kdrag.smt.substitute_body

kdrag.smt.substitute_body(q: QuantifierRef, *ts: ExprRef) → ExprRef

Substitute into a quantifier or lambda, checking arity and exact sorts.

Terms follow binder order, unlike smt.substitute_vars’s de Bruijn order. Python literals must be converted to expressions by the caller. Z3 itself does not enforce sorts and can silently leave loose variables on mismatch.

>>> r, n = Real("r"), Int("n")
>>> substitute_body(Lambda([r, n], r + n), RealVal(42), IntVal(7))
42 + ToReal(7)
Parameters:
  • q (QuantifierRef)

  • ts (ExprRef)

Return type:

ExprRef