TorchLean

8.5. Verification🔗

This part of the map follows proofs from local algebra to executable checkers. A solid dependency edge means the later statement uses the earlier definition or theorem. Runtime checkers that lack a proved acceptance-to-semantics bridge are described beside the matching proof work, without adding a dependency edge.

For autograd, the first step is a local identity between a Jacobian-vector product (JVP) and a vector-Jacobian product (VJP). Graph induction extends that identity to a whole computation. Derivative theorems additionally require the local operations to be differentiable, and runtime theorems identify which executable accumulation agrees with the proved graph. The entries below keep these steps separate so that the assumptions needed for each conclusion remain visible.

Read a linked declaration as a function from assumptions to a conclusion. A binder such as (h : TopoSorted g) asks the caller for evidence about this particular graph; a result quantified by ∀ x applies to every input satisfying its later premises. The proof entries explain where that evidence comes from. This matters when following an application backward: an enclosure result may need both a theorem about the propagation rule and a separate theorem identifying the program whose values it encloses.

Definition8.5.1
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.2
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 4
Reverse dependency previews
Preview
Definition 8.5.3
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

Each node in an algebraic proof graph carries forward, JVP, and VJP functions together with the local dot-product identity relating its JVP and VJP.

Here the tangent describes a perturbation of the node's inputs, and the output cotangent chooses a scalar combination of its outputs. The identity says that evaluating this combination after a JVP gives the same scalar as pairing the input perturbation with the VJP. Requiring it for every tangent and cotangent lets later proofs use the node in any surrounding graph.

Lean code for Definition8.5.1●1 definition
  • structure(extends 1, 6 fields)defined in NN/Proofs/Autograd/Tape/Algebra/Soundness.lean
    complete
    structure Proofs.Autograd.Algebra.Node {α : Type} [TorchLean.Storage α]
      [CommSemiring α] (Δ : Type) (Γ : List Spec.Shape) (τ : Spec.Shape) :
      Type
    structure Proofs.Autograd.Algebra.Node {α : Type}
      [TorchLean.Storage α] [CommSemiring α]
      (Δ : Type) (Γ : List Spec.Shape)
      (τ : Spec.Shape) : Type
    Proof-carrying node: `NodeData` plus the local adjointness law.
    
    The field `correct` is the algebraic version of the standard JVP/VJP inner-product law.
    
    • Proofs.Autograd.Algebra.NodeData α Δ Γ τ
    forward : TorchLean.TensorPack α Γ → Δ → TorchLean.Tensor α τ
    Inherited from
    1. Proofs.Autograd.Algebra.NodeData
    jvp : TorchLean.TensorPack α Γ → TorchLean.TensorPack α Γ → Δ → TorchLean.Tensor α τ
    Inherited from
    1. Proofs.Autograd.Algebra.NodeData
    vjp : TorchLean.TensorPack α Γ → Δ → TorchLean.Tensor α τ → TorchLean.TensorPack α Γ
    Inherited from
    1. Proofs.Autograd.Algebra.NodeData
    validate : TorchLean.TensorPack α Γ → Δ → Except String Unit
    Inherited from
    1. Proofs.Autograd.Algebra.NodeData
    prepare? : Option
      { prepare //
        ∀ (ctx : TorchLean.TensorPack α Γ) (d : Δ),
          (prepare (Proofs.Autograd.Algebra.TensorLookup.ofPack ctx) d).toPreparedPrograms =
            { value := fun x => self.forward ctx d, vjp := self.vjp ctx d, validate := fun x => self.validate ctx d } }
    Inherited from
    1. Proofs.Autograd.Algebra.NodeData
    correct : ∀ (x dx : TorchLean.TensorPack α Γ) (d : Δ) (δ : TorchLean.Tensor α τ),
      Proofs.TensorAlgebra.dot (self.jvp x dx d) δ = Proofs.Autograd.Algebra.TensorPack.dotList dx (self.vjp x d δ)
    The node's JVP and VJP satisfy the local dot-product adjoint identity. 
Definition8.5.2
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

GraphData stores a typed sequence of executable forward, JVP, and VJP node operations without local correctness proofs.

The type parameter Γ lists the differentiable input shapes; Δ holds auxiliary data that is kept fixed. A trainable weight must belong to the differentiable context if its cotangent is to be returned. Storing that weight only in Δ changes the differentiation problem even when forward evaluation computes the same numbers.

Lean code for Definition8.5.2●1 definition
  • inductive(2 constructors, 5 parameters)defined in NN/Proofs/Autograd/Tape/Algebra/Soundness.lean
    complete
    inductive Proofs.Autograd.Algebra.GraphData (α : Type) [TorchLean.Storage α]
      (Δ : Type) (Γ : List Spec.Shape) : List Spec.Shape → Type
    inductive Proofs.Autograd.Algebra.GraphData
      (α : Type) [TorchLean.Storage α]
      (Δ : Type) (Γ : List Spec.Shape) :
      List Spec.Shape → Type
    Executable-only graph: a snoc-list of `NodeData`. 
    Proofs.Autograd.Algebra.GraphData.nil {α : Type}
      [TorchLean.Storage α] {Δ : Type} {Γ : List Spec.Shape} :
      Proofs.Autograd.Algebra.GraphData α Δ Γ []
    A graph with no computed nodes; its context consists only of the inputs `Γ`. 
    Proofs.Autograd.Algebra.GraphData.snoc {α : Type}
      [TorchLean.Storage α] {Δ : Type} {Γ ss : List Spec.Shape}
      {τ : Spec.Shape} :
      Proofs.Autograd.Algebra.GraphData α Δ Γ ss →
        Proofs.Autograd.Algebra.NodeData α Δ (Γ ++ ss) τ →
          Proofs.Autograd.Algebra.GraphData α Δ Γ (ss ++ [τ])
    Append one node whose inputs may use the original and previously computed values. 
Definition8.5.3
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 5
Reverse dependency previews
Preview
Theorem 8.5.6
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

A proof-carrying algebraic graph is a typed sequence of locally correct nodes. Its output-shape list records each intermediate added to the graph.

Lean code for Definition8.5.3●1 definition
  • inductive(2 constructors, 6 parameters)defined in NN/Proofs/Autograd/Tape/Algebra/Soundness.lean
    complete
    inductive Proofs.Autograd.Algebra.Graph {α : Type} [TorchLean.Storage α]
      [CommSemiring α] (Δ : Type) (Γ : List Spec.Shape) :
      List Spec.Shape → Type
    inductive Proofs.Autograd.Algebra.Graph {α : Type}
      [TorchLean.Storage α] [CommSemiring α]
      (Δ : Type) (Γ : List Spec.Shape) :
      List Spec.Shape → Type
    A proof-carrying tape/SSA graph.
    
    Nodes are appended in topological order and may reference any previously computed value (fan-out
    and sharing are allowed). This mirrors the structure of PyTorch’s dynamic autograd graph, but with
    shape-typed contexts.
    
    Proofs.Autograd.Algebra.Graph.nil {α : Type}
      [TorchLean.Storage α] [CommSemiring α] {Δ : Type}
      {Γ : List Spec.Shape} :
      Proofs.Autograd.Algebra.Graph Δ Γ []
    A graph with no computed nodes; its context consists only of the inputs `Γ`. 
    Proofs.Autograd.Algebra.Graph.snoc {α : Type}
      [TorchLean.Storage α] [CommSemiring α] {Δ : Type}
      {Γ ss : List Spec.Shape} {τ : Spec.Shape} :
      Proofs.Autograd.Algebra.Graph Δ Γ ss →
        Proofs.Autograd.Algebra.Node Δ (Γ ++ ss) τ →
          Proofs.Autograd.Algebra.Graph Δ Γ (ss ++ [τ])
    Append one locally correct node that may use the inputs and all preceding results. 
Definition8.5.4
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 2
Reverse dependency previews
Preview
Definition 8.5.5
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

OpSpecCorrect packages a unary tensor operation, its JVP, and the local inner-product identity relating that JVP to the operation's VJP.

Lean code for Definition8.5.4●1 definition
  • complete
    structure Proofs.Autograd.Algebra.OpSpecCorrect (α : Type) [TorchLean.Storage α]
      [CommSemiring α] (σ τ : Spec.Shape) : Type
    structure Proofs.Autograd.Algebra.OpSpecCorrect
      (α : Type) [TorchLean.Storage α]
      [CommSemiring α] (σ τ : Spec.Shape) :
      Type
    An `OpSpec` together with a matching JVP and a proof of VJP/JVP adjointness.
    
    This is the backend-generic analogue of `Proofs.Autograd.OpSpecCorrect` from
    `NN.Proofs.Autograd.Core.RealCorrectness`.
    
    op : Spec.OpSpec α σ τ
    The operation being certified, forward and backward together. 
    jvp : TorchLean.Tensor α σ → TorchLean.Tensor α σ → TorchLean.Tensor α τ
    Forward-mode derivative at a basepoint, applied to a tangent. 
    correct : Proofs.Autograd.Algebra.VJPCorrect self.op.forward self.jvp self.op.backward
    The adjointness proof. Bundling it with the operation is what makes a value of this type a
    certificate: you cannot obtain one without having shown the backward pass is the transpose. 
Definition8.5.5
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 8.5.1
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 0✓L∃∀N

The unary-operation adapter places an OpSpecCorrect value at a typed input index and produces a proof-carrying graph node.

Lean code for Definition8.5.5●1 definition
  • def Proofs.Autograd.Algebra.Node.ofOpSpecCorrect {α Δ : Type}
      [TorchLean.Storage α] [CommSemiring α] {Γ : List Spec.Shape}
      {σ τ : Spec.Shape} (idx : Proofs.Idx Γ σ)
      (op : Proofs.Autograd.Algebra.OpSpecCorrect α σ τ) :
      Proofs.Autograd.Algebra.Node Δ Γ τ
    def Proofs.Autograd.Algebra.Node.ofOpSpecCorrect
      {α Δ : Type} [TorchLean.Storage α]
      [CommSemiring α] {Γ : List Spec.Shape}
      {σ τ : Spec.Shape}
      (idx : Proofs.Idx Γ σ)
      (op :
        Proofs.Autograd.Algebra.OpSpecCorrect
          α σ τ) :
      Proofs.Autograd.Algebra.Node Δ Γ τ
    Build a proof-carrying unary node from an `OpSpecCorrect`. 
Theorem8.5.6
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

For an algebraic graph over a commutative semiring, reverse accumulation is adjoint to the graph JVP.

The commutative-semiring assumption supplies the laws for rearranging finite sums and products. No limit or topology enters this statement. It establishes the relationship between the supplied JVP and VJP implementations; the analytic graph theorem below additionally identifies the JVP with the derivative of the forward function.

Lean code for Theorem8.5.6●1 theorem
  • theorem Proofs.Autograd.Algebra.Graph.backprop_correct {α : Type}
      [TorchLean.Storage α] [CommSemiring α] {Δ : Type}
      {Γ ss : List Spec.Shape} (g : Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x dx : TorchLean.TensorPack α Γ) (d : Δ)
      (seed : TorchLean.TensorPack α (Γ ++ ss)) :
      Proofs.Autograd.Algebra.TensorPack.dotList (g.jvpCtx x dx d) seed =
        Proofs.Autograd.Algebra.TensorPack.dotList dx
          (g.backpropCtx x d seed)
    theorem Proofs.Autograd.Algebra.Graph.backprop_correct
      {α : Type} [TorchLean.Storage α]
      [CommSemiring α] {Δ : Type}
      {Γ ss : List Spec.Shape}
      (g :
        Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x dx : TorchLean.TensorPack α Γ)
      (d : Δ)
      (seed :
        TorchLean.TensorPack α (Γ ++ ss)) :
      Proofs.Autograd.Algebra.TensorPack.dotList
          (g.jvpCtx x dx d) seed =
        Proofs.Autograd.Algebra.TensorPack.dotList
          dx (g.backpropCtx x d seed)
    Global tape soundness (algebraic form).
    
    Assuming each node satisfies its local adjointness law, `backpropCtx` is the adjoint of `jvpCtx`
    with respect to `TensorPack.dotList`.
    
Proof for Theorem 8.5.6

Graph induction expands the JVP and VJP at each node, then closes the new step with that node's local adjoint law.

Definition8.5.7
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Theorem 8.1.10
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 0✓L∃∀N

The linear operation satisfies the unary operation contract over any commutative semiring. Its correctness field applies matrix-vector adjointness and commutativity of the tensor dot product.

Lean code for Definition8.5.7●1 definition
  • def Proofs.Autograd.Algebra.linearCorrect {α : Type} [TorchLean.Storage α]
      [CommSemiring α] {inDim outDim : ℕ}
      (m : Spec.LinearSpec α inDim outDim) :
      Proofs.Autograd.Algebra.OpSpecCorrect α
        (Spec.Shape.dim inDim Spec.Shape.scalar)
        (Spec.Shape.dim outDim Spec.Shape.scalar)
    def Proofs.Autograd.Algebra.linearCorrect
      {α : Type} [TorchLean.Storage α]
      [CommSemiring α] {inDim outDim : ℕ}
      (m : Spec.LinearSpec α inDim outDim) :
      Proofs.Autograd.Algebra.OpSpecCorrect α
        (Spec.Shape.dim inDim
          Spec.Shape.scalar)
        (Spec.Shape.dim outDim
          Spec.Shape.scalar)
    Correctness of a linear layer’s backward rule (matrix–vector multiply), stated generically over `α`.
    
    This is purely algebraic: it relies only on semiring laws and the adjointness lemma for matrix
    multiplication in `TensorAlgebra`.
    PyTorch analogue: the affine map implemented by `torch.nn.Linear`.
    
Lean code for Theorem8.5.8●1 theorem
  • theorem Proofs.Autograd.Algebra.Graph.backwardDenseFrom_lowerGraphToTape_eq_backpropAllCtx
      {α Δ : Type} [TorchLean.Storage α] [CommSemiring α]
      {Γ ss : List Spec.Shape} (g : Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack α Γ) (d0 : Δ)
      (seed : TorchLean.TensorPack α (Γ ++ ss)) :
      (g.lowerGraphToTape x d0).1.backwardDenseFrom
          seed.toShapeErasedArray =
        Except.ok (g.backpropAllCtx x d0 seed).toShapeErasedArray
    theorem Proofs.Autograd.Algebra.Graph.backwardDenseFrom_lowerGraphToTape_eq_backpropAllCtx
      {α Δ : Type} [TorchLean.Storage α]
      [CommSemiring α]
      {Γ ss : List Spec.Shape}
      (g :
        Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack α Γ) (d0 : Δ)
      (seed :
        TorchLean.TensorPack α (Γ ++ ss)) :
      (g.lowerGraphToTape x
                d0).1.backwardDenseFrom
          seed.toShapeErasedArray =
        Except.ok
          (g.backpropAllCtx x d0
              seed).toShapeErasedArray
    The same statement for a proved graph, which lowers through `g.toData`. 
Theorem8.5.9
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

For a real proof-carrying tape, the inner product of a JVP with a cotangent seed equals the inner product of the input tangent with reverse accumulation.

Lean code for Theorem8.5.9●1 theorem
  • complete
    theorem Proofs.Autograd.Graph.backprop_correct_inner {Γ ss : List Spec.Shape}
      (g : Proofs.Autograd.Graph Γ ss) (xV dxV : Proofs.Autograd.CtxVec Γ)
      (seedV : Proofs.Autograd.CtxVec (Γ ++ ss)) :
      inner ℝ (g.jvpVec xV dxV) seedV = inner ℝ dxV (g.backpropVec xV seedV)
    theorem Proofs.Autograd.Graph.backprop_correct_inner
      {Γ ss : List Spec.Shape}
      (g : Proofs.Autograd.Graph Γ ss)
      (xV dxV : Proofs.Autograd.CtxVec Γ)
      (seedV :
        Proofs.Autograd.CtxVec (Γ ++ ss)) :
      inner ℝ (g.jvpVec xV dxV) seedV =
        inner ℝ dxV (g.backpropVec xV seedV)
    Vectorized tape soundness: `⟪jvp, seed⟫ = ⟪dx, backprop seed⟫`. It is `backprop_correct`
    read through `flattenCtx`, a bijection carrying `dotList` to the Euclidean inner product. 
Proof for Theorem 8.5.9
uses 0

Tape induction applies each real node's local vector adjoint law while preserving the Euclidean inner product across context append and split operations.

Theorem8.5.10
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 2
Reverse dependency previews
Preview
Theorem 8.5.11
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

For differentiable real graph nodes, reverse accumulation equals the adjoint Fréchet derivative at the chosen point.

Lean code for Theorem8.5.10●1 theorem
  • complete
    theorem Proofs.Autograd.Graph.backpropVec_eq_adjoint_fderiv_at
      {Γ ss : List Spec.Shape} (g : Proofs.Autograd.Graph Γ ss)
      (xV : Proofs.Autograd.CtxVec Γ)
      (seedV : Proofs.Autograd.CtxVec (Γ ++ ss)) :
      ∀ (a : Proofs.Autograd.GraphFDerivCorrectAt g xV),
        g.backpropVec xV seedV =
          (ContinuousLinearMap.adjoint (fderiv ℝ g.evalVec xV)) seedV
    theorem Proofs.Autograd.Graph.backpropVec_eq_adjoint_fderiv_at
      {Γ ss : List Spec.Shape}
      (g : Proofs.Autograd.Graph Γ ss)
      (xV : Proofs.Autograd.CtxVec Γ)
      (seedV :
        Proofs.Autograd.CtxVec (Γ ++ ss)) :
      ∀
        (a :
          Proofs.Autograd.GraphFDerivCorrectAt
            g xV),
        g.backpropVec xV seedV =
          (ContinuousLinearMap.adjoint
              (fderiv ℝ g.evalVec xV))
            seedV
    Under `GraphFDerivCorrectAt`, `backpropVec` at `xV` is the adjoint of the derivative of
    `evalVec` at `xV`. 
Proof for Theorem 8.5.10

Real tape soundness supplies the inner-product identity. The analytic hypotheses identify the graph JVP with a Fréchet derivative, and the adjoint is then characterized by its inner products.

Theorem8.5.11
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

For a real algebraic graph at a differentiable execution point, lowering the graph and running the exact dense tape returns the full algebraic reverse context. Its input prefix is the adjoint Fréchet derivative of graph evaluation applied to the output seed.

Lean code for Theorem8.5.11●1 theorem
  • complete
    theorem Proofs.Autograd.Algebra.Graph.backwardDenseFrom_lowerGraphToTape_adjoint_fderiv_at
      {Δ : Type} {Γ ss : List Spec.Shape}
      (g : Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack ℝ Γ) (d0 : Δ)
      (seed : TorchLean.TensorPack ℝ (Γ ++ ss))
      (hg :
        Proofs.Autograd.GraphFDerivCorrectAt (g.toReal d0)
          (Proofs.Autograd.flattenCtx x)) :
      (g.lowerGraphToTape x d0).1.backwardDenseFrom
            seed.toShapeErasedArray =
          Except.ok (g.backpropAllCtx x d0 seed).toShapeErasedArray ∧
        Proofs.Autograd.flattenCtx
            (Proofs.Autograd.Algebra.TensorPack.takeLeft
              (g.backpropAllCtx x d0 seed)) =
          (ContinuousLinearMap.adjoint
              (fderiv ℝ (g.toReal d0).evalVec
                (Proofs.Autograd.flattenCtx x)))
            (Proofs.Autograd.flattenCtx seed)
    theorem Proofs.Autograd.Algebra.Graph.backwardDenseFrom_lowerGraphToTape_adjoint_fderiv_at
      {Δ : Type} {Γ ss : List Spec.Shape}
      (g :
        Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack ℝ Γ) (d0 : Δ)
      (seed :
        TorchLean.TensorPack ℝ (Γ ++ ss))
      (hg :
        Proofs.Autograd.GraphFDerivCorrectAt
          (g.toReal d0)
          (Proofs.Autograd.flattenCtx x)) :
      (g.lowerGraphToTape x
                  d0).1.backwardDenseFrom
            seed.toShapeErasedArray =
          Except.ok
            (g.backpropAllCtx x d0
                seed).toShapeErasedArray ∧
        Proofs.Autograd.flattenCtx
            (Proofs.Autograd.Algebra.TensorPack.takeLeft
              (g.backpropAllCtx x d0 seed)) =
          (ContinuousLinearMap.adjoint
              (fderiv ℝ (g.toReal d0).evalVec
                (Proofs.Autograd.flattenCtx
                  x)))
            (Proofs.Autograd.flattenCtx seed)
    Pointwise variant of `backwardDenseFrom_lowerGraphToTape_adjoint_fderiv`. 
