The Context
for a call to abel
.
Stores a few options for this call, and caches some common subexpressions
such as typeclass instances and 0 : α
.
- α : Lean.Expr
The type of the ambient additive commutative group or monoid.
- univ : Lean.Level
The universe level for
α
. - α0 : Lean.Expr
The expression representing
0 : α
. - isGroup : Bool
Specify whether we are in an additive commutative group or an additive commutative monoid.
- inst : Lean.Expr
The
AddCommGroup α
orAddCommMonoid α
expression.
Instances For
Populate a context
object for evaluating e
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The monad for Abel
contains, in addition to the AtomM
state,
some information about the current type we are working over, so that we can consistently
use group lemmas or monoid lemmas as appropriate.
Instances For
Apply the function n : ∀ {α} [inst : AddWhatever α], _
to the
implicit parameters in the context, and the given list of arguments.
Equations
- Mathlib.Tactic.Abel.Context.app c n inst = Lean.mkAppN (Lean.Expr.app (Lean.Expr.app (Lean.Expr.const n [c.univ]) c.α) inst)
Instances For
Apply the function n : ∀ {α} [inst α], _
to the implicit parameters in the
context, and the given list of arguments.
Compared to context.app
, this takes the name of the typeclass, rather than an
inferred typeclass instance.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add the letter "g" to the end of the name, e.g. turning term
into termg
.
This is used to choose between declarations taking AddCommMonoid
and those
taking AddCommGroup
instances.
Equations
- Mathlib.Tactic.Abel.addG x = match x with | Lean.Name.str p s => Lean.Name.str p (s ++ "g") | n => n
Instances For
Apply the function n : ∀ {α} [AddComm{Monoid,Group} α]
to the given list of arguments.
Will use the AddComm{Monoid,Group}
instance that has been cached in the context.
Equations
- Mathlib.Tactic.Abel.iapp n xs = do let c ← read pure (Mathlib.Tactic.Abel.Context.app c (if c.isGroup = true then Mathlib.Tactic.Abel.addG n else n) c.inst xs)
Instances For
A type synonym used by abel
to represent n • x + a
in an additive commutative monoid.
Equations
- Mathlib.Tactic.Abel.term n x a = n • x + a
Instances For
A type synonym used by abel
to represent n • x + a
in an additive commutative group.
Equations
- Mathlib.Tactic.Abel.termg n x a = n • x + a
Instances For
Evaluate a term with coefficient n
, atom x
and successor terms a
.
Equations
- Mathlib.Tactic.Abel.mkTerm n x a = Mathlib.Tactic.Abel.iapp `Mathlib.Tactic.Abel.term #[n, x, a]
Instances For
Interpret an integer as a coefficient to a term.
Equations
- Mathlib.Tactic.Abel.intToExpr n = do let __do_lift ← read liftM (Lean.Expr.ofInt (Lean.mkConst (if __do_lift.isGroup = true then `Int else `Nat)) n)
Instances For
A normal form for abel
.
Expressions are represented as a list of terms of the form e = n • x
,
where n : ℤ
and x
is an arbitrary element of the additive commutative monoid or group.
We explicitly track the Expr
forms of e
and n
, even though they could be reconstructed,
for efficiency.
- zero: Lean.Expr → Mathlib.Tactic.Abel.NormalExpr
- nterm: Lean.Expr → Lean.Expr × ℤ → ℕ × Lean.Expr → Mathlib.Tactic.Abel.NormalExpr → Mathlib.Tactic.Abel.NormalExpr
Instances For
Equations
- Mathlib.Tactic.Abel.instInhabitedNormalExpr = { default := Mathlib.Tactic.Abel.NormalExpr.zero default }
Extract the expression from a normal form.
Equations
- Mathlib.Tactic.Abel.NormalExpr.e x = match x with | Mathlib.Tactic.Abel.NormalExpr.zero e => e | Mathlib.Tactic.Abel.NormalExpr.nterm e n x a => e
Instances For
Construct the normal form representing a single term.
Equations
- Mathlib.Tactic.Abel.NormalExpr.term' n x a = do let __do_lift ← Mathlib.Tactic.Abel.mkTerm n.1 x.2 (Mathlib.Tactic.Abel.NormalExpr.e a) pure (Mathlib.Tactic.Abel.NormalExpr.nterm __do_lift n x a)
Instances For
Construct the normal form representing zero.
Equations
- Mathlib.Tactic.Abel.NormalExpr.zero' = do let __do_lift ← read pure (Mathlib.Tactic.Abel.NormalExpr.zero __do_lift.α0)
Instances For
Interpret the sum of two expressions in abel
's normal form.
Interpret a negated expression in abel
's normal form.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A synonym for •
, used internally in abel
.
Equations
- Mathlib.Tactic.Abel.smulg n x = n • x
Instances For
Auxiliary function for evalSMul'
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Interpret an expression as an atom for abel
's normal form.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Normalize a term orig
of the form smul e₁ e₂
or smulg e₁ e₂
.
Normalized terms use smul
for monoids and smulg
for groups,
so there are actually four cases to handle:
- Using
smul
in a monoid just simplifies the pieces usingsubst_into_smul
- Using
smulg
in a group just simplifies the pieces usingsubst_into_smulg
- Using
smul a b
in a group requires convertinga
from a nat to an int and then simplifyingsmulg ↑a b
usingsubst_into_smul_upcast
- Using
smulg
in a monoid is impossible (or at least out of scope), because you need a group argument to write asmulg
term
Equations
- One or more equations did not get rendered due to their size.
Instances For
Evaluate an expression into its abel
normal form, by recursing into subexpressions.
Tactic for solving equations in the language of
additive, commutative monoids and groups.
This version of abel
fails if the target is not an equality
that is provable by the axioms of commutative monoids/groups.
abel1!
will use a more aggressive reducibility setting to identify atoms.
This can prove goals that abel
cannot, but is more expensive.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tactic for solving equations in the language of
additive, commutative monoids and groups.
This version of abel
fails if the target is not an equality
that is provable by the axioms of commutative monoids/groups.
abel1!
will use a more aggressive reducibility setting to identify atoms.
This can prove goals that abel
cannot, but is more expensive.
Equations
- Mathlib.Tactic.Abel.abel1! = Lean.ParserDescr.node `Mathlib.Tactic.Abel.abel1! 1024 (Lean.ParserDescr.nonReservedSymbol "abel1!" false)
Instances For
A type synonym used by abel
to represent n • x + a
in an additive commutative group.
True if this represents an atomic expression.
Equations
- Mathlib.Tactic.Abel.NormalExpr.isAtom x = match x with | Mathlib.Tactic.Abel.NormalExpr.nterm e (fst, 1) x (Mathlib.Tactic.Abel.NormalExpr.zero e_1) => true | x => false
Instances For
The normalization style for abel_nf
.
- term: Mathlib.Tactic.Abel.AbelMode
The default form
- raw: Mathlib.Tactic.Abel.AbelMode
Raw form: the representation
abel
uses internally.
Instances For
Configuration for abel_nf
.
the reducibility setting to use when comparing atoms for defeq
- recursive : Bool
if true, atoms inside ring expressions will be reduced recursively
- mode : Mathlib.Tactic.Abel.AbelMode
The normalization style.
Instances For
Function elaborating AbelNF.Config
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The core of abel_nf
, which rewrites the expression e
into abel
normal form.
s
: a reference to the mutable state ofabel
, for persisting across calls. This ensures that atom ordering is used consistently.cfg
: the configuration optionse
: the expression to rewrite
Equations
- One or more equations did not get rendered due to their size.
Instances For
The recursive case of abelNF
.
root
: true when the function is called directly fromabelNFCore
and false when called byevalAtom
in recursive mode.parent
: The input expression to simplify. Inpre
we make use of bothparent
ande
to determine if we are at the top level in order to prevent a loopgo -> eval -> evalAtom -> go
which makes no progress.
The evalAtom
implementation passed to eval
calls go
if cfg.recursive
is true,
and does nothing otherwise.
Use abel_nf
to rewrite the main goal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Use abel_nf
to rewrite hypothesis h
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Unsupported legacy syntax from mathlib3, which allowed passing additional terms to abel
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Unsupported legacy syntax from mathlib3, which allowed passing additional terms to abel!
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Simplification tactic for expressions in the language of abelian groups, which rewrites all group expressions into a normal form.
abel_nf!
will use a more aggressive reducibility setting to identify atoms.abel_nf (config := cfg)
allows for additional configuration:abel_nf
works as both a tactic and a conv tactic. In tactic mode,abel_nf at h
can be used to rewrite in a hypothesis.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Simplification tactic for expressions in the language of abelian groups, which rewrites all group expressions into a normal form.
abel_nf!
will use a more aggressive reducibility setting to identify atoms.abel_nf (config := cfg)
allows for additional configuration:abel_nf
works as both a tactic and a conv tactic. In tactic mode,abel_nf at h
can be used to rewrite in a hypothesis.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Simplification tactic for expressions in the language of abelian groups, which rewrites all group expressions into a normal form.
abel_nf!
will use a more aggressive reducibility setting to identify atoms.abel_nf (config := cfg)
allows for additional configuration:abel_nf
works as both a tactic and a conv tactic. In tactic mode,abel_nf at h
can be used to rewrite in a hypothesis.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Elaborator for the abel_nf
tactic.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Simplification tactic for expressions in the language of abelian groups, which rewrites all group expressions into a normal form.
abel_nf!
will use a more aggressive reducibility setting to identify atoms.abel_nf (config := cfg)
allows for additional configuration:abel_nf
works as both a tactic and a conv tactic. In tactic mode,abel_nf at h
can be used to rewrite in a hypothesis.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tactic for evaluating expressions in abelian groups.
abel!
will use a more aggressive reducibility setting to determine equality of atoms.abel1
fails if the target is not an equality.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Equations
- Mathlib.Tactic.Abel.abel = Lean.ParserDescr.node `Mathlib.Tactic.Abel.abel 1024 (Lean.ParserDescr.nonReservedSymbol "abel" false)
Instances For
Tactic for evaluating expressions in abelian groups.
abel!
will use a more aggressive reducibility setting to determine equality of atoms.abel1
fails if the target is not an equality.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Equations
- Mathlib.Tactic.Abel.tacticAbel! = Lean.ParserDescr.node `Mathlib.Tactic.Abel.tacticAbel! 1024 (Lean.ParserDescr.nonReservedSymbol "abel!" false)
Instances For
The tactic abel
evaluates expressions in abelian groups.
This is the conv tactic version, which rewrites a target which is an abel equality to True
.
See also the abel
tactic.
Equations
- Mathlib.Tactic.Abel.abelConv = Lean.ParserDescr.node `Mathlib.Tactic.Abel.abelConv 1024 (Lean.ParserDescr.nonReservedSymbol "abel" false)
Instances For
The tactic abel
evaluates expressions in abelian groups.
This is the conv tactic version, which rewrites a target which is an abel equality to True
.
See also the abel
tactic.
Equations
- Mathlib.Tactic.Abel.convAbel! = Lean.ParserDescr.node `Mathlib.Tactic.Abel.convAbel! 1024 (Lean.ParserDescr.nonReservedSymbol "abel!" false)