TorchLean API

NN.MLTheory.CROWN.Proofs.DirectedIBPLayerNorm

Rounded LayerNorm transfers #

The checked matrix view normalizes the complete suffix beginning at the requested axis. Stored gamma, beta, and epsilon are interpreted as real scalars before applying the real specification. Both the directed row path and the uniform default-parameter path are covered.

A successful matrix-layout check has positive width and preserves the element count.

theorem NN.MLTheory.CROWN.Graph.DirectedBackward.layerNorm_normalized_abs_le_sqrt {m n : ℕ} (hn : 0 < n) (x : TorchLean.Tensor ℝ [m, n]) (epsilon : ℝ) (hepsilon : 0 ≤ epsilon) (i : Fin m) (j : Fin n) :

Dividing a centered row entry by its stabilized standard deviation bounds its magnitude by the square root of the row width. Zero denominators follow Lean's real division convention.

Resolve the optional stored payload using the same suffix validation as IR evaluation.

Instances For

    The unit scale, zero bias, and stored-format default epsilon used by IR evaluation.

    Instances For

      The payload synthesized by the executable default-parameter fallback.

      Instances For

        Resolving the synthesized default payload gives exactly the absent-payload affine data.

        noncomputable def NN.MLTheory.CROWN.Graph.DirectedBackward.layerNormRealValue {α : Type} [TorchLean.Storage α] [Context α] [BoundOps α] [LawfulBoundOps α] (rows width : ℕ) (f : ℕ → ℝ) (affine : IR.Graph.LayerNormAffine α width) (hwidth : 0 < width) :

        The actual real matrix LayerNorm, with every affine parameter and epsilon interpreted from its stored scalar. Empty leading batches retain the IR's empty-tensor convention.

        Instances For

          Coordinate equation for suffix LayerNorm. Its premises are successful layout and payload resolution, independently of any interval box or interval transfer.

          Instances For

            The real coordinate equation is unchanged by materializing the default affine payload.

            theorem NN.MLTheory.CROWN.Graph.DirectedBackward.layerNormRealValue_default_abs_le {α : Type} [TorchLean.Storage α] [Context α] [BoundOps α] [LawfulBoundOps α] {rows width : ℕ} (hwidth : 0 < width) (f : ℕ → ℝ) (hepsilon : 0 ≤ LawfulBoundOps.toReal TorchLean.normalizationEpsilon) (i : Fin rows) (j : Fin width) :
            |Spec.get2 (layerNormRealValue rows width f (defaultNormalizationAffine width) hwidth) i j| ≤ √↑width

            The default matrix specification has the uniform square-root width bound.

            Default LayerNorm on a singleton suffix is exactly zero, even if epsilon rounds to zero.

            theorem NN.MLTheory.CROWN.Graph.DirectedBackward.ibpLayerNormPayloadBox?_encloses {α : Type} [TorchLean.Storage α] [Context α] [BoundOps α] [LawfulBoundOps α] [NonlinearBoundOps α] [LawfulNonlinearBoundOps α] {s : Spec.Shape} {axis : ℕ} {parameters : IR.LayerNormParams α} {input output : FlatBox α} {f g : ℕ → ℝ} (hx : RowEncloses input s.size f) (heq : LayerNormRealEquation s axis (some parameters) f g) (hout : ibpLayerNormPayloadBox? s axis parameters input = some output) :
            RowEncloses output s.size g

            A successful stored-parameter transfer encloses the IR matrix specification, including its resolved scale, bias, and epsilon, for every accepted normalized suffix.

            The backend's uniform default-parameter box encloses the actual real normalization. The lower radius is rounded downward; nonnegativity of the stored default epsilon is the only additional scalar fact.

            theorem NN.MLTheory.CROWN.Graph.DirectedBackward.ibpLayerNormBox?_encloses {α : Type} [TorchLean.Storage α] [Context α] [BoundOps α] [LawfulBoundOps α] [NonlinearBoundOps α] [LawfulNonlinearBoundOps α] (hepsilon : 0 ≤ LawfulBoundOps.toReal TorchLean.normalizationEpsilon) {s : Spec.Shape} {axis : ℕ} {input output : FlatBox α} {f g : ℕ → ℝ} (hx : RowEncloses input s.size f) (heq : LayerNormRealEquation s axis none f g) (hout : ibpLayerNormBox? s input axis = some output) :
            RowEncloses output s.size g

            Both successful default-parameter execution paths enclose the actual real LayerNorm.