Proof for Theorem 8.5.11

The real, environment-free algebraic graph and the analytic graph convert in both directions while preserving evaluation, JVPs, and reverse accumulation. The tape-lowering correctness theorem gives the full cotangent context; prefix extraction identifies its input block with analytic backprop, and the analytic graph theorem identifies that value with the adjoint Fréchet derivative.

Theorem8.5.12
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 8.3.2
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1✓L∃∀N

Every tape produced by lowering an algebraic graph over a commutative semiring is zero preserving: each lowered node's backward closure sends a zero cotangent to zero contributions of its parents' shapes. This is the hypothesis under which the executed sweep backwardDenseAll agrees with the proved sweep backwardDenseFrom.

Lean code for Theorem8.5.12●1 theorem
  • theorem Proofs.Autograd.Algebra.Graph.lowerGraphToTape_zeroPreserving {α : Type}
      [TorchLean.Storage α] [CommSemiring α] {Δ : Type}
      {Γ ss : List Spec.Shape} (g : Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack α Γ) (d0 : Δ) :
      Proofs.Autograd.Algebra.Graph.ZeroPreserving
        (g.lowerGraphToTape x d0).1
    theorem Proofs.Autograd.Algebra.Graph.lowerGraphToTape_zeroPreserving
      {α : Type} [TorchLean.Storage α]
      [CommSemiring α] {Δ : Type}
      {Γ ss : List Spec.Shape}
      (g :
        Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack α Γ)
      (d0 : Δ) :
      Proofs.Autograd.Algebra.Graph.ZeroPreserving
        (g.lowerGraphToTape x d0).1
    Every tape produced by `lowerGraphToTape` is `ZeroPreserving`: leaves have no contributions, and
    a lowered node's `backward` on its zero cotangent runs the stored VJP at zero, which is the zero
    context by `node_vjp_full_zero`, so every emitted contribution is a parent's zero cotangent.
    
Proof for Theorem 8.5.12

A node's adjointness law gives dot (jvp x dx d) δ = dotList dx (vjp x d δ); with δ = 0 the left side vanishes for every dx, and nondegeneracy of the tensor pairing over a commutative semiring forces vjp x d 0 = 0.

Lean code for Theorem8.5.13●1 theorem
  • theorem Proofs.Autograd.Algebra.Graph.backwardDenseAll_lowerGraphToTape_eq_backpropAllCtx
      {α : Type} [TorchLean.Storage α] [CommSemiring α] {Δ : Type}
      {Γ ss : List Spec.Shape} (g : Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack α Γ) (d0 : Δ) {τ : Spec.Shape}
      (output : Proofs.Idx (Γ ++ ss) τ) (seed : TorchLean.Tensor α τ) :
      (g.lowerGraphToTape x d0).1.backwardDenseAll (↑output.i)
          (Spec.SomeTensor.ofTensor seed) =
        Except.ok
          (g.backpropAllCtx x d0
              (Proofs.Autograd.Algebra.TensorPack.single output
                seed)).toShapeErasedArray
    theorem Proofs.Autograd.Algebra.Graph.backwardDenseAll_lowerGraphToTape_eq_backpropAllCtx
      {α : Type} [TorchLean.Storage α]
      [CommSemiring α] {Δ : Type}
      {Γ ss : List Spec.Shape}
      (g :
        Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack α Γ) (d0 : Δ)
      {τ : Spec.Shape}
      (output : Proofs.Idx (Γ ++ ss) τ)
      (seed : TorchLean.Tensor α τ) :
      (g.lowerGraphToTape x
                d0).1.backwardDenseAll
          (↑output.i)
          (Spec.SomeTensor.ofTensor seed) =
        Except.ok
          (g.backpropAllCtx x d0
              (Proofs.Autograd.Algebra.TensorPack.single
                output
                seed)).toShapeErasedArray
    **Executed backward pass on a lowered graph = proved backpropagation.** Running the trainer's
    `Tape.backwardDenseAll` on the tape produced by `lowerGraphToTape`, seeded at any typed output
    index `output` with cotangent `seed`, succeeds and returns the shape erasure of `backpropAllCtx`
    of the one-hot seed context. Unlike `backwardDenseFrom_lowerGraphToTape_eq_backpropAllCtx`, this
    is about the variant that skips unreached nodes; the two agree by `lowerGraphToTape_zeroPreserving`.
    
Theorem8.5.14
Group: Algebraic, executable, and analytic accounts of reverse-mode differentiation. (13)
Group member previews
Preview
Definition 8.5.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

For a real algebraic graph whose nodes satisfy the analytic GraphFDerivCorrect hypothesis, the executed dense sweep on the lowered tape returns the full reverse context, and the input block of that context is the adjoint Fréchet derivative of the graph's forward map applied to the output seed. The statement is about the exact tape model over ℝ; it says nothing about Float rounding or the CUDA path.

Lean code for Theorem8.5.14●1 theorem
  • theorem Proofs.Autograd.Algebra.Graph.backwardDenseAll_lowerGraphToTape_adjoint_fderiv
      {Δ : Type} {Γ ss : List Spec.Shape}
      (g : Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack ℝ Γ) (d0 : Δ) {τ : Spec.Shape}
      (output : Proofs.Idx (Γ ++ ss) τ) (seed : TorchLean.Tensor ℝ τ)
      (hg : Proofs.Autograd.GraphFDerivCorrect (g.toReal d0)) :
      (g.lowerGraphToTape x d0).1.backwardDenseAll (↑output.i)
            (Spec.SomeTensor.ofTensor seed) =
          Except.ok
            (g.backpropAllCtx x d0
                (Proofs.Autograd.Algebra.TensorPack.single output
                  seed)).toShapeErasedArray ∧
        Proofs.Autograd.flattenCtx
            (Proofs.Autograd.Algebra.TensorPack.takeLeft
              (g.backpropAllCtx x d0
                (Proofs.Autograd.Algebra.TensorPack.single output seed))) =
          (ContinuousLinearMap.adjoint
              (fderiv ℝ (g.toReal d0).evalVec
                (Proofs.Autograd.flattenCtx x)))
            (Proofs.Autograd.flattenCtx
              (Proofs.Autograd.Algebra.TensorPack.single output seed))
    theorem Proofs.Autograd.Algebra.Graph.backwardDenseAll_lowerGraphToTape_adjoint_fderiv
      {Δ : Type} {Γ ss : List Spec.Shape}
      (g :
        Proofs.Autograd.Algebra.Graph Δ Γ ss)
      (x : TorchLean.TensorPack ℝ Γ) (d0 : Δ)
      {τ : Spec.Shape}
      (output : Proofs.Idx (Γ ++ ss) τ)
      (seed : TorchLean.Tensor ℝ τ)
      (hg :
        Proofs.Autograd.GraphFDerivCorrect
          (g.toReal d0)) :
      (g.lowerGraphToTape x
                  d0).1.backwardDenseAll
            (↑output.i)
            (Spec.SomeTensor.ofTensor seed) =
          Except.ok
            (g.backpropAllCtx x d0
                (Proofs.Autograd.Algebra.TensorPack.single
                  output
                  seed)).toShapeErasedArray ∧
        Proofs.Autograd.flattenCtx
            (Proofs.Autograd.Algebra.TensorPack.takeLeft
              (g.backpropAllCtx x d0
                (Proofs.Autograd.Algebra.TensorPack.single
                  output seed))) =
          (ContinuousLinearMap.adjoint
              (fderiv ℝ (g.toReal d0).evalVec
                (Proofs.Autograd.flattenCtx
                  x)))
            (Proofs.Autograd.flattenCtx
              (Proofs.Autograd.Algebra.TensorPack.single
                output seed))
    **Executed backward pass = adjoint of the Fréchet derivative.** Over `ℝ`, the trainer's
    `Tape.backwardDenseAll` on a lowered graph, seeded at a typed output index, succeeds with the full
    backpropagation context, whose input (`Γ`-prefix) block is the adjoint of the Fréchet derivative
    of the graph's forward evaluation applied to the one-hot seed. This composes
    `backwardDenseAll_lowerGraphToTape_eq_backpropAllCtx` with
    `backwardDenseFrom_lowerGraphToTape_adjoint_fderiv`.
    
Proof for Theorem 8.5.14
Proof uses 2
Proof dependency previews
Preview
Theorem 8.5.11
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The first conjunct is the executed-sweep link; the second is the proved-sweep Fréchet theorem read through the same one-hot seed context.

Definition8.5.15
Group: The proved lowering from typed TorchLean programs to verifier IR. (3)
Group member previews
Preview
Definition 8.5.16
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 3
Reverse dependency previews
Preview
Definition 8.5.16
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The verified source language is a typed sequence of supported tensor operations with one input and shape-indexed intermediate values.

The source type already records which shapes each operation consumes and produces. Lowering changes how those values are named and stored: a typed position becomes a node reference in the IR. The two theorems below check complementary consequences of that change. Well-formedness makes the references structurally valid; semantic equality shows that they still name the intended computations.

Lean code for Definition8.5.15●1 definition
  • complete
    abbrev NN.Verification.Builtin.Proved.ForwardProgram (α : Type)
      [TorchLean.Storage α] (paramShapes : List Spec.Shape)
      (inShape outShape : Spec.Shape) : Type
    abbrev NN.Verification.Builtin.Proved.ForwardProgram
      (α : Type) [TorchLean.Storage α]
      (paramShapes : List Spec.Shape)
      (inShape outShape : Spec.Shape) : Type
    A closed program in the proved forward fragment, from `inShape` to `outShape`. 
Definition8.5.16
Group: The proved lowering from typed TorchLean programs to verifier IR. (3)
Group member previews
Preview
Definition 8.5.15
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 2
Reverse dependency previews
Preview
Theorem 8.5.17
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

lowerForwardProgramToIR lowers the verified source program to the shared IR while preserving its typed node order.

Lean code for Definition8.5.16●1 definition
  • def NN.Verification.Builtin.Proved.lowerForwardProgramToIR {α : Type}
      [TorchLean.Storage α] [Context α] {paramShapes : List Spec.Shape}
      {inShape outShape : Spec.Shape}
      (p :
        NN.Verification.Builtin.Proved.ForwardProgram α paramShapes inShape
          outShape)
      (params : TorchLean.TensorPack α paramShapes) :
      NN.Verification.Builtin.LoweredIR α
    def NN.Verification.Builtin.Proved.lowerForwardProgramToIR
      {α : Type} [TorchLean.Storage α]
      [Context α]
      {paramShapes : List Spec.Shape}
      {inShape outShape : Spec.Shape}
      (p :
        NN.Verification.Builtin.Proved.ForwardProgram
          α paramShapes inShape outShape)
      (params :
        TorchLean.TensorPack α paramShapes) :
      NN.Verification.Builtin.LoweredIR α
    Lower a proved forward-fragment program into the verifier IR.
    
    The resulting `LoweredIR` can be executed by the IR evaluator. The modules under
    `NN.Verification.Builtin.Proved.Correctness` prove that its denotation agrees with `evalForward`.
    
Theorem8.5.17
Group: The proved lowering from typed TorchLean programs to verifier IR. (3)
Group member previews
Preview
Definition 8.5.15
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 8.1.20
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 0✓L∃∀N
Lean code for Theorem8.5.17●1 theorem
  • theorem NN.Verification.Builtin.Proved.Correctness.lowerForwardProgramToIR_wellFormed
      {α : Type} [TorchLean.Storage α] [Context α]
      {paramShapes : List Spec.Shape} {inShape outShape : Spec.Shape}
      (p :
        NN.Verification.Builtin.Proved.ForwardProgram α paramShapes inShape
          outShape)
      (params : TorchLean.TensorPack α paramShapes) :
      (NN.Verification.Builtin.Proved.lowerForwardProgramToIR p
              params).graph.wellFormed =
        true
    theorem NN.Verification.Builtin.Proved.Correctness.lowerForwardProgramToIR_wellFormed
      {α : Type} [TorchLean.Storage α]
      [Context α]
      {paramShapes : List Spec.Shape}
      {inShape outShape : Spec.Shape}
      (p :
        NN.Verification.Builtin.Proved.ForwardProgram
          α paramShapes inShape outShape)
      (params :
        TorchLean.TensorPack α paramShapes) :
      (NN.Verification.Builtin.Proved.lowerForwardProgramToIR
              p params).graph.wellFormed =
        true
    Graphs produced by `lowerForwardProgramToIR` satisfy the IR structural discipline
    (`Graph.wellFormed = true`).
    
Proof for Theorem 8.5.17
Proof uses 2
Proof dependency previews
Preview
Definition 8.5.15
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

Induction over the source program shows that the lowering preserves the node-index invariant at every append.

Theorem8.5.18
Group: The proved lowering from typed TorchLean programs to verifier IR. (3)
Group member previews
Preview
Definition 8.5.15
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 8.1.23
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 0✓L∃∀N

Running the output of the verified forward lowering with the IR semantics gives the same result as evaluating the source forward program.

Lean code for Theorem8.5.18●1 theorem
  • theorem NN.Verification.Builtin.Proved.Correctness.runForwardIR_eq_evalForward
      {α : Type} [TorchLean.Storage α] [Context α]
      {paramShapes : List Spec.Shape} {inShape outShape : Spec.Shape}
      (p :
        NN.Verification.Builtin.Proved.ForwardProgram α paramShapes inShape
          outShape)
      (params : TorchLean.TensorPack α paramShapes)
      (x : TorchLean.Tensor α inShape) :
      NN.Verification.Builtin.runForwardIR
          (NN.Verification.Builtin.Proved.lowerForwardProgramToIR p params)
          x =
        NN.Verification.Builtin.Proved.evalForward p params x
    theorem NN.Verification.Builtin.Proved.Correctness.runForwardIR_eq_evalForward
      {α : Type} [TorchLean.Storage α]
      [Context α]
      {paramShapes : List Spec.Shape}
      {inShape outShape : Spec.Shape}
      (p :
        NN.Verification.Builtin.Proved.ForwardProgram
          α paramShapes inShape outShape)
      (params :
        TorchLean.TensorPack α paramShapes)
      (x : TorchLean.Tensor α inShape) :
      NN.Verification.Builtin.runForwardIR
          (NN.Verification.Builtin.Proved.lowerForwardProgramToIR
            p params)
          x =
        NN.Verification.Builtin.Proved.evalForward
          p params x
    Lowering a first-order forward program and evaluating its IR gives the same result, including
    errors, as `evalForward` on the source program.
    
Proof for Theorem 8.5.18
Proof uses 2
Proof dependency previews
Preview
Definition 8.1.23
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

Induction over the source program relates each lowered step to its matching IR denotation rule.

Theorem8.5.19
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.20
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 8.1.1
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 2
Reverse dependency previews
Preview
Theorem 8.5.20
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

A topologically sorted supported graph over shape-indexed tensors and ordered real scalars encloses every computed node value when its local semantic and box certificates are sound.

Lean code for Theorem8.5.19●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.CertSoundness.cert_encloses_semantics
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (cert : Array (Option (NN.MLTheory.CROWN.FlatBox ℝ)))
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals : Array (Option NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hsupp : NN.MLTheory.CROWN.Graph.CertSoundness.Supported g)
      (hcert : NN.MLTheory.CROWN.Graph.CertSoundness.CertLocalOK g ps cert)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK g ps inputs vals)
      (hinputs :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed g ps inputs)
      (id : ℕ) :
      id < g.nodes.size →
        match cert[id]!, vals[id]! with
        | some B, some v =>
          NN.MLTheory.CROWN.Graph.CertSoundness.EnclosesBox B v
        | x, x_1 => True
    theorem NN.MLTheory.CROWN.Graph.CertSoundness.cert_encloses_semantics
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (cert :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox ℝ)))
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals :
        Array
          (Option
            NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hsupp :
        NN.MLTheory.CROWN.Graph.CertSoundness.Supported
          g)
      (hcert :
        NN.MLTheory.CROWN.Graph.CertSoundness.CertLocalOK
          g ps cert)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK
          g ps inputs vals)
      (hinputs :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed
          g ps inputs)
      (id : ℕ) :
      id < g.nodes.size →
        match cert[id]!, vals[id]! with
        | some B, some v =>
          NN.MLTheory.CROWN.Graph.CertSoundness.EnclosesBox
            B v
        | x, x_1 => True
    Enclosure of every certified node box around the corresponding semantic value.
    
    The conclusion matches on `cert[id]!` and `vals[id]!` and is trivially true when either entry is
    missing.  This shape is kept because downstream files instantiate it directly with the runtime
    arrays produced by `runIBP?` and the evaluator, where presence of an entry is not known up front.
    See `cert_encloses_semantics_of_some` for the explicitly quantified form. 
Proof for Theorem 8.5.19
Proof uses 2
Proof dependency previews
Preview
Definition 8.1.1
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

Topological induction follows the graph's tensor values and applies each local enclosure result using the order from the real scalar setting.

Theorem8.5.20
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 2
Reverse dependency previews
Preview
Theorem 8.5.22
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The proof-side real runIBP? pass supplies the certificates required by the local soundness theorem, so on a topologically sorted supported graph with enclosed inputs every box it produces encloses the value computed by the recursive evaluator evalGraphRec.

Lean code for Theorem8.5.20●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.CertSoundness.runIBP?_encloses_evalGraphRec
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hsupp : NN.MLTheory.CROWN.Graph.CertSoundness.Supported g)
      (hinputs :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed g ps inputs)
      (id : ℕ) :
      id < g.nodes.size →
        match (NN.MLTheory.CROWN.Graph.CertSoundness.runIBP? g ps)[id]!,
          (NN.MLTheory.CROWN.Graph.CertSoundness.evalGraphRec g ps
              inputs)[id]! with
        | some B, some v =>
          NN.MLTheory.CROWN.Graph.CertSoundness.EnclosesBox B v
        | x, x_1 => True
    theorem NN.MLTheory.CROWN.Graph.CertSoundness.runIBP?_encloses_evalGraphRec
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hsupp :
        NN.MLTheory.CROWN.Graph.CertSoundness.Supported
          g)
      (hinputs :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed
          g ps inputs)
      (id : ℕ) :
      id < g.nodes.size →
        match
          (NN.MLTheory.CROWN.Graph.CertSoundness.runIBP?
              g ps)[id]!,
          (NN.MLTheory.CROWN.Graph.CertSoundness.evalGraphRec
              g ps inputs)[id]! with
        | some B, some v =>
          NN.MLTheory.CROWN.Graph.CertSoundness.EnclosesBox
            B v
        | x, x_1 => True
