- cst : ℕ → omega.nat.preterm
- var : ℕ → ℕ → omega.nat.preterm
- add : omega.nat.preterm → omega.nat.preterm → omega.nat.preterm
- sub : omega.nat.preterm → omega.nat.preterm → omega.nat.preterm
Similar to exprterm
, except that all exprs are now replaced with
de Brujin indices of type nat
. This is akin to generalizing over
the terms represented by the said exprs.
Instances for omega.nat.preterm
- omega.nat.preterm.has_sizeof_inst
- omega.nat.preterm.has_reflect
- omega.nat.preterm.inhabited
Preterm evaluation
Equations
- omega.nat.preterm.val v (t1.sub t2) = omega.nat.preterm.val v t1 - omega.nat.preterm.val v t2
- omega.nat.preterm.val v (t1.add t2) = omega.nat.preterm.val v t1 + omega.nat.preterm.val v t2
- omega.nat.preterm.val v (omega.nat.preterm.var i n) = ite (i = 1) (v n) (v n * i)
- omega.nat.preterm.val v (omega.nat.preterm.cst i) = i
@[simp]
@[simp]
theorem
omega.nat.preterm.val_var
{v : ℕ → ℕ}
{m n : ℕ} :
omega.nat.preterm.val v (omega.nat.preterm.var m n) = m * v n
@[simp]
theorem
omega.nat.preterm.val_add
{v : ℕ → ℕ}
{t s : omega.nat.preterm} :
omega.nat.preterm.val v (t.add s) = omega.nat.preterm.val v t + omega.nat.preterm.val v s
@[simp]
theorem
omega.nat.preterm.val_sub
{v : ℕ → ℕ}
{t s : omega.nat.preterm} :
omega.nat.preterm.val v (t.sub s) = omega.nat.preterm.val v t - omega.nat.preterm.val v s
Fresh de Brujin index not used by any variable in argument
Equations
- (t1.sub t2).fresh_index = linear_order.max t1.fresh_index t2.fresh_index
- (t1.add t2).fresh_index = linear_order.max t1.fresh_index t2.fresh_index
- (omega.nat.preterm.var i n).fresh_index = n + 1
- (omega.nat.preterm.cst _x).fresh_index = 0
theorem
omega.nat.preterm.val_constant
(v w : ℕ → ℕ)
(t : omega.nat.preterm) :
(∀ (x : ℕ), x < t.fresh_index → v x = w x) → omega.nat.preterm.val v t = omega.nat.preterm.val w t
If variable assignments v
and w
agree on all variables that occur
in term t
, the value of t
under v
and w
are identical.
@[simp]
Equations
- t.add_one = t.add (omega.nat.preterm.cst 1)
@[simp]
Return a term (which is in canonical form by definition) that is equivalent to the input preterm
Equations
- omega.nat.canonize (_x.sub _x_1) = (0, list.nil ℤ)
- omega.nat.canonize (t.add s) = (omega.nat.canonize t).add (omega.nat.canonize s)
- omega.nat.canonize (omega.nat.preterm.var m n) = (0, list.func.set ↑m list.nil n)
- omega.nat.canonize (omega.nat.preterm.cst m) = (↑m, list.nil ℤ)
@[simp]
theorem
omega.nat.val_canonize
{v : ℕ → ℕ}
{t : omega.nat.preterm} :
t.sub_free → omega.term.val (λ (x : ℕ), ↑(v x)) (omega.nat.canonize t) = ↑(omega.nat.preterm.val v t)