Datastructure for representing the "head symbol" of an expression.
It is the key of KExprMap
.
Examples:
- The head of
f a
is.const f
- The head of
let x := 1; f x
is.const f
- The head of
fun x => fun
is.lam
HeadIndex
is a very simple index, and is used in situations where
we want to find definitionally equal terms, but we want to minimize
the search by checking only pairs of terms that have the same
HeadIndex
.
- fvar (fvarId : Lean.FVarId) : Lean.HeadIndex
- mvar (mvarId : Lean.MVarId) : Lean.HeadIndex
- const (constName : Lean.Name) : Lean.HeadIndex
- proj (structName : Lean.Name) (idx : Nat) : Lean.HeadIndex
- lit (litVal : Lean.Literal) : Lean.HeadIndex
- sort : Lean.HeadIndex
- lam : Lean.HeadIndex
- forallE : Lean.HeadIndex
Instances For
Equations
- Lean.instInhabitedHeadIndex = { default := Lean.HeadIndex.fvar default }
Equations
- Lean.instBEqHeadIndex = { beq := Lean.beqHeadIndex✝ }
Equations
- Lean.instReprHeadIndex = { reprPrec := Lean.reprHeadIndex✝ }
Hash code for a HeadIndex
value.
Equations
- (Lean.HeadIndex.fvar a).hash = mixHash 11 (hash a)
- (Lean.HeadIndex.mvar a).hash = mixHash 13 (hash a)
- (Lean.HeadIndex.const a).hash = mixHash 17 (hash a)
- (Lean.HeadIndex.proj a a_1).hash = mixHash 19 (mixHash (hash a) (hash a_1))
- (Lean.HeadIndex.lit a).hash = mixHash 23 (hash a)
- Lean.HeadIndex.sort.hash = 29
- Lean.HeadIndex.lam.hash = 31
- Lean.HeadIndex.forallE.hash = 37
Instances For
Equations
- Lean.instHashableHeadIndex = { hash := Lean.HeadIndex.hash }
Return the number of arguments in the given expression with respect to its HeadIndex
Equations
- e.headNumArgs = Lean.Expr.headNumArgs.go e 0
Instances For
Equations
- Lean.Expr.headNumArgs.go (f.app arg) x✝ = Lean.Expr.headNumArgs.go f (x✝ + 1)
- Lean.Expr.headNumArgs.go (Lean.Expr.letE declName type value b nonDep) x✝ = Lean.Expr.headNumArgs.go b x✝
- Lean.Expr.headNumArgs.go (Lean.Expr.mdata data e) x✝ = Lean.Expr.headNumArgs.go e x✝
- Lean.Expr.headNumArgs.go x✝¹ x✝ = x✝
Instances For
Convert the given expression into a HeadIndex
.
Equations
- e.toHeadIndex = match Lean.Expr.toHeadIndexQuick?✝ e with | some i => i | none => Lean.Expr.toHeadIndexSlow✝ e