pub struct Environment { /* private fields */ }Expand description
The global environment containing all checked declarations.
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn add(&mut self, decl: Declaration) -> Result<(), EnvError>
pub fn add(&mut self, decl: Declaration) -> Result<(), EnvError>
Add a legacy declaration to the environment.
Returns an error if a declaration with the same name already exists.
Sourcepub fn add_constant(&mut self, ci: ConstantInfo) -> Result<(), EnvError>
pub fn add_constant(&mut self, ci: ConstantInfo) -> Result<(), EnvError>
Add a ConstantInfo to the environment.
Sourcepub fn get(&self, name: &Name) -> Option<&Declaration>
pub fn get(&self, name: &Name) -> Option<&Declaration>
Look up a legacy declaration by name.
Sourcepub fn find(&self, name: &Name) -> Option<&ConstantInfo>
pub fn find(&self, name: &Name) -> Option<&ConstantInfo>
Look up a constant info by name.
Sourcepub fn get_defn(&self, name: &Name) -> Option<(Expr, ReducibilityHint)>
pub fn get_defn(&self, name: &Name) -> Option<(Expr, ReducibilityHint)>
Get a definition’s value and hint (for reduction).
Sourcepub fn is_inductive(&self, name: &Name) -> bool
pub fn is_inductive(&self, name: &Name) -> bool
Check if a name refers to an inductive type.
Sourcepub fn is_constructor(&self, name: &Name) -> bool
pub fn is_constructor(&self, name: &Name) -> bool
Check if a name refers to a constructor.
Sourcepub fn is_recursor(&self, name: &Name) -> bool
pub fn is_recursor(&self, name: &Name) -> bool
Check if a name refers to a recursor.
Sourcepub fn is_quotient(&self, name: &Name) -> bool
pub fn is_quotient(&self, name: &Name) -> bool
Check if a name refers to a quotient.
Sourcepub fn is_structure_like(&self, name: &Name) -> bool
pub fn is_structure_like(&self, name: &Name) -> bool
Check if a name refers to a structure-like inductive.
Sourcepub fn get_inductive_val(&self, name: &Name) -> Option<&InductiveVal>
pub fn get_inductive_val(&self, name: &Name) -> Option<&InductiveVal>
Get the inductive type info for a name.
Sourcepub fn get_constructor_val(&self, name: &Name) -> Option<&ConstructorVal>
pub fn get_constructor_val(&self, name: &Name) -> Option<&ConstructorVal>
Get the constructor info for a name.
Sourcepub fn get_recursor_val(&self, name: &Name) -> Option<&RecursorVal>
pub fn get_recursor_val(&self, name: &Name) -> Option<&RecursorVal>
Get the recursor info for a name.
Sourcepub fn get_quotient_val(&self, name: &Name) -> Option<&QuotVal>
pub fn get_quotient_val(&self, name: &Name) -> Option<&QuotVal>
Get the quotient info for a name.
Sourcepub fn get_type(&self, name: &Name) -> Option<&Expr>
pub fn get_type(&self, name: &Name) -> Option<&Expr>
Get the type of a constant (from ConstantInfo).
Sourcepub fn get_level_params(&self, name: &Name) -> Option<&[Name]>
pub fn get_level_params(&self, name: &Name) -> Option<&[Name]>
Get the universe level parameters for a constant.
Sourcepub fn instantiate_const_type(
&self,
name: &Name,
levels: &[Level],
) -> Option<Expr>
pub fn instantiate_const_type( &self, name: &Name, levels: &[Level], ) -> Option<Expr>
Instantiate a constant’s type with universe levels.
Sourcepub fn constant_names(&self) -> impl Iterator<Item = &Name>
pub fn constant_names(&self) -> impl Iterator<Item = &Name>
Iterate over all constant names.
Sourcepub fn constant_infos(&self) -> impl Iterator<Item = (&Name, &ConstantInfo)>
pub fn constant_infos(&self) -> impl Iterator<Item = (&Name, &ConstantInfo)>
Iterate over all constant infos.
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more