Chapter 3: MNIST 2D CNN (no BatchNorm) — whole-network VJP #
The Chapter-3 demo model mnistCnnNoBn:
conv2d 1→c (relu) → conv2d c→c (relu) → maxPool 2×2 → flatten → dense (relu) → dense (relu) → dense (identity)
mnistCnnNoBnHasVJPAt is the structural whole-network VJP: the
composed backward equals the pdiv-Jacobian VJP of the full forward
pass, conditional on smoothness hypotheses (no ReLU kink / MaxPool
tie at the running activations). The Chapter-3 sibling of
cnnHasVJPAt, minus BN and residual blocks.
TrainedCnn.trainedCnnHasVJPAt discharges every hypothesis on a reduced
instance of this forward — input a 24×24 MNIST crop 4×4-average-pooled to
6×6, conv 1→2→2 (3×3), dense 18→8→8→10, /128-rational trained weights (the
max-pool no-tie hypothesis needed a pool-tie regulariser during training) —
at one pooled MNIST test digit.
conv → relu block VJP at a smooth point (no BatchNorm).
relu ∘ flatConv W b. The plain-conv analogue of
convBnReluHasVJPAt — conv is linear (global VJP via the
HasVJP3 bridge), relu carries the smoothness hypothesis.
Equations
- One or more equations did not get rendered due to their size.
Instances For
dense → relu block VJP at a smooth point. relu ∘ dense W b.
Equations
- Proofs.denseReluHasVJPAt W b v h_smooth = Proofs.vjpCompAt (Proofs.dense W b) (Proofs.relu n) v ⋯ ⋯ ((Proofs.denseHasVJP W b).toHasVJPAt v) (Proofs.reluHasVJPAt n (Proofs.dense W b v) h_smooth)
Instances For
The Chapter-3 mnistCnnNoBn forward, in flattened Vec space.
Conv stage runs at spatial (2*h, 2*w); the maxPool halves it to
(h, w); then three dense layers (two with ReLU).
Equations
- One or more equations did not get rendered due to their size.
Instances For
MNIST 2D CNN (no BN) whole-network VJP at a smooth point.
The composed backward of the full Chapter-3 forward equals the
pdiv-contracted Jacobian (Jacobian-transpose applied to the
cotangent), conditional on smoothness at the four ReLU kinks and
the one MaxPool. Built by vjpCompAt through
convRelu → convRelu → maxPool → denseRelu → denseRelu → dense.
The Chapter-3 sibling of cnnHasVJPAt (BN-free, no resblocks).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Public correctness theorem for mnistCnnNoBnHasVJPAt — the
Chapter-3 CNN's backward equals the pdiv-contracted Jacobian.
Positional injectivity ⇒ MaxPool2Smooth. If, on each channel,
the position map (r, s) ↦ x ci r s is injective, then every 2×2
window has pairwise-distinct values, so its max is attained once. One injectivity argument in
place of 6·c·h·w per-window decides.
A tensor that is positive everywhere flattens to a positive vector
(flatten T k just reads T at the decoded index). Discharges the
ReLU ∀ k, … ≠ 0 conditions once the layer is shown positive.
A dense layer with nonnegative weights, a strictly-positive bias, and a
nonnegative input is strictly positive — the propagating positivity
invariant that discharges the dense ReLU ≠ 0 conditions without
per-coordinate case analysis.
1×1 conv collapses to a per-pixel channel mix. With a 1×1 kernel
(SAME padding is a no-op), conv2d at each pixel is just the bias
plus a channel-weighted sum of that same pixel — the closed form the
1×1-kernel witnesses compute their forward pass with.
A concrete 3-layer MLP (dense → relu → dense → relu → dense) with
all-ones weights/biases and a positive input. Every ReLU pre-activation
is then strictly positive (hence ≠ 0), so both smoothness hypotheses
of mlpHasVJPAt discharge. The net is non-constant, so this is a
live witness (non-trivial Jacobian), not a degenerate one.
Equations
- Proofs.MlpConcrete.W₀ x✝¹ x✝ = 1
Instances For
Equations
- Proofs.MlpConcrete.b₀ x✝ = 1
Instances For
Equations
- Proofs.MlpConcrete.W₁ x✝¹ x✝ = 1
Instances For
Equations
- Proofs.MlpConcrete.b₁ x✝ = 1
Instances For
Equations
- Proofs.MlpConcrete.W₂ x✝¹ x✝ = 1
Instances For
Equations
- Proofs.MlpConcrete.b₂ x✝ = 1
Instances For
Equations
- Proofs.MlpConcrete.x x✝ = 1
Instances For
Unconditional whole-network VJP for a concrete 3-layer MLP. Both
ReLU ≠ 0 hypotheses are discharged via dense_pos_of_nonneg
(positive bias + nonnegative weights/input propagate strict
positivity), with relu_id_of_pos collapsing the inner ReLU.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Proofs.CnnConcrete.Ws x✝³ x✝² x✝¹ x✝ = 1
Instances For
Equations
- Proofs.CnnConcrete.bs x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.X i = ↑↑i
Instances For
Equations
- Proofs.CnnConcrete.W₁ x✝³ x✝² x✝¹ x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.b₁ x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.W₂ x✝³ x✝² x✝¹ x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.b₂ x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.W₁' x✝³ x✝² x✝¹ x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.b₁' x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.W₂' x✝³ x✝² x✝¹ x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.b₂' x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.Wp x✝³ x✝² x✝¹ x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.bp x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.Wd x✝¹ x✝ = 0
Instances For
Equations
- Proofs.CnnConcrete.bd x✝ = 0
Instances For
Whole-network VJP for a concrete ResNet-style CNN with BatchNorm —
every smoothness hypothesis discharged: the stem produces distinct
positive BN outputs (so maxpool has no ties and bn ≠ 0), and the
resblock BNs use γ=0 (constant).
Equations
- One or more equations did not get rendered due to their size.