The result of simplifying some expression e.
- expr : Lean.Expr
The simplified version of
e A proof that
$e = $expr, where the simplified expression is on the RHS. Ifnone, the proof is assumed to berefl.- dischargeDepth : UInt32
Save the field
dischargeDepthatSimp.Contextbecause it impacts the simplifier result. - cache : Bool
If
cache := truethe result is cached.
Instances For
Equations
- Lean.Meta.Simp.instInhabitedResult = { default := { expr := default, proof? := default, dischargeDepth := default, cache := default } }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Meta.Simp.Result.mkEqTrans r₁ r₂ = Lean.Meta.Simp.mkEqTransOptProofResult r₁.proof? r₁.cache r₂
Instances For
Flip the proof in a Simp.Result.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Instances For
- config : Lean.Meta.Simp.Config
- maxDischargeDepth : UInt32
maxDischargeDepthfromconfigas anUInt32. - simpTheorems : Lean.Meta.SimpTheoremsArray
- congrTheorems : Lean.Meta.SimpCongrTheorems
Stores the "parent" term for the term being simplified. If a simplification procedure result depends on this value, then it is its reponsability to set
Result.cache := false.Motivation for this field: Suppose we have a simplication procedure for normalizing arithmetic terms. Then, given a term such as
t_1 + ... + t_n, we don't want to apply the procedure to every subtermt_1 + ... + t_ifori < nfor performance issues. The procedure can accomplish this by checking whether the parent term is also an arithmetical expression and do nothing if it is. However, it should setResult.cache := falseto ensure we don't miss simplification opportunities. For example, consider the following:example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by simp_arith only ...If we don't set
Result.cache := falsefor the firstx + x, then we get the resulting state:... |- id (2*x + y) = id (x + x)instead of
... |- id (2*x + y) = id (2*x)as expected.
Remark: given an application
f a b cthe "parent" term forf,a,b, andcisf a b c.- dischargeDepth : UInt32
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Meta.Simp.Context.isDeclToUnfold ctx declName = Lean.Meta.SimpTheoremsArray.isDeclToUnfold ctx.simpTheorems declName
Instances For
Instances For
- cache : Lean.Meta.Simp.Cache
- congrCache : Lean.Meta.Simp.CongrCache
- usedTheorems : Lean.Meta.Simp.UsedSimps
- numSteps : Nat
Instances For
Equations
Instances For
Result type for a simplification procedure. We have pre and post simplication procedures.
- done: Lean.Meta.Simp.Result → Lean.Meta.Simp.Step
- visit: Lean.Meta.Simp.Result → Lean.Meta.Simp.Step
- continue: optParam (Option Lean.Meta.Simp.Result) none → Lean.Meta.Simp.Step
Instances For
Equations
- Lean.Meta.Simp.instInhabitedStep = { default := Lean.Meta.Simp.Step.done default }
Equations
- One or more equations did not get rendered due to their size.
Instances For
"Compose" the two given simplification procedures. We use the following semantics.
- If
fproducesdoneorvisit, then returnf's result. - If
fproducescontinue, then applygto new expression returned byf.
See Simp.Step type.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Meta.Simp.instAndThenSimproc = { andThen := fun (s₁ : Lean.Meta.Simp.Simproc) (s₂ : Unit → Lean.Meta.Simp.Simproc) => Lean.Meta.Simp.andThen s₁ (s₂ ()) }
Equations
- Lean.Meta.Simp.instInhabitedSimprocOLeanEntry = { default := { declName := default, post := default, keys := default } }
Simproc entry. It is the .olean entry plus the actual function.
- declName : Lake.Name
- post : Bool
- keys : Array Lean.Meta.SimpTheoremKey
- proc : Lean.Meta.Simp.Simproc
Recall that we cannot store
Simprocinto .olean files because it is a closure. GivenSimprocOLeanEntry.declName, we convert it into aSimprocby using the unsafe functionevalConstCheck.
Instances For
Instances For
- post : Lean.Meta.Simp.SimprocTree
- simprocNames : Lean.PHashSet Lake.Name
- erased : Lean.PHashSet Lake.Name
Instances For
Equations
- Lean.Meta.Simp.instInhabitedSimprocs = { default := { pre := default, post := default, simprocNames := default, erased := default } }
- pre : Lean.Meta.Simp.Simproc
- post : Lean.Meta.Simp.Simproc
- discharge? : Lean.Expr → Lean.Meta.SimpM (Option Lean.Expr)
Instances For
Equations
- Lean.Meta.Simp.instInhabitedMethods = { default := { pre := default, post := default, discharge? := default } }
Equations
Instances For
Equations
Instances For
Equations
- Lean.Meta.Simp.getMethods = do let __do_lift ← read pure (Lean.Meta.Simp.MethodsRef.toMethods __do_lift)
Instances For
Equations
- Lean.Meta.Simp.pre e = do let __do_lift ← Lean.Meta.Simp.getMethods __do_lift.pre e
Instances For
Equations
- Lean.Meta.Simp.post e = do let __do_lift ← Lean.Meta.Simp.getMethods __do_lift.post e
Instances For
Equations
- Lean.Meta.Simp.discharge? e = do let __do_lift ← Lean.Meta.Simp.getMethods __do_lift.discharge? e
Instances For
Instances For
Equations
- Lean.Meta.Simp.getConfig = do let __do_lift ← Lean.Meta.Simp.getContext pure __do_lift.config
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Meta.Simp.getSimpTheorems = do let __do_lift ← readThe Lean.Meta.Simp.Context pure __do_lift.simpTheorems
Instances For
Equations
- Lean.Meta.Simp.getSimpCongrTheorems = do let __do_lift ← readThe Lean.Meta.Simp.Context pure __do_lift.congrTheorems
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Meta.Simp.Result.getProof r = match r.proof? with | some p => pure p | none => Lean.Meta.mkEqRefl r.expr
Instances For
Similar to Result.getProof, but adds a mkExpectedTypeHint if proof? is none
(i.e., result is definitionally equal to input), but we cannot establish that
source and r.expr are definitionally when using TransparencyMode.reducible.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct the Expr cast h e, from a Simp.Result with proof h.
Equations
- Lean.Meta.Simp.Result.mkCast r e = do let __do_lift ← Lean.Meta.Simp.Result.getProof r Lean.Meta.mkAppM `cast #[__do_lift, e]
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Meta.Simp.removeUnnecessaryCasts.isDummyEqRec e = ((Lean.Expr.isAppOfArity e `Eq.rec 6 || Lean.Expr.isAppOfArity e `Eq.ndrec 6) && Lean.Expr.isAppOf (Lean.Expr.appArg! e) `Eq.refl)
Instances For
Given a simplified function result r and arguments args, simplify arguments using simp and dsimp.
The resulting proof is built using congr and congrFun theorems.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Try to use automatically generated congruence theorems. See mkCongrSimp?.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return a WHNF configuration for retrieving [simp] from the discrimination tree.
If user has disabled zeta and/or beta reduction in the simplifier, or enabled zetaDelta,
we must also disable/enable them when retrieving lemmas from discrimination tree. See issues: #2669 and #2281
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Auxiliary method.
Given the current target of mvarId, apply r which is a new target and proof that it is equal to the current one.
Equations
- One or more equations did not get rendered due to their size.