Proof for Theorem 8.5.20

The pass is shown to produce the local certificates required by the generic soundness theorem.

Theorem8.5.21
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

On graphs whose nodes are all in EngineCore (input, constant, detach, addition, subtraction, elementwise multiplication, ReLU, linear, matrix multiplication, convolution, concatenation, softplus, and safe logarithm), when the semantic guard accepts the graph and the proof-side pass produced a box at every node (IBPCovers), the executable engine's runIBP computes exactly the proof-side runIBP?.

The Option entries matter here. some box supplies an enclosure candidate, while none records an absent result. Both passes propagate missing parents as none, so a failed transfer cannot supply a fabricated box to a later node. IBPCovers ensures that every node has the box required by this correspondence and the enclosure theorem.

Lean code for Theorem8.5.21●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.CertSoundness.runIBP_eq_runIBP?
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hcore : NN.MLTheory.CROWN.Graph.CertSoundness.EngineCore g)
      (hguard : g.crownGraphSemanticsSupported ps = true)
      (hcov :
        NN.MLTheory.CROWN.Graph.CertSoundness.IBPCovers g
          (NN.MLTheory.CROWN.Graph.CertSoundness.runIBP? g ps)) :
      g.runIBP ps = NN.MLTheory.CROWN.Graph.CertSoundness.runIBP? g ps
    theorem NN.MLTheory.CROWN.Graph.CertSoundness.runIBP_eq_runIBP?
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hcore :
        NN.MLTheory.CROWN.Graph.CertSoundness.EngineCore
          g)
      (hguard :
        g.crownGraphSemanticsSupported ps =
          true)
      (hcov :
        NN.MLTheory.CROWN.Graph.CertSoundness.IBPCovers
          g
          (NN.MLTheory.CROWN.Graph.CertSoundness.runIBP?
            g ps)) :
      g.runIBP ps =
        NN.MLTheory.CROWN.Graph.CertSoundness.runIBP?
          g ps
    The engine's `runIBP` computes exactly the proof-side `runIBP?` on engine-core graphs, provided the
    semantic guard accepts the graph and the proof-side pass produced a box at every node.
    
    Coverage supplies a successful certificate step at each prefix of the induction.
    
Proof for Theorem 8.5.21
uses 0

Induction over the node prefix: on each EngineCore kind the engine step and the proof-side step compute the same box once their parents agree.

Theorem8.5.22
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

Under TopoSorted, EngineCore, IBPCovers, and InputsEnclosed, every box produced by the executable runIBP over ℝ encloses the matching value of evalGraphRec. The theorem covers the executable IBP engine at the real scalar. Transcendental node kinds outside EngineCore are not covered; the full rounded forward theorem handles directed endpoints.

Lean code for Theorem8.5.22●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.CertSoundness.runIBP_encloses_evalGraphRec
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hcore : NN.MLTheory.CROWN.Graph.CertSoundness.EngineCore g)
      (hcov :
        NN.MLTheory.CROWN.Graph.CertSoundness.IBPCovers g
          (NN.MLTheory.CROWN.Graph.CertSoundness.runIBP? g ps))
      (hinputs :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed g ps inputs)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (B : NN.MLTheory.CROWN.FlatBox ℝ)
          (v : NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          (g.runIBP ps)[id]! = some B →
            (NN.MLTheory.CROWN.Graph.CertSoundness.evalGraphRec g ps
                    inputs)[id]! =
                some v →
              NN.MLTheory.CROWN.Graph.CertSoundness.EnclosesBox B v
    theorem NN.MLTheory.CROWN.Graph.CertSoundness.runIBP_encloses_evalGraphRec
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hcore :
        NN.MLTheory.CROWN.Graph.CertSoundness.EngineCore
          g)
      (hcov :
        NN.MLTheory.CROWN.Graph.CertSoundness.IBPCovers
          g
          (NN.MLTheory.CROWN.Graph.CertSoundness.runIBP?
            g ps))
      (hinputs :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed
          g ps inputs)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (B : NN.MLTheory.CROWN.FlatBox ℝ)
          (v :
            NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          (g.runIBP ps)[id]! = some B →
            (NN.MLTheory.CROWN.Graph.CertSoundness.evalGraphRec
                    g ps inputs)[id]! =
                some v →
              NN.MLTheory.CROWN.Graph.CertSoundness.EnclosesBox
                B v
    End-to-end soundness of the engine's IBP pass: every box computed by `runIBP` encloses the value
    computed by the total evaluator `evalGraphRec` at the same node.
    
    The statement quantifies over node ids at which the engine produced a box `B` and the evaluator a
    value `v`, so it cannot hold through a missing entry. The semantic guard needs no hypothesis: if
    `crownGraphSemanticsSupported` rejects the graph, `runIBP` produces no boxes and there is nothing
    to prove. Coverage of the proof-side pass is needed for the reason given at `runIBP_eq_runIBP?`.
    
Proof for Theorem 8.5.22
Proof uses 2
Proof dependency previews
Preview
Theorem 8.5.20
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.
Theorem8.5.23
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

This theorem covers the ibpForwardSupported core: inputs, constants, copies, add, sub, mulElem, relu, linear, unary matmul, sum, exp, log, sqrt, inv, tanh, sigmoid, sin, and cos. With LawfulBoundOps and LawfulNonlinearBoundOps, every box produced by the executable runIBP encloses the real value of its node. Parents must precede their consumers, inputs must lie in their seed boxes, and the real point must satisfy NodeEquation at every node.

Lean code for Theorem8.5.23●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.DirectedBackward.runIBP_encloses {α : Type}
      [TorchLean.Storage α] [Context α] [NN.MLTheory.CROWN.BoundOps α]
      [NN.MLTheory.CROWN.LawfulBoundOps α]
      [NN.MLTheory.CROWN.NonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulNonlinearBoundOps α]
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore α) {dims : ℕ → ℕ}
      {v : ℕ → ℕ → ℝ}
      (hparent : ∀ id < g.nodes.size, ∀ p ∈ g.nodes[id]!.parents, p < id)
      (hsupported :
        NN.MLTheory.CROWN.Graph.DirectedBackward.ibpForwardSupported
            g.nodes =
          true)
      (hinputs :
        NN.MLTheory.CROWN.Graph.DirectedBackward.InputsInBoxes g.nodes ps
          dims v)
      (hequation :
        ∀ id < g.nodes.size,
          NN.MLTheory.CROWN.Graph.DirectedBackward.NodeEquation g.nodes ps
            (g.runIBP ps) dims v id)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (box : NN.MLTheory.CROWN.FlatBox α),
          (g.runIBP ps)[id]! = some box →
            NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses box
              (dims id) (v id)
    theorem NN.MLTheory.CROWN.Graph.DirectedBackward.runIBP_encloses
      {α : Type} [TorchLean.Storage α]
      [Context α]
      [NN.MLTheory.CROWN.BoundOps α]
      [NN.MLTheory.CROWN.LawfulBoundOps α]
      [NN.MLTheory.CROWN.NonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulNonlinearBoundOps
          α]
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore α)
      {dims : ℕ → ℕ} {v : ℕ → ℕ → ℝ}
      (hparent :
        ∀ id < g.nodes.size,
          ∀ p ∈ g.nodes[id]!.parents, p < id)
      (hsupported :
        NN.MLTheory.CROWN.Graph.DirectedBackward.ibpForwardSupported
            g.nodes =
          true)
      (hinputs :
        NN.MLTheory.CROWN.Graph.DirectedBackward.InputsInBoxes
          g.nodes ps dims v)
      (hequation :
        ∀ id < g.nodes.size,
          NN.MLTheory.CROWN.Graph.DirectedBackward.NodeEquation
            g.nodes ps (g.runIBP ps) dims v
            id)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (box : NN.MLTheory.CROWN.FlatBox α),
          (g.runIBP ps)[id]! = some box →
            NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses
              box (dims id) (v id)
    Soundness of the rounded forward IBP pass. Every box that `runIBP` returns encloses the value of
    its node, when the parents precede their consumers, every node kind is covered by
    `ibpForwardSupportedNode`, the input boxes contain the real inputs, and the real point satisfies
    the node equations.
    
    If the semantic guard of `runIBP` rejects the graph, no box is produced and the statement holds
    trivially.
    
Proof for Theorem 8.5.23
uses 0

Strong induction over node identifiers. Each entry of the final array is the transfer computed from the prefix before it, and each supported transfer is proved sound from the directed endpoint laws and the scalar enclosure laws.

Definition8.5.24
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 3
Reverse dependency previews
Preview
Theorem 8.5.25
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

RealNodeEquation describes the real operation at each graph node. Convolution uses the exact spatial operation on the real interpretations of the stored weights. Stored linear nodes use vector affine equations. A sum node sums every coordinate of its real parent, independently of whether an IBP row is available. Structural operations use their coordinate maps and reductions, and normalization nodes use their real formulas. Random nodes use the actual seeded Spec.Random.uniform and Spec.Random.mask values over ℝ. Uniform nodes have no parents; masks read one existing scalar parent. Their unit-interval support follows from these source equations.

Lean code for Definition8.5.24●1 definition
  • def NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation {α : Type}
      [TorchLean.Storage α] [Context α] [NN.MLTheory.CROWN.BoundOps α]
      [NN.MLTheory.CROWN.LawfulBoundOps α]
      (nodes : Array NN.MLTheory.CROWN.Graph.Node)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore α)
      (ibp : Array (Option (NN.MLTheory.CROWN.FlatBox α))) (dims : ℕ → ℕ)
      (v : ℕ → ℕ → ℝ) (id : ℕ) : Prop
    def NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation
      {α : Type} [TorchLean.Storage α]
      [Context α]
      [NN.MLTheory.CROWN.BoundOps α]
      [NN.MLTheory.CROWN.LawfulBoundOps α]
      (nodes :
        Array NN.MLTheory.CROWN.Graph.Node)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore α)
      (ibp :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox α)))
      (dims : ℕ → ℕ) (v : ℕ → ℕ → ℝ)
      (id : ℕ) : Prop
    The real semantics of every graph operation.
    
    The spatial convolution and structural equations stand on their own. In particular, they do not
    assume a second affine equation about coefficients computed by the verifier. Unary stored-weight
    and binary tensor matrix multiplication share an operation tag; their parent counts distinguish
    the two equations. Stored `linear` nodes use vector affine equations; the public IR bridge for
    `linear` requires vector-shaped parents.
    
Theorem8.5.25
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

With LawfulBoundOps, LawfulNonlinearBoundOps, and LawfulMinBoundOps, and a nonnegative real interpretation of the backend's fixed normalizationEpsilon, every successful ibpStepNodeAt? transfer encloses the node's real value. Its parent boxes must agree with the reference IBP array and enclose their values, inputs must lie in their seed boxes, and the node must obey its real equation. Unsupported transfers are rejected; the theorem constrains boxes returned by successful transfers.

Lean code for Theorem8.5.25●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.DirectedBackward.ibpStepNodeAt?_all_encloses
      {α : Type} [TorchLean.Storage α] [Context α]
      [NN.MLTheory.CROWN.BoundOps α] [NN.MLTheory.CROWN.LawfulBoundOps α]
      [NN.MLTheory.CROWN.NonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulNonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulMinBoundOps α]
      (hepsilon :
        0 ≤
          NN.MLTheory.CROWN.LawfulBoundOps.toReal
            TorchLean.normalizationEpsilon)
      {nodes : Array NN.MLTheory.CROWN.Graph.Node}
      {ps : NN.MLTheory.CROWN.Graph.ParamStore α}
      {boxes ibp : Array (Option (NN.MLTheory.CROWN.FlatBox α))}
      {dims : ℕ → ℕ} {v : ℕ → ℕ → ℝ} {id : ℕ}
      (hinput :
        nodes[id]!.kind = NN.IR.OpKind.input →
          ∀ (box : NN.MLTheory.CROWN.FlatBox α),
            ps.inputBoxes[id]? = some box →
              NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses box
                (dims id) (v id))
      (heq :
        NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation nodes ps
          ibp dims v id)
      (hagree : ∀ p ∈ nodes[id]!.parents, boxes[p]?.join = ibp[p]!)
      (henc :
        ∀ p ∈ nodes[id]!.parents,
          ∀ (box : NN.MLTheory.CROWN.FlatBox α),
            ibp[p]! = some box →
              NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses box
                (dims p) (v p))
      {box : NN.MLTheory.CROWN.FlatBox α}
      (hstep :
        NN.MLTheory.CROWN.Graph.ibpStepNodeAt? nodes ps boxes id
            nodes[id]! =
          some box) :
      NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses box (dims id)
        (v id)
    theorem NN.MLTheory.CROWN.Graph.DirectedBackward.ibpStepNodeAt?_all_encloses
      {α : Type} [TorchLean.Storage α]
      [Context α]
      [NN.MLTheory.CROWN.BoundOps α]
      [NN.MLTheory.CROWN.LawfulBoundOps α]
      [NN.MLTheory.CROWN.NonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulNonlinearBoundOps
          α]
      [NN.MLTheory.CROWN.LawfulMinBoundOps α]
      (hepsilon :
        0 ≤
          NN.MLTheory.CROWN.LawfulBoundOps.toReal
            TorchLean.normalizationEpsilon)
      {nodes :
        Array NN.MLTheory.CROWN.Graph.Node}
      {ps :
        NN.MLTheory.CROWN.Graph.ParamStore α}
      {boxes ibp :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox α))}
      {dims : ℕ → ℕ} {v : ℕ → ℕ → ℝ} {id : ℕ}
      (hinput :
        nodes[id]!.kind = NN.IR.OpKind.input →
          ∀
            (box :
              NN.MLTheory.CROWN.FlatBox α),
            ps.inputBoxes[id]? = some box →
              NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses
                box (dims id) (v id))
      (heq :
        NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation
          nodes ps ibp dims v id)
      (hagree :
        ∀ p ∈ nodes[id]!.parents,
          boxes[p]?.join = ibp[p]!)
      (henc :
        ∀ p ∈ nodes[id]!.parents,
          ∀
            (box :
              NN.MLTheory.CROWN.FlatBox α),
            ibp[p]! = some box →
              NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses
                box (dims p) (v p))
      {box : NN.MLTheory.CROWN.FlatBox α}
      (hstep :
        NN.MLTheory.CROWN.Graph.ibpStepNodeAt?
            nodes ps boxes id nodes[id]! =
          some box) :
      NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses
        box (dims id) (v id)
    Every successful IBP transfer encloses the corresponding real operation.
    
    The epsilon premise concerns the backend's fixed default normalization constant. Stored
    normalization payloads retain the executable positivity checks on their own epsilon.
    
Proof for Theorem 8.5.25
uses 0

Case analysis applies the core, convolution, pointwise, structural, and normalization transfer proofs. Unary stored-weight and binary tensor matrix multiplication are distinguished by their parent counts.

Theorem8.5.26
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 2
Reverse dependency previews
Preview
Theorem 8.5.22
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

Under the same arithmetic assumptions, every box returned by the executable runIBP encloses its node's real value. Parents precede their consumers, inputs lie in their seed boxes, and every node satisfies RealNodeEquation. There is no operation-kind restriction or intermediate enclosure hypothesis. The reals and the rounded-real FP32 model have the required scalar instances and nonnegative default epsilon.

The theorem constrains successful entries. Invalid shapes, missing parameters, and unavailable arithmetic transfers can still return none.

Lean code for Theorem8.5.26●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.DirectedBackward.runIBP_encloses_all {α : Type}
      [TorchLean.Storage α] [Context α] [NN.MLTheory.CROWN.BoundOps α]
      [NN.MLTheory.CROWN.LawfulBoundOps α]
      [NN.MLTheory.CROWN.NonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulNonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulMinBoundOps α] (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore α)
      (hepsilon :
        0 ≤
          NN.MLTheory.CROWN.LawfulBoundOps.toReal
            TorchLean.normalizationEpsilon)
      {dims : ℕ → ℕ} {v : ℕ → ℕ → ℝ}
      (hparent : ∀ id < g.nodes.size, ∀ p ∈ g.nodes[id]!.parents, p < id)
      (hinputs :
        NN.MLTheory.CROWN.Graph.DirectedBackward.InputsInBoxes g.nodes ps
          dims v)
      (hequation :
        ∀ id < g.nodes.size,
          NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation g.nodes
            ps (g.runIBP ps) dims v id)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (box : NN.MLTheory.CROWN.FlatBox α),
          (g.runIBP ps)[id]! = some box →
            NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses box
              (dims id) (v id)
    theorem NN.MLTheory.CROWN.Graph.DirectedBackward.runIBP_encloses_all
      {α : Type} [TorchLean.Storage α]
      [Context α]
      [NN.MLTheory.CROWN.BoundOps α]
      [NN.MLTheory.CROWN.LawfulBoundOps α]
      [NN.MLTheory.CROWN.NonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulNonlinearBoundOps
          α]
      [NN.MLTheory.CROWN.LawfulMinBoundOps α]
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore α)
      (hepsilon :
        0 ≤
          NN.MLTheory.CROWN.LawfulBoundOps.toReal
            TorchLean.normalizationEpsilon)
      {dims : ℕ → ℕ} {v : ℕ → ℕ → ℝ}
      (hparent :
        ∀ id < g.nodes.size,
          ∀ p ∈ g.nodes[id]!.parents, p < id)
      (hinputs :
        NN.MLTheory.CROWN.Graph.DirectedBackward.InputsInBoxes
          g.nodes ps dims v)
      (hequation :
        ∀ id < g.nodes.size,
          NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation
            g.nodes ps (g.runIBP ps) dims v
            id)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (box : NN.MLTheory.CROWN.FlatBox α),
          (g.runIBP ps)[id]! = some box →
            NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses
              box (dims id) (v id)
    The complete rounded forward pass encloses every real node value for which it returns a box.
    
    Inputs lie in their seeded boxes, parents precede consumers, and nodes obey their actual real
    equations. The proof supplies all intermediate enclosures by induction, including convolution,
    binary matrix multiplication, structural operations, normalization, and random realizations.
    
Proof for Theorem 8.5.26

Induction along the node order supplies each parent's enclosure before applying the transfer theorem. runIBP_encloses_of_step carries this argument through the executable array construction.

Theorem8.5.27
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

With in-bounds parents and dimension agreement between each available parent box and its real value, the actual real node equation implies the equation consumed by the backward sweep. For convolution, the accepted geometry has positive dilation, so each matrix coefficient is a stored weight or zero. Interpreting this matrix therefore agrees with the exact real spatial convolution without assuming that ordinary scalar addition is exact. Structural operations use the same coordinate maps in both directions.

