Skip to content

Obtaining the computed patterns for quantifiers from the API #6839

Closed Answered by NikolajBjorner
Philipp15b asked this question in Q&A
Discussion options

You must be logged in to vote

There isn't a self-contained way to get these patterns.
They get compiled within the solvers. You can retrieve assertions after a solver has run for a little while (set max-conflicts to bound time in search).

from z3 import *
s = SimpleSolver()
f = Function('f', IntSort(), IntSort(), IntSort())
g = Function('g', IntSort(), IntSort(), IntSort())
x, y = Ints('x y')
s.add(ForAll([x,y], f(x,y) == g(x,y)))
set_option(verbose=10)
s.set("smt.max_conflicts", 0)
print(s.check())
for f in s.assertions():
    print(f)
    for i in range(f.num_patterns()):
        print(f.pattern(i))

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Philipp15b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants