Documentation

Lean.Elab.Term

structure Lean.Elab.Term.Context :
Type
structure Lean.Elab.Term.SavedContext :
Type
Equations
Equations
Equations
structure Lean.Elab.Term.LetRecToLift :
Type
Equations
  • Lean.Elab.Term.instInhabitedState = { default := { levelNames := default, syntheticMVars := default, mvarErrorInfos := default, messages := default, letRecsToLift := default, infoState := default } }
Equations
  • Lean.Elab.Term.instInhabitedTermElabM = { default := throw default }
Equations
Equations
Equations
  • Lean.Elab.Term.instInhabitedTermElabResult = { default := EStateM.Result.ok default default }
Equations
  • Lean.Elab.Term.setMessageLog messages = modify fun s => { levelNames := s.levelNames, syntheticMVars := s.syntheticMVars, mvarErrorInfos := s.mvarErrorInfos, messages := messages, letRecsToLift := s.letRecsToLift, infoState := s.infoState }
Equations
Equations
Equations
Equations
Equations
  • Lean.Elab.Term.withFreshMacroScope x = do let fresh ← modifyGetThe Lean.Core.State fun st => (st.nextMacroScope, { env := st.env, nextMacroScope := st.nextMacroScope + 1, ngen := st.ngen, traceState := st.traceState }) withReader (fun ctx => { fileName := ctx.fileName, fileMap := ctx.fileMap, declName? := ctx.declName?, macroStack := ctx.macroStack, currMacroScope := fresh, mayPostpone := ctx.mayPostpone, errToSorry := ctx.errToSorry, autoBoundImplicit := ctx.autoBoundImplicit, autoBoundImplicits := ctx.autoBoundImplicits, sectionVars := ctx.sectionVars, sectionFVars := ctx.sectionFVars, implicitLambda := ctx.implicitLambda, isNoncomputableSection := ctx.isNoncomputableSection, ignoreTCFailures := ctx.ignoreTCFailures }) x
Equations
  • Lean.Elab.Term.instMonadInfoTreeTermElabM = { getInfoState := do let a ← get pure a.infoState, modifyInfoState := fun f => modify fun s => { levelNames := s.levelNames, syntheticMVars := s.syntheticMVars, mvarErrorInfos := s.mvarErrorInfos, messages := s.messages, letRecsToLift := s.letRecsToLift, infoState := f s.infoState } }
Equations
Equations
@[implementedBy Lean.Elab.Term.mkTermElabAttributeUnsafe]
Equations
Equations
  • Lean.Elab.Term.withDeclName name x = withReader (fun ctx => { fileName := ctx.fileName, fileMap := ctx.fileMap, declName? := some name, macroStack := ctx.macroStack, currMacroScope := ctx.currMacroScope, mayPostpone := ctx.mayPostpone, errToSorry := ctx.errToSorry, autoBoundImplicit := ctx.autoBoundImplicit, autoBoundImplicits := ctx.autoBoundImplicits, sectionVars := ctx.sectionVars, sectionFVars := ctx.sectionFVars, implicitLambda := ctx.implicitLambda, isNoncomputableSection := ctx.isNoncomputableSection, ignoreTCFailures := ctx.ignoreTCFailures }) x
Equations
  • Lean.Elab.Term.setLevelNames levelNames = modify fun s => { levelNames := levelNames, syntheticMVars := s.syntheticMVars, mvarErrorInfos := s.mvarErrorInfos, messages := s.messages, letRecsToLift := s.letRecsToLift, infoState := s.infoState }
Equations
  • Lean.Elab.Term.withoutErrToSorry x = withReader (fun ctx => { fileName := ctx.fileName, fileMap := ctx.fileMap, declName? := ctx.declName?, macroStack := ctx.macroStack, currMacroScope := ctx.currMacroScope, mayPostpone := ctx.mayPostpone, errToSorry := false, autoBoundImplicit := ctx.autoBoundImplicit, autoBoundImplicits := ctx.autoBoundImplicits, sectionVars := ctx.sectionVars, sectionFVars := ctx.sectionFVars, implicitLambda := ctx.implicitLambda, isNoncomputableSection := ctx.isNoncomputableSection, ignoreTCFailures := ctx.ignoreTCFailures }) x
