The areas / V01. The language of Mathlib
Mathlib.Lean.Meta.Simp
15 declarations. Mathlib docs · Source
Helper functions for using the simplifier.
[TODO] Needs documentation, cleanup, and possibly reunification of mkSimpContext' with core.
def Lean.PHashSet.toList E1 #
{α : Type u} → [inst : BEq α] → [inst_1 : Hashable α] → Lean.PHashSet α → List α
instance Lean.Meta.Simp.instToFormatSimpTheorems_mathlib E0 #
Std.ToFormat Lean.Meta.SimpTheorems
def Lean.Meta.Simp.Result.ofTrue E1 #
Lean.Meta.Simp.Result → Lean.MetaM (Option Lean.Expr)
Constructs a proof that the original expression is true
given a simp result which simplifies the target to True.
def Lean.Meta.Simp.getPropHyps E1 #
Lean.MetaM (Array Lean.FVarId)
Return all propositions in the local context.
def Lean.Meta.simpTheoremsOfNames E1 #
optParam (List Lean.Name) [] → optParam Bool false → Lean.MetaM Lean.Meta.SimpTheorems
Construct a SimpTheorems from a list of names.
def Lean.Meta.Simp.Context.ofNames E1 #
optParam (List Lean.Name) [] →
optParam Bool false → optParam Lean.Meta.Simp.Config { } → Lean.MetaM Lean.Meta.Simp.Context
Construct a Simp.Context from a list of names.
def Lean.Meta.Simp.Context.ofArgs E1 #
Lean.TSyntax `Lean.Parser.Tactic.simpArgs →
optParam Lean.Meta.Simp.Config { } → Lean.Elab.Tactic.TacticM Lean.Meta.Simp.Context
Construct a Simp.Context, following the same algorithm that would be done in a "simp" run:
look up all the simp-lemmas in the library, and adjust (add/erase) as specified by the provided
simpArgs list.
def Lean.Meta.simpOnlyNames E1 #
List Lean.Name → Lean.Expr → optParam Lean.Meta.Simp.Config { } → Lean.MetaM Lean.Meta.Simp.Result
Simplify an expression using only a list of lemmas specified by name.
def Lean.Meta.simpType E1 #
(Lean.Expr → Lean.MetaM Lean.Meta.Simp.Result) → Lean.Expr → optParam (Option Lean.Expr) none → Lean.MetaM Lean.Expr
Given a simplifier S : Expr → MetaM Simp.Result,
and an expression e : Expr, run S on the type of e, and then
convert e into that simplified type,
using a combination of type hints as well as casting if the proof is not definitional Eq.mp.
The optional argument type?, if present, must be definitionally equal to the type of e.
When it is specified we simplify this type rather than the inferred type of e.
def Lean.Meta.simpEq E1 #
(Lean.Expr → Lean.MetaM Lean.Meta.Simp.Result) → Lean.Expr → Lean.Expr → Lean.MetaM (Lean.Expr × Lean.Expr)
Independently simplify both the left-hand side and the right-hand side of an equality. The equality is allowed to be under binders. Returns the simplified equality and a proof of it.
def Lean.Meta.SimpTheorems.contains E1 #
Lean.Meta.SimpTheorems → Lean.Name → Bool
Checks whether declName is in SimpTheorems as either a lemma or definition to unfold.
def Lean.Meta.isInSimpSet E1 #
Lean.Name → Lean.Name → Lean.CoreM Bool
Tests whether decl has simp-attribute simpAttr. Returns false is simpAttr is not a
valid simp-attribute.
def Lean.Meta.getAllSimpDecls E1 #
Lean.Name → Lean.CoreM (List Lean.Name)
Returns all declarations with the simp-attribute simpAttr.
Note: this also returns many auxiliary declarations.
def Lean.Meta.getAllSimpAttrs E1 #
Lean.Name → Lean.CoreM (Array Lean.Name)
Gets all simp-attributes given to declaration decl.
def Lean.Meta.Simp.withoutTheorems E1 #
{α : Type} → Array Lean.Name → Lean.Meta.SimpM α → Lean.Meta.SimpM α
Run e while the entries in declNames are erased from the simp set, while preserving the
rest of the simp configuration.
Performance note: the code in e will be run with a new cache (which is discarded at the end of the
function). The original cache is restored when this function returns.