kdrag.kernel

The kernel hold core proof datatypes and core inference rules. By and large, all proofs must flow through this module.

Module Attributes

defns

defn holds definitional axioms for function symbols.

Functions

FreshVar(prefix, sort)

Generate a fresh variable.

Inductive(name[, ctx])

Declare datatypes with auto generated induction principles.

andI(pfs)

Prove an and from two kd.Proofs of its conjuncts.

axiom(thm[, by])

Assert an axiom.

compose(ab, bc)

Compose two implications.

define(name, args, body)

Define a non recursive definition.

define_fix(name, args, retsort, fix_lam)

Define a recursive definition.

ext(domain, range_)

forget(ts, thm)

"Forget" a term using existentials.

fresh_const(q[, prefixes])

Generate fresh constants of same sort as quantifier.

generalize(vs, pf)

Generalize a theorem with respect to a list of schema variables.

herb(thm[, prefixes])

Herbrandize a theorem.

induct_inductive(x, P)

Build a basic induction principle for an algebraic datatype

instan(ts, pf)

Instantiate a universally quantified formula.

is_defined(x)

Determined if expression head is in definitions.

is_fresh_var(v)

Check if a variable is a schema variable.

is_proof(p)

modus(ab, a)

Modus ponens for implies and equality.

obtain(thm)

Skolemize an existential quantifier.

prove(thm[, by, admit, timeout, dump, solver])

Prove a theorem using a list of previously proved lemmas.

rename_vars2(pf, vs[, patterns, no_patterns])

Rename bound variables and also attach triggers

specialize(ts, thm)

Instantiate a universally quantified formula forall xs, P(xs) -> P(ts) This is forall elimination

subst(t, eqs)

Substitute using equality proofs

unfold(e, decls)

Unfold function definitions in an expression.

Classes

Defn(name, decl, args, body, ax, _subst_fun_body)

A record storing definition.

Judgement()

Judgements should be constructed by smart constructors.

Proof(thm, reason[, admit])

It is unlikely that users should be accessing the Proof constructor directly.

Exceptions

LemmaError

class kdrag.kernel.Defn(name: str, decl: FuncDeclRef, args: list[ExprRef], body: ExprRef, ax: Proof, _subst_fun_body: ExprRef)

Bases: Judgement

A record storing definition. It is useful to record definitions as special axioms because we often must unfold them.

Parameters:
  • name (str)

  • decl (FuncDeclRef)

  • args (list[ExprRef])

  • body (ExprRef)

  • ax (Proof)

  • _subst_fun_body (ExprRef)

args: list[ExprRef]
ax: Proof
body: ExprRef
decl: FuncDeclRef
name: str
kdrag.kernel.FreshVar(prefix: str, sort: SortRef) ExprRef

Generate a fresh variable. This is distinguished from FreshConst by the fact that it has freshness evidence. This is intended to be used for constants that represent arbitrary terms (implicitly universally quantified). For example, axioms like c_fresh = t should never be asserted about bare FreshVars as they imply a probably inconsistent axiom, whereas asserting such an axiom about FreshConst is ok, effectively defining a new rigid constant.

>>> FreshVar("x", smt.IntSort()).fresh_evidence
_FreshVarEvidence(v=x!...)
Parameters:
  • prefix (str)

  • sort (SortRef)

Return type:

ExprRef

kdrag.kernel.Inductive(name: str, ctx=None) Datatype

Declare datatypes with auto generated induction principles. Wrapper around z3.Datatype

>>> Nat = Inductive("Nat")
>>> Nat.declare("zero")
>>> Nat.declare("succ", ("pred", Nat))
>>> Nat = Nat.create()
>>> Nat.succ(Nat.zero)
succ(zero)
Parameters:

name (str)

Return type:

Datatype

class kdrag.kernel.Judgement

Bases: object

Judgements should be constructed by smart constructors. Having an object of supertype judgement represents having shown some kind of truth. Judgements are the things that go above and below inference lines in a proof system. Don’t worry about it. It is just nice to have a name for the concept.

See: - https://en.wikipedia.org/wiki/Judgment_(mathematical_logic) - https://mathoverflow.net/questions/254518/what-exactly-is-a-judgement - https://ncatlab.org/nlab/show/judgment

exception kdrag.kernel.LemmaError

Bases: Exception

add_note(note, /)

Add a note to the exception

args
with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

class kdrag.kernel.Proof(thm: BoolRef, reason: list[Any], admit: bool = False)

Bases: Judgement

It is unlikely that users should be accessing the Proof constructor directly. This is not ironclad. If you really want the Proof constructor, I can’t stop you.

Parameters:
  • thm (BoolRef)

  • reason (list[Any])

  • admit (bool)

__call__(*args: ExprRef | Proof)
>>> x,y = smt.Ints("x y")
>>> p = prove(smt.ForAll([y], smt.ForAll([x], x >= x - 1)))
>>> p(x)
|= ForAll(x, x >= x - 1)
>>> p(x, 7)
|= 7 >= 7 - 1
>>> a,b,c = smt.Bools("a b c")
>>> ab = prove(smt.Implies(a,smt.Implies(a, a)))
>>> a = axiom(a)
>>> ab(a)
|= Implies(a, a)
>>> ab(a,a)
|= a
Parameters:

args (ExprRef | Proof)

admit: bool = False
forall(fresh_vars: list[ExprRef]) Proof

Generalize a proof involved schematic variables generated by FreshVar

>>> x = FreshVar("x", smt.IntSort())
>>> prove(x + 1 > x).forall([x])
|= ForAll(x!..., x!... + 1 > x!...)
Parameters:

fresh_vars (list[ExprRef])

Return type:

Proof

reason: list[Any]
thm: BoolRef
kdrag.kernel.andI(pfs: Sequence[Proof]) Proof

Prove an and from two kd.Proofs of its conjuncts.

>>> a, b = smt.Bools("a b")
>>> pa = kd.axiom(smt.Implies(True, a))
>>> pb = kd.axiom(smt.Implies(True, b))
>>> andI([pa, pb, pb])
|= Implies(True, And(a, b, b))
Parameters:

pfs (Sequence[Proof])

Return type:

Proof

kdrag.kernel.axiom(thm: BoolRef, by=['axiom']) Proof

Assert an axiom.

Axioms are necessary and useful. But you must use great care.

Parameters:
  • thm (BoolRef) – The axiom to assert.

  • by – A python object explaining why the axiom should exist. Often a string explaining the axiom.

Return type:

Proof

kdrag.kernel.compose(ab: Proof, bc: Proof) Proof

Compose two implications. Useful for chaining implications.

>>> a,b,c = smt.Bools("a b c")
>>> ab = axiom(smt.Implies(a, b))
>>> bc = axiom(smt.Implies(b, c))
>>> compose(ab, bc)
|= Implies(a, c)
Parameters:
Return type:

Proof

kdrag.kernel.define(name: str, args: list[ExprRef], body: ExprRef) FuncDeclRef

Define a non recursive definition. Useful for shorthand and abstraction. Does not currently defend against ill formed definitions. TODO: Check for bad circularity, record dependencies

Parameters:
  • name (str) – The name of the term to define.

  • args (list[ExprRef]) – The arguments of the term.

  • defn – The definition of the term.

  • body (ExprRef)

Returns:

A tuple of the defined term and the proof of the definition.

Return type:

tuple[smt.FuncDeclRef, Proof]

kdrag.kernel.define_fix(name: str, args: list[ExprRef], retsort, fix_lam) FuncDeclRef

Define a recursive definition.

Parameters:
  • name (str)

  • args (list[ExprRef])

Return type:

FuncDeclRef

