pub enum ConstantInfo {
Axiom(AxiomVal),
Definition(DefinitionVal),
Theorem(TheoremVal),
Opaque(OpaqueVal),
Inductive(InductiveVal),
Constructor(ConstructorVal),
Recursor(RecursorVal),
Quotient(QuotVal),
}Expand description
Unified constant info enum (mirrors LEAN 4’s constant_info).
Every declaration in the environment is stored as a ConstantInfo.
The type checker dispatches on this enum to determine reduction behavior.
Variants§
Axiom(AxiomVal)
Axiom declaration.
Definition(DefinitionVal)
Definition with body.
Theorem(TheoremVal)
Theorem with proof.
Opaque(OpaqueVal)
Opaque definition.
Inductive(InductiveVal)
Inductive type.
Constructor(ConstructorVal)
Constructor of inductive type.
Recursor(RecursorVal)
Recursor (eliminator).
Quotient(QuotVal)
Quotient type component.
Implementations§
Source§impl ConstantInfo
impl ConstantInfo
Sourcepub fn level_params(&self) -> &[Name]
pub fn level_params(&self) -> &[Name]
Get the universe level parameters.
Sourcepub fn common(&self) -> &ConstantVal
pub fn common(&self) -> &ConstantVal
Get the common constant value.
Sourcepub fn is_definition(&self) -> bool
pub fn is_definition(&self) -> bool
Check if this is a definition.
Sourcepub fn is_theorem(&self) -> bool
pub fn is_theorem(&self) -> bool
Check if this is a theorem.
Sourcepub fn is_inductive(&self) -> bool
pub fn is_inductive(&self) -> bool
Check if this is an inductive type.
Sourcepub fn is_constructor(&self) -> bool
pub fn is_constructor(&self) -> bool
Check if this is a constructor.
Sourcepub fn is_recursor(&self) -> bool
pub fn is_recursor(&self) -> bool
Check if this is a recursor.
Sourcepub fn is_quotient(&self) -> bool
pub fn is_quotient(&self) -> bool
Check if this is a quotient component.
Sourcepub fn to_definition_val(&self) -> Option<&DefinitionVal>
pub fn to_definition_val(&self) -> Option<&DefinitionVal>
Get the definition value if this is a Definition.
Sourcepub fn to_inductive_val(&self) -> Option<&InductiveVal>
pub fn to_inductive_val(&self) -> Option<&InductiveVal>
Get the inductive value if this is an Inductive.
Sourcepub fn to_constructor_val(&self) -> Option<&ConstructorVal>
pub fn to_constructor_val(&self) -> Option<&ConstructorVal>
Get the constructor value if this is a Constructor.
Sourcepub fn to_recursor_val(&self) -> Option<&RecursorVal>
pub fn to_recursor_val(&self) -> Option<&RecursorVal>
Get the recursor value if this is a Recursor.
Sourcepub fn to_quotient_val(&self) -> Option<&QuotVal>
pub fn to_quotient_val(&self) -> Option<&QuotVal>
Get the quotient value if this is a Quotient.
Sourcepub fn to_axiom_val(&self) -> Option<&AxiomVal>
pub fn to_axiom_val(&self) -> Option<&AxiomVal>
Get the axiom value if this is an Axiom.
Sourcepub fn to_theorem_val(&self) -> Option<&TheoremVal>
pub fn to_theorem_val(&self) -> Option<&TheoremVal>
Get the theorem value if this is a Theorem.
Sourcepub fn to_opaque_val(&self) -> Option<&OpaqueVal>
pub fn to_opaque_val(&self) -> Option<&OpaqueVal>
Get the opaque value if this is an Opaque.
Sourcepub fn has_value(&self, allow_opaque: bool) -> bool
pub fn has_value(&self, allow_opaque: bool) -> bool
Check if this constant has a computable value.
allow_opaque controls whether opaque definitions are considered.
Sourcepub fn reducibility_hint(&self) -> ReducibilityHint
pub fn reducibility_hint(&self) -> ReducibilityHint
Get the reducibility hint.
Sourcepub fn is_structure_like(&self) -> bool
pub fn is_structure_like(&self) -> bool
Check if this is a structure-like inductive (single constructor, not recursive).
Source§impl ConstantInfo
impl ConstantInfo
Sourcepub fn kind(&self) -> ConstantKind
pub fn kind(&self) -> ConstantKind
Return the kind of this constant.
Sourcepub fn summarize(&self) -> ConstantSummary
pub fn summarize(&self) -> ConstantSummary
Build a summary of this constant.
Sourcepub fn num_level_params(&self) -> usize
pub fn num_level_params(&self) -> usize
Return the number of universe-level parameters.
Sourcepub fn is_polymorphic(&self) -> bool
pub fn is_polymorphic(&self) -> bool
Whether this constant is universe-polymorphic.
Sourcepub fn parent_inductive(&self) -> Option<&Name>
pub fn parent_inductive(&self) -> Option<&Name>
For constructors, return the parent inductive name.
Sourcepub fn inductive_num_params(&self) -> Option<usize>
pub fn inductive_num_params(&self) -> Option<usize>
For inductives, return the number of parameters.
Sourcepub fn inductive_num_indices(&self) -> Option<usize>
pub fn inductive_num_indices(&self) -> Option<usize>
For inductives, return the number of indices.
Sourcepub fn inductive_constructors(&self) -> Option<&[Name]>
pub fn inductive_constructors(&self) -> Option<&[Name]>
For inductives, return the list of constructor names.
Sourcepub fn ctor_num_fields(&self) -> Option<usize>
pub fn ctor_num_fields(&self) -> Option<usize>
For constructors, return the number of fields.
Sourcepub fn recursor_rules(&self) -> Option<&[RecursorRule]>
pub fn recursor_rules(&self) -> Option<&[RecursorRule]>
For recursors, return the recursor rules.
Sourcepub fn display_string(&self) -> String
pub fn display_string(&self) -> String
Return a display string for this constant.
Trait Implementations§
Source§impl Clone for ConstantInfo
impl Clone for ConstantInfo
Source§fn clone(&self) -> ConstantInfo
fn clone(&self) -> ConstantInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more