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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//! # z3rs — a pure-Rust port of the Z3 theorem prover
//!
//! `z3rs` is a from-scratch reimplementation of
//! [Z3](https://github.com/Z3Prover/z3) (v4.17.0) in safe, idiomatic Rust.
//! The goal is a 1:1 behavioural port of 100% of Z3 with **no third-party or
//! native dependency** — no GMP, no C. The crate is `no_std` (needs only
//! `alloc`) by default; the optional `std` feature adds std-backed conveniences.
//! Its sole dependency is our own pure-Rust, dependency-free numeric core
//! [`puremp`], re-exported below and used directly throughout the port.
//!
//! This is a large, multi-phase effort. See [`ROADMAP.md`](../ROADMAP.md) for the
//! staged plan, and [`PORTING.md`](../PORTING.md) for the porting methodology and
//! differential-testing strategy against upstream Z3.
//!
//! ## Attribution
//!
//! z3rs is a derivative work of Z3, Copyright (c) Microsoft Corporation, used
//! under the MIT License. See [`LICENSE`](../LICENSE) and [`NOTICE`](../NOTICE).
//!
//! ## Architecture
//!
//! The module tree mirrors Z3's `src/` component layering. Modules are ordered
//! bottom-up by dependency (each layer only uses layers above it in this list):
//!
//! | Module | Phase | Upstream `z3/src/…` |
//! |-----------------|-------|-------------------------------------------------------|
//! | [`util`] | 0 | `util` (bignum, containers, symbols, params infra) |
//! | [`math`] | 1 | `math/*` (polynomial, interval, simplex, dd, lp, …) |
//! | [`ast`] | 1 | `ast` (terms, sorts, decls, theory decl_plugins) |
//! | [`params`] | 1 | `params` |
//! | [`rewriter`] | 2 | `ast/rewriter`, `ast/euf`, `ast/normal_forms`, … |
//! | [`model`] | 3 | `model` |
//! | [`tactic`] | 3 | `tactic` + tactic portfolio |
//! | [`sat`] | 4 | `sat`, `sat/smt` |
//! | [`nlsat`] | 5 | `nlsat`, `math/realclosure` |
//! | [`smt`] | 5 | `smt` (core SMT engine) |
//! | [`solver`] | 6 | `solver` |
//! | [`cmd_context`] | 6 | `cmd_context`, `parsers/smt2` |
//! | [`qe`] | 7 | `qe`, `qe/mbp` |
//! | [`muz`] | 7 | `muz` (Datalog / Spacer / Horn) |
//! | [`opt`] | 7 | `opt` (MaxSAT / optimization) |
//! | [`parsers`] | 8 | `parsers` |
//! | [`api`] | 9 | `api` (C ABI + safe Rust surface) |
//!
//! Most modules are functional (see [`ROADMAP.md`](../ROADMAP.md) for live
//! phase status); a few upper-layer components remain documented scaffolds.
// `no_std` by default; `alloc` is always required. `std` (feature) or `test`
// builds pull in the standard library.
// Keep the dependency-free, safety-first posture visible and enforced.
// expected while modules are scaffolds
// Established now so the `no_std` posture holds from the start; used as modules land.
extern crate alloc;
/// The arbitrary-precision numeric core, re-exported so consumers of z3rs's API
/// get the numeral types (`puremp::Int`, `puremp::Rational`, `puremp::Float`)
/// without adding their own dependency. z3rs uses these types directly — there
/// is no wrapper layer.
pub use puremp;
// --- Phase 0: foundation ---
// --- Phase 1: math + AST ---
// --- Phase 2: rewriting / simplification ---
// --- Phase 3: models + tactics ---
// --- Phase 4: SAT ---
// --- Phase 5: nonlinear SAT + core SMT ---
// --- Phase 6: solver abstraction + command context ---
// --- Phase 7: quantifier elimination, fixedpoint, optimization ---
// --- Phase 8: parsers ---
// --- Phase 9: public API ---
// The C ABI (opt-in via the `ffi` feature); the only module that uses `unsafe`.
/// The upstream Z3 version this port tracks.
pub const Z3_UPSTREAM_VERSION: &str = "4.17.0";
/// z3rs crate version.
pub const VERSION: &str = env!;