Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
caisar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
caisar
Commits
712afe63
Commit
712afe63
authored
3 years ago
by
Michele Alberti
Browse files
Options
Downloads
Patches
Plain Diff
Add support to axioms for input constraints.
parent
1525ffdd
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
engine.ml
+11
-1
11 additions, 1 deletion
engine.ml
property.ml
+6
-1
6 additions, 1 deletion
property.ml
property_lexer.mll
+4
-1
4 additions, 1 deletion
property_lexer.mll
property_parser.mly
+8
-8
8 additions, 8 deletions
property_parser.mly
property_types.mli
+3
-3
3 additions, 3 deletions
property_types.mli
with
32 additions
and
14 deletions
engine.ml
+
11
−
1
View file @
712afe63
...
@@ -68,8 +68,18 @@ let check_compatibility solver model =
...
@@ -68,8 +68,18 @@ let check_compatibility solver model =
S
.
name
S
.
name
(
Model
.
show_format
model
.
format
))
(
Model
.
show_format
model
.
format
))
let
tasks_of_property
solver
{
hypothesi
s
;
goals
}
=
let
tasks_of_property
solver
{
axiom
s
;
goals
}
=
let
module
S
=
(
val
solver
:
Solver
.
S
)
in
let
module
S
=
(
val
solver
:
Solver
.
S
)
in
let
hypothesis
=
match
axioms
with
|
[]
->
(* Axioms are non-empty lists. *)
assert
false
|
[
{
formula
;
_
}
]
->
formula
|
a
::
aa
->
List
.
fold_left
aa
~
init
:
a
.
formula
~
f
:
(
fun
acc
a
->
And
(
acc
,
a
.
formula
))
in
let
table
=
Hashtbl
.
create
(
module
String
)
in
let
table
=
Hashtbl
.
create
(
module
String
)
in
List
.
iter
List
.
iter
goals
goals
...
...
This diff is collapsed.
Click to expand it.
property.ml
+
6
−
1
View file @
712afe63
...
@@ -147,9 +147,14 @@ let pretty_goal fmt goal =
...
@@ -147,9 +147,14 @@ let pretty_goal fmt goal =
goal
.
name
goal
.
name
pretty_formula
goal
.
formula
pretty_formula
goal
.
formula
let
pretty_axiom
fmt
axiom
=
Format
.
fprintf
fmt
"@[<v 2>axiom %s:@ @[<hov>%a@]@]"
axiom
.
name
pretty_formula
axiom
.
formula
let
pretty
fmt
t
=
let
pretty
fmt
t
=
Format
.
fprintf
fmt
"@[%a@]@
\n
@[<v>%a@]"
Format
.
fprintf
fmt
"@[%a@]@
\n
@[<v>%a@]"
pretty_formula
t
.
hypothesi
s
(
Format
.
pp_print_list
pretty_axiom
)
t
.
axiom
s
(
Format
.
pp_print_list
pretty_goal
)
t
.
goals
(
Format
.
pp_print_list
pretty_goal
)
t
.
goals
...
...
This diff is collapsed.
Click to expand it.
property_lexer.mll
+
4
−
1
View file @
712afe63
...
@@ -14,6 +14,7 @@ let output = 'y'['0'-'9']+
...
@@ -14,6 +14,7 @@ let output = 'y'['0'-'9']+
(* Keywords. *)
(* Keywords. *)
let
goal
=
"goal"
let
goal
=
"goal"
let
axiom
=
"axiom"
(* Macros. *)
(* Macros. *)
...
@@ -42,10 +43,12 @@ rule token = parse
...
@@ -42,10 +43,12 @@ rule token = parse
{
INPUT
i
}
{
INPUT
i
}
|
output
as
o
|
output
as
o
{
OUTPUT
o
}
{
OUTPUT
o
}
|
axiom
{
AXIOM
}
|
goal
|
goal
{
GOAL
}
{
GOAL
}
|
(
ident
as
gid
)
space
*
":"
|
(
ident
as
gid
)
space
*
":"
{
GOAL
ID
gid
}
{
ID
gid
}
|
(
'
-
'
|
'
+
'
)
?
[
'
0
'
-
'
9
'
]
+
'.'
[
'
0
'
-
'
9
'
]
+
as
f
|
(
'
-
'
|
'
+
'
)
?
[
'
0
'
-
'
9
'
]
+
'.'
[
'
0
'
-
'
9
'
]
+
as
f
{
FLOAT
(
float_of_string
f
)
}
{
FLOAT
(
float_of_string
f
)
}
|
(
'
-
'
|
'
+
'
)
?
[
'
0
'
-
'
9
'
]
+
as
i
|
(
'
-
'
|
'
+
'
)
?
[
'
0
'
-
'
9
'
]
+
as
i
...
...
This diff is collapsed.
Click to expand it.
property_parser.mly
+
8
−
8
View file @
712afe63
...
@@ -8,12 +8,12 @@
...
@@ -8,12 +8,12 @@
%
token
<
int
>
INT
%
token
<
int
>
INT
%
token
<
float
>
FLOAT
%
token
<
float
>
FLOAT
%
token
<
string
>
INPUT
OUTPUT
GOAL
ID
%
token
<
string
>
INPUT
OUTPUT
ID
%
token
EQ
GT
LT
GE
LE
%
token
EQ
GT
LT
GE
LE
%
token
PLUS
MINUS
%
token
PLUS
MINUS
%
token
AND
OR
%
token
AND
OR
%
token
LPAREN
RPAREN
%
token
LPAREN
RPAREN
%
token
GOAL
%
token
AXIOM
GOAL
%
token
EOF
%
token
EOF
(* Starting rule. *)
(* Starting rule. *)
...
@@ -26,22 +26,22 @@
...
@@ -26,22 +26,22 @@
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
(* We parse a property given by
(* We parse a property given by
a
hypothesi
s
a
non-empty list of axiom
s
a non-empty list of goals
a non-empty list of goals
followed by an end-of-file. *)
followed by an end-of-file. *)
let
main
:=
let
main
:=
~
=
hypothesis
;
goals
=
nonempty_list
(
goal
);
EOF
;
{
{
hypothesi
s
;
goals
;
}
}
axioms
=
nonempty_list
(
axiom
)
;
goals
=
nonempty_list
(
goal
);
EOF
;
{
{
axiom
s
;
goals
;
}
}
(* A
hypothesis
is a conjunctive formula over constraints. *)
(* A
n axiom
is a conjunctive formula over constraints. *)
let
hypothesis
==
let
axiom
==
and_formula
(
constraint_
)
AXIOM
;
name
=
ID
;
formula
=
and_formula
(
constraint_
);
{
{
name
;
formula
;
}
}
(* A goal has a name and a formula. *)
(* A goal has a name and a formula. *)
let
goal
:=
let
goal
:=
GOAL
;
name
=
GOAL
ID
;
~
=
formula
;
{
{
name
;
formula
;
}
}
GOAL
;
name
=
ID
;
~
=
formula
;
{
{
name
;
formula
;
}
}
(* A formula is given by disjunctions of conjuctions of (delimited) formulae. *)
(* A formula is given by disjunctions of conjuctions of (delimited) formulae. *)
...
...
This diff is collapsed.
Click to expand it.
property_types.mli
+
3
−
3
View file @
712afe63
...
@@ -24,12 +24,12 @@ type formula =
...
@@ -24,12 +24,12 @@ type formula =
|
And
of
formula
*
formula
|
And
of
formula
*
formula
|
Or
of
formula
*
formula
|
Or
of
formula
*
formula
type
goal
=
{
type
named_formula
=
{
name
:
string
;
name
:
string
;
formula
:
formula
;
formula
:
formula
;
}
}
type
t
=
{
type
t
=
{
hypothesis
:
formula
;
axioms
:
named_
formula
list
;
goals
:
goal
list
;
goals
:
named_formula
list
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment