- cdecl: Nat → Lean.FVarId → Lean.Name → Lean.Expr → Lean.BinderInfo → Lean.LocalDecl
- ldecl: Nat → Lean.FVarId → Lean.Name → Lean.Expr → Lean.Expr → Bool → Lean.LocalDecl
A declaration for a LocalContext. This is used to register which free variables are in scope. Each declaration comes with
Equations
- Lean.instInhabitedLocalDecl = { default := Lean.LocalDecl.cdecl default default default default default }
Equations
- Lean.mkLocalDeclEx index fvarId userName type bi = Lean.LocalDecl.cdecl index fvarId userName type bi
Equations
- Lean.mkLetDeclEx index fvarId userName type val = Lean.LocalDecl.ldecl index fvarId userName type val false
Equations
- Lean.LocalDecl.binderInfoEx _fun_discr = match _fun_discr with | Lean.LocalDecl.cdecl index fvarId userName type bi => bi | x => Lean.BinderInfo.default
Equations
- Lean.LocalDecl.isLet _fun_discr = match _fun_discr with | Lean.LocalDecl.cdecl index fvarId userName type bi => false | Lean.LocalDecl.ldecl index fvarId userName type value nonDep => true
Equations
- Lean.LocalDecl.index _fun_discr = match _fun_discr with | Lean.LocalDecl.cdecl i fvarId userName type bi => i | Lean.LocalDecl.ldecl i fvarId userName type value nonDep => i
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.LocalDecl.fvarId _fun_discr = match _fun_discr with | Lean.LocalDecl.cdecl index id userName type bi => id | Lean.LocalDecl.ldecl index id userName type value nonDep => id
Equations
- Lean.LocalDecl.userName _fun_discr = match _fun_discr with | Lean.LocalDecl.cdecl index fvarId n type bi => n | Lean.LocalDecl.ldecl index fvarId n type value nonDep => n
Equations
- Lean.LocalDecl.type _fun_discr = match _fun_discr with | Lean.LocalDecl.cdecl index fvarId userName t bi => t | Lean.LocalDecl.ldecl index fvarId userName t value nonDep => t
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.LocalDecl.value? _fun_discr = match _fun_discr with | Lean.LocalDecl.cdecl index fvarId userName type bi => none | Lean.LocalDecl.ldecl index fvarId userName type v nonDep => some v
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.LocalDecl.setValue _fun_discr _fun_discr = match _fun_discr, _fun_discr with | Lean.LocalDecl.ldecl idx id n t value nd, v => Lean.LocalDecl.ldecl idx id n t v nd | d, x => d
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.LocalDecl.toExpr decl = Lean.mkFVar (Lean.LocalDecl.fvarId decl)
Equations
- One or more equations did not get rendered due to their size.
- fvarIdToDecl : Std.PersistentHashMap Lean.FVarId Lean.LocalDecl
- decls : Std.PersistentArray (Option Lean.LocalDecl)
A LocalContext is an ordered set of local variable declarations. It is used to store the free variables (also known as local constants) that are in scope.
When inspecting a goal or expected type in the infoview, the local
context is all of the variables above the ⊢
symbol.
Equations
- Lean.instInhabitedLocalContext = { default := { fvarIdToDecl := default, decls := 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.LocalContext.isEmpty lctx = Std.PersistentHashMap.isEmpty lctx.fvarIdToDecl
Low level API for creating local declarations.
It is used to implement actions in the monads Elab
and Tactic
.
It should not be used directly since the argument (fvarId : FVarId)
is
assumed to be unique. You can create a unique fvarId with mkFreshFVarId
.
Equations
- One or more equations did not get rendered due to their size.
Low level API for let declarations. Do not use directly.
Equations
- One or more equations did not get rendered due to their size.
Low level API for adding a local declaration. Do not use directly.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.LocalContext.find? lctx fvarId = Std.PersistentHashMap.find? lctx.fvarIdToDecl fvarId
Equations
- Lean.LocalContext.findFVar? lctx e = Lean.LocalContext.find? lctx (Lean.Expr.fvarId! e)
Equations
- One or more equations did not get rendered due to their size.
Gets the declaration for expression e
in the local context.
If e
is not a free variable or not present then panics.
Equations
- Lean.LocalContext.getFVar! lctx e = Lean.LocalContext.get! lctx (Lean.Expr.fvarId! e)
Equations
- Lean.LocalContext.contains lctx fvarId = Std.PersistentHashMap.contains lctx.fvarIdToDecl fvarId
Returns true when the lctx contains the free variable e
.
Panics if e
is not an fvar.
Equations
- Lean.LocalContext.containsFVar lctx e = Lean.LocalContext.contains lctx (Lean.Expr.fvarId! e)
Equations
- One or more equations did not get rendered due to their size.
Return all of the free variables in the given context.
Equations
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
- Lean.LocalContext.usesUserName lctx userName = Option.isSome (Lean.LocalContext.findFromUserName? lctx userName)
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.LocalContext.lastDecl lctx = Std.PersistentArray.get! lctx.decls (lctx.decls.size - 1)
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.
Low-level function for updating the local context.
Assumptions about f
, the resulting nested expressions must be definitionally equal to their original values,
the index
nor fvarId
are modified.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.LocalContext.setBinderInfo lctx fvarId bi = Lean.LocalContext.modifyLocalDecl lctx fvarId fun decl => Lean.LocalDecl.setBinderInfo decl bi
Equations
- Lean.LocalContext.numIndices lctx = lctx.decls.size
Equations
- Lean.LocalContext.getAt? lctx i = Std.PersistentArray.get! lctx.decls i
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.LocalContext.foldrM lctx f init = Std.PersistentArray.foldrM lctx.decls (fun decl b => match decl with | none => pure b | some decl => f decl b) init
Equations
- Lean.LocalContext.forM lctx f = Std.PersistentArray.forM lctx.decls fun decl => match decl with | none => pure PUnit.unit | some decl => f decl
Equations
- Lean.LocalContext.findDeclM? lctx f = Std.PersistentArray.findSomeM? lctx.decls fun decl => match decl with | none => pure none | some decl => f decl
Equations
- Lean.LocalContext.findDeclRevM? lctx f = Std.PersistentArray.findSomeRevM? lctx.decls fun decl => match decl with | none => pure none | some decl => f decl
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.LocalContext.foldl lctx f init start = Id.run (Lean.LocalContext.foldlM lctx f init start)
Equations
- Lean.LocalContext.foldr lctx f init = Id.run (Lean.LocalContext.foldrM lctx f init)
Equations
- Lean.LocalContext.findDecl? lctx f = Id.run (Lean.LocalContext.findDeclM? lctx f)
Equations
- Lean.LocalContext.findDeclRev? lctx f = Id.run (Lean.LocalContext.findDeclRevM? lctx f)
Equations
- Lean.LocalContext.isSubPrefixOf lctx₁ lctx₂ exceptFVars = Lean.LocalContext.isSubPrefixOfAux lctx₁.decls lctx₂.decls exceptFVars 0 0
Equations
- One or more equations did not get rendered due to their size.
Creates the expression fun x₁ .. xₙ => b
for free variables xs = #[x₁, .., xₙ]
,
suitably abstracting b
and the types for each of the xᵢ
.
Equations
- Lean.LocalContext.mkLambda lctx xs b = Lean.LocalContext.mkBinding true lctx xs b
Creates the expression (x₁:α₁) → .. → (xₙ:αₙ) → b
for free variables xs = #[x₁, .., xₙ]
,
suitably abstracting b
and the types for each of the xᵢ
, αᵢ
.
Equations
- Lean.LocalContext.mkForall lctx xs b = Lean.LocalContext.mkBinding false lctx xs b
Equations
- Lean.LocalContext.anyM lctx p = Std.PersistentArray.anyM lctx.decls fun d => match d with | some decl => p decl | none => pure false
Equations
- Lean.LocalContext.allM lctx p = Std.PersistentArray.allM lctx.decls fun d => match d with | some decl => p decl | none => pure true
Equations
- Lean.LocalContext.any lctx p = Id.run (Lean.LocalContext.anyM lctx p)
Equations
- Lean.LocalContext.all lctx p = Id.run (Lean.LocalContext.allM lctx p)
Equations
- One or more equations did not get rendered due to their size.
- getLCtx : m Lean.LocalContext
Class used to denote that m
has a local context.
Equations
- One or more equations did not get rendered due to their size.