M07 — Logical reduction and masked update
ProvedVathekProof.M07_masked_update_reductionEquality of the complete accumulated gradient survives the whole post-accumulation chain. The radius- global clipping is total with both branches specified: a gradient already within the radius is returned unchanged, and the zero gradient is fixed (both branches of the case split are well-defined real arithmetic). For every deterministic optimizer, applying the trainable projection, then one global clip, then the optimizer once (logicalStep) maps equal gradients to equal successor states; the same congruence holds for the concrete masked AdamW instance.
What is deliberately not asserted: per-tile clipping (gradients and sum to inside the radius, but clipped separately each lands at the radius and sums to ), per-tile means, or any update before accumulation is complete — the source's counterexamples show those change the optimizer transition.
import Definitions.Def_VathekFrame import Definitions.Def_VathekState import Definitions.Def_VathekAdamW import Definitions.Def_VathekWitness
namespace VathekProof
/-- **M07 — Logical reduction and masked update.** Equality of the complete
accumulated gradient survives the whole post-accumulation chain: the trainable
projection, one *global* clipping operation (both branches total, the zero gradient
fixed), and exactly one optimizer transition — for an arbitrary deterministic
optimizer via `logicalStep`, and for the concrete masked AdamW instance. No per-tile
clipping, no per-tile means, no early update. -/
theorem M07_masked_update_reduction {d : ℕ} (c : ℝ) (β₁ β₂ η lam ε : ℝ)
(S : TrainState d) :
(∀ g : EuclideanSpace ℝ (Fin d), ‖g‖ ≤ c → clipVec c g = g)
∧ (clipVec c (0 : EuclideanSpace ℝ (Fin d)) = 0)
∧ ∀ (σ : Type*) (T : Finset (Fin d)) (U : σ → EuclideanSpace ℝ (Fin d) → σ)
(S' : σ) (g₁ g₂ : EuclideanSpace ℝ (Fin d)), g₁ = g₂ →
logicalStep T c U S' g₁ = logicalStep T c U S' g₂
∧ ∀ (T : Finset (Fin d)) (g₁ g₂ : EuclideanSpace ℝ (Fin d)), g₁ = g₂ →
adamWStep β₁ β₂ η lam ε T S g₁ = adamWStep β₁ β₂ η lam ε T S g₂ := by sorry
end VathekProofRead-back
What the Lean code literally says, in plain math · glm-5.3 (independent auditor subagent)
{"text": "{\n "data": "M07_masked_update_reduction. Let be an arbitrary natural number (implicit; is allowed, in which case is the one-point zero space), let be arbitrary real numbers \u2014 no sign or range hypotheses are imposed on any of them \u2014 and let be an arbitrary training state on , i.e. a record with (the parameter vector, the first-moment vector, and the second-moment vector) and a step counter . Throughout, denotes the space of real -tuples indexed by equipped with the Euclidean () norm , and is the -th coordinate of . The theorem has no hypotheses beyond these binders and asserts the conjunction of the following four statements; is used in (i)\u2013(iii), while and the state are used only in (iv).\n\n**(i)** For every : if , then . Here is the global clip of a whole vector at radius , defined by the two total branches\n
\nWhen the hypothesis is unsatisfiable (norms are nonnegative), so that instance is vacuously true; when the claim is that the clip acts as the identity on the closed ball of radius (at this covers only ).\n\n**(ii)** For the same radius (any real number): , where is the zero vector of . Note the edge case: if , the zero vector fails the branch test , so the assertion is that the second branch \u2014 which scales by the factor , a division by the zero norm under the reals' total division \u2014 still returns the zero vector.\n\n**(iii)** For every type (arbitrary, possibly with no elements, in which case the inner quantification over is vacuous), every finite set of coordinate indices (the trainable set; it may be empty or all of ), every function (an arbitrary deterministic optimizer transition), every , and all vectors , the conditional equality\n
\nholds, where the logical step is the composite\n
\\n\\\\operatorname{logicalStep}(T, c, U, S', g) \\\\;:=\\\\; U\\\\bigl(S',\\\\, \\\\operatorname{clip}_c(P_T g)\\\\bigr),\\n\\\\qquad\\n(P_T g)_j =\\n\\\\begin{cases}\\ng_j, & j \\\\in T, \\\\\\\\\\n0, & j \\\\notin T,\\n\\\\end{cases}\\n\ni.e. the gradient is first projected onto the trainable coordinates (every frozen coordinate is zeroed), then globally clipped at radius by the same two-branch definition as in (i), and the map is then applied exactly once, to the fixed state and the resulting clipped vector. The assertion is exactly that replacing the gradient argument of this composite by an equal vector leaves the -valued result unchanged, with , , , and held fixed on both sides; if is empty the projection sends every to .\n\n**(iv)** For every finite set of coordinate indices (again possibly empty or full) and all , the conditional equality\n
\nholds, where the transition returns the new training state defined coordinatewise by\n
\n
\\nw'_j =\\n\\\\begin{cases}\\n(1 - \\\\eta\\\\lambda)\\\\, w_j \\\\; - \\\\; \\\\eta \\\\cdot \\\\dfrac{\\\\,m'_j \\\\big/ \\\\bigl(1 - \\\\beta_1^{\\\\,t+1}\\\\bigr)\\\\,}{\\\\sqrt{\\\\,v'_j \\\\big/ \\\\bigl(1 - \\\\beta_2^{\\\\,t+1}\\\\bigr)\\\\,} \\\\, + \\\\, \\\\varepsilon}, & j \\\\in T, \\\\\\\\\\\\[10pt]\\nw_j, & j \\\\notin T,\\n\\\\end{cases}\\n\ni.e. trainable coordinates receive the decoupled-weight-decay AdamW update built from the bias-corrected first and second moments, frozen coordinates of are copied through unchanged, both moment vectors are updated at every coordinate (frozen coordinates included), and the step counter is incremented by exactly one. The asserted equality is equality of the full state record \u2014 all four components (, , , and the counter) \u2014 with , the hyperparameters, and the state fixed on both sides and only the gradient argument replaced by the equal vector. All arithmetic is total: nothing excludes or (which zero the bias-correction denominators ), nor (which zeros the update denominator), nor negative arguments under the total real square root; in those cases the divisions and square root take their total-division/total-sqrt values, and the claim above is still asserted verbatim."\n}", "details": {"resolvedPath": "/home/ajax/.omp/agent/sessions/-math/2026-09-22T19-31-08-510Z_01a0ca99-be5e-7000-93c6-dac7c74cc004/RB-M07.md", "contentType": "text/markdown", "totalLines": 3, "displayContent": {"text": "{\n "data": "M07_masked_update_reduction. Let be an arbitrary natural number (implicit; is allowed, in which case is the one-point zero space), let be arbitrary real numbers \u2014 no sign or range hypotheses are imposed on any of them \u2014 and let be an arbitrary training state on , i.e. a record with (the parameter vector, the first-moment vector, and the second-moment vector) and a step counter . Throughout, denotes the space of real -tuples indexed by equipped with the Euclidean () norm , and is the -th coordinate of . The theorem has no hypotheses beyond these binders and asserts the conjunction of the following four statements; is used in (i)\u2013(iii), while and the state are used only in (iv).\n\n**(i)** For every : if , then . Here is the global clip of a whole vector at radius , defined by the two total branches\n
\nWhen the hypothesis is unsatisfiable (norms are nonnegative), so that instance is vacuously true; when the claim is that the clip acts as the identity on the closed ball of radius (at this covers only ).\n\n**(ii)** For the same radius (any real number): , where is the zero vector of . Note the edge case: if , the zero vector fails the branch test , so the assertion is that the second branch \u2014 which scales by the factor , a division by the zero norm under the reals' total division \u2014 still returns the zero vector.\n\n**(iii)** For every type (arbitrary, possibly with no elements, in which case the inner quantification over is vacuous), every finite set of coordinate indices (the trainable set; it may be empty or all of ), every function (an arbitrary deterministic optimizer transition), every , and all vectors , the conditional equality\n
\nholds, where the logical step is the composite\n
\\n\\\\operatorname{logicalStep}(T, c, U, S', g) \\\\;:=\\\\; U\\\\bigl(S',\\\\, \\\\operatorname{clip}_c(P_T g)\\\\bigr),\\n\\\\qquad\\n(P_T g)_j =\\n\\\\begin{cases}\\ng_j, & j \\\\in T, \\\\\\\\\\n0, & j \\\\notin T,\\n\\\\end{cases}\\n\ni.e. the gradient is first projected onto the trainable coordinates (every frozen coordinate is zeroed), then globally clipped at radius by the same two-branch definition as in (i), and the map is then applied exactly once, to the fixed state and the resulting clipped vector. The assertion is exactly that replacing the gradient argument of this composite by an equal vector leaves the -valued result unchanged, with , , , and held fixed on both sides; if is empty the projection sends every to .\n\n**(iv)** For every finite set of coordinate indices (again possibly empty or full) and all , the conditional equality\n
\nholds, where the transition returns the new training state defined coordinatewise by\n
\n
\\nw'_j =\\n\\\\begin{cases}\\n(1 - \\\\eta\\\\lambda)\\\\, w_j \\\\; - \\\\; \\\\eta \\\\cdot \\\\dfrac{\\\\,m'_j \\\\big/ \\\\bigl(1 - \\\\beta_1^{\\\\,t+1}\\\\bigr)\\\\,}{\\\\sqrt{\\\\,v'_j \\\\big/ \\\\bigl(1 - \\\\beta_2^{\\\\,t+1}\\\\bigr)\\\\,} \\\\, + \\\\, \\\\varepsilon}, & j \\\\in T, \\\\\\\\\\\\[10pt]\\nw_j, & j \\\\notin T,\\n\\\\end{cases}\\n\ni.e. trainable coordinates receive the decoupled-weight-decay AdamW update built from the bias-corrected first and second moments, frozen coordinates of are copied through unchanged, both moment vectors are updated at every coordinate (frozen coordinates included), and the step counter is incremented by exactly one. The asserted equality is equality of the full state record \u2014 all four components (, , , and the counter) \u2014 with , the hyperparameters, and the state fixed on both sides and only the gradient argument replaced by the equal vector. All arithmetic is total: nothing excludes or (which zero the bias-correction denominators ), nor (which zeros the update denominator), nor negative arguments under the total real square root; in those cases the divisions and square root take their total-division/total-sqrt values, and the claim above is still asserted verbatim."\n}", "startLine": 1, "lineNumbers": [1, 2, 3]}, "meta": {"source": {"type": "internal", "value": "agent://RB-M07"}}}}
Confirmed by the mission captain (proposal self-audit).