Lean code for Theorem8.5.27●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation.nodeEquation
      {α : Type} [TorchLean.Storage α] [Context α]
      [NN.MLTheory.CROWN.BoundOps α] [NN.MLTheory.CROWN.LawfulBoundOps α]
      {nodes : Array NN.MLTheory.CROWN.Graph.Node}
      {ps : NN.MLTheory.CROWN.Graph.ParamStore α}
      {ibp : Array (Option (NN.MLTheory.CROWN.FlatBox α))} {dims : ℕ → ℕ}
      {v : ℕ → ℕ → ℝ} {id : ℕ}
      (heq :
        NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation nodes ps
          ibp dims v id)
      (hparents : ∀ p ∈ nodes[id]!.parents, p < nodes.size)
      (hdims :
        ∀ p ∈ nodes[id]!.parents,
          ∀ (box : NN.MLTheory.CROWN.FlatBox α),
            ibp[p]! = some box → box.dim = dims p) :
      NN.MLTheory.CROWN.Graph.DirectedBackward.NodeEquation nodes ps ibp
        dims v id
    theorem NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation.nodeEquation
      {α : Type} [TorchLean.Storage α]
      [Context α]
      [NN.MLTheory.CROWN.BoundOps α]
      [NN.MLTheory.CROWN.LawfulBoundOps α]
      {nodes :
        Array NN.MLTheory.CROWN.Graph.Node}
      {ps :
        NN.MLTheory.CROWN.Graph.ParamStore α}
      {ibp :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox α))}
      {dims : ℕ → ℕ} {v : ℕ → ℕ → ℝ} {id : ℕ}
      (heq :
        NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation
          nodes ps ibp dims v id)
      (hparents :
        ∀ p ∈ nodes[id]!.parents,
          p < nodes.size)
      (hdims :
        ∀ p ∈ nodes[id]!.parents,
          ∀
            (box :
              NN.MLTheory.CROWN.FlatBox α),
            ibp[p]! = some box →
              box.dim = dims p) :
      NN.MLTheory.CROWN.Graph.DirectedBackward.NodeEquation
        nodes ps ibp dims v id
    Real node semantics supplies each equation consumed by the backward sweep.
    
    The legacy sum equation also records parent row widths. `hdims` supplies this shape fact;
    `GraphPoint.ofRunIBPAll` derives it from the completed forward pass. 
Proof for Theorem 8.5.27
uses 0

The convolution and structural bridges handle their respective operation kinds. The remaining cases follow from the corresponding clauses of RealNodeEquation. The backward sum clause also records the parent row width; the full forward theorem supplies this dimension agreement.

Theorem8.5.28
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

Under the arithmetic and real-node hypotheses of the full forward theorem, with exact affine reassociation disabled, a successful rounded CROWN objective query returns an interval containing its real output objective. The graph must have consistent node identifiers, ordered parents, and valid input, output, and objective dimensions; the supplied input box must enclose the real input. The rounded-real FP32 instance satisfies the scalar requirements.

Forward IBP, directed backward propagation, interval fallbacks, and final affine-bound evaluation are composed in this result. There is no intermediate enclosure hypothesis or second node equation to assume. The theorem concerns a successful .ok result; it does not guarantee that every query succeeds or yields a tighter bound than IBP.

Lean code for Theorem8.5.28●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.DirectedBackward.backwardObjectiveBox_encloses_runIBP_all
      {α : Type} [TorchLean.Storage α] [Context α]
      [NN.MLTheory.CROWN.BoundOps α] [NN.MLTheory.CROWN.LawfulBoundOps α]
      [NN.MLTheory.CROWN.NonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulNonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulMinBoundOps α]
      (hrounded :
        NN.MLTheory.CROWN.BoundOps.supportsExactAffineReassociation α =
          false)
      {g : NN.MLTheory.CROWN.Graph}
      {ps : NN.MLTheory.CROWN.Graph.ParamStore α}
      {ctx : NN.MLTheory.CROWN.Graph.AffineCtx} {dims : ℕ → ℕ}
      {v : ℕ → ℕ → ℝ} (input_lt : ctx.inputId < g.nodes.size)
      (input_dim : dims ctx.inputId = ctx.inputDim)
      (input_kind : g.nodes[ctx.inputId]!.kind = NN.IR.OpKind.input)
      (node_id : ∀ id < g.nodes.size, g.nodes[id]!.id = id)
      (parent_lt : ∀ id < g.nodes.size, ∀ p ∈ g.nodes[id]!.parents, p < id)
      (hepsilon :
        0 ≤
          NN.MLTheory.CROWN.LawfulBoundOps.toReal
            TorchLean.normalizationEpsilon)
      (hinputs :
        NN.MLTheory.CROWN.Graph.DirectedBackward.InputsInBoxes g.nodes ps
          dims v)
      (equation :
        ∀ id < g.nodes.size,
          NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation g.nodes
            ps (g.runIBP ps) dims v id)
      (xB : NN.MLTheory.CROWN.FlatBox α)
      (hx :
        NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses xB ctx.inputDim
          (v ctx.inputId))
      (output : ℕ) (houtput : output < g.nodes.size)
      (obj : NN.MLTheory.CROWN.Graph.FlatTensor α)
      (hdim : obj.n = dims output) {result : NN.MLTheory.CROWN.FlatBox α}
      (hresult :
        g.backwardObjectiveBox? ps ctx (g.runIBP ps) xB output obj =
          Except.ok result) :
      NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses result 1 fun x =>
        NN.MLTheory.CROWN.Graph.DirectedBackward.dot (dims output)
          (fun i =>
            NN.MLTheory.CROWN.LawfulBoundOps.toReal
              (Spec.getAtOrZero obj.v [i]))
          (v output)
    theorem NN.MLTheory.CROWN.Graph.DirectedBackward.backwardObjectiveBox_encloses_runIBP_all
      {α : Type} [TorchLean.Storage α]
      [Context α]
      [NN.MLTheory.CROWN.BoundOps α]
      [NN.MLTheory.CROWN.LawfulBoundOps α]
      [NN.MLTheory.CROWN.NonlinearBoundOps α]
      [NN.MLTheory.CROWN.LawfulNonlinearBoundOps
          α]
      [NN.MLTheory.CROWN.LawfulMinBoundOps α]
      (hrounded :
        NN.MLTheory.CROWN.BoundOps.supportsExactAffineReassociation
            α =
          false)
      {g : NN.MLTheory.CROWN.Graph}
      {ps :
        NN.MLTheory.CROWN.Graph.ParamStore α}
      {ctx :
        NN.MLTheory.CROWN.Graph.AffineCtx}
      {dims : ℕ → ℕ} {v : ℕ → ℕ → ℝ}
      (input_lt : ctx.inputId < g.nodes.size)
      (input_dim :
        dims ctx.inputId = ctx.inputDim)
      (input_kind :
        g.nodes[ctx.inputId]!.kind =
          NN.IR.OpKind.input)
      (node_id :
        ∀ id < g.nodes.size,
          g.nodes[id]!.id = id)
      (parent_lt :
        ∀ id < g.nodes.size,
          ∀ p ∈ g.nodes[id]!.parents, p < id)
      (hepsilon :
        0 ≤
          NN.MLTheory.CROWN.LawfulBoundOps.toReal
            TorchLean.normalizationEpsilon)
      (hinputs :
        NN.MLTheory.CROWN.Graph.DirectedBackward.InputsInBoxes
          g.nodes ps dims v)
      (equation :
        ∀ id < g.nodes.size,
          NN.MLTheory.CROWN.Graph.DirectedBackward.RealNodeEquation
            g.nodes ps (g.runIBP ps) dims v
            id)
      (xB : NN.MLTheory.CROWN.FlatBox α)
      (hx :
        NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses
          xB ctx.inputDim (v ctx.inputId))
      (output : ℕ)
      (houtput : output < g.nodes.size)
      (obj :
        NN.MLTheory.CROWN.Graph.FlatTensor α)
      (hdim : obj.n = dims output)
      {result : NN.MLTheory.CROWN.FlatBox α}
      (hresult :
        g.backwardObjectiveBox? ps ctx
            (g.runIBP ps) xB output obj =
          Except.ok result) :
      NN.MLTheory.CROWN.Graph.DirectedBackward.RowEncloses
        result 1 fun x =>
        NN.MLTheory.CROWN.Graph.DirectedBackward.dot
          (dims output)
          (fun i =>
            NN.MLTheory.CROWN.LawfulBoundOps.toReal
              (Spec.getAtOrZero obj.v [i]))
          (v output)
    Forward IBP, rounded backward propagation, and final interval evaluation enclose the real
    objective for every graph operation. Intermediate bounds are proved from the input boxes. 
Proof for Theorem 8.5.28
Proof uses 2
Proof dependency previews
Preview
Theorem 8.5.26
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

GraphPoint.ofRunIBPAll derives the intermediate enclosures from the full forward theorem and the backward equations from the semantic bridge. Directed backward soundness and the outward-rounded affine evaluator then enclose the objective.

Theorem8.5.29
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

For the bridged node kinds, when the IR payload matches the CROWN parameter store and the IR input is lifted to the CROWN input map, a successful step of the IR node evaluator equals the CROWN node evaluator on the lifted value table. Linear nodes additionally require vector-shaped parents. Present parents must have their declared shapes; successful Graph.denoteAll execution supplies this invariant, including at intermediate prefixes. The bridge covers vector and broadcast matmul, grouped convolution, and concatenation along any valid axis. This is the per-node link between the shared IR semantics and the graph semantics that the bound theorems above are stated against.

Lean code for Theorem8.5.29●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.CertSoundness.evalNode_bridge
      (nodes : Array NN.MLTheory.CROWN.Graph.Node)
      (payload : NN.IR.Payload ℝ)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (input : Spec.SomeTensor ℝ)
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (rvals : Array (Spec.SomeTensor ℝ)) (i : ℕ)
      (n : NN.MLTheory.CROWN.Graph.Node) (t : Spec.SomeTensor ℝ)
      (hps :
        NN.MLTheory.CROWN.Graph.CertSoundness.PayloadMatches payload ps)
      (hin :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsLift nodes input inputs)
      (hi : i < nodes.size) (hn : nodes[i]! = n) (hid : n.id = i)
      (hkind : NN.MLTheory.CROWN.Graph.CertSoundness.Bridged n.kind)
      (hshapes :
        NN.MLTheory.CROWN.Graph.CertSoundness.ParentShapesMatch nodes n
          rvals)
      (hvec :
        n.kind = NN.IR.OpKind.linear →
          ∀ p ∈ n.parents,
            ∀ (r : Spec.SomeTensor ℝ),
              rvals[p]? = some r →
                NN.MLTheory.CROWN.Graph.CertSoundness.IsVector r)
      (heval : NN.IR.Graph.evalNode payload input rvals i n = Except.ok t) :
      NN.MLTheory.CROWN.Graph.CertSoundness.evalNode? nodes ps inputs
          (NN.MLTheory.CROWN.Graph.CertSoundness.liftVals rvals) i =
        some (NN.MLTheory.CROWN.Graph.CertSoundness.flatOfSome t)
    theorem NN.MLTheory.CROWN.Graph.CertSoundness.evalNode_bridge
      (nodes :
        Array NN.MLTheory.CROWN.Graph.Node)
      (payload : NN.IR.Payload ℝ)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (input : Spec.SomeTensor ℝ)
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (rvals : Array (Spec.SomeTensor ℝ))
      (i : ℕ)
      (n : NN.MLTheory.CROWN.Graph.Node)
      (t : Spec.SomeTensor ℝ)
      (hps :
        NN.MLTheory.CROWN.Graph.CertSoundness.PayloadMatches
          payload ps)
      (hin :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsLift
          nodes input inputs)
      (hi : i < nodes.size)
      (hn : nodes[i]! = n) (hid : n.id = i)
      (hkind :
        NN.MLTheory.CROWN.Graph.CertSoundness.Bridged
          n.kind)
      (hshapes :
        NN.MLTheory.CROWN.Graph.CertSoundness.ParentShapesMatch
          nodes n rvals)
      (hvec :
        n.kind = NN.IR.OpKind.linear →
          ∀ p ∈ n.parents,
            ∀ (r : Spec.SomeTensor ℝ),
              rvals[p]? = some r →
                NN.MLTheory.CROWN.Graph.CertSoundness.IsVector
                  r)
      (heval :
        NN.IR.Graph.evalNode payload input
            rvals i n =
          Except.ok t) :
      NN.MLTheory.CROWN.Graph.CertSoundness.evalNode?
          nodes ps inputs
          (NN.MLTheory.CROWN.Graph.CertSoundness.liftVals
            rvals)
          i =
        some
          (NN.MLTheory.CROWN.Graph.CertSoundness.flatOfSome
            t)
    A successful runtime evaluation of a bridged node is reproduced by the proof-side semantics on the
    flattened value table.
    
    Hypotheses: the node record `n` sits at index `i` with `n.id = i` (the id discipline that
    `Graph.denoteAll` checks), the parameter stores agree (`PayloadMatches`), the proof-side inputs are
    the flattened runtime input (`InputsLift`), present parents have their declared shapes
    (`ParentShapesMatch`), the node kind is bridged, and a `linear` node has a vector-shaped parent.
    The conclusion is exact equality of flat values for one node. `denoteAll_semLocalOK` below is the
    trace-level induction that turns it into `SemLocalOK` for the flattened runtime table.
    
Proof for Theorem 8.5.29

Case analysis over the bridged operation kinds, unfolding both evaluators and the flattening of shape-tagged tensors to flat values.

Theorem8.5.30
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

Under the hypotheses of the per-node bridge at every node, and with parents preceding their children, a successful Graph.denoteAll run flattens to a value table that satisfies SemLocalOK. The certificate enclosure theorems above take exactly this premise, so they apply to runtime IR values on the bridged node kinds.

Lean code for Theorem8.5.30●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.CertSoundness.denoteAll_semLocalOK
      (graph : NN.IR.Graph) (payload : NN.IR.Payload ℝ)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (input : Spec.SomeTensor ℝ)
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (values : Array (Spec.SomeTensor ℝ))
      (hps :
        NN.MLTheory.CROWN.Graph.CertSoundness.PayloadMatches payload ps)
      (hin :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsLift graph.nodes input
          inputs)
      (htopo :
        ∀ id < graph.nodes.size, ∀ p ∈ graph.nodes[id]!.parents, p < id)
      (hkind :
        ∀ id < graph.nodes.size,
          NN.MLTheory.CROWN.Graph.CertSoundness.Bridged
            graph.nodes[id]!.kind)
      (hvec :
        ∀ id < graph.nodes.size,
          graph.nodes[id]!.kind = NN.IR.OpKind.linear →
            ∀ p ∈ graph.nodes[id]!.parents,
              ∀ (r : Spec.SomeTensor ℝ),
                values[p]? = some r →
                  NN.MLTheory.CROWN.Graph.CertSoundness.IsVector r)
      (heval : graph.denoteAll payload input = Except.ok values) :
      NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK graph ps inputs
        (NN.MLTheory.CROWN.Graph.CertSoundness.liftVals values)
    theorem NN.MLTheory.CROWN.Graph.CertSoundness.denoteAll_semLocalOK
      (graph : NN.IR.Graph)
      (payload : NN.IR.Payload ℝ)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (input : Spec.SomeTensor ℝ)
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (values : Array (Spec.SomeTensor ℝ))
      (hps :
        NN.MLTheory.CROWN.Graph.CertSoundness.PayloadMatches
          payload ps)
      (hin :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsLift
          graph.nodes input inputs)
      (htopo :
        ∀ id < graph.nodes.size,
          ∀ p ∈ graph.nodes[id]!.parents,
            p < id)
      (hkind :
        ∀ id < graph.nodes.size,
          NN.MLTheory.CROWN.Graph.CertSoundness.Bridged
            graph.nodes[id]!.kind)
      (hvec :
        ∀ id < graph.nodes.size,
          graph.nodes[id]!.kind =
              NN.IR.OpKind.linear →
            ∀ p ∈ graph.nodes[id]!.parents,
              ∀ (r : Spec.SomeTensor ℝ),
                values[p]? = some r →
                  NN.MLTheory.CROWN.Graph.CertSoundness.IsVector
                    r)
      (heval :
        graph.denoteAll payload input =
          Except.ok values) :
      NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK
        graph ps inputs
        (NN.MLTheory.CROWN.Graph.CertSoundness.liftVals
          values)
    Trace-level bridge: a successful runtime evaluation `graph.denoteAll`, flattened, is a semantic
    interpretation of the graph in the sense of `SemLocalOK`.
    
    The hypotheses are those of `evalNode_bridge`, required at every node: the parameter stores agree,
    the proof-side inputs are the flattened runtime input, every node kind is bridged, and every
    `linear` node has vector-shaped parents in the runtime table. `htopo` says that parents precede
    their children (the `TopoSorted` condition), which `denoteAll` checks at run time. The id
    discipline and the parent shapes come from the successful run itself. The conclusion is the
    `SemLocalOK` premise of the certificate soundness theorems, so their enclosure results apply to the
    flattened runtime values.
    
Proof for Theorem 8.5.30
uses 0

Induction along the denoteAllFrom loop gives, for each node, the prefix table on which the runtime evaluated it. The per-node bridge equates that step with the CROWN node evaluator on the lifted prefix, and the CROWN evaluator reads only parent entries, which the prefix and the final table share.

Definition8.5.31
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 3
Reverse dependency previews
Preview
Theorem 8.5.32
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

An affine transfer implementation satisfies this contract when each backward transfer preserves the represented lower and upper bounds.