kdrag.kernel.defns: dict[FuncDeclRef, Defn] = {Array.add: Defn(name='Array.add', decl=Array.add, args=[f, g], body=Lambda(x, f[x] + g[x]), ax=|= ForAll([f, g], Array.add(f, g) == (Lambda(x, f[x] + g[x]))), _subst_fun_body=Lambda(x, Var(1)[x] + Var(2)[x])), Array.add: Defn(name='Array.add', decl=Array.add, args=[a, b], body=Lambda(i, a[i] + b[i]), ax=|= ForAll([a, b], Array.add(a, b) == (Lambda(i, a[i] + b[i]))), _subst_fun_body=Lambda(i, Var(1)[i] + Var(2)[i])), Array.choose: Defn(name='Array.choose', decl=Array.choose, args=[P], body=If(P[True], True, False), ax=|= ForAll(P, Array.choose(P) == If(P[True], True, False)), _subst_fun_body=If(Var(0)[True], True, False)), Array.choose: Defn(name='Array.choose', decl=Array.choose, args=[P], body=search(P, 0), ax=|= ForAll(P, Array.choose(P) == search(P, 0)), _subst_fun_body=search(Var(0), 0)), Array.div_: Defn(name='Array.div_', decl=Array.div_, args=[f, g], body=Lambda(x, f[x]/g[x]), ax=|= ForAll([f, g], Array.div_(f, g) == (Lambda(x, f[x]/g[x]))), _subst_fun_body=Lambda(x, Var(1)[x]/Var(2)[x])), Array.div_: Defn(name='Array.div_', decl=Array.div_, args=[a, b], body=Lambda(i, a[i]/b[i]), ax=|= ForAll([a, b], Array.div_(a, b) == (Lambda(i, a[i]/b[i]))), _subst_fun_body=Lambda(i, Var(1)[i]/Var(2)[i])), Array.mul: Defn(name='Array.mul', decl=Array.mul, args=[f, g], body=Lambda(x, f[x]*g[x]), ax=|= ForAll([f, g], Array.mul(f, g) == (Lambda(x, f[x]*g[x]))), _subst_fun_body=Lambda(x, Var(1)[x]*Var(2)[x])), Array.mul: Defn(name='Array.mul', decl=Array.mul, args=[a, b], body=Lambda(i, a[i]*b[i]), ax=|= ForAll([a, b], Array.mul(a, b) == (Lambda(i, a[i]*b[i]))), _subst_fun_body=Lambda(i, Var(1)[i]*Var(2)[i])), Array.neg: Defn(name='Array.neg', decl=Array.neg, args=[a], body=Lambda(i, -a[i]), ax=|= ForAll(a, Array.neg(a) == (Lambda(i, -a[i]))), _subst_fun_body=Lambda(i, -Var(1)[i])), Array.open: Defn(name='Array.open', decl=Array.open, args=[A], body=Or(A == K(Sierpinski, False),    A == K(Sierpinski, True),    A == Store(K(Sierpinski, False), S1, True)), ax=|= ForAll(A,        Array.open(A) ==        Or(A == K(Sierpinski, False),           A == K(Sierpinski, True),           A == Store(K(Sierpinski, False), S1, True))), _subst_fun_body=Or(Var(0) == K(Sierpinski, False),    Var(0) == K(Sierpinski, True),    Var(0) == Store(K(Sierpinski, False), S1, True))), Array.sub: Defn(name='Array.sub', decl=Array.sub, args=[f, g], body=Lambda(x, f[x] - g[x]), ax=|= ForAll([f, g], Array.sub(f, g) == (Lambda(x, f[x] - g[x]))), _subst_fun_body=Lambda(x, Var(1)[x] - Var(2)[x])), Array.sub: Defn(name='Array.sub', decl=Array.sub, args=[a, b], body=Lambda(i, a[i] - b[i]), ax=|= ForAll([a, b], Array.sub(a, b) == (Lambda(i, a[i] - b[i]))), _subst_fun_body=Lambda(i, Var(1)[i] - Var(2)[i])), Atom.fresh: Defn(name='Atom.fresh', decl=Atom.fresh, args=[x, a], body=a != x, ax=|= ForAll([x, a], Atom.fresh(x, a) == a != x), _subst_fun_body=Var(1) != Var(0)), Atom.swap: Defn(name='Atom.swap', decl=Atom.swap, args=[x, a, b], body=If(x == a, b, If(x == b, a, x)), ax=|= ForAll([x, a, b],        Atom.swap(x, a, b) == If(x == a, b, If(x == b, a, x))), _subst_fun_body=If(Var(0) == Var(1),    Var(2),    If(Var(0) == Var(2), Var(1), Var(0)))), BitVecN.to_int: Defn(name='BitVecN.to_int', decl=BitVecN.to_int, args=[x], body=If(Length(val(x)) == 0,    0,    BV2Int(Nth(val(x), 0)) +    2*    BitVecN.to_int(BitVecN(seq.extract(val(x),                                       1,                                       Length(val(x)) - 1)))), ax=|= ForAll(x,        BitVecN.to_int(x) ==        If(Length(val(x)) == 0,           0,           BV2Int(Nth(val(x), 0)) +           2*           BitVecN.to_int(BitVecN(seq.extract(val(x),                                         1,                                         Length(val(x)) - 1))))), _subst_fun_body=If(Length(val(Var(0))) == 0,    0,    BV2Int(Nth(val(Var(0)), 0)) +    2*    BitVecN.to_int(BitVecN(seq.extract(val(Var(0)),                                       1,                                       Length(val(Var(0))) -                                       1))))), C.add: Defn(name='C.add', decl=C.add, args=[z1, z2], body=C(re(z1) + re(z2), im(z1) + im(z2)), ax=|= ForAll([z1, z2],        C.add(z1, z2) == C(re(z1) + re(z2), im(z1) + im(z2))), _subst_fun_body=C(re(Var(0)) + re(Var(1)), im(Var(0)) + im(Var(1)))), C.div_: Defn(name='C.div_', decl=C.div_, args=[z1, z2], body=C((re(z1)*re(z2) + im(z1)*im(z2))/(re(z2)**2 + im(z2)**2),   (im(z1)*re(z2) - re(z1)*im(z2))/(re(z2)**2 + im(z2)**2)), ax=|= ForAll([z1, z2],        C.div_(z1, z2) ==        C((re(z1)*re(z2) + im(z1)*im(z2))/          (re(z2)**2 + im(z2)**2),          (im(z1)*re(z2) - re(z1)*im(z2))/          (re(z2)**2 + im(z2)**2))), _subst_fun_body=C((re(Var(0))*re(Var(1)) + im(Var(0))*im(Var(1)))/   (re(Var(1))**2 + im(Var(1))**2),   (im(Var(0))*re(Var(1)) - re(Var(0))*im(Var(1)))/   (re(Var(1))**2 + im(Var(1))**2))), C.mul: Defn(name='C.mul', decl=C.mul, args=[z1, z2], body=C(re(z1)*re(z2) - im(z1)*im(z2),   re(z1)*im(z2) + im(z1)*re(z2)), ax=|= ForAll([z1, z2],        C.mul(z1, z2) ==        C(re(z1)*re(z2) - im(z1)*im(z2),          re(z1)*im(z2) + im(z1)*re(z2))), _subst_fun_body=C(re(Var(0))*re(Var(1)) - im(Var(0))*im(Var(1)),   re(Var(0))*im(Var(1)) + im(Var(0))*re(Var(1)))), EPosReal.wf: Defn(name='EPosReal.wf', decl=EPosReal.wf, args=[x], body=Implies(is(real, x), val(x) >= 0), ax=|= ForAll(x,        EPosReal.wf(x) == Implies(is(real, x), val(x) >= 0)), _subst_fun_body=Implies(is(real, Var(0)), val(Var(0)) >= 0)), EReal.add: Defn(name='EReal.add', decl=EReal.add, args=[x, y], body=If(And(is(Real, x), is(Real, y)),    Real(val(x) + val(y)),    If(And(is(Inf, x), Not(is(NegInf, y))),       Inf,       If(And(Not(is(NegInf, x)), is(Inf, y)),          Inf,          If(And(is(NegInf, x), Not(is(Inf, y))),             NegInf,             If(And(Not(is(Inf, x)), is(NegInf, y)),                NegInf,                add_undef(x, y)))))), ax=|= ForAll([x, y],        EReal.add(x, y) ==        If(And(is(Real, x), is(Real, y)),           Real(val(x) + val(y)),           If(And(is(Inf, x), Not(is(NegInf, y))),              Inf,              If(And(Not(is(NegInf, x)), is(Inf, y)),                 Inf,                 If(And(is(NegInf, x), Not(is(Inf, y))),                    NegInf,                    If(And(Not(is(Inf, x)), is(NegInf, y)),                       NegInf,                       add_undef(x, y))))))), _subst_fun_body=If(And(is(Real, Var(0)), is(Real, Var(1))),    Real(val(Var(0)) + val(Var(1))),    If(And(is(Inf, Var(0)), Not(is(NegInf, Var(1)))),       Inf,       If(And(Not(is(NegInf, Var(0))), is(Inf, Var(1))),          Inf,          If(And(is(NegInf, Var(0)), Not(is(Inf, Var(1)))),             NegInf,             If(And(Not(is(Inf, Var(0))), is(NegInf, Var(1))),                NegInf,                add_undef(Var(0), Var(1)))))))), EReal.le: Defn(name='EReal.le', decl=EReal.le, args=[x, y], body=If(x == y,    True,    If(is(NegInf, x),       True,       If(is(Inf, y),          True,          If(is(NegInf, y),             False,             If(is(Inf, x),                False,                If(And(is(Real, x), is(Real, y)),                   val(x) <= val(y),                   unreachable!1010)))))), ax=|= ForAll([x, y],        EReal.le(x, y) ==        If(x == y,           True,           If(is(NegInf, x),              True,              If(is(Inf, y),                 True,                 If(is(NegInf, y),                    False,                    If(is(Inf, x),                       False,                       If(And(is(Real, x), is(Real, y)),                          val(x) <= val(y),                          unreachable!1010))))))), _subst_fun_body=If(Var(0) == Var(1),    True,    If(is(NegInf, Var(0)),       True,       If(is(Inf, Var(1)),          True,          If(is(NegInf, Var(1)),             False,             If(is(Inf, Var(0)),                False,                If(And(is(Real, Var(0)), is(Real, Var(1))),                   val(Var(0)) <= val(Var(1)),                   unreachable!1010))))))), Interval.add: Defn(name='Interval.add', decl=Interval.add, args=[i, j], body=Interval(lo(i) + lo(j), hi(i) + hi(j)), ax=|= ForAll([i, j],        Interval.add(i, j) ==        Interval(lo(i) + lo(j), hi(i) + hi(j))), _subst_fun_body=Interval(lo(Var(0)) + lo(Var(1)), hi(Var(0)) + hi(Var(1)))), Interval.sub: Defn(name='Interval.sub', decl=Interval.sub, args=[i, j], body=Interval(lo(i) - hi(j), hi(i) - lo(j)), ax=|= ForAll([i, j],        Interval.sub(i, j) ==        Interval(lo(i) - hi(j), hi(i) - lo(j))), _subst_fun_body=Interval(lo(Var(0)) - hi(Var(1)), hi(Var(0)) - lo(Var(1)))), KnownBits_1.and_: Defn(name='KnownBits_1.and_', decl=KnownBits_1.and_, args=[x, y], body=KnownBits_1(ones(x) & ones(y),             ~(~unknowns(x) & ~ones(x) |               ~unknowns(y) & ~ones(y) |               ones(x) & ones(y))), ax=|= ForAll([x, y],        KnownBits_1.and_(x, y) ==        KnownBits_1(ones(x) & ones(y),                    ~(~unknowns(x) & ~ones(x) |                      ~unknowns(y) & ~ones(y) |                      ones(x) & ones(y)))), _subst_fun_body=KnownBits_1(ones(Var(0)) & ones(Var(1)),             ~(~unknowns(Var(0)) & ~ones(Var(0)) |               ~unknowns(Var(1)) & ~ones(Var(1)) |               ones(Var(0)) & ones(Var(1))))), KnownBits_1.invert: Defn(name='KnownBits_1.invert', decl=KnownBits_1.invert, args=[x], body=KnownBits_1(~unknowns(x) & ~ones(x), unknowns(x)), ax=|= ForAll(x,        KnownBits_1.invert(x) ==        KnownBits_1(~unknowns(x) & ~ones(x), unknowns(x))), _subst_fun_body=KnownBits_1(~unknowns(Var(0)) & ~ones(Var(0)),             unknowns(Var(0)))), KnownBits_1.or_: Defn(name='KnownBits_1.or_', decl=KnownBits_1.or_, args=[x, y], body=KnownBits_1(ones(x) | ones(y),             ~(ones(x) |               ones(y) |               ~unknowns(x) &               ~ones(x) &               ~unknowns(y) &               ~ones(y))), ax=|= ForAll([x, y],        KnownBits_1.or_(x, y) ==        KnownBits_1(ones(x) | ones(y),                    ~(ones(x) |                      ones(y) |                      ~unknowns(x) &                      ~ones(x) &                      ~unknowns(y) &                      ~ones(y)))), _subst_fun_body=KnownBits_1(ones(Var(0)) | ones(Var(1)),             ~(ones(Var(0)) |               ones(Var(1)) |               ~unknowns(Var(0)) &               ~ones(Var(0)) &               ~unknowns(Var(1)) &               ~ones(Var(1))))), KnownBits_1.wf: Defn(name='KnownBits_1.wf', decl=KnownBits_1.wf, args=[x], body=ones(x) & unknowns(x) == 0, ax=|= ForAll(x, KnownBits_1.wf(x) == (ones(x) & unknowns(x) == 0)), _subst_fun_body=ones(Var(0)) & unknowns(Var(0)) == 0), NDArray.add: Defn(name='NDArray.add', decl=NDArray.add, args=[u, v], body=If(shape(u) == shape(v),    NDArray(shape(u), Lambda(k, data(u)[k] + data(v)[k])),    add_undef(u, v)), ax=|= ForAll([u, v],        NDArray.add(u, v) ==        If(shape(u) == shape(v),           NDArray(shape(u),                   Lambda(k, data(u)[k] + data(v)[k])),           add_undef(u, v))), _subst_fun_body=If(shape(Var(0)) == shape(Var(1)),    NDArray(shape(Var(0)),            Lambda(k, data(Var(1))[k] + data(Var(2))[k])),    add_undef(Var(0), Var(1)))), T_Int.add: Defn(name='T_Int.add', decl=T_Int.add, args=[x, y], body=T_Int(Lambda(t, val(x)[t] + val(y)[t])), ax=|= ForAll([x, y],        T_Int.add(x, y) ==        T_Int(Lambda(t, val(x)[t] + val(y)[t]))), _subst_fun_body=T_Int(Lambda(t, val(Var(1))[t] + val(Var(2))[t]))), T_Int.ge: Defn(name='T_Int.ge', decl=T_Int.ge, args=[x, y], body=T_Bool(Lambda(t, val(x)[t] >= val(y)[t])), ax=|= ForAll([x, y],        T_Int.ge(x, y) ==        T_Bool(Lambda(t, val(x)[t] >= val(y)[t]))), _subst_fun_body=T_Bool(Lambda(t, val(Var(1))[t] >= val(Var(2))[t]))), T_Int.le: Defn(name='T_Int.le', decl=T_Int.le, args=[x, y], body=T_Bool(Lambda(t, val(x)[t] <= val(y)[t])), ax=|= ForAll([x, y],        T_Int.le(x, y) ==        T_Bool(Lambda(t, val(x)[t] <= val(y)[t]))), _subst_fun_body=T_Bool(Lambda(t, val(Var(1))[t] <= val(Var(2))[t]))), T_Real.add: Defn(name='T_Real.add', decl=T_Real.add, args=[x, y], body=T_Real(Lambda(t, val(x)[t] + val(y)[t])), ax=|= ForAll([x, y],        T_Real.add(x, y) ==        T_Real(Lambda(t, val(x)[t] + val(y)[t]))), _subst_fun_body=T_Real(Lambda(t, val(Var(1))[t] + val(Var(2))[t]))), Vec2.add: Defn(name='Vec2.add', decl=Vec2.add, args=[u, v], body=Vec2(x(u) + x(v), y(u) + y(v)), ax=|= ForAll([u, v],        Vec2.add(u, v) == Vec2(x(u) + x(v), y(u) + y(v))), _subst_fun_body=Vec2(x(Var(0)) + x(Var(1)), y(Var(0)) + y(Var(1)))), Vec2.dot: Defn(name='Vec2.dot', decl=Vec2.dot, args=[u, v], body=x(u)*x(v) + y(u)*y(v), ax=|= ForAll([u, v], Vec2.dot(u, v) == x(u)*x(v) + y(u)*y(v)), _subst_fun_body=x(Var(0))*x(Var(1)) + y(Var(0))*y(Var(1))), Vec2.neg: Defn(name='Vec2.neg', decl=Vec2.neg, args=[u], body=Vec2(-x(u), -y(u)), ax=|= ForAll(u, Vec2.neg(u) == Vec2(-x(u), -y(u))), _subst_fun_body=Vec2(-x(Var(0)), -y(Var(0)))), Vec2.norm2: Defn(name='Vec2.norm2', decl=Vec2.norm2, args=[u], body=Vec2.dot(u, u), ax=|= ForAll(u, Vec2.norm2(u) == Vec2.dot(u, u)), _subst_fun_body=Vec2.dot(Var(0), Var(0))), Vec2.sub: Defn(name='Vec2.sub', decl=Vec2.sub, args=[u, v], body=Vec2(x(u) - x(v), y(u) - y(v)), ax=|= ForAll([u, v],        Vec2.sub(u, v) == Vec2(x(u) - x(v), y(u) - y(v))), _subst_fun_body=Vec2(x(Var(0)) - x(Var(1)), y(Var(0)) - y(Var(1)))), Vec3.add: Defn(name='Vec3.add', decl=Vec3.add, args=[u, v], body=Vec3(x0(u) + x0(v), x1(u) + x1(v), x2(u) + x2(v)), ax=|= ForAll([u, v],        Vec3.add(u, v) ==        Vec3(x0(u) + x0(v), x1(u) + x1(v), x2(u) + x2(v))), _subst_fun_body=Vec3(x0(Var(0)) + x0(Var(1)),      x1(Var(0)) + x1(Var(1)),      x2(Var(0)) + x2(Var(1)))), Vec3.div_: Defn(name='Vec3.div_', decl=Vec3.div_, args=[u, v], body=Vec3(x0(u)/x0(v), x1(u)/x1(v), x2(u)/x2(v)), ax=|= ForAll([u, v],        Vec3.div_(u, v) ==        Vec3(x0(u)/x0(v), x1(u)/x1(v), x2(u)/x2(v))), _subst_fun_body=Vec3(x0(Var(0))/x0(Var(1)),      x1(Var(0))/x1(Var(1)),      x2(Var(0))/x2(Var(1)))), Vec3.dot: Defn(name='Vec3.dot', decl=Vec3.dot, args=[u, v], body=0 + x0(u)*x0(v) + x1(u)*x1(v) + x2(u)*x2(v), ax=|= ForAll([u, v],        Vec3.dot(u, v) ==        0 + x0(u)*x0(v) + x1(u)*x1(v) + x2(u)*x2(v)), _subst_fun_body=0 + x0(Var(0))*x0(Var(1)) + x1(Var(0))*x1(Var(1)) + x2(Var(0))*x2(Var(1))), Vec3.mul: Defn(name='Vec3.mul', decl=Vec3.mul, args=[u, v], body=Vec3(x0(u)*x0(v), x1(u)*x1(v), x2(u)*x2(v)), ax=|= ForAll([u, v],        Vec3.mul(u, v) ==        Vec3(x0(u)*x0(v), x1(u)*x1(v), x2(u)*x2(v))), _subst_fun_body=Vec3(x0(Var(0))*x0(Var(1)),      x1(Var(0))*x1(Var(1)),      x2(Var(0))*x2(Var(1)))), Vec3.neg: Defn(name='Vec3.neg', decl=Vec3.neg, args=[u], body=Vec3(-x0(u), -x1(u), -x2(u)), ax=|= ForAll(u, Vec3.neg(u) == Vec3(-x0(u), -x1(u), -x2(u))), _subst_fun_body=Vec3(-x0(Var(0)), -x1(Var(0)), -x2(Var(0)))), Vec3.norm2: Defn(name='Vec3.norm2', decl=Vec3.norm2, args=[u], body=0 + x0(u)*x0(u) + x1(u)*x1(u) + x2(u)*x2(u), ax=|= ForAll(u,        Vec3.norm2(u) ==        0 + x0(u)*x0(u) + x1(u)*x1(u) + x2(u)*x2(u)), _subst_fun_body=0 + x0(Var(0))*x0(Var(0)) + x1(Var(0))*x1(Var(0)) + x2(Var(0))*x2(Var(0))), Vec3.sub: Defn(name='Vec3.sub', decl=Vec3.sub, args=[u, v], body=Vec3(x0(u) - x0(v), x1(u) - x1(v), x2(u) - x2(v)), ax=|= ForAll([u, v],        Vec3.sub(u, v) ==        Vec3(x0(u) - x0(v), x1(u) - x1(v), x2(u) - x2(v))), _subst_fun_body=Vec3(x0(Var(0)) - x0(Var(1)),      x1(Var(0)) - x1(Var(1)),      x2(Var(0)) - x2(Var(1)))), ZFSet.le: Defn(name='ZFSet.le', decl=ZFSet.le, args=[A, B], body=ForAll(x, Implies(∈(x, A), ∈(x, B))), ax=|= ForAll([A, B],        ZFSet.le(A, B) ==        (ForAll(x, Implies(∈(x, A), ∈(x, B))))), _subst_fun_body=ForAll(x, Implies(∈(x, Var(1)), ∈(x, Var(2))))), ZFSet.sub: Defn(name='ZFSet.sub', decl=ZFSet.sub, args=[A, B], body=sep(A, Lambda(x, Not(∈(x, B)))), ax=|= ForAll([A, B],        ZFSet.sub(A, B) == sep(A, Lambda(x, Not(∈(x, B))))), _subst_fun_body=sep(Var(0), Lambda(x, Not(∈(x, Var(2)))))), abelian: Defn(name='abelian', decl=abelian, args=[], body=ForAll([x!611, y!612],        mul(x!611, y!612) == mul(y!612, x!611)), ax=|= abelian == (ForAll([x!611, y!612],         mul(x!611, y!612) == mul(y!612, x!611))), _subst_fun_body=ForAll([x!611, y!612],        mul(x!611, y!612) == mul(y!612, x!611))), abs: Defn(name='abs', decl=abs, args=[a], body=Map(absR, a), ax=|= ForAll(a, abs(a) == Map(absR, a)), _subst_fun_body=Map(absR, Var(0))), absR: Defn(name='absR', decl=absR, args=[x], body=If(x >= 0, x, -x), ax=|= ForAll(x, absR(x) == If(x >= 0, x, -x)), _subst_fun_body=If(Var(0) >= 0, Var(0), -Var(0))), add: Defn(name='add', decl=add, args=[x, y], body=If(is(Z, x), y, S(add(pred(x), y))), ax=|= ForAll([x, y],        add(x, y) == If(is(Z, x), y, S(add(pred(x), y)))), _subst_fun_body=If(is(Z, Var(0)), Var(1), S(add(pred(Var(0)), Var(1))))), add: Defn(name='add', decl=add, args=[x, y], body=x + y, ax=|= ForAll([x, y], add(x, y) == x + y), _subst_fun_body=Var(0) + Var(1)), add_defined: Defn(name='add_defined', decl=add_defined, args=[x, y], body=Or(And(is(Real, x), is(Real, y)),    And(is(Inf, x), Not(is(NegInf, y))),    And(Not(is(NegInf, x)), is(Inf, y)),    And(is(NegInf, x), Not(is(Inf, y))),    And(Not(is(Inf, x)), is(NegInf, y))), ax=|= ForAll([x, y],        add_defined(x, y) ==        Or(And(is(Real, x), is(Real, y)),           And(is(Inf, x), Not(is(NegInf, y))),           And(Not(is(NegInf, x)), is(Inf, y)),           And(is(NegInf, x), Not(is(Inf, y))),           And(Not(is(Inf, x)), is(NegInf, y)))), _subst_fun_body=Or(And(is(Real, Var(0)), is(Real, Var(1))),    And(is(Inf, Var(0)), Not(is(NegInf, Var(1)))),    And(Not(is(NegInf, Var(0))), is(Inf, Var(1))),    And(is(NegInf, Var(0)), Not(is(Inf, Var(1)))),    And(Not(is(Inf, Var(0))), is(NegInf, Var(1))))), aeq: Defn(name='aeq', decl=aeq, args=[x, y, eps], body=If(x - y > 0, x - y, -(x - y)) <= eps, ax=|= ForAll([x, y, eps],        aeq(x, y, eps) ==        (If(x - y > 0, x - y, -(x - y)) <= eps)), _subst_fun_body=If(Var(0) - Var(1) > 0, Var(0) - Var(1), -(Var(0) - Var(1))) <= Var(2)), always: Defn(name='always', decl=always, args=[p], body=T_Bool(Lambda(t!935,               ForAll(dt!936,                      Implies(dt!936 >= 0,                              val(p)[t!935 + dt!936])))), ax=|= ForAll(p,        always(p) ==        T_Bool(Lambda(t!935,                      ForAll(dt!936,                             Implies(dt!936 >= 0,                                     val(p)[t!935 + dt!936]))))), _subst_fun_body=T_Bool(Lambda(t!935,               ForAll(dt!936,                      Implies(dt!936 >= 0,                              val(Var(2))[t!935 + dt!936]))))), ball: Defn(name='ball', decl=ball, args=[x!966, r!969], body=Lambda(y!970, absR(y!970 - x!966) < r!969), ax=|= ForAll([x!966, r!969],        ball(x!966, r!969) ==        (Lambda(y!970, absR(y!970 - x!966) < r!969))), _subst_fun_body=Lambda(y!970, absR(y!970 - Var(1)) < Var(2))), bchoose: Defn(name='bchoose', decl=bchoose, args=[P, N], body=downsearch(P, N), ax=|= ForAll([P, N], bchoose(P, N) == downsearch(P, N)), _subst_fun_body=downsearch(Var(0), Var(1))), beq: Defn(name='beq', decl=beq, args=[p, q], body=T_Bool(Lambda(t!938, val(p)[t!938] == val(q)[t!938])), ax=|= ForAll([p, q],        beq(p, q) ==        T_Bool(Lambda(t!938, val(p)[t!938] == val(q)[t!938]))), _subst_fun_body=T_Bool(Lambda(t!938,               val(Var(1))[t!938] == val(Var(2))[t!938]))), bexist: Defn(name='bexist', decl=bexist, args=[A, n], body=If(n < 0, False, Or(A[n], bexists(A, n - 1))), ax=|= ForAll([A, n],        bexist(A, n) ==        If(n < 0, False, Or(A[n], bexists(A, n - 1)))), _subst_fun_body=If(Var(1) < 0,    False,    Or(Var(0)[Var(1)], bexists(Var(0), Var(1) - 1)))), bexists: Defn(name='bexists', decl=bexists, args=[P, N], body=P[bchoose(P, N)], ax=|= ForAll([P, N], bexists(P, N) == P[bchoose(P, N)]), _subst_fun_body=Var(0)[bchoose(Var(0), Var(1))]), bforall: Defn(name='bforall', decl=bforall, args=[A, n], body=If(n < 0, True, And(A[n], bforall(A, n - 1))), ax=|= ForAll([A, n],        bforall(A, n) ==        If(n < 0, True, And(A[n], bforall(A, n - 1)))), _subst_fun_body=If(Var(1) < 0,    True,    And(Var(0)[Var(1)], bforall(Var(0), Var(1) - 1)))), biginter: Defn(name='biginter', decl=biginter, args=[a!1609], body=sep(pick(a!1609),     Lambda(x,            ForAll(b!1610,                   Implies(∈(b!1610, a!1609), ∈(x, b!1610))))), ax=|= ForAll(a!1609,        biginter(a!1609) ==        sep(pick(a!1609),            Lambda(x,                   ForAll(b!1610,                          Implies(∈(b!1610, a!1609),                                  ∈(x, b!1610)))))), _subst_fun_body=sep(pick(Var(0)),     Lambda(x,            ForAll(b!1610,                   Implies(∈(b!1610, Var(2)), ∈(x, b!1610)))))), cauchy_mod: Defn(name='cauchy_mod', decl=cauchy_mod, args=[a, mod], body=ForAll(eps,        Implies(eps > 0,                ForAll([m, k],                       Implies(And(m > mod[eps],                                   k > mod[eps]),                               absR(a[m] - a[k]) < eps)))), ax=|= ForAll([a, mod],        cauchy_mod(a, mod) ==        (ForAll(eps,                Implies(eps > 0,                        ForAll([m, k],                               Implies(And(m > mod[eps],                                         k > mod[eps]),                                       absR(a[m] - a[k]) <                                       eps)))))), _subst_fun_body=ForAll(eps,        Implies(eps > 0,                ForAll([m, k],                       Implies(And(m > Var(4)[eps],                                   k > Var(4)[eps]),                               absR(Var(3)[m] - Var(3)[k]) <                               eps))))), ceil: Defn(name='ceil', decl=ceil, args=[x], body=-floor(-x), ax=|= ForAll(x, ceil(x) == -floor(-x)), _subst_fun_body=-floor(-Var(0))), cinter: Defn(name='cinter', decl=cinter, args=[An], body=Lambda(x, ForAll(n, An[n][x])), ax=|= ForAll(An, cinter(An) == (Lambda(x, ForAll(n, An[n][x])))), _subst_fun_body=Lambda(x, ForAll(n, Var(2)[n][x]))), circle: Defn(name='circle', decl=circle, args=[c, r], body=Lambda(p, Vec2.norm2(Vec2.sub(p, c)) == r*r), ax=|= ForAll([c, r],        circle(c, r) ==        (Lambda(p, Vec2.norm2(Vec2.sub(p, c)) == r*r))), _subst_fun_body=Lambda(p, Vec2.norm2(Vec2.sub(p, Var(1))) == Var(2)*Var(2))), closed: Defn(name='closed', decl=closed, args=[A], body=Array.open(complement(A)), ax=|= ForAll(A, closed(A) == Array.open(complement(A))), _subst_fun_body=Array.open(complement(Var(0)))), closed_int: Defn(name='closed_int', decl=closed_int, args=[x, y], body=Lambda(z, And(x <= z, z <= y)), ax=|= ForAll([x, y],        closed_int(x, y) == (Lambda(z, And(x <= z, z <= y)))), _subst_fun_body=Lambda(z, And(Var(1) <= z, z <= Var(2)))), comp: Defn(name='comp', decl=comp, args=[f, g], body=Lambda(x, f[g[x]]), ax=|= ForAll([f, g], comp(f, g) == (Lambda(x, f[g[x]]))), _subst_fun_body=Lambda(x, Var(1)[Var(2)[x]])), conj: Defn(name='conj', decl=conj, args=[z], body=C(re(z), -im(z)), ax=|= ForAll(z, conj(z) == C(re(z), -im(z))), _subst_fun_body=C(re(Var(0)), -im(Var(0)))), const: Defn(name='const', decl=const, args=[x], body=K(Real, x), ax=|= ForAll(x, const(x) == K(Real, x)), _subst_fun_body=K(Real, Var(0))), const: Defn(name='const', decl=const, args=[a], body=KnownBits_1(a, 0), ax=|= ForAll(a, const(a) == KnownBits_1(a, 0)), _subst_fun_body=KnownBits_1(Var(0), 0)), const: Defn(name='const', decl=const, args=[x], body=Lambda(i, x), ax=|= ForAll(x, const(x) == (Lambda(i, x))), _subst_fun_body=Lambda(i, Var(1))), cont_at: Defn(name='cont_at', decl=cont_at, args=[f, x], body=ForAll(eps,        Implies(eps > 0,                Exists(delta,                       And(delta > 0,                           ForAll(y,                                  Implies(absR(x - y) < delta,                                         absR(f[x] - f[y]) <                                         eps)))))), ax=|= ForAll([f, x],        cont_at(f, x) ==        (ForAll(eps,                Implies(eps > 0,                        Exists(delta,                               And(delta > 0,                                   ForAll(y,                                         Implies(absR(x - y) <                                         delta,                                         absR(f[x] - f[y]) <                                         eps)))))))), _subst_fun_body=ForAll(eps,        Implies(eps > 0,                Exists(delta,                       And(delta > 0,                           ForAll(y,                                  Implies(absR(Var(4) - y) <                                         delta,                                         absR(Var(3)[Var(4)] -                                         Var(3)[y]) <                                         eps))))))), cos: Defn(name='cos', decl=cos, args=[a], body=Map(cos, a), ax=|= ForAll(a, cos(a) == Map(cos, a)), _subst_fun_body=Map(cos, Var(0))), cross: Defn(name='cross', decl=cross, args=[u, v], body=Vec3(x1(u)*x2(v) - x2(u)*x1(v),      x2(u)*x0(v) - x0(u)*x2(v),      x0(u)*x1(v) - x1(u)*x0(v)), ax=|= ForAll([u, v],        cross(u, v) ==        Vec3(x1(u)*x2(v) - x2(u)*x1(v),             x2(u)*x0(v) - x0(u)*x2(v),             x0(u)*x1(v) - x1(u)*x0(v))), _subst_fun_body=Vec3(x1(Var(0))*x2(Var(1)) - x2(Var(0))*x1(Var(1)),      x2(Var(0))*x0(Var(1)) - x0(Var(0))*x2(Var(1)),      x0(Var(0))*x1(Var(1)) - x1(Var(0))*x0(Var(1)))), cumsum: Defn(name='cumsum', decl=cumsum, args=[a], body=Lambda(i,        If(i == 0,           a[0],           If(i > 0,              cumsum(a)[i - 1] + a[i],              -cumsum(a)[i + 1] - a[i]))), ax=|= ForAll(a,        cumsum(a) ==        (Lambda(i,                If(i == 0,                   a[0],                   If(i > 0,                      cumsum(a)[i - 1] + a[i],                      -cumsum(a)[i + 1] - a[i]))))), _subst_fun_body=Lambda(i,        If(i == 0,           Var(1)[0],           If(i > 0,              cumsum(Var(1))[i - 1] + Var(1)[i],              -cumsum(Var(1))[i + 1] - Var(1)[i])))), cunion: Defn(name='cunion', decl=cunion, args=[An], body=Lambda(x, Exists(n, An[n][x])), ax=|= ForAll(An, cunion(An) == (Lambda(x, Exists(n, An[n][x])))), _subst_fun_body=Lambda(x, Exists(n, Var(2)[n][x]))), decimate: Defn(name='decimate', decl=decimate, args=[a, n], body=Lambda(i, a[i*n]), ax=|= ForAll([a, n], decimate(a, n) == (Lambda(i, a[i*n]))), _subst_fun_body=Lambda(i, Var(1)[i*Var(2)])), delay: Defn(name='delay', decl=delay, args=[a], body=shift(a, 1), ax=|= ForAll(a, delay(a) == shift(a, 1)), _subst_fun_body=shift(Var(0), 1)), diff: Defn(name='diff', decl=diff, args=[a], body=Lambda(i, a[i + 1] - a[i]), ax=|= ForAll(a, diff(a) == (Lambda(i, a[i + 1] - a[i]))), _subst_fun_body=Lambda(i, Var(1)[i + 1] - Var(1)[i])), diff_at: Defn(name='diff_at', decl=diff_at, args=[f, x], body=Exists(y, has_diff_at(f, x, y)), ax=|= ForAll([f, x],        diff_at(f, x) == (Exists(y, has_diff_at(f, x, y)))), _subst_fun_body=Exists(y, has_diff_at(Var(1), Var(2), y))), dilate: Defn(name='dilate', decl=dilate, args=[a, n], body=Lambda(i, a[i/n]), ax=|= ForAll([a, n], dilate(a, n) == (Lambda(i, a[i/n]))), _subst_fun_body=Lambda(i, Var(1)[i/Var(2)])), dist: Defn(name='dist', decl=dist, args=[x!966, y!967], body=absR(x!966 - y!967), ax=|= ForAll([x!966, y!967],        dist(x!966, y!967) == absR(x!966 - y!967)), _subst_fun_body=absR(Var(0) - Var(1))), dist: Defn(name='dist', decl=dist, args=[u, v], body=sqrt(Vec2.norm2(Vec2.sub(u, v))), ax=|= ForAll([u, v],        dist(u, v) == sqrt(Vec2.norm2(Vec2.sub(u, v)))), _subst_fun_body=sqrt(Vec2.norm2(Vec2.sub(Var(0), Var(1))))), dom: Defn(name='dom', decl=dom, args=[R], body=sep(bigunion(bigunion(R)),     Lambda(x, Exists(y, ∈(pair(x, y), R)))), ax=|= ForAll(R,        dom(R) ==        sep(bigunion(bigunion(R)),            Lambda(x, Exists(y, ∈(pair(x, y), R))))), _subst_fun_body=sep(bigunion(bigunion(Var(0))),     Lambda(x, Exists(y, ∈(pair(x, y), Var(2)))))), double: Defn(name='double', decl=double, args=[n], body=If(is(Z, n), Z, S(S(double(pred(n))))), ax=|= ForAll(n,        double(n) == If(is(Z, n), Z, S(S(double(pred(n)))))), _subst_fun_body=If(is(Z, Var(0)), Z, S(S(double(pred(Var(0))))))), downsearch: Defn(name='downsearch', decl=downsearch, args=[P, n!284], body=If(P[n!284],    n!284,    If(n!284 < 0, 0, downsearch(P, n!284 - 1))), ax=|= ForAll([P, n!284],        downsearch(P, n!284) ==        If(P[n!284],           n!284,           If(n!284 < 0, 0, downsearch(P, n!284 - 1)))), _subst_fun_body=If(Var(0)[Var(1)],    Var(1),    If(Var(1) < 0, 0, downsearch(Var(0), Var(1) - 1)))), dvd: Defn(name='dvd', decl=dvd, args=[n, m], body=Exists(p, m == n*p), ax=|= ForAll([n, m], dvd(n, m) == (Exists(p, m == n*p))), _subst_fun_body=Exists(p, Var(2) == Var(1)*p)), elts: Defn(name='elts', decl=elts, args=[A], body=Lambda(x, ∈(x, A)), ax=|= ForAll(A, elts(A) == (Lambda(x, ∈(x, A)))), _subst_fun_body=Lambda(x, ∈(x, Var(1)))), empty: Defn(name='empty', decl=empty, args=[], body=Interval(1, 0), ax=|= empty == Interval(1, 0), _subst_fun_body=Interval(1, 0)), even: Defn(name='even', decl=even, args=[x], body=Exists(y, x == 2*y), ax=|= ForAll(x, even(x) == (Exists(y, x == 2*y))), _subst_fun_body=Exists(y, Var(1) == 2*y)), eventually: Defn(name='eventually', decl=eventually, args=[p], body=T_Bool(Lambda(t!933,               Exists(dt!934,                      And(dt!934 >= 0,                          val(p)[t!933 + dt!934])))), ax=|= ForAll(p,        eventually(p) ==        T_Bool(Lambda(t!933,                      Exists(dt!934,                             And(dt!934 >= 0,                                 val(p)[t!933 + dt!934]))))), _subst_fun_body=T_Bool(Lambda(t!933,               Exists(dt!934,                      And(dt!934 >= 0,                          val(Var(2))[t!933 + dt!934]))))), expi: Defn(name='expi', decl=expi, args=[t], body=C(cos(t), sin(t)), ax=|= ForAll(t, expi(t) == C(cos(t), sin(t))), _subst_fun_body=C(cos(Var(0)), sin(Var(0)))), fact: Defn(name='fact', decl=fact, args=[n], body=If(n <= 0, 1, n*fact(n - 1)), ax=|= ForAll(n, fact(n) == If(n <= 0, 1, n*fact(n - 1))), _subst_fun_body=If(Var(0) <= 0, 1, Var(0)*fact(Var(0) - 1))), finite: Defn(name='finite', decl=finite, args=[A], body=Exists(finwit!17,        ForAll(x!16,               A[x!16] == Contains(finwit!17, Unit(x!16)))), ax=|= ForAll(A,        finite(A) ==        (Exists(finwit!17,                ForAll(x!16,                       A[x!16] ==                       Contains(finwit!17, Unit(x!16)))))), _subst_fun_body=Exists(finwit!17,        ForAll(x!16,               Var(2)[x!16] ==               Contains(finwit!17, Unit(x!16))))), finite: Defn(name='finite', decl=finite, args=[A], body=Exists(finwit!54,        ForAll(x!53,               A[x!53] == Contains(finwit!54, Unit(x!53)))), ax=|= ForAll(A,        finite(A) ==        (Exists(finwit!54,                ForAll(x!53,                       A[x!53] ==                       Contains(finwit!54, Unit(x!53)))))), _subst_fun_body=Exists(finwit!54,        ForAll(x!53,               Var(2)[x!53] ==               Contains(finwit!54, Unit(x!53))))), finite: Defn(name='finite', decl=finite, args=[A], body=Exists(finwit!91,        ForAll(x!90,               A[x!90] == Contains(finwit!91, Unit(x!90)))), ax=|= ForAll(A,        finite(A) ==        (Exists(finwit!91,                ForAll(x!90,                       A[x!90] ==                       Contains(finwit!91, Unit(x!90)))))), _subst_fun_body=Exists(finwit!91,        ForAll(x!90,               Var(2)[x!90] ==               Contains(finwit!91, Unit(x!90))))), finite: Defn(name='finite', decl=finite, args=[A], body=Exists(finwit!799,        ForAll(x!798,               A[x!798] == Contains(finwit!799, Unit(x!798)))), ax=|= ForAll(A,        finite(A) ==        (Exists(finwit!799,                ForAll(x!798,                       A[x!798] ==                       Contains(finwit!799, Unit(x!798)))))), _subst_fun_body=Exists(finwit!799,        ForAll(x!798,               Var(2)[x!798] ==               Contains(finwit!799, Unit(x!798))))), finite: Defn(name='finite', decl=finite, args=[A], body=Exists(finwit!854,        ForAll(x!853,               A[x!853] == Contains(finwit!854, Unit(x!853)))), ax=|= ForAll(A,        finite(A) ==        (Exists(finwit!854,                ForAll(x!853,                       A[x!853] ==                       Contains(finwit!854, Unit(x!853)))))), _subst_fun_body=Exists(finwit!854,        ForAll(x!853,               Var(2)[x!853] ==               Contains(finwit!854, Unit(x!853))))), finite: Defn(name='finite', decl=finite, args=[A], body=Exists(finwit!1055,        ForAll(x!1054,               A[x!1054] ==               Contains(finwit!1055, Unit(x!1054)))), ax=|= ForAll(A,        finite(A) ==        (Exists(finwit!1055,                ForAll(x!1054,                       A[x!1054] ==                       Contains(finwit!1055, Unit(x!1054)))))), _subst_fun_body=Exists(finwit!1055,        ForAll(x!1054,               Var(2)[x!1054] ==               Contains(finwit!1055, Unit(x!1054))))), finite: Defn(name='finite', decl=finite, args=[A], body=Exists(finwit!1115,        ForAll(x!1114,               A[x!1114] ==               Contains(finwit!1115, Unit(x!1114)))), ax=|= ForAll(A,        finite(A) ==        (Exists(finwit!1115,                ForAll(x!1114,                       A[x!1114] ==                       Contains(finwit!1115, Unit(x!1114)))))), _subst_fun_body=Exists(finwit!1115,        ForAll(x!1114,               Var(2)[x!1114] ==               Contains(finwit!1115, Unit(x!1114))))), finsum: Defn(name='finsum', decl=finsum, args=[a, n], body=cumsum(a)[n], ax=|= ForAll([a, n], finsum(a, n) == cumsum(a)[n]), _subst_fun_body=cumsum(Var(0))[Var(1)]), floor: Defn(name='floor', decl=floor, args=[x], body=ToReal(ToInt(x)), ax=|= ForAll(x, floor(x) == ToReal(ToInt(x))), _subst_fun_body=ToReal(ToInt(Var(0)))), from_int: Defn(name='from_int', decl=from_int, args=[a], body=If(a <= 0, Z, S(from_int(a - 1))), ax=|= ForAll(a, from_int(a) == If(a <= 0, Z, S(from_int(a - 1)))), _subst_fun_body=If(Var(0) <= 0, Z, S(from_int(Var(0) - 1)))), fst: Defn(name='fst', decl=fst, args=[p!1613], body=pick(biginter(p!1613)), ax=|= ForAll(p!1613, fst(p!1613) == pick(biginter(p!1613))), _subst_fun_body=pick(biginter(Var(0)))), has_bound: Defn(name='has_bound', decl=has_bound, args=[a, M], body=ForAll(n, absR(a[n]) <= M), ax=|= ForAll([a, M],        has_bound(a, M) == (ForAll(n, absR(a[n]) <= M))), _subst_fun_body=ForAll(n, absR(Var(1)[n]) <= Var(2))), has_lb: Defn(name='has_lb', decl=has_lb, args=[A, M], body=ForAll(x, Implies(A[x], M <= x)), ax=|= ForAll([A, M],        has_lb(A, M) == (ForAll(x, Implies(A[x], M <= x)))), _subst_fun_body=ForAll(x, Implies(Var(1)[x], Var(2) <= x))), has_lim: Defn(name='has_lim', decl=has_lim, args=[a, y], body=ForAll(eps,        Implies(eps > 0,                Exists(N,                       ForAll(n,                              Implies(n > N,                                      absR(a[n] - y) < eps))))), ax=|= ForAll([a, y],        has_lim(a, y) ==        (ForAll(eps,                Implies(eps > 0,                        Exists(N,                               ForAll(n,                                      Implies(n > N,                                         absR(a[n] - y) < eps))))))), _subst_fun_body=ForAll(eps,        Implies(eps > 0,                Exists(N,                       ForAll(n,                              Implies(n > N,                                      absR(Var(3)[n] - Var(4)) <                                      eps)))))), has_lim_at: Defn(name='has_lim_at', decl=has_lim_at, args=[f, p, L], body=ForAll(eps,        Implies(0 < eps,                Exists(delta,                       And(delta > 0,                           ForAll(x,                                  Implies(And(0 < absR(x - p),                                         absR(x - p) < delta),                                         absR(f[x] - L) < eps)))))), ax=|= ForAll([f, p, L],        has_lim_at(f, p, L) ==        (ForAll(eps,                Implies(0 < eps,                        Exists(delta,                               And(delta > 0,                                   ForAll(x,                                         Implies(And(0 <                                         absR(x - p),                                         absR(x - p) < delta),                                         absR(f[x] - L) < eps)))))))), _subst_fun_body=ForAll(eps,        Implies(0 < eps,                Exists(delta,                       And(delta > 0,                           ForAll(x,                                  Implies(And(0 <                                         absR(x - Var(4)),                                         absR(x - Var(4)) <                                         delta),                                         absR(Var(3)[x] -                                         Var(5)) <                                         eps))))))), has_max: Defn(name='has_max', decl=has_max, args=[A, x], body=And(A[x], sup(A) == x), ax=|= ForAll([A, x], has_max(A, x) == And(A[x], sup(A) == x)), _subst_fun_body=And(Var(0)[Var(1)], sup(Var(0)) == Var(1))), has_sum: Defn(name='has_sum', decl=has_sum, args=[a, y], body=has_lim(cumsum(a), y), ax=|= ForAll([a, y], has_sum(a, y) == has_lim(cumsum(a), y)), _subst_fun_body=has_lim(cumsum(Var(0)), Var(1))), has_ub: Defn(name='has_ub', decl=has_ub, args=[A, M], body=ForAll(x, Implies(A[x], x <= M)), ax=|= ForAll([A, M],        has_ub(A, M) == (ForAll(x, Implies(A[x], x <= M)))), _subst_fun_body=ForAll(x, Implies(Var(1)[x], x <= Var(2)))), iand: Defn(name='iand', decl=iand, args=[a, b], body=Prop(Lambda(w, And(val(a)[w], val(b)[w]))), ax=|= ForAll([a, b],        iand(a, b) ==        Prop(Lambda(w, And(val(a)[w], val(b)[w])))), _subst_fun_body=Prop(Lambda(w, And(val(Var(1))[w], val(Var(2))[w])))), id: Defn(name='id', decl=id, args=[], body=Lambda(i, ToReal(i)), ax=|= id == (Lambda(i, ToReal(i))), _subst_fun_body=Lambda(i, ToReal(i))), ident: Defn(name='ident', decl=ident, args=[], body=Lambda(x, x), ax=|= ident == (Lambda(x, x)), _subst_fun_body=Lambda(x, x)), ieq: Defn(name='ieq', decl=ieq, args=[x, y], body=T_Bool(Lambda(t!962, val(x)[t!962] == val(y)[t!962])), ax=|= ForAll([x, y],        ieq(x, y) ==        T_Bool(Lambda(t!962, val(x)[t!962] == val(y)[t!962]))), _subst_fun_body=T_Bool(Lambda(t!962,               val(Var(1))[t!962] == val(Var(2))[t!962]))), if_int: Defn(name='if_int', decl=if_int, args=[p, x, y], body=T_Int(Lambda(t!965,              If(val(p)[t!965], val(x)[t!965], val(y)[t!965]))), ax=|= ForAll([p, x, y],        if_int(p, x, y) ==        T_Int(Lambda(t!965,                     If(val(p)[t!965],                        val(x)[t!965],                        val(y)[t!965])))), _subst_fun_body=T_Int(Lambda(t!965,              If(val(Var(1))[t!965],                 val(Var(2))[t!965],                 val(Var(3))[t!965])))), iimpl: Defn(name='iimpl', decl=iimpl, args=[a, b], body=Prop(Lambda(w,             ForAll(u,                    Implies(acc(w, u),                            Implies(val(a)[u], val(b)[u]))))), ax=|= ForAll([a, b],        iimpl(a, b) ==        Prop(Lambda(w,                    ForAll(u,                           Implies(acc(w, u),                                   Implies(val(a)[u],                                         val(b)[u])))))), _subst_fun_body=Prop(Lambda(w,             ForAll(u,                    Implies(acc(w, u),                            Implies(val(Var(2))[u],                                    val(Var(3))[u])))))), ineq: Defn(name='ineq', decl=ineq, args=[x, y], body=T_Bool(Lambda(t!963, val(x)[t!963] != val(y)[t!963])), ax=|= ForAll([x, y],        ineq(x, y) ==        T_Bool(Lambda(t!963, val(x)[t!963] != val(y)[t!963]))), _subst_fun_body=T_Bool(Lambda(t!963,               val(Var(1))[t!963] != val(Var(2))[t!963]))), inext: Defn(name='inext', decl=inext, args=[x], body=T_Int(Lambda(t!964, val(x)[t!964 + 1])), ax=|= ForAll(x,        inext(x) == T_Int(Lambda(t!964, val(x)[t!964 + 1]))), _subst_fun_body=T_Int(Lambda(t!964, val(Var(1))[t!964 + 1]))), inf: Defn(name='inf', decl=inf, args=[A], body=sup(Lambda(x, has_lb(A, x))), ax=|= ForAll(A, inf(A) == sup(Lambda(x, has_lb(A, x)))), _subst_fun_body=sup(Lambda(x, has_lb(Var(1), x)))), inot: Defn(name='inot', decl=inot, args=[a], body=Prop(Lambda(w,             ForAll(u,                    Implies(acc(w, u),                            Implies(val(a)[u],                                    val(Prop(K(World, False)))[u]))))), ax=|= ForAll(a,        inot(a) ==        Prop(Lambda(w,                    ForAll(u,                           Implies(acc(w, u),                                   Implies(val(a)[u],                                         val(Prop(K(World,                                         False)))[u])))))), _subst_fun_body=Prop(Lambda(w,             ForAll(u,                    Implies(acc(w, u),                            Implies(val(Var(2))[u],                                    val(Prop(K(World, False)))[u])))))), inter: Defn(name='inter', decl=inter, args=[A, B], body=sep(A, Lambda(x, ∈(x, B))), ax=|= ForAll([A, B], inter(A, B) == sep(A, Lambda(x, ∈(x, B)))), _subst_fun_body=sep(Var(0), Lambda(x, ∈(x, Var(2))))), ior: Defn(name='ior', decl=ior, args=[a, b], body=Prop(Lambda(w, Or(val(a)[w], val(b)[w]))), ax=|= ForAll([a, b],        ior(a, b) ==        Prop(Lambda(w, Or(val(a)[w], val(b)[w])))), _subst_fun_body=Prop(Lambda(w, Or(val(Var(1))[w], val(Var(2))[w])))), is_bounded: Defn(name='is_bounded', decl=is_bounded, args=[a], body=Exists(M, has_bound(a, M)), ax=|= ForAll(a, is_bounded(a) == (Exists(M, has_bound(a, M)))), _subst_fun_body=Exists(M, has_bound(Var(1), M))), is_cauchy: Defn(name='is_cauchy', decl=is_cauchy, args=[a], body=ForAll(eps,        Implies(eps > 0,                Exists(N,                       ForAll([m, k],                              Implies(And(m > N, k > N),                                      absR(a[m] - a[k]) < eps))))), ax=|= ForAll(a,        is_cauchy(a) ==        (ForAll(eps,                Implies(eps > 0,                        Exists(N,                               ForAll([m, k],                                      Implies(And(m > N,                                         k > N),                                         absR(a[m] - a[k]) <                                         eps))))))), _subst_fun_body=ForAll(eps,        Implies(eps > 0,                Exists(N,                       ForAll([m, k],                              Implies(And(m > N, k > N),                                      absR(Var(4)[m] -                                         Var(4)[k]) <                                      eps)))))), is_circle: Defn(name='is_circle', decl=is_circle, args=[A], body=Exists([c, r], circle(c, r) == A), ax=|= ForAll(A,        is_circle(A) == (Exists([c, r], circle(c, r) == A))), _subst_fun_body=Exists([c, r], circle(c, r) == Var(2))), is_const: Defn(name='is_const', decl=is_const, args=[x], body=unknowns(x) == 0, ax=|= ForAll(x, is_const(x) == (unknowns(x) == 0)), _subst_fun_body=unknowns(Var(0)) == 0), is_cont: Defn(name='is_cont', decl=is_cont, args=[f], body=ForAll(x, cont_at(f, x)), ax=|= ForAll(f, is_cont(f) == (ForAll(x, cont_at(f, x)))), _subst_fun_body=ForAll(x, cont_at(Var(1), x))), is_conv: Defn(name='is_conv', decl=is_conv, args=[a], body=Exists(y, has_lim(a, y)), ax=|= ForAll(a, is_conv(a) == (Exists(y, has_lim(a, y)))), _subst_fun_body=Exists(y, has_lim(Var(1), y))), is_diff: Defn(name='is_diff', decl=is_diff, args=[f], body=ForAll(x, diff_at(f, x)), ax=|= ForAll(f, is_diff(f) == (ForAll(x, diff_at(f, x)))), _subst_fun_body=ForAll(x, diff_at(Var(1), x))), is_empty: Defn(name='is_empty', decl=is_empty, args=[I], body=hi(i) > lo(i), ax=|= ForAll(I, is_empty(I) == (hi(i) > lo(i))), _subst_fun_body=hi(i) > lo(i)), is_idem: Defn(name='is_idem', decl=is_idem, args=[A], body=mul(A, A) == A, ax=|= ForAll(A, is_idem(A) == (mul(A, A) == A)), _subst_fun_body=mul(Var(0), Var(0)) == Var(0)), is_lub: Defn(name='is_lub', decl=is_lub, args=[A, x], body=And(upper_bound(A, x),     ForAll(y, Implies(upper_bound(A, y), EReal.le(x, y)))), ax=|= ForAll([A, x],        is_lub(A, x) ==        And(upper_bound(A, x),            ForAll(y,                   Implies(upper_bound(A, y), EReal.le(x, y))))), _subst_fun_body=And(upper_bound(Var(0), Var(1)),     ForAll(y,            Implies(upper_bound(Var(1), y),                    EReal.le(Var(2), y))))), is_monotone: Defn(name='is_monotone', decl=is_monotone, args=[a], body=ForAll([n, m], Implies(n <= m, a[n] <= a[m])), ax=|= ForAll(a,        is_monotone(a) ==        (ForAll([n, m], Implies(n <= m, a[n] <= a[m])))), _subst_fun_body=ForAll([n, m], Implies(n <= m, Var(2)[n] <= Var(2)[m]))), is_nonneg: Defn(name='is_nonneg', decl=is_nonneg, args=[a], body=ForAll(n, a[n] >= 0), ax=|= ForAll(a, is_nonneg(a) == (ForAll(n, a[n] >= 0))), _subst_fun_body=ForAll(n, Var(1)[n] >= 0)), is_open: Defn(name='is_open', decl=is_open, args=[S], body=ForAll(x!966,        Implies(S[x!966],                Exists(r!969,                       And(0 < r!969,                           subset(ball(x!966, r!969), S))))), ax=|= ForAll(S,        is_open(S) ==        (ForAll(x!966,                Implies(S[x!966],                        Exists(r!969,                               And(0 < r!969,                                   subset(ball(x!966, r!969),                                         S))))))), _subst_fun_body=ForAll(x!966,        Implies(Var(1)[x!966],                Exists(r!969,                       And(0 < r!969,                           subset(ball(x!966, r!969), Var(2))))))), is_orth: Defn(name='is_orth', decl=is_orth, args=[A], body=mul(A, trans(A)) == I, ax=|= ForAll(A, is_orth(A) == (mul(A, trans(A)) == I)), _subst_fun_body=mul(Var(0), trans(Var(0))) == I), is_pair: Defn(name='is_pair', decl=is_pair, args=[c!1611], body=Exists([a!1609, b!1610], pair(a!1609, b!1610) == c!1611), ax=|= ForAll(c!1611,        is_pair(c!1611) ==        (Exists([a!1609, b!1610],                pair(a!1609, b!1610) == c!1611))), _subst_fun_body=Exists([a!1609, b!1610], pair(a!1609, b!1610) == Var(2))), is_rel: Defn(name='is_rel', decl=is_rel, args=[R], body=ForAll(p!1613, Implies(∈(p!1613, R), is_pair(p!1613))), ax=|= ForAll(R,        is_rel(R) ==        (ForAll(p!1613,                Implies(∈(p!1613, R), is_pair(p!1613))))), _subst_fun_body=ForAll(p!1613, Implies(∈(p!1613, Var(1)), is_pair(p!1613)))), is_set: Defn(name='is_set', decl=is_set, args=[P], body=Exists(A, reflects(P, A)), ax=|= ForAll(P, is_set(P) == (Exists(A, reflects(P, A)))), _subst_fun_body=Exists(A, reflects(Var(1), A))), is_summable: Defn(name='is_summable', decl=is_summable, args=[a], body=Exists(y, has_sum(a, y)), ax=|= ForAll(a, is_summable(a) == (Exists(y, has_sum(a, y)))), _subst_fun_body=Exists(y, has_sum(Var(1), y))), is_symm: Defn(name='is_symm', decl=is_symm, args=[A], body=trans(A) == A, ax=|= ForAll(A, is_symm(A) == (trans(A) == A)), _subst_fun_body=trans(Var(0)) == Var(0)), is_ub: Defn(name='is_ub', decl=is_ub, args=[A], body=Exists(M, has_ub(A, M)), ax=|= ForAll(A, is_ub(A) == (Exists(M, has_ub(A, M)))), _subst_fun_body=Exists(M, has_ub(Var(1), M))), join: Defn(name='join', decl=join, args=[i, j], body=Interval(min(lo(i), lo(j)), max(hi(i), hi(j))), ax=|= ForAll([i, j],        join(i, j) ==        Interval(min(lo(i), lo(j)), max(hi(i), hi(j)))), _subst_fun_body=Interval(min(lo(Var(0)), lo(Var(1))),          max(hi(Var(0)), hi(Var(1))))), krondelta: Defn(name='krondelta', decl=krondelta, args=[n], body=Lambda(i, If(i == n, 1, 0)), ax=|= ForAll(n, krondelta(n) == (Lambda(i, If(i == n, 1, 0)))), _subst_fun_body=Lambda(i, If(i == Var(1), 1, 0))), lim: Defn(name='lim', decl=lim, args=[A!1164], body=f!1315(A!1164), ax=|= ForAll(A!1164, lim(A!1164) == f!1315(A!1164)), _subst_fun_body=f!1315(Var(0))), max: Defn(name='max', decl=max, args=[x, y], body=If(x >= y, x, y), ax=|= ForAll([x, y], max(x, y) == If(x >= y, x, y)), _subst_fun_body=If(Var(0) >= Var(1), Var(0), Var(1))), max: Defn(name='max', decl=max, args=[a], body=Lambda(i,        If(i == 0,           a[0],           If(i > 0,              max(max(a)[i - 1], a[i]),              max(max(a)[i + 1], a[i])))), ax=|= ForAll(a,        max(a) ==        (Lambda(i,                If(i == 0,                   a[0],                   If(i > 0,                      max(max(a)[i - 1], a[i]),                      max(max(a)[i + 1], a[i])))))), _subst_fun_body=Lambda(i,        If(i == 0,           Var(1)[0],           If(i > 0,              max(max(Var(1))[i - 1], Var(1)[i]),              max(max(Var(1))[i + 1], Var(1)[i]))))), meet: Defn(name='meet', decl=meet, args=[i, j], body=Interval(max(lo(i), lo(j)), min(hi(i), hi(j))), ax=|= ForAll([i, j],        meet(i, j) ==        Interval(max(lo(i), lo(j)), min(hi(i), hi(j)))), _subst_fun_body=Interval(max(lo(Var(0)), lo(Var(1))),          min(hi(Var(0)), hi(Var(1))))), mid: Defn(name='mid', decl=mid, args=[i], body=(lo(i) + hi(i))/2, ax=|= ForAll(i, mid(i) == (lo(i) + hi(i))/2), _subst_fun_body=(lo(Var(0)) + hi(Var(0)))/2), min: Defn(name='min', decl=min, args=[x, y], body=If(x <= y, x, y), ax=|= ForAll([x, y], min(x, y) == If(x <= y, x, y)), _subst_fun_body=If(Var(0) <= Var(1), Var(0), Var(1))), mu: Defn(name='mu', decl=mu, args=[A], body=mu_iter(A, 0), ax=|= ForAll(A, mu(A) == mu_iter(A, 0)), _subst_fun_body=mu_iter(Var(0), 0)), mu_iter: Defn(name='mu_iter', decl=mu_iter, args=[A, n], body=If(A[n], n, mu_iter(A, n + 1)), ax=|= ForAll([A, n],        mu_iter(A, n) == If(A[n], n, mu_iter(A, n + 1))), _subst_fun_body=If(Var(0)[Var(1)], Var(1), mu_iter(Var(0), Var(1) + 1))), mul: Defn(name='mul', decl=mul, args=[x, y], body=x*y, ax=|= ForAll([x, y], mul(x, y) == x*y), _subst_fun_body=Var(0)*Var(1)), mul: Defn(name='mul', decl=mul, args=[I, J], body=Interval(If(And(hi(I)*hi(J) <= lo(I)*lo(J),                 hi(I)*hi(J) <= hi(I)*lo(J),                 hi(I)*hi(J) <= lo(I)*hi(J)),             hi(I)*hi(J),             If(And(lo(I)*lo(J) <= hi(I)*lo(J),                    lo(I)*lo(J) <= lo(I)*hi(J)),                lo(I)*lo(J),                If(And(hi(I)*lo(J) <= lo(I)*hi(J)),                   hi(I)*lo(J),                   lo(I)*hi(J)))),          If(And(hi(I)*hi(J) >= lo(I)*lo(J),                 hi(I)*hi(J) >= hi(I)*lo(J),                 hi(I)*hi(J) >= lo(I)*hi(J)),             hi(I)*hi(J),             If(And(lo(I)*lo(J) <= hi(I)*lo(J),                    lo(I)*lo(J) <= lo(I)*hi(J)),                lo(I)*lo(J),                If(And(hi(I)*lo(J) <= lo(I)*hi(J)),                   hi(I)*lo(J),                   lo(I)*hi(J))))), ax=|= ForAll([I, J],        mul(I, J) ==        Interval(If(And(hi(I)*hi(J) <= lo(I)*lo(J),                        hi(I)*hi(J) <= hi(I)*lo(J),                        hi(I)*hi(J) <= lo(I)*hi(J)),                    hi(I)*hi(J),                    If(And(lo(I)*lo(J) <= hi(I)*lo(J),                           lo(I)*lo(J) <= lo(I)*hi(J)),                       lo(I)*lo(J),                       If(And(hi(I)*lo(J) <= lo(I)*hi(J)),                          hi(I)*lo(J),                          lo(I)*hi(J)))),                 If(And(hi(I)*hi(J) >= lo(I)*lo(J),                        hi(I)*hi(J) >= hi(I)*lo(J),                        hi(I)*hi(J) >= lo(I)*hi(J)),                    hi(I)*hi(J),                    If(And(lo(I)*lo(J) <= hi(I)*lo(J),                           lo(I)*lo(J) <= lo(I)*hi(J)),                       lo(I)*lo(J),                       If(And(hi(I)*lo(J) <= lo(I)*hi(J)),                          hi(I)*lo(J),                          lo(I)*hi(J)))))), _subst_fun_body=Interval(If(And(hi(Var(0))*hi(Var(1)) <=                 lo(Var(0))*lo(Var(1)),                 hi(Var(0))*hi(Var(1)) <=                 hi(Var(0))*lo(Var(1)),                 hi(Var(0))*hi(Var(1)) <=                 lo(Var(0))*hi(Var(1))),             hi(Var(0))*hi(Var(1)),             If(And(lo(Var(0))*lo(Var(1)) <=                    hi(Var(0))*lo(Var(1)),                    lo(Var(0))*lo(Var(1)) <=                    lo(Var(0))*hi(Var(1))),                lo(Var(0))*lo(Var(1)),                If(And(hi(Var(0))*lo(Var(1)) <=                       lo(Var(0))*hi(Var(1))),                   hi(Var(0))*lo(Var(1)),                   lo(Var(0))*hi(Var(1))))),          If(And(hi(Var(0))*hi(Var(1)) >=                 lo(Var(0))*lo(Var(1)),                 hi(Var(0))*hi(Var(1)) >=                 hi(Var(0))*lo(Var(1)),                 hi(Var(0))*hi(Var(1)) >=                 lo(Var(0))*hi(Var(1))),             hi(Var(0))*hi(Var(1)),             If(And(lo(Var(0))*lo(Var(1)) <=                    hi(Var(0))*lo(Var(1)),                    lo(Var(0))*lo(Var(1)) <=                    lo(Var(0))*hi(Var(1))),                lo(Var(0))*lo(Var(1)),                If(And(hi(Var(0))*lo(Var(1)) <=                       lo(Var(0))*hi(Var(1))),                   hi(Var(0))*lo(Var(1)),                   lo(Var(0))*hi(Var(1))))))), nested: Defn(name='nested', decl=nested, args=[An], body=ForAll(n, subset(An[n + 1], An[n])), ax=|= ForAll(An,        nested(An) == (ForAll(n, subset(An[n + 1], An[n])))), _subst_fun_body=ForAll(n, subset(Var(1)[n + 1], Var(1)[n]))), next: Defn(name='next', decl=next, args=[p], body=T_Bool(Lambda(t!937, val(p)[t!937 + 1])), ax=|= ForAll(p,        next(p) == T_Bool(Lambda(t!937, val(p)[t!937 + 1]))), _subst_fun_body=T_Bool(Lambda(t!937, val(Var(1))[t!937 + 1]))), nonneg: Defn(name='nonneg', decl=nonneg, args=[x], body=absR(x) == x, ax=|= ForAll(x, nonneg(x) == (absR(x) == x)), _subst_fun_body=absR(Var(0)) == Var(0)), norm2: Defn(name='norm2', decl=norm2, args=[z], body=C.mul(z, conj(z)), ax=|= ForAll(z, norm2(z) == C.mul(z, conj(z))), _subst_fun_body=C.mul(Var(0), conj(Var(0)))), odd: Defn(name='odd', decl=odd, args=[x], body=Exists(y, x == 2*y + 1), ax=|= ForAll(x, odd(x) == (Exists(y, x == 2*y + 1))), _subst_fun_body=Exists(y, Var(1) == 2*y + 1)), one: Defn(name='one', decl=one, args=[], body=1, ax=|= one == 1, _subst_fun_body=1), ones: Defn(name='ones', decl=ones, args=[n], body=NDArray(Unit(n), K(Int, 1)), ax=|= ForAll(n, ones(n) == NDArray(Unit(n), K(Int, 1))), _subst_fun_body=NDArray(Unit(Var(0)), K(Int, 1))), open_int: Defn(name='open_int', decl=open_int, args=[x, y], body=Lambda(z, And(x < z, z < y)), ax=|= ForAll([x, y],        open_int(x, y) == (Lambda(z, And(x < z, z < y)))), _subst_fun_body=Lambda(z, And(Var(1) < z, z < Var(2)))), pair: Defn(name='pair', decl=pair, args=[a!1609, b!1610], body=upair(sing(a!1609), upair(a!1609, b!1610)), ax=|= ForAll([a!1609, b!1610],        pair(a!1609, b!1610) ==        upair(sing(a!1609), upair(a!1609, b!1610))), _subst_fun_body=upair(sing(Var(0)), upair(Var(0), Var(1)))), pick: Defn(name='pick', decl=pick, args=[a!1609], body=f!1627(a!1609), ax=|= ForAll(a!1609, pick(a!1609) == f!1627(a!1609)), _subst_fun_body=f!1627(Var(0))), pos: Defn(name='pos', decl=pos, args=[a], body=Lambda(i, If(i >= 0, a[i], 0)), ax=|= ForAll(a, pos(a) == (Lambda(i, If(i >= 0, a[i], 0)))), _subst_fun_body=Lambda(i, If(i >= 0, Var(1)[i], 0))), pow: Defn(name='pow', decl=pow, args=[x, y], body=x**y, ax=|= ForAll([x, y], pow(x, y) == x**y), _subst_fun_body=Var(0)**Var(1)), powers: Defn(name='powers', decl=powers, args=[x], body=Lambda(i,        If(i == 0,           1,           If(i < 0, powers(x)[i + 1]/x, x*powers(x)[i - 1]))), ax=|= ForAll(x,        powers(x) ==        (Lambda(i,                If(i == 0,                   1,                   If(i < 0,                      powers(x)[i + 1]/x,                      x*powers(x)[i - 1]))))), _subst_fun_body=Lambda(i,        If(i == 0,           1,           If(i < 0,              powers(Var(1))[i + 1]/Var(1),              Var(1)*powers(Var(1))[i - 1])))), pownat: Defn(name='pownat', decl=pownat, args=[x, n], body=If(n == 0,    1,    If(n > 0, x*pownat(x, n - 1), pownat(x, n + 1)/x)), ax=|= ForAll([x, n],        pownat(x, n) ==        If(n == 0,           1,           If(n > 0, x*pownat(x, n - 1), pownat(x, n + 1)/x))), _subst_fun_body=If(Var(1) == 0,    1,    If(Var(1) > 0,       Var(0)*pownat(Var(0), Var(1) - 1),       pownat(Var(0), Var(1) + 1)/Var(0)))), prime: Defn(name='prime', decl=prime, args=[n], body=And(n > 1, Not(Exists([p, q], And(p > 1, q > 1, n == p*q)))), ax=|= ForAll(n,        prime(n) ==        And(n > 1,            Not(Exists([p, q], And(p > 1, q > 1, n == p*q))))), _subst_fun_body=And(Var(0) > 1,     Not(Exists([p, q], And(p > 1, q > 1, Var(2) == p*q))))), prod: Defn(name='prod', decl=prod, args=[A, B], body=sep(pow(pow(union(A, B))),     Lambda(p!1613,            Exists([x, y],                   And(And(∈(x, A), ∈(y, B)),                       p!1613 == pair(x, y))))), ax=|= ForAll([A, B],        prod(A, B) ==        sep(pow(pow(union(A, B))),            Lambda(p!1613,                   Exists([x, y],                          And(And(∈(x, A), ∈(y, B)),                              p!1613 == pair(x, y)))))), _subst_fun_body=sep(pow(pow(union(Var(0), Var(1)))),     Lambda(p!1613,            Exists([x, y],                   And(And(∈(x, Var(3)), ∈(y, Var(4))),                       p!1613 == pair(x, y)))))), ran: Defn(name='ran', decl=ran, args=[R], body=sep(bigunion(bigunion(R)),     Lambda(y, Exists(x, ∈(pair(x, y), R)))), ax=|= ForAll(R,        ran(R) ==        sep(bigunion(bigunion(R)),            Lambda(y, Exists(x, ∈(pair(x, y), R))))), _subst_fun_body=sep(bigunion(bigunion(Var(0))),     Lambda(y, Exists(x, ∈(pair(x, y), Var(2)))))), reflects: Defn(name='reflects', decl=reflects, args=[P, A], body=ForAll(x, ∈(x, A) == P[x]), ax=|= ForAll([P, A],        reflects(P, A) == (ForAll(x, ∈(x, A) == P[x]))), _subst_fun_body=ForAll(x, ∈(x, Var(2)) == Var(1)[x])), rev: Defn(name='rev', decl=rev, args=[a], body=Lambda(i, a[-i]), ax=|= ForAll(a, rev(a) == (Lambda(i, a[-i]))), _subst_fun_body=Lambda(i, Var(1)[-i])), safe_pred: Defn(name='safe_pred', decl=safe_pred, args=[n], body=If(is(Z, n), Z, pred(n)), ax=|= ForAll(n, safe_pred(n) == If(is(Z, n), Z, pred(n))), _subst_fun_body=If(is(Z, Var(0)), Z, pred(Var(0)))), search: Defn(name='search', decl=search, args=[P, n!284], body=If(P[n!284],    n!284,    If(P[-n!284], -n!284, If(P[n!284 + 1], 1, 0))), ax=|= ForAll([P, n!284],        search(P, n!284) ==        If(P[n!284],           n!284,           If(P[-n!284], -n!284, If(P[n!284 + 1], 1, 0)))), _subst_fun_body=If(Var(0)[Var(1)],    Var(1),    If(Var(0)[-Var(1)],       -Var(1),       If(Var(0)[Var(1) + 1], 1, 0)))), setof: Defn(name='setof', decl=setof, args=[x], body=Lambda(a, ~unknowns(x) & a == ones(x)), ax=|= ForAll(x,        setof(x) == (Lambda(a, ~unknowns(x) & a == ones(x)))), _subst_fun_body=Lambda(a, ~unknowns(Var(1)) & a == ones(Var(1)))), setof: Defn(name='setof', decl=setof, args=[i], body=Lambda(x, And(lo(i) <= x, x <= hi(i))), ax=|= ForAll(i,        setof(i) == (Lambda(x, And(lo(i) <= x, x <= hi(i))))), _subst_fun_body=Lambda(x, And(lo(Var(1)) <= x, x <= hi(Var(1))))), sgn: Defn(name='sgn', decl=sgn, args=[x], body=If(x > 0, 1, If(x < 0, -1, 0)), ax=|= ForAll(x, sgn(x) == If(x > 0, 1, If(x < 0, -1, 0))), _subst_fun_body=If(Var(0) > 0, 1, If(Var(0) < 0, -1, 0))), shift: Defn(name='shift', decl=shift, args=[a, n], body=Lambda(i, a[i - n]), ax=|= ForAll([a, n], shift(a, n) == (Lambda(i, a[i - n]))), _subst_fun_body=Lambda(i, Var(1)[i - Var(2)])), shift: Defn(name='shift', decl=shift, args=[A, c], body=Lambda(x, A[x - c]), ax=|= ForAll([A, c], shift(A, c) == (Lambda(x, A[x - c]))), _subst_fun_body=Lambda(x, Var(1)[x - Var(2)])), sin: Defn(name='sin', decl=sin, args=[a], body=Map(sin, a), ax=|= ForAll(a, sin(a) == Map(sin, a)), _subst_fun_body=Map(sin, Var(0))), sing: Defn(name='sing', decl=sing, args=[c], body=Lambda(x, x == c), ax=|= ForAll(c, sing(c) == (Lambda(x, x == c))), _subst_fun_body=Lambda(x, x == Var(1))), sing: Defn(name='sing', decl=sing, args=[x], body=upair(x, x), ax=|= ForAll(x, sing(x) == upair(x, x)), _subst_fun_body=upair(Var(0), Var(0))), smul: Defn(name='smul', decl=smul, args=[x, a], body=Lambda(n, x*a[n]), ax=|= ForAll([x, a], smul(x, a) == (Lambda(n, x*a[n]))), _subst_fun_body=Lambda(n, Var(1)*Var(2)[n])), snd: Defn(name='snd', decl=snd, args=[p!1613], body=If(sing(sing(fst(p!1613))) == p!1613,    fst(p!1613),    pick(ZFSet.sub(bigunion(p!1613), sing(fst(p!1613))))), ax=|= ForAll(p!1613,        snd(p!1613) ==        If(sing(sing(fst(p!1613))) == p!1613,           fst(p!1613),           pick(ZFSet.sub(bigunion(p!1613),                          sing(fst(p!1613)))))), _subst_fun_body=If(sing(sing(fst(Var(0)))) == Var(0),    fst(Var(0)),    pick(ZFSet.sub(bigunion(Var(0)), sing(fst(Var(0))))))), sqr: Defn(name='sqr', decl=sqr, args=[x], body=x*x, ax=|= ForAll(x, sqr(x) == x*x), _subst_fun_body=Var(0)*Var(0)), sqrt: Defn(name='sqrt', decl=sqrt, args=[x], body=x**(1/2), ax=|= ForAll(x, sqrt(x) == x**(1/2)), _subst_fun_body=Var(0)**(1/2)), sub: Defn(name='sub', decl=sub, args=[x, y], body=x - y, ax=|= ForAll([x, y], sub(x, y) == x - y), _subst_fun_body=Var(0) - Var(1)), tan: Defn(name='tan', decl=tan, args=[x], body=sin(x)/cos(x), ax=|= ForAll(x, tan(x) == sin(x)/cos(x)), _subst_fun_body=sin(Var(0))/cos(Var(0))), tand: Defn(name='tand', decl=tand, args=[p, q], body=T_Bool(Lambda(t!930, And(val(p)[t!930], val(q)[t!930]))), ax=|= ForAll([p, q],        tand(p, q) ==        T_Bool(Lambda(t!930,                      And(val(p)[t!930], val(q)[t!930])))), _subst_fun_body=T_Bool(Lambda(t!930,               And(val(Var(1))[t!930], val(Var(2))[t!930])))), timpl: Defn(name='timpl', decl=timpl, args=[p, q], body=T_Bool(Lambda(t!932, Implies(val(p)[t!932], val(q)[t!932]))), ax=|= ForAll([p, q],        timpl(p, q) ==        T_Bool(Lambda(t!932,                      Implies(val(p)[t!932], val(q)[t!932])))), _subst_fun_body=T_Bool(Lambda(t!932,               Implies(val(Var(1))[t!932],                       val(Var(2))[t!932])))), tint: Defn(name='tint', decl=tint, args=[x], body=T_Int(K(Int, x)), ax=|= ForAll(x, tint(x) == T_Int(K(Int, x))), _subst_fun_body=T_Int(K(Int, Var(0)))), tnot: Defn(name='tnot', decl=tnot, args=[p], body=T_Bool(Lambda(t!929, Not(val(p)[t!929]))), ax=|= ForAll(p,        tnot(p) == T_Bool(Lambda(t!929, Not(val(p)[t!929])))), _subst_fun_body=T_Bool(Lambda(t!929, Not(val(Var(1))[t!929])))), to_int: Defn(name='to_int', decl=to_int, args=[n], body=If(is(Z, n), 0, 1 + to_int(pred(n))), ax=|= ForAll(n, to_int(n) == If(is(Z, n), 0, 1 + to_int(pred(n)))), _subst_fun_body=If(is(Z, Var(0)), 0, 1 + to_int(pred(Var(0))))), tor: Defn(name='tor', decl=tor, args=[p, q], body=T_Bool(Lambda(t!931, Or(val(p)[t!931], val(q)[t!931]))), ax=|= ForAll([p, q],        tor(p, q) ==        T_Bool(Lambda(t!931,                      Or(val(p)[t!931], val(q)[t!931])))), _subst_fun_body=T_Bool(Lambda(t!931,               Or(val(Var(1))[t!931], val(Var(2))[t!931])))), union: Defn(name='union', decl=union, args=[A, B], body=bigunion(upair(A, B)), ax=|= ForAll([A, B], union(A, B) == bigunion(upair(A, B))), _subst_fun_body=bigunion(upair(Var(0), Var(1)))), upper_bound: Defn(name='upper_bound', decl=upper_bound, args=[A, x], body=ForAll(y, Implies(A[y], EReal.le(y, x))), ax=|= ForAll([A, x],        upper_bound(A, x) ==        (ForAll(y, Implies(A[y], EReal.le(y, x))))), _subst_fun_body=ForAll(y, Implies(Var(1)[y], EReal.le(y, Var(2))))), valid: Defn(name='valid', decl=valid, args=[a], body=ForAll(w, val(a)[w]), ax=|= ForAll(a, valid(a) == (ForAll(w, val(a)[w]))), _subst_fun_body=ForAll(w, val(Var(1))[w])), valid: Defn(name='valid', decl=valid, args=[p], body=val(p)[0], ax=|= ForAll(p, valid(p) == val(p)[0]), _subst_fun_body=val(Var(0))[0]), where: Defn(name='where', decl=where, args=[mask, a, b], body=Lambda(i, If(mask[i], a[i], b[i])), ax=|= ForAll([mask, a, b],        where(mask, a, b) ==        (Lambda(i, If(mask[i], a[i], b[i])))), _subst_fun_body=Lambda(i, If(Var(1)[i], Var(2)[i], Var(3)[i]))), width: Defn(name='width', decl=width, args=[i], body=hi(i) - lo(i), ax=|= ForAll(i, width(i) == hi(i) - lo(i)), _subst_fun_body=hi(Var(0)) - lo(Var(0))), zero: Defn(name='zero', decl=zero, args=[], body=0, ax=|= zero == 0, _subst_fun_body=0), zero: Defn(name='zero', decl=zero, args=[], body=K(Int, 0), ax=|= zero == K(Int, 0), _subst_fun_body=K(Int, 0)), zero: Defn(name='zero', decl=zero, args=[n], body=NDArray(Unit(n), K(Int, 0)), ax=|= ForAll(n, zero(n) == NDArray(Unit(n), K(Int, 0))), _subst_fun_body=NDArray(Unit(Var(0)), K(Int, 0))), zeros: Defn(name='zeros', decl=zeros, args=[x], body=~unknowns(x) & ~ones(x), ax=|= ForAll(x, zeros(x) == ~unknowns(x) & ~ones(x)), _subst_fun_body=~unknowns(Var(0)) & ~ones(Var(0)))}

