- 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.
Instances For
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 x = match x with | Lean.ReducibilityHints.abbrev => true | x => false
Equations
- Lean.ReducibilityHints.isRegular x = match x with | Lean.ReducibilityHints.regular a => true | x => false
Base structure for AxiomVal
, DefinitionVal
, TheoremVal
, InductiveVal
, ConstructorVal
, RecursorVal
and QuotVal
.
Instances For
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
Instances For
Equations
- Lean.instInhabitedDefinitionSafety = { default := Lean.DefinitionSafety.unsafe }
Equations
Equations
- Lean.instReprDefinitionSafety = { reprPrec := Lean.reprDefinitionSafety✝ }
- 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
.
Instances For
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
Instances For
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.
Instances For
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 x = match x 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. An example of this is the
α : Type
argument in the vector constructorsnil : Vector α 0
andcons : α → Vector α n → Vector α (n+1)
.The intuition is that the inductive type must exhibit parametric polymorphism over the inductive parameter, as opposed to ad-hoc polymorphism.
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 : BoolAn inductive type is called reflexive if it has at least one constructor that takes as an argument a function returning the same type we are defining. Consider the type:
inductive WideTree where | branch: (Nat -> WideTree) -> WideTree | leaf: WideTree
this is reflexive due to the presence of the
branch : (Nat -> WideTree) -> WideTree
constructor.See also: 'Inductive Definitions in the system Coq Rules and Properties' by Christine Paulin-Mohring Section 2.2, Definition 3
isReflexive : BoolAn 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.
Instances For
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. A recursor is said to support K-like reduction if one can assume it behaves like
Eq
under axiomK
--- that is, it has one constructor, the constructor has 0 arguments, and it is an inductive predicate (ie, it lives in Prop).Examples of inductives with K-like reduction is
Eq
,Acc
, andAnd.intro
. Non-examples areexists
(where the constructor has arguments) andOr.intro
(which has multiple constructors).k : Bool- isUnsafe : Bool
Instances For
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
Instances For
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.
Instances For
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
- Lean.ConstantInfo.isPartial x = match x with | Lean.ConstantInfo.defnInfo v => v.safety == Lean.DefinitionSafety.partial | x => false
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 x = match x 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 x = match x with | Lean.ConstantInfo.ctorInfo val => true | x => false
Equations
- Lean.ConstantInfo.isInductive x = match x 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"