pub struct InductiveFamily {
pub types: Vec<InductiveType>,
pub univ_params: Vec<Name>,
}Expand description
A mutually inductive family of types.
Lean 4 supports mutual induction (e.g., Even and Odd defined together).
This struct holds a group of inductive types that are checked together.
Fields§
§types: Vec<InductiveType>The inductive types in the family.
univ_params: Vec<Name>Shared universe parameters.
Implementations§
Source§impl InductiveFamily
impl InductiveFamily
Sourcepub fn singleton(ty: InductiveType) -> Self
pub fn singleton(ty: InductiveType) -> Self
Create a single-type family.
Sourcepub fn new(types: Vec<InductiveType>, univ_params: Vec<Name>) -> Self
pub fn new(types: Vec<InductiveType>, univ_params: Vec<Name>) -> Self
Create a mutually inductive family.
Sourcepub fn is_singleton(&self) -> bool
pub fn is_singleton(&self) -> bool
Whether the family contains a single type.
Sourcepub fn type_names(&self) -> Vec<&Name>
pub fn type_names(&self) -> Vec<&Name>
All type names in the family.
Sourcepub fn all_constructor_names(&self) -> Vec<&Name>
pub fn all_constructor_names(&self) -> Vec<&Name>
All constructor names across all types.
Sourcepub fn find_type(&self, name: &Name) -> Option<&InductiveType>
pub fn find_type(&self, name: &Name) -> Option<&InductiveType>
Find a type by name.
Sourcepub fn total_constructors(&self) -> usize
pub fn total_constructors(&self) -> usize
Total number of constructors across all types.
Trait Implementations§
Source§impl Clone for InductiveFamily
impl Clone for InductiveFamily
Source§fn clone(&self) -> InductiveFamily
fn clone(&self) -> InductiveFamily
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InductiveFamily
impl RefUnwindSafe for InductiveFamily
impl Send for InductiveFamily
impl Sync for InductiveFamily
impl Unpin for InductiveFamily
impl UnsafeUnpin for InductiveFamily
impl UnwindSafe for InductiveFamily
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more