Skip to main content

BacktrackingTraversal

Struct BacktrackingTraversal 

Source
pub struct BacktrackingTraversal {
    pub branch_factor: u64,
    pub max_depth: usize,
    pub init_aux: u64,
    pub path: Vec<u64>,
    pub aux: u64,
    pub ledger: Vec<UndoToken>,
    pub visited: Vec<Vec<u64>>,
}
Expand description

Reversible depth-first traversal owner.

Fields§

§branch_factor: u64

Number of admitted choices at each non-leaf depth.

§max_depth: usize

Required depth of a complete leaf path.

§init_aux: u64

Auxiliary value at the root.

§path: Vec<u64>

Current branch-choice path.

§aux: u64

Current auxiliary value.

§ledger: Vec<UndoToken>

Undo tokens aligned with the current path.

§visited: Vec<Vec<u64>>

A Vec is the executable representation of the TLA+ visited set; visited_unique and Visit’s freshness guard preserve set semantics.

Implementations§

Source§

impl BacktrackingTraversal

Source

pub fn mutate_exec(v: u64, d: u64) -> u64

Apply the modulo-three auxiliary mutation.

Source

pub fn undo_exec(v: u64, d: u64) -> u64

Apply the inverse modulo-three auxiliary mutation.

Source

pub fn new( branch_factor: u64, max_depth: usize, init_aux: u64, ) -> BacktrackingTraversal

Construct a traversal at its root with an empty visited set.

Source

pub fn is_leaf_exec(&self) -> bool

Whether the current path has reached the configured leaf depth.

Source

pub fn can_descend(&self, c: u64, d: u64) -> bool

Whether a choice and mutation delta enable another descent.

Source

pub fn can_ascend(&self) -> bool

Whether an undo token is available for ascent.

Source

pub fn has_visited(&self, p: &Vec<u64>) -> bool

Whether a path occurs in the visited-leaf ledger.

Source

pub fn can_visit(&self) -> bool

Whether the current path is a fresh leaf that may be visited.

Source

pub fn descend(&mut self, c: u64, d: u64)

Descend(c,d): record the undo token and apply its mutation atomically.

Source

pub fn visit(&mut self)

Visit: append the current leaf only when it is fresh.

Source

pub fn ascend(&mut self)

Ascend: apply the recorded inverse, then pop token and path.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.