Universe level utilities for the code generator #
Universe level parameter normalizer #
The specializer creates "keys" for a function specialization. The key is an expression containing the function being specialized and the argument values used for the specialization. The key does not contain free variables, and function parameter names are irrelevant due to alpha equivalence. The universe level normalizer ensures the universe parameter names are irrelevant when comparing keys.
State for the universe level normalizer monad.
- nextIdx : Nat
Counter for generating new (normalized) universe parameter names.
- map : Std.HashMap Lean.Name Lean.Level
Mapping from existing universe parameter names to the new ones.
Parameters that have been normalized.
Instances For
Monad for the universe level normalizer
Instances For
Normalize universe level parameter names in the given universe level.
Normalize universe level parameter names in the given expression.
Normalize universe level parameter names in the given expression. The function also returns the list of universe level parameter names that have been normalized.
Equations
- Lean.Compiler.LCNF.normLevelParams e = match StateT.run (Lean.Compiler.LCNF.NormLevelParam.normExpr e) { nextIdx := 1, map := ∅, paramNames := #[] } with | (e, s) => (e, s.paramNames.toList)
Instances For
Universe level collector #
This module extends support for Code
. See Lean.Util.CollectLevelParams.lean
In the code specializer, we create new auxiliary declarations and the universe level parameter collector is used to setup the new auxiliary declarations.
See Decl.setLevelParams
.
Equations
Instances For
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.
- Lean.Compiler.LCNF.CollectLevelParams.visitLetValue Lean.Compiler.LCNF.LetValue.erased = id
- Lean.Compiler.LCNF.CollectLevelParams.visitLetValue (Lean.Compiler.LCNF.LetValue.value value) = id
- Lean.Compiler.LCNF.CollectLevelParams.visitLetValue (Lean.Compiler.LCNF.LetValue.proj typeName idx struct) = id
- Lean.Compiler.LCNF.CollectLevelParams.visitLetValue (Lean.Compiler.LCNF.LetValue.fvar fvarId args) = Lean.Compiler.LCNF.CollectLevelParams.visitArgs args
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Collect universe level parameters collecting in the type, parameters, and value, and then
set decl.levelParams
with the resulting value.
Equations
- One or more equations did not get rendered due to their size.