defn holds definitional axioms for function symbols.

kdrag.kernel.ext(domain: Sequence[SortRef], range_: SortRef) Proof
>>> ext([smt.IntSort()], smt.IntSort())
|= ForAll([f, g], (f == g) == (ForAll(x0, f[x0] == g[x0])))
>>> ext([smt.IntSort(), smt.RealSort()], smt.IntSort())
|= ForAll([f, g],
       (f == g) ==
       (ForAll([x0, x1],
               Select(f, x0, x1) == Select(g, x0, x1))))
Parameters:
  • domain (Sequence[SortRef])

  • range_ (SortRef)

Return type:

Proof

kdrag.kernel.forget(ts: Sequence[ExprRef], thm: QuantifierRef) Proof

“Forget” a term using existentials. This is existential introduction. P(ts) -> exists xs, P(xs) thm is an existential formula, and ts are terms to substitute those variables with. forget easily follows. https://en.wikipedia.org/wiki/Existential_generalization

Parameters:
  • ts (Sequence[ExprRef])

  • thm (QuantifierRef)

Return type:

Proof

kdrag.kernel.fresh_const(q: QuantifierRef, prefixes=None) list[ExprRef]

Generate fresh constants of same sort as quantifier.

Parameters:

q (QuantifierRef)

Return type:

