The ResNet as an Euler scheme, and the weight-interpolated residual
DefinitionSanderAblinPeyre2022_DefsOver a real normed space : euler φ x0 N is the sequence , (the ResNet of eq. (1) with , i.e. the Euler scheme for eq. (2) with step ). wInterp N s , the weight-interpolated residual of the second example on p. 4.
import Mathlib
namespace SanderAblinPeyre2022
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
/-- The ResNet of depth `N` (eq. (1)), i.e. the Euler scheme for eq. (2) with step `1/N`:
`x_{n+1} = x_n + (1/N) φ(x_n, n/N)`. -/
noncomputable def euler (φ : E → ℝ → E) (x0 : E) (N : ℕ) : ℕ → E
| 0 => x0
| n + 1 => euler φ x0 N n + (1 / (N : ℝ)) • φ (euler φ x0 N n) ((n : ℝ) / N)
/-- The weight-interpolated residual of the second negative example (p. 4):
`φ(·, s) = (2Ns - (2n + 1))²` on `[n/N, (n+1)/N]`, written with `n = ⌊N s⌋`. -/
noncomputable def wInterp (N : ℕ) (s : ℝ) : ℝ := (2 * N * s - (2 * ⌊(N : ℝ) * s⌋ + 1)) ^ 2
end SanderAblinPeyre2022
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Throughout, is any real normed vector space. Definition euler. Given a map (written ), a starting point and a natural number , euler is the sequence in defined recursively for every (not only ) by
where and are taken as real numbers and division is real division. Edge case: when , the convention and applies, so the update term is and for all . Definition wInterp. For a natural number and a real ,
where is the integer floor of the real number , then regarded as a real number. This is defined for all real (not only ) and all , including , where .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.