pub struct InductiveType {
pub name: Name,
pub univ_params: Vec<Name>,
pub num_params: u32,
pub num_indices: u32,
pub ty: Expr,
pub intro_rules: Vec<IntroRule>,
pub recursor: Name,
pub is_nested: bool,
pub is_prop: bool,
}Expand description
An inductive type declaration.
Fields§
§name: NameType name
univ_params: Vec<Name>Universe parameters
num_params: u32Number of parameters (non-varying arguments)
num_indices: u32Number of indices (varying arguments)
ty: ExprType of the inductive type (Pi type over params and indices)
intro_rules: Vec<IntroRule>Introduction rules (constructors)
recursor: NameRecursor name (generated automatically)
is_nested: boolWhether this is a nested inductive type
is_prop: boolWhether this type is in Prop (proof-irrelevant)
Implementations§
Source§impl InductiveType
impl InductiveType
Sourcepub fn new(
name: Name,
univ_params: Vec<Name>,
num_params: u32,
num_indices: u32,
ty: Expr,
intro_rules: Vec<IntroRule>,
) -> Self
pub fn new( name: Name, univ_params: Vec<Name>, num_params: u32, num_indices: u32, ty: Expr, intro_rules: Vec<IntroRule>, ) -> Self
Create a new inductive type.
Sourcepub fn is_recursive(&self) -> bool
pub fn is_recursive(&self) -> bool
Check if this inductive type is recursive.
Sourcepub fn constructor_names(&self) -> Vec<&Name>
pub fn constructor_names(&self) -> Vec<&Name>
Return a vector of references to constructor names.
Sourcepub fn num_constructors(&self) -> usize
pub fn num_constructors(&self) -> usize
Return the number of constructors.
Sourcepub fn to_constant_infos(
&self,
) -> Result<(ConstantInfo, Vec<ConstantInfo>, ConstantInfo), KernelError>
pub fn to_constant_infos( &self, ) -> Result<(ConstantInfo, Vec<ConstantInfo>, ConstantInfo), KernelError>
Generate ConstantInfo declarations for this inductive type.
Returns: (InductiveVal, Vec<ConstructorVal>, RecursorVal).
The recursor is derived by the kernel derivation machinery
(crate::inductive::derive) following Lean 4’s inductive.cpp:
minor premises carry induction hypotheses, the elimination universe
and K flag are computed from the declared type (the caller-supplied
is_prop flag is ignored), and rule right-hand sides are closed
lambdas over params ++ motives ++ minors ++ fields.
This environment-free path performs no positivity or universe
checking; use crate::inductive::derive::add_inductive_family for
the checked path.