list[ExprRef]

kdrag.kernel.generalize(vs: list[ExprRef], pf: Proof) Proof

Generalize a theorem with respect to a list of schema variables. This introduces a universal quantifier for schema variables.

>>> x = FreshVar("x", smt.IntSort())
>>> y = FreshVar("y", smt.IntSort())
>>> generalize([x, y], prove(x == x))
|= ForAll([x!..., y!...], x!... == x!...)
Parameters:
  • vs (list[ExprRef])

  • pf (Proof)

Return type:

Proof

kdrag.kernel.herb(thm: QuantifierRef, prefixes=None) tuple[list[ExprRef], Proof]

Herbrandize a theorem. It is sufficient to prove a theorem for fresh consts to prove a universal. Note: Perhaps lambdaized form is better? Return vars and lamda that could receive |= P[vars]

>>> x = smt.Int("x")
>>> herb(smt.ForAll([x], x >= x))
([x!...], |=  Implies(x!... >= x!..., ForAll(x, x >= x)))
Parameters:

thm (QuantifierRef)

Return type:

tuple[list[ExprRef], Proof]

kdrag.kernel.induct_inductive(x: DatatypeRef, P: QuantifierRef) Proof

Build a basic induction principle for an algebraic datatype

Parameters:
  • x (DatatypeRef)

  • P (QuantifierRef)