Lean code for Definition8.5.31●1 definition
  • def NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownTransferSound
      (g : NN.MLTheory.CROWN.Graph)
      (_ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (_inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals : Array (Option NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx : NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (step :
        Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)) →
          ℕ → Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ))
      (cert : Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ))) :
      Prop
    def NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownTransferSound
      (g : NN.MLTheory.CROWN.Graph)
      (_ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (_inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals :
        Array
          (Option
            NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx :
        NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (step :
        Array
            (Option
              (NN.MLTheory.CROWN.Graph.FlatAffineBounds
                ℝ)) →
          ℕ →
            Option
              (NN.MLTheory.CROWN.Graph.FlatAffineBounds
                ℝ))
      (cert :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ))) :
      Prop
    Each node's step rule is sound: parents enclosing their values force the node to enclose its
    own. This is the assumption a certificate format has to discharge to reuse the checker theorem. 
Theorem8.5.32
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

A locally consistent real affine certificate encloses graph semantics when its transfer step satisfies CrownTransferSound.

Lean code for Theorem8.5.32●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.CrownCertSoundness.crown_checker_encloses_semantics
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (step :
        Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)) →
          ℕ → Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ))
      (cert : Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)))
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals : Array (Option NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx : NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK g ps inputs vals)
      (hcert :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK g step
          cert)
      (hsound :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownTransferSound g ps
          inputs vals ctx x step cert)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (b : NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)
          (v : NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          cert[id]! = some b →
            vals[id]! = some v →
              NN.MLTheory.CROWN.Graph.CrownCertSoundness.EnclosesAtInput ctx
                x b v
    theorem NN.MLTheory.CROWN.Graph.CrownCertSoundness.crown_checker_encloses_semantics
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (step :
        Array
            (Option
              (NN.MLTheory.CROWN.Graph.FlatAffineBounds
                ℝ)) →
          ℕ →
            Option
              (NN.MLTheory.CROWN.Graph.FlatAffineBounds
                ℝ))
      (cert :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)))
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals :
        Array
          (Option
            NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx :
        NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK
          g ps inputs vals)
      (hcert :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK
          g step cert)
      (hsound :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownTransferSound
          g ps inputs vals ctx x step cert)
      (id : ℕ) :
      id < g.nodes.size →
        ∀
          (b :
            NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)
          (v :
            NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          cert[id]! = some b →
            vals[id]! = some v →
              NN.MLTheory.CROWN.Graph.CrownCertSoundness.EnclosesAtInput
                ctx x b v
    Wherever both a certificate entry and a semantic value are present, the entry encloses the
    value.
    
    This is the partial form of the main theorem: it says nothing about nodes the checker skipped, which
    is exactly why `crown_checker_encloses_all_nodes` below also takes a coverage hypothesis. 
Proof for Theorem 8.5.32

Reverse topological induction composes the certified affine forms and discharges each node with the transfer-soundness premise.

Theorem8.5.33
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 2
Reverse dependency previews
Preview
Theorem 8.5.34
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

On a topologically sorted graph with locally consistent semantic values, matching inputs, enclosing IBP boxes, and valid slopes (AlphaOK), the concrete real α-CROWN transfer step satisfies the generic transfer contract.

For the supplied α vectors, AlphaOK requires each component to lie between zero and one. These are admissible slopes for the relaxation; the theorem does not ask how the slopes were selected. An optimizer can search for tighter bounds while this local condition remains the same proof obligation for every candidate.

Lean code for Theorem8.5.33●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.alphaCrown_transfer_sound
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp : Array (Option (NN.MLTheory.CROWN.FlatBox ℝ)))
      (alpha : Array (Option (NN.MLTheory.CROWN.Graph.FlatTensor ℝ)))
      (cert : Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)))
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals : Array (Option NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx : NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK g ps inputs vals)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (hibp :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.IBPEnclosesVals
          ibp vals)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK alpha) :
      NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownTransferSound g ps
        inputs vals ctx x
        (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepAlpha g ps
          ibp alpha ctx)
        cert
    theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.alphaCrown_transfer_sound
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox ℝ)))
      (alpha :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatTensor
              ℝ)))
      (cert :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)))
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals :
        Array
          (Option
            NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx :
        NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK
          g ps inputs vals)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (hibp :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.IBPEnclosesVals
          ibp vals)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK
          alpha) :
      NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownTransferSound
        g ps inputs vals ctx x
        (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepAlpha
          g ps ibp alpha ctx)
        cert
    Pointwise soundness of the graph-dialect α-CROWN transfer rule.
    
    Fix a graph `g`, parameters `ps`, an input point `x`, and a locally consistent value semantics
    array `vals` (that is, `vals[id]` agrees with evaluating node `id` from its parents' values).
    
    Assume:
    
    - the designated input node in `inputs` matches `x` (`InputsMatch`),
    - the IBP boxes `ibp` enclose the semantic values in `vals` (`IBPEnclosesVals`), and
    - the α parameters are well-formed (`AlphaOK`).
    
    Then the concrete step function `alphaCrownStepNode?` satisfies the abstract
    `CrownTransferSound` requirement: whenever every parent `p` is enclosed by its certificate entry,
    the current node `id` is enclosed by the step-produced certificate entry as well.
    
    This is the key lemma that lets `alphaCrownStepNode?` plug into the generic end-to-end checker
    theorem in `NN.MLTheory.CROWN.Proofs.GraphCrownCertSoundness`.
    
Proof for Theorem 8.5.33

The proof checks the affine relaxation chosen for each supported operation against the generic transfer contract.

Theorem8.5.34
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 8.5.31
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1✓L∃∀N

Under the same graph, semantic, input, box, and slope hypotheses, the α-CROWN transfer step with ReLU phases satisfies the transfer contract. Nodes without phases reduce to the α-CROWN transfer theorem.

Lean code for Theorem8.5.34●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.phasedCrown_transfer_sound
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp : Array (Option (NN.MLTheory.CROWN.FlatBox ℝ)))
      (alpha : Array (Option (NN.MLTheory.CROWN.Graph.FlatTensor ℝ)))
      (phases : Array (Option (Array ℤ)))
      (cert : Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)))
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals : Array (Option NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx : NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK g ps inputs vals)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (hibp :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.IBPEnclosesVals
          ibp vals)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK alpha) :
      NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownTransferSound g ps
        inputs vals ctx x
        (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepPhased g ps
          ibp alpha phases ctx)
        cert
    theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.phasedCrown_transfer_sound
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox ℝ)))
      (alpha :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatTensor
              ℝ)))
      (phases : Array (Option (Array ℤ)))
      (cert :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)))
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals :
        Array
          (Option
            NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx :
        NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK
          g ps inputs vals)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (hibp :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.IBPEnclosesVals
          ibp vals)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK
          alpha) :
      NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownTransferSound
        g ps inputs vals ctx x
        (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepPhased
          g ps ibp alpha phases ctx)
        cert
    Pointwise soundness of the graph-dialect phased α-CROWN transfer rule.
    
    This is the phase-aware analog of `alphaCrown_transfer_sound`. The step function additionally
    receives a `phases` array of per-ReLU phase constraints (active, inactive, unstable). At a ReLU node
    with phases, `phaseRelaxVec?` checks each phase against the IBP pre-activation interval via
    `phaseConsistentScalar?` (inactive needs `u ≤ 0`, active needs `0 ≤ l`) and, if every phase
    passes, uses the phase's exact affine rule for that unit; an inconsistent phase rejects the step
    rather than falling back to another relaxation. All other nodes use the α-CROWN rule.
    
    What the phases contribute here, and what they do not. Because a phase is accepted only when
    the IBP interval already implies it, the phases can never certify a sign that the supplied
    `ibp` box does not fix on its own; for such stable units the phase rule coincides with the
    standard relaxation, except for an active phase with a zero lower endpoint, where the phase rule
    uses the identity and α-CROWN uses the slope α (or zero when the upper endpoint is zero too).
    The theorem therefore establishes two things about phases: the exact rules are sound whenever the
    consistency check passes, and inconsistent phases are rejected. It does not model branch-and-bound
    split constraints. A split that tightens beyond IBP would have to be
    reflected in a tighter `ibp` argument, which this theorem takes as given through
    `IBPEnclosesVals`.
    
    The theorem states that this concrete step function satisfies `CrownTransferSound`, and thus can
    be used as the trusted checker semantics in `crown_checker_encloses_semantics`.
    
Proof for Theorem 8.5.34

ReLU nodes with phases are handled directly. The remaining nodes reuse the α-CROWN transfer proof.

Theorem8.5.35
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 2
Reverse dependency previews
Preview
Theorem 8.5.36
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The transfer theorems assume IBPEnclosesVals: every IBP box present at a node encloses the semantic value there. On a topologically sorted supported graph with locally consistent boxes and values and enclosed inputs, that assumption follows from IBP soundness.

Lean code for Theorem8.5.35●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.ibp_encloses_vals_of_cert_local_ok
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp : Array (Option (NN.MLTheory.CROWN.FlatBox ℝ)))
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals : Array (Option NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hsupp : NN.MLTheory.CROWN.Graph.CertSoundness.Supported g)
      (hibp : NN.MLTheory.CROWN.Graph.CertSoundness.CertLocalOK g ps ibp)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK g ps inputs vals)
      (hinputs :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed g ps inputs) :
      NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.IBPEnclosesVals
        ibp vals
    theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.ibp_encloses_vals_of_cert_local_ok
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox ℝ)))
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals :
        Array
          (Option
            NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hsupp :
        NN.MLTheory.CROWN.Graph.CertSoundness.Supported
          g)
      (hibp :
        NN.MLTheory.CROWN.Graph.CertSoundness.CertLocalOK
          g ps ibp)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK
          g ps inputs vals)
      (hinputs :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed
          g ps inputs) :
      NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.IBPEnclosesVals
        ibp vals
    A locally consistent IBP certificate encloses every locally consistent semantic interpretation.
    
    This is `CertSoundness.cert_encloses_semantics` repackaged in the shape the α-CROWN transfer
    theorems expect. The hypotheses are exactly those of the IBP theorem: the graph is topologically
    sorted and uses only supported ops, the IBP boxes replay the checker step at every node, the
    values replay the evaluator at every node, and the input values lie inside their seed boxes.
    
Proof for Theorem 8.5.35

The IBP theorem is repackaged in the shape the transfer theorems expect.

Theorem8.5.36
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 2
Reverse dependency previews
Preview
Theorem 8.5.37
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

On a topologically sorted supported graph, given locally consistent IBP boxes and values, enclosed inputs, an input matching the affine context, valid slopes (AlphaOK), and an affine certificate that replays the α-CROWN step (CrownCertLocalOK), every certificate entry encloses the matching semantic value at the input. Unlike the transfer theorem, no IBPEnclosesVals hypothesis remains.

Lean code for Theorem8.5.36●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.alphaCrown_cert_encloses_semantics
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp : Array (Option (NN.MLTheory.CROWN.FlatBox ℝ)))
      (alpha : Array (Option (NN.MLTheory.CROWN.Graph.FlatTensor ℝ)))
      (cert : Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)))
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals : Array (Option NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx : NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hsupp : NN.MLTheory.CROWN.Graph.CertSoundness.Supported g)
      (hibp : NN.MLTheory.CROWN.Graph.CertSoundness.CertLocalOK g ps ibp)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK g ps inputs vals)
      (hinputsEnc :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed g ps inputs)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK alpha)
      (hcert :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK g
          (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepAlpha g
            ps ibp alpha ctx)
          cert)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (b : NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)
          (v : NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          cert[id]! = some b →
            vals[id]! = some v →
              NN.MLTheory.CROWN.Graph.CrownCertSoundness.EnclosesAtInput ctx
                x b v
    theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.alphaCrown_cert_encloses_semantics
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox ℝ)))
      (alpha :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatTensor
              ℝ)))
      (cert :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)))
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals :
        Array
          (Option
            NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx :
        NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hsupp :
        NN.MLTheory.CROWN.Graph.CertSoundness.Supported
          g)
      (hibp :
        NN.MLTheory.CROWN.Graph.CertSoundness.CertLocalOK
          g ps ibp)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK
          g ps inputs vals)
      (hinputsEnc :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed
          g ps inputs)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK
          alpha)
      (hcert :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK
          g
          (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepAlpha
            g ps ibp alpha ctx)
          cert)
      (id : ℕ) :
      id < g.nodes.size →
        ∀
          (b :
            NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)
          (v :
            NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          cert[id]! = some b →
            vals[id]! = some v →
              NN.MLTheory.CROWN.Graph.CrownCertSoundness.EnclosesAtInput
                ctx x b v
    A locally replayed α-CROWN certificate encloses every corresponding graph value, with the IBP
    boxes justified rather than assumed.
    
    Compared with `alphaCrown_transfer_sound`, the hypothesis `IBPEnclosesVals` is replaced by the
    IBP-side hypotheses `Supported g`, `CertLocalOK g ps ibp`, and `InputsEnclosed g ps inputs`.
    
    The conclusion is stated for every node id at which the certificate has an entry `b` and the
    semantics has a value `v`; a node missing either one carries no claim.
    
Proof for Theorem 8.5.36
Proof uses 3
Proof dependency previews
Preview
Theorem 8.5.32
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The generic checker theorem is applied with the α-CROWN transfer, whose IBP hypothesis is discharged by the enclosure lemma.

Theorem8.5.37
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

When the IBP boxes are the proof-side runIBP? g ps and the values are evalGraphRec g ps inputs, the α-CROWN certificate encloses the semantics under only TopoSorted, Supported, the input conditions, AlphaOK, and CrownCertLocalOK. The local-consistency hypotheses on boxes and values are discharged by the definitions of the two passes.

The conclusion quantifies over a node index, a stored affine bound, and a semantic value. The premises saying that the corresponding entries are some b and some v identify which records the enclosure relates. To apply the result to a model output, one supplies its node index and these lookup equalities, then evaluates the affine bound at the chosen enclosed input.

Lean code for Theorem8.5.37●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.alphaCrown_cert_encloses_evalGraphRec
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (alpha : Array (Option (NN.MLTheory.CROWN.Graph.FlatTensor ℝ)))
      (cert : Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)))
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (ctx : NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hsupp : NN.MLTheory.CROWN.Graph.CertSoundness.Supported g)
      (hinputsEnc :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed g ps inputs)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK alpha)
      (hcert :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK g
          (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepAlpha g
            ps (NN.MLTheory.CROWN.Graph.CertSoundness.runIBP? g ps) alpha
            ctx)
          cert)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (b : NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)
          (v : NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          cert[id]! = some b →
            (NN.MLTheory.CROWN.Graph.CertSoundness.evalGraphRec g ps
                    inputs)[id]! =
                some v →
              NN.MLTheory.CROWN.Graph.CrownCertSoundness.EnclosesAtInput ctx
                x b v
    theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.alphaCrown_cert_encloses_evalGraphRec
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (alpha :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatTensor
              ℝ)))
      (cert :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)))
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (ctx :
        NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hsupp :
        NN.MLTheory.CROWN.Graph.CertSoundness.Supported
          g)
      (hinputsEnc :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed
          g ps inputs)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK
          alpha)
      (hcert :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK
          g
          (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepAlpha
            g ps
            (NN.MLTheory.CROWN.Graph.CertSoundness.runIBP?
              g ps)
            alpha ctx)
          cert)
      (id : ℕ) :
      id < g.nodes.size →
        ∀
          (b :
            NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)
          (v :
            NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          cert[id]! = some b →
            (NN.MLTheory.CROWN.Graph.CertSoundness.evalGraphRec
                    g ps inputs)[id]! =
                some v →
              NN.MLTheory.CROWN.Graph.CrownCertSoundness.EnclosesAtInput
                ctx x b v
    α-CROWN enclosure against the total IBP pass and the total evaluator.
    
    Here the IBP boxes are `runIBP? g ps` and the values are `evalGraphRec g ps inputs`, so the only
    remaining hypotheses about the graph are `TopoSorted`, `Supported`, and the input conditions.
    
Proof for Theorem 8.5.37
Proof uses 2
Proof dependency previews
Preview
Theorem 8.5.20
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The α-CROWN corollary with the local-consistency lemmas for runIBP? and evalGraphRec, the same lemmas that drive the IBP end-to-end theorem.

Theorem8.5.38
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

The phased analogue of the α-CROWN corollary: with per-node ReLU phases and a certificate replaying the phased step, every certificate entry encloses the semantic value, with the IBP enclosure hypothesis discharged rather than assumed.

Lean code for Theorem8.5.38●1 theorem
  • theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.phasedCrown_cert_encloses_semantics
      (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp : Array (Option (NN.MLTheory.CROWN.FlatBox ℝ)))
      (alpha : Array (Option (NN.MLTheory.CROWN.Graph.FlatTensor ℝ)))
      (phases : Array (Option (Array ℤ)))
      (cert : Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)))
      (inputs : Std.HashMap ℕ NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals : Array (Option NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx : NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo : NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted g)
      (hsupp : NN.MLTheory.CROWN.Graph.CertSoundness.Supported g)
      (hibp : NN.MLTheory.CROWN.Graph.CertSoundness.CertLocalOK g ps ibp)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK g ps inputs vals)
      (hinputsEnc :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed g ps inputs)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK alpha)
      (hcert :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK g
          (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepPhased g
            ps ibp alpha phases ctx)
          cert)
      (id : ℕ) :
      id < g.nodes.size →
        ∀ (b : NN.MLTheory.CROWN.Graph.FlatAffineBounds ℝ)
          (v : NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          cert[id]! = some b →
            vals[id]! = some v →
              NN.MLTheory.CROWN.Graph.CrownCertSoundness.EnclosesAtInput ctx
                x b v
    theorem NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.phasedCrown_cert_encloses_semantics
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore ℝ)
      (ibp :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox ℝ)))
      (alpha :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatTensor
              ℝ)))
      (phases : Array (Option (Array ℤ)))
      (cert :
        Array
          (Option
            (NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)))
      (inputs :
        Std.HashMap ℕ
          NN.MLTheory.CROWN.Graph.CertSoundness.Val)
      (vals :
        Array
          (Option
            NN.MLTheory.CROWN.Graph.CertSoundness.Val))
      (ctx :
        NN.MLTheory.CROWN.Graph.AffineCtx)
      (x : TorchLean.Tensor ℝ [ctx.inputDim])
      (htopo :
        NN.MLTheory.CROWN.Graph.CertSoundness.TopoSorted
          g)
      (hsupp :
        NN.MLTheory.CROWN.Graph.CertSoundness.Supported
          g)
      (hibp :
        NN.MLTheory.CROWN.Graph.CertSoundness.CertLocalOK
          g ps ibp)
      (hsem :
        NN.MLTheory.CROWN.Graph.CertSoundness.SemLocalOK
          g ps inputs vals)
      (hinputsEnc :
        NN.MLTheory.CROWN.Graph.CertSoundness.InputsEnclosed
          g ps inputs)
      (hinputs :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.InputsMatch
          inputs ctx x)
      (halpha :
        NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.AlphaOK
          alpha)
      (hcert :
        NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK
          g
          (NN.MLTheory.CROWN.Graph.AlphaCrownTransferSoundness.stepPhased
            g ps ibp alpha phases ctx)
          cert)
      (id : ℕ) :
      id < g.nodes.size →
        ∀
          (b :
            NN.MLTheory.CROWN.Graph.FlatAffineBounds
              ℝ)
          (v :
            NN.MLTheory.CROWN.Graph.CertSoundness.Val),
          cert[id]! = some b →
            vals[id]! = some v →
              NN.MLTheory.CROWN.Graph.CrownCertSoundness.EnclosesAtInput
                ctx x b v
    A locally replayed phased α-CROWN certificate encloses every corresponding graph value, with the IBP
    boxes justified rather than assumed.
    
    This is `phasedCrown_cert_encloses_semantics_of_ibpEnclosesVals` with `IBPEnclosesVals`
    discharged from the IBP soundness theorem; see `alphaCrown_cert_encloses_semantics` for the
    hypothesis trade.
    
Proof for Theorem 8.5.38
Proof uses 2
Proof dependency previews
Preview
Theorem 8.5.34
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The phased transfer theorem composed with the enclosure lemma through the generic checker theorem.

Definition8.5.39
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

The fixed-relaxation runner takes IBP bounds, infers stable ReLU phases, and replays the phased α-CROWN affine pass. Its outputBoxPhasedCROWN? caller computes the IBP bounds first. Unstable phases remain unsplit; no β multipliers are optimized, and this runner does not implement the branch-and-bound search of the external alpha-beta-CROWN verifier.

Lean code for Definition8.5.39●1 definition
  • def NN.MLTheory.CROWN.Cert.runPhasedCROWN {α : Type} [TorchLean.Storage α]
      [Context α] (g : NN.MLTheory.CROWN.Graph)
      (ps : NN.MLTheory.CROWN.Graph.ParamStore α)
      (ctx : NN.MLTheory.CROWN.Graph.AffineCtx)
      (ibp : Array (Option (NN.MLTheory.CROWN.FlatBox α))) :
      Array (Option (NN.MLTheory.CROWN.Graph.FlatAffineBounds α))
    def NN.MLTheory.CROWN.Cert.runPhasedCROWN
      {α : Type} [TorchLean.Storage α]
      [Context α]
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore α)
      (ctx :
        NN.MLTheory.CROWN.Graph.AffineCtx)
      (ibp :
        Array
          (Option
            (NN.MLTheory.CROWN.FlatBox α))) :
      Array
        (Option
          (NN.MLTheory.CROWN.Graph.FlatAffineBounds
            α))
    Run the fixed-relaxation α-CROWN graph pass with IBP phase annotations.
    
    Stable ReLU phases come from IBP and are checked again by `phasedCrownStepNode?`. Unstable
    neurons use the default α-CROWN lower relaxation. No β multipliers are optimized and no neuron is
    split.
    
Definition8.5.40
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

The executable checker parses and replays a FloatLib binary32 node certificate, with or without ReLU phases. Its final acceptance decision has a proved bridge to the proposition-level local replay condition. Connecting that binary32 condition to the real enclosure in Theorem 8.5.32 still requires the refinement assumptions for the operations in the graph.

