Helper definitions and theorems for converting Nat
expressions into Int
one.
We use them to implement the arithmetic theories in grind
@[reducible, inline]
Equations
Instances For
Equations
- Int.OfNat.Var.denote ctx v = Lean.RArray.get ctx v
Instances For
Equations
- Int.OfNat.instBEqExpr = { beq := Int.OfNat.beqExpr✝ }
Equations
- Int.OfNat.Expr.denote ctx (Int.OfNat.Expr.num k) = k
- Int.OfNat.Expr.denote ctx (Int.OfNat.Expr.var v) = Int.OfNat.Var.denote ctx v
- Int.OfNat.Expr.denote ctx (a.add b) = (Int.OfNat.Expr.denote ctx a).add (Int.OfNat.Expr.denote ctx b)
- Int.OfNat.Expr.denote ctx (a.mul b) = (Int.OfNat.Expr.denote ctx a).mul (Int.OfNat.Expr.denote ctx b)
- Int.OfNat.Expr.denote ctx (a.div b) = (Int.OfNat.Expr.denote ctx a).div (Int.OfNat.Expr.denote ctx b)
- Int.OfNat.Expr.denote ctx (a.mod b) = (Int.OfNat.Expr.denote ctx a).mod (Int.OfNat.Expr.denote ctx b)
Instances For
Equations
- Int.OfNat.Expr.denoteAsInt ctx (Int.OfNat.Expr.num k) = Int.ofNat k
- Int.OfNat.Expr.denoteAsInt ctx (Int.OfNat.Expr.var v) = Int.ofNat (Int.OfNat.Var.denote ctx v)
- Int.OfNat.Expr.denoteAsInt ctx (a.add b) = (Int.OfNat.Expr.denoteAsInt ctx a).add (Int.OfNat.Expr.denoteAsInt ctx b)
- Int.OfNat.Expr.denoteAsInt ctx (a.mul b) = (Int.OfNat.Expr.denoteAsInt ctx a).mul (Int.OfNat.Expr.denoteAsInt ctx b)
- Int.OfNat.Expr.denoteAsInt ctx (a.div b) = (Int.OfNat.Expr.denoteAsInt ctx a).ediv (Int.OfNat.Expr.denoteAsInt ctx b)
- Int.OfNat.Expr.denoteAsInt ctx (a.mod b) = (Int.OfNat.Expr.denoteAsInt ctx a).emod (Int.OfNat.Expr.denoteAsInt ctx b)
Instances For
theorem
Int.OfNat.of_le
(ctx : Context)
(lhs rhs : Expr)
:
Expr.denote ctx lhs ≤ Expr.denote ctx rhs → Expr.denoteAsInt ctx lhs ≤ Expr.denoteAsInt ctx rhs
theorem
Int.OfNat.of_not_le
(ctx : Context)
(lhs rhs : Expr)
:
¬Expr.denote ctx lhs ≤ Expr.denote ctx rhs → ¬Expr.denoteAsInt ctx lhs ≤ Expr.denoteAsInt ctx rhs
theorem
Int.OfNat.of_dvd
(ctx : Context)
(d : Nat)
(e : Expr)
:
d ∣ Expr.denote ctx e → ofNat d ∣ Expr.denoteAsInt ctx e
theorem
Int.OfNat.of_eq
(ctx : Context)
(lhs rhs : Expr)
:
Expr.denote ctx lhs = Expr.denote ctx rhs → Expr.denoteAsInt ctx lhs = Expr.denoteAsInt ctx rhs
theorem
Int.OfNat.of_not_eq
(ctx : Context)
(lhs rhs : Expr)
:
¬Expr.denote ctx lhs = Expr.denote ctx rhs → ¬Expr.denoteAsInt ctx lhs = Expr.denoteAsInt ctx rhs