pub struct LinearTypeChecker;Expand description
A simple linearity checker that tracks variable usage counts. In linear typing, each variable must be used exactly once.
Implementations§
Source§impl LinearTypeChecker
impl LinearTypeChecker
Sourcepub fn count_uses(&self, term: &Term, depth: usize) -> UsageMap
pub fn count_uses(&self, term: &Term, depth: usize) -> UsageMap
Count free variable occurrences in term, relative to a context of depth variables.
Returns a vector of length depth with usage counts for each variable.
Sourcepub fn is_linear(&self, term: &Term, depth: usize) -> bool
pub fn is_linear(&self, term: &Term, depth: usize) -> bool
Check if term is linear in the context of depth variables.
Returns true iff every variable in the context is used exactly once.
Sourcepub fn is_affine(&self, term: &Term, depth: usize) -> bool
pub fn is_affine(&self, term: &Term, depth: usize) -> bool
Check if term is affine in the context of depth variables.
Returns true iff every variable in the context is used at most once.
Sourcepub fn is_relevant(&self, term: &Term, depth: usize) -> bool
pub fn is_relevant(&self, term: &Term, depth: usize) -> bool
Check if term is relevant in the context of depth variables.
Returns true iff every variable in the context is used at least once.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LinearTypeChecker
impl RefUnwindSafe for LinearTypeChecker
impl Send for LinearTypeChecker
impl Sync for LinearTypeChecker
impl Unpin for LinearTypeChecker
impl UnsafeUnpin for LinearTypeChecker
impl UnwindSafe for LinearTypeChecker
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