catenary_euler_lagrangetheoremProved here from basic factspropext, Classical.choice, Quot.sound
catenary_euler_lagrangeLean 4Proved here from basic factsFormally verified
/-- **The catenoid is a minimal surface of revolution.** Rotating the graph of `y(x) > 0` aboutthe `x`-axis gives area `2π ∫ y √(1 + y'²) dx`, whose Euler–Lagrange equation is`y y'' = 1 + y'²`. The catenary `y = a cosh(x/a)` solves it: `y' = sinh(x/a)`,`y'' = cosh(x/a)/a`, and `y y'' = cosh²(x/a) = 1 + sinh²(x/a)`. -/theorem catenary_euler_lagrange (a : ℝ) (ha : a ≠ 0) (x : ℝ) : HasDerivAt (fun x => a * cosh (x / a)) (sinh (x / a)) x ∧ HasDerivAt (fun x => sinh (x / a)) (cosh (x / a) / a) x ∧ a * cosh (x / a) * (cosh (x / a) / a) = 1 + sinh (x / a) ^ 2 := by have hdiv : HasDerivAt (fun x : ℝ => x / a) (1 / a) x := by simpa using (hasDerivAt_id x).div_const a refine ⟨?_, ?_, ?_⟩ · have h := ((hasDerivAt_cosh (x / a)).comp x hdiv).const_mul a exact h.congr_deriv (by field_simp) · have h := (hasDerivAt_sinh (x / a)).comp x hdiv exact h.congr_deriv (by field_simp) · field_simp linarith [cosh_sq (x / a)]
catenary_first_integraltheoremProved here from basic factspropext, Classical.choice, Quot.sound
catenary_first_integralLean 4Proved here from basic factsFormally verified
/-- **Beltrami's first integral.** The area integrand `L = y √(1 + y'²)` does not depend on `x`, so`L − y' ∂L/∂y' = y / √(1 + y'²)` is constant along solutions. For the catenary`y = a cosh(x/a)` it equals `a`, because `√(1 + sinh²) = cosh`. -/theorem catenary_first_integral (a x : ℝ) : a * cosh (x / a) / √(1 + sinh (x / a) ^ 2) = a := by have hc : √(1 + sinh (x / a) ^ 2) = cosh (x / a) := by rw [← cosh_sq', sqrt_sq (cosh_pos _).le] rw [hc, mul_div_assoc, div_self (cosh_pos _).ne', mul_one]
/-- The **minimal surface equation** for a graph `z = u(x, y)`, written in terms of its first andsecond partial derivatives at a point:`(1 + u_y²) u_xx − 2 u_x u_y u_xy + (1 + u_x²) u_yy = 0`. It says the mean curvature of the graphvanishes; it is the Euler–Lagrange equation of the area `∬ √(1 + u_x² + u_y²) dx dy`. -/def MinimalSurfaceEq (ux uy uxx uxy uyy : ℝ) : Prop := (1 + uy ^ 2) * uxx - 2 * ux * uy * uxy + (1 + ux ^ 2) * uyy = 0
scherk_minimaltheoremProved here from basic factspropext, Classical.choice, Quot.sound
scherk_minimalLean 4Proved here from basic factsFormally verified
/-- **Scherk's surface is minimal.** On the open square (where `cos x, cos y > 0`) the partialderivatives are `u_x = tan x`, `u_y = −tan y`, `u_xx = 1/cos² x`, `u_yy = −1/cos² y` and`u_xy = 0` (the `x`-derivative `tan x` does not depend on `y`); and with `1 + tan² = 1/cos²` theminimal surface equation reads `(1/cos² y)(1/cos² x) − (1/cos² x)(1/cos² y) = 0`. The partialderivatives are proved as one-variable derivatives in each coordinate. -/theorem scherk_minimal (x y : ℝ) (hx : 0 < cos x) (hy : 0 < cos y) : HasDerivAt (fun s => scherk s y) (tan x) x ∧ HasDerivAt (fun t => scherk x t) (-tan y) y ∧ HasDerivAt tan (1 / cos x ^ 2) x ∧ HasDerivAt (fun t => -tan t) (-(1 / cos y ^ 2)) y ∧ HasDerivAt (fun _ : ℝ => tan x) 0 y ∧ MinimalSurfaceEq (tan x) (-tan y) (1 / cos x ^ 2) 0 (-(1 / cos y ^ 2)) := by refine ⟨?_, ?_, hasDerivAt_tan hx.ne', (hasDerivAt_tan hy.ne').neg, hasDerivAt_const _ _, ?_⟩ · have h := ((hasDerivAt_cos x).log hx.ne').const_sub (log (cos y)) exact h.congr_deriv (by rw [tan_eq_sin_div_cos]; ring) · have h := ((hasDerivAt_cos y).log hy.ne').sub_const (log (cos x)) exact h.congr_deriv (by rw [tan_eq_sin_div_cos]; ring) · unfold MinimalSurfaceEq rw [tan_eq_sin_div_cos, tan_eq_sin_div_cos] have hx2 : sin x ^ 2 + cos x ^ 2 = 1 := sin_sq_add_cos_sq x have hy2 : sin y ^ 2 + cos y ^ 2 = 1 := sin_sq_add_cos_sq y field_simp nlinarith [hx2, hy2]
/-- One step of the explicit finite-difference scheme for the heat equation `u_t = u_xx` on a grid`ℤ`, with ratio `λ = Δt/Δx²`: `u'(i) = λ u(i−1) + (1 − 2λ) u(i) + λ u(i+1)`. -/def heatStep (lam : ℝ) (u : ℤ → ℝ) : ℤ → ℝ := fun i => lam * u (i - 1) + (1 - 2 * lam) * u i + lam * u (i + 1)
heatStep_consttheoremProved here from basic factspropext, Classical.choice, Quot.sound
heatStep_constLean 4Proved here from basic factsFormally verified
/-- Constant functions are steady states of the heat scheme: the three weights `λ, 1 − 2λ, λ`sum to `1`. (For the heat equation itself, constants solve `u_t = u_xx`.) -/theorem heatStep_const (lam c : ℝ) : heatStep lam (fun _ => c) = fun _ => c := by funext i simp only [heatStep] ring
discrete_max_principletheoremProved here from basic factspropext, Classical.choice, Quot.sound
discrete_max_principleLean 4Proved here from basic factsFormally verified
/-- **Discrete maximum principle.** If `0 ≤ λ ≤ 1/2` and `u ≤ M` everywhere, then after any numberof heat steps the solution is still `≤ M`: each new value is a convex combination (weights `λ`,`1 − 2λ`, `λ`, all non-negative) of old values. This is the discrete shadow of the maximumprinciple for parabolic equations, which Hamilton turned into his main tool for Ricci flow. For`λ > 1/2` the weight `1 − 2λ` is negative and the scheme can overshoot (and is unstable). -/theorem discrete_max_principle (lam : ℝ) (h0 : 0 ≤ lam) (h1 : lam ≤ 1 / 2) (M : ℝ) (u : ℤ → ℝ) (hu : ∀ i, u i ≤ M) (k : ℕ) (i : ℤ) : (heatStep lam)^[k] u i ≤ M := by induction k generalizing u with | zero => exact hu i | succ k ih => rw [Function.iterate_succ_apply] apply ih intro j simp only [heatStep] have ha := hu (j - 1) have hb := hu j have hc := hu (j + 1) have hw : 0 ≤ 1 - 2 * lam := by linarith nlinarith [mul_le_mul_of_nonneg_left ha h0, mul_le_mul_of_nonneg_left hb hw, mul_le_mul_of_nonneg_left hc h0]
harmonic_mean_valuetheoremApplies a library theorempropext, Classical.choice, Quot.sound
harmonic_mean_valueLean 4Applies a library theoremFormally verified
/-- **Mean value property.** A function harmonic on a neighbourhood of a closed disc in `ℂ = ℝ²`equals its average over the boundary circle. This is Mathlib's`InnerProductSpace.HarmonicOnNhd.circleAverage_eq`. It implies the strong maximum principle, andit is the reason the coordinate functions of a conformally parametrised minimal surface — whichare harmonic — cannot have interior maxima: a compact minimal surface in `ℝ³` must have boundary. -/theorem harmonic_mean_value {f : ℂ → ℝ} {c : ℂ} {R : ℝ} (hf : InnerProductSpace.HarmonicOnNhd f (Metric.closedBall c |R|)) : circleAverage f c R = f c := hf.circleAverage_eq
/-- Show that constant functions are fixed by one step of the heat scheme.Hint: `funext i`, unfold with `simp only [heatStep]`, and finish with `ring`. -/theorem heatStep_const (lam c : ℝ) : heatStep lam (fun _ => c) = fun _ => c := by sorry
Show the compiled solution
heatStep_constLean 4Proved here from basic factsFormally verified
/-- Constant functions are steady states of the heat scheme: the three weights `λ, 1 − 2λ, λ`sum to `1`. (For the heat equation itself, constants solve `u_t = u_xx`.) -/theorem heatStep_const (lam c : ℝ) : heatStep lam (fun _ => c) = fun _ => c := by funext i simp only [heatStep] ring
/-- Show that the catenary `y = a cosh(x/a)` has first integral `y / √(1 + y'²) = a`.Hint: first prove `√(1 + sinh (x / a) ^ 2) = cosh (x / a)` using `cosh_sq'` and `sqrt_sq`(with `cosh_pos`), then cancel `cosh (x / a)`. -/theorem catenary_first_integral (a x : ℝ) : a * cosh (x / a) / √(1 + sinh (x / a) ^ 2) = a := by sorry
Show the compiled solution
catenary_first_integralLean 4Proved here from basic factsFormally verified
/-- **Beltrami's first integral.** The area integrand `L = y √(1 + y'²)` does not depend on `x`, so`L − y' ∂L/∂y' = y / √(1 + y'²)` is constant along solutions. For the catenary`y = a cosh(x/a)` it equals `a`, because `√(1 + sinh²) = cosh`. -/theorem catenary_first_integral (a x : ℝ) : a * cosh (x / a) / √(1 + sinh (x / a) ^ 2) = a := by have hc : √(1 + sinh (x / a) ^ 2) = cosh (x / a) := by rw [← cosh_sq', sqrt_sq (cosh_pos _).le] rw [hc, mul_div_assoc, div_self (cosh_pos _).ne', mul_one]