perf: mark ReaderT context argument as borrow (#12942)
This PR marks the context argument of `ReaderT` as borrowed, causing a wide spread of useful borrow annotations throughout the entire meta stack which reduces RC pressure. This introduces a crucial new behavior: When modifying `ReaderT` context, e.g. through `withReader` this will almost always cause an allocation. Given that the `ReaderT` context is frequently used in a non-linear fashion anyways we think this is an acceptable behavior.
This commit is contained in:
parent
482d7a11f2
commit
33e63bb6c3
32 changed files with 179 additions and 147 deletions
|
|
@ -4082,7 +4082,7 @@ Actions in the resulting monad are functions that take the local value as a para
|
|||
ordinary actions in `m`.
|
||||
-/
|
||||
def ReaderT (ρ : Type u) (m : Type u → Type v) (α : Type u) : Type (max u v) :=
|
||||
ρ → m α
|
||||
(a : @&ρ) → m α
|
||||
|
||||
/--
|
||||
Interpret `ρ → m α` as an element of `ReaderT ρ m α`.
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public section
|
|||
|
||||
namespace Lean.IR
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_add_extern]
|
||||
def addExtern (declName : Name) (externAttrData : ExternAttrData) : CoreM Unit := do
|
||||
if !isPrivateName declName then
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ def getUnfoldFor? (declName : Name) : MetaM (Option Name) := do
|
|||
else
|
||||
return none
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_get_structural_rec_arg_pos]
|
||||
def getStructuralRecArgPosImp? (declName : Name) : CoreM (Option Nat) := do
|
||||
let some info := eqnInfoExt.find? (← getEnv) declName | return none
|
||||
|
|
|
|||
|
|
@ -787,6 +787,7 @@ where
|
|||
throw ex
|
||||
|
||||
-- `evalSuggest` implementation
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_eval_suggest_tactic]
|
||||
private partial def evalSuggestImpl : TryTactic := fun tac => do
|
||||
trace[try.debug] "{tac}"
|
||||
|
|
|
|||
|
|
@ -1126,6 +1126,7 @@ def checkAssignment (mvarId : MVarId) (fvars : Array Expr) (v : Expr) : MetaM (O
|
|||
return none
|
||||
return some v
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
-- Implementation for `_root_.Lean.MVarId.checkedAssign`
|
||||
@[export lean_checked_assign]
|
||||
def checkedAssignImpl (mvarId : MVarId) (val : Expr) : MetaM Bool := do
|
||||
|
|
@ -2233,6 +2234,7 @@ private def whnfCoreAtDefEq (e : Expr) : MetaM Expr := do
|
|||
else
|
||||
whnfCore e
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_is_expr_def_eq]
|
||||
partial def isExprDefEqAuxImpl (t : Expr) (s : Expr) : MetaM Bool := withIncRecDepth do
|
||||
withTraceNodeBefore `Meta.isDefEq (fun _ => return m!"{t} =?= {s}") do
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ because it overrides unrelated configurations.
|
|||
else
|
||||
withConfig (fun cfg => { cfg with beta := true, iota := true, zeta := true, zetaHave := true, zetaDelta := true, proj := .yesWithDelta, etaStruct := .all }) x
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_infer_type]
|
||||
def inferTypeImp (e : Expr) : MetaM Expr :=
|
||||
let rec infer (e : Expr) : MetaM Expr := do
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ private def isMVarWithGreaterDepth (v : Level) (mvarId : LMVarId) : MetaM Bool :
|
|||
| Level.mvar mvarId' => return (← mvarId'.getLevel) > (← mvarId.getLevel)
|
||||
| _ => return false
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
mutual
|
||||
|
||||
private partial def solve (u v : Level) : MetaM LBool := do
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ Creates conditional equations and splitter for the given match auxiliary declara
|
|||
|
||||
See also `getEquationsFor`.
|
||||
-/
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_get_match_equations_for]
|
||||
def getEquationsForImpl (matchDeclName : Name) : MetaM MatchEqns := do
|
||||
/-
|
||||
|
|
@ -246,6 +247,7 @@ where go baseName splitterName := withConfig (fun c => { c with etaStruct := .no
|
|||
let result := { eqnNames, splitterName, splitterMatchInfo }
|
||||
registerMatchEqns matchDeclName result
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
/--
|
||||
Generate the congruence equations for the given match auxiliary declaration.
|
||||
The congruence equations have a completely unrestricted left-hand side (arbitrary discriminants),
|
||||
|
|
|
|||
|
|
@ -785,6 +785,7 @@ def isDefEqApp (tFn : Expr) (t : Expr) (s : Expr) (_ : tFn = t.getAppFn) : DefEq
|
|||
let numArgs := t.getAppNumArgs
|
||||
isDefEqAppWithInfo t s (numArgs - 1) info
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
/--
|
||||
`isDefEqMain` implementation.
|
||||
-/
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ abbrev cacheResult (e : Expr) (r : Result) : SimpM Result := do
|
|||
modify fun s => { s with persistentCache := s.persistentCache.insert { expr := e } r }
|
||||
return r
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_sym_simp]
|
||||
def simpImpl (e₁ : Expr) : SimpM Result := withIncRecDepth do
|
||||
let numSteps := (← get).numSteps
|
||||
|
|
|
|||
|
|
@ -944,6 +944,7 @@ def synthInstance (type : Expr) (maxResultSize? : Option Nat := none) : MetaM Ex
|
|||
| none => throwFailedToSynthesize type)
|
||||
(fun _ => throwFailedToSynthesize type)
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_synth_pending]
|
||||
private def synthPendingImp (mvarId : MVarId) : MetaM Bool := withIncRecDepth <| mvarId.withContext do
|
||||
let mvarDecl ← mvarId.getDecl
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ private def propagateNonlinearPow (x : Var) : GoalM Bool := do
|
|||
c'.assert
|
||||
return true
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_cutsat_propagate_nonlinear]
|
||||
def propagateNonlinearTermImpl (y : Var) (x : Var) : GoalM Bool := do
|
||||
unless (← isVarEqConst? y).isSome do return false
|
||||
|
|
@ -338,6 +339,7 @@ partial def _root_.Int.Linear.Poly.updateOccsForElimEq (p : Poly) (x : Var) : Go
|
|||
go p
|
||||
go p
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_grind_cutsat_assert_eq]
|
||||
def EqCnstr.assertImpl (c : EqCnstr) : GoalM Unit := do
|
||||
if (← inconsistent) then return ()
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ where
|
|||
return some { p := c.p.addConst 1, h := .ofLeDiseq c c' }
|
||||
return none
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_grind_cutsat_assert_le]
|
||||
def LeCnstr.assertImpl (c : LeCnstr) : GoalM Unit := do
|
||||
if (← inconsistent) then return ()
|
||||
|
|
|
|||
|
|
@ -325,7 +325,9 @@ private def mkPowEqProof (ka : Int) (ca? : Option EqCnstr) (kb : Nat) (cb? : Opt
|
|||
let h := mkApp8 (mkConst ``Int.Linear.pow_eq) a b (toExpr ka) (toExpr kbInt) (toExpr k) h₁ h₂ eagerReflBoolTrue
|
||||
return mkApp6 (mkConst ``Int.Linear.of_var_eq) (← getContext) (← mkVarDecl x) (toExpr k) (← mkPolyDecl c'.p) eagerReflBoolTrue h
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
mutual
|
||||
|
||||
@[export lean_cutsat_eq_cnstr_to_proof]
|
||||
private partial def EqCnstr.toExprProofImpl (c' : EqCnstr) : ProofM Expr := caching c' do
|
||||
trace[grind.debug.lia.proof] "{← c'.pp}"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ where
|
|||
registerNonlinearOcc e x
|
||||
| _ => registerNonlinearOcc e x
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_grind_cutsat_mk_var]
|
||||
def mkVarImpl (expr : Expr) : GoalM Var := do
|
||||
if let some var := (← get').varMap.find? { expr } then
|
||||
|
|
|
|||
|
|
@ -239,6 +239,7 @@ private def normOfNatArgs? (args : Array Expr) : MetaM (Option (Array Expr)) :=
|
|||
return some args.toArray
|
||||
return none
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_grind_canon]
|
||||
partial def canonImpl (e : Expr) : GoalM Expr := do profileitM Exception "grind canon" (← getOptions) do
|
||||
trace_goal[grind.debug.canon] "{e}"
|
||||
|
|
|
|||
|
|
@ -348,6 +348,7 @@ where
|
|||
internalize rhs generation p
|
||||
addEqCore lhs rhs proof isHEq
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_grind_process_new_facts]
|
||||
private def processNewFactsImpl : GoalM Unit := do
|
||||
repeat
|
||||
|
|
|
|||
|
|
@ -535,6 +535,7 @@ private def internalizeOfNatFinBitVecLiteral (e : Expr) (generation : Nat) (pare
|
|||
updateIndicesFound (.const ``OfNat.ofNat)
|
||||
activateTheorems ``OfNat.ofNat generation
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_grind_internalize]
|
||||
private partial def internalizeImpl (e : Expr) (generation : Nat) (parent? : Option Expr := none) : GoalM Unit := withIncRecDepth do
|
||||
if (← alreadyInternalized e) then
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ mutual
|
|||
|
||||
end
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
/--
|
||||
Returns a proof that `a = b`.
|
||||
It assumes `a` and `b` are in the same equivalence class.
|
||||
|
|
@ -338,6 +339,7 @@ def mkEqProofImpl (a b : Expr) : GoalM Expr := do
|
|||
throwError "internal `grind` error, `mkEqProof` invoked with terms of different types{indentExpr a}\nhas type{indentExpr (← inferType a)}\nbut{indentExpr b}\nhas type{indentExpr (← inferType b)}"
|
||||
mkEqProofCore a b (heq := false)
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_grind_mk_heq_proof]
|
||||
def mkHEqProofImpl (a b : Expr) : GoalM Expr :=
|
||||
mkEqProofCore a b (heq := true)
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ def dsimpCore (e : Expr) : GrindM Expr := do profileitM Exception "grind dsimp"
|
|||
modify fun s => { s with simp }
|
||||
return r
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
/--
|
||||
Preprocesses `e` using `grind` normalization theorems and simprocs,
|
||||
and then applies several other preprocessing steps.
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ protected def getSimpContext (config : Grind.Config) : MetaM Simp.Context := do
|
|||
(simpTheorems := #[thms])
|
||||
(congrTheorems := (← getSimpCongrTheorems))
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_grind_normalize]
|
||||
def normalizeImp (e : Expr) (config : Grind.Config) : MetaM Expr := do
|
||||
let (r, _) ← Meta.simp e (← Grind.getSimpContext config) (← Grind.getSimprocs)
|
||||
|
|
|
|||
|
|
@ -512,6 +512,7 @@ Auxiliary `dsimproc` for not visiting `Char` literal subterms.
|
|||
-/
|
||||
private def doNotVisitCharLit : DSimproc := doNotVisit isCharLit ``Char.ofNat
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_dsimp]
|
||||
private partial def dsimpImpl (e : Expr) : SimpM Expr := do
|
||||
let cfg ← getConfig
|
||||
|
|
@ -710,6 +711,7 @@ where
|
|||
r ← r.mkEqTrans (← simpLoop r.expr)
|
||||
cacheResult e cfg r
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_simp]
|
||||
def simpImpl (e : Expr) : SimpM Result := withIncRecDepth do
|
||||
checkSystem "simp"
|
||||
|
|
|
|||
|
|
@ -1100,6 +1100,7 @@ private def cache (useCache : Bool) (e r : Expr) : MetaM Expr := do
|
|||
modify fun s => { s with cache.whnf := s.cache.whnf.insert key r }
|
||||
return r
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_whnf]
|
||||
partial def whnfImp (e : Expr) : MetaM Expr :=
|
||||
withIncRecDepth <| whnfEasyCases e fun e => do
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ end Parser
|
|||
namespace PrettyPrinter
|
||||
namespace Parenthesizer
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
-- Close the mutual recursion loop; see corresponding `[extern]` in the parenthesizer.
|
||||
@[export lean_mk_antiquot_parenthesizer]
|
||||
def mkAntiquot.parenthesizer (name : String) (kind : SyntaxNodeKind) (anonymous := true) (isPseudoKind := true) : Parenthesizer :=
|
||||
|
|
@ -80,6 +81,7 @@ def mkAntiquot.parenthesizer (name : String) (kind : SyntaxNodeKind) (anonymous
|
|||
|
||||
open Lean.Parser
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_pretty_printer_parenthesizer_interpret_parser_descr]
|
||||
unsafe def interpretParserDescr : ParserDescr → CoreM Parenthesizer
|
||||
| ParserDescr.const n => getConstAlias parenthesizerAliasesRef n
|
||||
|
|
@ -101,6 +103,7 @@ end Parenthesizer
|
|||
|
||||
namespace Formatter
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_mk_antiquot_formatter]
|
||||
def mkAntiquot.formatter (name : String) (kind : SyntaxNodeKind) (anonymous := true) (isPseudoKind := true) : Formatter :=
|
||||
Parser.mkAntiquot.formatter name kind anonymous isPseudoKind
|
||||
|
|
@ -113,6 +116,7 @@ def mkAntiquot.formatter (name : String) (kind : SyntaxNodeKind) (anonymous := t
|
|||
|
||||
open Lean.Parser
|
||||
|
||||
set_option compiler.ignoreBorrowAnnotation true in
|
||||
@[export lean_pretty_printer_formatter_interpret_parser_descr]
|
||||
unsafe def interpretParserDescr : ParserDescr → CoreM Formatter
|
||||
| ParserDescr.const n => getConstAlias formatterAliasesRef n
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ options get_default_options() {
|
|||
opts = opts.update({"debug", "terminalTacticsAsSorry"}, false);
|
||||
// switch to `true` for ABI-breaking changes affecting meta code;
|
||||
// see also next option!
|
||||
opts = opts.update({"interpreter", "prefer_native"}, false);
|
||||
opts = opts.update({"interpreter", "prefer_native"}, true);
|
||||
// switch to `false` when enabling `prefer_native` should also affect use
|
||||
// of built-in parsers in quotations; this is usually the case, but setting
|
||||
// both to `true` may be necessary for handling non-builtin parsers with
|
||||
|
|
|
|||
|
|
@ -4028,7 +4028,7 @@ Actions in the resulting monad are functions that take the local value as a para
|
|||
ordinary actions in `m`.
|
||||
-/
|
||||
def ReaderT (ρ : Type u) (m : Type u → Type v) (α : Type u) : Type max u v :=
|
||||
ρ → m α
|
||||
(a : @&ρ) → m α
|
||||
|
||||
/--
|
||||
Interpret `ρ → m α` as an element of `ReaderT ρ m α`.
|
||||
|
|
|
|||
|
|
@ -71,98 +71,98 @@
|
|||
let _x.4 := Nat.decEq x _x.3;
|
||||
return _x.4
|
||||
[Compiler.simp] size: 12
|
||||
def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.4 := "f";
|
||||
let _x.5 := Lean.Name.mkStr1 _x.4;
|
||||
let _x.6 := 1;
|
||||
let _x.7 := @Array.mkEmpty _ _x.6;
|
||||
let _x.8 := @Array.push _ _x.7 _x.5;
|
||||
let _x.9 := PUnit.unit;
|
||||
fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17;
|
||||
cases _x.18 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.19 a.20 =>
|
||||
let _x.21 := @EST.Out.ok _ _ _ _x.9 a.20;
|
||||
return _x.21
|
||||
| EST.Out.error a.22 a.23 =>
|
||||
return _x.18;
|
||||
let _x.24 := @Lean.Elab.Command.liftTermElabM _ _f.10 a.1 a.2 a.3;
|
||||
return _x.24
|
||||
def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.2 := "f";
|
||||
let _x.3 := Lean.Name.mkStr1 _x.2;
|
||||
let _x.4 := 1;
|
||||
let _x.5 := @Array.mkEmpty _ _x.4;
|
||||
let _x.6 := @Array.push _ _x.5 _x.3;
|
||||
let _x.7 := PUnit.unit;
|
||||
fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15;
|
||||
cases _x.16 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.17 a.18 =>
|
||||
let _x.19 := @EST.Out.ok _ _ _ _x.7 a.18;
|
||||
return _x.19
|
||||
| EST.Out.error a.20 a.21 =>
|
||||
return _x.16;
|
||||
let _x.22 := @Lean.Elab.Command.liftTermElabM _ _f.8 a a a.1;
|
||||
return _x.22
|
||||
[Compiler.simp] size: 12
|
||||
def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.4 := "f";
|
||||
let _x.5 := Lean.Name.mkStr1 _x.4;
|
||||
let _x.6 := 1;
|
||||
let _x.7 := @Array.mkEmpty _ _x.6;
|
||||
let _x.8 := @Array.push _ _x.7 _x.5;
|
||||
let _x.9 := PUnit.unit;
|
||||
fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17;
|
||||
cases _x.18 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.19 a.20 =>
|
||||
let _x.21 := @EST.Out.ok _ _ _ _x.9 a.20;
|
||||
return _x.21
|
||||
| EST.Out.error a.22 a.23 =>
|
||||
return _x.18;
|
||||
let _x.24 := @Lean.Elab.Command.liftTermElabM _ _f.10 a.1 a.2 a.3;
|
||||
return _x.24
|
||||
def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.2 := "f";
|
||||
let _x.3 := Lean.Name.mkStr1 _x.2;
|
||||
let _x.4 := 1;
|
||||
let _x.5 := @Array.mkEmpty _ _x.4;
|
||||
let _x.6 := @Array.push _ _x.5 _x.3;
|
||||
let _x.7 := PUnit.unit;
|
||||
fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15;
|
||||
cases _x.16 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.17 a.18 =>
|
||||
let _x.19 := @EST.Out.ok _ _ _ _x.7 a.18;
|
||||
return _x.19
|
||||
| EST.Out.error a.20 a.21 =>
|
||||
return _x.16;
|
||||
let _x.22 := @Lean.Elab.Command.liftTermElabM _ _f.8 a a a.1;
|
||||
return _x.22
|
||||
[Compiler.simp] size: 12
|
||||
def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.4 := "f";
|
||||
let _x.5 := Lean.Name.mkStr1 _x.4;
|
||||
let _x.6 := 1;
|
||||
let _x.7 := @Array.mkEmpty _ _x.6;
|
||||
let _x.8 := @Array.push _ _x.7 _x.5;
|
||||
let _x.9 := PUnit.unit;
|
||||
fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17;
|
||||
cases _x.18 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.19 a.20 =>
|
||||
let _x.21 := @EST.Out.ok _ _ _ _x.9 a.20;
|
||||
return _x.21
|
||||
| EST.Out.error a.22 a.23 =>
|
||||
return _x.18;
|
||||
let _x.24 := @Lean.Elab.Command.liftTermElabM _ _f.10 a.1 a.2 a.3;
|
||||
return _x.24
|
||||
def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.2 := "f";
|
||||
let _x.3 := Lean.Name.mkStr1 _x.2;
|
||||
let _x.4 := 1;
|
||||
let _x.5 := @Array.mkEmpty _ _x.4;
|
||||
let _x.6 := @Array.push _ _x.5 _x.3;
|
||||
let _x.7 := PUnit.unit;
|
||||
fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15;
|
||||
cases _x.16 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.17 a.18 =>
|
||||
let _x.19 := @EST.Out.ok _ _ _ _x.7 a.18;
|
||||
return _x.19
|
||||
| EST.Out.error a.20 a.21 =>
|
||||
return _x.16;
|
||||
let _x.22 := @Lean.Elab.Command.liftTermElabM _ _f.8 a a a.1;
|
||||
return _x.22
|
||||
[Compiler.simp] size: 12
|
||||
def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.4 := "f";
|
||||
let _x.5 := Lean.Name.mkStr1 _x.4;
|
||||
let _x.6 := 1;
|
||||
let _x.7 := Array.mkEmpty ◾ _x.6;
|
||||
let _x.8 := Array.push ◾ _x.7 _x.5;
|
||||
let _x.9 := PUnit.unit;
|
||||
fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17;
|
||||
cases _x.18 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.19 a.20 =>
|
||||
let _x.21 := @EST.Out.ok ◾ ◾ ◾ _x.9 a.20;
|
||||
return _x.21
|
||||
| EST.Out.error a.22 a.23 =>
|
||||
return _x.18;
|
||||
let _x.24 := Lean.Elab.Command.liftTermElabM._redArg _f.10 a.1 a.2 a.3;
|
||||
return _x.24
|
||||
def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.2 := "f";
|
||||
let _x.3 := Lean.Name.mkStr1 _x.2;
|
||||
let _x.4 := 1;
|
||||
let _x.5 := Array.mkEmpty ◾ _x.4;
|
||||
let _x.6 := Array.push ◾ _x.5 _x.3;
|
||||
let _x.7 := PUnit.unit;
|
||||
fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15;
|
||||
cases _x.16 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.17 a.18 =>
|
||||
let _x.19 := @EST.Out.ok ◾ ◾ ◾ _x.7 a.18;
|
||||
return _x.19
|
||||
| EST.Out.error a.20 a.21 =>
|
||||
return _x.16;
|
||||
let _x.22 := Lean.Elab.Command.liftTermElabM._redArg _f.8 a a a.1;
|
||||
return _x.22
|
||||
[Compiler.simp] size: 12
|
||||
def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.4 := "f";
|
||||
let _x.5 := Lean.Name.mkStr1 _x.4;
|
||||
let _x.6 := 1;
|
||||
let _x.7 := Array.mkEmpty ◾ _x.6;
|
||||
let _x.8 := Array.push ◾ _x.7 _x.5;
|
||||
let _x.9 := PUnit.unit;
|
||||
fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17;
|
||||
cases _x.18 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.19 a.20 =>
|
||||
let _x.21 := @EST.Out.ok ◾ ◾ ◾ _x.9 a.20;
|
||||
return _x.21
|
||||
| EST.Out.error a.22 a.23 =>
|
||||
return _x.18;
|
||||
let _x.24 := Lean.Elab.Command.liftTermElabM._redArg _f.10 a.1 a.2 a.3;
|
||||
return _x.24
|
||||
def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.2 := "f";
|
||||
let _x.3 := Lean.Name.mkStr1 _x.2;
|
||||
let _x.4 := 1;
|
||||
let _x.5 := Array.mkEmpty ◾ _x.4;
|
||||
let _x.6 := Array.push ◾ _x.5 _x.3;
|
||||
let _x.7 := PUnit.unit;
|
||||
fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15;
|
||||
cases _x.16 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.17 a.18 =>
|
||||
let _x.19 := @EST.Out.ok ◾ ◾ ◾ _x.7 a.18;
|
||||
return _x.19
|
||||
| EST.Out.error a.20 a.21 =>
|
||||
return _x.16;
|
||||
let _x.22 := Lean.Elab.Command.liftTermElabM._redArg _f.8 a a a.1;
|
||||
return _x.22
|
||||
[Compiler.simp] size: 5
|
||||
def _private.elab.attachJp.0._eval._lam_0 _x.1 _x.2 _y.3 _y.4 _y.5 _y.6 _y.7 _y.8 _y.9 : EST.Out Lean.Exception
|
||||
lcAny PUnit :=
|
||||
def _private.elab.attachJp.0._eval._lam_0 _x.1 _x.2 _y.3 @&_y.4 @&_y.5 @&_y.6 @&_y.7 @&_y.8 _y.9 : EST.Out
|
||||
Lean.Exception lcAny PUnit :=
|
||||
let _x.10 := Lean.Compiler.compile _x.1 _y.7 _y.8 _y.9;
|
||||
cases _x.10 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.11 a.12 =>
|
||||
|
|
@ -171,13 +171,13 @@
|
|||
| EST.Out.error a.14 a.15 =>
|
||||
return _x.10
|
||||
[Compiler.simp] size: 8
|
||||
def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.4 := "f";
|
||||
let _x.5 := Lean.Name.mkStr1 _x.4;
|
||||
let _x.6 := 1;
|
||||
let _x.7 := Array.mkEmpty ◾ _x.6;
|
||||
let _x.8 := Array.push ◾ _x.7 _x.5;
|
||||
let _x.9 := PUnit.unit;
|
||||
let _f.10 := _eval._lam_0 _x.8 _x.9;
|
||||
let _x.11 := Lean.Elab.Command.liftTermElabM._redArg _f.10 a.1 a.2 a.3;
|
||||
return _x.11
|
||||
def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.2 := "f";
|
||||
let _x.3 := Lean.Name.mkStr1 _x.2;
|
||||
let _x.4 := 1;
|
||||
let _x.5 := Array.mkEmpty ◾ _x.4;
|
||||
let _x.6 := Array.push ◾ _x.5 _x.3;
|
||||
let _x.7 := PUnit.unit;
|
||||
let _f.8 := _eval._lam_0 _x.6 _x.7;
|
||||
let _x.9 := Lean.Elab.Command.liftTermElabM._redArg _f.8 a a a.1;
|
||||
return _x.9
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace List
|
|||
-- No code is generated for the match_on_same_ctor or match_on_same_ctor.het
|
||||
/--
|
||||
trace: [Compiler.saveMono] size: 5
|
||||
def _private.elab.casesOnSameCtor.0._eval._lam_0 _x.1 _x.2 _x.3 _y.4 _y.5 _y.6 _y.7 _y.8 _y.9 _y.10 : EST.Out
|
||||
def _private.elab.casesOnSameCtor.0._eval._lam_0 _x.1 _x.2 _x.3 _y.4 @&_y.5 @&_y.6 @&_y.7 @&_y.8 @&_y.9 _y.10 : EST.Out
|
||||
Exception lcAny PUnit :=
|
||||
let _x.11 := mkCasesOnSameCtor _x.1 _x.2 _y.6 _y.7 _y.8 _y.9 _y.10;
|
||||
cases _x.11 : EST.Out Exception lcAny PUnit
|
||||
|
|
@ -146,15 +146,15 @@ trace: [Compiler.saveMono] size: 5
|
|||
| EST.Out.error a.15 a.16 =>
|
||||
return _x.11
|
||||
[Compiler.saveMono] size: 7
|
||||
def _private.elab.casesOnSameCtor.0._eval a.1 a.2 a.3 : EST.Out Exception lcAny PUnit :=
|
||||
let _x.4 := "List";
|
||||
let _x.5 := "match_on_same_ctor";
|
||||
let _x.6 := Name.mkStr2 _x.4 _x.5;
|
||||
let _x.7 := Name.mkStr1 _x.4;
|
||||
let _x.8 := PUnit.unit;
|
||||
let _f.9 := _eval._lam_0 _x.6 _x.7 _x.8;
|
||||
let _x.10 := Lean.Elab.Command.liftTermElabM._redArg _f.9 a.1 a.2 a.3;
|
||||
return _x.10
|
||||
def _private.elab.casesOnSameCtor.0._eval @&a @&a a.1 : EST.Out Exception lcAny PUnit :=
|
||||
let _x.2 := "List";
|
||||
let _x.3 := "match_on_same_ctor";
|
||||
let _x.4 := Name.mkStr2 _x.2 _x.3;
|
||||
let _x.5 := Name.mkStr1 _x.2;
|
||||
let _x.6 := PUnit.unit;
|
||||
let _f.7 := _eval._lam_0 _x.4 _x.5 _x.6;
|
||||
let _x.8 := Lean.Elab.Command.liftTermElabM._redArg _f.7 a a a.1;
|
||||
return _x.8
|
||||
-/
|
||||
#guard_msgs in
|
||||
set_option trace.Compiler.saveMono true in
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ trace: [Compiler.saveMono] size: 0
|
|||
⊥
|
||||
---
|
||||
trace: [Compiler.saveMono] size: 5
|
||||
def _private.elab.emptyLcnf.0._eval._lam_0 _x.1 _x.2 _y.3 _y.4 _y.5 _y.6 _y.7 _y.8 _y.9 : EST.Out Lean.Exception
|
||||
lcAny PUnit :=
|
||||
def _private.elab.emptyLcnf.0._eval._lam_0 _x.1 _x.2 _y.3 @&_y.4 @&_y.5 @&_y.6 @&_y.7 @&_y.8 _y.9 : EST.Out
|
||||
Lean.Exception lcAny PUnit :=
|
||||
let _x.10 := Lean.Compiler.compile _x.1 _y.7 _y.8 _y.9;
|
||||
cases _x.10 : EST.Out Lean.Exception lcAny PUnit
|
||||
| EST.Out.ok a.11 a.12 =>
|
||||
|
|
@ -22,16 +22,16 @@ trace: [Compiler.saveMono] size: 5
|
|||
| EST.Out.error a.14 a.15 =>
|
||||
return _x.10
|
||||
[Compiler.saveMono] size: 8
|
||||
def _private.elab.emptyLcnf.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.4 := "f";
|
||||
let _x.5 := Lean.Name.mkStr1 _x.4;
|
||||
let _x.6 := 1;
|
||||
let _x.7 := Array.mkEmpty ◾ _x.6;
|
||||
let _x.8 := Array.push ◾ _x.7 _x.5;
|
||||
let _x.9 := PUnit.unit;
|
||||
let _f.10 := _eval._lam_0 _x.8 _x.9;
|
||||
let _x.11 := Lean.Elab.Command.liftTermElabM._redArg _f.10 a.1 a.2 a.3;
|
||||
return _x.11
|
||||
def _private.elab.emptyLcnf.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.2 := "f";
|
||||
let _x.3 := Lean.Name.mkStr1 _x.2;
|
||||
let _x.4 := 1;
|
||||
let _x.5 := Array.mkEmpty ◾ _x.4;
|
||||
let _x.6 := Array.push ◾ _x.5 _x.3;
|
||||
let _x.7 := PUnit.unit;
|
||||
let _f.8 := _eval._lam_0 _x.6 _x.7;
|
||||
let _x.9 := Lean.Elab.Command.liftTermElabM._redArg _f.8 a a a.1;
|
||||
return _x.9
|
||||
-/
|
||||
#guard_msgs in
|
||||
run_meta Lean.Compiler.compile #[``f]
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ trace: [Compiler.saveMono] size: 1
|
|||
---
|
||||
trace: [Compiler.saveMono] size: 5
|
||||
def _private.elab.erased.0._eval._lam_0 (_x.1 : Array
|
||||
Lean.Name) (_x.2 : PUnit) (_y.3 : Lean.Elab.Term.Context) (_y.4 : lcAny) (_y.5 : Lean.Meta.Context) (_y.6 : lcAny) (_y.7 : Lean.Core.Context) (_y.8 : lcAny) (_y.9 : lcVoid) : EST.Out
|
||||
Lean.Name) (_x.2 : PUnit) (_y.3 : Lean.Elab.Term.Context) (_y.4 : @&lcAny) (_y.5 : @&Lean.Meta.Context) (_y.6 : @&lcAny) (_y.7 : @&Lean.Core.Context) (_y.8 : @&lcAny) (_y.9 : lcVoid) : EST.Out
|
||||
Lean.Exception lcAny PUnit :=
|
||||
let _x.10 : EST.Out Lean.Exception lcAny PUnit := compile _x.1 _y.7 _y.8 _y.9;
|
||||
cases _x.10 : EST.Out Lean.Exception lcAny PUnit
|
||||
|
|
@ -37,21 +37,21 @@ trace: [Compiler.saveMono] size: 5
|
|||
| EST.Out.error (a.14 : Lean.Exception) (a.15 : lcVoid) =>
|
||||
return _x.10
|
||||
[Compiler.saveMono] size: 9
|
||||
def _private.elab.erased.0._eval (a.1 : Lean.Elab.Command.Context) (a.2 : lcAny) (a.3 : lcVoid) : EST.Out
|
||||
def _private.elab.erased.0._eval (a : @&Lean.Elab.Command.Context) (a : @&lcAny) (a.1 : lcVoid) : EST.Out
|
||||
Lean.Exception lcAny PUnit :=
|
||||
let _x.4 : String := "Erased";
|
||||
let _x.5 : String := "mk";
|
||||
let _x.6 : Lean.Name := Lean.Name.mkStr2 _x.4 _x.5;
|
||||
let _x.7 : Nat := 1;
|
||||
let _x.8 : Array Lean.Name := Array.mkEmpty ◾ _x.7;
|
||||
let _x.9 : Array Lean.Name := Array.push ◾ _x.8 _x.6;
|
||||
let _x.10 : PUnit := PUnit.unit;
|
||||
let _f.11 : Lean.Elab.Term.Context →
|
||||
let _x.2 : String := "Erased";
|
||||
let _x.3 : String := "mk";
|
||||
let _x.4 : Lean.Name := Lean.Name.mkStr2 _x.2 _x.3;
|
||||
let _x.5 : Nat := 1;
|
||||
let _x.6 : Array Lean.Name := Array.mkEmpty ◾ _x.5;
|
||||
let _x.7 : Array Lean.Name := Array.push ◾ _x.6 _x.4;
|
||||
let _x.8 : PUnit := PUnit.unit;
|
||||
let _f.9 : Lean.Elab.Term.Context →
|
||||
lcAny →
|
||||
Lean.Meta.Context →
|
||||
lcAny → Lean.Core.Context → lcAny → lcVoid → EST.Out Lean.Exception lcAny PUnit := _eval._lam_0 _x.9 _x.10;
|
||||
let _x.12 : EST.Out Lean.Exception lcAny PUnit := Lean.Elab.Command.liftTermElabM._redArg _f.11 a.1 a.2 a.3;
|
||||
return _x.12
|
||||
lcAny → Lean.Core.Context → lcAny → lcVoid → EST.Out Lean.Exception lcAny PUnit := _eval._lam_0 _x.7 _x.8;
|
||||
let _x.10 : EST.Out Lean.Exception lcAny PUnit := Lean.Elab.Command.liftTermElabM._redArg _f.9 a a a.1;
|
||||
return _x.10
|
||||
-/
|
||||
#guard_msgs in
|
||||
run_meta Lean.Compiler.compile #[``Erased.mk]
|
||||
|
|
|
|||
|
|
@ -20,20 +20,20 @@ trace: [Compiler.saveMono] size: 8
|
|||
return _x.8
|
||||
---
|
||||
trace: [Compiler.saveMono] size: 1
|
||||
def _private.elab.inlineApp.0._eval._lam_0 _x.1 _y.2 _y.3 _y.4 _y.5 _y.6 _y.7 _y.8 : EST.Out Lean.Exception lcAny
|
||||
PUnit :=
|
||||
def _private.elab.inlineApp.0._eval._lam_0 _x.1 _y.2 @&_y.3 @&_y.4 @&_y.5 @&_y.6 @&_y.7 _y.8 : EST.Out
|
||||
Lean.Exception lcAny PUnit :=
|
||||
let _x.9 := Lean.Compiler.compile _x.1 _y.6 _y.7 _y.8;
|
||||
return _x.9
|
||||
[Compiler.saveMono] size: 7
|
||||
def _private.elab.inlineApp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.4 := "h";
|
||||
let _x.5 := Lean.Name.mkStr1 _x.4;
|
||||
let _x.6 := 1;
|
||||
let _x.7 := Array.mkEmpty ◾ _x.6;
|
||||
let _x.8 := Array.push ◾ _x.7 _x.5;
|
||||
let _f.9 := _eval._lam_0 _x.8;
|
||||
let _x.10 := Lean.Elab.Command.liftTermElabM._redArg _f.9 a.1 a.2 a.3;
|
||||
return _x.10
|
||||
def _private.elab.inlineApp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit :=
|
||||
let _x.2 := "h";
|
||||
let _x.3 := Lean.Name.mkStr1 _x.2;
|
||||
let _x.4 := 1;
|
||||
let _x.5 := Array.mkEmpty ◾ _x.4;
|
||||
let _x.6 := Array.push ◾ _x.5 _x.3;
|
||||
let _f.7 := _eval._lam_0 _x.6;
|
||||
let _x.8 := Lean.Elab.Command.liftTermElabM._redArg _f.7 a a a.1;
|
||||
return _x.8
|
||||
-/
|
||||
#guard_msgs in
|
||||
set_option trace.Compiler.saveMono true in
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[Meta.debug] ----- tst2 -----
|
||||
[Meta.debug] #[a, b, motive, t, inl, inr]
|
||||
[Meta.debug] #[a, b, motive, intro, t]
|
||||
[Meta.debug] #[x, a._@._internal._hyg.0, a._@._internal._hyg.0, a._@._internal._hyg.0, a._@._internal._hyg.0, a._@._internal._hyg.0]
|
||||
[Meta.debug] #[x, a, a, a, a, a._@._internal._hyg.0]
|
||||
[Meta.debug] @False.elim.{0}
|
||||
(@GT.gt.{0} Nat instLTNat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))
|
||||
(@OfNat.ofNat.{0} Nat (nat_lit 5) (instOfNatNat (nat_lit 5))))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue