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

[HACK_FIX] Using (get-model) breaks the logs #100

Closed
JonasAlaif opened this issue Jan 1, 2025 · 1 comment · Fixed by #101
Closed

[HACK_FIX] Using (get-model) breaks the logs #100

JonasAlaif opened this issue Jan 1, 2025 · 1 comment · Fixed by #101
Labels
z3-issue This can only be fixed in z3

Comments

@JonasAlaif
Copy link
Collaborator

JonasAlaif commented Jan 1, 2025

The following smt2 file, run through all z3 versions, results in a log which fails to parse the quantifier instantiation at the second assert:

(push)(pop) ; This switches to incremental, which makes the log cleaner?
(declare-fun f (Int) Bool)

(assert (forall ((i Int))
    (!  (not (f i))
        :pattern ((f i))
    )))

(check-sat)
(get-model)

(assert (f 0))
(check-sat)

The resulting log: z3.log. The issue is that z3 creates string and ident terms in a separate namespace for the (get-model) but fails to note this in the log. Thus the term IDs clash with the term ID for the quantifier, and when the later instantiation line refers to the quantifier by its ID we find a string term and not a quantifier.
Related z3 source code here.

@JonasAlaif JonasAlaif added the z3-issue This can only be fixed in z3 label Jan 1, 2025
@JonasAlaif JonasAlaif changed the title Using (get-model) breaks the logs [HACK_FIX] Using (get-model) breaks the logs Jan 6, 2025
@JonasAlaif
Copy link
Collaborator Author

This issue is due to a bug in z3.

Description

z3 creates terms for the string literals it will print for (get-model) and logs them as new terms in the logfile. See here. Internally in z3 these are likely in a different namespace/object, but in the logfile these terms appear as term IDs without a namespace (e.g. #13). The issue is that these IDs clash with existing terms which still exist and thus the "term ID" to TermIdx mapping is broken in our tool.

Hack fix

The only way to differentiate these "false" new terms is by their name. Therefore we do this and forbid the set of names z3 uses for these special terms in .smt2 files to avoid misidentifying user terms as these special ones. The special terms are still parsed (though they could also be ignored) but are given a new fake namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
z3-issue This can only be fixed in z3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant