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).