- opaque: Lean.ReducibilityHints
- abbrev: Lean.ReducibilityHints
- regular: UInt32 → Lean.ReducibilityHints
Reducibility hints are used in the convertibility checker. When trying to solve a constraint such a
(f ...) =?= (g ...)
where f and g are definitions, the checker has to decide which one will be unfolded. If f (g) is opaque, then g (f) is unfolded if it is also not marked as opaque, Else if f (g) is abbrev, then f (g) is unfolded if g (f) is also not marked as abbrev, Else if f and g are regular, then we unfold the one with the biggest definitional height. Otherwise both are unfolded.
The arguments of the regular
Constructor are: the definitional height and the flag selfOpt
.
The definitional height is by default computed by the kernel. It only takes into account other regular definitions used in a definition. When creating declarations using meta-programming, we can specify the definitional depth manually.
Remark: the hint only affects performance. None of the hints prevent the kernel from unfolding a declaration during Type checking.
Remark: the ReducibilityHints are not related to the attributes: reducible/irrelevance/semireducible. These attributes are used by the Elaborator. The ReducibilityHints are used by the kernel (and Elaborator). Moreover, the ReducibilityHints cannot be changed after a declaration is added to the kernel.
Equations
- Lean.instInhabitedReducibilityHints = { default := Lean.ReducibilityHints.opaque }
Equations
- Lean.ReducibilityHints.getHeightEx h = match h with | Lean.ReducibilityHints.regular h => h | x => 0
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.ReducibilityHints.isAbbrev _fun_discr = match _fun_discr with | Lean.ReducibilityHints.abbrev => true | x => false
Equations
- Lean.ReducibilityHints.isRegular _fun_discr = match _fun_discr with | Lean.ReducibilityHints.regular a => true | x => false
Base structure for AxiomVal
, DefinitionVal
, TheoremVal
, InductiveVal
, ConstructorVal
, RecursorVal
and QuotVal
.
Equations
- Lean.instInhabitedConstantVal = { default := { name := default, levelParams := default, type := default } }
Equations
- Lean.instInhabitedAxiomVal = { default := { toConstantVal := default, isUnsafe := default } }
Equations
- Lean.mkAxiomValEx name levelParams type isUnsafe = { toConstantVal := { name := name, levelParams := levelParams, type := type }, isUnsafe := isUnsafe }
Equations
- Lean.AxiomVal.isUnsafeEx v = v.isUnsafe
- unsafe: Lean.DefinitionSafety
- safe: Lean.DefinitionSafety
- partial: Lean.DefinitionSafety
Equations
- Lean.instInhabitedDefinitionSafety = { default := Lean.DefinitionSafety.unsafe }
Equations
- Lean.instBEqDefinitionSafety = { beq := [anonymous] }
Equations
- Lean.instReprDefinitionSafety = { reprPrec := [anonymous] }
- value : Lean.Expr
- hints : Lean.ReducibilityHints
- safety : Lean.DefinitionSafety
List of all (including this one) declarations in the same mutual block. Note that this information is not used by the kernel, and is only used to save the information provided by the user when using mutual blocks. Recall that the Lean kernel does not support recursive definitions and they are compiled using recursors and
WellFounded.fix
.
Equations
- Lean.instInhabitedDefinitionVal = { default := { toConstantVal := default, value := default, hints := default, safety := default, all := default } }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.DefinitionVal.getSafetyEx v = v.safety
Equations
- Lean.instInhabitedTheoremVal = { default := { toConstantVal := default, value := default, all := default } }
Equations
- Lean.instInhabitedOpaqueVal = { default := { toConstantVal := default, value := default, isUnsafe := default, all := default } }
Equations
- Lean.mkOpaqueValEx name levelParams type value isUnsafe all = { toConstantVal := { name := name, levelParams := levelParams, type := type }, value := value, isUnsafe := isUnsafe, all := all }
Equations
- Lean.OpaqueVal.isUnsafeEx v = v.isUnsafe
Equations
- Lean.instInhabitedConstructor = { default := { name := default, type := default } }
- name : Lean.Name
- type : Lean.Expr
- ctors : List Lean.Constructor
Equations
- Lean.instInhabitedInductiveType = { default := { name := default, type := default, ctors := default } }
- axiomDecl: Lean.AxiomVal → Lean.Declaration
- defnDecl: Lean.DefinitionVal → Lean.Declaration
- thmDecl: Lean.TheoremVal → Lean.Declaration
- opaqueDecl: Lean.OpaqueVal → Lean.Declaration
- quotDecl: Lean.Declaration
- mutualDefnDecl: List Lean.DefinitionVal → Lean.Declaration
- inductDecl: List Lean.Name → Nat → List Lean.InductiveType → Bool → Lean.Declaration
Declaration object that can be sent to the kernel.
Equations
- Lean.instInhabitedDeclaration = { default := Lean.Declaration.axiomDecl default }
Equations
- Lean.mkInductiveDeclEs lparams nparams types isUnsafe = Lean.Declaration.inductDecl lparams nparams types isUnsafe
Equations
- Lean.Declaration.isUnsafeInductiveDeclEx _fun_discr = match _fun_discr with | Lean.Declaration.inductDecl lparams nparams types isUnsafe => isUnsafe | x => false
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Declaration.forExprM d f = Lean.Declaration.foldExprM d (fun x a => f a) ()
Number of parameters. A parameter is an argument to the defined type that is fixed over constructors.
numParams : NatNumber of indices. An index is an argument that varies over constructors.
An example of this is the
n : Nat
argument in the vector constructorcons : α → Vector α n → Vector α (n+1)
numIndices : NatList of all (including this one) inductive datatypes in the mutual declaration containing this one
List of the names of the constructors for this inductive datatype.
true
when recursive (that is, the inductive type appears as an argument in a constructor).isRec : BoolWhether the definition is flagged as unsafe.
isUnsafe : Bool- isReflexive : Bool
An inductive definition
T
is nested when there is a constructor with an argumentx : F T
, whereF : Type → Type
is some suitably behaved (ie strictly positive) function (EgArray T
,List T
,T × T
, ...).isNested : Bool
The kernel compiles (mutual) inductive declarations (see inductiveDecls
) into a set of
- Declaration.inductDecl
(for each inductive datatype in the mutual Declaration),
- Declaration.ctorDecl
(for each Constructor in the mutual Declaration),
- Declaration.recDecl
(automatically generated recursors).
This data is used to implement iota-reduction efficiently and compile nested inductive
declarations.
A series of checks are performed by the kernel to check whether a `inductiveDecls`
is valid or not.
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.InductiveVal.isRecEx v = v.isRec
Equations
- Lean.InductiveVal.isUnsafeEx v = v.isUnsafe
Equations
- Lean.InductiveVal.isReflexiveEx v = v.isReflexive
Equations
- Lean.InductiveVal.isNestedEx v = v.isNested
Equations
- Lean.InductiveVal.numCtors v = List.length v.ctors
Equations
- Lean.instInhabitedConstructorVal = { default := { toConstantVal := default, induct := default, cidx := default, numParams := default, numFields := default, isUnsafe := default } }
Equations
- Lean.ConstructorVal.isUnsafeEx v = v.isUnsafe
Equations
- Lean.instInhabitedRecursorRule = { default := { ctor := default, nfields := default, rhs := default } }
List of all inductive datatypes in the mutual declaration that generated this recursor
Number of parameters
numParams : NatNumber of indices
numIndices : NatNumber of motives
numMotives : NatNumber of minor premises
numMinors : NatA reduction for each Constructor
rules : List Lean.RecursorRuleIt supports K-like reduction
k : Bool- isUnsafe : Bool
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.RecursorVal.kEx v = v.k
Equations
- Lean.RecursorVal.isUnsafeEx v = v.isUnsafe
Equations
- Lean.RecursorVal.getMajorIdx v = v.numParams + v.numMotives + v.numMinors + v.numIndices
Equations
- Lean.RecursorVal.getFirstIndexIdx v = v.numParams + v.numMotives + v.numMinors
Equations
- Lean.RecursorVal.getFirstMinorIdx v = v.numParams + v.numMotives
Equations
- Lean.RecursorVal.getInduct v = Lean.Name.getPrefix v.toConstantVal.name
- type: Lean.QuotKind
- ctor: Lean.QuotKind
- lift: Lean.QuotKind
- ind: Lean.QuotKind
Equations
- Lean.instInhabitedQuotKind = { default := Lean.QuotKind.type }
Equations
- Lean.instInhabitedQuotVal = { default := { toConstantVal := default, kind := default } }
Equations
- Lean.mkQuotValEx name levelParams type kind = { toConstantVal := { name := name, levelParams := levelParams, type := type }, kind := kind }
Equations
- Lean.QuotVal.kindEx v = v.kind
- axiomInfo: Lean.AxiomVal → Lean.ConstantInfo
- defnInfo: Lean.DefinitionVal → Lean.ConstantInfo
- thmInfo: Lean.TheoremVal → Lean.ConstantInfo
- opaqueInfo: Lean.OpaqueVal → Lean.ConstantInfo
- quotInfo: Lean.QuotVal → Lean.ConstantInfo
- inductInfo: Lean.InductiveVal → Lean.ConstantInfo
- ctorInfo: Lean.ConstructorVal → Lean.ConstantInfo
- recInfo: Lean.RecursorVal → Lean.ConstantInfo
Information associated with constant declarations.
Equations
- Lean.instInhabitedConstantInfo = { default := Lean.ConstantInfo.axiomInfo 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
Equations
- Lean.ConstantInfo.levelParams d = (Lean.ConstantInfo.toConstantVal d).levelParams
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.ConstantInfo.hasValue _fun_discr = match _fun_discr with | Lean.ConstantInfo.defnInfo val => true | Lean.ConstantInfo.thmInfo val => true | x => false
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.ConstantInfo.isCtor _fun_discr = match _fun_discr with | Lean.ConstantInfo.ctorInfo val => true | x => false
Equations
- Lean.ConstantInfo.isInductive _fun_discr = match _fun_discr with | Lean.ConstantInfo.inductInfo val => true | x => false
List of all (including this one) declarations in the same mutual block.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.mkRecName declName = Lean.Name.mkStr declName "rec"