Tactic for evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
Equations
- One or more equations did not get rendered due to their size.
Instances For
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
- c.app n inst = Lean.mkAppN (((Lean.Expr.const n [c.univ]).app c.α).app 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
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 (p.str s) = p.str (s ++ "g")
- Mathlib.Tactic.Abel.addG x✝ = x✝
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
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
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 (e : Lean.Expr) : NormalExpr
- nterm (e : Lean.Expr) (n : Lean.Expr × ℤ) (x : ℕ × Lean.Expr) (a : NormalExpr) : NormalExpr
Instances For
Extract the expression from a normal form.
Equations
- (Mathlib.Tactic.Abel.NormalExpr.zero e).e = e
- (Mathlib.Tactic.Abel.NormalExpr.nterm e n x_1 a).e = 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 a.e 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
smulin a monoid just simplifies the pieces usingsubst_into_smul - Using
smulgin a group just simplifies the pieces usingsubst_into_smulg - Using
smul a bin a group requires convertingafrom a nat to an int and then simplifyingsmulg ↑a busingsubst_into_smul_upcast - Using
smulgin a monoid is impossible (or at least out of scope), because you need a group argument to write asmulgterm
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 evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tactic for evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
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
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 fromabelNFCoreand false when called byevalAtomin recursive mode.parent: The input expression to simplify. Inprewe make use of bothparentandeto determine if we are at the top level in order to prevent a loopgo -> eval -> evalAtom -> gowhich 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
Tactic for evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tactic for evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tactic for evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
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
Tactic for evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tactic for evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
Equations
- Mathlib.Tactic.Abel.tacticAbel! = Lean.ParserDescr.node `Mathlib.Tactic.Abel.tacticAbel! 1024 (Lean.ParserDescr.nonReservedSymbol "abel!" false)
Instances For
Tactic for evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
Equations
- Mathlib.Tactic.Abel.abelConv = Lean.ParserDescr.node `Mathlib.Tactic.Abel.abelConv 1024 (Lean.ParserDescr.nonReservedSymbol "abel" false)
Instances For
Tactic for evaluating equations in the language of additive, commutative monoids and groups.
abel and its variants work as both tactics and conv tactics.
abel1fails if the target is not an equality that is provable by the axioms of commutative monoids/groups.abel_nfrewrites all group expressions into a normal form.- In tactic mode,
abel_nf at hcan be used to rewrite in a hypothesis. abel_nf (config := cfg)allows for additional configuration:
- In tactic mode,
abel!,abel1!,abel_nf!will use a more aggressive reducibility setting to identify atoms.
For example:
example [AddCommMonoid α] (a b : α) : a + (b + a) = a + a + b := by abel
example [AddCommGroup α] (a : α) : (3 : ℤ) • a = a + (2 : ℤ) • a := by abel
Future work #
- In mathlib 3,
abelaccepted additional optional arguments:
It is undecided whether these features should be restored eventually.syntax "abel" (&" raw" <|> &" term")? (location)? : tactic
Equations
- Mathlib.Tactic.Abel.convAbel! = Lean.ParserDescr.node `Mathlib.Tactic.Abel.convAbel! 1024 (Lean.ParserDescr.nonReservedSymbol "abel!" false)
Instances For
We register abel with the hint tactic.