- num: Nat → Nat.SOM.Expr
- var: Nat.Linear.Var → Nat.SOM.Expr
- add: Nat.SOM.Expr → Nat.SOM.Expr → Nat.SOM.Expr
- mul: Nat.SOM.Expr → Nat.SOM.Expr → Nat.SOM.Expr
Instances For
Equations
- Nat.SOM.instInhabitedExpr = { default := Nat.SOM.Expr.num default }
Equations
- Nat.SOM.Expr.denote ctx (Nat.SOM.Expr.num n) = n
- Nat.SOM.Expr.denote ctx (Nat.SOM.Expr.var v) = Nat.Linear.Var.denote ctx v
- Nat.SOM.Expr.denote ctx (a.add b) = (Nat.SOM.Expr.denote ctx a).add (Nat.SOM.Expr.denote ctx b)
- Nat.SOM.Expr.denote ctx (a.mul b) = (Nat.SOM.Expr.denote ctx a).mul (Nat.SOM.Expr.denote ctx b)
Instances For
@[reducible, inline]
Equations
Instances For
Equations
- Nat.SOM.Mon.denote ctx [] = 1
- Nat.SOM.Mon.denote ctx (v :: vs) = (Nat.Linear.Var.denote ctx v).mul (Nat.SOM.Mon.denote ctx vs)
Instances For
Equations
- m₁.mul m₂ = Nat.SOM.Mon.mul.go Nat.Linear.hugeFuel m₁ m₂
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Nat.SOM.Mon.mul.go 0 m₁ m₂ = m₁ ++ m₂
- Nat.SOM.Mon.mul.go fuel_2.succ m₁ [] = m₁
- Nat.SOM.Mon.mul.go fuel_2.succ [] m₂ = m₂
Instances For
@[reducible, inline]
Equations
Instances For
Equations
- Nat.SOM.Poly.denote ctx [] = 0
- Nat.SOM.Poly.denote ctx ((k, m) :: p) = (k.mul (Nat.SOM.Mon.denote ctx m)).add (Nat.SOM.Poly.denote ctx p)
Instances For
Equations
- p₁.add p₂ = Nat.SOM.Poly.add.go Nat.Linear.hugeFuel p₁ p₂
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Nat.SOM.Poly.add.go 0 p₁ p₂ = p₁ ++ p₂
- Nat.SOM.Poly.add.go fuel_2.succ p₁ [] = p₁
- Nat.SOM.Poly.add.go fuel_2.succ [] p₂ = p₂
Instances For
Equations
- Nat.SOM.Poly.insertSorted k m [] = [(k, m)]
- Nat.SOM.Poly.insertSorted k m ((k_1, m_1) :: p_1) = bif decide (m < m_1) then (k, m) :: (k_1, m_1) :: p_1 else (k_1, m_1) :: Nat.SOM.Poly.insertSorted k m p_1
Instances For
Equations
- p.mulMon k m = Nat.SOM.Poly.mulMon.go k m p []
Instances For
Equations
- Nat.SOM.Poly.mulMon.go k m [] acc = acc
- Nat.SOM.Poly.mulMon.go k m ((k_1, m_1) :: p_1) acc = Nat.SOM.Poly.mulMon.go k m p_1 (Nat.SOM.Poly.insertSorted (k * k_1) (m.mul m_1) acc)
Instances For
Equations
- p₁.mul p₂ = Nat.SOM.Poly.mul.go p₂ p₁ []
Instances For
Equations
- Nat.SOM.Poly.mul.go p₂ [] acc = acc
- Nat.SOM.Poly.mul.go p₂ ((k, m) :: p) acc = Nat.SOM.Poly.mul.go p₂ p (acc.add (p₂.mulMon k m))
Instances For
Equations
- (Nat.SOM.Expr.num n).toPoly = bif n == 0 then [] else [(n, [])]
- (Nat.SOM.Expr.var v).toPoly = [(1, [v])]
- (a.add b).toPoly = a.toPoly.add b.toPoly
- (a.mul b).toPoly = a.toPoly.mul b.toPoly
Instances For
theorem
Nat.SOM.Mon.append_denote
(ctx : Nat.Linear.Context)
(m₁ : Nat.SOM.Mon)
(m₂ : Nat.SOM.Mon)
:
Nat.SOM.Mon.denote ctx (m₁ ++ m₂) = Nat.SOM.Mon.denote ctx m₁ * Nat.SOM.Mon.denote ctx m₂
theorem
Nat.SOM.Mon.mul_denote
(ctx : Nat.Linear.Context)
(m₁ : Nat.SOM.Mon)
(m₂ : Nat.SOM.Mon)
:
Nat.SOM.Mon.denote ctx (m₁.mul m₂) = Nat.SOM.Mon.denote ctx m₁ * Nat.SOM.Mon.denote ctx m₂
theorem
Nat.SOM.Mon.mul_denote.go
(ctx : Nat.Linear.Context)
(fuel : Nat)
(m₁ : Nat.SOM.Mon)
(m₂ : Nat.SOM.Mon)
:
Nat.SOM.Mon.denote ctx (Nat.SOM.Mon.mul.go fuel m₁ m₂) = Nat.SOM.Mon.denote ctx m₁ * Nat.SOM.Mon.denote ctx m₂
theorem
Nat.SOM.Poly.append_denote
(ctx : Nat.Linear.Context)
(p₁ : Nat.SOM.Poly)
(p₂ : Nat.SOM.Poly)
:
Nat.SOM.Poly.denote ctx (p₁ ++ p₂) = Nat.SOM.Poly.denote ctx p₁ + Nat.SOM.Poly.denote ctx p₂
theorem
Nat.SOM.Poly.add_denote
(ctx : Nat.Linear.Context)
(p₁ : Nat.SOM.Poly)
(p₂ : Nat.SOM.Poly)
:
Nat.SOM.Poly.denote ctx (p₁.add p₂) = Nat.SOM.Poly.denote ctx p₁ + Nat.SOM.Poly.denote ctx p₂
theorem
Nat.SOM.Poly.add_denote.go
(ctx : Nat.Linear.Context)
(fuel : Nat)
(p₁ : Nat.SOM.Poly)
(p₂ : Nat.SOM.Poly)
:
Nat.SOM.Poly.denote ctx (Nat.SOM.Poly.add.go fuel p₁ p₂) = Nat.SOM.Poly.denote ctx p₁ + Nat.SOM.Poly.denote ctx p₂
theorem
Nat.SOM.Poly.denote_insertSorted
(ctx : Nat.Linear.Context)
(k : Nat)
(m : Nat.SOM.Mon)
(p : Nat.SOM.Poly)
:
Nat.SOM.Poly.denote ctx (Nat.SOM.Poly.insertSorted k m p) = Nat.SOM.Poly.denote ctx p + k * Nat.SOM.Mon.denote ctx m
theorem
Nat.SOM.Poly.mulMon_denote
(ctx : Nat.Linear.Context)
(p : Nat.SOM.Poly)
(k : Nat)
(m : Nat.SOM.Mon)
:
Nat.SOM.Poly.denote ctx (p.mulMon k m) = Nat.SOM.Poly.denote ctx p * k * Nat.SOM.Mon.denote ctx m
theorem
Nat.SOM.Poly.mulMon_denote.go
(ctx : Nat.Linear.Context)
(k : Nat)
(m : Nat.SOM.Mon)
(p : Nat.SOM.Poly)
(acc : Nat.SOM.Poly)
:
Nat.SOM.Poly.denote ctx (Nat.SOM.Poly.mulMon.go k m p acc) = Nat.SOM.Poly.denote ctx acc + Nat.SOM.Poly.denote ctx p * k * Nat.SOM.Mon.denote ctx m
theorem
Nat.SOM.Poly.mul_denote
(ctx : Nat.Linear.Context)
(p₁ : Nat.SOM.Poly)
(p₂ : Nat.SOM.Poly)
:
Nat.SOM.Poly.denote ctx (p₁.mul p₂) = Nat.SOM.Poly.denote ctx p₁ * Nat.SOM.Poly.denote ctx p₂
theorem
Nat.SOM.Poly.mul_denote.go
(ctx : Nat.Linear.Context)
(p₂ : Nat.SOM.Poly)
(p₁ : Nat.SOM.Poly)
(acc : Nat.SOM.Poly)
:
Nat.SOM.Poly.denote ctx (Nat.SOM.Poly.mul.go p₂ p₁ acc) = Nat.SOM.Poly.denote ctx acc + Nat.SOM.Poly.denote ctx p₁ * Nat.SOM.Poly.denote ctx p₂
theorem
Nat.SOM.Expr.toPoly_denote
(ctx : Nat.Linear.Context)
(e : Nat.SOM.Expr)
:
Nat.SOM.Poly.denote ctx e.toPoly = Nat.SOM.Expr.denote ctx e
theorem
Nat.SOM.Expr.eq_of_toPoly_eq
(ctx : Nat.Linear.Context)
(a : Nat.SOM.Expr)
(b : Nat.SOM.Expr)
(h : (a.toPoly == b.toPoly) = true)
:
Nat.SOM.Expr.denote ctx a = Nat.SOM.Expr.denote ctx b