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)
This file builds two things:
mnistCnnNoBn_has_vjp_at— the structural whole-network VJP: the composed backward equals thepdiv-Jacobian VJP of the full forward pass, conditional on smoothness hypotheses (no ReLU kink / MaxPool tie at the running activations). The Chapter-3 sibling ofcnn_has_vjp_at, minus BN and residual blocks.mnistMicroCnn_has_vjp_correct— a concrete tiny instance where every smoothness hypothesis is discharged (norm_num/explicit), so the statement is unconditional and still closes under the three-axiom kernel. The witness that the conditional machinery is instantiable.
conv → relu block VJP at a smooth point (no BatchNorm).
relu ∘ flatConv W b. The plain-conv analogue of
convBnRelu_has_vjp_at — 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
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 vjp_comp_at through
convRelu → convRelu → maxPool → denseRelu → denseRelu → dense.
The Chapter-3 sibling of cnn_has_vjp_at (BN-free, no resblocks).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Public correctness theorem for mnistCnnNoBn_has_vjp_at — the
Chapter-3 CNN's backward equals the pdiv-contracted Jacobian.
A minimal mnistCnnNoBn at ic=c=h=w=d1=nClasses=1, 1×1 kernels,
with hand-picked weights so the conv stack is the identity, every
ReLU sees strictly-positive input, and the single MaxPool window has
four distinct values. All five smoothness hypotheses of
mnistCnnNoBn_has_vjp_at are then proved, yielding an
unconditional whole-network VJP correctness theorem — the
non-vacuity witness for the conditional capstone above.
Input Vec 4 with four distinct strictly-positive entries 1,2,3,4.
Equations
- Proofs.Micro.X0 k = ↑↑k + 1
Instances For
1×1×1×1 all-ones kernel ⇒ conv is the identity.
Equations
- Proofs.Micro.K1 x✝³ x✝² x✝¹ x✝ = 1
Instances For
The single 2×2 MaxPool window of X0 has four distinct values.
The pooled value is ≥ 1 (so the dense head stays nonzero).
The pooled vector is strictly positive (feeds the dense head).
Unconditional whole-network VJP for a concrete tiny CNN.
Every smoothness hypothesis of mnistCnnNoBn_has_vjp_at is
discharged here, so this statement carries no side conditions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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. 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 a
center-structured instance computes its forward pass with.
3×3 conv with a center-only kernel collapses to a per-pixel channel
mix. If W vanishes off the center tap (1,1), the full 3×3
SAME-padding sum — all nine taps and their padding branches — reduces
to b o + ∑ c, W o c 1 1 · t c hi wi. The 3×3 analogue of
conv2d_1x1: a center-structured instance exercises genuine spatial
convolution (the padding ifs are evaluated) while keeping a closed
forward form.
conv1 bias (1, 2) — gives the two output channels distinct values.
Instances For
conv2: 2→2 channels, 1×1. Row depends on the output channel
(1 for channel 0, 2 for channel 1), so the two output channels
differ and each has a strictly-positive input-pixel coefficient.
Instances For
Dense heads: nonnegative weights + strictly-positive biases keep every activation off the ReLU kink.
Equations
- Proofs.Mini.W3 x✝¹ x✝ = 1
Instances For
The max-pool input (conv2 ∘ conv1) is positionally injective on each
channel: distinct positions give distinct values (the conv stack is
affine with a strictly-positive coefficient on the injective input).
Unconditional whole-network VJP for a multi-channel, multi-window,
10-class CNN. Every smoothness hypothesis of
mnistCnnNoBn_has_vjp_at is discharged — the no-tie condition via
maxPool2Smooth_of_injective, the ReLU conditions via positivity —
so the statement carries no side conditions and stays in the
three-axiom closure.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Input tensor, 16 distinct strictly-positive values (positionally injective).
Equations
- Proofs.Spatial.T0 x✝ hi wi = ↑(4 * ↑hi + ↑wi + 1)
Instances For
Equations
Instances For
Instances For
Equations
- Proofs.Spatial.W3 x✝¹ x✝ = 1
Instances For
Equations
- Proofs.Spatial.W4 x✝¹ x✝ = 1
Instances For
Equations
- Proofs.Spatial.W5 x✝¹ x✝ = 1
Instances For
Unconditional whole-network VJP for a 3×3-convolution CNN. Same
shape as Mini.miniCnn (2 channels, eight pool windows, 10 classes)
but with genuine 3×3 SAME-padding convolutions, every smoothness
hypothesis discharged, inside the three-axiom closure.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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 mlp_has_vjp_at discharge. The net is non-constant, so this is a
live witness (non-trivial Jacobian), not a degenerate one. The
Chapter-2 analogue of the Micro/Mini/Spatial CNN instances.
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
Public unconditional correctness theorem — the concrete MLP's
backward equals the pdiv-Jacobian VJP, no hypotheses.
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.