Return type:

Proof

kdrag.kernel.instan(ts: Sequence[ExprRef], pf: Proof) Proof

Instantiate a universally quantified formula. This is forall elimination

Parameters:
  • ts (Sequence[ExprRef])

  • pf (Proof)

Return type:

Proof

kdrag.kernel.is_defined(x: ExprRef) bool

Determined if expression head is in definitions.

Parameters:

x (ExprRef)

Return type:

bool

kdrag.kernel.is_fresh_var(v: ExprRef) bool

Check if a variable is a schema variable. Schema variables are generated by FreshVar and have a _FreshVarEvidence attribute.

>>> is_fresh_var(FreshVar("x", smt.IntSort()))
True
Parameters:

v (ExprRef)

Return type:

bool

kdrag.kernel.is_proof(p: Proof) bool
Parameters:

p (Proof)

Return type:

bool

kdrag.kernel.modus(ab: Proof, a: Proof) Proof

Modus ponens for implies and equality.

>>> a,b = smt.Bools("a b")
>>> ab = axiom(smt.Implies(a, b))
>>> a = axiom(a)
>>> modus(ab, a)
|= b
>>> ab1 = axiom(smt.Eq(a.thm, b))
>>> modus(ab1, a)
|= b
Parameters:
Return type:

Proof

