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
72
73
74
75
76
77
78
79
80
81
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2026, Marco Elver <me@marcoelver.com>
//! `vers3` — Explicit-State Model Checking Library
//!
//! # Quick start
//!
//! ```
//! use vers3::{TransitionSystem, invariant, rule, search::Bfs};
//!
//! // 1. Define your state (Clone + Hash + Eq + Display = State automatically).
//! #[derive(Clone, Hash, PartialEq, Eq, Debug)]
//! struct Counter(u32);
//! vers3::display_via_debug!(Counter);
//!
//! // 2. Build a transition system: guarded rules plus safety invariants.
//! let mut ts = TransitionSystem::new();
//! ts.add_rule(rule(
//! "increment",
//! |_: &Counter| true,
//! |s: &mut Counter| {
//! s.0 = (s.0 + 1) % 4; // wrap around: the state space is finite
//! true
//! },
//! ));
//! ts.add_property(invariant("bounded", |s: &Counter| s.0 < 4));
//!
//! // 3. Run BFS (ts is consumed, preventing reuse with stale property state).
//! let result = Bfs::new().run(vec![Counter(0)], ts);
//! match &result {
//! Ok(stats) => println!("No violations. {stats}"),
//! Err(cex) => vers3::report::print_counterexample(cex),
//! }
//! # assert_eq!(result.unwrap().states_visited, 4);
//! ```
/// Implement [`std::fmt::Display`] for a type by delegating to its [`std::fmt::Debug`] impl.
///
/// Useful for simple enums that `#[derive(Debug)]` and need no custom `Display`.
///
/// # Example
///
/// ```
/// #[derive(Debug)]
/// enum Color { Red, Green, Blue }
///
/// vers3::display_via_debug!(Color);
/// assert_eq!(format!("{}", Color::Red), "Red");
/// ```
// Compile the README's Rust examples as doctests.
;
pub use ;
pub use ;