Skip to main content

Streams

Struct Streams 

Source
pub struct Streams { /* private fields */ }
Expand description

The run’s seed and seeding: hands out the random stream for each evaluation.

Model checking (TLC’s RandomEnumerableValues, TLCStateRandom):

  • Streams::startup is one stream, used in order by the constant definitions TLC evaluates at start-up, the ASSUMEs, and the initial predicate, including invariants checked on initial states. In TLC this is the main thread’s generator: new Random(seed), never reseeded.
  • Streams::state is the stream for everything evaluated while expanding one state: its next-state relation (all actions, in order), and the checks on the successors. TLC reseeds the worker’s generator to fingerprint(state) ^ seed on the first draw for each newly expanded state, and keeps drawing from it for the rest of that expansion.
  • Trace reconstruction replays with the same streams: Streams::startup for the initial states, then Streams::state per predecessor (TLC resets the generator, ConcurrentTLCTrace.getTrace). In TLC the reset stream does not replay draws made by start-up definitions and ASSUMEs before Init, so a violation that depends on them can lose its counterexample.

Simulation (TLC’s Simulator, SimulationWorker, DefaultRandom):

In RandomMode::Dive, Streams::simulation_trace replaces both per-worker generators with one stream per trace number, so traces are reproducible whatever worker runs them.

Implementations§

Source§

impl Streams

Source

pub const fn new(seed: i64, mode: RandomMode) -> Self

The streams of a run with seed (always reported) in mode.

Source

pub const fn seed(&self) -> i64

The run’s seed, as reported (TLCGet("config").seed).

Source

pub const fn mode(&self) -> RandomMode

The seeding mode.

Source

pub const fn startup(&self) -> Stream

The start-up stream: constant definitions, ASSUMEs and Init, in TLC’s evaluation order.

Source

pub const fn state(&self, fp: u64) -> Stream

The stream for expanding the state with fingerprint fp: under RandomMode::Tlc TLC’s state fingerprint (TLCState.fingerPrint), seeding new Random(fp ^ seed) (RandomEnumerableValues.TLCStateRandom).

Source

pub fn tlc_simulation_worker_seeds(&self, aril: u64, workers: usize) -> Vec<i64>

TLC simulation: the seeds of the workers simulation workers’ generators, rng.nextLong() each in worker order after rng.setSeed(seed, aril) (TLC.process, Simulator constructor). With TLC’s default (no -seed) the seed itself came from an unseeded generator and aril is ignored; pass 0.

Source

pub const fn tlc_simulation_values(&self) -> JavaRandom

TLC simulation: a worker thread’s generator for RandomElement and the Randomization operators (RandomEnumerableValues.DefaultRandom).

Source

pub const fn simulation_trace(&self, trace: u64) -> Stream

dive simulation: the single stream of trace number trace (0-based, in the order traces are numbered, not the order workers finish them). It drives the choice of initial state, actions and successors, and the operators’ draws.

Trait Implementations§

Source§

impl Clone for Streams

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Streams

Source§

impl Debug for Streams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Streams

Source§

impl Hash for Streams

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Streams

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Streams

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, !>

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.