Lean code for Definition8.5.40●1 definition
  • def NN.Verification.Cert.CROWNNodeCert.check (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore
          (FloatLib.Floats.ExecFloat.Binary 8 23
            FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee
            (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias
              8)
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_1
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_2
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_3
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_4))
      (path : String) : IO Bool
    def NN.Verification.Cert.CROWNNodeCert.check
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore
          (FloatLib.Floats.ExecFloat.Binary 8
            23
            FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee
            (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias
              8)
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_1
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_2
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_3
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_4))
      (path : String) : IO Bool
    Check a per-node CROWN certificate against Lean's propagation rules.
    
    Returns `true` iff every supplied IBP box contains Lean's authoritative recomputation and every
    node's affine replay data agrees exactly with Lean's step.
    
    The per-node loop is part of the verdict: it checks IBP containment, parent coverage, shape and
    domain preconditions, and dimensions, which the pure replay in `accepts` does not. The pure replay
    runs only when the loop passes. The certificate's `ibp` boxes are only checked for containment;
    replay uses Lean's own IBP pass, so they add no information to the affine check.
    
Theorem8.5.41
Group: Interval and affine certificate soundness. (22)
Group member previews
Preview
Theorem 8.5.19
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

Acceptance of the in-memory CROWN decision implies CrownCertLocalOK for the exact FloatLib binary32 replay step used by the checker.

Lean code for Theorem8.5.41●1 theorem
  • complete
    theorem NN.Verification.Cert.CROWNNodeCert.accepts_eq_true
      (cert : NN.Verification.Cert.NodeReplay.CROWNCertificate)
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore
          (FloatLib.Floats.ExecFloat.Binary 8 23
            FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee
            (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias
              8)
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_1
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_2
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_3
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_4))
      (authoritativeIbp :
        Array
          (Option
            (NN.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)
                NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_1
                NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_2
                NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_3
                NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_4))))
      (diagnosticsOk : Bool)
      (haccept :
        NN.Verification.Cert.CROWNNodeCert.accepts cert g ps
            authoritativeIbp diagnosticsOk =
          true) :
      NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK g
        (NN.Verification.Cert.CROWNNodeCert.replayStep g ps authoritativeIbp
          cert)
        cert.crown
    theorem NN.Verification.Cert.CROWNNodeCert.accepts_eq_true
      (cert :
        NN.Verification.Cert.NodeReplay.CROWNCertificate)
      (g : NN.MLTheory.CROWN.Graph)
      (ps :
        NN.MLTheory.CROWN.Graph.ParamStore
          (FloatLib.Floats.ExecFloat.Binary 8
            23
            FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee
            (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias
              8)
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_1
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_2
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_3
            NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_4))
      (authoritativeIbp :
        Array
          (Option
            (NN.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)
                NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_1
                NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_2
                NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_3
                NN.Verification.Cert.CROWNNodeCert.checkNodeEntries._proof_4))))
      (diagnosticsOk : Bool)
      (haccept :
        NN.Verification.Cert.CROWNNodeCert.accepts
            cert g ps authoritativeIbp
            diagnosticsOk =
          true) :
      NN.MLTheory.CROWN.Graph.CrownCertSoundness.CrownCertLocalOK
        g
        (NN.Verification.Cert.CROWNNodeCert.replayStep
          g ps authoritativeIbp cert)
        cert.crown
    Acceptance supplies graph-level local consistency of the replay. 
Proof for Theorem 8.5.41
uses 0

The checker compares every dependent affine record bit-for-bit. Soundness of the tensor, matrix, affine-vector, and optional-record comparisons turns the successful Boolean replay into equality at every graph node.

The type of accepts_eq_true fixes the graph, parameter store, authoritative IBP array, and certificate before asking for acceptance. Its result refers to the replay step built from those same arguments. This prevents a successful check for one parameter store from being reused as a local-consistency proof for a different checkpoint.

Theorem8.5.42
Group: Specification-layer kernels identified with their analytic presentations. (7)
Group member previews
Preview
Theorem 8.5.43
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 2
Reverse dependency previews
Preview
Theorem 8.5.43
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The specification softmax Activation.softmaxSpec 0 on a real vector, which uses the numerically stable max-shifted form, is Fréchet differentiable after vectorization, with the derivative of the analytic softmaxVec. hasFDerivAt_logSoftmaxSpec_vec gives the corresponding result for log-softmax.

Lean code for Theorem8.5.42●1 theorem
  • complete
    theorem Proofs.Autograd.hasFDerivAt_softmaxSpec_vec {n : ℕ}
      (xV : Proofs.Autograd.Vec n) :
      HasFDerivAt
        (fun xV =>
          Proofs.Autograd.getScalarE
            (Activation.softmaxSpec 0 (Proofs.Autograd.ofFnE xV)))
        (Proofs.Autograd.softmaxDerivCLM xV) xV
    theorem Proofs.Autograd.hasFDerivAt_softmaxSpec_vec
      {n : ℕ} (xV : Proofs.Autograd.Vec n) :
      HasFDerivAt
        (fun xV =>
          Proofs.Autograd.getScalarE
            (Activation.softmaxSpec 0
              (Proofs.Autograd.ofFnE xV)))
        (Proofs.Autograd.softmaxDerivCLM xV)
        xV
    Axis-`0` spec softmax on vectors is Fréchet-differentiable with derivative
    `softmaxDerivCLM`. 
Proof for Theorem 8.5.42
uses 0

The spec kernel is identified coordinatewise with the analytic softmax; the max shift cancels in the quotient, and the analytic derivative transfers.

This avoids differentiating the maximum itself at tied coordinates. Multiplying every exponential by the same positive factor leaves the normalized quotient unchanged, so the smooth analytic function describes the entire shifted implementation, including ties. HasFDerivAt then records that function, its continuous linear derivative, and the input point where the claim holds.

Theorem8.5.43
Group: Specification-layer kernels identified with their analytic presentations. (7)
Group member previews
Preview
Theorem 8.5.42
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

The specification backward rule Activation.softmaxBackwardSpec 0 on a real vector is the vector-Jacobian product of the specification softmax at that point. logSoftmaxBackwardSpec_eq_vjp gives the corresponding result for log-softmax.

Lean code for Theorem8.5.43●1 theorem
  • complete
    theorem Proofs.Autograd.softmaxBackwardSpec_eq_vjp {n : ℕ}
      (x δ : TorchLean.Tensor ℝ [n]) :
      Proofs.Autograd.getScalarE (Activation.softmaxBackwardSpec 0 x δ) =
        (Proofs.Autograd.vjp
            (fun xV =>
              Proofs.Autograd.getScalarE
                (Activation.softmaxSpec 0 (Proofs.Autograd.ofFnE xV)))
            (Proofs.Autograd.getScalarE x))
          (Proofs.Autograd.getScalarE δ)
    theorem Proofs.Autograd.softmaxBackwardSpec_eq_vjp
      {n : ℕ} (x δ : TorchLean.Tensor ℝ [n]) :
      Proofs.Autograd.getScalarE
          (Activation.softmaxBackwardSpec 0 x
            δ) =
        (Proofs.Autograd.vjp
            (fun xV =>
              Proofs.Autograd.getScalarE
                (Activation.softmaxSpec 0
                  (Proofs.Autograd.ofFnE xV)))
            (Proofs.Autograd.getScalarE x))
          (Proofs.Autograd.getScalarE δ)
    The spec softmax backward is the vector-Jacobian product of the spec softmax forward. 
Proof for Theorem 8.5.43

softmaxFDerivCorrect packages the kernel as an OpSpecFDerivCorrect using the derivative theorem; its backward_eq_adjoint_fderiv field gives the identity.

Theorem8.5.44
Group: Specification-layer kernels identified with their analytic presentations. (7)
Group member previews
Preview
Theorem 8.5.42
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

Over ℝ, hard-masked softmax with the all-true Boolean mask equals plain axis-one softmax of the scores. The two code paths of Spec.scaledDotProductAttention therefore agree wherever both apply.

Lean code for Theorem8.5.44●1 theorem
  • complete
    theorem NN.Proofs.Models.Attention.hardMaskedSoftmaxSpec_allTrueMask {nQ nK : ℕ}
      (scores : TorchLean.Tensor ℝ [nQ, nK]) :
      Spec.hardMaskedSoftmaxSpec scores (Spec.allTrueMask nQ nK) =
        Activation.softmaxSpec 1 scores
    theorem NN.Proofs.Models.Attention.hardMaskedSoftmaxSpec_allTrueMask
      {nQ nK : ℕ}
      (scores : TorchLean.Tensor ℝ [nQ, nK]) :
      Spec.hardMaskedSoftmaxSpec scores
          (Spec.allTrueMask nQ nK) =
        Activation.softmaxSpec 1 scores
    Hard-masked softmax with the all-true mask is the unmasked axis-`1` softmax. 
Proof for Theorem 8.5.44
uses 0

The row scan of the hard mask computes the fold of max over the row, which is the shift used by the stable softmax; with every position allowed the numerators and denominators coincide.

Theorem8.5.45
Group: Specification-layer kernels identified with their analytic presentations. (7)
Group member previews
Preview
Theorem 8.5.42
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

For a nonempty sequence, the tape reverse pass on the proof-carrying scaled dot-product attention graph, seeded on the output block, is the adjoint Fréchet derivative of Spec.scaledDotProductAttention without a mask and with the canonical inverse square-root scale. A companion theorem covers the masked code path with the all-true mask through the hard-mask identity.

Lean code for Theorem8.5.45●1 theorem
  • theorem Proofs.Autograd.Attention.backpropVec_eq_adjoint_fderiv_scaledDotProductAttention
      {m d : ℕ} (hm : m ≠ 0)
      (xV : Proofs.Autograd.CtxVec (Proofs.Autograd.Attention.ΓQKV m d))
      (δ :
        Proofs.Autograd.Vec
          (Spec.Shape.dim m (Spec.Shape.dim d Spec.Shape.scalar)).size) :
      (Proofs.Autograd.Attention.scaledDotProductGraph
              (1 / Spec.attentionScaleDenom d)).backpropVec
          xV
          (Proofs.Autograd.CtxVec.single
            (Proofs.Autograd.Attention.sdpaOutIdx m d) δ) =
        (ContinuousLinearMap.adjoint
            (fderiv ℝ
              (fun xV =>
                Proofs.Autograd.tensorToVec
                  (Spec.scaledDotProductAttention
                    { Q := Proofs.Autograd.Attention.ctxQ xV,
                      K := Proofs.Autograd.Attention.ctxK xV,
                      V := Proofs.Autograd.Attention.ctxV xV,
                      mask := none }))
              xV))
          δ
    theorem Proofs.Autograd.Attention.backpropVec_eq_adjoint_fderiv_scaledDotProductAttention
      {m d : ℕ} (hm : m ≠ 0)
      (xV :
        Proofs.Autograd.CtxVec
          (Proofs.Autograd.Attention.ΓQKV m
            d))
      (δ :
        Proofs.Autograd.Vec
          (Spec.Shape.dim m
              (Spec.Shape.dim d
                Spec.Shape.scalar)).size) :
      (Proofs.Autograd.Attention.scaledDotProductGraph
              (1 /
                Spec.attentionScaleDenom
                  d)).backpropVec
          xV
          (Proofs.Autograd.CtxVec.single
            (Proofs.Autograd.Attention.sdpaOutIdx
              m d)
            δ) =
        (ContinuousLinearMap.adjoint
            (fderiv ℝ
              (fun xV =>
                Proofs.Autograd.tensorToVec
                  (Spec.scaledDotProductAttention
                    {
                      Q :=
                        Proofs.Autograd.Attention.ctxQ
                          xV,
                      K :=
                        Proofs.Autograd.Attention.ctxK
                          xV,
                      V :=
                        Proofs.Autograd.Attention.ctxV
                          xV,
                      mask := none }))
              xV))
          δ
    Tape backprop is the vector-Jacobian product of unmasked `Spec.scaledDotProductAttention`. 
Proof for Theorem 8.5.45
Proof uses 2
Proof dependency previews
Preview
Theorem 8.5.10
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The output block of the graph evaluation is shown to be the vectorized specification forward pass, node by node, and the analytic graph theorem then identifies the tape reverse pass with the adjoint derivative; the softmax bridge supplies the softmax node.

Theorem8.5.46
Group: Specification-layer kernels identified with their analytic presentations. (7)
Group member previews
Preview
Theorem 8.5.42
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

For positive row and feature counts, the output block of the proof-carrying LayerNorm graph evaluated on packed inputs equals the vectorized Spec.layerNorm of those inputs.

Lean code for Theorem8.5.46●1 theorem
  • theorem Proofs.Autograd.LayerNorm.outputCLM_evalVec_layerNormGraph {m n : ℕ}
      (hm : 0 < m) (hn : 0 < n) (ε : ℝ)
      (xV : Proofs.Autograd.CtxVec (Proofs.Autograd.LayerNorm.ΓLN m n)) :
      Proofs.Autograd.LayerNorm.outputCLM
          ((Proofs.Autograd.LayerNorm.layerNormGraph ε).evalVec xV) =
        Proofs.Autograd.LayerNorm.specLayerNormVec hm hn ε xV
    theorem Proofs.Autograd.LayerNorm.outputCLM_evalVec_layerNormGraph
      {m n : ℕ} (hm : 0 < m) (hn : 0 < n)
      (ε : ℝ)
      (xV :
        Proofs.Autograd.CtxVec
          (Proofs.Autograd.LayerNorm.ΓLN m
            n)) :
      Proofs.Autograd.LayerNorm.outputCLM
          ((Proofs.Autograd.LayerNorm.layerNormGraph
                ε).evalVec
            xV) =
        Proofs.Autograd.LayerNorm.specLayerNormVec
          hm hn ε xV
    Forward bridge: the output block of the LayerNorm graph is `Spec.layerNorm` of the packed
    inputs. 
Proof for Theorem 8.5.46
uses 0

Both sides are reduced to the same closed form for each matrix entry: centered value, inverse stabilized standard deviation, scale, and shift.

Packing puts the input matrix, scale vector, and bias vector in one differentiation context. The output projection selects the normalized matrix from a context that also contains intermediates. Thus the equality aligns both the numerical formula and the placement of its arguments before a derivative theorem is applied to the composed graph.

Theorem8.5.47
Group: Specification-layer kernels identified with their analytic presentations. (7)
Group member previews
Preview
Theorem 8.5.42
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

For positive row and feature counts, the specification LayerNorm JVP paired with an output cotangent equals the sum of the three pairings of the input, scale, and bias tangents with the corresponding components of Spec.layerNormBackward. The backward rule is therefore the adjoint of the JVP.

Lean code for Theorem8.5.47●1 theorem
  • theorem Proofs.Autograd.LayerNorm.layerNormJvp_layerNormBackward_adjoint
      {m n : ℕ} (hm : 0 < m) (hn : 0 < n)
      (x tangent gradOutput : TorchLean.Tensor ℝ [m, n])
      (gamma dgamma beta dbeta : TorchLean.Tensor ℝ [n]) (ε : ℝ) :
      Spec.dot (Spec.layerNormJvp hm hn x tangent gamma dgamma beta dbeta ε)
          gradOutput =
        Spec.dot tangent
              (Spec.layerNormBackward hm hn x gamma gradOutput
                  ε).inputGradient +
            Spec.dot dgamma
              (Spec.layerNormBackward hm hn x gamma gradOutput
                  ε).scaleGradient +
          Spec.dot dbeta
            (Spec.layerNormBackward hm hn x gamma gradOutput ε).biasGradient
    theorem Proofs.Autograd.LayerNorm.layerNormJvp_layerNormBackward_adjoint
      {m n : ℕ} (hm : 0 < m) (hn : 0 < n)
      (x tangent gradOutput :
        TorchLean.Tensor ℝ [m, n])
      (gamma dgamma beta dbeta :
        TorchLean.Tensor ℝ [n])
      (ε : ℝ) :
      Spec.dot
          (Spec.layerNormJvp hm hn x tangent
            gamma dgamma beta dbeta ε)
          gradOutput =
        Spec.dot tangent
              (Spec.layerNormBackward hm hn x
                  gamma gradOutput
                  ε).inputGradient +
            Spec.dot dgamma
              (Spec.layerNormBackward hm hn x
                  gamma gradOutput
                  ε).scaleGradient +
          Spec.dot dbeta
            (Spec.layerNormBackward hm hn x
                gamma gradOutput
                ε).biasGradient
    The LayerNorm reverse rule is adjoint to its forward differential.
    
    Pairing the input tangent and both parameter tangents with `Spec.layerNormJvp` gives the same
    scalar as pairing the upstream gradient with the three outputs of `Spec.layerNormBackward`.
    
Proof for Theorem 8.5.47
uses 0

The two pairings are expanded into finite sums over matrix entries and matched term by term; the row-statistics terms are regrouped so that each input tangent coordinate meets the corresponding entry of the specification backward rule.

Scale and bias are shared across rows, so their cotangents sum contributions from every row; input cotangents retain the full matrix shape. The three pairings in the conclusion express these different shapes in one scalar equality. This adjoint identity permits arbitrary epsilon as written; identifying the formula with an analytic derivative needs the separate conditions that make the stabilized denominator differentiable.

Theorem8.5.48
Group: Specification-layer kernels identified with their analytic presentations. (7)
Group member previews
Preview
Theorem 8.5.42
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

For a well-formed channel-first shape and 0 < \varepsilon, the map sending input, scale, and shift to Spec.batchNorm is Fréchet differentiable on the flattened vectors.

Lean code for Theorem8.5.48●1 theorem
  • theorem Proofs.Autograd.BatchNorm.hasFDerivAt_batchNorm {channels : ℕ}
      {sSpatial : Spec.Shape}
      [(Spec.Shape.dim channels sSpatial).WellFormed] {ε : ℝ} (hε : 0 < ε)
      (x : TorchLean.Tensor ℝ (Spec.Shape.dim channels sSpatial))
      (gamma beta : TorchLean.Tensor ℝ [channels]) :
      HasFDerivAt (Proofs.Autograd.BatchNorm.bnVec ε)
        (Proofs.Autograd.BatchNorm.bnD
          (Proofs.Autograd.BatchNorm.matVec (Proofs.Autograd.tensorToVec x))
          (Proofs.Autograd.tensorToVec gamma) ε)
        (Proofs.Autograd.tensorToVec x, Proofs.Autograd.tensorToVec gamma,
          Proofs.Autograd.tensorToVec beta)
    theorem Proofs.Autograd.BatchNorm.hasFDerivAt_batchNorm
      {channels : ℕ} {sSpatial : Spec.Shape}
      [(Spec.Shape.dim channels
            sSpatial).WellFormed]
      {ε : ℝ} (hε : 0 < ε)
      (x :
        TorchLean.Tensor ℝ
          (Spec.Shape.dim channels sSpatial))
      (gamma beta :
        TorchLean.Tensor ℝ [channels]) :
      HasFDerivAt
        (Proofs.Autograd.BatchNorm.bnVec ε)
        (Proofs.Autograd.BatchNorm.bnD
          (Proofs.Autograd.BatchNorm.matVec
            (Proofs.Autograd.tensorToVec x))
          (Proofs.Autograd.tensorToVec gamma)
          ε)
        (Proofs.Autograd.tensorToVec x,
          Proofs.Autograd.tensorToVec gamma,
          Proofs.Autograd.tensorToVec beta)
    `Spec.batchNorm` is Fréchet differentiable in `(x, gamma, beta)` for positive `ε`. 
Proof for Theorem 8.5.48
uses 0

BatchNorm flattens the spatial axes to a channel-by-position matrix and normalizes each row; the derivative of one normalized row entry is composed with the reshaping and affine stages, and the clamps in the specification are shown inactive because the variance is a mean of squares.