kdrag.kernel.obtain(thm: QuantifierRef) tuple[list[ExprRef], Proof]

Skolemize an existential quantifier. exists xs, P(xs) -> P(cs) for fresh cs https://en.wikipedia.org/wiki/Existential_instantiation

>>> x = smt.Int("x")
>>> obtain(smt.Exists([x], x >= 0))
([x!...], |=  Implies(Exists(x, x >= 0), x!... >= 0))
>>> y = FreshVar("y", smt.IntSort())
>>> obtain(smt.Exists([x], x >= y))
([f!...(y!...)], |=  Implies(Exists(x, x >= y!...), f!...(y!...) >= y!...))
Parameters:

thm (QuantifierRef)

Return type:

tuple[list[ExprRef], Proof]

kdrag.kernel.prove(thm: BoolRef, by: Proof | Iterable[Proof] = [], admit=False, timeout=1000, dump=False, solver=None) Proof

Prove a theorem using a list of previously proved lemmas.

In essence prove(Implies(by, thm)).

Parameters:
  • thm (smt.BoolRef) – The theorem to prove.

  • thm – The theorem to prove.

  • by (list[Proof]) – A list of previously proved lemmas.

  • admit (bool) – If True, admit the theorem without proof.

Returns:

A proof object of thm

Return type:

