Expand description
§Ordeal
ordeal (meaning “verdict / judgment”) is a specialized,
certificate-checked QF_BV SMT solver for the PulseEngine toolchain. It
exists to replace the Z3 static-link build pain that loom (verified WASM
optimizer) and synth (verified WASM→ARM codegen) carry today — grounding:
loom issue #246.
§Design in one paragraph
An untrusted solver emits a machine-checkable LRAT UNSAT
certificate; a small formally-verified checker validates it. Only the
checker is trusted (the CompCert certifying-algorithm pattern; blueprint =
Lean 4 bv_decide, OOPSLA 2025). Z3 is demoted to a differential oracle
and benchmark rival, not the production engine. The pipeline is: term
graph → bit-blast → AIG → CNF (Tseitin) → SAT → LRAT → verified checker.
§Modules
term— the closed QF_BV fragment (the exact loom #246 op set).lowering— blessed derived-op constructors (bvnot,bvneg,bvrotl,bvurem,bvsdiv,bvsrem) built over the closed core, for the ops synth-verify emits but the fragment omits (DES-018).solver— the one-shotcheck-satinterface and result types.eval— the concrete evaluator (executable SMT-LIB semantics; the test oracle for every blasting rule and the SAT-model self-check).aig— the And-Inverter Graph arena (structural hashing, folding).blast— per-op-family bit-blasting rules (term → AIG).cnf— CNF types and the Tseitin encoder (AIG → CNF).sat— the pure-Rust CDCL core (primary engine on every target).lrat— LRAT certificate emission from the CDCL proof trace; theordeal-lratcrate (the sole trusted component) validates it before anyUnsatis returned.- [
oracle] — the Z3 differential oracle (behind theoraclefeature). smtlib— a minimal QF_BV SMT-LIB2 reader for the standalone CLI / differential harness (not the production interface; that stays the API).
Re-exports§
pub use query::QueryCheckResult;pub use query::SliverCheckResult;pub use query::TermCheckResult;pub use solver::CheckResult;pub use solver::Solver;pub use term::BoolTerm;pub use term::BvTerm;pub use term::Sort;pub use witness::WitnessCheckResult;
Modules§
- aig
- And-Inverter Graph with structural hashing and constant folding (DES-002).
- blast
- Bit-blasting (DES-005..DES-009): the per-rule bridge to the Lean-proven rules — since issue #192 phase 3 a TEST harness, not the production path.
- canon
- Semantics-preserving canonicalization above the AIG (issue #35 / TR-009).
- cnf
- CNF representation and the Tseitin encoder (DES-003).
- echo
- The certified query echo in a certificate (#281 E2,
ordeal-cert/v5): re-exported from the solver-freeordeal-certcrate. The certified query echo av5bundle carries (#281 E2):EchoCertificate, printed and re-derived by the trusted printer. The certified query echo in a certificate (issue #281, phase E2): the SMT-LIB text the trusted printer (ordeal_lrat::echo_term/echo_ext, proven inlean/Echo.lean) makes of a bundle’stermorextblock, carried next to the certificate so a consumer can compare it with its own input (ordeal-cert/v5,crate::cert_bundle). - eval
- Concrete evaluator for the closed QF_BV fragment — the executable SMT-LIB semantics (DES-001).
- layout
- Byte-layout helpers (TR-021): split a bitvector into little-endian bytes and
reassemble it, as pure
extract/concatcompositions over the closed fragment — no new operations. - lowering
- The formerly derived ops: constructors and the core-fragment REWRITE (DES-018 / TR-015; proven DAG constructs since #192 phase 5, TR-064).
- lrat
- LRAT certificate emission from the CDCL proof trace (DES-013).
- mirror
- The copy of the caller’s trees into the kernel’s tree type (TR-073): the one trusted step of the term direction, a bijection. The copy of the caller’s trees into the kernel’s tree type (TR-073).
- query
- The certificate-carried query (#192 phase 4,
ordeal-cert/v2) — always compiled; the JSON envelope is incert_bundle. The certificate-carried query (issue #192 phase 4,ordeal-cert/v2): the term DAG the solver lowered, kept next to the certificate so that a consumer re-checks the QUERY, not a CNF it has to take on faith. - sat
- The pure-Rust CDCL SAT core (DES-004) — primary engine on every target.
- sha256
- In-tree SHA-256 for
ordeal-cert/v1content hashes (#162 / TR-045): integrity only, never part of the soundness argument. SHA-256 (FIPS 180-4), in-tree and dependency-free (#162 / TR-045). Since TR-075 the implementation lives in the solver-freeordeal-certcrate (ordeal_cert::sha256), re-exported here unchanged; the known-answer tests stay here. - sliver
- The loom array/UF sliver (P3) — an extended query layer that is preprocessed away into the closed QF_BV core before bit-blasting.
- smtlib
- A minimal QF_BV SMT-LIB2 front end (FEAT-006 / loom field-report #34).
- solver
- The one-shot solver interface and the P1 pipeline dispatcher (DES-012).
- term
- The
ordealterm language: the closed QF_BV fragment from loom issue #246. - trap
- WASM trap / partiality semantics (issue #59 / TR-019).
- verus
- Verus VC ingestion: lift
by (bit_vector)obligations out of a Verus SMT log so the obligation Verus actually checked is discharged with a re-checkable certificate (TR-023 / FEAT-009, issue #65). - witness
- The re-checkable SAT witness (TR-038) — always compiled.
The independently re-checkable SAT witness (TR-038 / #133). Since
TR-075 the witness type and its trusted recheck live in the
solver-free
ordeal-certcrate (ordeal_cert::witness), re-exported here unchanged; the solver’s verdict type stays.
Structs§
- Certificate
- A machine-checkable UNSAT certificate — a self-contained, portable proof object.
- Echo
Certificate - A term-carrying certificate together with the certified echo of its
question (#281 E2,
ordeal-cert/v5). - Model
- A satisfying assignment (counterexample) for a SAT query.
- Query
Certificate - A certificate together with the query it certifies (issue #192 phase
4): the v1 pair (
certificate.cnf,certificate.lrat) plus the loweredQueryDag.QueryCertificate::recheckis the stronger re-check: the trusted crate re-encodes the DAG itself and checks the proof against the CNF it produced, so an accepted re-check proves the DAG unsatisfiable —kernel.spec.check_query_sound. - Query
Dag - The lowered query: exactly the inputs the proven lowering (and the trusted re-check) consumes.
- Query
Echo - The
echoblock of anordeal-cert/v5bundle: the printed text and the logic its first line declares. - Query
Inputs - The DAG’s primary-input assignment a SAT verdict is re-checked with
(issue #192 phase 6, TR-065): what the trusted
ordeal_lrat::check_query_modelconsumes, plus the untrusted map from the model’s named variables to theVarnodes that read those bits. - Query
SatCertificate - A SAT witness together with the query it satisfies (issue #192 phase
6): the v1
SatCertificate(model, CNF, assignment, bit map) plus the loweredQueryDagand the DAG’s input assignment (QueryInputs).QuerySatCertificate::recheckis the stronger re-check: the trusted crate evaluates the DAG itself under the inputs (ordeal_lrat::check_query_model), so an accepted re-check proves the DAG satisfiable —kernel.spec.check_query_model_sound, in the same semanticscheck_query_soundnegates. The SAT twin ofQueryCertificate. - Query
Term - The term a
v3certificate is about (#192 phase 7): what the caller asserted, flattened, plus the untrusted index map from its nodes to the loweredQueryDag’s. The trustedordeal_lrat::check_term_dagverifies, node by node along the map, that the DAG is a semantics-preserving rewrite of this term — the two rewrites canonicalization makes (a commutative swap, a comparison mirror), a constant fold (evaluated by the proven encoder and simulator) and hash-consing (the map itself) — so a consumer that compares this block with its own query certifies the QUESTION, not the solver’s DAG. - SatCertificate
- An independently re-checkable SAT verdict — the SAT twin of
Certificate(TR-038 / #133, docs/design/sat-witness.md): the model, the CNF it satisfies, the FULL satisfying assignment (inputs and Tseitin auxiliaries), and the map from each model variable’s bits to signed CNF literals.SatCertificate::recheckre-establishes the verdict via the trustedordeal-lratcrate with zero solver trust: every clause is checked satisfied, and every advertised model binding is checked consistent with the assignment. - Sliver
Block - The
extblock of anordeal-cert/v4bundle (TR-072): the extended query as asked (ExtQuery) plus the untrusted map from its nodes to the lowered core’s (QueryTermwithTERM_ENCODING_V2) and the untrusted read and call tables — everythingordeal_lrat::check_sliver_loweringverifies. - Sliver
Certificate - An UNSAT certificate about an EXTENDED query (TR-072,
ordeal-cert/v4): the v3 term certificate about the lowered core, plus theextblock relating that core to the query as asked.SliverCertificate::recheckis the strongest re-check: the trusted crate relates the extended query to the core (check_sliver_lowering), the core to the DAG (check_term_dag) and refutes the DAG (check_query), so an accepted re-check proves the EXTENDED query unsatisfiable under every array and UF interpretation —kernel.spec.check_sliver_unsat_sound. - Sliver
SatCertificate - A SAT witness about an EXTENDED query (TR-072,
ordeal-cert/v4): the v3 SAT certificate about the lowered core, theextblock, and the extended model the core model pulls back to (SliverBlock::pullback_model). An acceptedSliverSatCertificate::recheckproves the EXTENDED query satisfied by an interpretation built from the model —kernel.spec.check_sliver_model_sound. - Term
Certificate - An UNSAT certificate together with the query it refutes AND the term
that query was lowered from (#192 phase 7,
ordeal-cert/v3).TermCertificate::recheckis the strongest re-check: the trusted crate relates the term to the DAG (check_term_dag) and refutes the DAG (check_query), so an accepted re-check proves the TERM unsatisfiable —kernel.spec.check_term_unsat_sound. - Term
SatCertificate - A SAT witness together with the query it satisfies AND the term that
query was lowered from (#192 phase 7,
ordeal-cert/v3).TermSatCertificate::recheckrelates the term to the DAG (check_term_dag), evaluates the DAG under the inputs (check_query_model) and, new, ties every advertised model value to the inputs with the provenvar_offset/check_input_valuethrough the term’s own variable map — so an accepted re-check proves the TERM satisfied by the advertised model (check_term_model_sound, and the only untrusted step left is the variable’s name).
Enums§
- Certificate
Error - Why an independent
Certificate::recheckcould not confirm the proof. - Echo
Recheck Error - Why an
EchoCertificate::recheckdid not accept. - Echo
Subject - The certificate an
ordeal-cert/v5bundle carries the echo of: one of the four term-carrying kinds, told apart by verdict and by whether anextblock is present. - Query
Model Recheck Error - Why a
QuerySatCertificate::recheckcould not confirm the model. - Query
Recheck Error - Why a
QueryCertificate::recheckcould not confirm the proof. - SatRecheck
Error - Why a SAT witness recheck failed.
- Sliver
Model Recheck Error - Why a
SliverSatCertificate::recheckcould not confirm the model. - Sliver
Recheck Error - Why a
SliverCertificate::recheckcould not confirm the proof. - Term
Model Recheck Error - Why a
TermSatCertificate::recheckcould not confirm the model. - Term
Recheck Error - Why a
TermCertificate::recheckcould not confirm the proof.