Whether a local declaration should be found by type class search, tactics, etc. and shown in the goal display.
- default: Lean.LocalDeclKind
Participates fully in type class search, tactics, and is shown even if inaccessible.
For example: the
x
infun x => _
has the default kind. - implDetail: Lean.LocalDeclKind
Invisible to type class search or tactics, and hidden in the goal display.
This kind is used for temporary variables in macros. For example:
return (← foo) + bar
expands tofoo >>= fun __tmp => pure (__tmp + bar)
, where__tmp
has theimplDetail
kind. - auxDecl: Lean.LocalDeclKind
Auxiliary local declaration for recursive calls. The behavior is similar to
implDetail
.For example:
def foo (n : Nat) : Nat := _
adds the local declarationfoo : Nat → Nat
to allow recursive calls. This declaration has theauxDecl
kind.
Instances For
Equations
- Lean.instInhabitedLocalDeclKind = { default := Lean.LocalDeclKind.default }
Equations
- Lean.instReprLocalDeclKind = { reprPrec := Lean.reprLocalDeclKind✝ }
Equations
- Lean.instDecidableEqLocalDeclKind x y = if h : Lean.LocalDeclKind.toCtorIdx x = Lean.LocalDeclKind.toCtorIdx y then isTrue ⋯ else isFalse ⋯
Equations
- Lean.instHashableLocalDeclKind = { hash := Lean.hashLocalDeclKind✝ }
A declaration for a LocalContext. This is used to register which free variables are in scope. Each declaration comes with
index
the position of the decl in the local contextfvarId
the unique id of the free variablesuserName
the pretty-printable name of the variabletype
the type. Acdecl
is a local variable, aldecl
is a let-bound free variable with avalue : Expr
.
- cdecl: Nat → Lean.FVarId → Lake.Name → Lean.Expr → Lean.BinderInfo → Lean.LocalDeclKind → Lean.LocalDecl
- ldecl: Nat → Lean.FVarId → Lake.Name → Lean.Expr → Lean.Expr → Bool → Lean.LocalDeclKind → Lean.LocalDecl
Instances For
Equations
- Lean.instInhabitedLocalDecl = { default := Lean.LocalDecl.cdecl default default default default default default }
Equations
- Lean.mkLocalDeclEx index fvarId userName type bi = Lean.LocalDecl.cdecl index fvarId userName type bi Lean.LocalDeclKind.default
Instances For
Equations
- Lean.mkLetDeclEx index fvarId userName type val = Lean.LocalDecl.ldecl index fvarId userName type val false Lean.LocalDeclKind.default
Instances For
Equations
- Lean.LocalDecl.binderInfoEx x = match x with | Lean.LocalDecl.cdecl index fvarId userName type bi kind => bi | x => Lean.BinderInfo.default
Instances For
Equations
- Lean.LocalDecl.isLet x = match x with | Lean.LocalDecl.cdecl index fvarId userName type bi kind => false | Lean.LocalDecl.ldecl index fvarId userName type value nonDep kind => true
Instances For
Equations
- Lean.LocalDecl.index x = match x with | Lean.LocalDecl.cdecl i fvarId userName type bi kind => i | Lean.LocalDecl.ldecl i fvarId userName type value nonDep kind => i
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.LocalDecl.fvarId x = match x with | Lean.LocalDecl.cdecl index id userName type bi kind => id | Lean.LocalDecl.ldecl index id userName type value nonDep kind => id
Instances For
Equations
- Lean.LocalDecl.userName x = match x with | Lean.LocalDecl.cdecl index fvarId n type bi kind => n | Lean.LocalDecl.ldecl index fvarId n type value nonDep kind => n
Instances For
Equations
- Lean.LocalDecl.type x = match x with | Lean.LocalDecl.cdecl index fvarId userName t bi kind => t | Lean.LocalDecl.ldecl index fvarId userName t value nonDep kind => t
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.LocalDecl.kind x = match x with | Lean.LocalDecl.cdecl index fvarId userName type bi kind => kind | Lean.LocalDecl.ldecl index fvarId userName type value nonDep kind => kind
Instances For
Equations
Instances For
Is the local declaration an implementation-detail hypothesis (including auxiliary declarations)?
Equations
Instances For
Equations
- Lean.LocalDecl.value? x = match x with | Lean.LocalDecl.cdecl index fvarId userName type bi kind => none | Lean.LocalDecl.ldecl index fvarId userName type v nonDep kind => some v
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.LocalDecl.hasValue x = match x with | Lean.LocalDecl.cdecl index fvarId userName type bi kind => false | Lean.LocalDecl.ldecl index fvarId userName type value nonDep kind => true
Instances For
Equations
- Lean.LocalDecl.setValue x✝ x = match x✝, x with | Lean.LocalDecl.ldecl idx id n t value nd k, v => Lean.LocalDecl.ldecl idx id n t v nd k | d, x => d
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.LocalDecl.toExpr decl = Lean.mkFVar (Lean.LocalDecl.fvarId decl)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Set the kind of a LocalDecl
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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.
- fvarIdToDecl : Lean.PersistentHashMap Lean.FVarId Lean.LocalDecl
- decls : Lean.PersistentArray (Option Lean.LocalDecl)
Instances For
Equations
- Lean.instInhabitedLocalContext = { default := { fvarIdToDecl := default, decls := default } }
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.LocalContext.isEmpty lctx = Lean.PersistentHashMap.isEmpty lctx.fvarIdToDecl
Instances For
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.
Instances For
Low level API for let declarations. Do not use directly.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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.
Instances For
Equations
- Lean.LocalContext.find? lctx fvarId = Lean.PersistentHashMap.find? lctx.fvarIdToDecl fvarId
Instances For
Equations
- Lean.LocalContext.findFVar? lctx e = Lean.LocalContext.find? lctx (Lean.Expr.fvarId! e)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
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)
Instances For
Equations
- Lean.LocalContext.contains lctx fvarId = Lean.PersistentHashMap.contains lctx.fvarIdToDecl fvarId
Instances For
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)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return all of the free variables in the given context.
Equations
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.LocalContext.usesUserName lctx userName = Option.isSome (Lean.LocalContext.findFromUserName? lctx userName)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.LocalContext.lastDecl lctx = Lean.PersistentArray.get! lctx.decls (lctx.decls.size - 1)
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
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.
Instances For
Set the kind of the given fvar.
Equations
- Lean.LocalContext.setKind lctx fvarId kind = Lean.LocalContext.modifyLocalDecl lctx fvarId fun (x : Lean.LocalDecl) => Lean.LocalDecl.setKind x kind
Instances For
Equations
- Lean.LocalContext.setBinderInfo lctx fvarId bi = Lean.LocalContext.modifyLocalDecl lctx fvarId fun (decl : Lean.LocalDecl) => Lean.LocalDecl.setBinderInfo decl bi
Instances For
Equations
- Lean.LocalContext.numIndices lctx = lctx.decls.size
Instances For
Equations
- Lean.LocalContext.getAt? lctx i = Lean.PersistentArray.get! lctx.decls i
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.LocalContext.forM lctx f = Lean.PersistentArray.forM lctx.decls fun (decl : Option Lean.LocalDecl) => match decl with | none => pure PUnit.unit | some decl => f decl
Instances For
Equations
- Lean.LocalContext.findDeclM? lctx f = Lean.PersistentArray.findSomeM? lctx.decls fun (decl : Option Lean.LocalDecl) => match decl with | none => pure none | some decl => f decl
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.LocalContext.foldl lctx f init start = Id.run (Lean.LocalContext.foldlM lctx f init start)
Instances For
Equations
- Lean.LocalContext.foldr lctx f init = Id.run (Lean.LocalContext.foldrM lctx f init)
Instances For
Equations
- Lean.LocalContext.size lctx = Lean.LocalContext.foldl lctx (fun (n : Nat) (x : Lean.LocalDecl) => n + 1) 0
Instances For
Equations
- Lean.LocalContext.findDecl? lctx f = Id.run (Lean.LocalContext.findDeclM? lctx f)
Instances For
Equations
- Lean.LocalContext.findDeclRev? lctx f = Id.run (Lean.LocalContext.findDeclRevM? lctx f)
Instances For
Given lctx₁ - exceptFVars
of the form (x_1 : A_1) ... (x_n : A_n)
, then return true
iff there is a local context B_1* (x_1 : A_1) ... B_n* (x_n : A_n)
which is a prefix
of lctx₂
where B_i
's are (possibly empty) sequences of local declarations.
Equations
- Lean.LocalContext.isSubPrefixOf lctx₁ lctx₂ exceptFVars = Lean.LocalContext.isSubPrefixOfAux lctx₁.decls lctx₂.decls exceptFVars 0 0
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
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
Instances For
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
Instances For
Equations
- Lean.LocalContext.anyM lctx p = Lean.PersistentArray.anyM lctx.decls fun (d : Option Lean.LocalDecl) => match d with | some decl => p decl | none => pure false
Instances For
Equations
- Lean.LocalContext.allM lctx p = Lean.PersistentArray.allM lctx.decls fun (d : Option Lean.LocalDecl) => match d with | some decl => p decl | none => pure true
Instances For
Return true
if lctx
contains a local declaration satisfying p
.
Equations
- Lean.LocalContext.any lctx p = Id.run (Lean.LocalContext.anyM lctx p)
Instances For
Return true
if all declarations in lctx
satisfy p
.
Equations
- Lean.LocalContext.all lctx p = Id.run (Lean.LocalContext.allM lctx p)
Instances For
If option pp.sanitizeNames
is set to true
, add tombstone to shadowed local declaration names and ones contains macroscopes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an FVarId
, this function returns the corresponding user name,
but only if the name can be used to recover the original FVarId.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Sort the given FVarId
s by the order in which they appear in lctx
. If any of
the FVarId
s do not appear in lctx
, the result is unspecified.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return local hypotheses which are not "implementation detail", as Expr
s.
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.