Proof

>>> prove(smt.BoolVal(True))
|= True
>>> prove(smt.RealVal(1) >= smt.RealVal(0))
|= 1 >= 0
kdrag.kernel.rename_vars2(pf: Proof, vs: list[ExprRef], patterns=[], no_patterns=[]) Proof

Rename bound variables and also attach triggers

>>> x,y = smt.Ints("x y")
>>> f = smt.Function("f", smt.IntSort(), smt.IntSort())
>>> rename_vars2(kd.prove(smt.ForAll([x, y], x + 1 > x)), [y,x], patterns=[x+y])
|= ForAll([y, x], y + 1 > y)
>>> rename_vars2(kd.prove(smt.Exists([x], x + 1 > y)), [y])
Traceback (most recent call last):
    ...
ValueError: ('Cannot rename vars to ones that already occur in term', [y], Exists(x, x + 1 > y))
Parameters:
  • pf (Proof)

  • vs (list[ExprRef])

Return type:

Proof

kdrag.kernel.specialize(ts: Sequence[ExprRef], thm: BoolRef) Proof

Instantiate a universally quantified formula forall xs, P(xs) -> P(ts) This is forall elimination

Parameters:
  • ts (Sequence[ExprRef])

  • thm (BoolRef)

Return type:

Proof