Equations
def Lean.Elab.Term.withMacroExpansion {α : Type} (beforeStx : Lean.Syntax) (afterStx : Lean.Syntax) (x : Lean.Elab.TermElabM α) :
Equations
  • Lean.Elab.Term.withMacroExpansion beforeStx afterStx x = Lean.Elab.withMacroExpansionInfo beforeStx afterStx (withReader (fun ctx => { fileName := ctx.fileName, fileMap := ctx.fileMap, declName? := ctx.declName?, macroStack := { before := beforeStx, after := afterStx } :: ctx.macroStack, currMacroScope := ctx.currMacroScope, mayPostpone := ctx.mayPostpone, errToSorry := ctx.errToSorry, autoBoundImplicit := ctx.autoBoundImplicit, autoBoundImplicits := ctx.autoBoundImplicits, sectionVars := ctx.sectionVars, sectionFVars := ctx.sectionFVars, implicitLambda := ctx.implicitLambda, isNoncomputableSection := ctx.isNoncomputableSection, ignoreTCFailures := ctx.ignoreTCFailures }) x)
Equations
  • Lean.Elab.Term.registerSyntheticMVar stx mvarId kind = modify fun s => { levelNames := s.levelNames, syntheticMVars := { mvarId := mvarId, stx := stx, kind := kind } :: s.syntheticMVars, mvarErrorInfos := s.mvarErrorInfos, messages := s.messages, letRecsToLift := s.letRecsToLift, infoState := s.infoState }
Equations
  • Lean.Elab.Term.registerMVarErrorInfo mvarErrorInfo = modify fun s => { levelNames := s.levelNames, syntheticMVars := s.syntheticMVars, mvarErrorInfos := Std.RBMap.insert s.mvarErrorInfos mvarErrorInfo.mvarId mvarErrorInfo, messages := s.messages, letRecsToLift := s.letRecsToLift, infoState := s.infoState }
Equations
Equations
Equations
Equations
Equations
Equations
Equations
  • Lean.Elab.Term.withoutPostponing x = withReader (fun ctx => { fileName := ctx.fileName, fileMap := ctx.fileMap, declName? := ctx.declName?, macroStack := ctx.macroStack, currMacroScope := ctx.currMacroScope, mayPostpone := false, errToSorry := ctx.errToSorry, autoBoundImplicit := ctx.autoBoundImplicit, autoBoundImplicits := ctx.autoBoundImplicits, sectionVars := ctx.sectionVars, sectionFVars := ctx.sectionFVars, implicitLambda := ctx.implicitLambda, isNoncomputableSection := ctx.isNoncomputableSection, ignoreTCFailures := ctx.ignoreTCFailures }) x
Equations
Equations
Equations
def Lean.Elab.Term.mkFreshBinderName {m : TypeType} [inst : Monad m] [inst : Lean.MonadQuotation m] :
Equations
def Lean.Elab.Term.mkFreshIdent {m : TypeType} [inst : Monad m] [inst : Lean.MonadQuotation m] (ref : Lean.Syntax) :
Equations
Equations
def Lean.Elab.Term.throwTypeMismatchError {α : Type} (header? : Option String) (expectedType : Lean.Expr) (eType : Lean.Expr) (e : Lean.Expr) (f? : optParam (Option Lean.Expr) none) (extraMsg? : optParam (Option Lean.MessageData) none) :
Equations
Equations
Equations
Equations
def Lean.Elab.Term.mkCoe (expectedType : Lean.Expr) (eType : Lean.Expr) (e : Lean.Expr) (f? : optParam (Option Lean.Expr) none) (errorMsgHeader? : optParam (Option String) none) :
Equations
Equations
Equations
Equations
def Lean.Elab.Term.ensureHasTypeAux (expectedType? : Option Lean.Expr) (eType : Lean.Expr) (e : Lean.Expr) (f? : optParam (Option Lean.Expr) none) (errorMsgHeader? : optParam (Option String) none) :
Equations
Equations
Equations
Equations
Equations
  • Lean.Elab.Term.saveContext = do let a ← read let a_1 ← read let a_2 ← Lean.getOptions let a_3 ← Lean.getOpenDecls let a_4 ← read pure { declName? := a_1.declName?, options := a_2, openDecls := a_3, macroStack := a.macroStack, errToSorry := a_4.errToSorry }
