miden_constraint_compiler/lib.rs
1//! Constraint compiler for Plonky3-based Miden AIRs.
2//!
3//! Hand-written constraint definitions — plain Rust `eval` implementations, the
4//! auditable source of truth — are captured symbolically into a hash-consed,
5//! class-aware IR ([`ir::Graph`]). Analyses and code-generation backends consume
6//! that graph. A backend with target-specific machinery lives with its target
7//! (the ACE circuit backend in `miden-ace-codegen`); the rest live here.
8//!
9//! # Invariants
10//!
11//! 1. **Capture that feeds artifacts or oracle anchors consumes only hand-written definitions** — a
12//! generated artifact as capture input makes regeneration self-referential and severs the chain
13//! back to the source of truth. Capturing generated code is legitimate only as the subject under
14//! test (drift tests compare it against a hand-written capture).
15//! 2. **IR node ids are internal.** Ids are deterministic (dense, in walk order) but not part of
16//! any artifact contract. Digest-visible ordering, such as ACE `DagBuilder` interning order, is
17//! owned by each backend.
18//! 3. **Determinism.** The same AIR always captures to the same graph, and a backend always emits
19//! byte-identical output for the same graph.
20//!
21//! Backend output is never trusted by inspection: each backend is validated
22//! against the hand-written source by oracles living with its consumers.
23
24pub mod backend;
25pub mod ir;