The areas / V34. The tactics of Mathlib
Mathlib.Tactic.Ring.Common
241 declarations. Mathlib docs · Source
ring-like tactics
The core normalization procedure for ring-like tactics that solve equations in commutative (semi)rings where the exponents can also contain variables. Based on http://www.cs.ru.nl/~freek/courses/tt-2014/read/10.1.1.61.3041.pdf .
More precisely, expressions of the following form are supported:
- constants (non-negative integers)
- variables
- coefficients (living in
BaseType; forringthis is a rational embedded into the semiring) - addition of expressions
- multiplication of expressions (
a * b) - scalar multiplication of expressions (
r • a) - exponentiation of expressions (the exponent must have type
ℕ) - subtraction and negation of expressions (if the base is a full ring)
The extension to exponents means that something like 2 * 2^n * b = b * 2^(n+1) can be proved,
even though it is not strictly speaking an equation in the language of commutative rings.
Implementation notes
The basic approach to prove equalities is to normalise both sides and check for equality.
The normalisation is guided by building a value in the type ExSum at the meta level,
together with a proof (at the base level) that the original value is equal to
the normalised version.
The outline of the file:
- Define a mutual inductive family of types
ExSum,ExProd,ExBase, which can represent expressions with+,*,^and some parametricBaseType. The mutual induction ensures that associativity and distributivity are applied, by restricting which kinds of subexpressions appear as arguments to the various operators. - Represent addition, multiplication and exponentiation in the
ExSumtype, thus allowing us to map expressions toExSum(theevalfunction drives this). We apply associativity and distributivity of the operators here (helped byEx*types) and commutativity as well (by sorting the subterms; unfortunately not helped by anything). Any expression not of the above formats is treated as an atom (the same as a variable).
There are some details we glossed over which make the plan more complicated:
- The order on atoms is not initially obvious. We construct a list containing them in order of initial appearance in the expression, then use the index into the list as a key to order on.
- For
pow, the exponent must be a natural number, while the base can be any semiringα. We swap out operations for the base ringαwith those for the exponent ringℕas soon as we deal with exponents. Unfortunately this has to be done with a separate inductive type due to universe issues outlined later in this file.
Caveats and future work
The normalized form of an expression is the one that is useful for the tactic,
but not as nice to read. To remedy this, the user-facing normalization calls ringNFCore.
Subtraction cancels out identical terms, but division does not.
That is: a - a = 0 := by ring solves the goal,
but a / a := 1 by ring doesn't.
Note that 0 / 0 is generally defined to be 0,
so division cancelling out is not true in general.
Multiplication of powers can be simplified a little bit further:
2 ^ n * 2 ^ n = 4 ^ n := by ring could be implemented
in a similar way that 2 * a + 2 * a = 4 * a := by ring already works.
This feature wasn't needed yet, so it's not implemented yet.
Tags
ring, semiring, exponent, power
The ExNat types
The Ex{Base,Prod,Sum}Nat types are equivalent to Ex{Base,Prod,Sum} btℕ sℕ. ExProdNat is only
used to represent exponents in ExProds. We cannot use ExProd btℕ sℕ in the mul constructor
of ExProd because BaseType is a parameter and not an index. Making BaseType an index
(i.e. moving it to the right of the colon) would require including it as an argument to each
constructor, raising the universe level of ExProd from Type to Type 1; that is:
inductive ExProd : ∀ {u : Lean.Level} {α : Q(Type u)} (BaseType : Q($α) → Type)
(sα : Q(CommSemiring $α)) (e : Q($α)), Type
| const {u : Lean.Level} {α : Q(Type u)} {BaseType} {sα} {e : Q($α)} (value : BaseType e) :
ExProd BaseType sα e
| mul {u : Lean.Level} {α : Q(Type u)} {BaseType} {sα} {x : Q($α)} {e : Q(ℕ)} {b : Q($α)} :
ExBase BaseType sα x → ExProd btℕ sℕ e → ExProd BaseType sα b →
ExProd BaseType sα q($x ^ $e * $b)
would fail to compile because ExProd lives in Type 1.
Lean does not support monadic computation in Type 1 in its core monad types,
so we cannot tolerate this universe bump.
The BaseType parameter is used to specify how constant coefficients are stored. In the ring
tactic we need only to store coefficients as normalizations to rational numbers, but in a future
algebra tactic the base type may itself be a normalized ring expression.
Addition
Multiplication
Negation
Subtraction
Exponentiation
abbrev Mathlib.Tactic.Ring.Common.ExBase.ctorElimType E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{motive_1 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e → Sort u} → ℕ → Sort (max 1 u)
def Mathlib.Tactic.Ring.Common.ExBase.ctorIdx E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e → ℕ
abbrev Mathlib.Tactic.Ring.Common.ExSumNat.ctorElimType E1 #
{motive_3 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExSumNat e → Sort u} → ℕ → Sort (max 1 u)
theorem Mathlib.Tactic.Ring.Common.ExBase.brecOn.eq E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)}
{motive_1 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e → Sort u}
{motive_2 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExProd BaseType sα e → Sort u}
{motive_3 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExSum BaseType sα e → Sort u} {e : Q(«$α»)}
(t : Mathlib.Tactic.Ring.Common.ExBase BaseType sα e)
(F_1 : (e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExBase BaseType sα e) → t.below → motive_1 e t)
(F_2 : (e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExProd BaseType sα e) → t.below → motive_2 e t)
(F_3 : (e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e) → t.below → motive_3 e t),
t.brecOn F_1 F_2 F_3 = F_1 e t (Mathlib.Tactic.Ring.Common.ExBase.brecOn.go t F_1 F_2 F_3).2
theorem Mathlib.Tactic.Ring.Common.Overlap.zero.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {bt : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)}
(x x_1 : Q(Mathlib.Meta.NormNum.IsNat «$e» 0)),
(Mathlib.Tactic.Ring.Common.Overlap.zero x = Mathlib.Tactic.Ring.Common.Overlap.zero x_1) = (x = x_1)
theorem Mathlib.Tactic.Ring.Common.ExBase.sum.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)}
(x x_1 : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e),
(Mathlib.Tactic.Ring.Common.ExBase.sum x = Mathlib.Tactic.Ring.Common.ExBase.sum x_1) = (x = x_1)
theorem Mathlib.Tactic.Ring.Common.ExSumNat.add.inj E1 #
∀ {a b : Q(ℕ)} {a_1 : Mathlib.Tactic.Ring.Common.ExProdNat a} {a_2 : Mathlib.Tactic.Ring.Common.ExSumNat b}
{a_3 : Mathlib.Tactic.Ring.Common.ExProdNat a} {a_4 : Mathlib.Tactic.Ring.Common.ExSumNat b},
Mathlib.Tactic.Ring.Common.ExSumNat.add a_1 a_2 = Mathlib.Tactic.Ring.Common.ExSumNat.add a_3 a_4 →
a_1 = a_3 ∧ a_2 = a_4
theorem Mathlib.Tactic.Ring.Common.ExProdNat.brecOn.eq E1 #
∀ {motive_1 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExBaseNat e → Sort u}
{motive_2 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExProdNat e → Sort u}
{motive_3 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExSumNat e → Sort u} {e : Q(ℕ)}
(t : Mathlib.Tactic.Ring.Common.ExProdNat e)
(F_1 : (e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExBaseNat e) → t.below → motive_1 e t)
(F_2 : (e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExProdNat e) → t.below → motive_2 e t)
(F_3 : (e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExSumNat e) → t.below → motive_3 e t),
t.brecOn F_1 F_2 F_3 = F_2 e t (Mathlib.Tactic.Ring.Common.ExProdNat.brecOn.go t F_1 F_2 F_3).2
theorem Mathlib.Tactic.Ring.Common.ExSumNat.brecOn.eq E1 #
∀ {motive_1 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExBaseNat e → Sort u}
{motive_2 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExProdNat e → Sort u}
{motive_3 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExSumNat e → Sort u} {e : Q(ℕ)}
(t : Mathlib.Tactic.Ring.Common.ExSumNat e)
(F_1 : (e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExBaseNat e) → t.below → motive_1 e t)
(F_2 : (e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExProdNat e) → t.below → motive_2 e t)
(F_3 : (e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExSumNat e) → t.below → motive_3 e t),
t.brecOn F_1 F_2 F_3 = F_3 e t (Mathlib.Tactic.Ring.Common.ExSumNat.brecOn.go t F_1 F_2 F_3).2
abbrev Mathlib.Tactic.Ring.Common.ExSum.brecOn.go E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{motive_1 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e → Sort u} →
{motive_2 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExProd BaseType sα e → Sort u} →
{motive_3 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExSum BaseType sα e → Sort u} →
{e : Q(«$α»)} →
(t : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e) →
((e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExBase BaseType sα e) → t.below → motive_1 e t) →
((e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExProd BaseType sα e) → t.below → motive_2 e t) →
((e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e) → t.below → motive_3 e t) →
motive_3 e t ×' t.below
theorem Mathlib.Tactic.Ring.Common.ExSum.add.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {a b : Q(«$α»)}
{a_1 : Mathlib.Tactic.Ring.Common.ExProd BaseType sα a} {a_2 : Mathlib.Tactic.Ring.Common.ExSum BaseType sα b}
{a_3 : Mathlib.Tactic.Ring.Common.ExProd BaseType sα a} {a_4 : Mathlib.Tactic.Ring.Common.ExSum BaseType sα b},
Mathlib.Tactic.Ring.Common.ExSum.add a_1 a_2 = Mathlib.Tactic.Ring.Common.ExSum.add a_3 a_4 → a_1 = a_3 ∧ a_2 = a_4
def Mathlib.Tactic.Ring.Common.instInhabitedRatCoeff.default E1 #
{u : Lean.Level} → {α : Q(Type u)} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.RatCoeff e
theorem Mathlib.Tactic.Ring.Common.ExProdNat.mul.injEq E0 #
∀ {x e b : Q(ℕ)} (a : Mathlib.Tactic.Ring.Common.ExBaseNat x) (a_1 : Mathlib.Tactic.Ring.Common.ExProdNat e)
(a_2 : Mathlib.Tactic.Ring.Common.ExProdNat b) (a_3 : Mathlib.Tactic.Ring.Common.ExBaseNat x)
(a_4 : Mathlib.Tactic.Ring.Common.ExProdNat e) (a_5 : Mathlib.Tactic.Ring.Common.ExProdNat b),
(Mathlib.Tactic.Ring.Common.ExProdNat.mul a a_1 a_2 = Mathlib.Tactic.Ring.Common.ExProdNat.mul a_3 a_4 a_5) =
(a = a_3 ∧ a_1 = a_4 ∧ a_2 = a_5)
theorem Mathlib.Tactic.Ring.Common.Cache.mk.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {sα : Q(CommSemiring «$α»)} (rα : Option Q(CommRing «$α»))
(dsα : Option Q(Semifield «$α»)) (czα : Option Q(CharZero «$α»)) (rα_1 : Option Q(CommRing «$α»))
(dsα_1 : Option Q(Semifield «$α»)) (czα_1 : Option Q(CharZero «$α»)),
({ rα := rα, dsα := dsα, czα := czα } = { rα := rα_1, dsα := dsα_1, czα := czα_1 }) =
(rα = rα_1 ∧ dsα = dsα_1 ∧ czα = czα_1)
def Mathlib.Tactic.Ring.Common.RingCompute.ctorIdx E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} → {sα : Q(CommSemiring «$α»)} → Mathlib.Tactic.Ring.Common.RingCompute BaseType sα → ℕ
abbrev Mathlib.Tactic.Ring.Common.ExProd.brecOn.go E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{motive_1 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e → Sort u} →
{motive_2 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExProd BaseType sα e → Sort u} →
{motive_3 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExSum BaseType sα e → Sort u} →
{e : Q(«$α»)} →
(t : Mathlib.Tactic.Ring.Common.ExProd BaseType sα e) →
((e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExBase BaseType sα e) → t.below → motive_1 e t) →
((e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExProd BaseType sα e) → t.below → motive_2 e t) →
((e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e) → t.below → motive_3 e t) →
motive_2 e t ×' t.below
theorem Mathlib.Tactic.Ring.Common.ExProd.brecOn.eq E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)}
{motive_1 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e → Sort u}
{motive_2 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExProd BaseType sα e → Sort u}
{motive_3 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExSum BaseType sα e → Sort u} {e : Q(«$α»)}
(t : Mathlib.Tactic.Ring.Common.ExProd BaseType sα e)
(F_1 : (e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExBase BaseType sα e) → t.below → motive_1 e t)
(F_2 : (e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExProd BaseType sα e) → t.below → motive_2 e t)
(F_3 : (e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e) → t.below → motive_3 e t),
t.brecOn F_1 F_2 F_3 = F_2 e t (Mathlib.Tactic.Ring.Common.ExProd.brecOn.go t F_1 F_2 F_3).2
theorem Mathlib.Tactic.Ring.Common.ExProd.const.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)}
{value value_1 : BaseType e},
Mathlib.Tactic.Ring.Common.ExProd.const value = Mathlib.Tactic.Ring.Common.ExProd.const value_1 → value = value_1
abbrev Mathlib.Tactic.Ring.Common.ExSumNat.brecOn.go E1 #
{motive_1 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExBaseNat e → Sort u} →
{motive_2 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExProdNat e → Sort u} →
{motive_3 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExSumNat e → Sort u} →
{e : Q(ℕ)} →
(t : Mathlib.Tactic.Ring.Common.ExSumNat e) →
((e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExBaseNat e) → t.below → motive_1 e t) →
((e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExProdNat e) → t.below → motive_2 e t) →
((e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExSumNat e) → t.below → motive_3 e t) →
motive_3 e t ×' t.below
def Mathlib.Tactic.Ring.Common.ExProd.ctorIdx E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.Common.ExProd BaseType sα e → ℕ
def Mathlib.Tactic.Ring.Common.Overlap.ctorIdx E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} → {sα : Q(CommSemiring «$α»)} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.Common.Overlap bt sα e → ℕ
theorem Mathlib.Tactic.Ring.RatCoeff.mk.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {e : Q(«$α»)} (value : ℚ) (hyp : Option Lean.Expr) (value_1 : ℚ)
(hyp_1 : Option Lean.Expr),
({ value := value, hyp := hyp } = { value := value_1, hyp := hyp_1 }) = (value = value_1 ∧ hyp = hyp_1)
theorem Mathlib.Tactic.Ring.Common.Overlap.nonzero.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {bt : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)}
{x x_1 : Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExProd bt sα) e},
Mathlib.Tactic.Ring.Common.Overlap.nonzero x = Mathlib.Tactic.Ring.Common.Overlap.nonzero x_1 → x = x_1
theorem Mathlib.Tactic.Ring.Common.ExProdNat.const.inj E1 #
∀ {e : Q(ℕ)} {value value_1 : Mathlib.Tactic.Ring.Common.btℕ e},
Mathlib.Tactic.Ring.Common.ExProdNat.const value = Mathlib.Tactic.Ring.Common.ExProdNat.const value_1 →
value = value_1
theorem Mathlib.Tactic.Ring.Common.ExSumNat.add.injEq E0 #
∀ {a b : Q(ℕ)} (a_1 : Mathlib.Tactic.Ring.Common.ExProdNat a) (a_2 : Mathlib.Tactic.Ring.Common.ExSumNat b)
(a_3 : Mathlib.Tactic.Ring.Common.ExProdNat a) (a_4 : Mathlib.Tactic.Ring.Common.ExSumNat b),
(Mathlib.Tactic.Ring.Common.ExSumNat.add a_1 a_2 = Mathlib.Tactic.Ring.Common.ExSumNat.add a_3 a_4) =
(a_1 = a_3 ∧ a_2 = a_4)
abbrev Mathlib.Tactic.Ring.Common.ExProdNat.ctorElimType E1 #
{motive_2 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExProdNat e → Sort u} → ℕ → Sort (max 1 u)
theorem Mathlib.Tactic.Ring.Common.ExBaseNat.sum.injEq E0 #
∀ {e : Q(ℕ)} (x x_1 : Mathlib.Tactic.Ring.Common.ExSumNat e),
(Mathlib.Tactic.Ring.Common.ExBaseNat.sum x = Mathlib.Tactic.Ring.Common.ExBaseNat.sum x_1) = (x = x_1)
theorem Mathlib.Tactic.Ring.Common.ExSum.brecOn.eq E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)}
{motive_1 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e → Sort u}
{motive_2 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExProd BaseType sα e → Sort u}
{motive_3 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExSum BaseType sα e → Sort u} {e : Q(«$α»)}
(t : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e)
(F_1 : (e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExBase BaseType sα e) → t.below → motive_1 e t)
(F_2 : (e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExProd BaseType sα e) → t.below → motive_2 e t)
(F_3 : (e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e) → t.below → motive_3 e t),
t.brecOn F_1 F_2 F_3 = F_3 e t (Mathlib.Tactic.Ring.Common.ExSum.brecOn.go t F_1 F_2 F_3).2
theorem Mathlib.Tactic.Ring.Common.ExSum.add.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {a b : Q(«$α»)}
(a_1 : Mathlib.Tactic.Ring.Common.ExProd BaseType sα a) (a_2 : Mathlib.Tactic.Ring.Common.ExSum BaseType sα b)
(a_3 : Mathlib.Tactic.Ring.Common.ExProd BaseType sα a) (a_4 : Mathlib.Tactic.Ring.Common.ExSum BaseType sα b),
(Mathlib.Tactic.Ring.Common.ExSum.add a_1 a_2 = Mathlib.Tactic.Ring.Common.ExSum.add a_3 a_4) =
(a_1 = a_3 ∧ a_2 = a_4)
theorem Mathlib.Tactic.Ring.Common.ExtractCoeff.mk.inj E1 #
∀ {e k e' : Q(ℕ)} {ve' : Mathlib.Tactic.Ring.Common.ExProdNat e'} {p : Q(«$e» = «$e'» * «$k»)} {k_1 e'_1 : Q(ℕ)}
{ve'_1 : Mathlib.Tactic.Ring.Common.ExProdNat e'_1} {p_1 : Q(«$e» = «$e'_1» * «$k_1»)},
{ k := k, e' := e', ve' := ve', p := p } = { k := k_1, e' := e'_1, ve' := ve'_1, p := p_1 } →
k = k_1 ∧ e' = e'_1 ∧ ve' ≍ ve'_1 ∧ p = p_1
abbrev Mathlib.Tactic.Ring.Common.Overlap.ctorElimType E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{e : Q(«$α»)} → {motive : Mathlib.Tactic.Ring.Common.Overlap bt sα e → Sort u} → ℕ → Sort (max 1 u)
theorem Mathlib.Tactic.Ring.Common.RingCompare.mk.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {eq : {x y : Q(«$α»)} → BaseType x → BaseType y → Bool}
{compare : {x y : Q(«$α»)} → BaseType x → BaseType y → Ordering}
{eq_1 : {x y : Q(«$α»)} → BaseType x → BaseType y → Bool}
{compare_1 : {x y : Q(«$α»)} → BaseType x → BaseType y → Ordering},
{ eq := eq, compare := compare } = { eq := eq_1, compare := compare_1 } → eq = eq_1 ∧ compare = compare_1
def Mathlib.Tactic.Ring.Common.ExSumNat.ctorIdx E1 #
{e : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExSumNat e → ℕ
theorem Mathlib.Tactic.Ring.Common.ExProdNat.mul.inj E1 #
∀ {x e b : Q(ℕ)} {a : Mathlib.Tactic.Ring.Common.ExBaseNat x} {a_1 : Mathlib.Tactic.Ring.Common.ExProdNat e}
{a_2 : Mathlib.Tactic.Ring.Common.ExProdNat b} {a_3 : Mathlib.Tactic.Ring.Common.ExBaseNat x}
{a_4 : Mathlib.Tactic.Ring.Common.ExProdNat e} {a_5 : Mathlib.Tactic.Ring.Common.ExProdNat b},
Mathlib.Tactic.Ring.Common.ExProdNat.mul a a_1 a_2 = Mathlib.Tactic.Ring.Common.ExProdNat.mul a_3 a_4 a_5 →
a = a_3 ∧ a_1 = a_4 ∧ a_2 = a_5
abbrev Mathlib.Tactic.Ring.Common.ExProdNat.brecOn.go E1 #
{motive_1 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExBaseNat e → Sort u} →
{motive_2 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExProdNat e → Sort u} →
{motive_3 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExSumNat e → Sort u} →
{e : Q(ℕ)} →
(t : Mathlib.Tactic.Ring.Common.ExProdNat e) →
((e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExBaseNat e) → t.below → motive_1 e t) →
((e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExProdNat e) → t.below → motive_2 e t) →
((e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExSumNat e) → t.below → motive_3 e t) →
motive_2 e t ×' t.below
theorem Mathlib.Tactic.Ring.Common.Cache.mk.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {sα : Q(CommSemiring «$α»)} {rα : Option Q(CommRing «$α»)}
{dsα : Option Q(Semifield «$α»)} {czα : Option Q(CharZero «$α»)} {rα_1 : Option Q(CommRing «$α»)}
{dsα_1 : Option Q(Semifield «$α»)} {czα_1 : Option Q(CharZero «$α»)},
{ rα := rα, dsα := dsα, czα := czα } = { rα := rα_1, dsα := dsα_1, czα := czα_1 } →
rα = rα_1 ∧ dsα = dsα_1 ∧ czα = czα_1
theorem Mathlib.Tactic.Ring.Common.ExProd.mul.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {x : Q(«$α»)} {e : Q(ℕ)}
{b : Q(«$α»)} (a : Mathlib.Tactic.Ring.Common.ExBase BaseType sα x) (a_1 : Mathlib.Tactic.Ring.Common.ExProdNat e)
(a_2 : Mathlib.Tactic.Ring.Common.ExProd BaseType sα b) (a_3 : Mathlib.Tactic.Ring.Common.ExBase BaseType sα x)
(a_4 : Mathlib.Tactic.Ring.Common.ExProdNat e) (a_5 : Mathlib.Tactic.Ring.Common.ExProd BaseType sα b),
(Mathlib.Tactic.Ring.Common.ExProd.mul a a_1 a_2 = Mathlib.Tactic.Ring.Common.ExProd.mul a_3 a_4 a_5) =
(a = a_3 ∧ a_1 = a_4 ∧ a_2 = a_5)
theorem Mathlib.Tactic.Ring.Common.RingCompute.mk.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)}
{toRingCompare : Mathlib.Tactic.Ring.Common.RingCompare BaseType}
{add :
{x y : Q(«$α»)} →
BaseType x →
BaseType y →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» + «$y») ×
Option Q(Mathlib.Meta.NormNum.IsNat («$x» + «$y») 0))}
{mul :
{x y : Q(«$α»)} → BaseType x → BaseType y → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» * «$y»))}
{cast :
(v : Lean.Level) →
(β : Q(Type v)) →
Q(CommSemiring «$β») →
(x : Q(SMul «$β» «$α»)) →
(x_1 : Q(«$β»)) →
Mathlib.Tactic.AtomM
((y : Q(«$α»)) ×
Mathlib.Tactic.Ring.Common.ExSum BaseType sα q(«$y») × Q(∀ (a : «$α»), «$x_1» • a = «$y» * a))}
{neg :
{x : Q(«$α»)} →
(rα : Q(CommRing «$α»)) → BaseType x → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(-«$x»))}
{pow :
{x : Q(«$α»)} →
{b : Q(ℕ)} →
BaseType x →
Mathlib.Tactic.Ring.Common.ExProdNat q(«$b») →
OptionT Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» ^ «$b»))}
{inv :
{x : Q(«$α»)} →
Option Q(CharZero «$α») →
(fα : Q(Semifield «$α»)) →
BaseType x → Mathlib.Tactic.AtomM (Option (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x»⁻¹)))}
{derive :
(x : Q(«$α»)) →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum BaseType sα) q(«$x»))}
{isOne : {x : Q(«$α»)} → BaseType x → Option Q(Mathlib.Meta.NormNum.IsNat «$x» 1)}
{one : Mathlib.Tactic.Ring.Common.Result BaseType q(Nat.rawCast 1)}
{toRingCompare_1 : Mathlib.Tactic.Ring.Common.RingCompare BaseType}
{add_1 :
{x y : Q(«$α»)} →
BaseType x →
BaseType y →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» + «$y») ×
Option Q(Mathlib.Meta.NormNum.IsNat («$x» + «$y») 0))}
{mul_1 :
{x y : Q(«$α»)} → BaseType x → BaseType y → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» * «$y»))}
{cast_1 :
(v : Lean.Level) →
(β : Q(Type v)) →
Q(CommSemiring «$β») →
(x : Q(SMul «$β» «$α»)) →
(x_1 : Q(«$β»)) →
Mathlib.Tactic.AtomM
((y : Q(«$α»)) ×
Mathlib.Tactic.Ring.Common.ExSum BaseType sα q(«$y») × Q(∀ (a : «$α»), «$x_1» • a = «$y» * a))}
{neg_1 :
{x : Q(«$α»)} →
(rα : Q(CommRing «$α»)) → BaseType x → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(-«$x»))}
{pow_1 :
{x : Q(«$α»)} →
{b : Q(ℕ)} →
BaseType x →
Mathlib.Tactic.Ring.Common.ExProdNat q(«$b») →
OptionT Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» ^ «$b»))}
{inv_1 :
{x : Q(«$α»)} →
Option Q(CharZero «$α») →
(fα : Q(Semifield «$α»)) →
BaseType x → Mathlib.Tactic.AtomM (Option (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x»⁻¹)))}
{derive_1 :
(x : Q(«$α»)) →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum BaseType sα) q(«$x»))}
{isOne_1 : {x : Q(«$α»)} → BaseType x → Option Q(Mathlib.Meta.NormNum.IsNat «$x» 1)}
{one_1 : Mathlib.Tactic.Ring.Common.Result BaseType q(Nat.rawCast 1)},
{ toRingCompare := toRingCompare, add := add, mul := mul, cast := cast, neg := neg, pow := pow, inv := inv,
derive := derive, isOne := isOne, one := one } =
{ toRingCompare := toRingCompare_1, add := add_1, mul := mul_1, cast := cast_1, neg := neg_1, pow := pow_1,
inv := inv_1, derive := derive_1, isOne := isOne_1, one := one_1 } →
toRingCompare = toRingCompare_1 ∧
add = add_1 ∧
mul = mul_1 ∧
cast = cast_1 ∧ neg = neg_1 ∧ pow = pow_1 ∧ inv = inv_1 ∧ derive = derive_1 ∧ isOne = isOne_1 ∧ one = one_1
theorem Mathlib.Tactic.Ring.Common.ExBaseNat.sum.inj E1 #
∀ {e : Q(ℕ)} {x x_1 : Mathlib.Tactic.Ring.Common.ExSumNat e},
Mathlib.Tactic.Ring.Common.ExBaseNat.sum x = Mathlib.Tactic.Ring.Common.ExBaseNat.sum x_1 → x = x_1
theorem Mathlib.Tactic.Ring.Common.Result.mk.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {E : Q(«$α») → Type u_1} {e : Q(«$α»)} (expr : Q(«$α»)) (val : E expr)
(proof : Q(«$e» = «$expr»)) (expr_1 : Q(«$α»)) (val_1 : E expr_1) (proof_1 : Q(«$e» = «$expr_1»)),
({ expr := expr, val := val, proof := proof } = { expr := expr_1, val := val_1, proof := proof_1 }) =
(expr = expr_1 ∧ val ≍ val_1 ∧ proof = proof_1)
theorem Mathlib.Tactic.Ring.Common.ExProdNat.const.injEq E0 #
∀ {e : Q(ℕ)} (value value_1 : Mathlib.Tactic.Ring.Common.btℕ e),
(Mathlib.Tactic.Ring.Common.ExProdNat.const value = Mathlib.Tactic.Ring.Common.ExProdNat.const value_1) =
(value = value_1)
theorem Mathlib.Tactic.Ring.Common.ExProd.const.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)}
(value value_1 : BaseType e),
(Mathlib.Tactic.Ring.Common.ExProd.const value = Mathlib.Tactic.Ring.Common.ExProd.const value_1) = (value = value_1)
abbrev Mathlib.Tactic.Ring.Common.ExBaseNat.brecOn.go E1 #
{motive_1 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExBaseNat e → Sort u} →
{motive_2 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExProdNat e → Sort u} →
{motive_3 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExSumNat e → Sort u} →
{e : Q(ℕ)} →
(t : Mathlib.Tactic.Ring.Common.ExBaseNat e) →
((e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExBaseNat e) → t.below → motive_1 e t) →
((e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExProdNat e) → t.below → motive_2 e t) →
((e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExSumNat e) → t.below → motive_3 e t) →
motive_1 e t ×' t.below
theorem Mathlib.Tactic.Ring.RatCoeff.mk.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {e : Q(«$α»)} {value : ℚ} {hyp : Option Lean.Expr} {value_1 : ℚ}
{hyp_1 : Option Lean.Expr},
{ value := value, hyp := hyp } = { value := value_1, hyp := hyp_1 } → value = value_1 ∧ hyp = hyp_1
theorem Mathlib.Tactic.Ring.Common.ExBaseNat.atom.inj E1 #
∀ {e : Q(ℕ)} {id id_1 : ℕ},
Mathlib.Tactic.Ring.Common.ExBaseNat.atom id = Mathlib.Tactic.Ring.Common.ExBaseNat.atom id_1 → id = id_1
theorem Mathlib.Tactic.Ring.Common.ExBase.sum.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)}
{x x_1 : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e},
Mathlib.Tactic.Ring.Common.ExBase.sum x = Mathlib.Tactic.Ring.Common.ExBase.sum x_1 → x = x_1
theorem Mathlib.Tactic.Ring.Common.ExBase.atom.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)} (id id_1 : ℕ),
(Mathlib.Tactic.Ring.Common.ExBase.atom id = Mathlib.Tactic.Ring.Common.ExBase.atom id_1) = (id = id_1)
theorem Mathlib.Tactic.Ring.Common.RingCompute.mk.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)}
(toRingCompare : Mathlib.Tactic.Ring.Common.RingCompare BaseType)
(add :
{x y : Q(«$α»)} →
BaseType x →
BaseType y →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» + «$y») ×
Option Q(Mathlib.Meta.NormNum.IsNat («$x» + «$y») 0)))
(mul :
{x y : Q(«$α»)} → BaseType x → BaseType y → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» * «$y»)))
(cast :
(v : Lean.Level) →
(β : Q(Type v)) →
Q(CommSemiring «$β») →
(x : Q(SMul «$β» «$α»)) →
(x_1 : Q(«$β»)) →
Mathlib.Tactic.AtomM
((y : Q(«$α»)) ×
Mathlib.Tactic.Ring.Common.ExSum BaseType sα q(«$y») × Q(∀ (a : «$α»), «$x_1» • a = «$y» * a)))
(neg :
{x : Q(«$α»)} →
(rα : Q(CommRing «$α»)) → BaseType x → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(-«$x»)))
(pow :
{x : Q(«$α»)} →
{b : Q(ℕ)} →
BaseType x →
Mathlib.Tactic.Ring.Common.ExProdNat q(«$b») →
OptionT Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» ^ «$b»)))
(inv :
{x : Q(«$α»)} →
Option Q(CharZero «$α») →
(fα : Q(Semifield «$α»)) →
BaseType x → Mathlib.Tactic.AtomM (Option (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x»⁻¹))))
(derive :
(x : Q(«$α»)) →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum BaseType sα) q(«$x»)))
(isOne : {x : Q(«$α»)} → BaseType x → Option Q(Mathlib.Meta.NormNum.IsNat «$x» 1))
(one : Mathlib.Tactic.Ring.Common.Result BaseType q(Nat.rawCast 1))
(toRingCompare_1 : Mathlib.Tactic.Ring.Common.RingCompare BaseType)
(add_1 :
{x y : Q(«$α»)} →
BaseType x →
BaseType y →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» + «$y») ×
Option Q(Mathlib.Meta.NormNum.IsNat («$x» + «$y») 0)))
(mul_1 :
{x y : Q(«$α»)} → BaseType x → BaseType y → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» * «$y»)))
(cast_1 :
(v : Lean.Level) →
(β : Q(Type v)) →
Q(CommSemiring «$β») →
(x : Q(SMul «$β» «$α»)) →
(x_1 : Q(«$β»)) →
Mathlib.Tactic.AtomM
((y : Q(«$α»)) ×
Mathlib.Tactic.Ring.Common.ExSum BaseType sα q(«$y») × Q(∀ (a : «$α»), «$x_1» • a = «$y» * a)))
(neg_1 :
{x : Q(«$α»)} →
(rα : Q(CommRing «$α»)) → BaseType x → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(-«$x»)))
(pow_1 :
{x : Q(«$α»)} →
{b : Q(ℕ)} →
BaseType x →
Mathlib.Tactic.Ring.Common.ExProdNat q(«$b») →
OptionT Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» ^ «$b»)))
(inv_1 :
{x : Q(«$α»)} →
Option Q(CharZero «$α») →
(fα : Q(Semifield «$α»)) →
BaseType x → Mathlib.Tactic.AtomM (Option (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x»⁻¹))))
(derive_1 :
(x : Q(«$α»)) →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum BaseType sα) q(«$x»)))
(isOne_1 : {x : Q(«$α»)} → BaseType x → Option Q(Mathlib.Meta.NormNum.IsNat «$x» 1))
(one_1 : Mathlib.Tactic.Ring.Common.Result BaseType q(Nat.rawCast 1)),
({ toRingCompare := toRingCompare, add := add, mul := mul, cast := cast, neg := neg, pow := pow, inv := inv,
derive := derive, isOne := isOne, one := one } =
{ toRingCompare := toRingCompare_1, add := add_1, mul := mul_1, cast := cast_1, neg := neg_1, pow := pow_1,
inv := inv_1, derive := derive_1, isOne := isOne_1, one := one_1 }) =
(toRingCompare = toRingCompare_1 ∧
add = add_1 ∧
mul = mul_1 ∧
cast = cast_1 ∧ neg = neg_1 ∧ pow = pow_1 ∧ inv = inv_1 ∧ derive = derive_1 ∧ isOne = isOne_1 ∧ one = one_1)
theorem Mathlib.Tactic.Ring.Common.RingCompare.mk.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} (eq : {x y : Q(«$α»)} → BaseType x → BaseType y → Bool)
(compare : {x y : Q(«$α»)} → BaseType x → BaseType y → Ordering)
(eq_1 : {x y : Q(«$α»)} → BaseType x → BaseType y → Bool)
(compare_1 : {x y : Q(«$α»)} → BaseType x → BaseType y → Ordering),
({ eq := eq, compare := compare } = { eq := eq_1, compare := compare_1 }) = (eq = eq_1 ∧ compare = compare_1)
def Mathlib.Tactic.Ring.Common.ExtractCoeff.ctorIdx E1 #
{e : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExtractCoeff e → ℕ
def Mathlib.Tactic.Ring.Common.ExBaseNat.ctorIdx E1 #
{e : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExBaseNat e → ℕ
theorem Mathlib.Tactic.Ring.Common.ExBase.atom.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)} {id id_1 : ℕ},
Mathlib.Tactic.Ring.Common.ExBase.atom id = Mathlib.Tactic.Ring.Common.ExBase.atom id_1 → id = id_1
def Mathlib.Tactic.Ring.RatCoeff.ctorIdx E1 #
{u : Lean.Level} → {α : Q(Type u)} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.RatCoeff e → ℕ
def Mathlib.Tactic.Ring.Common.Result.ctorIdx E1 #
{u : Lean.Level} →
{α : Q(Type u)} → {E : Q(«$α») → Type u_1} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.Common.Result E e → ℕ
theorem Mathlib.Tactic.Ring.Common.ExProd.mul.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {BaseType : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {x : Q(«$α»)} {e : Q(ℕ)}
{b : Q(«$α»)} {a : Mathlib.Tactic.Ring.Common.ExBase BaseType sα x} {a_1 : Mathlib.Tactic.Ring.Common.ExProdNat e}
{a_2 : Mathlib.Tactic.Ring.Common.ExProd BaseType sα b} {a_3 : Mathlib.Tactic.Ring.Common.ExBase BaseType sα x}
{a_4 : Mathlib.Tactic.Ring.Common.ExProdNat e} {a_5 : Mathlib.Tactic.Ring.Common.ExProd BaseType sα b},
Mathlib.Tactic.Ring.Common.ExProd.mul a a_1 a_2 = Mathlib.Tactic.Ring.Common.ExProd.mul a_3 a_4 a_5 →
a = a_3 ∧ a_1 = a_4 ∧ a_2 = a_5
theorem Mathlib.Tactic.Ring.Common.ExBaseNat.atom.injEq E0 #
∀ {e : Q(ℕ)} (id id_1 : ℕ),
(Mathlib.Tactic.Ring.Common.ExBaseNat.atom id = Mathlib.Tactic.Ring.Common.ExBaseNat.atom id_1) = (id = id_1)
theorem Mathlib.Tactic.Ring.Common.ExBaseNat.brecOn.eq E1 #
∀ {motive_1 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExBaseNat e → Sort u}
{motive_2 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExProdNat e → Sort u}
{motive_3 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExSumNat e → Sort u} {e : Q(ℕ)}
(t : Mathlib.Tactic.Ring.Common.ExBaseNat e)
(F_1 : (e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExBaseNat e) → t.below → motive_1 e t)
(F_2 : (e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExProdNat e) → t.below → motive_2 e t)
(F_3 : (e : Q(ℕ)) → (t : Mathlib.Tactic.Ring.Common.ExSumNat e) → t.below → motive_3 e t),
t.brecOn F_1 F_2 F_3 = F_1 e t (Mathlib.Tactic.Ring.Common.ExBaseNat.brecOn.go t F_1 F_2 F_3).2
def Mathlib.Tactic.Ring.Common.RingCompare.ctorIdx E1 #
{u : Lean.Level} → {α : Q(Type u)} → {BaseType : Q(«$α») → Type} → Mathlib.Tactic.Ring.Common.RingCompare BaseType → ℕ
def Mathlib.Tactic.Ring.Common.Cache.ctorIdx E1 #
{u : Lean.Level} → {α : Q(Type u)} → {sα : Q(CommSemiring «$α»)} → Mathlib.Tactic.Ring.Common.Cache sα → ℕ
theorem Mathlib.Tactic.Ring.Common.Result.mk.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {E : Q(«$α») → Type u_1} {e expr : Q(«$α»)} {val : E expr}
{proof : Q(«$e» = «$expr»)} {expr_1 : Q(«$α»)} {val_1 : E expr_1} {proof_1 : Q(«$e» = «$expr_1»)},
{ expr := expr, val := val, proof := proof } = { expr := expr_1, val := val_1, proof := proof_1 } →
expr = expr_1 ∧ val ≍ val_1 ∧ proof = proof_1
theorem Mathlib.Tactic.Ring.Common.ExtractCoeff.mk.injEq E0 #
∀ {e : Q(ℕ)} (k e' : Q(ℕ)) (ve' : Mathlib.Tactic.Ring.Common.ExProdNat e') (p : Q(«$e» = «$e'» * «$k»))
(k_1 e'_1 : Q(ℕ)) (ve'_1 : Mathlib.Tactic.Ring.Common.ExProdNat e'_1) (p_1 : Q(«$e» = «$e'_1» * «$k_1»)),
({ k := k, e' := e', ve' := ve', p := p } = { k := k_1, e' := e'_1, ve' := ve'_1, p := p_1 }) =
(k = k_1 ∧ e' = e'_1 ∧ ve' ≍ ve'_1 ∧ p = p_1)
theorem Mathlib.Tactic.Ring.Common.Overlap.nonzero.injEq E0 #
∀ {u : Lean.Level} {α : Q(Type u)} {bt : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)}
(x x_1 : Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExProd bt sα) e),
(Mathlib.Tactic.Ring.Common.Overlap.nonzero x = Mathlib.Tactic.Ring.Common.Overlap.nonzero x_1) = (x = x_1)
def Mathlib.Tactic.Ring.Common.ExProdNat.ctorIdx E1 #
{e : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExProdNat e → ℕ
abbrev Mathlib.Tactic.Ring.Common.ExBaseNat.ctorElimType E1 #
{motive_1 : (e : Q(ℕ)) → Mathlib.Tactic.Ring.Common.ExBaseNat e → Sort u} → ℕ → Sort (max 1 u)
abbrev Mathlib.Tactic.Ring.Common.ExSum.ctorElimType E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{motive_3 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExSum BaseType sα e → Sort u} → ℕ → Sort (max 1 u)
theorem Mathlib.Tactic.Ring.Common.Overlap.zero.inj E1 #
∀ {u : Lean.Level} {α : Q(Type u)} {bt : Q(«$α») → Type} {sα : Q(CommSemiring «$α»)} {e : Q(«$α»)}
{x x_1 : Q(Mathlib.Meta.NormNum.IsNat «$e» 0)},
Mathlib.Tactic.Ring.Common.Overlap.zero x = Mathlib.Tactic.Ring.Common.Overlap.zero x_1 → x = x_1
abbrev Mathlib.Tactic.Ring.Common.ExProd.ctorElimType E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{motive_2 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExProd BaseType sα e → Sort u} → ℕ → Sort (max 1 u)
def Mathlib.Tactic.Ring.Common.ExSum.ctorIdx E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.Common.ExSum BaseType sα e → ℕ
abbrev Mathlib.Tactic.Ring.Common.ExBase.brecOn.go E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{motive_1 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e → Sort u} →
{motive_2 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExProd BaseType sα e → Sort u} →
{motive_3 : (e : Q(«$α»)) → Mathlib.Tactic.Ring.Common.ExSum BaseType sα e → Sort u} →
{e : Q(«$α»)} →
(t : Mathlib.Tactic.Ring.Common.ExBase BaseType sα e) →
((e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExBase BaseType sα e) → t.below → motive_1 e t) →
((e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExProd BaseType sα e) → t.below → motive_2 e t) →
((e : Q(«$α»)) → (t : Mathlib.Tactic.Ring.Common.ExSum BaseType sα e) → t.below → motive_3 e t) →
motive_1 e t ×' t.below
def Mathlib.Tactic.Ring.Common.sℕ E1 #
Q(CommSemiring ℕ)
A typed expression of type CommSemiring ℕ used when we are working on
ring subexpressions of type ℕ.
structure Mathlib.Tactic.Ring.RatCoeff E1 #
{u : Lean.Level} → {α : Q(Type u)} → Q(«$α») → Type
The data used by ring to represent coefficients. e is a raw rat cast.
We include e as a parameter even though it is unused in this definition because it lets us use
Qq type annotations in the RingCompute structure, and so that it can be used with the Result
type defined below.
ctor Mathlib.Tactic.Ring.RatCoeff.mk E0 #
{u : Lean.Level} → {α : Q(Type u)} → {e : Q(«$α»)} → ℚ → Option Lean.Expr → Mathlib.Tactic.Ring.RatCoeff e
abbrev Mathlib.Tactic.Ring.RatCoeff.value E1 #
{u : Lean.Level} → {α : Q(Type u)} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.RatCoeff e → ℚ
The value represented by e. Should not be zero.
abbrev Mathlib.Tactic.Ring.RatCoeff.hyp E1 #
{u : Lean.Level} → {α : Q(Type u)} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.RatCoeff e → Option Lean.Expr
If value is not an integer, then hyp should be a proof of (value.den : α) ≠ 0.
instance Mathlib.Tactic.Ring.Common.instInhabitedRatCoeff E0 #
{a : Lean.Level} → {a_1 : Q(Type a)} → {a_2 : Q(«$a_1»)} → Inhabited (Mathlib.Tactic.Ring.RatCoeff a_2)
abbrev Mathlib.Tactic.Ring.Common.btℕ E1 #
Q(ℕ) → Type
The data used to represent coefficients in exponents. This is the same data that ring uses.
inductive Mathlib.Tactic.Ring.Common.ExBaseNat E1 #
Q(ℕ) → Type
ExBaseNat e stores the structure of a normalized expression e : Q(ℕ), which appears
as the base of an exponent expression e^n. The sum constructor is only used when the exponent
n is not a constant.
Used to represent normalized natural number expressions in exponents.
ExBaseNat q($e) is equivalent to ExBase btℕ sℕ q($e), and one can cast between the two.
ctor Mathlib.Tactic.Ring.Common.ExBaseNat.atom E0 #
{e : Q(ℕ)} → ℕ → Mathlib.Tactic.Ring.Common.ExBaseNat e
An atomic expression e with id id.
Atomic expressions are those which ring cannot parse any further.
For instance, a + (a % b) has a and (a % b) as atoms.
The ring1 tactic does not normalize the subexpressions in atoms, but ring_nf does.
Atoms in fact represent equivalence classes of expressions, modulo definitional equality.
The field index : ℕ should be a unique number for each class,
while e : Q($α) contains a representative of this class.
ctor Mathlib.Tactic.Ring.Common.ExBaseNat.sum E0 #
{e : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExSumNat e → Mathlib.Tactic.Ring.Common.ExBaseNat e
A sum of monomials.
inductive Mathlib.Tactic.Ring.Common.ExProdNat E1 #
Q(ℕ) → Type
ExProdNat e stores the structure of a normalized monomial expression e : Q(ℕ).
A monomial here is a product of powers of ExBaseNat expressions, terminated by a (nonzero)
constant coefficient.
Used to represent normalized natural number expressions in exponents.
ExProdNat q($e) is equivalent to ExProd btℕ sℕ q($e), and one can cast between the two.
ctor Mathlib.Tactic.Ring.Common.ExProdNat.const E0 #
{e : Q(ℕ)} → Mathlib.Tactic.Ring.Common.btℕ e → Mathlib.Tactic.Ring.Common.ExProdNat e
A coefficient value, holding the data that ring uses to represent rational coefficients.
In this case these happen to always be natural numbers.
ctor Mathlib.Tactic.Ring.Common.ExProdNat.mul E0 #
{x e b : Q(ℕ)} →
Mathlib.Tactic.Ring.Common.ExBaseNat x →
Mathlib.Tactic.Ring.Common.ExProdNat e →
Mathlib.Tactic.Ring.Common.ExProdNat b → Mathlib.Tactic.Ring.Common.ExProdNat q(«$x» ^ «$e» * «$b»)
A product x ^ e * b is a monomial if b is a monomial. Here x is an ExBaseNat
and e is an ExProdNat representing a monomial expression in ℕ (it is a monomial instead of
a polynomial because we eagerly normalize x ^ (a + b) = x ^ a * x ^ b.)
inductive Mathlib.Tactic.Ring.Common.ExSumNat E1 #
Q(ℕ) → Type
ExSumNat e stores the structure of a normalized polynomial expression e : Q(ℕ), which is
a sum of monomials.
Used to represent normalized natural number expressions in exponents.
ExSumNat q($e) is equivalent to ExSum btℕ sℕ q($e), and one can cast between the two.
ctor Mathlib.Tactic.Ring.Common.ExSumNat.zero E0 #
Mathlib.Tactic.Ring.Common.ExSumNat q(0)
Zero is a polynomial. e is the expression 0.
ctor Mathlib.Tactic.Ring.Common.ExSumNat.add E0 #
{a b : Q(ℕ)} →
Mathlib.Tactic.Ring.Common.ExProdNat a →
Mathlib.Tactic.Ring.Common.ExSumNat b → Mathlib.Tactic.Ring.Common.ExSumNat q(«$a» + «$b»)
A sum a + b is a polynomial if a is a monomial and b is another polynomial.
inductive Mathlib.Tactic.Ring.Common.ExBase E1 #
{u : Lean.Level} → {α : Q(Type u)} → (Q(«$α») → Type) → Q(CommSemiring «$α») → Q(«$α») → Type
ExBase BaseType sα e stores the structure of a normalized expression e, which appears
as the base of an exponent expression e^n. The sum constructor is only used when the exponent
n is not a constant.
ctor Mathlib.Tactic.Ring.Common.ExBase.atom E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} → {e : Q(«$α»)} → ℕ → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e
An atomic expression e with id id.
Atomic expressions are those which a ring-like tactic cannot parse any further.
For instance, a + (a % b) has a and (a % b) as atoms.
The ring1 tactic does not normalize the subexpressions in atoms, but ring_nf does.
Atoms in fact represent equivalence classes of expressions, modulo definitional equality.
The field index : ℕ should be a unique number for each class,
while e : Q($α) contains a representative of this class.
ctor Mathlib.Tactic.Ring.Common.ExBase.sum E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{e : Q(«$α»)} → Mathlib.Tactic.Ring.Common.ExSum BaseType sα e → Mathlib.Tactic.Ring.Common.ExBase BaseType sα e
A sum of monomials.
inductive Mathlib.Tactic.Ring.Common.ExProd E1 #
{u : Lean.Level} → {α : Q(Type u)} → (Q(«$α») → Type) → Q(CommSemiring «$α») → Q(«$α») → Type
ExProd BaseType sα e stores the structure of a normalized monomial expression e.
A monomial here is a product of powers of ExBase expressions, terminated by a (nonzero) constant
coefficient. The data of the constant coefficient is stored in the BaseType.
ctor Mathlib.Tactic.Ring.Common.ExProd.const E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} → {e : Q(«$α»)} → BaseType e → Mathlib.Tactic.Ring.Common.ExProd BaseType sα e
A coefficient value, which must not be 0. e is a raw rat cast.
If value is not an integer, then hyp should be a proof of (value.den : α) ≠ 0.
ctor Mathlib.Tactic.Ring.Common.ExProd.mul E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{x : Q(«$α»)} →
{e : Q(ℕ)} →
{b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExBase BaseType sα x →
Mathlib.Tactic.Ring.Common.ExProdNat e →
Mathlib.Tactic.Ring.Common.ExProd BaseType sα b →
Mathlib.Tactic.Ring.Common.ExProd BaseType sα q(«$x» ^ «$e» * «$b»)
A product x ^ e * b is a monomial if b is a monomial. Here x is an ExBase
and e is an ExProdNat representing a monomial expression in ℕ (it is a monomial instead of
a polynomial because we eagerly normalize x ^ (a + b) = x ^ a * x ^ b.)
inductive Mathlib.Tactic.Ring.Common.ExSum E1 #
{u : Lean.Level} → {α : Q(Type u)} → (Q(«$α») → Type) → Q(CommSemiring «$α») → Q(«$α») → Type
ExSum BaseType sα e stores the structure of a normalized polynomial expression e, which is
a sum of monomials.
ctor Mathlib.Tactic.Ring.Common.ExSum.zero E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} → {sα : Q(CommSemiring «$α»)} → Mathlib.Tactic.Ring.Common.ExSum BaseType sα q(0)
Zero is a polynomial. e is the expression 0.
ctor Mathlib.Tactic.Ring.Common.ExSum.add E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExProd BaseType sα a →
Mathlib.Tactic.Ring.Common.ExSum BaseType sα b → Mathlib.Tactic.Ring.Common.ExSum BaseType sα q(«$a» + «$b»)
A sum a + b is a polynomial if a is a monomial and b is another polynomial.
structure Mathlib.Tactic.Ring.Common.Result E1 #
{u : Lean.Level} → {α : Q(Type u)} → (Q(«$α») → Type u_1) → Q(«$α») → Type u_1
The result of evaluating an (unnormalized) expression e into the type family E
(typically one of ExSum, ExProd, ExBase or BaseType) is a (normalized) element e'
and a representation E e' for it, and a proof of e = e'.
ctor Mathlib.Tactic.Ring.Common.Result.mk E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{E : Q(«$α») → Type u_1} →
{e : Q(«$α»)} → (expr : Q(«$α»)) → E expr → Q(«$e» = «$expr») → Mathlib.Tactic.Ring.Common.Result E e
abbrev Mathlib.Tactic.Ring.Common.Result.expr E1 #
{u : Lean.Level} →
{α : Q(Type u)} → {E : Q(«$α») → Type u_1} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.Common.Result E e → Q(«$α»)
The normalized result.
abbrev Mathlib.Tactic.Ring.Common.Result.val E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{E : Q(«$α») → Type u_1} → {e : Q(«$α»)} → (self : Mathlib.Tactic.Ring.Common.Result E e) → E self.expr
The data associated to the normalization.
abbrev Mathlib.Tactic.Ring.Common.Result.proof E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{E : Q(«$α») → Type u_1} → {e : Q(«$α»)} → (self : Mathlib.Tactic.Ring.Common.Result E e) → Q(«$e» = unknown_1)
A proof that the original expression is equal to the normalized result.
instance Mathlib.Tactic.Ring.Common.instInhabitedResultOfSigmaQuoted E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{E : Q(«$α») → Type} →
{e : Q(«$α»)} → [Inhabited ((e : Q(«$α»)) × E e)] → Inhabited (Mathlib.Tactic.Ring.Common.Result E e)
structure Mathlib.Tactic.Ring.Common.RingCompare E1 #
{u : Lean.Level} → {α : Q(Type u)} → (Q(«$α») → Type) → Type
Defines how comparisons and binary equality are computed in the base type. These are separated from RingCompute because they can often be defined without using instance caches.
ctor Mathlib.Tactic.Ring.Common.RingCompare.mk E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
({x y : Q(«$α»)} → BaseType x → BaseType y → Bool) →
({x y : Q(«$α»)} → BaseType x → BaseType y → Ordering) → Mathlib.Tactic.Ring.Common.RingCompare BaseType
abbrev Mathlib.Tactic.Ring.Common.RingCompare.eq E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
Mathlib.Tactic.Ring.Common.RingCompare BaseType → {x y : Q(«$α»)} → BaseType x → BaseType y → Bool
Returns whether two coefficients are equal
abbrev Mathlib.Tactic.Ring.Common.RingCompare.compare E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
Mathlib.Tactic.Ring.Common.RingCompare BaseType → {x y : Q(«$α»)} → BaseType x → BaseType y → Ordering
Returns whether x is less than, equal to or greater than y. Can be any total order.
structure Mathlib.Tactic.Ring.Common.RingCompute E1 #
{u : Lean.Level} → {α : Q(Type u)} → (Q(«$α») → Type) → Q(CommSemiring «$α») → Type
Stores all of the normalization procedures on the coefficient type.
ring implements these using norm_num
algebra will implement these using ring
ctor Mathlib.Tactic.Ring.Common.RingCompute.mk E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompare BaseType →
({x y : Q(«$α»)} →
BaseType x →
BaseType y →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» + «$y») ×
Option Q(Mathlib.Meta.NormNum.IsNat («$x» + «$y») 0))) →
({x y : Q(«$α»)} →
BaseType x → BaseType y → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» * «$y»))) →
((v : Lean.Level) →
(β : Q(Type v)) →
Q(CommSemiring «$β») →
(x : Q(SMul «$β» «$α»)) →
(x_1 : Q(«$β»)) →
Mathlib.Tactic.AtomM
((y : Q(«$α»)) ×
Mathlib.Tactic.Ring.Common.ExSum BaseType sα q(«$y») ×
Q(∀ (a : «$α»), «$x_1» • a = «$y» * a))) →
({x : Q(«$α»)} →
(rα : Q(CommRing «$α»)) →
BaseType x → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(-«$x»))) →
({x : Q(«$α»)} →
{b : Q(ℕ)} →
BaseType x →
Mathlib.Tactic.Ring.Common.ExProdNat q(«$b») →
OptionT Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» ^ «$b»))) →
({x : Q(«$α»)} →
Option Q(CharZero «$α») →
(fα : Q(Semifield «$α»)) →
BaseType x →
Mathlib.Tactic.AtomM (Option (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x»⁻¹)))) →
((x : Q(«$α»)) →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum BaseType sα)
q(«$x»))) →
({x : Q(«$α»)} → BaseType x → Option Q(Mathlib.Meta.NormNum.IsNat «$x» 1)) →
Mathlib.Tactic.Ring.Common.Result BaseType q(Nat.rawCast 1) →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα
abbrev Mathlib.Tactic.Ring.Common.RingCompute.toRingCompare E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα → Mathlib.Tactic.Ring.Common.RingCompare BaseType
abbrev Mathlib.Tactic.Ring.Common.RingCompute.add E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα →
{x y : Q(«$α»)} →
BaseType x →
BaseType y →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» + «$y») ×
Option Q(Mathlib.Meta.NormNum.IsNat («$x» + «$y») 0))
Evaluate the sum of two coefficients.
If the result is zero returns a proof of this fact, which is used to remove zero terms.
abbrev Mathlib.Tactic.Ring.Common.RingCompute.mul E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα →
{x y : Q(«$α»)} →
BaseType x → BaseType y → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» * «$y»))
Evaluate the product of two coefficients.
abbrev Mathlib.Tactic.Ring.Common.RingCompute.cast E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα →
(v : Lean.Level) →
(β : Q(Type v)) →
Q(CommSemiring «$β») →
(x : Q(SMul «$β» «$α»)) →
(x_1 : Q(«$β»)) →
Mathlib.Tactic.AtomM
((y : Q(«$α»)) ×
Mathlib.Tactic.Ring.Common.ExSum BaseType sα q(«$y») × Q(∀ (a : «$α»), «$x_1» • a = «$y» * a))
Given a commutative ring β with a scalar multiplication action on α and a x : β, cast
x to α such that the scalar multiplication turns into normal multiplication. Typically one
can think of α as being an algebra over β, but this file does not know about Algebras.
abbrev Mathlib.Tactic.Ring.Common.RingCompute.neg E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα →
{x : Q(«$α»)} →
(rα : Q(CommRing «$α»)) → BaseType x → Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(-«$x»))
Evaluate the negation of a coefficient.
abbrev Mathlib.Tactic.Ring.Common.RingCompute.pow E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα →
{x : Q(«$α»)} →
{b : Q(ℕ)} →
BaseType x →
Mathlib.Tactic.Ring.Common.ExProdNat q(«$b») →
OptionT Lean.MetaM (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x» ^ «$b»))
Raise a coefficient to some natural power.
The exponent is not necessarily a natural literal. If the tactic can only raise coefficients to
the power of a literal (e.g. ring), it should check for this and return none otherwise.
abbrev Mathlib.Tactic.Ring.Common.RingCompute.inv E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα →
{x : Q(«$α»)} →
Option Q(CharZero «$α») →
(fα : Q(Semifield «$α»)) →
BaseType x → Mathlib.Tactic.AtomM (Option (Mathlib.Tactic.Ring.Common.Result BaseType q(«$x»⁻¹)))
Evaluate the inverse of a coefficient.
abbrev Mathlib.Tactic.Ring.Common.RingCompute.derive E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα →
(x : Q(«$α»)) →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum BaseType sα) q(«$x»))
Evaluate an expression as a potential coefficient.
abbrev Mathlib.Tactic.Ring.Common.RingCompute.isOne E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα →
{x : Q(«$α»)} → BaseType x → Option Q(Mathlib.Meta.NormNum.IsNat «$x» 1)
Decides whether a coefficient is 1 and returns a proof if so.
abbrev Mathlib.Tactic.Ring.Common.RingCompute.one E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{BaseType : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute BaseType sα → Mathlib.Tactic.Ring.Common.Result BaseType q(Nat.rawCast 1)
The number 1 represented as a BaseType.
instance Mathlib.Tactic.Ring.Common.instCoeOutRingComputeRingCompare E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
(BaseType : Q(«$α») → Type) →
(sα : Q(CommSemiring «$α»)) →
CoeOut (Mathlib.Tactic.Ring.Common.RingCompute BaseType sα) (Mathlib.Tactic.Ring.Common.RingCompare BaseType)
instance Mathlib.Tactic.Ring.Common.instNonemptyRingCompute E0 #
∀ (u : Lean.Level) (α : Q(Type u)) (BaseType : Q(«$α») → Type) [∀ (e : Q(«$α»)), Nonempty (BaseType e)]
(sα : Q(CommSemiring «$α»)), Nonempty (Mathlib.Tactic.Ring.Common.RingCompute BaseType sα)
instance Mathlib.Tactic.Ring.Common.instInhabitedSigmaQuotedConstMkStr1NilLevelExBaseNat E0 #
Inhabited ((e : Q(ℕ)) × Mathlib.Tactic.Ring.Common.ExBaseNat e)
instance Mathlib.Tactic.Ring.Common.instInhabitedSigmaQuotedConstMkStr1NilLevelExSumNat E0 #
Inhabited ((e : Q(ℕ)) × Mathlib.Tactic.Ring.Common.ExSumNat e)
instance Mathlib.Tactic.Ring.Common.instInhabitedSigmaQuotedConstMkStr1NilLevelExProdNat E0 #
Inhabited ((e : Q(ℕ)) × Mathlib.Tactic.Ring.Common.ExProdNat e)
instance Mathlib.Tactic.Ring.Common.instInhabitedSigmaQuotedExBase E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} → Inhabited ((e : Q(«$α»)) × Mathlib.Tactic.Ring.Common.ExBase bt sα e)
instance Mathlib.Tactic.Ring.Common.instInhabitedSigmaQuotedExSum E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} → Inhabited ((e : Q(«$α»)) × Mathlib.Tactic.Ring.Common.ExSum bt sα e)
instance Mathlib.Tactic.Ring.Common.instInhabitedSigmaQuotedExProd E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
[(e : Q(«$α»)) → Inhabited (bt e)] → Inhabited ((e : Q(«$α»)) × Mathlib.Tactic.Ring.Common.ExProd bt sα e)
opaque Mathlib.Tactic.Ring.Common.ExBaseNat.toExBase E1 #
(e : Q(ℕ)) →
Mathlib.Tactic.Ring.Common.ExBaseNat e →
(e' : Q(ℕ)) × Mathlib.Tactic.Ring.Common.ExBase Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ e'
Cast ExBaseNat to ExBase btℕ sℕ.
opaque Mathlib.Tactic.Ring.Common.ExProdNat.toExProd E1 #
(e : Q(ℕ)) →
Mathlib.Tactic.Ring.Common.ExProdNat e →
(e' : Q(ℕ)) × Mathlib.Tactic.Ring.Common.ExProd Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ e'
Cast ExProdNat to ExProd btℕ sℕ.
opaque Mathlib.Tactic.Ring.Common.ExSumNat.toExSum E1 #
(e : Q(ℕ)) →
Mathlib.Tactic.Ring.Common.ExSumNat e →
(e' : Q(ℕ)) × Mathlib.Tactic.Ring.Common.ExSum Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ e'
Cast ExSumNat to ExSum btℕ sℕ.
opaque Mathlib.Tactic.Ring.Common.ExBase.toExBaseNat E1 #
(e : Q(ℕ)) →
Mathlib.Tactic.Ring.Common.ExBase Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ e →
(e' : Q(ℕ)) × Mathlib.Tactic.Ring.Common.ExBaseNat e'
Cast ExBase btℕ sℕ to ExBaseNat.
opaque Mathlib.Tactic.Ring.Common.ExProd.toExProdNat E1 #
(e : Q(ℕ)) →
Mathlib.Tactic.Ring.Common.ExProd Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ e →
(e' : Q(ℕ)) × Mathlib.Tactic.Ring.Common.ExProdNat e'
Cast ExProd btℕ sℕ to ExProdNat.
opaque Mathlib.Tactic.Ring.Common.ExSum.toExSumNat E1 #
(e : Q(ℕ)) →
Mathlib.Tactic.Ring.Common.ExSum Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ e →
(e' : Q(ℕ)) × Mathlib.Tactic.Ring.Common.ExSumNat e'
Cast ExSum btℕ sℕ to ExSumNat.
def Mathlib.Tactic.Ring.Common.ExBase.toProd E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
{a : Q(«$α»)} →
{b : Q(ℕ)} →
Mathlib.Tactic.Ring.Common.ExBase bt sα a →
Mathlib.Tactic.Ring.Common.ExProdNat b →
Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExProd bt sα)
q(«$a» ^ «$b» * Nat.rawCast 1)
Embed an exponent (an ExBase, ExProd pair) as an ExProd by multiplying by 1.
def Mathlib.Tactic.Ring.Common.ExProd.toSum E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{e : Q(«$α»)} → Mathlib.Tactic.Ring.Common.ExProd bt sα e → Mathlib.Tactic.Ring.Common.ExSum bt sα q(«$e» + 0)
Embed ExProd in ExSum by adding 0.
opaque Mathlib.Tactic.Ring.Common.ExBase.eq E1 #
Mathlib.Tactic.Ring.Common.RingCompare Mathlib.Tactic.Ring.Common.btℕ →
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompare bt →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExBase bt sα a → Mathlib.Tactic.Ring.Common.ExBase bt sα b → Bool
Equality test for expressions. This is not a BEq instance because it is heterogeneous.
opaque Mathlib.Tactic.Ring.Common.ExProd.eq E1 #
Mathlib.Tactic.Ring.Common.RingCompare Mathlib.Tactic.Ring.Common.btℕ →
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompare bt →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExProd bt sα a → Mathlib.Tactic.Ring.Common.ExProd bt sα b → Bool
Equality test for expressions. This is not a BEq instance because it is heterogeneous.
opaque Mathlib.Tactic.Ring.Common.ExSum.eq E1 #
Mathlib.Tactic.Ring.Common.RingCompare Mathlib.Tactic.Ring.Common.btℕ →
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompare bt →
{a b : Q(«$α»)} → Mathlib.Tactic.Ring.Common.ExSum bt sα a → Mathlib.Tactic.Ring.Common.ExSum bt sα b → Bool
Equality test for expressions. This is not a BEq instance because it is heterogeneous.
opaque Mathlib.Tactic.Ring.Common.ExBase.cmp E1 #
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompare bt →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExBase bt sα a → Mathlib.Tactic.Ring.Common.ExBase bt sα b → Ordering
A total order on normalized expressions.
This is not an Ord instance because it is heterogeneous.
opaque Mathlib.Tactic.Ring.Common.ExProd.cmp E1 #
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompare bt →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExProd bt sα a → Mathlib.Tactic.Ring.Common.ExProd bt sα b → Ordering
A total order on normalized expressions.
This is not an Ord instance because it is heterogeneous.
opaque Mathlib.Tactic.Ring.Common.ExSum.cmp E1 #
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompare bt →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExSum bt sα a → Mathlib.Tactic.Ring.Common.ExSum bt sα b → Ordering
A total order on normalized expressions.
This is not an Ord instance because it is heterogeneous.
def Mathlib.Tactic.Ring.Common.ExProd.coeff E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} → {e : Q(«$α»)} → Mathlib.Tactic.Ring.Common.ExProd bt sα e → (c : Q(«$α»)) × bt c
Get the leading coefficient of an ExProd.
inductive Mathlib.Tactic.Ring.Common.Overlap E1 #
{u : Lean.Level} → {α : Q(Type u)} → (Q(«$α») → Type) → Q(CommSemiring «$α») → Q(«$α») → Type
Two monomials are said to "overlap" if they differ by a constant factor, in which case the constants just add. When this happens, the constant may be either zero (if the monomials cancel) or nonzero (if they add up); the zero case is handled specially.
ctor Mathlib.Tactic.Ring.Common.Overlap.zero E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{e : Q(«$α»)} → Q(Mathlib.Meta.NormNum.IsNat «$e» 0) → Mathlib.Tactic.Ring.Common.Overlap bt sα e
The expression e (the sum of monomials) is equal to 0.
ctor Mathlib.Tactic.Ring.Common.Overlap.nonzero E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
{e : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExProd bt sα) e →
Mathlib.Tactic.Ring.Common.Overlap bt sα e
The expression e (the sum of monomials) is equal to another monomial
(with nonzero leading coefficient).
theorem Mathlib.Tactic.Ring.Common.add_overlap_pf E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a b c : R} (x : R) (e : ℕ), a + b = c → x ^ e * a + x ^ e * b = x ^ e * c
theorem Mathlib.Tactic.Ring.Common.add_overlap_pf_zero E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a b : R} (x : R) (e : ℕ),
Mathlib.Meta.NormNum.IsNat (a + b) 0 → Mathlib.Meta.NormNum.IsNat (x ^ e * a + x ^ e * b) 0
def Mathlib.Tactic.Ring.Common.evalAddOverlap E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExProd bt sα a →
Mathlib.Tactic.Ring.Common.ExProd bt sα b →
OptionT Lean.MetaM (Mathlib.Tactic.Ring.Common.Overlap bt sα q(«$a» + «$b»))
Given monomials va, vb, attempts to add them together to get another monomial.
If the monomials are not compatible, returns none.
For example, xy + 2xy = 3xy is a .nonzero overlap, while xy + xz returns none
and xy + -xy = 0 is a .zero overlap.
theorem Mathlib.Tactic.Ring.Common.add_pf_zero_add E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (b : R), 0 + b = b
theorem Mathlib.Tactic.Ring.Common.add_pf_add_zero E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R), a + 0 = a
theorem Mathlib.Tactic.Ring.Common.add_pf_add_overlap E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a₁ a₂ b₁ b₂ c₁ c₂ : R},
a₁ + b₁ = c₁ → a₂ + b₂ = c₂ → a₁ + a₂ + (b₁ + b₂) = c₁ + c₂
theorem Mathlib.Tactic.Ring.Common.add_pf_add_overlap_zero E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a₁ a₂ b₁ b₂ c : R},
Mathlib.Meta.NormNum.IsNat (a₁ + b₁) 0 → a₂ + b₂ = c → a₁ + a₂ + (b₁ + b₂) = c
theorem Mathlib.Tactic.Ring.Common.add_pf_add_lt E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a₂ b c : R} (a₁ : R), a₂ + b = c → a₁ + a₂ + b = a₁ + c
theorem Mathlib.Tactic.Ring.Common.add_pf_add_gt E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a b₂ c : R} (b₁ : R), a + b₂ = c → a + (b₁ + b₂) = b₁ + c
opaque Mathlib.Tactic.Ring.Common.evalAdd E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExSum bt sα a →
Mathlib.Tactic.Ring.Common.ExSum bt sα b →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a» + «$b»))
Adds two polynomials va, vb together to get a normalized result polynomial.
0 + b = ba + 0 = aa * x + a * y = a * (x + y)(forx,ycoefficients; usesevalAddOverlap)(a₁ + a₂) + (b₁ + b₂) = a₁ + (a₂ + (b₁ + b₂))(ifa₁.lt b₁)(a₁ + a₂) + (b₁ + b₂) = b₁ + ((a₁ + a₂) + b₂)(if nota₁.lt b₁)
theorem Mathlib.Tactic.Ring.Common.one_mul E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R), Nat.rawCast 1 * a = a
theorem Mathlib.Tactic.Ring.Common.mul_one E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R), a * Nat.rawCast 1 = a
theorem Mathlib.Tactic.Ring.Common.mul_pf_left E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a₃ b c : R} (a₁ : R) (a₂ : ℕ), a₃ * b = c → a₁ ^ a₂ * a₃ * b = a₁ ^ a₂ * c
theorem Mathlib.Tactic.Ring.Common.mul_pf_right E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a b₃ c : R} (b₁ : R) (b₂ : ℕ), a * b₃ = c → a * (b₁ ^ b₂ * b₃) = b₁ ^ b₂ * c
theorem Mathlib.Tactic.Ring.Common.mul_pp_pf_overlap E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a₂ b₂ c : R} {ea eb e : ℕ} (x : R),
ea + eb = e → a₂ * b₂ = c → x ^ ea * a₂ * (x ^ eb * b₂) = x ^ e * c
opaque Mathlib.Tactic.Ring.Common.evalMulProd E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExProd bt sα a →
Mathlib.Tactic.Ring.Common.ExProd bt sα b →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExProd bt sα) q(«$a» * «$b»))
Multiplies two monomials va, vb together to get a normalized result monomial.
x * y = (x * y)(forx,ycoefficients)x * (b₁ * b₂) = b₁ * (b₂ * x)(forxcoefficient)(a₁ * a₂) * y = a₁ * (a₂ * y)(forycoefficient)(x ^ ea * a₂) * (x ^ eb * b₂) = x ^ (ea + eb) * (a₂ * b₂)(ifeaandebare identical except coefficient)(a₁ * a₂) * (b₁ * b₂) = a₁ * (a₂ * (b₁ * b₂))(ifa₁.lt b₁)(a₁ * a₂) * (b₁ * b₂) = b₁ * ((a₁ * a₂) * b₂)(if nota₁.lt b₁)
theorem Mathlib.Tactic.Ring.Common.mul_zero E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R), a * 0 = 0
theorem Mathlib.Tactic.Ring.Common.mul_add E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a b₁ b₂ c₁ c₂ d : R},
a * b₁ = c₁ → a * b₂ = c₂ → c₁ + 0 + c₂ = d → a * (b₁ + b₂) = d
def Mathlib.Tactic.Ring.Common.evalMul₁ E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExProd bt sα a →
Mathlib.Tactic.Ring.Common.ExSum bt sα b →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a» * «$b»))
Multiplies a monomial va to a polynomial vb to get a normalized result polynomial.
a * 0 = 0a * (b₁ + b₂) = (a * b₁) + (a * b₂)
theorem Mathlib.Tactic.Ring.Common.zero_mul E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (b : R), 0 * b = 0
theorem Mathlib.Tactic.Ring.Common.add_mul E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a₁ a₂ b c₁ c₂ d : R},
a₁ * b = c₁ → a₂ * b = c₂ → c₁ + c₂ = d → (a₁ + a₂) * b = d
def Mathlib.Tactic.Ring.Common.evalMul E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a b : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExSum bt sα a →
Mathlib.Tactic.Ring.Common.ExSum bt sα b →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a» * «$b»))
Multiplies two polynomials va, vb together to get a normalized result polynomial.
0 * b = 0(a₁ + a₂) * b = (a₁ * b) + (a₂ * b)
theorem Mathlib.Tactic.Ring.Common.neg_one_mul E1 #
∀ {R : Type u_2} [inst : CommRing R] {a b : R}, -1 * a = b → -a = b
theorem Mathlib.Tactic.Ring.Common.neg_mul E1 #
∀ {R : Type u_2} [inst : CommRing R] (a₁ : R) (a₂ : ℕ) {a₃ b : R}, -a₃ = b → -(a₁ ^ a₂ * a₃) = a₁ ^ a₂ * b
def Mathlib.Tactic.Ring.Common.evalNegProd E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
{a : Q(«$α»)} →
(rα : Q(CommRing «$α»)) →
Mathlib.Tactic.Ring.Common.ExProd bt sα a →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExProd bt sα) q(-«$a»))
Negates a monomial va to get another monomial.
-c = (-c)(forccoefficient)-(a₁ * a₂) = a₁ * -a₂
theorem Mathlib.Tactic.Ring.Common.neg_zero E1 #
∀ {R : Type u_2} [inst : CommRing R], -0 = 0
theorem Mathlib.Tactic.Ring.Common.neg_add E1 #
∀ {R : Type u_2} [inst : CommRing R] {a₁ a₂ b₁ b₂ : R}, -a₁ = b₁ → -a₂ = b₂ → -(a₁ + a₂) = b₁ + b₂
def Mathlib.Tactic.Ring.Common.evalNeg E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
{a : Q(«$α»)} →
(rα : Q(CommRing «$α»)) →
Mathlib.Tactic.Ring.Common.ExSum bt sα a →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(-«$a»))
Negates a polynomial va to get another polynomial.
-0 = 0(forccoefficient)-(a₁ + a₂) = -a₁ + -a₂
theorem Mathlib.Tactic.Ring.Common.sub_pf E1 #
∀ {R : Type u_2} [inst : CommRing R] {a b c d : R}, -b = c → a + c = d → a - b = d
def Mathlib.Tactic.Ring.Common.evalSub E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a b : Q(«$α»)} →
(rα : Q(CommRing «$α»)) →
Mathlib.Tactic.Ring.Common.ExSum bt sα a →
Mathlib.Tactic.Ring.Common.ExSum bt sα b →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a» - «$b»))
Subtracts two polynomials va, vb to get a normalized result polynomial.
a - b = a + -b
theorem Mathlib.Tactic.Ring.Common.pow_prod_atom E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R) (b : ℕ) {e : R}, (a + 0) ^ b * Nat.rawCast 1 = e → a ^ b = e
def Mathlib.Tactic.Ring.Common.evalPowProdAtom E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
{a : Q(«$α»)} →
{b : Q(ℕ)} →
Mathlib.Tactic.Ring.Common.ExProd bt sα a →
Mathlib.Tactic.Ring.Common.ExProdNat b →
Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExProd bt sα) q(«$a» ^ «$b»)
The fallback case for exponentiating polynomials is to use ExBase.toProd to just build an
exponent expression. (This has a slightly different normalization than evalPowAtom because
the input types are different.)
x ^ e = (x + 0) ^ e * 1
theorem Mathlib.Tactic.Ring.Common.pow_atom E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R) (b : ℕ) {e : R}, a ^ b * Nat.rawCast 1 = e → a ^ b = e + 0
def Mathlib.Tactic.Ring.Common.evalPowAtom E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
{a : Q(«$α»)} →
{b : Q(ℕ)} →
Mathlib.Tactic.Ring.Common.ExBase bt sα a →
Mathlib.Tactic.Ring.Common.ExProdNat b →
Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a» ^ «$b»)
The fallback case for exponentiating polynomials is to use ExBase.toProd to just build an
exponent expression.
x ^ e = x ^ e * 1 + 0
theorem Mathlib.Tactic.Ring.Common.const_pos E1 #
∀ (n : ℕ), Nat.ble 1 n = true → 0 < n.rawCast
theorem Mathlib.Tactic.Ring.Common.mul_exp_pos E1 #
∀ {a₁ a₂ : ℕ} (n : ℕ), 0 < a₁ → 0 < a₂ → 0 < a₁ ^ n * a₂
theorem Mathlib.Tactic.Ring.Common.add_pos_left E1 #
∀ {a₁ : ℕ} (a₂ : ℕ), 0 < a₁ → 0 < a₁ + a₂
theorem Mathlib.Tactic.Ring.Common.add_pos_right E1 #
∀ {a₂ : ℕ} (a₁ : ℕ), 0 < a₂ → 0 < a₁ + a₂
opaque Mathlib.Tactic.Ring.Common.ExBaseNat.evalPos E1 #
{a : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExBaseNat a → Option Q(0 < «$a»)
Attempts to prove that a polynomial expression in ℕ is positive.
- Atoms are not (necessarily) positive
- Sums defer to
ExSum.evalPos
opaque Mathlib.Tactic.Ring.Common.ExProdNat.evalPos E1 #
{a : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExProdNat a → Option Q(0 < «$a»)
Attempts to prove that a monomial expression in ℕ is positive.
0 < c(wherecis a numeral) is true by the normalization invariant (cis not zero)0 < x ^ e * bif0 < xand0 < b
opaque Mathlib.Tactic.Ring.Common.ExSumNat.evalPos E1 #
{a : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExSumNat a → Option Q(0 < «$a»)
Attempts to prove that a polynomial expression in ℕ is positive.
0 < 0fails0 < a + bif0 < aor0 < b
theorem Mathlib.Tactic.Ring.Common.pow_one E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R), a ^ 1 = a
theorem Mathlib.Tactic.Ring.Common.pow_bit0 E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a b c : R} {k : ℕ}, a ^ k = b → b * b = c → a ^ Nat.mul 2 k = c
theorem Mathlib.Tactic.Ring.Common.pow_bit1 E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a b c : R} {k : ℕ} {d : R},
a ^ k = b → b * b = c → c * a = d → a ^ (Nat.mul 2 k).add 1 = d
opaque Mathlib.Tactic.Ring.Common.evalPowNat E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a : Q(«$α»)} →
Mathlib.Tactic.Ring.Common.ExSum bt sα a →
(n : Q(ℕ)) →
Lean.MetaM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a» ^ «$n»))
The main case of exponentiation of ring expressions is when va is a polynomial and n is a
nonzero literal expression, like (x + y)^5. In this case we work out the polynomial completely
into a sum of monomials.
x ^ 1 = xx ^ (2*n) = x ^ n * x ^ nx ^ (2*n+1) = x ^ n * x ^ n * x
theorem Mathlib.Tactic.Ring.Common.one_pow E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a : R} (b : ℕ), Mathlib.Meta.NormNum.IsNat a 1 → a ^ b = a
theorem Mathlib.Tactic.Ring.Common.mul_pow E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a₂ c₂ : R} {ea₁ b c₁ : ℕ} {xa₁ : R},
ea₁ * b = c₁ → a₂ ^ b = c₂ → (xa₁ ^ ea₁ * a₂) ^ b = xa₁ ^ c₁ * c₂
theorem Mathlib.Tactic.Ring.Common.mul_pow_mul E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a₂ c₂ : R} {ea₁ b c₁ : ℕ} {xa₁ c₃ d : R},
ea₁ * b = c₁ → a₂ ^ b = c₂ → xa₁ ^ c₁ * Nat.rawCast 1 = c₃ → c₃ * c₂ = d → (xa₁ ^ ea₁ * a₂) ^ b = d
def Mathlib.Tactic.Ring.Common.evalPowProd E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a : Q(«$α»)} →
{b : Q(ℕ)} →
Mathlib.Tactic.Ring.Common.ExProd bt sα a →
Mathlib.Tactic.Ring.Common.ExProdNat b →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExProd bt sα) q(«$a» ^ «$b»))
There are several special cases when exponentiating monomials:
1 ^ n = 1x ^ y = (x ^ y)whenxis a constant (Note this may fail if e.g.yis not a constant)(a * b) ^ e = a ^ e * b ^ e
In all other cases we use evalPowProdAtom.
structure Mathlib.Tactic.Ring.Common.ExtractCoeff E1 #
Q(ℕ) → Type
The result of extractCoeff is a numeral and a proof that the original expression
factors by this numeral.
ctor Mathlib.Tactic.Ring.Common.ExtractCoeff.mk E0 #
{e : Q(ℕ)} →
(k e' : Q(ℕ)) →
Mathlib.Tactic.Ring.Common.ExProdNat e' → Q(«$e» = «$e'» * «$k») → Mathlib.Tactic.Ring.Common.ExtractCoeff e
abbrev Mathlib.Tactic.Ring.Common.ExtractCoeff.k E1 #
{e : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExtractCoeff e → Q(ℕ)
A raw natural number literal.
abbrev Mathlib.Tactic.Ring.Common.ExtractCoeff.e' E1 #
{e : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExtractCoeff e → Q(ℕ)
The result of extracting the coefficient is a monic monomial.
abbrev Mathlib.Tactic.Ring.Common.ExtractCoeff.ve' E1 #
{e : Q(ℕ)} → (self : Mathlib.Tactic.Ring.Common.ExtractCoeff e) → Mathlib.Tactic.Ring.Common.ExProdNat self.e'
e' is a monomial.
abbrev Mathlib.Tactic.Ring.Common.ExtractCoeff.p E1 #
{e : Q(ℕ)} → (self : Mathlib.Tactic.Ring.Common.ExtractCoeff e) → Q(«$e» = unknown_1 * unknown_2)
The proof that e splits into the coefficient k and the monic monomial e'.
theorem Mathlib.Tactic.Ring.Common.coeff_one E1 #
∀ (k : ℕ) {e : ℕ}, Nat.rawCast 1 = e → k.rawCast = e * k
theorem Mathlib.Tactic.Ring.Common.coeff_mul E1 #
∀ {a₃ c₂ k : ℕ} (a₁ a₂ : ℕ), a₃ = c₂ * k → a₁ ^ a₂ * a₃ = a₁ ^ a₂ * c₂ * k
def Mathlib.Tactic.Ring.Common.extractCoeff E1 #
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a : Q(ℕ)} → Mathlib.Tactic.Ring.Common.ExProdNat a → Mathlib.Tactic.Ring.Common.ExtractCoeff a
Given a monomial expression va, splits off the leading coefficient k and the remainder
e', stored in the ExtractCoeff structure.
c = 1 * c(ifcis a constant)a * b = (a * b') * kifb = b' * k
theorem Mathlib.Tactic.Ring.Common.pow_one_cast E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R), a ^ Nat.rawCast 1 = a
theorem Mathlib.Tactic.Ring.Common.pow_one_cast_of_isNat E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R) (b : ℕ), Mathlib.Meta.NormNum.IsNat b 1 → a ^ b = a
theorem Mathlib.Tactic.Ring.Common.zero_pow E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {b : ℕ}, 0 < b → 0 ^ b = 0
theorem Mathlib.Tactic.Ring.Common.single_pow E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a c : R} {b : ℕ}, a ^ b = c → (a + 0) ^ b = c + 0
theorem Mathlib.Tactic.Ring.Common.pow_nat E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a : R} {b c k : ℕ} {d e : R}, b = c * k → a ^ c = d → d ^ k = e → a ^ b = e
opaque Mathlib.Tactic.Ring.Common.evalPow₁ E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a : Q(«$α»)} →
{b : Q(ℕ)} →
Mathlib.Tactic.Ring.Common.ExSum bt sα a →
Mathlib.Tactic.Ring.Common.ExProdNat b →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a» ^ «$b»))
Exponentiates a polynomial va by a monomial vb, including several special cases.
a ^ 1 = a0 ^ e = 0if0 < e(a + 0) ^ b = a ^ bcomputed usingevalPowProda ^ b = (a ^ b') ^ kifb = b' * kandk > 1
Otherwise a ^ b is just encoded as a ^ b * 1 + 0 using evalPowAtom.
theorem Mathlib.Tactic.Ring.Common.pow_zero E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (a : R) {e : R}, Nat.rawCast 1 = e → a ^ 0 = e + 0
theorem Mathlib.Tactic.Ring.Common.pow_add E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a c₁ c₂ : R} {b₁ b₂ : ℕ} {d : R},
a ^ b₁ = c₁ → a ^ b₂ = c₂ → c₁ * c₂ = d → a ^ (b₁ + b₂) = d
def Mathlib.Tactic.Ring.Common.evalPow E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a : Q(«$α»)} →
{b : Q(ℕ)} →
Mathlib.Tactic.Ring.Common.ExSum bt sα a →
Mathlib.Tactic.Ring.Common.ExSumNat b →
Lean.MetaM
(Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a» ^ «$b»))
Exponentiates two polynomials va, vb.
a ^ 0 = 1a ^ (b₁ + b₂) = a ^ b₁ * a ^ b₂
structure Mathlib.Tactic.Ring.Common.Cache E1 #
{u : Lean.Level} → {α : Q(Type u)} → Q(CommSemiring «$α») → Type
This cache contains data required by the ring tactic during execution.
ctor Mathlib.Tactic.Ring.Common.Cache.mk E0 #
{u : Lean.Level} →
{α : Q(Type u)} →
{sα : Q(CommSemiring «$α»)} →
Option Q(CommRing «$α») → Option Q(Semifield «$α») → Option Q(CharZero «$α») → Mathlib.Tactic.Ring.Common.Cache sα
abbrev Mathlib.Tactic.Ring.Common.Cache.rα E1 #
{u : Lean.Level} →
{α : Q(Type u)} → {sα : Q(CommSemiring «$α»)} → Mathlib.Tactic.Ring.Common.Cache sα → Option Q(CommRing «$α»)
A ring instance on α, if available.
abbrev Mathlib.Tactic.Ring.Common.Cache.dsα E1 #
{u : Lean.Level} →
{α : Q(Type u)} → {sα : Q(CommSemiring «$α»)} → Mathlib.Tactic.Ring.Common.Cache sα → Option Q(Semifield «$α»)
A division semiring instance on α, if available.
abbrev Mathlib.Tactic.Ring.Common.Cache.czα E1 #
{u : Lean.Level} →
{α : Q(Type u)} → {sα : Q(CommSemiring «$α»)} → Mathlib.Tactic.Ring.Common.Cache sα → Option Q(CharZero «$α»)
A characteristic zero ring instance on α, if available.
def Mathlib.Tactic.Ring.Common.mkCache E1 #
{u : Lean.Level} → {α : Q(Type u)} → (sα : Q(CommSemiring «$α»)) → Lean.MetaM (Mathlib.Tactic.Ring.Common.Cache sα)
Create a new cache for α by doing the necessary instance searches.
theorem Mathlib.Tactic.Ring.Common.toProd_pf E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a a' : R}, a = a' → ∀ {e : ℕ}, Nat.rawCast 1 = e → a = a' ^ e * Nat.rawCast 1
theorem Mathlib.Tactic.Ring.Common.atom_pf E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {b : R} (a : R) {e : ℕ},
Nat.rawCast 1 = e → a ^ e * Nat.rawCast 1 = b → a = b + 0
theorem Mathlib.Tactic.Ring.Common.atom_pf' E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a a' b : R},
a = a' → ∀ {e : ℕ}, Nat.rawCast 1 = e → a' ^ e * Nat.rawCast 1 = b → a = b + 0
def Mathlib.Tactic.Ring.Common.evalAtom E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
(e : Q(«$α»)) →
Mathlib.Tactic.AtomM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) e)
Evaluates an atom, an expression where ring can find no additional structure.
a = a ^ 1 * 1 + 0
theorem Mathlib.Tactic.Ring.Common.inv_mul E1 #
∀ {R : Type u_2} [inst : Semifield R] {a₁ : R} {a₂ : ℕ} {a₃ b₁ b₃ c : R},
a₁⁻¹ = b₁ → a₃⁻¹ = b₃ → b₃ * (b₁ ^ a₂ * Nat.rawCast 1) = c → (a₁ ^ a₂ * a₃)⁻¹ = c
theorem Mathlib.Tactic.Ring.Common.inv_zero E1 #
∀ {R : Type u_2} [inst : Semifield R], 0⁻¹ = 0
theorem Mathlib.Tactic.Ring.Common.inv_single E1 #
∀ {R : Type u_2} [inst : Semifield R] {a b : R}, a⁻¹ = b → (a + 0)⁻¹ = b + 0
theorem Mathlib.Tactic.Ring.Common.inv_add E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {b₁ b₂ : R} {a₁ a₂ : ℕ}, ↑a₁ = b₁ → ↑a₂ = b₂ → ↑(a₁ + a₂) = b₁ + b₂
def Mathlib.Tactic.Ring.Common.evalInvAtom E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
(dsα : Q(Semifield «$α»)) →
(a : Q(«$α»)) →
Mathlib.Tactic.AtomM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExBase bt sα) q(«$a»⁻¹))
Applies ⁻¹ to a polynomial to get an atom.
def Mathlib.Tactic.Ring.Common.ExProd.evalInv E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
(dsα : Q(Semifield «$α»)) →
{a : Q(«$α»)} →
Option Q(CharZero «$α») →
Mathlib.Tactic.Ring.Common.ExProd bt sα a →
Mathlib.Tactic.AtomM
(Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExProd bt sα) q(«$a»⁻¹))
Inverts a polynomial va to get a normalized result polynomial.
c⁻¹ = (c⁻¹)ifcis a constant(a ^ b * c)⁻¹ = a⁻¹ ^ b * c⁻¹
def Mathlib.Tactic.Ring.Common.ExSum.evalInv E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
(dsα : Q(Semifield «$α»)) →
{a : Q(«$α»)} →
Option Q(CharZero «$α») →
Mathlib.Tactic.Ring.Common.ExSum bt sα a →
Mathlib.Tactic.AtomM
(Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a»⁻¹))
Inverts a polynomial va to get a normalized result polynomial.
0⁻¹ = 0a⁻¹ = (a⁻¹)ifais a nontrivial sum
theorem Mathlib.Tactic.Ring.Common.div_pf E1 #
∀ {R : Type u_2} [inst : Semifield R] {a b c d : R}, b⁻¹ = c → a * c = d → a / b = d
def Mathlib.Tactic.Ring.Common.evalDiv E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{a b : Q(«$α»)} →
(rα : Q(Semifield «$α»)) →
Option Q(CharZero «$α») →
Mathlib.Tactic.Ring.Common.ExSum bt sα a →
Mathlib.Tactic.Ring.Common.ExSum bt sα b →
Mathlib.Tactic.AtomM
(Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) q(«$a» / «$b»))
Divides two polynomials va, vb to get a normalized result polynomial.
a / b = a * b⁻¹
theorem Mathlib.Tactic.Ring.Common.add_congr E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a a' b b' c : R}, a = a' → b = b' → a' + b' = c → a + b = c
theorem Mathlib.Tactic.Ring.Common.mul_congr E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a a' b b' c : R}, a = a' → b = b' → a' * b' = c → a * b = c
theorem Mathlib.Tactic.Ring.Common.nsmul_congr E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {b b' c : R} {a a' : ℕ}, a = a' → b = b' → a' • b' = c → a • b = c
theorem Mathlib.Tactic.Ring.Common.zsmul_congr E1 #
∀ {R : Type u_2} [inst : CommRing R] {b b' c : R} {a a' : ℤ}, a = a' → b = b' → a' • b' = c → a • b = c
theorem Mathlib.Tactic.Ring.Common.pow_congr E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {a a' c : R} {b b' : ℕ}, a = a' → b = b' → a' ^ b' = c → a ^ b = c
theorem Mathlib.Tactic.Ring.Common.neg_congr E1 #
∀ {R : Type u_2} [inst : CommRing R] {a a' b : R}, a = a' → -a' = b → -a = b
theorem Mathlib.Tactic.Ring.Common.sub_congr E1 #
∀ {R : Type u_2} [inst : CommRing R] {a a' b b' c : R}, a = a' → b = b' → a' - b' = c → a - b = c
theorem Mathlib.Tactic.Ring.Common.inv_congr E1 #
∀ {R : Type u_2} [inst : Semifield R] {a a' b : R}, a = a' → a'⁻¹ = b → a⁻¹ = b
theorem Mathlib.Tactic.Ring.Common.div_congr E1 #
∀ {R : Type u_2} [inst : Semifield R] {a a' b b' c : R}, a = a' → b = b' → a' / b' = c → a / b = c
theorem Mathlib.Tactic.Ring.Common.smul_congr E1 #
∀ {R : Type u_2} {α : Type u_3} [inst : CommSemiring α] [inst_1 : SMul R α] {r : R} {a b t c : α},
a = b → (∀ (x : α), r • x = t * x) → t * b = c → r • a = c
def Mathlib.Tactic.Ring.Common.Cache.nat E1 #
Mathlib.Tactic.Ring.Common.Cache Mathlib.Tactic.Ring.Common.sℕ
A precomputed Cache for ℕ.
def Mathlib.Tactic.Ring.Common.isAtomOrDerivable E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.Cache sα →
(e : Q(«$α»)) →
Mathlib.Tactic.AtomM
(Option (Option (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) e)))
Checks whether e would be processed by eval as a ring expression,
or otherwise if it is an atom or something simplifiable via norm_num.
We use this in ring_nf to avoid rewriting atoms unnecessarily.
Returns:
noneifevalwould processeas an algebraic ring expressionsome noneifevalwould treateas an atom.some (some r)ifevalwould not processeas an algebraic ring expression, butNormNum.derivecan nevertheless simplifye, with resultr.
opaque Mathlib.Tactic.Ring.Common.eval E1 #
Mathlib.Tactic.Ring.Common.RingCompute Mathlib.Tactic.Ring.Common.btℕ Mathlib.Tactic.Ring.Common.sℕ →
{u : Lean.Level} →
{α : Q(Type u)} →
{bt : Q(«$α») → Type} →
{sα : Q(CommSemiring «$α»)} →
Mathlib.Tactic.Ring.Common.RingCompute bt sα →
Mathlib.Tactic.Ring.Common.Cache sα →
(e : Q(«$α»)) →
Mathlib.Tactic.AtomM (Mathlib.Tactic.Ring.Common.Result (Mathlib.Tactic.Ring.Common.ExSum bt sα) e)
Evaluates expression e of type α into a normalized representation as a polynomial.
This is the main driver of ring, which calls out to evalAdd, evalMul etc.
rctells us how to normalize constants inα.rcℕtells us how to normalize constants in exponents.