Equations
  • Lean.Elab.Term.withSavedContext savedCtx x = withReader (fun ctx => { fileName := ctx.fileName, fileMap := ctx.fileMap, declName? := savedCtx.declName?, macroStack := savedCtx.macroStack, currMacroScope := ctx.currMacroScope, mayPostpone := ctx.mayPostpone, errToSorry := savedCtx.errToSorry, autoBoundImplicit := ctx.autoBoundImplicit, autoBoundImplicits := ctx.autoBoundImplicits, sectionVars := ctx.sectionVars, sectionFVars := ctx.sectionFVars, implicitLambda := ctx.implicitLambda, isNoncomputableSection := ctx.isNoncomputableSection, ignoreTCFailures := ctx.ignoreTCFailures }) (withTheReader Lean.Core.Context (fun ctx => { options := savedCtx.options, currRecDepth := ctx.currRecDepth, maxRecDepth := ctx.maxRecDepth, ref := ctx.ref, currNamespace := ctx.currNamespace, openDecls := savedCtx.openDecls, initHeartbeats := ctx.initHeartbeats, maxHeartbeats := ctx.maxHeartbeats }) x)
Equations
Equations
Equations
Equations
Equations
def Lean.Elab.Term.elabTerm (stx : Lean.Syntax) (expectedType? : Option Lean.Expr) (catchExPostpone : optParam Bool true) (implicitLambda : optParam Bool true) :
Equations
def Lean.Elab.Term.elabTermEnsuringType (stx : Lean.Syntax) (expectedType? : Option Lean.Expr) (catchExPostpone : optParam Bool true) (implicitLambda : optParam Bool true) (errorMsgHeader? : optParam (Option String) none) :
Equations
Equations
  • Lean.Elab.Term.withoutPending x = do let saved ← get tryFinally x (modify fun s => { levelNames := saved.levelNames, syntheticMVars := saved.syntheticMVars, mvarErrorInfos := saved.mvarErrorInfos, messages := s.messages, letRecsToLift := saved.letRecsToLift, infoState := s.infoState })
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
def Lean.Elab.Term.resolveName (stx : Lean.Syntax) (n : Lean.Name) (preresolved : List (Lean.Name × List String)) (explicitLevels : List Lean.Level) (expectedType? : optParam (Option Lean.Expr) none) :
Equations
def Lean.Elab.Term.resolveName.process (stx : Lean.Syntax) (n : Lean.Name) (preresolved : List (Lean.Name × List String)) (explicitLevels : List Lean.Level) (expectedType? : optParam (Option Lean.Expr) none) (candidates : List (Lean.Name × List String)) :
Equations
Equations
Equations
def Lean.Elab.Term.TermElabM.run {α : Type} (x : Lean.Elab.TermElabM α) (ctx : optParam Lean.Elab.Term.Context Lean.Elab.Term.mkSomeContext) (s : optParam Lean.Elab.Term.State { levelNames := [], syntheticMVars := [], mvarErrorInfos := , messages := { msgs := { root := Std.PersistentArrayNode.node (Array.mkEmpty (USize.toNat Std.PersistentArray.branching)), tail := Array.mkEmpty (USize.toNat Std.PersistentArray.branching), size := 0, shift := Std.PersistentArray.initShift, tailOff := 0 } }, letRecsToLift := [], infoState := { enabled := false, assignment := { root := Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray, size := 0 }, trees := { root := Std.PersistentArrayNode.node (Array.mkEmpty (USize.toNat Std.PersistentArray.branching)), tail := Array.mkEmpty (USize.toNat Std.PersistentArray.branching), size := 0, shift := Std.PersistentArray.initShift, tailOff := 0 } } }) :
Equations
@[inline]
def Lean.Elab.Term.TermElabM.run' {α : Type} (x : Lean.Elab.TermElabM α) (ctx : optParam Lean.Elab.Term.Context Lean.Elab.Term.mkSomeContext) (s : optParam Lean.Elab.Term.State { levelNames := [], syntheticMVars := [], mvarErrorInfos := , messages := { msgs := { root := Std.PersistentArrayNode.node (Array.mkEmpty (USize.toNat Std.PersistentArray.branching)), tail := Array.mkEmpty (USize.toNat Std.PersistentArray.branching), size := 0, shift := Std.PersistentArray.initShift, tailOff := 0 } }, letRecsToLift := [], infoState := { enabled := false, assignment := { root := Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray, size := 0 }, trees := { root := Std.PersistentArrayNode.node (Array.mkEmpty (USize.toNat Std.PersistentArray.branching)), tail := Array.mkEmpty (USize.toNat Std.PersistentArray.branching), size := 0, shift := Std.PersistentArray.initShift, tailOff := 0 } } }) :
Equations
Equations
Equations
unsafe def Lean.Elab.Term.evalExpr (α : Type) (typeName : Lean.Name) (value : Lean.Expr) :
Equations
Equations
Equations