Skip to main content

RunHost

Struct RunHost 

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

A model-checking run’s Host.

Implementations§

Source§

impl RunHost

Source

pub fn new(streams: Streams, config: Option<RunConfig>) -> Self

A host drawing from streams (start-up stream first) and reporting config for TLCGet("config"). No level and no counter is set.

Source

pub fn with_inputs(self, inputs: Arc<dyn InputSource>) -> Self

Installs explicit external input ownership before binding starts.

Source

pub fn streams(&self) -> Streams

The run’s streams.

Source

pub fn restart(&self)

Restarts the start-up stream (trace reconstruction regenerates the initial states from a fresh one, as TLC does).

Source

pub fn expand(&self, fp: u64)

Switches to the stream of the state with fingerprint fp, before the state is expanded (RandomEnumerableValues’ per-state reseeding).

Source

pub fn stream(&self) -> Stream

The current stream, at its current position.

Source

pub fn set_stream(&self, stream: Stream)

Continues from stream (a snapshot taken with RunHost::stream).

Source

pub fn skip(&self, words: u64)

Advances the current stream by words generator steps, as that many draws of one word each would (one java.util.Random.next call, or one counter step of dive’s stream). The trace validator uses it to look for a check’s draws later in a stream.

Source

pub fn set_level(&self, level: i64)

The level TLCGet("level") reports from now on (TLC’s s0.getLevel()).

Source

pub fn clear_level(&self)

Stops providing TLCGet("level"), restoring the state before the engine supplied a level. Other host capabilities are unchanged.

use dive_eval::Host;
use dive_stdlib::{host::RunHost, random::{RandomMode, Streams}};
let host = RunHost::new(Streams::new(0, RandomMode::Dive), None);
host.set_level(3);
host.clear_level();
assert_eq!(host.level(), None);
Source

pub fn set_counter(&self, c: Counter, value: Option<i64>)

Sets a live counter (None: not provided, so reading it is refused).

Source

pub fn set_config(&self, config: Option<RunConfig>)

Sets what TLCGet("config") reports.

Source

pub fn exit_requested(&self) -> bool

Whether the specification asked to stop (TLCSet("exit", TRUE)).

Trait Implementations§

Source§

impl Debug for RunHost

Source§

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

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

impl Host for RunHost

Source§

fn input( &self, request: &InputRequest, ) -> Option<Result<InputResponse, HostError>>

Supplies raw external inputs after explicit evaluator category admission. No implementation is supplied by default; independent replay hosts must consume an explicit recorded context and never read the operating system.
Source§

fn random( &self, op: StdOp, args: &[Value], ctx: Ctx, ) -> Option<Result<Value, HostError>>

Applies a random operator (RandomElement, RandomSubset, RandomSetOfSubsets) to its evaluated arguments, drawing from the stream of the current evaluation: TLC’s start-up stream during constant definitions, ASSUMEs and Init, and the stream reseeded from the expanded state’s fingerprint while expanding a state. None when the host has no stream.
Source§

fn level(&self) -> Option<i64>

TLCGet("level") outside ASSUME and Init: the level of TLC’s s0, the state being expanded in the next-state relation and action checks, the successor in invariants and constraints (initial states are level 1).
Source§

fn counter(&self, c: Counter) -> Option<i64>

A live counter.
Source§

fn config(&self) -> Option<RunConfig>

TLCGet("config").
Source§

fn request_exit(&self) -> bool

TLCSet("exit", TRUE): ends the run as a success once the current state is done (ModelChecker.stop). Returns whether the host acts on it.
Source§

fn check_native_access(&self, _op: StdOp) -> Result<(), HostError>

Checks a native operation at runtime, before its arguments or body run. Ordinary evaluators permit it; an isolated driver may remember a refusal even if startup binding later catches the evaluation error. Read more
Source§

fn print_output(&self, _text: &str) -> Result<bool, HostError>

Checks a rendered Print/PrintT event before any output sink is called. Arguments and rendering have already been evaluated. false preserves the operator’s return value while discarding replay output; true emits the event. Ordinary hosts keep the existing output behavior. Read more
Source§

fn check_tlc_access(&self, _key: &str, _write: bool) -> Result<(), HostError>

Checks a string TLCGet/TLCSet key before accessing host state. Read more
Source§

fn check_random_in_enabled(&self) -> Result<(), HostError>

Checks a random operation reached inside an ENABLED query, before evaluating its arguments. Ordinary hosts retain TLC’s behavior. Isolated sampling/replay hosts may refuse until they can prove the query’s full random support, including a negative existential result. Read more
Source§

fn check_register_access(&self) -> Result<(), HostError>

Checks whether this run permits access to the evaluator’s register file. Called before integer/named TLCGet reads, aggregate register reads ("all", "all:named"), and integer/named TLCSet writes. Other introspection keys do not call this method. The default permits access, preserving ordinary evaluator and checker behavior. Read more
Source§

fn check_action_composition(&self) -> Result<(), HostError>

Checks whether expression evaluation or successor generation may search intermediate states to decide unrestricted action composition. Independent replay refuses this; its explicit bounded capability is checked separately. Read more
Source§

fn requires_bounded_action_composition(&self) -> bool

Selects the evaluator’s bounded, pure TLA+ composition path. Read more
Source§

fn check_bounded_action_composition(&self) -> Result<(), HostError>

Checks the host’s permission for an inspected bounded composition. Existing host refusals still apply unless the host explicitly admits this slice. This is called before collecting any intermediate states. Read more
Source§

fn expression_cache_domain(&self) -> u64

The cache domain that lazy expression results computed under this host belong to. A cached result is reused only by evaluation under a host of the same domain. Ordinary drivers share domain 0 (TLC’s single LazyValue cache). Independent replay gives each run its own domain, so a value cached by another consumer never becomes replay’s answer and a replay verdict does not depend on how warm the caches were.
Source§

fn successor_level(&self) -> Result<i64, HostError>

TLCGet("level") under a prime. TLC evaluates a primed expression with the successor as its current state, so it reads the successor’s level, which Self::level does not describe. No host tracks it, so the default refuses by name; a host may remember the refusal so that a verdict built around a swallowed error is refused too. Read more

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, !>

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.