kdrag.kernel.subst(t: ExprRef, eqs: Sequence[Proof]) tuple[ExprRef, Proof]

Substitute using equality proofs

>>> x, y = smt.Ints("x y")
>>> eq = kd.prove(x == ((x + 1) - 1))
>>> subst(x + 3, [eq])
(x + 1 - 1 + 3, |= x + 3 == x + 1 - 1 + 3)
Parameters:
  • t (ExprRef)

  • eqs (Sequence[Proof])

Return type:

tuple[ExprRef, Proof]

kdrag.kernel.unfold(e: ExprRef, decls: Sequence[FuncDeclRef]) tuple[ExprRef, Proof]

Unfold function definitions in an expression.

>>> x,y = smt.Ints("x y")
>>> f = define("f", [x,y], x + 2*y)
>>> g = define("g", [x,y], f(x,y) + 1)
>>> unfold(f(42,13) + g(7,8), [f])
(42 + 2*13 + g(7, 8), |= f(42, 13) + g(7, 8) == 42 + 2*13 + g(7, 8))
>>> unfold(f(42,13) + g(7,8), [f,g])
(42 + 2*13 + f(7, 8) + 1, |= f(42, 13) + g(7, 8) == 42 + 2*13 + f(7, 8) + 1)
Parameters:
  • e (ExprRef)

  • decls (Sequence[FuncDeclRef])

Return type:

tuple[ExprRef, Proof]