Positive epsilon makes the stabilized variance strictly positive even when every value in a channel is identical. That is where the hypothesis enters the calculus: square root and reciprocal are differentiated away from their singular points. The channel-first shape hypothesis separately justifies which coordinates are collected into each normalization row.

Theorem8.5.49
Group: Specification-layer kernels identified with their analytic presentations. (7)
Group member previews
Preview
Theorem 8.5.42
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

Under the hypotheses of the differentiability theorem, the Fréchet derivative of BatchNorm applied to a tangent equals the specification Spec.batchNormJvp.

Lean code for Theorem8.5.49●1 theorem
  • theorem Proofs.Autograd.BatchNorm.fderiv_batchNorm_eq_batchNormJvp
      {channels : ℕ} {sSpatial : Spec.Shape}
      [(Spec.Shape.dim channels sSpatial).WellFormed] {ε : ℝ} (hε : 0 < ε)
      (x dx : TorchLean.Tensor ℝ (Spec.Shape.dim channels sSpatial))
      (gamma dgamma beta dbeta : TorchLean.Tensor ℝ [channels]) :
      (fderiv ℝ (Proofs.Autograd.BatchNorm.bnVec ε)
            (Proofs.Autograd.tensorToVec x,
              Proofs.Autograd.tensorToVec gamma,
              Proofs.Autograd.tensorToVec beta))
          (Proofs.Autograd.tensorToVec dx,
            Proofs.Autograd.tensorToVec dgamma,
            Proofs.Autograd.tensorToVec dbeta) =
        Proofs.Autograd.tensorToVec
          (Spec.batchNormJvp x dx gamma dgamma beta dbeta ε)
    theorem Proofs.Autograd.BatchNorm.fderiv_batchNorm_eq_batchNormJvp
      {channels : ℕ} {sSpatial : Spec.Shape}
      [(Spec.Shape.dim channels
            sSpatial).WellFormed]
      {ε : ℝ} (hε : 0 < ε)
      (x dx :
        TorchLean.Tensor ℝ
          (Spec.Shape.dim channels sSpatial))
      (gamma dgamma beta dbeta :
        TorchLean.Tensor ℝ [channels]) :
      (fderiv ℝ
            (Proofs.Autograd.BatchNorm.bnVec
              ε)
            (Proofs.Autograd.tensorToVec x,
              Proofs.Autograd.tensorToVec
                gamma,
              Proofs.Autograd.tensorToVec
                beta))
          (Proofs.Autograd.tensorToVec dx,
            Proofs.Autograd.tensorToVec
              dgamma,
            Proofs.Autograd.tensorToVec
              dbeta) =
        Proofs.Autograd.tensorToVec
          (Spec.batchNormJvp x dx gamma dgamma
            beta dbeta ε)
    The Fréchet derivative of `Spec.batchNorm` in `(x, gamma, beta)` applied to a tangent triple
    is `Spec.batchNormJvp`, for positive `ε`. 
Proof for Theorem 8.5.49

The derivative is read off entrywise and compared with the closed-form row differential that defines the JVP.

Definition8.5.50
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Theorem 8.5.51
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

A Lyapunov certificate is valid for a pair of functions when its two intervals enclose the function and orbital-derivative values throughout the stated region.

Lean code for Definition8.5.50●1 definition
  • structure(2 fields)defined in NN/MLTheory/CROWN/Lyapunov/Certificate.lean
    complete
    structure NN.MLTheory.CROWN.Lyapunov.LyapunovCert.ValidFor {α : Type}
      [TorchLean.Storage α] [Context α] {n : ℕ}
      (cert : NN.MLTheory.CROWN.Lyapunov.LyapunovCert α n)
      (lyap : NN.MLTheory.CROWN.Lyapunov.NeuralLyapunov α n) : Prop
    structure NN.MLTheory.CROWN.Lyapunov.LyapunovCert.ValidFor
      {α : Type} [TorchLean.Storage α]
      [Context α] {n : ℕ}
      (cert :
        NN.MLTheory.CROWN.Lyapunov.LyapunovCert
          α n)
      (lyap :
        NN.MLTheory.CROWN.Lyapunov.NeuralLyapunov
          α n) :
      Prop
    Proof object produced by a semantic certificate checker.
    
    Parsing a certificate or checking the signs of its endpoints cannot construct this structure. Its
    two fields require enclosure proofs for the actual functions named by `lyap` on the actual region
    stored in `cert`.
    
    valueBounds : ∀ (x : TorchLean.Tensor α (Spec.Shape.dim n Spec.Shape.scalar)),
      cert.region.contains x → cert.vLower ≤ lyap.value x ∧ lyap.value x ≤ cert.vUpper
    The checked interval for the Lyapunov candidate. 
    orbitalDerivativeBounds : ∀ (x : TorchLean.Tensor α (Spec.Shape.dim n Spec.Shape.scalar)),
      cert.region.contains x →
        cert.derivativeLower ≤ lyap.orbitalDerivative x ∧ lyap.orbitalDerivative x ≤ cert.derivativeUpper
    The checked interval for the orbital derivative. 
Theorem8.5.51
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Definition 8.5.50
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

Certificate thresholds imply positive Lyapunov values and negative derivatives on the certified region, conditional on the certificate validity predicate.

Lean code for Theorem8.5.51●1 theorem
  • theorem NN.MLTheory.CROWN.Lyapunov.Real.lyapunov_conditions {n : ℕ}
      (lyap : NN.MLTheory.CROWN.Lyapunov.NeuralLyapunov ℝ n)
      (cert : NN.MLTheory.CROWN.Lyapunov.LyapunovCert ℝ n)
      (hcert : cert.ValidFor lyap) (h_V_pos : cert.vLower > 0)
      (h_Vdot_neg : cert.derivativeUpper < 0) :
      (∀ (x : TorchLean.Tensor ℝ (Spec.Shape.dim n Spec.Shape.scalar)),
          cert.region.contains x → lyap.value x > 0) ∧
        ∀ (x : TorchLean.Tensor ℝ (Spec.Shape.dim n Spec.Shape.scalar)),
          cert.region.contains x → lyap.orbitalDerivative x < 0
    theorem NN.MLTheory.CROWN.Lyapunov.Real.lyapunov_conditions
      {n : ℕ}
      (lyap :
        NN.MLTheory.CROWN.Lyapunov.NeuralLyapunov
          ℝ n)
      (cert :
        NN.MLTheory.CROWN.Lyapunov.LyapunovCert
          ℝ n)
      (hcert : cert.ValidFor lyap)
      (h_V_pos : cert.vLower > 0)
      (h_Vdot_neg :
        cert.derivativeUpper < 0) :
      (∀
          (x :
            TorchLean.Tensor ℝ
              (Spec.Shape.dim n
                Spec.Shape.scalar)),
          cert.region.contains x →
            lyap.value x > 0) ∧
        ∀
          (x :
            TorchLean.Tensor ℝ
              (Spec.Shape.dim n
                Spec.Shape.scalar)),
          cert.region.contains x →
            lyap.orbitalDerivative x < 0
    Strict certificate margins give `V > 0` and `V̇ < 0` at every point of the region. The two
    functions are not linked to any dynamics here, so this is a sign condition, not stability. 
Proof for Theorem 8.5.51

The enclosures in the validity hypothesis are compared with the certificate thresholds and strengthened to strict sign conditions.

The conclusion gives two pointwise statements for every state inside cert.region. To use them in a stability argument, the region and dynamics must be the ones of interest, and the validity proof must enclose the stated orbital derivative there. Strict positivity of the lower value bound also means that a zero-valued equilibrium cannot lie in this certified region.

Theorem8.5.52
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Definition 8.5.50
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

Let x^\star be a root of the update map g, let \eta be the step size, and set q(\eta,\mu,L)=1-2\eta\mu+\eta^2L^2. Under the stated strong-monotonicity and Lipschitz hypotheses, with 0\le\eta and 0\le q(\eta,\mu,L), the iterates satisfy

\left\lVert \operatorname{step}_{\eta}(g)^{\,k}(x)-x^\star\right\rVert^2 \leq q(\eta,\mu,L)^k\left\lVert x-x^\star\right\rVert^2.

Here k counts update steps. The bound gives geometric decay when q<1; the next theorem provides step-size conditions that establish that inequality.

Lean code for Theorem8.5.52●1 theorem
  • theorem Optim.GD.dist_sq_iterate_le_of_q_nonneg {E : Type}
      [NormedAddCommGroup E] [InnerProductSpace ℝ E] (η μ : ℝ) (hη : 0 ≤ η)
      {L : NNReal} (g : E → E) (hmono : Optim.GD.StrongMonotone μ g)
      (hlip : LipschitzWith L g) {xStar x : E} (hxStar : g xStar = 0)
      (hq : 0 ≤ Optim.GD.q η μ L) (k : ℕ) :
      ‖(Optim.GD.step η g)^[k] x - xStar‖ ^ 2 ≤
        Optim.GD.q η μ L ^ k * ‖x - xStar‖ ^ 2
    theorem Optim.GD.dist_sq_iterate_le_of_q_nonneg
      {E : Type} [NormedAddCommGroup E]
      [InnerProductSpace ℝ E] (η μ : ℝ)
      (hη : 0 ≤ η) {L : NNReal} (g : E → E)
      (hmono : Optim.GD.StrongMonotone μ g)
      (hlip : LipschitzWith L g) {xStar x : E}
      (hxStar : g xStar = 0)
      (hq : 0 ≤ Optim.GD.q η μ L) (k : ℕ) :
      ‖(Optim.GD.step η g)^[k] x - xStar‖ ^
          2 ≤
        Optim.GD.q η μ L ^ k * ‖x - xStar‖ ^ 2
    Iterated contraction bound in squared norm.
    
    If $q(\eta,\mu,L)\geq 0$, then after $k$ steps we have
    
    $$
    \left\lVert \operatorname{step}_\eta(g)^{\,k}(x)-x^\star\right\rVert^2
      \leq q(\eta,\mu,L)^k\lVert x-x^\star\rVert^2.
    $$
    
Proof for Theorem 8.5.52
uses 0

The one-step contraction is iterated, and nonnegativity of q(\eta,\mu,L) controls multiplication by the geometric factor.

Theorem8.5.53
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Definition 8.5.50
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

For a \mu-strongly monotone, L-Lipschitz update map with root x^\star, if 0\le\mu\le L, 0<\eta, and \eta L^2<2\mu, then the geometric bound of the iterate theorem holds and, in addition, q(\eta,\mu,L)<1, so the squared distance to the root decreases geometrically. This packages the step-size conditions a caller must check instead of assuming the contraction factor is below one.

Lean code for Theorem8.5.53●1 theorem
  • theorem Optim.GD.dist_sq_iterate_le_of_step_size {E : Type}
      [NormedAddCommGroup E] [InnerProductSpace ℝ E] (η μ : ℝ) {L : NNReal}
      (g : E → E) (hmono : Optim.GD.StrongMonotone μ g)
      (hlip : LipschitzWith L g) {xStar x : E} (hxStar : g xStar = 0)
      (hμ : 0 ≤ μ) (hμL : μ ≤ ↑L) (hη : 0 < η) (hstep : η * ↑L ^ 2 < 2 * μ)
      (k : ℕ) :
      ‖(Optim.GD.step η g)^[k] x - xStar‖ ^ 2 ≤
          Optim.GD.q η μ L ^ k * ‖x - xStar‖ ^ 2 ∧
        Optim.GD.q η μ L < 1
    theorem Optim.GD.dist_sq_iterate_le_of_step_size
      {E : Type} [NormedAddCommGroup E]
      [InnerProductSpace ℝ E] (η μ : ℝ)
      {L : NNReal} (g : E → E)
      (hmono : Optim.GD.StrongMonotone μ g)
      (hlip : LipschitzWith L g) {xStar x : E}
      (hxStar : g xStar = 0) (hμ : 0 ≤ μ)
      (hμL : μ ≤ ↑L) (hη : 0 < η)
      (hstep : η * ↑L ^ 2 < 2 * μ) (k : ℕ) :
      ‖(Optim.GD.step η g)^[k] x - xStar‖ ^
            2 ≤
          Optim.GD.q η μ L ^ k *
            ‖x - xStar‖ ^ 2 ∧
        Optim.GD.q η μ L < 1
    Linear convergence of gradient descent under an explicit step-size condition.
    
    Assuming `0 ≤ μ ≤ L`, `0 < η`, and `η * L ^ 2 < 2 * μ`, the contraction factor satisfies
    `0 ≤ q η μ L < 1` and the iterates converge linearly to any root `xStar` of `g`.
    
Proof for Theorem 8.5.53

q-1=\eta(\eta L^2-2\mu) gives q<1 from the step-size condition; \mu\le L gives q\ge 0; the iterate theorem supplies the bound.

Theorem8.5.54
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Definition 8.5.50
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

Measurable post-processing preserves (\varepsilon,\delta)-differential privacy.

Lean code for Theorem8.5.54●1 theorem
  • theorem NN.MLTheory.LearningTheory.differentialPrivacy_postprocess
      {α β γ : Type} {Adj : α → α → Prop} [MeasurableSpace β]
      [MeasurableSpace γ] {M : NN.MLTheory.LearningTheory.Mechanism α β}
      {ε : ℝ} {δ : ENNReal} {f : β → γ} (hf : Measurable f) :
      NN.MLTheory.LearningTheory.DifferentialPrivacy Adj M ε δ →
        NN.MLTheory.LearningTheory.DifferentialPrivacy Adj
          (NN.MLTheory.LearningTheory.postprocess M f) ε δ
    theorem NN.MLTheory.LearningTheory.differentialPrivacy_postprocess
      {α β γ : Type} {Adj : α → α → Prop}
      [MeasurableSpace β] [MeasurableSpace γ]
      {M :
        NN.MLTheory.LearningTheory.Mechanism α
          β}
      {ε : ℝ} {δ : ENNReal} {f : β → γ}
      (hf : Measurable f) :
      NN.MLTheory.LearningTheory.DifferentialPrivacy
          Adj M ε δ →
        NN.MLTheory.LearningTheory.DifferentialPrivacy
          Adj
          (NN.MLTheory.LearningTheory.postprocess
            M f)
          ε δ
    Post-processing theorem: measurable mappings of outputs preserve DP.
    
    Proof idea (the standard one):
    
    - the probability of an event `S` under the mapped output is the probability of the preimage
      `f ⁻¹' S` under the original output;
    - apply DP for `M` to the measurable set `f ⁻¹' S`.
    
Proof for Theorem 8.5.54
uses 0

The proof rewrites measurable preimages through the post-processing map and reuses the original privacy inequality.

An observable event after post-processing corresponds to its preimage before post-processing. Measurability makes that preimage a legal event for the original privacy bound. The deterministic map receives only the mechanism's output in this theorem; a function that also consults the private dataset would require a different argument.

Theorem8.5.55
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Definition 8.5.50
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

For each FloatLib format, the constructive hinge network approximates a Lipschitz target with error below the requested real approximation tolerance plus its pointwise evaluation-rounding bound. Its parameters inhabit FloatLib's rounded-real carrier; their stored real values need not be representable in the selected format.

Lean code for Theorem8.5.55●1 theorem
  • theorem NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.relu_universal_approximation_Icc
      (format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat)
      {f : ℝ → ℝ} {a b L : ℝ} (h_ab : a < b) (hL : 0 < L)
      (h_lip :
        ∀ x ∈ Set.Icc a b, ∀ y ∈ Set.Icc a b, |f x - f y| ≤ L * |x - y|)
      (ε : ℝ) :
      ε > 0 →
        ∃ hidDim t c b0,
          ∀ x ∈ Set.Icc a b,
            |f x -
                  (NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.hingeFun
                      format t c b0 { val := x }).val| <
              ε +
                NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.hingeFunErrorBound
                  format t c b0 { val := x }
    theorem NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.relu_universal_approximation_Icc
      (format :
        FloatLib.Floats.Formats.BinaryInterchange.FloatFormat)
      {f : ℝ → ℝ} {a b L : ℝ} (h_ab : a < b)
      (hL : 0 < L)
      (h_lip :
        ∀ x ∈ Set.Icc a b,
          ∀ y ∈ Set.Icc a b,
            |f x - f y| ≤ L * |x - y|)
      (ε : ℝ) :
      ε > 0 →
        ∃ hidDim t c b0,
          ∀ x ∈ Set.Icc a b,
            |f x -
                  (NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.hingeFun
                      format t c b0
                      { val := x }).val| <
              ε +
                NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.hingeFunErrorBound
                  format t c b0 { val := x }
    One-dimensional ReLU approximation with a pointwise rounding budget for any `FloatFormat`.
    
    The real hinge construction supplies exact real parameters, embedded in `Rounded format` without
    quantization. Each arithmetic operation rounds to the chosen grid. Thus the bound combines the
    real approximation error with `hingeFunErrorBound`; it does not assert representability of the
    parameters or inputs, or finiteness of a corresponding executable computation.
    
Proof for Theorem 8.5.55
uses 0

The real hinge construction supplies parameters. A fold invariant bounds the accumulated rounding error using FloatLib's half-ULP theorem at each subtraction, product, and addition. The triangle inequality adds this evaluation bound to the approximation tolerance.

Theorem8.5.56
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Definition 8.5.50
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

For a configured IEEE format and its storage codec, executable hinge evaluation has error below the supplied approximation and parameter-quantization budgets plus the proved rounding bound. The parameters and intermediate computations must satisfy the theorem's finiteness hypotheses.

