Equations
- Lean.Core.getMaxHeartbeats opts = Lean.Option.get opts Lean.maxHeartbeats * 1000
Instances For
Equations
Instances For
Cache for the CoreM
monad
- instLevelType : Lean.Core.InstantiateLevelCache
- instLevelValue : Lean.Core.InstantiateLevelCache
Instances For
Equations
- Lean.Core.instInhabitedCache = { default := { instLevelType := default, instLevelValue := default } }
State for the CoreM monad.
- env : Lean.Environment
Current environment.
- nextMacroScope : Lean.MacroScope
Next macro scope. We use macro scopes to avoid accidental name capture.
- ngen : Lean.NameGenerator
Name generator for producing unique
FVarId
s,MVarId
s, andLMVarId
s - traceState : Lean.TraceState
Trace messages
- cache : Lean.Core.Cache
Cache for instantiating universe polymorphic declarations.
- messages : Lean.MessageLog
Message log.
- infoState : Lean.Elab.InfoState
Info tree. We have the info tree here because we want to update it while adding attributes.
Instances For
Equations
Context for the CoreM monad.
- fileName : String
Name of the file being compiled.
- fileMap : Lean.FileMap
Auxiliary datastructure for converting
String.Pos
into Line/Column number. - options : Lean.Options
- currRecDepth : Nat
- maxRecDepth : Nat
- ref : Lean.Syntax
- currNamespace : Lake.Name
- openDecls : List Lean.OpenDecl
- initHeartbeats : Nat
- maxHeartbeats : Nat
- currMacroScope : Lean.MacroScope
- catchRuntimeEx : Bool
If
catchRuntimeEx = false
, then giventry x catch ex => h ex
, an runtime exception occurring inx
is not handled byh
. Recall that runtime exceptions aremaxRecDepth
ormaxHeartbeats
. - diag : Bool
Instances For
Equations
CoreM is a monad for manipulating the Lean environment.
It is the base monad for MetaM
.
The main features it provides are:
- name generator state
- environment state
- Lean options context
- the current open namespace
Equations
Instances For
Equations
- Lean.Core.instMonadCoreM = let i := inferInstanceAs (Monad Lean.CoreM); Monad.mk
Equations
- Lean.Core.instInhabitedCoreM = { default := fun (x : Lean.Core.Context) (x : ST.Ref IO.RealWorld Lean.Core.State) => throw default }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Core.instMonadOptionsCoreM = { getOptions := do let __do_lift ← read pure __do_lift.options }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Core.instAddMessageContextCoreM = { addMessageContext := Lean.addMessageContextPartial }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
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.
Equations
- One or more equations did not get rendered due to their size.
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
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Core.liftIOCore x = do let ref ← Lean.getRef liftM (IO.toEIO (fun (err : IO.Error) => Lean.Exception.error ref ((Lean.MessageData.ofFormat ∘ Std.format) (toString err))) x)
Instances For
Equations
- Lean.Core.instMonadLiftIOCoreM = { monadLift := fun {α : Type} => Lean.Core.liftIOCore }
Equations
- One or more equations did not get rendered due to their size.
Restore backtrackable parts of the state.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Restores full state including sources for unique identifiers. Only intended for incremental reuse between elaboration runs, not for backtracking within a single run.
Equations
Instances For
Equations
Instances For
Equations
- x.run ctx s = (x ctx).run s
Instances For
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.
Equations
- Lean.Core.withIncRecDepth x = controlAt Lean.CoreM fun (runInBase : {β : Type} → m β → Lean.CoreM (stM Lean.CoreM m β)) => Lean.withIncRecDepth (runInBase x)
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.Core.checkMaxHeartbeats moduleName = do let __do_lift ← read Lean.Core.checkMaxHeartbeatsCore moduleName `maxHeartbeats __do_lift.maxHeartbeats
Instances For
Equations
- Lean.checkSystem moduleName = do Lean.Core.checkInterrupted Lean.Core.checkMaxHeartbeats moduleName
Instances For
Equations
- Lean.withCurrHeartbeats x = controlAt Lean.CoreM fun (runInBase : {β : Type} → m β → Lean.CoreM (stM Lean.CoreM m β)) => Lean.Core.withCurrHeartbeatsImp (runInBase x)
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.Core.getMessageLog = do let __do_lift ← get pure __do_lift.messages
Instances For
Returns the current log and then resets its messages but does NOT reset MessageLog.hadErrors
. Used
for incremental reporting during elaboration of a single command.
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.
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
Return true if ex
was generated by throwMaxHeartbeat
.
This function is a bit hackish. The heartbeat exception should probably be an internal exception.
We used a similar hack at Exception.isMaxRecDepth
Equations
- ex.isMaxHeartbeat = match ex with | Lean.Exception.error ref (Lean.MessageData.ofFormat (Std.Format.text msg)) => "(deterministic) timeout".isPrefixOf msg | x => false
Instances For
Creates the expression d → b
Equations
- Lean.mkArrow d b = do let __do_lift ← Lean.mkFreshUserName `x pure (Lean.mkForall __do_lift Lean.BinderInfo.default d b)
Instances For
Iterated mkArrow
, creates the expression a₁ → a₂ → … → aₙ → b
. Also see arrowDomainsN
.
Equations
- Lean.mkArrowN ds e = Array.foldrM Lean.mkArrow e ds ds.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.addAndCompile decl = do Lean.addDecl decl Lean.compileDecl decl
Instances For
Equations
- Lean.getDiag opts = Lean.Option.get opts Lean.diagnostics
Instances For
Return true
if diagnostic information collection is enabled.
Equations
- Lean.isDiagnosticsEnabled = do let __do_lift ← read pure __do_lift.diag
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return true
if the exception was generated by one our resource limits.
Instances For
Custom try-catch
for all monads based on CoreM
. We don't want to catch "runtime exceptions"
in these monads, but on CommandElabM
. See issues #2775 and #2744 as well as MonadAlwayExcept
.
Equations
- Lean.Core.tryCatch x h = tryCatch x fun (ex : Lean.Exception) => do let __do_lift ← read if (ex.isRuntime && !__do_lift.catchRuntimeEx) = true then throw ex else h ex
Instances For
Equations
- Lean.instMonadExceptOfExceptionCoreM = { throw := fun {α : Type} => throw, tryCatch := fun {α : Type} => Lean.Core.tryCatch }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.mapCoreM f x = controlAt Lean.CoreM fun (runInBase : {β : Type} → m β → Lean.CoreM (stM Lean.CoreM m β)) => f (runInBase x)
Instances For
Execute x
with catchRuntimeEx = flag
. That is, given try x catch ex => h ex
,
if x
throws a runtime exception, the handler h
will be invoked if flag = true
Recall that
Equations
- Lean.withCatchingRuntimeEx x = Lean.mapCoreM (fun {α : Type} => Lean.Core.withCatchingRuntimeEx true) x
Instances For
Equations
- Lean.withoutCatchingRuntimeEx x = Lean.mapCoreM (fun {α : Type} => Lean.Core.withCatchingRuntimeEx false) x