Expand description
dive-core: Core, dive’s compiled execution core for explicit-state
model checking.
Core turns a bound specification into a Plan and evaluates it over
compact value handles instead of tree-walking the IR. compile() takes
dive_ir plus the binder’s Handoff (constants, roles and the
definitions left to evaluate) and compiles every value expression and
every action into flat node arrays. A Machine interprets those nodes
over a Heap: persistent values live in a hash-consed, sharded
Store shared by all workers, and each worker builds intermediate
values in its own transient arena, released once a state is accepted.
Successor generation follows TLC’s getNextStates rules and hands each
initial state and successor to a Sink; the exploration engine in
dive-explore provides that sink and does the searching, storing and
checking.
Core serves both profiles, dive’s default and --compat=tlc: it keeps
TLC’s evaluation order and error classes, supports either integer mode
and either value order, and implements SYMMETRY reduction. Anything it
does not implement exactly is refused before or during the run with an
unsupported result naming the construct, never approximated.
handle: 64-bit tagged value words.store: the hash-consed, sharded persistent store.arena: the per-worker transient arena with epochs.heap: hashing, equality, order, builders and interning.int: integers of any size, in both integer modes.compile: the plan compiler fromdive_irplus the binder handoff.eval: the interpreter for value nodes.generate: TLC’s successor-generation rules.memo: keyed result caches.opts: strategy switches for ablation.
§Example
use std::sync::Arc;
use dive_core::{Handle, Heap, Store};
let store = Arc::new(Store::default());
let mut heap = Heap::new(store, false, false);
let one = Handle::int(1).unwrap();
let two = Handle::int(2).unwrap();
let a = heap.set_from(&mut vec![two, one]);
let b = heap.set_from(&mut vec![one, two, one]);
assert!(heap.eq(a, b));
let (pa, pb) = (heap.intern(a).unwrap(), heap.intern(b).unwrap());
assert_eq!(pa, pb); // hash-consedRe-exports§
pub use compile::Handoff;pub use compile::Role;pub use compile::compile;pub use eval::Machine;pub use generate::Sink;pub use handle::Handle;pub use heap::Heap;pub use opts::Opts;pub use plan::Plan;pub use store::Semantics;pub use store::Store;
Modules§
- arena
- The per-worker transient arena.
- candidate_
codec - Owned, bounded candidate DAG records tied to one live Store.
- compile
- The plan compiler:
dive_irplus the binder handoff to aPlan. - convert
- The binder boundary: converts startup values of
dive-model’s binder (dive_value::Value) to persistent handles. - debug
- Opt-in maps and observation of actual compiled instruction activations.
- eval
- The interpreter for value nodes: a recursive
matchover the plan’s node array, over one flat frame per activation. - frontier_
codec - Same-process frontier rows tied to one retained, append-only
Store. - generate
- Successor and initial-state generation with TLC’s
getNextStatesrules. - handle
- Handles: 64-bit tagged value words.
- heap
- Value operations over both regions: views, hashing, equality, the canonical order, builders, materialization of symbolic sets, and interning by deep close.
- int
- Integers of any size (big integers are the default profile’s mode).
- key
- Bounded mathematical keys for closed canonical state rows.
- memo
- Keyed result caches for pure bodies.
- node
- Compound node kinds and the uniform view over both regions
(
03-value-model.md§4). - opts
- Strategy switches for ablation.
- owned_
exchange - Bounded owned DAG exchange for identity-checked trusted worker sessions.
- plan
- The compiled plan: compact node arrays indexed by
u32, not boxed trees. - Printing core values as TLC prints them (
ToString,Print,PrintT). - random
- Random draws (
TLC!RandomElement): the run’s streams, which the engine supplies. - stdlib
- Standard and CommunityModules operators of the core, by TLC’s override
table (
dive_ir::StdOp). - store
- The persistent, hash-consed, sharded store.
- strings
- The global, append-only string table.
- symmetry
- Symmetry reduction (
SYMMETRY): the state key of a state is the key of its canonical image, the least of its images under the closure’s permutations of model values, compared variable by variable in the run’s value order. The explored state stays the concrete one; only keys change, as indive-model’s symmetry reduction (Reduction::canonical_values).
Structs§
- Error
- An error of the core. Boxed, so that
Result<Handle, Error>is two words and returns in registers on the interpreter’s hot path. - Error
Data - The contents of an
Error. - TlcClass
- How TLC raises an evaluation error: its
ECcode and whether it is anEvalException(which a Java override passes through, and which the checker reports with its own code) or anAssert.fail. The site rules stay with the engine.