Documentation

LeanMlir.Proofs.Training.TrainedCnnSeal

Level-3 seal for the trained-CNN witness #

The MLP rung's pdiv_fwd/trainedMlp_backward_nontrivial program at the CONVOLUTIONAL witness: one whole-net Jacobian entry of the trained CNN, computed in closed form by peeling mnistCnnNoBnForward with pdiv_comp from the output side. Exact backward-cotangent tables (all in-kernel rationals): dense head slices (t4V/t3V), the max-pool argmax routing (t2V, via MaxPool2IsArgmax at each of the 72 positions), the ReLU mask folds (m2V/m1V), and the conv input-VJPs (t1V and the final entry, via conv2d_input_grad_formula through HasVJPAt.correct).

The sealed entry: ∂ logit_7 / ∂ pixel (0,2) at the witness = -326103939411/34359738368 ≈ -9.4909 ≠ 0, hence trainedCnn_backward_nontrivial (the proven backward is not the zero map), trainedCnn_jacobian_nonzero (fderiv ≠ 0), and trainedCnn_not_constant. Generated by scripts/trained_cnn_seal.py; tables are DATA here.

noncomputable def Proofs.TrainedCnn.t4V :
Vec 8

dense-head slice pdiv (dense5 ∘ relu∘dense4) r3V · 7.

Equations
Instances For
    noncomputable def Proofs.TrainedCnn.t3V :
    Vec (2 * 3 * 3)
    • relu∘dense3: pdiv (head) p2f · 7.
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      noncomputable def Proofs.TrainedCnn.t2V :
      Vec (2 * (2 * 3) * (2 * 3))
      • max-pool: argmax routing of t3V (zero off-argmax).
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        noncomputable def Proofs.TrainedCnn.M2T :
        Tensor3 2 6 6

        relu mask₂ ⊙ t2V, tensor form (the conv2 backward cotangent).

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          noncomputable def Proofs.TrainedCnn.m2V :
          Vec (2 * (2 * 3) * (2 * 3))
          Equations
          Instances For
            noncomputable def Proofs.TrainedCnn.t1V :
            Vec (2 * (2 * 3) * (2 * 3))

            conv2 input-VJP of m2V.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              noncomputable def Proofs.TrainedCnn.M1T :
              Tensor3 2 6 6

              relu mask₁ ⊙ t1V, tensor form (the conv1 backward cotangent).

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                noncomputable def Proofs.TrainedCnn.m1V :
                Vec (2 * (2 * 3) * (2 * 3))
                Equations
                Instances For

                  relu(conv2 table) = the max-pool input table, pointwise fold.

                  conv2 at the relu(conv1) table = the conv2 table, flat form.

                  relu(conv1 table) = the conv2-input table, pointwise fold.

                  conv1 at the witness input = the conv1 table, flat form.

                  theorem Proofs.TrainedCnn.d4inner (k m : Fin 8) :
                  pdiv (relu 8 dense W4 b4) r3V k m = W4 k m * if d4V m > 0 then 1 else 0
                  theorem Proofs.TrainedCnn.d3inner (k : Fin (2 * 3 * 3)) (m : Fin 8) :
                  pdiv (relu 8 dense W3 b3) p2f k m = W3 k m * if d3V m > 0 then 1 else 0
                  theorem Proofs.TrainedCnn.S3 (k : Fin (2 * 3 * 3)) :
                  theorem Proofs.TrainedCnn.S2 (k : Fin (2 * (2 * 3) * (2 * 3))) :
                  theorem Proofs.TrainedCnn.S2r (m : Fin (2 * (2 * 3) * (2 * 3))) :
                  pdiv ((((dense W5 b5 relu 8 dense W4 b4) relu 8 dense W3 b3) maxPoolFlat 2 3 3) relu (2 * (2 * 3) * (2 * 3))) (Tensor3.flatten c2V) m 7, = m2V m
                  theorem Proofs.TrainedCnn.S1 (k : Fin (2 * (2 * 3) * (2 * 3))) :
                  pdiv (((((dense W5 b5 relu 8 dense W4 b4) relu 8 dense W3 b3) maxPoolFlat 2 3 3) relu (2 * (2 * 3) * (2 * 3))) flatConv W2 b2) z1V.flatten k 7, = t1V k
                  theorem Proofs.TrainedCnn.S0r (m : Fin (2 * (2 * 3) * (2 * 3))) :
                  pdiv ((((((dense W5 b5 relu 8 dense W4 b4) relu 8 dense W3 b3) maxPoolFlat 2 3 3) relu (2 * (2 * 3) * (2 * 3))) flatConv W2 b2) relu (2 * (2 * 3) * (2 * 3))) (Tensor3.flatten c1V) m 7, = m1V m
                  theorem Proofs.TrainedCnn.pdiv_fwd_entry :
                  pdiv (mnistCnnNoBnForward W1 b1 W2 b2 W3 b3 W4 b4 W5 b5) X 2, 7, = -326103939411 / 34359738368

                  The whole-net Jacobian entry, exactly: ∂ logit_7 / ∂ pixel (0,2) at the trained weights and the real witness input.

                  Level 3: the trained-weight CNN backward is not the zero map — the seal the MLP rung carries, now at the convolutional witness.

                  The fderiv form: the whole-net Jacobian at the trained CNN witness is nonzero.

                  The trained CNN is not a constant function.