Documentation

Lean.Elab.Command

structure Lean.Elab.Command.Scope :
Type
Equations
  • Lean.Elab.Command.instInhabitedScope = { default := { header := default, opts := default, currNamespace := default, openDecls := default, levelNames := default, varDecls := default, varUIds := default, isNoncomputable := default } }
structure Lean.Elab.Command.State :
Type
Equations
  • Lean.Elab.Command.instInhabitedState = { default := { env := default, messages := default, scopes := default, nextMacroScope := default, maxRecDepth := default, nextInstIdx := default, ngen := default, infoState := default, traceState := default } }
structure Lean.Elab.Command.Context :
Type
Equations
Equations
  • Lean.Elab.Command.instMonadInfoTreeCommandElabM = { getInfoState := do let a ← get pure a.infoState, modifyInfoState := fun f => modify fun s => { env := s.env, messages := s.messages, scopes := s.scopes, nextMacroScope := s.nextMacroScope, maxRecDepth := s.maxRecDepth, nextInstIdx := s.nextInstIdx, ngen := s.ngen, infoState := f s.infoState, traceState := s.traceState } }
Equations
  • Lean.Elab.Command.instMonadEnvCommandElabM = { getEnv := do let a ← get pure a.env, modifyEnv := fun f => modify fun s => { env := f s.env, messages := s.messages, scopes := s.scopes, nextMacroScope := s.nextMacroScope, maxRecDepth := s.maxRecDepth, nextInstIdx := s.nextInstIdx, ngen := s.ngen, infoState := s.infoState, traceState := s.traceState } }
Equations
Equations
  • Lean.Elab.Command.instMonadTraceCommandElabM = { modifyTraceState := fun f => modify fun s => { env := s.env, messages := s.messages, scopes := s.scopes, nextMacroScope := s.nextMacroScope, maxRecDepth := s.maxRecDepth, nextInstIdx := s.nextInstIdx, ngen := s.ngen, infoState := s.infoState, traceState := f s.traceState }, getTraceState := do let a ← get pure a.traceState }
Equations
Equations
@[inline]
Equations
Equations
  • Lean.Elab.Command.instMonadLogCommandElabM = Lean.Elab.MonadLog.mk Lean.getRef (do let a ← read pure a.fileName) fun msg => do let currNamespace ← Lean.getCurrNamespace let openDecls ← Lean.getOpenDecls let msg : Lean.Message := { fileName := msg.fileName, pos := msg.pos, endPos := msg.endPos, severity := msg.severity, caption := msg.caption, data := Lean.MessageData.withNamingContext { currNamespace := currNamespace, openDecls := openDecls } msg.data } modify fun s => { env := s.env, messages := Lean.MessageLog.add msg s.messages, scopes := s.scopes, nextMacroScope := s.nextMacroScope, maxRecDepth := s.maxRecDepth, nextInstIdx := s.nextInstIdx, ngen := s.ngen, infoState := s.infoState, traceState := s.traceState }
Equations
Equations
  • Lean.Elab.Command.withFreshMacroScope x = do let fresh ← modifyGet fun st => (st.nextMacroScope, { env := st.env, messages := st.messages, scopes := st.scopes, nextMacroScope := st.nextMacroScope + 1, maxRecDepth := st.maxRecDepth, nextInstIdx := st.nextInstIdx, ngen := st.ngen, infoState := st.infoState, traceState := st.traceState }) withReader (fun ctx => { fileName := ctx.fileName, fileMap := ctx.fileMap, currRecDepth := ctx.currRecDepth, cmdPos := ctx.cmdPos, macroStack := ctx.macroStack, currMacroScope := fresh, ref := ctx.ref }) x
Equations
@[implementedBy Lean.Elab.Command.mkCommandElabAttributeUnsafe]
Equations
  • Lean.Elab.Command.withMacroExpansion beforeStx afterStx x = withReader (fun ctx => { fileName := ctx.fileName, fileMap := ctx.fileMap, currRecDepth := ctx.currRecDepth, cmdPos := ctx.cmdPos, macroStack := { before := beforeStx, after := afterStx } :: ctx.macroStack, currMacroScope := ctx.currMacroScope, ref := ctx.ref }) x
Equations
  • Lean.Elab.Command.instMonadMacroAdapterCommandElabM = { getCurrMacroScope := Lean.getCurrMacroScope, getNextMacroScope := do let a ← get pure a.nextMacroScope, setNextMacroScope := fun next => modify fun s => { env := s.env, messages := s.messages, scopes := s.scopes, nextMacroScope := next, maxRecDepth := s.maxRecDepth, nextInstIdx := s.nextInstIdx, ngen := s.ngen, infoState := s.infoState, traceState := s.traceState } }
Equations
  • Lean.Elab.Command.instMonadRecDepthCommandElabM = { withRecDepth := fun {α} d x => withReader (fun ctx => { fileName := ctx.fileName, fileMap := ctx.fileMap, currRecDepth := d, cmdPos := ctx.cmdPos, macroStack := ctx.macroStack, currMacroScope := ctx.currMacroScope, ref := ctx.ref }) x, getRecDepth := do let a ← read pure a.currRecDepth, getMaxRecDepth := do let a ← get pure a.maxRecDepth }
Equations
Equations
  • Lean.Elab.Command.instInhabitedCommandElabM = { default := throw default }
Equations
Equations
@[inline]
Equations
Equations
  • Lean.Elab.Command.modifyScope f = modify fun s => { env := s.env, messages := s.messages, scopes := match s.scopes with | h :: t => f h :: t | [] => panicWithPosWithDecl "Lean.Elab.Command" "Lean.Elab.Command.modifyScope" 411 16 "unreachable code has been reached", nextMacroScope := s.nextMacroScope, maxRecDepth := s.maxRecDepth, nextInstIdx := s.nextInstIdx, ngen := s.ngen, infoState := s.infoState, traceState := s.traceState }
Equations
  • Lean.Elab.Command.withScope f x = do let a ← get match a.scopes with | [] => x | h :: t => tryFinally (do modify fun s => { env := s.env, messages := s.messages, scopes := f h :: t, nextMacroScope := s.nextMacroScope, maxRecDepth := s.maxRecDepth, nextInstIdx := s.nextInstIdx, ngen := s.ngen, infoState := s.infoState, traceState := s.traceState } x) (modify fun s => { env := s.env, messages := s.messages, scopes := h :: t, nextMacroScope := s.nextMacroScope, maxRecDepth := s.maxRecDepth, nextInstIdx := s.nextInstIdx, ngen := s.ngen, infoState := s.infoState, traceState := s.traceState })
Equations
Equations