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

Tree-order failures #6654

Closed
LeventErkok opened this issue Mar 29, 2023 · 2 comments
Closed

Tree-order failures #6654

LeventErkok opened this issue Mar 29, 2023 · 2 comments

Comments

@LeventErkok
Copy link

According to the guide (https://microsoft.github.io/z3guide/docs/theories/Special%20Relations/), amongst other properties, a tree-order is reflexive, and satisfies:

 (assert (forall ((x A) (y A) (z A)) (=> (and (R x y) (R x z)) (or (R y z) (R z y)))))

Looks like both are failing in z3:

Reflexivity:

(declare-sort A 0)
(define-fun R ((x A) (y A)) Bool ((_ tree-order 0) x y))

(declare-const a A)
(assert (not (R a a)))
(check-sat)

This prints sat.

For the second axiom:

(declare-sort A 0)
(define-fun R ((x A) (y A)) Bool ((_ tree-order 0) x y))

(declare-const x A)
(declare-const y A)
(declare-const z A)
(assert (not (forall ((x A) (y A) (z A)) (=> (and (R x y) (R x z)) (or (R y z) (R z y))))))
(check-sat)

which also prints sat.

@NikolajBjorner
Copy link
Contributor

Maybe a switcharound, the following is unsat

(declare-sort A 0)
(define-fun R ((x A) (y A)) Bool ((_ tree-order 0) x y))

(declare-const x A)
(declare-const y A)
(declare-const z A)
(assert (not (forall ((x A) (y A) (z A)) (=> (and (R y x) (R z x)) (or (R y z) (R z y))))))
(check-sat)
(exit)

NikolajBjorner added a commit that referenced this issue Mar 31, 2023
fix reflexivity for tree-order
@NikolajBjorner
Copy link
Contributor

I checked the code again and concluded this is a documentation bug.
The intent is reversed of the documentation you cite. I have updated the documentation on z3guide.

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

2 participants