[][src]Struct kontroli::rc::state::State

pub struct State<'s> {
    pub ctx: Context<'s>,
    pub term: RTerm<'s>,
    pub stack: Stack<'s>,
}

An abstract machine representing arguments applied to a substituted term.

This representation allows for the lazy evaluation of terms.

See section 5.1 of the following reference: Asperti, A.; Ricciotti, W.; Sacerdoti Coen, C.; Tassi, E. (2009). "A compact kernel for the calculus of inductive constructions". Sadhana. 34: 71–144. doi: 10.1007/s12046-009-0003-3.

Fields

ctx: Context<'s>term: RTerm<'s>stack: Stack<'s>

Implementations

impl<'s> State<'s>[src]

pub fn whnf(self, sig: &Signature<'s>) -> Self[src]

Evaluate the state to its weak head normal form.

let sig = Signature::new();
let syms = Symbols::new();

let term = Term::from(STerm::parse(r"(x => x) (x => x).", &syms)?);
let whnf = State::new(RTerm::new(term)).whnf(&sig);

let expected = Term::from(STerm::parse(r"(x => x).", &syms)?);
assert!(whnf.ctx.is_empty());
assert!(whnf.stack.is_empty());
assert_eq!(*whnf.term, expected);

impl<'s> State<'s>[src]

pub fn new(term: RTerm<'s>) -> Self[src]

Construct a new state from a reference to a term.

This does not yet evaluate anything, as can be seen from following example:

let syms = Symbols::new();

let term = Term::from(STerm::parse(r"(x => x) (x => x).", &syms)?);
let rterm = RTerm::new(term);

let state = State::new(rterm.clone());
assert!(RTerm::ptr_eq(&RTerm::from(state), &rterm));

Trait Implementations

impl<'s> Clone for State<'s>[src]

impl<'s> Default for State<'s>[src]

impl<'s> From<State<'s>> for RTerm<'s>[src]

Auto Trait Implementations

impl<'s> !RefUnwindSafe for State<'s>

impl<'s> !Send for State<'s>

impl<'s> !Sync for State<'s>

impl<'s> Unpin for State<'s>

impl<'s> !UnwindSafe for State<'s>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.