1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! `dive-store`: state storage for the model checker. It provides the
//! state fingerprint and the exact-store key, the disk-backed seen-state set, the
//! ordered frontier spill and the predecessor log Core's search uses.
//!
//! The crate depends on no other dive crate except `dive-value`, and has no
//! `unsafe` code.
//!
//! # Overview
//!
//! - [`state`]: the state fingerprint (dive's two-level fingerprint in the default
//! profile, cached FP64 value fingerprints combined by a non-linear mixer chain;
//! TLC's own, in TLC's variable order, under `--compat=tlc`) and the canonical
//! exact-store key.
//! - [`StoreMode`]: whether two states are the same by fingerprint or by
//! canonical key.
//! - [`seen`]: the disk-backed seen-state set (`--seen disk`).
//! - [`spill`]: the ordered, disk-spilled frontier.
//! - [`predecessor`]: parent pointers and successor ordinals for counterexample
//! replay, in memory or on disk.
//! - [`trace`]: the state ids and path steps the predecessor log returns.
//!
//! # Fingerprints and keys
//!
//! ```
//! use dive_store::state::{StateFingerprinter, state_key};
//! use dive_value::{Ctx, Int, Value};
//!
//! let ctx = Ctx::tlc();
//! let fp = StateFingerprinter::new(0).ok_or("polynomial 0")?;
//! // `1..3` and `{3, 2, 1}` are one state, whatever their representation.
//! let a = [Value::interval(Int::from(1), Int::from(3), ctx)];
//! let b = [Value::set(vec![Value::Int(3), Value::Int(2), Value::Int(1)], ctx)?];
//! assert_eq!(fp.fingerprint(&a, ctx)?, fp.fingerprint(&b, ctx)?);
//! let (mut ka, mut kb) = (Vec::new(), Vec::new());
//! state_key(&a, ctx, &mut ka)?;
//! state_key(&b, ctx, &mut kb)?;
//! assert_eq!(ka, kb);
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
pub use StoreError;
/// How a store decides that two states are the same.