The areas / V34. The tactics of Mathlib
Mathlib.Tactic.NormNum.Basic
69 declarations. Mathlib docs · Source
norm_num basic plugins
This file adds norm_num plugins for
- constructors and constants
Nat.cast,Int.cast, andmkRat+,-,*, and/Nat.succ,Nat.sub,Nat.mod, andNat.div.
See other files in this directory for many more plugins.
Constructors and constants
Casts
Arithmetic
Logic
(In)equalities
Nat operations
def Mathlib.Meta.NormNum.invertibleOfMul E1 #
{α : Type u_1} → [inst : Semiring α] → (k : ℕ) → (b a : α) → [Invertible a] → a = ↑k * b → Invertible b
If b divides a and a is invertible, then b is invertible.
def Mathlib.Meta.NormNum.invertibleOfMul' E1 #
{α : Type u_1} → [inst : Semiring α] → {a k b : ℕ} → [Invertible ↑a] → a = k * b → Invertible ↑b
If b divides a and a is invertible, then b is invertible.
theorem Mathlib.Meta.NormNum.IsInt.raw_refl E1 #
∀ (n : ℤ), Mathlib.Meta.NormNum.IsInt n n
theorem Mathlib.Meta.NormNum.isNat_zero E1 #
∀ (α : Type u_1) [inst : AddMonoidWithOne α], Mathlib.Meta.NormNum.IsNat Zero.zero 0
def Mathlib.Meta.NormNum.evalZero E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies the expression Zero.zero, returning 0.
theorem Mathlib.Meta.NormNum.isNat_one E1 #
∀ (α : Type u_1) [inst : AddMonoidWithOne α], Mathlib.Meta.NormNum.IsNat One.one 1
def Mathlib.Meta.NormNum.evalOne E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies the expression One.one, returning 1.
theorem Mathlib.Meta.NormNum.isNat_ofNat E1 #
∀ (α : Type u) [inst : AddMonoidWithOne α] {a : α} {n : ℕ}, ↑n = a → Mathlib.Meta.NormNum.IsNat a n
def Mathlib.Meta.NormNum.evalOfNat E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies an expression OfNat.ofNat n, returning n.
theorem Mathlib.Meta.NormNum.isNat_intOfNat E1 #
∀ {n n' : ℕ}, Mathlib.Meta.NormNum.IsNat n n' → Mathlib.Meta.NormNum.IsNat (Int.ofNat n) n'
def Mathlib.Meta.NormNum.evalIntOfNat E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies the constructor application Int.ofNat n such that
norm_num successfully recognizes n, returning n.
theorem Mathlib.Meta.NormNum.isInt_negOfNat E1 #
∀ (m n : ℕ), Mathlib.Meta.NormNum.IsNat m n → Mathlib.Meta.NormNum.IsInt (Int.negOfNat m) (Int.negOfNat n)
def Mathlib.Meta.NormNum.evalNegOfNat E1 #
Mathlib.Meta.NormNum.NormNumExt
norm_num extension for Int.negOfNat.
It's useful for calling derive with the numerator of an .isNegNNRat branch.
theorem Mathlib.Meta.NormNum.isNat_natAbs_pos E1 #
∀ {n : ℤ} {a : ℕ}, Mathlib.Meta.NormNum.IsNat n a → Mathlib.Meta.NormNum.IsNat n.natAbs a
theorem Mathlib.Meta.NormNum.isNat_natAbs_neg E1 #
∀ {n : ℤ} {a : ℕ}, Mathlib.Meta.NormNum.IsInt n (Int.negOfNat a) → Mathlib.Meta.NormNum.IsNat n.natAbs a
def Mathlib.Meta.NormNum.evalIntNatAbs E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies the expression Int.natAbs n such that
norm_num successfully recognizes n.
theorem Mathlib.Meta.NormNum.isNat_natCast E1 #
∀ {R : Type u_1} [inst : AddMonoidWithOne R] (n m : ℕ),
Mathlib.Meta.NormNum.IsNat n m → Mathlib.Meta.NormNum.IsNat (↑n) m
def Mathlib.Meta.NormNum.evalNatCast E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies an expression Nat.cast n, returning n.
theorem Mathlib.Meta.NormNum.isNat_intCast E1 #
∀ {R : Type u_1} [inst : Ring R] (n : ℤ) (m : ℕ), Mathlib.Meta.NormNum.IsNat n m → Mathlib.Meta.NormNum.IsNat (↑n) m
theorem Mathlib.Meta.NormNum.isintCast E1 #
∀ {R : Type u_1} [inst : Ring R] (n m : ℤ), Mathlib.Meta.NormNum.IsInt n m → Mathlib.Meta.NormNum.IsInt (↑n) m
def Mathlib.Meta.NormNum.evalIntCast E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies an expression Int.cast n, returning n.
def LibraryNote.norm_num_lemma_function_equality E1 #
Batteries.Util.LibraryNote
Note: Many of the lemmas in this file use a function equality hypothesis like f = HAdd.hAdd
below. The reason for this is that when this is applied, to prove e.g. 100 + 200 = 300, the
+ here is HAdd.hAdd with an instance that may not be syntactically equal to the one supplied
by the AddMonoidWithOne instance, and rather than attempting to prove the instances equal lean
will sometimes decide to evaluate 100 + 200 directly (into whatever + is defined to do in this
ring), which is definitely not what we want; if the subterms are expensive to kernel-reduce then
this could cause a (kernel) deep recursion detected error (see https://github.com/leanprover/lean4/issues/2171, https://github.com/leanprover-community/mathlib4/pull/4048).
By using an equality for the unapplied + function and proving it by rfl we take away the
opportunity for lean to unfold the numerals (and the instance defeq problem is usually comparatively
easy).
theorem Mathlib.Meta.NormNum.isNat_add E1 #
∀ {α : Type u_1} [inst : AddMonoidWithOne α] {f : α → α → α} {a b : α} {a' b' c : ℕ},
f = HAdd.hAdd →
Mathlib.Meta.NormNum.IsNat a a' →
Mathlib.Meta.NormNum.IsNat b b' → a'.add b' = c → Mathlib.Meta.NormNum.IsNat (f a b) c
theorem Mathlib.Meta.NormNum.isInt_add E1 #
∀ {α : Type u_1} [inst : Ring α] {f : α → α → α} {a b : α} {a' b' c : ℤ},
f = HAdd.hAdd →
Mathlib.Meta.NormNum.IsInt a a' →
Mathlib.Meta.NormNum.IsInt b b' → a'.add b' = c → Mathlib.Meta.NormNum.IsInt (f a b) c
theorem Mathlib.Meta.NormNum.isNNRat_add E1 #
∀ {α : Type u_1} [inst : Semiring α] {f : α → α → α} {a b : α} {na nb nc da db dc k : ℕ},
f = HAdd.hAdd →
Mathlib.Meta.NormNum.IsNNRat a na da →
Mathlib.Meta.NormNum.IsNNRat b nb db →
(na.mul db).add (nb.mul da) = k.mul nc → da.mul db = k.mul dc → Mathlib.Meta.NormNum.IsNNRat (f a b) nc dc
theorem Mathlib.Meta.NormNum.isRat_add E1 #
∀ {α : Type u_1} [inst : Ring α] {f : α → α → α} {a b : α} {na nb nc : ℤ} {da db dc k : ℕ},
f = HAdd.hAdd →
Mathlib.Meta.NormNum.IsRat a na da →
Mathlib.Meta.NormNum.IsRat b nb db →
(na.mul ↑db).add (nb.mul ↑da) = (↑k).mul nc → da.mul db = k.mul dc → Mathlib.Meta.NormNum.IsRat (f a b) nc dc
def Mathlib.Meta.monadLiftOptionMetaM E1 #
MonadLift Option Lean.MetaM
Consider an Option as an object in the MetaM monad, by throwing an error on none.
def Mathlib.Meta.NormNum.Result.add E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{a b : Q(«$α»)} →
Mathlib.Meta.NormNum.Result q(«$a») →
Mathlib.Meta.NormNum.Result q(«$b») →
(inst : autoParam Q(Add «$α») Mathlib.Meta.NormNum.Result.add._auto_1) →
Lean.MetaM (Mathlib.Meta.NormNum.Result q(«$a» + «$b»))
The result of adding two norm_num results.
def Mathlib.Meta.NormNum.evalAdd E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form a + b,
such that norm_num successfully recognises both a and b.
theorem Mathlib.Meta.NormNum.isInt_neg E1 #
∀ {α : Type u_1} [inst : Ring α] {f : α → α} {a : α} {a' b : ℤ},
f = Neg.neg → Mathlib.Meta.NormNum.IsInt a a' → a'.neg = b → Mathlib.Meta.NormNum.IsInt (-a) b
theorem Mathlib.Meta.NormNum.isRat_neg E1 #
∀ {α : Type u_1} [inst : Ring α] {f : α → α} {a : α} {n n' : ℤ} {d : ℕ},
f = Neg.neg → Mathlib.Meta.NormNum.IsRat a n d → n.neg = n' → Mathlib.Meta.NormNum.IsRat (-a) n' d
def Mathlib.Meta.NormNum.Result.neg E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{a : Q(«$α»)} →
Mathlib.Meta.NormNum.Result q(«$a») →
(rα : autoParam Q(Ring «$α») Mathlib.Meta.NormNum.Result.neg._auto_1) →
Lean.MetaM (Mathlib.Meta.NormNum.Result q(-«$a»))
The result of negating a norm_num result.
def Mathlib.Meta.NormNum.evalNeg E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form -a,
such that norm_num successfully recognises a.
theorem Mathlib.Meta.NormNum.isInt_sub E1 #
∀ {α : Type u_1} [inst : Ring α] {f : α → α → α} {a b : α} {a' b' c : ℤ},
f = HSub.hSub →
Mathlib.Meta.NormNum.IsInt a a' →
Mathlib.Meta.NormNum.IsInt b b' → a'.sub b' = c → Mathlib.Meta.NormNum.IsInt (f a b) c
theorem Mathlib.Meta.NormNum.isRat_sub E1 #
∀ {α : Type u_1} [inst : Ring α] {f : α → α → α} {a b : α} {na nb nc : ℤ} {da db dc k : ℕ},
f = HSub.hSub →
Mathlib.Meta.NormNum.IsRat a na da →
Mathlib.Meta.NormNum.IsRat b nb db →
(na.mul ↑db).sub (nb.mul ↑da) = (↑k).mul nc → da.mul db = k.mul dc → Mathlib.Meta.NormNum.IsRat (f a b) nc dc
def Mathlib.Meta.NormNum.Result.sub E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{a b : Q(«$α»)} →
Mathlib.Meta.NormNum.Result q(«$a») →
Mathlib.Meta.NormNum.Result q(«$b») →
(inst : autoParam Q(Ring «$α») Mathlib.Meta.NormNum.Result.sub._auto_1) →
Lean.MetaM (Mathlib.Meta.NormNum.Result q(«$a» - «$b»))
The result of subtracting two norm_num results.
def Mathlib.Meta.NormNum.evalSub E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form a - b in a ring,
such that norm_num successfully recognises both a and b.
theorem Mathlib.Meta.NormNum.isNat_mul E1 #
∀ {α : Type u_1} [inst : Semiring α] {f : α → α → α} {a b : α} {a' b' c : ℕ},
f = HMul.hMul →
Mathlib.Meta.NormNum.IsNat a a' →
Mathlib.Meta.NormNum.IsNat b b' → a'.mul b' = c → Mathlib.Meta.NormNum.IsNat (a * b) c
theorem Mathlib.Meta.NormNum.isInt_mul E1 #
∀ {α : Type u_1} [inst : Ring α] {f : α → α → α} {a b : α} {a' b' c : ℤ},
f = HMul.hMul →
Mathlib.Meta.NormNum.IsInt a a' →
Mathlib.Meta.NormNum.IsInt b b' → a'.mul b' = c → Mathlib.Meta.NormNum.IsInt (a * b) c
theorem Mathlib.Meta.NormNum.isNNRat_mul E1 #
∀ {α : Type u_1} [inst : Semiring α] {f : α → α → α} {a b : α} {na nb nc da db dc k : ℕ},
f = HMul.hMul →
Mathlib.Meta.NormNum.IsNNRat a na da →
Mathlib.Meta.NormNum.IsNNRat b nb db →
na.mul nb = k.mul nc → da.mul db = k.mul dc → Mathlib.Meta.NormNum.IsNNRat (f a b) nc dc
theorem Mathlib.Meta.NormNum.isRat_mul E1 #
∀ {α : Type u_1} [inst : Ring α] {f : α → α → α} {a b : α} {na nb nc : ℤ} {da db dc k : ℕ},
f = HMul.hMul →
Mathlib.Meta.NormNum.IsRat a na da →
Mathlib.Meta.NormNum.IsRat b nb db →
na.mul nb = (↑k).mul nc → da.mul db = k.mul dc → Mathlib.Meta.NormNum.IsRat (f a b) nc dc
def Mathlib.Meta.NormNum.Result.mul E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{a b : Q(«$α»)} →
Mathlib.Meta.NormNum.Result q(«$a») →
Mathlib.Meta.NormNum.Result q(«$b») →
(inst : autoParam Q(Semiring «$α») Mathlib.Meta.NormNum.Result.mul._auto_1) →
Lean.MetaM (Mathlib.Meta.NormNum.Result q(«$a» * «$b»))
The result of multiplying two norm_num results.
def Mathlib.Meta.NormNum.evalMul E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form a * b,
such that norm_num successfully recognises both a and b.
theorem Mathlib.Meta.NormNum.isNNRat_div E1 #
∀ {α : Type u} [inst : DivisionSemiring α] {a b : α} {cn cd : ℕ},
Mathlib.Meta.NormNum.IsNNRat (a * b⁻¹) cn cd → Mathlib.Meta.NormNum.IsNNRat (a / b) cn cd
theorem Mathlib.Meta.NormNum.isRat_div E1 #
∀ {α : Type u} [inst : DivisionRing α] {a b : α} {cn : ℤ} {cd : ℕ},
Mathlib.Meta.NormNum.IsRat (a * b⁻¹) cn cd → Mathlib.Meta.NormNum.IsRat (a / b) cn cd
def Mathlib.Meta.NormNum.inferDivisionSemiring E1 #
{u : Lean.Level} → (α : Q(Type u)) → Lean.MetaM Q(DivisionSemiring «$α»)
Helper function to synthesize a typed DivisionSemiring α expression.
def Mathlib.Meta.NormNum.inferDivisionRing E1 #
{u : Lean.Level} → (α : Q(Type u)) → Lean.MetaM Q(DivisionRing «$α»)
Helper function to synthesize a typed DivisionRing α expression.
def Mathlib.Meta.NormNum.evalDiv E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form a / b,
such that norm_num successfully recognises both a and b.
def Mathlib.Meta.NormNum.evalTrue E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies True.
def Mathlib.Meta.NormNum.evalFalse E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies False.
def Mathlib.Meta.NormNum.evalNot E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form ¬a,
such that norm_num successfully recognises a.
theorem Mathlib.Meta.NormNum.isNat_eq_true E1 #
∀ {α : Type u} [inst : AddMonoidWithOne α] {a b : α} {c : ℕ},
Mathlib.Meta.NormNum.IsNat a c → Mathlib.Meta.NormNum.IsNat b c → a = b
theorem Mathlib.Meta.NormNum.ble_eq_false E1 #
∀ {x y : ℕ}, x.ble y = false ↔ y < x
theorem Mathlib.Meta.NormNum.isInt_eq_true E1 #
∀ {α : Type u} [inst : Ring α] {a b : α} {z : ℤ},
Mathlib.Meta.NormNum.IsInt a z → Mathlib.Meta.NormNum.IsInt b z → a = b
theorem Mathlib.Meta.NormNum.isNNRat_eq_true E1 #
∀ {α : Type u} [inst : Semiring α] {a b : α} {n d : ℕ},
Mathlib.Meta.NormNum.IsNNRat a n d → Mathlib.Meta.NormNum.IsNNRat b n d → a = b
theorem Mathlib.Meta.NormNum.isRat_eq_true E1 #
∀ {α : Type u} [inst : Ring α] {a b : α} {n : ℤ} {d : ℕ},
Mathlib.Meta.NormNum.IsRat a n d → Mathlib.Meta.NormNum.IsRat b n d → a = b
theorem Mathlib.Meta.NormNum.ne_of_false_of_true E1 #
∀ {a b : Prop}, ¬a → b → a ≠ b
theorem Mathlib.Meta.NormNum.ne_of_true_of_false E1 #
∀ {a b : Prop}, a → ¬b → a ≠ b
theorem Mathlib.Meta.NormNum.isNat_natSucc E1 #
∀ {a a' c : ℕ}, Mathlib.Meta.NormNum.IsNat a a' → a'.succ = c → Mathlib.Meta.NormNum.IsNat a.succ c
def Mathlib.Meta.NormNum.evalNatSucc E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form Nat.succ a,
such that norm_num successfully recognises a.
theorem Mathlib.Meta.NormNum.isNat_natSub E1 #
∀ {a b a' b' c : ℕ},
Mathlib.Meta.NormNum.IsNat a a' →
Mathlib.Meta.NormNum.IsNat b b' → a'.sub b' = c → Mathlib.Meta.NormNum.IsNat (a - b) c
def Mathlib.Meta.NormNum.evalNatSub E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form Nat.sub a b,
such that norm_num successfully recognises both a and b.
theorem Mathlib.Meta.NormNum.isNat_natMod E1 #
∀ {a b a' b' c : ℕ},
Mathlib.Meta.NormNum.IsNat a a' →
Mathlib.Meta.NormNum.IsNat b b' → a'.mod b' = c → Mathlib.Meta.NormNum.IsNat (a % b) c
def Mathlib.Meta.NormNum.evalNatMod E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form Nat.mod a b,
such that norm_num successfully recognises both a and b.
theorem Mathlib.Meta.NormNum.isNat_natDiv E1 #
∀ {a b a' b' c : ℕ},
Mathlib.Meta.NormNum.IsNat a a' →
Mathlib.Meta.NormNum.IsNat b b' → a'.div b' = c → Mathlib.Meta.NormNum.IsNat (a / b) c
def Mathlib.Meta.NormNum.evalNatDiv E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form Nat.div a b,
such that norm_num successfully recognises both a and b.
theorem Mathlib.Meta.NormNum.isNat_dvd_true E1 #
∀ {a b a' b' : ℕ}, Mathlib.Meta.NormNum.IsNat a a' → Mathlib.Meta.NormNum.IsNat b b' → b'.mod a' = 0 → a ∣ b
theorem Mathlib.Meta.NormNum.isNat_dvd_false E1 #
∀ {a b a' b' c : ℕ}, Mathlib.Meta.NormNum.IsNat a a' → Mathlib.Meta.NormNum.IsNat b b' → b'.mod a' = c.succ → ¬a ∣ b
def Mathlib.Meta.NormNum.evalNatDvd E1 #
Mathlib.Meta.NormNum.NormNumExt
The norm_num extension which identifies expressions of the form (a : ℕ) | b,
such that norm_num successfully recognises both a and b.