TorchLean API

NN.Verification.Builtin.Proved.Correctness.Eval.PayloadOps

Payload-Backed IR Evaluation #

linear and conv nodes read weights from the external IR payload. These lemmas state the local contract at that boundary: when the expected payload is present and the shape preconditions are met, the IR evaluator returns the corresponding spec-layer operation.

A lookup table with one defined entry.

Instances For
    @[simp]

    Looking up the defining index of a singleton table returns its stored value.

    A payload containing one flat constant at id.

    Instances For

      A payload containing one linear layer at id.

      Instances For

        A payload containing one convolution layer at id.

        Instances For

          A payload containing one eval-mode BatchNorm layer at id.

          Instances For

            A graph containing a zero-parent const node.

            Instances For

              Local IR semantics for a payload-backed flat const node.

              Local IR semantics for a payload-backed flat const node.

              theorem NN.Verification.Builtin.Proved.Correctness.IRStep.evalConst_missing_payload {α : Type} [TorchLean.Storage α] [Context α] (payload : IR.Payload α) (id : ) (s : Spec.Shape) (hMissing : payload.const? id = none) :
              IR.Graph.evalConst payload id s = Except.error (toString "IR eval: missing const payload for node " ++ toString id)

              Missing constant payloads are rejected before unflattening.

              theorem NN.Verification.Builtin.Proved.Correctness.IRStep.evalLinear_eq_affine {α : Type} [TorchLean.Storage α] [Context α] (id outDim inDim : ) (W : TorchLean.Tensor α [outDim, inDim]) (b : TorchLean.Tensor α [outDim]) (x : TorchLean.Tensor α [inDim]) :
              have p := { outDim := outDim, inDim := inDim, W := W, b := b }; IR.Graph.evalLinear (singletonLinearPayload id p) id { shape := Spec.Shape.dim inDim Spec.Shape.scalar, tensor := x } (Spec.Shape.dim outDim Spec.Shape.scalar) = Except.ok { shape := Spec.Shape.dim outDim Spec.Shape.scalar, tensor := (Spec.matVecMulSpec W x).addSpec b }

              Local IR semantics for a payload-backed linear node.

              theorem NN.Verification.Builtin.Proved.Correctness.IRStep.evalAt_linear_eq_affine {α : Type} [TorchLean.Storage α] [Context α] (outDim inDim : ) (W : TorchLean.Tensor α [outDim, inDim]) (b : TorchLean.Tensor α [outDim]) (x : TorchLean.Tensor α [inDim]) :
              have p := { outDim := outDim, inDim := inDim, W := W, b := b }; (unaryGraphOut IR.OpKind.linear (Spec.Shape.dim inDim Spec.Shape.scalar) (Spec.Shape.dim outDim Spec.Shape.scalar)).evalAt (singletonLinearPayload 1 p) { shape := Spec.Shape.dim inDim Spec.Shape.scalar, tensor := x } #[{ shape := Spec.Shape.dim inDim Spec.Shape.scalar, tensor := x }] 1 = Except.ok { shape := Spec.Shape.dim outDim Spec.Shape.scalar, tensor := (Spec.matVecMulSpec W x).addSpec b }

              Local IR semantics for a payload-backed linear node.

              theorem NN.Verification.Builtin.Proved.Correctness.IRStep.evalLinear_missing_payload {α : Type} [TorchLean.Storage α] [Context α] (payload : IR.Payload α) (id : ) (hMissing : payload.linear? id = none) (x : Spec.SomeTensor α) (outShape : Spec.Shape) :
              IR.Graph.evalLinear payload id x outShape = Except.error (toString "IR eval: missing linear payload for node " ++ toString id)

              Missing linear payloads are rejected before the affine operation is evaluated.

              The IR configuration carried by a convolution payload with no leading batch axes.

              Instances For

                Local IR semantics for a payload-backed arbitrary-rank convolution.

                The shape-inference equation is exposed because it is exactly the dynamic check performed at the IR boundary. Once that check succeeds, evaluation is the typed Spec.groupedConvSpec operation.

                theorem NN.Verification.Builtin.Proved.Correctness.IRStep.evalConv_missing_payload {α : Type} [TorchLean.Storage α] [Context α] (payload : IR.Payload α) (id : ) (config : IR.ConvConfig) (x : Spec.SomeTensor α) (outShape : Spec.Shape) (hInfer : IR.OpContracts.inferConvConfigOutShape "conv" config x.shape = Except.ok outShape) (hMissing : payload.conv? id = none) :
                IR.Graph.evalConv payload id config x = Except.error (toString "IR eval: missing conv payload for node " ++ toString id)

                Missing convolution payloads are rejected before convolution is evaluated.