pub struct RecursorBuilder {
pub name: Name,
pub univ_params: Vec<Name>,
pub num_params: u32,
pub num_indices: u32,
pub num_motives: u32,
pub num_minor_premises: u32,
pub rules: Vec<RecursorRule>,
pub is_prop: bool,
}Expand description
A builder for constructing recursor definitions programmatically.
Recursors (eliminators) are the fundamental way to consume inductive types. This builder provides a fluent API for constructing them.
Fields§
§name: NameName of the recursor (typically T.rec or T.recOn).
univ_params: Vec<Name>Universe parameters.
num_params: u32Number of type parameters.
num_indices: u32Number of indices.
num_motives: u32Number of motives (typically 1).
num_minor_premises: u32Number of minor premises (one per constructor).
rules: Vec<RecursorRule>Recursor rules (one per constructor).
is_prop: boolWhether the recursor targets Prop.
Implementations§
Source§impl RecursorBuilder
impl RecursorBuilder
Sourcepub fn univ_params(self, params: Vec<Name>) -> Self
pub fn univ_params(self, params: Vec<Name>) -> Self
Set universe parameters.
Sourcepub fn num_params(self, n: u32) -> Self
pub fn num_params(self, n: u32) -> Self
Set the number of parameters.
Sourcepub fn num_indices(self, n: u32) -> Self
pub fn num_indices(self, n: u32) -> Self
Set the number of indices.
Sourcepub fn add_rule(self, rule: RecursorRule) -> Self
pub fn add_rule(self, rule: RecursorRule) -> Self
Add a recursor rule.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate the builder state.
Returns Ok(()) if the builder is consistent.
Sourcepub fn build_name(&self) -> Name
pub fn build_name(&self) -> Name
Return the name of the recursor.
Sourcepub fn build(&self, ty: Expr, all: Vec<Name>) -> Result<RecursorVal, String>
pub fn build(&self, ty: Expr, all: Vec<Name>) -> Result<RecursorVal, String>
Build a complete RecursorVal from the builder state.
ty is the type of the recursor (must be supplied by the caller since
this builder does not reconstruct the Pi telescope).
all is the list of inductive type names in the mutual family.
Trait Implementations§
Source§impl Clone for RecursorBuilder
impl Clone for RecursorBuilder
Source§fn clone(&self) -> RecursorBuilder
fn clone(&self) -> RecursorBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more