- 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.
Preterm evaluation
Equations
- omega.nat.preterm.val v (t1 -* t2) = omega.nat.preterm.val v t1 - omega.nat.preterm.val v t2
- omega.nat.preterm.val v (t1 +* t2) = omega.nat.preterm.val v t1 + omega.nat.preterm.val v t2
- omega.nat.preterm.val v (i ** n) = ite (i = 1) (v n) ((v n) * i)
- omega.nat.preterm.val v (&i) = i
@[simp]
@[simp]
theorem
omega.nat.preterm.val_var
{v : ℕ → ℕ}
{m n : ℕ} :
omega.nat.preterm.val v (m ** n) = m * v n
@[simp]
theorem
omega.nat.preterm.val_add
{v : ℕ → ℕ}
{t s : omega.nat.preterm} :
omega.nat.preterm.val v (t +* 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 -* 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 -* t2).fresh_index = max t1.fresh_index t2.fresh_index
- (t1 +* t2).fresh_index = max t1.fresh_index t2.fresh_index
- (i ** n).fresh_index = n + 1
- (&_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]
@[simp]
Return a term (which is in canonical form by definition) that is equivalent to the input preterm
Equations
- omega.nat.canonize (_x -* _x_1) = (0, list.nil ℤ)
- omega.nat.canonize (t +* s) = (omega.nat.canonize t).add (omega.nat.canonize s)
- omega.nat.canonize (m ** n) = (0, list.nil {n ↦ ↑m})
- omega.nat.canonize (&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)