Documentation

LeanMlir.Proofs.Nets.ResNet.ResNet50ParamGrad

ResNet-50 — every parameter gradient node IS the loss's derivative in that parameter #

r50_net_tiedB says each of the 161 parameter gradient nodes denotes its layer's parameter Jacobian contracted with the cotangent the emitted backward chain threads to it, from a loss cotangent g it takes as a binder; the r50*CotIn_eq_vjp lemmas say the block-input cotangents are certified VJP backwards. r50_net_lossGrad composes them: for any loss L of the logits whose gradient at the net's output is g, every node is ∂L/∂θ of the WHOLE net with that one parameter varied. The two losses the artifacts ship discharge hL:

How. ResNet34ParamGrad's three layers, with R34's stem and head bundles reused verbatim (the stem and head ARE R34's functions at R50's widths):

Hypotheses. 0 < q, R50PosB (every BN ε > 0), R50SmoothAtB (every relu off its kink and the stem pool tie-free at the real activations); for the smoothed loss also every example's target summing to one and 0 < nCls. The BCE corollary takes no hypothesis on the target.

noncomputable def Proofs.ResNet50TieB.r50IdGA (N h w : ℕ) {oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) :
Vec (N * (oc * h * w)) → Vec 1

The loss at the outer relu's input.

Equations
Instances For
    noncomputable def Proofs.ResNet50TieB.r50IdGN3 (N h w : ℕ) {oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (v : Vec (N * (oc * h * w))) :
    Vec (N * (oc * h * w)) → Vec 1

    The loss at bn₃'s output (the skip v held fixed).

    Equations
    Instances For
      noncomputable def Proofs.ResNet50TieB.r50IdGC3 (N h w : ℕ) {mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50IdW mid oc) (v : Vec (N * (oc * h * w))) :
      Vec (N * (oc * h * w)) → Vec 1

      The loss at conv₃'s output.

      Equations
      Instances For
        noncomputable def Proofs.ResNet50TieB.r50IdGN2 (N h w : ℕ) {mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50IdW mid oc) (v : Vec (N * (oc * h * w))) :
        Vec (N * (mid * h * w)) → Vec 1

        The loss at bn₂'s output.

        Equations
        Instances For
          noncomputable def Proofs.ResNet50TieB.r50IdGC2 (N h w : ℕ) {mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50IdW mid oc) (v : Vec (N * (oc * h * w))) :
          Vec (N * (mid * h * w)) → Vec 1

          The loss at conv₂'s output.

          Equations
          Instances For
            noncomputable def Proofs.ResNet50TieB.r50IdGN1 (N h w : ℕ) {mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50IdW mid oc) (v : Vec (N * (oc * h * w))) :
            Vec (N * (mid * h * w)) → Vec 1

            The loss at bn₁'s output.

            Equations
            Instances For
              noncomputable def Proofs.ResNet50TieB.r50IdGC1 (N h w : ℕ) {mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50IdW mid oc) (v : Vec (N * (oc * h * w))) :
              Vec (N * (mid * h * w)) → Vec 1

              The loss at conv₁'s output.

              Equations
              Instances For
                theorem Proofs.ResNet50TieB.r50IdGA_hasGradAt {N h w mid oc : ℕ} (p : R50IdW mid oc) (v : Vec (N * (oc * h * w))) (hs : R50IdSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50IdB N h w p v) dy) :
                theorem Proofs.ResNet50TieB.r50IdGN3_hasGradAt {N h w mid oc : ℕ} (p : R50IdW mid oc) (v : Vec (N * (oc * h * w))) (hs : R50IdSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50IdB N h w p v) dy) :
                theorem Proofs.ResNet50TieB.r50IdGC3_hasGradAt {N h w mid oc : ℕ} (p : R50IdW mid oc) (hq : R50IdPos p) (v : Vec (N * (oc * h * w))) (hs : R50IdSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50IdB N h w p v) dy) :
                theorem Proofs.ResNet50TieB.r50IdGN2_hasGradAt {N h w mid oc : ℕ} (p : R50IdW mid oc) (hq : R50IdPos p) (v : Vec (N * (oc * h * w))) (hs : R50IdSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50IdB N h w p v) dy) :
                HasGradAt (r50IdGN2 N h w Gn p v) (StableHLO.bnBatchLA N mid h w p.ε₂ p.γ₂ p.β₂ (StableHLO.batchMap N (flatConv p.W₂ p.b₂) (StableHLO.cbReluB N p.W₁ p.b₁ p.ε₁ p.γ₁ p.β₁ v))) (r50IdCotN2 N h w p v dy)
                theorem Proofs.ResNet50TieB.r50IdGC2_hasGradAt {N h w mid oc : ℕ} (p : R50IdW mid oc) (hq : R50IdPos p) (v : Vec (N * (oc * h * w))) (hs : R50IdSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50IdB N h w p v) dy) :
                HasGradAt (r50IdGC2 N h w Gn p v) (StableHLO.batchMap N (flatConv p.W₂ p.b₂) (StableHLO.cbReluB N p.W₁ p.b₁ p.ε₁ p.γ₁ p.β₁ v)) (r50IdCotC2 N h w p v dy)
                theorem Proofs.ResNet50TieB.r50IdGN1_hasGradAt {N h w mid oc : ℕ} (p : R50IdW mid oc) (hq : R50IdPos p) (v : Vec (N * (oc * h * w))) (hs : R50IdSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50IdB N h w p v) dy) :
                HasGradAt (r50IdGN1 N h w Gn p v) (StableHLO.bnBatchLA N mid h w p.ε₁ p.γ₁ p.β₁ (StableHLO.batchMap N (flatConv p.W₁ p.b₁) v)) (r50IdCotN1 N h w p v dy)
                theorem Proofs.ResNet50TieB.r50IdGC1_hasGradAt {N h w mid oc : ℕ} (p : R50IdW mid oc) (hq : R50IdPos p) (v : Vec (N * (oc * h * w))) (hs : R50IdSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50IdB N h w p v) dy) :
                HasGradAt (r50IdGC1 N h w Gn p v) (StableHLO.batchMap N (flatConv p.W₁ p.b₁) v) (r50IdCotC1 N h w p v dy)
                def Proofs.ResNet50TieB.r50IdLossTiedB {N h w mid oc : ℕ} (xN cotN vN epsStr : String) (p : R50IdW mid oc) (v : Vec (N * (oc * h * w))) (Φ : R50IdW mid oc → Vec 1) (dy : Vec (N * (oc * h * w))) :

                Identity bottleneck, every parameter node a loss derivative. With Gn the loss read at the block's output and Φ the loss as a function of the block's weight record (hΦ), each of the nine nodes r50IdTiedB ties — at the same cotangents — is ∂Φ/∂slot with that one slot varied.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem Proofs.ResNet50TieB.r50_idblock_lossTiedB {N h w mid oc : ℕ} (xN cotN vN epsStr : String) (p : R50IdW mid oc) (hq : R50IdPos p) (v : Vec (N * (oc * h * w))) (hs : R50IdSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50IdB N h w p v) dy) {Φ : R50IdW mid oc → Vec 1} (hΦ : ∀ (p' : R50IdW mid oc), Φ p' = Gn (r50IdB N h w p' v)) :
                  r50IdLossTiedB xN cotN vN epsStr p v Φ dy
                  @[reducible]
                  noncomputable def Proofs.ResNet50TieB.r50ProjProjOut (N h w : ℕ) {ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                  Vec (N * (oc * h * w))

                  The projection branch's output, bnₚ(convₚ v).

                  Equations
                  Instances For
                    @[reducible]
                    noncomputable def Proofs.ResNet50TieB.r50ProjBodyOut (N h w : ℕ) {ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                    Vec (N * (oc * h * w))

                    The body branch's output, bn₃(conv₃(relu(bn₂(conv₂(relu(bn₁(conv₁ v))))))).

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      noncomputable def Proofs.ResNet50TieB.r50ProjGN3 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                      Vec (N * (oc * h * w)) → Vec 1

                      The loss at bn₃'s output (projection branch fixed, on the left).

                      Equations
                      Instances For
                        noncomputable def Proofs.ResNet50TieB.r50ProjGC3 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                        Vec (N * (oc * h * w)) → Vec 1
                        Equations
                        Instances For
                          noncomputable def Proofs.ResNet50TieB.r50ProjGN2 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                          Vec (N * (mid * h * w)) → Vec 1
                          Equations
                          Instances For
                            noncomputable def Proofs.ResNet50TieB.r50ProjGC2 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                            Vec (N * (mid * h * w)) → Vec 1
                            Equations
                            Instances For
                              noncomputable def Proofs.ResNet50TieB.r50ProjGN1 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                              Vec (N * (mid * h * w)) → Vec 1
                              Equations
                              Instances For
                                noncomputable def Proofs.ResNet50TieB.r50ProjGC1 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                                Vec (N * (mid * h * w)) → Vec 1
                                Equations
                                Instances For
                                  noncomputable def Proofs.ResNet50TieB.r50ProjGNp (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                                  Vec (N * (oc * h * w)) → Vec 1

                                  The loss at bnₚ's output (body branch fixed, on the right).

                                  Equations
                                  Instances For
                                    noncomputable def Proofs.ResNet50TieB.r50ProjGCp (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) :
                                    Vec (N * (oc * h * w)) → Vec 1
                                    Equations
                                    Instances For
                                      theorem Proofs.ResNet50TieB.r50ProjGA_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) :
                                      HasGradAt (r50IdGA N h w Gn) (fun (i : Fin (N * (oc * h * w))) => r50ProjProjOut N h w p v i + r50ProjBodyOut N h w p v i) (r50ProjCotA N h w p v dy)
                                      theorem Proofs.ResNet50TieB.r50ProjGN3_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) :
                                      HasGradAt (r50ProjGN3 N h w Gn p v) (r50ProjBodyOut N h w p v) (r50ProjCotA N h w p v dy)
                                      theorem Proofs.ResNet50TieB.r50ProjGNp_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) :
                                      HasGradAt (r50ProjGNp N h w Gn p v) (r50ProjProjOut N h w p v) (r50ProjCotA N h w p v dy)
                                      theorem Proofs.ResNet50TieB.r50ProjGC3_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) :
                                      theorem Proofs.ResNet50TieB.r50ProjGN2_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) :
                                      theorem Proofs.ResNet50TieB.r50ProjGC2_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) :
                                      theorem Proofs.ResNet50TieB.r50ProjGN1_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) :
                                      HasGradAt (r50ProjGN1 N h w Gn p v) (StableHLO.bnBatchLA N mid h w p.ε₁ p.γ₁ p.β₁ (StableHLO.batchMap N (flatConv p.W₁ p.b₁) v)) (r50ProjCotN1 N h w p v dy)
                                      theorem Proofs.ResNet50TieB.r50ProjGC1_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) :
                                      HasGradAt (r50ProjGC1 N h w Gn p v) (StableHLO.batchMap N (flatConv p.W₁ p.b₁) v) (r50ProjCotC1 N h w p v dy)
                                      theorem Proofs.ResNet50TieB.r50ProjGCp_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) :
                                      HasGradAt (r50ProjGCp N h w Gn p v) (StableHLO.batchMap N (flatConv p.Wp p.bp) v) (r50ProjCotCp N h w p v dy)
                                      def Proofs.ResNet50TieB.r50ProjLossTiedB {N h w ic mid oc : ℕ} (xN cotN vN epsStr : String) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * h * w))) (Φ : R50ProjW ic mid oc → Vec 1) (dy : Vec (N * (oc * h * w))) :

                                      Stride-1 projection bottleneck, every parameter node a loss derivative — the twelve nodes r50ProjTiedB ties.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        theorem Proofs.ResNet50TieB.r50_projblock_lossTiedB {N h w ic mid oc : ℕ} (xN cotN vN epsStr : String) (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50ProjB N h w p v) dy) {Φ : R50ProjW ic mid oc → Vec 1} (hΦ : ∀ (p' : R50ProjW ic mid oc), Φ p' = Gn (r50ProjB N h w p' v)) :
                                        r50ProjLossTiedB xN cotN vN epsStr p v Φ dy
                                        @[reducible]
                                        noncomputable def Proofs.ResNet50TieB.r50DownProjOut (N h w : ℕ) {ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                        Vec (N * (oc * h * w))

                                        The strided projection branch's output.

                                        Equations
                                        Instances For
                                          @[reducible]
                                          noncomputable def Proofs.ResNet50TieB.r50DownBodyOut (N h w : ℕ) {ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                          Vec (N * (oc * h * w))

                                          The body branch's output.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            noncomputable def Proofs.ResNet50TieB.r50DownGN3 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                            Vec (N * (oc * h * w)) → Vec 1
                                            Equations
                                            Instances For
                                              noncomputable def Proofs.ResNet50TieB.r50DownGC3 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                              Vec (N * (oc * h * w)) → Vec 1
                                              Equations
                                              Instances For
                                                noncomputable def Proofs.ResNet50TieB.r50DownGN2 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                                Vec (N * (mid * h * w)) → Vec 1
                                                Equations
                                                Instances For
                                                  noncomputable def Proofs.ResNet50TieB.r50DownGC2 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                                  Vec (N * (mid * h * w)) → Vec 1
                                                  Equations
                                                  Instances For
                                                    noncomputable def Proofs.ResNet50TieB.r50DownGN1 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                                    Vec (N * (mid * (2 * h) * (2 * w))) → Vec 1

                                                    The loss at bn₁'s output, at the input grid 2h × 2w.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      noncomputable def Proofs.ResNet50TieB.r50DownGC1 (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                                      Vec (N * (mid * (2 * h) * (2 * w))) → Vec 1
                                                      Equations
                                                      Instances For
                                                        noncomputable def Proofs.ResNet50TieB.r50DownGNp (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                                        Vec (N * (oc * h * w)) → Vec 1
                                                        Equations
                                                        Instances For
                                                          noncomputable def Proofs.ResNet50TieB.r50DownGCp (N h w : ℕ) {ic mid oc : ℕ} (Gn : Vec (N * (oc * h * w)) → Vec 1) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) :
                                                          Vec (N * (oc * h * w)) → Vec 1
                                                          Equations
                                                          Instances For
                                                            theorem Proofs.ResNet50TieB.r50DownGA_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) :
                                                            HasGradAt (r50IdGA N h w Gn) (fun (i : Fin (N * (oc * h * w))) => r50DownProjOut N h w p v i + r50DownBodyOut N h w p v i) (r50DownCotA N h w p v dy)
                                                            theorem Proofs.ResNet50TieB.r50DownGN3_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) :
                                                            HasGradAt (r50DownGN3 N h w Gn p v) (r50DownBodyOut N h w p v) (r50DownCotA N h w p v dy)
                                                            theorem Proofs.ResNet50TieB.r50DownGNp_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) :
                                                            HasGradAt (r50DownGNp N h w Gn p v) (r50DownProjOut N h w p v) (r50DownCotA N h w p v dy)
                                                            theorem Proofs.ResNet50TieB.r50DownGC3_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) :
                                                            theorem Proofs.ResNet50TieB.r50DownGN2_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) :
                                                            theorem Proofs.ResNet50TieB.r50DownGC2_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) :
                                                            theorem Proofs.ResNet50TieB.r50DownGN1_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) :
                                                            HasGradAt (r50DownGN1 N h w Gn p v) (StableHLO.bnBatchLA N mid (2 * h) (2 * w) p.ε₁ p.γ₁ p.β₁ (StableHLO.batchMap N (flatConv p.W₁ p.b₁) v)) (r50DownCotN1 N h w p v dy)
                                                            theorem Proofs.ResNet50TieB.r50DownGC1_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) :
                                                            HasGradAt (r50DownGC1 N h w Gn p v) (StableHLO.batchMap N (flatConv p.W₁ p.b₁) v) (r50DownCotC1 N h w p v dy)
                                                            theorem Proofs.ResNet50TieB.r50DownGCp_hasGradAt {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) :
                                                            HasGradAt (r50DownGCp N h w Gn p v) (StableHLO.batchMap N (flatConvStride2 p.Wp p.bp) v) (r50DownCotCp N h w p v dy)
                                                            def Proofs.ResNet50TieB.r50DownLossTiedB {N h w ic mid oc : ℕ} (xN cotN vN epsStr : String) (p : R50ProjW ic mid oc) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (Φ : R50ProjW ic mid oc → Vec 1) (dy : Vec (N * (oc * h * w))) :

                                                            Strided projection bottleneck, every parameter node a loss derivative — the twelve nodes r50DownTiedB ties: W₁ an ordinary conv node at 2h × 2w, W₂ and Wp strided.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              theorem Proofs.ResNet50TieB.r50_downblock_lossTiedB {N h w ic mid oc : ℕ} (xN cotN vN epsStr : String) (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {Gn : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hGn : HasGradAt Gn (r50DownB N h w p v) dy) {Φ : R50ProjW ic mid oc → Vec 1} (hΦ : ∀ (p' : R50ProjW ic mid oc), Φ p' = Gn (r50DownB N h w p' v)) :
                                                              r50DownLossTiedB xN cotN vN epsStr p v Φ dy
                                                              theorem Proofs.ResNet50TieB.r50IdB_hasGradAt_comp {N h w mid oc : ℕ} (p : R50IdW mid oc) (hq : R50IdPos p) (v : Vec (N * (oc * h * w))) (hs : R50IdSmoothAt N h w p v) {G : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hG : HasGradAt G (r50IdB N h w p v) dy) :
                                                              HasGradAt (fun (y : Vec (N * (oc * h * w))) => G (r50IdB N h w p y)) v (r50IdCotIn N h w p v dy)

                                                              Pull the loss gradient back through an identity bottleneck: the certified block VJP, read at the chain's own fan-in (r50IdCotIn_eq_vjp).

                                                              theorem Proofs.ResNet50TieB.r50ProjB_hasGradAt_comp {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * h * w))) (hs : R50ProjSmoothAt N h w p v) {G : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hG : HasGradAt G (r50ProjB N h w p v) dy) :
                                                              HasGradAt (fun (y : Vec (N * (ic * h * w))) => G (r50ProjB N h w p y)) v (r50ProjCotIn N h w p v dy)

                                                              …through the stride-1 projection bottleneck (r50ProjCotIn_eq_vjp).

                                                              theorem Proofs.ResNet50TieB.r50DownB_hasGradAt_comp {N h w ic mid oc : ℕ} (p : R50ProjW ic mid oc) (hq : R50ProjPos p) (v : Vec (N * (ic * (2 * h) * (2 * w)))) (hs : R50DownSmoothAt N h w p v) {G : Vec (N * (oc * h * w)) → Vec 1} {dy : Vec (N * (oc * h * w))} (hG : HasGradAt G (r50DownB N h w p v) dy) :
                                                              HasGradAt (fun (y : Vec (N * (ic * (2 * h) * (2 * w)))) => G (r50DownB N h w p y)) v (r50DownCotIn N h w p v dy)

                                                              …and through the strided projection bottleneck (r50DownCotIn_eq_vjp).

                                                              noncomputable def Proofs.ResNet50TieB.r50SufS4b2 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                              Vec (N * (2048 * q * q)) → Vec (N * nCls)

                                                              The net after block s4b2 — the head.

                                                              Equations
                                                              Instances For
                                                                noncomputable def Proofs.ResNet50TieB.r50SufS4b1 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                Vec (N * (2048 * q * q)) → Vec (N * nCls)

                                                                The net after block s4b1: block s4b2, then the rest.

                                                                Equations
                                                                Instances For
                                                                  noncomputable def Proofs.ResNet50TieB.r50SufS4b0 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                  Vec (N * (2048 * q * q)) → Vec (N * nCls)

                                                                  The net after block s4b0: block s4b1, then the rest.

                                                                  Equations
                                                                  Instances For
                                                                    noncomputable def Proofs.ResNet50TieB.r50SufS3b5 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                    Vec (N * (1024 * (2 * q) * (2 * q))) → Vec (N * nCls)

                                                                    The net after block s3b5: block s4b0, then the rest.

                                                                    Equations
                                                                    Instances For
                                                                      noncomputable def Proofs.ResNet50TieB.r50SufS3b4 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                      Vec (N * (1024 * (2 * q) * (2 * q))) → Vec (N * nCls)

                                                                      The net after block s3b4: block s3b5, then the rest.

                                                                      Equations
                                                                      Instances For
                                                                        noncomputable def Proofs.ResNet50TieB.r50SufS3b3 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                        Vec (N * (1024 * (2 * q) * (2 * q))) → Vec (N * nCls)

                                                                        The net after block s3b3: block s3b4, then the rest.

                                                                        Equations
                                                                        Instances For
                                                                          noncomputable def Proofs.ResNet50TieB.r50SufS3b2 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                          Vec (N * (1024 * (2 * q) * (2 * q))) → Vec (N * nCls)

                                                                          The net after block s3b2: block s3b3, then the rest.

                                                                          Equations
                                                                          Instances For
                                                                            noncomputable def Proofs.ResNet50TieB.r50SufS3b1 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                            Vec (N * (1024 * (2 * q) * (2 * q))) → Vec (N * nCls)

                                                                            The net after block s3b1: block s3b2, then the rest.

                                                                            Equations
                                                                            Instances For
                                                                              noncomputable def Proofs.ResNet50TieB.r50SufS3b0 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                              Vec (N * (1024 * (2 * q) * (2 * q))) → Vec (N * nCls)

                                                                              The net after block s3b0: block s3b1, then the rest.

                                                                              Equations
                                                                              Instances For
                                                                                noncomputable def Proofs.ResNet50TieB.r50SufS2b3 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                                Vec (N * (512 * (2 * (2 * q)) * (2 * (2 * q)))) → Vec (N * nCls)

                                                                                The net after block s2b3: block s3b0, then the rest.

                                                                                Equations
                                                                                Instances For
                                                                                  noncomputable def Proofs.ResNet50TieB.r50SufS2b2 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                                  Vec (N * (512 * (2 * (2 * q)) * (2 * (2 * q)))) → Vec (N * nCls)

                                                                                  The net after block s2b2: block s2b3, then the rest.

                                                                                  Equations
                                                                                  Instances For
                                                                                    noncomputable def Proofs.ResNet50TieB.r50SufS2b1 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                                    Vec (N * (512 * (2 * (2 * q)) * (2 * (2 * q)))) → Vec (N * nCls)

                                                                                    The net after block s2b1: block s2b2, then the rest.

                                                                                    Equations
                                                                                    Instances For
                                                                                      noncomputable def Proofs.ResNet50TieB.r50SufS2b0 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                                      Vec (N * (512 * (2 * (2 * q)) * (2 * (2 * q)))) → Vec (N * nCls)

                                                                                      The net after block s2b0: block s2b1, then the rest.

                                                                                      Equations
                                                                                      Instances For
                                                                                        noncomputable def Proofs.ResNet50TieB.r50SufS1b2 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                                        Vec (N * (256 * (2 * (2 * (2 * q))) * (2 * (2 * (2 * q))))) → Vec (N * nCls)

                                                                                        The net after block s1b2: block s2b0, then the rest.

                                                                                        Equations
                                                                                        Instances For
                                                                                          noncomputable def Proofs.ResNet50TieB.r50SufS1b1 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                                          Vec (N * (256 * (2 * (2 * (2 * q))) * (2 * (2 * (2 * q))))) → Vec (N * nCls)

                                                                                          The net after block s1b1: block s1b2, then the rest.

                                                                                          Equations
                                                                                          Instances For
                                                                                            noncomputable def Proofs.ResNet50TieB.r50SufS1b0 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                                            Vec (N * (256 * (2 * (2 * (2 * q))) * (2 * (2 * (2 * q))))) → Vec (N * nCls)

                                                                                            The net after block s1b0: block s1b1, then the rest.

                                                                                            Equations
                                                                                            Instances For
                                                                                              noncomputable def Proofs.ResNet50TieB.r50SufStem (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) :
                                                                                              Vec (N * (64 * (2 * (2 * (2 * q))) * (2 * (2 * (2 * q))))) → Vec (N * nCls)

                                                                                              The net after the stem: block s1b0, then the rest.

                                                                                              Equations
                                                                                              Instances For
                                                                                                theorem Proofs.ResNet50TieB.r50_factor_stem (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (W : Kernel4 64 3 7 7) (b γ β : Vec 64) :
                                                                                                resnet50ForwardBFull N q { sW := W, sb := b, sε := w.sε, sγ := γ, sβ := β, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufStem N q w (r34StemB N (2 * (2 * (2 * q))) (2 * (2 * (2 * q))) W b w.sε γ β x)

                                                                                                The net with the stem's parameters varied is the suffix after the stem at the varied stem.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s1b0 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50ProjW 64 64 256) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := p, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS1b0 N q w (r50ProjB N (2 * (2 * (2 * q))) (2 * (2 * (2 * q))) p (r50Pre0 N q w x))

                                                                                                The net with block s1b0's weights varied is the suffix after s1b0 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s1b1 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 64 256) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := p, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS1b1 N q w (r50IdB N (2 * (2 * (2 * q))) (2 * (2 * (2 * q))) p (r50Pre1 N q w x))

                                                                                                The net with block s1b1's weights varied is the suffix after s1b1 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s1b2 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 64 256) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := p, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS1b2 N q w (r50IdB N (2 * (2 * (2 * q))) (2 * (2 * (2 * q))) p (r50Pre2 N q w x))

                                                                                                The net with block s1b2's weights varied is the suffix after s1b2 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s2b0 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50ProjW 256 128 512) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := p, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS2b0 N q w (r50DownB N (2 * (2 * q)) (2 * (2 * q)) p (r50Pre3 N q w x))

                                                                                                The net with block s2b0's weights varied is the suffix after s2b0 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s2b1 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 128 512) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := p, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS2b1 N q w (r50IdB N (2 * (2 * q)) (2 * (2 * q)) p (r50Pre4 N q w x))

                                                                                                The net with block s2b1's weights varied is the suffix after s2b1 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s2b2 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 128 512) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := p, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS2b2 N q w (r50IdB N (2 * (2 * q)) (2 * (2 * q)) p (r50Pre5 N q w x))

                                                                                                The net with block s2b2's weights varied is the suffix after s2b2 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s2b3 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 128 512) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := p, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS2b3 N q w (r50IdB N (2 * (2 * q)) (2 * (2 * q)) p (r50Pre6 N q w x))

                                                                                                The net with block s2b3's weights varied is the suffix after s2b3 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s3b0 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50ProjW 512 256 1024) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := p, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS3b0 N q w (r50DownB N (2 * q) (2 * q) p (r50Pre7 N q w x))

                                                                                                The net with block s3b0's weights varied is the suffix after s3b0 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s3b1 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 256 1024) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := p, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS3b1 N q w (r50IdB N (2 * q) (2 * q) p (r50Pre8 N q w x))

                                                                                                The net with block s3b1's weights varied is the suffix after s3b1 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s3b2 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 256 1024) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := p, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS3b2 N q w (r50IdB N (2 * q) (2 * q) p (r50Pre9 N q w x))

                                                                                                The net with block s3b2's weights varied is the suffix after s3b2 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s3b3 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 256 1024) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := p, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS3b3 N q w (r50IdB N (2 * q) (2 * q) p (r50Pre10 N q w x))

                                                                                                The net with block s3b3's weights varied is the suffix after s3b3 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s3b4 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 256 1024) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := p, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS3b4 N q w (r50IdB N (2 * q) (2 * q) p (r50Pre11 N q w x))

                                                                                                The net with block s3b4's weights varied is the suffix after s3b4 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s3b5 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 256 1024) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := p, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS3b5 N q w (r50IdB N (2 * q) (2 * q) p (r50Pre12 N q w x))

                                                                                                The net with block s3b5's weights varied is the suffix after s3b5 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s4b0 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50ProjW 1024 512 2048) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := p, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS4b0 N q w (r50DownB N q q p (r50Pre13 N q w x))

                                                                                                The net with block s4b0's weights varied is the suffix after s4b0 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s4b1 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 512 2048) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := p, s4b2 := w.s4b2, Wd := w.Wd, bd := w.bd } x = r50SufS4b1 N q w (r50IdB N q q p (r50Pre14 N q w x))

                                                                                                The net with block s4b1's weights varied is the suffix after s4b1 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_s4b2 (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (p : R50IdW 512 2048) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := p, Wd := w.Wd, bd := w.bd } x = r50SufS4b2 N q w (r50IdB N q q p (r50Pre15 N q w x))

                                                                                                The net with block s4b2's weights varied is the suffix after s4b2 at the varied block.

                                                                                                theorem Proofs.ResNet50TieB.r50_factor_head (N q : ℕ) {nCls : ℕ} (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (W : Mat 2048 nCls) (b : Vec nCls) :
                                                                                                resnet50ForwardBFull N q { sW := w.sW, sb := w.sb, sε := w.sε, sγ := w.sγ, sβ := w.sβ, s1b0 := w.s1b0, s1b1 := w.s1b1, s1b2 := w.s1b2, s2b0 := w.s2b0, s2b1 := w.s2b1, s2b2 := w.s2b2, s2b3 := w.s2b3, s3b0 := w.s3b0, s3b1 := w.s3b1, s3b2 := w.s3b2, s3b3 := w.s3b3, s3b4 := w.s3b4, s3b5 := w.s3b5, s4b0 := w.s4b0, s4b1 := w.s4b1, s4b2 := w.s4b2, Wd := W, bd := b } x = r34HeadB N q q W b (r50Pre16 N q w x)

                                                                                                The net with the classifier varied is the head at the varied classifier.

                                                                                                def Proofs.ResNet50TieB.R50NetLossTiedB (N q : ℕ) {nCls : ℕ} (xN cotN vN epsStr : String) (w : R50BWeights nCls) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (L : Vec (N * nCls) → Vec 1) (g : Vec (N * nCls)) :

                                                                                                Every ResNet-50 parameter gradient node is the derivative of L in that parameter, for a loss L of the logits and g the cotangent the chain starts from: the 161 nodes r50_net_tiedB ties, each at the cotangent the emitted chain threads to it, stated against L of resnet50ForwardBFull with that one parameter varied. r50_net_lossGrad proves it whenever g is L's gradient at the logits; the two losses the artifacts ship instantiate it.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For
                                                                                                  theorem Proofs.ResNet50TieB.r50_net_lossGrad (N q : ℕ) (hq0 : 0 < q) {nCls : ℕ} (xN cotN vN epsStr : String) (w : R50BWeights nCls) (hp : R50PosB w) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (hx : R50SmoothAtB N q w x) {L : Vec (N * nCls) → Vec 1} {g : Vec (N * nCls)} (hL : HasGradAt L (resnet50ForwardBFull N q w x) g) :
                                                                                                  R50NetLossTiedB N q xN cotN vN epsStr w x L g

                                                                                                  Every ResNet-50 parameter gradient node is the derivative of the loss in that parameter. For any loss L of the logits with gradient g at the net's output, each of the 161 nodes r50_net_tiedB ties — at the same cotangent — is ∂L/∂θ of the WHOLE net, resnet50ForwardBFull with that one parameter varied (a stem field, a block's weight record w.blk := p with one slot changed, or the classifier).

                                                                                                  Hypotheses: 0 < q, every BN ε positive (R50PosB), every relu off its kink and the stem pool tie-free at the real activations (R50SmoothAtB). The loss enters only through hL; r50_net_lossGrad_smoothedCE and r50_net_lossGrad_bce discharge it for the two losses the artifacts ship.

                                                                                                  theorem Proofs.ResNet50TieB.r50_net_lossGrad_smoothedCE (N q : ℕ) (hq0 : 0 < q) {nCls : ℕ} (hK : 0 < nCls) (xN cotN vN epsStr aStr negAK bStr logN ohN : String) (α B : ℝ) (w : R50BWeights nCls) (hp : R50PosB w) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (hx : R50SmoothAtB N q w x) (t : Vec (N * (1 * nCls))) (ht : ∀ (n : Fin N), ∑ k : Fin nCls, targetRow N nCls t n k = 1) :
                                                                                                  R50NetLossTiedB N q xN cotN vN epsStr w x (smoothedBatchLoss N nCls α B t) (BackLinks.unrowB N nCls (StableHLO.den (smoothedLossCotGraph N nCls α B aStr negAK bStr logN ohN (BackLinks.rowB N nCls (resnet50ForwardBFull N q w x)) t)))

                                                                                                  The bce := false artifacts: every node is the derivative of the batched label-smoothed cross-entropy smoothedBatchLoss, g the six-op cotangent the render emits.

                                                                                                  theorem Proofs.ResNet50TieB.r50_net_lossGrad_bce (N q : ℕ) (hq0 : 0 < q) {nCls : ℕ} (xN cotN vN epsStr bStr logN ohN : String) (w : R50BWeights nCls) (hp : R50PosB w) (x : Vec (N * (3 * (2 * (2 * (2 * (2 * (2 * q))))) * (2 * (2 * (2 * (2 * (2 * q)))))))) (hx : R50SmoothAtB N q w x) (t : Vec (N * (1 * nCls))) :
                                                                                                  R50NetLossTiedB N q xN cotN vN epsStr w x (bceBatchLoss N nCls t) (BackLinks.unrowB N nCls (StableHLO.den (bceLossCotGraph N nCls (↑N * ↑nCls) bStr logN ohN (BackLinks.rowB N nCls (resnet50ForwardBFull N q w x)) t)))

                                                                                                  The bce := true artifacts (resnet50in160_lambaccdp8x64bce among them): every node is the derivative of the batched BCE-with-logits bceBatchLoss, the mean over B×K, g the three-op cotangent at the committed divisor N·K. No hypothesis on the target.