Lean code for Theorem8.5.56●1 theorem
  • theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.relu_approximation_Icc_binary_three_term
      {format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat}
      {plan :
        FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan
          format}
      {code : Type}
      [FloatLib.Floats.ExecFloat.ModelCodec plan
          (FloatLib.Floats.Formats.BinaryInterchange.Model format) code]
      (hformat : format.isIEEE = true) {f : ℝ → ℝ} {a b : ℝ} {hidDim : ℕ}
      (tR cR : Fin hidDim → ℝ)
      (t c :
        Fin hidDim →
          FloatLib.Floats.ExecFloat
            (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
              format code plan))
      (b0 :
        FloatLib.Floats.ExecFloat
          (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
            format code plan))
      (ht :
        ∀ (i : Fin hidDim),
          FloatLib.Floats.ExecFloat.Binary.isFinite (t i) = true)
      (hc :
        ∀ (i : Fin hidDim),
          FloatLib.Floats.ExecFloat.Binary.isFinite (c i) = true)
      (εApprox εQ : ℝ) :
      (∀
          (x :
            FloatLib.Floats.ExecFloat
              (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                format code plan)),
          FloatLib.Floats.ExecFloat.Binary.isFinite x = true →
            (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈
                Set.Icc a b →
              NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.HingeSumFinite
                  t c x 0 (List.finRange hidDim) ∧
                FloatLib.Floats.ExecFloat.Binary.isFinite
                    (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.hingeFunBinary
                      t c b0 x) =
                  true) →
        (∀
            (x :
              FloatLib.Floats.ExecFloat
                (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                  format code plan)),
            FloatLib.Floats.ExecFloat.Binary.isFinite x = true →
              (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈
                  Set.Icc a b →
                |f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal -
                      NN.MLTheory.Proofs.UniversalApproximation.hingeFun
                        hidDim tR cR (f a)
                        (FloatLib.Floats.ExecFloat.Binary.toModel
                            x).toReal| <
                  εApprox) →
          (∀
              (x :
                FloatLib.Floats.ExecFloat
                  (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                    format code plan)),
              FloatLib.Floats.ExecFloat.Binary.isFinite x = true →
                (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈
                    Set.Icc a b →
                  |NN.MLTheory.Proofs.UniversalApproximation.hingeFun hidDim
                          tR cR (f a)
                          (FloatLib.Floats.ExecFloat.Binary.toModel
                              x).toReal -
                        NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.hingeFunReal
                          format
                          (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embedVec
                            t)
                          (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embedVec
                            c)
                          (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embed
                            b0)
                          (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embed
                            x)| ≤
                    εQ) →
            ∀
              (x :
                FloatLib.Floats.ExecFloat
                  (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                    format code plan)),
              FloatLib.Floats.ExecFloat.Binary.isFinite x = true →
                (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈
                    Set.Icc a b →
                  |f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal -
                        (FloatLib.Floats.ExecFloat.Binary.toModel
                            (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.hingeFunBinary
                              t c b0 x)).toReal| <
                    εApprox + εQ +
                      NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.hingeFunErrorBound
                        format
                        (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embedVec
                          t)
                        (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embedVec
                          c)
                        (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embed
                          b0)
                        (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embed
                          x)
    theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.relu_approximation_Icc_binary_three_term
      {format :
        FloatLib.Floats.Formats.BinaryInterchange.FloatFormat}
      {plan :
        FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan
          format}
      {code : Type}
      [FloatLib.Floats.ExecFloat.ModelCodec
          plan
          (FloatLib.Floats.Formats.BinaryInterchange.Model
            format)
          code]
      (hformat : format.isIEEE = true)
      {f : ℝ → ℝ} {a b : ℝ} {hidDim : ℕ}
      (tR cR : Fin hidDim → ℝ)
      (t c :
        Fin hidDim →
          FloatLib.Floats.ExecFloat
            (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
              format code plan))
      (b0 :
        FloatLib.Floats.ExecFloat
          (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
            format code plan))
      (ht :
        ∀ (i : Fin hidDim),
          FloatLib.Floats.ExecFloat.Binary.isFinite
              (t i) =
            true)
      (hc :
        ∀ (i : Fin hidDim),
          FloatLib.Floats.ExecFloat.Binary.isFinite
              (c i) =
            true)
      (εApprox εQ : ℝ) :
      (∀
          (x :
            FloatLib.Floats.ExecFloat
              (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                format code plan)),
          FloatLib.Floats.ExecFloat.Binary.isFinite
                x =
              true →
            (FloatLib.Floats.ExecFloat.Binary.toModel
                    x).toReal ∈
                Set.Icc a b →
              NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.HingeSumFinite
                  t c x 0
                  (List.finRange hidDim) ∧
                FloatLib.Floats.ExecFloat.Binary.isFinite
                    (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.hingeFunBinary
                      t c b0 x) =
                  true) →
        (∀
            (x :
              FloatLib.Floats.ExecFloat
                (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                  format code plan)),
            FloatLib.Floats.ExecFloat.Binary.isFinite
                  x =
                true →
              (FloatLib.Floats.ExecFloat.Binary.toModel
                      x).toReal ∈
                  Set.Icc a b →
                |f
                        (FloatLib.Floats.ExecFloat.Binary.toModel
                            x).toReal -
                      NN.MLTheory.Proofs.UniversalApproximation.hingeFun
                        hidDim tR cR (f a)
                        (FloatLib.Floats.ExecFloat.Binary.toModel
                            x).toReal| <
                  εApprox) →
          (∀
              (x :
                FloatLib.Floats.ExecFloat
                  (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                    format code plan)),
              FloatLib.Floats.ExecFloat.Binary.isFinite
                    x =
                  true →
                (FloatLib.Floats.ExecFloat.Binary.toModel
                        x).toReal ∈
                    Set.Icc a b →
                  |NN.MLTheory.Proofs.UniversalApproximation.hingeFun
                          hidDim tR cR (f a)
                          (FloatLib.Floats.ExecFloat.Binary.toModel
                              x).toReal -
                        NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.hingeFunReal
                          format
                          (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embedVec
                            t)
                          (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embedVec
                            c)
                          (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embed
                            b0)
                          (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embed
                            x)| ≤
                    εQ) →
            ∀
              (x :
                FloatLib.Floats.ExecFloat
                  (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                    format code plan)),
              FloatLib.Floats.ExecFloat.Binary.isFinite
                    x =
                  true →
                (FloatLib.Floats.ExecFloat.Binary.toModel
                        x).toReal ∈
                    Set.Icc a b →
                  |f
                          (FloatLib.Floats.ExecFloat.Binary.toModel
                              x).toReal -
                        (FloatLib.Floats.ExecFloat.Binary.toModel
                            (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.hingeFunBinary
                              t c b0
                              x)).toReal| <
                    εApprox + εQ +
                      NN.MLTheory.Proofs.UniversalApproximation.RoundedReLUApprox.hingeFunErrorBound
                        format
                        (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embedVec
                          t)
                        (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embedVec
                          c)
                        (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embed
                          b0)
                        (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.embed
                          x)
    Specialization of `relu_approximation_Icc_binary_three_term_bias` to the real bias `f a`, which is
    the bias the constructive one-dimensional interpolation theorem emits.
    
Proof for Theorem 8.5.56
uses 0

FloatLib's arithmetic refinement identifies each finite executable operation with its rounded-real counterpart. A fold proof extends this correspondence to the hinge sum; the rounded-real error bound and two triangle inequalities then give the total budget.

Theorem8.5.57
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Definition 8.5.50
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

Assuming real approximation, parameter quantization, and execution budgets for a two-layer ReLU network over a configured binary format, the total error is bounded by their sum. This includes binary32 execution.

Lean code for Theorem8.5.57●1 theorem
  • theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecTwoLayerMLP.relu_mlp_approximation_three_term
      {format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat}
      {plan :
        FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan
          format}
      {code : Type}
      [FloatLib.Floats.ExecFloat.ModelCodec plan
          (FloatLib.Floats.Formats.BinaryInterchange.Model format) code]
      {n hidDim : ℕ}
      (D :
        Set
          (TorchLean.Tensor
            (FloatLib.Floats.ExecFloat
              (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                format code plan))
            [n]))
      (f : TorchLean.Tensor ℝ [n] → ℝ) (l1R : Spec.LinearSpec ℝ n hidDim)
      (l2R : Spec.LinearSpec ℝ hidDim 1)
      (l1I :
        Spec.LinearSpec
          (FloatLib.Floats.ExecFloat
            (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
              format code plan))
          n hidDim)
      (l2I :
        Spec.LinearSpec
          (FloatLib.Floats.ExecFloat
            (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
              format code plan))
          hidDim 1)
      (εApprox εQ εR : ℝ)
      (hApprox :
        ∀ xI ∈ D,
          have xR :=
            NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.tensorToReal
              xI;
          |f xR - NN.MLTheory.Proofs.ReLUMlpBridge.mlpEval l1R l2R xR| ≤
            εApprox)
      (hQ :
        ∀ xI ∈ D,
          have xR :=
            NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.tensorToReal
              xI;
          |NN.MLTheory.Proofs.ReLUMlpBridge.mlpEval l1R l2R xR -
                NN.MLTheory.Proofs.ReLUMlpBridge.mlpEval
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.linearSpecToReal
                    l1I)
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.linearSpecToReal
                    l2I)
                  xR| ≤
            εQ)
      (hR :
        ∀ xI ∈ D,
          have xR :=
            NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.tensorToReal
              xI;
          |(FloatLib.Floats.ExecFloat.Binary.toModel
                    (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.mlpEval
                      l1I l2I xI)).toReal -
                NN.MLTheory.Proofs.ReLUMlpBridge.mlpEval
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.linearSpecToReal
                    l1I)
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.linearSpecToReal
                    l2I)
                  xR| ≤
            εR)
      (xI :
        TorchLean.Tensor
          (FloatLib.Floats.ExecFloat
            (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
              format code plan))
          [n]) :
      xI ∈ D →
        have xR :=
          NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.tensorToReal
            xI;
        |f xR -
              (FloatLib.Floats.ExecFloat.Binary.toModel
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.mlpEval
                    l1I l2I xI)).toReal| ≤
          εApprox + εQ + εR
    theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecTwoLayerMLP.relu_mlp_approximation_three_term
      {format :
        FloatLib.Floats.Formats.BinaryInterchange.FloatFormat}
      {plan :
        FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan
          format}
      {code : Type}
      [FloatLib.Floats.ExecFloat.ModelCodec
          plan
          (FloatLib.Floats.Formats.BinaryInterchange.Model
            format)
          code]
      {n hidDim : ℕ}
      (D :
        Set
          (TorchLean.Tensor
            (FloatLib.Floats.ExecFloat
              (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
                format code plan))
            [n]))
      (f : TorchLean.Tensor ℝ [n] → ℝ)
      (l1R : Spec.LinearSpec ℝ n hidDim)
      (l2R : Spec.LinearSpec ℝ hidDim 1)
      (l1I :
        Spec.LinearSpec
          (FloatLib.Floats.ExecFloat
            (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
              format code plan))
          n hidDim)
      (l2I :
        Spec.LinearSpec
          (FloatLib.Floats.ExecFloat
            (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
              format code plan))
          hidDim 1)
      (εApprox εQ εR : ℝ)
      (hApprox :
        ∀ xI ∈ D,
          have xR :=
            NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.tensorToReal
              xI;
          |f xR -
                NN.MLTheory.Proofs.ReLUMlpBridge.mlpEval
                  l1R l2R xR| ≤
            εApprox)
      (hQ :
        ∀ xI ∈ D,
          have xR :=
            NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.tensorToReal
              xI;
          |NN.MLTheory.Proofs.ReLUMlpBridge.mlpEval
                  l1R l2R xR -
                NN.MLTheory.Proofs.ReLUMlpBridge.mlpEval
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.linearSpecToReal
                    l1I)
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.linearSpecToReal
                    l2I)
                  xR| ≤
            εQ)
      (hR :
        ∀ xI ∈ D,
          have xR :=
            NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.tensorToReal
              xI;
          |(FloatLib.Floats.ExecFloat.Binary.toModel
                    (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.mlpEval
                      l1I l2I xI)).toReal -
                NN.MLTheory.Proofs.ReLUMlpBridge.mlpEval
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.linearSpecToReal
                    l1I)
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.linearSpecToReal
                    l2I)
                  xR| ≤
            εR)
      (xI :
        TorchLean.Tensor
          (FloatLib.Floats.ExecFloat
            (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family
              format code plan))
          [n]) :
      xI ∈ D →
        have xR :=
          NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.tensorToReal
            xI;
        |f xR -
              (FloatLib.Floats.ExecFloat.Binary.toModel
                  (NN.MLTheory.Proofs.UniversalApproximation.BinaryExecCore.mlpEval
                    l1I l2I xI)).toReal| ≤
          εApprox + εQ + εR
    Combine real approximation, parameter quantization, and execution error on a set of inputs.
    The execution bound is a hypothesis about `Model.toReal`, including its treatment of exceptional
    values; this theorem does not supply a rounding or finiteness bound. 
Proof for Theorem 8.5.57
uses 0

After interpreting the configured binary result as a real value, two triangle inequalities split the target error into the three assumed budgets.

Theorem8.5.58
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Definition 8.5.50
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 0✓L∃∀N

A comparison argument encloses a clamped scalar ODE solution with constant extension outside the integration interval.

Lean code for Theorem8.5.58●1 theorem
  • complete
    theorem NN.Proofs.Verification.ODE.Enclosure.extendedSolutionEnclosed_fromClampedDynamics
      {T τ : ℝ} (hT : 0 ≤ T) {f : ℝ → ℝ → ℝ} {u uL uU uL' uU' : ℝ → ℝ}
      {a : ℝ} (hu_cont : ContinuousOn u (Set.Icc 0 τ))
      (hu_der :
        ∀ t ∈ Set.Ico 0 τ,
          HasDerivWithinAt u
            (f t
              (NN.Proofs.Verification.ODE.Enclosure.clampToCorridor
                (NN.Proofs.Verification.ODE.Enclosure.constantExtensionAfter
                  T uL)
                (NN.Proofs.Verification.ODE.Enclosure.constantExtensionAfter
                  T uU)
                t (u t)))
            (Set.Ici t) t)
      (hu0 : u 0 = a) (hL_cont : ContinuousOn uL (Set.Icc 0 T))
      (hL_der :
        ∀ t ∈ Set.Ico 0 T, HasDerivWithinAt uL (uL' t) (Set.Ici t) t)
      (hL_sub : ∀ t ∈ Set.Ico 0 T, uL' t ≤ f t (uL t)) (hL0 : uL 0 ≤ a)
      (hU_cont : ContinuousOn uU (Set.Icc 0 T))
      (hU_der :
        ∀ t ∈ Set.Ico 0 T, HasDerivWithinAt uU (uU' t) (Set.Ici t) t)
      (hU_sup : ∀ t ∈ Set.Ico 0 T, f t (uU t) ≤ uU' t) (hU0 : a ≤ uU 0)
      (hLU : ∀ t ∈ Set.Icc 0 T, uL t ≤ uU t)
      (hLower : ∀ (t : ℝ), T < t → 0 ≤ f T (uL T) ∧ f T (uL T) ≤ f t (uL T))
      (hUpper :
        ∀ (t : ℝ), T < t → f t (uU T) ≤ f T (uU T) ∧ f T (uU T) ≤ 0) :
      (∀ t ∈ Set.Icc 0 τ,
          NN.Proofs.Verification.ODE.Enclosure.constantExtensionAfter T uL
                t ≤
              u t ∧
            u t ≤
              NN.Proofs.Verification.ODE.Enclosure.constantExtensionAfter T
                uU t) ∧
        ∀ t ∈ Set.Ico 0 τ, HasDerivWithinAt u (f t (u t)) (Set.Ici t) t
    theorem NN.Proofs.Verification.ODE.Enclosure.extendedSolutionEnclosed_fromClampedDynamics
      {T τ : ℝ} (hT : 0 ≤ T) {f : ℝ → ℝ → ℝ}
      {u uL uU uL' uU' : ℝ → ℝ} {a : ℝ}
      (hu_cont : ContinuousOn u (Set.Icc 0 τ))
      (hu_der :
        ∀ t ∈ Set.Ico 0 τ,
          HasDerivWithinAt u
            (f t
              (NN.Proofs.Verification.ODE.Enclosure.clampToCorridor
                (NN.Proofs.Verification.ODE.Enclosure.constantExtensionAfter
                  T uL)
                (NN.Proofs.Verification.ODE.Enclosure.constantExtensionAfter
                  T uU)
                t (u t)))
            (Set.Ici t) t)
      (hu0 : u 0 = a)
      (hL_cont :
        ContinuousOn uL (Set.Icc 0 T))
      (hL_der :
        ∀ t ∈ Set.Ico 0 T,
          HasDerivWithinAt uL (uL' t)
            (Set.Ici t) t)
      (hL_sub :
        ∀ t ∈ Set.Ico 0 T, uL' t ≤ f t (uL t))
      (hL0 : uL 0 ≤ a)
      (hU_cont :
        ContinuousOn uU (Set.Icc 0 T))
      (hU_der :
        ∀ t ∈ Set.Ico 0 T,
          HasDerivWithinAt uU (uU' t)
            (Set.Ici t) t)
      (hU_sup :
        ∀ t ∈ Set.Ico 0 T, f t (uU t) ≤ uU' t)
      (hU0 : a ≤ uU 0)
      (hLU : ∀ t ∈ Set.Icc 0 T, uL t ≤ uU t)
      (hLower :
        ∀ (t : ℝ),
          T < t →
            0 ≤ f T (uL T) ∧
              f T (uL T) ≤ f t (uL T))
      (hUpper :
        ∀ (t : ℝ),
          T < t →
            f t (uU T) ≤ f T (uU T) ∧
              f T (uU T) ≤ 0) :
      (∀ t ∈ Set.Icc 0 τ,
          NN.Proofs.Verification.ODE.Enclosure.constantExtensionAfter
                T uL t ≤
              u t ∧
            u t ≤
              NN.Proofs.Verification.ODE.Enclosure.constantExtensionAfter
                T uU t) ∧
        ∀ t ∈ Set.Ico 0 τ,
          HasDerivWithinAt u (f t (u t))
            (Set.Ici t) t
    Constant-extension enclosure theorem:
    
    Assume we have `uL,uU` on `[0,T]` satisfying the local corridor hypotheses, and assume the paper's
    extra sign/monotonicity conditions for `f` beyond `T`. Then for any horizon `τ` (the case of
    interest being `τ ≥ T`; for `τ ≤ T` the statement reduces to the local one), any solution `u` of
    the clamped ODE built from the constant extensions is enclosed on `[0,τ]` and is a genuine solution
    of `u' = f(t,u)` on `[0,τ]`.
    
    This is the reusable Lean form of the paper's global-in-time step: after the verified horizon, the
    walls stop moving, and the vector field points inward at those frozen walls.
    
Proof for Theorem 8.5.58
uses 0

The proof combines the in-interval differential inequality with the two constant-extension cases.

The hypotheses include the initial value between the walls, continuity and one-sided derivative bounds up to the horizon, and inward-pointing inequalities at the frozen walls afterward. The result both encloses the supplied clamped solution and shows that it satisfies the original ODE. Once the solution lies between the walls, clamping its value has no effect on the vector field.

Theorem8.5.59
Group: Selected end-to-end mathematical results and explicit assumptions. (9)
Group member previews
Preview
Definition 8.5.50
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 0✓L∃∀N

Acceptance by the boolean 3D box and camera checker over shape-indexed inputs yields a Verified3DBox certificate.

Lean code for Theorem8.5.59●1 theorem
  • complete
    theorem NN.Verification.Geometry3D.Box3D.checkCert_sound {α : Type}
      [TorchLean.Storage α] [OfNat α 0] [OfNat α 1] [Add α] [Sub α] [Mul α]
      [Div α] [LE α] [LT α] [DecidableRel fun x1 x2 => x1 ≤ x2]
      [DecidableRel fun x1 x2 => x1 < x2]
      {cert : NN.Verification.Geometry3D.Box3D.BoxCameraCert α}
      (h : NN.Verification.Geometry3D.Box3D.checkCert cert = true) :
      NN.Verification.Geometry3D.Box3D.Verified3DBox cert
    theorem NN.Verification.Geometry3D.Box3D.checkCert_sound
      {α : Type} [TorchLean.Storage α]
      [OfNat α 0] [OfNat α 1] [Add α] [Sub α]
      [Mul α] [Div α] [LE α] [LT α]
      [DecidableRel fun x1 x2 => x1 ≤ x2]
      [DecidableRel fun x1 x2 => x1 < x2]
      {cert :
        NN.Verification.Geometry3D.Box3D.BoxCameraCert
          α}
      (h :
        NN.Verification.Geometry3D.Box3D.checkCert
            cert =
          true) :
      NN.Verification.Geometry3D.Box3D.Verified3DBox
        cert
    Soundness of the executable checker.
    
    This is the main theorem for the implementation: if the Boolean checker accepts an artifact, the
    artifact satisfies the mathematical `Verified3DBox` predicate.
    
Proof for Theorem 8.5.59

Each boolean guard over the tensor inputs is reflected into its proposition and assembled into the certificate structure.

The resulting fields record positive image dimensions and corner depths, an ordered box inside the image, projected corners inside the image, and their enclosure by the box with its stated tolerance. These are properties of the supplied camera artifact. They can be inspected separately when a downstream geometric argument needs, for example, the positive-depth premise for a projection.