Enum formality_core::variable::CoreVariable
source · pub enum CoreVariable<L: Language> {
UniversalVar(CoreUniversalVar<L>),
ExistentialVar(CoreExistentialVar<L>),
BoundVar(CoreBoundVar<L>),
}
Expand description
A term representing a variable.
Variants§
UniversalVar(CoreUniversalVar<L>)
A “universal free variable” is a variable that appears free in all terms because it is bound in the environment. Universal means that it arose from a “forall” binder. Universal variables are a kind of placeholder meant to represent “some value” about which you know nothing except what you are told to assume.
ExistentialVar(CoreExistentialVar<L>)
An “existential free variable” is a variable that appears free in all terms because it is bound in the environment. Existential means that it arose from a “exists” binder. Existential variables are a kind of placeholder for which you will eventually find some specific value, so the rules typically accumulate constraints.
BoundVar(CoreBoundVar<L>)
A bound variable is one that is bound by some enclosing Binder
in this term (or a binder about to be constructex; see fresh_bound_var
).
Implementations§
source§impl<L: Language> CoreVariable<L>
impl<L: Language> CoreVariable<L>
pub fn kind(&self) -> CoreKind<L>
sourcepub fn shift_in(&self) -> Self
pub fn shift_in(&self) -> Self
Shift a variable in through binders
binding levels.
Only affects bound variables.
sourcepub fn shift_out(&self) -> Option<Self>
pub fn shift_out(&self) -> Option<Self>
Shift a variable out through binders
binding levels.
Only affects bound variables. Returns None if the variable
is bound within those binding levels.
sourcepub fn is_free(&self) -> bool
pub fn is_free(&self) -> bool
A variable is free (i.e., not bound by any internal binder)
if it is an existential variable, a universal, or has a debruijn
index of None
. The latter occurs when you open
a binder (and before
you close it back up again).
pub fn is_universal(&self) -> bool
Trait Implementations§
source§impl<L: Clone + Language> Clone for CoreVariable<L>
impl<L: Clone + Language> Clone for CoreVariable<L>
source§fn clone(&self) -> CoreVariable<L>
fn clone(&self) -> CoreVariable<L>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<L: Language> CoreVisit<L> for CoreVariable<L>
impl<L: Language> CoreVisit<L> for CoreVariable<L>
source§fn free_variables(&self) -> Vec<CoreVariable<L>>
fn free_variables(&self) -> Vec<CoreVariable<L>>
Variable::is_free
).
The list may contain duplicates and must be in a determinstic order (though the order itself isn’t important).source§fn size(&self) -> usize
fn size(&self) -> usize
source§fn assert_valid(&self)
fn assert_valid(&self)
source§fn references_only_universal_variables(&self) -> bool
fn references_only_universal_variables(&self) -> bool
source§impl<L: Language> Debug for CoreVariable<L>
impl<L: Language> Debug for CoreVariable<L>
source§impl<L: Language> DowncastTo<CoreBoundVar<L>> for CoreVariable<L>
impl<L: Language> DowncastTo<CoreBoundVar<L>> for CoreVariable<L>
fn downcast_to(&self) -> Option<CoreBoundVar<L>>
source§impl<L: Language> DowncastTo<CoreExistentialVar<L>> for CoreVariable<L>
impl<L: Language> DowncastTo<CoreExistentialVar<L>> for CoreVariable<L>
fn downcast_to(&self) -> Option<CoreExistentialVar<L>>
source§impl<L: Language> DowncastTo<CoreUniversalVar<L>> for CoreVariable<L>
impl<L: Language> DowncastTo<CoreUniversalVar<L>> for CoreVariable<L>
fn downcast_to(&self) -> Option<CoreUniversalVar<L>>
source§impl<L: Language> DowncastTo<CoreVariable<L>> for CoreVariable<L>
impl<L: Language> DowncastTo<CoreVariable<L>> for CoreVariable<L>
fn downcast_to(&self) -> Option<CoreVariable<L>>
source§impl<L: Language> Index<CoreVariable<L>> for CoreSubstitution<L>
impl<L: Language> Index<CoreVariable<L>> for CoreSubstitution<L>
source§impl<L: Ord + Language> Ord for CoreVariable<L>
impl<L: Ord + Language> Ord for CoreVariable<L>
source§fn cmp(&self, other: &CoreVariable<L>) -> Ordering
fn cmp(&self, other: &CoreVariable<L>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<L: PartialEq + Language> PartialEq for CoreVariable<L>
impl<L: PartialEq + Language> PartialEq for CoreVariable<L>
source§fn eq(&self, other: &CoreVariable<L>) -> bool
fn eq(&self, other: &CoreVariable<L>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<L: PartialOrd + Language> PartialOrd for CoreVariable<L>
impl<L: PartialOrd + Language> PartialOrd for CoreVariable<L>
source§fn partial_cmp(&self, other: &CoreVariable<L>) -> Option<Ordering>
fn partial_cmp(&self, other: &CoreVariable<L>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more