Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
119
Issues
119
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
c50d0346
Commit
c50d0346
authored
Feb 18, 2010
by
Jean-Christophe Filliâtre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uses = declaration comme une autre ; retablissement du . dans la syntaxe de forall/exists
parent
644ef011
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
29 deletions
+45
-29
TODO
TODO
+5
-8
src/parser.mly
src/parser.mly
+6
-11
src/ptree.mli
src/ptree.mli
+2
-1
src/test.why
src/test.why
+29
-7
src/typing.ml
src/typing.ml
+3
-2
No files found.
TODO
View file @
c50d0346
...
...
@@ -2,14 +2,7 @@
syntaxe
-------
- le point (.) dans les noms qualifiés introduit un conflit dans la syntaxe
de forall/exists
forall x : a. b
forall x : a.b: c
-> changement temporaire de syntaxe pour forall / exists : virgule
plutôt que point
- open
sémantique
...
...
@@ -17,3 +10,7 @@ s
- uses : pour l'instant, l'ordre des théories dans le fichier est important
i.e. les théories mentionnées par uses doivent être définies précédemment
- open (et échouer si "open A" et "open B" avec A et B déclarant un symbole
de même nom)
src/parser.mly
View file @
c50d0346
...
...
@@ -208,6 +208,8 @@ decl:
{
let
loc
,
vl
,
id
=
$
3
in
TypeDecl
(
loc
,
true
,
vl
,
id
)
}
|
TYPE
typedecl
typedefn
{
let
loc
,
vl
,
id
=
$
2
in
$
3
loc
vl
id
}
|
USES
list1_ident_sep_comma
{
Uses
(
loc
()
,
$
2
)
}
;
list1_theory
:
...
...
@@ -218,15 +220,8 @@ list1_theory:
;
theory
:
|
THEORY
ident
uses
list0_decl
END
{
Theory
({
th_loc
=
loc
()
;
th_name
=
$
2
;
th_uses
=
$
3
;
th_decl
=
$
4
})
}
;
uses
:
|
/*
epsilon
*/
{
[]
}
|
USES
list1_ident_sep_comma
{
$
2
}
|
THEORY
ident
list0_decl
END
{
Theory
({
th_loc
=
loc
()
;
th_name
=
$
2
;
th_decl
=
$
3
})
}
;
typedecl
:
...
...
@@ -385,14 +380,14 @@ lexpr:
|
IF
lexpr
THEN
lexpr
ELSE
lexpr
%
prec
prec_if
{
mk_pp
(
PPif
(
$
2
,
$
4
,
$
6
))
}
|
FORALL
list1_ident_sep_comma
COLON
primitive_type
triggers
COMMA
lexpr
%
prec
prec_forall
DOT
lexpr
%
prec
prec_forall
{
let
rec
mk
=
function
|
[]
->
assert
false
|
[
id
]
->
mk_pp
(
PPforall
(
id
,
$
4
,
$
5
,
$
7
))
|
id
::
l
->
mk_pp
(
PPforall
(
id
,
$
4
,
[]
,
mk
l
))
in
mk
$
2
}
|
EXISTS
ident
COLON
primitive_type
COMMA
lexpr
%
prec
prec_exists
|
EXISTS
ident
COLON
primitive_type
DOT
lexpr
%
prec
prec_exists
{
mk_pp
(
PPexists
(
$
2
,
$
4
,
$
6
))
}
|
INTEGER
{
mk_pp
(
PPconst
(
ConstInt
$
1
))
}
...
...
src/ptree.mli
View file @
c50d0346
...
...
@@ -83,7 +83,6 @@ type uses = ident
type
theory
=
{
th_loc
:
loc
;
th_name
:
ident
;
th_uses
:
uses
list
;
th_decl
:
logic_decl
list
;
}
...
...
@@ -99,5 +98,7 @@ and logic_decl =
|
AlgType
of
(
loc
*
ident
list
*
ident
*
(
loc
*
ident
*
ppure_type
list
)
list
)
list
|
Theory
of
theory
|
Uses
of
loc
*
uses
list
type
logic_file
=
logic_decl
list
src/test.why
View file @
c50d0346
(* test file *)
theory A
type t
logic c:t
end
theory B
uses A
logic d : A.t
logic p : A.t -> prop
end
theory C
uses B
logic e : B.A.t
axiom test : B.p(B.A.c)
end
theory Int
type int
...
...
@@ -9,8 +31,6 @@ end
theory List
uses Int
type 'a list
logic nil : 'a list
...
...
@@ -19,6 +39,8 @@ theory List
logic is_nil : 'a list -> prop
uses Int
logic length : 'a list -> Int.int
end
...
...
@@ -31,8 +53,6 @@ end
theory set
uses Eq
type elt
type t
...
...
@@ -41,11 +61,13 @@ theory set
logic empty : t
axiom empty_def1 : forall x:elt
,
not in_(x, empty)
axiom empty_def1 : forall x:elt
.
not in_(x, empty)
logic add : elt, t -> t
axiom add_def1 : forall x,y:elt, forall s:t,
uses Eq
axiom add_def1 : forall x,y:elt. forall s:t.
in_(x, add(y, s)) <-> (Eq.eq(x, y) or in_(x, s))
end
...
...
@@ -54,7 +76,7 @@ theory test
uses Eq, List
axiom a : forall x : 'a
,
not Eq.eq(List.nil, List.cons(List.nil, List.nil))
axiom a : forall x : 'a
.
not Eq.eq(List.nil, List.cons(List.nil, List.nil))
end
src/typing.ml
View file @
c50d0346
...
...
@@ -483,6 +483,8 @@ let rec add_decl env = function
axiom
loc
s
f
env
|
Theory
th
->
add_theory
th
env
|
Uses
(
loc
,
uses
)
->
List
.
fold_left
add_global_theory
env
uses
|
_
->
assert
false
(*TODO*)
...
...
@@ -491,8 +493,7 @@ and add_decls env = List.fold_left add_decl env
and
add_theory
th
env
=
let
id
=
th
.
th_name
.
id
in
if
M
.
mem
id
env
.
theories
then
error
~
loc
:
th
.
th_loc
(
ClashTheory
id
);
let
th_env
=
List
.
fold_left
add_global_theory
empty
th
.
th_uses
in
let
th_env
=
add_decls
th_env
th
.
th_decl
in
let
th_env
=
add_decls
empty
th
.
th_decl
in
Hashtbl
.
add
loaded_theories
id
th_env
;
env
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment