Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Results from consequences Interface Based on Constant Names #6916

Closed
ptr1120 opened this issue Sep 22, 2023 · 1 comment
Closed

Comments

@ptr1120
Copy link
Contributor

ptr1120 commented Sep 22, 2023

Summary:
I'm encountering inconsistent outcomes between the check and consequences methods when using the Z3 Python and dotnet API. The results differ based on the naming of constants. I have tested this behavior across Z3 versions 4.11.2 to 4.12.2.

Details:
When using the following snippet that employs Z3's Python API, the consequences method returns "unknown" while the check method returns "sat".

from z3 import *
a = Bool('a')
b = Bool('b')
c = Bool('c')
r = Bool('r_abc')
i = Int('int')

solver = Solver()
cardinality = And(AtLeast(a, b, c, 1), AtMost(a, b, c, 1))
reification = Implies(r, cardinality)
solver.add(reification)
intBound = And(i >= 1, i <= 1)
solver.add(intBound)

print(solver.check()) # Output: sat
print(solver.consequences([r],[a,b,c,r,i])) # Output: unknown

However, if the name of the integer constant is changed from 'int' to 'integer', both methods return "sat".

from z3 import *
a = Bool('a')
b = Bool('b')
c = Bool('c')
r = Bool('r_abc')
i = Int('integer')

solver = Solver()
cardinality = And(AtLeast(a, b, c, 1), AtMost(a, b, c, 1))
reification = Implies(r, cardinality)
solver.add(reification)
intBound = And(i >= 1, i <= 1)
solver.add(intBound)

print(solver.check()) # Output: sat
print(solver.consequences([r],[a,b,c,r,i])) # Output: sat

Additionally, varying the integer bounds or other constant names also leads to inconsistent results.

Query:
Any idea that helps identify the underlying issue causing this inconsistent behavior?

Thanks,
Peter

@LeventErkok
Copy link

LeventErkok commented Sep 22, 2023

(Possibly) Related: #4600

NikolajBjorner added a commit that referenced this issue Sep 23, 2023
short circuiting equality consequence appears to have the wrong sign
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Sep 24, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Sep 24, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Sep 24, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Sep 24, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Sep 25, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Sep 25, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Sep 25, 2023
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jun 29, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jun 30, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 1, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 2, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 3, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 4, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 4, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 4, 2024
ptr1120 added a commit to ptr1120/z3-patched that referenced this issue Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants