Node-Certificate Replay #
Parsing, exact comparison, and local replay for node-wise verification certificates.
The IBP and CROWN checkers consume the same basic artifact shapes: flat interval boxes, affine lower/upper bounds, and optional per-node vectors. We keep those format-level operations here so each checker can focus on its propagation rule:
IBPNodeCertchecks interval propagation;CROWNNodeCertchecks affine α-CROWN propagation, with optional ReLU phases.
The JSON artifact is always untrusted. These helpers only parse and compare data; acceptance still requires each checker to recompute the corresponding bound inside Lean. Interval claims are checked by containment after rounding each decimal endpoint outward into binary32, while affine replay transcripts must match the executable binary32 result exactly after rounding each decimal coefficient to nearest.
Bitwise equality for shape-indexed binary32 tensors.
Instances For
A successful bitwise tensor comparison proves equality at every rank.
Whether outer contains inner componentwise.
This deliberately has no tolerance after decimal decoding. The decoded lower endpoint may be farther down and the upper endpoint farther up, but neither may lie inward of the recomputed box.
Instances For
Bitwise equality for affine vectors, componentwise on matrix A and offset c.
Instances For
A successful bitwise affine-vector comparison proves equality of both affine components.
Bitwise equality for flattened affine lower/upper bounds.
Instances For
A successful bitwise affine-bound comparison proves equality of the dependent records, including their input and output dimensions.
Bitwise equality for optional affine bounds, used by the pure replay checker.
Instances For
Successful optional comparison proves equality of the optional affine bounds.
Proved local replay #
The diagnostic node checkers below replay bounds incrementally so that they can report the first
bad node. The final acceptance decision also runs this pure check against the complete imported
certificate. Its soundness theorem supplies exactly the CrownCertLocalOK hypothesis expected by
the graph-level CROWN theorem.
Check that every affine entry is exactly the result of applying step to the imported certificate.
This is intentionally narrower than the complete certificate checker: parsing, IBP containment,
shape checks, and domain checks remain separate executable obligations. This predicate is the
local-replay component whose proposition-level meaning is CrownCertLocalOK.
Instances For
Successful pure replay constructs the local-consistency hypothesis used by CROWN soundness.
Combine the diagnostic checks with pure local replay. Acceptance of the combined decision always supplies the proposition-level local CROWN consistency condition.
Instances For
The complete Boolean acceptance decision implies local CROWN consistency.
Read a length-dim JSON vector into binary32, rounding each exact decimal once with mode.
Callers validate the JSON entries through host binary64 first. This conversion itself does not
check finiteness after rounding into binary32, whose smaller range can overflow.
Instances For
Read a rows × cols JSON matrix into binary32, rounding each exact decimal once.
Instances For
Parse a flat interval box (two arrays of floats) from JSON.
Each decimal endpoint is rounded once into binary32: lower endpoints toward -∞ and upper
endpoints toward +∞. The parsed box is therefore the smallest binary32 box containing the decimal
box the artifact states. Containment is then checked exactly on binary32 values, so a decimal
endpoint that lies inward of Lean's endpoint by less than one binary32 ulp is read as Lean's value.
Serializations that print the shortest round-trip decimal of each endpoint still check.
Instances For
Parse an optional α vector for α-CROWN ReLU relaxations.
The soundness theorem for the lower ReLU relaxation assumes every α component is in [0, 1].
We enforce that contract at the JSON boundary, so a malformed external certificate cannot be
accepted by executable checking while relying on proof hypotheses that are false. Each entry is
rounded once to the nearest binary32 value; rounding is monotone and 0 and 1 are exact, so the
range survives the conversion.
Instances For
Parse flattened affine bounds (lower/upper) from JSON.
The affine transcript must equal Lean's binary32 replay bit for bit, so each decimal coefficient is read as the binary32 value nearest to it, with a single rounding from the exact decimal.
Instances For
Parse one JSON entry per graph node. The array must have exactly g.nodes.size entries; each
entry is parsed together with its node so entry parsers can use the node's output dimension.
Instances For
A node-wise CROWN certificate: the affine context, the interval and affine bounds per node, the optional α vectors of the ReLU lower relaxations, and optional ReLU phases.
Affine-propagation context, including the chosen input node and flattened input dimension.
- ibp : Array (Option (MLTheory.CROWN.FlatBox (FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) exactEqTensor._proof_1 exactEqTensor._proof_2 exactEqTensor._proof_3 exactEqTensor._proof_4)))
Optional per-node interval bounds used by nonlinear CROWN steps.
- crown : Array (Option (MLTheory.CROWN.Graph.FlatAffineBounds (FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) exactEqTensor._proof_1 exactEqTensor._proof_2 exactEqTensor._proof_3 exactEqTensor._proof_4)))
Optional per-node affine lower/upper bounds.
- alpha : Array (Option (MLTheory.CROWN.Graph.FlatTensor (FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) exactEqTensor._proof_1 exactEqTensor._proof_2 exactEqTensor._proof_3 exactEqTensor._proof_4)))
Optional per-node α values for ReLU lower relaxations.
Optional per-node ReLU phases:
-1inactive,0unconstrained,1active. A phase counts only when the IBP interval already proves it.
Instances For
An integer from JSON, as a number or a string.
Instances For
Parse a CROWN node certificate.
The producer may omit "alpha" and "phases"; then no node has a custom α vector or a phase.
The field "beta", the former name of "phases", is rejected rather than ignored, so an older
certificate cannot silently lose its phases.
Whenever α is present, parseAlphaVec? enforces the [0,1] side condition required by the ReLU
relaxation proof.
Instances For
Check that an optional per-node certificate array contains all parents of node id.
Instances For
Safe lookup for optional flat boxes used by certificate-side shape checks.
Instances For
Check that binary elementwise parent boxes have the same flattened size as each other and as the node output. This closes the hole where a malformed certificate could make the runtime helper use the left box on a dimension mismatch.
Instances For
Check whether a flat box is entirely inside the positive domain needed by true log.
Instances For
Check that every coordinate interval lies strictly on one side of zero.
Instances For
Domain and shape preconditions that must hold before a node-wise certificate checker replays a bound step. These executable checks mirror the side conditions that the mathematical rules need.
Instances For
Pretty-printer for a flat box, used in certificate mismatch messages.
Instances For
Pretty-printer for affine bounds, used in certificate mismatch messages.
Instances For
Check one node of a CROWN affine certificate against the bound computed? that Lean replayed:
parent availability, IBP side conditions, dimensions, exact binary32 transcript equality, and
diagnostic messages.