An ApplyResult object contains the subgoals produced by a tactic when applied to a goal. It also contains model and proof converters.
Definition at line 7608 of file z3py.py.
def __getitem__ |
( |
|
self, |
|
|
|
idx |
|
) |
| |
Return one of the subgoals stored in ApplyResult object `self`.
>>> a, b = Ints('a b')
>>> g = Goal()
>>> g.add(Or(a == 0, a == 1), Or(b == 0, b == 1), a > b)
>>> t = Tactic('split-clause')
>>> r = t(g)
>>> r[0]
[a == 0, Or(b == 0, b == 1), a > b]
>>> r[1]
[a == 1, Or(b == 0, b == 1), a > b]
Definition at line 7642 of file z3py.py.
7642 def __getitem__(self, idx):
7643 """Return one of the subgoals stored in ApplyResult object `self`.
7645 >>> a, b = Ints('a b')
7647 >>> g.add(Or(a == 0, a == 1), Or(b == 0, b == 1), a > b)
7648 >>> t = Tactic('split-clause')
7651 [a == 0, Or(b == 0, b == 1), a > b]
7653 [a == 1, Or(b == 0, b == 1), a > b]
7655 if idx >= len(self):
Return the number of subgoals in `self`.
>>> a, b = Ints('a b')
>>> g = Goal()
>>> g.add(Or(a == 0, a == 1), Or(b == 0, b == 1), a > b)
>>> t = Tactic('split-clause')
>>> r = t(g)
>>> len(r)
2
>>> t = Then(Tactic('split-clause'), Tactic('split-clause'))
>>> len(t(g))
4
>>> t = Then(Tactic('split-clause'), Tactic('split-clause'), Tactic('propagate-values'))
>>> len(t(g))
1
Definition at line 7623 of file z3py.py.
7624 """Return the number of subgoals in `self`.
7626 >>> a, b = Ints('a b')
7628 >>> g.add(Or(a == 0, a == 1), Or(b == 0, b == 1), a > b)
7629 >>> t = Tactic('split-clause')
7633 >>> t = Then(Tactic('split-clause'), Tactic('split-clause'))
7636 >>> t = Then(Tactic('split-clause'), Tactic('split-clause'), Tactic('propagate-values'))
Return a Z3 expression consisting of all subgoals.
>>> x = Int('x')
>>> g = Goal()
>>> g.add(x > 1)
>>> g.add(Or(x == 2, x == 3))
>>> r = Tactic('simplify')(g)
>>> r
[[Not(x <= 1), Or(x == 2, x == 3)]]
>>> r.as_expr()
And(Not(x <= 1), Or(x == 2, x == 3))
>>> r = Tactic('split-clause')(g)
>>> r
[[x > 1, x == 2], [x > 1, x == 3]]
>>> r.as_expr()
Or(And(x > 1, x == 2), And(x > 1, x == 3))
Definition at line 7667 of file z3py.py.
7668 """Return a Z3 expression consisting of all subgoals.
7673 >>> g.add(Or(x == 2, x == 3))
7674 >>> r = Tactic('simplify')(g)
7676 [[Not(x <= 1), Or(x == 2, x == 3)]]
7678 And(Not(x <= 1), Or(x == 2, x == 3))
7679 >>> r = Tactic('split-clause')(g)
7681 [[x > 1, x == 2], [x > 1, x == 3]]
7683 Or(And(x > 1, x == 2), And(x > 1, x == 3))
7687 return BoolVal(
False, self.ctx)
7689 return self[0].as_expr()
7691 return Or([ self[i].as_expr()
for i
in range(len(self)) ])