Skip to main content

Crate miden_constraint_compiler

Crate miden_constraint_compiler 

Source
Expand description

Constraint compiler for Plonky3-based Miden AIRs.

Hand-written constraint definitions — plain Rust eval implementations, the auditable source of truth — are captured symbolically into a hash-consed, class-aware IR (ir::Graph). Analyses and code-generation backends consume that graph. A backend with target-specific machinery lives with its target (the ACE circuit backend in miden-ace-codegen); the rest live here.

§Invariants

  1. Capture that feeds artifacts or oracle anchors consumes only hand-written definitions — a generated artifact as capture input makes regeneration self-referential and severs the chain back to the source of truth. Capturing generated code is legitimate only as the subject under test (drift tests compare it against a hand-written capture).
  2. IR node ids are internal. Ids are deterministic (dense, in walk order) but not part of any artifact contract. Digest-visible ordering, such as ACE DagBuilder interning order, is owned by each backend.
  3. Determinism. The same AIR always captures to the same graph, and a backend always emits byte-identical output for the same graph.

Backend output is never trusted by inspection: each backend is validated against the hand-written source by oracles living with its consumers.

Modules§

backend
Code-generation backends over the constraint IR.
ir
The constraint IR: a hash-consed expression graph with structural identity, plus the symbolic-capture frontend that builds it and analyses over it.