Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
javawlp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
impresshs
javawlp
Commits
6e4ffdc5
Verified
Commit
6e4ffdc5
authored
7 years ago
by
Ogilvie, D.H. (Duncan)
Browse files
Options
Downloads
Patches
Plain Diff
more z3 python tests
parent
9f58f2ce
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/z3_tests/equivalence.py
+19
-7
19 additions, 7 deletions
src/z3_tests/equivalence.py
with
19 additions
and
7 deletions
src/z3_tests/equivalence.py
+
19
−
7
View file @
6e4ffdc5
...
...
@@ -34,21 +34,33 @@ def neq():
# Checks if "ForAll(x, x > 0) == ForAll(x, x < 0)", should give a counter example but doesn't!
def
neq_forall
():
x
=
Int
(
'
x
'
)
ast1
=
ForAll
(
x
,
x
>
0
)
s
=
Solver
()
x
=
Int
(
0
)
ast1
=
ForAll
(
x
,
x
>
0
,
patterns
=
[
x
])
print
"
ast1:
"
,
ast1
ast2
=
ForAll
(
x
,
x
<
0
)
y
=
Int
(
1
)
ast2
=
ForAll
(
y
,
y
<
0
,
patterns
=
[
y
])
print
"
ast2:
"
,
ast2
ast
=
ast1
!
=
ast2
print
ast
s
.
add
(
ast1
=
=
ast2
)
print
s
.
check
(),
s
.
model
()
print
"
model:
"
# Check if "ForAll(x, x > 0) == ForAll(x, x < 0)" by evaluating "Exists(x, (x > 0) != (x < 0))"
def
neq_forall2
():
x
=
Int
(
'
x
'
)
ast
=
(
x
>
0
)
!=
(
x
<
0
)
solve
(
Exists
(
x
,
ast
,
patterns
=
[
x
]))
solve
(
ast
)
# A <=> B means A => B and B => A, so if we prove (A & ~B), A => B doesn't hold so A != B
# - joao
eq
()
print
""
neq
()
print
""
neq_forall
()
\ No newline at end of file
neq_forall
()
print
""
neq_forall2
()
\ No newline at end of file
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