Interval Soundness Lemmas #
Scalar interval arithmetic, box-cast lemmas, and point-box facts used by the graph IBP soundness induction.
Op-level soundness lemmas (enclosure for each supported step) #
These lemmas are the building blocks for the final “certificate ⇒ semantics enclosure” theorem.
This proof reuses the following existing components:
- Linear IBP soundness over
ℝis already proved inNN.MLTheory.CROWN.mlpasNN.MLTheory.CROWN.Theorems.ibp_linear_sound_real. - For add/sub/relu on
FlatBox, the graph file already contains enclosure lemmas inNN.MLTheory.CROWN.Graph.Theorems.Semantics.
Monotonicity of real ReLU, used by interval enclosure proofs.
The runtime if a > b then a else b is max.
The implementations branch on a comparison rather than calling min/max, so these two lemmas are
what let the interval proofs use the Mathlib lattice lemmas at all.
Multiplying an interval by a constant: the product lies between the two endpoint products.
Stated with min/max instead of a case split on the sign of a, so the caller never has to know
which endpoint is which.
Interval multiplication: the product of two bounded values lies between the min and the max of the four endpoint products.
This is the classical four-corner rule. All four products are needed because signs can differ, and taking min and max of the corners is exactly tight for real multiplication.
Helpers: our bound propagation uses BoundOps.min2/max2, which are defined via decide (a > b).
For ℝ these coincide with min/max.
The bound-arithmetic max2 is max over ℝ.
Elementwise interval multiplication of two boxes is sound.
Coordinatewise this is interval_mul_bounds; the box wrapper adds the dimension check, which is why
the conclusion is about whatever box boxMulElem actually returned.
Casting lemmas (avoid cases on B.dim = v.n) #
FlatBox and FlatTensor carry their dimensions in dependent types, so it is tempting to
cases equalities like h : B.dim = v.n to “align” types. In Lean this can easily trigger
dependent elimination failures when the equality mentions fields of dependent records.
Instead, we keep such equalities as data and move tensors/boxes across them using
castDimScalar / castBoxDim. The following small lemmas are proved once (by cases on
fresh Nat equalities) and then used throughout the main proof without ever cases-ing on
B.dim = v.n directly.
Dimension casts commute with elementwise maps.
Dimension casts commute with addition.
Dimension casts commute with subtraction.
Dimension casts commute with elementwise multiplication.
Casting a box and a point along the same equality does not change containment.
Enclosure survives a dimension cast, which is how a box proved for one layer width is reused at the next one without ever eliminating the equality itself.
Box.contains implies encloses on the flattened box; the two are definitionally the same, and
the lemma exists so proofs can change vocabulary without unfolding.
Point Boxes Always Enclose Their Point #
This is used in the .const case, where a constant node certifies a point box
[v,v] and the semantics returns exactly the same v.