All declarations

Every declaration of the development, 1098 in 225 files, with its formal statement generated from Lean and its source code at commit 6884ed0. Declarations used in the blueprint link to their statement there. Open a declaration to see it.

1098 declarations; 1092 with an exported statement.

Plaplacian/AddSmooth.lean4 declarations

theoremgradient_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{Differentiable}(\mathbb{R}, u)$ hu
  • $\operatorname{Differentiable}(\mathbb{R}, v)$ hv

Then $\operatorname{gradient}(y \mapsto u(y) - v(y), x) = \operatorname{gradient}(u, x) - \operatorname{gradient}(v, x)$.

/-- The gradient of a difference. -/
theorem gradient_sub {u v : EuclSpace d → ℝ} (hu : Differentiable ℝ u)
    (hv : Differentiable ℝ v) (x : EuclSpace d) :
    gradient (fun y => u y - v y) x = gradient u x - gradient v x := by
  refine ext_inner_right ℝ fun w => ?_
  rw [inner_gradient_left, inner_sub_left, inner_gradient_left,
      inner_gradient_left]
  have heq : (fun y => u y - v y) = u - v := rfl
  rw [heq, fderiv_sub (hu x) (hv x)]
  simp
theoremhess_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, u)$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 2, v)$ hv

Then $\operatorname{hess}(y \mapsto u(y) - v(y), x) = \operatorname{hess}(u, x) - \operatorname{hess}(v, x)$.

/-- The Hessian of a difference. -/
theorem hess_sub {u v : EuclSpace d → ℝ} (hu : ContDiff ℝ 2 u)
    (hv : ContDiff ℝ 2 v) (x : EuclSpace d) :
    hess (fun y => u y - v y) x = hess u x - hess v x := by
  unfold hess
  have h1 : fderiv ℝ (fun y => u y - v y) = fderiv ℝ u - fderiv ℝ v := by
    funext y
    exact fderiv_sub (hu.differentiable (by norm_num) y)
      (hv.differentiable (by norm_num) y)
  rw [h1]
  exact fderiv_sub (differentiable_fderiv hu x) (differentiable_fderiv hv x)
theoremisLocalMax_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, \psi, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMax}(y \mapsto u(y) + \psi(y) - \varphi(y), x_{0})$ hmax

Then $\operatorname{IsLocalMax}(y \mapsto u(y) - (z \mapsto \varphi(z) - \psi(z))(y), x_{0})$.

PLaplacian.isLocalMax_shiftPlaplacian/AddSmooth.lean, lines 73–81
/-- Testing `u + ψ` against `φ` is testing `u` against `φ - ψ`. -/
theorem isLocalMax_shift {u ψ φ : EuclSpace d → ℝ} {x₀ : EuclSpace d}
    (hmax : IsLocalMax (fun y => (u y + ψ y) - φ y) x₀) :
    IsLocalMax (fun y => u y - (fun z => φ z - ψ z) y) x₀ := by
  have heq : (fun y => u y - (fun z => φ z - ψ z) y)
      = fun y => (u y + ψ y) - φ y := by
    funext y; ring
  rw [heq]
  exact hmax
theoremIsViscositySubsolution.add_smoothTheorem 2.7 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\psi \colon \mathbb{R}^{d} \to \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ h
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \psi)$ hψ
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $x_{0} \in \Omega$ hx₀
  • $\operatorname{IsLocalMax}(y \mapsto u(y) + \psi(y) - \varphi(y), x_{0})$ hmax
  • $\operatorname{gradient}(\varphi, x_{0}) - \operatorname{gradient}(\psi, x_{0}) \ne 0$ hgrad

Then $\operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}) - \operatorname{gradient}(\psi, x_{0}), \operatorname{hess}(\varphi, x_{0}) - \operatorname{hess}(\psi, x_{0})) \le f(x_{0})$.

PLaplacian.IsViscositySubsolution.add_smoothPlaplacian/AddSmooth.lean, lines 83–103
/-- **Stability under adding a smooth function.** -/
theorem IsViscositySubsolution.add_smooth {p : ℝ} {Ω : Set (EuclSpace d)}
    {f u : EuclSpace d → ℝ} (h : IsViscositySubsolution p Ω f u)
    {ψ : EuclSpace d → ℝ} (hψ : ContDiff ℝ 2 ψ)
    (φ : EuclSpace d → ℝ) (hφ : ContDiff ℝ 2 φ)
    {x₀ : EuclSpace d} (hx₀ : x₀ ∈ Ω)
    (hmax : IsLocalMax (fun y => (u y + ψ y) - φ y) x₀)
    (hgrad : gradient φ x₀ - gradient ψ x₀ ≠ 0) :
    viscF p (gradient φ x₀ - gradient ψ x₀)
      (hess φ x₀ - hess ψ x₀) ≤ f x₀ := by
  have hdiff : ContDiff ℝ 2 (fun z => φ z - ψ z) := hφ.sub hψ
  have hg : gradient (fun z => φ z - ψ z) x₀
      = gradient φ x₀ - gradient ψ x₀ :=
    gradient_sub (hφ.differentiable (by norm_num))
      (hψ.differentiable (by norm_num)) x₀
  have hh : hess (fun z => φ z - ψ z) x₀ = hess φ x₀ - hess ψ x₀ :=
    hess_sub hφ hψ x₀
  have hgrad' : gradient (fun z => φ z - ψ z) x₀ ≠ 0 := by rwa [hg]
  have hres := h.regular (fun z => φ z - ψ z) hdiff x₀ hx₀
    (isLocalMax_shift hmax) hgrad'
  rwa [hg, hh] at hres

Plaplacian/Alexandrov.lean4 declarations

theoremquad_formOfMatrix
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, A : EuclSpace d →L[ℝ] EuclSpace d, $h \in \mathbb{R}^{d}$.

Then ((PLaplacian.formOfMatrix fun i j => inner ℝ (A ((PLaplacian.obasis d) i)) ((PLaplacian.obasis d) j)) h) h = inner ℝ (A h) h.

PLaplacian.quad_formOfMatrixPlaplacian/Alexandrov.lean, lines 43–57
/-- **The quadratic form of `⟪A ·, ·⟫`, through its matrix.** -/
theorem quad_formOfMatrix (A : EuclSpace d →L[ℝ] EuclSpace d) (h : EuclSpace d) :
    (formOfMatrix (fun i j => inner ℝ (A (obasis d i)) (obasis d j)) h) h
      = inner ℝ (A h) h := by
  rw [formOfMatrix_apply]
  have hh := (obasis d).sum_repr' h
  calc ∑ i, ∑ j, inner ℝ (A (obasis d i)) (obasis d j)
        * (inner ℝ (obasis d i) h * inner ℝ (obasis d j) h)
      = inner ℝ (A (∑ i, inner ℝ (obasis d i) h • obasis d i))
          (∑ j, inner ℝ (obasis d j) h • obasis d j) := by
        simp only [map_sum, map_smul, sum_inner, inner_sum, real_inner_smul_left,
          real_inner_smul_right]
        conv_rhs => rw [Finset.sum_comm]
        exact sum_congr rfl fun i _ => sum_congr rfl fun j _ => by ring
    _ = inner ℝ (A h) h := by rw [hh]
theoremtwiceDiffAt_of_expansion
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, \mathrm{p0} \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, A : EuclSpace d →L[ℝ] EuclSpace d.

Assume

  • $\forall h,\ (X(h))(h) = \operatorname{inner}(\mathbb{R}, A(h), h)$ hX
  • $\forall \varepsilon > 0,\ \exists \delta > 0,\ \forall h,\ \lVert h\rVert < \delta \to \lvert f(x + h) - f(x) - \operatorname{inner}(\mathbb{R}, \mathrm{p0}, h) - 1 / 2 \cdot \operatorname{inner}(\mathbb{R}, A(h), h)\rvert \le \varepsilon \cdot \lVert h\rVert ^{2}$ hexp

Then $\operatorname{TwiceDiffAt}(f, x, \mathrm{p0}, X)$.

PLaplacian.twiceDiffAt_of_expansionPlaplacian/Alexandrov.lean, lines 59–88
/-- **A Peano expansion gives Peano twice differentiability.** -/
theorem twiceDiffAt_of_expansion {f : EuclSpace d → ℝ} {x p0 : EuclSpace d}
    {X : Bilin d} {A : EuclSpace d →L[ℝ] EuclSpace d}
    (hX : ∀ h, (X h) h = inner ℝ (A h) h)
    (hexp : ∀ ε > 0, ∃ δ > 0, ∀ h : EuclSpace d, ‖h‖ < δ →
      |f (x + h) - f x - inner ℝ p0 h - 1 / 2 * inner ℝ (A h) h| ≤ ε * ‖h‖ ^ 2) :
    TwiceDiffAt f x p0 X := by
  constructor
  · intro η hη
    obtain ⟨δ, hδ, hb⟩ := hexp η hη
    filter_upwards [Metric.ball_mem_nhds x hδ] with y hy
    rw [mem_ball, dist_eq_norm] at hy
    have h1 := (abs_le.1 (hb (y - x) hy)).2
    have e : x + (y - x) = y := by abel
    rw [e] at h1
    change f y ≤ f x + inner ℝ p0 (y - x) + 1 / 2 * (X (y - x)) (y - x)
      + η * ‖y - x‖ ^ 2
    rw [hX]
    linarith
  · intro η hη
    obtain ⟨δ, hδ, hb⟩ := hexp η hη
    filter_upwards [Metric.ball_mem_nhds x hδ] with y hy
    rw [mem_ball, dist_eq_norm] at hy
    have h1 := (abs_le.1 (hb (y - x) hy)).1
    have e : x + (y - x) = y := by abel
    rw [e] at h1
    change f x + inner ℝ p0 (y - x) + 1 / 2 * (X (y - x)) (y - x)
      - η * ‖y - x‖ ^ 2 ≤ f y
    rw [hX]
    linarith
theoremalexandrovTheorem 5.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Then $\operatorname{AlexandrovThm}(d)$.

/-- **Alexandrov's theorem.** -/
theorem alexandrov : AlexandrovThm d := by
  intro f hf
  filter_upwards [ae_good hf] with x hx
  obtain ⟨y, hJy, hdiff, hdet, hp0⟩ := hx
  set B := fderiv ℝ (proxMap f) y with hB
  have hd : HasFDerivAt (proxMap f) B y := hdiff.hasFDerivAt
  obtain ⟨Binv, hinv, _⟩ := exists_inv_of_det hdet
  set A : EuclSpace d →L[ℝ] EuclSpace d := Binv - ContinuousLinearMap.id ℝ (EuclSpace d)
    with hA
  have hAapp : ∀ v, A v = Binv v - v := fun v => by
    rw [hA, sub_apply, ContinuousLinearMap.id_apply]
  -- the linear approximation, for the chosen subgradients
  have happrox : ∀ ε > 0, ∃ δ > 0, ∀ z, ‖z - x‖ < δ →
      ‖subgradSel f z - (y - x) - A (z - x)‖ ≤ ε * ‖z - x‖ := by
    intro ε hε
    obtain ⟨δ, hδ, hb⟩ := subgrad_linear_approx hf hJy hd hinv hp0 hε
    refine ⟨δ, hδ, fun z hz => ?_⟩
    rw [hAapp]
    exact hb z (subgradSel f z) hz (subgradSel_spec hf z)
  -- the expansion, and the jet
  have hexp := fun ε hε => peano_of_approx (subgradSel_spec hf) happrox (ε := ε) hε
  exact ⟨y - x, formOfMatrix (fun i j => inner ℝ (A (obasis d i)) (obasis d j)),
    twiceDiffAt_of_expansion (quad_formOfMatrix A) hexp⟩
theoremcomparison_strict_of_J
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\operatorname{JensenLemma}(d)$ hJ
  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $U\text{ is upper semicontinuous}$ hU
  • $V\text{ is lower semicontinuous}$ hV
  • $U\text{ is bounded above}$ hUb
  • $V\text{ is bounded below}$ hVb
  • $0 < c$ hc
  • $U\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = x \mapsto - c\text{ in }\Omega$ hsub
  • $V\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsup
  • $\forall x \in \partial \Omega,\ U(x) \le V(x)$ hbd
  • $x \in \Omega$ a._@._internal._hyg.0

Then $U(x) \le V(x)$.

PLaplacian.comparison_strict_of_JPlaplacian/Alexandrov.lean, lines 115–127
/-- **The comparison principle for strict subsolutions, assuming only Jensen's
lemma.** -/
theorem comparison_strict_of_J (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hJ : JensenLemma d) {Ω : Set (EuclSpace d)}
    (hΩo : IsOpen Ω) (hΩb : Bornology.IsBounded Ω) {U V : EuclSpace d → ℝ}
    (hU : UpperSemicontinuous U) (hV : LowerSemicontinuous V)
    (hUb : BddAbove (range U)) (hVb : BddBelow (range V))
    {c : ℝ} (hc : 0 < c)
    (hsub : IsViscositySubsolution p Ω (fun _ => -c) U)
    (hsup : IsViscositySupersolution p Ω (fun _ => 0) V)
    (hbd : ∀ x ∈ frontier Ω, U x ≤ V x) :
    ∀ x ∈ Ω, U x ≤ V x :=
  comparison_strict_of_AJ hd hp alexandrov hJ hΩo hΩb hU hV hUb hVb hc hsub hsup hbd

Plaplacian/AllOrders.lean2 declarations

theoremexists_bound_order
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $i \in \mathbb{N}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $i \le 3$ hi

Then there exists $C$ such that:

  • $\forall y \in \overline{B}(x, \varepsilon),\ \lVert \operatorname{iteratedFDeriv}(\mathbb{R}, i, \varphi, y)\rVert \le C$
PLaplacian.exists_bound_orderPlaplacian/AllOrders.lean, lines 39–47
/-- A bound at a single order. -/
theorem exists_bound_order {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x : EuclSpace d) (ε : ℝ) (i : ℕ) (hi : i ≤ 3) :
    ∃ C : ℝ, ∀ y ∈ closedBall x ε, ‖iteratedFDeriv ℝ i φ y‖ ≤ C := by
  have hcont : Continuous (fun y => iteratedFDeriv ℝ i φ y) := by
    refine hφ.continuous_iteratedFDeriv ?_
    exact_mod_cast hi
  exact (isCompact_closedBall x ε).exists_bound_of_continuousOn
    hcont.continuousOn
theoremexists_bound_all_orders
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $C$ such that:

  • $\forall y \in \overline{B}(x, \varepsilon),\ \forall i \le 3,\ \lVert \operatorname{iteratedFDeriv}(\mathbb{R}, i, \varphi, y)\rVert \le C$
PLaplacian.exists_bound_all_ordersPlaplacian/AllOrders.lean, lines 49–63
/-- **A single constant across all orders up to three.** -/
theorem exists_bound_all_orders {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x : EuclSpace d) (ε : ℝ) :
    ∃ C : ℝ, ∀ y ∈ closedBall x ε, ∀ i ≤ 3,
      ‖iteratedFDeriv ℝ i φ y‖ ≤ C := by
  -- a constant for each of the four orders
  choose f hf using fun i : Fin 4 =>
    exists_bound_order hφ x ε i.val (by omega)
  -- their maximum
  obtain ⟨M, hM⟩ := Finite.exists_le f
  refine ⟨M, fun y hy i hi => ?_⟩
  have hi4 : i < 4 := by omega
  have := hf ⟨i, hi4⟩ y hy
  calc ‖iteratedFDeriv ℝ i φ y‖ ≤ f ⟨i, hi4⟩ := this
    _ ≤ M := hM _

Plaplacian/Annulus.lean5 declarations

defannulus
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$, $\rho, r \in \mathbb{R}$.

Its value lies in $\operatorname{Set}(\mathbb{R}^{d})$.

/-- The annulus. -/
def annulus (x₀ : EuclSpace d) (ρ r : ℝ) : Set (EuclSpace d) :=
  closedBall x₀ r \ ball x₀ ρ
theoremisCompact_annulus
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$, $\rho, r \in \mathbb{R}$.

Then $\operatorname{IsCompact}(\operatorname{annulus}(x_{0}, \rho, r))$.

PLaplacian.isCompact_annulusPlaplacian/Annulus.lean, lines 59–63
/-- It is compact, being closed in a compact set. -/
theorem isCompact_annulus (x₀ : EuclSpace d) (ρ r : ℝ) :
    IsCompact (annulus x₀ ρ r) := by
  unfold annulus
  exact (isCompact_closedBall x₀ r).diff isOpen_ball
theoremne_of_mem_annulus
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, w \in \mathbb{R}^{d}$, $\rho, r \in \mathbb{R}$.

Assume

  • $0 < \rho$ hρ
  • $w \in \operatorname{annulus}(x_{0}, \rho, r)$ hw

Then $w \ne x_{0}$.

PLaplacian.ne_of_mem_annulusPlaplacian/Annulus.lean, lines 65–70
/-- No point of the annulus is the base point, for positive inner radius. -/
theorem ne_of_mem_annulus {x₀ w : EuclSpace d} {ρ r : ℝ} (hρ : 0 < ρ)
    (hw : w ∈ annulus x₀ ρ r) : w ≠ x₀ := by
  intro h
  rw [h] at hw
  exact hw.2 (mem_ball_self hρ)
theoremusc_ubar_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ

Then UpperSemicontinuous fun w => PLaplacian.ubar u w - φ w.

/-- The relaxed difference is upper semicontinuous: the upper limit is, and
subtracting a continuous function preserves it. Mathlib has no `sub` for upper
semicontinuity, so it is written as adding the negation. -/
theorem usc_ubar_sub (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ} (hφ : Continuous φ) :
    UpperSemicontinuous (fun w => ubar u w - φ w) := by
  have h1 : UpperSemicontinuous (ubar u) := upperSemicontinuous_ubar u hC
  have h2 : UpperSemicontinuous (fun w => -φ w) :=
    (hφ.neg).upperSemicontinuous
  have h := h1.add h2
  simpa [sub_eq_add_neg] using h
theoremannulus_gap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\rho, r \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $0 < \rho$ hρ
  • $\operatorname{IsStrictMaxOn}(w \mapsto \overline{u}(w) - \varphi(w), x_{0}, r)$ hstrict

Then there exists $\eta > 0$ such that:

  • $\forall w \in \operatorname{annulus}(x_{0}, \rho, r),\ \overline{u}(w) - \varphi(w) \le \overline{u}(x_{0}) - \varphi(x_{0}) - \eta$
/-- **The gap on the annulus.** At a strict maximum, the relaxed difference is
bounded below the maximum's value by a fixed positive amount throughout the
annulus. -/
theorem annulus_gap (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    {x₀ : EuclSpace d} {ρ r : ℝ} (hρ : 0 < ρ)
    (hstrict : IsStrictMaxOn (fun w => ubar u w - φ w) x₀ r) :
    ∃ η > 0, ∀ w ∈ annulus x₀ ρ r,
      ubar u w - φ w ≤ (ubar u x₀ - φ x₀) - η := by
  by_cases hne : (annulus x₀ ρ r).Nonempty
  · -- the maximum on the annulus is attained
    have husc : UpperSemicontinuousOn (fun w => ubar u w - φ w)
        (annulus x₀ ρ r) := (usc_ubar_sub u hC hφ).upperSemicontinuousOn _
    obtain ⟨a, ha, hmax⟩ := husc.exists_isMaxOn hne (isCompact_annulus x₀ ρ r)
    -- and it is strictly below the strict maximum
    have hlt : ubar u a - φ a < ubar u x₀ - φ x₀ :=
      hstrict a ha.1 (ne_of_mem_annulus hρ ha)
    refine ⟨(ubar u x₀ - φ x₀) - (ubar u a - φ a), by linarith [hlt],
      fun w hw => ?_⟩
    have h3 : ubar u w - φ w ≤ ubar u a - φ a := hmax hw
    linarith [h3]
  · -- an empty annulus makes the bound vacuous
    refine ⟨1, one_pos, fun w hw => ?_⟩
    exact absurd ⟨w, hw⟩ hne

Plaplacian/ApproxCmp.lean2 declarations

theoremdpp_comparison_approxTheorem 4.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$, $c, \kappa \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφ
  • $y \in \Omega$ hy
  • $\forall w \in B(y, \varepsilon),\ u(w) - \varphi(w) \le c$ hle
  • $c - \kappa \le u(y) - \varphi(y)$ hnear

Then $\varphi(y) \le T_{\varepsilon} \varphi(y) + \kappa$.

PLaplacian.dpp_comparison_approxPlaplacian/ApproxCmp.lean, lines 54–76
/-- **The approximate comparison.** -/
theorem dpp_comparison_approx {p ε : ℝ} (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφ : BddMeas φ)
    {y : EuclSpace d} (hy : y ∈ Ω) {c κ : ℝ}
    (hle : ∀ w ∈ ball y ε, u w - φ w ≤ c)
    (hnear : c - κ ≤ u y - φ y) :
    φ y ≤ tugOfWarOp p ε φ y + κ := by
  -- u ≤ φ + c on the ball
  have hup : ∀ w ∈ ball y ε, u w ≤ φ w + c := by
    intro w hw
    linarith [hle w hw]
  have hψ : BddMeas (fun w => φ w + c) := bddMeas_add_const hφ c
  -- monotonicity
  have hmono : tugOfWarOp p ε u y
      ≤ tugOfWarOp p ε (fun w => φ w + c) y :=
    tugOfWarOp_mono_ball p ε hp hε hpd hu.bddMeas hψ y hup
  rw [tugOfWarOp_add_const p ε hε hφ c y hpd] at hmono
  -- the dynamic programming principle
  rw [← hu.interior y hy] at hmono
  -- and the near-equality
  linarith [hmono, hnear]
theoremdiff_at_pair_approx
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $q \in \mathbb{R} \times \mathbb{R}^{d}$, $c, \kappa \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $0 < \mathrm{q.1}$ hq1
  • $u(\mathrm{q.1})\text{ is }p\text{-harmonious in }\Omega\text{ with step }\mathrm{q.1}\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $\mathrm{q.2} \in \Omega$ hmem
  • $\operatorname{gradient}(\varphi, \mathrm{q.2}) \ne 0$ hgrad
  • $\forall w \in B(\mathrm{q.2}, \mathrm{q.1}),\ u(\mathrm{q.1}, w) - \varphi(w) \le c$ hle
  • $c - \kappa \le u(\mathrm{q.1}, \mathrm{q.2}) - \varphi(\mathrm{q.2})$ hnear

Then there exists $E$ such that:

  • $0 \le \mathrm{q.1} ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, \mathrm{q.2}), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), \mathrm{q.2})) + E + \kappa$
PLaplacian.diff_at_pair_approxPlaplacian/ApproxCmp.lean, lines 78–97
/-- **The differential inequality with slack.** -/
theorem diff_at_pair_approx [Nontrivial (EuclSpace d)] {p : ℝ} (hp : 2 ≤ p)
    (hd : 0 < d) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F φ : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ}
    {q : ℝ × EuclSpace d} (hq1 : 0 < q.1)
    (hu : IsPHarmonious p q.1 Ω F (u q.1))
    (hφ : ContDiff ℝ 3 φ) (hφb : BddMeas φ)
    (hmem : q.2 ∈ Ω) (hgrad : gradient φ q.2 ≠ 0) {c κ : ℝ}
    (hle : ∀ w ∈ ball q.2 q.1, u q.1 w - φ w ≤ c)
    (hnear : c - κ ≤ u q.1 q.2 - φ q.2) :
    ∃ E : ℝ,
      0 ≤ q.1 ^ 2 / (2 * (p + (d : ℝ)))
          * normPLapOf p (gradient φ q.2) (fderiv ℝ (fderiv ℝ φ) q.2)
        + E + κ := by
  obtain ⟨E, hE⟩ := tugOfWarOp_expansion_final hd p hpd hφ hgrad hq1
  refine ⟨E, ?_⟩
  have hcmp := dpp_comparison_approx hp hq1 hpd hu hφb hmem hle hnear
  rw [hE] at hcmp
  linarith [hcmp]

Plaplacian/AsmCond.lean2 declarations

theoremviscF_le_of_eventually
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $q \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$ hq
  • ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), q ε ≤ PLaplacian.normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) hle

Then $\operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0})) \le 0$.

PLaplacian.viscF_le_of_eventuallyPlaplacian/AsmCond.lean, lines 55–66
/-- **The subsolution inequality, conditional on the eventual bound.**

If the error quotient tends to zero and is eventually below the operator's
value at the point, then the generator is nonpositive there --- which is the
subsolution inequality. -/
theorem viscF_le_of_eventually {p : ℝ} {φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d} {q : ℝ → ℝ}
    (hq : Filter.Tendsto q (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0))
    (hle : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      q ε ≤ normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀)) :
    viscF p (gradient φ x₀) (hess φ x₀) ≤ 0 :=
  viscF_le_of_chain (nonneg_of_rate hq hle)
theoremle_viscF_of_eventually
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $q \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$ hq
  • ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), PLaplacian.normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) ≤ q ε hge

Then $0 \le \operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0}))$.

PLaplacian.le_viscF_of_eventuallyPlaplacian/AsmCond.lean, lines 68–75
/-- **The supersolution inequality, conditional on the dual bound.** -/
theorem le_viscF_of_eventually {p : ℝ} {φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d} {q : ℝ → ℝ}
    (hq : Filter.Tendsto q (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0))
    (hge : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) ≤ q ε) :
    0 ≤ viscF p (gradient φ x₀) (hess φ x₀) :=
  le_viscF_of_chain (nonpos_of_rate hq hge)

Plaplacian/AsmFreq.lean2 declarations

theoremviscF_le_of_frequently
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $q \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$ hq
  • ∃ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), q ε ≤ PLaplacian.normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) hfreq

Then $\operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0})) \le 0$.

PLaplacian.viscF_le_of_frequentlyPlaplacian/AsmFreq.lean, lines 52–59
/-- **The subsolution inequality, conditional on a frequent bound.** -/
theorem viscF_le_of_frequently {p : ℝ} {φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d} {q : ℝ → ℝ}
    (hq : Filter.Tendsto q (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0))
    (hfreq : ∃ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      q ε ≤ normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀)) :
    viscF p (gradient φ x₀) (hess φ x₀) ≤ 0 :=
  viscF_le_of_chain (nonneg_of_frequently hq hfreq)
theoremle_viscF_of_frequently
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $q \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$ hq
  • ∃ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), PLaplacian.normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) ≤ q ε hfreq

Then $0 \le \operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0}))$.

PLaplacian.le_viscF_of_frequentlyPlaplacian/AsmFreq.lean, lines 61–68
/-- **The supersolution inequality, conditional on the dual frequency.** -/
theorem le_viscF_of_frequently {p : ℝ} {φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d} {q : ℝ → ℝ}
    (hq : Filter.Tendsto q (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0))
    (hfreq : ∃ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) ≤ q ε) :
    0 ≤ viscF p (gradient φ x₀) (hess φ x₀) :=
  le_viscF_of_chain (nonpos_of_frequently hq hfreq)

Plaplacian/AtPair.lean1 declarations

theoremdiff_at_pair
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $q \in \mathbb{R} \times \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $0 < \mathrm{q.1}$ hq1
  • $u(\mathrm{q.1})\text{ is }p\text{-harmonious in }\Omega\text{ with step }\mathrm{q.1}\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $\mathrm{q.2} \in \Omega$ hmem
  • $\operatorname{gradient}(\varphi, \mathrm{q.2}) \ne 0$ hgrad
  • $\forall w \in B(\mathrm{q.2}, \mathrm{q.1}),\ u(\mathrm{q.1}, w) - \varphi(w) \le u(\mathrm{q.1}, \mathrm{q.2}) - \varphi(\mathrm{q.2})$ hle

Then there exists $E$ such that:

  • $0 \le \mathrm{q.1} ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, \mathrm{q.2}), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), \mathrm{q.2})) + E$
/-- **The differential inequality at a pair**, given the local bound.

Stated with the bound on the small ball as a hypothesis, since establishing it
from the relaxed limit's local maximum is the remaining analytic step. -/
theorem diff_at_pair [Nontrivial (EuclSpace d)] {p : ℝ} (hp : 2 ≤ p)
    (hd : 0 < d) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F φ : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ}
    {q : ℝ × EuclSpace d} (hq1 : 0 < q.1)
    (hu : IsPHarmonious p q.1 Ω F (u q.1))
    (hφ : ContDiff ℝ 3 φ) (hφb : BddMeas φ)
    (hmem : q.2 ∈ Ω) (hgrad : gradient φ q.2 ≠ 0)
    (hle : ∀ w ∈ ball q.2 q.1, u q.1 w - φ w ≤ u q.1 q.2 - φ q.2) :
    ∃ E : ℝ,
      0 ≤ q.1 ^ 2 / (2 * (p + (d : ℝ)))
          * normPLapOf p (gradient φ q.2) (fderiv ℝ (fderiv ℝ φ) q.2)
        + E := by
  obtain ⟨E, hE⟩ := tugOfWarOp_expansion_final hd p hpd hφ hgrad hq1
  refine ⟨E, ?_⟩
  have hcmp := dpp_comparison_local' hp hq1 hpd hu hφb hmem hle
  rw [hE] at hcmp
  linarith [hcmp]

Plaplacian/Average.lean7 declarations

abbrevEuclSpace
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in $\mathrm{Type}$.

/-- The ambient Euclidean space. `abbrev`, not `def`, so instance search sees
through it. -/
abbrev EuclSpace (d : ℕ) := EuclideanSpace ℝ (Fin d)
lemmameasure_ball_ne_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then $\lambda(B(x, \varepsilon)) \ne 0$.

PLaplacian.measure_ball_ne_zeroPlaplacian/Average.lean, lines 45–48
/-- The measure of a ball of positive radius is nonzero. -/
lemma measure_ball_ne_zero (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    volume (ball x ε) ≠ 0 :=
  (measure_ball_pos volume x hε).ne'
lemmaisFiniteMeasure_restrict_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{IsFiniteMeasure}(\operatorname{volume.restrict}(B(x, \varepsilon)))$.

PLaplacian.isFiniteMeasure_restrict_ballPlaplacian/Average.lean, lines 50–55
/-- The restriction of Lebesgue measure to a ball is a finite measure. -/
lemma isFiniteMeasure_restrict_ball (x : EuclSpace d) (ε : ℝ) :
    IsFiniteMeasure (volume.restrict (ball x ε)) := by
  refine ⟨?_⟩
  rw [Measure.restrict_apply_univ]
  exact measure_ball_lt_top
lemmaneZero_restrict_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then $\operatorname{NeZero}(\operatorname{volume.restrict}(B(x, \varepsilon)))$.

PLaplacian.neZero_restrict_ballPlaplacian/Average.lean, lines 57–63
/-- The restriction of Lebesgue measure to a ball of positive radius is
nonzero. Cannot be an instance: the hypothesis `0 < ε` is essential. -/
lemma neZero_restrict_ball (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    NeZero (volume.restrict (ball x ε)) := by
  refine ⟨fun h => ?_⟩
  rw [Measure.restrict_eq_zero] at h
  exact measure_ball_ne_zero x hε h
theoremsetAverage_monoTheorem 2.9 in the blueprint
Formal statementgenerated from the Lean declaration

Let $\alpha$ be a type, $\mu \in \operatorname{Measure}(\alpha)$, $s \subseteq \alpha$, $f, g \colon \alpha \to \mathbb{R}$.

Assume

  • $\operatorname{MeasurableSpace}(\alpha)$
  • $s\text{ is measurable}$ hs
  • $\operatorname{IntegrableOn}(f, s, \mu)$ hf
  • $\operatorname{IntegrableOn}(g, s, \mu)$ hg
  • $\forall x \in s,\ f(x) \le g(x)$ h

Then ⨍ (x : α) in s, f x ∂μ ≤ ⨍ (x : α) in s, g x ∂μ.

PLaplacian.setAverage_monoPlaplacian/Average.lean, lines 65–78
/-- **Monotonicity of the set average.** No hypothesis on `μ s` is needed:
`setAverage_eq` is unconditional, and `(μ.real s)⁻¹` is nonnegative even when
`μ s = 0` or `μ s = ∞`, where the junk-value convention makes it `0`. -/
theorem setAverage_mono {α : Type*} [MeasurableSpace α] {μ : Measure α}
    {s : Set α} (hs : MeasurableSet s) {f g : α → ℝ}
    (hf : IntegrableOn f s μ) (hg : IntegrableOn g s μ)
    (h : ∀ x ∈ s, f x ≤ g x) :
    (⨍ x in s, f x ∂μ) ≤ ⨍ x in s, g x ∂μ := by
  have hint : (∫ x in s, f x ∂μ) ≤ ∫ x in s, g x ∂μ :=
    setIntegral_mono_on hf hg hs h
  have hnn : (0 : ℝ) ≤ (μ.real s)⁻¹ := by positivity
  rw [setAverage_eq, setAverage_eq]
  simp only [smul_eq_mul]
  exact mul_le_mul_of_nonneg_left hint hnn
theoremsetAverage_mono_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $f, g \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{IntegrableOn}(f, B(x, \varepsilon), \lambda)$ hf
  • $\operatorname{IntegrableOn}(g, B(x, \varepsilon), \lambda)$ hg
  • $\forall y,\ f(y) \le g(y)$ h

Then $\fint_{B(x, \varepsilon)} (f(y) \le \fint_{B(x, \varepsilon)} g(y) \, dy) \, dy$.

PLaplacian.setAverage_mono_ballPlaplacian/Average.lean, lines 80–86
/-- Monotonicity of the average over a ball. -/
theorem setAverage_mono_ball (x : EuclSpace d) {ε : ℝ}
    {f g : EuclSpace d → ℝ}
    (hf : IntegrableOn f (ball x ε)) (hg : IntegrableOn g (ball x ε))
    (h : ∀ y, f y ≤ g y) :
    (⨍ y in ball x ε, f y) ≤ ⨍ y in ball x ε, g y :=
  setAverage_mono measurableSet_ball hf hg (fun y _ => h y)
theoremsetAverage_const_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then $\fint_{B(x, \varepsilon)} (c = c) \, d\mathrm{\_y}$.

PLaplacian.setAverage_const_ballPlaplacian/Average.lean, lines 88–93
/-- The average of a constant over a ball of positive radius. -/
theorem setAverage_const_ball (c : ℝ) (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    (⨍ _y in ball x ε, c) = c := by
  have := isFiniteMeasure_restrict_ball x ε
  have := neZero_restrict_ball x hε
  exact average_const (volume.restrict (ball x ε)) c

Plaplacian/AvgErrBound.lean1 declarations

theoremsetAverage_taylorErr_leTheorem 3.10 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $0 < \varepsilon$ hε

Then there exists $K$ such that:

  • $\fint_{B(0, \varepsilon)} (\operatorname{taylorErr}(\varphi, x, z) \le K \cdot \varepsilon ^{3}) \, dz$
PLaplacian.setAverage_taylorErr_lePlaplacian/AvgErrBound.lean, lines 46–61
/-- **The average of the Taylor error, bounded cubically.** -/
theorem setAverage_taylorErr_le {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    ∃ K : ℝ, (⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ x z)
      ≤ K * ε ^ 3 := by
  obtain ⟨K, hK⟩ := taylorErr_le_on_ball hφ x hε
  refine ⟨K, ?_⟩
  have hmono : (⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ x z)
      ≤ ⨍ _z in ball (0 : EuclSpace d) ε, K * ε ^ 3 := by
    refine setAverage_mono measurableSet_ball
      (integrableOn_taylorErr (hφ.of_le (by norm_num)) x ε) integrableOn_const ?_
    intro z hz
    have h := hK z hz
    exact le_of_abs_le h
  rw [setAverage_const_ball (K * ε ^ 3) 0 hε] at hmono
  exact hmono

Plaplacian/AvgExpansion.lean9 declarations

deftaylorErr
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

def taylorErr (φ : EuclSpace d → ℝ) (x z : EuclSpace d) : ℝ :=
  φ (x + z) - φ x - fderiv ℝ φ x z
    - (1/2) * fderiv ℝ (fderiv ℝ φ) x z z
theoremtaylor_decomp
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Then $\varphi(x + z) = \varphi(x) + (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(z) + 1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(z))(z) + \operatorname{taylorErr}(\varphi, x, z)$.

theorem taylor_decomp (φ : EuclSpace d → ℝ) (x z : EuclSpace d) :
    φ (x + z) = φ x + fderiv ℝ φ x z
      + (1/2) * fderiv ℝ (fderiv ℝ φ) x z z + taylorErr φ x z := by
  unfold taylorErr; ring
theoremcontinuous_linear_term
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then Continuous fun z => (fderiv ℝ φ x) z.

PLaplacian.continuous_linear_termPlaplacian/AvgExpansion.lean, lines 51–53
theorem continuous_linear_term (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    Continuous (fun z : EuclSpace d => fderiv ℝ φ x z) :=
  (fderiv ℝ φ x).continuous
theoremcontinuous_quad_term
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then Continuous fun z => 1 / 2 * ((fderiv ℝ (fderiv ℝ φ) x) z) z.

PLaplacian.continuous_quad_termPlaplacian/AvgExpansion.lean, lines 55–61
theorem continuous_quad_term (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    Continuous (fun z : EuclSpace d =>
      (1/2) * fderiv ℝ (fderiv ℝ φ) x z z) := by
  have h : Continuous (fun z : EuclSpace d =>
      fderiv ℝ (fderiv ℝ φ) x z z) := by
    exact (fderiv ℝ (fderiv ℝ φ) x).continuous.clm_apply continuous_id
  exact continuous_const.mul h
theoremintegrableOn_linear
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(z \mapsto (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(z), B(0, \varepsilon), \lambda)$.

PLaplacian.integrableOn_linearPlaplacian/AvgExpansion.lean, lines 63–67
theorem integrableOn_linear (φ : EuclSpace d → ℝ) (x : EuclSpace d) (ε : ℝ) :
    MeasureTheory.IntegrableOn (fun z : EuclSpace d => fderiv ℝ φ x z)
      (ball (0 : EuclSpace d) ε) :=
  ((continuous_linear_term φ x).continuousOn.integrableOn_compact
    (isCompact_closedBall _ _)).mono_set ball_subset_closedBall
theoremintegrableOn_quad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(z \mapsto 1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(z))(z), B(0, \varepsilon), \lambda)$.

theorem integrableOn_quad (φ : EuclSpace d → ℝ) (x : EuclSpace d) (ε : ℝ) :
    MeasureTheory.IntegrableOn
      (fun z : EuclSpace d => (1/2) * fderiv ℝ (fderiv ℝ φ) x z z)
      (ball (0 : EuclSpace d) ε) :=
  ((continuous_quad_term φ x).continuousOn.integrableOn_compact
    (isCompact_closedBall _ _)).mono_set ball_subset_closedBall
theoremcontinuous_taylorErr
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then Continuous fun z => PLaplacian.taylorErr φ x z.

PLaplacian.continuous_taylorErrPlaplacian/AvgExpansion.lean, lines 76–83
theorem continuous_taylorErr {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) :
    Continuous (fun z : EuclSpace d => taylorErr φ x z) := by
  unfold taylorErr
  have h1 : Continuous (fun z : EuclSpace d => φ (x + z)) :=
    (hφ.continuous).comp (continuous_const.add continuous_id)
  exact ((h1.sub continuous_const).sub (continuous_linear_term φ x)).sub
    (continuous_quad_term φ x)
theoremintegrableOn_taylorErr
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then $\operatorname{IntegrableOn}(z \mapsto \operatorname{taylorErr}(\varphi, x, z), B(0, \varepsilon), \lambda)$.

PLaplacian.integrableOn_taylorErrPlaplacian/AvgExpansion.lean, lines 85–90
theorem integrableOn_taylorErr {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) (ε : ℝ) :
    MeasureTheory.IntegrableOn (fun z => taylorErr φ x z)
      (ball (0 : EuclSpace d) ε) :=
  ((continuous_taylorErr hφ x).continuousOn.integrableOn_compact
    (isCompact_closedBall _ _)).mono_set ball_subset_closedBall
theoremsetAverage_expansionTheorem 3.4 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < \varepsilon$ hε

Then $\fint_{B(x, \varepsilon)} (\varphi(y) = \varphi(x) + \varepsilon ^{2} / (2 \cdot (d + 2)) \cdot \operatorname{laplacianOf}(\operatorname{hess}(\varphi, x)) + \fint_{B(0, \varepsilon)} \operatorname{taylorErr}(\varphi, x, z) \, dz) \, dy$.

PLaplacian.setAverage_expansionPlaplacian/AvgExpansion.lean, lines 94–141
/-- **The average expansion with an explicit error term.**

The average of `φ` over a ball equals the value at the centre plus the
quadratic term, plus the average of the Taylor error. The linear term drops
out by the odd moments; the quadratic term is the Laplacian by the second
moments.

The error term is left as an average rather than estimated, so that the
statement is exact. Bounding it is `setAverage_taylorErr_le` below. -/
theorem setAverage_expansion [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ) (x : EuclSpace d) {ε : ℝ}
    (hε : 0 < ε) :
    (⨍ y in ball x ε, φ y)
      = φ x + ε ^ 2 / (2 * ((d : ℝ) + 2)) * laplacianOf (hess φ x)
        + ⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ x z := by
  rw [setAverage_ball_translate φ x ε]
  have hdec : (fun z : EuclSpace d => φ (x + z))
      = fun z => φ x + fderiv ℝ φ x z
        + (1/2) * fderiv ℝ (fderiv ℝ φ) x z z + taylorErr φ x z := by
    funext z
    exact taylor_decomp φ x z
  rw [hdec]
  -- split the average across the four terms
  have hsplit : (⨍ z in ball (0 : EuclSpace d) ε,
        (φ x + fderiv ℝ φ x z
          + (1/2) * fderiv ℝ (fderiv ℝ φ) x z z + taylorErr φ x z))
      = (⨍ z in ball (0 : EuclSpace d) ε, φ x)
        + (⨍ z in ball (0 : EuclSpace d) ε, fderiv ℝ φ x z)
        + (⨍ z in ball (0 : EuclSpace d) ε,
            (1/2) * fderiv ℝ (fderiv ℝ φ) x z z)
        + (⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ x z) := by
    have hc : MeasureTheory.IntegrableOn (fun _ : EuclSpace d => φ x)
        (ball (0 : EuclSpace d) ε) := integrableOn_const
    have hl := integrableOn_linear φ x ε
    have hq := integrableOn_quad φ x ε
    have he := integrableOn_taylorErr hφ x ε
    rw [show (fun z : EuclSpace d => φ x + fderiv ℝ φ x z
          + (1/2) * fderiv ℝ (fderiv ℝ φ) x z z + taylorErr φ x z)
        = ((fun _ : EuclSpace d => φ x) + (fun z => fderiv ℝ φ x z)
            + (fun z => (1/2) * fderiv ℝ (fderiv ℝ φ) x z z))
          + (fun z => taylorErr φ x z) from rfl]
    rw [MeasureTheory.setAverage_add (((hc.add hl).add hq)) he,
        MeasureTheory.setAverage_add (hc.add hl) hq,
        MeasureTheory.setAverage_add hc hl]
  rw [hsplit, setAverage_const_ball (φ x) 0 hε,
      setAverage_fderiv_eq_zero φ x ε,
      setAverage_hess_term hd φ x hε]
  ring

Plaplacian/AvgRate.lean1 declarations

theoremtaylorErr_le_on_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $0 < \varepsilon$ _hε

Then there exists $K$ such that:

  • $\forall z \in B(0, \varepsilon),\ \lvert \operatorname{taylorErr}(\varphi, x, z)\rvert \le K \cdot \varepsilon ^{3}$
PLaplacian.taylorErr_le_on_ballPlaplacian/AvgRate.lean, lines 43–61
/-- The integrand, bounded pointwise on the ball. -/
theorem taylorErr_le_on_ball {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x : EuclSpace d) {ε : ℝ} (_hε : 0 < ε) :
    ∃ K : ℝ, ∀ z ∈ ball (0 : EuclSpace d) ε,
      |taylorErr φ x z| ≤ K * ε ^ 3 := by
  obtain ⟨K, hK⟩ := taylorErr_le_cubic hφ x ε
  refine ⟨max K 0, fun z hz => ?_⟩
  have hzn : ‖z‖ ≤ ε := by
    rw [mem_ball, dist_zero_right] at hz
    exact le_of_lt hz
  have h1 := hK z hzn
  have hz3 : ‖z‖ ^ 3 ≤ ε ^ 3 := by
    have h0 : (0:ℝ) ≤ ‖z‖ := norm_nonneg z
    have hεnn : (0:ℝ) ≤ ε := le_trans h0 hzn
    nlinarith [hzn, h0, hεnn, sq_nonneg (‖z‖ - ε), sq_nonneg (‖z‖ + ε)]
  have hKle : K ≤ max K 0 := le_max_left _ _
  have hK0 : (0:ℝ) ≤ max K 0 := le_max_right _ _
  have hz3nn : (0:ℝ) ≤ ‖z‖ ^ 3 := by positivity
  nlinarith [h1, hz3, hKle, hK0, hz3nn]

Plaplacian/AvgTerms.lean4 declarations

theoremsetAverage_const_mul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $s \subseteq \mathbb{R}^{d}$.

Then $\fint_{s} (c \cdot f(z) = c \cdot \fint_{s} f(z) \, dz) \, dz$.

PLaplacian.setAverage_const_mulPlaplacian/AvgTerms.lean, lines 57–63
/-- Pulling a scalar out of a set average on the left. -/
theorem setAverage_const_mul (c : ℝ) (f : EuclSpace d → ℝ)
    (s : Set (EuclSpace d)) :
    (⨍ z in s, c * f z) = c * ⨍ z in s, f z := by
  rw [MeasureTheory.setAverage_eq, MeasureTheory.setAverage_eq,
      MeasureTheory.integral_const_mul, smul_eq_mul, smul_eq_mul]
  ring
theoremfderiv_eq_inner_gradient
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Then $(\operatorname{fderiv}(\mathbb{R}, \varphi, x))(z) = \operatorname{inner}(\mathbb{R}, \operatorname{gradient}(\varphi, x), z)$.

PLaplacian.fderiv_eq_inner_gradientPlaplacian/AvgTerms.lean, lines 72–75
/-- The derivative applied to `z`, as an inner product. -/
theorem fderiv_eq_inner_gradient (φ : EuclSpace d → ℝ) (x z : EuclSpace d) :
    fderiv ℝ φ x z = inner ℝ (gradient φ x) z :=
  (inner_gradient_left).symm
theoremsetAverage_fderiv_eq_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\fint_{B(0, \varepsilon)} ((\operatorname{fderiv}(\mathbb{R}, \varphi, x))(z) = 0) \, dz$.

PLaplacian.setAverage_fderiv_eq_zeroPlaplacian/AvgTerms.lean, lines 77–87
/-- **The linear term vanishes.** -/
theorem setAverage_fderiv_eq_zero (φ : EuclSpace d → ℝ) (x : EuclSpace d)
    (ε : ℝ) :
    (⨍ z in ball (0 : EuclSpace d) ε, fderiv ℝ φ x z) = 0 := by
  have h : (fun z : EuclSpace d => fderiv ℝ φ x z)
      = fun z : EuclSpace d => inner ℝ (gradient φ x) z := by
    funext z
    exact fderiv_eq_inner_gradient φ x z
  rw [h, MeasureTheory.setAverage_eq,
      integral_inner_ball_eq_zero (gradient φ x) ε]
  simp
theoremsetAverage_hess_term
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $0 < \varepsilon$ hε

Then $\fint_{B(0, \varepsilon)} (1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(z))(z) = \varepsilon ^{2} / (2 \cdot (d + 2)) \cdot \operatorname{laplacianOf}(\operatorname{hess}(\varphi, x))) \, dz$.

PLaplacian.setAverage_hess_termPlaplacian/AvgTerms.lean, lines 91–101
/-- **The quadratic term.** -/
theorem setAverage_hess_term [Nontrivial (EuclSpace d)] (hd : 0 < d)
    (φ : EuclSpace d → ℝ) (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    (⨍ z in ball (0 : EuclSpace d) ε,
        (1/2) * fderiv ℝ (fderiv ℝ φ) x z z)
      = ε ^ 2 / (2 * ((d : ℝ) + 2)) * laplacianOf (hess φ x) := by
  rw [setAverage_const_mul (1/2) (fun z => fderiv ℝ (fderiv ℝ φ) x z z),
      setAverage_quadratic hd (fderiv ℝ (fderiv ℝ φ) x) hε]
  unfold hess
  have hd2 : ((d : ℝ) + 2) ≠ 0 := by positivity
  field_simp

Plaplacian/AvgUnif.lean1 declarations

theoremavgErr_uniform
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $R \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $K$ such that:

  • $\forall y \in \overline{B}(x_{0}, R),\ \forall \varepsilon,\ 0 < \varepsilon \to \varepsilon \le R \to \lvert \fint_{B(0, \varepsilon)} \operatorname{taylorErr}(\varphi, y, z) \, dz\rvert \le K \cdot \varepsilon ^{3}$
/-- **The average error, uniform in the base point.** -/
theorem avgErr_uniform {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x₀ : EuclSpace d) (R : ℝ) :
    ∃ K : ℝ, ∀ y ∈ closedBall x₀ R, ∀ ε : ℝ, 0 < ε → ε ≤ R →
      |⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ y z| ≤ K * ε ^ 3 := by
  obtain ⟨K₀, hK₀⟩ := taylorErr_le_cubic_uniform hφ x₀ R
  set K := max K₀ 0 with hK
  refine ⟨K, fun y hy ε hε hεR => ?_⟩
  have hKnn : (0:ℝ) ≤ K := le_max_right _ _
  have hKge : K₀ ≤ K := le_max_left _ _
  -- the pointwise bound on the ball
  have hpt : ∀ z ∈ ball (0 : EuclSpace d) ε,
      |taylorErr φ y z| ≤ K * ε ^ 3 := by
    intro z hz
    have hzn : ‖z‖ < ε := by
      rw [mem_ball, dist_zero_right] at hz; exact hz
    have hzR : ‖z‖ ≤ R := le_trans (le_of_lt hzn) hεR
    have h1 := hK₀ y hy z hzR
    have hz3 : ‖z‖ ^ 3 ≤ ε ^ 3 := by
      have h0 : (0:ℝ) ≤ ‖z‖ := norm_nonneg z
      nlinarith [hzn, h0, hε, sq_nonneg (‖z‖ - ε), sq_nonneg (‖z‖ + ε)]
    have hz3nn : (0:ℝ) ≤ ‖z‖ ^ 3 := by positivity
    nlinarith [h1, hz3, hKge, hKnn, hz3nn]
  -- integrability
  have hint := integrableOn_taylorErr (hφ.of_le (by norm_num)) y ε
  have hconst : MeasureTheory.IntegrableOn
      (fun _ : EuclSpace d => K * ε ^ 3) (ball (0 : EuclSpace d) ε) :=
    integrableOn_const
  have hconstn : MeasureTheory.IntegrableOn
      (fun _ : EuclSpace d => -(K * ε ^ 3)) (ball (0 : EuclSpace d) ε) :=
    integrableOn_const
  -- the two sides
  have hup : (⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ y z)
      ≤ K * ε ^ 3 := by
    have h := setAverage_mono measurableSet_ball hint hconst
      (fun z hz => le_of_abs_le (hpt z hz))
    rwa [setAverage_const_ball (K * ε ^ 3) 0 hε] at h
  have hlo : -(K * ε ^ 3)
      ≤ ⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ y z := by
    have h := setAverage_mono measurableSet_ball hconstn hint
      (fun z hz => (abs_le.1 (hpt z hz)).1)
    rwa [setAverage_const_ball (-(K * ε ^ 3)) 0 hε] at h
  rw [abs_le]
  exact ⟨hlo, hup⟩

Plaplacian/BallCont.lean3 declarations

lemmaalready

No exported statement.

lemma already in the library.
theoremball_subset_of_near
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, y \in \mathbb{R}^{d}$, $\varepsilon, r \in \mathbb{R}$.

Assume

  • $\varepsilon < r / 2$ hεr
  • $\lVert y - x_{0}\rVert < r / 2$ hy

Then $B(y, \varepsilon) \subseteq B(x_{0}, r)$.

PLaplacian.ball_subset_of_nearPlaplacian/BallCont.lean, lines 54–66
/-- **The ball containment.** -/
theorem ball_subset_of_near {x₀ y : EuclSpace d} {ε r : ℝ}
    (hεr : ε < r / 2) (hy : ‖y - x₀‖ < r / 2) :
    ball y ε ⊆ ball x₀ r := by
  intro w hw
  rw [mem_ball, dist_eq_norm] at hw
  rw [mem_ball, dist_eq_norm]
  calc ‖w - x₀‖ = ‖(w - y) + (y - x₀)‖ := by
        congr 1; abel
    _ ≤ ‖w - y‖ + ‖y - x₀‖ := norm_add_le _ _
    _ < r / 2 + r / 2 := by
        exact add_lt_add (lt_trans hw hεr) hy
    _ = r := by ring
theoremeventually_near
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $0 < r$ hr

Then all of the following hold:

  • ∀ᶠ ( q : ℝ × EuclSpace d ) in PLaplacian.relaxFilter x₀ , q.1 < r / 2
  • $\lVert \mathrm{q.2} - x_{0}\rVert < r / 2$
PLaplacian.eventually_nearPlaplacian/BallCont.lean, lines 68–82
/-- The two smallness conditions hold eventually on the product filter. -/
theorem eventually_near {x₀ : EuclSpace d} {r : ℝ} (hr : 0 < r) :
    ∀ᶠ q in relaxFilter x₀,
      q.1 < r / 2 ∧ ‖q.2 - x₀‖ < r / 2 := by
  unfold relaxFilter
  rw [Filter.eventually_iff, Filter.mem_prod_iff]
  refine ⟨Set.Iio (r / 2), ?_, ball x₀ (r / 2), ?_, ?_⟩
  · exact Filter.mem_of_superset (Ioo_mem_nhdsGT (by positivity))
      (fun y hy => hy.2)
  · exact Metric.ball_mem_nhds x₀ (by positivity)
  · intro q hq
    refine ⟨hq.1, ?_⟩
    have := hq.2
    rw [mem_ball, dist_eq_norm] at this
    exact this

Plaplacian/BallMoments.lean38 declarations

abbrevEuclSpaceM
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in $\mathrm{Type}$.

abbrev EuclSpaceM (d : ℕ) := EuclideanSpace ℝ (Fin d)
lemmaintegral_neg_coord_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$.

Then ∫ (z : EuclSpaceM d) in Metric.ball 0 r, (-z).ofLp i = ∫ (z : EuclSpaceM d) in Metric.ball 0 r, z.ofLp i.

PLaplacian.integral_neg_coord_ballPlaplacian/BallMoments.lean, lines 63–78
/-- Reflection symmetry of the coordinate integral over a centred ball. -/
lemma integral_neg_coord_ball (i : Fin d) (r : ℝ) :
    (∫ z in ball (0 : EuclSpaceM d) r, (-z) i)
      = ∫ z in ball (0 : EuclSpaceM d) r, z i := by
  have hneg : (volume : Measure (EuclSpaceM d)).IsNegInvariant :=
    Measure.IsAddHaarMeasure.isNegInvariant_of_innerRegular volume
  rw [← integral_indicator measurableSet_ball,
      ← integral_indicator measurableSet_ball]
  rw [← integral_neg_eq_self
      (fun z => (ball (0 : EuclSpaceM d) r).indicator (fun w => w i) z) volume]
  congr 1
  ext z
  simp only
  by_cases h : z ∈ ball (0 : EuclSpaceM d) r
  · simp [h, show (-z) ∈ ball (0 : EuclSpaceM d) r from by simpa using h]
  · simp [h, show (-z) ∉ ball (0 : EuclSpaceM d) r from by simpa using h]
lemmaintegral_neg_coord_ball'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$.

Then ∫ (z : EuclSpaceM d) in Metric.ball 0 r, (-z).ofLp i = -∫ (z : EuclSpaceM d) in Metric.ball 0 r, z.ofLp i.

PLaplacian.integral_neg_coord_ball'Plaplacian/BallMoments.lean, lines 80–85
/-- Linearity: negating the integrand negates the integral. -/
lemma integral_neg_coord_ball' (i : Fin d) (r : ℝ) :
    (∫ z in ball (0 : EuclSpaceM d) r, (-z) i)
      = -∫ z in ball (0 : EuclSpaceM d) r, z i := by
  simp only [PiLp.neg_apply]
  exact integral_neg _
theoremintegral_coord_ball_eq_zeroTheorem 2.10 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$.

Then $\int_{B(0, r)} (\operatorname{z.ofLp}(i) = 0) \, dz$.

PLaplacian.integral_coord_ball_eq_zeroPlaplacian/BallMoments.lean, lines 87–92
/-- **The odd moments of a centred ball vanish.** -/
theorem integral_coord_ball_eq_zero (i : Fin d) (r : ℝ) :
    (∫ z in ball (0 : EuclSpaceM d) r, z i) = 0 := by
  have h1 := integral_neg_coord_ball i r
  have h2 := integral_neg_coord_ball' i r
  linarith [h1, h2]
defflipCoord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $z \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}^{d}$.

/-- Flip the sign of the `i`-th coordinate. -/
def flipCoord (i : Fin d) (z : EuclSpaceM d) : EuclSpaceM d :=
  (WithLp.equiv 2 _).symm (fun j => if j = i then -(z.ofLp j) else z.ofLp j)
lemmaflipCoord_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $z \in \mathbb{R}^{d}$, $j \in \operatorname{Fin}(d)$.

Then (PLaplacian.flipCoord i z).ofLp j = if j = i then -z.ofLp j else z.ofLp j.

lemma flipCoord_apply (i : Fin d) (z : EuclSpaceM d) (j : Fin d) :
    (flipCoord i z).ofLp j = if j = i then -(z.ofLp j) else z.ofLp j := by
  simp [flipCoord]
lemmanorm_flipCoord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $z \in \mathbb{R}^{d}$.

Then $\lVert \operatorname{flipCoord}(i, z)\rVert = \lVert z\rVert$.

lemma norm_flipCoord (i : Fin d) (z : EuclSpaceM d) : ‖flipCoord i z‖ = ‖z‖ := by
  rw [EuclideanSpace.norm_eq, EuclideanSpace.norm_eq]
  congr 1
  refine Finset.sum_congr rfl fun j _ => ?_
  simp only [flipCoord]
  by_cases h : j = i
  · simp [h]
  · simp [h]
lemmaflipCoord_involutive
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$.

Then $\operatorname{Function.Involutive}(\operatorname{flipCoord}(i))$.

PLaplacian.flipCoord_involutivePlaplacian/BallMoments.lean, lines 116–121
lemma flipCoord_involutive (i : Fin d) :
    Function.Involutive (flipCoord (d := d) i) := by
  intro z; ext j; simp only [flipCoord_apply]
  by_cases h : j = i
  · simp [h]
  · simp [h]
lemmaflipCoord_add
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $z, w \in \mathbb{R}^{d}$.

Then $\operatorname{flipCoord}(i, z + w) = \operatorname{flipCoord}(i, z) + \operatorname{flipCoord}(i, w)$.

lemma flipCoord_add (i : Fin d) (z w : EuclSpaceM d) :
    flipCoord i (z + w) = flipCoord i z + flipCoord i w := by
  ext j; simp only [flipCoord_apply, PiLp.add_apply]
  by_cases h : j = i
  · simp [h]; ring
  · simp [h]
lemmaflipCoord_smul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $c \in \mathbb{R}$, $z \in \mathbb{R}^{d}$.

Then $\operatorname{flipCoord}(i, c \cdot z) = c \cdot \operatorname{flipCoord}(i, z)$.

lemma flipCoord_smul (i : Fin d) (c : ℝ) (z : EuclSpaceM d) :
    flipCoord i (c • z) = c • flipCoord i z := by
  ext j; simp only [flipCoord_apply, PiLp.smul_apply, smul_eq_mul]
  by_cases h : j = i
  · simp [h]
  · simp [h]
defflipCoordEquiv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$.

Its value lies in EuclSpaceM d ≃ₗᵢ[ℝ] EuclSpaceM d.

/-- The single-coordinate flip as a linear isometry equivalence. Being an
isometry, it preserves `volume` by `LinearIsometryEquiv.measurePreserving`. -/
def flipCoordEquiv (i : Fin d) : EuclSpaceM d ≃ₗᵢ[ℝ] EuclSpaceM d where
  toFun := flipCoord i
  invFun := flipCoord i
  left_inv := flipCoord_involutive i
  right_inv := flipCoord_involutive i
  map_add' := flipCoord_add i
  map_smul' := flipCoord_smul i
  norm_map' := norm_flipCoord i
lemmameasurePreserving_flipCoord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$.

Then MeasureTheory.MeasurePreserving (⇑(PLaplacian.flipCoordEquiv i)) MeasureTheory.volume MeasureTheory.volume.

PLaplacian.measurePreserving_flipCoordPlaplacian/BallMoments.lean, lines 148–150
lemma measurePreserving_flipCoord (i : Fin d) :
    MeasurePreserving (flipCoordEquiv (d := d) i) volume volume :=
  LinearIsometryEquiv.measurePreserving _
lemmaflipCoord_mem_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$, $z \in \mathbb{R}^{d}$.

Then $\operatorname{flipCoord}(i, z) \in B(0, r) \iff z \in B(0, r)$.

/-- The flip preserves the centred ball. -/
lemma flipCoord_mem_ball (i : Fin d) (r : ℝ) (z : EuclSpaceM d) :
    flipCoord i z ∈ ball (0 : EuclSpaceM d) r ↔
      z ∈ ball (0 : EuclSpaceM d) r := by
  simp [mem_ball, dist_zero_right, norm_flipCoord]
lemmaflip_mul_coord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i, j \in \operatorname{Fin}(d)$, $z \in \mathbb{R}^{d}$.

Assume

  • $i \ne j$ hij

Then (PLaplacian.flipCoord i z).ofLp i * (PLaplacian.flipCoord i z).ofLp j = -(z.ofLp i * z.ofLp j).

/-- The product of two distinct coordinates is odd under the flip. -/
lemma flip_mul_coord (i j : Fin d) (hij : i ≠ j) (z : EuclSpaceM d) :
    (flipCoord i z).ofLp i * (flipCoord i z).ofLp j
      = -(z.ofLp i * z.ofLp j) := by
  simp only [flipCoord_apply]
  simp [Ne.symm hij]
lemmameasurableEmbedding_flipCoord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$.

Then MeasurableEmbedding ⇑(PLaplacian.flipCoordEquiv i).

PLaplacian.measurableEmbedding_flipCoordPlaplacian/BallMoments.lean, lines 168–171
/-- The flip is a measurable embedding, being a homeomorphism. -/
lemma measurableEmbedding_flipCoord (i : Fin d) :
    MeasurableEmbedding (flipCoordEquiv (d := d) i) :=
  (flipCoordEquiv (d := d) i).toHomeomorph.measurableEmbedding
lemmaflipCoordEquiv_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $z \in \mathbb{R}^{d}$.

Then $(\operatorname{flipCoordEquiv}(i))(z) = \operatorname{flipCoord}(i, z)$.

PLaplacian.flipCoordEquiv_applyPlaplacian/BallMoments.lean, lines 173–175
/-- The bundled equivalence agrees with the bare function. -/
@[simp] lemma flipCoordEquiv_apply (i : Fin d) (z : EuclSpaceM d) :
    (flipCoordEquiv (d := d) i) z = flipCoord i z := rfl
lemmaintegral_flip_mul_coord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i, j \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$.

Then ∫ (z : EuclSpaceM d) in Metric.ball 0 r, (PLaplacian.flipCoord i z).ofLp i * (PLaplacian.flipCoord i z).ofLp j = ∫ (z : EuclSpaceM d) in Metric.ball 0 r, z.ofLp i * z.ofLp j.

PLaplacian.integral_flip_mul_coordPlaplacian/BallMoments.lean, lines 177–191
/-- Change of variables under the flip: it preserves both `volume` and the
centred ball, so the integral is unchanged. -/
lemma integral_flip_mul_coord (i j : Fin d) (r : ℝ) :
    (∫ z in ball (0 : EuclSpaceM d) r,
        (flipCoord i z).ofLp i * (flipCoord i z).ofLp j)
      = ∫ z in ball (0 : EuclSpaceM d) r, z.ofLp i * z.ofLp j := by
  have hpre : (flipCoordEquiv (d := d) i) ⁻¹' (ball (0 : EuclSpaceM d) r)
      = ball (0 : EuclSpaceM d) r := by
    ext z; simp
  have key := (measurePreserving_flipCoord i).setIntegral_preimage_emb
    (measurableEmbedding_flipCoord i)
    (fun w : EuclSpaceM d => w.ofLp i * w.ofLp j)
    (ball (0 : EuclSpaceM d) r)
  rw [hpre] at key
  simpa using key
lemmaintegral_flip_mul_coord_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i, j \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$.

Assume

  • $i \ne j$ hij

Then ∫ (z : EuclSpaceM d) in Metric.ball 0 r, (PLaplacian.flipCoord i z).ofLp i * (PLaplacian.flipCoord i z).ofLp j = -∫ (z : EuclSpaceM d) in Metric.ball 0 r, z.ofLp i * z.ofLp j.

PLaplacian.integral_flip_mul_coord_negPlaplacian/BallMoments.lean, lines 193–200
/-- Oddness: for `j ≠ i` the integrand changes sign under the flip. -/
lemma integral_flip_mul_coord_neg (i j : Fin d) (hij : i ≠ j) (r : ℝ) :
    (∫ z in ball (0 : EuclSpaceM d) r,
        (flipCoord i z).ofLp i * (flipCoord i z).ofLp j)
      = -∫ z in ball (0 : EuclSpaceM d) r, z.ofLp i * z.ofLp j := by
  rw [← integral_neg]
  refine setIntegral_congr_fun measurableSet_ball fun z _ => ?_
  exact flip_mul_coord i j hij z
theoremintegral_mul_coord_ball_eq_zeroTheorem 2.10 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i, j \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$.

Assume

  • $i \ne j$ hij

Then $\int_{B(0, r)} (\operatorname{z.ofLp}(i) \cdot \operatorname{z.ofLp}(j) = 0) \, dz$.

PLaplacian.integral_mul_coord_ball_eq_zeroPlaplacian/BallMoments.lean, lines 202–211
/-- **The off-diagonal second moments of a centred ball vanish.**

Flipping the sign of the `i`-th coordinate preserves both Lebesgue measure and
the ball, but negates `z i * z j` when `j ≠ i`. Hence the integral equals its
own negative, so it is zero. -/
theorem integral_mul_coord_ball_eq_zero (i j : Fin d) (hij : i ≠ j) (r : ℝ) :
    (∫ z in ball (0 : EuclSpaceM d) r, z.ofLp i * z.ofLp j) = 0 := by
  have h1 := integral_flip_mul_coord i j r
  have h2 := integral_flip_mul_coord_neg i j hij r
  linarith [h1, h2]
lemmaDiagonal.pow_sub_one_mul_sq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $y \in \mathbb{R}$.

Assume

  • $0 < d$ hd

Then $y ^{d - 1} \cdot y ^{2} = y ^{d + 1}$.

/-- Exponent arithmetic. `d - 1` is truncated natural subtraction, so this
genuinely needs `0 < d` and cannot be closed by `ring`. -/
lemma pow_sub_one_mul_sq {d : ℕ} (hd : 0 < d) (y : ℝ) :
    y ^ (d - 1) * y ^ 2 = y ^ (d + 1) := by
  rw [← pow_add]
  congr 1
  omega
lemmaDiagonal.smul_indicator_sq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $y \in \mathbb{R}$.

Assume

  • $0 < d$ hd

Then y ^ (d - 1) • (Set.Iio 1).indicator (fun t => t ^ 2) y = (Set.Iio 1).indicator (fun t => t ^ (d + 1)) y.

/-- Folding the radial weight into the cut-off indicator. -/
lemma smul_indicator_sq {d : ℕ} (hd : 0 < d) (y : ℝ) :
    y ^ (d - 1) • Set.indicator (Set.Iio (1:ℝ)) (fun t : ℝ => t ^ 2) y
      = Set.indicator (Set.Iio (1:ℝ)) (fun t : ℝ => t ^ (d + 1)) y := by
  by_cases h : y ∈ Set.Iio (1:ℝ)
  · simp only [Set.indicator_of_mem h, smul_eq_mul]
    exact pow_sub_one_mul_sq hd y
  · simp only [Set.indicator_of_notMem h, smul_zero]
lemmaDiagonal.integral_Ioi_indicator_pow
Formal statementgenerated from the Lean declaration

Let $n \in \mathbb{N}$.

Then ∫ (y : ℝ) in Set.Ioi 0, (Set.Iio 1).indicator (fun t => t ^ n) y = 1 / (↑n + 1).

Diagonal.integral_Ioi_indicator_powPlaplacian/BallMoments.lean, lines 244–256
/-- The one-dimensional value `∫_0^1 y ^ n dy = 1 / (n + 1)`, written with the
cut-off as an indicator over `Ioi 0` --- the exact shape that
`MeasureTheory.integral_fun_norm_addHaar` produces. -/
lemma integral_Ioi_indicator_pow (n : ℕ) :
    (∫ y in Set.Ioi (0:ℝ),
        Set.indicator (Set.Iio (1:ℝ)) (fun t : ℝ => t ^ n) y)
      = 1 / (n + 1 : ℝ) := by
  rw [MeasureTheory.setIntegral_indicator measurableSet_Iio,
      Set.Ioi_inter_Iio,
      ← MeasureTheory.integral_Ioc_eq_integral_Ioo,
      ← intervalIntegral.integral_of_le (by norm_num : (0:ℝ) ≤ 1),
      integral_pow]
  simp
theoremDiagonal.integral_radial_sq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Assume

  • $0 < d$ hd

Then ∫ (y : ℝ) in Set.Ioi 0, y ^ (d - 1) • (Set.Iio 1).indicator (fun t => t ^ 2) y = 1 / (↑d + 2).

/-- **The radial integral behind the constant `1 / (d + 2)`.** -/
theorem integral_radial_sq {d : ℕ} (hd : 0 < d) :
    (∫ y in Set.Ioi (0:ℝ), y ^ (d - 1) •
        Set.indicator (Set.Iio (1:ℝ)) (fun t : ℝ => t ^ 2) y)
      = 1 / (d + 2 : ℝ) := by
  rw [funext (smul_indicator_sq hd), integral_Ioi_indicator_pow]
  push_cast
  ring
lemmaDiagonal.integrableOn_sq_coord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(z \mapsto \operatorname{z.ofLp}(i) ^{2}, B(0, r), \lambda)$.

Diagonal.integrableOn_sq_coordPlaplacian/BallMoments.lean, lines 279–283
lemma integrableOn_sq_coord (i : Fin d) (r : ℝ) :
    MeasureTheory.IntegrableOn (fun z : EuclSpaceM d => (z.ofLp i) ^ 2)
      (Metric.ball (0 : EuclSpaceM d) r) :=
  (ContinuousOn.integrableOn_compact (isCompact_closedBall _ _)
    (by fun_prop)).mono_set Metric.ball_subset_closedBall
lemmaDiagonal.sum_sq_coord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $z \in \mathbb{R}^{d}$.

Then ∑ i, z.ofLp i ^ 2 = ‖z‖ ^ 2.

lemma sum_sq_coord (z : EuclSpaceM d) : ∑ i, (z.ofLp i) ^ 2 = ‖z‖ ^ 2 := by
  rw [EuclideanSpace.norm_eq, Real.sq_sqrt (by positivity)]
  simp [sq_abs]
lemmaDiagonal.integral_sum_sq_coord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $r \in \mathbb{R}$.

Then ∫ (z : EuclSpaceM d) in Metric.ball 0 r, ‖z‖ ^ 2 = ∑ i, ∫ (z : EuclSpaceM d) in Metric.ball 0 r, z.ofLp i ^ 2.

Diagonal.integral_sum_sq_coordPlaplacian/BallMoments.lean, lines 289–295
lemma integral_sum_sq_coord (r : ℝ) :
    (∫ z in Metric.ball (0 : EuclSpaceM d) r, ‖z‖ ^ 2)
      = ∑ i : Fin d, ∫ z in Metric.ball (0 : EuclSpaceM d) r, (z.ofLp i) ^ 2 := by
  rw [← MeasureTheory.integral_finsetSum Finset.univ
        fun i _ => integrableOn_sq_coord i r]
  refine MeasureTheory.setIntegral_congr_fun measurableSet_ball fun z _ => ?_
  exact (sum_sq_coord z).symm
defDiagonal.permEquiv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\sigma \in \operatorname{Equiv.Perm}(\operatorname{Fin}(d))$.

Its value lies in EuclSpaceM d ≃ₗᵢ[ℝ] EuclSpaceM d.

/-- Coordinate permutation as a linear isometry. Unlike `flipCoordEquiv`, this
comes free from `LinearIsometryEquiv.piLpCongrLeft`. -/
noncomputable def permEquiv (σ : Equiv.Perm (Fin d)) :
    EuclSpaceM d ≃ₗᵢ[ℝ] EuclSpaceM d :=
  LinearIsometryEquiv.piLpCongrLeft 2 ℝ ℝ σ
lemmaDiagonal.measurePreserving_perm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\sigma \in \operatorname{Equiv.Perm}(\operatorname{Fin}(d))$.

Then MeasureTheory.MeasurePreserving (⇑(Diagonal.permEquiv σ)) MeasureTheory.volume MeasureTheory.volume.

Diagonal.measurePreserving_permPlaplacian/BallMoments.lean, lines 303–305
lemma measurePreserving_perm (σ : Equiv.Perm (Fin d)) :
    MeasureTheory.MeasurePreserving (permEquiv (d := d) σ) volume volume :=
  LinearIsometryEquiv.measurePreserving _
lemmaDiagonal.permEquiv_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\sigma \in \operatorname{Equiv.Perm}(\operatorname{Fin}(d))$, $z \in \mathbb{R}^{d}$, $i \in \operatorname{Fin}(d)$.

Then ((Diagonal.permEquiv σ) z).ofLp i = z.ofLp ((Equiv.symm σ) i).

@[simp] lemma permEquiv_apply (σ : Equiv.Perm (Fin d)) (z : EuclSpaceM d)
    (i : Fin d) : (permEquiv σ z).ofLp i = z.ofLp (σ.symm i) := by
  simp [permEquiv, LinearIsometryEquiv.piLpCongrLeft]
lemmaDiagonal.measurableEmbedding_perm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\sigma \in \operatorname{Equiv.Perm}(\operatorname{Fin}(d))$.

Then MeasurableEmbedding ⇑(Diagonal.permEquiv σ).

Diagonal.measurableEmbedding_permPlaplacian/BallMoments.lean, lines 311–313
lemma measurableEmbedding_perm (σ : Equiv.Perm (Fin d)) :
    MeasurableEmbedding (permEquiv (d := d) σ) :=
  (permEquiv (d := d) σ).toHomeomorph.measurableEmbedding
lemmaDiagonal.integral_sq_coord_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i, j \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$.

Then $\int_{B(0, r)} (\operatorname{z.ofLp}(i) ^{2} = \int_{B(0, r)} \operatorname{z.ofLp}(j) ^{2} \, dz) \, dz$.

/-- All coordinates have the same second moment, by the swap permutation. -/
lemma integral_sq_coord_eq (i j : Fin d) (r : ℝ) :
    (∫ z in Metric.ball (0 : EuclSpaceM d) r, (z.ofLp i) ^ 2)
      = ∫ z in Metric.ball (0 : EuclSpaceM d) r, (z.ofLp j) ^ 2 := by
  have hpre : (permEquiv (d := d) (Equiv.swap i j)) ⁻¹'
      (Metric.ball (0 : EuclSpaceM d) r) = Metric.ball (0 : EuclSpaceM d) r := by
    ext z; simp [Metric.mem_ball, dist_zero_right]
  have key := (measurePreserving_perm (Equiv.swap i j)).setIntegral_preimage_emb
    (measurableEmbedding_perm _)
    (fun w : EuclSpaceM d => (w.ofLp i) ^ 2)
    (Metric.ball (0 : EuclSpaceM d) r)
  rw [hpre] at key
  rw [← key]
  refine MeasureTheory.setIntegral_congr_fun measurableSet_ball fun z _ => ?_
  simp [Equiv.swap_apply_def]
theoremDiagonal.integral_normSq_eq_nsmul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $r \in \mathbb{R}$.

Then $\int_{B(0, r)} (\lVert z\rVert ^{2} = d \cdot \int_{B(0, r)} \operatorname{z.ofLp}(i) ^{2} \, dz) \, dz$.

Diagonal.integral_normSq_eq_nsmulPlaplacian/BallMoments.lean, lines 331–337
/-- The sum collapses: `∫ ‖z‖ ^ 2 = d * ∫ z i ^ 2`. -/
theorem integral_normSq_eq_nsmul (i : Fin d) (r : ℝ) :
    (∫ z in Metric.ball (0 : EuclSpaceM d) r, ‖z‖ ^ 2)
      = (d : ℝ) * ∫ z in Metric.ball (0 : EuclSpaceM d) r, (z.ofLp i) ^ 2 := by
  rw [integral_sum_sq_coord,
      Finset.sum_congr rfl fun j _ => integral_sq_coord_eq j i r]
  simp [Finset.sum_const, Finset.card_univ]
lemmaDiagonal.mem_unitBall_iff
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $z \in \mathbb{R}^{d}$.

Then $z \in B(0, 1) \iff \lVert z\rVert < 1$.

lemma mem_unitBall_iff (z : EuclSpaceM d) :
    z ∈ Metric.ball (0 : EuclSpaceM d) 1 ↔ ‖z‖ < 1 := by
  simp [Metric.mem_ball, dist_zero_right]
lemmaDiagonal.integral_ball_eq_integral_indicator
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $g \colon \mathbb{R} \to \mathbb{R}$.

Then ∫ (z : EuclSpaceM d) in Metric.ball 0 1, g ‖z‖ = ∫ (z : EuclSpaceM d), (Set.Iio 1).indicator g ‖z‖.

Diagonal.integral_ball_eq_integral_indicatorPlaplacian/BallMoments.lean, lines 345–353
lemma integral_ball_eq_integral_indicator (g : ℝ → ℝ) :
    (∫ z in Metric.ball (0 : EuclSpaceM d) 1, g ‖z‖)
      = ∫ z : EuclSpaceM d, Set.indicator (Set.Iio (1:ℝ)) g ‖z‖ := by
  rw [← MeasureTheory.integral_indicator measurableSet_ball]
  refine MeasureTheory.integral_congr_ae
    (Filter.Eventually.of_forall fun z => ?_)
  by_cases h : ‖z‖ < 1
  · simp [Set.indicator_of_mem, (mem_unitBall_iff z).2 h, h]
  · simp [Set.indicator_of_notMem, h]
theoremDiagonal.integral_normSq_unitBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd

Then $\int_{B(0, 1)} (\lVert z\rVert ^{2} = d \cdot \operatorname{volume.real}(B(0, 1)) \cdot (1 / (d + 2))) \, dz$.

Diagonal.integral_normSq_unitBallPlaplacian/BallMoments.lean, lines 355–365
/-- The radial computation on the unit ball. -/
theorem integral_normSq_unitBall [Nontrivial (EuclSpaceM d)] (hd : 0 < d) :
    (∫ z in Metric.ball (0 : EuclSpaceM d) 1, ‖z‖ ^ 2)
      = (d : ℝ) * (volume.real (Metric.ball (0 : EuclSpaceM d) 1))
          * (1 / (d + 2 : ℝ)) := by
  rw [integral_ball_eq_integral_indicator (fun t : ℝ => t ^ 2),
      MeasureTheory.integral_fun_norm_addHaar volume
        (Set.indicator (Set.Iio (1:ℝ)) (fun t : ℝ => t ^ 2)),
      finrank_euclideanSpace_fin, integral_radial_sq hd]
  simp [nsmul_eq_mul, smul_eq_mul]
  ring
lemmaDiagonal.volumeReal_unitBall_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$

Then $0 < \operatorname{volume.real}(B(0, 1))$.

Diagonal.volumeReal_unitBall_posPlaplacian/BallMoments.lean, lines 369–376
lemma volumeReal_unitBall_pos [Nontrivial (EuclSpaceM d)] :
    0 < volume.real (Metric.ball (0 : EuclSpaceM d) 1) := by
  have h1 : volume (Metric.ball (0 : EuclSpaceM d) 1) ≠ 0 :=
    (measure_ball_pos volume 0 one_pos).ne'
  have h2 : volume (Metric.ball (0 : EuclSpaceM d) 1) ≠ ⊤ :=
    measure_ball_lt_top.ne
  simp only [MeasureTheory.Measure.real]
  exact ENNReal.toReal_pos h1 h2
theoremDiagonal.integral_sq_coord_unitBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd

Then $\int_{B(0, 1)} (\operatorname{z.ofLp}(i) ^{2} = \operatorname{volume.real}(B(0, 1)) / (d + 2)) \, dz$.

Diagonal.integral_sq_coord_unitBallPlaplacian/BallMoments.lean, lines 378–386
theorem integral_sq_coord_unitBall [Nontrivial (EuclSpaceM d)] (hd : 0 < d)
    (i : Fin d) :
    (∫ z in Metric.ball (0 : EuclSpaceM d) 1, (z.ofLp i) ^ 2)
      = volume.real (Metric.ball (0 : EuclSpaceM d) 1) / (d + 2 : ℝ) := by
  have hdne : (d : ℝ) ≠ 0 := Nat.cast_ne_zero.2 hd.ne'
  have h := (integral_normSq_eq_nsmul i 1).symm.trans
    (integral_normSq_unitBall hd)
  field_simp at h ⊢
  linarith [h]
theoremDiagonal.setAverage_sq_coord_unitBallTheorem 2.10 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd

Then $\fint_{B(0, 1)} (\operatorname{z.ofLp}(i) ^{2} = 1 / (d + 2)) \, dz$.

Diagonal.setAverage_sq_coord_unitBallPlaplacian/BallMoments.lean, lines 388–396
/-- **The diagonal second moment of the unit ball: the `1/(d+2)` of the
asymptotic expansion.** -/
theorem setAverage_sq_coord_unitBall [Nontrivial (EuclSpaceM d)] (hd : 0 < d)
    (i : Fin d) :
    (⨍ z in Metric.ball (0 : EuclSpaceM d) 1, (z.ofLp i) ^ 2)
      = 1 / (d + 2 : ℝ) := by
  rw [MeasureTheory.setAverage_eq, integral_sq_coord_unitBall hd i, smul_eq_mul]
  have hpos := volumeReal_unitBall_pos (d := d)
  field_simp

Plaplacian/BandEst.lean3 declarations

theoremcompl_nonempty
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $\Omega\text{ is bounded}$ hb

Then $\Omega^{c}\text{ is nonempty}$.

/-- **A bounded set in `ℝᵈ`, `d ≥ 1`, has nonempty complement.** -/
theorem compl_nonempty (hd : 0 < d) {Ω : Set (EuclSpace d)} (hb : Bornology.IsBounded Ω) :
    (Ωᶜ).Nonempty := by
  by_contra h
  rw [not_nonempty_iff_eq_empty, compl_empty_iff] at h
  obtain ⟨C, hC⟩ := isBounded_iff_forall_norm_le.1 hb
  set e := EuclideanSpace.single (⟨0, hd⟩ : Fin d) (1 : ℝ) with he
  have hen : ‖e‖ = 1 := by rw [he]; simp
  have h1 := hC ((|C| + 1) • e) (by rw [h]; exact mem_univ _)
  rw [norm_smul, hen, mul_one, Real.norm_eq_abs, abs_of_pos (by positivity)] at h1
  have := le_abs_self C
  linarith
theoremtendsto_norm_of_sq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{N} \to \mathbb{R}^{d}$.

Assume

  • $\operatorname{Tendsto}(n \mapsto \lVert v(n)\rVert ^{2}, \mathrm{atTop}, \operatorname{nhds}(0))$ h

Then $\operatorname{Tendsto}(n \mapsto \lVert v(n)\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$.

PLaplacian.tendsto_norm_of_sqPlaplacian/BandEst.lean, lines 48–55
/-- Norms tend to zero when their squares do. -/
theorem tendsto_norm_of_sq {v : ℕ → EuclSpace d}
    (h : Tendsto (fun n => ‖v n‖ ^ 2) atTop (𝓝 0)) :
    Tendsto (fun n => ‖v n‖) atTop (𝓝 0) := by
  have h1 := (Real.continuous_sqrt.tendsto 0).comp h
  rw [Real.sqrt_zero] at h1
  refine h1.congr fun n => ?_
  simp [Function.comp, Real.sqrt_sq (norm_nonneg _)]
theoremband_est
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{SU}, \mathrm{SL}, \mathrm{TU}, \mathrm{TL} \in \mathbb{R}$, $\theta \in \mathbb{R}$.

Assume

  • $\Omega\text{ is bounded}$ hΩb
  • $\Omega^{c}\text{ is nonempty}$ hΩc
  • $U\text{ is upper semicontinuous}$ hU
  • $V\text{ is lower semicontinuous}$ hV
  • $U\text{ is bounded above}$ hUb
  • $V\text{ is bounded below}$ hVb
  • $\forall x,\ U(x) \le \mathrm{SU}$ hSU
  • $\forall x,\ \mathrm{SL} \le U(x)$ hSL
  • $\forall x,\ V(x) \le \mathrm{TU}$ hTU
  • $\forall x,\ \mathrm{TL} \le V(x)$ hTL
  • $\forall x \in \partial \Omega,\ U(x) \le V(x)$ hbd
  • $0 < \theta$ hθ

Then there exists $\delta > 0$ such that:

  • $\exists \Lambda > 0,\ \forall \mathrm{lam},\ \Lambda \le \mathrm{lam} \to \forall x \in \overline{\Omega},\ \operatorname{infDist}(x, \Omega^{c}) \le 2 \cdot \delta \to \operatorname{regU}(\mathrm{lam}, U, x) - \operatorname{regV}(\mathrm{lam}, V, x) \le \theta$
/-- **The band estimate.** -/
theorem band_est {Ω : Set (EuclSpace d)} (hΩb : Bornology.IsBounded Ω) (hΩc : (Ωᶜ).Nonempty)
    {U V : EuclSpace d → ℝ} (hU : UpperSemicontinuous U) (hV : LowerSemicontinuous V)
    (hUb : BddAbove (range U)) (hVb : BddBelow (range V))
    {SU SL TU TL : ℝ} (hSU : ∀ x, U x ≤ SU) (hSL : ∀ x, SL ≤ U x)
    (hTU : ∀ x, V x ≤ TU) (hTL : ∀ x, TL ≤ V x)
    (hbd : ∀ x ∈ frontier Ω, U x ≤ V x) {θ : ℝ} (hθ : 0 < θ) :
    ∃ δ > 0, ∃ Λ > 0, ∀ lam, Λ ≤ lam → ∀ x ∈ closure Ω, infDist x Ωᶜ ≤ 2 * δ →
      regU lam U x - regV lam V x ≤ θ := by
  by_contra hcon
  push Not at hcon
  have hseq : ∀ n : ℕ, ∃ (lam : ℝ) (x : EuclSpace d), (n : ℝ) + 1 ≤ lam ∧ x ∈ closure Ω ∧
      infDist x Ωᶜ ≤ 2 * (1 / ((n : ℝ) + 1)) ∧ θ < regU lam U x - regV lam V x := by
    intro n
    obtain ⟨lam, hl, x, hx, h1, h2⟩ := hcon (1 / ((n : ℝ) + 1)) (by positivity) ((n : ℝ) + 1)
      (by positivity)
    exact ⟨lam, x, hl, hx, h1, h2⟩
  choose lams xs hlam hxs hinf hgt using hseq
  have hlam0 : ∀ n, 0 < lams n := fun n => lt_of_lt_of_le (by positivity) (hlam n)
  -- the maximizers
  have hb := bddAbove_neg_of_bddBelow hVb
  choose ys hys using fun n => supConv_attained (hlam0 n) hU hUb (xs n)
  choose zs hzs using fun n => supConv_attained (hlam0 n) (usc_neg_of_lsc hV) hb (xs n)
  -- θ < U(y) - V(z)
  have hUV : ∀ n, θ < U (ys n) - V (zs n) := by
    intro n
    have h1 := hgt n
    have e1 : regU (lams n) U (xs n) = supConv (lams n) U (xs n) := rfl
    have e2 : regV (lams n) V (xs n) = -supConv (lams n) (fun y => -V y) (xs n) := rfl
    rw [e1, e2, hys n, hzs n] at h1
    have a1 : 0 ≤ lams n / 2 * ‖ys n - xs n‖ ^ 2 := by have := hlam0 n; positivity
    have a2 : 0 ≤ lams n / 2 * ‖zs n - xs n‖ ^ 2 := by have := hlam0 n; positivity
    linarith
  -- the maximizers are close
  have hCU : 0 ≤ SU - SL := by linarith [hSU 0, hSL 0]
  have hCV : 0 ≤ TU - TL := by linarith [hTU 0, hTL 0]
  have hyclose : ∀ n, ‖ys n - xs n‖ ^ 2 ≤ 2 * (SU - SL) / ((n : ℝ) + 1) := by
    intro n
    have h1 := supConv_maximizer_close (hlam0 n).le hUb hSU (hys n)
    have h2 := hSL (xs n)
    have h3 : ‖ys n - xs n‖ ^ 2 ≤ 2 * (SU - SL) / lams n := by
      rw [le_div_iff₀ (hlam0 n)]; nlinarith
    exact h3.trans (div_le_div_of_nonneg_left (by linarith) (by positivity) (hlam n))
  have hzclose : ∀ n, ‖zs n - xs n‖ ^ 2 ≤ 2 * (TU - TL) / ((n : ℝ) + 1) := by
    intro n
    have h1 := supConv_maximizer_close (hlam0 n).le hb
      (fun x => (by linarith [hTL x] : -V x ≤ -TL)) (hzs n)
    have h2 := hTU (xs n)
    have h3 : ‖zs n - xs n‖ ^ 2 ≤ 2 * (TU - TL) / lams n := by
      rw [le_div_iff₀ (hlam0 n)]; nlinarith
    exact h3.trans (div_le_div_of_nonneg_left (by linarith) (by positivity) (hlam n))
  -- a convergent subsequence
  obtain ⟨xstar, hxstar, φ, hφ, hlim⟩ := tendsto_subseq_of_bounded hΩb.closure hxs
  have hφT : Tendsto (fun n => 1 / ((φ n : ℝ) + 1)) atTop (𝓝 0) :=
    tendsto_one_div_add_atTop_nhds_zero_nat.comp hφ.tendsto_atTop
  -- x* lies on the frontier
  have hinf0 : infDist xstar Ωᶜ = 0 := by
    have h1 : Tendsto (fun n => infDist (xs (φ n)) Ωᶜ) atTop (𝓝 (infDist xstar Ωᶜ)) :=
      ((continuous_infDist_pt Ωᶜ).tendsto xstar).comp hlim
    have h2 : Tendsto (fun n => 2 * (1 / ((φ n : ℝ) + 1))) atTop (𝓝 (2 * 0)) :=
      hφT.const_mul 2
    rw [mul_zero] at h2
    have h3 := le_of_tendsto_of_tendsto' h1 h2 (fun n => hinf (φ n))
    exact le_antisymm h3 infDist_nonneg
  have hfr : xstar ∈ frontier Ω := by
    rw [frontier_eq_closure_inter_closure]
    refine ⟨by rwa [closure_closure] at hxstar, ?_⟩
    exact (mem_closure_iff_infDist_zero hΩc).2 hinf0
  have hUVstar := hbd xstar hfr
  -- the maximizers converge to x*
  have hsqT : ∀ (w : ℕ → EuclSpace d) (C : ℝ), 0 ≤ C →
      (∀ n, ‖w n - xs n‖ ^ 2 ≤ 2 * C / ((n : ℝ) + 1)) →
      Tendsto (fun n => w (φ n)) atTop (𝓝 xstar) := by
    intro w C hC hw
    have h1 : Tendsto (fun n => ‖w (φ n) - xs (φ n)‖ ^ 2) atTop (𝓝 0) := by
      have h2 : Tendsto (fun n => 2 * C * (1 / ((φ n : ℝ) + 1))) atTop (𝓝 (2 * C * 0)) :=
        hφT.const_mul (2 * C)
      rw [mul_zero] at h2
      refine squeeze_zero (fun n => by positivity) (fun n => ?_) h2
      have := hw (φ n)
      rw [mul_one_div]
      exact this
    have h3 := tendsto_norm_of_sq (v := fun n => w (φ n) - xs (φ n)) h1
    have h4 : Tendsto (fun n => ‖xs (φ n) - xstar‖) atTop (𝓝 0) :=
      (tendsto_iff_norm_sub_tendsto_zero.1 hlim)
    rw [tendsto_iff_norm_sub_tendsto_zero]
    have h5 : Tendsto (fun n => ‖w (φ n) - xs (φ n)‖ + ‖xs (φ n) - xstar‖) atTop (𝓝 0) := by
      have := h3.add h4
      rwa [add_zero] at this
    refine squeeze_zero (fun n => norm_nonneg _) (fun n => ?_) h5
    have e : w (φ n) - xstar = (w (φ n) - xs (φ n)) + (xs (φ n) - xstar) := by abel
    rw [e]
    exact norm_add_le _ _
  have hyT := hsqT ys (SU - SL) hCU hyclose
  have hzT := hsqT zs (TU - TL) hCV hzclose
  -- semicontinuity at x*
  have hUev : ∀ᶠ n in atTop, U (ys (φ n)) < U xstar + θ / 2 :=
    hyT.eventually (hU xstar (U xstar + θ / 2) (by linarith))
  have hVev : ∀ᶠ n in atTop, V xstar - θ / 2 < V (zs (φ n)) :=
    hzT.eventually (hV xstar (V xstar - θ / 2) (by linarith))
  obtain ⟨n, h1, h2⟩ := (hUev.and hVev).exists
  have h3 := hUV (φ n)
  linarith

Plaplacian/BarrierPoly.lean8 declarations

defbpsi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $z \in \mathbb{R}^{d}$, $\delta, M \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The barrier.** -/
def bpsi (z : EuclSpace d) (δ M : ℝ) (x : EuclSpace d) : ℝ :=
  (‖x - z‖ ^ 2 - δ ^ 2) - M * (‖x - z‖ ^ 2 - δ ^ 2) ^ 2
defbM
Formal statementgenerated from the Lean declaration

Let $p, \delta \in \mathbb{R}$, $d \in \mathbb{N}$.

Its value lies in $\mathbb{R}$.

/-- The constant `M`. -/
def bM (p δ : ℝ) (d : ℕ) : ℝ := (2 * ((d : ℝ) + p - 2) + 1) / (8 * (p - 1) * δ ^ 2)
theorembpsi_contDiff
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $z \in \mathbb{R}^{d}$, $\delta, M \in \mathbb{R}$, $n \in \operatorname{WithTop}(\mathbb{N}, \infty)$.

Then $\operatorname{ContDiff}(\mathbb{R}, n, \operatorname{bpsi}(z, \delta, M))$.

theorem bpsi_contDiff (z : EuclSpace d) (δ M : ℝ) {n : WithTop ℕ∞} :
    ContDiff ℝ n (bpsi z δ M) := by
  have hs : ContDiff ℝ n (fun x : EuclSpace d => ‖x - z‖ ^ 2) :=
    (contDiff_norm_sq ℝ).comp (contDiff_id.sub contDiff_const)
  unfold bpsi
  exact (hs.sub contDiff_const).sub (contDiff_const.mul ((hs.sub contDiff_const).pow 2))
theorembpsi_expand
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $z \in \mathbb{R}^{d}$, $\delta, M \in \mathbb{R}$, $w, h \in \mathbb{R}^{d}$.

Then $\operatorname{bpsi}(z, \delta, M, w + h) - \operatorname{bpsi}(z, \delta, M, w) = 2 \cdot (1 - 2 \cdot M \cdot (\lVert w - z\rVert ^{2} - \delta ^{2})) \cdot \operatorname{inner}(\mathbb{R}, w - z, h) + ((1 - 2 \cdot M \cdot (\lVert w - z\rVert ^{2} - \delta ^{2})) \cdot \lVert h\rVert ^{2} - 4 \cdot M \cdot \operatorname{inner}(\mathbb{R}, w - z, h) ^{2}) + (- 4 \cdot M \cdot \operatorname{inner}(\mathbb{R}, w - z, h) \cdot \lVert h\rVert ^{2} - M \cdot \lVert h\rVert ^{4})$.

/-- **The exact expansion of the barrier.** -/
theorem bpsi_expand (z : EuclSpace d) (δ M : ℝ) (w h : EuclSpace d) :
    bpsi z δ M (w + h) - bpsi z δ M w
      = 2 * (1 - 2 * M * (‖w - z‖ ^ 2 - δ ^ 2)) * inner ℝ (w - z) h
        + ((1 - 2 * M * (‖w - z‖ ^ 2 - δ ^ 2)) * ‖h‖ ^ 2 - 4 * M * inner ℝ (w - z) h ^ 2)
        + (-4 * M * inner ℝ (w - z) h * ‖h‖ ^ 2 - M * ‖h‖ ^ 4) := by
  unfold bpsi
  have e : w + h - z = (w - z) + h := by abel
  rw [e, norm_add_sq_real]
  ring
theorembpsi_peano
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $M \in \mathbb{R}$, $z \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$, $w \in \mathbb{R}^{d}$.

Assume

  • $0 \le M$ hM

Then $\operatorname{PeanoAt}(\operatorname{bpsi}(z, \delta, M), w, (2 \cdot (1 - 2 \cdot M \cdot (\lVert w - z\rVert ^{2} - \delta ^{2}))) \cdot (w - z), (2 \cdot (1 - 2 \cdot M \cdot (\lVert w - z\rVert ^{2} - \delta ^{2}))) \cdot \operatorname{idForm}(d) - 8 \cdot M \cdot \operatorname{rankOne}(w - z))$.

/-- **The Peano expansion of the barrier.** -/
theorem bpsi_peano {M : ℝ} (hM : 0 ≤ M) (z : EuclSpace d) (δ : ℝ) (w : EuclSpace d) :
    PeanoAt (bpsi z δ M) w ((2 * (1 - 2 * M * (‖w - z‖ ^ 2 - δ ^ 2))) • (w - z))
      ((2 * (1 - 2 * M * (‖w - z‖ ^ 2 - δ ^ 2))) • idForm d - (8 * M) • rankOne (w - z)) := by
  intro ε hε
  set v := w - z with hv
  set c := 2 * (1 - 2 * M * (‖v‖ ^ 2 - δ ^ 2)) with hc
  set ρ := min 1 (ε / (4 * M * ‖v‖ + M + 1)) with hρ
  have hρ0 : 0 < ρ := lt_min one_pos (by positivity)
  refine ⟨ρ, hρ0, fun k hk => ?_⟩
  have hk1 : ‖k‖ ≤ 1 := le_trans hk.le (min_le_left _ _)
  have hk2 : ‖k‖ ≤ ε / (4 * M * ‖v‖ + M + 1) := le_trans hk.le (min_le_right _ _)
  have hexp := bpsi_expand z δ M w k
  rw [← hv] at hexp
  have hQ : inner ℝ (c • v) k = c * inner ℝ v k := real_inner_smul_left _ _ _
  have hX : ((c • idForm d - (8 * M) • rankOne v) k) k
      = c * ‖k‖ ^ 2 - 8 * M * (inner ℝ v k * inner ℝ v k) := by
    simp only [sub_apply, smul_apply, smul_eq_mul, idForm_apply, rankOne_apply]
  rw [hQ, hX]
  have key : bpsi z δ M (w + k) - bpsi z δ M w - c * inner ℝ v k
      - 1 / 2 * (c * ‖k‖ ^ 2 - 8 * M * (inner ℝ v k * inner ℝ v k))
      = -4 * M * inner ℝ v k * ‖k‖ ^ 2 - M * ‖k‖ ^ 4 := by
    rw [hexp, hc]; ring
  rw [key]
  -- the remainder
  have hvk : |inner ℝ v k| ≤ ‖v‖ * ‖k‖ := abs_real_inner_le_norm v k
  have hk0 : 0 ≤ ‖k‖ := norm_nonneg k
  have hk4 : ‖k‖ ^ 4 ≤ ‖k‖ ^ 3 := by
    have : ‖k‖ ^ 4 = ‖k‖ ^ 3 * ‖k‖ := by ring
    rw [this]
    calc ‖k‖ ^ 3 * ‖k‖ ≤ ‖k‖ ^ 3 * 1 := mul_le_mul_of_nonneg_left hk1 (by positivity)
      _ = ‖k‖ ^ 3 := mul_one _
  have hrem : |-4 * M * inner ℝ v k * ‖k‖ ^ 2 - M * ‖k‖ ^ 4|
      ≤ (4 * M * ‖v‖ + M) * ‖k‖ ^ 3 := by
    obtain ⟨a1, a2⟩ := abs_le.1 hvk
    have b1 : -(4 * M * (‖v‖ * ‖k‖) * ‖k‖ ^ 2) ≤ 4 * M * inner ℝ v k * ‖k‖ ^ 2 := by
      have := mul_le_mul_of_nonneg_right a1 (by positivity : (0 : ℝ) ≤ 4 * M * ‖k‖ ^ 2)
      nlinarith
    have b2 : 4 * M * inner ℝ v k * ‖k‖ ^ 2 ≤ 4 * M * (‖v‖ * ‖k‖) * ‖k‖ ^ 2 := by
      have := mul_le_mul_of_nonneg_right a2 (by positivity : (0 : ℝ) ≤ 4 * M * ‖k‖ ^ 2)
      nlinarith
    have b3 : 0 ≤ M * ‖k‖ ^ 4 := by positivity
    have b4 : M * ‖k‖ ^ 4 ≤ M * ‖k‖ ^ 3 := mul_le_mul_of_nonneg_left hk4 hM
    rw [abs_le]
    constructor <;> nlinarith
  have hfin : (4 * M * ‖v‖ + M) * ‖k‖ ^ 3 ≤ ε * ‖k‖ ^ 2 := by
    have h1 : (4 * M * ‖v‖ + M + 1) * ‖k‖ ≤ ε := by
      have := (le_div_iff₀ (by positivity : (0 : ℝ) < 4 * M * ‖v‖ + M + 1)).1 hk2
      linarith
    have h2 : (4 * M * ‖v‖ + M) * ‖k‖ ≤ ε := by nlinarith [norm_nonneg v]
    have := mul_le_mul_of_nonneg_right h2 (by positivity : (0 : ℝ) ≤ ‖k‖ ^ 2)
    nlinarith
  linarith
theoremnormPLapOf_idForm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $v \in \mathbb{R}^{d}$.

Assume

  • $v \ne 0$ hv

Then $\operatorname{normPLapOf}(p, v, \operatorname{idForm}(d)) = d + p - 2$.

/-- The operator at `(v, I)`. -/
theorem normPLapOf_idForm {p : ℝ} {v : EuclSpace d} (hv : v ≠ 0) :
    normPLapOf p v (idForm d) = (d : ℝ) + p - 2 := by
  have hvn : 0 < ‖v‖ := norm_pos_iff.2 hv
  unfold normPLapOf infLaplacianOf
  rw [laplacianOf_idForm, idForm_apply, norm_smul, norm_inv, norm_norm,
    inv_mul_cancel₀ hvn.ne', one_pow]
  ring
theorembpsi_opTheorem 7.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\delta \in \mathbb{R}$, $z, w \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < \delta$ hδ
  • $\delta ^{2} \le \lVert w - z\rVert ^{2}$ h1
  • $\lVert w - z\rVert ^{2} \le \delta ^{2} + 1 / 4 \cdot \operatorname{bM}(p, \delta, d)$ h2

Then all of the following hold:

  • $\operatorname{gradient}(\operatorname{bpsi}(z, \delta, \operatorname{bM}(p, \delta, d)), w) \ne 0$
  • $\operatorname{normPLapOf}(p, \operatorname{gradient}(\operatorname{bpsi}(z, \delta, \operatorname{bM}(p, \delta, d)), w), \operatorname{hess}(\operatorname{bpsi}(z, \delta, \operatorname{bM}(p, \delta, d)), w)) \le - 1$
/-- **On the shell, the barrier has nonzero gradient and `Δᴺₚψ ≤ -1`.** -/
theorem bpsi_op (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {δ : ℝ} (hδ : 0 < δ) (z : EuclSpace d)
    {w : EuclSpace d} (h1 : δ ^ 2 ≤ ‖w - z‖ ^ 2)
    (h2 : ‖w - z‖ ^ 2 ≤ δ ^ 2 + 1 / (4 * bM p δ d)) :
    gradient (bpsi z δ (bM p δ d)) w ≠ 0 ∧
      normPLapOf p (gradient (bpsi z δ (bM p δ d)) w) (hess (bpsi z δ (bM p δ d)) w)
        ≤ -1 := by
  have hp1 : 0 < p - 1 := by linarith
  have hd1 : (1 : ℝ) ≤ d := by exact_mod_cast hd
  have hD : 0 < (d : ℝ) + p - 2 := by linarith
  set M := bM p δ d with hMdef
  have hM : 0 < M := by rw [hMdef]; unfold bM; positivity
  set v := w - z with hv
  set t := ‖v‖ ^ 2 - δ ^ 2 with ht
  have ht0 : 0 ≤ t := by linarith
  have hMt : M * t ≤ 1 / 4 := by
    have : t ≤ 1 / (4 * M) := by linarith
    have h := mul_le_mul_of_nonneg_left this hM.le
    have e : M * (1 / (4 * M)) = 1 / 4 := by field_simp
    linarith
  set c := 2 * (1 - 2 * M * t) with hc
  have hc1 : 1 ≤ c := by rw [hc]; nlinarith
  have hc2 : c ≤ 2 := by rw [hc]; nlinarith [mul_nonneg hM.le ht0]
  have hv0 : v ≠ 0 := by
    intro h
    rw [h, norm_zero] at ht
    have : t = -δ ^ 2 := by rw [ht]; ring
    nlinarith [pow_pos hδ 2]
  -- the operator value, from the explicit expansion
  obtain ⟨hgrad, hval⟩ := normPLapOf_of_peano (p := p) (bpsi_contDiff z δ M)
    (bpsi_peano hM.le z δ w)
  rw [← hv, ← ht, ← hc] at hgrad hval
  have hcpos : 0 < c := by linarith
  refine ⟨?_, ?_⟩
  · rw [hgrad]; exact smul_ne_zero hcpos.ne' hv0
  · rw [hval, normPLapOf_cv_sub hv0 hcpos, normPLapOf_idForm hv0]
    -- c(d + p - 2) - 8M(p - 1)‖v‖² ≤ 2(d + p - 2) - 8M(p - 1)δ² = -1
    have hMδ : 8 * M * (p - 1) * δ ^ 2 = 2 * ((d : ℝ) + p - 2) + 1 := by
      rw [hMdef]; unfold bM; field_simp
    have k1 : c * ((d : ℝ) + p - 2) ≤ 2 * ((d : ℝ) + p - 2) :=
      mul_le_mul_of_nonneg_right hc2 hD.le
    have k2 : 8 * M * (p - 1) * δ ^ 2 ≤ (p - 1) * (8 * M) * ‖v‖ ^ 2 := by
      have := mul_le_mul_of_nonneg_left h1 (by positivity : (0 : ℝ) ≤ 8 * M * (p - 1))
      nlinarith
    linarith
theorembpsi_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $M, \delta \in \mathbb{R}$, $z, w \in \mathbb{R}^{d}$.

Assume

  • $0 < M$ hM
  • $\delta ^{2} \le \lVert w - z\rVert ^{2}$ h1
  • $\lVert w - z\rVert ^{2} \le \delta ^{2} + 1 / 4 \cdot M$ h2

Then $3 / 4 \cdot (\lVert w - z\rVert ^{2} - \delta ^{2}) \le \operatorname{bpsi}(z, \delta, M, w)$.

/-- **The barrier is nonnegative on the shell.** -/
theorem bpsi_nonneg {M δ : ℝ} (hM : 0 < M) (z : EuclSpace d) {w : EuclSpace d}
    (h1 : δ ^ 2 ≤ ‖w - z‖ ^ 2) (h2 : ‖w - z‖ ^ 2 ≤ δ ^ 2 + 1 / (4 * M)) :
    3 / 4 * (‖w - z‖ ^ 2 - δ ^ 2) ≤ bpsi z δ M w := by
  unfold bpsi
  set t := ‖w - z‖ ^ 2 - δ ^ 2 with ht
  have ht0 : 0 ≤ t := by linarith
  have hMt : M * t ≤ 1 / 4 := by
    have : t ≤ 1 / (4 * M) := by linarith
    have h := mul_le_mul_of_nonneg_left this hM.le
    have e : M * (1 / (4 * M)) = 1 / 4 := by field_simp
    linarith
  nlinarith

Plaplacian/Basic.lean1 declarations

defhello
Formal statementgenerated from the Lean declaration

Its value lies in $\mathrm{String}$.

def hello := "world"

Plaplacian/BdryEst.lean3 declarations

theorembdry_compare
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\delta \in \mathbb{R}$, $z \in \mathbb{R}^{d}$, $c, A, \tau, a, \varepsilon, \varepsilon_{0} \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\forall \varepsilon > 0,\ \forall x \notin \Omega,\ u_{\varepsilon}(x) = F(x)$ hout
  • $0 < \delta$ hδ
  • $0 < A$ hA
  • $0 \le \tau$ hτ0
  • $0 \le a$ ha
  • $0 < \varepsilon$ hε
  • $\forall y \in \operatorname{bShell}(z, \delta, \operatorname{bM}(p, \delta, d)),\ \forall \varepsilon',\ 0 < \varepsilon' \to \varepsilon' \le \varepsilon_{0} \to T_{\varepsilon'} x \mapsto c + A \cdot \operatorname{bpsi}(z, \delta, \operatorname{bM}(p, \delta, d), x)(y) \le c + A \cdot \operatorname{bpsi}(z, \delta, \operatorname{bM}(p, \delta, d), y) - A \cdot \varepsilon' ^{2} / (4 \cdot (p + d))$ hε₀
  • $\varepsilon \le \varepsilon_{0}$ hεε₀
  • $\operatorname{bM}(p, \delta, d) \cdot a \le 1$ hMa
  • $\tau \le 1 / 4 \cdot \operatorname{bM}(p, \delta, d)$ hτM
  • $\forall x \in \Omega,\ \lVert x - z\rVert ^{2} < \delta ^{2} + \tau \to \delta ^{2} \le \lVert x - z\rVert ^{2}$ hG1
  • $\forall w, y,\ y \in \Omega \to \lVert y - z\rVert ^{2} < \delta ^{2} + \tau \to \operatorname{dist}(w, y) < \varepsilon \to - a \le \lVert w - z\rVert ^{2} - \delta ^{2}$ hG2
  • $\forall w, y,\ y \in \Omega \to \lVert y - z\rVert ^{2} < \delta ^{2} + \tau \to \operatorname{dist}(w, y) < \varepsilon \to \lVert w - z\rVert ^{2} - \delta ^{2} \le 1 / 4 \cdot \operatorname{bM}(p, \delta, d)$ hG3
  • $C \le c + A \cdot 3 / 4 \cdot \tau$ hG4
  • $\forall w, y,\ w \notin \Omega \to y \in \Omega \to \lVert y - z\rVert ^{2} < \delta ^{2} + \tau \to \operatorname{dist}(w, y) < \varepsilon \to F(w) \le c - 2 \cdot A \cdot a$ hG5
  • $x \in \Omega$ a._@._internal._hyg.0
  • $\lVert x - z\rVert ^{2} < \delta ^{2} + \tau$ a._@._internal._hyg.0

Then $u_{\varepsilon}(x) \le c + A \cdot \operatorname{bpsi}(z, \delta, \operatorname{bM}(p, \delta, d), x)$.

theorem bdry_compare [Nontrivial (EuclSpace d)] (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    (hout : ∀ ε > 0, ∀ x, x ∉ Ω → u ε x = F x)
    {δ : ℝ} (hδ : 0 < δ) (z : EuclSpace d) {c A τ a ε ε₀ : ℝ}
    (hA : 0 < A) (hτ0 : 0 ≤ τ) (ha : 0 ≤ a) (hε : 0 < ε)
    (hε₀ : ∀ y ∈ bShell z δ (bM p δ d), ∀ ε' : ℝ, 0 < ε' → ε' ≤ ε₀ →
      tugOfWarOp p ε' (fun x => c + A * bpsi z δ (bM p δ d) x) y
        ≤ (c + A * bpsi z δ (bM p δ d) y) - A * ε' ^ 2 / (4 * (p + (d : ℝ))))
    (hεε₀ : ε ≤ ε₀) (hMa : bM p δ d * a ≤ 1) (hτM : τ ≤ 1 / (4 * bM p δ d))
    (hG1 : ∀ x, x ∈ Ω → ‖x - z‖ ^ 2 < δ ^ 2 + τ → δ ^ 2 ≤ ‖x - z‖ ^ 2)
    (hG2 : ∀ w y, y ∈ Ω → ‖y - z‖ ^ 2 < δ ^ 2 + τ → dist w y < ε →
      -a ≤ ‖w - z‖ ^ 2 - δ ^ 2)
    (hG3 : ∀ w y, y ∈ Ω → ‖y - z‖ ^ 2 < δ ^ 2 + τ → dist w y < ε →
      ‖w - z‖ ^ 2 - δ ^ 2 ≤ 1 / (4 * bM p δ d))
    (hG4 : C ≤ c + A * (3 / 4 * τ))
    (hG5 : ∀ w y, w ∉ Ω → y ∈ Ω → ‖y - z‖ ^ 2 < δ ^ 2 + τ → dist w y < ε →
      F w ≤ c - 2 * A * a) :
    ∀ x, x ∈ Ω → ‖x - z‖ ^ 2 < δ ^ 2 + τ → u ε x ≤ c + A * bpsi z δ (bM p δ d) x := by
  set M := bM p δ d with hMdef
  have hp1 : 0 < p - 1 := by linarith
  have hd1 : (1 : ℝ) ≤ d := by exact_mod_cast hd
  have hM : 0 < M := by
    rw [hMdef]; unfold bM
    have hD : 0 < (d : ℝ) + p - 2 := by linarith
    exact div_pos (by linarith) (mul_pos (mul_pos (by norm_num) hp1) (pow_pos hδ 2))
  set D := {x | x ∈ Ω ∧ ‖x - z‖ ^ 2 < δ ^ 2 + τ} with hDdef
  set v : EuclSpace d → ℝ := fun x => c + A * bpsi z δ M x with hvdef
  have hvc : Continuous v :=
    continuous_const.add (continuous_const.mul (bpsi_contDiff z δ M (n := 0)).continuous)
  -- v is bounded on the ε-neighbourhood of D
  set Q := a + 1 / (4 * M) with hQ
  have hQ0 : 0 ≤ Q := by positivity
  set B := |c| + A * (Q + M * Q ^ 2) + 1 with hB
  have hB0 : 0 ≤ B := by positivity
  have hNb : ∀ w, (∃ y ∈ D, dist w y < ε) → |v w| ≤ B := by
    rintro w ⟨y, ⟨hyΩ, hyD⟩, hwy⟩
    have hlo := hG2 w y hyΩ hyD hwy
    have hhi := hG3 w y hyΩ hyD hwy
    have hq4 : 0 ≤ 1 / (4 * M) := by positivity
    have ht : |‖w - z‖ ^ 2 - δ ^ 2| ≤ Q := abs_le.2 ⟨by linarith, by linarith⟩
    have ht2 : (‖w - z‖ ^ 2 - δ ^ 2) ^ 2 ≤ Q ^ 2 := by
      rw [← sq_abs]; exact pow_le_pow_left₀ (abs_nonneg _) ht 2
    have hψ := abs_bpsi_le hM.le z δ w
    have hψQ : |bpsi z δ M w| ≤ Q + M * Q ^ 2 := by
      have := mul_le_mul_of_nonneg_left ht2 hM.le
      linarith
    change |c + A * bpsi z δ M w| ≤ B
    calc |c + A * bpsi z δ M w| ≤ |c| + |A * bpsi z δ M w| := abs_add_le _ _
      _ = |c| + A * |bpsi z δ M w| := by rw [abs_mul, abs_of_pos hA]
      _ ≤ |c| + A * (Q + M * Q ^ 2) := by
          have := mul_le_mul_of_nonneg_left hψQ hA.le
          linarith
      _ ≤ B := by rw [hB]; linarith
  set v' := clampF B v with hv'def
  have hv'eq : ∀ w, (∃ y ∈ D, dist w y < ε) → v' w = v w := fun w hw => clampF_eq (hNb w hw)
  have hself : ∀ x ∈ D, ∃ y ∈ D, dist x y < ε := fun x hx => ⟨x, hx, by rw [dist_self]; exact hε⟩
  -- the hypotheses of the discrete comparison
  have hU : ∀ x ∈ D, u ε x = tugOfWarOp p ε (u ε) x := fun x hx => (hu ε hε).interior x hx.1
  have hκ : 0 < A * ε ^ 2 / (4 * (p + (d : ℝ))) := by positivity
  have hV : ∀ x ∈ D, tugOfWarOp p ε v' x ≤ v' x - A * ε ^ 2 / (4 * (p + (d : ℝ))) := by
    intro x hx
    have hball : ∀ y ∈ ball x ε, v' y = v y := fun y hy =>
      hv'eq y ⟨x, hx, by rw [mem_ball] at hy; exact hy⟩
    rw [tugOfWarOp_congr_ball hball, hv'eq x (hself x hx)]
    have hsh : x ∈ bShell z δ M := ⟨hG1 x hx.1 hx.2, by linarith [hx.2]⟩
    exact hε₀ x hsh ε hε hεε₀
  have hstrip : ∀ w, w ∉ D → (∃ y ∈ D, dist w y < ε) → u ε w ≤ v' w := by
    intro w hwD hw
    rw [hv'eq w hw]
    obtain ⟨y, ⟨hyΩ, hyD⟩, hwy⟩ := hw
    have hhi := hG3 w y hyΩ hyD hwy
    by_cases hwΩ : w ∈ Ω
    · have ht : δ ^ 2 + τ ≤ ‖w - z‖ ^ 2 := by
        by_contra h
        push Not at h
        exact hwD ⟨hwΩ, h⟩
      have hψ := bpsi_nonneg hM z (by linarith : δ ^ 2 ≤ ‖w - z‖ ^ 2)
        (by linarith : ‖w - z‖ ^ 2 ≤ δ ^ 2 + 1 / (4 * M))
      have h1 : A * (3 / 4 * τ) ≤ A * bpsi z δ M w :=
        mul_le_mul_of_nonneg_left (by linarith) hA.le
      have h2 := (abs_le.1 (hC ε w)).2
      change u ε w ≤ c + A * bpsi z δ M w
      linarith
    · have h1 := hout ε hε w hwΩ
      have h2 := hG5 w y hwΩ hyΩ hyD hwy
      have hψ := bpsi_ge_neg hM z δ ha hMa (hG2 w y hyΩ hyD hwy) hhi
      have h3 : A * (-(2 * a)) ≤ A * bpsi z δ M w := mul_le_mul_of_nonneg_left hψ hA.le
      change u ε w ≤ c + A * bpsi z δ M w
      linarith
  have hcomp := disc_comparison hp hpd hε (hu ε hε).bddMeas (bddMeas_clampF hB0 hvc) hU hκ hV
    hstrip
  intro x hxΩ hxD
  have h1 := hcomp x ⟨hxΩ, hxD⟩
  change u ε x ≤ v' x at h1
  rw [hv'eq x (hself x ⟨hxΩ, hxD⟩)] at h1
  exact h1
theorembdry_step
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $y_{0} \in \mathbb{R}^{d}$, $z_{0} \in \mathbb{R}^{d}$, $\delta_{0} \in \mathbb{R}$, $\eta_{1} \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\forall \varepsilon > 0,\ \forall x \notin \Omega,\ u_{\varepsilon}(x) = F(x)$ hout
  • $\operatorname{ContinuousAt}(F, y_{0})$ hFc
  • $0 < \delta_{0}$ hδ₀
  • $\lVert y_{0} - z_{0}\rVert = \delta_{0}$ hy₀z
  • $\forall x \in \Omega,\ \delta_{0} \le \lVert x - z_{0}\rVert$ hext
  • $0 < \eta_{1}$ hη₁

Then there exists $\varepsilon_{1} > 0$ such that:

  • $\exists r_{1} > 0,\ \forall \varepsilon,\ 0 < \varepsilon \to \varepsilon < \varepsilon_{1} \to \forall x \in B(y_{0}, r_{1}),\ u_{\varepsilon}(x) \le F(y_{0}) + 3 \cdot \eta_{1}$
theorem bdry_step [Nontrivial (EuclSpace d)] (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    (hout : ∀ ε > 0, ∀ x, x ∉ Ω → u ε x = F x)
    {y₀ : EuclSpace d} (hFc : ContinuousAt F y₀)
    {z₀ : EuclSpace d} {δ₀ : ℝ} (hδ₀ : 0 < δ₀) (hy₀z : ‖y₀ - z₀‖ = δ₀)
    (hext : ∀ x ∈ Ω, δ₀ ≤ ‖x - z₀‖) {η₁ : ℝ} (hη₁ : 0 < η₁) :
    ∃ ε₁ > 0, ∃ r₁ > 0, ∀ ε, 0 < ε → ε < ε₁ → ∀ x ∈ ball y₀ r₁,
      u ε x ≤ F y₀ + 3 * η₁ := by
  obtain ⟨r₀, hr₀, hF⟩ := Metric.continuousAt_iff.1 hFc η₁ hη₁
  have hC0 : 0 ≤ C := le_trans (abs_nonneg _) (hC 0 0)
  -- the smaller exterior ball
  obtain ⟨δ, hδdef⟩ : ∃ δ, δ = δ₀ / 2 := ⟨_, rfl⟩
  have hδ : 0 < δ := by rw [hδdef]; positivity
  obtain ⟨z, hz⟩ : ∃ z, z = z₀ + (1 / 2 : ℝ) • (y₀ - z₀) := ⟨_, rfl⟩
  have hyz : ‖y₀ - z‖ = δ := by
    have e : y₀ - z = (1 / 2 : ℝ) • (y₀ - z₀) := by rw [hz]; module
    rw [e, norm_smul, hy₀z, Real.norm_eq_abs, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 2),
      hδdef]
    ring
  -- the constants
  set M := bM p δ d with hMdef
  have hp1 : 0 < p - 1 := by linarith
  have hd1 : (1 : ℝ) ≤ d := by exact_mod_cast hd
  have hM : 0 < M := by
    rw [hMdef]; unfold bM
    have hD : 0 < (d : ℝ) + p - 2 := by linarith
    exact div_pos (by linarith) (mul_pos (mul_pos (by norm_num) hp1) (pow_pos hδ 2))
  set τ := min (1 / (8 * M)) (r₀ ^ 2 / 8) with hτdef
  have hτ : 0 < τ := lt_min (by positivity) (by positivity)
  have hτ1 : τ ≤ 1 / (8 * M) := min_le_left _ _
  have hτ2 : τ ≤ r₀ ^ 2 / 8 := min_le_right _ _
  have hτM : τ ≤ 1 / (4 * M) := by
    have : 1 / (8 * M) ≤ 1 / (4 * M) :=
      div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)
    linarith
  set c := F y₀ + 2 * η₁ with hc
  set A := 4 * (C + |c| + 1) / (3 * τ) with hAdef
  have hA : 0 < A := by positivity
  have hAτ : A * (3 / 4 * τ) = C + |c| + 1 := by rw [hAdef]; field_simp
  obtain ⟨ε₀, hε₀pos, hε₀⟩ := barrier_super hd hp hpd hδ z c hA
  set K3 := 2 * (δ ^ 2 + τ + 1) + 1 with hK3
  have hK30 : 0 < K3 := by positivity
  set ε₁ := min ε₀ (min (r₀ / 2) (min δ₀ (min 1 (min (η₁ / (2 * A * δ₀ + 1))
    (min (1 / (M * δ₀ + 1)) (1 / (8 * M * K3))))))) with hε₁def
  have hε₁ : 0 < ε₁ := by
    refine lt_min hε₀pos (lt_min (by positivity) (lt_min hδ₀ (lt_min one_pos
      (lt_min (by positivity) (lt_min (by positivity) (by positivity))))))
  set r₁ := min r₀ (min 1 (min (τ / (2 * δ + 2)) (η₁ / (A * (2 * δ + 1) + 1)))) with hr₁def
  have hr₁ : 0 < r₁ :=
    lt_min hr₀ (lt_min one_pos (lt_min (by positivity) (by positivity)))
  refine ⟨ε₁, hε₁, r₁, hr₁, fun ε hε hεε₁ x hx => ?_⟩
  -- the bounds on ε
  have hε1 : ε ≤ ε₀ := le_trans hεε₁.le (min_le_left _ _)
  have hε2 : ε ≤ r₀ / 2 := le_trans hεε₁.le (le_trans (min_le_right _ _) (min_le_left _ _))
  have hε3 : ε ≤ δ₀ := le_trans hεε₁.le (le_trans (min_le_right _ _)
    (le_trans (min_le_right _ _) (min_le_left _ _)))
  have hε4 : ε ≤ 1 := le_trans hεε₁.le (le_trans (min_le_right _ _)
    (le_trans (min_le_right _ _) (le_trans (min_le_right _ _) (min_le_left _ _))))
  have hε5 : ε ≤ η₁ / (2 * A * δ₀ + 1) := le_trans hεε₁.le (le_trans (min_le_right _ _)
    (le_trans (min_le_right _ _) (le_trans (min_le_right _ _)
      (le_trans (min_le_right _ _) (min_le_left _ _)))))
  have hε6 : ε ≤ 1 / (M * δ₀ + 1) := le_trans hεε₁.le (le_trans (min_le_right _ _)
    (le_trans (min_le_right _ _) (le_trans (min_le_right _ _)
      (le_trans (min_le_right _ _) (le_trans (min_le_right _ _) (min_le_left _ _))))))
  have hε7 : ε ≤ 1 / (8 * M * K3) := le_trans hεε₁.le (le_trans (min_le_right _ _)
    (le_trans (min_le_right _ _) (le_trans (min_le_right _ _)
      (le_trans (min_le_right _ _) (le_trans (min_le_right _ _) (min_le_right _ _))))))
  -- Apollonius, with e = 0 and with e = ε
  have hap : ∀ x, ∀ e : ℝ, 0 ≤ e → e ≤ δ₀ → δ₀ - e ≤ ‖x - z₀‖ →
      δ ^ 2 + ‖x - y₀‖ ^ 2 / 2 - δ₀ * e ≤ ‖x - z‖ ^ 2 := by
    intro x e he he' hx
    have h := apoll_ge hδ₀ hy₀z he he' hx
    rw [← hz, ← hδdef] at h
    exact h
  have hG1 : ∀ x, x ∈ Ω → ‖x - z‖ ^ 2 < δ ^ 2 + τ → δ ^ 2 ≤ ‖x - z‖ ^ 2 := by
    intro x hxΩ _
    have h := hap x 0 le_rfl hδ₀.le (by linarith [hext x hxΩ])
    have : 0 ≤ ‖x - y₀‖ ^ 2 / 2 := by positivity
    linarith
  have hclose : ∀ y, y ∈ Ω → ‖y - z‖ ^ 2 < δ ^ 2 + τ → ‖y - y₀‖ < r₀ / 2 := by
    intro y hyΩ hyD
    have h := hap y 0 le_rfl hδ₀.le (by linarith [hext y hyΩ])
    have h2 : ‖y - y₀‖ ^ 2 < (r₀ / 2) ^ 2 := by nlinarith
    exact lt_of_pow_lt_pow_left₀ 2 (by positivity) h2
  have hfar : ∀ w y, y ∈ Ω → dist w y < ε → δ₀ - ε ≤ ‖w - z₀‖ := by
    intro w y hyΩ hwy
    have h1 := hext y hyΩ
    have h2 : ‖y - z₀‖ ≤ ‖y - w‖ + ‖w - z₀‖ := by
      have := norm_add_le (y - w) (w - z₀)
      rwa [sub_add_sub_cancel] at this
    rw [dist_eq_norm, ← norm_neg, neg_sub] at hwy
    linarith
  have hG2 : ∀ w y, y ∈ Ω → ‖y - z‖ ^ 2 < δ ^ 2 + τ → dist w y < ε →
      -(δ₀ * ε) ≤ ‖w - z‖ ^ 2 - δ ^ 2 := by
    intro w y hyΩ _ hwy
    have h := hap w ε hε.le hε3 (hfar w y hyΩ hwy)
    have : 0 ≤ ‖w - y₀‖ ^ 2 / 2 := by positivity
    linarith
  have hG3 : ∀ w y, y ∈ Ω → ‖y - z‖ ^ 2 < δ ^ 2 + τ → dist w y < ε →
      ‖w - z‖ ^ 2 - δ ^ 2 ≤ 1 / (4 * M) := by
    intro w y _ hyD hwy
    have h1 : ‖w - z‖ ≤ ε + ‖y - z‖ := by
      have := norm_add_le (w - y) (y - z)
      rw [sub_add_sub_cancel] at this
      rw [dist_eq_norm] at hwy
      linarith
    have h2 : ‖w - z‖ ^ 2 ≤ (ε + ‖y - z‖) ^ 2 := by
      rw [sq, sq]; exact mul_self_le_mul_self (norm_nonneg _) h1
    have h3 : ‖y - z‖ ≤ ‖y - z‖ ^ 2 + 1 := by nlinarith [norm_nonneg (y - z)]
    have h4 : ε ^ 2 ≤ ε := by nlinarith
    have h5 : ε * K3 ≤ 1 / (8 * M) := by
      have := (le_div_iff₀ (by positivity : (0 : ℝ) < 8 * M * K3)).1 hε7
      rw [le_div_iff₀ (by positivity)]
      linarith
    have h6 : 2 * ε * ‖y - z‖ ≤ 2 * ε * (δ ^ 2 + τ + 1) :=
      mul_le_mul_of_nonneg_left (by linarith) (by positivity)
    have e : 1 / (8 * M) + 1 / (8 * M) = 1 / (4 * M) := by field_simp; ring
    nlinarith
  have hMa : M * (δ₀ * ε) ≤ 1 := by
    have := (le_div_iff₀ (by positivity : (0 : ℝ) < M * δ₀ + 1)).1 hε6
    nlinarith
  have hG4 : C ≤ c + A * (3 / 4 * τ) := by
    rw [hAτ]
    have := neg_abs_le c
    linarith
  have hG5 : ∀ w y, w ∉ Ω → y ∈ Ω → ‖y - z‖ ^ 2 < δ ^ 2 + τ → dist w y < ε →
      F w ≤ c - 2 * A * (δ₀ * ε) := by
    intro w y _ hyΩ hyD hwy
    have h1 := hclose y hyΩ hyD
    have h2 : dist w y₀ < r₀ := by
      have := dist_triangle w y y₀
      rw [dist_eq_norm y y₀] at this
      linarith
    have h3 := hF h2
    rw [Real.dist_eq] at h3
    have h4 : 2 * A * δ₀ * ε ≤ η₁ := by
      have := (le_div_iff₀ (by positivity : (0 : ℝ) < 2 * A * δ₀ + 1)).1 hε5
      nlinarith
    have := (abs_lt.1 h3).2
    rw [hc]
    nlinarith
  -- the estimate at x
  by_cases hxΩ : x ∈ Ω
  · have hxr : ‖x - y₀‖ < r₁ := by rw [mem_ball, dist_eq_norm] at hx; exact hx
    have hr11 : r₁ ≤ 1 := le_trans (min_le_right _ _) (min_le_left _ _)
    have hr12 : r₁ ≤ τ / (2 * δ + 2) :=
      le_trans (min_le_right _ _) (le_trans (min_le_right _ _) (min_le_left _ _))
    have hr13 : r₁ ≤ η₁ / (A * (2 * δ + 1) + 1) :=
      le_trans (min_le_right _ _) (le_trans (min_le_right _ _) (min_le_right _ _))
    have h1 : ‖x - z‖ < r₁ + δ := by
      have := norm_add_le (x - y₀) (y₀ - z)
      rw [sub_add_sub_cancel, hyz] at this
      linarith
    have h2 : ‖x - z‖ ^ 2 < (r₁ + δ) ^ 2 := by
      rw [sq, sq]; exact mul_self_lt_mul_self (norm_nonneg _) h1
    have h3 : (r₁ + δ) ^ 2 ≤ δ ^ 2 + (2 * δ + 1) * r₁ := by nlinarith
    have h4 : (2 * δ + 1) * r₁ < τ := by
      have := (le_div_iff₀ (by positivity : (0 : ℝ) < 2 * δ + 2)).1 hr12
      nlinarith
    have hxD : ‖x - z‖ ^ 2 < δ ^ 2 + τ := by linarith
    have hcmp := bdry_compare hd hp hpd hC hu hout hδ z hA hτ.le (by positivity : 0 ≤ δ₀ * ε) hε
      hε₀ hε1 hMa hτM hG1 hG2 hG3 hG4 hG5 x hxΩ hxD
    have h5 := bpsi_le_t hM.le z δ x
    have h6 : A * bpsi z δ M x ≤ A * ((2 * δ + 1) * r₁) :=
      mul_le_mul_of_nonneg_left (by linarith) hA.le
    have h7 : A * ((2 * δ + 1) * r₁) ≤ η₁ := by
      have := (le_div_iff₀ (by positivity : (0 : ℝ) < A * (2 * δ + 1) + 1)).1 hr13
      nlinarith
    rw [hc] at hcmp
    linarith
  · have h1 := hout ε hε x hxΩ
    have h2 : dist x y₀ < r₀ := lt_of_lt_of_le hx (min_le_left _ _)
    have h3 := hF h2
    rw [Real.dist_eq] at h3
    have := (abs_lt.1 h3).2
    linarith
theoremubar_le_bdryTheorem 7.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $y_{0} \in \mathbb{R}^{d}$, $z_{0} \in \mathbb{R}^{d}$, $\delta_{0} \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\forall \varepsilon > 0,\ \forall x \notin \Omega,\ u_{\varepsilon}(x) = F(x)$ hout
  • $\operatorname{ContinuousAt}(F, y_{0})$ hFc
  • $0 < \delta_{0}$ hδ₀
  • $\lVert y_{0} - z_{0}\rVert = \delta_{0}$ hy₀z
  • $\forall x \in \Omega,\ \delta_{0} \le \lVert x - z_{0}\rVert$ hext

Then $\overline{u}(y_{0}) \le F(y_{0})$.

/-- **`ubar u ≤ F` at a boundary point with an exterior sphere.** -/
theorem ubar_le_bdry [Nontrivial (EuclSpace d)] (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    (hout : ∀ ε > 0, ∀ x, x ∉ Ω → u ε x = F x)
    {y₀ : EuclSpace d} (hFc : ContinuousAt F y₀)
    {z₀ : EuclSpace d} {δ₀ : ℝ} (hδ₀ : 0 < δ₀) (hy₀z : ‖y₀ - z₀‖ = δ₀)
    (hext : ∀ x ∈ Ω, δ₀ ≤ ‖x - z₀‖) :
    ubar u y₀ ≤ F y₀ := by
  apply le_of_forall_pos_le_add
  intro η hη
  obtain ⟨ε₁, hε₁, r₁, hr₁, hb⟩ := bdry_step hd hp hpd hC hu hout hFc hδ₀ hy₀z hext
    (η₁ := η / 3) (by positivity)
  have h := ubar_le_of_bound u hC (S := Ioo 0 ε₁) (Ioo_mem_nhdsGT hε₁)
    (V := ball y₀ r₁) (b := F y₀ + 3 * (η / 3))
    (fun ε hε x hx => hb ε hε.1 hε.2 x hx) (ball_mem_nhds y₀ hr₁)
  linarith

Plaplacian/BdryPrep.lean10 declarations

theoremtugOfWarOp_congr_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $v, w \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\forall y \in B(x, \varepsilon),\ v(y) = w(y)$ h

Then $T_{\varepsilon} v(x) = T_{\varepsilon} w(x)$.

PLaplacian.tugOfWarOp_congr_ballPlaplacian/BdryPrep.lean, lines 35–42
/-- **The operator reads only values on the ball.** -/
theorem tugOfWarOp_congr_ball {p ε : ℝ} {v w : EuclSpace d → ℝ} {x : EuclSpace d}
    (h : ∀ y ∈ ball x ε, v y = w y) : tugOfWarOp p ε v x = tugOfWarOp p ε w x := by
  unfold tugOfWarOp
  rw [Set.image_congr h]
  have hae : (fun y => v y) =ᵐ[volume.restrict (ball x ε)] (fun y => w y) :=
    ae_restrict_of_forall_mem measurableSet_ball h
  rw [average_congr hae]
defclampF
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $B \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The clamp** of a function to `[-B, B]`. -/
def clampF (B : ℝ) (f : EuclSpace d → ℝ) : EuclSpace d → ℝ := fun x => max (min (f x) B) (-B)
theorembddMeas_clampF
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $B \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $0 \le B$ hB
  • $f\text{ is continuous}$ hf

Then $\operatorname{clampF}(B, f)\text{ is admissible (bounded and Borel measurable)}$.

theorem bddMeas_clampF {B : ℝ} (hB : 0 ≤ B) {f : EuclSpace d → ℝ} (hf : Continuous f) :
    BddMeas (clampF B f) := by
  refine ⟨((hf.min continuous_const).max continuous_const).measurable, ⟨B, fun y => ?_⟩⟩
  unfold clampF
  rw [abs_le]
  constructor
  · exact le_max_right _ _
  · exact max_le (min_le_right _ _) (by linarith)
theoremclampF_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $B \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\lvert f(x)\rvert \le B$ h

Then $\operatorname{clampF}(B, f, x) = f(x)$.

theorem clampF_eq {B : ℝ} {f : EuclSpace d → ℝ} {x : EuclSpace d} (h : |f x| ≤ B) :
    clampF B f x = f x := by
  unfold clampF
  obtain ⟨h1, h2⟩ := abs_le.1 h
  rw [min_eq_left h2, max_eq_left h1]
theoremnorm_sub_half_sq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $a, b \in \mathbb{R}^{d}$.

Then $\lVert a - 1 / 2 \cdot b\rVert ^{2} = (\lVert a\rVert ^{2} + \lVert a - b\rVert ^{2}) / 2 - \lVert b\rVert ^{2} / 4$.

PLaplacian.norm_sub_half_sqPlaplacian/BdryPrep.lean, lines 66–71
/-- The parallelogram identity in the form used for the midpoint. -/
theorem norm_sub_half_sq (a b : EuclSpace d) :
    ‖a - (1 / 2 : ℝ) • b‖ ^ 2 = (‖a‖ ^ 2 + ‖a - b‖ ^ 2) / 2 - ‖b‖ ^ 2 / 4 := by
  rw [norm_sub_sq_real a ((1 / 2 : ℝ) • b), norm_sub_sq_real a b, norm_smul,
    real_inner_smul_right, Real.norm_eq_abs, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 2)]
  ring
theoremmidpoint_sq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y_{0}, z_{0} \in \mathbb{R}^{d}$.

Then $\lVert x - (z_{0} + 1 / 2 \cdot (y_{0} - z_{0}))\rVert ^{2} = (\lVert x - z_{0}\rVert ^{2} + \lVert x - y_{0}\rVert ^{2}) / 2 - \lVert y_{0} - z_{0}\rVert ^{2} / 4$.

/-- **Apollonius's identity** for the midpoint `z₀ + ½(y₀ - z₀)`. -/
theorem midpoint_sq (x y₀ z₀ : EuclSpace d) :
    ‖x - (z₀ + (1 / 2 : ℝ) • (y₀ - z₀))‖ ^ 2
      = (‖x - z₀‖ ^ 2 + ‖x - y₀‖ ^ 2) / 2 - ‖y₀ - z₀‖ ^ 2 / 4 := by
  have e1 : x - (z₀ + (1 / 2 : ℝ) • (y₀ - z₀)) = (x - z₀) - (1 / 2 : ℝ) • (y₀ - z₀) := by
    abel
  have e2 : x - y₀ = (x - z₀) - (y₀ - z₀) := by abel
  rw [e1, e2]
  exact norm_sub_half_sq (x - z₀) (y₀ - z₀)
theoremapoll_ge
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\delta_{0} \in \mathbb{R}$, $y_{0}, z_{0} \in \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$, $e \in \mathbb{R}$.

Assume

  • $0 < \delta_{0}$ _hδ₀
  • $\lVert y_{0} - z_{0}\rVert = \delta_{0}$ hy
  • $0 \le e$ _he
  • $e \le \delta_{0}$ he'
  • $\delta_{0} - e \le \lVert x - z_{0}\rVert$ hx

Then $\delta_{0} / 2 ^{2} + \lVert x - y_{0}\rVert ^{2} / 2 - \delta_{0} \cdot e \le \lVert x - (z_{0} + 1 / 2 \cdot (y_{0} - z_{0}))\rVert ^{2}$.

/-- **The distance to the midpoint, from outside the exterior ball.** -/
theorem apoll_ge {δ₀ : ℝ} (_hδ₀ : 0 < δ₀) {y₀ z₀ : EuclSpace d} (hy : ‖y₀ - z₀‖ = δ₀)
    {x : EuclSpace d} {e : ℝ} (_he : 0 ≤ e) (he' : e ≤ δ₀) (hx : δ₀ - e ≤ ‖x - z₀‖) :
    (δ₀ / 2) ^ 2 + ‖x - y₀‖ ^ 2 / 2 - δ₀ * e ≤ ‖x - (z₀ + (1 / 2 : ℝ) • (y₀ - z₀))‖ ^ 2 := by
  rw [midpoint_sq, hy]
  have h1 : (δ₀ - e) ^ 2 ≤ ‖x - z₀‖ ^ 2 := by
    rw [sq, sq]; exact mul_self_le_mul_self (by linarith) hx
  nlinarith [sq_nonneg e]
theorembpsi_le_t
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $M \in \mathbb{R}$, $z \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 \le M$ hM

Then $\operatorname{bpsi}(z, \delta, M, x) \le \lVert x - z\rVert ^{2} - \delta ^{2}$.

theorem bpsi_le_t {M : ℝ} (hM : 0 ≤ M) (z : EuclSpace d) (δ : ℝ) (x : EuclSpace d) :
    bpsi z δ M x ≤ ‖x - z‖ ^ 2 - δ ^ 2 := by
  unfold bpsi
  have := mul_nonneg hM (sq_nonneg (‖x - z‖ ^ 2 - δ ^ 2))
  linarith
theorembpsi_ge_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $M \in \mathbb{R}$, $z \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $a \in \mathbb{R}$.

Assume

  • $0 < M$ hM
  • $0 \le a$ ha
  • $M \cdot a \le 1$ hMa
  • $- a \le \lVert x - z\rVert ^{2} - \delta ^{2}$ h1
  • $\lVert x - z\rVert ^{2} - \delta ^{2} \le 1 / 4 \cdot M$ h2

Then $- 2 \cdot a \le \operatorname{bpsi}(z, \delta, M, x)$.

theorem bpsi_ge_neg {M : ℝ} (hM : 0 < M) (z : EuclSpace d) (δ : ℝ) {x : EuclSpace d}
    {a : ℝ} (ha : 0 ≤ a) (hMa : M * a ≤ 1) (h1 : -a ≤ ‖x - z‖ ^ 2 - δ ^ 2)
    (h2 : ‖x - z‖ ^ 2 - δ ^ 2 ≤ 1 / (4 * M)) : -(2 * a) ≤ bpsi z δ M x := by
  rcases le_or_gt 0 (‖x - z‖ ^ 2 - δ ^ 2) with ht | ht
  · have := bpsi_nonneg hM z (by linarith : δ ^ 2 ≤ ‖x - z‖ ^ 2) (by linarith)
    linarith
  · unfold bpsi
    set t := ‖x - z‖ ^ 2 - δ ^ 2 with htdef
    have hsq : t ^ 2 ≤ a ^ 2 := by nlinarith
    have k1 : M * t ^ 2 ≤ M * a ^ 2 := mul_le_mul_of_nonneg_left hsq hM.le
    have k2 : M * a ^ 2 ≤ a := by
      have := mul_le_mul_of_nonneg_right hMa ha
      nlinarith
    linarith
theoremabs_bpsi_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $M \in \mathbb{R}$, $z \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 \le M$ hM

Then $\lvert \operatorname{bpsi}(z, \delta, M, x)\rvert \le \lvert \lVert x - z\rVert ^{2} - \delta ^{2}\rvert + M \cdot (\lVert x - z\rVert ^{2} - \delta ^{2}) ^{2}$.

theorem abs_bpsi_le {M : ℝ} (hM : 0 ≤ M) (z : EuclSpace d) (δ : ℝ) (x : EuclSpace d) :
    |bpsi z δ M x| ≤ |‖x - z‖ ^ 2 - δ ^ 2| + M * (‖x - z‖ ^ 2 - δ ^ 2) ^ 2 := by
  unfold bpsi
  calc |(‖x - z‖ ^ 2 - δ ^ 2) - M * (‖x - z‖ ^ 2 - δ ^ 2) ^ 2|
      ≤ |‖x - z‖ ^ 2 - δ ^ 2| + |M * (‖x - z‖ ^ 2 - δ ^ 2) ^ 2| := abs_sub _ _
    _ = |‖x - z‖ ^ 2 - δ ^ 2| + M * (‖x - z‖ ^ 2 - δ ^ 2) ^ 2 := by
        rw [abs_of_nonneg (mul_nonneg hM (sq_nonneg _) :
          0 ≤ M * (‖x - z‖ ^ 2 - δ ^ 2) ^ 2)]

Plaplacian/Bounds.lean4 declarations

theorembound_one
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u, \mathrm{wl}, \mathrm{wk} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $\mathrm{wl}\text{ is admissible (bounded and Borel measurable)}$ hwl
  • $\mathrm{wk}\text{ is admissible (bounded and Borel measurable)}$ hwk
  • $\forall y,\ \operatorname{wl}(y) \le u(y)$ hlu
  • $\forall y,\ \lvert u(y) - \operatorname{wk}(y)\rvert \le C$ hC

Then PLaplacian.tugOfWarOp p ε wl x₀ - PLaplacian.tugOfWarOp p ε wk x₀ ≤ (p - 2) / (p + ↑d) * sSup ((fun y => u y - wk y) '' Metric.ball x₀ ε) + (↑d + 2) / (p + ↑d) * ⨍ (y : EuclSpace d) in Metric.ball x₀ ε, u y - wk y.

/-- **The chained estimate.** -/
theorem bound_one (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {u wl wk : EuclSpace d → ℝ}
    (hu : BddMeas u) (hwl : BddMeas wl) (hwk : BddMeas wk)
    (hlu : ∀ y, wl y ≤ u y)
    {C : ℝ} (hC : ∀ y, |u y - wk y| ≤ C)
    (x₀ : EuclSpace d) :
    tugOfWarOp p ε wl x₀ - tugOfWarOp p ε wk x₀
      ≤ (p - 2) / (p + (d : ℝ))
          * sSup ((fun y => u y - wk y) '' ball x₀ ε)
        + ((d : ℝ) + 2) / (p + (d : ℝ))
            * ⨍ y in ball x₀ ε, (u y - wk y) := by
  have hkey := key_estimate p ε hp hε hpd hwk hwl x₀
  have hα : (0 : ℝ) ≤ (p - 2) / (p + (d : ℝ)) :=
    div_nonneg (by linarith) hpd.le
  have hβ : (0 : ℝ) ≤ ((d : ℝ) + 2) / (p + (d : ℝ)) := by positivity
  have hsup : sSup ((fun y => wl y - wk y) '' ball x₀ ε)
      ≤ sSup ((fun y => u y - wk y) '' ball x₀ ε) :=
    sSup_diff_mono (nonempty_ball x₀ hε) hlu hC
  have havg : (⨍ y in ball x₀ ε, (wl y - wk y))
      ≤ ⨍ y in ball x₀ ε, (u y - wk y) :=
    setAverage_diff_mono hlu x₀
      ((hwl.sub hwk).integrableOn_ball x₀ ε)
      ((hu.sub hwk).integrableOn_ball x₀ ε)
  have h1 := mul_le_mul_of_nonneg_left hsup hα
  have h2 := mul_le_mul_of_nonneg_left havg hβ
  linarith [hkey, h1, h2]
theorembound_two
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $u, w \colon \mathbb{R}^{d} \to \mathbb{R}$, $M, \delta, C \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\forall x,\ \lvert u(x) - w(x)\rvert \le C$ hC
  • $\operatorname{deficitSup}(\Omega_{\varepsilon}, u, w) \le M + \delta$ hk
  • $x_{0} \in \Omega$ hx₀
  • $0 < \varepsilon$ hε

Then sSup ((fun y => u y - w y) '' Metric.ball x₀ ε) ≤ M + δ.

/-- **The supremum bound.** Needs `ball_subset_closureEps`, since the ball is
not contained in the domain. -/
theorem bound_two {Ω : Set (EuclSpace d)} {ε : ℝ}
    {u w : EuclSpace d → ℝ} {M δ C : ℝ}
    (hC : ∀ x, |u x - w x| ≤ C)
    (hk : deficitSup (closureEps Ω ε) u w ≤ M + δ)
    {x₀ : EuclSpace d} (hx₀ : x₀ ∈ Ω) (hε : 0 < ε) :
    sSup ((fun y => u y - w y) '' ball x₀ ε) ≤ M + δ := by
  refine csSup_le ⟨u x₀ - w x₀, x₀, mem_ball_self hε, rfl⟩ ?_
  rintro a ⟨y, hy, rfl⟩
  have hmem : y ∈ closureEps Ω ε := ball_subset_closureEps Ω hx₀ hy
  exact le_trans (le_csSup (bddAbove_deficit hC) ⟨y, hmem, rfl⟩) hk
theorembound_three
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $u, w \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\beta, \eta \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\forall y,\ 0 \le u(y) - w(y)$ hnn
  • $\operatorname{IntegrableOn}(y \mapsto u(y) - w(y), \Omega_{\varepsilon}, \lambda)$ hint
  • $x_{0} \in \Omega$ hx₀
  • $0 \le \beta$ hβ
  • $\int_{\Omega_{\varepsilon}} (u(y) - w(y) \le \eta) \, dy$ hsmall

Then $\beta \cdot \fint_{B(x_{0}, \varepsilon)} (u(y) - w(y) \le \beta \cdot (\operatorname{volume.real}(B(0, \varepsilon)))(^{-1}) \cdot \eta) \, dy$.

/-- **The average bound.** -/
theorem bound_three {Ω : Set (EuclSpace d)} {ε : ℝ} (hε : 0 < ε)
    {u w : EuclSpace d → ℝ}
    (hnn : ∀ y, 0 ≤ u y - w y)
    (hint : MeasureTheory.IntegrableOn (fun y => u y - w y) (closureEps Ω ε))
    {x₀ : EuclSpace d} (hx₀ : x₀ ∈ Ω)
    {β η : ℝ} (hβ : 0 ≤ β)
    (hsmall : (∫ y in closureEps Ω ε, (u y - w y)) ≤ η) :
    β * (⨍ y in ball x₀ ε, (u y - w y))
      ≤ β * ((volume.real (ball (0 : EuclSpace d) ε))⁻¹ * η) := by
  refine mul_le_mul_of_nonneg_left ?_ hβ
  refine le_trans (setAverage_le_integral_div _ hnn hint x₀ hε
    (ball_subset_closureEps Ω hx₀)) ?_
  have hpos : (0 : ℝ) ≤ (volume.real (ball (0 : EuclSpace d) ε))⁻¹ := by
    positivity
  exact mul_le_mul_of_nonneg_left hsmall hpos
theorembound_three_eta
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\beta, \delta \in \mathbb{R}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \beta$ hβ
  • $0 < \operatorname{volume.real}(B(0, \varepsilon))$ hvol
  • $0 < \delta$ hδ

Then all of the following hold:

  • $0 < \delta \cdot \operatorname{volume.real}(B(0, \varepsilon)) / \beta$
  • $\beta \cdot (\operatorname{volume.real}(B(0, \varepsilon)))(^{-1}) \cdot \delta \cdot \operatorname{volume.real}(B(0, \varepsilon)) / \beta = \delta$
PLaplacian.bound_three_etaPlaplacian/Bounds.lean, lines 103–111
/-- The target for the global integral making the average bound exactly
`delta`. -/
theorem bound_three_eta {β δ : ℝ} (hβ : 0 < β) {ε : ℝ}
    (hvol : (0 : ℝ) < volume.real (ball (0 : EuclSpace d) ε)) (hδ : 0 < δ) :
    0 < δ * volume.real (ball (0 : EuclSpace d) ε) / β
    ∧ β * ((volume.real (ball (0 : EuclSpace d) ε))⁻¹
        * (δ * volume.real (ball (0 : EuclSpace d) ε) / β)) = δ := by
  refine ⟨by positivity, ?_⟩
  field_simp

Plaplacian/C2Diff.lean1 declarations

theoremtaylorErr_le_on_ball_c2
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < \eta$ hη

Then there exists $\delta > 0$ such that:

  • $\forall \varepsilon,\ 0 < \varepsilon \to \varepsilon < \delta \to \forall z \in B(0, \varepsilon),\ \lvert \operatorname{taylorErr}(\varphi, x, z)\rvert \le \eta \cdot \varepsilon ^{2}$
PLaplacian.taylorErr_le_on_ball_c2Plaplacian/C2Diff.lean, lines 56–74
/-- **The average error at `C²`, bounded on a ball.**

For every prescribed multiple there is a radius within which the Taylor error
is below that multiple of the squared radius, throughout the ball. -/
theorem taylorErr_le_on_ball_c2 {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∃ δ > 0, ∀ ε : ℝ, 0 < ε → ε < δ →
      ∀ z ∈ ball (0 : EuclSpace d) ε, |taylorErr φ x z| ≤ η * ε ^ 2 := by
  obtain ⟨δ, hδ, hbd⟩ := exists_taylorErr_le hφ x hη
  refine ⟨δ, hδ, fun ε hε hεδ z hz => ?_⟩
  have hzn : ‖z‖ < ε := by
    rw [mem_ball, dist_zero_right] at hz
    exact hz
  have hzδ : ‖z‖ < δ := lt_trans hzn hεδ
  have h1 := hbd z hzδ
  have hz2 : ‖z‖ ^ 2 ≤ ε ^ 2 := by
    have h0 : (0:ℝ) ≤ ‖z‖ := norm_nonneg z
    nlinarith [hzn, h0, hε]
  nlinarith [h1, hz2, hη.le, sq_nonneg ‖z‖]

Plaplacian/C2Expand.lean3 declarations

theoremexists_err2_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < \eta$ hη

Then there exists $\delta > 0$ such that:

  • $\forall w,\ \lVert w\rVert < \delta \to \lvert \operatorname{err2}(\varphi, x, w)\rvert \le \eta \cdot \lVert w\rVert ^{2}$
/-- **The `C²` second-order Taylor estimate.** -/
theorem exists_err2_le {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∃ δ > 0, ∀ w : EuclSpace d, ‖w‖ < δ →
      |err2 φ x w| ≤ η * ‖w‖ ^ 2 := by
  obtain ⟨δ, hδ, hbd⟩ := fderiv_increment_small hφ x hη
  exact ⟨δ, hδ, fun w hw => err2_le hφ x hη hbd hw⟩
theoremtaylorErr_eq_err2
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w \in \mathbb{R}^{d}$.

Then $\operatorname{taylorErr}(\varphi, x, w) = \operatorname{err2}(\varphi, x, w)$.

PLaplacian.taylorErr_eq_err2Plaplacian/C2Expand.lean, lines 60–64
/-- The error of `Plaplacian.AvgExpansion` and the error here agree. -/
theorem taylorErr_eq_err2 (φ : EuclSpace d → ℝ) (x w : EuclSpace d) :
    taylorErr φ x w = err2 φ x w := by
  unfold taylorErr err2
  ring
theoremexists_taylorErr_leTheorem 3.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < \eta$ hη

Then there exists $\delta > 0$ such that:

  • $\forall w,\ \lVert w\rVert < \delta \to \lvert \operatorname{taylorErr}(\varphi, x, w)\rvert \le \eta \cdot \lVert w\rVert ^{2}$
PLaplacian.exists_taylorErr_lePlaplacian/C2Expand.lean, lines 66–74
/-- **The `C²` estimate for the expansion's error.** -/
theorem exists_taylorErr_le {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∃ δ > 0, ∀ w : EuclSpace d, ‖w‖ < δ →
      |taylorErr φ x w| ≤ η * ‖w‖ ^ 2 := by
  obtain ⟨δ, hδ, hbd⟩ := exists_err2_le hφ x hη
  refine ⟨δ, hδ, fun w hw => ?_⟩
  rw [taylorErr_eq_err2]
  exact hbd w hw

Plaplacian/C2Taylor.lean2 declarations

theoremerr2_zero'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\operatorname{err2}(\varphi, x, 0) = 0$.

/-- The error vanishes at the origin. -/
theorem err2_zero' (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    err2 φ x 0 = 0 := by
  unfold err2
  simp
theoremerr2_leTheorem 3.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta, \delta \in \mathbb{R}$, $w \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < \eta$ hη
  • $\forall v,\ \lVert v\rVert < \delta \to \lVert \operatorname{fderiv}(\mathbb{R}, \varphi, x + v) - \operatorname{fderiv}(\mathbb{R}, \varphi, x) - (\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(v)\rVert \le \eta \cdot \lVert v\rVert$ hbd
  • $\lVert w\rVert < \delta$ hw

Then $\lvert \operatorname{err2}(\varphi, x, w)\rvert \le \eta \cdot \lVert w\rVert ^{2}$.

/-- **The second-order Taylor error bound for a `C²` function.**

Given the derivative bound, the error at `w` is at most the same bound. -/
theorem err2_le {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {η δ : ℝ} (hη : 0 < η)
    (hbd : ∀ v : EuclSpace d, ‖v‖ < δ →
      ‖fderiv ℝ φ (x + v) - fderiv ℝ φ x
          - fderiv ℝ (fderiv ℝ φ) x v‖ ≤ η * ‖v‖)
    {w : EuclSpace d} (hw : ‖w‖ < δ) :
    |err2 φ x w| ≤ η * ‖w‖ ^ 2 := by
  -- the scalar function along the ray
  set g : ℝ → ℝ := fun s => err2 φ x (s • w) with hg
  -- its derivative
  have hderiv : ∀ t ∈ Icc (0:ℝ) 1,
      HasDerivWithinAt g
        (fderiv ℝ φ (x + t • w) w - fderiv ℝ φ x w
          - t * fderiv ℝ (fderiv ℝ φ) x w w) (Icc (0:ℝ) 1) t := by
    intro t _
    exact (hasDerivAt_err2 hφ x w t).hasDerivWithinAt
  -- and its bound
  have hdbd : ∀ t ∈ Icc (0:ℝ) 1,
      ‖fderiv ℝ φ (x + t • w) w - fderiv ℝ φ x w
          - t * fderiv ℝ (fderiv ℝ φ) x w w‖ ≤ η * ‖w‖ ^ 2 := by
    intro t ht
    exact err2_deriv_bound hφ x hη hbd hw ht
  -- the mean value inequality
  have hmv : ‖g 1 - g 0‖ ≤ η * ‖w‖ ^ 2 * ‖(1:ℝ) - 0‖ :=
    Convex.norm_image_sub_le_of_norm_hasDerivWithin_le hderiv hdbd
      (convex_Icc 0 1) (by norm_num) (by norm_num)
  -- g 0 = 0 and g 1 = err2 φ x w
  have hg0 : g 0 = 0 := by
    rw [hg]; simp only [zero_smul]; exact err2_zero' φ x
  have hg1 : g 1 = err2 φ x w := by
    rw [hg]; simp only [one_smul]
  rw [hg0, hg1, sub_zero] at hmv
  simpa using hmv

Plaplacian/CVJet.lean8 declarations

theoremnormPLapOf_cv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, $a, b \in \mathbb{R}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $q \ne 0$ hq
  • $0 < a$ ha

Then $\operatorname{normPLapOf}(p, a \cdot q, a \cdot X + b \cdot \operatorname{rankOne}(q)) = a \cdot \operatorname{normPLapOf}(p, q, X) + (p - 1) \cdot b \cdot \lVert q\rVert ^{2}$.

PLaplacian.normPLapOf_cvPlaplacian/CVJet.lean, lines 38–57
/-- **The operator after a change of values**, for `a > 0` and `q ≠ 0`. -/
theorem normPLapOf_cv {p : ℝ} {q : EuclSpace d} (hq : q ≠ 0) {a b : ℝ} (ha : 0 < a)
    (X : Bilin d) :
    normPLapOf p (a • q) (a • X + b • rankOne q)
      = a * normPLapOf p q X + (p - 1) * b * ‖q‖ ^ 2 := by
  have hqn : 0 < ‖q‖ := norm_pos_iff.2 hq
  unfold normPLapOf infLaplacianOf
  rw [laplacianOf_add, laplacianOf_smul, laplacianOf_smul, laplacianOf_rankOne]
  have hn : ‖a • q‖ = a * ‖q‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_pos ha]
  have he : ‖a • q‖⁻¹ • (a • q) = ‖q‖⁻¹ • q := by
    rw [hn, smul_smul]
    congr 1
    field_simp
  rw [he]
  have h2 : inner ℝ q (‖q‖⁻¹ • q) = ‖q‖ := by
    rw [real_inner_smul_right, real_inner_self_eq_norm_sq]
    field_simp
  rw [add_apply, add_apply, smul_apply, smul_apply, smul_apply, smul_apply, smul_eq_mul,
    smul_eq_mul, rankOne_apply, h2]
  ring
theoremnormPLapOf_cv_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, $a, b \in \mathbb{R}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $q \ne 0$ hq
  • $0 < a$ ha

Then $\operatorname{normPLapOf}(p, a \cdot q, a \cdot X - b \cdot \operatorname{rankOne}(q)) = a \cdot \operatorname{normPLapOf}(p, q, X) - (p - 1) \cdot b \cdot \lVert q\rVert ^{2}$.

PLaplacian.normPLapOf_cv_subPlaplacian/CVJet.lean, lines 59–78
/-- **The operator after a change of values**, subtraction form. -/
theorem normPLapOf_cv_sub {p : ℝ} {q : EuclSpace d} (hq : q ≠ 0) {a b : ℝ} (ha : 0 < a)
    (X : Bilin d) :
    normPLapOf p (a • q) (a • X - b • rankOne q)
      = a * normPLapOf p q X - (p - 1) * b * ‖q‖ ^ 2 := by
  have hqn : 0 < ‖q‖ := norm_pos_iff.2 hq
  unfold normPLapOf infLaplacianOf
  rw [laplacianOf_sub, laplacianOf_smul, laplacianOf_smul, laplacianOf_rankOne]
  have hn : ‖a • q‖ = a * ‖q‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_pos ha]
  have he : ‖a • q‖⁻¹ • (a • q) = ‖q‖⁻¹ • q := by
    rw [hn, smul_smul]
    congr 1
    field_simp
  rw [he]
  have h2 : inner ℝ q (‖q‖⁻¹ • q) = ‖q‖ := by
    rw [real_inner_smul_right, real_inner_self_eq_norm_sq]
    field_simp
  rw [sub_apply, sub_apply, smul_apply, smul_apply, smul_apply, smul_apply, smul_eq_mul,
    smul_eq_mul, rankOne_apply, h2]
  ring
theoremnormPLapOf_cv_strictTheorem 6.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, $c, \eta \in \mathbb{R}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $2 \le p$ _hp
  • $q \ne 0$ hq
  • $0 < c$ hc
  • $0 \le \eta$ _hη
  • $\operatorname{normPLapOf}(p, q, X) \le 0$ hX

Then $\operatorname{normPLapOf}(p, c \cdot q, c \cdot X - 2 \cdot \eta \cdot \operatorname{rankOne}(q)) \le - (2 \cdot \eta \cdot (p - 1) \cdot \lVert q\rVert ^{2})$.

PLaplacian.normPLapOf_cv_strictPlaplacian/CVJet.lean, lines 80–86
/-- **Strictness away from critical points.** -/
theorem normPLapOf_cv_strict {p : ℝ} (_hp : 2 ≤ p) {q : EuclSpace d} (hq : q ≠ 0)
    {c η : ℝ} (hc : 0 < c) (_hη : 0 ≤ η) {X : Bilin d} (hX : normPLapOf p q X ≤ 0) :
    normPLapOf p (c • q) (c • X - (2 * η) • rankOne q) ≤ -(2 * η * (p - 1) * ‖q‖ ^ 2) := by
  rw [normPLapOf_cv_sub hq hc]
  have : c * normPLapOf p q X ≤ 0 := mul_nonpos_of_nonneg_of_nonpos hc.le hX
  nlinarith
defPeanoAt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Its value lies in $\mathrm{Prop}$.

/-- **The Peano expansion**, in `ε`–`δ` form. -/
def PeanoAt (f : EuclSpace d → ℝ) (x q : EuclSpace d) (X : Bilin d) : Prop :=
  ∀ ε > 0, ∃ δ > 0, ∀ h : EuclSpace d, ‖h‖ < δ →
    |f (x + h) - f x - inner ℝ q h - 1 / 2 * (X h) h| ≤ ε * ‖h‖ ^ 2
theorempeanoAt_of_twiceDiffAt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{TwiceDiffAt}(f, x, q, X)$ h

Then $\operatorname{PeanoAt}(f, x, q, X)$.

PLaplacian.peanoAt_of_twiceDiffAtPlaplacian/CVJet.lean, lines 95–113
theorem peanoAt_of_twiceDiffAt {f : EuclSpace d → ℝ} {x q : EuclSpace d} {X : Bilin d}
    (h : TwiceDiffAt f x q X) : PeanoAt f x q X := by
  obtain ⟨h1, h2⟩ := h
  have h1' : ∀ η > 0, ∀ᶠ y in 𝓝 x, f y ≤ f x + inner ℝ q (y - x)
      + 1 / 2 * (X (y - x)) (y - x) + η * ‖y - x‖ ^ 2 := h1
  have h2' : ∀ η > 0, ∀ᶠ y in 𝓝 x, f x + inner ℝ q (y - x)
      + 1 / 2 * (X (y - x)) (y - x) - η * ‖y - x‖ ^ 2 ≤ f y := h2
  intro ε hε
  obtain ⟨δ, hδ, hb⟩ := Metric.eventually_nhds_iff.1 ((h1' ε hε).and (h2' ε hε))
  refine ⟨δ, hδ, fun k hk => ?_⟩
  have hk' : dist (x + k) x < δ := by
    rw [dist_eq_norm]
    have e : x + k - x = k := by abel
    rw [e]; exact hk
  obtain ⟨a1, a2⟩ := hb hk'
  have e : x + k - x = k := by abel
  rw [e] at a1 a2
  rw [abs_le]
  constructor <;> linarith
theoremtwiceDiffAt_of_peanoAt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{PeanoAt}(f, x, q, X)$ h

Then $\operatorname{TwiceDiffAt}(f, x, q, X)$.

PLaplacian.twiceDiffAt_of_peanoAtPlaplacian/CVJet.lean, lines 115–135
theorem twiceDiffAt_of_peanoAt {f : EuclSpace d → ℝ} {x q : EuclSpace d} {X : Bilin d}
    (h : PeanoAt f x q X) : TwiceDiffAt f x q X := by
  refine ⟨?_, ?_⟩
  · intro η hη
    obtain ⟨δ, hδ, hb⟩ := h η hη
    filter_upwards [Metric.ball_mem_nhds x hδ] with y hy
    rw [mem_ball, dist_eq_norm] at hy
    have h1 := (abs_le.1 (hb (y - x) hy)).2
    have e : x + (y - x) = y := by abel
    rw [e] at h1
    change f y ≤ f x + inner ℝ q (y - x) + 1 / 2 * (X (y - x)) (y - x) + η * ‖y - x‖ ^ 2
    linarith
  · intro η hη
    obtain ⟨δ, hδ, hb⟩ := h η hη
    filter_upwards [Metric.ball_mem_nhds x hδ] with y hy
    rw [mem_ball, dist_eq_norm] at hy
    have h1 := (abs_le.1 (hb (y - x) hy)).1
    have e : x + (y - x) = y := by abel
    rw [e] at h1
    change f x + inner ℝ q (y - x) + 1 / 2 * (X (y - x)) (y - x) - η * ‖y - x‖ ^ 2 ≤ f y
    linarith
theoremcv_arith
Formal statementgenerated from the Lean declaration

Let $a, L, Q, c, \eta, t, \varepsilon, K, \mathrm{qn} \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $0 \le t$ ht0
  • $t \le 1$ ht1
  • $0 \le K$ hK
  • $0 \le \mathrm{qn}$ hqn
  • $\lvert a - L - Q\rvert \le \operatorname{min}(1, \varepsilon / (2 \cdot (\lvert c\rvert + 1))) \cdot t ^{2}$ he
  • $\lvert Q\rvert \le K / 2 \cdot t ^{2}$ hQ
  • $\lvert L\rvert \le \mathrm{qn} \cdot t$ hL
  • $t \le \varepsilon / (2 \cdot (\lvert \eta\rvert \cdot ((K / 2 + 1) \cdot (K / 2 + 1 + 2 \cdot \mathrm{qn})) + 1))$ ht3

Then $\lvert c \cdot (a - L - Q) - \eta \cdot (a ^{2} - L ^{2})\rvert \le \varepsilon \cdot t ^{2}$.

/-- **The error estimate of the composed expansion**, in a small context. -/
theorem cv_arith {a L Q c η t ε K qn : ℝ} (hε : 0 < ε) (ht0 : 0 ≤ t) (ht1 : t ≤ 1)
    (hK : 0 ≤ K) (hqn : 0 ≤ qn)
    (he : |a - L - Q| ≤ min 1 (ε / (2 * (|c| + 1))) * t ^ 2)
    (hQ : |Q| ≤ K / 2 * t ^ 2) (hL : |L| ≤ qn * t)
    (ht3 : t ≤ ε / (2 * (|η| * ((K / 2 + 1) * (K / 2 + 1 + 2 * qn)) + 1))) :
    |c * (a - L - Q) - η * (a ^ 2 - L ^ 2)| ≤ ε * t ^ 2 := by
  set ε₁ := min 1 (ε / (2 * (|c| + 1))) with hε₁
  set M := (K / 2 + 1) * (K / 2 + 1 + 2 * qn) with hM
  have hM0 : 0 ≤ M := by positivity
  have hε₁1 : ε₁ ≤ 1 := min_le_left _ _
  have hε₁2 : ε₁ ≤ ε / (2 * (|c| + 1)) := min_le_right _ _
  have ht2 : t ^ 2 ≤ t := by nlinarith
  -- |a - L| and |a - L + 2L|
  have hE : |a - L - Q| ≤ t ^ 2 := by
    have : ε₁ * t ^ 2 ≤ 1 * t ^ 2 := mul_le_mul_of_nonneg_right hε₁1 (by positivity)
    linarith
  have hD : |a - L| ≤ (K / 2 + 1) * t ^ 2 := by
    obtain ⟨e1, e2⟩ := abs_le.1 hE
    obtain ⟨q1, q2⟩ := abs_le.1 hQ
    rw [abs_le]; constructor <;> nlinarith
  have hD2 : |a - L + 2 * L| ≤ (K / 2 + 1) * t ^ 2 + 2 * qn * t := by
    obtain ⟨d1, d2⟩ := abs_le.1 hD
    obtain ⟨l1, l2⟩ := abs_le.1 hL
    rw [abs_le]; constructor <;> nlinarith
  -- the quadratic error
  have hprod : |a ^ 2 - L ^ 2| ≤ ((K / 2 + 1) * t ^ 2) * ((K / 2 + 1) * t ^ 2 + 2 * qn * t) := by
    rw [show a ^ 2 - L ^ 2 = (a - L) * (a - L + 2 * L) by ring, abs_mul]
    exact mul_le_mul hD hD2 (abs_nonneg _) (by positivity)
  have hprod2 : ((K / 2 + 1) * t ^ 2) * ((K / 2 + 1) * t ^ 2 + 2 * qn * t) ≤ M * t ^ 3 := by
    have h1 : (K / 2 + 1) * t ^ 2 + 2 * qn * t ≤ (K / 2 + 1 + 2 * qn) * t := by nlinarith
    have h2 := mul_le_mul_of_nonneg_left h1 (by positivity : (0 : ℝ) ≤ (K / 2 + 1) * t ^ 2)
    rw [hM]
    nlinarith
  -- the two terms
  have hT1 : |c * (a - L - Q)| ≤ ε / 2 * t ^ 2 := by
    rw [abs_mul]
    have h1 : |c| * |a - L - Q| ≤ |c| * (ε₁ * t ^ 2) :=
      mul_le_mul_of_nonneg_left he (abs_nonneg c)
    have h2 : |c| * ε₁ ≤ ε / 2 := by
      have := mul_le_mul_of_nonneg_left hε₁2 (abs_nonneg c)
      have e : |c| * (ε / (2 * (|c| + 1))) ≤ ε / 2 := by
        rw [mul_div_assoc', div_le_div_iff₀ (by positivity) (by norm_num)]
        nlinarith [abs_nonneg c]
      linarith
    have h3 := mul_le_mul_of_nonneg_right h2 (by positivity : (0 : ℝ) ≤ t ^ 2)
    nlinarith
  have hT2 : |η * (a ^ 2 - L ^ 2)| ≤ ε / 2 * t ^ 2 := by
    rw [abs_mul]
    have h1 : |η| * |a ^ 2 - L ^ 2| ≤ |η| * (M * t ^ 3) :=
      mul_le_mul_of_nonneg_left (hprod.trans hprod2) (abs_nonneg η)
    have h2 : |η| * M * t ≤ ε / 2 := by
      have := mul_le_mul_of_nonneg_left ht3 (by positivity : (0 : ℝ) ≤ |η| * M)
      have e : |η| * M * (ε / (2 * (|η| * M + 1))) ≤ ε / 2 := by
        rw [mul_div_assoc', div_le_div_iff₀ (by positivity) (by norm_num)]
        nlinarith [mul_nonneg (abs_nonneg η) hM0]
      linarith
    have h3 := mul_le_mul_of_nonneg_right h2 (by positivity : (0 : ℝ) ≤ t ^ 2)
    have e : |η| * (M * t ^ 3) = |η| * M * t * t ^ 2 := by ring
    linarith
  obtain ⟨a1, a2⟩ := abs_le.1 hT1
  obtain ⟨b1, b2⟩ := abs_le.1 hT2
  rw [abs_le]
  constructor <;> linarith
theorempeanoAt_cvTheorem 6.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{PeanoAt}(V, x, q, X)$ h

Then $\operatorname{PeanoAt}(y \mapsto V(y) - \eta \cdot V(y) ^{2}, x, (1 - 2 \cdot \eta \cdot V(x)) \cdot q, (1 - 2 \cdot \eta \cdot V(x)) \cdot X - 2 \cdot \eta \cdot \operatorname{rankOne}(q))$.

/-- **Composing an expansion with `ψ(s) = s - η s²`.** -/
theorem peanoAt_cv {V : EuclSpace d → ℝ} {x q : EuclSpace d} {X : Bilin d}
    (h : PeanoAt V x q X) (η : ℝ) :
    PeanoAt (fun y => V y - η * V y ^ 2) x ((1 - 2 * η * V x) • q)
      ((1 - 2 * η * V x) • X - (2 * η) • rankOne q) := by
  intro ε hε
  set c := 1 - 2 * η * V x with hc
  set K := ‖X‖ with hK
  set qn := ‖q‖ with hqn
  obtain ⟨δ₁, hδ₁, hb⟩ := h (min 1 (ε / (2 * (|c| + 1)))) (by positivity)
  refine ⟨min (min δ₁ 1) (ε / (2 * (|η| * ((K / 2 + 1) * (K / 2 + 1 + 2 * qn)) + 1))),
    by positivity, fun k hk => ?_⟩
  have hk1 : ‖k‖ < δ₁ := lt_of_lt_of_le hk (le_trans (min_le_left _ _) (min_le_left _ _))
  have hkle1 : ‖k‖ ≤ 1 := le_trans hk.le (le_trans (min_le_left _ _) (min_le_right _ _))
  have hk3 : ‖k‖ ≤ ε / (2 * (|η| * ((K / 2 + 1) * (K / 2 + 1 + 2 * qn)) + 1)) :=
    le_trans hk.le (min_le_right _ _)
  have he := hb k hk1
  -- the jet terms
  have hQ : inner ℝ (c • q) k = c * inner ℝ q k := real_inner_smul_left _ _ _
  have hR : ((c • X - (2 * η) • rankOne q) k) k
      = c * (X k) k - 2 * η * (inner ℝ q k * inner ℝ q k) := by
    rw [sub_apply, sub_apply, smul_apply, smul_apply, smul_apply, smul_apply, smul_eq_mul,
      smul_eq_mul, rankOne_apply]
  change |(V (x + k) - η * V (x + k) ^ 2) - (V x - η * V x ^ 2) - inner ℝ (c • q) k
    - 1 / 2 * ((c • X - (2 * η) • rankOne q) k) k| ≤ ε * ‖k‖ ^ 2
  rw [hQ, hR]
  have key : (V (x + k) - η * V (x + k) ^ 2) - (V x - η * V x ^ 2) - c * inner ℝ q k
      - 1 / 2 * (c * (X k) k - 2 * η * (inner ℝ q k * inner ℝ q k))
      = c * (V (x + k) - V x - inner ℝ q k - 1 / 2 * (X k) k)
        - η * ((V (x + k) - V x) ^ 2 - inner ℝ q k ^ 2) := by
    rw [hc]; ring
  rw [key]
  -- the bounds, in a small context
  have hQb : |1 / 2 * (X k) k| ≤ K / 2 * ‖k‖ ^ 2 := by
    have h1 : ‖(X k) k‖ ≤ ‖X‖ * ‖k‖ * ‖k‖ := X.le_opNorm₂ k k
    rw [Real.norm_eq_abs] at h1
    rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 2), hK]
    nlinarith
  have hLb : |inner ℝ q k| ≤ qn * ‖k‖ := abs_real_inner_le_norm q k
  have e2 : V (x + k) - V x - inner ℝ q k - 1 / 2 * (X k) k
      = (V (x + k) - V x) - inner ℝ q k - 1 / 2 * (X k) k := rfl
  exact cv_arith hε (norm_nonneg k) hkle1 (norm_nonneg X) (norm_nonneg q) he hQb hLb hk3

Plaplacian/ClJetBridge.lean16 declarations

theoremnorm_apply_apply_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $Z \in \operatorname{Bilin}(d)$, $w \in \mathbb{R}^{d}$.

Assume

  • $\lVert w\rVert \le 1$ hw

Then $\lVert (Z(w))(w)\rVert \le \lVert Z\rVert$.

PLaplacian.norm_apply_apply_lePlaplacian/ClJetBridge.lean, lines 36–47
/-- A form applied twice to a vector of norm at most one is bounded by its
norm. -/
theorem norm_apply_apply_le {Z : Bilin d} {w : EuclSpace d} (hw : ‖w‖ ≤ 1) :
    ‖(Z w) w‖ ≤ ‖Z‖ := by
  have h0 : (0:ℝ) ≤ ‖w‖ := norm_nonneg w
  have hw2 : ‖w‖ * ‖w‖ ≤ 1 := by nlinarith
  calc ‖(Z w) w‖ ≤ ‖Z w‖ * ‖w‖ := (Z w).le_opNorm w
    _ ≤ (‖Z‖ * ‖w‖) * ‖w‖ :=
        mul_le_mul_of_nonneg_right (Z.le_opNorm w) h0
    _ = ‖Z‖ * (‖w‖ * ‖w‖) := by ring
    _ ≤ ‖Z‖ * 1 := mul_le_mul_of_nonneg_left hw2 (norm_nonneg Z)
    _ = ‖Z‖ := mul_one _
theoremtendsto_quad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{Xs} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $X \in \operatorname{Bilin}(d)$, $\mathrm{ws} \colon \mathbb{N} \to \mathbb{R}^{d}$, $w \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{Xs}(n) - X\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$ hX
  • $\operatorname{Tendsto}(\mathrm{ws}, \mathrm{atTop}, \operatorname{nhds}(w))$ hw
  • $\forall n,\ \lVert \operatorname{ws}(n)\rVert \le 1$ hb

Then $\operatorname{Tendsto}(n \mapsto ((\operatorname{Xs}(n))(\operatorname{ws}(n)))(\operatorname{ws}(n)), \mathrm{atTop}, \operatorname{nhds}((X(w))(w)))$.

/-- **The quadratic form converges**, when the forms converge in norm and the
vectors converge within the unit ball. -/
theorem tendsto_quad {Xs : ℕ → Bilin d} {X : Bilin d}
    (hX : Tendsto (fun n => ‖Xs n - X‖) atTop (𝓝 0))
    {ws : ℕ → EuclSpace d} {w : EuclSpace d}
    (hw : Tendsto ws atTop (𝓝 w)) (hb : ∀ n, ‖ws n‖ ≤ 1) :
    Tendsto (fun n => (Xs n (ws n)) (ws n)) atTop (𝓝 ((X w) w)) := by
  have h1 : Tendsto (fun n => ((Xs n - X) (ws n)) (ws n)) atTop (𝓝 0) :=
    squeeze_zero_norm (fun n => norm_apply_apply_le (hb n)) hX
  have h2 : Tendsto (fun n => (X (ws n)) (ws n)) atTop (𝓝 ((X w) w)) :=
    ((X.continuous.clm_apply continuous_id).tendsto w).comp hw
  have hsplit : (fun n => (Xs n (ws n)) (ws n))
      = fun n => ((Xs n - X) (ws n)) (ws n) + (X (ws n)) (ws n) := by
    funext n
    simp only [sub_apply]
    ring
  rw [hsplit]
  simpa using h1.add h2
theoremnorm_normalize_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $q \in \mathbb{R}^{d}$.

Then ‖‖q‖⁻¹ • q‖ ≤ 1.

PLaplacian.norm_normalize_lePlaplacian/ClJetBridge.lean, lines 68–72
/-- The unit normalization has norm at most one. -/
theorem norm_normalize_le (q : EuclSpace d) : ‖‖q‖⁻¹ • q‖ ≤ 1 := by
  by_cases hq : q = 0
  · simp [hq]
  · rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ (norm_ne_zero_iff.2 hq)]
theoremtendsto_laplacianOf
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{Xs} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{Xs}(n) - X\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$ hX

Then $\operatorname{Tendsto}(n \mapsto \operatorname{laplacianOf}(\operatorname{Xs}(n)), \mathrm{atTop}, \operatorname{nhds}(\operatorname{laplacianOf}(X)))$.

PLaplacian.tendsto_laplacianOfPlaplacian/ClJetBridge.lean, lines 74–80
/-- The Laplacian converges. -/
theorem tendsto_laplacianOf {Xs : ℕ → Bilin d} {X : Bilin d}
    (hX : Tendsto (fun n => ‖Xs n - X‖) atTop (𝓝 0)) :
    Tendsto (fun n => laplacianOf (Xs n)) atTop (𝓝 (laplacianOf X)) := by
  unfold laplacianOf
  refine tendsto_finsetSum _ (fun i _ => ?_)
  exact tendsto_quad hX tendsto_const_nhds (fun _ => by simp)
theoremtendsto_infLaplacianOf
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{Xs} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $X \in \operatorname{Bilin}(d)$, $\mathrm{qs} \colon \mathbb{N} \to \mathbb{R}^{d}$, $q \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{Xs}(n) - X\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$ hX
  • $\operatorname{Tendsto}(\mathrm{qs}, \mathrm{atTop}, \operatorname{nhds}(q))$ hqs
  • $q \ne 0$ hq

Then $\operatorname{Tendsto}(n \mapsto \operatorname{infLaplacianOf}(\operatorname{qs}(n), \operatorname{Xs}(n)), \mathrm{atTop}, \operatorname{nhds}(\operatorname{infLaplacianOf}(q, X)))$.

PLaplacian.tendsto_infLaplacianOfPlaplacian/ClJetBridge.lean, lines 82–93
/-- The infinity Laplacian converges at a nonzero limit gradient. -/
theorem tendsto_infLaplacianOf {Xs : ℕ → Bilin d} {X : Bilin d}
    (hX : Tendsto (fun n => ‖Xs n - X‖) atTop (𝓝 0))
    {qs : ℕ → EuclSpace d} {q : EuclSpace d} (hqs : Tendsto qs atTop (𝓝 q))
    (hq : q ≠ 0) :
    Tendsto (fun n => infLaplacianOf (qs n) (Xs n)) atTop
      (𝓝 (infLaplacianOf q X)) := by
  unfold infLaplacianOf
  have hn : ‖q‖ ≠ 0 := norm_ne_zero_iff.2 hq
  have hw : Tendsto (fun n => ‖qs n‖⁻¹ • qs n) atTop (𝓝 (‖q‖⁻¹ • q)) :=
    (hqs.norm.inv₀ hn).smul hqs
  exact tendsto_quad hX hw (fun n => norm_normalize_le (qs n))
theoremtendsto_viscF
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\mathrm{Xs} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $X \in \operatorname{Bilin}(d)$, $\mathrm{qs} \colon \mathbb{N} \to \mathbb{R}^{d}$, $q \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{Xs}(n) - X\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$ hX
  • $\operatorname{Tendsto}(\mathrm{qs}, \mathrm{atTop}, \operatorname{nhds}(q))$ hqs
  • $q \ne 0$ hq

Then $\operatorname{Tendsto}(n \mapsto \operatorname{viscF}(p, \operatorname{qs}(n), \operatorname{Xs}(n)), \mathrm{atTop}, \operatorname{nhds}(\operatorname{viscF}(p, q, X)))$.

/-- **The regular generator converges** at a nonzero limit gradient. -/
theorem tendsto_viscF {p : ℝ} {Xs : ℕ → Bilin d} {X : Bilin d}
    (hX : Tendsto (fun n => ‖Xs n - X‖) atTop (𝓝 0))
    {qs : ℕ → EuclSpace d} {q : EuclSpace d} (hqs : Tendsto qs atTop (𝓝 q))
    (hq : q ≠ 0) :
    Tendsto (fun n => viscF p (qs n) (Xs n)) atTop (𝓝 (viscF p q X)) := by
  have h := (tendsto_laplacianOf hX).add
    ((tendsto_infLaplacianOf hX hqs hq).const_mul (p - 2))
  simp only [viscF_eq_neg]
  unfold normPLapOf
  exact h.neg
theoremlamMax_le_add_norm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X, Y \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd

Then $\operatorname{lamMax}(X) \le \operatorname{lamMax}(Y) + \lVert X - Y\rVert$.

/-- **The largest eigenvalue is Lipschitz** in the form. -/
theorem lamMax_le_add_norm (hd : 0 < d) (X Y : Bilin d) :
    lamMax X ≤ lamMax Y + ‖X - Y‖ := by
  unfold lamMax
  apply csSup_le ((sphere_nonempty hd).image _)
  rintro _ ⟨v, hv, rfl⟩
  have hv1 : ‖v‖ = 1 := hv
  change (X v) v ≤ _
  have h1 : (Y v) v ≤ sSup ((fun v => (Y v) v) '' {v : EuclSpace d | ‖v‖ = 1}) :=
    le_csSup (bddAbove_quad_sphere Y) ⟨v, hv, rfl⟩
  have h2 : ((X - Y) v) v ≤ ‖X - Y‖ :=
    le_trans (le_abs_self _)
      (by rw [← Real.norm_eq_abs]; exact norm_apply_apply_le (le_of_eq hv1))
  have h3 : (X v) v = (Y v) v + ((X - Y) v) v := by
    simp only [sub_apply]; ring
  linarith
theoremlamMax_le_add_norm'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X, Y \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd

Then $\operatorname{lamMax}(X) \le \operatorname{lamMax}(Y) + \lVert Y - X\rVert$.

PLaplacian.lamMax_le_add_norm'Plaplacian/ClJetBridge.lean, lines 124–141
/-- The same, with the difference reversed. Stated separately because the
subtraction on forms is not the generic one, so the reversal cannot be done by
rewriting. -/
theorem lamMax_le_add_norm' (hd : 0 < d) (X Y : Bilin d) :
    lamMax X ≤ lamMax Y + ‖Y - X‖ := by
  unfold lamMax
  apply csSup_le ((sphere_nonempty hd).image _)
  rintro _ ⟨v, hv, rfl⟩
  have hv1 : ‖v‖ = 1 := hv
  change (X v) v ≤ _
  have h1 : (Y v) v ≤ sSup ((fun v => (Y v) v) '' {v : EuclSpace d | ‖v‖ = 1}) :=
    le_csSup (bddAbove_quad_sphere Y) ⟨v, hv, rfl⟩
  have h2 : -(((Y - X) v) v) ≤ ‖Y - X‖ :=
    le_trans (neg_le_abs _)
      (by rw [← Real.norm_eq_abs]; exact norm_apply_apply_le (le_of_eq hv1))
  have h3 : (X v) v = (Y v) v - ((Y - X) v) v := by
    simp only [sub_apply]; ring
  linarith
theoremtendsto_lamMax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{Xs} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{Xs}(n) - X\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$ hX

Then $\operatorname{Tendsto}(n \mapsto \operatorname{lamMax}(\operatorname{Xs}(n)), \mathrm{atTop}, \operatorname{nhds}(\operatorname{lamMax}(X)))$.

theorem tendsto_lamMax (hd : 0 < d) {Xs : ℕ → Bilin d} {X : Bilin d}
    (hX : Tendsto (fun n => ‖Xs n - X‖) atTop (𝓝 0)) :
    Tendsto (fun n => lamMax (Xs n)) atTop (𝓝 (lamMax X)) := by
  rw [tendsto_iff_norm_sub_tendsto_zero]
  refine squeeze_zero (fun _ => norm_nonneg _) (fun n => ?_) hX
  rw [Real.norm_eq_abs, abs_le]
  have h1 := lamMax_le_add_norm hd (Xs n) X
  have h2 := lamMax_le_add_norm' hd X (Xs n)
  constructor <;> linarith
theoremtendsto_viscFLower
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\mathrm{Xs} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{Xs}(n) - X\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$ hX

Then $\operatorname{Tendsto}(n \mapsto \operatorname{viscFLower}(p, \operatorname{Xs}(n)), \mathrm{atTop}, \operatorname{nhds}(\operatorname{viscFLower}(p, X)))$.

/-- **The lower envelope converges.** -/
theorem tendsto_viscFLower (hd : 0 < d) {p : ℝ} {Xs : ℕ → Bilin d}
    {X : Bilin d} (hX : Tendsto (fun n => ‖Xs n - X‖) atTop (𝓝 0)) :
    Tendsto (fun n => viscFLower p (Xs n)) atTop (𝓝 (viscFLower p X)) := by
  unfold viscFLower
  exact (tendsto_laplacianOf hX).neg.sub
    ((tendsto_lamMax hd hX).const_mul (p - 2))
theoremviscFLower_le_viscF
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $2 \le p$ hp
  • $q \ne 0$ hq

Then $\operatorname{viscFLower}(p, X) \le \operatorname{viscF}(p, q, X)$.

PLaplacian.viscFLower_le_viscFPlaplacian/ClJetBridge.lean, lines 161–171
/-- The lower envelope is below the regular generator, for `p ≥ 2`. -/
theorem viscFLower_le_viscF (hp : 2 ≤ p) {q : EuclSpace d} (hq : q ≠ 0)
    (X : Bilin d) : viscFLower p X ≤ viscF p q X := by
  rw [viscF_eq_neg]
  unfold viscFLower normPLapOf infLaplacianOf
  have hn : ‖‖q‖⁻¹ • q‖ = 1 := by
    rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ (norm_ne_zero_iff.2 hq)]
  have h := quad_le_lamMax_norm X (‖q‖⁻¹ • q)
  rw [hn, one_pow, mul_one] at h
  have hp2 : (0:ℝ) ≤ p - 2 := by linarith
  nlinarith [mul_le_mul_of_nonneg_left h hp2]
theoremviscF_anti
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $X, Y \in \operatorname{Bilin}(d)$, $q \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $\operatorname{QuadLE}(X, Y)$ hXY

Then $\operatorname{viscF}(p, q, Y) \le \operatorname{viscF}(p, q, X)$.

/-- **Degenerate ellipticity**, in the quadratic-form order. -/
theorem viscF_anti (hp : 2 ≤ p) {X Y : Bilin d} (hXY : QuadLE X Y)
    (q : EuclSpace d) : viscF p q Y ≤ viscF p q X := by
  rw [viscF_eq_neg, viscF_eq_neg]
  unfold normPLapOf laplacianOf infLaplacianOf
  have hlap : ∑ i, (X (EuclideanSpace.single i 1)) (EuclideanSpace.single i 1)
      ≤ ∑ i, (Y (EuclideanSpace.single i 1)) (EuclideanSpace.single i 1) :=
    Finset.sum_le_sum (fun i _ => hXY _)
  have hinf := hXY (‖q‖⁻¹ • q)
  have hp2 : (0:ℝ) ≤ p - 2 := by linarith
  nlinarith [mul_le_mul_of_nonneg_left hinf hp2]
theoremviscFLower_nonneg_of_nonpos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\operatorname{QuadLE}(X, 0)$ hX

Then $0 \le \operatorname{viscFLower}(p, X)$.

PLaplacian.viscFLower_nonneg_of_nonposPlaplacian/ClJetBridge.lean, lines 185–200
/-- **At a nonpositive form the lower envelope is nonnegative.** -/
theorem viscFLower_nonneg_of_nonpos (hd : 0 < d) (hp : 2 ≤ p) {X : Bilin d}
    (hX : QuadLE X 0) : 0 ≤ viscFLower p X := by
  unfold viscFLower
  have hv : ∀ v, (X v) v ≤ 0 := fun v => by
    have := hX v; simpa using this
  have hlap : laplacianOf X ≤ 0 := by
    unfold laplacianOf
    exact Finset.sum_nonpos (fun i _ => hv _)
  have hlam : lamMax X ≤ 0 := by
    unfold lamMax
    apply csSup_le ((sphere_nonempty hd).image _)
    rintro _ ⟨v, _, rfl⟩
    exact hv v
  have hp2 : (0:ℝ) ≤ p - 2 := by linarith
  nlinarith [mul_le_mul_of_nonneg_left hlam hp2]
theoremclSuperJet_regular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, c \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\Omega\text{ is open}$ hΩ
  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = x \mapsto c\text{ in }\Omega$ hsub
  • $x \in \Omega$ hx
  • (q, X) ∈ PLaplacian.ClSuperJet u x hcl
  • $q \ne 0$ hq

Then $\operatorname{viscF}(p, q, X) \le c$.

/-- **The regular subsolution inequality at a closed superjet.** -/
theorem clSuperJet_regular (hd : 0 < d) (hp : 2 ≤ p) (hΩ : IsOpen Ω)
    (hsub : IsViscositySubsolution p Ω (fun _ => c) u) (hx : x ∈ Ω)
    (hcl : (q, X) ∈ ClSuperJet u x) (hq : q ≠ 0) :
    viscF p q X ≤ c := by
  obtain ⟨xs, qs, Xs, hj, hxs, _, hqs, hXs⟩ := hcl
  have hxΩ : ∀ᶠ n in atTop, xs n ∈ Ω := hxs (hΩ.mem_nhds hx)
  have hqne : ∀ᶠ n in atTop, qs n ≠ 0 := hqs.eventually_ne hq
  have hineq : ∀ᶠ n in atTop, viscF p (qs n) (Xs n) ≤ c :=
    (hxΩ.and hqne).mono fun n hn =>
      superJet_regular hd hp hsub hn.1 (hj n) hn.2
  exact le_of_tendsto (tendsto_viscF hXs hqs hq) hineq
theoremclSuperJet_singular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, c \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\Omega\text{ is open}$ hΩ
  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = x \mapsto c\text{ in }\Omega$ hsub
  • $x \in \Omega$ hx
  • (0, X) ∈ PLaplacian.ClSuperJet u x hcl

Then $\operatorname{viscFLower}(p, X) \le c$.

PLaplacian.clSuperJet_singularPlaplacian/ClJetBridge.lean, lines 220–235
/-- **The singular subsolution inequality at a closed superjet.** -/
theorem clSuperJet_singular (hd : 0 < d) (hp : 2 ≤ p) (hΩ : IsOpen Ω)
    (hsub : IsViscositySubsolution p Ω (fun _ => c) u) (hx : x ∈ Ω)
    (hcl : (0, X) ∈ ClSuperJet u x) :
    viscFLower p X ≤ c := by
  obtain ⟨xs, qs, Xs, hj, hxs, _, _, hXs⟩ := hcl
  have hxΩ : ∀ᶠ n in atTop, xs n ∈ Ω := hxs (hΩ.mem_nhds hx)
  have hineq : ∀ᶠ n in atTop, viscFLower p (Xs n) ≤ c := by
    refine hxΩ.mono fun n hn => ?_
    by_cases hqn : qs n = 0
    · have hjn := hj n
      rw [hqn] at hjn
      exact superJet_singular hd hp hsub hn hjn
    · exact le_trans (viscFLower_le_viscF hp hqn (Xs n))
        (superJet_regular hd hp hsub hn (hj n) hqn)
  exact le_of_tendsto (tendsto_viscFLower hd hXs) hineq
theoremclSubJet_regular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, c \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\Omega\text{ is open}$ hΩ
  • $u\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = x \mapsto c\text{ in }\Omega$ hsup
  • $x \in \Omega$ hx
  • (q, X) ∈ PLaplacian.ClSubJet u x hcl
  • $q \ne 0$ hq

Then $c \le \operatorname{viscF}(p, q, X)$.

/-- **The regular supersolution inequality at a closed subjet.** -/
theorem clSubJet_regular (hd : 0 < d) (hp : 2 ≤ p) (hΩ : IsOpen Ω)
    (hsup : IsViscositySupersolution p Ω (fun _ => c) u) (hx : x ∈ Ω)
    (hcl : (q, X) ∈ ClSubJet u x) (hq : q ≠ 0) :
    c ≤ viscF p q X := by
  obtain ⟨xs, qs, Xs, hj, hxs, _, hqs, hXs⟩ := hcl
  have hxΩ : ∀ᶠ n in atTop, xs n ∈ Ω := hxs (hΩ.mem_nhds hx)
  have hqne : ∀ᶠ n in atTop, qs n ≠ 0 := hqs.eventually_ne hq
  have hineq : ∀ᶠ n in atTop, c ≤ viscF p (qs n) (Xs n) :=
    (hxΩ.and hqne).mono fun n hn =>
      subJet_regular hd hp hsup hn.1 (hj n) hn.2
  exact ge_of_tendsto (tendsto_viscF hXs hqs hq) hineq

Plaplacian/Combine.lean3 declarations

theorembeta_div
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd

Then $(d + 2) / (p + d) / (d + 2) = 1 / (p + d)$.

/-- The weight identity behind the combination: `β / (d+2) = 1/(p+d)`. -/
theorem beta_div (p : ℝ) (hpd : 0 < p + (d : ℝ)) :
    ((d : ℝ) + 2) / (p + (d : ℝ)) / ((d : ℝ) + 2) = 1 / (p + (d : ℝ)) := by
  have hd2 : ((d : ℝ) + 2) ≠ 0 := by positivity
  field_simp
theoremcombine_weights
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varepsilon, I, L \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd

Then $(p - 2) / (p + d) \cdot \varepsilon ^{2} / 2 \cdot I + (d + 2) / (p + d) \cdot (\varepsilon ^{2} / (2 \cdot (d + 2)) \cdot L) = \varepsilon ^{2} / (2 \cdot (p + d)) \cdot ((p - 2) \cdot I + L)$.

PLaplacian.combine_weightsPlaplacian/Combine.lean, lines 72–82
/-- **The combination identity.** Weighting the two halves by `α` and `β`
produces the normalized `p`-Laplacian, with the constant `1/(2(p+d))`. -/
theorem combine_weights (p : ℝ) (hpd : 0 < p + (d : ℝ)) (ε : ℝ)
    (I L : ℝ) :
    (p - 2) / (p + (d : ℝ)) * ((ε ^ 2 / 2) * I)
        + ((d : ℝ) + 2) / (p + (d : ℝ))
            * (ε ^ 2 / (2 * ((d : ℝ) + 2)) * L)
      = ε ^ 2 / (2 * (p + (d : ℝ))) * ((p - 2) * I + L) := by
  have hd2 : ((d : ℝ) + 2) ≠ 0 := by positivity
  have hpd' : (p + (d : ℝ)) ≠ 0 := ne_of_gt hpd
  field_simp
theorembracket_eq_normPLap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then $(p - 2) \cdot \operatorname{infLaplacianOf}(q, X) + \operatorname{laplacianOf}(X) = \operatorname{normPLapOf}(p, q, X)$.

PLaplacian.bracket_eq_normPLapPlaplacian/Combine.lean, lines 84–89
/-- And the bracket is the normalized `p`-Laplacian. -/
theorem bracket_eq_normPLap (p : ℝ) (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    (p - 2) * infLaplacianOf q X + laplacianOf X = normPLapOf p q X := by
  unfold normPLapOf
  ring

Plaplacian/CompFull.lean1 declarations

theoremvisc_comparisonTheorem 6.5 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $U\text{ is upper semicontinuous}$ hU
  • $V\text{ is lower semicontinuous}$ hV
  • $U\text{ is bounded above}$ hUb
  • $U\text{ is bounded below}$ hUb'
  • $V\text{ is bounded below}$ hVb
  • $V\text{ is bounded above}$ hVb'
  • $U\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsub
  • $V\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsup
  • $\forall x \in \partial \Omega,\ U(x) \le V(x)$ hbd
  • $x \in \Omega$ a._@._internal._hyg.0

Then $U(x) \le V(x)$.

/-- **The comparison principle** for the homogeneous normalized `p`-Laplacian. -/
theorem visc_comparison (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {Ω : Set (EuclSpace d)}
    (hΩo : IsOpen Ω) (hΩb : Bornology.IsBounded Ω) {U V : EuclSpace d → ℝ}
    (hU : UpperSemicontinuous U) (hV : LowerSemicontinuous V)
    (hUb : BddAbove (range U)) (hUb' : BddBelow (range U))
    (hVb : BddBelow (range V)) (hVb' : BddAbove (range V))
    (hsub : IsViscositySubsolution p Ω (fun _ => 0) U)
    (hsup : IsViscositySupersolution p Ω (fun _ => 0) V)
    (hbd : ∀ x ∈ frontier Ω, U x ≤ V x) :
    ∀ x ∈ Ω, U x ≤ V x := by
  intro xb hxb
  by_contra hlt
  push Not at hlt
  set θ := U xb - V xb with hθdef
  have hθ : 0 < θ := by linarith
  -- the bounds
  obtain ⟨SU, hSU'⟩ := hUb
  obtain ⟨SL, hSL'⟩ := hUb'
  obtain ⟨TL, hTL'⟩ := hVb
  obtain ⟨TU, hTU'⟩ := hVb'
  have hSU : ∀ x, U x ≤ SU := fun x => hSU' ⟨x, rfl⟩
  have hSL : ∀ x, SL ≤ U x := fun x => hSL' ⟨x, rfl⟩
  have hTL : ∀ x, TL ≤ V x := fun x => hTL' ⟨x, rfl⟩
  have hTU : ∀ x, V x ≤ TU := fun x => hTU' ⟨x, rfl⟩
  have hUbA : BddAbove (range U) := ⟨SU, hSU'⟩
  have hVbB : BddBelow (range V) := ⟨TL, hTL'⟩
  have hCU : 0 ≤ SU - SL := by linarith [hSU 0, hSL 0]
  have hCV : 0 ≤ TU - TL := by linarith [hTU 0, hTL 0]
  -- the complement, and the distance of x̄ to it
  have hΩc := compl_nonempty hd hΩb
  have hxbd : 0 < infDist xb Ωᶜ :=
    (hΩo.isClosed_compl.notMem_iff_infDist_pos hΩc).1 (fun h => h hxb)
  -- δ from the band estimate
  obtain ⟨δ₀, hδ₀, Λ, hΛ, hband⟩ := band_est hΩb hΩc hU hV hUbA hVbB hSU hSL hTU hTL hbd
    (θ := θ / 4) (by positivity)
  set δ := min δ₀ (infDist xb Ωᶜ / 2) with hδdef
  have hδ : 0 < δ := lt_min hδ₀ (by positivity)
  have hδδ₀ : δ ≤ δ₀ := min_le_left _ _
  have hδxb : δ < infDist xb Ωᶜ := by
    have : δ ≤ infDist xb Ωᶜ / 2 := min_le_right _ _
    linarith
  -- λ
  set C := (SU - SL) + (TU - TL) + 1 with hC
  have hC0 : 0 < C := by linarith
  set lam := Λ + 8 * C / δ ^ 2 + 1 with hlamdef
  have hlamC : 8 * C / δ ^ 2 ≤ lam := by
    have : 0 < Λ := hΛ
    linarith
  have hlam0 : 0 < lam := lt_of_lt_of_le (by positivity) hlamC
  have hlamΛ : Λ ≤ lam := by
    have : 0 ≤ 8 * C / δ ^ 2 := by positivity
    linarith
  have hρ2 : 2 * C < (δ / 2) ^ 2 * lam + 1 := by
    have h1 : (δ / 2) ^ 2 * (8 * C / δ ^ 2) = 2 * C := by field_simp; ring
    have h2 := mul_le_mul_of_nonneg_left hlamC (by positivity : (0 : ℝ) ≤ (δ / 2) ^ 2)
    linarith
  have hρU : 2 * (SU - SL) / lam < (δ / 2) ^ 2 := by
    rw [div_lt_iff₀ hlam0]
    have h1 : (δ / 2) ^ 2 * (8 * C / δ ^ 2) = 2 * C := by field_simp; ring
    have h2 := mul_le_mul_of_nonneg_left hlamC (by positivity : (0 : ℝ) ≤ (δ / 2) ^ 2)
    nlinarith
  have hρV : 2 * (TU - TL) / lam < (δ / 2) ^ 2 := by
    rw [div_lt_iff₀ hlam0]
    have h1 : (δ / 2) ^ 2 * (8 * C / δ ^ 2) = 2 * C := by field_simp; ring
    have h2 := mul_le_mul_of_nonneg_left hlamC (by positivity : (0 : ℝ) ≤ (δ / 2) ^ 2)
    nlinarith
  -- the bounds on V_λ, and η
  have hVlam := regV_bounds hlam0.le hVbB hTU hTL
  set B := |TL| + |TU| + 1 with hB
  have hB0 : 0 < B := by positivity
  have hVB : ∀ y, |regV lam V y| ≤ B := by
    intro y
    obtain ⟨_, h1, h2⟩ := hVlam y
    rw [abs_le]
    constructor
    · have := neg_abs_le TL; linarith [abs_nonneg TU]
    · have := le_abs_self TU; linarith [abs_nonneg TL]
  set η := min (1 / (4 * B)) (θ / (8 * B ^ 2)) with hηdef
  have hη : 0 < η := lt_min (by positivity) (by positivity)
  have hηB : η * B ≤ 1 / 4 := by
    have := mul_le_mul_of_nonneg_right (min_le_left (1 / (4 * B)) (θ / (8 * B ^ 2))) hB0.le
    have e : 1 / (4 * B) * B = 1 / 4 := by field_simp
    linarith
  have hηB2 : η * B ^ 2 ≤ θ / 8 := by
    have := mul_le_mul_of_nonneg_right (min_le_right (1 / (4 * B)) (θ / (8 * B ^ 2)))
      (by positivity : (0 : ℝ) ≤ B ^ 2)
    have e : θ / (8 * B ^ 2) * B ^ 2 = θ / 8 := by field_simp
    linarith
  have hcb : ∀ y, 1 / 2 ≤ 1 - 2 * η * regV lam V y ∧ 1 - 2 * η * regV lam V y ≤ 3 / 2 := by
    intro y
    obtain ⟨a1, a2⟩ := abs_le.1 (hVB y)
    have k1 : η * regV lam V y ≤ η * B := mul_le_mul_of_nonneg_left a2 hη.le
    have k2 : η * (-B) ≤ η * regV lam V y := mul_le_mul_of_nonneg_left a1 hη.le
    constructor <;> nlinarith
  have hsq : ∀ y, η * regV lam V y ^ 2 ≤ θ / 8 := by
    intro y
    have h1 : regV lam V y ^ 2 ≤ B ^ 2 := by
      have := hVB y
      rw [← sq_abs]
      exact pow_le_pow_left₀ (abs_nonneg _) this 2
    have := mul_le_mul_of_nonneg_left h1 hη.le
    linarith
  -- the function f, at x̄ and on the band
  have hUc := regU_continuous hlam0.le hUbA
  have hVc := regV_continuous hlam0.le hVbB
  have hfc : Continuous (fun z => regU lam U z - (regV lam V z - η * regV lam V z ^ 2)) := by
    fun_prop
  have hfx : θ ≤ regU lam U xb - (regV lam V xb - η * regV lam V xb ^ 2) := by
    have h1 := (regU_bounds hlam0.le hUbA hSU hSL xb).1
    have h2 := (hVlam xb).1
    have h3 : 0 ≤ η * regV lam V xb ^ 2 := by positivity
    linarith
  have hfband : ∀ x ∈ closure Ω, infDist x Ωᶜ ≤ 2 * δ →
      regU lam U x - (regV lam V x - η * regV lam V x ^ 2) < θ / 2 := by
    intro x hx hxd
    have h1 := hband lam hlamΛ x hx (le_trans hxd (by linarith))
    have h2 := hsq x
    linarith
  -- the set S and the component G
  set S := {x | δ < infDist x Ωᶜ} ∩
    {x | θ / 2 < regU lam U x - (regV lam V x - η * regV lam V x ^ 2)} with hSdef
  have hSo : IsOpen S :=
    (isOpen_lt continuous_const (continuous_infDist_pt _)).inter
      (isOpen_lt continuous_const hfc)
  have hxbS : xb ∈ S := ⟨hδxb, by change θ / 2 < _; linarith⟩
  have hSΩ : S ⊆ Ω := by
    intro x hx
    by_contra hxΩ
    have : infDist x Ωᶜ = 0 := infDist_zero_of_mem hxΩ
    have h1 : δ < infDist x Ωᶜ := hx.1
    linarith
  set G := connectedComponentIn S xb with hGdef
  have hGo : IsOpen G := hSo.connectedComponentIn
  have hGc : IsPreconnected G := isPreconnected_connectedComponentIn
  have hxbG : xb ∈ G := mem_connectedComponentIn hxbS
  have hGne : G.Nonempty := ⟨xb, hxbG⟩
  have hGS : G ⊆ S := connectedComponentIn_subset S xb
  have hGb : Bornology.IsBounded G := hΩb.subset (hGS.trans hSΩ)
  have hclG : closure G ⊆ {x | δ ≤ infDist x Ωᶜ} := by
    apply closure_minimal _ (isClosed_le continuous_const (continuous_infDist_pt _))
    intro x hx
    have h : δ < infDist x Ωᶜ := (hGS hx).1
    exact h.le
  have hclGΩ : closure G ⊆ closure Ω := closure_mono (hGS.trans hSΩ)
  -- the frontier of G lies where f ≤ θ/2
  have hfr : ∀ z ∈ frontier G,
      regU lam U z - (regV lam V z - η * regV lam V z ^ 2) ≤ θ / 2 := by
    intro z hz
    by_contra hgt
    push Not at hgt
    have hzcl : z ∈ closure G := frontier_subset_closure hz
    rcases lt_or_ge δ (infDist z Ωᶜ) with hzd | hzd
    · -- z ∈ S would put z inside G
      have hzS : z ∈ S := ⟨hzd, hgt⟩
      obtain ⟨r, hr, hrS⟩ := Metric.isOpen_iff.1 hSo z hzS
      obtain ⟨w, hwG, hwz⟩ := Metric.mem_closure_iff.1 hzcl r hr
      have hwball : w ∈ ball z r := by rw [mem_ball, dist_comm]; exact hwz
      have hGw : G = connectedComponentIn S w := connectedComponentIn_eq hwG
      have hball : ball z r ⊆ connectedComponentIn S w :=
        (convex_ball z r).isPreconnected.subset_connectedComponentIn hwball hrS
      have hzG : z ∈ G := by rw [hGw]; exact hball (mem_ball_self hr)
      have hzint : z ∉ interior G := hz.2
      rw [hGo.interior_eq] at hzint
      exact hzint hzG
    · -- z lies in the band
      have h1 := hfband z (hclGΩ hzcl) (by linarith)
      linarith
  have hgap : ∀ z ∈ frontier G,
      regU lam U z - (regV lam V z - η * regV lam V z ^ 2)
        < regU lam U xb - (regV lam V xb - η * regV lam V xb ^ 2) := by
    intro z hz
    have := hfr z hz
    linarith
  -- the region O where the jet inequalities hold
  set O := {x | δ / 2 < infDist x Ωᶜ} with hOdef
  have hOball : ∀ y ∈ O, ball y (δ / 2) ⊆ Ω := by
    intro y hy w hw
    by_contra hwΩ
    have h1 := infDist_le_dist_of_mem (x := y) (show w ∈ Ωᶜ from hwΩ)
    have h2 : δ / 2 < infDist y Ωᶜ := hy
    rw [mem_ball, dist_comm] at hw
    linarith
  have hUjet : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d),
      (q, X) ∈ SuperJet (regU lam U) y → q ≠ 0 → viscF p q X ≤ 0 :=
    fun y hy q X hj hq => regU_jet hd hp hsub hlam0 hU hUbA hSU hSL hρU (by positivity)
      (hOball y hy) hj hq
  have hVneg : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d),
      (q, X) ∈ SuperJet (fun z => -regV lam V z) y → q ≠ 0 → viscF p q X ≤ 0 :=
    fun y hy q X hj hq => regV_jet hd hp hsup hlam0 hV hVbB hTU hTL hρV (by positivity)
      (hOball y hy) hj hq
  have hGO : ∀ x ∈ closure G, ball x (δ / 2) ⊆ O := by
    intro x hx y hy
    have h1 : δ ≤ infDist x Ωᶜ := hclG hx
    have h2 := infDist_le_infDist_add_dist (s := Ωᶜ) (x := x) (y := y)
    rw [mem_ball, dist_comm] at hy
    change δ / 2 < infDist y Ωᶜ
    linarith
  -- semiconvexity
  have hUs := regU_semiconvex hlam0.le hUbA
  have hVs := regV_semiconcave hlam0.le hVbB
  have hWs := semiconcave_psi (Cc := 3 / 2) hlam0.le hη.le hVs
    (fun y => by linarith [(hcb y).1]) (fun y => (hcb y).2)
  -- the third step
  exact step3 hd hp hlam0.le (by positivity) hη hUs hVs hWs hUc hVc hUjet hVneg
    (fun y _ => by linarith [(hcb y).1]) (fun y _ => (hcb y).2)
    hGo hGb hGne hGc (by positivity : (0 : ℝ) < δ / 2) hGO hxbG hgap

Plaplacian/Comparison.lean20 declarations

lemmaBddMeas.sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then PLaplacian.BddMeas fun y => u y - v y.

/-- The difference of two admissible functions is admissible. -/
lemma BddMeas.sub {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v) :
    BddMeas (fun y => u y - v y) := by
  obtain ⟨Cu, hCu⟩ := hu.bound
  obtain ⟨Cv, hCv⟩ := hv.bound
  refine ⟨hu.meas.sub hv.meas, ⟨Cu + Cv, fun y => ?_⟩⟩
  calc |u y - v y| ≤ |u y| + |v y| := abs_sub _ _
    _ ≤ Cu + Cv := by linarith [hCu y, hCv y]
theoremkey_estimateTheorem 1.14 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then PLaplacian.tugOfWarOp p ε v x - PLaplacian.tugOfWarOp p ε u x ≤ (p - 2) / (p + ↑d) * sSup ((fun y => v y - u y) '' Metric.ball x ε) + (↑d + 2) / (p + ↑d) * ⨍ (y : EuclSpace d) in Metric.ball x ε, v y - u y.

/-- **The key estimate.** -/
theorem key_estimate (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    (x : EuclSpace d) :
    tugOfWarOp p ε v x - tugOfWarOp p ε u x
      ≤ (p - 2) / (p + (d : ℝ)) * sSup ((fun y => v y - u y) '' ball x ε)
        + ((d : ℝ) + 2) / (p + (d : ℝ))
            * ⨍ y in ball x ε, (v y - u y) := by
  have hne := nonempty_ball x hε
  have hdiff := hv.sub hu
  have hsup := sSup_sub_sSup_le u v (ball x ε) hne
    (hu.bddAbove_image (ball x ε)) (hdiff.bddAbove_image (ball x ε))
  have hinf := sInf_sub_sInf_le u v (ball x ε) hne
    (hv.bddBelow_image (ball x ε)) (hdiff.bddAbove_image (ball x ε))
  have havg : (⨍ y in ball x ε, v y) - (⨍ y in ball x ε, u y)
      = ⨍ y in ball x ε, (v y - u y) := by
    rw [show (fun y : EuclSpace d => v y - u y) = v - u from rfl,
        MeasureTheory.setAverage_sub (hv.integrableOn_ball x ε)
          (hu.integrableOn_ball x ε)]
  have hα : 0 ≤ (p - 2) / (p + (d : ℝ)) / 2 := by
    apply div_nonneg (div_nonneg (by linarith) hpd.le); norm_num
  unfold tugOfWarOp
  rw [← havg]
  nlinarith [hsup, hinf, hα]
lemmaae_eq_zero_of_setIntegral_eq_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $g \colon \mathbb{R}^{d} \to \mathbb{R}$, $s \subseteq \mathbb{R}^{d}$.

Assume

  • $\operatorname{IntegrableOn}(g, s, \lambda)$ hint
  • $\forall y,\ 0 \le g(y)$ hnn
  • $\int_{s} (g(y) = 0) \, dy$ hzero

Then g =ᵐ[MeasureTheory.volume.restrict s] 0.

PLaplacian.ae_eq_zero_of_setIntegral_eq_zeroPlaplacian/Comparison.lean, lines 98–105
/-- A nonnegative integrable function with vanishing integral is zero a.e. -/
lemma ae_eq_zero_of_setIntegral_eq_zero
    {g : EuclSpace d → ℝ} {s : Set (EuclSpace d)}
    (hint : MeasureTheory.IntegrableOn g s) (hnn : ∀ y, 0 ≤ g y)
    (hzero : (∫ y in s, g y) = 0) :
    g =ᵐ[volume.restrict s] 0 := by
  refine (MeasureTheory.setIntegral_eq_zero_iff_of_nonneg_ae ?_ hint).1 hzero
  exact Filter.Eventually.of_forall hnn
theoremae_eq_of_setAverage_eq_maxTheorem 1.14 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\operatorname{IntegrableOn}(f, B(x, \varepsilon), \lambda)$ hint
  • $\forall y,\ f(y) \le M$ hle
  • $\fint_{B(x, \varepsilon)} (f(y) = M) \, dy$ havg

Then (fun y => M - f y) =ᵐ[MeasureTheory.volume.restrict (Metric.ball x ε)] 0.

PLaplacian.ae_eq_of_setAverage_eq_maxPlaplacian/Comparison.lean, lines 107–135
/-- **The a.e.-equality step.** A function bounded above by `M` whose average
over a ball equals `M` is equal to `M` almost everywhere on that ball. -/
theorem ae_eq_of_setAverage_eq_max
    {f : EuclSpace d → ℝ} {M : ℝ} (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε)
    (hint : MeasureTheory.IntegrableOn f (ball x ε))
    (hle : ∀ y, f y ≤ M)
    (havg : (⨍ y in ball x ε, f y) = M) :
    (fun y => M - f y) =ᵐ[volume.restrict (ball x ε)] 0 := by
  have hcint : MeasureTheory.IntegrableOn (fun _ : EuclSpace d => M)
      (ball x ε) := integrableOn_const
  have hgint : MeasureTheory.IntegrableOn (fun y => M - f y) (ball x ε) :=
    hcint.sub hint
  refine ae_eq_zero_of_setIntegral_eq_zero hgint
    (fun y => by linarith [hle y]) ?_
  have hsub : (⨍ y in ball x ε, (M - f y)) = 0 := by
    rw [show (fun y : EuclSpace d => M - f y)
          = (fun _ : EuclSpace d => M) - f from rfl,
        MeasureTheory.setAverage_sub hcint hint,
        setAverage_const_ball M x hε, havg, sub_self]
  rw [MeasureTheory.setAverage_eq] at hsub
  have hvol : volume.real (ball x ε) ≠ 0 := by
    have h1 : volume (ball x ε) ≠ 0 := measure_ball_ne_zero x hε
    have h2 : volume (ball x ε) ≠ ⊤ := measure_ball_lt_top.ne
    simp only [MeasureTheory.Measure.real]
    exact ne_of_gt (ENNReal.toReal_pos h1 h2)
  rw [smul_eq_mul, mul_eq_zero] at hsub
  rcases hsub with h | h
  · exact absurd (inv_eq_zero.1 h) hvol
  · exact h
theoremball_displaced_subset
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $e \in \mathbb{R}^{d}$.

Assume

  • $0 < \varepsilon$ hε
  • $\lVert e\rVert = 1$ he

Then $B(x + \varepsilon / 2 \cdot e, \varepsilon / 4) \subseteq B(x, \varepsilon)$.

PLaplacian.ball_displaced_subsetPlaplacian/Comparison.lean, lines 152–164
/-- The displaced small ball sits inside the big one. -/
theorem ball_displaced_subset (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε)
    (e : EuclSpace d) (he : ‖e‖ = 1) :
    ball (x + (ε / 2) • e) (ε / 4) ⊆ ball x ε := by
  intro y hy
  rw [mem_ball, dist_eq_norm] at hy ⊢
  have h1 : ‖y - x‖ ≤ ‖y - (x + (ε / 2) • e)‖ + ‖(ε / 2 : ℝ) • e‖ := by
    have hrw : y - x = (y - (x + (ε / 2) • e)) + (ε / 2 : ℝ) • e := by abel
    rw [hrw]
    exact norm_add_le _ _
  have h2 : ‖(ε / 2 : ℝ) • e‖ = ε / 2 := by
    rw [norm_smul, he, Real.norm_eq_abs, abs_of_nonneg (by linarith), mul_one]
  linarith
theoremnonempty_inter_of_ae_full
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $G \subseteq \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $S \subseteq \mathbb{R}^{d}$.

Assume

  • $\lambda(B(x, \varepsilon) \setminus G) = 0$ hfull
  • $S \subseteq B(x, \varepsilon)$ hS
  • $0 < \lambda(S)$ hSpos

Then (G ∩ S).Nonempty.

PLaplacian.nonempty_inter_of_ae_fullPlaplacian/Comparison.lean, lines 166–181
/-- **A set of full measure in a ball meets every positive-measure subset.** -/
theorem nonempty_inter_of_ae_full (G : Set (EuclSpace d)) (x : EuclSpace d)
    {ε : ℝ} (hfull : volume (ball x ε \ G) = 0)
    (S : Set (EuclSpace d)) (hS : S ⊆ ball x ε) (hSpos : 0 < volume S) :
    (G ∩ S).Nonempty := by
  by_contra hcon
  rw [Set.not_nonempty_iff_eq_empty] at hcon
  have hsub : S ⊆ ball x ε \ G := by
    intro y hy
    refine ⟨hS hy, fun hyG => ?_⟩
    have hmem : y ∈ G ∩ S := ⟨hyG, hy⟩
    rw [hcon] at hmem
    exact hmem
  have hle : volume S ≤ volume (ball x ε \ G) := measure_mono hsub
  rw [hfull, nonpos_iff_eq_zero] at hle
  exact hSpos.ne' hle
theoremexists_unit_vector
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Assume

  • $0 < d$ hd

Then there exists $e$ such that:

  • $\lVert e\rVert = 1$
PLaplacian.exists_unit_vectorPlaplacian/Comparison.lean, lines 183–187
/-- A unit vector exists in dimension at least one; needed to fix a marching
direction. -/
theorem exists_unit_vector (hd : 0 < d) : ∃ e : EuclSpace d, ‖e‖ = 1 := by
  refine ⟨EuclideanSpace.single (⟨0, hd⟩ : Fin d) (1 : ℝ), ?_⟩
  simp
theoremexists_mem_displaced
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $G \subseteq \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $e \in \mathbb{R}^{d}$.

Assume

  • $0 < \varepsilon$ hε
  • $\lVert e\rVert = 1$ he
  • $\lambda(B(x, \varepsilon) \setminus G) = 0$ hfull

Then (G ∩ Metric.ball (x + (ε / 2) • e) (ε / 4)).Nonempty.

PLaplacian.exists_mem_displacedPlaplacian/Comparison.lean, lines 189–197
/-- **The propagation step.** If `G` has full measure in `B ε x`, it contains a
point displaced from `x` by `ε / 2` in the direction `e`, up to `ε / 4`. -/
theorem exists_mem_displaced (G : Set (EuclSpace d)) (x : EuclSpace d)
    {ε : ℝ} (hε : 0 < ε) (e : EuclSpace d) (he : ‖e‖ = 1)
    (hfull : volume (ball x ε \ G) = 0) :
    (G ∩ ball (x + (ε / 2) • e) (ε / 4)).Nonempty :=
  nonempty_inter_of_ae_full G x hfull _
    (ball_displaced_subset x hε e he)
    (measure_ball_pos volume _ (by linarith))
theoreminner_advanceTheorem 1.14 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y, e \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\lVert e\rVert = 1$ he
  • $y \in B(x + \varepsilon / 2 \cdot e, \varepsilon / 4)$ hy

Then $\operatorname{inner}(\mathbb{R}, e, x) + \varepsilon / 4 \le \operatorname{inner}(\mathbb{R}, e, y)$.

/-- Each step advances the inner product with `e` by at least `ε / 4`. -/
theorem inner_advance (x y : EuclSpace d)
    (e : EuclSpace d) (he : ‖e‖ = 1) {ε : ℝ}
    (hy : y ∈ ball (x + (ε / 2) • e) (ε / 4)) :
    inner ℝ e x + ε / 4 ≤ inner ℝ e y := by
  have hd : ‖y - (x + (ε / 2) • e)‖ < ε / 4 := by
    rw [← dist_eq_norm]; exact mem_ball.1 hy
  have hip : inner ℝ e (y - (x + (ε / 2) • e)) ≥ -(ε / 4) := by
    have h1 := abs_real_inner_le_norm e (y - (x + (ε / 2) • e))
    rw [he, one_mul] at h1
    have h2 := abs_le.1 h1
    linarith [h2.1]
  have hexp : inner ℝ e (y - (x + (ε / 2) • e))
      = inner ℝ e y - inner ℝ e x - (ε / 2) := by
    have hee : inner ℝ e e = (1 : ℝ) := by
      rw [real_inner_self_eq_norm_sq, he, one_pow]
    rw [inner_sub_right, inner_add_right, real_inner_smul_right, hee]
    ring
  linarith [hip, hexp]
theoremexists_advance
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $G \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $e \in \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < \varepsilon$ hε
  • $\lVert e\rVert = 1$ he
  • $\forall x \in G,\ \lambda(B(x, \varepsilon) \setminus G) = 0$ hprop
  • $x \in G$ hx

Then there exists $y \in G$ such that:

  • $\operatorname{inner}(\mathbb{R}, e, x) + \varepsilon / 4 \le \operatorname{inner}(\mathbb{R}, e, y)$
/-- One step of the march. -/
theorem exists_advance (G : Set (EuclSpace d)) {ε : ℝ} (hε : 0 < ε)
    (e : EuclSpace d) (he : ‖e‖ = 1)
    (hprop : ∀ x ∈ G, volume (ball x ε \ G) = 0)
    {x : EuclSpace d} (hx : x ∈ G) :
    ∃ y ∈ G, inner ℝ e x + ε / 4 ≤ inner ℝ e y := by
  obtain ⟨y, hyG, hyB⟩ := exists_mem_displaced G x hε e he (hprop x hx)
  exact ⟨y, hyG, inner_advance x y e he hyB⟩
theoremexists_far
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $G \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $e \in \mathbb{R}^{d}$, $x_{0} \in \mathbb{R}^{d}$, $k \in \mathbb{N}$.

Assume

  • $0 < \varepsilon$ hε
  • $\lVert e\rVert = 1$ he
  • $\forall x \in G,\ \lambda(B(x, \varepsilon) \setminus G) = 0$ hprop
  • $x_{0} \in G$ hx₀

Then there exists $y \in G$ such that:

  • $\operatorname{inner}(\mathbb{R}, e, x_{0}) + k \cdot \varepsilon / 4 \le \operatorname{inner}(\mathbb{R}, e, y)$
/-- **`G` is unbounded in the direction `e`.** -/
theorem exists_far (G : Set (EuclSpace d)) {ε : ℝ} (hε : 0 < ε)
    (e : EuclSpace d) (he : ‖e‖ = 1)
    (hprop : ∀ x ∈ G, volume (ball x ε \ G) = 0)
    {x₀ : EuclSpace d} (hx₀ : x₀ ∈ G) (k : ℕ) :
    ∃ y ∈ G, inner ℝ e x₀ + k * (ε / 4) ≤ inner ℝ e y := by
  induction k with
  | zero => exact ⟨x₀, hx₀, by simp⟩
  | succ n ih =>
      obtain ⟨y, hyG, hy⟩ := ih
      obtain ⟨z, hzG, hz⟩ := exists_advance G hε e he hprop hyG
      refine ⟨z, hzG, ?_⟩
      push_cast
      linarith
theoremnot_bddAbove_inner
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $G \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $e \in \mathbb{R}^{d}$, $x_{0} \in \mathbb{R}^{d}$, $R \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\lVert e\rVert = 1$ he
  • $\forall x \in G,\ \lambda(B(x, \varepsilon) \setminus G) = 0$ hprop
  • $x_{0} \in G$ hx₀

Then there exists $y \in G$ such that:

  • $R < \operatorname{inner}(\mathbb{R}, e, y)$
PLaplacian.not_bddAbove_innerPlaplacian/Comparison.lean, lines 253–270
/-- **The contradiction.** A non-empty set with the propagation property
cannot have `⟪e, ·⟫` bounded above, so it cannot be contained in a bounded
set. -/
theorem not_bddAbove_inner (G : Set (EuclSpace d)) {ε : ℝ} (hε : 0 < ε)
    (e : EuclSpace d) (he : ‖e‖ = 1)
    (hprop : ∀ x ∈ G, volume (ball x ε \ G) = 0)
    {x₀ : EuclSpace d} (hx₀ : x₀ ∈ G) (R : ℝ) :
    ∃ y ∈ G, R < inner ℝ e y := by
  obtain ⟨k, hk⟩ := exists_nat_gt ((R - inner ℝ e x₀) / (ε / 4))
  obtain ⟨y, hyG, hy⟩ := exists_far G hε e he hprop hx₀ k
  refine ⟨y, hyG, ?_⟩
  have hq : 0 < ε / 4 := by linarith
  have hk' : R - inner ℝ e x₀ < (k : ℝ) * (ε / 4) := by
    calc R - inner ℝ e x₀
        = ((R - inner ℝ e x₀) / (ε / 4)) * (ε / 4) := by field_simp
      _ < (k : ℝ) * (ε / 4) := by
          exact mul_lt_mul_of_pos_right hk hq
  linarith
theoremae_full_of_attains
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ v(y) - u(y) \le M$ hMle
  • $v(x) - u(x) = M$ hMx
  • $T_{\varepsilon} v(x) - T_{\varepsilon} u(x) = v(x) - u(x)$ hfix

Then $\fint_{B(x, \varepsilon)} (v(y) - u(y) = M) \, dy$.

PLaplacian.ae_full_of_attainsPlaplacian/Comparison.lean, lines 287–328
/-- At a point where the difference attains its supremum and both functions are
fixed by the operator, the average over the ball also attains the supremum. -/
theorem ae_full_of_attains (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    {M : ℝ} (hMle : ∀ y, v y - u y ≤ M)
    {x : EuclSpace d} (hMx : v x - u x = M)
    (hfix : tugOfWarOp p ε v x - tugOfWarOp p ε u x = v x - u x) :
    (⨍ y in ball x ε, (v y - u y)) = M := by
  have hkey := key_estimate p ε hp hε hpd hu hv x
  rw [hfix, hMx] at hkey
  have hsup : sSup ((fun y => v y - u y) '' ball x ε) ≤ M := by
    refine csSup_le ⟨v x - u x, x, mem_ball_self hε, rfl⟩ ?_
    rintro a ⟨y, -, rfl⟩
    exact hMle y
  have havgle : (⨍ y in ball x ε, (v y - u y)) ≤ M := by
    have h0 : (⨍ _y in ball x ε, M) = M := setAverage_const_ball M x hε
    rw [← h0]
    exact setAverage_mono_ball x
      ((hv.sub hu).integrableOn_ball x ε) integrableOn_const hMle
  have hα : 0 ≤ (p - 2) / (p + (d : ℝ)) := div_nonneg (by linarith) hpd.le
  have hβ : 0 < ((d : ℝ) + 2) / (p + (d : ℝ)) := by positivity
  have hab : (p - 2) / (p + (d : ℝ)) + ((d : ℝ) + 2) / (p + (d : ℝ)) = 1 :=
    alpha_add_beta p hpd
  refine le_antisymm havgle ?_
  by_contra hcon
  push Not at hcon
  have hstep : (p - 2) / (p + (d : ℝ)) * sSup ((fun y => v y - u y) '' ball x ε)
      ≤ (p - 2) / (p + (d : ℝ)) * M :=
    mul_le_mul_of_nonneg_left hsup hα
  have hstep2 : ((d : ℝ) + 2) / (p + (d : ℝ))
        * (⨍ y in ball x ε, (v y - u y))
      < ((d : ℝ) + 2) / (p + (d : ℝ)) * M :=
    mul_lt_mul_of_pos_left hcon hβ
  have hsum : (p - 2) / (p + (d : ℝ)) * M
      + ((d : ℝ) + 2) / (p + (d : ℝ)) * M = M := by
    calc (p - 2) / (p + (d : ℝ)) * M + ((d : ℝ) + 2) / (p + (d : ℝ)) * M
        = ((p - 2) / (p + (d : ℝ)) + ((d : ℝ) + 2) / (p + (d : ℝ))) * M := by
          ring
      _ = 1 * M := by rw [hab]
      _ = M := one_mul M
  linarith [hkey, hstep, hstep2, hsum]
theoremae_eq_max_on_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ v(y) - u(y) \le M$ hMle
  • $v(x) - u(x) = M$ hMx
  • $T_{\varepsilon} v(x) - T_{\varepsilon} u(x) = v(x) - u(x)$ hfix

Then (fun y => M - (v y - u y)) =ᵐ[MeasureTheory.volume.restrict (Metric.ball x ε)] 0.

/-- **The propagation property.** Combining rigidity of the average with the
a.e.-equality step: at an attained maximum, the difference equals `M` almost
everywhere on the ball, i.e. the maximum set has full measure there. -/
theorem ae_eq_max_on_ball (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    {M : ℝ} (hMle : ∀ y, v y - u y ≤ M)
    {x : EuclSpace d} (hMx : v x - u x = M)
    (hfix : tugOfWarOp p ε v x - tugOfWarOp p ε u x = v x - u x) :
    (fun y => M - (v y - u y)) =ᵐ[volume.restrict (ball x ε)] 0 :=
  ae_eq_of_setAverage_eq_max x hε ((hv.sub hu).integrableOn_ball x ε) hMle
    (ae_full_of_attains p ε hp hε hpd hu hv hMle hMx hfix)
theoremae_mem_max_set
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • (fun y => M - f y) =ᵐ[MeasureTheory.volume.restrict (Metric.ball x ε)] 0 h

Then ∀ᵐ (y : EuclSpace d) ∂MeasureTheory.volume.restrict (Metric.ball x ε), f y = M.

/-- From `=ᵐ 0` for the deficit to pointwise membership in the maximum set. -/
theorem ae_mem_max_set {f : EuclSpace d → ℝ} {M : ℝ} (x : EuclSpace d) {ε : ℝ}
    (h : (fun y => M - f y) =ᵐ[volume.restrict (ball x ε)] 0) :
    ∀ᵐ y ∂(volume.restrict (ball x ε)), f y = M := by
  filter_upwards [h] with y hy
  simp only [Pi.zero_apply] at hy
  linarith [hy]
theoremmeasure_diff_eq_zero_of_ae_mem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $G \subseteq \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $G\text{ is measurable}$ hG
  • ∀ᵐ (y : EuclSpace d) ∂MeasureTheory.volume.restrict (Metric.ball x ε), y ∈ G h

Then $\lambda(B(x, \varepsilon) \setminus G) = 0$.

PLaplacian.measure_diff_eq_zero_of_ae_memPlaplacian/Comparison.lean, lines 360–372
/-- From a.e. membership to a null set difference. -/
theorem measure_diff_eq_zero_of_ae_mem (G : Set (EuclSpace d))
    (x : EuclSpace d) {ε : ℝ} (hG : MeasurableSet G)
    (h : ∀ᵐ y ∂(volume.restrict (ball x ε)), y ∈ G) :
    volume (ball x ε \ G) = 0 := by
  rw [MeasureTheory.ae_iff] at h
  have hcompl : {a : EuclSpace d | a ∉ G} = Gᶜ := rfl
  rw [hcompl, MeasureTheory.Measure.restrict_apply₀
      hG.compl.nullMeasurableSet] at h
  have hset : (Gᶜ : Set (EuclSpace d)) ∩ ball x ε = ball x ε \ G := by
    ext y
    simp [and_comm]
  rwa [hset] at h
theoremmeasurableSet_max_set
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$.

Assume

  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then MeasurableSet {y | v y - u y = M}.

PLaplacian.measurableSet_max_setPlaplacian/Comparison.lean, lines 374–379
/-- The maximum set is measurable, being a level set of a measurable
function. -/
theorem measurableSet_max_set {u v : EuclSpace d → ℝ} (hu : BddMeas u)
    (hv : BddMeas v) (M : ℝ) :
    MeasurableSet {y : EuclSpace d | v y - u y = M} :=
  measurableSet_eq_fun (hv.meas.sub hu.meas) measurable_const
theoremmeasure_diff_max_setTheorem 1.14 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ v(y) - u(y) \le M$ hMle
  • $v(x) - u(x) = M$ hMx
  • $T_{\varepsilon} v(x) - T_{\varepsilon} u(x) = v(x) - u(x)$ hfix

Then MeasureTheory.volume (Metric.ball x ε \ {y | v y - u y = M}) = 0.

PLaplacian.measure_diff_max_setPlaplacian/Comparison.lean, lines 381–392
/-- **Propagation, in the form `exists_mem_displaced` consumes.** At an
attained maximum, the maximum set has full measure in the ball. -/
theorem measure_diff_max_set (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    {M : ℝ} (hMle : ∀ y, v y - u y ≤ M)
    {x : EuclSpace d} (hMx : v x - u x = M)
    (hfix : tugOfWarOp p ε v x - tugOfWarOp p ε u x = v x - u x) :
    volume (ball x ε \ {y : EuclSpace d | v y - u y = M}) = 0 :=
  measure_diff_eq_zero_of_ae_mem _ x (measurableSet_max_set hu hv M)
    (ae_mem_max_set x
      (ae_eq_max_on_ball p ε hp hε hpd hu hv hMle hMx hfix))
theoremmax_set_unboundedTheorem 1.14 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $e \in \mathbb{R}^{d}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $R \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\lVert e\rVert = 1$ he
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ v(y) - u(y) \le M$ hMle
  • $\forall y,\ v(y) - u(y) = M \to T_{\varepsilon} v(y) - T_{\varepsilon} u(y) = v(y) - u(y)$ hfix
  • $v(x_{0}) - u(x_{0}) = M$ hx₀

Then there exists $y$ such that:

  • $v(y) - u(y) = M$
  • $R < \operatorname{inner}(\mathbb{R}, e, y)$
/-- **The maximum set is unbounded.** If `v - u` attains its maximum `M` at
some point and the dynamic programming principle holds wherever the maximum is
attained, then the maximum set extends arbitrarily far in any fixed
direction. -/
theorem max_set_unbounded (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    (e : EuclSpace d) (he : ‖e‖ = 1)
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    {M : ℝ} (hMle : ∀ y, v y - u y ≤ M)
    (hfix : ∀ y, v y - u y = M →
      tugOfWarOp p ε v y - tugOfWarOp p ε u y = v y - u y)
    {x₀ : EuclSpace d} (hx₀ : v x₀ - u x₀ = M) (R : ℝ) :
    ∃ y, v y - u y = M ∧ R < inner ℝ e y := by
  set G := {y : EuclSpace d | v y - u y = M} with hG
  have hprop : ∀ y ∈ G, volume (ball y ε \ G) = 0 := fun y hy =>
    measure_diff_max_set p ε hp hε hpd hu hv hMle hy (hfix y hy)
  obtain ⟨y, hyG, hy⟩ :=
    not_bddAbove_inner G hε e he hprop (show x₀ ∈ G from hx₀) R
  exact ⟨y, hyG, hy⟩
theoremnot_bounded_max_setTheorem 1.14 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $e \in \mathbb{R}^{d}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $S \subseteq \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\lVert e\rVert = 1$ he
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ v(y) - u(y) \le M$ hMle
  • $\forall y,\ v(y) - u(y) = M \to T_{\varepsilon} v(y) - T_{\varepsilon} u(y) = v(y) - u(y)$ hfix
  • $v(x_{0}) - u(x_{0}) = M$ hx₀
  • $S\text{ is bounded}$ hS
  • {y | v y - u y = M} ⊆ S hsub

Then $\mathrm{False}$.

PLaplacian.not_bounded_max_setPlaplacian/Comparison.lean, lines 425–453
/-- **The comparison principle, contradiction form.** Under the hypotheses of
`max_set_unbounded`, the maximum set cannot be contained in a bounded set. This
is the form in which the principle is applied: for two solutions of the
`ε`-Dirichlet problem on a bounded `Ω`, the maximum of `v - u` cannot be
attained in `Ω`, so it is controlled by the boundary data. -/
theorem not_bounded_max_set (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    (e : EuclSpace d) (he : ‖e‖ = 1)
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    {M : ℝ} (hMle : ∀ y, v y - u y ≤ M)
    (hfix : ∀ y, v y - u y = M →
      tugOfWarOp p ε v y - tugOfWarOp p ε u y = v y - u y)
    {x₀ : EuclSpace d} (hx₀ : v x₀ - u x₀ = M)
    {S : Set (EuclSpace d)} (hS : Bornology.IsBounded S)
    (hsub : {y : EuclSpace d | v y - u y = M} ⊆ S) :
    False := by
  obtain ⟨R, hR⟩ := hS.subset_closedBall 0
  obtain ⟨y, hyG, hy⟩ :=
    max_set_unbounded p ε hp hε hpd e he hu hv hMle hfix hx₀ R
  have hmem : y ∈ closedBall (0 : EuclSpace d) R := hR (hsub hyG)
  have hnorm : ‖y‖ ≤ R := by
    rw [Metric.mem_closedBall, dist_zero_right] at hmem
    exact hmem
  have hip : inner ℝ e y ≤ R := by
    calc inner ℝ e y ≤ |inner ℝ e y| := le_abs_self _
      _ ≤ ‖e‖ * ‖y‖ := abs_real_inner_le_norm e y
      _ = ‖y‖ := by rw [he, one_mul]
      _ ≤ R := hnorm
  linarith

Plaplacian/ComparisonFinal.lean2 declarations

theoremcomparison_of_attainedTheorem 1.15 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $e \in \mathbb{R}^{d}$, $F, G, u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is bounded}$ hΩbdd
  • $\lVert e\rVert = 1$ he
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $v\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }G$ hv
  • $\forall y,\ v(y) - u(y) \le M$ hMle
  • $\forall y,\ v(y) - u(y) = M \to y \in \Omega$ hmaxΩ
  • $v(x_{0}) - u(x_{0}) = M$ hx₀

Then $\mathrm{False}$.

PLaplacian.comparison_of_attainedPlaplacian/ComparisonFinal.lean, lines 38–70
/-- **The comparison principle for solutions of the epsilon-Dirichlet
problem.**

If two `p`-harmonious functions have their difference attaining a positive
maximum, and that maximum is attained only inside the domain, the maximum set
is unbounded --- contradicting boundedness of the domain. Hence no positive
maximum is attained inside.

The hypothesis `hmaxΩ` is what the intended application supplies: on the
boundary strip the data satisfies `v ≤ u`, so a positive maximum of `v - u`
cannot be attained there. Isolating it keeps this theorem free of assumptions
about the behaviour of `u` and `v` outside `Ω_ε`, where the
`ε`-Dirichlet problem says nothing. -/
theorem comparison_of_attained (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩbdd : Bornology.IsBounded Ω)
    (e : EuclSpace d) (he : ‖e‖ = 1)
    {F G : EuclSpace d → ℝ} {u v : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hv : IsPHarmonious p ε Ω G v)
    {M : ℝ} (hMle : ∀ y, v y - u y ≤ M)
    (hmaxΩ : ∀ y, v y - u y = M → y ∈ Ω)
    {x₀ : EuclSpace d} (hx₀ : v x₀ - u x₀ = M) :
    False := by
  -- at a point of the maximum set the dynamic programming principle holds
  have hfix : ∀ y, v y - u y = M →
      tugOfWarOp p ε v y - tugOfWarOp p ε u y = v y - u y := by
    intro y hy
    have hyΩ : y ∈ Ω := hmaxΩ y hy
    have hue : u y = tugOfWarOp p ε u y := hu.interior y hyΩ
    have hve : v y = tugOfWarOp p ε v y := hv.interior y hyΩ
    rw [← hue, ← hve]
  exact not_bounded_max_set p ε hp hε hpd e he hu.bddMeas hv.bddMeas
    hMle hfix hx₀ hΩbdd (fun y hy => hmaxΩ y hy)
theoremnot_attained_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $e \in \mathbb{R}^{d}$, $F, G, u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is bounded}$ hΩbdd
  • $\lVert e\rVert = 1$ he
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $v\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }G$ hv
  • $\forall y,\ v(y) - u(y) \le M$ hMle
  • $\forall y,\ v(y) - u(y) = M \to y \in \Omega$ hmaxΩ

Then ¬∃ x₀, v x₀ - u x₀ = M.

/-- **No positive maximum.** Under the same hypotheses, the difference cannot
attain a positive value that is its maximum. -/
theorem not_attained_pos (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩbdd : Bornology.IsBounded Ω)
    (e : EuclSpace d) (he : ‖e‖ = 1)
    {F G : EuclSpace d → ℝ} {u v : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hv : IsPHarmonious p ε Ω G v)
    {M : ℝ} (hMle : ∀ y, v y - u y ≤ M)
    (hmaxΩ : ∀ y, v y - u y = M → y ∈ Ω) :
    ¬ ∃ x₀, v x₀ - u x₀ = M := by
  rintro ⟨x₀, hx₀⟩
  exact comparison_of_attained p ε hp hε hpd hΩbdd e he hu hv hMle hmaxΩ hx₀

Plaplacian/Compose.lean1 declarations

theoremdiff_at_good_pair
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r, M, \kappa \in \mathbb{R}$, $q \in \mathbb{R} \times \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $0 < r$ _hr
  • $\forall w \in B(x_{0}, r),\ \forall \varepsilon,\ 0 < \varepsilon \to u_{\varepsilon}(w) - \varphi(w) \le M + \kappa$ hupper
  • $0 < \mathrm{q.1}$ hq1
  • $\mathrm{q.1} < r / 2 \wedge \lVert \mathrm{q.2} - x_{0}\rVert < r / 2$ hsmall
  • $M - \kappa \le u(\mathrm{q.1}, \mathrm{q.2}) - \varphi(\mathrm{q.2})$ hnear
  • $u(\mathrm{q.1})\text{ is }p\text{-harmonious in }\Omega\text{ with step }\mathrm{q.1}\text{ and data }F$ hu
  • $\mathrm{q.2} \in \Omega$ hmem
  • $\operatorname{gradient}(\varphi, \mathrm{q.2}) \ne 0$ hgrad

Then there exists $E$ such that:

  • $0 \le \mathrm{q.1} ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, \mathrm{q.2}), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), \mathrm{q.2})) + E + 2 \cdot \kappa$
PLaplacian.diff_at_good_pairPlaplacian/Compose.lean, lines 52–81
/-- **The inequality at a pair, with both bounds in place.**

Given a radius on which the family minus the test function is below `M + κ`,
and a pair that is near-contact and positioned within half that radius, the
differential inequality holds with slack. -/
theorem diff_at_good_pair [Nontrivial (EuclSpace d)] {p : ℝ} (hp : 2 ≤ p)
    (hd : 0 < d) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F φ : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 3 φ) (hφb : BddMeas φ)
    {x₀ : EuclSpace d} {r M κ : ℝ} (_hr : 0 < r)
    (hupper : ∀ w ∈ ball x₀ r, ∀ ε : ℝ, 0 < ε →
      u ε w - φ w ≤ M + κ)
    {q : ℝ × EuclSpace d} (hq1 : 0 < q.1)
    (hsmall : q.1 < r / 2 ∧ ‖q.2 - x₀‖ < r / 2)
    (hnear : M - κ ≤ u q.1 q.2 - φ q.2)
    (hu : IsPHarmonious p q.1 Ω F (u q.1))
    (hmem : q.2 ∈ Ω) (hgrad : gradient φ q.2 ≠ 0) :
    ∃ E : ℝ,
      0 ≤ q.1 ^ 2 / (2 * (p + (d : ℝ)))
          * normPLapOf p (gradient φ q.2) (fderiv ℝ (fderiv ℝ φ) q.2)
        + E + 2 * κ := by
  -- the bound transfers to the small ball
  have hball : ∀ w ∈ ball q.2 q.1, u q.1 w - φ w ≤ M + κ := by
    intro w hw
    exact hupper w (ball_subset_of_near hsmall.1 hsmall.2 hw) q.1 hq1
  -- the near-contact gives the value within 2κ of the bound
  have hnear' : (M + κ) - 2 * κ ≤ u q.1 q.2 - φ q.2 := by
    linarith [hnear]
  exact diff_at_pair_approx hp hd hpd hq1 hu hφ hφb hmem hgrad hball hnear'

Plaplacian/Consistency.lean4 declarations

theoremfderiv_eq_of_isLocalMax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{Differentiable}(\mathbb{R}, u)$ hu
  • $\operatorname{Differentiable}(\mathbb{R}, \varphi)$ hφ
  • $\operatorname{IsLocalMax}(y \mapsto u(y) - \varphi(y), x_{0})$ hmax

Then $\operatorname{fderiv}(\mathbb{R}, u, x_{0}) = \operatorname{fderiv}(\mathbb{R}, \varphi, x_{0})$.

PLaplacian.fderiv_eq_of_isLocalMaxPlaplacian/Consistency.lean, lines 43–54
/-- At a local maximum of `u - φ` the derivatives agree. -/
theorem fderiv_eq_of_isLocalMax {u φ : EuclSpace d → ℝ} {x₀ : EuclSpace d}
    (hu : Differentiable ℝ u) (hφ : Differentiable ℝ φ)
    (hmax : IsLocalMax (fun y => u y - φ y) x₀) :
    fderiv ℝ u x₀ = fderiv ℝ φ x₀ := by
  have h0 : fderiv ℝ (fun y => u y - φ y) x₀ = 0 :=
    IsLocalMax.fderiv_eq_zero hmax
  have hsub : fderiv ℝ (fun y => u y - φ y) x₀
      = fderiv ℝ u x₀ - fderiv ℝ φ x₀ :=
    fderiv_sub (hu x₀) (hφ x₀)
  rw [hsub, sub_eq_zero] at h0
  exact h0
theoremgradient_eq_of_isLocalMax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{Differentiable}(\mathbb{R}, u)$ hu
  • $\operatorname{Differentiable}(\mathbb{R}, \varphi)$ hφ
  • $\operatorname{IsLocalMax}(y \mapsto u(y) - \varphi(y), x_{0})$ hmax

Then $\operatorname{gradient}(u, x_{0}) = \operatorname{gradient}(\varphi, x_{0})$.

PLaplacian.gradient_eq_of_isLocalMaxPlaplacian/Consistency.lean, lines 56–63
/-- The gradient form, via the Riesz representation. -/
theorem gradient_eq_of_isLocalMax {u φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d} (hu : Differentiable ℝ u) (hφ : Differentiable ℝ φ)
    (hmax : IsLocalMax (fun y => u y - φ y) x₀) :
    gradient u x₀ = gradient φ x₀ := by
  have hfd := fderiv_eq_of_isLocalMax hu hφ hmax
  refine ext_inner_right ℝ fun v => ?_
  rw [inner_gradient_left, inner_gradient_left, hfd]
theoremhess_le_of_isLocalMax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $v \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, u)$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{IsLocalMax}(y \mapsto u(y) - \varphi(y), x_{0})$ hmax

Then $((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, u), x_{0}))(v))(v) \le ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x_{0}))(v))(v)$.

PLaplacian.hess_le_of_isLocalMaxPlaplacian/Consistency.lean, lines 67–88
/-- At a local maximum of `u - φ` the Hessians are ordered as quadratic
forms. -/
theorem hess_le_of_isLocalMax {u φ : EuclSpace d → ℝ} (hu : ContDiff ℝ 2 u)
    (hφ : ContDiff ℝ 2 φ) {x₀ : EuclSpace d}
    (hmax : IsLocalMax (fun y => u y - φ y) x₀) (v : EuclSpace d) :
    fderiv ℝ (fderiv ℝ u) x₀ v v ≤ fderiv ℝ (fderiv ℝ φ) x₀ v v := by
  have hd : ContDiff ℝ 2 (fun y => u y - φ y) := hu.sub hφ
  have h := hess_nonpos_of_isLocalMax hd hmax v
  have hsplit : fderiv ℝ (fderiv ℝ (fun y => u y - φ y)) x₀ v v
      = fderiv ℝ (fderiv ℝ u) x₀ v v - fderiv ℝ (fderiv ℝ φ) x₀ v v := by
    have h1 : fderiv ℝ (fun y => u y - φ y) = fderiv ℝ u - fderiv ℝ φ := by
      funext y
      exact fderiv_sub (hu.differentiable (by norm_num) y)
        (hφ.differentiable (by norm_num) y)
    rw [h1]
    have h2 : fderiv ℝ (fderiv ℝ u - fderiv ℝ φ) x₀
        = fderiv ℝ (fderiv ℝ u) x₀ - fderiv ℝ (fderiv ℝ φ) x₀ :=
      fderiv_sub (differentiable_fderiv hu x₀) (differentiable_fderiv hφ x₀)
    rw [h2]
    simp
  rw [hsplit] at h
  linarith
theoremviscF_le_of_classicalTheorem 2.4 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $\operatorname{ContDiff}(\mathbb{R}, 2, u)$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{IsLocalMax}(y \mapsto u(y) - \varphi(y), x_{0})$ hmax
  • $\operatorname{viscF}(p, \operatorname{gradient}(u, x_{0}), \operatorname{hess}(u, x_{0})) \le f(x_{0})$ hclass

Then $\operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0})) \le f(x_{0})$.

PLaplacian.viscF_le_of_classicalPlaplacian/Consistency.lean, lines 97–117
/-- **Consistency at a regular contact point.** If `u` is `C²` and satisfies
the operator inequality at `x₀`, and `u - φ` has a local maximum there with the
gradient of `φ` nonzero, then `φ` satisfies the inequality too. -/
theorem viscF_le_of_classical {p : ℝ} (hp : 2 ≤ p)
    {u φ : EuclSpace d → ℝ} (hu : ContDiff ℝ 2 u) (hφ : ContDiff ℝ 2 φ)
    {x₀ : EuclSpace d} (hmax : IsLocalMax (fun y => u y - φ y) x₀)
    {f : EuclSpace d → ℝ}
    (hclass : viscF p (gradient u x₀) (hess u x₀) ≤ f x₀) :
    viscF p (gradient φ x₀) (hess φ x₀) ≤ f x₀ := by
  have hgrad : gradient u x₀ = gradient φ x₀ :=
    gradient_eq_of_isLocalMax (hu.differentiable (by norm_num))
      (hφ.differentiable (by norm_num)) hmax
  have hhess : ∀ v : EuclSpace d, hess u x₀ v v ≤ hess φ x₀ v v :=
    hess_le_of_isLocalMax hu hφ hmax
  have hanti : viscF p (gradient φ x₀) (hess φ x₀)
      ≤ viscF p (gradient φ x₀) (hess u x₀) :=
    viscF_antitone p hp (gradient φ x₀) (hess u x₀) (hess φ x₀) hhess
  rw [← hgrad] at hanti
  calc viscF p (gradient φ x₀) (hess φ x₀)
      ≤ viscF p (gradient u x₀) (hess u x₀) := by rw [hgrad] at hanti ⊢; exact hanti
    _ ≤ f x₀ := hclass

Plaplacian/ContactArg.lean3 declarations

theoremfrequently_near_max
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < \delta$ hδ

Then ∃ᶠ (q : ℝ × EuclSpace d) in PLaplacian.relaxFilter x, PLaplacian.ubar u x - φ x - δ < u q.1 q.2 - φ q.2.

PLaplacian.frequently_near_maxPlaplacian/ContactArg.lean, lines 47–61
/-- **Frequent near-contact.** At a maximum of the relaxed limit minus the
test function, the family minus the test function is frequently within `δ` of
that maximum. -/
theorem frequently_near_max (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    (x : EuclSpace d) {δ : ℝ} (hδ : 0 < δ) :
    ∃ᶠ q in relaxFilter x,
      ubar u x - φ x - δ < u q.1 q.2 - φ q.2 := by
  have hbd := abs_sub_le_of_bounds u hC hB
  have heq := ubar_sub u hC hφ hB x
  have hlt : ubar u x - φ x - δ
      < ubar (fun ε y => u ε y - φ y) x := by
    rw [heq]; linarith [hδ]
  exact frequently_lt_of_lt_ubar (fun ε y => u ε y - φ y) hbd x hlt
theoremsub_le_of_global_max
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $w \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, w,\ u_{\varepsilon}(w) - \varphi(w) \le M$ hmax

Then $u_{\varepsilon}(w) - \varphi(w) \le M$.

PLaplacian.sub_le_of_global_maxPlaplacian/ContactArg.lean, lines 63–68
/-- The difference is bounded above by the maximum, when the maximum is
global for the relaxed limit and the family is below its own limit. -/
theorem sub_le_of_global_max (u : ℝ → EuclSpace d → ℝ)
    {φ : EuclSpace d → ℝ} {M : ℝ}
    (hmax : ∀ ε w, u ε w - φ w ≤ M) (ε : ℝ) :
    ∀ w, u ε w - φ w ≤ M := fun w => hmax ε w
theoremcontact_conclusion
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$, $M \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $y \in \Omega$ hy
  • $\forall w,\ u(w) - \varphi(w) \le M$ hmax
  • $u(y) - \varphi(y) = M$ heq

Then $\varphi(y) \le T_{\varepsilon} \varphi(y)$.

PLaplacian.contact_conclusionPlaplacian/ContactArg.lean, lines 70–81
/-- **The contact-point conclusion at a fixed parameter.**

If the family minus the test function is globally below `M` and equals `M` at
a point of the domain, the comparison through the operator applies. -/
theorem contact_conclusion {p ε : ℝ} (hp : 2 ≤ p) (hd : 0 < d)
    (hε : 0 < ε) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφb : BddMeas φ)
    {y : EuclSpace d} (hy : y ∈ Ω) {M : ℝ}
    (hmax : ∀ w, u w - φ w ≤ M) (heq : u y - φ y = M) :
    φ y ≤ tugOfWarOp p ε φ y :=
  dpp_comparison hp hd hε hpd hu hφb hy hmax heq

Plaplacian/ConvexBasics.lean7 declarations

defIsSubgrad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, p \in \mathbb{R}^{d}$.

Its value lies in $\mathrm{Prop}$.

/-- **A subgradient.** -/
def IsSubgrad (f : EuclSpace d → ℝ) (x p : EuclSpace d) : Prop :=
  ∀ z, f x + inner ℝ p (z - x) ≤ f z
theoremconvex_continuous
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then $f\text{ is continuous}$.

/-- **A convex function on the whole space is continuous.** -/
theorem convex_continuous (hf : ConvexOn ℝ univ f) : Continuous f :=
  continuousOn_univ.1 (ConvexOn.continuousOn isOpen_univ hf)
theoremconvex_lower_linear
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then there exists $C$ such that:

  • $0 \le C$
  • $\forall x,\ f(0) - C \cdot (1 + \lVert x\rVert) \le f(x)$
PLaplacian.convex_lower_linearPlaplacian/ConvexBasics.lean, lines 49–83
/-- **The linear lower bound.** -/
theorem convex_lower_linear (hf : ConvexOn ℝ univ f) :
    ∃ C : ℝ, 0 ≤ C ∧ ∀ x, f 0 - C * (1 + ‖x‖) ≤ f x := by
  have hc := convex_continuous hf
  obtain ⟨x₀, _, hmin⟩ := (isCompact_closedBall (0 : EuclSpace d) 1).exists_isMinOn
    ⟨0, by simp⟩ hc.continuousOn
  set m := f x₀ with hmdef
  set C := max 0 (f 0 - m) with hCdef
  have hC0 : 0 ≤ C := le_max_left _ _
  have hCm : f 0 - m ≤ C := le_max_right _ _
  refine ⟨C, hC0, fun x => ?_⟩
  by_cases hx : ‖x‖ ≤ 1
  · have h1 : m ≤ f x := hmin (mem_closedBall_zero_iff.2 hx)
    have h2 : 0 ≤ C * ‖x‖ := mul_nonneg hC0 (norm_nonneg x)
    nlinarith
  · push Not at hx
    have hn : ‖x‖ ≠ 0 := by linarith
    set t := ‖x‖⁻¹ with htdef
    have ht0 : 0 < t := inv_pos.2 (by linarith)
    have ht1 : t ≤ 1 := inv_le_one_of_one_le₀ hx.le
    -- the point on the unit sphere
    have hw : ‖t • x‖ = 1 := by
      rw [norm_smul, Real.norm_eq_abs, abs_of_pos ht0, htdef, inv_mul_cancel₀ hn]
    have h1 : m ≤ f (t • x) := hmin (mem_closedBall_zero_iff.2 hw.le)
    -- convexity along the ray
    have h2 : f (t • x) ≤ (1 - t) * f 0 + t * f x := by
      have := hf.2 (mem_univ 0) (mem_univ x) (by linarith : 0 ≤ 1 - t) ht0.le
        (by ring : 1 - t + t = 1)
      simpa using this
    have e1 : ‖x‖ * ((1 - t) * f 0 + t * f x) = (‖x‖ - 1) * f 0 + f x := by
      rw [htdef]; field_simp
    have h3 : ‖x‖ * m ≤ (‖x‖ - 1) * f 0 + f x := by
      rw [← e1]; exact mul_le_mul_of_nonneg_left (h1.trans h2) (norm_nonneg x)
    have h4 : ‖x‖ * (f 0 - m) ≤ ‖x‖ * C := mul_le_mul_of_nonneg_left hCm (norm_nonneg x)
    nlinarith
theoremconvex_bdd_above_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then there exists $M$ such that:

  • $\forall z \in \overline{B}(x, r),\ f(z) \le M$
PLaplacian.convex_bdd_above_ballPlaplacian/ConvexBasics.lean, lines 85–94
/-- **A convex function is bounded above on closed balls.** -/
theorem convex_bdd_above_ball (hf : ConvexOn ℝ univ f) (x : EuclSpace d) (r : ℝ) :
    ∃ M, ∀ z ∈ closedBall x r, f z ≤ M := by
  by_cases hr : 0 ≤ r
  · obtain ⟨z₀, _, hmax⟩ := (isCompact_closedBall x r).exists_isMaxOn
      ⟨x, mem_closedBall_self hr⟩ (convex_continuous hf).continuousOn
    exact ⟨f z₀, fun z hz => hmax hz⟩
  · refine ⟨0, fun z hz => ?_⟩
    rw [mem_closedBall] at hz
    exfalso; linarith [dist_nonneg (x := z) (y := x)]
theoremconvex_bdd_below_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then there exists $m$ such that:

  • $\forall z \in \overline{B}(x, r),\ m \le f(z)$
PLaplacian.convex_bdd_below_ballPlaplacian/ConvexBasics.lean, lines 96–105
/-- **A convex function is bounded below on closed balls.** -/
theorem convex_bdd_below_ball (hf : ConvexOn ℝ univ f) (x : EuclSpace d) (r : ℝ) :
    ∃ m, ∀ z ∈ closedBall x r, m ≤ f z := by
  by_cases hr : 0 ≤ r
  · obtain ⟨z₀, _, hmin⟩ := (isCompact_closedBall x r).exists_isMinOn
      ⟨x, mem_closedBall_self hr⟩ (convex_continuous hf).continuousOn
    exact ⟨f z₀, fun z hz => hmin hz⟩
  · refine ⟨0, fun z hz => ?_⟩
    rw [mem_closedBall] at hz
    exfalso; linarith [dist_nonneg (x := z) (y := x)]
theoremsubgrad_norm_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z, p \in \mathbb{R}^{d}$, $r, M, m \in \mathbb{R}$.

Assume

  • $0 < r$ hr
  • $\forall w \in \overline{B}(x, 2 \cdot r),\ f(w) \le M$ hM
  • $\forall w \in \overline{B}(x, 2 \cdot r),\ m \le f(w)$ hm
  • $z \in \overline{B}(x, r)$ hz
  • $\operatorname{IsSubgrad}(f, z, p)$ hp

Then $r \cdot \lVert p\rVert \le M - m$.

/-- **Subgradients are locally bounded.** -/
theorem subgrad_norm_le {x z p : EuclSpace d} {r M m : ℝ} (hr : 0 < r)
    (hM : ∀ w ∈ closedBall x (2 * r), f w ≤ M)
    (hm : ∀ w ∈ closedBall x (2 * r), m ≤ f w)
    (hz : z ∈ closedBall x r) (hp : IsSubgrad f z p) :
    r * ‖p‖ ≤ M - m := by
  have hz2 : z ∈ closedBall x (2 * r) :=
    closedBall_subset_closedBall (by linarith) hz
  by_cases hp0 : p = 0
  · rw [hp0, norm_zero, mul_zero]
    have := hM z hz2
    have := hm z hz2
    linarith
  · have hpn : 0 < ‖p‖ := norm_pos_iff.2 hp0
    set e := (r / ‖p‖) • p with hedef
    have he : ‖e‖ = r := by
      rw [hedef, norm_smul, Real.norm_eq_abs, abs_of_pos (div_pos hr hpn),
        div_mul_cancel₀ _ hpn.ne']
    have hze : z + e ∈ closedBall x (2 * r) := by
      rw [mem_closedBall, dist_eq_norm] at hz ⊢
      have : z + e - x = (z - x) + e := by abel
      rw [this]
      calc ‖(z - x) + e‖ ≤ ‖z - x‖ + ‖e‖ := norm_add_le _ _
        _ ≤ r + r := by rw [he]; linarith
        _ = 2 * r := by ring
    have h1 := hp (z + e)
    have e1 : z + e - z = e := by abel
    rw [e1, hedef, real_inner_smul_right, real_inner_self_eq_norm_sq] at h1
    have e2 : r / ‖p‖ * ‖p‖ ^ 2 = r * ‖p‖ := by field_simp
    rw [e2] at h1
    have := hM (z + e) hze
    have := hm z hz2
    linarith
theoremisSubgrad_of_tendsto
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{zs}, \mathrm{ps} \colon \mathbb{N} \to \mathbb{R}^{d}$, $z, p \in \mathbb{R}^{d}$.

Assume

  • $f\text{ is continuous}$ hc
  • $\operatorname{Tendsto}(\mathrm{zs}, \mathrm{atTop}, \operatorname{nhds}(z))$ hz
  • $\operatorname{Tendsto}(\mathrm{ps}, \mathrm{atTop}, \operatorname{nhds}(p))$ hp
  • $\forall n,\ \operatorname{IsSubgrad}(f, \operatorname{zs}(n), \operatorname{ps}(n))$ h

Then $\operatorname{IsSubgrad}(f, z, p)$.

PLaplacian.isSubgrad_of_tendstoPlaplacian/ConvexBasics.lean, lines 147–156
/-- **Limits of subgradients are subgradients.** -/
theorem isSubgrad_of_tendsto (hc : Continuous f) {zs ps : ℕ → EuclSpace d}
    {z p : EuclSpace d} (hz : Tendsto zs atTop (𝓝 z)) (hp : Tendsto ps atTop (𝓝 p))
    (h : ∀ n, IsSubgrad f (zs n) (ps n)) : IsSubgrad f z p := by
  intro w
  have h1 : Tendsto (fun n => f (zs n)) atTop (𝓝 (f z)) := (hc.tendsto z).comp hz
  have h2 : Tendsto (fun n => inner ℝ (ps n) (w - zs n)) atTop (𝓝 (inner ℝ p (w - z))) :=
    hp.inner (tendsto_const_nhds.sub hz)
  exact le_of_tendsto_of_tendsto (h1.add h2) tendsto_const_nhds
    (Eventually.of_forall fun n => h n w)

Plaplacian/CoreJA.lean9 declarations

theoremsuperJet_congr
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f, g \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $f = g$ hfg
  • (q, X) ∈ PLaplacian.SuperJet f x h

Then (q, X) ∈ PLaplacian.SuperJet g x.

PLaplacian.superJet_congrPlaplacian/CoreJA.lean, lines 43–46
/-- Superjet congruence. -/
theorem superJet_congr {f g : EuclSpace d → ℝ} (hfg : f = g) {x q : EuclSpace d}
    {X : Bilin d} (h : (q, X) ∈ SuperJet f x) : (q, X) ∈ SuperJet g x := by
  subst hfg; exact h
theoremnorm_sq_about
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y \in \mathbb{R}^{d}$.

Then $\lVert y\rVert ^{2} = \lVert x\rVert ^{2} + 2 \cdot \operatorname{inner}(\mathbb{R}, x, y - x) + \lVert y - x\rVert ^{2}$.

/-- The expansion of the squared norm about a point. -/
theorem norm_sq_about (x y : EuclSpace d) :
    ‖y‖ ^ 2 = ‖x‖ ^ 2 + 2 * inner ℝ x (y - x) + ‖y - x‖ ^ 2 := by
  have h := norm_add_sq_real x (y - x)
  rw [show x + (y - x) = y by abel] at h
  exact h
theoremsuperJet_sub_halfsq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\mathrm{lam} \in \mathbb{R}$.

Assume

  • (q, X) ∈ PLaplacian.SuperJet f x h

Then (q + -lam • x, X + -lam • PLaplacian.idForm d) ∈ PLaplacian.SuperJet (fun y => f y - lam / 2 * ‖y‖ ^ 2) x.

PLaplacian.superJet_sub_halfsqPlaplacian/CoreJA.lean, lines 55–71
/-- **Subtracting `(λ/2)‖·‖²` shifts a superjet** by `(-λ x, -λ I)`. -/
theorem superJet_sub_halfsq {f : EuclSpace d → ℝ} {x q : EuclSpace d}
    {X : Bilin d} (lam : ℝ) (h : (q, X) ∈ SuperJet f x) :
    (q + (-lam) • x, X + (-lam) • idForm d)
      ∈ SuperJet (fun y => f y - lam / 2 * ‖y‖ ^ 2) x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change f y ≤ f x + inner ℝ q (y - x) + (1 / 2) * (X (y - x)) (y - x)
    + η * ‖y - x‖ ^ 2 at hy
  change f y - lam / 2 * ‖y‖ ^ 2 ≤ f x - lam / 2 * ‖x‖ ^ 2
    + inner ℝ (q + (-lam) • x) (y - x)
    + (1 / 2) * ((X + (-lam) • idForm d) (y - x)) (y - x) + η * ‖y - x‖ ^ 2
  rw [add_form_apply, smul_form_apply, idForm_apply, inner_add_left,
    real_inner_smul_left]
  have hexp : lam / 2 * ‖y‖ ^ 2 = lam / 2 * ‖x‖ ^ 2 + lam * inner ℝ x (y - x)
      + lam / 2 * ‖y - x‖ ^ 2 := by rw [norm_sq_about x y]; ring
  linarith
theoremsubJet_sub_halfsq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\mathrm{lam} \in \mathbb{R}$.

Assume

  • (q, X) ∈ PLaplacian.SubJet f x h

Then (q + -lam • x, X + -lam • PLaplacian.idForm d) ∈ PLaplacian.SubJet (fun y => f y - lam / 2 * ‖y‖ ^ 2) x.

PLaplacian.subJet_sub_halfsqPlaplacian/CoreJA.lean, lines 73–89
/-- **Subtracting `(λ/2)‖·‖²` shifts a subjet** by `(-λ x, -λ I)`. -/
theorem subJet_sub_halfsq {f : EuclSpace d → ℝ} {x q : EuclSpace d}
    {X : Bilin d} (lam : ℝ) (h : (q, X) ∈ SubJet f x) :
    (q + (-lam) • x, X + (-lam) • idForm d)
      ∈ SubJet (fun y => f y - lam / 2 * ‖y‖ ^ 2) x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change f x + inner ℝ q (y - x) + (1 / 2) * (X (y - x)) (y - x)
    - η * ‖y - x‖ ^ 2 ≤ f y at hy
  change f x - lam / 2 * ‖x‖ ^ 2 + inner ℝ (q + (-lam) • x) (y - x)
    + (1 / 2) * ((X + (-lam) • idForm d) (y - x)) (y - x) - η * ‖y - x‖ ^ 2
    ≤ f y - lam / 2 * ‖y‖ ^ 2
  rw [add_form_apply, smul_form_apply, idForm_apply, inner_add_left,
    real_inner_smul_left]
  have hexp : lam / 2 * ‖y‖ ^ 2 = lam / 2 * ‖x‖ ^ 2 + lam * inner ℝ x (y - x)
      + lam / 2 * ‖y - x‖ ^ 2 := by rw [norm_sq_about x y]; ring
  linarith
defdblW0
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $z \in \mathbb{R}^{d} \times \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The doubled function without perturbation. -/
def dblW0 (u v : EuclSpace d → ℝ) (s r α : ℝ) (h0 : EuclSpace d)
    (z : EuclSpace d × EuclSpace d) : ℝ :=
  u z.1 - v z.2 - penP s r α h0 (z.1 - z.2)
theorempenP_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Then $\operatorname{penP}(s, r, \alpha, \mathrm{h0}, 0) = 0$.

theorem penP_zero (s r α : ℝ) (h0 : EuclSpace d) : penP s r α h0 0 = 0 := by
  simp [penP, penQ]
theoremconvexOn_dblW0
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam}, s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ _hlam
  • $\operatorname{SemiconvexWith}(\mathrm{lam}, u)$ hu
  • PLaplacian.SemiconvexWith lam fun y => -v y hv
  • $0 \le s$ hs
  • $0 \le r$ hr
  • $0 < \alpha$ hα

Then ConvexOn ℝ Set.univ fun z => PLaplacian.dblW0 u v s r α h0 z + (lam + 4 * PLaplacian.penM s r α h0) / 2 * (‖z.1‖ ^ 2 + ‖z.2‖ ^ 2).

/-- **The doubled function is semiconvex on the product.** -/
theorem convexOn_dblW0 (_hlam : 0 ≤ lam) (hu : SemiconvexWith lam u)
    (hv : SemiconvexWith lam (fun y => -v y)) (hs : 0 ≤ s) (hr : 0 ≤ r)
    (hα : 0 < α) :
    ConvexOn ℝ univ (fun z => dblW0 u v s r α h0 z
      + (lam + 4 * penM s r α h0) / 2 * (‖z.1‖ ^ 2 + ‖z.2‖ ^ 2)) := by
  have c1 : ConvexOn ℝ univ
      (fun z : EuclSpace d × EuclSpace d => u z.1 + lam / 2 * ‖z.1‖ ^ 2) := by
    refine ⟨convex_univ, fun z₁ _ z₂ _ a b ha hb hab => ?_⟩
    have := hu.2 (mem_univ z₁.1) (mem_univ z₂.1) ha hb hab
    simpa only [Prod.fst_add, Prod.smul_fst] using this
  have c2 : ConvexOn ℝ univ
      (fun z : EuclSpace d × EuclSpace d => -v z.2 + lam / 2 * ‖z.2‖ ^ 2) := by
    refine ⟨convex_univ, fun z₁ _ z₂ _ a b ha hb hab => ?_⟩
    have := hv.2 (mem_univ z₁.2) (mem_univ z₂.2) ha hb hab
    simpa only [Prod.snd_add, Prod.smul_snd] using this
  have c3 := convexOn_quadPart (h0 := h0) hs hr hα (le_refl (4 * penM s r α h0))
  have hsum := (c1.add c2).add c3
  have heq : (fun z => dblW0 u v s r α h0 z
        + (lam + 4 * penM s r α h0) / 2 * (‖z.1‖ ^ 2 + ‖z.2‖ ^ 2))
      = (fun z : EuclSpace d × EuclSpace d => u z.1 + lam / 2 * ‖z.1‖ ^ 2)
        + (fun z : EuclSpace d × EuclSpace d => -v z.2 + lam / 2 * ‖z.2‖ ^ 2)
        + (fun z : EuclSpace d × EuclSpace d =>
            4 * penM s r α h0 / 2 * (‖z.1‖ ^ 2 + ‖z.2‖ ^ 2)
              - penP s r α h0 (z.1 - z.2)) := by
    funext z
    simp only [dblW0, Pi.add_apply]
    ring
  rw [heq]
  exact hsum
theoremcore_point
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam}, s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $n \in \mathbb{N}$.

Assume

  • $\operatorname{AlexandrovThm}(d)$ hA
  • $\operatorname{JensenLemma}(d)$ hJ
  • $0 < \mathrm{lam}$ hlam
  • $\operatorname{SemiconvexWith}(\mathrm{lam}, u)$ hu
  • PLaplacian.SemiconvexWith lam fun y => -v y hv
  • $0 \le s$ hs
  • $0 \le r$ hr
  • $0 < \alpha$ hα
  • $\forall z,\ z \ne 0 \to \operatorname{dblW0}(u, v, s, r, \alpha, \mathrm{h0}, z) < \operatorname{dblW0}(u, v, s, r, \alpha, \mathrm{h0}, 0)$ hstrict

Then there exists $\xi, \zeta, a, b, X, Y$ such that:

  • ( a , X ) ∈ PLaplacian.SuperJet u ξ
  • ( b , Y ) ∈ PLaplacian.SubJet v ζ
  • $\lVert \xi\rVert < 1 / (n + 1)$
  • $\lVert \zeta\rVert < 1 / (n + 1)$
  • $\lVert a\rVert \le (4 \cdot \operatorname{penM}(s, r, \alpha, \mathrm{h0}) + 1) \cdot (1 / (n + 1))$
  • $\lVert b\rVert \le (4 \cdot \operatorname{penM}(s, r, \alpha, \mathrm{h0}) + 1) \cdot (1 / (n + 1))$
  • $\operatorname{QuadLE}(X, Y)$
  • $\forall w,\ - \mathrm{lam} \cdot \lVert w\rVert ^{2} \le (X(w))(w)$
  • $\forall w,\ (Y(w))(w) \le \mathrm{lam} \cdot \lVert w\rVert ^{2}$
/-- **One point of the core**, at scale `1/(n+1)`. -/
theorem core_point (hA : AlexandrovThm d) (hJ : JensenLemma d) (hlam : 0 < lam)
    (hu : SemiconvexWith lam u) (hv : SemiconvexWith lam (fun y => -v y))
    (hs : 0 ≤ s) (hr : 0 ≤ r) (hα : 0 < α)
    (hstrict : ∀ z : EuclSpace d × EuclSpace d, z ≠ 0 →
      dblW0 u v s r α h0 z < dblW0 u v s r α h0 0)
    (n : ℕ) :
    ∃ ξ ζ a b : EuclSpace d, ∃ X Y : Bilin d,
      (a, X) ∈ SuperJet u ξ ∧ (b, Y) ∈ SubJet v ζ ∧
      ‖ξ‖ < 1 / ((n : ℝ) + 1) ∧ ‖ζ‖ < 1 / ((n : ℝ) + 1) ∧
      ‖a‖ ≤ (4 * penM s r α h0 + 1) * (1 / ((n : ℝ) + 1)) ∧
      ‖b‖ ≤ (4 * penM s r α h0 + 1) * (1 / ((n : ℝ) + 1)) ∧
      QuadLE X Y ∧
      (∀ w, -lam * ‖w‖ ^ 2 ≤ (X w) w) ∧ (∀ w, (Y w) w ≤ lam * ‖w‖ ^ 2) := by
  set rn : ℝ := 1 / ((n : ℝ) + 1) with hrn
  have hrnpos : 0 < rn := by rw [hrn]; positivity
  set M := penM s r α h0 with hM
  have hM0 : 0 ≤ M := penM_nonneg hs hr hα
  -- Jensen
  have hconv := convexOn_dblW0 (h0 := h0) hlam.le hu hv hs hr hα
  have hpos := hJ (dblW0 u v s r α h0) (lam + 4 * M) hconv 0 rn hrnpos
    (fun z _ hz => hstrict z hz) rn hrnpos
  -- Alexandrov, on the product
  have hAu := hA (fun ξ => u ξ + lam / 2 * ‖ξ‖ ^ 2) hu
  have hAv := hA (fun ζ => -v ζ + lam / 2 * ‖ζ‖ ^ 2) hv
  have hprod : ∀ᵐ z ∂(volume : Measure (EuclSpace d × EuclSpace d)),
      (∃ q X, TwiceDiffAt (fun ξ => u ξ + lam / 2 * ‖ξ‖ ^ 2) z.1 q X) ∧
      (∃ q X, TwiceDiffAt (fun ζ => -v ζ + lam / 2 * ‖ζ‖ ^ 2) z.2 q X) := by
    rw [Measure.volume_eq_prod]
    exact (Measure.quasiMeasurePreserving_fst.ae hAu).and
      (Measure.quasiMeasurePreserving_snd.ae hAv)
  obtain ⟨z, hzK, ⟨q₁, X₁, hT1⟩, ⟨q₂, X₂, hT2⟩⟩ := exists_mem_of_pos_of_ae' hpos hprod
  obtain ⟨hzball, p₁, p₂, hp₁, hp₂, hlmax⟩ := hzK
  have hzn : ‖z‖ < rn := mem_ball_zero_iff.1 hzball
  set ξ := z.1 with hξ
  set ζ := z.2 with hζ
  have hξn : ‖ξ‖ < rn := lt_of_le_of_lt (norm_fst_le z) hzn
  have hζn : ‖ζ‖ < rn := lt_of_le_of_lt (norm_snd_le z) hzn
  have hmax : IsLocalMax (dblW u v (penP s r α h0) p₁ p₂) (ξ, ζ) := hlmax
  -- the jets of u
  have hfu : (fun y => (fun ξ => u ξ + lam / 2 * ‖ξ‖ ^ 2) y - lam / 2 * ‖y‖ ^ 2)
      = u := by funext y; simp only; ring
  have hsupU := superJet_congr hfu (superJet_sub_halfsq lam hT1.1)
  have hsubU := subJet_congr hfu (subJet_sub_halfsq lam hT1.2)
  -- the jets of -v, then of v
  have hfv : (fun y => (fun ζ => -v ζ + lam / 2 * ‖ζ‖ ^ 2) y - lam / 2 * ‖y‖ ^ 2)
      = fun y => -v y := by funext y; simp only; ring
  have hsupNV := superJet_congr hfv (superJet_sub_halfsq lam hT2.1)
  have hsubNV := subJet_congr hfv (subJet_sub_halfsq lam hT2.2)
  have hnn : (fun y => -(fun y => -v y) y) = v := by funext y; simp
  have hsubV := subJet_congr hnn (subJet_neg_of_superJet hsupNV)
  have hsupV := superJet_congr hnn (superJet_neg_of_subJet hsubNV)
  -- the core line arguments
  have hTay : ∀ k, penP s r α h0 (ξ - ζ + k)
      ≤ penP s r α h0 (ξ - ζ) + inner ℝ (penG s r α h0 (ξ - ζ)) k + M * ‖k‖ ^ 2 :=
    fun k => penP_taylor hs hα (ξ - ζ) k
  have hdiag := core_diag hmax hsubU hsupV
  have hga := core_grad_u hmax hsubU hTay
  have hgb := core_grad_v hmax hsupV hTay
  refine ⟨ξ, ζ, _, _, _, _, hsupU, hsubV, hξn, hζn, ?_, ?_, hdiag, ?_, ?_⟩
  · -- the gradient of u
    rw [hga]
    have hg := norm_penG_le (h0 := h0) hs hr hα (ξ - ζ)
    have hd : ‖ξ - ζ‖ ≤ ‖ξ‖ + ‖ζ‖ := norm_sub_le _ _
    calc ‖penG s r α h0 (ξ - ζ) - p₁‖ ≤ ‖penG s r α h0 (ξ - ζ)‖ + ‖p₁‖ :=
          norm_sub_le _ _
      _ ≤ 2 * M * (‖ξ‖ + ‖ζ‖) + rn := by
          have := mul_le_mul_of_nonneg_left hd (by positivity : (0:ℝ) ≤ 2 * M)
          linarith
      _ ≤ (4 * M + 1) * rn := by nlinarith
  · -- the gradient of v
    rw [hgb]
    have hg := norm_penG_le (h0 := h0) hs hr hα (ξ - ζ)
    have hd : ‖ξ - ζ‖ ≤ ‖ξ‖ + ‖ζ‖ := norm_sub_le _ _
    calc ‖penG s r α h0 (ξ - ζ) + p₂‖ ≤ ‖penG s r α h0 (ξ - ζ)‖ + ‖p₂‖ :=
          norm_add_le _ _
      _ ≤ 2 * M * (‖ξ‖ + ‖ζ‖) + rn := by
          have := mul_le_mul_of_nonneg_left hd (by positivity : (0:ℝ) ≤ 2 * M)
          linarith
      _ ≤ (4 * M + 1) * rn := by nlinarith
  · -- the lower bound on X
    exact fun w => semiconvex_superJet hu hsupU w
  · -- the upper bound on Y
    intro w
    have h := semiconvex_superJet hv hsupNV w
    rw [neg_form_apply]
    linarith
theoremcore_sequences
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam}, s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{AlexandrovThm}(d)$ hA
  • $\operatorname{JensenLemma}(d)$ hJ
  • $0 < \mathrm{lam}$ hlam
  • $\operatorname{SemiconvexWith}(\mathrm{lam}, u)$ hu
  • PLaplacian.SemiconvexWith lam fun y => -v y hv
  • $0 \le s$ hs
  • $0 \le r$ hr
  • $0 < \alpha$ hα
  • $\forall z,\ z \ne 0 \to \operatorname{dblW0}(u, v, s, r, \alpha, \mathrm{h0}, z) < \operatorname{dblW0}(u, v, s, r, \alpha, \mathrm{h0}, 0)$ hstrict

Then there exists $\mathrm{ξs}, \mathrm{ζs}, \mathrm{as}, \mathrm{bs}, \mathrm{Xs}, \mathrm{Ys}$ such that:

  • ∀ ( n : ℕ ) , ( as n , Xs n ) ∈ PLaplacian.SuperJet u ( ξs n )
  • ∀ ( n : ℕ ) , ( bs n , Ys n ) ∈ PLaplacian.SubJet v ( ζs n )
  • $\operatorname{Tendsto}(\mathrm{ξs}, \mathrm{atTop}, \operatorname{nhds}(0))$
  • $\operatorname{Tendsto}(\mathrm{ζs}, \mathrm{atTop}, \operatorname{nhds}(0))$
  • $\operatorname{Tendsto}(\mathrm{as}, \mathrm{atTop}, \operatorname{nhds}(0))$
  • $\operatorname{Tendsto}(\mathrm{bs}, \mathrm{atTop}, \operatorname{nhds}(0))$
  • $\forall n,\ \operatorname{QuadLE}(\operatorname{Xs}(n), \operatorname{Ys}(n))$
  • $\forall n, w,\ - \mathrm{lam} \cdot \lVert w\rVert ^{2} \le ((\operatorname{Xs}(n))(w))(w)$
  • $\forall n, w,\ ((\operatorname{Ys}(n))(w))(w) \le \mathrm{lam} \cdot \lVert w\rVert ^{2}$
/-- **The core, as sequences.** -/
theorem core_sequences (hA : AlexandrovThm d) (hJ : JensenLemma d)
    (hlam : 0 < lam) (hu : SemiconvexWith lam u)
    (hv : SemiconvexWith lam (fun y => -v y))
    (hs : 0 ≤ s) (hr : 0 ≤ r) (hα : 0 < α)
    (hstrict : ∀ z : EuclSpace d × EuclSpace d, z ≠ 0 →
      dblW0 u v s r α h0 z < dblW0 u v s r α h0 0) :
    ∃ (ξs ζs as bs : ℕ → EuclSpace d) (Xs Ys : ℕ → Bilin d),
      (∀ n, (as n, Xs n) ∈ SuperJet u (ξs n)) ∧
      (∀ n, (bs n, Ys n) ∈ SubJet v (ζs n)) ∧
      Tendsto ξs atTop (𝓝 0) ∧ Tendsto ζs atTop (𝓝 0) ∧
      Tendsto as atTop (𝓝 0) ∧ Tendsto bs atTop (𝓝 0) ∧
      (∀ n, QuadLE (Xs n) (Ys n)) ∧
      (∀ n w, -lam * ‖w‖ ^ 2 ≤ (Xs n w) w) ∧
      (∀ n w, (Ys n w) w ≤ lam * ‖w‖ ^ 2) := by
  have h := fun n : ℕ => core_point hA hJ hlam hu hv hs hr hα hstrict n
  choose ξs ζs as bs Xs Ys hsup hsub hξ hζ ha hb hle hXl hYu using h
  have h0t : Tendsto (fun n : ℕ => 1 / ((n : ℝ) + 1)) atTop (𝓝 0) :=
    tendsto_one_div_add_atTop_nhds_zero_nat
  have hCt : Tendsto (fun n : ℕ => (4 * penM s r α h0 + 1) * (1 / ((n : ℝ) + 1)))
      atTop (𝓝 0) := by
    have := h0t.const_mul (4 * penM s r α h0 + 1)
    rw [mul_zero] at this
    exact this
  exact ⟨ξs, ζs, as, bs, Xs, Ys, hsup, hsub,
    squeeze_zero_norm (fun n => (hξ n).le) h0t,
    squeeze_zero_norm (fun n => (hζ n).le) h0t,
    squeeze_zero_norm ha hCt, squeeze_zero_norm hb hCt, hle, hXl, hYu⟩

Plaplacian/CoreLines.lean8 declarations

theoremzero_form_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \in \mathbb{R}^{d}$.

Then $(0(v))(v) = 0$.

theorem zero_form_apply (v : EuclSpace d) : ((0 : Bilin d) v) v = 0 := by
  simp only [zero_apply]
theoremsmul_form_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $X \in \operatorname{Bilin}(d)$, $v \in \mathbb{R}^{d}$.

Then $((c \cdot X)(v))(v) = c \cdot (X(v))(v)$.

theorem smul_form_apply (c : ℝ) (X : Bilin d) (v : EuclSpace d) :
    ((c • X) v) v = c * (X v) v := by
  simp only [smul_apply, smul_eq_mul]
theoremisLocalMax_pullback
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $F \colon \mathbb{R}^{d} \times \mathbb{R}^{d} \to \mathbb{R}$, $z_{0} \in \mathbb{R}^{d} \times \mathbb{R}^{d}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}^{d} \times \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMax}(F, z_{0})$ hmax
  • $\operatorname{Tendsto}(\varphi, \operatorname{nhds}(x), \operatorname{nhds}(z_{0}))$ hφ
  • $\varphi(x) = z_{0}$ hx

Then $\operatorname{IsLocalMax}(y \mapsto F(\varphi(y)), x)$.

PLaplacian.isLocalMax_pullbackPlaplacian/CoreLines.lean, lines 55–64
/-- A local maximum pulls back along a continuous map. -/
theorem isLocalMax_pullback {F : EuclSpace d × EuclSpace d → ℝ}
    {z₀ : EuclSpace d × EuclSpace d} (hmax : IsLocalMax F z₀)
    {φ : EuclSpace d → EuclSpace d × EuclSpace d} {x : EuclSpace d}
    (hφ : Tendsto φ (𝓝 x) (𝓝 z₀)) (hx : φ x = z₀) :
    IsLocalMax (fun y => F (φ y)) x := by
  unfold IsLocalMax IsMaxFilter at hmax ⊢
  filter_upwards [hφ.eventually hmax] with y hy
  rw [hx]
  exact hy
theoremsubJet_add_affine
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $p \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • (q, X) ∈ PLaplacian.SubJet f x h

Then (q + p, X) ∈ PLaplacian.SubJet (fun y => f y + inner ℝ p y + c) x.

PLaplacian.subJet_add_affinePlaplacian/CoreLines.lean, lines 66–78
/-- Adding an affine function shifts a subjet's gradient. -/
theorem subJet_add_affine {f : EuclSpace d → ℝ} {x q : EuclSpace d}
    {X : Bilin d} (h : (q, X) ∈ SubJet f x) (p : EuclSpace d) (c : ℝ) :
    (q + p, X) ∈ SubJet (fun y => f y + inner ℝ p y + c) x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change f x + inner ℝ q (y - x) + (1 / 2) * (X (y - x)) (y - x)
    - η * ‖y - x‖ ^ 2 ≤ f y at hy
  change f x + inner ℝ p x + c + inner ℝ (q + p) (y - x)
    + (1 / 2) * (X (y - x)) (y - x) - η * ‖y - x‖ ^ 2 ≤ f y + inner ℝ p y + c
  have e : inner ℝ p (y - x) = inner ℝ p y - inner ℝ p x := inner_sub_right _ _ _
  rw [inner_add_left]
  linarith
defdblW
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v, P \colon \mathbb{R}^{d} \to \mathbb{R}$, $p_{1}, p_{2} \in \mathbb{R}^{d}$, $z \in \mathbb{R}^{d} \times \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The doubled function with linear perturbations. -/
def dblW (u v P : EuclSpace d → ℝ) (p₁ p₂ : EuclSpace d)
    (z : EuclSpace d × EuclSpace d) : ℝ :=
  u z.1 - v z.2 - P (z.1 - z.2) + inner ℝ p₁ z.1 + inner ℝ p₂ z.2
theoremcore_diag
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v, P \colon \mathbb{R}^{d} \to \mathbb{R}$, $p_{1}, p_{2}, \xi, \zeta, a, b \in \mathbb{R}^{d}$, $X, Y \in \operatorname{Bilin}(d)$.

Assume

  • IsLocalMax (PLaplacian.dblW u v P p₁ p₂) (ξ, ζ) hmax
  • (a, X) ∈ PLaplacian.SubJet u ξ hu
  • (b, Y) ∈ PLaplacian.SuperJet v ζ hv

Then $\operatorname{QuadLE}(X, Y)$.

/-- **Along the diagonal: `X ≤ Y`.** -/
theorem core_diag (hmax : IsLocalMax (dblW u v P p₁ p₂) (ξ, ζ))
    (hu : (a, X) ∈ SubJet u ξ) (hv : (b, Y) ∈ SuperJet v ζ) :
    QuadLE X Y := by
  set c := ζ - ξ with hc
  -- the restriction to the diagonal line through (ξ, ζ)
  have hφ : Tendsto (fun y : EuclSpace d => (y, y + c)) (𝓝 ξ) (𝓝 (ξ, ζ)) := by
    have h0 : Continuous (fun y : EuclSpace d => (y, y + c)) :=
      continuous_id.prodMk (continuous_id.add continuous_const)
    have := h0.tendsto ξ
    have e : ξ + c = ζ := by rw [hc]; abel
    rw [e] at this
    exact this
  have hφx : (fun y : EuclSpace d => (y, y + c)) ξ = (ξ, ζ) := by
    simp only; rw [hc]; congr 1; abel
  have hgmax := isLocalMax_pullback hmax hφ hφx
  -- its subjet
  have hv' : (b, Y) ∈ SuperJet v (ξ + c) := by
    have e : ξ + c = ζ := by rw [hc]; abel
    rw [e]; exact hv
  have hneg := subJet_comp_add c (subJet_neg_of_superJet hv')
  have hsum := subJet_add hu hneg
  have haff := subJet_add_affine hsum (p₁ + p₂) (-P (ξ - ζ) + inner ℝ p₂ c)
  have hfun : (fun y => (fun y => u y + (fun y => -v y) (y + c)) y
        + inner ℝ (p₁ + p₂) y + (-P (ξ - ζ) + inner ℝ p₂ c))
      = fun y => dblW u v P p₁ p₂ (y, y + c) := by
    funext y
    unfold dblW
    simp only
    have e : y - (y + c) = ξ - ζ := by rw [hc]; abel
    rw [e, inner_add_left, inner_add_right]
    ring
  have hg := subJet_congr hfun haff
  have hcond := (localMax_subJet hgmax hg).2
  intro w
  have h1 := hcond w
  rw [add_form_apply, neg_form_apply, zero_form_apply] at h1
  linarith
theoremcore_grad_u
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v, P \colon \mathbb{R}^{d} \to \mathbb{R}$, $p_{1}, p_{2}, \xi, \zeta, a \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $g \in \mathbb{R}^{d}$, $M \in \mathbb{R}$.

Assume

  • IsLocalMax (PLaplacian.dblW u v P p₁ p₂) (ξ, ζ) hmax
  • (a, X) ∈ PLaplacian.SubJet u ξ hu
  • $\forall k,\ P(\xi - \zeta + k) \le P(\xi - \zeta) + \operatorname{inner}(\mathbb{R}, g, k) + M \cdot \lVert k\rVert ^{2}$ hP

Then $a = g - p_{1}$.

/-- **In the first variable: the gradient of `û`.** -/
theorem core_grad_u (hmax : IsLocalMax (dblW u v P p₁ p₂) (ξ, ζ))
    (hu : (a, X) ∈ SubJet u ξ) {g : EuclSpace d} {M : ℝ}
    (hP : ∀ k, P (ξ - ζ + k) ≤ P (ξ - ζ) + inner ℝ g k + M * ‖k‖ ^ 2) :
    a = g - p₁ := by
  have hφ : Tendsto (fun y : EuclSpace d => (y, ζ)) (𝓝 ξ) (𝓝 (ξ, ζ)) :=
    (continuous_id.prodMk continuous_const).tendsto ξ
  have hgmax := isLocalMax_pullback hmax hφ rfl
  -- the penalty term has an exact quadratic lower bound at ξ
  have hpen : (-g, (-2 * M) • idForm d) ∈ SubJet (fun y => -P (y - ζ)) ξ := by
    apply subJet_of_lower
    intro k
    have e : ξ + k - ζ = ξ - ζ + k := by abel
    rw [e, smul_form_apply, idForm_apply, inner_neg_left]
    have := hP k
    linarith
  have hsum := subJet_add hu hpen
  have haff := subJet_add_affine hsum p₁ (-v ζ + inner ℝ p₂ ζ)
  have hfun : (fun y => (fun y => u y + -P (y - ζ)) y + inner ℝ p₁ y
        + (-v ζ + inner ℝ p₂ ζ))
      = fun y => dblW u v P p₁ p₂ (y, ζ) := by
    funext y; unfold dblW; simp only; ring
  have hg := subJet_congr hfun haff
  have hq := (localMax_subJet hgmax hg).1
  have : a = -(-g) - p₁ := by
    have h2 : a + -g + p₁ = 0 := hq
    calc a = (a + -g + p₁) + g - p₁ := by abel
      _ = 0 + g - p₁ := by rw [h2]
      _ = -(-g) - p₁ := by abel
  rw [this, neg_neg]
theoremcore_grad_v
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v, P \colon \mathbb{R}^{d} \to \mathbb{R}$, $p_{1}, p_{2}, \xi, \zeta, b \in \mathbb{R}^{d}$, $Y \in \operatorname{Bilin}(d)$, $g \in \mathbb{R}^{d}$, $M \in \mathbb{R}$.

Assume

  • IsLocalMax (PLaplacian.dblW u v P p₁ p₂) (ξ, ζ) hmax
  • (b, Y) ∈ PLaplacian.SuperJet v ζ hv
  • $\forall k,\ P(\xi - \zeta + k) \le P(\xi - \zeta) + \operatorname{inner}(\mathbb{R}, g, k) + M \cdot \lVert k\rVert ^{2}$ hP

Then $b = g + p_{2}$.

/-- **In the second variable: the gradient of `v̌`.** -/
theorem core_grad_v (hmax : IsLocalMax (dblW u v P p₁ p₂) (ξ, ζ))
    (hv : (b, Y) ∈ SuperJet v ζ) {g : EuclSpace d} {M : ℝ}
    (hP : ∀ k, P (ξ - ζ + k) ≤ P (ξ - ζ) + inner ℝ g k + M * ‖k‖ ^ 2) :
    b = g + p₂ := by
  have hφ : Tendsto (fun y : EuclSpace d => (ξ, y)) (𝓝 ζ) (𝓝 (ξ, ζ)) :=
    (continuous_const.prodMk continuous_id).tendsto ζ
  have hgmax := isLocalMax_pullback hmax hφ rfl
  have hneg := subJet_neg_of_superJet hv
  -- the penalty term, now in the second variable
  have hpen : (g, (-2 * M) • idForm d) ∈ SubJet (fun y => -P (ξ - y)) ζ := by
    apply subJet_of_lower
    intro k
    have e : ξ - (ζ + k) = ξ - ζ + -k := by abel
    rw [e, smul_form_apply, idForm_apply]
    have := hP (-k)
    rw [inner_neg_right, norm_neg] at this
    linarith
  have hsum := subJet_add hneg hpen
  have haff := subJet_add_affine hsum p₂ (u ξ + inner ℝ p₁ ξ)
  have hfun : (fun y => (fun y => -v y + -P (ξ - y)) y + inner ℝ p₂ y
        + (u ξ + inner ℝ p₁ ξ))
      = fun y => dblW u v P p₁ p₂ (ξ, y) := by
    funext y; unfold dblW; simp only; ring
  have hg := subJet_congr hfun haff
  have hq := (localMax_subJet hgmax hg).1
  have h2 : -b + g + p₂ = 0 := hq
  calc b = b + (-b + g + p₂) := by rw [h2, add_zero]
    _ = g + p₂ := by abel

Plaplacian/CubicBound.lean2 declarations

theoremiteratedFDeriv_three_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $y \in \mathbb{R}^{d}$, $z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ _hφ
  • $\lVert \operatorname{iteratedFDeriv}(\mathbb{R}, 3, \varphi, y)\rVert \le C$ hC

Then |(iteratedFDeriv ℝ 3 φ y) fun x => z| ≤ C * ‖z‖ ^ 3.

PLaplacian.iteratedFDeriv_three_lePlaplacian/CubicBound.lean, lines 59–70
/-- The trilinear evaluation of the third derivative, bounded. -/
theorem iteratedFDeriv_three_le {φ : EuclSpace d → ℝ} (_hφ : ContDiff ℝ 3 φ)
    {C : ℝ} {y : EuclSpace d} (hC : ‖iteratedFDeriv ℝ 3 φ y‖ ≤ C)
    (z : EuclSpace d) :
    |iteratedFDeriv ℝ 3 φ y (fun _ => z)| ≤ C * ‖z‖ ^ 3 := by
  have h := (iteratedFDeriv ℝ 3 φ y).le_opNorm (fun _ : Fin 3 => z)
  have hprod : ∏ _i : Fin 3, ‖z‖ = ‖z‖ ^ 3 := by
    simp [Finset.prod_const]
  rw [hprod] at h
  have hznn : (0:ℝ) ≤ ‖z‖ ^ 3 := by positivity
  simp only [Real.norm_eq_abs] at h
  nlinarith [h, hC, hznn]
theoremexists_cubic_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $C$ such that:

  • ∀ y ∈ Metric.closedBall x ε , ∀ ( z : EuclSpace d ) , | ( iteratedFDeriv ℝ 3 φ y ) fun x => z | ≤ C * ‖ z ‖ ^ 3
PLaplacian.exists_cubic_boundPlaplacian/CubicBound.lean, lines 72–78
/-- **A uniform cubic bound on the third derivative over a ball.** -/
theorem exists_cubic_bound {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x : EuclSpace d) (ε : ℝ) :
    ∃ C : ℝ, ∀ y ∈ closedBall x ε, ∀ z : EuclSpace d,
      |iteratedFDeriv ℝ 3 φ y (fun _ => z)| ≤ C * ‖z‖ ^ 3 := by
  obtain ⟨C, hC⟩ := exists_uniform_bound hφ x ε
  exact ⟨C, fun y hy z => iteratedFDeriv_three_le hφ (hC y hy) z⟩

Plaplacian/CubicTaylor.lean3 declarations

theoremnorm_iteratedFDeriv_three_comp
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$, $t, C \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\forall i \le 3,\ \lVert \operatorname{iteratedFDeriv}(\mathbb{R}, i, \varphi, x + t \cdot z)\rVert \le C$ hC

Then $\lVert \operatorname{iteratedFDeriv}(\mathbb{R}, 3, \varphi \circ s \mapsto x + s \cdot z, t)\rVert \le 6 \cdot C \cdot \lVert z\rVert ^{3}$.

PLaplacian.norm_iteratedFDeriv_three_compPlaplacian/CubicTaylor.lean, lines 57–67
/-- The cubic bound on the composition, from norm_iteratedFDeriv_comp_le. -/
theorem norm_iteratedFDeriv_three_comp {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 3 φ) (x z : EuclSpace d) (t : ℝ) {C : ℝ}
    (hC : ∀ i ≤ 3, ‖iteratedFDeriv ℝ i φ (x + t • z)‖ ≤ C) :
    ‖iteratedFDeriv ℝ 3 (φ ∘ (fun s : ℝ => x + s • z)) t‖
      ≤ 6 * C * ‖z‖ ^ 3 := by
  have h := norm_iteratedFDeriv_comp_le hφ (contDiff_line x z 3)
    (le_refl (3 : WithTop ℕ∞)) t hC (line_deriv_bounds x z t)
  have hfact : ((3 : ℕ).factorial : ℝ) = 6 := by norm_num [Nat.factorial]
  rw [hfact] at h
  exact h
theoremcomp_line_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Then $(\varphi \circ s \mapsto x + s \cdot z) = s \mapsto \varphi(x + s \cdot z)$.

/-- The line composition, as a function. -/
theorem comp_line_eq (φ : EuclSpace d → ℝ) (x z : EuclSpace d) :
    (φ ∘ (fun s : ℝ => x + s • z)) = fun s : ℝ => φ (x + s • z) := rfl
theoremderiv_three_cubic_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $C$ such that:

  • ∀ ( z : EuclSpace d ) , ‖ z ‖ ≤ ε → ∀ ( t : ℝ ) , x + t • z ∈ Metric.closedBall x ε → | deriv ( deriv ( deriv fun s => φ ( x + s • z ) ) ) t | ≤ 6 * C * ‖ z ‖ ^ 3
PLaplacian.deriv_three_cubic_boundPlaplacian/CubicTaylor.lean, lines 73–86
/-- **The third derivative of the restriction, bounded cubically.** -/
theorem deriv_three_cubic_bound {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x : EuclSpace d) (ε : ℝ) :
    ∃ C : ℝ, ∀ z : EuclSpace d, ‖z‖ ≤ ε → ∀ t : ℝ,
      x + t • z ∈ closedBall x ε →
      |deriv (deriv (deriv (fun s : ℝ => φ (x + s • z)))) t|
        ≤ 6 * C * ‖z‖ ^ 3 := by
  obtain ⟨C, hC⟩ := exists_bound_all_orders hφ x ε
  refine ⟨C, fun z hz t ht => ?_⟩
  have hbd := norm_iteratedFDeriv_three_comp hφ x z t (hC _ ht)
  rw [comp_line_eq] at hbd
  rw [← iteratedDeriv_three]
  rw [← norm_iteratedFDeriv_eq_abs_iteratedDeriv]
  exact hbd

Plaplacian/Deficit.lean2 declarations

theoremdecomp_at
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w \in \mathbb{R}^{d}$.

Then $\varphi(x + w) = \varphi(x) + (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(w) + 1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(w))(w) + \operatorname{taylorErr}(\varphi, x, w)$.

/-- The Taylor decomposition, at a point of the ball. -/
theorem decomp_at (φ : EuclSpace d → ℝ) (x w : EuclSpace d) :
    φ (x + w) = φ x + fderiv ℝ φ x w
      + (1 / 2) * fderiv ℝ (fderiv ℝ φ) x w w + taylorErr φ x w := by
  exact taylor_decomp φ x w
theoremdeficit_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, y \in \mathbb{R}^{d}$, $\varepsilon, K \in \mathbb{R}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $\varphi(x + (y - x)) \ge \varphi(x + \varepsilon \cdot \operatorname{gradDir}(\varphi, x))$ hdom
  • $1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(y - x))(y - x) + \operatorname{taylorErr}(\varphi, x, y - x) - (1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(\varepsilon \cdot \operatorname{gradDir}(\varphi, x)))(\varepsilon \cdot \operatorname{gradDir}(\varphi, x)) + \operatorname{taylorErr}(\varphi, x, \varepsilon \cdot \operatorname{gradDir}(\varphi, x))) \le K$ hK

Then $\lVert \operatorname{gradient}(\varphi, x)\rVert \cdot (\varepsilon - \operatorname{inner}(\mathbb{R}, \operatorname{gradDir}(\varphi, x), y - x)) \le K$.

/-- **The deficit inequality, in abstract form.**

If the maximizer's value dominates the shifted point's, and the quadratic and
error terms on both sides are bounded by `K` in total, then the inner-product
deficit is at most `K` divided by the gradient norm. -/
theorem deficit_le {φ : EuclSpace d → ℝ} {x y : EuclSpace d}
    (hx : gradient φ x ≠ 0) {ε K : ℝ}
    (hdom : φ (x + (y - x)) ≥ φ (x + ε • gradDir φ x))
    (hK : (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (y - x) (y - x)
            + taylorErr φ x (y - x)
          - ((1 / 2) * fderiv ℝ (fderiv ℝ φ) x (ε • gradDir φ x)
                (ε • gradDir φ x)
              + taylorErr φ x (ε • gradDir φ x)) ≤ K) :
    ‖gradient φ x‖ * (ε - inner ℝ (gradDir φ x) (y - x)) ≤ K := by
  rw [decomp_at φ x (y - x), decomp_at φ x (ε • gradDir φ x)] at hdom
  rw [fderiv_eq_norm_mul_inner hx (y - x),
      fderiv_eq_at_shift hx ε] at hdom
  have hdist : ‖gradient φ x‖ * (ε - inner ℝ (gradDir φ x) (y - x))
      = ‖gradient φ x‖ * ε
        - ‖gradient φ x‖ * inner ℝ (gradDir φ x) (y - x) := by ring
  rw [hdist]
  have hcomm : ε * ‖gradient φ x‖ = ‖gradient φ x‖ * ε := mul_comm _ _
  rw [hcomm] at hdom
  linarith [hdom, hK]

Plaplacian/DeficitMono.lean6 declarations

theoremsSup_diff_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u, w, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $\forall x,\ w(x) \le u(x)$ hwu
  • $\forall x,\ \lvert u(x) - v(x)\rvert \le C$ hC

Then sSup ((fun x => w x - v x) '' S) ≤ sSup ((fun x => u x - v x) '' S).

/-- If `w ≤ u` pointwise then the sup of `w - v` is at most the sup of
`u - v`. Used to replace `u_ℓ` by `u` in the chained estimate. -/
theorem sSup_diff_mono {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u w v : EuclSpace d → ℝ} (hwu : ∀ x, w x ≤ u x)
    {C : ℝ} (hC : ∀ x, |u x - v x| ≤ C) :
    sSup ((fun x => w x - v x) '' S) ≤ sSup ((fun x => u x - v x) '' S) := by
  refine csSup_le (hS.image _) ?_
  rintro a ⟨x, hx, rfl⟩
  have h1 : w x - v x ≤ u x - v x := by linarith [hwu x]
  exact le_trans h1 (le_csSup (bddAbove_deficit hC) ⟨x, hx, rfl⟩)
theoremsetAverage_diff_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, w, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\forall x,\ w(x) \le u(x)$ hwu
  • $\operatorname{IntegrableOn}(y \mapsto w(y) - v(y), B(x, \varepsilon), \lambda)$ hwv
  • $\operatorname{IntegrableOn}(y \mapsto u(y) - v(y), B(x, \varepsilon), \lambda)$ huv

Then $\fint_{B(x, \varepsilon)} (w(y) - v(y) \le \fint_{B(x, \varepsilon)} (u(y) - v(y)) \, dy) \, dy$.

PLaplacian.setAverage_diff_monoPlaplacian/DeficitMono.lean, lines 48–54
/-- Same for the average over a ball. -/
theorem setAverage_diff_mono {u w v : EuclSpace d → ℝ}
    (hwu : ∀ x, w x ≤ u x) (x : EuclSpace d) {ε : ℝ}
    (hwv : MeasureTheory.IntegrableOn (fun y => w y - v y) (ball x ε))
    (huv : MeasureTheory.IntegrableOn (fun y => u y - v y) (ball x ε)) :
    (⨍ y in ball x ε, (w y - v y)) ≤ ⨍ y in ball x ε, (u y - v y) :=
  setAverage_mono_ball x hwv huv (fun y => by linarith [hwu y])
theoremiter_le_of_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $i, j \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep
  • $i \le j$ hij

Then $\operatorname{iter}(p, \varepsilon, u_{0}, i, x) \le \operatorname{iter}(p, \varepsilon, u_{0}, j, x)$.

/-- Monotonicity of the iteration in the index. -/
theorem iter_le_of_le (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) {i j : ℕ} (hij : i ≤ j) :
    ∀ x, iter p ε u₀ i x ≤ iter p ε u₀ j x := by
  intro x
  exact monotone_iter p ε hp hε hd hpd hu₀ hstep x hij
theoremiter_le_iterLimit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $j \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ _hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ _hstep

Then $\operatorname{iter}(p, \varepsilon, u_{0}, j, x) \le \operatorname{iterLimit}(p, \varepsilon, u_{0}, x)$.

PLaplacian.iter_le_iterLimitPlaplacian/DeficitMono.lean, lines 69–80
/-- Each iterate is below the limit, since the limit is the supremum. -/
theorem iter_le_iterLimit (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (_hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (_hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) (j : ℕ) (x : EuclSpace d) :
    iter p ε u₀ j x ≤ iterLimit p ε u₀ x := by
  unfold iterLimit
  refine le_ciSup (f := fun i => iter p ε u₀ i x) ?_ j
  refine ⟨C, ?_⟩
  rintro a ⟨i, rfl⟩
  exact (abs_le.1 (abs_iter_le p ε hp hε hpd hu₀ hC i x)).2
theoremdeficit_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $j \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep

Then $0 \le \operatorname{iterLimit}(p, \varepsilon, u_{0}, x) - \operatorname{iter}(p, \varepsilon, u_{0}, j, x)$.

/-- The deficit is nonnegative. -/
theorem deficit_nonneg (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) (j : ℕ) (x : EuclSpace d) :
    0 ≤ iterLimit p ε u₀ x - iter p ε u₀ j x := by
  have := iter_le_iterLimit p ε hp hε hd hpd hu₀ hC hstep j x
  linarith
theoremabs_deficit_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $j \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep

Then $\lvert \operatorname{iterLimit}(p, \varepsilon, u_{0}, x) - \operatorname{iter}(p, \varepsilon, u_{0}, j, x)\rvert \le 2 \cdot C$.

/-- The deficit is bounded by `2C`. -/
theorem abs_deficit_le (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) (j : ℕ) (x : EuclSpace d) :
    |iterLimit p ε u₀ x - iter p ε u₀ j x| ≤ 2 * C := by
  have hlo := (abs_le.1 (abs_iter_le p ε hp hε hpd hu₀ hC j x)).1
  have hhi := (abs_le.1 (abs_iter_le p ε hp hε hpd hu₀ hC j x)).2
  have hLlo : -C ≤ iterLimit p ε u₀ x := by
    have := iter_le_iterLimit p ε hp hε hd hpd hu₀ hC hstep 0 x
    simp only [iter_zero] at this
    linarith [(abs_le.1 (hC x)).1]
  have hLhi : iterLimit p ε u₀ x ≤ C := by
    unfold iterLimit
    refine ciSup_le fun i => ?_
    exact (abs_le.1 (abs_iter_le p ε hp hε hpd hu₀ hC i x)).2
  rw [abs_le]
  constructor <;> linarith

Plaplacian/DiffIneq.lean2 declarations

theoremdiff_inequality
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $y \in \Omega$ hy
  • $\operatorname{gradient}(\varphi, y) \ne 0$ hgrad
  • $\forall w,\ u(w) - \varphi(w) \le c$ hle
  • $u(y) - \varphi(y) = c$ heq

Then there exists $E$ such that:

  • $0 \le \varepsilon ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, y), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)) + E$
PLaplacian.diff_inequalityPlaplacian/DiffIneq.lean, lines 49–64
/-- **The differential inequality at fixed `ε`.** -/
theorem diff_inequality [Nontrivial (EuclSpace d)] {p ε : ℝ} (hp : 2 ≤ p)
    (hd : 0 < d) (hε : 0 < ε) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφ : ContDiff ℝ 3 φ)
    (hφb : BddMeas φ) {y : EuclSpace d} (hy : y ∈ Ω)
    (hgrad : gradient φ y ≠ 0) {c : ℝ}
    (hle : ∀ w, u w - φ w ≤ c) (heq : u y - φ y = c) :
    ∃ E : ℝ,
      0 ≤ ε ^ 2 / (2 * (p + (d : ℝ)))
          * normPLapOf p (gradient φ y) (fderiv ℝ (fderiv ℝ φ) y) + E := by
  obtain ⟨E, hE⟩ := tugOfWarOp_expansion_final hd p hpd hφ hgrad hε
  refine ⟨E, ?_⟩
  have hcmp := dpp_comparison hp hd hε hpd hu hφb hy hle heq
  rw [hE] at hcmp
  linarith [hcmp]
theoremnormPLap_mul_ge
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $I, E \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd
  • $0 < \varepsilon$ hε
  • $0 \le \varepsilon ^{2} / (2 \cdot (p + d)) \cdot I + E$ h

Then $- (2 \cdot (p + d)) \cdot E \le \varepsilon ^{2} \cdot I$.

PLaplacian.normPLap_mul_gePlaplacian/DiffIneq.lean, lines 66–81
/-- **The rearrangement, multiplied out.** From the inequality at scale `ε`,
the negated error times the weight is at most the operator times `ε²`. -/
theorem normPLap_mul_ge {p ε : ℝ} (hpd : 0 < p + (d : ℝ)) (hε : 0 < ε)
    {I E : ℝ} (h : 0 ≤ ε ^ 2 / (2 * (p + (d : ℝ))) * I + E) :
    - (2 * (p + (d : ℝ))) * E ≤ ε ^ 2 * I := by
  have h2 : (0:ℝ) < ε ^ 2 := by positivity
  have hpd2 : (0:ℝ) < 2 * (p + (d : ℝ)) := by linarith
  have hne : (2 * (p + (d : ℝ))) ≠ 0 := ne_of_gt hpd2
  have hmul := mul_le_mul_of_nonneg_left h (le_of_lt hpd2)
  rw [mul_zero] at hmul
  have hexp : 2 * (p + (d : ℝ))
      * (ε ^ 2 / (2 * (p + (d : ℝ))) * I + E)
      = ε ^ 2 * I + 2 * (p + (d : ℝ)) * E := by
    field_simp
  rw [hexp] at hmul
  linarith [hmul]

Plaplacian/DiffMin.lean2 declarations

theoremdiff_inequality_min
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $y \in \Omega$ hy
  • $\operatorname{gradient}(\varphi, y) \ne 0$ hgrad
  • $\forall w \in B(y, \varepsilon),\ u(y) - \varphi(y) \le u(w) - \varphi(w)$ hge

Then there exists $E$ such that:

  • $\varepsilon ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, y), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)) + E \le 0$
PLaplacian.diff_inequality_minPlaplacian/DiffMin.lean, lines 48–64
/-- **The differential inequality at a minimum, at fixed `ε`.** -/
theorem diff_inequality_min [Nontrivial (EuclSpace d)] {p ε : ℝ}
    (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφ : ContDiff ℝ 3 φ)
    (hφb : BddMeas φ) {y : EuclSpace d} (hy : y ∈ Ω)
    (hgrad : gradient φ y ≠ 0)
    (hge : ∀ w ∈ ball y ε, u y - φ y ≤ u w - φ w) :
    ∃ E : ℝ,
      ε ^ 2 / (2 * (p + (d : ℝ)))
          * normPLapOf p (gradient φ y) (fderiv ℝ (fderiv ℝ φ) y) + E
        ≤ 0 := by
  obtain ⟨E, hE⟩ := tugOfWarOp_expansion_final hd p hpd hφ hgrad hε
  refine ⟨E, ?_⟩
  have hcmp := dpp_comparison_local_min' hp hε hpd hu hφb hy hge
  rw [hE] at hcmp
  linarith [hcmp]
theoremnormPLap_mul_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $I, E \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd
  • $0 < \varepsilon$ hε
  • $\varepsilon ^{2} / (2 \cdot (p + d)) \cdot I + E \le 0$ h

Then $\varepsilon ^{2} \cdot I \le - (2 \cdot (p + d)) \cdot E$.

PLaplacian.normPLap_mul_lePlaplacian/DiffMin.lean, lines 66–80
/-- The rearrangement, multiplied out. -/
theorem normPLap_mul_le {p ε : ℝ} (hpd : 0 < p + (d : ℝ)) (hε : 0 < ε)
    {I E : ℝ}
    (h : ε ^ 2 / (2 * (p + (d : ℝ))) * I + E ≤ 0) :
    ε ^ 2 * I ≤ - (2 * (p + (d : ℝ))) * E := by
  have h2 : (0:ℝ) < ε ^ 2 := by positivity
  have hpd2 : (0:ℝ) < 2 * (p + (d : ℝ)) := by linarith
  have hmul := mul_le_mul_of_nonneg_left h (le_of_lt hpd2)
  rw [mul_zero] at hmul
  have hexp : 2 * (p + (d : ℝ))
      * (ε ^ 2 / (2 * (p + (d : ℝ))) * I + E)
      = ε ^ 2 * I + 2 * (p + (d : ℝ)) * E := by
    field_simp
  rw [hexp] at hmul
  linarith [hmul]

Plaplacian/DirichletExistence.lean26 declarations

defdirIter
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{N}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The Perron iteration of the restricted operator: `u₀` given,
`u_{j+1} = dppOp u_j`. -/
def dirIter (p ε : ℝ) (Ω : Set (EuclSpace d)) (u₀ : EuclSpace d → ℝ) :
    ℕ → (EuclSpace d → ℝ)
  | 0 => u₀
  | (j+1) => dppOp p ε Ω (dirIter p ε Ω u₀ j)
lemmadirIter_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$.

Then $\operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, 0) = u_{0}$.

@[simp] lemma dirIter_zero (p ε : ℝ) (Ω : Set (EuclSpace d))
    (u₀ : EuclSpace d → ℝ) : dirIter p ε Ω u₀ 0 = u₀ := rfl
lemmadirIter_succ
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $j \in \mathbb{N}$.

Then $\operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j + 1) = \widetilde{T}_{\varepsilon} \operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j)$.

@[simp] lemma dirIter_succ (p ε : ℝ) (Ω : Set (EuclSpace d))
    (u₀ : EuclSpace d → ℝ) (j : ℕ) :
    dirIter p ε Ω u₀ (j+1) = dppOp p ε Ω (dirIter p ε Ω u₀ j) := rfl
theoremabs_dppOp_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ \lvert v(y)\rvert \le C$ hC

Then $\lvert \widetilde{T}_{\varepsilon} v(x)\rvert \le C$.

/-- The restricted operator preserves a bound. -/
theorem abs_dppOp_le (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) (Ω : Set (EuclSpace d))
    {v : EuclSpace d → ℝ} (hv : BddMeas v) {C : ℝ} (hC : ∀ y, |v y| ≤ C)
    (x : EuclSpace d) : |dppOp p ε Ω v x| ≤ C := by
  by_cases hx : x ∈ Ω
  · rw [dppOp_of_mem p ε hx]
    exact abs_tugOfWarOp_le p ε hp hε hpd hv hC x
  · rw [dppOp_of_notMem p ε hx]
    exact hC x
theorembddMeas_dirIter
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $j \in \mathbb{N}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀

Then $\operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j)\text{ is admissible (bounded and Borel measurable)}$.

theorem bddMeas_dirIter (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) (j : ℕ) :
    BddMeas (dirIter p ε Ω u₀ j) := by
  induction j with
  | zero => exact hu₀
  | succ n ih => exact BddMeas.dppOp p ε hp hε hpd hΩm ih
theoremabs_dirIter_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $j \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC

Then $\lvert \operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j, x)\rvert \le C$.

theorem abs_dirIter_le (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C) (j : ℕ) :
    ∀ x, |dirIter p ε Ω u₀ j x| ≤ C := by
  induction j with
  | zero => exact hC
  | succ n ih =>
      intro x
      exact abs_dppOp_le p ε hp hε hpd Ω
        (bddMeas_dirIter p ε hp hε hpd hΩm hu₀ n) ih x
theoremdirIter_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $j \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall x,\ u_{0}(x) \le \widetilde{T}_{\varepsilon} u_{0}(x)$ hstep

Then $\operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j, x) \le \operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j + 1, x)$.

/-- From a subsolution of the restricted operator the iteration increases. -/
theorem dirIter_mono (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀)
    (hstep : ∀ x, u₀ x ≤ dppOp p ε Ω u₀ x) (j : ℕ) :
    ∀ x, dirIter p ε Ω u₀ j x ≤ dirIter p ε Ω u₀ (j+1) x := by
  induction j with
  | zero => exact hstep
  | succ n ih =>
      intro x
      exact dppOp_monotone p ε hp hd hε Ω
        (bddMeas_dirIter p ε hp hε hpd hΩm hu₀ n)
        (bddMeas_dirIter p ε hp hε hpd hΩm hu₀ (n+1)) ih x
theoremdirIter_eq_of_notMem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $j \in \mathbb{N}$.

Assume

  • $x \notin \Omega$ hx

Then $\operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j, x) = u_{0}(x)$.

/-- **The exterior data is never moved.** -/
theorem dirIter_eq_of_notMem (p ε : ℝ) {Ω : Set (EuclSpace d)}
    {u₀ : EuclSpace d → ℝ} {x : EuclSpace d} (hx : x ∉ Ω) (j : ℕ) :
    dirIter p ε Ω u₀ j x = u₀ x := by
  induction j with
  | zero => rfl
  | succ n ih => rw [dirIter_succ, dppOp_of_notMem p ε hx, ih]
theoremmonotone_dirIter
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall x,\ u_{0}(x) \le \widetilde{T}_{\varepsilon} u_{0}(x)$ hstep

Then Monotone fun j => PLaplacian.dirIter p ε Ω u₀ j x.

theorem monotone_dirIter (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀)
    (hstep : ∀ x, u₀ x ≤ dppOp p ε Ω u₀ x) (x : EuclSpace d) :
    Monotone (fun j => dirIter p ε Ω u₀ j x) :=
  monotone_nat_of_le_succ fun n =>
    dirIter_mono p ε hp hε hd hpd hΩm hu₀ hstep n x
defdirLimit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The limit of the iteration, as the pointwise supremum. -/
def dirLimit (p ε : ℝ) (Ω : Set (EuclSpace d)) (u₀ : EuclSpace d → ℝ)
    (x : EuclSpace d) : ℝ :=
  ⨆ j, dirIter p ε Ω u₀ j x
theorembddAbove_dirIter
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC

Then BddAbove (Set.range fun j => PLaplacian.dirIter p ε Ω u₀ j x).

theorem bddAbove_dirIter (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C) (x : EuclSpace d) :
    BddAbove (Set.range fun j => dirIter p ε Ω u₀ j x) := by
  refine ⟨C, ?_⟩
  rintro a ⟨j, rfl⟩
  exact (abs_le.1 (abs_dirIter_le p ε hp hε hpd hΩm hu₀ hC j x)).2
theoremtendsto_dirIter
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le \widetilde{T}_{\varepsilon} u_{0}(x)$ hstep

Then $\operatorname{Tendsto}(j \mapsto \operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j, x), \mathrm{atTop}, \operatorname{nhds}(\operatorname{dirLimit}(p, \varepsilon, \Omega, u_{0}, x)))$.

theorem tendsto_dirIter (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ dppOp p ε Ω u₀ x) (x : EuclSpace d) :
    Tendsto (fun j => dirIter p ε Ω u₀ j x) atTop
      (𝓝 (dirLimit p ε Ω u₀ x)) :=
  tendsto_atTop_ciSup (monotone_dirIter p ε hp hε hd hpd hΩm hu₀ hstep x)
    (bddAbove_dirIter p ε hp hε hpd hΩm hu₀ hC x)
theoremdirIter_le_dirLimit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $j \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC

Then $\operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j, x) \le \operatorname{dirLimit}(p, \varepsilon, \Omega, u_{0}, x)$.

theorem dirIter_le_dirLimit (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C) (j : ℕ) (x : EuclSpace d) :
    dirIter p ε Ω u₀ j x ≤ dirLimit p ε Ω u₀ x :=
  le_ciSup (bddAbove_dirIter p ε hp hε hpd hΩm hu₀ hC x) j
theoremabs_dirLimit_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC

Then $\lvert \operatorname{dirLimit}(p, \varepsilon, \Omega, u_{0}, x)\rvert \le C$.

theorem abs_dirLimit_le (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C) (x : EuclSpace d) :
    |dirLimit p ε Ω u₀ x| ≤ C := by
  have hlo : -C ≤ dirLimit p ε Ω u₀ x := by
    have h0 := dirIter_le_dirLimit p ε hp hε hpd hΩm hu₀ hC 0 x
    simp only [dirIter_zero] at h0
    linarith [(abs_le.1 (hC x)).1]
  have hhi : dirLimit p ε Ω u₀ x ≤ C := by
    unfold dirLimit
    refine ciSup_le fun i => ?_
    exact (abs_le.1 (abs_dirIter_le p ε hp hε hpd hΩm hu₀ hC i x)).2
  rw [abs_le]
  exact ⟨hlo, hhi⟩
theorembddMeas_dirLimit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le \widetilde{T}_{\varepsilon} u_{0}(x)$ hstep

Then $\operatorname{dirLimit}(p, \varepsilon, \Omega, u_{0})\text{ is admissible (bounded and Borel measurable)}$.

theorem bddMeas_dirLimit (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ dppOp p ε Ω u₀ x) :
    BddMeas (dirLimit p ε Ω u₀) := by
  refine ⟨?_, ⟨C, abs_dirLimit_le p ε hp hε hpd hΩm hu₀ hC⟩⟩
  refine measurable_of_tendsto_metrizable
    (f := fun j => dirIter p ε Ω u₀ j) ?_ ?_
  · exact fun j => (bddMeas_dirIter p ε hp hε hpd hΩm hu₀ j).meas
  · rw [tendsto_pi_nhds]
    exact fun x => tendsto_dirIter p ε hp hε hd hpd hΩm hu₀ hC hstep x
theoremdirLimit_eq_of_notMem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $x \notin \Omega$ hx

Then $\operatorname{dirLimit}(p, \varepsilon, \Omega, u_{0}, x) = u_{0}(x)$.

/-- The limit equals the starting function outside `Ω`. -/
theorem dirLimit_eq_of_notMem (p ε : ℝ) {Ω : Set (EuclSpace d)}
    {u₀ : EuclSpace d → ℝ} {x : EuclSpace d} (hx : x ∉ Ω) :
    dirLimit p ε Ω u₀ x = u₀ x := by
  unfold dirLimit
  simp only [dirIter_eq_of_notMem p ε hx]
  exact ciSup_const
theoremdeficit_le_zero_gen
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $M \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is admissible (bounded and Borel measurable)}$ hBMu
  • $\forall j,\ w(j)\text{ is admissible (bounded and Borel measurable)}$ hBM
  • $\forall j, y,\ w(j, y) \le u(y)$ hle
  • $\forall j, y,\ \lvert u(y) - w(j, y)\rvert \le C$ hCd
  • $\forall j, y,\ 0 \le u(y) - w(j, y)$ hnn
  • $\forall \eta > 0,\ \forall \delta' > 0,\ \exists k,\ \int_{\Omega_{\varepsilon}} (u(y) - w(k, y) \le \eta \wedge \operatorname{deficitSup}(\Omega_{\varepsilon}, u, w(k)) \le M + \delta') \, dy$ hglob
  • $\forall k,\ \operatorname{IntegrableOn}(y \mapsto u(y) - w(k, y), \Omega_{\varepsilon}, \lambda)$ hint
  • $\forall \delta,\ 0 < \delta \to \forall k,\ \exists x_{0} \in \Omega,\ \exists l,\ M - 2 \cdot \delta \le T_{\varepsilon} w(l)(x_{0}) - T_{\varepsilon} w(k)(x_{0})$ hsel

Then $M \le 0$.

theorem deficit_le_zero_gen (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)}
    {u : EuclSpace d → ℝ} {w : ℕ → EuclSpace d → ℝ} {C : ℝ}
    (hBMu : BddMeas u) (hBM : ∀ j, BddMeas (w j))
    (hle : ∀ j y, w j y ≤ u y)
    (hCd : ∀ j y, |u y - w j y| ≤ C)
    (hnn : ∀ j y, 0 ≤ u y - w j y)
    {M : ℝ}
    (hglob : ∀ η > 0, ∀ δ' > 0, ∃ k, (∫ y in closureEps Ω ε,
      (u y - w k y)) ≤ η
      ∧ deficitSup (closureEps Ω ε) u (w k) ≤ M + δ')
    (hint : ∀ k, MeasureTheory.IntegrableOn
      (fun y => u y - w k y) (closureEps Ω ε))
    (hsel : ∀ (δ : ℝ), 0 < δ → ∀ k : ℕ, ∃ x₀ ∈ Ω, ∃ l : ℕ,
      M - 2 * δ ≤ tugOfWarOp p ε (w l) x₀ - tugOfWarOp p ε (w k) x₀) :
    M ≤ 0 := by
  have hα : (0 : ℝ) ≤ (p - 2) / (p + (d : ℝ)) :=
    div_nonneg (by linarith) hpd.le
  have hβ : (0 : ℝ) < ((d : ℝ) + 2) / (p + (d : ℝ)) := by positivity
  have hvol : (0 : ℝ) < volume.real (ball (0 : EuclSpace d) ε) := by
    have h1 : volume (ball (0 : EuclSpace d) ε) ≠ 0 :=
      measure_ball_ne_zero 0 hε
    have h2 : volume (ball (0 : EuclSpace d) ε) ≠ ⊤ := measure_ball_lt_top.ne
    simp only [MeasureTheory.Measure.real]
    exact ENNReal.toReal_pos h1 h2
  refine deficitLimit_le_zero hα hβ (alpha_add_beta p hpd) ?_
  intro δ hδ
  set η := δ * volume.real (ball (0 : EuclSpace d) ε)
    / (((d : ℝ) + 2) / (p + (d : ℝ))) with hηdef
  have hηpos : 0 < η := by
    rw [hηdef]; positivity
  have hηeq : ((d : ℝ) + 2) / (p + (d : ℝ))
      * ((volume.real (ball (0 : EuclSpace d) ε))⁻¹ * η) = δ := by
    rw [hηdef]
    field_simp
  obtain ⟨k, hksmall, hksup⟩ := hglob η hηpos δ hδ
  obtain ⟨x₀, hx₀Ω, l, hchain⟩ := hsel δ hδ k
  refine ⟨⨍ y in ball x₀ ε, (u y - w k y),
          sSup ((fun y => u y - w k y) '' ball x₀ ε),
          ?_, ?_, ?_⟩
  · refine le_trans hchain ?_
    exact bound_one p ε hp hε hpd hBMu (hBM l) (hBM k)
      (fun y => hle l y) (hCd k) x₀
  · exact bound_two (hCd k) hksup hx₀Ω hε
  · rw [← hηeq]
    exact bound_three hε (hnn k) (hint k) hx₀Ω hβ.le hksmall
theoremintegrableOn_of_bddMeas
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $S \subseteq \mathbb{R}^{d}$.

Assume

  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • MeasureTheory.volume S ≠ ⊤ hSfin

Then $\operatorname{IntegrableOn}(v, S, \lambda)$.

PLaplacian.integrableOn_of_bddMeasPlaplacian/DirichletExistence.lean, lines 259–270
/-- A bounded measurable function is integrable on a set of finite measure. -/
theorem integrableOn_of_bddMeas {v : EuclSpace d → ℝ} (hv : BddMeas v)
    {S : Set (EuclSpace d)} (hSfin : volume S ≠ ⊤) :
    MeasureTheory.IntegrableOn v S := by
  obtain ⟨D, hD⟩ := hv.bound
  have hconst : MeasureTheory.IntegrableOn
      (fun _ : EuclSpace d => D) S := by
    refine MeasureTheory.integrableOn_const ?_ ?_
    · exact hSfin
    · simp
  exact hconst.mono' hv.meas.aestronglyMeasurable
    (Filter.Eventually.of_forall fun y => by simpa using hD y)
theoremdeficitSup_le_of_vanish
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega, S \subseteq \mathbb{R}^{d}$, $u, w \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\Omega\text{ is nonempty}$ hΩn
  • $S\text{ is nonempty}$ hS
  • $\forall x,\ \lvert u(x) - w(x)\rvert \le C$ hC
  • $\forall x,\ 0 \le u(x) - w(x)$ hnn
  • $\forall x \notin \Omega,\ u(x) - w(x) = 0$ hoff

Then $\operatorname{deficitSup}(S, u, w) \le \operatorname{deficitSup}(\Omega, u, w)$.

PLaplacian.deficitSup_le_of_vanishPlaplacian/DirichletExistence.lean, lines 272–286
/-- If the deficit vanishes outside `Ω`, its supremum over any set is at most
its supremum over `Ω`. -/
theorem deficitSup_le_of_vanish {Ω S : Set (EuclSpace d)} (hΩn : Ω.Nonempty)
    (hS : S.Nonempty) {u w : EuclSpace d → ℝ} {C : ℝ}
    (hC : ∀ x, |u x - w x| ≤ C) (hnn : ∀ x, 0 ≤ u x - w x)
    (hoff : ∀ x, x ∉ Ω → u x - w x = 0) :
    deficitSup S u w ≤ deficitSup Ω u w := by
  unfold deficitSup
  refine csSup_le (hS.image _) ?_
  rintro a ⟨x, -, rfl⟩
  by_cases hx : x ∈ Ω
  · exact le_csSup (bddAbove_deficit hC) ⟨x, hx, rfl⟩
  · beta_reduce
    rw [hoff x hx]
    exact deficitSup_nonneg hΩn hC hnn
theoremdirIter_unifTheorem 7.5 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\eta \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $\Omega\text{ is nonempty}$ hΩn
  • $\Omega\text{ is bounded}$ hΩb
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le \widetilde{T}_{\varepsilon} u_{0}(x)$ hstep
  • $\eta > 0$ a._@._internal._hyg.0

Then there exists $N$ such that:

  • $\forall j \ge N,\ \forall x,\ \lvert \operatorname{dirLimit}(p, \varepsilon, \Omega, u_{0}, x) - \operatorname{dirIter}(p, \varepsilon, \Omega, u_{0}, j, x)\rvert \le \eta$
/-- **Uniform convergence of the iteration of `dppOp`, on all of `ℝᵈ`.** -/
theorem dirIter_unif (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    (hΩn : Ω.Nonempty) (hΩb : Bornology.IsBounded Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ dppOp p ε Ω u₀ x) :
    ∀ η > 0, ∃ N, ∀ j ≥ N, ∀ x,
      |dirLimit p ε Ω u₀ x - dirIter p ε Ω u₀ j x| ≤ η := by
  set u := dirLimit p ε Ω u₀ with hu
  set w := dirIter p ε Ω u₀ with hw
  have hBMu : BddMeas u := bddMeas_dirLimit p ε hp hε hd hpd hΩm hu₀ hC hstep
  have hBM : ∀ j, BddMeas (w j) := fun j => bddMeas_dirIter p ε hp hε hpd hΩm hu₀ j
  have hle : ∀ j y, w j y ≤ u y := fun j y =>
    dirIter_le_dirLimit p ε hp hε hpd hΩm hu₀ hC j y
  have hnn : ∀ j y, 0 ≤ u y - w j y := fun j y => by linarith [hle j y]
  have hCd : ∀ j y, |u y - w j y| ≤ 2 * C := fun j y => by
    have h1 := abs_le.1 (abs_dirLimit_le p ε hp hε hpd hΩm hu₀ hC y)
    have h2 := abs_le.1 (abs_dirIter_le p ε hp hε hpd hΩm hu₀ hC j y)
    rw [abs_le]; constructor <;> linarith
  have hmono : ∀ j y, w j y ≤ w (j + 1) y := fun j y =>
    dirIter_mono p ε hp hε hd hpd hΩm hu₀ hstep j y
  have hconv : ∀ x, Tendsto (fun j => w j x) atTop (𝓝 (u x)) := fun x =>
    tendsto_dirIter p ε hp hε hd hpd hΩm hu₀ hC hstep x
  have hoff : ∀ j x, x ∉ Ω → u x - w j x = 0 := fun j x hx => by
    rw [hu, hw, dirLimit_eq_of_notMem p ε hx, dirIter_eq_of_notMem p ε hx]
    ring
  -- the set over which the deficit is measured
  set S := closureEps Ω ε
  have hS : S.Nonempty := closureEps_nonempty hΩn ε
  have hSfin : volume S ≠ ⊤ :=
    (isBounded_closureEps hΩn hΩb hε.le).measure_lt_top.ne
  obtain ⟨M, hlim⟩ := exists_deficitLimit hS hCd hnn hmono
  -- the three inputs of the estimate
  have hint : ∀ k, MeasureTheory.IntegrableOn (fun y => u y - w k y) S :=
    fun k => integrableOn_of_bddMeas (hBMu.sub (hBM k)) hSfin
  have hintlim : Tendsto (fun j => ∫ y in S, (u y - w j y)) atTop (𝓝 0) :=
    tendsto_setIntegral_deficit hSfin (fun j => (hBMu.sub (hBM j)).meas)
      hCd hconv
  have hglob : ∀ η > 0, ∀ δ' > 0, ∃ k, (∫ y in S, (u y - w k y)) ≤ η
      ∧ deficitSup S u (w k) ≤ M + δ' := fun η hη δ' hδ' =>
    exists_index_both hintlim hlim hη hδ'
  have hsel : ∀ (δ : ℝ), 0 < δ → ∀ k : ℕ, ∃ x₀ ∈ Ω, ∃ l : ℕ,
      M - 2 * δ ≤ tugOfWarOp p ε (w l) x₀ - tugOfWarOp p ε (w k) x₀ := by
    intro δ hδ k
    have hMk : ∀ k, M ≤ deficitSup Ω u (w (k + 1)) := fun k =>
      le_trans (le_deficitSup_of_antitone hS hCd hmono hlim (k + 1))
        (deficitSup_le_of_vanish hΩn hS (hCd (k + 1)) (hnn (k + 1))
          (hoff (k + 1)))
    obtain ⟨x₀, hx₀, l, hl⟩ := exists_sel hΩn hδ hMk hconv k
    refine ⟨x₀, hx₀, l, ?_⟩
    have e1 : w (l + 1) x₀ = tugOfWarOp p ε (w l) x₀ := by
      rw [hw, dirIter_succ, dppOp_of_mem p ε hx₀]
    have e2 : w (k + 1) x₀ = tugOfWarOp p ε (w k) x₀ := by
      rw [hw, dirIter_succ, dppOp_of_mem p ε hx₀]
    rw [e1, e2] at hl
    exact hl
  have hM : M ≤ 0 :=
    deficit_le_zero_gen p ε hp hε hpd (Ω := Ω) hBMu hBM hle hCd hnn hglob hint hsel
  have hzero := tendsto_deficitSup_zero hS hCd hnn hlim hM
  -- from the deficit suprema to a uniform bound
  intro η hη
  obtain ⟨N, hN⟩ := Filter.eventually_atTop.1
    (hzero.eventually (eventually_le_nhds hη))
  refine ⟨N, fun j hj x => ?_⟩
  rw [abs_of_nonneg (hnn j x)]
  by_cases hx : x ∈ S
  · exact le_trans (le_csSup (bddAbove_deficit (hCd j)) ⟨x, hx, rfl⟩) (hN j hj)
  · have hxΩ : x ∉ Ω := fun h => hx (subset_closureEps Ω ε h)
    rw [hoff j x hxΩ]
    exact hη.le
theoremdirLimit_fixedTheorem 7.6 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $\Omega\text{ is bounded}$ hΩb
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le \widetilde{T}_{\varepsilon} u_{0}(x)$ hstep

Then $\widetilde{T}_{\varepsilon} \operatorname{dirLimit}(p, \varepsilon, \Omega, u_{0})(x) = \operatorname{dirLimit}(p, \varepsilon, \Omega, u_{0}, x)$.

/-- **The limit is a fixed point of the restricted operator.** -/
theorem dirLimit_fixed (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    (hΩb : Bornology.IsBounded Ω)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ dppOp p ε Ω u₀ x) (x : EuclSpace d) :
    dppOp p ε Ω (dirLimit p ε Ω u₀) x = dirLimit p ε Ω u₀ x := by
  by_cases hx : x ∈ Ω
  swap
  · exact dppOp_of_notMem p ε hx _
  rw [dppOp_of_mem p ε hx]
  have hBMu := bddMeas_dirLimit p ε hp hε hd hpd hΩm hu₀ hC hstep
  have hunif := dirIter_unif p ε hp hε hd hpd hΩm ⟨x, hx⟩ hΩb hu₀ hC hstep
  set D := tugOfWarOp p ε (dirLimit p ε Ω u₀) x - dirLimit p ε Ω u₀ x
    with hD
  have key : ∀ η > 0, |D| ≤ 2 * η := by
    intro η hη
    obtain ⟨N, hN⟩ := hunif η hη
    have h1 : |tugOfWarOp p ε (dirLimit p ε Ω u₀) x
        - tugOfWarOp p ε (dirIter p ε Ω u₀ N) x| ≤ η :=
      tugOfWarOp_nonexpansive p ε hp hd hε hpd hBMu
        (bddMeas_dirIter p ε hp hε hpd hΩm hu₀ N)
        (fun y => hN N le_rfl y) x
    have h2 : |dirLimit p ε Ω u₀ x - dirIter p ε Ω u₀ (N + 1) x| ≤ η :=
      hN (N + 1) (Nat.le_succ N) x
    have h3 : dirIter p ε Ω u₀ (N + 1) x
        = tugOfWarOp p ε (dirIter p ε Ω u₀ N) x := by
      rw [dirIter_succ, dppOp_of_mem p ε hx]
    rw [h3] at h2
    have h4 := abs_le.1 h1
    have h5 := abs_le.1 h2
    rw [hD, abs_le]
    constructor <;> linarith
  have hDzero : D = 0 := by
    by_contra hcon
    have hpos : 0 < |D| := abs_pos.2 hcon
    have := key (|D| / 4) (by positivity)
    linarith
  linarith [hDzero, hD]
defdirStart
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

open Classical in
/-- The starting function: `-C` on `Ω`, the data `F` outside. -/
def dirStart (Ω : Set (EuclSpace d)) (F : EuclSpace d → ℝ) (C : ℝ)
    (x : EuclSpace d) : ℝ :=
  if x ∈ Ω then -C else F x
lemmadirStart_of_mem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $x \in \Omega$ hx

Then $\operatorname{dirStart}(\Omega, F, C, x) = - C$.

lemma dirStart_of_mem {Ω : Set (EuclSpace d)} {F : EuclSpace d → ℝ} {C : ℝ}
    {x : EuclSpace d} (hx : x ∈ Ω) : dirStart Ω F C x = -C := by
  unfold dirStart; simp [hx]
lemmadirStart_of_notMem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $x \notin \Omega$ hx

Then $\operatorname{dirStart}(\Omega, F, C, x) = F(x)$.

lemma dirStart_of_notMem {Ω : Set (EuclSpace d)} {F : EuclSpace d → ℝ}
    {C : ℝ} {x : EuclSpace d} (hx : x ∉ Ω) : dirStart Ω F C x = F x := by
  unfold dirStart; simp [hx]
theoremexists_pharmoniousTheorem 7.6 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩm
  • $\Omega\text{ is bounded}$ hΩb
  • $F\text{ is Borel measurable}$ hFm
  • $\forall y,\ \lvert F(y)\rvert \le C$ hFC

Then there exists $u$ such that:

  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$
  • $\forall x \notin \Omega,\ u(x) = F(x)$
  • $\forall y,\ \lvert u(y)\rvert \le C$
/-- **Existence for the `ε`-problem with exterior data.** For bounded measurable
data `F` with `|F| ≤ C`, there is a `p`-harmonious function in `Ω` with data `F`
that equals `F` outside `Ω` and is bounded by `C`. -/
theorem exists_pharmonious (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩm : MeasurableSet Ω)
    (hΩb : Bornology.IsBounded Ω)
    {F : EuclSpace d → ℝ} (hFm : Measurable F) {C : ℝ}
    (hFC : ∀ y, |F y| ≤ C) :
    ∃ u : EuclSpace d → ℝ, IsPHarmonious p ε Ω F u
      ∧ (∀ x, x ∉ Ω → u x = F x) ∧ ∀ y, |u y| ≤ C := by
  have hC0 : 0 ≤ C := le_trans (abs_nonneg _) (hFC 0)
  have hbd : ∀ y, |dirStart Ω F C y| ≤ C := by
    intro y
    by_cases hy : y ∈ Ω
    · rw [dirStart_of_mem hy, abs_neg, abs_of_nonneg hC0]
    · rw [dirStart_of_notMem hy]; exact hFC y
  have hmeas : Measurable (dirStart Ω F C) := by
    unfold dirStart
    exact Measurable.ite hΩm measurable_const hFm
  have hu₀ : BddMeas (dirStart Ω F C) := ⟨hmeas, ⟨C, hbd⟩⟩
  have hstep : ∀ x, dirStart Ω F C x ≤ dppOp p ε Ω (dirStart Ω F C) x := by
    intro x
    by_cases hx : x ∈ Ω
    · rw [dirStart_of_mem hx, dppOp_of_mem p ε hx]
      exact (abs_le.1 (abs_tugOfWarOp_le p ε hp hε hpd hu₀ hbd x)).1
    · exact (dppOp_of_notMem p ε hx _).symm.le
  refine ⟨dirLimit p ε Ω (dirStart Ω F C), ⟨?_, ?_, ?_⟩, ?_, ?_⟩
  · exact bddMeas_dirLimit p ε hp hε hd hpd hΩm hu₀ hbd hstep
  · intro x hx
    have h := dirLimit_fixed p ε hp hε hd hpd hΩm hΩb hu₀ hbd hstep x
    rw [dppOp_of_mem p ε hx] at h
    exact h.symm
  · intro x hx
    rw [dirLimit_eq_of_notMem p ε hx.1, dirStart_of_notMem hx.1]
  · intro x hx
    rw [dirLimit_eq_of_notMem p ε hx, dirStart_of_notMem hx]
  · exact abs_dirLimit_le p ε hp hε hpd hΩm hu₀ hbd
theorempharmonious_exists_convergeTheorem 7.7 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $F\text{ is continuous}$ hFc
  • $\forall y,\ \lvert F(y)\rvert \le C$ hFC
  • $\forall y \in \partial \Omega,\ \exists z, \delta,\ 0 < \delta \wedge \lVert y - z\rVert = \delta \wedge \forall x \in \Omega,\ \delta \le \lVert x - z\rVert$ hext

Then there exists $u$ such that:

  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$
  • $\forall \varepsilon > 0,\ \forall x \notin \Omega,\ u_{\varepsilon}(x) = F(x)$
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$
  • $\forall x \in \overline{\Omega},\ \overline{u}(x) = \underline{u}(x)$
  • $\forall x \in \partial \Omega,\ \overline{u}(x) = F(x)$
  • $\forall \eta > 0,\ \exists \varepsilon_{0} > 0,\ \forall \varepsilon,\ 0 < \varepsilon \to \varepsilon < \varepsilon_{0} \to \forall x \in \overline{\Omega},\ \lvert u_{\varepsilon}(x) - \overline{u}(x)\rvert \le \eta$
PLaplacian.pharmonious_exists_convergePlaplacian/DirichletExistence.lean, lines 459–497
/-- **Existence and convergence.** Let `Ω` be bounded and open with an exterior
sphere at every boundary point, and `F` bounded and continuous. Then for every
`ε > 0` the `ε`-problem has a `p`-harmonious solution with data `F`, equal to
`F` outside `Ω`, and these solutions converge uniformly on `closure Ω` to the
common value of the relaxed limits, which equals `F` on `frontier Ω`. -/
theorem pharmonious_exists_converge [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)}
    (hΩo : IsOpen Ω) (hΩb : Bornology.IsBounded Ω) {F : EuclSpace d → ℝ}
    (hFc : Continuous F) {C : ℝ} (hFC : ∀ y, |F y| ≤ C)
    (hext : ∀ y ∈ frontier Ω, ∃ (z : EuclSpace d) (δ : ℝ), 0 < δ ∧
      ‖y - z‖ = δ ∧ ∀ x ∈ Ω, δ ≤ ‖x - z‖) :
    ∃ u : ℝ → EuclSpace d → ℝ,
      (∀ ε > 0, IsPHarmonious p ε Ω F (u ε)) ∧
      (∀ ε > 0, ∀ x, x ∉ Ω → u ε x = F x) ∧
      (∀ ε y, |u ε y| ≤ C) ∧
      (∀ x ∈ closure Ω, ubar u x = lbar u x) ∧
      (∀ x ∈ frontier Ω, ubar u x = F x) ∧
      (∀ η > 0, ∃ ε₀ > 0, ∀ ε, 0 < ε → ε < ε₀ → ∀ x ∈ closure Ω,
        |u ε x - ubar u x| ≤ η) := by
  have hex : ∀ ε : ℝ, 0 < ε → ∃ v : EuclSpace d → ℝ,
      IsPHarmonious p ε Ω F v ∧ (∀ x, x ∉ Ω → v x = F x) ∧ ∀ y, |v y| ≤ C :=
    fun ε hε => exists_pharmonious p ε hp hε hd hpd hΩo.measurableSet hΩb
      hFc.measurable hFC
  choose! U hU using hex
  set u : ℝ → EuclSpace d → ℝ := fun ε => if 0 < ε then U ε else F with hudef
  have hUeq : ∀ ε, 0 < ε → u ε = U ε := fun ε hε => by
    rw [hudef]; simp [hε]
  have hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε) := fun ε hε => by
    rw [hUeq ε hε]; exact (hU ε hε).1
  have hout : ∀ ε > 0, ∀ x, x ∉ Ω → u ε x = F x := fun ε hε x hx => by
    rw [hUeq ε hε]; exact (hU ε hε).2.1 x hx
  have hC : ∀ ε y, |u ε y| ≤ C := fun ε y => by
    by_cases hε : 0 < ε
    · rw [hUeq ε hε]; exact (hU ε hε).2.2 y
    · have h : u ε = F := by rw [hudef]; simp [hε]
      rw [h]; exact hFC y
  obtain ⟨h1, h2, h3⟩ :=
    pharmonious_converge hd hp hpd hΩo hΩb hFc hext hC hu hout
  exact ⟨u, hu, hout, hC, h1, h2, h3⟩

Plaplacian/DiscComp.lean2 declarations

theoremtugOfWarOp_diff_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $S \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $0 < \varepsilon$ hε
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y \in B(x, \varepsilon),\ u(y) - v(y) \le S$ hS

Then $T_{\varepsilon} u(x) - T_{\varepsilon} v(x) \le S$.

PLaplacian.tugOfWarOp_diff_lePlaplacian/DiscComp.lean, lines 31–85
/-- **The operator moves by at most the supremum of the difference.** -/
theorem tugOfWarOp_diff_le {p ε : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ)) (hε : 0 < ε)
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v) (x : EuclSpace d) {S : ℝ}
    (hS : ∀ y ∈ ball x ε, u y - v y ≤ S) :
    tugOfWarOp p ε u x - tugOfWarOp p ε v x ≤ S := by
  obtain ⟨Cu, hCu⟩ := hu.bound
  obtain ⟨Cv, hCv⟩ := hv.bound
  have hne : (ball x ε).Nonempty := ⟨x, mem_ball_self hε⟩
  have hvA : BddAbove (v '' ball x ε) := by
    refine ⟨Cv, ?_⟩
    rintro _ ⟨y, _, rfl⟩
    exact (abs_le.1 (hCv y)).2
  have huB : BddBelow (u '' ball x ε) := by
    refine ⟨-Cu, ?_⟩
    rintro _ ⟨y, _, rfl⟩
    exact (abs_le.1 (hCu y)).1
  -- the supremum
  have hsup : sSup (u '' ball x ε) ≤ S + sSup (v '' ball x ε) := by
    refine csSup_le (hne.image _) ?_
    rintro _ ⟨y, hy, rfl⟩
    have h1 := hS y hy
    have h2 : v y ≤ sSup (v '' ball x ε) := le_csSup hvA ⟨y, hy, rfl⟩
    linarith
  -- the infimum
  have hinf : sInf (u '' ball x ε) ≤ S + sInf (v '' ball x ε) := by
    have : sInf (u '' ball x ε) - S ≤ sInf (v '' ball x ε) := by
      refine le_csInf (hne.image _) ?_
      rintro _ ⟨y, hy, rfl⟩
      have h1 := hS y hy
      have h2 : sInf (u '' ball x ε) ≤ u y := csInf_le huB ⟨y, hy, rfl⟩
      linarith
    linarith
  -- the average
  have hiu := hu.integrableOn_ball x ε
  have hiv := hv.integrableOn_ball x ε
  have havg : (⨍ y in ball x ε, u y) - (⨍ y in ball x ε, v y) ≤ S := by
    rw [← average_sub hiu hiv]
    have hconst : IntegrableOn (fun _ : EuclSpace d => S) (ball x ε) := integrableOn_const
    have h1 := setAverage_mono measurableSet_ball (hiu.sub hiv) hconst
      (fun y hy => hS y hy)
    rw [setAverage_const_ball S x hε] at h1
    exact h1
  -- the weights
  have hα : 0 ≤ (p - 2) / (p + (d : ℝ)) / 2 := by
    have : 0 ≤ p - 2 := by linarith
    positivity
  have hβ : 0 ≤ ((d : ℝ) + 2) / (p + (d : ℝ)) := by positivity
  have hαβ := alpha_add_beta (d := d) p hpd
  unfold tugOfWarOp
  have k1 := mul_le_mul_of_nonneg_left (add_le_add hsup hinf) hα
  have k2 := mul_le_mul_of_nonneg_left havg hβ
  have e : (p - 2) / (p + (d : ℝ)) / 2 * (S + S) + ((d : ℝ) + 2) / (p + (d : ℝ)) * S = S := by
    have : (p - 2) / (p + (d : ℝ)) / 2 * (S + S) = (p - 2) / (p + (d : ℝ)) * S := by ring
    rw [this, ← add_mul, hαβ, one_mul]
  nlinarith
theoremdisc_comparisonTheorem 7.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $D \subseteq \mathbb{R}^{d}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\kappa \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $0 < \varepsilon$ hε
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall x \in D,\ u(x) = T_{\varepsilon} u(x)$ hU
  • $0 < \kappa$ hκ
  • $\forall x \in D,\ T_{\varepsilon} v(x) \le v(x) - \kappa$ hV
  • $\forall w \notin D,\ (\exists y \in D,\ \operatorname{dist}(w, y) < \varepsilon) \to u(w) \le v(w)$ hstrip
  • $x \in D$ a._@._internal._hyg.0

Then $u(x) \le v(x)$.

/-- **Discrete comparison against a strict supersolution.** -/
theorem disc_comparison {p ε : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ)) (hε : 0 < ε)
    {D : Set (EuclSpace d)} {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    (hU : ∀ x ∈ D, u x = tugOfWarOp p ε u x)
    {κ : ℝ} (hκ : 0 < κ) (hV : ∀ x ∈ D, tugOfWarOp p ε v x ≤ v x - κ)
    (hstrip : ∀ w, w ∉ D → (∃ y ∈ D, dist w y < ε) → u w ≤ v w) :
    ∀ x ∈ D, u x ≤ v x := by
  by_contra hcon
  push Not at hcon
  obtain ⟨x₀, hx₀D, hx₀⟩ := hcon
  obtain ⟨Cu, hCu⟩ := hu.bound
  obtain ⟨Cv, hCv⟩ := hv.bound
  -- the ε-neighbourhood of D, and the supremum of u - v over it
  set A := {w | ∃ y ∈ D, dist w y < ε} with hAdef
  have hx₀A : x₀ ∈ A := ⟨x₀, hx₀D, by rw [dist_self]; exact hε⟩
  have hbdd : BddAbove ((fun w => u w - v w) '' A) := by
    refine ⟨Cu + Cv, ?_⟩
    rintro _ ⟨w, _, rfl⟩
    have h1 := (abs_le.1 (hCu w)).2
    have h2 := (abs_le.1 (hCv w)).1
    change u w - v w ≤ Cu + Cv
    linarith
  set M := sSup ((fun w => u w - v w) '' A) with hM
  have hleM : ∀ w ∈ A, u w - v w ≤ M := fun w hw => le_csSup hbdd ⟨w, hw, rfl⟩
  have hMpos : 0 < M := by
    have := hleM x₀ hx₀A
    linarith
  -- every value is at most max (M - κ) 0
  have hbound : ∀ w ∈ A, u w - v w ≤ max (M - κ) 0 := by
    rintro w ⟨y, hyD, hwy⟩
    by_cases hwD : w ∈ D
    · -- on D: the difference drops by κ
      have hball : ∀ z ∈ ball w ε, u z - v z ≤ M := by
        intro z hz
        exact hleM z ⟨w, hwD, hz⟩
      have h1 := tugOfWarOp_diff_le hp hpd hε hu hv w hball
      have h2 := hU w hwD
      have h3 := hV w hwD
      have : u w - v w ≤ M - κ := by linarith
      exact le_trans this (le_max_left _ _)
    · -- outside D: u ≤ v
      have := hstrip w hwD ⟨y, hyD, hwy⟩
      exact le_trans (by linarith) (le_max_right _ _)
  have hMle : M ≤ max (M - κ) 0 := by
    refine csSup_le ⟨_, ⟨x₀, hx₀A, rfl⟩⟩ ?_
    rintro _ ⟨w, hw, rfl⟩
    exact hbound w hw
  rcases le_total (M - κ) 0 with h | h
  · rw [max_eq_right h] at hMle; linarith
  · rw [max_eq_left h] at hMle; linarith

Plaplacian/DiscUnique.lean7 declarations

defstepConst
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$.

Its value lies in $\mathbb{R}$.

/-- The constant of the one-step estimate: `2 |B_ε| / (β |B_{ε/4}|)`. -/
def stepConst (p ε : ℝ) : ℝ :=
  2 * volume.real (ball (0 : EuclSpace d) ε)
    / (((d : ℝ) + 2) / (p + (d : ℝ))
        * volume.real (ball (0 : EuclSpace d) (ε / 4)))
theoremvolumeReal_ball_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $r \in \mathbb{R}$.

Assume

  • $0 < r$ hr

Then $0 < \operatorname{volume.real}(B(0, r))$.

PLaplacian.volumeReal_ball_posPlaplacian/DiscUnique.lean, lines 56–61
theorem volumeReal_ball_pos {r : ℝ} (hr : 0 < r) :
    0 < volume.real (ball (0 : EuclSpace d) r) := by
  have h1 : volume (ball (0 : EuclSpace d) r) ≠ 0 := measure_ball_ne_zero 0 hr
  have h2 : volume (ball (0 : EuclSpace d) r) ≠ ⊤ := measure_ball_lt_top.ne
  simp only [MeasureTheory.Measure.real]
  exact ENNReal.toReal_pos h1 h2
theoremintegrableOn_const_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(x \mapsto c, B(x, r), \lambda)$.

PLaplacian.integrableOn_const_ballPlaplacian/DiscUnique.lean, lines 63–67
theorem integrableOn_const_ball (c : ℝ) (x : EuclSpace d) (r : ℝ) :
    IntegrableOn (fun _ : EuclSpace d => c) (ball x r) := by
  refine MeasureTheory.integrableOn_const ?_ ?_
  · exact measure_ball_lt_top.ne
  · simp
theoremstep_arith
Formal statementgenerated from the Lean declaration

Let $M, \delta, a, b, A, V, K, s \in \mathbb{R}$.

Assume

  • $0 < b$ hb
  • $0 < V$ hV
  • $0 < \delta$ hδ
  • $a + b = 1$ hab
  • $M - \delta < a \cdot M + b \cdot A$ hw
  • $K \cdot \delta \cdot s = 2 \cdot V \cdot \delta / b$ hK
  • $K \cdot \delta \cdot s \le V \cdot (M - A)$ hint

Then $\mathrm{False}$.

/-- The arithmetic at the end of the one-step estimate. -/
theorem step_arith {M δ a b A V K s : ℝ} (hb : 0 < b) (hV : 0 < V)
    (hδ : 0 < δ) (hab : a + b = 1) (hw : M - δ < a * M + b * A)
    (hK : K * δ * s = 2 * V * δ / b) (hint : K * δ * s ≤ V * (M - A)) :
    False := by
  have ha : a * M = M - b * M := by
    have : a = 1 - b := by linarith
    rw [this]; ring
  have h1 : b * (M - A) < δ := by nlinarith
  have h2 : V * (b * (M - A)) < V * δ := mul_lt_mul_of_pos_left h1 hV
  have h3 : 2 * V * δ / b ≤ V * (M - A) := by rw [← hK]; exact hint
  have h4 : 2 * V * δ ≤ V * (M - A) * b := (div_le_iff₀ hb).1 h3
  have h5 : 0 < V * δ := mul_pos hV hδ
  nlinarith
theoremdisc_stepLemma 7.8 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$, $e \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall x \in \Omega,\ u(x) = T_{\varepsilon} u(x)$ hTu
  • $\forall x \in \Omega,\ v(x) = T_{\varepsilon} v(x)$ hTv
  • $\forall y,\ v(y) - u(y) \le M$ hM
  • $x \in \Omega$ hx
  • $0 < \delta$ hδ
  • $M - \delta < v(x) - u(x)$ hwx
  • $\lVert e\rVert = 1$ he

Then there exists $y$ such that:

  • $M - \operatorname{stepConst}(p, \varepsilon) \cdot \delta < v(y) - u(y)$
  • $\operatorname{inner}(\mathbb{R}, x, e) + \varepsilon / 2 \le \operatorname{inner}(\mathbb{R}, y, e)$
/-- **The one-step estimate.** If `v - u ≤ M` everywhere and `v x - u x > M - δ`
at a point `x ∈ Ω`, then `v - u > M - Cδ` at some point `y` with
`⟪y, e⟫ ≥ ⟪x, e⟫ + ε / 2`. -/
theorem disc_step (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)}
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    (hTu : ∀ x ∈ Ω, u x = tugOfWarOp p ε u x)
    (hTv : ∀ x ∈ Ω, v x = tugOfWarOp p ε v x)
    {M : ℝ} (hM : ∀ y, v y - u y ≤ M)
    {x : EuclSpace d} (hx : x ∈ Ω) {δ : ℝ} (hδ : 0 < δ)
    (hwx : M - δ < v x - u x) {e : EuclSpace d} (he : ‖e‖ = 1) :
    ∃ y, M - stepConst (d := d) p ε * δ < v y - u y
      ∧ ⟪x, e⟫ + ε / 2 ≤ ⟪y, e⟫ := by
  have hβ : 0 < ((d : ℝ) + 2) / (p + (d : ℝ)) := by positivity
  have hα : 0 ≤ (p - 2) / (p + (d : ℝ)) := div_nonneg (by linarith) hpd.le
  have hab := alpha_add_beta p hpd
  have hV : 0 < volume.real (ball (0 : EuclSpace d) ε) := volumeReal_ball_pos hε
  have hs : 0 < volume.real (ball (0 : EuclSpace d) (ε / 4)) :=
    volumeReal_ball_pos (by linarith)
  have hw : BddMeas (fun y => v y - u y) := hv.sub hu
  -- the equation at x
  have hkey := key_estimate p ε hp hε hpd hu hv x
  have hsup : sSup ((fun y => v y - u y) '' ball x ε) ≤ M := by
    refine csSup_le ((nonempty_ball x hε).image _) ?_
    rintro _ ⟨y, -, rfl⟩
    exact hM y
  have hwx' : v x - u x ≤ (p - 2) / (p + (d : ℝ)) * M
      + ((d : ℝ) + 2) / (p + (d : ℝ)) * ⨍ y in ball x ε, (v y - u y) := by
    have h1 : v x - u x = tugOfWarOp p ε v x - tugOfWarOp p ε u x := by
      rw [← hTv x hx, ← hTu x hx]
    have h2 := mul_le_mul_of_nonneg_left hsup hα
    rw [h1]
    linarith [hkey]
  -- the small ball near the edge of B_ε(x), in the direction e
  set c := x + (3 * ε / 4) • e with hcdef
  have hcx : ‖c - x‖ = 3 * ε / 4 := by
    rw [hcdef, add_sub_cancel_left, norm_smul, he, mul_one, Real.norm_eq_abs,
      abs_of_pos (by linarith)]
  have hSB : ball c (ε / 4) ⊆ ball x ε := by
    intro y hy
    rw [mem_ball] at hy ⊢
    calc dist y x ≤ dist y c + dist c x := dist_triangle _ _ _
      _ < ε / 4 + 3 * ε / 4 := by
          rw [dist_eq_norm c x, hcx]; linarith
      _ = ε := by ring
  -- every point of the small ball lies far enough in the direction e
  have hfar : ∀ y ∈ ball c (ε / 4), ⟪x, e⟫ + ε / 2 ≤ ⟪y, e⟫ := by
    intro y hy
    have hyc : ‖y - c‖ < ε / 4 := by rw [← dist_eq_norm]; exact mem_ball.1 hy
    have h5 : -(ε / 4) ≤ ⟪y - c, e⟫ := by
      have := abs_real_inner_le_norm (y - c) e
      rw [he, mul_one] at this
      linarith [neg_abs_le ⟪y - c, e⟫]
    have h6 : ⟪c, e⟫ = ⟪x, e⟫ + 3 * ε / 4 := by
      rw [hcdef, inner_add_left, real_inner_smul_left, real_inner_self_eq_norm_sq, he]
      ring
    have h7 : ⟪y, e⟫ = ⟪y - c, e⟫ + ⟪c, e⟫ := by
      rw [← inner_add_left, sub_add_cancel]
    linarith
  -- by contradiction: no point of the small ball has v - u > M - Cδ
  by_contra hcon
  push Not at hcon
  have hlow : ∀ y ∈ ball c (ε / 4),
      stepConst (d := d) p ε * δ ≤ M - (v y - u y) := by
    intro y hy
    by_contra hlt
    push Not at hlt
    have := hcon y (by linarith)
    linarith [hfar y hy]
  -- integrate over the small ball and over B_ε(x)
  have hintB : IntegrableOn (fun y => M - (v y - u y)) (ball x ε) :=
    Integrable.sub (integrableOn_const_ball M x ε) (hw.integrableOn_ball x ε)
  have hintS : IntegrableOn (fun y => M - (v y - u y)) (ball c (ε / 4)) :=
    hintB.mono_set hSB
  have hnn : ∀ y, 0 ≤ M - (v y - u y) := fun y => by linarith [hM y]
  have hI1 : (∫ y in ball c (ε / 4), (M - (v y - u y)))
      ≤ ∫ y in ball x ε, (M - (v y - u y)) :=
    MeasureTheory.setIntegral_mono_set hintB
      (Filter.Eventually.of_forall hnn) (LE.le.eventuallyLE hSB)
  have hI2 : (∫ y in ball c (ε / 4), (stepConst (d := d) p ε * δ))
      ≤ ∫ y in ball c (ε / 4), (M - (v y - u y)) :=
    MeasureTheory.setIntegral_mono_on (integrableOn_const_ball _ c _) hintS
      measurableSet_ball hlow
  have hI3 : (∫ y in ball c (ε / 4), (stepConst (d := d) p ε * δ))
      = stepConst (d := d) p ε * δ
          * volume.real (ball (0 : EuclSpace d) (ε / 4)) := by
    rw [MeasureTheory.setIntegral_const, smul_eq_mul,
      volumeReal_ball_center c (ε / 4)]
    ring
  have hI4 : (∫ y in ball x ε, (M - (v y - u y)))
      = volume.real (ball (0 : EuclSpace d) ε)
          * (M - ⨍ y in ball x ε, (v y - u y)) := by
    rw [MeasureTheory.integral_sub (integrableOn_const_ball M x ε)
        (hw.integrableOn_ball x ε),
      MeasureTheory.setIntegral_const, smul_eq_mul,
      MeasureTheory.setAverage_eq, smul_eq_mul, volumeReal_ball_center x ε,
      mul_sub, ← mul_assoc, mul_inv_cancel₀ hV.ne', one_mul]
  have hint : stepConst (d := d) p ε * δ
        * volume.real (ball (0 : EuclSpace d) (ε / 4))
      ≤ volume.real (ball (0 : EuclSpace d) ε)
          * (M - ⨍ y in ball x ε, (v y - u y)) := by
    rw [← hI3, ← hI4]; exact le_trans hI2 hI1
  have hK : stepConst (d := d) p ε * δ
        * volume.real (ball (0 : EuclSpace d) (ε / 4))
      = 2 * volume.real (ball (0 : EuclSpace d) ε) * δ
          / (((d : ℝ) + 2) / (p + (d : ℝ))) := by
    have hsne := hs.ne'
    have hβne := hβ.ne'
    have hpdne : p + (d : ℝ) ≠ 0 := hpd.ne'
    have hd2 : (d : ℝ) + 2 ≠ 0 := by positivity
    unfold stepConst
    field_simp
  exact step_arith hβ hV hδ hab (lt_of_lt_of_le hwx hwx') hK hint
theoremsup_diff_nonposTheorem 7.9 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is bounded}$ hΩb
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall x \in \Omega,\ u(x) = T_{\varepsilon} u(x)$ hTu
  • $\forall x \in \Omega,\ v(x) = T_{\varepsilon} v(x)$ hTv
  • $\forall x \notin \Omega,\ u(x) = v(x)$ hout

Then $v(x) \le u(x)$.

/-- **The difference of two solutions is nonpositive.** If `u` and `v` satisfy
the dynamic programming principle in a bounded set `Ω` and agree outside `Ω`,
then `v ≤ u`. -/
theorem sup_diff_nonpos [Nontrivial (EuclSpace d)] (p ε : ℝ) (hp : 2 ≤ p)
    (hε : 0 < ε) (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)}
    (hΩb : Bornology.IsBounded Ω)
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    (hTu : ∀ x ∈ Ω, u x = tugOfWarOp p ε u x)
    (hTv : ∀ x ∈ Ω, v x = tugOfWarOp p ε v x)
    (hout : ∀ x, x ∉ Ω → u x = v x) :
    ∀ x, v x ≤ u x := by
  have hw : BddMeas (fun y => v y - u y) := hv.sub hu
  obtain ⟨B, hB⟩ := hw.bound
  have hbdd : BddAbove (range fun y => v y - u y) :=
    ⟨B, by rintro _ ⟨y, rfl⟩; exact (abs_le.1 (hB y)).2⟩
  set M := ⨆ y, (v y - u y)
  have hM : ∀ y, v y - u y ≤ M := fun y => le_ciSup hbdd y
  -- it suffices to show M ≤ 0
  suffices hM0 : M ≤ 0 by
    intro x
    linarith [hM x]
  by_contra hMpos
  push Not at hMpos
  -- a point where v - u > 0 lies in Ω
  have hmem : ∀ y, 0 < v y - u y → y ∈ Ω := by
    intro y hy
    by_contra hyΩ
    rw [hout y hyΩ, sub_self] at hy
    exact lt_irrefl _ hy
  -- a unit direction, and a bound for Ω in that direction
  obtain ⟨e, he⟩ := exists_norm_eq (EuclSpace d) zero_le_one
  obtain ⟨R, hR⟩ := hΩb.exists_norm_le
  have hproj : ∀ y ∈ Ω, |⟪y, e⟫| ≤ R := by
    intro y hy
    have := abs_real_inner_le_norm y e
    rw [he, mul_one] at this
    exact le_trans this (hR y hy)
  -- the number of steps and the constants
  set C := max (stepConst (d := d) p ε) 1
  have hC1 : 1 ≤ C := le_max_right _ _
  have hCpos : 0 < C := by linarith
  set N : ℕ := ⌈4 * |R| / ε⌉₊ + 1 with hNdef
  have hCN : 0 < C ^ N := pow_pos hCpos N
  set δ₀ := M / (2 * C ^ N) with hδ₀def
  have hδ₀ : 0 < δ₀ := by rw [hδ₀def]; positivity
  have hsmall : ∀ k ≤ N, C ^ k * δ₀ ≤ M / 2 := by
    intro k hk
    have h1 : C ^ k ≤ C ^ N := pow_le_pow_right₀ hC1 hk
    have hCNne : C ^ N ≠ 0 := hCN.ne'
    have h2 : C ^ N * δ₀ = M / 2 := by
      rw [hδ₀def]
      field_simp
    calc C ^ k * δ₀ ≤ C ^ N * δ₀ := mul_le_mul_of_nonneg_right h1 hδ₀.le
      _ = M / 2 := h2
  -- the starting point
  obtain ⟨x₀, hx₀⟩ : ∃ x₀, M - δ₀ < v x₀ - u x₀ :=
    exists_lt_of_lt_ciSup (by linarith : M - δ₀ < M)
  -- the walk
  have hwalk : ∀ k ≤ N, ∃ x, M - C ^ k * δ₀ < v x - u x
      ∧ ⟪x₀, e⟫ + (k : ℝ) * (ε / 2) ≤ ⟪x, e⟫ := by
    intro k
    induction k with
    | zero =>
        intro _
        refine ⟨x₀, ?_, ?_⟩
        · simpa using hx₀
        · simp
    | succ k ih =>
        intro hk
        obtain ⟨x, hxw, hxe⟩ := ih (Nat.le_of_succ_le hk)
        have hk' := hsmall k (Nat.le_of_succ_le hk)
        have hxΩ : x ∈ Ω := hmem x (by linarith)
        have hδk : 0 < C ^ k * δ₀ := by positivity
        obtain ⟨y, hyw, hye⟩ :=
          disc_step p ε hp hε hpd hu hv hTu hTv hM hxΩ hδk hxw he
        refine ⟨y, ?_, ?_⟩
        · have h1 : stepConst (d := d) p ε ≤ C := le_max_left _ _
          have h2 : stepConst (d := d) p ε * (C ^ k * δ₀) ≤ C * (C ^ k * δ₀) :=
            mul_le_mul_of_nonneg_right h1 hδk.le
          have h3 : C ^ (k + 1) * δ₀ = C * (C ^ k * δ₀) := by rw [pow_succ]; ring
          rw [h3]
          linarith
        · push_cast
          linarith
  -- after N steps the walk has left Ω, but v - u is still positive there
  obtain ⟨x, hxw, hxe⟩ := hwalk N le_rfl
  have hxΩ : x ∈ Ω := hmem x (by linarith [hsmall N le_rfl])
  have hx₀Ω : x₀ ∈ Ω := hmem x₀ (by
    have := hsmall 0 (Nat.zero_le N)
    simp only [pow_zero, one_mul] at this
    linarith)
  obtain ⟨h1a, h1b⟩ := abs_le.1 (hproj x hxΩ)
  obtain ⟨h2a, h2b⟩ := abs_le.1 (hproj x₀ hx₀Ω)
  have hN : 4 * |R| / ε < (N : ℝ) := by
    rw [hNdef]; push_cast
    linarith [Nat.le_ceil (4 * |R| / ε)]
  have hNε : 2 * |R| < (N : ℝ) * (ε / 2) := by
    have := (div_lt_iff₀ hε).1 hN
    linarith
  have hRabs : R ≤ |R| := le_abs_self R
  linarith
theorempharmonious_uniqueTheorem 7.10 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is bounded}$ hΩb
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $v\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hv
  • $\forall x \notin \Omega,\ u(x) = F(x)$ huF
  • $\forall x \notin \Omega,\ v(x) = F(x)$ hvF

Then $u = v$.

PLaplacian.pharmonious_uniquePlaplacian/DiscUnique.lean, lines 300–314
/-- **Uniqueness for the `ε`-problem.** Two `p`-harmonious functions in a bounded
set `Ω` with data `F` that both equal `F` outside `Ω` are equal. -/
theorem pharmonious_unique [Nontrivial (EuclSpace d)] (p ε : ℝ) (hp : 2 ≤ p)
    (hε : 0 < ε) (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)}
    (hΩb : Bornology.IsBounded Ω) {F u v : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hv : IsPHarmonious p ε Ω F v)
    (huF : ∀ x, x ∉ Ω → u x = F x) (hvF : ∀ x, x ∉ Ω → v x = F x) :
    u = v := by
  have hout : ∀ x, x ∉ Ω → u x = v x := fun x hx => by rw [huF x hx, hvF x hx]
  have h1 := sup_diff_nonpos p ε hp hε hpd hΩb hu.bddMeas hv.bddMeas
    hu.interior hv.interior hout
  have h2 := sup_diff_nonpos p ε hp hε hpd hΩb hv.bddMeas hu.bddMeas
    hv.interior hu.interior (fun x hx => (hout x hx).symm)
  funext x
  exact le_antisymm (h2 x) (h1 x)

Plaplacian/Discharge.lean2 declarations

theoremexists_index_both
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $M \in \mathbb{R}$, $\eta \in \mathbb{R}$, $\delta' \in \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(j \mapsto \int_{S} (u(y) - w(j, y)) \, dy, \mathrm{atTop}, \operatorname{nhds}(0))$ hglob
  • $\operatorname{Tendsto}(j \mapsto \operatorname{deficitSup}(S, u, w(j)), \mathrm{atTop}, \operatorname{nhds}(M))$ hsup
  • $0 < \eta$ hη
  • $0 < \delta'$ hδ'

Then there exists $k$ such that:

  • $\int_{S} (u(y) - w(k, y) \le \eta) \, dy$
  • $\operatorname{deficitSup}(S, u, w(k)) \le M + \delta'$
PLaplacian.exists_index_bothPlaplacian/Discharge.lean, lines 37–56
/-- **Discharging `hglob`.** Both conditions hold eventually in `j`, so some
single index satisfies both: the integral of the deficit is below `eta` by
dominated convergence, and the deficit supremum is below `M + delta'` because
the suprema decrease to `M`.

The two tolerances are genuinely independent; see the module docstring of
`Plaplacian.UniformIteration`. -/
theorem exists_index_both {S : Set (EuclSpace d)}
    {u : EuclSpace d → ℝ} {w : ℕ → EuclSpace d → ℝ} {M : ℝ}
    (hglob : Tendsto (fun j => ∫ y in S, (u y - w j y)) atTop (nhds 0))
    (hsup : Tendsto (fun j => deficitSup S u (w j)) atTop (nhds M))
    {η : ℝ} (hη : 0 < η) {δ' : ℝ} (hδ' : 0 < δ') :
    ∃ k, (∫ y in S, (u y - w k y)) ≤ η
      ∧ deficitSup S u (w k) ≤ M + δ' := by
  have h1 : ∀ᶠ j in atTop, (∫ y in S, (u y - w j y)) ≤ η :=
    hglob.eventually (eventually_le_nhds hη)
  have h2 : ∀ᶠ j in atTop, deficitSup S u (w j) ≤ M + δ' :=
    hsup.eventually (eventually_le_nhds (by linarith : M < M + δ'))
  obtain ⟨k, hk1, hk2⟩ := (h1.and h2).exists
  exact ⟨k, hk1, hk2⟩
theoremintegrableOn_deficit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $S \subseteq \mathbb{R}^{d}$, $k \in \mathbb{N}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep
  • MeasureTheory.volume S ≠ ⊤ hSfin

Then $\operatorname{IntegrableOn}(y \mapsto \operatorname{iterLimit}(p, \varepsilon, u_{0}, y) - \operatorname{iter}(p, \varepsilon, u_{0}, k, y), S, \lambda)$.

PLaplacian.integrableOn_deficitPlaplacian/Discharge.lean, lines 58–78
/-- Integrability of the deficit on a finite-measure set. -/
theorem integrableOn_deficit (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x)
    {S : Set (EuclSpace d)} (hSfin : volume S ≠ ⊤) (k : ℕ) :
    MeasureTheory.IntegrableOn
      (fun y => iterLimit p ε u₀ y - iter p ε u₀ k y) S := by
  have hBMu := bddMeas_iterLimit p ε hp hε hd hpd hu₀ hC hstep
  have hBMk := bddMeas_iter p ε hp hε hpd hu₀ k
  have hdiff : BddMeas (fun y => iterLimit p ε u₀ y - iter p ε u₀ k y) :=
    hBMu.sub hBMk
  obtain ⟨D, hD⟩ := hdiff.bound
  have hconst : MeasureTheory.IntegrableOn
      (fun _ : EuclSpace d => D) S := by
    refine MeasureTheory.integrableOn_const ?_ ?_
    · exact hSfin
    · simp
  exact hconst.mono' hdiff.meas.aestronglyMeasurable
    (Filter.Eventually.of_forall fun y => by simpa using hD y)

Plaplacian/Domain.lean6 declarations

defbdryStripDefinition 1.6 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Its value lies in $\operatorname{Set}(\mathbb{R}^{d})$.

/-- The boundary strip: points outside `Ω` within distance `ε` of it.

The `≤` makes `closedBall_subset_union` hold; see the module docstring. -/
def bdryStrip (Ω : Set (EuclSpace d)) (ε : ℝ) : Set (EuclSpace d) :=
  {x | x ∉ Ω ∧ Metric.infDist x Ω ≤ ε}
defclosureEpsDefinition 1.6 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Its value lies in $\operatorname{Set}(\mathbb{R}^{d})$.

/-- The set on which the data of the ε-problem is prescribed. -/
def closureEps (Ω : Set (EuclSpace d)) (ε : ℝ) : Set (EuclSpace d) :=
  Ω ∪ bdryStrip Ω ε
lemmadisjoint_bdryStrip
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{Disjoint}(\Omega, \operatorname{bdryStrip}(\Omega, \varepsilon))$.

PLaplacian.disjoint_bdryStripPlaplacian/Domain.lean, lines 66–70
lemma disjoint_bdryStrip (Ω : Set (EuclSpace d)) (ε : ℝ) :
    Disjoint Ω (bdryStrip Ω ε) := by
  rw [Set.disjoint_left]
  intro x hx hx'
  exact hx'.1 hx
lemmasubset_closureEps
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\Omega \subseteq \Omega_{\varepsilon}$.

PLaplacian.subset_closureEpsPlaplacian/Domain.lean, lines 72–73
lemma subset_closureEps (Ω : Set (EuclSpace d)) (ε : ℝ) :
    Ω ⊆ closureEps Ω ε := Set.subset_union_left
lemmaclosedBall_subset_unionLemma 1.7 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $x \in \Omega$ hx

Then $\overline{B}(x, \varepsilon) \subseteq \Omega \cup \operatorname{bdryStrip}(\Omega, \varepsilon)$.

PLaplacian.closedBall_subset_unionPlaplacian/Domain.lean, lines 75–85
/-- **The ε-problem is closed.** At a point of `Ω` the operator reads only
points of `Ω ∪ Γ_ε`, so it never needs a value that is not prescribed. -/
lemma closedBall_subset_union (Ω : Set (EuclSpace d)) {ε : ℝ}
    {x : EuclSpace d} (hx : x ∈ Ω) :
    closedBall x ε ⊆ Ω ∪ bdryStrip Ω ε := by
  intro y hy
  by_cases hyΩ : y ∈ Ω
  · exact Or.inl hyΩ
  · refine Or.inr ⟨hyΩ, ?_⟩
    calc Metric.infDist y Ω ≤ dist y x := Metric.infDist_le_dist_of_mem hx
      _ ≤ ε := Metric.mem_closedBall.1 hy
structureIsPHarmoniousDefinition 1.8 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

This defines a property of these parameters.

/-- **The ε-Dirichlet problem.** The dynamic programming principle is taken as
the definition of the discrete problem, not derived from a game. -/
structure IsPHarmonious (p ε : ℝ) (Ω : Set (EuclSpace d))
    (F : EuclSpace d → ℝ) (u : EuclSpace d → ℝ) : Prop where
  bddMeas : BddMeas u
  interior : ∀ x ∈ Ω, u x = tugOfWarOp p ε u x
  boundary : ∀ x ∈ bdryStrip Ω ε, u x = F x

Plaplacian/DomainBounds.lean5 declarations

theoremball_subset_closureEps
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $x \in \Omega$ hx

Then $B(x, \varepsilon) \subseteq \Omega_{\varepsilon}$.

PLaplacian.ball_subset_closureEpsPlaplacian/DomainBounds.lean, lines 45–50
/-- The open ball at a point of the domain lies in the epsilon-closure. This is
why the deficit supremum must range over `closureEps`. -/
theorem ball_subset_closureEps (Ω : Set (EuclSpace d)) {ε : ℝ}
    {x : EuclSpace d} (hx : x ∈ Ω) :
    ball x ε ⊆ closureEps Ω ε :=
  fun _ hy => closedBall_subset_union Ω hx (ball_subset_closedBall hy)
theoremclosureEps_nonempty
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\Omega\text{ is nonempty}$ hΩ

Then (PLaplacian.closureEps Ω ε).Nonempty.

PLaplacian.closureEps_nonemptyPlaplacian/DomainBounds.lean, lines 52–54
theorem closureEps_nonempty {Ω : Set (EuclSpace d)} (hΩ : Ω.Nonempty)
    (ε : ℝ) : (closureEps Ω ε).Nonempty :=
  hΩ.mono (subset_closureEps Ω ε)
theoremexists_dist_lt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $y \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $\Omega\text{ is nonempty}$ hΩ
  • $\operatorname{infDist}(y, \Omega) < r$ h

Then there exists $z \in \Omega$ such that:

  • $\operatorname{dist}(y, z) < r$
/-- From `infDist y Ω < r`, extract a point of `Ω` within `r` of `y`. Proved by
contradiction from `Metric.le_infDist`, since mathlib has no direct form. -/
theorem exists_dist_lt {Ω : Set (EuclSpace d)} (hΩ : Ω.Nonempty)
    {y : EuclSpace d} {r : ℝ} (h : Metric.infDist y Ω < r) :
    ∃ z ∈ Ω, dist y z < r := by
  by_contra hcon
  push Not at hcon
  have : r ≤ Metric.infDist y Ω :=
    (Metric.le_infDist hΩ).2 fun z hz => hcon z hz
  linarith
theoremnorm_le_of_infDist_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $R \in \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $\Omega\text{ is nonempty}$ hΩ
  • $\forall z \in \Omega,\ \lVert z\rVert \le R$ hR
  • $\operatorname{infDist}(y, \Omega) \le \varepsilon$ hy

Then $\lVert y\rVert \le R + \varepsilon + 1$.

PLaplacian.norm_le_of_infDist_lePlaplacian/DomainBounds.lean, lines 67–80
/-- A point of the strip has norm controlled by a bound on the domain. -/
theorem norm_le_of_infDist_le {Ω : Set (EuclSpace d)} (hΩ : Ω.Nonempty)
    {R : ℝ} (hR : ∀ z ∈ Ω, ‖z‖ ≤ R)
    {ε : ℝ} {y : EuclSpace d} (hy : Metric.infDist y Ω ≤ ε) :
    ‖y‖ ≤ R + ε + 1 := by
  obtain ⟨z, hzΩ, hz⟩ := exists_dist_lt hΩ (show Metric.infDist y Ω < ε + 1 by
    linarith)
  have h1 : ‖z‖ ≤ R := hR z hzΩ
  have h2 : ‖y‖ ≤ ‖z‖ + dist y z := by
    rw [dist_eq_norm]
    have hyz : y = z + (y - z) := by abel
    calc ‖y‖ = ‖z + (y - z)‖ := by rw [← hyz]
      _ ≤ ‖z‖ + ‖y - z‖ := norm_add_le _ _
  linarith
theoremisBounded_closureEps
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\Omega\text{ is nonempty}$ hΩ
  • $\Omega\text{ is bounded}$ hb
  • $0 \le \varepsilon$ hε

Then $\Omega_{\varepsilon}\text{ is bounded}$.

PLaplacian.isBounded_closureEpsPlaplacian/DomainBounds.lean, lines 82–99
/-- **The epsilon-closure of a bounded set is bounded**, hence of finite
measure. This supplies the dominated convergence hypothesis. -/
theorem isBounded_closureEps {Ω : Set (EuclSpace d)} (hΩ : Ω.Nonempty)
    (hb : Bornology.IsBounded Ω) {ε : ℝ} (hε : 0 ≤ ε) :
    Bornology.IsBounded (closureEps Ω ε) := by
  obtain ⟨R, hR⟩ := hb.subset_closedBall 0
  have hRnorm : ∀ z ∈ Ω, ‖z‖ ≤ R := by
    intro z hz
    have := hR hz
    rwa [Metric.mem_closedBall, dist_zero_right] at this
  refine Bornology.IsBounded.subset
    (Metric.isBounded_closedBall (x := (0 : EuclSpace d)) (r := R + ε + 1)) ?_
  intro y hy
  rw [Metric.mem_closedBall, dist_zero_right]
  rcases hy with hyΩ | hyΓ
  · have := hRnorm y hyΩ
    linarith
  · exact norm_le_of_infDist_le hΩ hRnorm hyΓ.2

Plaplacian/Dominated.lean1 declarations

theoremtendsto_setIntegral_deficit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • MeasureTheory.volume S ≠ ⊤ hSfin
  • ∀ (j : ℕ), Measurable fun x => u x - w j x hmeas
  • $\forall j, x,\ \lvert u(x) - w(j, x)\rvert \le C$ hC
  • $\forall x,\ \operatorname{Tendsto}(j \mapsto w(j, x), \mathrm{atTop}, \operatorname{nhds}(u(x)))$ hconv

Then $\operatorname{Tendsto}(j \mapsto \int_{S} (u(x) - w(j, x)) \, dx, \mathrm{atTop}, \operatorname{nhds}(0))$.

PLaplacian.tendsto_setIntegral_deficitPlaplacian/Dominated.lean, lines 33–60
/-- **LPS's (2.7).** For a sequence of functions bounded by a constant and
converging pointwise to zero, the integrals over a finite-measure set tend to
zero. Applied to the restricted measure, since a set integral is an integral
against `volume.restrict S`. -/
theorem tendsto_setIntegral_deficit {S : Set (EuclSpace d)}
    (hSfin : volume S ≠ ⊤)
    {u : EuclSpace d → ℝ} {w : ℕ → EuclSpace d → ℝ} {C : ℝ}
    (hmeas : ∀ j, Measurable (fun x => u x - w j x))
    (hC : ∀ j x, |u x - w j x| ≤ C)
    (hconv : ∀ x, Tendsto (fun j => w j x) atTop (nhds (u x))) :
    Tendsto (fun j => ∫ x in S, (u x - w j x)) atTop (nhds 0) := by
  have hbound : Integrable (fun _ : EuclSpace d => C)
      (volume.restrict S) := by
    refine integrable_const_iff.2 (Or.inr ?_)
    constructor
    rw [Measure.restrict_apply_univ]
    exact lt_of_le_of_ne le_top hSfin
  have hzero : (0 : ℝ) = ∫ x, (0 : ℝ) ∂(volume.restrict S) := by simp
  rw [hzero]
  exact MeasureTheory.tendsto_integral_of_dominated_convergence
    (fun _ => C)
    (fun j => (hmeas j).aestronglyMeasurable)
    hbound
    (fun j => Filter.Eventually.of_forall fun x => by
      simpa [Real.norm_eq_abs] using hC j x)
    (Filter.Eventually.of_forall fun x => by
      have h := (hconv x).const_sub (u x)
      simpa using h)

Plaplacian/Domination.lean1 declarations

theoremexists_max_with_dom
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • $\lVert y - x\rVert \le \varepsilon$
  • $\varphi(x + (y - x)) \ge \varphi(x + \varepsilon \cdot \operatorname{gradDir}(\varphi, x))$
PLaplacian.exists_max_with_domPlaplacian/Domination.lean, lines 44–54
/-- The maximizer, together with the domination hypothesis. -/
theorem exists_max_with_dom {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε,
      ‖y - x‖ ≤ ε
      ∧ φ (x + (y - x)) ≥ φ (x + ε • gradDir φ x) := by
  obtain ⟨y, hyMem, hyMax⟩ := exists_isMaxOn_closedBall hφ x hε
  refine ⟨y, hyMem, norm_sub_le_of_mem hyMem, ?_⟩
  have hxy : x + (y - x) = y := by abel
  rw [hxy]
  exact hyMax (mem_closedBall_shift x (norm_gradDir hx) hε)

Plaplacian/DppOperator.lean7 declarations

defdppOp
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

open Classical in
/-- The dynamic programming operator: the formula on `Ω`, the identity
elsewhere. `open Classical in` supplies decidability of set membership; it is
scoped to this definition so that no theorem statement below depends on it. -/
def dppOp (p ε : ℝ) (Ω : Set (EuclSpace d)) (v : EuclSpace d → ℝ)
    (x : EuclSpace d) : ℝ :=
  if x ∈ Ω then tugOfWarOp p ε v x else v x
lemmadppOp_of_mem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $x \in \Omega$ hx

Then $\widetilde{T}_{\varepsilon} v(x) = T_{\varepsilon} v(x)$.

lemma dppOp_of_mem (p ε : ℝ) {Ω : Set (EuclSpace d)} {x : EuclSpace d}
    (hx : x ∈ Ω) (v : EuclSpace d → ℝ) :
    dppOp p ε Ω v x = tugOfWarOp p ε v x := by
  unfold dppOp; simp [hx]
lemmadppOp_of_notMem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $x \notin \Omega$ hx

Then $\widetilde{T}_{\varepsilon} v(x) = v(x)$.

lemma dppOp_of_notMem (p ε : ℝ) {Ω : Set (EuclSpace d)} {x : EuclSpace d}
    (hx : x ∉ Ω) (v : EuclSpace d → ℝ) :
    dppOp p ε Ω v x = v x := by
  unfold dppOp; simp [hx]
theoremdppOp_monotone
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < \varepsilon$ hε
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ u(y) \le v(y)$ h

Then $\widetilde{T}_{\varepsilon} u(x) \le \widetilde{T}_{\varepsilon} v(x)$.

/-- Monotonicity. On `Ω` this is `tugOfWarOp_monotone`; off `Ω` it is the
hypothesis itself. -/
theorem dppOp_monotone (p ε : ℝ) (hp : 2 ≤ p) (hd : 0 < d) (hε : 0 < ε)
    (Ω : Set (EuclSpace d))
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    (h : ∀ y, u y ≤ v y) (x : EuclSpace d) :
    dppOp p ε Ω u x ≤ dppOp p ε Ω v x := by
  by_cases hx : x ∈ Ω
  · rw [dppOp_of_mem p ε hx, dppOp_of_mem p ε hx]
    exact tugOfWarOp_monotone p ε hp hd hε hu hv h x
  · rw [dppOp_of_notMem p ε hx, dppOp_of_notMem p ε hx]
    exact h x
theoremBddMeas.dppOp
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $\Omega\text{ is measurable}$ hΩ
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then $\widetilde{T}_{\varepsilon} v\text{ is admissible (bounded and Borel measurable)}$.

/-- **Invariance of the admissible class.** Note the hypothesis
`MeasurableSet Ω`, forced by `Measurable.ite`. -/
theorem BddMeas.dppOp (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩ : MeasurableSet Ω)
    {v : EuclSpace d → ℝ} (hv : BddMeas v) :
    BddMeas (PLaplacian.dppOp p ε Ω v) := by
  obtain ⟨C, hC⟩ := hv.bound
  have hT := BddMeas.tugOfWarOp p ε hp hε hpd hv
  refine ⟨?_, ⟨C, fun x => ?_⟩⟩
  · exact hT.meas.ite hΩ hv.meas
  · by_cases hx : x ∈ Ω
    · rw [dppOp_of_mem p ε hx]
      exact abs_tugOfWarOp_le p ε hp hε hpd hv hC x
    · rw [dppOp_of_notMem p ε hx]
      exact hC x
theoremdppOp_eq_on_compl
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $x \notin \Omega$ hx

Then $\widetilde{T}_{\varepsilon} v(x) = v(x)$.

PLaplacian.dppOp_eq_on_complPlaplacian/DppOperator.lean, lines 92–96
/-- The operator fixes the strip, so boundary values are preserved along the
iteration. -/
theorem dppOp_eq_on_compl (p ε : ℝ) (Ω : Set (EuclSpace d))
    (v : EuclSpace d → ℝ) {x : EuclSpace d} (hx : x ∉ Ω) :
    dppOp p ε Ω v x = v x := dppOp_of_notMem p ε hx v
theoremsetAverage_le_integral_div
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $S \subseteq \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\forall y,\ 0 \le f(y)$ hnn
  • $\operatorname{IntegrableOn}(f, S, \lambda)$ hint
  • $0 < \varepsilon$ hε
  • $B(x, \varepsilon) \subseteq S$ hsub

Then $\fint_{B(x, \varepsilon)} (f(y) \le (\operatorname{volume.real}(B(0, \varepsilon)))(^{-1}) \cdot \int_{S} f(y) \, dy) \, dy$.

PLaplacian.setAverage_le_integral_divPlaplacian/DppOperator.lean, lines 117–135
/-- **The uniformity bound.** For a nonnegative function integrable on a set
containing the ball, the average over the ball is dominated by the global
integral divided by the centre-independent ball volume. -/
theorem setAverage_le_integral_div (f : EuclSpace d → ℝ)
    (hnn : ∀ y, 0 ≤ f y) {S : Set (EuclSpace d)}
    (hint : MeasureTheory.IntegrableOn f S) (x : EuclSpace d) {ε : ℝ}
    (hε : 0 < ε) (hsub : ball x ε ⊆ S) :
    (⨍ y in ball x ε, f y)
      ≤ (volume.real (ball (0 : EuclSpace d) ε))⁻¹ * ∫ y in S, f y := by
  rw [MeasureTheory.setAverage_eq, volumeReal_ball_center x ε, smul_eq_mul]
  have hpos : 0 < volume.real (ball (0 : EuclSpace d) ε) := by
    have h1 : volume (ball (0 : EuclSpace d) ε) ≠ 0 :=
      measure_ball_ne_zero 0 hε
    have h2 : volume (ball (0 : EuclSpace d) ε) ≠ ⊤ := measure_ball_lt_top.ne
    simp only [MeasureTheory.Measure.real]
    exact ENNReal.toReal_pos h1 h2
  refine mul_le_mul_of_nonneg_left ?_ (by positivity)
  exact MeasureTheory.setIntegral_mono_set hint
    (Filter.Eventually.of_forall hnn) (LE.le.eventuallyLE hsub)

Plaplacian/ElimMax.lean2 declarations

theoremnorm_eps_gradDir
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then $\lVert \varepsilon \cdot \operatorname{gradDir}(\varphi, x)\rVert = \varepsilon$.

PLaplacian.norm_eps_gradDirPlaplacian/ElimMax.lean, lines 50–54
/-- The norm of the shift. -/
theorem norm_eps_gradDir {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    ‖ε • gradDir φ x‖ = ε := by
  rw [norm_smul, norm_gradDir hx, Real.norm_eq_abs, abs_of_pos hε, mul_one]
theoremcmp_err_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, y \in \mathbb{R}^{d}$, $\varepsilon, D \in \mathbb{R}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε
  • $\lVert y - x\rVert \le \varepsilon$ hball
  • $\lVert y - x - \varepsilon \cdot \operatorname{gradDir}(\varphi, x)\rVert \le D$ hloc
  • $0 \le D$ hD

Then $1 / 2 \cdot (\lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \cdot \lVert y - x - \varepsilon \cdot \operatorname{gradDir}(\varphi, x)\rVert \cdot (\lVert y - x\rVert + \lVert \varepsilon \cdot \operatorname{gradDir}(\varphi, x)\rVert)) \le 1 / 2 \cdot \lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \cdot D \cdot 2 \cdot \varepsilon$.

/-- The comparison error, bounded in terms of the localization distance. -/
theorem cmp_err_le {φ : EuclSpace d → ℝ} {x y : EuclSpace d}
    (hx : gradient φ x ≠ 0) {ε D : ℝ} (hε : 0 < ε)
    (hball : ‖y - x‖ ≤ ε)
    (hloc : ‖(y - x) - ε • gradDir φ x‖ ≤ D) (hD : 0 ≤ D) :
    (1 / 2) * (‖fderiv ℝ (fderiv ℝ φ) x‖
        * ‖(y - x) - ε • gradDir φ x‖
        * (‖y - x‖ + ‖ε • gradDir φ x‖))
      ≤ (1 / 2) * (‖fderiv ℝ (fderiv ℝ φ) x‖ * D * (2 * ε)) := by
  rw [norm_eps_gradDir hx hε]
  have hHnn : (0:ℝ) ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ :=
    ContinuousLinearMap.opNorm_nonneg _
  have hsum : ‖y - x‖ + ε ≤ 2 * ε := by linarith [hball]
  have hdnn : (0:ℝ) ≤ ‖(y - x) - ε • gradDir φ x‖ := norm_nonneg _
  have hsumnn : (0:ℝ) ≤ ‖y - x‖ + ε := by
    have := norm_nonneg (y - x); linarith
  -- step 1: replace the distance by D
  have s1 : ‖fderiv ℝ (fderiv ℝ φ) x‖ * ‖y - x - ε • gradDir φ x‖
        * (‖y - x‖ + ε)
      ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ * D * (‖y - x‖ + ε) := by
    have hmul : ‖fderiv ℝ (fderiv ℝ φ) x‖ * ‖y - x - ε • gradDir φ x‖
        ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ * D :=
      mul_le_mul_of_nonneg_left hloc hHnn
    exact mul_le_mul_of_nonneg_right hmul hsumnn
  -- step 2: replace the sum by 2 ε
  have s2 : ‖fderiv ℝ (fderiv ℝ φ) x‖ * D * (‖y - x‖ + ε)
      ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ * D * (2 * ε) := by
    have hnn : (0:ℝ) ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ * D :=
      mul_nonneg hHnn hD
    exact mul_le_mul_of_nonneg_left hsum hnn
  linarith [s1, s2]

Plaplacian/Err2Bound.lean1 declarations

theoremerr2_deriv_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta, \delta \in \mathbb{R}$, $w \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ _hφ
  • $0 < \eta$ hη
  • $\forall v,\ \lVert v\rVert < \delta \to \lVert \operatorname{fderiv}(\mathbb{R}, \varphi, x + v) - \operatorname{fderiv}(\mathbb{R}, \varphi, x) - (\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(v)\rVert \le \eta \cdot \lVert v\rVert$ hbd
  • $\lVert w\rVert < \delta$ hw
  • $t \in \operatorname{Icc}(0, 1)$ ht

Then $\lVert (\operatorname{fderiv}(\mathbb{R}, \varphi, x + t \cdot w))(w) - (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(w) - t \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(w))(w)\rVert \le \eta \cdot \lVert w\rVert ^{2}$.

PLaplacian.err2_deriv_boundPlaplacian/Err2Bound.lean, lines 47–88
/-- The derivative along the ray is bounded on the unit interval. -/
theorem err2_deriv_bound {φ : EuclSpace d → ℝ} (_hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {η δ : ℝ} (hη : 0 < η)
    (hbd : ∀ v : EuclSpace d, ‖v‖ < δ →
      ‖fderiv ℝ φ (x + v) - fderiv ℝ φ x
          - fderiv ℝ (fderiv ℝ φ) x v‖ ≤ η * ‖v‖)
    {w : EuclSpace d} (hw : ‖w‖ < δ) {t : ℝ} (ht : t ∈ Icc (0:ℝ) 1) :
    ‖fderiv ℝ φ (x + t • w) w - fderiv ℝ φ x w
        - t * fderiv ℝ (fderiv ℝ φ) x w w‖ ≤ η * ‖w‖ ^ 2 := by
  rw [err2_deriv_eq_increment]
  -- the increment at t w
  have htw : ‖t • w‖ < δ := by
    rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht.1]
    calc t * ‖w‖ ≤ 1 * ‖w‖ :=
          mul_le_mul_of_nonneg_right ht.2 (norm_nonneg w)
      _ = ‖w‖ := one_mul _
      _ < δ := hw
  have hinc := hbd (t • w) htw
  -- the operator-norm inequality
  have hop : ‖(fderiv ℝ φ (x + t • w) - fderiv ℝ φ x
      - fderiv ℝ (fderiv ℝ φ) x (t • w)) w‖
      ≤ ‖fderiv ℝ φ (x + t • w) - fderiv ℝ φ x
          - fderiv ℝ (fderiv ℝ φ) x (t • w)‖ * ‖w‖ :=
    ContinuousLinearMap.le_opNorm _ _
  -- and the scaling
  have hscale : ‖t • w‖ ≤ ‖w‖ := by
    rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht.1]
    calc t * ‖w‖ ≤ 1 * ‖w‖ :=
          mul_le_mul_of_nonneg_right ht.2 (norm_nonneg w)
      _ = ‖w‖ := one_mul _
  have hwnn : (0:ℝ) ≤ ‖w‖ := norm_nonneg w
  calc ‖(fderiv ℝ φ (x + t • w) - fderiv ℝ φ x
          - fderiv ℝ (fderiv ℝ φ) x (t • w)) w‖
      ≤ ‖fderiv ℝ φ (x + t • w) - fderiv ℝ φ x
          - fderiv ℝ (fderiv ℝ φ) x (t • w)‖ * ‖w‖ := hop
    _ ≤ (η * ‖t • w‖) * ‖w‖ :=
        mul_le_mul_of_nonneg_right hinc hwnn
    _ ≤ (η * ‖w‖) * ‖w‖ := by
        have : η * ‖t • w‖ ≤ η * ‖w‖ :=
          mul_le_mul_of_nonneg_left hscale (le_of_lt hη)
        exact mul_le_mul_of_nonneg_right this hwnn
    _ = η * ‖w‖ ^ 2 := by ring

Plaplacian/Err2Comb.lean2 declarations

theoremhasDerivAt_err2
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then $\operatorname{HasDerivAt}(s \mapsto \operatorname{err2}(\varphi, x, s \cdot w), (\operatorname{fderiv}(\mathbb{R}, \varphi, x + t \cdot w))(w) - (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(w) - t \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(w))(w), t)$.

PLaplacian.hasDerivAt_err2Plaplacian/Err2Comb.lean, lines 42–59
/-- **The error's derivative along a ray.** -/
theorem hasDerivAt_err2 {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x w : EuclSpace d) (t : ℝ) :
    HasDerivAt (fun s : ℝ => err2 φ x (s • w))
      (fderiv ℝ φ (x + t • w) w - fderiv ℝ φ x w
        - t * fderiv ℝ (fderiv ℝ φ) x w w) t := by
  have h1 := hasDerivAt_ray hφ x w t
  have h2 := hasDerivAt_linear (φ := φ) x w t
  have h3 := hasDerivAt_quad (φ := φ) x w t
  have hfun : (fun s : ℝ => err2 φ x (s • w))
      = fun s : ℝ => φ (x + s • w) - φ x
          - fderiv ℝ φ x (s • w)
          - (1/2) * fderiv ℝ (fderiv ℝ φ) x (s • w) (s • w) := by
    funext s
    unfold err2
    ring
  rw [hfun]
  exact ((h1.sub_const (φ x)).sub h2).sub h3
theoremerr2_deriv_eq_increment
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Then $(\operatorname{fderiv}(\mathbb{R}, \varphi, x + t \cdot w))(w) - (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(w) - t \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(w))(w) = (\operatorname{fderiv}(\mathbb{R}, \varphi, x + t \cdot w) - \operatorname{fderiv}(\mathbb{R}, \varphi, x) - (\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(t \cdot w))(w)$.

PLaplacian.err2_deriv_eq_incrementPlaplacian/Err2Comb.lean, lines 61–69
/-- The derivative equals the increment applied to the direction. -/
theorem err2_deriv_eq_increment {φ : EuclSpace d → ℝ} (x w : EuclSpace d)
    (t : ℝ) :
    fderiv ℝ φ (x + t • w) w - fderiv ℝ φ x w
        - t * fderiv ℝ (fderiv ℝ φ) x w w
      = (fderiv ℝ φ (x + t • w) - fderiv ℝ φ x
          - fderiv ℝ (fderiv ℝ φ) x (t • w)) w := by
  simp only [sub_apply, ContinuousLinearMap.map_smul,
    FunLike.coe_smul, Pi.smul_apply, smul_eq_mul]

Plaplacian/Err2Deriv.lean3 declarations

theoremhasDerivAt_ray
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then $\operatorname{HasDerivAt}(s \mapsto \varphi(x + s \cdot w), (\operatorname{fderiv}(\mathbb{R}, \varphi, x + t \cdot w))(w), t)$.

/-- The first term's derivative: the chain rule along the ray. -/
theorem hasDerivAt_ray {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x w : EuclSpace d) (t : ℝ) :
    HasDerivAt (fun s : ℝ => φ (x + s • w))
      (fderiv ℝ φ (x + t • w) w) t := by
  have h := hasDerivAt_first hφ x w t
  simpa [lineMap] using h
theoremhasDerivAt_linear
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Then $\operatorname{HasDerivAt}(s \mapsto (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(s \cdot w), (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(w), t)$.

PLaplacian.hasDerivAt_linearPlaplacian/Err2Deriv.lean, lines 56–66
/-- The linear term's derivative. -/
theorem hasDerivAt_linear {φ : EuclSpace d → ℝ} (x w : EuclSpace d)
    (t : ℝ) :
    HasDerivAt (fun s : ℝ => fderiv ℝ φ x (s • w))
      (fderiv ℝ φ x w) t := by
  have h : (fun s : ℝ => fderiv ℝ φ x (s • w))
      = fun s : ℝ => s * fderiv ℝ φ x w := by
    funext s
    rw [ContinuousLinearMap.map_smul, smul_eq_mul]
  rw [h]
  simpa using (hasDerivAt_id t).mul_const (fderiv ℝ φ x w)
theoremhasDerivAt_quad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Then $\operatorname{HasDerivAt}(s \mapsto 1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(s \cdot w))(s \cdot w), t \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(w))(w), t)$.

/-- The quadratic term's derivative. -/
theorem hasDerivAt_quad {φ : EuclSpace d → ℝ} (x w : EuclSpace d)
    (t : ℝ) :
    HasDerivAt (fun s : ℝ =>
        (1/2) * fderiv ℝ (fderiv ℝ φ) x (s • w) (s • w))
      (t * fderiv ℝ (fderiv ℝ φ) x w w) t := by
  have h : (fun s : ℝ =>
        (1/2) * fderiv ℝ (fderiv ℝ φ) x (s • w) (s • w))
      = fun s : ℝ => (1/2) * s ^ 2
          * fderiv ℝ (fderiv ℝ φ) x w w := by
    funext s
    simp only [ContinuousLinearMap.map_smul, FunLike.coe_smul,
      Pi.smul_apply, smul_eq_mul]
    ring
  rw [h]
  have hd := (hasDerivAt_pow 2 t).const_mul ((1:ℝ)/2)
  have hd2 := hd.mul_const (fderiv ℝ (fderiv ℝ φ) x w w)
  simpa using hd2

Plaplacian/ErrDiff.lean2 declarations

theoremabs_taylorErr_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $C$ such that:

  • $\lvert \operatorname{taylorErr}(\varphi, x, z)\rvert \le C / 6$
PLaplacian.abs_taylorErr_lePlaplacian/ErrDiff.lean, lines 45–50
/-- The error at a single point, in terms of `taylorErr`. -/
theorem abs_taylorErr_le {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x z : EuclSpace d) :
    ∃ C : ℝ, |taylorErr φ x z| ≤ C / 6 := by
  obtain ⟨C, hC⟩ := taylor_two_bounded hφ x z
  exact ⟨C, by unfold taylorErr; exact hC⟩
theoremexists_error_diff_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w, v \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $E$ such that:

  • $\operatorname{taylorErr}(\varphi, x, w) - \operatorname{taylorErr}(\varphi, x, v) \le E$
PLaplacian.exists_error_diff_boundPlaplacian/ErrDiff.lean, lines 52–61
/-- **The error difference is bounded.** -/
theorem exists_error_diff_bound {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x w v : EuclSpace d) :
    ∃ E : ℝ, taylorErr φ x w - taylorErr φ x v ≤ E := by
  obtain ⟨C₁, h₁⟩ := abs_taylorErr_le hφ x w
  obtain ⟨C₂, h₂⟩ := abs_taylorErr_le hφ x v
  refine ⟨C₁ / 6 + C₂ / 6, ?_⟩
  have h1 := abs_le.1 h₁
  have h2 := abs_le.1 h₂
  linarith [h1.2, h2.1]

Plaplacian/ErrNeg.lean3 declarations

theoremtaylorErr_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Then $\operatorname{taylorErr}(y \mapsto - \varphi(y), x, z) = - \operatorname{taylorErr}(\varphi, x, z)$.

/-- The Taylor error of the negation. -/
theorem taylorErr_neg (φ : EuclSpace d → ℝ) (x z : EuclSpace d) :
    taylorErr (fun y => -φ y) x z = - taylorErr φ x z := by
  unfold taylorErr
  have h1 : fderiv ℝ (fun y => -φ y) x z = - fderiv ℝ φ x z := by
    rw [show (fun y => -φ y) = -φ from rfl, fderiv_neg]
    rfl
  have h2 : fderiv ℝ (fderiv ℝ (fun y => -φ y)) x z z
      = - fderiv ℝ (fderiv ℝ φ) x z z := by
    rw [hess_neg]
    simp
  rw [h1, h2]
  ring
theoremgradDir_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ _hx

Then $\operatorname{gradDir}(y \mapsto - \varphi(y), x) = - \operatorname{gradDir}(\varphi, x)$.

/-- The negation's shift direction is the negative of the original's. -/
theorem gradDir_neg (φ : EuclSpace d → ℝ) {x : EuclSpace d}
    (_hx : gradient φ x ≠ 0) :
    gradDir (fun y => -φ y) x = - gradDir φ x := by
  unfold gradDir
  rw [gradient_neg', norm_neg]
  simp
theoreminf_err_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx

Then $\operatorname{taylorErr}(y \mapsto - \varphi(y), x, \varepsilon \cdot \operatorname{gradDir}(y \mapsto - \varphi(y), x)) = - \operatorname{taylorErr}(\varphi, x, - \varepsilon \cdot \operatorname{gradDir}(\varphi, x))$.

/-- **The error in `sInf_upper_infLap`, in terms of the original
function.** -/
theorem inf_err_eq (φ : EuclSpace d → ℝ) {x : EuclSpace d}
    (hx : gradient φ x ≠ 0) (ε : ℝ) :
    taylorErr (fun y => -φ y) x (ε • gradDir (fun y => -φ y) x)
      = - taylorErr φ x (-(ε • gradDir φ x)) := by
  rw [gradDir_neg φ hx, taylorErr_neg]
  congr 2
  module

Plaplacian/ErrRate.lean3 declarations

opaqueconstant.

No exported statement.

opaque constant. The point on the segment lies in the ball, a convex
theoremmem_closedBall_segment
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$, $\varepsilon, \xi \in \mathbb{R}$.

Assume

  • $\lVert z\rVert \le \varepsilon$ hz
  • $0 \le \xi$ hξ0
  • $\xi \le 1$ hξ1

Then $x + \xi \cdot z \in \overline{B}(x, \varepsilon)$.

PLaplacian.mem_closedBall_segmentPlaplacian/ErrRate.lean, lines 47–57
/-- The segment point lies in the closed ball. -/
theorem mem_closedBall_segment (x z : EuclSpace d) {ε ξ : ℝ}
    (hz : ‖z‖ ≤ ε) (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) :
    x + ξ • z ∈ closedBall x ε := by
  rw [Metric.mem_closedBall, dist_eq_norm]
  have h : x + ξ • z - x = ξ • z := by abel
  rw [h, norm_smul, Real.norm_eq_abs, abs_of_nonneg hξ0]
  calc ξ * ‖z‖ ≤ 1 * ‖z‖ := by
        exact mul_le_mul_of_nonneg_right hξ1 (norm_nonneg z)
    _ = ‖z‖ := one_mul _
    _ ≤ ε := hz
theoremtaylorErr_le_cubicTheorem 3.9 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $K$ such that:

  • $\forall z,\ \lVert z\rVert \le \varepsilon \to \lvert \operatorname{taylorErr}(\varphi, x, z)\rvert \le K \cdot \lVert z\rVert ^{3}$
PLaplacian.taylorErr_le_cubicPlaplacian/ErrRate.lean, lines 59–103
/-- **The Taylor error, at a cubic rate.** -/
theorem taylorErr_le_cubic {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x : EuclSpace d) (ε : ℝ) :
    ∃ K : ℝ, ∀ z : EuclSpace d, ‖z‖ ≤ ε →
      |taylorErr φ x z| ≤ K * ‖z‖ ^ 3 := by
  obtain ⟨C, hC⟩ := deriv_three_cubic_bound hφ x ε
  refine ⟨C, fun z hz => ?_⟩
  -- Taylor at order two on the restriction
  obtain ⟨ξ, hξ, hres⟩ := taylor_two_deriv
    (fun s : ℝ => φ (x + s • z)) (by
      have h := contDiff_restrict_three hφ x z
      simpa [lineMap] using h)
  -- the three polynomial terms
  have hd1 : deriv (fun s : ℝ => φ (x + s • z)) 0
      = fderiv ℝ φ x z := by
    have h := hasDerivAt_first (hφ.of_le (by norm_num)) x z 0
    simp only [lineMap, zero_smul, add_zero] at h
    exact h.deriv
  have hd2 : deriv (deriv (fun s : ℝ => φ (x + s • z))) 0
      = fderiv ℝ (fderiv ℝ φ) x z z := by
    have h := hasDerivAt_second_at (hφ.of_le (by norm_num)) x z 0
    simp only [lineMap, zero_smul, add_zero] at h
    have hfun : deriv (fun s : ℝ => φ (x + s • z))
        = fun t => fderiv ℝ φ (x + t • z) z := by
      funext t
      have ht := hasDerivAt_first (hφ.of_le (by norm_num)) x z t
      simp only [lineMap] at ht
      exact ht.deriv
    rw [hfun]
    exact h.deriv
  -- the remainder, bounded cubically
  have hmem : x + ξ • z ∈ closedBall x ε :=
    mem_closedBall_segment x z hz (le_of_lt hξ.1) (le_of_lt hξ.2)
  have hbd := hC z hz ξ hmem
  -- assemble
  have herr : taylorErr φ x z
      = (1 / 6) * deriv (deriv (deriv (fun s : ℝ => φ (x + s • z)))) ξ := by
    unfold taylorErr
    simp only [one_smul, zero_smul, add_zero] at hres
    rw [hd1, hd2] at hres
    linarith [hres]
  rw [herr, abs_mul, abs_of_nonneg (by norm_num : (0:ℝ) ≤ 1/6)]
  nlinarith [hbd, abs_nonneg
    (deriv (deriv (deriv (fun s : ℝ => φ (x + s • z)))) ξ),
    pow_nonneg (norm_nonneg z) 3]

Plaplacian/ErrSmall.lean4 declarations

deferrFactor
Formal statementgenerated from the Lean declaration

Let $H, K, \mathrm{Ka}, g, \varepsilon \in \mathbb{R}$.

Its value lies in $\mathbb{R}$.

/-- The factor, continuous and vanishing at zero. -/
def errFactor (H K Ka g ε : ℝ) : ℝ :=
  H * Real.sqrt (2 * ε * (H + 2 * K * ε) / g) + (K + Ka) * ε
theoremtendsto_errFactor
Formal statementgenerated from the Lean declaration

Let $H, K, \mathrm{Ka}, g \in \mathbb{R}$.

Then $\operatorname{Tendsto}(\operatorname{errFactor}(H, K, \mathrm{Ka}, g), \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$.

PLaplacian.tendsto_errFactorPlaplacian/ErrSmall.lean, lines 51–61
/-- It tends to zero as the parameter does. -/
theorem tendsto_errFactor (H K Ka g : ℝ) :
    Filter.Tendsto (errFactor H K Ka g) (nhdsWithin (0 : ℝ) (Set.Ioi 0))
      (nhds 0) := by
  have hcont : Continuous (errFactor H K Ka g) := by
    unfold errFactor; fun_prop
  have h0 : errFactor H K Ka g 0 = 0 := by
    unfold errFactor; simp
  have h := hcont.tendsto 0
  rw [h0] at h
  exact h.mono_left nhdsWithin_le_nhds
theorembound_eq_sq_mul
Formal statementgenerated from the Lean declaration

Let $H, K, \mathrm{Ka}, g, \varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then H * ε * √(2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) + K * ε ^ 3 + Ka * ε ^ 3 = ε ^ 2 * PLaplacian.errFactor H K Ka g ε.

PLaplacian.bound_eq_sq_mulPlaplacian/ErrSmall.lean, lines 63–73
/-- **The factorisation.** For positive parameter, the uniform bound is the
squared parameter times the factor. -/
theorem bound_eq_sq_mul {H K Ka g ε : ℝ} (hε : 0 < ε) :
    (H * ε * Real.sqrt (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g))
        + K * ε ^ 3) + Ka * ε ^ 3
      = ε ^ 2 * errFactor H K Ka g ε := by
  have hinner : 2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)
      = ε ^ 2 * (2 * ε * (H + 2 * K * ε) / g) := by ring
  rw [hinner, Real.sqrt_mul (sq_nonneg ε), Real.sqrt_sq (le_of_lt hε)]
  unfold errFactor
  ring
theoremeventually_bound_leTheorem 4.5 in the blueprint
Formal statementgenerated from the Lean declaration

Let $H, K, \mathrm{Ka}, g, \eta \in \mathbb{R}$.

Assume

  • $0 < \eta$ hη

Then ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), H * ε * √(2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) + K * ε ^ 3 + Ka * ε ^ 3 ≤ η * ε ^ 2.

PLaplacian.eventually_bound_lePlaplacian/ErrSmall.lean, lines 75–89
/-- **The error is eventually small against the squared parameter.** -/
theorem eventually_bound_le {H K Ka g η : ℝ} (hη : 0 < η) :
    ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      (H * ε * Real.sqrt (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g))
          + K * ε ^ 3) + Ka * ε ^ 3 ≤ η * ε ^ 2 := by
  have hlt : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      errFactor H K Ka g ε < η :=
    (tendsto_errFactor H K Ka g).eventually (eventually_lt_nhds hη)
  have hpos : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), 0 < ε :=
    self_mem_nhdsWithin
  filter_upwards [hlt, hpos] with ε hq hε
  rw [bound_eq_sq_mul hε]
  have hε2 : (0:ℝ) ≤ ε ^ 2 := by positivity
  have := mul_le_mul_of_nonneg_left (le_of_lt hq) hε2
  linarith [this]

Plaplacian/Exclude.lean3 declarations

theoremmem_ball_of_not_annulus
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, y \in \mathbb{R}^{d}$, $\rho, r \in \mathbb{R}$.

Assume

  • $y \in \overline{B}(x_{0}, r)$ hy
  • $y \notin \operatorname{annulus}(x_{0}, \rho, r)$ hna

Then $y \in B(x_{0}, \rho)$.

PLaplacian.mem_ball_of_not_annulusPlaplacian/Exclude.lean, lines 49–56
/-- A point of the closed ball outside the annulus lies within the inner
radius. -/
theorem mem_ball_of_not_annulus {x₀ y : EuclSpace d} {ρ r : ℝ}
    (hy : y ∈ closedBall x₀ r) (hna : y ∉ annulus x₀ ρ r) :
    y ∈ ball x₀ ρ := by
  unfold annulus at hna
  by_contra hb
  exact hna ⟨hy, hb⟩
theoremnear_of_above
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0}, y \in \mathbb{R}^{d}$, $\rho, r, a \in \mathbb{R}$.

Assume

  • $\forall w \in \operatorname{annulus}(x_{0}, \rho, r),\ u(w) - \varphi(w) < a$ hann
  • $y \in \overline{B}(x_{0}, r)$ hy
  • $a \le u(y) - \varphi(y)$ habove

Then $y \in B(x_{0}, \rho)$.

/-- **The exclusion.** A point of the closed ball whose value is at least the
annulus bound lies within the inner radius. -/
theorem near_of_above {u : EuclSpace d → ℝ} {φ : EuclSpace d → ℝ}
    {x₀ y : EuclSpace d} {ρ r a : ℝ}
    (hann : ∀ w ∈ annulus x₀ ρ r, u w - φ w < a)
    (hy : y ∈ closedBall x₀ r) (habove : a ≤ u y - φ y) :
    y ∈ ball x₀ ρ := by
  refine mem_ball_of_not_annulus hy ?_
  intro hya
  have := hann y hya
  linarith [this, habove]
theoremnearmax_in_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0}, y \in \mathbb{R}^{d}$, $\rho, r, a, S, \tau \in \mathbb{R}$.

Assume

  • $\forall w \in \operatorname{annulus}(x_{0}, \rho, r),\ u(w) - \varphi(w) < a$ hann
  • $y \in \overline{B}(x_{0}, r)$ hy
  • $S - \tau < u(y) - \varphi(y)$ hnear
  • $a \le S - \tau$ hclear

Then $y \in B(x_{0}, \rho)$.

PLaplacian.nearmax_in_ballPlaplacian/Exclude.lean, lines 70–81
/-- **The near-maximizer is near the base point**, at a single parameter.

If the near-maximizer's value exceeds its supremum less the tolerance, and
that exceeds the annulus bound, the near-maximizer lies within the inner
radius. -/
theorem nearmax_in_ball {u : EuclSpace d → ℝ} {φ : EuclSpace d → ℝ}
    {x₀ y : EuclSpace d} {ρ r a S τ : ℝ}
    (hann : ∀ w ∈ annulus x₀ ρ r, u w - φ w < a)
    (hy : y ∈ closedBall x₀ r)
    (hnear : S - τ < u y - φ y) (hclear : a ≤ S - τ) :
    y ∈ ball x₀ ρ :=
  near_of_above hann hy (by linarith [hnear, hclear])

Plaplacian/Existence.lean1 declarations

theoremexists_fixedPointTheorem 1.13 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep
  • $\forall \eta > 0,\ \exists N,\ \forall j \ge N,\ \forall x,\ \lvert \operatorname{iterLimit}(p, \varepsilon, u_{0}, x) - \operatorname{iter}(p, \varepsilon, u_{0}, j, x)\rvert \le \eta$ hunif

Then all of the following hold:

  • $\operatorname{iterLimit}(p, \varepsilon, u_{0})\text{ is admissible (bounded and Borel measurable)}$
  • $\forall x,\ T_{\varepsilon} \operatorname{iterLimit}(p, \varepsilon, u_{0})(x) = \operatorname{iterLimit}(p, \varepsilon, u_{0}, x)$
PLaplacian.exists_fixedPointPlaplacian/Existence.lean, lines 35–87
/-- **Existence of a solution of the dynamic programming principle.**

Given an admissible subsolution `u₀`, the Perron iteration converges to an
admissible function that is a fixed point of the step operator. This is the
content of Theorem 2.1 of Luiro-Parviainen-Saksman, assembled from the
ingredients proved in the preceding files.

The fixed-point property is obtained by passing the operator through the
limit: `T` of the limit is the limit of the `T`-iterates by
`tugOfWarOp_nonexpansive` together with uniform convergence, and the
`T`-iterates are the iterates shifted by one, whose limit is the same. -/
theorem exists_fixedPoint (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x)
    (hunif : ∀ η > 0, ∃ N, ∀ j ≥ N, ∀ x,
      |iterLimit p ε u₀ x - iter p ε u₀ j x| ≤ η) :
    BddMeas (iterLimit p ε u₀)
    ∧ ∀ x, tugOfWarOp p ε (iterLimit p ε u₀) x = iterLimit p ε u₀ x := by
  have hBMu := bddMeas_iterLimit p ε hp hε hd hpd hu₀ hC hstep
  refine ⟨hBMu, fun x => ?_⟩
  -- it suffices that the difference is below every positive η
  have key : ∀ η > 0,
      |tugOfWarOp p ε (iterLimit p ε u₀) x - iterLimit p ε u₀ x| ≤ 2 * η := by
    intro η hη
    obtain ⟨N, hN⟩ := hunif η hη
    -- T of the limit is close to T of the N-th iterate
    have h1 : |tugOfWarOp p ε (iterLimit p ε u₀) x
        - tugOfWarOp p ε (iter p ε u₀ N) x| ≤ η :=
      tugOfWarOp_nonexpansive p ε hp hd hε hpd hBMu
        (bddMeas_iter p ε hp hε hpd hu₀ N)
        (fun y => hN N le_rfl y) x
    -- T of the N-th iterate is the (N+1)-st, which is close to the limit
    have h2 : |iterLimit p ε u₀ x - iter p ε u₀ (N + 1) x| ≤ η :=
      hN (N + 1) (Nat.le_succ N) x
    have h3 : iter p ε u₀ (N + 1) x = tugOfWarOp p ε (iter p ε u₀ N) x := rfl
    rw [h3] at h2
    have h4 := abs_le.1 h1
    have h5 := abs_le.1 h2
    rw [abs_le]
    constructor <;> linarith
  -- a nonnegative quantity below every positive bound is zero
  have hzero : tugOfWarOp p ε (iterLimit p ε u₀) x - iterLimit p ε u₀ x = 0 := by
    by_contra hcon
    have hpos : 0 < |tugOfWarOp p ε (iterLimit p ε u₀) x
        - iterLimit p ε u₀ x| := abs_pos.2 hcon
    obtain ⟨η, hηpos, hηlt⟩ : ∃ η > 0, 2 * η
        < |tugOfWarOp p ε (iterLimit p ε u₀) x - iterLimit p ε u₀ x| := by
      refine ⟨|tugOfWarOp p ε (iterLimit p ε u₀) x
        - iterLimit p ε u₀ x| / 4, by positivity, by linarith⟩
    exact absurd (key η hηpos) (not_le.2 hηlt)
  linarith [hzero]

Plaplacian/ExpCompact.lean7 declarations

theoremexpansion_small
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hx₀
  • $0 < \eta$ hη

Then there exists $\rho > 0$ such that:

  • $\forall y \in B(x_{0}, \rho),\ \forall \varepsilon,\ 0 < \varepsilon \to \varepsilon \le \rho \to T_{\varepsilon} \varphi(y) \le \varphi(y) + \varepsilon ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, y), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)) + \eta \cdot \varepsilon ^{2}$
/-- **The error is `o(ε²)`, near a point with nonzero gradient.** -/
theorem expansion_small [Nontrivial (EuclSpace d)] (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hpd : 0 < p + (d : ℝ)) {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x₀ : EuclSpace d} (hx₀ : gradient φ x₀ ≠ 0) {η : ℝ} (hη : 0 < η) :
    ∃ ρ > 0, ∀ y ∈ ball x₀ ρ, ∀ ε : ℝ, 0 < ε → ε ≤ ρ →
      tugOfWarOp p ε φ y ≤ φ y + ε ^ 2 / (2 * (p + (d : ℝ)))
        * normPLapOf p (gradient φ y) (fderiv ℝ (fderiv ℝ φ) y) + η * ε ^ 2 := by
  obtain ⟨ρ₀, hρ₀, H, K, Ka, g, hg, hK, hH, hKa, hexp⟩ := expansion_uniform hd hp hpd hφ hx₀
  set A := 2 * (H + 2 * K) / g with hA
  have hA0 : 0 ≤ A := by positivity
  set ε₁ := min (min ρ₀ 1) (min ((η / (2 * (H + 1))) ^ 2 / (A + 1)) (η / (2 * (K + Ka + 1))))
    with hε₁
  have hε₁0 : 0 < ε₁ := lt_min (lt_min hρ₀ one_pos) (lt_min (by positivity) (by positivity))
  refine ⟨ε₁, hε₁0, fun y hy ε hε hεle => ?_⟩
  have hερ : ε ≤ ρ₀ := le_trans hεle (le_trans (min_le_left _ _) (min_le_left _ _))
  have hε1 : ε ≤ 1 := le_trans hεle (le_trans (min_le_left _ _) (min_le_right _ _))
  have hε2 : ε ≤ (η / (2 * (H + 1))) ^ 2 / (A + 1) :=
    le_trans hεle (le_trans (min_le_right _ _) (min_le_left _ _))
  have hε3 : ε ≤ η / (2 * (K + Ka + 1)) :=
    le_trans hεle (le_trans (min_le_right _ _) (min_le_right _ _))
  have hyρ : y ∈ ball x₀ ρ₀ := ball_subset_ball (le_trans (min_le_left _ _) (min_le_left _ _)) hy
  obtain ⟨E, hE, hEb⟩ := hexp y hyρ ε hε hερ
  rw [hE]
  -- the square-root term
  set X := 2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g) with hX
  have hX0 : 0 ≤ X := by positivity
  have hXA : X ≤ A * ε ^ 3 := by
    have h1 : H * ε ^ 2 + 2 * K * ε ^ 3 ≤ (H + 2 * K) * ε ^ 2 := by
      have : ε ^ 3 ≤ ε ^ 2 := by
        have : ε ^ 3 = ε ^ 2 * ε := by ring
        rw [this]
        calc ε ^ 2 * ε ≤ ε ^ 2 * 1 := mul_le_mul_of_nonneg_left hε1 (by positivity)
          _ = ε ^ 2 := mul_one _
      nlinarith
    have h2 : (H * ε ^ 2 + 2 * K * ε ^ 3) / g ≤ (H + 2 * K) * ε ^ 2 / g :=
      div_le_div_of_nonneg_right h1 hg.le
    have h3 := mul_le_mul_of_nonneg_left h2 (by positivity : (0 : ℝ) ≤ 2 * ε)
    have e : 2 * ε * ((H + 2 * K) * ε ^ 2 / g) = A * ε ^ 3 := by rw [hA]; field_simp
    linarith
  have hAε : A * ε ≤ (η / (2 * (H + 1))) ^ 2 := by
    have h1 := (le_div_iff₀ (by positivity : (0 : ℝ) < A + 1)).1 hε2
    nlinarith
  have hXsq : X ≤ (η * ε / (2 * (H + 1))) ^ 2 := by
    have h1 : A * ε ^ 3 ≤ (η / (2 * (H + 1))) ^ 2 * ε ^ 2 := by
      have := mul_le_mul_of_nonneg_right hAε (by positivity : (0 : ℝ) ≤ ε ^ 2)
      nlinarith
    have e : (η / (2 * (H + 1))) ^ 2 * ε ^ 2 = (η * ε / (2 * (H + 1))) ^ 2 := by ring
    linarith
  have hsqrt : Real.sqrt X ≤ η * ε / (2 * (H + 1)) := by
    have := Real.sqrt_le_sqrt hXsq
    rwa [Real.sqrt_sq (by positivity)] at this
  have hT1 : H * ε * Real.sqrt X ≤ η / 2 * ε ^ 2 := by
    have h1 := mul_le_mul_of_nonneg_left hsqrt (by positivity : (0 : ℝ) ≤ H * ε)
    have h2 : H * ε * (η * ε / (2 * (H + 1))) ≤ η / 2 * ε ^ 2 := by
      rw [show H * ε * (η * ε / (2 * (H + 1))) = (H / (H + 1)) * (η / 2 * ε ^ 2) by
        field_simp]
      have : H / (H + 1) ≤ 1 := by rw [div_le_one (by positivity)]; linarith
      have hpos : 0 ≤ η / 2 * ε ^ 2 := by positivity
      nlinarith
    linarith
  -- the cubic terms
  have hT2 : K * ε ^ 3 + Ka * ε ^ 3 ≤ η / 2 * ε ^ 2 := by
    have h1 : (K + Ka) * ε ≤ η / 2 := by
      have := (le_div_iff₀ (by positivity : (0 : ℝ) < 2 * (K + Ka + 1))).1 hε3
      nlinarith
    have := mul_le_mul_of_nonneg_right h1 (by positivity : (0 : ℝ) ≤ ε ^ 2)
    nlinarith
  have hEle : E ≤ η * ε ^ 2 := by
    have := le_abs_self E
    linarith
  linarith
theoremexpansion_compact
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $K' \subseteq \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{IsCompact}(K')$ hK'
  • $\forall x \in K',\ \operatorname{gradient}(\varphi, x) \ne 0$ hgrad
  • $0 < \eta$ hη

Then there exists $\varepsilon_{0} > 0$ such that:

  • $\forall y \in K',\ \forall \varepsilon,\ 0 < \varepsilon \to \varepsilon \le \varepsilon_{0} \to T_{\varepsilon} \varphi(y) \le \varphi(y) + \varepsilon ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, y), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)) + \eta \cdot \varepsilon ^{2}$
/-- **The expansion, uniformly on a compact set with nonzero gradient.** -/
theorem expansion_compact [Nontrivial (EuclSpace d)] (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hpd : 0 < p + (d : ℝ)) {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {K' : Set (EuclSpace d)} (hK' : IsCompact K') (hgrad : ∀ x ∈ K', gradient φ x ≠ 0)
    {η : ℝ} (hη : 0 < η) :
    ∃ ε₀ > 0, ∀ y ∈ K', ∀ ε : ℝ, 0 < ε → ε ≤ ε₀ →
      tugOfWarOp p ε φ y ≤ φ y + ε ^ 2 / (2 * (p + (d : ℝ)))
        * normPLapOf p (gradient φ y) (fderiv ℝ (fderiv ℝ φ) y) + η * ε ^ 2 := by
  rcases K'.eq_empty_or_nonempty with h | hne
  · exact ⟨1, one_pos, fun y hy => by rw [h] at hy; exact absurd hy (notMem_empty y)⟩
  have hloc : ∀ x ∈ K', ∃ ρ > 0, ∀ y ∈ ball x ρ, ∀ ε : ℝ, 0 < ε → ε ≤ ρ →
      tugOfWarOp p ε φ y ≤ φ y + ε ^ 2 / (2 * (p + (d : ℝ)))
        * normPLapOf p (gradient φ y) (fderiv ℝ (fderiv ℝ φ) y) + η * ε ^ 2 :=
    fun x hx => expansion_small hd hp hpd hφ (hgrad x hx) hη
  choose! ρ hρpos hρ using hloc
  obtain ⟨t, htK, hcover⟩ := hK'.elim_nhds_subcover (fun x => ball x (ρ x))
    (fun x hx => ball_mem_nhds x (hρpos x hx))
  have htne : t.Nonempty := by
    obtain ⟨y, hy⟩ := hne
    have := hcover hy
    rw [mem_iUnion₂] at this
    obtain ⟨x, hx, _⟩ := this
    exact ⟨x, hx⟩
  refine ⟨t.inf' htne ρ, (Finset.lt_inf'_iff htne).2 fun x hx => hρpos x (htK x hx),
    fun y hy ε hε hεle => ?_⟩
  have := hcover hy
  rw [mem_iUnion₂] at this
  obtain ⟨x, hx, hyx⟩ := this
  exact hρ x (htK x hx) y hyx ε hε (le_trans hεle (Finset.inf'_le ρ hx))
theorempeanoAt_affine
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $c, A \in \mathbb{R}$.

Assume

  • $\operatorname{PeanoAt}(f, x, q, X)$ h

Then $\operatorname{PeanoAt}(y \mapsto c + A \cdot f(y), x, A \cdot q, A \cdot X)$.

theorem peanoAt_affine {f : EuclSpace d → ℝ} {x q : EuclSpace d} {X : Bilin d}
    (h : PeanoAt f x q X) (c A : ℝ) :
    PeanoAt (fun y => c + A * f y) x (A • q) (A • X) := by
  intro ε hε
  obtain ⟨δ, hδ, hb⟩ := h (ε / (|A| + 1)) (by positivity)
  refine ⟨δ, hδ, fun k hk => ?_⟩
  have h1 := hb k hk
  change |(c + A * f (x + k)) - (c + A * f x) - inner ℝ (A • q) k
    - 1 / 2 * ((A • X) k) k| ≤ ε * ‖k‖ ^ 2
  rw [real_inner_smul_left, smul_apply, smul_apply, smul_eq_mul]
  have e : (c + A * f (x + k)) - (c + A * f x) - A * inner ℝ q k - 1 / 2 * (A * (X k) k)
      = A * (f (x + k) - f x - inner ℝ q k - 1 / 2 * (X k) k) := by ring
  rw [e, abs_mul]
  have h2 := mul_le_mul_of_nonneg_left h1 (abs_nonneg A)
  have h3 : |A| * (ε / (|A| + 1) * ‖k‖ ^ 2) ≤ ε * ‖k‖ ^ 2 := by
    have : |A| * (ε / (|A| + 1)) ≤ ε := by
      rw [mul_div_assoc', div_le_iff₀ (by positivity)]
      nlinarith [abs_nonneg A]
    have := mul_le_mul_of_nonneg_right this (by positivity : (0 : ℝ) ≤ ‖k‖ ^ 2)
    nlinarith
  linarith
theoremnormPLapOf_smul_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, A \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < A$ hA
  • $q \ne 0$ hq

Then $\operatorname{normPLapOf}(p, A \cdot q, A \cdot X) = A \cdot \operatorname{normPLapOf}(p, q, X)$.

PLaplacian.normPLapOf_smul_posPlaplacian/ExpCompact.lean, lines 157–168
theorem normPLapOf_smul_pos {p A : ℝ} (hA : 0 < A) {q : EuclSpace d} (hq : q ≠ 0)
    (X : Bilin d) : normPLapOf p (A • q) (A • X) = A * normPLapOf p q X := by
  have hqn : 0 < ‖q‖ := norm_pos_iff.2 hq
  unfold normPLapOf infLaplacianOf
  rw [laplacianOf_smul]
  have hn : ‖A • q‖ = A * ‖q‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_pos hA]
  have he : ‖A • q‖⁻¹ • (A • q) = ‖q‖⁻¹ • q := by
    rw [hn, smul_smul]
    congr 1
    field_simp
  rw [he, smul_apply, smul_apply, smul_eq_mul]
  ring
defbShell
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $z \in \mathbb{R}^{d}$, $\delta, M \in \mathbb{R}$.

Its value lies in $\operatorname{Set}(\mathbb{R}^{d})$.

/-- The shell around the exterior ball. -/
def bShell (z : EuclSpace d) (δ M : ℝ) : Set (EuclSpace d) :=
  {x | δ ^ 2 ≤ ‖x - z‖ ^ 2 ∧ ‖x - z‖ ^ 2 ≤ δ ^ 2 + 1 / (4 * M)}
theoremisCompact_bShell
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $z \in \mathbb{R}^{d}$, $\delta, M \in \mathbb{R}$.

Then $\operatorname{IsCompact}(\operatorname{bShell}(z, \delta, M))$.

theorem isCompact_bShell (z : EuclSpace d) (δ M : ℝ) : IsCompact (bShell z δ M) := by
  have hc : Continuous (fun x : EuclSpace d => ‖x - z‖ ^ 2) := by fun_prop
  apply Metric.isCompact_of_isClosed_isBounded
  · exact (isClosed_le continuous_const hc).inter (isClosed_le hc continuous_const)
  · rw [isBounded_iff_forall_norm_le]
    refine ⟨‖z‖ + (δ ^ 2 + 1 / (4 * M) + 1), fun x hx => ?_⟩
    have h1 : ‖x - z‖ ^ 2 ≤ δ ^ 2 + 1 / (4 * M) := hx.2
    have h2 : ‖x - z‖ ≤ ‖x - z‖ ^ 2 + 1 := by nlinarith [norm_nonneg (x - z)]
    have h3 : ‖x‖ ≤ ‖x - z‖ + ‖z‖ := by
      have := norm_add_le (x - z) z
      rwa [sub_add_cancel] at this
    linarith
theorembarrier_superTheorem 7.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\delta \in \mathbb{R}$, $z \in \mathbb{R}^{d}$, $c, A \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $0 < \delta$ hδ
  • $0 < A$ hA

Then there exists $\varepsilon_{0} > 0$ such that:

  • $\forall y \in \operatorname{bShell}(z, \delta, \operatorname{bM}(p, \delta, d)),\ \forall \varepsilon,\ 0 < \varepsilon \to \varepsilon \le \varepsilon_{0} \to T_{\varepsilon} x \mapsto c + A \cdot \operatorname{bpsi}(z, \delta, \operatorname{bM}(p, \delta, d), x)(y) \le c + A \cdot \operatorname{bpsi}(z, \delta, \operatorname{bM}(p, \delta, d), y) - A \cdot \varepsilon ^{2} / (4 \cdot (p + d))$
/-- **The barrier is a strict discrete supersolution on the shell.** -/
theorem barrier_super [Nontrivial (EuclSpace d)] (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hpd : 0 < p + (d : ℝ)) {δ : ℝ} (hδ : 0 < δ) (z : EuclSpace d) (c : ℝ) {A : ℝ}
    (hA : 0 < A) :
    ∃ ε₀ > 0, ∀ y ∈ bShell z δ (bM p δ d), ∀ ε : ℝ, 0 < ε → ε ≤ ε₀ →
      tugOfWarOp p ε (fun x => c + A * bpsi z δ (bM p δ d) x) y
        ≤ (c + A * bpsi z δ (bM p δ d) y) - A * ε ^ 2 / (4 * (p + (d : ℝ))) := by
  set M := bM p δ d with hMdef
  have hp1 : 0 < p - 1 := by linarith
  have hd1 : (1 : ℝ) ≤ d := by exact_mod_cast hd
  have hM : 0 < M := by
    rw [hMdef]; unfold bM
    have hD : 0 < (d : ℝ) + p - 2 := by linarith
    exact div_pos (by linarith) (mul_pos (mul_pos (by norm_num) hp1) (pow_pos hδ 2))
  set v : EuclSpace d → ℝ := fun x => c + A * bpsi z δ M x with hvdef
  have hvC : ContDiff ℝ 3 v := contDiff_const.add (contDiff_const.mul (bpsi_contDiff z δ M))
  have hvC2 : ContDiff ℝ 2 v := contDiff_const.add (contDiff_const.mul (bpsi_contDiff z δ M))
  -- the gradient and the operator value of v on the shell
  have hval : ∀ y ∈ bShell z δ M, gradient v y ≠ 0 ∧
      normPLapOf p (gradient v y) (fderiv ℝ (fderiv ℝ v) y) ≤ -A := by
    intro y hy
    obtain ⟨hψg, hψN⟩ := bpsi_op hd hp hδ z hy.1 hy.2
    obtain ⟨hgψ, hNψ⟩ := normPLapOf_of_peano (p := p) (bpsi_contDiff z δ M)
      (bpsi_peano hM.le z δ y)
    obtain ⟨hgv, hNv⟩ := normPLapOf_of_peano (p := p) hvC2
      (peanoAt_affine (bpsi_peano hM.le z δ y) c A)
    set q := (2 * (1 - 2 * M * (‖y - z‖ ^ 2 - δ ^ 2))) • (y - z) with hq
    have hq0 : q ≠ 0 := by rw [← hgψ]; exact hψg
    refine ⟨by rw [hgv]; exact smul_ne_zero hA.ne' hq0, ?_⟩
    change normPLapOf p (gradient v y) (hess v y) ≤ -A
    rw [hNv, normPLapOf_smul_pos hA hq0, ← hNψ]
    have := mul_le_mul_of_nonneg_left hψN hA.le
    linarith
  -- the uniform expansion
  obtain ⟨ε₀, hε₀, hexp⟩ := expansion_compact hd hp hpd hvC (isCompact_bShell z δ M)
    (fun y hy => (hval y hy).1) (η := A / (4 * (p + (d : ℝ)))) (by positivity)
  refine ⟨ε₀, hε₀, fun y hy ε hε hεle => ?_⟩
  have h1 := hexp y hy ε hε hεle
  have h2 := (hval y hy).2
  have h3 : ε ^ 2 / (2 * (p + (d : ℝ))) * normPLapOf p (gradient v y) (fderiv ℝ (fderiv ℝ v) y)
      ≤ ε ^ 2 / (2 * (p + (d : ℝ))) * (-A) :=
    mul_le_mul_of_nonneg_left h2 (by positivity)
  have e : ε ^ 2 / (2 * (p + (d : ℝ))) * (-A) + A / (4 * (p + (d : ℝ))) * ε ^ 2
      = -(A * ε ^ 2 / (4 * (p + (d : ℝ)))) := by field_simp; ring
  change tugOfWarOp p ε v y ≤ v y - A * ε ^ 2 / (4 * (p + (d : ℝ)))
  linarith

Plaplacian/ExpErr.lean1 declarations

theoremexpansion_err_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon, B_{1}, B_{2} \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $0 < \varepsilon$ hε
  • |(sSup (φ '' Metric.closedBall x ε) + sInf (φ '' Metric.closedBall x ε)) / 2 - (φ x + ε ^ 2 / 2 * PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x))| ≤ B₁ hext
  • $\lvert \fint_{B(0, \varepsilon)} \operatorname{taylorErr}(\varphi, x, z) \, dz\rvert \le B_{2}$ havg

Then there exists $E$ such that:

  • $T_{\varepsilon} \varphi(x) = \varphi(x) + \varepsilon ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)) + E$
  • $\lvert E\rvert \le B_{1} + B_{2}$
PLaplacian.expansion_err_lePlaplacian/ExpErr.lean, lines 57–92
/-- **The expansion error, bounded by the sum of the two halves.** -/
theorem expansion_err_le [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) {x : EuclSpace d}
    {ε B₁ B₂ : ℝ} (hε : 0 < ε)
    (hext : |(sSup (φ '' closedBall x ε) + sInf (φ '' closedBall x ε)) / 2
        - (φ x + ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
            (fderiv ℝ (fderiv ℝ φ) x))| ≤ B₁)
    (havg : |⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ x z| ≤ B₂) :
    ∃ E : ℝ,
      tugOfWarOp p ε φ x
          = φ x + ε ^ 2 / (2 * (p + (d : ℝ)))
              * normPLapOf p (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) + E
        ∧ |E| ≤ B₁ + B₂ := by
  have hcont : Continuous φ := hφ.continuous
  -- the extreme-value half, over the open ball
  set e₁ := (sSup (φ '' ball x ε) + sInf (φ '' ball x ε)) / 2
    - (φ x + ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
        (fderiv ℝ (fderiv ℝ φ) x)) with he₁
  have hS : (sSup (φ '' ball x ε) + sInf (φ '' ball x ε)) / 2
      = φ x + ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
          (fderiv ℝ (fderiv ℝ φ) x) + e₁ := by
    rw [he₁]; ring
  have hB₁ : |e₁| ≤ B₁ := by
    rw [he₁, sSup_ball_eq_closedBall hcont x hε,
      sInf_ball_eq_closedBall hcont x hε]
    exact hext
  -- the average half
  set e₂ := ⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ x z with he₂
  have hA : (⨍ y in ball x ε, φ y)
      = φ x + ε ^ 2 / (2 * ((d : ℝ) + 2))
          * laplacianOf (fderiv ℝ (fderiv ℝ φ) x) + e₂ := by
    rw [he₂]
    exact setAverage_expansion hd (hφ.of_le (by norm_num)) x hε
  have hB₂ : |e₂| ≤ B₂ := by rw [he₂]; exact havg
  exact tugOfWarOp_expansion_bounded p hp hpd ε φ x hS hA hB₁ hB₂

Plaplacian/ExpUnif.lean1 declarations

theoremexpansion_uniformTheorem 4.5 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hx₀

Then there exists $\rho > 0$ such that:

  • ∃ H K Ka g, 0 < g ∧ 0 ≤ K ∧ 0 ≤ H ∧ 0 ≤ Ka ∧ ∀ y ∈ Metric.ball x₀ ρ, ∀ (ε : ℝ), 0 < ε → ε ≤ ρ → ∃ E, PLaplacian.tugOfWarOp p ε φ y = φ y + ε ^ 2 / (2 * (p + ↑d)) * PLaplacian.normPLapOf p (gradient φ y) (fderiv ℝ (fderiv ℝ φ) y) + E ∧ |E| ≤ H * ε * √(2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) + K * ε ^ 3 + Ka * ε ^ 3
PLaplacian.expansion_uniformPlaplacian/ExpUnif.lean, lines 58–119
/-- **The expansion, uniformly in the base point.** -/
theorem expansion_uniform [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) {x₀ : EuclSpace d}
    (hx₀ : gradient φ x₀ ≠ 0) :
    ∃ ρ > 0, ∃ H K Ka g : ℝ, 0 < g ∧ 0 ≤ K ∧ 0 ≤ H ∧ 0 ≤ Ka ∧
      ∀ y ∈ ball x₀ ρ, ∀ ε : ℝ, 0 < ε → ε ≤ ρ →
        ∃ E : ℝ,
          tugOfWarOp p ε φ y
              = φ y + ε ^ 2 / (2 * (p + (d : ℝ)))
                  * normPLapOf p (gradient φ y)
                      (fderiv ℝ (fderiv ℝ φ) y) + E
            ∧ |E| ≤ (H * ε * Real.sqrt
                  (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g))
                + K * ε ^ 3) + Ka * ε ^ 3 := by
  -- the radius and the gradient lower bound
  obtain ⟨ρ, hρ, hgrad⟩ := grad_lower_uniform (hφ.of_le (by norm_num)) hx₀
  set g := ‖gradient φ x₀‖ / 2 with hgdef
  have hg : 0 < g := by
    have : 0 < ‖gradient φ x₀‖ := norm_pos_iff.2 hx₀
    rw [hgdef]; linarith
  -- the uniform constants, on the closed ball of radius ρ
  obtain ⟨K₀, hK₀⟩ := taylorErr_le_cubic_uniform hφ x₀ ρ
  obtain ⟨Ka₀, hKa₀⟩ := avgErr_uniform hφ x₀ ρ
  obtain ⟨H₀, hH₀⟩ := hess_bound_uniform hφ x₀ ρ
  set H := max H₀ 0 with hHdef
  set Ka := max Ka₀ 0 with hKadef
  have hHnn : 0 ≤ H := le_max_right _ _
  have hKann : 0 ≤ Ka := le_max_right _ _
  set K := max K₀ 0 with hKdef
  have hK : 0 ≤ K := le_max_right _ _
  have hKge : K₀ ≤ K := le_max_left _ _
  refine ⟨ρ, hρ, H, K, Ka, g, hg, hK, hHnn, hKann,
    fun y hy ε hε hερ => ?_⟩
  have hyc : y ∈ closedBall x₀ ρ := ball_subset_closedBall hy
  -- the gradient at the base point
  have hgy : g < ‖gradient φ y‖ := hgrad y hy
  have hxy : gradient φ y ≠ 0 := by
    intro h; rw [h, norm_zero] at hgy; linarith
  -- the Taylor error bound at the base point
  have hTerr : ∀ z : EuclSpace d, ‖z‖ ≤ ε →
      |taylorErr φ y z| ≤ K * ε ^ 3 := by
    intro z hz
    have hzρ : ‖z‖ ≤ ρ := le_trans hz hερ
    have h1 := hK₀ y hyc z hzρ
    have hz3 : ‖z‖ ^ 3 ≤ ε ^ 3 := by
      have h0 : (0:ℝ) ≤ ‖z‖ := norm_nonneg z
      exact pow_le_pow_left₀ h0 hz 3
    have hz3nn : (0:ℝ) ≤ ‖z‖ ^ 3 := by positivity
    nlinarith [h1, hz3, hKge, hK, hz3nn]
  -- the two halves
  have hHy : ‖fderiv ℝ (fderiv ℝ φ) y‖ ≤ H :=
    le_trans (hH₀ y hyc) (le_max_left _ _)
  have hext := ext_avg_err_abs hφ hxy hε hK hTerr hHy hg (le_of_lt hgy)
  have havg : |⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ y z|
      ≤ Ka * ε ^ 3 := by
    have h := hKa₀ y hyc ε hε hερ
    have hε3 : (0:ℝ) ≤ ε ^ 3 := by positivity
    have : Ka₀ * ε ^ 3 ≤ Ka * ε ^ 3 :=
      mul_le_mul_of_nonneg_right (le_max_left _ _) hε3
    linarith [h, this]
  exact expansion_err_le hd hp hpd hφ hε hext havg

Plaplacian/Expansion.lean1 declarations

theoremtugOfWarOp_expansion_finalTheorem 3.8 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then there exists $E$ such that:

  • $T_{\varepsilon} \varphi(x) = \varphi(x) + \varepsilon ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)) + E$
PLaplacian.tugOfWarOp_expansion_finalPlaplacian/Expansion.lean, lines 48–67
/-- **The asymptotic expansion of the step operator.**

For a `C³` test function with nonvanishing gradient, the step operator equals
the value at the point plus the normalized `p`-Laplacian term, plus an error
term. -/
theorem tugOfWarOp_expansion_final [Nontrivial (EuclSpace d)] (hd : 0 < d)
    (p : ℝ) (hpd : 0 < p + (d : ℝ)) {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 3 φ) {x : EuclSpace d} (hx : gradient φ x ≠ 0)
    {ε : ℝ} (hε : 0 < ε) :
    ∃ E : ℝ,
      tugOfWarOp p ε φ x
        = φ x + ε ^ 2 / (2 * (p + (d : ℝ)))
            * normPLapOf p (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x)
          + E := by
  obtain ⟨e₁, lo, hi, hS, hlo, hhi⟩ := extreme_avg_threaded hφ hx hε
  have hA := setAverage_expansion hd (hφ.of_le (by norm_num)) x hε
  refine ⟨(p - 2) / (p + (d : ℝ)) * e₁
    + ((d : ℝ) + 2) / (p + (d : ℝ))
        * (⨍ z in ball (0 : EuclSpace d) ε, taylorErr φ x z), ?_⟩
  exact tugOfWarOp_expansion_normPLap p hpd ε φ x hS hA

Plaplacian/ExtAvgErr.lean1 declarations

theoremext_avg_err_abs
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon, K, H, g \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε
  • $0 \le K$ hK
  • $\forall z,\ \lVert z\rVert \le \varepsilon \to \lvert \operatorname{taylorErr}(\varphi, x, z)\rvert \le K \cdot \varepsilon ^{3}$ hTerr
  • $\lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \le H$ hH
  • $0 < g$ hg
  • $g \le \lVert \operatorname{gradient}(\varphi, x)\rVert$ hgx

Then |(sSup (φ '' Metric.closedBall x ε) + sInf (φ '' Metric.closedBall x ε)) / 2 - (φ x + ε ^ 2 / 2 * PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x))| ≤ H * ε * √(2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) + K * ε ^ 3.

/-- **The extreme-value average error, uniformly.** -/
theorem ext_avg_err_abs {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε K H g : ℝ}
    (hε : 0 < ε) (hK : 0 ≤ K)
    (hTerr : ∀ z : EuclSpace d, ‖z‖ ≤ ε → |taylorErr φ x z| ≤ K * ε ^ 3)
    (hH : ‖fderiv ℝ (fderiv ℝ φ) x‖ ≤ H) (hg : 0 < g)
    (hgx : g ≤ ‖gradient φ x‖) :
    |(sSup (φ '' closedBall x ε) + sInf (φ '' closedBall x ε)) / 2
        - (φ x + ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
            (fderiv ℝ (fderiv ℝ φ) x))|
      ≤ H * ε * Real.sqrt (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g))
        + K * ε ^ 3 := by
  have hs := sup_err_abs hφ hx hε hK hTerr hH hg hgx
  have hi := inf_err_abs hφ hx hε hK hTerr hH hg hgx
  set B := H * ε * Real.sqrt (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g))
    + K * ε ^ 3 with hB
  have hs' := abs_le.1 hs
  have hi' := abs_le.1 hi
  rw [abs_le]
  constructor <;> linarith [hs'.1, hs'.2, hi'.1, hi'.2]

Plaplacian/ExtErrRate.lean1 declarations

theoremerror_diff_cubic
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $0 < \varepsilon$ _hε

Then there exists $K$ such that:

  • $0 \le K$
  • $\forall w, v,\ \lVert w\rVert \le \varepsilon \to \lVert v\rVert \le \varepsilon \to \operatorname{taylorErr}(\varphi, x, w) - \operatorname{taylorErr}(\varphi, x, v) \le K \cdot \varepsilon ^{3}$
/-- **The error difference at a cubic rate.**

The difference of Taylor errors at two increments in the ball is at most twice
the cubic bound, which is what the localization consumes as its `E`. -/
theorem error_diff_cubic {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x : EuclSpace d) {ε : ℝ} (_hε : 0 < ε) :
    ∃ K : ℝ, 0 ≤ K ∧ ∀ w v : EuclSpace d, ‖w‖ ≤ ε → ‖v‖ ≤ ε →
      taylorErr φ x w - taylorErr φ x v ≤ K * ε ^ 3 := by
  obtain ⟨K, hK⟩ := taylorErr_le_cubic hφ x ε
  refine ⟨2 * max K 0, by positivity, fun w v hw hv => ?_⟩
  have hw3 : ‖w‖ ^ 3 ≤ ε ^ 3 := by
    have h0 : (0:ℝ) ≤ ‖w‖ := norm_nonneg w
    have hεnn : (0:ℝ) ≤ ε := le_trans h0 hw
    nlinarith [hw, h0, hεnn, sq_nonneg (‖w‖ - ε), sq_nonneg (‖w‖ + ε)]
  have hv3 : ‖v‖ ^ 3 ≤ ε ^ 3 := by
    have h0 : (0:ℝ) ≤ ‖v‖ := norm_nonneg v
    have hεnn : (0:ℝ) ≤ ε := le_trans h0 hv
    nlinarith [hv, h0, hεnn, sq_nonneg (‖v‖ - ε), sq_nonneg (‖v‖ + ε)]
  have hKm : K ≤ max K 0 := le_max_left _ _
  have hKnn : (0:ℝ) ≤ max K 0 := le_max_right _ _
  have h1 := abs_le.1 (hK w hw)
  have h2 := abs_le.1 (hK v hv)
  have hw3nn : (0:ℝ) ≤ ‖w‖ ^ 3 := by positivity
  have hv3nn : (0:ℝ) ≤ ‖v‖ ^ 3 := by positivity
  nlinarith [h1.2, h2.1, hw3, hv3, hKm, hKnn, hw3nn, hv3nn]

Plaplacian/ExtremeAttain.lean7 declarations

theoremnonempty_closedBall'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then (Metric.closedBall x ε).Nonempty.

PLaplacian.nonempty_closedBall'Plaplacian/ExtremeAttain.lean, lines 44–46
theorem nonempty_closedBall' (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    (closedBall x ε).Nonempty :=
  ⟨x, mem_closedBall_self hε.le⟩
theoremexists_sSup_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • sSup ( φ '' Metric.closedBall x ε ) = φ y
PLaplacian.exists_sSup_closedBallPlaplacian/ExtremeAttain.lean, lines 48–53
/-- **The supremum over a closed ball is attained.** -/
theorem exists_sSup_closedBall {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε, sSup (φ '' closedBall x ε) = φ y :=
  (isCompact_closedBall x ε).exists_sSup_image_eq
    (nonempty_closedBall' x hε) hφ.continuousOn
theoremexists_sInf_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • sInf ( φ '' Metric.closedBall x ε ) = φ y
PLaplacian.exists_sInf_closedBallPlaplacian/ExtremeAttain.lean, lines 55–60
/-- **And the infimum.** -/
theorem exists_sInf_closedBall {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε, sInf (φ '' closedBall x ε) = φ y :=
  (isCompact_closedBall x ε).exists_sInf_image_eq
    (nonempty_closedBall' x hε) hφ.continuousOn
theoremexists_isMaxOn_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • $\operatorname{IsMaxOn}(\varphi, \overline{B}(x, \varepsilon), y)$
PLaplacian.exists_isMaxOn_closedBallPlaplacian/ExtremeAttain.lean, lines 62–67
/-- The maximizer, in `IsMaxOn` form, which is what the upper bound needs. -/
theorem exists_isMaxOn_closedBall {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε, IsMaxOn φ (closedBall x ε) y :=
  (isCompact_closedBall x ε).exists_isMaxOn
    (nonempty_closedBall' x hε) hφ.continuousOn
theoremexists_isMinOn_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • $\operatorname{IsMinOn}(\varphi, \overline{B}(x, \varepsilon), y)$
PLaplacian.exists_isMinOn_closedBallPlaplacian/ExtremeAttain.lean, lines 69–73
theorem exists_isMinOn_closedBall {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε, IsMinOn φ (closedBall x ε) y :=
  (isCompact_closedBall x ε).exists_isMinOn
    (nonempty_closedBall' x hε) hφ.continuousOn
theoremmem_closedBall_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, \nu \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\lVert \nu\rVert = 1$ hν
  • $0 < \varepsilon$ hε

Then $x + \varepsilon \cdot \nu \in \overline{B}(x, \varepsilon)$.

PLaplacian.mem_closedBall_shiftPlaplacian/ExtremeAttain.lean, lines 77–83
/-- `x + ε ν` lies in the closed ball, for a unit vector `ν`. -/
theorem mem_closedBall_shift (x : EuclSpace d) {ν : EuclSpace d}
    (hν : ‖ν‖ = 1) {ε : ℝ} (hε : 0 < ε) :
    x + ε • ν ∈ closedBall x ε := by
  rw [Metric.mem_closedBall, dist_eq_norm]
  have h : x + ε • ν - x = ε • ν := by abel
  rw [h, norm_smul, hν, Real.norm_eq_abs, abs_of_pos hε, mul_one]
theoremmem_closedBall_shift_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, \nu \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\lVert \nu\rVert = 1$ hν
  • $0 < \varepsilon$ hε

Then $x - \varepsilon \cdot \nu \in \overline{B}(x, \varepsilon)$.

PLaplacian.mem_closedBall_shift_negPlaplacian/ExtremeAttain.lean, lines 85–91
/-- And so does `x - ε ν`. -/
theorem mem_closedBall_shift_neg (x : EuclSpace d) {ν : EuclSpace d}
    (hν : ‖ν‖ = 1) {ε : ℝ} (hε : 0 < ε) :
    x - ε • ν ∈ closedBall x ε := by
  rw [Metric.mem_closedBall, dist_eq_norm]
  have h : x - ε • ν - x = -(ε • ν) := by abel
  rw [h, norm_neg, norm_smul, hν, Real.norm_eq_abs, abs_of_pos hε, mul_one]

Plaplacian/ExtremeExpansion.lean2 declarations

theoremsSup_lower_infLapTheorem 3.6 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then φ x + ε * ‖gradient φ x‖ + ε ^ 2 / 2 * PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) + PLaplacian.taylorErr φ x (ε • PLaplacian.gradDir φ x) ≤ sSup (φ '' Metric.closedBall x ε).

/-- **The lower bound, with the infinity Laplacian identified.** -/
theorem sSup_lower_infLap {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    φ x + ε * ‖gradient φ x‖
        + (ε ^ 2 / 2) * infLaplacianOf (gradient φ x)
            (fderiv ℝ (fderiv ℝ φ) x)
        + taylorErr φ x (ε • gradDir φ x)
      ≤ sSup (φ '' closedBall x ε) := by
  have h := sSup_lower_bound hφ hx hε
  rwa [quad_at_shift x ε] at h
theoremsSup_upper_infLapTheorem 3.6 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • sSup ( φ '' Metric.closedBall x ε ) ≤ φ x + ε * ‖ gradient φ x ‖ + ε ^ 2 / 2 * PLaplacian.infLaplacianOf ( gradient φ x ) ( fderiv ℝ ( fderiv ℝ φ ) x ) + 1 / 2 * ( ‖ fderiv ℝ ( fderiv ℝ φ ) x ‖ * ‖ y - x - ε • PLaplacian.gradDir φ x ‖ * ( ‖ y - x ‖ + ‖ ε • PLaplacian.gradDir φ x ‖ ) ) + PLaplacian.taylorErr φ x ( y - x )
/-- **The upper bound, with the quadratic term compared to the target.** -/
theorem sSup_upper_infLap {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε,
      sSup (φ '' closedBall x ε)
        ≤ φ x + ε * ‖gradient φ x‖
          + (ε ^ 2 / 2) * infLaplacianOf (gradient φ x)
              (fderiv ℝ (fderiv ℝ φ) x)
          + (1 / 2) * (‖fderiv ℝ (fderiv ℝ φ) x‖
              * ‖(y - x) - ε • gradDir φ x‖
              * (‖y - x‖ + ‖ε • gradDir φ x‖))
          + taylorErr φ x (y - x) := by
  obtain ⟨y, hyMem, hyLe⟩ := sSup_upper_bound hφ hx hε
  refine ⟨y, hyMem, ?_⟩
  have hcmp := quad_diff_bound (fderiv ℝ (fderiv ℝ φ) x) (y - x)
    (ε • gradDir φ x)
  have hcmp' := (abs_le.1 hcmp).2
  have hq := quad_at_shift (φ := φ) x ε
  -- the quadratic term at the maximizer, in terms of the target
  have hstep : (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (y - x) (y - x)
      ≤ (ε ^ 2 / 2) * infLaplacianOf (gradient φ x)
            (fderiv ℝ (fderiv ℝ φ) x)
        + (1 / 2) * (‖fderiv ℝ (fderiv ℝ φ) x‖
            * ‖(y - x) - ε • gradDir φ x‖
            * (‖y - x‖ + ‖ε • gradDir φ x‖)) := by
    have hqq : (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (ε • gradDir φ x)
        (ε • gradDir φ x)
        = (ε ^ 2 / 2) * infLaplacianOf (gradient φ x)
            (fderiv ℝ (fderiv ℝ φ) x) := hq
    linarith [hcmp', hqq]
  linarith [hyLe, hstep]

Plaplacian/ExtremeValues.lean23 declarations

lemmanorm_le_of_mem_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $y \in \overline{B}(x, \varepsilon)$ hy

Then $\lVert y\rVert \le \lVert x\rVert + \varepsilon$.

PLaplacian.norm_le_of_mem_closedBallPlaplacian/ExtremeValues.lean, lines 46–53
lemma norm_le_of_mem_closedBall {x y : EuclSpace d} {ε : ℝ}
    (hy : y ∈ closedBall x ε) : ‖y‖ ≤ ‖x‖ + ε := by
  have hd : ‖y - x‖ ≤ ε := by
    rw [← dist_eq_norm]; exact Metric.mem_closedBall.1 hy
  have hyx : y = x + (y - x) := by abel
  calc ‖y‖ = ‖x + (y - x)‖ := by rw [← hyx]
    _ ≤ ‖x‖ + ‖y - x‖ := norm_add_le _ _
    _ ≤ ‖x‖ + ε := by linarith
lemmale_norm_of_mem_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $y \in \overline{B}(x, \varepsilon)$ hy

Then $\lVert x\rVert - \varepsilon \le \lVert y\rVert$.

PLaplacian.le_norm_of_mem_closedBallPlaplacian/ExtremeValues.lean, lines 55–60
lemma le_norm_of_mem_closedBall {x y : EuclSpace d} {ε : ℝ}
    (hy : y ∈ closedBall x ε) : ‖x‖ - ε ≤ ‖y‖ := by
  have hd : ‖x - y‖ ≤ ε := by
    rw [← dist_eq_norm, dist_comm]; exact Metric.mem_closedBall.1 hy
  have := norm_sub_norm_le x y
  linarith
lemmaradial_witness_mem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $x \ne 0$ hx
  • $0 \le \varepsilon$ hε

Then $(1 + \varepsilon / \lVert x\rVert) \cdot x \in \overline{B}(x, \varepsilon)$.

lemma radial_witness_mem {x : EuclSpace d} (hx : x ≠ 0) {ε : ℝ} (hε : 0 ≤ ε) :
    ((1 + ε / ‖x‖) • x) ∈ closedBall x ε := by
  have hxn : 0 < ‖x‖ := norm_pos_iff.2 hx
  rw [Metric.mem_closedBall, dist_eq_norm]
  have h : (1 + ε / ‖x‖) • x - x = (ε / ‖x‖) • x := by module
  rw [h, norm_smul]
  simp [hxn.ne', abs_of_nonneg hε]
lemmaradial_witness_norm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $x \ne 0$ hx
  • $0 \le \varepsilon$ hε

Then $\lVert (1 + \varepsilon / \lVert x\rVert) \cdot x\rVert = \lVert x\rVert + \varepsilon$.

PLaplacian.radial_witness_normPlaplacian/ExtremeValues.lean, lines 72–78
lemma radial_witness_norm {x : EuclSpace d} (hx : x ≠ 0) {ε : ℝ} (hε : 0 ≤ ε) :
    ‖(1 + ε / ‖x‖) • x‖ = ‖x‖ + ε := by
  have hxn : 0 < ‖x‖ := norm_pos_iff.2 hx
  rw [norm_smul]
  have h1 : (0:ℝ) ≤ 1 + ε / ‖x‖ := by positivity
  rw [Real.norm_eq_abs, abs_of_nonneg h1]
  field_simp
theoremisGreatest_norm_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $x \ne 0$ hx
  • $0 \le \varepsilon$ hε

Then IsGreatest ((fun y => ‖y‖) '' Metric.closedBall x ε) (‖x‖ + ε).

PLaplacian.isGreatest_norm_closedBallPlaplacian/ExtremeValues.lean, lines 80–87
/-- **The supremum of the norm over a ball is `‖x‖ + ε`.** -/
theorem isGreatest_norm_closedBall {x : EuclSpace d} (hx : x ≠ 0) {ε : ℝ}
    (hε : 0 ≤ ε) :
    IsGreatest ((fun y : EuclSpace d => ‖y‖) '' closedBall x ε) (‖x‖ + ε) := by
  refine ⟨⟨(1 + ε / ‖x‖) • x, radial_witness_mem hx hε,
    radial_witness_norm hx hε⟩, ?_⟩
  rintro a ⟨y, hy, rfl⟩
  exact norm_le_of_mem_closedBall hy
lemmainward_witness_mem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $x \ne 0$ hx
  • $0 \le \varepsilon$ hε

Then $(1 - \varepsilon / \lVert x\rVert) \cdot x \in \overline{B}(x, \varepsilon)$.

lemma inward_witness_mem {x : EuclSpace d} (hx : x ≠ 0) {ε : ℝ} (hε : 0 ≤ ε) :
    ((1 - ε / ‖x‖) • x) ∈ closedBall x ε := by
  have hxn : 0 < ‖x‖ := norm_pos_iff.2 hx
  rw [Metric.mem_closedBall, dist_eq_norm]
  have h : (1 - ε / ‖x‖) • x - x = (-(ε / ‖x‖)) • x := by module
  rw [h, norm_smul]
  simp [hxn.ne', abs_of_nonneg hε]
lemmainward_witness_norm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $x \ne 0$ hx
  • $\varepsilon \le \lVert x\rVert$ hle

Then $\lVert (1 - \varepsilon / \lVert x\rVert) \cdot x\rVert = \lVert x\rVert - \varepsilon$.

PLaplacian.inward_witness_normPlaplacian/ExtremeValues.lean, lines 99–107
lemma inward_witness_norm {x : EuclSpace d} (hx : x ≠ 0) {ε : ℝ}
    (hle : ε ≤ ‖x‖) : ‖(1 - ε / ‖x‖) • x‖ = ‖x‖ - ε := by
  have hxn : 0 < ‖x‖ := norm_pos_iff.2 hx
  rw [norm_smul]
  have h1 : (0:ℝ) ≤ 1 - ε / ‖x‖ := by
    have : ε / ‖x‖ ≤ 1 := by rw [div_le_one hxn]; exact hle
    linarith
  rw [Real.norm_eq_abs, abs_of_nonneg h1]
  field_simp
theoremisLeast_norm_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $x \ne 0$ hx
  • $0 \le \varepsilon$ hε
  • $\varepsilon \le \lVert x\rVert$ hle

Then IsLeast ((fun y => ‖y‖) '' Metric.closedBall x ε) (‖x‖ - ε).

PLaplacian.isLeast_norm_closedBallPlaplacian/ExtremeValues.lean, lines 109–116
/-- **The infimum when the ball misses the origin.** -/
theorem isLeast_norm_closedBall {x : EuclSpace d} (hx : x ≠ 0) {ε : ℝ}
    (hε : 0 ≤ ε) (hle : ε ≤ ‖x‖) :
    IsLeast ((fun y : EuclSpace d => ‖y‖) '' closedBall x ε) (‖x‖ - ε) := by
  refine ⟨⟨(1 - ε / ‖x‖) • x, inward_witness_mem hx hε,
    inward_witness_norm hx hle⟩, ?_⟩
  rintro a ⟨y, hy, rfl⟩
  exact le_norm_of_mem_closedBall hy
theoremisLeast_norm_closedBall_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\lVert x\rVert \le \varepsilon$ hle

Then IsLeast ((fun y => ‖y‖) '' Metric.closedBall x ε) 0.

PLaplacian.isLeast_norm_closedBall_zeroPlaplacian/ExtremeValues.lean, lines 118–126
/-- **The infimum when the ball contains the origin.** -/
theorem isLeast_norm_closedBall_zero {x : EuclSpace d} {ε : ℝ}
    (hle : ‖x‖ ≤ ε) :
    IsLeast ((fun y : EuclSpace d => ‖y‖) '' closedBall x ε) 0 := by
  refine ⟨⟨0, ?_, by simp⟩, ?_⟩
  · rw [Metric.mem_closedBall, dist_eq_norm]
    simpa using hle
  · rintro a ⟨y, hy, rfl⟩
    exact norm_nonneg y
lemmainner_expand
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$.

Then inner ℝ x z = ∑ i, x.ofLp i * z.ofLp i.

lemma inner_expand (x z : EuclSpace d) :
    inner ℝ x z = ∑ i, (x.ofLp i) * (z.ofLp i) := by
  rw [PiLp.inner_apply]
  simp [RCLike.inner_apply, mul_comm]
lemmaintegral_const_mul_coord_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $i \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Then $\int_{B(0, \varepsilon)} (\operatorname{x.ofLp}(i) \cdot \operatorname{z.ofLp}(i) = 0) \, dz$.

PLaplacian.integral_const_mul_coord_ballPlaplacian/ExtremeValues.lean, lines 135–137
lemma integral_const_mul_coord_ball (x : EuclSpace d) (i : Fin d) (ε : ℝ) :
    (∫ z in ball (0 : EuclSpace d) ε, (x.ofLp i) * (z.ofLp i)) = 0 := by
  rw [integral_const_mul, integral_coord_ball_eq_zero i ε, mul_zero]
lemmaintegrableOn_coord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(z \mapsto \operatorname{z.ofLp}(i), B(0, \varepsilon), \lambda)$.

lemma integrableOn_coord (i : Fin d) (ε : ℝ) :
    IntegrableOn (fun z : EuclSpace d => (z.ofLp i)) (ball (0 : EuclSpace d) ε) :=
  (ContinuousOn.integrableOn_compact (isCompact_closedBall _ _)
    (by fun_prop)).mono_set ball_subset_closedBall
lemmaintegrableOn_const_mul_coord
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $i \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(z \mapsto \operatorname{x.ofLp}(i) \cdot \operatorname{z.ofLp}(i), B(0, \varepsilon), \lambda)$.

PLaplacian.integrableOn_const_mul_coordPlaplacian/ExtremeValues.lean, lines 144–147
lemma integrableOn_const_mul_coord (x : EuclSpace d) (i : Fin d) (ε : ℝ) :
    IntegrableOn (fun z : EuclSpace d => (x.ofLp i) * (z.ofLp i))
      (ball (0 : EuclSpace d) ε) :=
  (integrableOn_coord i ε).const_mul _
lemmaintegrableOn_normSq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(z \mapsto \lVert z\rVert ^{2}, B(0, \varepsilon), \lambda)$.

lemma integrableOn_normSq (ε : ℝ) :
    IntegrableOn (fun z : EuclSpace d => ‖z‖ ^ 2) (ball (0 : EuclSpace d) ε) :=
  (ContinuousOn.integrableOn_compact (isCompact_closedBall _ _)
    (by fun_prop)).mono_set ball_subset_closedBall
theoremintegral_inner_ball_eq_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\int_{B(0, \varepsilon)} (\operatorname{inner}(\mathbb{R}, x, z) = 0) \, dz$.

PLaplacian.integral_inner_ball_eq_zeroPlaplacian/ExtremeValues.lean, lines 154–166
/-- **The linear term integrates to zero over a centred ball**, by the odd
moments of `Plaplacian.BallMoments`. -/
theorem integral_inner_ball_eq_zero (x : EuclSpace d) (ε : ℝ) :
    (∫ z in ball (0 : EuclSpace d) ε, inner ℝ x z) = (0 : ℝ) := by
  have h : (∫ z in ball (0 : EuclSpace d) ε, inner ℝ x z)
      = ∑ i : Fin d, ∫ z in ball (0 : EuclSpace d) ε,
          (x.ofLp i) * (z.ofLp i) := by
    rw [← MeasureTheory.integral_finsetSum Finset.univ
        fun i _ => integrableOn_const_mul_coord x i ε]
    refine MeasureTheory.setIntegral_congr_fun measurableSet_ball fun z _ => ?_
    exact inner_expand x z
  rw [h, Finset.sum_congr rfl fun i _ => integral_const_mul_coord_ball x i ε]
  simp
lemmasetAverage_normSq_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then $0 \le \fint_{B(0, \varepsilon)} \lVert z\rVert ^{2} \, dz$.

PLaplacian.setAverage_normSq_nonnegPlaplacian/ExtremeValues.lean, lines 168–174
lemma setAverage_normSq_nonneg {ε : ℝ} (hε : 0 < ε) :
    0 ≤ ⨍ z in ball (0 : EuclSpace d) ε, ‖z‖ ^ 2 := by
  have h0 : (⨍ _z in ball (0 : EuclSpace d) ε, (0 : ℝ)) = 0 :=
    setAverage_const_ball 0 0 hε
  rw [← h0]
  exact setAverage_mono_ball 0 integrableOn_const (integrableOn_normSq ε)
    (fun z => by positivity)
lemmavolumeReal_ball_center
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{volume.real}(B(x, \varepsilon)) = \operatorname{volume.real}(B(0, \varepsilon))$.

PLaplacian.volumeReal_ball_centerPlaplacian/ExtremeValues.lean, lines 187–190
lemma volumeReal_ball_center (x : EuclSpace d) (ε : ℝ) :
    volume.real (ball x ε) = volume.real (ball (0 : EuclSpace d) ε) := by
  simp only [MeasureTheory.Measure.real]
  rw [Measure.addHaar_ball_center volume x ε]
theoremsetIntegral_ball_translate
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\int_{B(x, \varepsilon)} (f(y) = \int_{B(0, \varepsilon)} (f(x + z)) \, dz) \, dy$.

PLaplacian.setIntegral_ball_translatePlaplacian/ExtremeValues.lean, lines 192–202
/-- Translation of a set integral over a ball. -/
theorem setIntegral_ball_translate (f : EuclSpace d → ℝ) (x : EuclSpace d)
    (ε : ℝ) :
    (∫ y in ball x ε, f y) = ∫ z in ball (0 : EuclSpace d) ε, f (x + z) := by
  have hpre : (fun z : EuclSpace d => x + z) ⁻¹' (ball x ε)
      = ball (0 : EuclSpace d) ε := by
    ext z; simp [Metric.mem_ball, dist_eq_norm]
  have key := (measurePreserving_add_left volume x).setIntegral_preimage_emb
    (measurableEmbedding_addLeft x) f (ball x ε)
  rw [hpre] at key
  exact key.symm
theoremsetAverage_ball_translate
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\fint_{B(x, \varepsilon)} (f(y) = \fint_{B(0, \varepsilon)} (f(x + z)) \, dz) \, dy$.

PLaplacian.setAverage_ball_translatePlaplacian/ExtremeValues.lean, lines 204–210
/-- Translation of the average over a ball. Uses that ball volume does not
depend on the centre. -/
theorem setAverage_ball_translate (f : EuclSpace d → ℝ) (x : EuclSpace d)
    (ε : ℝ) :
    (⨍ y in ball x ε, f y) = ⨍ z in ball (0 : EuclSpace d) ε, f (x + z) := by
  rw [MeasureTheory.setAverage_eq, MeasureTheory.setAverage_eq,
      setIntegral_ball_translate f x ε, volumeReal_ball_center x ε]
lemmaintegrableOn_inner
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(z \mapsto 2 \cdot \operatorname{inner}(\mathbb{R}, x, z), B(0, \varepsilon), \lambda)$.

lemma integrableOn_inner (x : EuclSpace d) (ε : ℝ) :
    IntegrableOn (fun z : EuclSpace d => 2 * inner ℝ x z)
      (ball (0 : EuclSpace d) ε) := by
  have h : Continuous (fun z : EuclSpace d => 2 * inner ℝ x z) := by fun_prop
  exact (h.continuousOn.integrableOn_compact
    (isCompact_closedBall _ _)).mono_set ball_subset_closedBall
lemmasetAverage_inner_eq_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\fint_{B(0, \varepsilon)} (2 \cdot \operatorname{inner}(\mathbb{R}, x, z) = 0) \, dz$.

PLaplacian.setAverage_inner_eq_zeroPlaplacian/ExtremeValues.lean, lines 219–223
lemma setAverage_inner_eq_zero (x : EuclSpace d) (ε : ℝ) :
    (⨍ z in ball (0 : EuclSpace d) ε, 2 * inner ℝ x z) = (0 : ℝ) := by
  rw [MeasureTheory.setAverage_eq, integral_const_mul,
      integral_inner_ball_eq_zero x ε]
  simp
theoremsetAverage_expand
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then $\fint_{B(0, \varepsilon)} (\lVert x\rVert ^{2} + 2 \cdot \operatorname{inner}(\mathbb{R}, x, z) + \lVert z\rVert ^{2} = \lVert x\rVert ^{2} + \fint_{B(0, \varepsilon)} \lVert z\rVert ^{2} \, dz) \, dz$.

/-- Splitting the average of the expanded square. -/
theorem setAverage_expand (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    (⨍ z in ball (0 : EuclSpace d) ε,
        (‖x‖ ^ 2 + 2 * inner ℝ x z + ‖z‖ ^ 2))
      = ‖x‖ ^ 2 + ⨍ z in ball (0 : EuclSpace d) ε, ‖z‖ ^ 2 := by
  have hc : IntegrableOn (fun _ : EuclSpace d => ‖x‖ ^ 2)
      (ball (0 : EuclSpace d) ε) := integrableOn_const
  have hi := integrableOn_inner x ε
  have hn := integrableOn_normSq (d := d) ε
  have h1 : (fun z : EuclSpace d => ‖x‖ ^ 2 + 2 * inner ℝ x z + ‖z‖ ^ 2)
      = ((fun _ : EuclSpace d => ‖x‖ ^ 2)
          + (fun z : EuclSpace d => 2 * inner ℝ x z))
        + (fun z : EuclSpace d => ‖z‖ ^ 2) := by
    funext z; simp
  rw [h1, MeasureTheory.setAverage_add (hc.add hi) hn,
      MeasureTheory.setAverage_add hc hi,
      setAverage_const_ball (‖x‖ ^ 2) 0 hε, setAverage_inner_eq_zero x ε]
  ring
theoremsetAverage_normSq_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then $\fint_{B(x, \varepsilon)} (\lVert y\rVert ^{2} = \lVert x\rVert ^{2} + \fint_{B(0, \varepsilon)} \lVert z\rVert ^{2} \, dz) \, dy$.

PLaplacian.setAverage_normSq_ballPlaplacian/ExtremeValues.lean, lines 244–255
/-- **The average of the squared norm over a ball centred at `x`.** -/
theorem setAverage_normSq_ball (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    (⨍ y in ball x ε, ‖y‖ ^ 2)
      = ‖x‖ ^ 2 + ⨍ z in ball (0 : EuclSpace d) ε, ‖z‖ ^ 2 := by
  rw [setAverage_ball_translate (fun y => ‖y‖ ^ 2) x ε]
  have hcongr : (⨍ z in ball (0 : EuclSpace d) ε, ‖x + z‖ ^ 2)
      = ⨍ z in ball (0 : EuclSpace d) ε,
          (‖x‖ ^ 2 + 2 * inner ℝ x z + ‖z‖ ^ 2) := by
    congr 1
    funext z
    exact norm_add_sq_real x z
  rw [hcongr, setAverage_expand x hε]

Plaplacian/FilterChar.lean3 declarations

theoremfrequently_lt_of_lt_ubar
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $a \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $a < \overline{u}(x)$ ha

Then ∃ᶠ (q : ℝ × EuclSpace d) in PLaplacian.relaxFilter x, a < u q.1 q.2.

PLaplacian.frequently_lt_of_lt_ubarPlaplacian/FilterChar.lean, lines 53–59
/-- **Below the upper limit, the family is frequently above.** -/
theorem frequently_lt_of_lt_ubar (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) (x : EuclSpace d) {a : ℝ}
    (ha : a < ubar u x) :
    ∃ᶠ q in relaxFilter x, a < u q.1 q.2 := by
  refine frequently_lt_of_lt_limsup ?_ ha
  exact (isBoundedUnder_ge_of_bound u hC x).isCobounded_flip
theoremle_ubar_of_frequently_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $a \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • ∃ᶠ (q : ℝ × EuclSpace d) in PLaplacian.relaxFilter x, a ≤ u q.1 q.2 hfreq

Then $a \le \overline{u}(x)$.

PLaplacian.le_ubar_of_frequently_lePlaplacian/FilterChar.lean, lines 61–67
/-- **Frequent approach from below bounds the upper limit.** -/
theorem le_ubar_of_frequently_le (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) (x : EuclSpace d) {a : ℝ}
    (hfreq : ∃ᶠ q in relaxFilter x, a ≤ u q.1 q.2) :
    a ≤ ubar u x := by
  refine le_limsup_of_frequently_le hfreq ?_
  exact isBoundedUnder_le_of_bound u hC x
theoremfrequently_gt_of_lbar_lt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $a \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\underline{u}(x) < a$ ha

Then ∃ᶠ (q : ℝ × EuclSpace d) in PLaplacian.relaxFilter x, u q.1 q.2 < a.

PLaplacian.frequently_gt_of_lbar_ltPlaplacian/FilterChar.lean, lines 69–82
/-- The dual for the lower limit: above it, the family is frequently below. -/
theorem frequently_gt_of_lbar_lt (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) (x : EuclSpace d) {a : ℝ}
    (ha : lbar u x < a) :
    ∃ᶠ q in relaxFilter x, u q.1 q.2 < a := by
  have hneg : - a < ubar (fun ε y => - u ε y) x := by
    rw [lbar_eq_neg_ubar_neg] at ha
    linarith [ha]
  have hCneg : ∀ ε y, |(- u ε y)| ≤ C := by
    intro ε y
    rw [abs_neg]
    exact hC ε y
  have hfreq := frequently_lt_of_lt_ubar (fun ε y => - u ε y) hCneg x hneg
  exact hfreq.mono fun q hq => by linarith [hq]

Plaplacian/FinSup.lean1 declarations

theoremIsViscositySubsolution.finsetSup'Theorem 2.8 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $\iota$ be a type, $s \in \operatorname{Finset}(\iota)$, $u \colon \iota \to \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $s\text{ is nonempty}$ hs
  • $\forall i \in s,\ u(i)\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ hu

Then PLaplacian.IsViscositySubsolution p Ω f fun y => s.sup' hs fun i => u i y.

PLaplacian.IsViscositySubsolution.finsetSup'Plaplacian/FinSup.lean, lines 57–79
/-- The maximum over a nonempty finite family of subsolutions. -/
theorem IsViscositySubsolution.finsetSup' {p : ℝ} {Ω : Set (EuclSpace d)}
    {f : EuclSpace d → ℝ} {ι : Type*} (s : Finset ι) (hs : s.Nonempty)
    (u : ι → EuclSpace d → ℝ)
    (hu : ∀ i ∈ s, IsViscositySubsolution p Ω f (u i)) :
    IsViscositySubsolution p Ω f (fun y => s.sup' hs (fun i => u i y)) := by
  induction hs using Finset.Nonempty.cons_induction with
  | singleton i =>
      have h := hu i (by simp)
      have heq : (fun y => ({i} : Finset ι).sup'
          (Finset.singleton_nonempty i) (fun j => u j y)) = u i := by
        funext y
        simp
      rw [heq]
      exact h
  | cons i t hit ht ih =>
      have hui : IsViscositySubsolution p Ω f (u i) := hu i (by simp)
      have hut : ∀ j ∈ t, IsViscositySubsolution p Ω f (u j) := by
        intro j hj
        exact hu j (by simp [hj])
      have hih := ih hut
      simp only [Finset.sup'_cons ht]
      exact IsViscositySubsolution.max hui hih

Plaplacian/FormCompact.lean11 declarations

abbrevobasis
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in $\operatorname{OrthonormalBasis}(\operatorname{Fin}(d), \mathbb{R}, \mathbb{R}^{d})$.

/-- The orthonormal basis. -/
abbrev obasis (d : ℕ) : OrthonormalBasis (Fin d) ℝ (EuclSpace d) :=
  EuclideanSpace.basisFun (Fin d) ℝ
defcoordF
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$.

Its value lies in EuclSpace d →L[ℝ] ℝ.

/-- The coordinate functional. -/
def coordF (i : Fin d) : EuclSpace d →L[ℝ] ℝ :=
  InnerProductSpace.toDual ℝ (EuclSpace d) (obasis d i)
theoremcoordF_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $u \in \mathbb{R}^{d}$.

Then $(\operatorname{coordF}(i))(u) = \operatorname{inner}(\mathbb{R}, (\operatorname{obasis}(d))(i), u)$.

theorem coordF_apply (i : Fin d) (u : EuclSpace d) :
    coordF i u = inner ℝ (obasis d i) u := by
  simp [coordF]
defformOfMatrix
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $A \colon \operatorname{Fin}(d) \to \operatorname{Fin}(d) \to \mathbb{R}$.

Its value lies in $\operatorname{Bilin}(d)$.

/-- **The form of a matrix.** -/
def formOfMatrix (A : Fin d → Fin d → ℝ) : Bilin d :=
  ∑ i, ∑ j, A i j • (coordF i).smulRight (coordF j)
theoremformOfMatrix_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $A \colon \operatorname{Fin}(d) \to \operatorname{Fin}(d) \to \mathbb{R}$, $u, w \in \mathbb{R}^{d}$.

Then ((PLaplacian.formOfMatrix A) u) w = ∑ i, ∑ j, A i j * (inner ℝ ((PLaplacian.obasis d) i) u * inner ℝ ((PLaplacian.obasis d) j) w).

PLaplacian.formOfMatrix_applyPlaplacian/FormCompact.lean, lines 57–61
theorem formOfMatrix_apply (A : Fin d → Fin d → ℝ) (u w : EuclSpace d) :
    (formOfMatrix A u) w
      = ∑ i, ∑ j, A i j * (inner ℝ (obasis d i) u * inner ℝ (obasis d j) w) := by
  simp only [formOfMatrix, sum_apply, smul_apply, ContinuousLinearMap.smulRight_apply,
    coordF_apply, smul_eq_mul]
theoremform_sub_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X, Y \in \operatorname{Bilin}(d)$, $u, w \in \mathbb{R}^{d}$.

Then $((X - Y)(u))(w) = (X(u))(w) - (Y(u))(w)$.

theorem form_sub_apply (X Y : Bilin d) (u w : EuclSpace d) :
    ((X - Y) u) w = (X u) w - (Y u) w := by
  simp only [sub_apply]
theoremform_expand
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $Z \in \operatorname{Bilin}(d)$, $u, w \in \mathbb{R}^{d}$.

Then (Z u) w = ∑ i, ∑ j, inner ℝ ((PLaplacian.obasis d) i) u * inner ℝ ((PLaplacian.obasis d) j) w * (Z ((PLaplacian.obasis d) i)) ((PLaplacian.obasis d) j).

/-- **The basis expansion of a form.** -/
theorem form_expand (Z : Bilin d) (u w : EuclSpace d) :
    (Z u) w = ∑ i, ∑ j, inner ℝ (obasis d i) u * inner ℝ (obasis d j) w
      * (Z (obasis d i)) (obasis d j) := by
  have hu := (obasis d).sum_repr' u
  have hw := (obasis d).sum_repr' w
  calc (Z u) w
      = (Z (∑ i, inner ℝ (obasis d i) u • obasis d i))
          (∑ j, inner ℝ (obasis d j) w • obasis d j) := by rw [hu, hw]
    _ = ∑ i, ∑ j, inner ℝ (obasis d i) u * inner ℝ (obasis d j) w
          * (Z (obasis d i)) (obasis d j) := by
        simp only [map_sum, map_smul, sum_apply, smul_apply, smul_eq_mul,
          Finset.mul_sum, mul_assoc]
        rw [Finset.sum_comm]
        exact Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => by ring
theoremabs_coord_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $u \in \mathbb{R}^{d}$.

Then $\lvert \operatorname{inner}(\mathbb{R}, (\operatorname{obasis}(d))(i), u)\rvert \le \lVert u\rVert$.

/-- A coordinate is bounded by the norm. -/
theorem abs_coord_le (i : Fin d) (u : EuclSpace d) :
    |inner ℝ (obasis d i) u| ≤ ‖u‖ := by
  have h := abs_real_inner_le_norm (obasis d i) u
  rw [(obasis d).orthonormal.1 i, one_mul] at h
  exact h
theoremnorm_form_le_sum
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $Z \in \operatorname{Bilin}(d)$.

Then ‖Z‖ ≤ ∑ i, ∑ j, |(Z ((PLaplacian.obasis d) i)) ((PLaplacian.obasis d) j)|.

/-- **The norm of a form is bounded by the sum of its entries.** -/
theorem norm_form_le_sum (Z : Bilin d) :
    ‖Z‖ ≤ ∑ i, ∑ j, |(Z (obasis d i)) (obasis d j)| := by
  apply ContinuousLinearMap.opNorm_le_bound₂ _ (by positivity)
  intro u w
  have key : |(Z u) w|
      ≤ ∑ i, ∑ j, ‖u‖ * ‖w‖ * |(Z (obasis d i)) (obasis d j)| := by
    rw [form_expand Z u w]
    refine (Finset.abs_sum_le_sum_abs _ _).trans (Finset.sum_le_sum fun i _ => ?_)
    refine (Finset.abs_sum_le_sum_abs _ _).trans (Finset.sum_le_sum fun j _ => ?_)
    rw [abs_mul, abs_mul]
    have h1 := abs_coord_le i u
    have h2 := abs_coord_le j w
    have h12 : |inner ℝ (obasis d i) u| * |inner ℝ (obasis d j) w| ≤ ‖u‖ * ‖w‖ :=
      mul_le_mul h1 h2 (abs_nonneg _) (norm_nonneg _)
    exact mul_le_mul_of_nonneg_right h12 (abs_nonneg _)
  have e : ∑ i, ∑ j, ‖u‖ * ‖w‖ * |(Z (obasis d i)) (obasis d j)|
      = (∑ i, ∑ j, |(Z (obasis d i)) (obasis d j)|) * ‖u‖ * ‖w‖ := by
    rw [Finset.sum_mul, Finset.sum_mul]
    refine Finset.sum_congr rfl fun i _ => ?_
    rw [Finset.sum_mul, Finset.sum_mul]
    refine Finset.sum_congr rfl fun j _ => ?_
    ring
  rw [Real.norm_eq_abs, ← e]
  exact key
theoremformOfMatrix_basis
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $A \colon \operatorname{Fin}(d) \to \operatorname{Fin}(d) \to \mathbb{R}$, $k, l \in \operatorname{Fin}(d)$.

Then $((\operatorname{formOfMatrix}(A))((\operatorname{obasis}(d))(k)))((\operatorname{obasis}(d))(l)) = A(k, l)$.

/-- **The form of a matrix has that matrix.** -/
theorem formOfMatrix_basis (A : Fin d → Fin d → ℝ) (k l : Fin d) :
    (formOfMatrix A (obasis d k)) (obasis d l) = A k l := by
  have ho := orthonormal_iff_ite.1 (obasis d).orthonormal
  rw [formOfMatrix_apply]
  simp only [ho]
  simp
theoremexists_subseq_form
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{Xs} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $L \in \mathbb{R}$.

Assume

  • $\forall n, i, j,\ \lvert ((\operatorname{Xs}(n))((\operatorname{obasis}(d))(i)))((\operatorname{obasis}(d))(j))\rvert \le L$ hL

Then there exists $X, \varphi$ such that:

  • $\operatorname{StrictMono}(\varphi)$
  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{Xs}(\varphi(n)) - X\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$
/-- **A sequence of forms with bounded entries has a subsequence converging in
operator norm.** -/
theorem exists_subseq_form (Xs : ℕ → Bilin d) {L : ℝ}
    (hL : ∀ n i j, |(Xs n (obasis d i)) (obasis d j)| ≤ L) :
    ∃ X : Bilin d, ∃ φ : ℕ → ℕ, StrictMono φ ∧
      Tendsto (fun n => ‖Xs (φ n) - X‖) atTop (𝓝 0) := by
  set R := max L 0 with hR
  have hR0 : 0 ≤ R := le_max_right _ _
  set A : ℕ → Fin d → Fin d → ℝ := fun n i j => (Xs n (obasis d i)) (obasis d j)
    with hAdef
  have hA : ∀ n, A n ∈ closedBall (0 : Fin d → Fin d → ℝ) R := by
    intro n
    rw [mem_closedBall_zero_iff, pi_norm_le_iff_of_nonneg hR0]
    intro i
    rw [pi_norm_le_iff_of_nonneg hR0]
    intro j
    rw [Real.norm_eq_abs]
    exact (hL n i j).trans (le_max_left _ _)
  obtain ⟨Ainf, _, φ, hφ, hlim⟩ := tendsto_subseq_of_bounded isBounded_closedBall hA
  refine ⟨formOfMatrix Ainf, φ, hφ, ?_⟩
  -- each entry converges
  have hentry : ∀ i j, Tendsto (fun n => ‖A (φ n) i j - Ainf i j‖) atTop (𝓝 0) := by
    intro i j
    have hcont : Continuous (fun B : Fin d → Fin d → ℝ => B i j) :=
      (continuous_apply j).comp (continuous_apply i)
    have hc : Tendsto (fun n => A (φ n) i j) atTop (𝓝 (Ainf i j)) :=
      (hcont.tendsto Ainf).comp hlim
    exact tendsto_iff_norm_sub_tendsto_zero.1 hc
  have hsum : Tendsto (fun n => ∑ i, ∑ j, ‖A (φ n) i j - Ainf i j‖) atTop (𝓝 0) := by
    have := tendsto_finsetSum (Finset.univ : Finset (Fin d)) fun i _ =>
      tendsto_finsetSum (Finset.univ : Finset (Fin d)) fun j _ => hentry i j
    simpa using this
  -- the norm is bounded by the entries
  refine squeeze_zero (fun n => ContinuousLinearMap.opNorm_nonneg _) (fun n => ?_) hsum
  refine (norm_form_le_sum _).trans (le_of_eq ?_)
  refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => ?_
  rw [form_sub_apply, formOfMatrix_basis, Real.norm_eq_abs]

Plaplacian/FreqGen.lean4 declarations

theoremnonneg_of_frequently'
Formal statementgenerated from the Lean declaration

Let $\alpha$ be a type, $F \in \operatorname{Filter}(\alpha)$, $I \in \mathbb{R}$, $q \colon \alpha \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, F, \operatorname{nhds}(0))$ hq
  • ∃ᶠ (a : α) in F, q a ≤ I hfreq

Then $0 \le I$.

PLaplacian.nonneg_of_frequently'Plaplacian/FreqGen.lean, lines 65–76
/-- **The limit argument, for an arbitrary filter.** -/
theorem nonneg_of_frequently' {α : Type*} {F : Filter α} {I : ℝ}
    {q : α → ℝ} (hq : Filter.Tendsto q F (nhds 0))
    (hfreq : ∃ᶠ a in F, q a ≤ I) :
    0 ≤ I := by
  by_contra hcon
  push Not at hcon
  have hev : ∀ᶠ a in F, I < q a := hq.eventually (eventually_gt_nhds hcon)
  have hboth := hfreq.and_eventually hev
  rw [Filter.frequently_iff] at hboth
  obtain ⟨a, _, hle, hlt⟩ := hboth Filter.univ_mem
  linarith [hle, hlt]
theoremnonpos_of_frequently'
Formal statementgenerated from the Lean declaration

Let $\alpha$ be a type, $F \in \operatorname{Filter}(\alpha)$, $I \in \mathbb{R}$, $q \colon \alpha \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, F, \operatorname{nhds}(0))$ hq
  • ∃ᶠ (a : α) in F, I ≤ q a hfreq

Then $I \le 0$.

PLaplacian.nonpos_of_frequently'Plaplacian/FreqGen.lean, lines 78–89
/-- And the dual. -/
theorem nonpos_of_frequently' {α : Type*} {F : Filter α} {I : ℝ}
    {q : α → ℝ} (hq : Filter.Tendsto q F (nhds 0))
    (hfreq : ∃ᶠ a in F, I ≤ q a) :
    I ≤ 0 := by
  by_contra hcon
  push Not at hcon
  have hev : ∀ᶠ a in F, q a < I := hq.eventually (eventually_lt_nhds hcon)
  have hboth := hfreq.and_eventually hev
  rw [Filter.frequently_iff] at hboth
  obtain ⟨a, _, hge, hlt⟩ := hboth Filter.univ_mem
  linarith [hge, hlt]
theoremviscF_le_of_frequently_prod
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $Q \colon \mathbb{R} \times \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(Q, \operatorname{relaxFilter}(x_{0}), \operatorname{nhds}(0))$ hQ
  • ∃ᶠ (r : ℝ × EuclSpace d) in PLaplacian.relaxFilter x₀, Q r ≤ PLaplacian.normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) hfreq

Then $\operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0})) \le 0$.

PLaplacian.viscF_le_of_frequently_prodPlaplacian/FreqGen.lean, lines 91–101
/-- **The subsolution inequality, on the product filter.**

The form the chain can supply: the bound is frequent along the filter where
the contact points live, and the quantity may depend on both coordinates. -/
theorem viscF_le_of_frequently_prod {p : ℝ} {φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d} {Q : ℝ × EuclSpace d → ℝ}
    (hQ : Filter.Tendsto Q (relaxFilter x₀) (nhds 0))
    (hfreq : ∃ᶠ r in relaxFilter x₀,
      Q r ≤ normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀)) :
    viscF p (gradient φ x₀) (hess φ x₀) ≤ 0 :=
  viscF_le_of_chain (nonneg_of_frequently' hQ hfreq)
theoremle_viscF_of_frequently_prod
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $Q \colon \mathbb{R} \times \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(Q, \operatorname{relaxFilter}(x_{0}), \operatorname{nhds}(0))$ hQ
  • ∃ᶠ (r : ℝ × EuclSpace d) in PLaplacian.relaxFilter x₀, PLaplacian.normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) ≤ Q r hfreq

Then $0 \le \operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0}))$.

PLaplacian.le_viscF_of_frequently_prodPlaplacian/FreqGen.lean, lines 103–110
/-- The dual, on the product filter. -/
theorem le_viscF_of_frequently_prod {p : ℝ} {φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d} {Q : ℝ × EuclSpace d → ℝ}
    (hQ : Filter.Tendsto Q (relaxFilter x₀) (nhds 0))
    (hfreq : ∃ᶠ r in relaxFilter x₀,
      normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) ≤ Q r) :
    0 ≤ viscF p (gradient φ x₀) (hess φ x₀) :=
  le_viscF_of_chain (nonpos_of_frequently' hQ hfreq)

Plaplacian/FreqProj.lean2 declarations

theoremfrequently_fst_of_prod
Formal statementgenerated from the Lean declaration

Let $\alpha$ be a type, $\beta$ be a type, $f \in \operatorname{Filter}(\alpha)$, $g \in \operatorname{Filter}(\beta)$, $P \colon \alpha \to \mathrm{Prop}$.

Assume

  • $\mathrm{g.NeBot}$
  • ∃ᶠ (q : α × β) in f ×ˢ g, P q.1 h

Then ∃ᶠ (a : α) in f, P a.

PLaplacian.frequently_fst_of_prodPlaplacian/FreqProj.lean, lines 54–65
/-- **Projection of a frequency, for a property of the first coordinate.** -/
theorem frequently_fst_of_prod {α β : Type*} {f : Filter α} {g : Filter β}
    [g.NeBot] {P : α → Prop}
    (h : ∃ᶠ q in f ×ˢ g, P q.1) :
    ∃ᶠ a in f, P a := by
  rw [Filter.frequently_iff] at h ⊢
  intro S hS
  obtain ⟨q, hq, hP⟩ := h (Filter.mem_prod_iff.2
    ⟨S, hS, Set.univ, Filter.univ_mem, by
      intro r hr
      exact hr.1⟩)
  exact ⟨q.1, hq, hP⟩
instancenhds_neBot_euclSpace
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Then (nhds x).NeBot.

PLaplacian.nhds_neBot_euclSpacePlaplacian/FreqProj.lean, lines 67–70
/-- The relaxed filter's second factor is not trivial, which the projection
needs. -/
instance nhds_neBot_euclSpace (x : EuclSpace d) : (nhds x).NeBot :=
  inferInstance

Plaplacian/FreqRate.lean2 declarations

theoremnonneg_of_frequently
Formal statementgenerated from the Lean declaration

Let $I \in \mathbb{R}$, $q \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$ hq
  • ∃ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), q ε ≤ I hfreq

Then $0 \le I$.

PLaplacian.nonneg_of_frequentlyPlaplacian/FreqRate.lean, lines 61–76
/-- **The limit argument with a frequent bound.** -/
theorem nonneg_of_frequently {I : ℝ} {q : ℝ → ℝ}
    (hq : Filter.Tendsto q (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0))
    (hfreq : ∃ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), q ε ≤ I) :
    0 ≤ I := by
  by_contra hcon
  push Not at hcon
  -- q is eventually above I, since it tends to zero and I < 0
  have hev : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), I < q ε := by
    have h := hq.eventually (eventually_gt_nhds hcon)
    exact h
  -- that contradicts the frequency
  have hboth := hfreq.and_eventually hev
  rw [Filter.frequently_iff] at hboth
  obtain ⟨ε, _, hle, hlt⟩ := hboth Filter.univ_mem
  linarith [hle, hlt]
theoremnonpos_of_frequently
Formal statementgenerated from the Lean declaration

Let $I \in \mathbb{R}$, $q \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$ hq
  • ∃ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), I ≤ q ε hfreq

Then $I \le 0$.

PLaplacian.nonpos_of_frequentlyPlaplacian/FreqRate.lean, lines 78–90
/-- And the dual. -/
theorem nonpos_of_frequently {I : ℝ} {q : ℝ → ℝ}
    (hq : Filter.Tendsto q (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0))
    (hfreq : ∃ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), I ≤ q ε) :
    I ≤ 0 := by
  by_contra hcon
  push Not at hcon
  have hev : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), q ε < I := by
    exact hq.eventually (eventually_lt_nhds hcon)
  have hboth := hfreq.and_eventually hev
  rw [Filter.frequently_iff] at hboth
  obtain ⟨ε, _, hge, hlt⟩ := hboth Filter.univ_mem
  linarith [hge, hlt]

Plaplacian/GoodSet.lean4 declarations

theoremprox_nondiff_null
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then MeasureTheory.volume {y | ¬DifferentiableAt ℝ (PLaplacian.proxMap f) y} = 0.

PLaplacian.prox_nondiff_nullPlaplacian/GoodSet.lean, lines 39–43
/-- **The non-differentiability set of the proximal map is null.** -/
theorem prox_nondiff_null (hf : ConvexOn ℝ univ f) :
    (volume : Measure (EuclSpace d)) {y | ¬ DifferentiableAt ℝ (proxMap f) y} = 0 := by
  have h := (prox_lipschitz hf).ae_differentiableAt (μ := (volume : Measure (EuclSpace d)))
  exact ae_iff.1 h
theoremprox_singular_image_null
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ _hf

Then MeasureTheory.volume (PLaplacian.proxMap f '' {y | DifferentiableAt ℝ (PLaplacian.proxMap f) y ∧ (fderiv ℝ (PLaplacian.proxMap f) y).det = 0}) = 0.

PLaplacian.prox_singular_image_nullPlaplacian/GoodSet.lean, lines 45–55
/-- **The image of the singular set is null**, by the area formula. -/
theorem prox_singular_image_null (_hf : ConvexOn ℝ univ f) :
    (volume : Measure (EuclSpace d))
      (proxMap f '' {y | DifferentiableAt ℝ (proxMap f) y ∧
        (fderiv ℝ (proxMap f) y).det = 0}) = 0 := by
  apply addHaar_image_eq_zero_of_det_fderivWithin_eq_zero volume
    (f' := fun y => fderiv ℝ (proxMap f) y)
  · intro y hy
    exact hy.1.hasFDerivAt.hasFDerivWithinAt
  · intro y hy
    exact hy.2
theoremprox_bad_null
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then MeasureTheory.volume (PLaplacian.proxMap f '' {y | ¬DifferentiableAt ℝ (PLaplacian.proxMap f) y} ∪ PLaplacian.proxMap f '' {y | DifferentiableAt ℝ (PLaplacian.proxMap f) y ∧ (fderiv ℝ (PLaplacian.proxMap f) y).det = 0}) = 0.

/-- **The bad set is null.** -/
theorem prox_bad_null (hf : ConvexOn ℝ univ f) :
    (volume : Measure (EuclSpace d))
      (proxMap f '' {y | ¬ DifferentiableAt ℝ (proxMap f) y} ∪
        proxMap f '' {y | DifferentiableAt ℝ (proxMap f) y ∧
          (fderiv ℝ (proxMap f) y).det = 0}) = 0 :=
  measure_union_null (lipschitz_image_null (prox_lipschitz hf) (prox_nondiff_null hf))
    (prox_singular_image_null hf)
theoremae_good
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then ∀ᵐ (x : EuclSpace d), ∃ y, PLaplacian.proxMap f y = x ∧ DifferentiableAt ℝ (PLaplacian.proxMap f) y ∧ (fderiv ℝ (PLaplacian.proxMap f) y).det ≠ 0 ∧ PLaplacian.IsSubgrad f x (y - x).

/-- **Almost every point is good**: it is the proximal point of a point where
the proximal map is differentiable with invertible derivative, the difference
being a subgradient. -/
theorem ae_good (hf : ConvexOn ℝ univ f) :
    ∀ᵐ x ∂(volume : Measure (EuclSpace d)), ∃ y,
      proxMap f y = x ∧ DifferentiableAt ℝ (proxMap f) y ∧
      (fderiv ℝ (proxMap f) y).det ≠ 0 ∧ IsSubgrad f x (y - x) := by
  rw [ae_iff]
  refine measure_mono_null (fun x hx => ?_) (prox_bad_null hf)
  simp only [Set.mem_ofPred_eq, not_exists, not_and] at hx
  set y := x + subgradSel f x with hy
  have hJy : proxMap f y = x := prox_surj hf x
  have hsub : IsSubgrad f x (y - x) := by
    have e : y - x = subgradSel f x := by rw [hy]; abel
    rw [e]; exact subgradSel_spec hf x
  by_cases hd : DifferentiableAt ℝ (proxMap f) y
  · right
    refine ⟨y, ⟨hd, ?_⟩, hJy⟩
    by_contra hdet
    exact hx y hJy hd hdet hsub
  · left
    exact ⟨y, hd, hJy⟩

Plaplacian/GradDir.lean4 declarations

defgradDir
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}^{d}$.

/-- The normalized gradient, where it is defined. -/
def gradDir (φ : EuclSpace d → ℝ) (x : EuclSpace d) : EuclSpace d :=
  ‖gradient φ x‖⁻¹ • gradient φ x
theoremnorm_gradDir
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx

Then $\lVert \operatorname{gradDir}(\varphi, x)\rVert = 1$.

/-- It is a unit vector where the gradient does not vanish. -/
theorem norm_gradDir {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (hx : gradient φ x ≠ 0) : ‖gradDir φ x‖ = 1 := by
  unfold gradDir
  rw [norm_smul, norm_inv, norm_norm]
  exact inv_mul_cancel₀ (norm_ne_zero_iff.2 hx)
theoremfderiv_gradDir
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx

Then $(\operatorname{fderiv}(\mathbb{R}, \varphi, x))(\operatorname{gradDir}(\varphi, x)) = \lVert \operatorname{gradient}(\varphi, x)\rVert$.

/-- **The derivative in the gradient direction is the gradient norm.** -/
theorem fderiv_gradDir {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (hx : gradient φ x ≠ 0) :
    fderiv ℝ φ x (gradDir φ x) = ‖gradient φ x‖ := by
  rw [← inner_gradient_left]
  unfold gradDir
  rw [real_inner_smul_right, real_inner_self_eq_norm_sq]
  have hn : ‖gradient φ x‖ ≠ 0 := norm_ne_zero_iff.2 hx
  field_simp
theoremfderiv_eps_gradDir
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx

Then $(\operatorname{fderiv}(\mathbb{R}, \varphi, x))(\varepsilon \cdot \operatorname{gradDir}(\varphi, x)) = \varepsilon \cdot \lVert \operatorname{gradient}(\varphi, x)\rVert$.

PLaplacian.fderiv_eps_gradDirPlaplacian/GradDir.lean, lines 72–76
/-- Scaled: the derivative at the shifted increment. -/
theorem fderiv_eps_gradDir {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (hx : gradient φ x ≠ 0) (ε : ℝ) :
    fderiv ℝ φ x (ε • gradDir φ x) = ε * ‖gradient φ x‖ := by
  rw [ContinuousLinearMap.map_smul, fderiv_gradDir hx, smul_eq_mul]

Plaplacian/GradEst.lean6 declarations

theoremnorm_sq_about'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y \in \mathbb{R}^{d}$.

Then $\lVert y\rVert ^{2} = \lVert x\rVert ^{2} + 2 \cdot \operatorname{inner}(\mathbb{R}, x, y - x) + \lVert y - x\rVert ^{2}$.

/-- The square of `‖y‖` about `x`. -/
theorem norm_sq_about' (x y : EuclSpace d) :
    ‖y‖ ^ 2 = ‖x‖ ^ 2 + 2 * inner ℝ x (y - x) + ‖y - x‖ ^ 2 := by
  have e : y = x + (y - x) := by abel
  conv_lhs => rw [e]
  rw [norm_add_sq_real]
theoremsemiconvex_support
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{SemiconvexWith}(\mathrm{lam}, f)$ h

Then there exists $q$ such that:

  • $\forall y,\ f(x) + \operatorname{inner}(\mathbb{R}, q, y - x) - \mathrm{lam} / 2 \cdot \lVert y - x\rVert ^{2} \le f(y)$
PLaplacian.semiconvex_supportPlaplacian/GradEst.lean, lines 48–57
/-- **A semiconvex function has a lower support at every point.** -/
theorem semiconvex_support {lam : ℝ} {f : EuclSpace d → ℝ} (h : SemiconvexWith lam f)
    (x : EuclSpace d) :
    ∃ q, ∀ y, f x + inner ℝ q (y - x) - lam / 2 * ‖y - x‖ ^ 2 ≤ f y := by
  obtain ⟨P, hP⟩ := subgrad_exists h x
  refine ⟨P - lam • x, fun y => ?_⟩
  have h1 : f x + lam / 2 * ‖x‖ ^ 2 + inner ℝ P (y - x) ≤ f y + lam / 2 * ‖y‖ ^ 2 := hP y
  have hn := congrArg (fun t => lam / 2 * t) (norm_sq_about' x y)
  rw [inner_sub_left, real_inner_smul_left]
  linarith
theoremconvex_subJet_isSubgrad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $y, g \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf
  • (g, X) ∈ PLaplacian.SubJet f y hj

Then $\operatorname{IsSubgrad}(f, y, g)$.

PLaplacian.convex_subJet_isSubgradPlaplacian/GradEst.lean, lines 59–107
/-- **A subjet of a convex function is a subgradient.** -/
theorem convex_subJet_isSubgrad {f : EuclSpace d → ℝ} (hf : ConvexOn ℝ univ f)
    {y g : EuclSpace d} {X : Bilin d} (hj : (g, X) ∈ SubJet f y) : IsSubgrad f y g := by
  intro z
  by_contra hcon
  push Not at hcon
  set v := z - y with hv
  set D := f y + inner ℝ g v - f z with hD
  have hD0 : 0 < D := by linarith
  set C := 1 / 2 * ‖X‖ * ‖v‖ ^ 2 + ‖v‖ ^ 2 with hC
  have hC0 : 0 ≤ C := by positivity
  have hj' : ∀ η > 0, ∀ᶠ w in 𝓝 y, f y + inner ℝ g (w - y)
      + 1 / 2 * (X (w - y)) (w - y) - η * ‖w - y‖ ^ 2 ≤ f w := hj
  obtain ⟨ε, hε, hball⟩ := Metric.eventually_nhds_iff.1 (hj' 1 one_pos)
  set t := min (1 / 2) (min (ε / (2 * (‖v‖ + 1))) (D / (2 * (C + 1)))) with ht
  have ht0 : 0 < t := lt_min (by norm_num) (lt_min (by positivity) (by positivity))
  have ht1 : t ≤ 1 / 2 := min_le_left _ _
  have ht2 : t ≤ ε / (2 * (‖v‖ + 1)) := le_trans (min_le_right _ _) (min_le_left _ _)
  have ht3 : t ≤ D / (2 * (C + 1)) := le_trans (min_le_right _ _) (min_le_right _ _)
  -- the point y + t v
  have hdist : dist (y + t • v) y < ε := by
    rw [dist_eq_norm]
    have e : y + t • v - y = t • v := by abel
    rw [e, norm_smul, Real.norm_eq_abs, abs_of_pos ht0]
    have h1 : t * (2 * (‖v‖ + 1)) ≤ ε := (le_div_iff₀ (by positivity)).1 ht2
    nlinarith [norm_nonneg v]
  have h1 := hball hdist
  have e : y + t • v - y = t • v := by abel
  have hXt : (X (t • v)) (t • v) = t * (t * (X v) v) := by
    simp only [map_smul, smul_apply, smul_eq_mul]
  rw [e, real_inner_smul_right, hXt, norm_smul, Real.norm_eq_abs, abs_of_pos ht0] at h1
  -- convexity along the segment
  have hconv := hf.2 (mem_univ y) (mem_univ z) (by linarith : (0 : ℝ) ≤ 1 - t) ht0.le
    (by ring : (1 - t) + t = 1)
  have e2 : (1 - t) • y + t • z = y + t • v := by rw [hv]; module
  rw [e2, smul_eq_mul, smul_eq_mul] at hconv
  -- the bound on the quadratic term
  have hXb : |(X v) v| ≤ ‖X‖ * ‖v‖ ^ 2 := by
    have := X.le_opNorm₂ v v
    rw [Real.norm_eq_abs] at this
    nlinarith
  have hq : t * D ≤ t ^ 2 * C := by
    have k := (abs_le.1 hXb).1
    nlinarith
  have hDC : D ≤ t * C := by nlinarith
  have hfin : t * C < D := by
    have h3 : t * (2 * (C + 1)) ≤ D := (le_div_iff₀ (by positivity)).1 ht3
    nlinarith
  linarith
theoremsemiconvex_subJet_support
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $y, a \in \mathbb{R}^{d}$, $A \in \operatorname{Bilin}(d)$, $z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{SemiconvexWith}(\mathrm{lam}, f)$ h
  • (a, A) ∈ PLaplacian.SubJet f y hj

Then $f(y) + \operatorname{inner}(\mathbb{R}, a, z - y) - \mathrm{lam} / 2 \cdot \lVert z - y\rVert ^{2} \le f(z)$.

PLaplacian.semiconvex_subJet_supportPlaplacian/GradEst.lean, lines 109–132
/-- **A subjet of a semiconvex function is a global lower support.** -/
theorem semiconvex_subJet_support {lam : ℝ} {f : EuclSpace d → ℝ} (h : SemiconvexWith lam f)
    {y a : EuclSpace d} {A : Bilin d} (hj : (a, A) ∈ SubJet f y) :
    ∀ z, f y + inner ℝ a (z - y) - lam / 2 * ‖z - y‖ ^ 2 ≤ f z := by
  have hj' : ∀ η > 0, ∀ᶠ w in 𝓝 y, f y + inner ℝ a (w - y)
      + 1 / 2 * (A (w - y)) (w - y) - η * ‖w - y‖ ^ 2 ≤ f w := hj
  have hΦ : (a + lam • y, A + lam • idForm d)
      ∈ SubJet (fun z => f z + lam / 2 * ‖z‖ ^ 2) y := by
    intro η hη
    filter_upwards [hj' η hη] with w hw
    change f y + lam / 2 * ‖y‖ ^ 2 + inner ℝ (a + lam • y) (w - y)
      + 1 / 2 * ((A + lam • idForm d) (w - y)) (w - y) - η * ‖w - y‖ ^ 2
      ≤ f w + lam / 2 * ‖w‖ ^ 2
    rw [inner_add_left, real_inner_smul_left, add_apply, add_apply, smul_apply, smul_apply,
      smul_eq_mul, idForm_apply]
    have hn := congrArg (fun t => lam / 2 * t) (norm_sq_about' y w)
    linarith
  have hsg := convex_subJet_isSubgrad h hΦ
  intro z
  have h1 : f y + lam / 2 * ‖y‖ ^ 2 + inner ℝ (a + lam • y) (z - y)
      ≤ f z + lam / 2 * ‖z‖ ^ 2 := hsg z
  rw [inner_add_left, real_inner_smul_left] at h1
  have hn := congrArg (fun t => lam / 2 * t) (norm_sq_about' y z)
  linarith
theoremupper_support_of_max
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, W \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $\rho, \mathrm{lam}, \mu \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $0 \le \mu$ hμ
  • $0 < \rho$ hρ
  • PLaplacian.SemiconvexWith μ fun y => -W y hW
  • $\forall y \in B(x, \rho),\ U(y) - W(y) \le U(x) - W(x)$ hmax
  • $\forall y,\ U(x) + \operatorname{inner}(\mathbb{R}, q, y - x) - \mathrm{lam} / 2 \cdot \lVert y - x\rVert ^{2} \le U(y)$ hq
  • $y \in B(x, \rho)$ a._@._internal._hyg.0

Then $U(y) \le U(x) + \operatorname{inner}(\mathbb{R}, q, y - x) + \mu / 2 \cdot \lVert y - x\rVert ^{2}$.

PLaplacian.upper_support_of_maxPlaplacian/GradEst.lean, lines 140–190
/-- **The lower support at a maximum is also an upper support.** -/
theorem upper_support_of_max (hlam : 0 ≤ lam) (hμ : 0 ≤ μ) (hρ : 0 < ρ)
    (hW : SemiconvexWith μ (fun y => -W y))
    (hmax : ∀ y ∈ ball x ρ, U y - W y ≤ U x - W x)
    (hq : ∀ y, U x + inner ℝ q (y - x) - lam / 2 * ‖y - x‖ ^ 2 ≤ U y) :
    ∀ y ∈ ball x ρ, U y ≤ U x + inner ℝ q (y - x) + μ / 2 * ‖y - x‖ ^ 2 := by
  obtain ⟨P, hP⟩ := semiconvex_support hW x
  -- the upper support of W at x
  have hWu : ∀ y, W y ≤ W x - inner ℝ P (y - x) + μ / 2 * ‖y - x‖ ^ 2 := fun y => by
    have := hP y
    linarith
  -- it equals q
  have hPq : q + P = 0 := by
    by_contra hv
    set v := q + P with hvdef
    have hvn : 0 < ‖v‖ := norm_pos_iff.2 hv
    set t := min (ρ / (2 * (‖v‖ + 1))) (1 / (lam + μ + 1)) with ht
    have ht0 : 0 < t := lt_min (by positivity) (by positivity)
    have ht1 : t ≤ ρ / (2 * (‖v‖ + 1)) := min_le_left _ _
    have ht2 : t ≤ 1 / (lam + μ + 1) := min_le_right _ _
    have hy : x + t • v ∈ ball x ρ := by
      rw [mem_ball, dist_eq_norm]
      have e : x + t • v - x = t • v := by abel
      rw [e, norm_smul, Real.norm_eq_abs, abs_of_pos ht0]
      have h1 : t * (2 * (‖v‖ + 1)) ≤ ρ := (le_div_iff₀ (by positivity)).1 ht1
      nlinarith [norm_nonneg v]
    have h1 := hq (x + t • v)
    have h2 := hmax (x + t • v) hy
    have h3 := hWu (x + t • v)
    have e : x + t • v - x = t • v := by abel
    rw [e, real_inner_smul_right, norm_smul, Real.norm_eq_abs, abs_of_pos ht0] at h1 h3
    -- ⟪v, t v⟫ ≤ ((λ + μ)/2) t² ‖v‖²
    have key : t * inner ℝ v v ≤ (lam + μ) / 2 * (t * ‖v‖) ^ 2 := by
      rw [hvdef, inner_add_left]
      linarith
    rw [real_inner_self_eq_norm_sq] at key
    have h4 : t * (lam + μ + 1) ≤ 1 := (le_div_iff₀ (by positivity)).1 ht2
    have h5 : (lam + μ) / 2 * (t * ‖v‖) ^ 2 < t * ‖v‖ ^ 2 := by
      have : (lam + μ) * t < 2 := by nlinarith
      have hpos : 0 < t * ‖v‖ ^ 2 := by positivity
      nlinarith
    linarith
  have hPeq : P = -q := by
    have := hPq
    rw [← sub_eq_zero, sub_neg_eq_add, add_comm]
    exact this
  intro y hy
  have h1 := hmax y hy
  have h2 := hWu y
  rw [hPeq, inner_neg_left] at h2
  linarith
theoremgrad_est
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, W \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $\rho, \mathrm{lam}, \mu \in \mathbb{R}$, $y, a \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $0 \le \mu$ hμ
  • $0 < \rho$ hρ
  • PLaplacian.SemiconvexWith μ fun y => -W y hW
  • $\forall y \in B(x, \rho),\ U(y) - W(y) \le U(x) - W(x)$ hmax
  • $\forall y,\ U(x) + \operatorname{inner}(\mathbb{R}, q, y - x) - \mathrm{lam} / 2 \cdot \lVert y - x\rVert ^{2} \le U(y)$ hq
  • $\lVert y - x\rVert < \rho / 3$ hy
  • $\forall z,\ U(y) + \operatorname{inner}(\mathbb{R}, a, z - y) - \mathrm{lam} / 2 \cdot \lVert z - y\rVert ^{2} \le U(z)$ ha

Then $\lVert a - q\rVert \le (\mathrm{lam} + 2 \cdot \mu) \cdot \lVert y - x\rVert$.

/-- **The gradient estimate**: lower supports at nearby points are close to `q`. -/
theorem grad_est (hlam : 0 ≤ lam) (hμ : 0 ≤ μ) (hρ : 0 < ρ)
    (hW : SemiconvexWith μ (fun y => -W y))
    (hmax : ∀ y ∈ ball x ρ, U y - W y ≤ U x - W x)
    (hq : ∀ y, U x + inner ℝ q (y - x) - lam / 2 * ‖y - x‖ ^ 2 ≤ U y)
    {y a : EuclSpace d} (hy : ‖y - x‖ < ρ / 3)
    (ha : ∀ z, U y + inner ℝ a (z - y) - lam / 2 * ‖z - y‖ ^ 2 ≤ U z) :
    ‖a - q‖ ≤ (lam + 2 * μ) * ‖y - x‖ := by
  have hup := upper_support_of_max hlam hμ hρ hW hmax hq
  set s := ‖y - x‖ with hs
  have hs0 : 0 ≤ s := norm_nonneg _
  -- the estimate at every scale t ≥ s
  have hscale : ∀ t, s ≤ t → t < ρ / 3 → ‖a - q‖ ≤ (lam + 2 * μ) * t := by
    intro t hst htρ
    have ht0 : 0 ≤ t := le_trans hs0 hst
    rcases eq_or_ne (a - q) 0 with h0 | h0
    · rw [h0, norm_zero]; positivity
    have hn : 0 < ‖a - q‖ := norm_pos_iff.2 h0
    rcases eq_or_lt_of_le ht0 with ht | ht
    · -- t = 0 forces s = 0
      have hs' : s = 0 := le_antisymm (by rw [← ht] at hst; exact hst) hs0
      -- then y = x, and a, q are both lower supports at x
      have hyx : y = x := by
        have : ‖y - x‖ = 0 := hs'
        exact sub_eq_zero.1 (norm_eq_zero.1 this)
      -- a ≠ q is impossible: the estimate at arbitrarily small scales
      exfalso
      have hsmall : ∀ τ, 0 < τ → τ < ρ / 3 → ‖a - q‖ ≤ (lam + μ) / 2 * τ := by
        intro τ hτ0 hτρ
        set e := ‖a - q‖⁻¹ • (a - q) with he
        have he1 : ‖e‖ = 1 := by
          rw [he, norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ hn.ne']
        have hz : x + τ • e ∈ ball x ρ := by
          rw [mem_ball, dist_eq_norm]
          have e0 : x + τ • e - x = τ • e := by abel
          rw [e0, norm_smul, he1, Real.norm_eq_abs, abs_of_pos hτ0, mul_one]
          linarith
        have h1 := ha (x + τ • e)
        have h2 := hup _ hz
        rw [hyx] at h1
        have e0 : x + τ • e - x = τ • e := by abel
        rw [e0, real_inner_smul_right, norm_smul, he1, Real.norm_eq_abs, abs_of_pos hτ0,
          mul_one] at h1 h2
        have hae : inner ℝ (a - q) e = ‖a - q‖ := by
          rw [he, real_inner_smul_right, real_inner_self_eq_norm_sq]
          field_simp
        have k : τ * inner ℝ (a - q) e ≤ (lam + μ) / 2 * τ ^ 2 := by
          rw [inner_sub_left]
          linarith
        rw [hae] at k
        by_contra hc
        push Not at hc
        have := mul_lt_mul_of_pos_left hc hτ0
        nlinarith
      set τ := min (ρ / 6) (‖a - q‖ / ((lam + μ) / 2 + 1)) with hτ
      have hτ0 : 0 < τ := lt_min (by positivity) (by positivity)
      have hτ1 : τ ≤ ρ / 6 := min_le_left _ _
      have hτ2 : τ ≤ ‖a - q‖ / ((lam + μ) / 2 + 1) := min_le_right _ _
      have h1 := hsmall τ hτ0 (by linarith)
      have h2 : τ * ((lam + μ) / 2 + 1) ≤ ‖a - q‖ := (le_div_iff₀ (by positivity)).1 hτ2
      nlinarith
    · -- t > 0: test in the direction of a - q at scale t
      set e := ‖a - q‖⁻¹ • (a - q) with he
      have he1 : ‖e‖ = 1 := by
        rw [he, norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ hn.ne']
      set z := y + t • e with hzdef
      have hzx : ‖z - x‖ ≤ s + t := by
        have e0 : z - x = (y - x) + t • e := by rw [hzdef]; abel
        rw [e0]
        calc ‖(y - x) + t • e‖ ≤ ‖y - x‖ + ‖t • e‖ := norm_add_le _ _
          _ = s + t := by rw [norm_smul, he1, Real.norm_eq_abs, abs_of_pos ht, mul_one]
      have hz : z ∈ ball x ρ := by
        rw [mem_ball, dist_eq_norm]; linarith
      have h1 := ha z
      have h2 := hup z hz
      have h3 := hq y
      have e1 : z - y = t • e := by rw [hzdef]; abel
      have e2 : z - x = (y - x) + t • e := by rw [hzdef]; abel
      rw [e1, real_inner_smul_right, norm_smul, he1, Real.norm_eq_abs, abs_of_pos ht,
        mul_one] at h1
      rw [e2, inner_add_right, real_inner_smul_right] at h2
      rw [← e2] at h2
      have hzx2 : ‖z - x‖ ^ 2 ≤ (s + t) ^ 2 := by
        have := mul_self_le_mul_self (norm_nonneg _) hzx
        nlinarith
      have hae : inner ℝ (a - q) e = ‖a - q‖ := by
        rw [he, real_inner_smul_right, real_inner_self_eq_norm_sq]
        field_simp
      have k : t * inner ℝ (a - q) e
          ≤ lam / 2 * t ^ 2 + μ / 2 * ‖z - x‖ ^ 2 + lam / 2 * s ^ 2 := by
        rw [inner_sub_left]
        linarith
      rw [hae] at k
      have k2 : lam / 2 * t ^ 2 + μ / 2 * ‖z - x‖ ^ 2 + lam / 2 * s ^ 2
          ≤ (lam + 2 * μ) * t ^ 2 := by
        have a1 : μ / 2 * ‖z - x‖ ^ 2 ≤ μ / 2 * (s + t) ^ 2 :=
          mul_le_mul_of_nonneg_left hzx2 (by positivity)
        have a2 : (s + t) ^ 2 ≤ 4 * t ^ 2 := by nlinarith
        have a3 : s ^ 2 ≤ t ^ 2 := by nlinarith
        nlinarith
      have : t * ‖a - q‖ ≤ t * ((lam + 2 * μ) * t) := by nlinarith
      exact le_of_mul_le_mul_left this ht
  -- let the scale decrease to s
  by_contra hcon
  push Not at hcon
  set gap := ‖a - q‖ - (lam + 2 * μ) * s with hgap
  have hgap0 : 0 < gap := by linarith
  set τ := min ((ρ / 3 - s) / 2) (gap / (2 * (lam + 2 * μ + 1))) with hτ
  have hτ0 : 0 < τ := lt_min (by linarith) (by positivity)
  have hτ1 : τ ≤ (ρ / 3 - s) / 2 := min_le_left _ _
  have hτ2 : τ ≤ gap / (2 * (lam + 2 * μ + 1)) := min_le_right _ _
  have h1 := hscale (s + τ) (by linarith) (by linarith)
  have h2 : τ * (2 * (lam + 2 * μ + 1)) ≤ gap := (le_div_iff₀ (by positivity)).1 hτ2
  nlinarith

Plaplacian/GradInner.lean4 declarations

theoremfderiv_eq_norm_mul_inner
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $w \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx

Then $(\operatorname{fderiv}(\mathbb{R}, \varphi, x))(w) = \lVert \operatorname{gradient}(\varphi, x)\rVert \cdot \operatorname{inner}(\mathbb{R}, \operatorname{gradDir}(\varphi, x), w)$.

PLaplacian.fderiv_eq_norm_mul_innerPlaplacian/GradInner.lean, lines 46–54
/-- **The derivative at an arbitrary increment.** -/
theorem fderiv_eq_norm_mul_inner {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (hx : gradient φ x ≠ 0) (w : EuclSpace d) :
    fderiv ℝ φ x w = ‖gradient φ x‖ * inner ℝ (gradDir φ x) w := by
  rw [← inner_gradient_left]
  unfold gradDir
  rw [real_inner_smul_left]
  have hn : ‖gradient φ x‖ ≠ 0 := norm_ne_zero_iff.2 hx
  field_simp
theoremfderiv_eq_at_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx

Then $(\operatorname{fderiv}(\mathbb{R}, \varphi, x))(\varepsilon \cdot \operatorname{gradDir}(\varphi, x)) = \varepsilon \cdot \lVert \operatorname{gradient}(\varphi, x)\rVert$.

PLaplacian.fderiv_eq_at_shiftPlaplacian/GradInner.lean, lines 56–62
/-- The derivative at the shifted increment, as a special case. -/
theorem fderiv_eq_at_shift {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (hx : gradient φ x ≠ 0) (ε : ℝ) :
    fderiv ℝ φ x (ε • gradDir φ x) = ε * ‖gradient φ x‖ := by
  rw [fderiv_eq_norm_mul_inner hx, real_inner_smul_right,
      real_inner_self_eq_norm_sq, norm_gradDir hx]
  ring
theoreminner_gradDir_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $w \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx

Then $\operatorname{inner}(\mathbb{R}, \operatorname{gradDir}(\varphi, x), w) \le \lVert w\rVert$.

PLaplacian.inner_gradDir_lePlaplacian/GradInner.lean, lines 64–70
/-- Cauchy--Schwarz in the form the localization needs: the inner product with
the unit direction is at most the norm of the increment. -/
theorem inner_gradDir_le {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (hx : gradient φ x ≠ 0) (w : EuclSpace d) :
    inner ℝ (gradDir φ x) w ≤ ‖w‖ := by
  have h := real_inner_le_norm (gradDir φ x) w
  rwa [norm_gradDir hx, one_mul] at h
theoremquadratic_le_of_norm_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $\eta \in \mathbb{R}$, $z \in \mathbb{R}^{d}$.

Assume

  • $\lVert X\rVert \le \eta$ hX

Then $\lvert (X(z))(z)\rvert \le \eta \cdot \lVert z\rVert ^{2}$.

PLaplacian.quadratic_le_of_norm_lePlaplacian/GradInner.lean, lines 73–83
/-- A bilinear form of small norm has small quadratic form. Proved here rather
than in the Taylor files, where it was first needed, so that the deficit chain
has it available. -/
theorem quadratic_le_of_norm_le (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    {η : ℝ} (hX : ‖X‖ ≤ η) (z : EuclSpace d) :
    |X z z| ≤ η * ‖z‖ ^ 2 := by
  have h1 : ‖X z z‖ ≤ ‖X z‖ * ‖z‖ := ContinuousLinearMap.le_opNorm _ _
  have h2 : ‖X z‖ ≤ ‖X‖ * ‖z‖ := ContinuousLinearMap.le_opNorm _ _
  have hz : (0:ℝ) ≤ ‖z‖ := norm_nonneg z
  simp only [Real.norm_eq_abs] at h1
  nlinarith [h1, h2, hz, norm_nonneg (X z)]

Plaplacian/HessCont.lean3 declarations

theoremcontinuous_hess_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $z, w \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then Continuous fun y => ((fderiv ℝ (fderiv ℝ φ) y) z) w.

PLaplacian.continuous_hess_applyPlaplacian/HessCont.lean, lines 57–63
/-- Evaluating the Hessian at a fixed pair is continuous in the base point. -/
theorem continuous_hess_apply {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (z w : EuclSpace d) :
    Continuous (fun y => fderiv ℝ (fderiv ℝ φ) y z w) := by
  have h1 : Continuous (fun y => fderiv ℝ (fderiv ℝ φ) y z) :=
    (continuous_hess hφ).clm_apply continuous_const
  exact h1.clm_apply continuous_const
theoremcontinuous_hess_diff_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then Continuous fun y => ((fderiv ℝ (fderiv ℝ φ) y) z) z - ((fderiv ℝ (fderiv ℝ φ) x) z) z.

PLaplacian.continuous_hess_diff_applyPlaplacian/HessCont.lean, lines 65–70
/-- The scalar Hessian difference is continuous. -/
theorem continuous_hess_diff_apply {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 2 φ) (x z : EuclSpace d) :
    Continuous (fun y => fderiv ℝ (fderiv ℝ φ) y z z
      - fderiv ℝ (fderiv ℝ φ) x z z) :=
  (continuous_hess_apply hφ z z).sub continuous_const
theoremhess_apply_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < \eta$ hη

Then there exists $\delta > 0$ such that:

  • $\forall w,\ \lVert w\rVert < \delta \to \lvert ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x + w))(z))(z) - ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(z))(z)\rvert < \eta$
PLaplacian.hess_apply_boundPlaplacian/HessCont.lean, lines 72–93
/-- **The pointwise uniform bound.** For each fixed `z`, the scalar Hessian
difference is small near the base point. -/
theorem hess_apply_bound {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x z : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∃ δ > 0, ∀ w : EuclSpace d, ‖w‖ < δ →
      |fderiv ℝ (fderiv ℝ φ) (x + w) z z
        - fderiv ℝ (fderiv ℝ φ) x z z| < η := by
  set g : EuclSpace d → ℝ := fun y =>
    |fderiv ℝ (fderiv ℝ φ) y z z - fderiv ℝ (fderiv ℝ φ) x z z| with hgdef
  have hgc : Continuous g := (continuous_hess_diff_apply hφ x z).abs
  have hgx : g x = 0 := by
    rw [hgdef]
    simp
  have hlt : g x < η := by rw [hgx]; exact hη
  have hev : ∀ᶠ y in nhds x, g y < η :=
    hgc.continuousAt.eventually (eventually_lt_nhds hlt)
  obtain ⟨δ, hδ, hb⟩ := Metric.eventually_nhds_iff.1 hev
  refine ⟨δ, hδ, fun w hw => ?_⟩
  have hdist : dist (x + w) x < δ := by
    rw [dist_eq_norm]
    simpa using hw
  exact hb hdist

Plaplacian/HessCont2.lean1 declarations

theoremhess_quad_cont
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $0 < \eta$ hη

Then there exists $\rho > 0$ such that:

  • $\forall y \in B(x_{0}, \rho),\ \forall z,\ ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y))(z))(z) \le ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x_{0}))(z))(z) + \eta \cdot \lVert z\rVert ^{2}$
/-- **The Hessian quadratic form is continuous, uniformly in the direction.** -/
theorem hess_quad_cont {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x₀ : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∃ ρ > 0, ∀ y ∈ ball x₀ ρ, ∀ z : EuclSpace d,
      (fderiv ℝ (fderiv ℝ φ) y z) z
        ≤ (fderiv ℝ (fderiv ℝ φ) x₀ z) z + η * ‖z‖ ^ 2 := by
  have hc : Continuous (fun x => iteratedFDeriv ℝ 2 φ x) :=
    hφ.continuous_iteratedFDeriv (by norm_num)
  obtain ⟨ρ, hρ, hball⟩ := Metric.continuousAt_iff.1 hc.continuousAt η hη
  refine ⟨ρ, hρ, fun y hy z => ?_⟩
  have hd : ‖iteratedFDeriv ℝ 2 φ y - iteratedFDeriv ℝ 2 φ x₀‖ < η := by
    rw [← dist_eq_norm]; exact hball (mem_ball.1 hy)
  -- the curried quadratic form as the flat map on (z, z)
  have hA : ∀ w : EuclSpace d, iteratedFDeriv ℝ 2 φ w ![z, z]
      = (fderiv ℝ (fderiv ℝ φ) w z) z := by
    intro w; rw [iteratedFDeriv_two_apply]; simp
  have hdiff : (fderiv ℝ (fderiv ℝ φ) y z) z - (fderiv ℝ (fderiv ℝ φ) x₀ z) z
      = (iteratedFDeriv ℝ 2 φ y - iteratedFDeriv ℝ 2 φ x₀) ![z, z] := by
    rw [sub_apply, hA, hA]
  -- the product of the norms of (z, z)
  have hprod : ∏ i : Fin 2, ‖(![z, z] : Fin 2 → EuclSpace d) i‖ = ‖z‖ ^ 2 := by
    simp [Fin.prod_univ_two, sq]
  -- the flat map's value is bounded by its norm
  have h1 : (iteratedFDeriv ℝ 2 φ y - iteratedFDeriv ℝ 2 φ x₀) ![z, z]
      ≤ ‖iteratedFDeriv ℝ 2 φ y - iteratedFDeriv ℝ 2 φ x₀‖ * ‖z‖ ^ 2 := by
    have := (iteratedFDeriv ℝ 2 φ y - iteratedFDeriv ℝ 2 φ x₀).le_opNorm ![z, z]
    rw [hprod, Real.norm_eq_abs] at this
    exact le_trans (le_abs_self _) this
  have h2 : ‖iteratedFDeriv ℝ 2 φ y - iteratedFDeriv ℝ 2 φ x₀‖ * ‖z‖ ^ 2
      ≤ η * ‖z‖ ^ 2 := mul_le_mul_of_nonneg_right hd.le (sq_nonneg _)
  linarith [hdiff, h1, h2]

Plaplacian/HessNorm.lean1 declarations

theoremnorm_hess_eq_flat
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Then $\lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)\rVert = \lVert \operatorname{iteratedFDeriv}(\mathbb{R}, 2, \varphi, y)\rVert$.

PLaplacian.norm_hess_eq_flatPlaplacian/HessNorm.lean, lines 50–55
/-- **The norms agree.** The curried Hessian and the flat second derivative
have the same norm, through the first iterated derivative of the derivative. -/
theorem norm_hess_eq_flat {φ : EuclSpace d → ℝ} (y : EuclSpace d) :
    ‖fderiv ℝ (fderiv ℝ φ) y‖ = ‖iteratedFDeriv ℝ 2 φ y‖ := by
  rw [← norm_iteratedFDeriv_one (f := fderiv ℝ φ)]
  exact norm_iteratedFDeriv_fderiv (n := 1)

Plaplacian/IndexSelection.lean10 declarations

defdeficitSup
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u, w \colon \mathbb{R}^{d} \to \mathbb{R}$.

Its value lies in $\mathbb{R}$.

/-- The supremum of the deficit `u - w` over a set. -/
def deficitSup (S : Set (EuclSpace d)) (u : EuclSpace d → ℝ)
    (w : EuclSpace d → ℝ) : ℝ :=
  sSup ((fun x => u x - w x) '' S)
lemmabddAbove_deficit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u, w \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\forall x,\ \lvert u(x) - w(x)\rvert \le C$ hC

Then BddAbove ((fun x => u x - w x) '' S).

lemma bddAbove_deficit {S : Set (EuclSpace d)} {u w : EuclSpace d → ℝ}
    {C : ℝ} (hC : ∀ x, |u x - w x| ≤ C) :
    BddAbove ((fun x => u x - w x) '' S) :=
  ⟨C, by rintro a ⟨x, -, rfl⟩; exact (abs_le.1 (hC x)).2⟩
lemmadeficitSup_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u, w \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $\forall x,\ \lvert u(x) - w(x)\rvert \le C$ hC
  • $\forall x,\ 0 \le u(x) - w(x)$ hnn

Then $0 \le \operatorname{deficitSup}(S, u, w)$.

lemma deficitSup_nonneg {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u w : EuclSpace d → ℝ} {C : ℝ} (hC : ∀ x, |u x - w x| ≤ C)
    (hnn : ∀ x, 0 ≤ u x - w x) :
    0 ≤ deficitSup S u w := by
  obtain ⟨x₀, hx₀⟩ := hS
  exact le_trans (hnn x₀) (le_csSup (bddAbove_deficit hC) ⟨x₀, hx₀, rfl⟩)
lemmadeficitSup_antitone
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $\forall j, x,\ \lvert u(x) - w(j, x)\rvert \le C$ hC
  • $\forall j, x,\ w(j, x) \le w(j + 1, x)$ hmono

Then Antitone fun j => PLaplacian.deficitSup S u (w j).

PLaplacian.deficitSup_antitonePlaplacian/IndexSelection.lean, lines 62–72
/-- The deficit sups decrease, because the approximants increase. -/
lemma deficitSup_antitone {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u : EuclSpace d → ℝ} {w : ℕ → EuclSpace d → ℝ} {C : ℝ}
    (hC : ∀ j x, |u x - w j x| ≤ C)
    (hmono : ∀ j x, w j x ≤ w (j + 1) x) :
    Antitone (fun j => deficitSup S u (w j)) := by
  refine antitone_nat_of_succ_le fun j => ?_
  refine csSup_le (hS.image _) ?_
  rintro a ⟨x, hx, rfl⟩
  have h1 : u x - w (j + 1) x ≤ u x - w j x := by linarith [hmono j x]
  exact le_trans h1 (le_csSup (bddAbove_deficit (hC j)) ⟨x, hx, rfl⟩)
theoremexists_deficitLimit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $\forall j, x,\ \lvert u(x) - w(j, x)\rvert \le C$ hC
  • $\forall j, x,\ 0 \le u(x) - w(j, x)$ hnn
  • $\forall j, x,\ w(j, x) \le w(j + 1, x)$ hmono

Then there exists $M$ such that:

  • $\operatorname{Tendsto}(j \mapsto \operatorname{deficitSup}(S, u, w(j)), \mathrm{atTop}, \operatorname{nhds}(M))$
PLaplacian.exists_deficitLimitPlaplacian/IndexSelection.lean, lines 74–85
/-- **The limit `M` exists**, as the limit of a decreasing bounded sequence. -/
theorem exists_deficitLimit {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u : EuclSpace d → ℝ} {w : ℕ → EuclSpace d → ℝ} {C : ℝ}
    (hC : ∀ j x, |u x - w j x| ≤ C)
    (hnn : ∀ j x, 0 ≤ u x - w j x)
    (hmono : ∀ j x, w j x ≤ w (j + 1) x) :
    ∃ M : ℝ, Tendsto (fun j => deficitSup S u (w j)) atTop (nhds M) := by
  have hbdd : BddBelow (Set.range fun j => deficitSup S u (w j)) := by
    refine ⟨0, ?_⟩
    rintro a ⟨j, rfl⟩
    exact deficitSup_nonneg hS (hC j) (hnn j)
  exact ⟨_, tendsto_atTop_ciInf (deficitSup_antitone hS hC hmono) hbdd⟩
theoremexists_index_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $M, \delta \in \mathbb{R}$.

Assume

  • $0 < \delta$ hδ
  • $\operatorname{Tendsto}(j \mapsto \operatorname{deficitSup}(S, u, w(j)), \mathrm{atTop}, \operatorname{nhds}(M))$ hlim

Then there exists $k$ such that:

  • $\operatorname{deficitSup}(S, u, w(k)) \le M + \delta$
/-- LPS's (2.6). -/
theorem exists_index_le {S : Set (EuclSpace d)} {u : EuclSpace d → ℝ}
    {w : ℕ → EuclSpace d → ℝ} {M δ : ℝ} (hδ : 0 < δ)
    (hlim : Tendsto (fun j => deficitSup S u (w j)) atTop (nhds M)) :
    ∃ k, deficitSup S u (w k) ≤ M + δ := by
  have h := hlim.eventually (eventually_le_nhds (by linarith : M < M + δ))
  obtain ⟨k, hk⟩ := h.exists
  exact ⟨k, hk⟩
theoremdeficit_le_of_index
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $M, \delta \in \mathbb{R}$, $k \in \mathbb{N}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\forall x,\ \lvert u(x) - w(k, x)\rvert \le C$ hC
  • $\operatorname{deficitSup}(S, u, w(k)) \le M + \delta$ hk
  • $x \in S$ hx

Then $u(x) - w(k, x) \le M + \delta$.

/-- Pointwise form of (2.6). -/
theorem deficit_le_of_index {S : Set (EuclSpace d)} {u : EuclSpace d → ℝ}
    {w : ℕ → EuclSpace d → ℝ} {M δ : ℝ} {k : ℕ} {C : ℝ}
    (hC : ∀ x, |u x - w k x| ≤ C)
    (hk : deficitSup S u (w k) ≤ M + δ)
    {x : EuclSpace d} (hx : x ∈ S) :
    u x - w k x ≤ M + δ :=
  le_trans (le_csSup (bddAbove_deficit hC) ⟨x, hx, rfl⟩) hk
theoremexists_point_near
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u, w \colon \mathbb{R}^{d} \to \mathbb{R}$, $\delta \in \mathbb{R}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $0 < \delta$ hδ

Then there exists $x_{0} \in S$ such that:

  • $\operatorname{deficitSup}(S, u, w) - \delta \le u(x_{0}) - w(x_{0})$
/-- A point nearly attaining the deficit sup. Boundedness is not needed:
`exists_lt_of_lt_csSup` requires only nonemptiness. -/
theorem exists_point_near {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u : EuclSpace d → ℝ} {w : EuclSpace d → ℝ} {δ : ℝ} (hδ : 0 < δ) :
    ∃ x₀ ∈ S, deficitSup S u w - δ ≤ u x₀ - w x₀ := by
  obtain ⟨a, ha, hlt⟩ := exists_lt_of_lt_csSup (hS.image _)
    (show deficitSup S u w - δ < deficitSup S u w by linarith)
  obtain ⟨x₀, hx₀S, rfl⟩ := ha
  exact ⟨x₀, hx₀S, hlt.le⟩
theoremeventually_deficit_lt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$.

Assume

  • $0 < \delta$ hδ
  • $\operatorname{Tendsto}(j \mapsto w(j, x_{0}), \mathrm{atTop}, \operatorname{nhds}(u(x_{0})))$ hconv

Then ∀ᶠ (j : ℕ) in Filter.atTop, u x₀ - w j x₀ < δ.

PLaplacian.eventually_deficit_ltPlaplacian/IndexSelection.lean, lines 121–128
theorem eventually_deficit_lt {u : EuclSpace d → ℝ}
    {w : ℕ → EuclSpace d → ℝ} {x₀ : EuclSpace d} {δ : ℝ} (hδ : 0 < δ)
    (hconv : Tendsto (fun j => w j x₀) atTop (nhds (u x₀))) :
    ∀ᶠ j in atTop, u x₀ - w j x₀ < δ := by
  have hd : Tendsto (fun j => u x₀ - w j x₀) atTop (nhds 0) := by
    have := hconv.const_sub (u x₀)
    simpa using this
  exact hd.eventually (eventually_lt_nhds hδ)
theoremexists_late_index
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$, $k \in \mathbb{N}$.

Assume

  • $0 < \delta$ hδ
  • $\operatorname{Tendsto}(j \mapsto w(j, x_{0}), \mathrm{atTop}, \operatorname{nhds}(u(x_{0})))$ hconv

Then there exists $ℓ$ such that:

  • $k < ℓ$
  • $u(x_{0}) - w(ℓ + 1, x_{0}) < \delta$
/-- LPS's choice of `ℓ > k`. -/
theorem exists_late_index {u : EuclSpace d → ℝ} {w : ℕ → EuclSpace d → ℝ}
    {x₀ : EuclSpace d} {δ : ℝ} (hδ : 0 < δ)
    (hconv : Tendsto (fun j => w j x₀) atTop (nhds (u x₀))) (k : ℕ) :
    ∃ ℓ, k < ℓ ∧ u x₀ - w (ℓ + 1) x₀ < δ := by
  have h := eventually_deficit_lt hδ hconv
  obtain ⟨N, hN⟩ := (h.and (eventually_gt_atTop k)).exists_forall_of_atTop
  refine ⟨N, (hN N le_rfl).2, ?_⟩
  exact (hN (N + 1) (Nat.le_succ N)).1

Plaplacian/InfAbs.lean1 declarations

theoreminf_err_abs
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon, K, H, g \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε
  • $0 \le K$ hK
  • $\forall z,\ \lVert z\rVert \le \varepsilon \to \lvert \operatorname{taylorErr}(\varphi, x, z)\rvert \le K \cdot \varepsilon ^{3}$ hTerr
  • $\lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \le H$ hH
  • $0 < g$ hg
  • $g \le \lVert \operatorname{gradient}(\varphi, x)\rVert$ hgx

Then |sInf (φ '' Metric.closedBall x ε) - (φ x - ε * ‖gradient φ x‖ + ε ^ 2 / 2 * PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x))| ≤ H * ε * √(2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) + K * ε ^ 3.

/-- **The infimum's two-sided error, uniformly.** -/
theorem inf_err_abs {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε K H g : ℝ}
    (hε : 0 < ε) (hK : 0 ≤ K)
    (hTerr : ∀ z : EuclSpace d, ‖z‖ ≤ ε → |taylorErr φ x z| ≤ K * ε ^ 3)
    (hH : ‖fderiv ℝ (fderiv ℝ φ) x‖ ≤ H) (hg : 0 < g)
    (hgx : g ≤ ‖gradient φ x‖) :
    |sInf (φ '' closedBall x ε)
        - (φ x - ε * ‖gradient φ x‖
            + ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
                (fderiv ℝ (fderiv ℝ φ) x))|
      ≤ H * ε * Real.sqrt (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g))
        + K * ε ^ 3 := by
  -- the negation's hypotheses
  have hψ : ContDiff ℝ 3 (fun y => -φ y) := contDiff_neg' hφ
  have hxψ : gradient (fun y => -φ y) x ≠ 0 := gradient_neg_ne_zero hx
  have hTψ : ∀ z : EuclSpace d, ‖z‖ ≤ ε →
      |taylorErr (fun y => -φ y) x z| ≤ K * ε ^ 3 := by
    intro z hz
    rw [taylorErr_neg, abs_neg]
    exact hTerr z hz
  have hHψ : ‖fderiv ℝ (fderiv ℝ (fun y => -φ y)) x‖ ≤ H := by
    rw [hess_neg, ContinuousLinearMap.opNorm_neg]; exact hH
  have hgψ : g ≤ ‖gradient (fun y => -φ y) x‖ := by
    rw [norm_gradient_neg]; exact hgx
  -- the supremum's error for the negation
  have h := sup_err_abs hψ hxψ hε hK hTψ hHψ hg hgψ
  -- translate back
  have hsup : sSup ((fun y => -φ y) '' closedBall x ε)
      = - sInf (φ '' closedBall x ε) := by
    have := sInf_eq_neg_sSup φ (closedBall x ε)
    linarith [this]
  rw [hsup, norm_gradient_neg, infLaplacianOf_neg] at h
  have heq : - sInf (φ '' closedBall x ε)
      - (-φ x + ε * ‖gradient φ x‖
          + ε ^ 2 / 2 * -infLaplacianOf (gradient φ x)
              (fderiv ℝ (fderiv ℝ φ) x))
      = -(sInf (φ '' closedBall x ε)
          - (φ x - ε * ‖gradient φ x‖
              + ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
                  (fderiv ℝ (fderiv ℝ φ) x))) := by ring
  rw [heq, abs_neg] at h
  exact h

Plaplacian/InfLower.lean1 declarations

theoremsInf_lower_infLap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • φ x - ε * ‖ gradient φ x ‖ + ε ^ 2 / 2 * PLaplacian.infLaplacianOf ( gradient φ x ) ( fderiv ℝ ( fderiv ℝ φ ) x ) - 1 / 2 * ( ‖ fderiv ℝ ( fderiv ℝ fun z => - φ z ) x ‖ * ‖ y - x - ε • PLaplacian.gradDir ( fun z => - φ z ) x ‖ * ( ‖ y - x ‖ + ‖ ε • PLaplacian.gradDir ( fun z => - φ z ) x ‖ ) ) - PLaplacian.taylorErr ( fun z => - φ z ) x ( y - x ) ≤ sInf ( φ '' Metric.closedBall x ε )
PLaplacian.sInf_lower_infLapPlaplacian/InfLower.lean, lines 44–64
/-- **The lower bound on the infimum.** -/
theorem sInf_lower_infLap {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε,
      φ x - ε * ‖gradient φ x‖
          + (ε ^ 2 / 2) * infLaplacianOf (gradient φ x)
              (fderiv ℝ (fderiv ℝ φ) x)
          - (1 / 2) * (‖fderiv ℝ (fderiv ℝ (fun z => -φ z)) x‖
              * ‖(y - x) - ε • gradDir (fun z => -φ z) x‖
              * (‖y - x‖ + ‖ε • gradDir (fun z => -φ z) x‖))
          - taylorErr (fun z => -φ z) x (y - x)
        ≤ sInf (φ '' closedBall x ε) := by
  obtain ⟨y, hyMem, hyLe⟩ := sSup_upper_infLap (contDiff_neg' hφ)
    (gradient_neg_ne_zero hx) hε
  refine ⟨y, hyMem, ?_⟩
  rw [norm_gradient_neg, infLaplacianOf_neg] at hyLe
  have hinf : sInf (φ '' closedBall x ε)
      = - sSup ((fun z => -φ z) '' closedBall x ε) :=
    sInf_eq_neg_sSup φ (closedBall x ε)
  rw [hinf]
  linarith [hyLe]

Plaplacian/InfSide.lean4 declarations

theoremgradient_neg'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\operatorname{gradient}(y \mapsto - \varphi(y), x) = - \operatorname{gradient}(\varphi, x)$.

/-- The gradient of the negation. -/
theorem gradient_neg' (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    gradient (fun y => -φ y) x = - gradient φ x := by
  refine ext_inner_right ℝ fun w => ?_
  rw [inner_gradient_left, inner_neg_left, inner_gradient_left]
  rw [show (fun y => -φ y) = -φ from rfl, fderiv_neg]
  rfl
theoremcontDiff_neg'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then ContDiff ℝ 3 fun y => -φ y.

/-- The negation is `C³` when the function is. -/
theorem contDiff_neg' {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) :
    ContDiff ℝ 3 (fun y => -φ y) := hφ.neg
theoremgradient_neg_ne_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx

Then $\operatorname{gradient}(y \mapsto - \varphi(y), x) \ne 0$.

PLaplacian.gradient_neg_ne_zeroPlaplacian/InfSide.lean, lines 67–71
/-- Its gradient is nonzero where the original's is. -/
theorem gradient_neg_ne_zero {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (hx : gradient φ x ≠ 0) : gradient (fun y => -φ y) x ≠ 0 := by
  rw [gradient_neg' φ x]
  exact neg_ne_zero.2 hx
theoremsInf_eq_neg_sSup
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $S \subseteq \mathbb{R}^{d}$.

Then sInf (φ '' S) = -sSup ((fun y => -φ y) '' S).

PLaplacian.sInf_eq_neg_sSupPlaplacian/InfSide.lean, lines 73–85
/-- The infimum as minus a supremum. -/
theorem sInf_eq_neg_sSup (φ : EuclSpace d → ℝ) (S : Set (EuclSpace d)) :
    sInf (φ '' S) = - sSup ((fun y => -φ y) '' S) := by
  have himg : (fun y => -φ y) '' S = -(φ '' S) := by
    ext a
    simp only [Set.mem_image, Set.mem_neg]
    constructor
    · rintro ⟨y, hy, rfl⟩
      exact ⟨y, hy, by ring⟩
    · rintro ⟨y, hy, hay⟩
      exact ⟨y, hy, by linarith [hay]⟩
  rw [himg, Real.sSup_neg]
  ring

Plaplacian/InfTransport.lean3 declarations

theoremhess_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then fderiv ℝ (fderiv ℝ fun y => -φ y) x = -fderiv ℝ (fderiv ℝ φ) x.

/-- The Hessian of the negation. -/
theorem hess_neg (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    fderiv ℝ (fderiv ℝ (fun y => -φ y)) x
      = - fderiv ℝ (fderiv ℝ φ) x := by
  have h1 : fderiv ℝ (fun y => -φ y) = - fderiv ℝ φ := by
    funext y
    rw [show (fun y => -φ y) = -φ from rfl, fderiv_neg]
    rfl
  rw [h1]
  exact fderiv_neg
theoremnorm_gradient_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\lVert \operatorname{gradient}(y \mapsto - \varphi(y), x)\rVert = \lVert \operatorname{gradient}(\varphi, x)\rVert$.

/-- The gradient norm is unchanged by negation. -/
theorem norm_gradient_neg (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    ‖gradient (fun y => -φ y) x‖ = ‖gradient φ x‖ := by
  rw [gradient_neg', norm_neg]
theoreminfLaplacianOf_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then PLaplacian.infLaplacianOf (gradient (fun y => -φ y) x) (fderiv ℝ (fderiv ℝ fun y => -φ y) x) = -PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x).

PLaplacian.infLaplacianOf_negPlaplacian/InfTransport.lean, lines 62–69
/-- **The infinity Laplacian flips sign under negation.** -/
theorem infLaplacianOf_neg (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    infLaplacianOf (gradient (fun y => -φ y) x)
        (fderiv ℝ (fderiv ℝ (fun y => -φ y)) x)
      = - infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) := by
  unfold infLaplacianOf
  rw [hess_neg, gradient_neg', norm_neg]
  simp

Plaplacian/InfUpper.lean1 declarations

theoremsInf_upper_infLap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then sInf (φ '' Metric.closedBall x ε) ≤ φ x - ε * ‖gradient φ x‖ + ε ^ 2 / 2 * PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) - PLaplacian.taylorErr (fun y => -φ y) x (ε • PLaplacian.gradDir (fun y => -φ y) x).

PLaplacian.sInf_upper_infLapPlaplacian/InfUpper.lean, lines 54–72
/-- **The upper bound on the infimum.** -/
theorem sInf_upper_infLap {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    sInf (φ '' closedBall x ε)
      ≤ φ x - ε * ‖gradient φ x‖
        + (ε ^ 2 / 2) * infLaplacianOf (gradient φ x)
            (fderiv ℝ (fderiv ℝ φ) x)
        - taylorErr (fun y => -φ y) x
            (ε • gradDir (fun y => -φ y) x) := by
  -- the supremum result for the negation
  have hneg := sSup_lower_infLap (contDiff_neg' hφ)
    (gradient_neg_ne_zero hx) hε
  rw [norm_gradient_neg, infLaplacianOf_neg] at hneg
  -- transport
  have hinf : sInf (φ '' closedBall x ε)
      = - sSup ((fun y => -φ y) '' closedBall x ε) :=
    sInf_eq_neg_sSup φ (closedBall x ε)
  rw [hinf]
  linarith [hneg]

Plaplacian/Invariance.lean10 declarations

lemmameasurable_translate
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $v\text{ is Borel measurable}$ hv

Then Measurable fun q => v (q.1 + q.2).

PLaplacian.measurable_translatePlaplacian/Invariance.lean, lines 47–49
lemma measurable_translate {v : EuclSpace d → ℝ} (hv : Measurable v) :
    Measurable (fun q : EuclSpace d × EuclSpace d => v (q.1 + q.2)) :=
  hv.comp (measurable_fst.add measurable_snd)
lemmameasurable_setIntegral_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $v\text{ is Borel measurable}$ hv

Then Measurable fun x => ∫ (y : EuclSpace d) in Metric.ball x ε, v y.

PLaplacian.measurable_setIntegral_ballPlaplacian/Invariance.lean, lines 51–80
/-- The integral over a moving ball is measurable in the centre. -/
lemma measurable_setIntegral_ball {v : EuclSpace d → ℝ} (hv : Measurable v)
    (ε : ℝ) :
    Measurable (fun x : EuclSpace d => ∫ y in ball x ε, v y) := by
  have hrw : (fun x : EuclSpace d => ∫ y in ball x ε, v y)
      = fun x : EuclSpace d =>
          ∫ z : EuclSpace d, (ball (0 : EuclSpace d) ε).indicator
            (fun z => v (x + z)) z := by
    funext x
    rw [setIntegral_ball_translate v x ε,
        ← MeasureTheory.integral_indicator measurableSet_ball]
  rw [hrw]
  have hjoint : StronglyMeasurable
      (Function.uncurry fun (x z : EuclSpace d) =>
        (ball (0 : EuclSpace d) ε).indicator (fun w => v (x + w)) z) := by
    refine Measurable.stronglyMeasurable ?_
    have hset : MeasurableSet
        {q : EuclSpace d × EuclSpace d | q.2 ∈ ball (0 : EuclSpace d) ε} :=
      measurable_snd measurableSet_ball
    have heq : (Function.uncurry fun (x z : EuclSpace d) =>
        (ball (0 : EuclSpace d) ε).indicator (fun w => v (x + w)) z)
        = {q : EuclSpace d × EuclSpace d |
            q.2 ∈ ball (0 : EuclSpace d) ε}.indicator
            (fun q => v (q.1 + q.2)) := by
      funext q
      simp only [Function.uncurry]
      rfl
    rw [heq]
    exact (measurable_translate hv).indicator hset
  exact (StronglyMeasurable.integral_prod_right hjoint).measurable
lemmameasurable_setAverage_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $v\text{ is Borel measurable}$ hv

Then Measurable fun x => ⨍ (y : EuclSpace d) in Metric.ball x ε, v y.

PLaplacian.measurable_setAverage_ballPlaplacian/Invariance.lean, lines 82–94
/-- **The average over a moving ball is measurable.** The normalising factor is
constant in the centre, by `volumeReal_ball_center`. -/
lemma measurable_setAverage_ball {v : EuclSpace d → ℝ} (hv : Measurable v)
    (ε : ℝ) :
    Measurable (fun x : EuclSpace d => ⨍ y in ball x ε, v y) := by
  have hrw : (fun x : EuclSpace d => ⨍ y in ball x ε, v y)
      = fun x : EuclSpace d =>
          (volume.real (ball (0 : EuclSpace d) ε))⁻¹
            * ∫ y in ball x ε, v y := by
    funext x
    rw [MeasureTheory.setAverage_eq, volumeReal_ball_center x ε, smul_eq_mul]
  rw [hrw]
  exact (measurable_setIntegral_ball hv ε).const_mul _
lemmasSup_ball_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\forall y,\ \lvert v(y)\rvert \le C$ hC
  • $0 < \varepsilon$ hε

Then sSup (v '' Metric.ball x ε) ≤ C.

lemma sSup_ball_le {v : EuclSpace d → ℝ} {C : ℝ} (hC : ∀ y, |v y| ≤ C)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    sSup (v '' ball x ε) ≤ C := by
  refine csSup_le ⟨v x, x, mem_ball_self hε, rfl⟩ ?_
  rintro a ⟨y, -, rfl⟩
  exact (abs_le.1 (hC y)).2
lemmale_sInf_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\forall y,\ \lvert v(y)\rvert \le C$ hC
  • $0 < \varepsilon$ hε

Then -C ≤ sInf (v '' Metric.ball x ε).

lemma le_sInf_ball {v : EuclSpace d → ℝ} {C : ℝ} (hC : ∀ y, |v y| ≤ C)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    -C ≤ sInf (v '' ball x ε) := by
  refine le_csInf ⟨v x, x, mem_ball_self hε, rfl⟩ ?_
  rintro a ⟨y, -, rfl⟩
  exact (abs_le.1 (hC y)).1
lemmasInf_ball_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\forall y,\ \lvert v(y)\rvert \le C$ hC
  • $0 < \varepsilon$ hε

Then sInf (v '' Metric.ball x ε) ≤ C.

lemma sInf_ball_le {v : EuclSpace d → ℝ} {C : ℝ} (hC : ∀ y, |v y| ≤ C)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    sInf (v '' ball x ε) ≤ C := by
  have hbdd : BddBelow (v '' ball x ε) :=
    ⟨-C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hC y)).1⟩
  exact le_trans (csInf_le hbdd ⟨x, mem_ball_self hε, rfl⟩) (abs_le.1 (hC x)).2
lemmaneg_le_sSup_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\forall y,\ \lvert v(y)\rvert \le C$ hC
  • $0 < \varepsilon$ hε

Then -C ≤ sSup (v '' Metric.ball x ε).

lemma neg_le_sSup_ball {v : EuclSpace d → ℝ} {C : ℝ} (hC : ∀ y, |v y| ≤ C)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    -C ≤ sSup (v '' ball x ε) := by
  have hbdd : BddAbove (v '' ball x ε) :=
    ⟨C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hC y)).2⟩
  exact le_trans (abs_le.1 (hC x)).1 (le_csSup hbdd ⟨x, mem_ball_self hε, rfl⟩)
lemmaabs_setAverage_ball_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ \lvert v(y)\rvert \le C$ hC
  • $0 < \varepsilon$ hε

Then $\lvert \fint_{B(x, \varepsilon)} v(y) \, dy\rvert \le C$.

PLaplacian.abs_setAverage_ball_lePlaplacian/Invariance.lean, lines 126–138
lemma abs_setAverage_ball_le {v : EuclSpace d → ℝ} (hv : BddMeas v) {C : ℝ}
    (hC : ∀ y, |v y| ≤ C) (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    |⨍ y in ball x ε, v y| ≤ C := by
  rw [abs_le]
  refine ⟨?_, ?_⟩
  · have h0 : (⨍ _y in ball x ε, (-C)) = -C := setAverage_const_ball (-C) x hε
    rw [← h0]
    exact setAverage_mono_ball x integrableOn_const (hv.integrableOn_ball x ε)
      (fun y => (abs_le.1 (hC y)).1)
  · have h0 : (⨍ _y in ball x ε, C) = C := setAverage_const_ball C x hε
    rw [← h0]
    exact setAverage_mono_ball x (hv.integrableOn_ball x ε) integrableOn_const
      (fun y => (abs_le.1 (hC y)).2)
theoremabs_tugOfWarOp_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ \lvert v(y)\rvert \le C$ hC

Then $\lvert T_{\varepsilon} v(x)\rvert \le C$.

/-- **The operator preserves any pointwise bound**, by convexity of the
weights. -/
theorem abs_tugOfWarOp_le (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {v : EuclSpace d → ℝ} (hv : BddMeas v) {C : ℝ} (hC : ∀ y, |v y| ≤ C)
    (x : EuclSpace d) :
    |tugOfWarOp p ε v x| ≤ C := by
  have hα : 0 ≤ (p - 2) / (p + (d : ℝ)) := div_nonneg (by linarith) hpd.le
  have hβ : 0 ≤ ((d : ℝ) + 2) / (p + (d : ℝ)) := by positivity
  have hab : (p - 2) / (p + (d : ℝ)) + ((d : ℝ) + 2) / (p + (d : ℝ)) = 1 :=
    alpha_add_beta p hpd
  have hs1 := sSup_ball_le hC x hε
  have hs2 := neg_le_sSup_ball hC x hε
  have hi1 := sInf_ball_le hC x hε
  have hi2 := le_sInf_ball hC x hε
  have ha := abs_le.1 (abs_setAverage_ball_le hv hC x hε)
  unfold PLaplacian.tugOfWarOp
  rw [abs_le]
  constructor <;> nlinarith [hs1, hs2, hi1, hi2, ha.1, ha.2, hα, hβ, hab]
theoremBddMeas.tugOfWarOpTheorem 1.5 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then $T_{\varepsilon} v\text{ is admissible (bounded and Borel measurable)}$.

PLaplacian.BddMeas.tugOfWarOpPlaplacian/Invariance.lean, lines 162–177
/-- **The admissible class is invariant under the step operator.** This is what
makes the monotone iteration of the existence proof well defined. -/
theorem BddMeas.tugOfWarOp (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {v : EuclSpace d → ℝ} (hv : BddMeas v) :
    BddMeas (tugOfWarOp p ε v) := by
  obtain ⟨C, hC⟩ := hv.bound
  refine ⟨?_, ⟨C, fun x => abs_tugOfWarOp_le p ε hp hε hpd hv hC x⟩⟩
  unfold PLaplacian.tugOfWarOp
  have h1 : Measurable (fun x : EuclSpace d => sSup (v '' ball x ε)) :=
    measurable_sSup_ball v hε ⟨C, hC⟩
  have h2 : Measurable (fun x : EuclSpace d => sInf (v '' ball x ε)) :=
    measurable_sInf_ball v hε ⟨C, hC⟩
  have h3 : Measurable (fun x : EuclSpace d => ⨍ y in ball x ε, v y) :=
    measurable_setAverage_ball hv.meas ε
  exact ((h1.add h2).const_mul _).add (h3.const_mul _)

Plaplacian/IshiiFoundations.lean9 declarations

theoremand

No exported statement.

theorem and Jensen's lemma, through sup-convolutions. This file fixes their
defTwiceDiffAt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Its value lies in $\mathrm{Prop}$.

/-- **Twice differentiability in the sense of Peano.** -/
def TwiceDiffAt (f : EuclSpace d → ℝ) (x q : EuclSpace d) (X : Bilin d) : Prop :=
  (q, X) ∈ SuperJet f x ∧ (q, X) ∈ SubJet f x
defSemiconvexWith
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $w \colon \mathbb{R}^{d} \to \mathbb{R}$.

Its value lies in $\mathrm{Prop}$.

/-- **Semiconvexity**, with constant `lam`. -/
def SemiconvexWith (lam : ℝ) (w : EuclSpace d → ℝ) : Prop :=
  ConvexOn ℝ univ (fun x => w x + (lam / 2) * ‖x‖ ^ 2)
defAlexandrovThm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in $\mathrm{Prop}$.

/-- **Alexandrov's theorem**, stated as a proposition. -/
def AlexandrovThm (d : ℕ) : Prop :=
  ∀ f : EuclSpace d → ℝ, ConvexOn ℝ univ f →
    ∀ᵐ x ∂(volume : Measure (EuclSpace d)), ∃ q X, TwiceDiffAt f x q X
defJensenLemma
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in $\mathrm{Prop}$.

/-- **Jensen's lemma**, stated as a proposition. -/
def JensenLemma (d : ℕ) : Prop :=
  ∀ (w : EuclSpace d × EuclSpace d → ℝ) (lam : ℝ),
    ConvexOn ℝ univ (fun z => w z + (lam / 2) * (‖z.1‖ ^ 2 + ‖z.2‖ ^ 2)) →
    ∀ (zh : EuclSpace d × EuclSpace d) (r : ℝ), 0 < r →
      (∀ z ∈ closedBall zh r, z ≠ zh → w z < w zh) →
      ∀ δ > 0, 0 < (volume : Measure (EuclSpace d × EuclSpace d))
        {z ∈ ball zh r | ∃ p₁ p₂ : EuclSpace d, ‖p₁‖ ≤ δ ∧ ‖p₂‖ ≤ δ ∧
          IsLocalMax (fun z' => w z' + inner ℝ p₁ z'.1 + inner ℝ p₂ z'.2) z}
theoremTwiceDiffAt.superJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{TwiceDiffAt}(f, x, q, X)$ h

Then (q, X) ∈ PLaplacian.SuperJet f x.

/-- Peano twice differentiability gives a superjet. -/
theorem TwiceDiffAt.superJet {f : EuclSpace d → ℝ} {x q : EuclSpace d}
    {X : Bilin d} (h : TwiceDiffAt f x q X) : (q, X) ∈ SuperJet f x := h.1
theoremTwiceDiffAt.subJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{TwiceDiffAt}(f, x, q, X)$ h

Then (q, X) ∈ PLaplacian.SubJet f x.

/-- And a subjet. -/
theorem TwiceDiffAt.subJet {f : EuclSpace d → ℝ} {x q : EuclSpace d}
    {X : Bilin d} (h : TwiceDiffAt f x q X) : (q, X) ∈ SubJet f x := h.2
theoremexists_mem_of_pos_of_ae'
Formal statementgenerated from the Lean declaration

Let $\alpha$ be a type, $\mu \in \operatorname{Measure}(\alpha)$, $s \subseteq \alpha$, $P \colon \alpha \to \mathrm{Prop}$.

Assume

  • $\operatorname{MeasurableSpace}(\alpha)$
  • $0 < \mu(s)$ hs
  • ∀ᵐ (x : α) ∂μ, P x hP

Then there exists $x \in s$ such that:

  • $P(x)$
PLaplacian.exists_mem_of_pos_of_ae'Plaplacian/IshiiFoundations.lean, lines 93–104
/-- A set of positive measure meets every set of full measure, for any
measure. -/
theorem exists_mem_of_pos_of_ae' {α : Type*} [MeasurableSpace α]
    {μ : Measure α} {s : Set α} (hs : 0 < μ s) {P : α → Prop}
    (hP : ∀ᵐ x ∂μ, P x) : ∃ x ∈ s, P x := by
  by_contra h
  push Not at h
  have hsub : s ⊆ {x | ¬ P x} := fun x hx => h x hx
  have h0 : μ {x | ¬ P x} = 0 := ae_iff.1 hP
  have := measure_mono_null hsub h0
  rw [this] at hs
  exact lt_irrefl 0 hs
theoremexists_mem_of_pos_of_ae
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s \subseteq \mathbb{R}^{d}$, $P \colon \mathbb{R}^{d} \to \mathrm{Prop}$.

Assume

  • $0 < \lambda(s)$ hs
  • $\forall ᵐ, x,\ P(x)$ hP

Then there exists $x \in s$ such that:

  • $P(x)$
PLaplacian.exists_mem_of_pos_of_aePlaplacian/IshiiFoundations.lean, lines 106–118
/-- A set of positive measure meets every set of full measure. -/
theorem exists_mem_of_pos_of_ae {s : Set (EuclSpace d)}
    (hs : 0 < (volume : Measure (EuclSpace d)) s) {P : EuclSpace d → Prop}
    (hP : ∀ᵐ x ∂(volume : Measure (EuclSpace d)), P x) :
    ∃ x ∈ s, P x := by
  by_contra h
  push Not at h
  have hsub : s ⊆ {x | ¬ P x} := fun x hx => h x hx
  have h0 : (volume : Measure (EuclSpace d)) {x | ¬ P x} = 0 :=
    ae_iff.1 hP
  have := measure_mono_null hsub h0
  rw [this] at hs
  exact lt_irrefl 0 hs

Plaplacian/IterFDeriv.lean2 declarations

theoremcontinuous_norm_iteratedFDeriv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then Continuous fun y => ‖iteratedFDeriv ℝ 3 φ y‖.

PLaplacian.continuous_norm_iteratedFDerivPlaplacian/IterFDeriv.lean, lines 43–48
theorem continuous_norm_iteratedFDeriv {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 3 φ) :
    Continuous (fun y => ‖iteratedFDeriv ℝ 3 φ y‖) := by
  have h : Continuous (fun y => iteratedFDeriv ℝ 3 φ y) :=
    hφ.continuous_iteratedFDeriv (by norm_num)
  exact h.norm
theoremexists_uniform_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $C$ such that:

  • $\forall y \in \overline{B}(x, \varepsilon),\ \lVert \operatorname{iteratedFDeriv}(\mathbb{R}, 3, \varphi, y)\rVert \le C$
PLaplacian.exists_uniform_boundPlaplacian/IterFDeriv.lean, lines 50–58
/-- A uniform bound on the third derivative over a closed ball. -/
theorem exists_uniform_bound {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x : EuclSpace d) (ε : ℝ) :
    ∃ C : ℝ, ∀ y ∈ closedBall x ε, ‖iteratedFDeriv ℝ 3 φ y‖ ≤ C := by
  have hc : Continuous (fun y => iteratedFDeriv ℝ 3 φ y) :=
    hφ.continuous_iteratedFDeriv (m := 3) (by norm_num)
  obtain ⟨C, hC⟩ := (isCompact_closedBall x ε).exists_bound_of_continuousOn
    hc.continuousOn
  exact ⟨C, hC⟩

Plaplacian/Iteration.lean10 declarations

defiterTheorem 1.9 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{N}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The Perron iteration: `u₀` given, `u_{j+1} = T_ε u_j`. -/
def iter (p ε : ℝ) (u₀ : EuclSpace d → ℝ) : ℕ → (EuclSpace d → ℝ)
  | 0 => u₀
  | (j+1) => tugOfWarOp p ε (iter p ε u₀ j)
lemmaiter_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$.

Then $\operatorname{iter}(p, \varepsilon, u_{0}, 0) = u_{0}$.

@[simp] lemma iter_zero (p ε : ℝ) (u₀ : EuclSpace d → ℝ) :
    iter p ε u₀ 0 = u₀ := rfl
lemmaiter_succ
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $j \in \mathbb{N}$.

Then $\operatorname{iter}(p, \varepsilon, u_{0}, j + 1) = T_{\varepsilon} \operatorname{iter}(p, \varepsilon, u_{0}, j)$.

@[simp] lemma iter_succ (p ε : ℝ) (u₀ : EuclSpace d → ℝ) (j : ℕ) :
    iter p ε u₀ (j+1) = tugOfWarOp p ε (iter p ε u₀ j) := rfl
theorembddMeas_iter
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $j \in \mathbb{N}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀

Then $\operatorname{iter}(p, \varepsilon, u_{0}, j)\text{ is admissible (bounded and Borel measurable)}$.

/-- Every iterate is admissible. Uses `Plaplacian.Invariance`. -/
theorem bddMeas_iter (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) (j : ℕ) :
    BddMeas (iter p ε u₀ j) := by
  induction j with
  | zero => exact hu₀
  | succ n ih => exact BddMeas.tugOfWarOp p ε hp hε hpd ih
theoremiter_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $j \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep

Then $\operatorname{iter}(p, \varepsilon, u_{0}, j, x) \le \operatorname{iter}(p, \varepsilon, u_{0}, j + 1, x)$.

/-- From a subsolution the iteration increases, by monotonicity of `T_ε`. -/
theorem iter_mono (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) (j : ℕ) :
    ∀ x, iter p ε u₀ j x ≤ iter p ε u₀ (j+1) x := by
  induction j with
  | zero => exact hstep
  | succ n ih =>
      intro x
      exact tugOfWarOp_monotone p ε hp hd hε
        (bddMeas_iter p ε hp hε hpd hu₀ n)
        (bddMeas_iter p ε hp hε hpd hu₀ (n+1)) ih x
theoremabs_iter_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $j \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC

Then $\lvert \operatorname{iter}(p, \varepsilon, u_{0}, j, x)\rvert \le C$.

/-- The bound on `u₀` propagates to the whole sequence. -/
theorem abs_iter_le (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C) (j : ℕ) :
    ∀ x, |iter p ε u₀ j x| ≤ C := by
  induction j with
  | zero => exact hC
  | succ n ih =>
      intro x
      exact abs_tugOfWarOp_le p ε hp hε hpd
        (bddMeas_iter p ε hp hε hpd hu₀ n) ih x
theoremmonotone_iter
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep

Then Monotone fun j => PLaplacian.iter p ε u₀ j x.

theorem monotone_iter (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) (x : EuclSpace d) :
    Monotone (fun j => iter p ε u₀ j x) :=
  monotone_nat_of_le_succ fun n =>
    iter_mono p ε hp hε hd hpd hu₀ hstep n x
theoremtendsto_iter
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep

Then there exists $L$ such that:

  • $\operatorname{Tendsto}(j \mapsto \operatorname{iter}(p, \varepsilon, u_{0}, j, x), \mathrm{atTop}, \operatorname{nhds}(L))$
/-- **Pointwise convergence** to the pointwise supremum. -/
theorem tendsto_iter (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) (x : EuclSpace d) :
    ∃ L : ℝ, Tendsto (fun j => iter p ε u₀ j x) atTop (nhds L) := by
  have hbdd : BddAbove (Set.range fun j => iter p ε u₀ j x) := by
    refine ⟨C, ?_⟩
    rintro a ⟨j, rfl⟩
    exact (abs_le.1 (abs_iter_le p ε hp hε hpd hu₀ hC j x)).2
  exact ⟨_, tendsto_atTop_ciSup
    (monotone_iter p ε hp hε hd hpd hu₀ hstep x) hbdd⟩
defiterLimit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The limit function, defined as the pointwise supremum. -/
def iterLimit (p ε : ℝ) (u₀ : EuclSpace d → ℝ) (x : EuclSpace d) : ℝ :=
  ⨆ j, iter p ε u₀ j x
theoremtendsto_iterLimit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep

Then $\operatorname{Tendsto}(j \mapsto \operatorname{iter}(p, \varepsilon, u_{0}, j, x), \mathrm{atTop}, \operatorname{nhds}(\operatorname{iterLimit}(p, \varepsilon, u_{0}, x)))$.

PLaplacian.tendsto_iterLimitPlaplacian/Iteration.lean, lines 119–130
theorem tendsto_iterLimit (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) (x : EuclSpace d) :
    Tendsto (fun j => iter p ε u₀ j x) atTop (nhds (iterLimit p ε u₀ x)) := by
  have hbdd : BddAbove (Set.range fun j => iter p ε u₀ j x) := by
    refine ⟨C, ?_⟩
    rintro a ⟨j, rfl⟩
    exact (abs_le.1 (abs_iter_le p ε hp hε hpd hu₀ hC j x)).2
  exact tendsto_atTop_ciSup
    (monotone_iter p ε hp hε hd hpd hu₀ hstep x) hbdd

Plaplacian/JensenEucl.lean3 declarations

theoremnull_image_pi_lipschitzOn
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $g \colon (\operatorname{Fin}(d) \to \mathbb{R}) \to \operatorname{Fin}(d) \to \mathbb{R}$, $K \in \mathrm{NNReal}$, $s \subseteq (\operatorname{Fin}(d) \to \mathbb{R})$.

Assume

  • $\operatorname{LipschitzOnWith}(K, g, s)$ hg
  • $\lambda(s) = 0$ hs

Then MeasureTheory.volume (g '' s) = 0.

PLaplacian.null_image_pi_lipschitzOnPlaplacian/JensenEucl.lean, lines 47–56
/-- On `Fin d → ℝ`, a map Lipschitz on a null set has null image. -/
theorem null_image_pi_lipschitzOn {g : (Fin d → ℝ) → (Fin d → ℝ)} {K : NNReal}
    {s : Set (Fin d → ℝ)} (hg : LipschitzOnWith K g s) (hs : volume s = 0) :
    volume (g '' s) = 0 := by
  have hH := hausdorffMeasure_pi_real (ι := Fin d)
  simp only [Fintype.card_fin] at hH
  rw [← hH] at hs ⊢
  have h := hg.hausdorffMeasure_image_le (d := (d : ℝ)) (Nat.cast_nonneg d)
  rw [hs, mul_zero] at h
  exact le_antisymm h zero_le
theoremlipschitzOn_image_null
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $J \colon \mathbb{R}^{d} \to \mathbb{R}^{d}$, $K \in \mathrm{NNReal}$, $s \subseteq \mathbb{R}^{d}$.

Assume

  • $\operatorname{LipschitzOnWith}(K, J, s)$ hJ
  • $\lambda(s) = 0$ hs

Then MeasureTheory.volume (J '' s) = 0.

PLaplacian.lipschitzOn_image_nullPlaplacian/JensenEucl.lean, lines 58–81
/-- **A map Lipschitz on a null set of `EuclSpace d` has null image.** -/
theorem lipschitzOn_image_null {J : EuclSpace d → EuclSpace d} {K : NNReal}
    {s : Set (EuclSpace d)} (hJ : LipschitzOnWith K J s) (hs : volume s = 0) :
    volume (J '' s) = 0 := by
  set L := EuclideanSpace.equiv (Fin d) ℝ with hLdef
  have hLs : volume (L '' s) = 0 := null_image_cle volume volume L hs
  have hLL : LipschitzWith ‖(L : EuclSpace d →L[ℝ] (Fin d → ℝ))‖₊ L :=
    (L : EuclSpace d →L[ℝ] (Fin d → ℝ)).lipschitzWith
  have hLsy : LipschitzWith ‖(L.symm : (Fin d → ℝ) →L[ℝ] EuclSpace d)‖₊ L.symm :=
    (L.symm : (Fin d → ℝ) →L[ℝ] EuclSpace d).lipschitzWith
  have hmaps : MapsTo L.symm (L '' s) s := by
    rintro _ ⟨x, hx, rfl⟩
    simpa using hx
  have hg := hLL.comp_lipschitzOnWith (hJ.comp hLsy.lipschitzOnWith hmaps)
  have h1 := null_image_pi_lipschitzOn hg hLs
  have himg : (⇑L ∘ (J ∘ ⇑L.symm)) '' (L '' s) = L '' (J '' s) := by
    rw [Set.image_image, Set.image_image]
    congr 1
  rw [himg] at h1
  have h2 := null_image_cle volume volume L.symm h1
  have e : L.symm '' (L '' (J '' s)) = J '' s := by
    rw [Set.image_image]
    simp
  rwa [e] at h2
theoremjensen_positive_measureTheorem 5.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $n \in \mathbb{N}$, $W \colon \mathbb{R}^{n} \to \mathbb{R}$, $C \in \mathbb{R}$, $x_{0}, \mathrm{xs} \in \mathbb{R}^{n}$, $r, \delta \in \mathbb{R}$.

Assume

  • $0 \le C$ hC
  • ConvexOn ℝ Set.univ fun x => W x + C / 2 * ‖x‖ ^ 2 hconv
  • $0 < r$ hr
  • $0 < \delta$ hδ
  • $\mathrm{xs} \in \overline{B}(x_{0}, r)$ hxs
  • $\forall y,\ \lVert y - x_{0}\rVert = r \to W(y) + 2 \cdot \delta \cdot r < W(\mathrm{xs})$ hsphere

Then 0 < MeasureTheory.volume {x | x ∈ Metric.ball x₀ r ∧ ∃ p, ‖p‖ ≤ δ ∧ ∀ y ∈ Metric.closedBall x₀ r, W y + inner ℝ p y ≤ W x + inner ℝ p x}.

PLaplacian.jensen_positive_measurePlaplacian/JensenEucl.lean, lines 85–311
/-- **Jensen's lemma on `ℝⁿ`** [CIL92, Lemma A.3], in the form of the
*Superposition* formalization. -/
theorem jensen_positive_measure {n : ℕ} (W : EuclSpace n → ℝ) (C : ℝ)
    (hC : 0 ≤ C) (hconv : ConvexOn ℝ Set.univ (fun x => W x + C / 2 * ‖x‖ ^ 2))
    (x₀ xs : EuclSpace n) (r δ : ℝ) (hr : 0 < r) (hδ : 0 < δ)
    (hxs : xs ∈ closedBall x₀ r)
    (hsphere : ∀ y, ‖y - x₀‖ = r → W y + 2 * δ * r < W xs) :
    0 < volume {x | x ∈ ball x₀ r ∧ ∃ p : EuclSpace n, ‖p‖ ≤ δ ∧
      ∀ y ∈ closedBall x₀ r, W y + inner ℝ p y ≤ W x + inner ℝ p x} := by
  set K := {x | x ∈ ball x₀ r ∧ ∃ p : EuclSpace n, ‖p‖ ≤ δ ∧
      ∀ y ∈ closedBall x₀ r, W y + inner ℝ p y ≤ W x + inner ℝ p x} with hKdef
  -- Step 1: continuity
  have hΦc : Continuous (fun x => W x + C / 2 * ‖x‖ ^ 2) := hconv.locallyLipschitz.continuous
  have hWc : Continuous W := by
    have := hΦc.sub ((continuous_const.mul (continuous_norm.pow 2)) :
      Continuous (fun x : EuclSpace n => C / 2 * ‖x‖ ^ 2))
    convert this using 1
    funext x
    simp
  -- subgradients of Φ and the map g
  have hsub := fun x => subgrad_exists hconv x
  choose Q hQ0 using hsub
  have hQ : ∀ x z, W x + C / 2 * ‖x‖ ^ 2 + inner ℝ (Q x) (z - x) ≤ W z + C / 2 * ‖z‖ ^ 2 :=
    fun x z => hQ0 x z
  let g : EuclSpace n → EuclSpace n := fun x => C • x - Q x
  -- Step 3: uniqueness of the witness
  have huniq : ∀ x ∈ ball x₀ r, ∀ p : EuclSpace n,
      (∀ y ∈ closedBall x₀ r, W y + inner ℝ p y ≤ W x + inner ℝ p x) → p = g x := by
    intro x hx p hp
    set v := Q x - (C • x - p) with hv
    have hxr : ‖x - x₀‖ < r := by rw [mem_ball, dist_eq_norm] at hx; exact hx
    set t : ℝ := min (1 / (2 * (C + 1))) ((r - ‖x - x₀‖) / (‖v‖ + 1)) with ht
    have ht0 : 0 < t := lt_min (by positivity) (div_pos (by linarith) (by positivity))
    have ht1 : t ≤ 1 / (2 * (C + 1)) := min_le_left _ _
    have ht2 : t ≤ (r - ‖x - x₀‖) / (‖v‖ + 1) := min_le_right _ _
    have hyB : x + t • v ∈ closedBall x₀ r := by
      rw [mem_closedBall, dist_eq_norm]
      have e : x + t • v - x₀ = (x - x₀) + t • v := by abel
      rw [e]
      refine (norm_add_le _ _).trans ?_
      rw [norm_smul, Real.norm_eq_abs, abs_of_pos ht0]
      have h1 : t * (‖v‖ + 1) ≤ r - ‖x - x₀‖ := (le_div_iff₀ (by positivity)).mp ht2
      nlinarith [norm_nonneg v]
    have hup := hp _ hyB
    have hlow := hQ x (x + t • v)
    simp only [add_sub_cancel_left] at hlow
    have hn : ‖x + t • v‖ ^ 2 = ‖x‖ ^ 2 + 2 * (t * inner ℝ x v) + t ^ 2 * ‖v‖ ^ 2 := by
      rw [norm_add_sq_real, norm_smul, real_inner_smul_right, mul_pow, Real.norm_eq_abs, sq_abs]
    rw [hn, real_inner_smul_right] at hlow
    rw [inner_add_right, real_inner_smul_right] at hup
    have hvv : ‖v‖ ^ 2 = inner ℝ (Q x) v - C * inner ℝ x v + inner ℝ p v := by
      rw [← real_inner_self_eq_norm_sq]
      conv_lhs => rw [hv]
      rw [inner_sub_left, inner_sub_left, real_inner_smul_left]
      ring
    have hCt : C * t ≤ 1 / 2 := by
      have : t * (2 * (C + 1)) ≤ 1 := (le_div_iff₀ (by positivity)).mp ht1
      nlinarith
    have htv := congrArg (fun z => t * z) hvv
    have key : t * (‖v‖ ^ 2 - C / 2 * t * ‖v‖ ^ 2) ≤ 0 := by
      have : t * (‖v‖ ^ 2 - C / 2 * t * ‖v‖ ^ 2)
          = t * ‖v‖ ^ 2 - C / 2 * (t ^ 2 * ‖v‖ ^ 2) := by ring
      rw [this]
      nlinarith
    have k2 : ‖v‖ ^ 2 - C / 2 * t * ‖v‖ ^ 2 ≤ 0 := by
      by_contra hk
      push Not at hk
      linarith [mul_pos ht0 hk]
    have k3 := mul_le_mul_of_nonneg_right hCt (sq_nonneg ‖v‖)
    have hv0 : ‖v‖ ^ 2 ≤ 0 := by nlinarith [sq_nonneg ‖v‖]
    have : v = 0 := by
      have := pow_eq_zero_iff (n := 2) (two_ne_zero) |>.mp (le_antisymm hv0 (sq_nonneg _))
      exact norm_eq_zero.mp this
    rw [hv] at this
    simp only [g]
    rw [sub_eq_zero] at this
    rw [this]; abel
  -- Step 2: every small p is attained
  have hattain : ∀ p : EuclSpace n, ‖p‖ ≤ δ → ∃ x ∈ K, g x = p := by
    intro p hp
    have hcont : ContinuousOn (fun x => W x + inner ℝ p x) (closedBall x₀ r) :=
      (hWc.add (continuous_const.inner continuous_id)).continuousOn
    obtain ⟨xp, hxpB, hxpmax⟩ := (isCompact_closedBall x₀ r).exists_isMaxOn
      ⟨x₀, mem_closedBall_self hr.le⟩ hcont
    have hmax : ∀ y ∈ closedBall x₀ r, W y + inner ℝ p y ≤ W xp + inner ℝ p xp :=
      fun y hy => hxpmax hy
    have hxpin : xp ∈ ball x₀ r := by
      rw [mem_ball, dist_eq_norm]
      rw [mem_closedBall, dist_eq_norm] at hxpB
      rcases hxpB.lt_or_eq with h | h
      · exact h
      · exfalso
        have h1 := hsphere xp h
        have h2 := hmax xs hxs
        rw [mem_closedBall, dist_eq_norm] at hxs
        have c1 : |inner ℝ p (xp - x₀)| ≤ δ * r := by
          refine (abs_real_inner_le_norm _ _).trans ?_
          rw [h]; exact mul_le_mul_of_nonneg_right hp hr.le
        have c2 : |inner ℝ p (xs - x₀)| ≤ δ * r :=
          (abs_real_inner_le_norm _ _).trans (mul_le_mul hp hxs (norm_nonneg _) hδ.le)
        rw [inner_sub_right] at c1 c2
        have := (abs_le.mp c1).2
        have := (abs_le.mp c2).1
        linarith
    refine ⟨xp, ⟨hxpin, p, hp, hmax⟩, (huniq xp hxpin p hmax).symm⟩
  -- (U): upper quadratic bound at points of K
  have hU : ∀ x ∈ K, ∀ y ∈ closedBall x₀ r,
      W y + C / 2 * ‖y‖ ^ 2 ≤ W x + C / 2 * ‖x‖ ^ 2 + inner ℝ (Q x) (y - x)
        + C / 2 * ‖y - x‖ ^ 2 := by
    intro x hx y hy
    obtain ⟨hxb, p, -, hwit⟩ := hx
    have hpg := huniq x hxb p hwit
    have h1 := hwit y hy
    rw [hpg] at h1
    have e1 : inner ℝ (g x) y - inner ℝ (g x) x
        = C * inner ℝ x (y - x) - inner ℝ (Q x) (y - x) := by
      rw [← inner_sub_right]
      simp only [g]
      rw [inner_sub_left, real_inner_smul_left]
    have e2 : ‖y‖ ^ 2 = ‖x‖ ^ 2 + 2 * inner ℝ x (y - x) + ‖y - x‖ ^ 2 := by
      have : y = x + (y - x) := by abel
      conv_lhs => rw [this]
      rw [norm_add_sq_real]
    rw [e2]
    nlinarith
  -- Step 4: local Lipschitz bound for g on K
  have hlip4 : ∀ θ > 0, ∀ x1 ∈ K, ∀ x2 ∈ K, ‖x1 - x₀‖ ≤ r - θ → ‖x2 - x₀‖ ≤ r - θ →
      ‖x1 - x2‖ ≤ θ / 2 → ‖g x1 - g x2‖ ≤ 3 * C * ‖x1 - x2‖ := by
    intro θ hθ x1 hx1 x2 hx2 h1 h2 hd
    set dd := ‖x1 - x2‖ with hddef
    set Δ := Q x2 - Q x1 with hΔ
    have hg : g x1 - g x2 = C • (x1 - x2) + Δ := by
      simp only [g, hΔ, smul_sub]; abel
    have hΔb : ‖Δ‖ ≤ 2 * C * dd := by
      rcases eq_or_ne Δ 0 with h0 | h0
      · rw [h0, norm_zero]; positivity
      have hΔpos : 0 < ‖Δ‖ := norm_pos_iff.mpr h0
      have hdpos : 0 < dd := by
        rcases (norm_nonneg (x1 - x2)).eq_or_lt with h | h
        · exfalso
          have : x1 = x2 := sub_eq_zero.mp (norm_eq_zero.mp h.symm)
          exact h0 (by rw [hΔ, this, sub_self])
        · exact h
      set t := 2 * dd with htdef
      set u := (t / ‖Δ‖) • Δ with hu
      have hun : ‖u‖ = t := by
        rw [hu, norm_smul, Real.norm_eq_abs, abs_of_nonneg (by positivity)]
        field_simp
      have hyB : x1 + u ∈ closedBall x₀ r := by
        rw [mem_closedBall, dist_eq_norm]
        have : x1 + u - x₀ = (x1 - x₀) + u := by abel
        rw [this]
        refine (norm_add_le _ _).trans ?_
        rw [hun]; linarith
      have L2 := hQ x2 (x1 + u)
      have U1 := hU x1 hx1 (x1 + u) hyB
      have L1 := hQ x1 x2
      have e1 : x1 + u - x2 = u + (x1 - x2) := by abel
      have e2 : x1 + u - x1 = u := by abel
      have e3 : x2 - x1 = -(x1 - x2) := by abel
      rw [e1, inner_add_right] at L2
      rw [e2, hun] at U1
      rw [e3, inner_neg_right] at L1
      have hΔu : inner ℝ (Q x2) u - inner ℝ (Q x1) u = t * ‖Δ‖ := by
        rw [← inner_sub_left, ← hΔ, hu, real_inner_smul_right, real_inner_self_eq_norm_sq]
        field_simp
      have hΔx : -(‖Δ‖ * dd) ≤ inner ℝ (Q x2) (x1 - x2) - inner ℝ (Q x1) (x1 - x2) := by
        rw [← inner_sub_left, ← hΔ]
        exact neg_le_of_abs_le (abs_real_inner_le_norm _ _)
      have key : dd * ‖Δ‖ ≤ dd * (2 * C * dd) := by
        rw [htdef] at hΔu U1
        nlinarith
      exact le_of_mul_le_mul_left key hdpos
    rw [hg]
    refine (norm_add_le _ _).trans ?_
    rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hC]
    linarith
  -- Step 5: conclusion
  rw [pos_iff_ne_zero]
  intro hK0
  obtain ⟨c, hc⟩ := TopologicalSpace.exists_dense_seq (EuclSpace n)
  let T : ℕ → ℕ → Set (EuclSpace n) := fun m j =>
    K ∩ closedBall x₀ (r - 1 / ((m : ℝ) + 1)) ∩ closedBall (c j) (1 / (4 * ((m : ℝ) + 1)))
  have hTK : ∀ m j, T m j ⊆ K := fun m j x hx => hx.1.1
  have hTlip : ∀ m j, LipschitzOnWith (⟨3 * C, by positivity⟩ : NNReal) g (T m j) := by
    intro m j
    refine LipschitzOnWith.of_dist_le_mul fun x1 hx1 x2 hx2 => ?_
    rw [dist_eq_norm, dist_eq_norm]
    change ‖g x1 - g x2‖ ≤ 3 * C * ‖x1 - x2‖
    have hm : (0 : ℝ) < 1 / ((m : ℝ) + 1) := by positivity
    refine hlip4 (1 / ((m : ℝ) + 1)) hm x1 hx1.1.1 x2 hx2.1.1 ?_ ?_ ?_
    · have := hx1.1.2; rwa [mem_closedBall, dist_eq_norm] at this
    · have := hx2.1.2; rwa [mem_closedBall, dist_eq_norm] at this
    · have a1 := hx1.2; have a2 := hx2.2
      rw [mem_closedBall, dist_eq_norm] at a1 a2
      have : x1 - x2 = (x1 - c j) - (x2 - c j) := by abel
      rw [this]
      refine (norm_sub_le _ _).trans ?_
      have e : 1 / ((m : ℝ) + 1) / 2
          = 1 / (4 * ((m : ℝ) + 1)) + 1 / (4 * ((m : ℝ) + 1)) := by
        field_simp; ring
      rw [e]; linarith
  have hcover : K ⊆ ⋃ m, ⋃ j, T m j := by
    intro x hx
    have hxr : dist x x₀ < r := hx.1
    obtain ⟨m, hm⟩ := exists_nat_one_div_lt (sub_pos.mpr hxr)
    have hpos : (0 : ℝ) < 1 / (4 * ((m : ℝ) + 1)) := by positivity
    obtain ⟨j, hj⟩ := hc.exists_dist_lt x hpos
    refine mem_iUnion.mpr ⟨m, mem_iUnion.mpr ⟨j, ⟨hx, ?_⟩, ?_⟩⟩
    · rw [mem_closedBall]; linarith
    · rw [mem_closedBall]; exact hj.le
  have hgK : volume (g '' K) = 0 := by
    have hsubset : g '' K ⊆ ⋃ m, ⋃ j, g '' T m j := by
      rintro _ ⟨x, hx, rfl⟩
      obtain ⟨m, hm⟩ := mem_iUnion.mp (hcover hx)
      obtain ⟨j, hj⟩ := mem_iUnion.mp hm
      exact mem_iUnion.mpr ⟨m, mem_iUnion.mpr ⟨j, x, hj, rfl⟩⟩
    refine measure_mono_null hsubset
      (measure_iUnion_null fun m => measure_iUnion_null fun j => ?_)
    exact lipschitzOn_image_null (hTlip m j) (measure_mono_null (hTK m j) hK0)
  have hball : closedBall (0 : EuclSpace n) δ ⊆ g '' K := by
    intro p hp
    rw [mem_closedBall, dist_zero_right] at hp
    obtain ⟨x, hxK, hgx⟩ := hattain p hp
    exact ⟨x, hxK, hgx⟩
  have := measure_mono_null hball hgK
  exact (Metric.measure_closedBall_pos volume (0 : EuclSpace n) hδ).ne' this

Plaplacian/JensenProduct.lean8 declarations

abbrevΦsplit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in EuclideanSpace ℝ (Fin (d + d)) ≃L[ℝ] EuclSpace d × EuclSpace d.

/-- The Euclidean identification of `ℝ^{d+d}` with the product. -/
abbrev Φsplit (d : ℕ) : EuclideanSpace ℝ (Fin (d + d)) ≃L[ℝ] EuclSpace d × EuclSpace d :=
  EuclideanSpace.finAddEquivProd
theoremΦsplit_norm_sq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \in \operatorname{EuclideanSpace}(\mathbb{R}, \operatorname{Fin}(d + d))$.

Then ‖v‖ ^ 2 = ‖((PLaplacian.Φsplit d) v).1‖ ^ 2 + ‖((PLaplacian.Φsplit d) v).2‖ ^ 2.

theorem Φsplit_norm_sq (v : EuclideanSpace ℝ (Fin (d + d))) :
    ‖v‖ ^ 2 = ‖(Φsplit d v).1‖ ^ 2 + ‖(Φsplit d v).2‖ ^ 2 := by
  simp [EuclideanSpace.norm_sq_eq, Fin.sum_univ_add]
theoremΦsplit_inner
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \in \operatorname{EuclideanSpace}(\mathbb{R}, \operatorname{Fin}(d + d))$.

Then inner ℝ u v = inner ℝ ((PLaplacian.Φsplit d) u).1 ((PLaplacian.Φsplit d) v).1 + inner ℝ ((PLaplacian.Φsplit d) u).2 ((PLaplacian.Φsplit d) v).2.

theorem Φsplit_inner (u v : EuclideanSpace ℝ (Fin (d + d))) :
    inner ℝ u v = inner ℝ (Φsplit d u).1 (Φsplit d v).1
      + inner ℝ (Φsplit d u).2 (Φsplit d v).2 := by
  have h1 := Φsplit_norm_sq (u + v)
  have h2 := Φsplit_norm_sq u
  have h3 := Φsplit_norm_sq v
  rw [map_add, Prod.fst_add, Prod.snd_add, norm_add_sq_real, norm_add_sq_real,
    norm_add_sq_real] at h1
  linarith
theoremΦsplit_fst_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \in \operatorname{EuclideanSpace}(\mathbb{R}, \operatorname{Fin}(d + d))$.

Then ‖((PLaplacian.Φsplit d) v).1‖ ≤ ‖v‖.

theorem Φsplit_fst_le (v : EuclideanSpace ℝ (Fin (d + d))) : ‖(Φsplit d v).1‖ ≤ ‖v‖ := by
  have h := Φsplit_norm_sq v
  exact (pow_le_pow_iff_left₀ (norm_nonneg _) (norm_nonneg _) two_ne_zero).1
    (by nlinarith [sq_nonneg ‖(Φsplit d v).2‖])
theoremΦsplit_snd_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \in \operatorname{EuclideanSpace}(\mathbb{R}, \operatorname{Fin}(d + d))$.

Then ‖((PLaplacian.Φsplit d) v).2‖ ≤ ‖v‖.

theorem Φsplit_snd_le (v : EuclideanSpace ℝ (Fin (d + d))) : ‖(Φsplit d v).2‖ ≤ ‖v‖ := by
  have h := Φsplit_norm_sq v
  exact (pow_le_pow_iff_left₀ (norm_nonneg _) (norm_nonneg _) two_ne_zero).1
    (by nlinarith [sq_nonneg ‖(Φsplit d v).1‖])
theoremΦsplit_norm_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \in \operatorname{EuclideanSpace}(\mathbb{R}, \operatorname{Fin}(d + d))$.

Then $\lVert (\operatorname{Φsplit}(d))(v)\rVert \le \lVert v\rVert$.

theorem Φsplit_norm_le (v : EuclideanSpace ℝ (Fin (d + d))) : ‖Φsplit d v‖ ≤ ‖v‖ :=
  norm_prod_le_iff.2 ⟨Φsplit_fst_le v, Φsplit_snd_le v⟩
theoremjensenTheorem 5.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Then $\operatorname{JensenLemma}(d)$.

/-- **Jensen's lemma on the product.** -/
theorem jensen : JensenLemma d := by
  intro w lam hconv zh r hr hstrict δ hδ
  have hH : (volume : Measure (EuclSpace d × EuclSpace d)).IsAddHaarMeasure := by
    rw [Measure.volume_eq_prod]; infer_instance
  set Φ := Φsplit d with hΦdef
  set C := max lam 0 with hCdef
  have hC0 : 0 ≤ C := le_max_right _ _
  have hCl : 0 ≤ C - lam := sub_nonneg.2 (le_max_left _ _)
  set vh := Φ.symm zh with hvh
  have hΦvh : Φ vh = zh := Φ.apply_symm_apply zh
  set W : EuclideanSpace ℝ (Fin (d + d)) → ℝ := fun v => w (Φ v) with hWdef
  -- semiconvexity of W
  have hconvW : ConvexOn ℝ univ (fun v => W v + C / 2 * ‖v‖ ^ 2) := by
    refine ⟨convex_univ, fun a _ b _ s t hs ht hst => ?_⟩
    have h1 := hconv.2 (mem_univ (Φ a)) (mem_univ (Φ b)) hs ht hst
    simp only [smul_eq_mul] at h1 ⊢
    have hΦ : Φ (s • a + t • b) = s • Φ a + t • Φ b := by
      rw [map_add, map_smul, map_smul]
    have hn1 := Φsplit_norm_sq (s • a + t • b)
    have hna := Φsplit_norm_sq a
    have hnb := Φsplit_norm_sq b
    rw [← hΦdef, hΦ] at hn1
    rw [← hΦdef] at hna hnb
    rw [← hn1, ← hna, ← hnb] at h1
    have hsq := norm_sq_convex_comb hst a b
    have hab : 0 ≤ s * t * ‖a - b‖ ^ 2 := by positivity
    have hconvsq : ‖s • a + t • b‖ ^ 2 ≤ s * ‖a‖ ^ 2 + t * ‖b‖ ^ 2 := by linarith
    have h2 := mul_le_mul_of_nonneg_left hconvsq hCl
    simp only [hWdef]
    rw [hΦ]
    nlinarith
  have hWc : Continuous W := by
    have h1 := convex_continuous hconvW
    have h2 : Continuous (fun v : EuclideanSpace ℝ (Fin (d + d)) => C / 2 * ‖v‖ ^ 2) := by
      fun_prop
    convert h1.sub h2 using 1
    funext v
    simp
  -- the strict maximum on the Euclidean ball
  have hstrE : ∀ v ∈ closedBall vh r, v ≠ vh → W v < W vh := by
    intro v hv hne
    have hz : Φ v ∈ closedBall zh r := by
      rw [mem_closedBall, dist_eq_norm, ← hΦvh, ← map_sub]
      rw [mem_closedBall, dist_eq_norm] at hv
      exact (Φsplit_norm_le _).trans hv
    have hne' : Φ v ≠ zh := by
      intro h; apply hne
      rw [← hΦvh] at h
      exact Φ.injective h
    have := hstrict (Φ v) hz hne'
    simp only [hWdef, hΦvh]
    exact this
  -- the gap on the sphere
  obtain ⟨γ, hγ, hgap⟩ : ∃ γ > 0, ∀ y ∈ sphere vh r, W y ≤ W vh - γ := by
    by_cases hS : (sphere vh r).Nonempty
    · obtain ⟨y₀, hy₀, hmax⟩ := (isCompact_sphere vh r).exists_isMaxOn hS hWc.continuousOn
      have hy₀b : y₀ ∈ closedBall vh r := sphere_subset_closedBall hy₀
      have hy₀ne : y₀ ≠ vh := by
        intro h
        rw [h, mem_sphere, dist_self] at hy₀
        linarith
      have hlt := hstrE y₀ hy₀b hy₀ne
      exact ⟨W vh - W y₀, by linarith, fun y hy => by have h' : W y ≤ W y₀ := hmax hy; linarith⟩
    · refine ⟨1, one_pos, fun y hy => ?_⟩
      exact absurd ⟨y, hy⟩ hS
  set δ' := min δ (γ / (4 * r)) with hδ'def
  have hδ' : 0 < δ' := lt_min hδ (by positivity)
  have hδ'δ : δ' ≤ δ := min_le_left _ _
  have hsphere : ∀ y, ‖y - vh‖ = r → W y + 2 * δ' * r < W vh := by
    intro y hy
    have h1 := hgap y (by rw [mem_sphere, dist_eq_norm]; exact hy)
    have h2 : δ' ≤ γ / (4 * r) := min_le_right _ _
    have h3 : 2 * δ' * r ≤ γ / 2 := by
      have := mul_le_mul_of_nonneg_right h2 (by positivity : (0:ℝ) ≤ 2 * r)
      have e : γ / (4 * r) * (2 * r) = γ / 2 := by field_simp; ring
      nlinarith
    linarith
  -- Jensen's lemma on ℝ^{d+d}
  have hpos := jensen_positive_measure W C hC0 hconvW vh vh r δ' hr hδ'
    (mem_closedBall_self hr.le) hsphere
  set KE := {x | x ∈ ball vh r ∧ ∃ p : EuclSpace (d + d), ‖p‖ ≤ δ' ∧
      ∀ y ∈ closedBall vh r, W y + inner ℝ p y ≤ W x + inner ℝ p x} with hKE
  -- Φ maps it into the product Jensen set
  have hsub : Φ '' KE ⊆ {z ∈ ball zh r | ∃ p₁ p₂ : EuclSpace d, ‖p₁‖ ≤ δ ∧ ‖p₂‖ ≤ δ ∧
      IsLocalMax (fun z' => w z' + inner ℝ p₁ z'.1 + inner ℝ p₂ z'.2) z} := by
    rintro _ ⟨v, ⟨hvb, p, hp, hmaxv⟩, rfl⟩
    refine ⟨?_, (Φ p).1, (Φ p).2, ?_, ?_, ?_⟩
    · rw [mem_ball, dist_eq_norm, ← hΦvh, ← map_sub]
      rw [mem_ball, dist_eq_norm] at hvb
      exact lt_of_le_of_lt (Φsplit_norm_le _) hvb
    · exact ((Φsplit_fst_le p).trans hp).trans hδ'δ
    · exact ((Φsplit_snd_le p).trans hp).trans hδ'δ
    · unfold IsLocalMax IsMaxFilter
      have hnb : Φ.symm ⁻¹' (ball vh r) ∈ 𝓝 (Φ v) := by
        apply Φ.symm.continuous.continuousAt.preimage_mem_nhds
        rw [Φ.symm_apply_apply]
        exact isOpen_ball.mem_nhds hvb
      filter_upwards [hnb] with z' hz'
      have hz'b : Φ.symm z' ∈ closedBall vh r := ball_subset_closedBall hz'
      have h1 := hmaxv (Φ.symm z') hz'b
      simp only [hWdef, Φ.apply_symm_apply] at h1
      rw [Φsplit_inner p (Φ.symm z'), Φsplit_inner p v] at h1
      rw [← hΦdef, Φ.apply_symm_apply] at h1
      change w z' + inner ℝ (Φ p).1 z'.1 + inner ℝ (Φ p).2 z'.2
        ≤ w (Φ v) + inner ℝ (Φ p).1 (Φ v).1 + inner ℝ (Φ p).2 (Φ v).2
      linarith
  -- positive measure transfers
  refine lt_of_lt_of_le ?_ (measure_mono hsub)
  rw [pos_iff_ne_zero]
  intro h0
  have h1 := null_image_cle volume volume Φ.symm h0
  have e : Φ.symm '' (Φ '' KE) = KE := by
    rw [Set.image_image]; simp
  rw [e] at h1
  exact (ne_of_gt hpos) h1
theoremcomparison_strict_fullTheorem 5.4 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $U\text{ is upper semicontinuous}$ hU
  • $V\text{ is lower semicontinuous}$ hV
  • $U\text{ is bounded above}$ hUb
  • $V\text{ is bounded below}$ hVb
  • $0 < c$ hc
  • $U\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = x \mapsto - c\text{ in }\Omega$ hsub
  • $V\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsup
  • $\forall x \in \partial \Omega,\ U(x) \le V(x)$ hbd
  • $x \in \Omega$ a._@._internal._hyg.0

Then $U(x) \le V(x)$.

PLaplacian.comparison_strict_fullPlaplacian/JensenProduct.lean, lines 187–199
/-- **The comparison principle for strict subsolutions** of the normalized
`p`-Laplace equation. -/
theorem comparison_strict_full (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    {Ω : Set (EuclSpace d)} (hΩo : IsOpen Ω) (hΩb : Bornology.IsBounded Ω)
    {U V : EuclSpace d → ℝ}
    (hU : UpperSemicontinuous U) (hV : LowerSemicontinuous V)
    (hUb : BddAbove (range U)) (hVb : BddBelow (range V))
    {c : ℝ} (hc : 0 < c)
    (hsub : IsViscositySubsolution p Ω (fun _ => -c) U)
    (hsup : IsViscositySupersolution p Ω (fun _ => 0) V)
    (hbd : ∀ x ∈ frontier Ω, U x ≤ V x) :
    ∀ x ∈ Ω, U x ≤ V x :=
  comparison_strict_of_J hd hp jensen hΩo hΩb hU hV hUb hVb hc hsub hsup hbd

Plaplacian/JetAlgebra.lean9 declarations

theoremsuperJet_sub_linear
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q, a \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • (q, X) ∈ PLaplacian.SuperJet u x h

Then (q - a, X) ∈ PLaplacian.SuperJet (fun y => u y - inner ℝ a y) x.

PLaplacian.superJet_sub_linearPlaplacian/JetAlgebra.lean, lines 40–52
/-- Subtracting a linear function shifts a superjet's gradient. -/
theorem superJet_sub_linear (h : (q, X) ∈ SuperJet u x) :
    (q - a, X) ∈ SuperJet (fun y => u y - inner ℝ a y) x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change u y ≤ u x + inner ℝ q (y - x) + (1 / 2) * (X (y - x)) (y - x)
    + η * ‖y - x‖ ^ 2 at hy
  change u y - inner ℝ a y ≤ u x - inner ℝ a x + inner ℝ (q - a) (y - x)
    + (1 / 2) * (X (y - x)) (y - x) + η * ‖y - x‖ ^ 2
  have h1 : inner ℝ (q - a) (y - x) = inner ℝ q (y - x) - inner ℝ a (y - x) :=
    inner_sub_left _ _ _
  have h2 : inner ℝ a (y - x) = inner ℝ a y - inner ℝ a x := inner_sub_right _ _ _
  linarith
theoremsuperJet_of_sub_linear
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q, a \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • (q, X) ∈ PLaplacian.SuperJet (fun y => u y - inner ℝ a y) x h

Then (q + a, X) ∈ PLaplacian.SuperJet u x.

PLaplacian.superJet_of_sub_linearPlaplacian/JetAlgebra.lean, lines 54–67
/-- And back: adding the linear function restores it. -/
theorem superJet_of_sub_linear
    (h : (q, X) ∈ SuperJet (fun y => u y - inner ℝ a y) x) :
    (q + a, X) ∈ SuperJet u x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change u y - inner ℝ a y ≤ u x - inner ℝ a x + inner ℝ q (y - x)
    + (1 / 2) * (X (y - x)) (y - x) + η * ‖y - x‖ ^ 2 at hy
  change u y ≤ u x + inner ℝ (q + a) (y - x) + (1 / 2) * (X (y - x)) (y - x)
    + η * ‖y - x‖ ^ 2
  have h1 : inner ℝ (q + a) (y - x) = inner ℝ q (y - x) + inner ℝ a (y - x) :=
    inner_add_left _ _ _
  have h2 : inner ℝ a (y - x) = inner ℝ a y - inner ℝ a x := inner_sub_right _ _ _
  linarith
theoremsubJet_of_sub_linear
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q, a \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • (q, X) ∈ PLaplacian.SubJet (fun y => u y - inner ℝ a y) x h

Then (q + a, X) ∈ PLaplacian.SubJet u x.

PLaplacian.subJet_of_sub_linearPlaplacian/JetAlgebra.lean, lines 69–82
/-- Subtracting a linear function shifts a subjet's gradient back. -/
theorem subJet_of_sub_linear
    (h : (q, X) ∈ SubJet (fun y => u y - inner ℝ a y) x) :
    (q + a, X) ∈ SubJet u x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change u x - inner ℝ a x + inner ℝ q (y - x) + (1 / 2) * (X (y - x)) (y - x)
    - η * ‖y - x‖ ^ 2 ≤ u y - inner ℝ a y at hy
  change u x + inner ℝ (q + a) (y - x) + (1 / 2) * (X (y - x)) (y - x)
    - η * ‖y - x‖ ^ 2 ≤ u y
  have h1 : inner ℝ (q + a) (y - x) = inner ℝ q (y - x) + inner ℝ a (y - x) :=
    inner_add_left _ _ _
  have h2 : inner ℝ a (y - x) = inner ℝ a y - inner ℝ a x := inner_sub_right _ _ _
  linarith
theoremclSuperJet_of_sub_linear
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q, a \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • (q, X) ∈ PLaplacian.ClSuperJet (fun y => u y - inner ℝ a y) x h

Then (q + a, X) ∈ PLaplacian.ClSuperJet u x.

PLaplacian.clSuperJet_of_sub_linearPlaplacian/JetAlgebra.lean, lines 84–94
/-- **Closed superjets shift back.** -/
theorem clSuperJet_of_sub_linear
    (h : (q, X) ∈ ClSuperJet (fun y => u y - inner ℝ a y) x) :
    (q + a, X) ∈ ClSuperJet u x := by
  obtain ⟨xs, qs, Xs, hj, hxs, hus, hqs, hXs⟩ := h
  refine ⟨xs, fun n => qs n + a, Xs, fun n => superJet_of_sub_linear (hj n),
    hxs, ?_, hqs.add tendsto_const_nhds, hXs⟩
  have hlin : Tendsto (fun n => inner ℝ a (xs n)) atTop (𝓝 (inner ℝ a x)) :=
    ((continuous_const.inner continuous_id).tendsto x).comp hxs
  have := hus.add hlin
  simpa using this
theoremclSubJet_of_sub_linear
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q, a \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • (q, X) ∈ PLaplacian.ClSubJet (fun y => u y - inner ℝ a y) x h

Then (q + a, X) ∈ PLaplacian.ClSubJet u x.

PLaplacian.clSubJet_of_sub_linearPlaplacian/JetAlgebra.lean, lines 96–106
/-- **Closed subjets shift back.** -/
theorem clSubJet_of_sub_linear
    (h : (q, X) ∈ ClSubJet (fun y => u y - inner ℝ a y) x) :
    (q + a, X) ∈ ClSubJet u x := by
  obtain ⟨xs, qs, Xs, hj, hxs, hus, hqs, hXs⟩ := h
  refine ⟨xs, fun n => qs n + a, Xs, fun n => subJet_of_sub_linear (hj n),
    hxs, ?_, hqs.add tendsto_const_nhds, hXs⟩
  have hlin : Tendsto (fun n => inner ℝ a (xs n)) atTop (𝓝 (inner ℝ a x)) :=
    ((continuous_const.inner continuous_id).tendsto x).comp hxs
  have := hus.add hlin
  simpa using this
theoremeq_zero_of_eventually_mul_le
Formal statementgenerated from the Lean declaration

Let $a, C \in \mathbb{R}$.

Assume

  • ∀ᶠ (t : ℝ) in nhds 0, t * a ≤ t ^ 2 * C h

Then $a = 0$.

PLaplacian.eq_zero_of_eventually_mul_lePlaplacian/JetAlgebra.lean, lines 110–144
/-- A coefficient bounded near zero by a quadratic vanishes: if
`t a ≤ t² C` for `t` near zero, then `a = 0`. -/
theorem eq_zero_of_eventually_mul_le {a C : ℝ}
    (h : ∀ᶠ t in 𝓝 (0 : ℝ), t * a ≤ t ^ 2 * C) : a = 0 := by
  by_contra ha
  have ha2 : 0 < a ^ 2 := by positivity
  have hcomp : Tendsto (fun s : ℝ => a * s) (𝓝[>] 0) (𝓝 0) := by
    have h0 : Tendsto (fun s : ℝ => a * s) (𝓝 0) (𝓝 (a * 0)) :=
      (continuous_const_mul a).tendsto 0
    rw [mul_zero] at h0
    exact h0.mono_left nhdsWithin_le_nhds
  have h1 : ∀ᶠ s in 𝓝[>] (0 : ℝ), (a * s) * a ≤ (a * s) ^ 2 * C :=
    hcomp.eventually h
  have h2 : ∀ᶠ s in 𝓝[>] (0 : ℝ), s * (|C| + 1) < 1 / 2 := by
    have hc : Tendsto (fun s : ℝ => s * (|C| + 1)) (𝓝[>] 0) (𝓝 0) := by
      have h0 : Tendsto (fun s : ℝ => s * (|C| + 1)) (𝓝 0) (𝓝 (0 * (|C| + 1))) :=
        (continuous_mul_const (|C| + 1)).tendsto 0
      rw [zero_mul] at h0
      exact h0.mono_left nhdsWithin_le_nhds
    exact hc.eventually (gt_mem_nhds (by norm_num))
  have h3 : ∀ᶠ s in 𝓝[>] (0 : ℝ), 0 < s := self_mem_nhdsWithin
  obtain ⟨s, hs1, hs2, hs3⟩ := (h1.and (h2.and h3)).exists
  -- s a² ≤ s² a² C, so a² ≤ s a² C ≤ s a² |C| < a²/2
  have e1 : s * a ^ 2 ≤ s ^ 2 * a ^ 2 * C := by nlinarith
  have e2 : a ^ 2 ≤ s * a ^ 2 * C := by
    have := e1
    have hs : 0 < s := hs3
    nlinarith
  have e3 : s * a ^ 2 * C ≤ s * a ^ 2 * |C| := by
    have : 0 ≤ s * a ^ 2 := by positivity
    exact mul_le_mul_of_nonneg_left (le_abs_self C) this
  have e4 : s * a ^ 2 * |C| ≤ s * (|C| + 1) * a ^ 2 := by
    have : 0 ≤ s * a ^ 2 := by positivity
    nlinarith
  nlinarith
theoremnonpos_of_eventually_sq
Formal statementgenerated from the Lean declaration

Let $b \in \mathbb{R}$.

Assume

  • ∀ η > 0, ∀ᶠ (t : ℝ) in nhds 0, t ^ 2 * b ≤ t ^ 2 * η h

Then $b \le 0$.

PLaplacian.nonpos_of_eventually_sqPlaplacian/JetAlgebra.lean, lines 146–157
/-- A quadratic coefficient bounded by every positive multiple vanishes from
above: if `t² b ≤ t² η` for `t` near zero, for every `η > 0`, then `b ≤ 0`. -/
theorem nonpos_of_eventually_sq {b : ℝ}
    (h : ∀ η > 0, ∀ᶠ t in 𝓝 (0 : ℝ), t ^ 2 * b ≤ t ^ 2 * η) : b ≤ 0 := by
  refine le_of_forall_pos_le_add (fun η hη => ?_)
  have h1 : ∀ᶠ t in 𝓝[≠] (0 : ℝ), t ^ 2 * b ≤ t ^ 2 * η :=
    Eventually.filter_mono nhdsWithin_le_nhds (h η hη)
  have h3 : ∀ᶠ t in 𝓝[≠] (0 : ℝ), t ≠ 0 := self_mem_nhdsWithin
  obtain ⟨t, ht2, ht1⟩ := (h1.and h3).exists
  have hpos : 0 < t ^ 2 := by positivity
  have := le_of_mul_le_mul_left ht2 hpos
  linarith
theoremlocalMax_subJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{IsLocalMax}(f, x)$ hmax
  • (q, X) ∈ PLaplacian.SubJet f x hj

Then all of the following hold:

  • $q = 0$
  • $\operatorname{QuadLE}(X, 0)$
/-- **The second-order condition at a maximum.** -/
theorem localMax_subJet {f : EuclSpace d → ℝ} {x q : EuclSpace d}
    {X : Bilin d} (hmax : IsLocalMax f x) (hj : (q, X) ∈ SubJet f x) :
    q = 0 ∧ QuadLE X 0 := by
  -- along every line through x
  have hline : ∀ v : EuclSpace d, ∀ η > 0, ∀ᶠ t in 𝓝 (0 : ℝ),
      t * inner ℝ q v + t ^ 2 * ((1 / 2) * (X v) v) ≤ t ^ 2 * (η * ‖v‖ ^ 2) := by
    intro v η hη
    have hT : Tendsto (fun t : ℝ => x + t • v) (𝓝 0) (𝓝 x) := by
      have h0 : Continuous (fun t : ℝ => x + t • v) :=
        continuous_const.add (continuous_id.smul continuous_const)
      have := h0.tendsto 0
      simpa using this
    have h1 := hT.eventually (hj η hη)
    have h2 := hT.eventually hmax
    filter_upwards [h1, h2] with t ht1 ht2
    change f x + inner ℝ q (x + t • v - x) + (1 / 2) * (X (x + t • v - x))
      (x + t • v - x) - η * ‖x + t • v - x‖ ^ 2 ≤ f (x + t • v) at ht1
    change f (x + t • v) ≤ f x at ht2
    have hsub : x + t • v - x = t • v := by abel
    rw [hsub] at ht1
    simp only [inner_smul_right, map_smul, smul_eq_mul, norm_smul,
      Real.norm_eq_abs, mul_pow, sq_abs, smul_apply] at ht1
    nlinarith
  -- the gradient vanishes
  have hq : q = 0 := by
    have hzero : inner ℝ q q = 0 := by
      apply eq_zero_of_eventually_mul_le (C := ‖q‖ ^ 2 - (1 / 2) * (X q) q)
      filter_upwards [hline q 1 one_pos] with t ht
      nlinarith
    exact inner_self_eq_zero.1 hzero
  refine ⟨hq, fun v => ?_⟩
  -- the form is nonpositive
  have hb : (1 / 2) * (X v) v - ‖v‖ ^ 2 * 0 ≤ 0 := by
    have : (1 / 2) * (X v) v ≤ 0 := by
      apply nonpos_of_eventually_sq (b := (1 / 2) * (X v) v)
      intro η hη
      have hη' : 0 < η / (‖v‖ ^ 2 + 1) := by positivity
      filter_upwards [hline v (η / (‖v‖ ^ 2 + 1)) hη'] with t ht
      rw [hq, inner_zero_left, mul_zero, zero_add] at ht
      have hle : η / (‖v‖ ^ 2 + 1) * ‖v‖ ^ 2 ≤ η := by
        rw [div_mul_eq_mul_div, div_le_iff₀ (by positivity)]
        nlinarith [sq_nonneg ‖v‖]
      have ht2 : 0 ≤ t ^ 2 := by positivity
      nlinarith [mul_le_mul_of_nonneg_left hle ht2]
    linarith
  simp only [zero_apply]
  linarith
theoremsemiconvex_superJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $w \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $v \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{SemiconvexWith}(\mathrm{lam}, w)$ hw
  • (q, X) ∈ PLaplacian.SuperJet w x hj

Then $- \mathrm{lam} \cdot \lVert v\rVert ^{2} \le (X(v))(v)$.

PLaplacian.semiconvex_superJetPlaplacian/JetAlgebra.lean, lines 208–276
/-- **The semiconvex Hessian bound.** -/
theorem semiconvex_superJet {lam : ℝ} {w : EuclSpace d → ℝ}
    (hw : SemiconvexWith lam w) {x q : EuclSpace d} {X : Bilin d}
    (hj : (q, X) ∈ SuperJet w x) (v : EuclSpace d) :
    -lam * ‖v‖ ^ 2 ≤ (X v) v := by
  -- convexity at the midpoint of x ± t v
  have hmid : ∀ t : ℝ, 2 * w x ≤ w (x + t • v) + w (x - t • v)
      + lam * t ^ 2 * ‖v‖ ^ 2 := by
    intro t
    have hc := hw.2 (mem_univ (x + t • v)) (mem_univ (x - t • v))
      (by norm_num : (0:ℝ) ≤ 1 / 2) (by norm_num : (0:ℝ) ≤ 1 / 2)
      (by norm_num : (1:ℝ) / 2 + 1 / 2 = 1)
    have hm : (1 / 2 : ℝ) • (x + t • v) + (1 / 2 : ℝ) • (x - t • v) = x := by
      module
    rw [hm] at hc
    simp only [smul_eq_mul] at hc
    have hp1 := norm_add_sq_real x (t • v)
    have hp2 := norm_sub_sq_real x (t • v)
    have hn : ‖t • v‖ ^ 2 = t ^ 2 * ‖v‖ ^ 2 := by
      rw [norm_smul, Real.norm_eq_abs, mul_pow, sq_abs]
    have hkey : lam / 2 * ‖x + t • v‖ ^ 2 + lam / 2 * ‖x - t • v‖ ^ 2
        = lam * ‖x‖ ^ 2 + lam * t ^ 2 * ‖v‖ ^ 2 := by
      rw [hp1, hp2, hn]; ring
    linarith [hc, hkey]
  have hT : ∀ s : ℝ, Tendsto (fun t : ℝ => x + (s * t) • v) (𝓝 0) (𝓝 x) := by
    intro s
    have h0 : Continuous (fun t : ℝ => x + (s * t) • v) :=
      continuous_const.add ((continuous_const.mul continuous_id).smul continuous_const)
    have := h0.tendsto 0
    simpa using this
  have key : ∀ η > 0, ∀ᶠ t in 𝓝 (0 : ℝ),
      t ^ 2 * (-(X v) v - lam * ‖v‖ ^ 2) ≤ t ^ 2 * (2 * η * ‖v‖ ^ 2) := by
    intro η hη
    have hp := (hT 1).eventually (hj η hη)
    have hm := (hT (-1)).eventually (hj η hη)
    filter_upwards [hp, hm] with t h1 h2
    change w (x + (1 * t) • v) ≤ w x + inner ℝ q (x + (1 * t) • v - x)
      + (1 / 2) * (X (x + (1 * t) • v - x)) (x + (1 * t) • v - x)
      + η * ‖x + (1 * t) • v - x‖ ^ 2 at h1
    change w (x + (-1 * t) • v) ≤ w x + inner ℝ q (x + (-1 * t) • v - x)
      + (1 / 2) * (X (x + (-1 * t) • v - x)) (x + (-1 * t) • v - x)
      + η * ‖x + (-1 * t) • v - x‖ ^ 2 at h2
    have e1 : x + (1 * t) • v - x = t • v := by simp
    have e2 : x + (-1 * t) • v - x = -(t • v) := by
      rw [neg_one_mul, neg_smul]; abel
    have e3 : x + (-1 * t) • v = x - t • v := by
      rw [neg_one_mul, neg_smul, ← sub_eq_add_neg]
    have e4 : x + (1 * t) • v = x + t • v := by rw [one_mul]
    rw [e1, e4] at h1
    rw [e2, e3] at h2
    simp only [inner_smul_right, inner_neg_right, map_smul, map_neg, smul_eq_mul,
      norm_smul, norm_neg, Real.norm_eq_abs, mul_pow, sq_abs,
      smul_apply, neg_apply] at h1 h2
    have hm' := hmid t
    nlinarith
  have hb : -(X v) v - lam * ‖v‖ ^ 2 ≤ 0 := by
    apply nonpos_of_eventually_sq
    intro η hη
    have hη' : 0 < η / (2 * (‖v‖ ^ 2 + 1)) := by positivity
    filter_upwards [key _ hη'] with t ht
    have hle : 2 * (η / (2 * (‖v‖ ^ 2 + 1))) * ‖v‖ ^ 2 ≤ η := by
      rw [show 2 * (η / (2 * (‖v‖ ^ 2 + 1))) * ‖v‖ ^ 2
          = η * (‖v‖ ^ 2 / (‖v‖ ^ 2 + 1)) by field_simp]
      have : ‖v‖ ^ 2 / (‖v‖ ^ 2 + 1) ≤ 1 := by
        rw [div_le_one (by positivity)]; linarith
      nlinarith
    have ht2 : 0 ≤ t ^ 2 := by positivity
    nlinarith [mul_le_mul_of_nonneg_left hle ht2]
  linarith

Plaplacian/JetBridge.lean14 declarations

defjPoly
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\kappa \in \mathbb{R}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The jet polynomial.** -/
def jPoly (c : ℝ) (x q : EuclSpace d) (X : Bilin d) (κ : ℝ) :
    EuclSpace d → ℝ := fun w =>
  c + inner ℝ q (w - x) + (1 / 2) * (X (w - x)) (w - x) + κ * ‖w - x‖ ^ 2
theoremcontDiff_jPoly
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\kappa \in \mathbb{R}$, $n \in \operatorname{WithTop}(\mathbb{N}, \infty)$.

Then $\operatorname{ContDiff}(\mathbb{R}, n, \operatorname{jPoly}(c, x, q, X, \kappa))$.

theorem contDiff_jPoly (c : ℝ) (x q : EuclSpace d) (X : Bilin d) (κ : ℝ)
    {n : WithTop ℕ∞} : ContDiff ℝ n (jPoly c x q X κ) := by
  unfold jPoly
  have h1 : ContDiff ℝ n (fun w : EuclSpace d => w - x) :=
    contDiff_id.sub contDiff_const
  have hI : ContDiff ℝ n (fun w : EuclSpace d => inner ℝ q (w - x)) :=
    ContDiff.inner ℝ contDiff_const h1
  have hX : ContDiff ℝ n (fun w => (X (w - x)) (w - x)) :=
    (X.contDiff.comp h1).clm_apply h1
  have hN : ContDiff ℝ n (fun w => ‖w - x‖ ^ 2) :=
    (contDiff_norm_sq ℝ).comp h1
  exact ((contDiff_const.add hI).add (contDiff_const.mul hX)).add
    (contDiff_const.mul hN)
theoremjPoly_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\kappa \in \mathbb{R}$.

Then $\operatorname{jPoly}(c, x, q, X, \kappa, x) = c$.

theorem jPoly_self (c : ℝ) (x q : EuclSpace d) (X : Bilin d) (κ : ℝ) :
    jPoly c x q X κ x = c := by
  simp [jPoly]
theoremjPoly_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x, q, z \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\kappa, s \in \mathbb{R}$.

Then $\operatorname{jPoly}(c, x, q, X, \kappa, x + s \cdot z) = c + s \cdot \operatorname{inner}(\mathbb{R}, q, z) + s ^{2} \cdot (1 / 2 \cdot (X(z))(z) + \kappa \cdot \lVert z\rVert ^{2})$.

/-- Along a line through the base point, the jet polynomial is a quadratic in
the parameter. -/
theorem jPoly_line (c : ℝ) (x q z : EuclSpace d) (X : Bilin d) (κ s : ℝ) :
    jPoly c x q X κ (x + s • z)
      = c + s * inner ℝ q z + s ^ 2 * ((1 / 2) * (X z) z + κ * ‖z‖ ^ 2) := by
  unfold jPoly
  have hsub : x + s • z - x = s • z := by abel
  rw [hsub]
  simp only [inner_smul_right, map_smul, smul_eq_mul, norm_smul,
    Real.norm_eq_abs, mul_pow, sq_abs, smul_apply]
  ring
theoremjPoly_line_fun
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x, q, z \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\kappa \in \mathbb{R}$.

Then $(s \mapsto \operatorname{jPoly}(c, x, q, X, \kappa, x + s \cdot z)) = s \mapsto c + s \cdot \operatorname{inner}(\mathbb{R}, q, z) + s ^{2} \cdot (1 / 2 \cdot (X(z))(z) + \kappa \cdot \lVert z\rVert ^{2})$.

theorem jPoly_line_fun (c : ℝ) (x q z : EuclSpace d) (X : Bilin d) (κ : ℝ) :
    (fun s : ℝ => jPoly c x q X κ (x + s • z))
      = fun s => c + s * inner ℝ q z
          + s ^ 2 * ((1 / 2) * (X z) z + κ * ‖z‖ ^ 2) := by
  funext s; exact jPoly_line c x q z X κ s
theoremfderiv_jPoly_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\kappa \in \mathbb{R}$.

Then $\operatorname{fderiv}(\mathbb{R}, \operatorname{jPoly}(c, x, q, X, \kappa), x) = (\operatorname{InnerProductSpace.toDual}(\mathbb{R}, \mathbb{R}^{d}))(q)$.

PLaplacian.fderiv_jPoly_selfPlaplacian/JetBridge.lean, lines 79–85
/-- **Its derivative at the base point is the functional of `q`.** -/
theorem fderiv_jPoly_self (c : ℝ) (x q : EuclSpace d) (X : Bilin d) (κ : ℝ) :
    fderiv ℝ (jPoly c x q X κ) x = InnerProductSpace.toDual ℝ (EuclSpace d) q := by
  ext z
  rw [← line_deriv_one (contDiff_jPoly c x q X κ) x z,
    jPoly_line_fun, deriv_quad_poly]
  simp
theoremgradient_jPoly_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\kappa \in \mathbb{R}$.

Then $\operatorname{gradient}(\operatorname{jPoly}(c, x, q, X, \kappa), x) = q$.

PLaplacian.gradient_jPoly_selfPlaplacian/JetBridge.lean, lines 87–92
/-- **Its gradient at the base point is `q`.** -/
theorem gradient_jPoly_self (c : ℝ) (x q : EuclSpace d) (X : Bilin d)
    (κ : ℝ) : gradient (jPoly c x q X κ) x = q := by
  unfold gradient
  rw [fderiv_jPoly_self]
  exact LinearIsometryEquiv.symm_apply_apply _ _
theoremhess_jPoly_quad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $x, q, z \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\kappa \in \mathbb{R}$.

Then $((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \operatorname{jPoly}(c, x, q, X, \kappa)), x))(z))(z) = (X(z))(z) + 2 \cdot \kappa \cdot \lVert z\rVert ^{2}$.

/-- **Its Hessian quadratic form is `X` plus `2κ ‖z‖²`.** -/
theorem hess_jPoly_quad (c : ℝ) (x q z : EuclSpace d) (X : Bilin d) (κ : ℝ) :
    fderiv ℝ (fderiv ℝ (jPoly c x q X κ)) x z z = (X z) z + 2 * κ * ‖z‖ ^ 2 := by
  rw [← line_deriv_two (contDiff_jPoly c x q X κ) x z,
    jPoly_line_fun, deriv_deriv_quad_poly]
  ring
theoremlocalMax_jPoly
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\eta \in \mathbb{R}$.

Assume

  • (q, X) ∈ PLaplacian.SuperJet u x hj
  • $0 < \eta$ hη

Then $\operatorname{IsLocalMax}(y \mapsto u(y) - \operatorname{jPoly}(u(x), x, q, X, \eta, y), x)$.

/-- **A superjet gives a jet polynomial touching from above.** -/
theorem localMax_jPoly {u : EuclSpace d → ℝ} {x q : EuclSpace d} {X : Bilin d}
    (hj : (q, X) ∈ SuperJet u x) {η : ℝ} (hη : 0 < η) :
    IsLocalMax (fun y => u y - jPoly (u x) x q X η y) x := by
  have h := hj η hη
  unfold IsLocalMax IsMaxFilter
  filter_upwards [h] with y hy
  change u y - jPoly (u x) x q X η y ≤ u x - jPoly (u x) x q X η x
  rw [jPoly_self]
  simp only [jPoly]
  linarith
theoremlocalMin_jPoly
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\eta \in \mathbb{R}$.

Assume

  • (q, X) ∈ PLaplacian.SubJet u x hj
  • $0 < \eta$ hη

Then $\operatorname{IsLocalMin}(y \mapsto u(y) - \operatorname{jPoly}(u(x), x, q, X, - \eta, y), x)$.

/-- **A subjet gives a jet polynomial touching from below.** -/
theorem localMin_jPoly {u : EuclSpace d → ℝ} {x q : EuclSpace d} {X : Bilin d}
    (hj : (q, X) ∈ SubJet u x) {η : ℝ} (hη : 0 < η) :
    IsLocalMin (fun y => u y - jPoly (u x) x q X (-η) y) x := by
  have h := hj η hη
  unfold IsLocalMin IsMinFilter
  filter_upwards [h] with y hy
  change u x - jPoly (u x) x q X (-η) x ≤ u y - jPoly (u x) x q X (-η) y
  rw [jPoly_self]
  simp only [jPoly]
  linarith
theoremsuperJet_regular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ hsub
  • $x \in \Omega$ hx
  • (q, X) ∈ PLaplacian.SuperJet u x hj
  • $q \ne 0$ hq

Then $\operatorname{viscF}(p, q, X) \le f(x)$.

/-- **The regular subsolution inequality at a superjet.** -/
theorem superJet_regular (hd : 0 < d) (hp : 2 ≤ p)
    (hsub : IsViscositySubsolution p Ω f u) (hx : x ∈ Ω)
    (hj : (q, X) ∈ SuperJet u x) (hq : q ≠ 0) :
    viscF p q X ≤ f x := by
  have key : ∀ η > 0, viscF p q X - f x ≤ 2 * η * ((d : ℝ) + p - 2) := by
    intro η hη
    have hg : gradient (jPoly (u x) x q X η) x ≠ 0 := by
      rw [gradient_jPoly_self]; exact hq
    have h := hsub.regular _ (contDiff_jPoly (u x) x q X η) x hx
      (localMax_jPoly hj hη) hg
    rw [gradient_jPoly_self] at h
    rw [viscF_shift (X := X) (fun v => hess_jPoly_quad (u x) x q v X η) hq] at h
    linarith
  linarith [nonpos_of_forall_le_mul (dim_pos hd hp) key]
theoremsuperJet_singular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ hsub
  • $x \in \Omega$ hx
  • (0, X) ∈ PLaplacian.SuperJet u x hj

Then $\operatorname{viscFLower}(p, X) \le f(x)$.

PLaplacian.superJet_singularPlaplacian/JetBridge.lean, lines 146–159
/-- **The singular subsolution inequality at a superjet.** -/
theorem superJet_singular (hd : 0 < d) (hp : 2 ≤ p)
    (hsub : IsViscositySubsolution p Ω f u) (hx : x ∈ Ω)
    (hj : (0, X) ∈ SuperJet u x) :
    viscFLower p X ≤ f x := by
  have key : ∀ η > 0, viscFLower p X - f x ≤ 2 * η * ((d : ℝ) + p - 2) := by
    intro η hη
    have hg : gradient (jPoly (u x) x 0 X η) x = 0 := gradient_jPoly_self _ _ _ _ _
    have h := hsub.singular _ (contDiff_jPoly (u x) x 0 X η) x hx
      (localMax_jPoly hj hη) hg
    rw [viscFLower_shift (X := X) hd
      (fun v => hess_jPoly_quad (u x) x 0 v X η)] at h
    linarith
  linarith [nonpos_of_forall_le_mul (dim_pos hd hp) key]
theoremsubJet_regular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $u\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ hsup
  • $x \in \Omega$ hx
  • (q, X) ∈ PLaplacian.SubJet u x hj
  • $q \ne 0$ hq

Then $f(x) \le \operatorname{viscF}(p, q, X)$.

/-- **The regular supersolution inequality at a subjet.** -/
theorem subJet_regular (hd : 0 < d) (hp : 2 ≤ p)
    (hsup : IsViscositySupersolution p Ω f u) (hx : x ∈ Ω)
    (hj : (q, X) ∈ SubJet u x) (hq : q ≠ 0) :
    f x ≤ viscF p q X := by
  have key : ∀ η > 0, f x - viscF p q X ≤ 2 * η * ((d : ℝ) + p - 2) := by
    intro η hη
    have hg : gradient (jPoly (u x) x q X (-η)) x ≠ 0 := by
      rw [gradient_jPoly_self]; exact hq
    have h := hsup.regular _ (contDiff_jPoly (u x) x q X (-η)) x hx
      (localMin_jPoly hj hη) hg
    rw [gradient_jPoly_self] at h
    rw [viscF_shift (X := X) (fun v => hess_jPoly_quad (u x) x q v X (-η)) hq]
      at h
    linarith
  linarith [nonpos_of_forall_le_mul (dim_pos hd hp) key]
theoremsubJet_singular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $u\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ hsup
  • $x \in \Omega$ hx
  • (0, X) ∈ PLaplacian.SubJet u x hj

Then $f(x) \le \operatorname{viscFUpper}(p, X)$.

/-- **The singular supersolution inequality at a subjet.** -/
theorem subJet_singular (hd : 0 < d) (hp : 2 ≤ p)
    (hsup : IsViscositySupersolution p Ω f u) (hx : x ∈ Ω)
    (hj : (0, X) ∈ SubJet u x) :
    f x ≤ viscFUpper p X := by
  have key : ∀ η > 0, f x - viscFUpper p X ≤ 2 * η * ((d : ℝ) + p - 2) := by
    intro η hη
    have hg : gradient (jPoly (u x) x 0 X (-η)) x = 0 :=
      gradient_jPoly_self _ _ _ _ _
    have h := hsup.singular _ (contDiff_jPoly (u x) x 0 X (-η)) x hx
      (localMin_jPoly hj hη) hg
    rw [viscFUpper_shift (X := X) hd
      (fun v => hess_jPoly_quad (u x) x 0 v X (-η))] at h
    linarith
  linarith [nonpos_of_forall_le_mul (dim_pos hd hp) key]

Plaplacian/Jets.lean13 declarations

abbrevBilin
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in $\mathrm{Type}$.

/-- The bilinear forms on the space. -/
abbrev Bilin (d : ℕ) := EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ
defQuadLE
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X, Y \in \operatorname{Bilin}(d)$.

Its value lies in $\mathrm{Prop}$.

/-- **The quadratic-form order.** -/
def QuadLE (X Y : Bilin d) : Prop := ∀ v : EuclSpace d, (X v) v ≤ (Y v) v
theoremQuadLE.refl
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$.

Then $\operatorname{QuadLE}(X, X)$.

theorem QuadLE.refl (X : Bilin d) : QuadLE X X := fun _ => le_refl _
theoremQuadLE.trans
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X, Y, Z \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{QuadLE}(X, Y)$ h1
  • $\operatorname{QuadLE}(Y, Z)$ h2

Then $\operatorname{QuadLE}(X, Z)$.

theorem QuadLE.trans {X Y Z : Bilin d} (h1 : QuadLE X Y) (h2 : QuadLE Y Z) :
    QuadLE X Z := fun v => le_trans (h1 v) (h2 v)
defSuperJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\operatorname{Set}(\mathbb{R}^{d} \times \operatorname{Bilin}(d))$.

/-- **The second-order superjet.** -/
def SuperJet (u : EuclSpace d → ℝ) (x : EuclSpace d) :
    Set (EuclSpace d × Bilin d) :=
  {qX | ∀ η > 0, ∀ᶠ y in 𝓝 x,
    u y ≤ u x + inner ℝ qX.1 (y - x)
      + (1 / 2) * (qX.2 (y - x)) (y - x) + η * ‖y - x‖ ^ 2}
defSubJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\operatorname{Set}(\mathbb{R}^{d} \times \operatorname{Bilin}(d))$.

/-- **The second-order subjet.** -/
def SubJet (u : EuclSpace d → ℝ) (x : EuclSpace d) :
    Set (EuclSpace d × Bilin d) :=
  {qX | ∀ η > 0, ∀ᶠ y in 𝓝 x,
    u x + inner ℝ qX.1 (y - x)
      + (1 / 2) * (qX.2 (y - x)) (y - x) - η * ‖y - x‖ ^ 2 ≤ u y}
defClSuperJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\operatorname{Set}(\mathbb{R}^{d} \times \operatorname{Bilin}(d))$.

/-- **The closed superjet**: limits of superjets at nearby points along which
the function converges. -/
def ClSuperJet (u : EuclSpace d → ℝ) (x : EuclSpace d) :
    Set (EuclSpace d × Bilin d) :=
  {qX | ∃ xs : ℕ → EuclSpace d, ∃ qs : ℕ → EuclSpace d, ∃ Xs : ℕ → Bilin d,
    (∀ n, (qs n, Xs n) ∈ SuperJet u (xs n)) ∧
    Tendsto xs atTop (𝓝 x) ∧
    Tendsto (fun n => u (xs n)) atTop (𝓝 (u x)) ∧
    Tendsto qs atTop (𝓝 qX.1) ∧
    Tendsto (fun n => ‖Xs n - qX.2‖) atTop (𝓝 0)}
defClSubJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\operatorname{Set}(\mathbb{R}^{d} \times \operatorname{Bilin}(d))$.

/-- **The closed subjet.** -/
def ClSubJet (u : EuclSpace d → ℝ) (x : EuclSpace d) :
    Set (EuclSpace d × Bilin d) :=
  {qX | ∃ xs : ℕ → EuclSpace d, ∃ qs : ℕ → EuclSpace d, ∃ Xs : ℕ → Bilin d,
    (∀ n, (qs n, Xs n) ∈ SubJet u (xs n)) ∧
    Tendsto xs atTop (𝓝 x) ∧
    Tendsto (fun n => u (xs n)) atTop (𝓝 (u x)) ∧
    Tendsto qs atTop (𝓝 qX.1) ∧
    Tendsto (fun n => ‖Xs n - qX.2‖) atTop (𝓝 0)}
theoremsuperJet_subset_cl
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\operatorname{SuperJet}(u, x) \subseteq \operatorname{ClSuperJet}(u, x)$.

PLaplacian.superJet_subset_clPlaplacian/Jets.lean, lines 117–123
/-- A superjet is a closed superjet, by constant sequences. -/
theorem superJet_subset_cl (u : EuclSpace d → ℝ) (x : EuclSpace d) :
    SuperJet u x ⊆ ClSuperJet u x := by
  intro qX h
  refine ⟨fun _ => x, fun _ => qX.1, fun _ => qX.2, fun _ => h,
    tendsto_const_nhds, tendsto_const_nhds, tendsto_const_nhds, ?_⟩
  simp
theoremsubJet_subset_cl
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\operatorname{SubJet}(u, x) \subseteq \operatorname{ClSubJet}(u, x)$.

PLaplacian.subJet_subset_clPlaplacian/Jets.lean, lines 125–131
/-- A subjet is a closed subjet, by constant sequences. -/
theorem subJet_subset_cl (u : EuclSpace d → ℝ) (x : EuclSpace d) :
    SubJet u x ⊆ ClSubJet u x := by
  intro qX h
  refine ⟨fun _ => x, fun _ => qX.1, fun _ => qX.2, fun _ => h,
    tendsto_const_nhds, tendsto_const_nhds, tendsto_const_nhds, ?_⟩
  simp
defpenaltyGrad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $x, y \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}^{d}$.

/-- The gradient of the quartic penalty. -/
def penaltyGrad (α : ℝ) (x y : EuclSpace d) : EuclSpace d :=
  (‖x - y‖ ^ 2 / α) • (x - y)
defTheoremOfSums
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in $\mathrm{Prop}$.

/-- **The theorem of sums, in the form the comparison argument consumes.**
Stated as a proposition, and proved separately. -/
def TheoremOfSums (d : ℕ) : Prop :=
  ∀ (u v : EuclSpace d → ℝ), UpperSemicontinuous u → LowerSemicontinuous v →
    BddAbove (range u) → BddBelow (range v) →
    ∀ α : ℝ, 0 < α → ∀ xh yh : EuclSpace d,
      IsLocalMax
        (fun z : EuclSpace d × EuclSpace d =>
          u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, yh) →
      ∃ X Y : Bilin d,
        (penaltyGrad α xh yh, X) ∈ ClSuperJet u xh ∧
        (penaltyGrad α xh yh, Y) ∈ ClSubJet v yh ∧
        QuadLE X Y ∧
        (xh = yh → QuadLE X 0 ∧ QuadLE 0 Y)
theorempenaltyGrad_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\operatorname{penaltyGrad}(\alpha, x, x) = 0$.

PLaplacian.penaltyGrad_selfPlaplacian/Jets.lean, lines 152–154
/-- At coincident points the penalty gradient vanishes. -/
theorem penaltyGrad_self (α : ℝ) (x : EuclSpace d) : penaltyGrad α x x = 0 := by
  simp [penaltyGrad]

Plaplacian/KeyStep.lean1 declarations

theoremdpp_comparison
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφ
  • $y \in \Omega$ hy
  • $\forall w,\ u(w) - \varphi(w) \le c$ hle
  • $u(y) - \varphi(y) = c$ heq

Then $\varphi(y) \le T_{\varepsilon} \varphi(y)$.

/-- **Comparison through the operator.** If `u - φ` is bounded by `c`
everywhere and `u` is `p`-harmonious at an interior point, then `φ` is a
subsolution of the discrete equation there. -/
theorem dpp_comparison {p ε : ℝ} (hp : 2 ≤ p) (hd : 0 < d) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφ : BddMeas φ)
    {y : EuclSpace d} (hy : y ∈ Ω) {c : ℝ}
    (hle : ∀ w, u w - φ w ≤ c) (heq : u y - φ y = c) :
    φ y ≤ tugOfWarOp p ε φ y := by
  -- u ≤ φ + c pointwise
  have hup : ∀ w, u w ≤ φ w + c := by
    intro w
    linarith [hle w]
  -- monotonicity through the operator
  have hmono : tugOfWarOp p ε u y
      ≤ tugOfWarOp p ε (fun w => φ w + c) y := by
    refine tugOfWarOp_monotone p ε hp hd hε hu.bddMeas ?_ hup y
    exact ⟨hφ.meas.add measurable_const, by
      obtain ⟨B, hB⟩ := hφ.bound
      exact ⟨B + |c|, fun w => by
        have := hB w
        have := abs_le.1 this
        rw [abs_le]
        constructor <;> [linarith [abs_nonneg c, neg_abs_le c];
          linarith [le_abs_self c]]⟩⟩
  -- the constant comes out
  rw [tugOfWarOp_add_const p ε hε hφ c y hpd] at hmono
  -- the dynamic programming principle
  rw [← hu.interior y hy] at hmono
  -- and u y = φ y + c
  have huy : u y = φ y + c := by linarith [heq]
  rw [huy] at hmono
  linarith [hmono]

Plaplacian/LbarSub.lean2 declarations

theoremneg_sub_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$.

Then $(\varepsilon, y \mapsto - (u_{\varepsilon}(y) - \varphi(y))) = \varepsilon, y \mapsto - u_{\varepsilon}(y) - - \varphi(y)$.

/-- The negated difference is the difference of the negations. -/
theorem neg_sub_eq (u : ℝ → EuclSpace d → ℝ) (φ : EuclSpace d → ℝ) :
    (fun ε y => -(u ε y - φ y)) = fun ε y => (-u ε y) - (-φ y) := by
  funext ε y
  ring
theoremlbar_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB

Then $\underline{\varepsilon, y \mapsto u_{\varepsilon}(y) - \varphi(y)}(x) = \underline{u}(x) - \varphi(x)$.

/-- **The lower relaxed limit of a difference.** -/
theorem lbar_sub (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B) (x : EuclSpace d) :
    lbar (fun ε y => u ε y - φ y) x = lbar u x - φ x := by
  rw [lbar_eq_neg_ubar_neg, lbar_eq_neg_ubar_neg]
  rw [neg_sub_eq]
  have hCn : ∀ ε y, |(-u ε y)| ≤ C := by
    intro ε y; rw [abs_neg]; exact hC ε y
  have hφn : Continuous (fun y => -φ y) := hφ.neg
  have hBn : ∀ y, |(-φ y)| ≤ B := by
    intro y; rw [abs_neg]; exact hB y
  rw [ubar_sub (fun ε y => -u ε y) hCn hφn hBn x]
  ring

Plaplacian/LimitMeas.lean3 declarations

theoremmeasurable_iterLimit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep

Then $\operatorname{iterLimit}(p, \varepsilon, u_{0})\text{ is Borel measurable}$.

PLaplacian.measurable_iterLimitPlaplacian/LimitMeas.lean, lines 36–49
/-- The limit is measurable, being a pointwise limit of measurable functions.
Uses the pointwise convergence rather than the supremum structure, which avoids
the `iSup` measurability API entirely. -/
theorem measurable_iterLimit (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) :
    Measurable (iterLimit p ε u₀) := by
  refine measurable_of_tendsto_metrizable
    (f := fun j => iter p ε u₀ j) ?_ ?_
  · exact fun j => (bddMeas_iter p ε hp hε hpd hu₀ j).meas
  · rw [tendsto_pi_nhds]
    exact fun x => tendsto_iterLimit p ε hp hε hd hpd hu₀ hC hstep x
theoremabs_iterLimit_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep

Then $\lvert \operatorname{iterLimit}(p, \varepsilon, u_{0}, x)\rvert \le C$.

PLaplacian.abs_iterLimit_lePlaplacian/LimitMeas.lean, lines 51–67
/-- The limit is bounded, by the bound on the iterates. -/
theorem abs_iterLimit_le (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) (x : EuclSpace d) :
    |iterLimit p ε u₀ x| ≤ C := by
  have hlo : -C ≤ iterLimit p ε u₀ x := by
    have h0 := iter_le_iterLimit p ε hp hε hd hpd hu₀ hC hstep 0 x
    simp only [iter_zero] at h0
    linarith [(abs_le.1 (hC x)).1]
  have hhi : iterLimit p ε u₀ x ≤ C := by
    unfold iterLimit
    refine ciSup_le fun i => ?_
    exact (abs_le.1 (abs_iter_le p ε hp hε hpd hu₀ hC i x)).2
  rw [abs_le]
  exact ⟨hlo, hhi⟩
theorembddMeas_iterLimit
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep

Then $\operatorname{iterLimit}(p, \varepsilon, u_{0})\text{ is admissible (bounded and Borel measurable)}$.

PLaplacian.bddMeas_iterLimitPlaplacian/LimitMeas.lean, lines 69–77
/-- **The limit is admissible.** -/
theorem bddMeas_iterLimit (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x) :
    BddMeas (iterLimit p ε u₀) :=
  ⟨measurable_iterLimit p ε hp hε hd hpd hu₀ hC hstep,
   ⟨C, abs_iterLimit_le p ε hp hε hd hpd hu₀ hC hstep⟩⟩

Plaplacian/LimitPassage.lean3 declarations

theoremnonneg_of_tendsto_le
Formal statementgenerated from the Lean declaration

Let $I \in \mathbb{R}$, $f \colon \mathbb{R} \to \mathbb{R}$, $l \in \operatorname{Filter}(\mathbb{R})$.

Assume

  • $\mathrm{l.NeBot}$
  • $\operatorname{Tendsto}(f, l, \operatorname{nhds}(0))$ hf
  • ∀ᶠ (ε : ℝ) in l, f ε ≤ I hle

Then $0 \le I$.

PLaplacian.nonneg_of_tendsto_lePlaplacian/LimitPassage.lean, lines 55–60
/-- **The limit argument.** If a quantity is bounded below by terms tending to
zero, it is nonnegative. -/
theorem nonneg_of_tendsto_le {I : ℝ} {f : ℝ → ℝ} {l : Filter ℝ} [l.NeBot]
    (hf : Filter.Tendsto f l (nhds 0)) (hle : ∀ᶠ ε in l, f ε ≤ I) :
    0 ≤ I :=
  le_of_tendsto hf hle
theoremtendsto_err_quotient
Formal statementgenerated from the Lean declaration

Let $K, M \in \mathbb{R}$, $E \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $0 \le M$ hM
  • $\forall \varepsilon > 0,\ \lvert E_{\varepsilon}\rvert \le K \cdot \varepsilon ^{3}$ hE
  • $0 \le K$ _hK

Then $\operatorname{Tendsto}(\varepsilon \mapsto M \cdot E_{\varepsilon} / \varepsilon ^{2}, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$.

PLaplacian.tendsto_err_quotientPlaplacian/LimitPassage.lean, lines 62–83
/-- The error quotient tends to zero when the error is of higher order. -/
theorem tendsto_err_quotient {K M : ℝ} (hM : 0 ≤ M) {E : ℝ → ℝ}
    (hE : ∀ ε > 0, |E ε| ≤ K * ε ^ 3) (_hK : 0 ≤ K) :
    Filter.Tendsto (fun ε => M * E ε / ε ^ 2)
      (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0) := by
  have hsq : Filter.Tendsto (fun ε : ℝ => M * K * ε)
      (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0) := by
    have hc : Continuous (fun ε : ℝ => M * K * ε) := by fun_prop
    have h := hc.tendsto (0 : ℝ)
    simp only [mul_zero] at h
    exact h.mono_left nhdsWithin_le_nhds
  refine squeeze_zero_norm' ?_ hsq
  filter_upwards [self_mem_nhdsWithin] with ε hε
  have hεpos : (0:ℝ) < ε := hε
  have h2 : (0:ℝ) < ε ^ 2 := by positivity
  have hEε := hE ε hεpos
  rw [Real.norm_eq_abs, abs_div, abs_mul, abs_of_nonneg hM,
      abs_of_pos h2]
  rw [div_le_iff₀ h2]
  calc M * |E ε| ≤ M * (K * ε ^ 3) := by
        exact mul_le_mul_of_nonneg_left hEε hM
    _ = M * K * ε * ε ^ 2 := by ring
theoremnonneg_of_rate
Formal statementgenerated from the Lean declaration

Let $I \in \mathbb{R}$, $q \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$ hq
  • ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), q ε ≤ I hle

Then $0 \le I$.

/-- **The subsolution inequality in the limit**, stated with the hypothesis
the rate supplies. -/
theorem nonneg_of_rate {I : ℝ} {q : ℝ → ℝ}
    (hq : Filter.Tendsto q (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0))
    (hle : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), q ε ≤ I) :
    0 ≤ I := by
  exact nonneg_of_tendsto_le hq hle

Plaplacian/LineBounds.lean2 declarations

theoremiteratedFDeriv_three_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Then $\operatorname{iteratedFDeriv}(\mathbb{R}, 3, s \mapsto x + s \cdot z, t) = 0$.

PLaplacian.iteratedFDeriv_three_linePlaplacian/LineBounds.lean, lines 49–60
/-- The second iterated derivative is zero as a function, so higher ones
vanish. -/
theorem iteratedFDeriv_three_line (x z : EuclSpace d) (t : ℝ) :
    iteratedFDeriv ℝ 3 (fun s : ℝ => x + s • z) t = 0 := by
  rw [show (3 : ℕ) = 2 + 1 from rfl, iteratedFDeriv_succ_eq_comp_left]
  simp only [Function.comp_apply]
  have hconst : iteratedFDeriv ℝ 2 (fun s : ℝ => x + s • z)
      = Function.const ℝ 0 := by
    funext u
    exact iteratedFDeriv_two_line x z u
  rw [hconst, fderiv_const]
  exact LinearIsometryEquiv.map_zero _
theoremline_deriv_bounds
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$, $t \in \mathbb{R}$, $i \in \mathbb{N}$.

Assume

  • $1 \le i$ a._@._internal._hyg.0
  • $i \le 3$ a._@._internal._hyg.0

Then $\lVert \operatorname{iteratedFDeriv}(\mathbb{R}, i, s \mapsto x + s \cdot z, t)\rVert \le \lVert z\rVert ^{i}$.

PLaplacian.line_deriv_boundsPlaplacian/LineBounds.lean, lines 62–71
/-- The line map's derivative bounds, in the form the composition bound
wants. -/
theorem line_deriv_bounds (x z : EuclSpace d) (t : ℝ) :
    ∀ i : ℕ, 1 ≤ i → i ≤ 3 →
      ‖iteratedFDeriv ℝ i (fun s : ℝ => x + s • z) t‖ ≤ ‖z‖ ^ i := by
  intro i h1 h3
  interval_cases i
  · rw [norm_fderiv_line]; simp
  · rw [norm_iteratedFDeriv_two_line]; positivity
  · rw [iteratedFDeriv_three_line, norm_zero]; positivity

Plaplacian/LineDeriv.lean6 declarations

theoremcontDiff_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$, $n \in \mathbb{N}$.

Then ContDiff ℝ ↑n fun s => x + s • z.

/-- The line map is smooth to every order. -/
theorem contDiff_line (x z : EuclSpace d) (n : ℕ) :
    ContDiff ℝ n (fun s : ℝ => x + s • z) := by
  fun_prop
theoremfderiv_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Then $\operatorname{fderiv}(\mathbb{R}, s \mapsto x + s \cdot z, t) = \operatorname{ContinuousLinearMap.smulRight}(1, z)$.

/-- Its Fréchet derivative, as a continuous linear map. -/
theorem fderiv_line (x z : EuclSpace d) (t : ℝ) :
    fderiv ℝ (fun s : ℝ => x + s • z) t
      = ContinuousLinearMap.smulRight (1 : ℝ →L[ℝ] ℝ) z := by
  have h : HasDerivAt (fun s : ℝ => x + s • z) z t := by
    simpa using (hasDerivAt_id t).smul_const z |>.const_add x
  exact h.hasFDerivAt.fderiv
theoremnorm_fderiv_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Then $\lVert \operatorname{iteratedFDeriv}(\mathbb{R}, 1, s \mapsto x + s \cdot z, t)\rVert = \lVert z\rVert$.

PLaplacian.norm_fderiv_linePlaplacian/LineDeriv.lean, lines 61–66
/-- Hence the first derivative has norm `‖z‖`. -/
theorem norm_fderiv_line (x z : EuclSpace d) (t : ℝ) :
    ‖iteratedFDeriv ℝ 1 (fun s : ℝ => x + s • z) t‖ = ‖z‖ := by
  rw [norm_iteratedFDeriv_one, fderiv_line x z t,
      ContinuousLinearMap.norm_smulRight_apply]
  simp
theoremiteratedFDeriv_one_line_const
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$.

Then (iteratedFDeriv ℝ 1 fun s => x + s • z) = fun x_1 => iteratedFDeriv ℝ 1 (fun s => x + s • z) 0.

PLaplacian.iteratedFDeriv_one_line_constPlaplacian/LineDeriv.lean, lines 77–84
/-- The line map's first iterated derivative is constant in the base point. -/
theorem iteratedFDeriv_one_line_const (x z : EuclSpace d) :
    iteratedFDeriv ℝ 1 (fun s : ℝ => x + s • z)
      = fun _ => iteratedFDeriv ℝ 1 (fun s : ℝ => x + s • z) 0 := by
  funext t
  ext m
  rw [iteratedFDeriv_one_apply, iteratedFDeriv_one_apply,
      fderiv_line x z t, fderiv_line x z 0]
theoremiteratedFDeriv_two_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Then $\operatorname{iteratedFDeriv}(\mathbb{R}, 2, s \mapsto x + s \cdot z, t) = 0$.

PLaplacian.iteratedFDeriv_two_linePlaplacian/LineDeriv.lean, lines 86–95
/-- Hence the second iterated derivative vanishes. -/
theorem iteratedFDeriv_two_line (x z : EuclSpace d) (t : ℝ) :
    iteratedFDeriv ℝ 2 (fun s : ℝ => x + s • z) t = 0 := by
  rw [show (2 : ℕ) = 1 + 1 from rfl, iteratedFDeriv_succ_eq_comp_left]
  simp only [Function.comp_apply]
  rw [iteratedFDeriv_one_line_const x z]
  rw [show (fun _ : ℝ => iteratedFDeriv ℝ 1 (fun s : ℝ => x + s • z) 0)
      = Function.const ℝ (iteratedFDeriv ℝ 1 (fun s : ℝ => x + s • z) 0)
      from rfl, fderiv_const]
  exact LinearIsometryEquiv.map_zero _
theoremnorm_iteratedFDeriv_two_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Then $\lVert \operatorname{iteratedFDeriv}(\mathbb{R}, 2, s \mapsto x + s \cdot z, t)\rVert = 0$.

PLaplacian.norm_iteratedFDeriv_two_linePlaplacian/LineDeriv.lean, lines 97–100
/-- And so does its norm, which is what the composition bound needs. -/
theorem norm_iteratedFDeriv_two_line (x z : EuclSpace d) (t : ℝ) :
    ‖iteratedFDeriv ℝ 2 (fun s : ℝ => x + s • z) t‖ = 0 := by
  rw [iteratedFDeriv_two_line, norm_zero]

Plaplacian/LineRestrict.lean13 declarations

deflineMap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, v \in \mathbb{R}^{d}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}$.

Its value lies in $\mathbb{R}^{d}$.

/-- The affine line through `x` in direction `v`. -/
def lineMap (x v : EuclSpace d) : ℝ → EuclSpace d := fun t => x + t • v
lemmalineMap_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, v \in \mathbb{R}^{d}$.

Then $\operatorname{lineMap}(x, v, 0) = x$.

@[simp] lemma lineMap_zero (x v : EuclSpace d) : lineMap x v 0 = x := by
  simp [lineMap]
lemmacontDiff_lineMap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, v \in \mathbb{R}^{d}$.

Then $\operatorname{ContDiff}(\mathbb{R}, 2, \operatorname{lineMap}(x, v))$.

lemma contDiff_lineMap (x v : EuclSpace d) : ContDiff ℝ 2 (lineMap x v) := by
  unfold lineMap; fun_prop
lemmacontinuous_lineMap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, v \in \mathbb{R}^{d}$.

Then $\operatorname{lineMap}(x, v)\text{ is continuous}$.

PLaplacian.continuous_lineMapPlaplacian/LineRestrict.lean, lines 59–60
lemma continuous_lineMap (x v : EuclSpace d) : Continuous (lineMap x v) :=
  (contDiff_lineMap x v).continuous
lemmahasDerivAt_lineMap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, v \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Then $\operatorname{HasDerivAt}(\operatorname{lineMap}(x, v), v, t)$.

PLaplacian.hasDerivAt_lineMapPlaplacian/LineRestrict.lean, lines 62–65
lemma hasDerivAt_lineMap (x v : EuclSpace d) (t : ℝ) :
    HasDerivAt (lineMap x v) v t := by
  unfold lineMap
  simpa using (hasDerivAt_id t).smul_const v |>.const_add x
theoremIsLocalMax.along_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $h \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $v \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMax}(h, x)$ hmax

Then $\operatorname{IsLocalMax}(t \mapsto h(\operatorname{lineMap}(x, v, t)), 0)$.

PLaplacian.IsLocalMax.along_linePlaplacian/LineRestrict.lean, lines 69–79
/-- A local maximum restricts to a local maximum along any line. -/
theorem IsLocalMax.along_line {h : EuclSpace d → ℝ} {x : EuclSpace d}
    (hmax : IsLocalMax h x) (v : EuclSpace d) :
    IsLocalMax (fun t : ℝ => h (lineMap x v t)) 0 := by
  have htend : Tendsto (lineMap x v) (𝓝 (0 : ℝ)) (𝓝 x) := by
    have := (continuous_lineMap x v).tendsto 0
    rwa [lineMap_zero] at this
  have hev := htend.eventually hmax
  rw [IsLocalMax, IsMaxFilter]
  rw [lineMap_zero]
  exact hev
lemmacontDiff_restrict
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $h \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, v \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, h)$ hh

Then ContDiff ℝ 2 fun t => h (PLaplacian.lineMap x v t).

lemma contDiff_restrict {h : EuclSpace d → ℝ} (hh : ContDiff ℝ 2 h)
    (x v : EuclSpace d) :
    ContDiff ℝ 2 (fun t : ℝ => h (lineMap x v t)) :=
  hh.comp (contDiff_lineMap x v)
theoremhasDerivAt_first
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $h \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, v \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, h)$ hh

Then $\operatorname{HasDerivAt}(s \mapsto h(\operatorname{lineMap}(x, v, s)), (\operatorname{fderiv}(\mathbb{R}, h, \operatorname{lineMap}(x, v, t)))(v), t)$.

/-- The first derivative along a line. -/
theorem hasDerivAt_first {h : EuclSpace d → ℝ} (hh : ContDiff ℝ 2 h)
    (x v : EuclSpace d) (t : ℝ) :
    HasDerivAt (fun s : ℝ => h (lineMap x v s))
      (fderiv ℝ h (lineMap x v t) v) t := by
  have h1 : HasFDerivAt h (fderiv ℝ h (lineMap x v t)) (lineMap x v t) :=
    (hh.differentiable (by norm_num) _).hasFDerivAt
  exact h1.comp_hasDerivAt t (hasDerivAt_lineMap x v t)
theoremderiv_first
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $h \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, v \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, h)$ hh

Then (deriv fun s => h (PLaplacian.lineMap x v s)) = fun t => (fderiv ℝ h (PLaplacian.lineMap x v t)) v.

theorem deriv_first {h : EuclSpace d → ℝ} (hh : ContDiff ℝ 2 h)
    (x v : EuclSpace d) :
    deriv (fun s : ℝ => h (lineMap x v s))
      = fun t => fderiv ℝ h (lineMap x v t) v := by
  funext t
  exact (hasDerivAt_first hh x v t).deriv
lemmadifferentiable_fderiv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $h \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, h)$ hh

Then $\operatorname{Differentiable}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, h))$.

PLaplacian.differentiable_fderivPlaplacian/LineRestrict.lean, lines 104–107
lemma differentiable_fderiv {h : EuclSpace d → ℝ} (hh : ContDiff ℝ 2 h) :
    Differentiable ℝ (fderiv ℝ h) := by
  have h1 : ContDiff ℝ 1 (fderiv ℝ h) := hh.fderiv_right (by norm_num)
  exact h1.differentiable (by norm_num)
lemmahasFDerivAt_fderiv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $h \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, h)$ hh

Then $\operatorname{HasFDerivAt}(\operatorname{fderiv}(\mathbb{R}, h), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, h), y), y)$.

lemma hasFDerivAt_fderiv {h : EuclSpace d → ℝ} (hh : ContDiff ℝ 2 h)
    (y : EuclSpace d) :
    HasFDerivAt (fderiv ℝ h) (fderiv ℝ (fderiv ℝ h) y) y :=
  (differentiable_fderiv hh y).hasFDerivAt
theoremhasDerivAt_second
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $h \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, v \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, h)$ hh

Then $\operatorname{HasDerivAt}(t \mapsto (\operatorname{fderiv}(\mathbb{R}, h, \operatorname{lineMap}(x, v, t)))(v), ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, h), x))(v))(v), 0)$.

/-- **The second derivative along a line is the Hessian at the direction
twice.** -/
theorem hasDerivAt_second {h : EuclSpace d → ℝ} (hh : ContDiff ℝ 2 h)
    (x v : EuclSpace d) :
    HasDerivAt (fun t : ℝ => fderiv ℝ h (lineMap x v t) v)
      (fderiv ℝ (fderiv ℝ h) x v v) 0 := by
  have hcomp : HasDerivAt (fun t : ℝ => fderiv ℝ h (lineMap x v t))
      (fderiv ℝ (fderiv ℝ h) x v) 0 := by
    have h1 : HasFDerivAt (fderiv ℝ h)
        (fderiv ℝ (fderiv ℝ h) (lineMap x v 0)) (lineMap x v 0) :=
      hasFDerivAt_fderiv hh _
    have h2 := h1.comp_hasDerivAt 0 (hasDerivAt_lineMap x v 0)
    rw [lineMap_zero] at h2
    exact h2
  have heval : HasFDerivAt (fun L : EuclSpace d →L[ℝ] ℝ => L v)
      (ContinuousLinearMap.apply ℝ ℝ v)
      (fderiv ℝ h (lineMap x v 0)) :=
    (ContinuousLinearMap.apply ℝ ℝ v).hasFDerivAt
  have hres := heval.comp_hasDerivAt 0 hcomp
  simp only [Function.comp_def, ContinuousLinearMap.apply_apply] at hres
  exact hres
theoremhess_nonpos_of_isLocalMaxTheorem 2.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $h \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $v \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, h)$ hh
  • $\operatorname{IsLocalMax}(h, x)$ hmax

Then $((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, h), x))(v))(v) \le 0$.

PLaplacian.hess_nonpos_of_isLocalMaxPlaplacian/LineRestrict.lean, lines 138–152
/-- **The Hessian is nonpositive at a local maximum.** -/
theorem hess_nonpos_of_isLocalMax {h : EuclSpace d → ℝ}
    (hh : ContDiff ℝ 2 h) {x : EuclSpace d} (hmax : IsLocalMax h x)
    (v : EuclSpace d) :
    fderiv ℝ (fderiv ℝ h) x v v ≤ 0 := by
  set g : ℝ → ℝ := fun t => h (lineMap x v t) with hgdef
  have hgC : ContDiff ℝ 2 g := contDiff_restrict hh x v
  have hgmax : IsLocalMax g 0 := IsLocalMax.along_line hmax v
  have hd1 : deriv g = fun t => fderiv ℝ h (lineMap x v t) v :=
    deriv_first hh x v
  have hd2 : deriv (deriv g) 0 = fderiv ℝ (fderiv ℝ h) x v v := by
    rw [hd1]
    exact (hasDerivAt_second hh x v).deriv
  have := IsLocalMax.deriv_deriv_nonpos hgC hgmax
  rwa [hd2] at this

Plaplacian/LittleO.lean2 declarations

theoremcontDiffOn_restrict_two
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$, $s \subseteq \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then $\operatorname{ContDiffOn}(\mathbb{R}, 2, t \mapsto \varphi(x + t \cdot z), s)$.

PLaplacian.contDiffOn_restrict_twoPlaplacian/LittleO.lean, lines 57–64
/-- The restriction of a `C²` function to a line is `C²` on any convex set. -/
theorem contDiffOn_restrict_two {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x z : EuclSpace d) (s : Set ℝ) :
    ContDiffOn ℝ 2 (fun t : ℝ => φ (x + t • z)) s := by
  have h : ContDiff ℝ 2 (fun t : ℝ => φ (x + t • z)) := by
    have hline : ContDiff ℝ 2 (fun t : ℝ => x + t • z) := by fun_prop
    exact hφ.comp hline
  exact h.contDiffOn
theoremtaylor_littleO_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then (fun t => φ (x + t • z) - taylorWithinEval (fun s => φ (x + s • z)) 2 Set.univ 0 t) =o[nhdsWithin 0 Set.univ] fun t => (t - 0) ^ 2.

PLaplacian.taylor_littleO_linePlaplacian/LittleO.lean, lines 66–75
/-- **The little-o remainder along a line.** -/
theorem taylor_littleO_line {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x z : EuclSpace d) :
    (fun t : ℝ => φ (x + t • z)
        - taylorWithinEval (fun s : ℝ => φ (x + s • z)) 2 univ 0 t)
      =o[nhdsWithin 0 univ] (fun t : ℝ => (t - 0) ^ 2) := by
  refine taylor_isLittleO (E := ℝ) (n := 2)
    (f := fun s : ℝ => φ (x + s • z)) (x₀ := 0) (s := univ)
    convex_univ (Set.mem_univ 0) ?_
  exact contDiffOn_restrict_two hφ x z univ

Plaplacian/LocDistUnif.lean1 declarations

theoremloc_dist_unif
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, y \in \mathbb{R}^{d}$, $\varepsilon, K, H, g \in \mathbb{R}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε
  • $0 \le K$ hK
  • $\lVert y - x\rVert \le \varepsilon$ hyb
  • $\varphi(x + (y - x)) \ge \varphi(x + \varepsilon \cdot \operatorname{gradDir}(\varphi, x))$ hdom
  • $\lvert \operatorname{taylorErr}(\varphi, x, y - x)\rvert \le K \cdot \varepsilon ^{3}$ hTy
  • $\lvert \operatorname{taylorErr}(\varphi, x, \varepsilon \cdot \operatorname{gradDir}(\varphi, x))\rvert \le K \cdot \varepsilon ^{3}$ hTs
  • $\lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \le H$ hH
  • $0 < g$ hg
  • $g \le \lVert \operatorname{gradient}(\varphi, x)\rVert$ hgx

Then ‖y - x - ε • PLaplacian.gradDir φ x‖ ≤ √(2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)).

/-- **The localization distance, bounded uniformly.** -/
theorem loc_dist_unif {φ : EuclSpace d → ℝ} {x y : EuclSpace d}
    (hx : gradient φ x ≠ 0) {ε K H g : ℝ} (hε : 0 < ε) (hK : 0 ≤ K)
    (hyb : ‖y - x‖ ≤ ε)
    (hdom : φ (x + (y - x)) ≥ φ (x + ε • gradDir φ x))
    (hTy : |taylorErr φ x (y - x)| ≤ K * ε ^ 3)
    (hTs : |taylorErr φ x (ε • gradDir φ x)| ≤ K * ε ^ 3)
    (hH : ‖fderiv ℝ (fderiv ℝ φ) x‖ ≤ H) (hg : 0 < g)
    (hgx : g ≤ ‖gradient φ x‖) :
    ‖y - x - ε • gradDir φ x‖
      ≤ Real.sqrt (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) := by
  -- the Taylor-error difference
  have hE : taylorErr φ x (y - x) - taylorErr φ x (ε • gradDir φ x)
      ≤ 2 * K * ε ^ 3 := by
    have h1 := (abs_le.1 hTy).2
    have h2 := (abs_le.1 hTs).1
    linarith [h1, h2]
  -- the numerator is nonnegative
  have hε2 : (0:ℝ) ≤ ε ^ 2 := by positivity
  have hε3 : (0:ℝ) ≤ ε ^ 3 := by positivity
  have hHnn : (0:ℝ) ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ :=
    ContinuousLinearMap.opNorm_nonneg _
  have hnum : 0 ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 + 2 * K * ε ^ 3 := by
    have : 0 ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 := mul_nonneg hHnn hε2
    have : 0 ≤ 2 * K * ε ^ 3 := by positivity
    linarith
  have hgpos : 0 < ‖gradient φ x‖ := lt_of_lt_of_le hg hgx
  have hnn : 0 ≤ 2 * ε * ((‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2
      + 2 * K * ε ^ 3) / ‖gradient φ x‖) := by
    have : 0 ≤ (‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 + 2 * K * ε ^ 3)
        / ‖gradient φ x‖ := div_nonneg hnum (le_of_lt hgpos)
    positivity
  -- the localization at the base point
  have hloc := localize_dist hx hε hyb hdom hE hnn
  -- the uniform constants
  have hrhs := localize_rhs_le hε hH hg hgx
    (le_refl (2 * K * ε ^ 3)) hnum
  exact le_trans hloc (Real.sqrt_le_sqrt hrhs)

Plaplacian/LocUnif.lean1 declarations

theoremlocalize_rhs_le
Formal statementgenerated from the Lean declaration

Let $\varepsilon, \mathrm{hy}, H, \mathrm{gy}, g, \mathrm{Ey}, E_{0} \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\mathrm{hy} \le H$ hH
  • $0 < g$ hg
  • $g \le \mathrm{gy}$ hgy
  • $\mathrm{Ey} \le E_{0}$ hE
  • $0 \le \mathrm{hy} \cdot \varepsilon ^{2} + \mathrm{Ey}$ hnum

Then $2 \cdot \varepsilon \cdot ((\mathrm{hy} \cdot \varepsilon ^{2} + \mathrm{Ey}) / \mathrm{gy}) \le 2 \cdot \varepsilon \cdot ((H \cdot \varepsilon ^{2} + E_{0}) / g)$.

PLaplacian.localize_rhs_lePlaplacian/LocUnif.lean, lines 56–76
/-- **The arithmetic of the uniform localization bound.** -/
theorem localize_rhs_le {ε hy H gy g Ey E₀ : ℝ} (hε : 0 < ε)
    (hH : hy ≤ H) (hg : 0 < g) (hgy : g ≤ gy) (hE : Ey ≤ E₀)
    (hnum : 0 ≤ hy * ε ^ 2 + Ey) :
    2 * ε * ((hy * ε ^ 2 + Ey) / gy)
      ≤ 2 * ε * ((H * ε ^ 2 + E₀) / g) := by
  have hε2 : (0:ℝ) ≤ ε ^ 2 := by positivity
  have hgy0 : 0 < gy := lt_of_lt_of_le hg hgy
  -- the numerator grows
  have hnum' : hy * ε ^ 2 + Ey ≤ H * ε ^ 2 + E₀ := by
    have : hy * ε ^ 2 ≤ H * ε ^ 2 := mul_le_mul_of_nonneg_right hH hε2
    linarith [this, hE]
  -- dividing the smaller numerator by the larger denominator is smaller
  have hdiv : (hy * ε ^ 2 + Ey) / gy ≤ (H * ε ^ 2 + E₀) / g := by
    calc (hy * ε ^ 2 + Ey) / gy
        ≤ (hy * ε ^ 2 + Ey) / g := by
          exact div_le_div_of_nonneg_left hnum hg hgy
      _ ≤ (H * ε ^ 2 + E₀) / g := by
          exact div_le_div_of_nonneg_right hnum' (le_of_lt hg)
  have h2ε : (0:ℝ) ≤ 2 * ε := by linarith
  exact mul_le_mul_of_nonneg_left hdiv h2ε

Plaplacian/LocalCmp.lean2 declarations

theoremdpp_comparison_local
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφ
  • $y \in \Omega$ hy
  • $\forall w \in B(y, \varepsilon),\ u(w) - \varphi(w) \le c$ hle
  • $u(y) - \varphi(y) = c$ heq

Then $\varphi(y) \le T_{\varepsilon} \varphi(y)$.

PLaplacian.dpp_comparison_localPlaplacian/LocalCmp.lean, lines 42–70
/-- **The comparison through the operator, local form.**

If the difference is bounded by `c` on the ball of radius `ε` about `y`, with
equality at `y`, and `u` is `p`-harmonious at `y`, then `φ` satisfies the
discrete inequality there. -/
theorem dpp_comparison_local {p ε : ℝ} (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφ : BddMeas φ)
    {y : EuclSpace d} (hy : y ∈ Ω) {c : ℝ}
    (hle : ∀ w ∈ ball y ε, u w - φ w ≤ c) (heq : u y - φ y = c) :
    φ y ≤ tugOfWarOp p ε φ y := by
  -- u ≤ φ + c on the ball
  have hup : ∀ w ∈ ball y ε, u w ≤ φ w + c := by
    intro w hw
    linarith [hle w hw]
  -- the shifted test function is admissible
  have hψ : BddMeas (fun w => φ w + c) := bddMeas_add_const hφ c
  -- local monotonicity
  have hmono : tugOfWarOp p ε u y
      ≤ tugOfWarOp p ε (fun w => φ w + c) y :=
    tugOfWarOp_mono_ball p ε hp hε hpd hu.bddMeas hψ y hup
  -- the constant comes out
  rw [tugOfWarOp_add_const p ε hε hφ c y hpd] at hmono
  -- the dynamic programming principle
  rw [← hu.interior y hy] at hmono
  have huy : u y = φ y + c := by linarith [heq]
  rw [huy] at hmono
  linarith [hmono]
theoremdpp_comparison_local'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφ
  • $y \in \Omega$ hy
  • $\forall w \in B(y, \varepsilon),\ u(w) - \varphi(w) \le u(y) - \varphi(y)$ hle

Then $\varphi(y) \le T_{\varepsilon} \varphi(y)$.

PLaplacian.dpp_comparison_local'Plaplacian/LocalCmp.lean, lines 72–81
/-- The version needing no separate equality, the constant being the value at
the point. -/
theorem dpp_comparison_local' {p ε : ℝ} (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφ : BddMeas φ)
    {y : EuclSpace d} (hy : y ∈ Ω)
    (hle : ∀ w ∈ ball y ε, u w - φ w ≤ u y - φ y) :
    φ y ≤ tugOfWarOp p ε φ y :=
  dpp_comparison_local hp hε hpd hu hφ hy hle rfl

Plaplacian/LocalMono.lean4 declarations

theoremexists_radius_of_isLocalMax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMax}(f, x_{0})$ h

Then there exists $r > 0$ such that:

  • $\forall w \in B(x_{0}, r),\ f(w) \le f(x_{0})$
PLaplacian.exists_radius_of_isLocalMaxPlaplacian/LocalMono.lean, lines 51–57
/-- A radius on which a local maximum's bound holds. -/
theorem exists_radius_of_isLocalMax {f : EuclSpace d → ℝ} {x₀ : EuclSpace d}
    (h : IsLocalMax f x₀) :
    ∃ r > 0, ∀ w ∈ ball x₀ r, f w ≤ f x₀ := by
  rw [IsLocalMax, IsMaxFilter, Filter.eventually_iff] at h
  obtain ⟨r, hr, hsub⟩ := Metric.mem_nhds_iff.1 h
  exact ⟨r, hr, fun w hw => hsub hw⟩
theoremsSup_ball_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\forall w \in B(x, \varepsilon),\ u(w) \le v(w)$ hle
  • BddAbove (v '' Metric.ball x ε) hbdd

Then sSup (u '' Metric.ball x ε) ≤ sSup (v '' Metric.ball x ε).

/-- The supremum over the ball is monotone under an inequality on the ball. -/
theorem sSup_ball_mono {u v : EuclSpace d → ℝ} {x : EuclSpace d} {ε : ℝ}
    (hε : 0 < ε) (hle : ∀ w ∈ ball x ε, u w ≤ v w)
    (hbdd : BddAbove (v '' ball x ε)) :
    sSup (u '' ball x ε) ≤ sSup (v '' ball x ε) := by
  have hne : (u '' ball x ε).Nonempty := ⟨u x, ⟨x, mem_ball_self hε, rfl⟩⟩
  refine csSup_le hne ?_
  rintro a ⟨w, hw, rfl⟩
  exact le_trans (hle w hw) (le_csSup hbdd ⟨w, hw, rfl⟩)
theoremsInf_ball_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\forall w \in B(x, \varepsilon),\ u(w) \le v(w)$ hle
  • BddBelow (u '' Metric.ball x ε) hbdd

Then sInf (u '' Metric.ball x ε) ≤ sInf (v '' Metric.ball x ε).

/-- And the infimum. -/
theorem sInf_ball_mono {u v : EuclSpace d → ℝ} {x : EuclSpace d} {ε : ℝ}
    (hε : 0 < ε) (hle : ∀ w ∈ ball x ε, u w ≤ v w)
    (hbdd : BddBelow (u '' ball x ε)) :
    sInf (u '' ball x ε) ≤ sInf (v '' ball x ε) := by
  have hne : (v '' ball x ε).Nonempty := ⟨v x, ⟨x, mem_ball_self hε, rfl⟩⟩
  refine le_csInf hne ?_
  rintro a ⟨w, hw, rfl⟩
  exact le_trans (csInf_le hbdd ⟨w, hw, rfl⟩) (hle w hw)
theoremsetAverage_ball_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\forall w \in B(x, \varepsilon),\ u(w) \le v(w)$ hle
  • $\operatorname{IntegrableOn}(u, B(x, \varepsilon), \lambda)$ hu
  • $\operatorname{IntegrableOn}(v, B(x, \varepsilon), \lambda)$ hv

Then $\fint_{B(x, \varepsilon)} (u(y) \le \fint_{B(x, \varepsilon)} v(y) \, dy) \, dy$.

PLaplacian.setAverage_ball_monoPlaplacian/LocalMono.lean, lines 79–85
/-- The average over the ball is monotone under an inequality on the ball. -/
theorem setAverage_ball_mono {u v : EuclSpace d → ℝ} {x : EuclSpace d}
    {ε : ℝ} (hle : ∀ w ∈ ball x ε, u w ≤ v w)
    (hu : MeasureTheory.IntegrableOn u (ball x ε))
    (hv : MeasureTheory.IntegrableOn v (ball x ε)) :
    (⨍ y in ball x ε, u y) ≤ ⨍ y in ball x ε, v y :=
  setAverage_mono measurableSet_ball hu hv hle

Plaplacian/Localize.lean2 declarations

theoremnorm_sub_shift_sq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y, \nu \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\lVert \nu\rVert = 1$ hν

Then $\lVert y - x - \varepsilon \cdot \nu\rVert ^{2} = \lVert y - x\rVert ^{2} - 2 \cdot \varepsilon \cdot \operatorname{inner}(\mathbb{R}, \nu, y - x) + \varepsilon ^{2}$.

PLaplacian.norm_sub_shift_sqPlaplacian/Localize.lean, lines 57–67
/-- **Polarization.** The squared distance to the shifted point. -/
theorem norm_sub_shift_sq (x y : EuclSpace d) {ν : EuclSpace d}
    (hν : ‖ν‖ = 1) (ε : ℝ) :
    ‖y - x - ε • ν‖ ^ 2
      = ‖y - x‖ ^ 2 - 2 * ε * inner ℝ ν (y - x) + ε ^ 2 := by
  rw [norm_sub_sq_real (y - x) (ε • ν), norm_smul, hν, Real.norm_eq_abs,
      mul_one]
  have hinner : inner ℝ (y - x) (ε • ν) = ε * inner ℝ ν (y - x) := by
    rw [real_inner_smul_right, real_inner_comm]
  rw [hinner, sq_abs]
  ring
theoremnorm_sub_shift_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y, \nu \in \mathbb{R}^{d}$, $\varepsilon, c \in \mathbb{R}$.

Assume

  • $\lVert \nu\rVert = 1$ hν
  • $0 < \varepsilon$ hε
  • $\lVert y - x\rVert \le \varepsilon$ hball
  • $\varepsilon - c \le \operatorname{inner}(\mathbb{R}, \nu, y - x)$ hinner

Then $\lVert y - x - \varepsilon \cdot \nu\rVert ^{2} \le 2 \cdot \varepsilon \cdot c$.

PLaplacian.norm_sub_shift_lePlaplacian/Localize.lean, lines 69–79
/-- **The localization bound.** A deficit `c` in the inner product bounds the
squared distance by `2 ε c`. -/
theorem norm_sub_shift_le (x y : EuclSpace d) {ν : EuclSpace d}
    (hν : ‖ν‖ = 1) {ε c : ℝ} (hε : 0 < ε)
    (hball : ‖y - x‖ ≤ ε) (hinner : ε - c ≤ inner ℝ ν (y - x)) :
    ‖y - x - ε • ν‖ ^ 2 ≤ 2 * ε * c := by
  rw [norm_sub_shift_sq x y hν ε]
  have hsq : ‖y - x‖ ^ 2 ≤ ε ^ 2 := by
    have h0 : (0:ℝ) ≤ ‖y - x‖ := norm_nonneg _
    nlinarith [hball, h0]
  nlinarith [hsq, hinner, hε]

Plaplacian/LocalizeDist.lean3 declarations

theoremle_sqrt_of_sq_le
Formal statementgenerated from the Lean declaration

Let $a, B \in \mathbb{R}$.

Assume

  • $0 \le a$ ha
  • $0 \le B$ _hB
  • $a ^{2} \le B$ h

Then a ≤ √B.

/-- A nonnegative quantity whose square is bounded is bounded by the square
root. -/
theorem le_sqrt_of_sq_le {a B : ℝ} (ha : 0 ≤ a) (_hB : 0 ≤ B)
    (h : a ^ 2 ≤ B) : a ≤ Real.sqrt B := by
  rw [show a = Real.sqrt (a ^ 2) from (Real.sqrt_sq ha).symm]
  exact Real.sqrt_le_sqrt h
theoremlocalize_dist
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, y \in \mathbb{R}^{d}$, $\varepsilon, E \in \mathbb{R}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε
  • $\lVert y - x\rVert \le \varepsilon$ hball
  • $\varphi(x + (y - x)) \ge \varphi(x + \varepsilon \cdot \operatorname{gradDir}(\varphi, x))$ hdom
  • $\operatorname{taylorErr}(\varphi, x, y - x) - \operatorname{taylorErr}(\varphi, x, \varepsilon \cdot \operatorname{gradDir}(\varphi, x)) \le E$ hE
  • $0 \le 2 \cdot \varepsilon \cdot ((\lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \cdot \varepsilon ^{2} + E) / \lVert \operatorname{gradient}(\varphi, x)\rVert)$ hBnn

Then ‖y - x - ε • PLaplacian.gradDir φ x‖ ≤ √(2 * ε * ((‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 + E) / ‖gradient φ x‖)).

/-- **The localization distance, as a bound rather than a squared bound.** -/
theorem localize_dist {φ : EuclSpace d → ℝ} {x y : EuclSpace d}
    (hx : gradient φ x ≠ 0) {ε E : ℝ} (hε : 0 < ε)
    (hball : ‖y - x‖ ≤ ε)
    (hdom : φ (x + (y - x)) ≥ φ (x + ε • gradDir φ x))
    (hE : taylorErr φ x (y - x) - taylorErr φ x (ε • gradDir φ x) ≤ E)
    (hBnn : 0 ≤ 2 * ε * ((‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 + E)
        / ‖gradient φ x‖)) :
    ‖y - x - ε • gradDir φ x‖
      ≤ Real.sqrt (2 * ε * ((‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 + E)
          / ‖gradient φ x‖)) := by
  have hsq := localize_maximizer hx hε hball hdom hE
  exact le_sqrt_of_sq_le (norm_nonneg _) hBnn hsq
theoremsqrt_nonneg'
Formal statementgenerated from the Lean declaration

Let $B \in \mathbb{R}$.

Then 0 ≤ √B.

/-- The square root is nonnegative, which `cmp_err_le` requires. -/
theorem sqrt_nonneg' (B : ℝ) : 0 ≤ Real.sqrt B := Real.sqrt_nonneg B

Plaplacian/LocalizeMax.lean1 declarations

theoremlocalize_maximizerTheorem 3.5 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, y \in \mathbb{R}^{d}$, $\varepsilon, E \in \mathbb{R}$.

Assume

  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε
  • $\lVert y - x\rVert \le \varepsilon$ hball
  • $\varphi(x + (y - x)) \ge \varphi(x + \varepsilon \cdot \operatorname{gradDir}(\varphi, x))$ hdom
  • $\operatorname{taylorErr}(\varphi, x, y - x) - \operatorname{taylorErr}(\varphi, x, \varepsilon \cdot \operatorname{gradDir}(\varphi, x)) \le E$ hE

Then $\lVert y - x - \varepsilon \cdot \operatorname{gradDir}(\varphi, x)\rVert ^{2} \le 2 \cdot \varepsilon \cdot ((\lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \cdot \varepsilon ^{2} + E) / \lVert \operatorname{gradient}(\varphi, x)\rVert)$.

PLaplacian.localize_maximizerPlaplacian/LocalizeMax.lean, lines 54–92
/-- **Localization of the maximizer.**

If `y` maximizes `φ` on the closed ball and the Taylor errors at the two
points differ by at most `E`, then

  `‖y - x - ε ν‖² ≤ 2 ε (‖D²φ x‖ ε² + E) / ‖∇φ x‖`.

With `E` of order `ε³` this is `O(ε³)`, so the maximizer is within
`O(ε^{3/2})` of the shifted point. -/
theorem localize_maximizer {φ : EuclSpace d → ℝ} {x y : EuclSpace d}
    (hx : gradient φ x ≠ 0) {ε E : ℝ} (hε : 0 < ε)
    (hball : ‖y - x‖ ≤ ε)
    (hdom : φ (x + (y - x)) ≥ φ (x + ε • gradDir φ x))
    (hE : taylorErr φ x (y - x) - taylorErr φ x (ε • gradDir φ x) ≤ E) :
    ‖y - x - ε • gradDir φ x‖ ^ 2
      ≤ 2 * ε * ((‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 + E)
          / ‖gradient φ x‖) := by
  have hgpos : (0:ℝ) < ‖gradient φ x‖ := norm_pos_iff.2 hx
  -- the shift has norm ε
  have hshift : ‖ε • gradDir φ x‖ ≤ ε := by
    rw [norm_smul, norm_gradDir hx, Real.norm_eq_abs, abs_of_pos hε, mul_one]
  -- the quadratic difference
  have hquad := quad_diff_le (φ := φ) x hball hshift hε
  -- the total bound K
  set K := ‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 + E with hK
  have hKbd : (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (y - x) (y - x)
        + taylorErr φ x (y - x)
      - ((1 / 2) * fderiv ℝ (fderiv ℝ φ) x (ε • gradDir φ x)
            (ε • gradDir φ x)
          + taylorErr φ x (ε • gradDir φ x)) ≤ K := by
    rw [hK]
    linarith [hquad, hE]
  -- the deficit
  have hdef := deficit_le hx hdom hKbd
  have hc : ε - inner ℝ (gradDir φ x) (y - x) ≤ K / ‖gradient φ x‖ := by
    rw [le_div_iff₀ hgpos]
    linarith [hdef]
  -- polarization
  exact norm_sub_shift_le x y (norm_gradDir hx) hε hball (by linarith [hc])

Plaplacian/LowerSemi.lean4 declarations

theoremneg_set_eq
Formal statementgenerated from the Lean declaration

Let $\alpha$ be a type, $u \colon \alpha \to \mathbb{R}$, $F \in \operatorname{Filter}(\alpha)$.

Then {a | ∀ᶠ (x : α) in F, -u x ≤ a} = -{a | ∀ᶠ (x : α) in F, a ≤ u x}.

/-- The defining set for the limsup of a negation is the negation of the
defining set for the liminf. -/
theorem neg_set_eq {α : Type*} (u : α → ℝ) (F : Filter α) :
    {a : ℝ | ∀ᶠ x in F, - u x ≤ a} = - {a : ℝ | ∀ᶠ x in F, a ≤ u x} := by
  ext a
  simp only [Set.mem_ofPred_eq, Set.mem_neg]
  constructor
  · intro h
    filter_upwards [h] with x hx
    linarith [hx]
  · intro h
    filter_upwards [h] with x hx
    linarith [hx]
theoremliminf_eq_neg_limsup_neg
Formal statementgenerated from the Lean declaration

Let $\alpha$ be a type, $u \colon \alpha \to \mathbb{R}$, $F \in \operatorname{Filter}(\alpha)$.

Then $\operatorname{liminf}(u, F) = - \operatorname{limsup}(x \mapsto - u(x), F)$.

PLaplacian.liminf_eq_neg_limsup_negPlaplacian/LowerSemi.lean, lines 62–66
/-- **The limit inferior as minus the limit superior of the negation.** -/
theorem liminf_eq_neg_limsup_neg {α : Type*} (u : α → ℝ) (F : Filter α) :
    Filter.liminf u F = - Filter.limsup (fun x => - u x) F := by
  rw [Filter.liminf_eq, Filter.limsup_eq, neg_set_eq u F, Real.sInf_neg]
  ring
theoremlbar_eq_neg_ubar_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\underline{u}(x) = - \overline{\varepsilon, y \mapsto - u_{\varepsilon}(y)}(x)$.

PLaplacian.lbar_eq_neg_ubar_negPlaplacian/LowerSemi.lean, lines 69–74
/-- The lower limit is minus the upper limit of the negation. -/
theorem lbar_eq_neg_ubar_neg (u : ℝ → EuclSpace d → ℝ) (x : EuclSpace d) :
    lbar u x = - ubar (fun ε y => - u ε y) x := by
  unfold lbar ubar
  exact liminf_eq_neg_limsup_neg (fun q : ℝ × EuclSpace d => u q.1 q.2)
    (relaxFilter x)
theoremlowerSemicontinuous_lbarTheorem 4.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC

Then $\underline{u}\text{ is lower semicontinuous}$.

PLaplacian.lowerSemicontinuous_lbarPlaplacian/LowerSemi.lean, lines 76–90
/-- **The lower limit is lower semicontinuous.** -/
theorem lowerSemicontinuous_lbar (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) :
    LowerSemicontinuous (lbar u) := by
  refine upperSemiContinuous_neg_iff.mp ?_
  have heq : (- lbar u)
      = ubar (fun ε y => - u ε y) := by
    funext y
    change - lbar u y = _
    rw [lbar_eq_neg_ubar_neg, neg_neg]
  rw [heq]
  refine upperSemicontinuous_ubar (fun ε y => - u ε y) (C := C) ?_
  intro ε y
  rw [abs_neg]
  exact hC ε y

Plaplacian/MainConv.lean1 declarations

theorempharmonious_convergeTheorem 7.4 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $F\text{ is continuous}$ hFc
  • $\forall y \in \partial \Omega,\ \exists z, \delta,\ 0 < \delta \wedge \lVert y - z\rVert = \delta \wedge \forall x \in \Omega,\ \delta \le \lVert x - z\rVert$ hext
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\forall \varepsilon > 0,\ \forall x \notin \Omega,\ u_{\varepsilon}(x) = F(x)$ hout

Then all of the following hold:

  • $\forall x \in \overline{\Omega},\ \overline{u}(x) = \underline{u}(x)$
  • $\forall x \in \partial \Omega,\ \overline{u}(x) = F(x)$
  • $\forall \eta > 0,\ \exists \varepsilon_{0} > 0,\ \forall \varepsilon,\ 0 < \varepsilon \to \varepsilon < \varepsilon_{0} \to \forall x \in \overline{\Omega},\ \lvert u_{\varepsilon}(x) - \overline{u}(x)\rvert \le \eta$
PLaplacian.pharmonious_convergePlaplacian/MainConv.lean, lines 39–144
/-- **Convergence of `p`-harmonious functions to the viscosity solution.** -/
theorem pharmonious_converge [Nontrivial (EuclSpace d)] (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hpd : 0 < p + (d : ℝ)) {Ω : Set (EuclSpace d)} (hΩo : IsOpen Ω)
    (hΩb : Bornology.IsBounded Ω) {F : EuclSpace d → ℝ} (hFc : Continuous F)
    (hext : ∀ y ∈ frontier Ω, ∃ (z : EuclSpace d) (δ : ℝ), 0 < δ ∧ ‖y - z‖ = δ ∧
      ∀ x ∈ Ω, δ ≤ ‖x - z‖)
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    (hout : ∀ ε > 0, ∀ x, x ∉ Ω → u ε x = F x) :
    (∀ x ∈ closure Ω, ubar u x = lbar u x) ∧
    (∀ x ∈ frontier Ω, ubar u x = F x) ∧
    (∀ η > 0, ∃ ε₀ > 0, ∀ ε, 0 < ε → ε < ε₀ → ∀ x ∈ closure Ω,
      |u ε x - ubar u x| ≤ η) := by
  -- the negated family
  have hC' : ∀ ε y, |(fun ε y => -u ε y) ε y| ≤ C := fun ε y => by
    simp only [abs_neg]; exact hC ε y
  have hu' : ∀ ε > 0, IsPHarmonious p ε Ω (fun y => -F y) ((fun ε y => -u ε y) ε) :=
    fun ε hε => isPHarmonious_neg (hu ε hε)
  have hout' : ∀ ε > 0, ∀ x, x ∉ Ω → (fun ε y => -u ε y) ε x = (fun y => -F y) x := by
    intro ε hε x hx
    change -u ε x = -F x
    rw [hout ε hε x hx]
  -- the bounds on the relaxed limits
  have hubC : ∀ x, ubar u x ≤ C := fun x =>
    ubar_le_of_bound u hC (S := Ioi 0) self_mem_nhdsWithin (V := univ) (b := C)
      (fun ε _ y _ => (abs_le.1 (hC ε y)).2) univ_mem
  have hlbC : ∀ x, -C ≤ lbar u x := by
    intro x
    have h : ubar (fun ε y => -u ε y) x ≤ C :=
      ubar_le_of_bound _ hC' (S := Ioi 0) self_mem_nhdsWithin (V := univ) (b := C)
        (fun ε _ y _ => (abs_le.1 (hC' ε y)).2) univ_mem
    rw [lbar_eq_neg_ubar_neg]
    linarith
  have hord : ∀ x, lbar u x ≤ ubar u x := lbar_le_ubar u hC
  -- the boundary estimates
  have hupper : ∀ y ∈ frontier Ω, ubar u y ≤ F y := by
    intro y hy
    obtain ⟨z, δ, hδ, hyz, hext'⟩ := hext y hy
    exact ubar_le_bdry hd hp hpd hC hu hout hFc.continuousAt hδ hyz hext'
  have hlower : ∀ y ∈ frontier Ω, F y ≤ lbar u y := by
    intro y hy
    obtain ⟨z, δ, hδ, hyz, hext'⟩ := hext y hy
    have h : ubar (fun ε y => -u ε y) y ≤ -F y :=
      ubar_le_bdry hd hp hpd hC' hu' hout' hFc.neg.continuousAt hδ hyz hext'
    rw [lbar_eq_neg_ubar_neg]
    linarith
  -- comparison in Ω
  have hcomp := visc_comparison hd hp hΩo hΩb (upperSemicontinuous_ubar u hC)
    (lowerSemicontinuous_lbar u hC)
    ⟨C, by rintro _ ⟨x, rfl⟩; exact hubC x⟩
    ⟨-C, by rintro _ ⟨x, rfl⟩; exact le_trans (hlbC x) (hord x)⟩
    ⟨-C, by rintro _ ⟨x, rfl⟩; exact hlbC x⟩
    ⟨C, by rintro _ ⟨x, rfl⟩; exact le_trans (hord x) (hubC x)⟩
    (ubar_isViscositySubsolution hd hp hpd hΩo hC hu)
    (lbar_isViscositySupersolution hd hp hpd hΩo hC hu)
    (fun x hx => le_trans (hupper x hx) (hlower x hx))
  -- the relaxed limits agree on the closure
  have heq : ∀ x ∈ closure Ω, ubar u x = lbar u x := by
    intro x hx
    rw [closure_eq_self_union_frontier] at hx
    rcases hx with hx | hx
    · exact le_antisymm (hcomp x hx) (hord x)
    · exact le_antisymm (le_trans (hupper x hx) (hlower x hx)) (hord x)
  have heqF : ∀ x ∈ frontier Ω, ubar u x = F x := fun x hx =>
    le_antisymm (hupper x hx) (le_trans (hlower x hx) (hord x))
  refine ⟨heq, heqF, ?_⟩
  -- uniform convergence, by contradiction
  intro η hη
  by_contra hcon
  push Not at hcon
  have hseq : ∀ n : ℕ, ∃ ε x, 0 < ε ∧ ε < 1 / ((n : ℝ) + 1) ∧ x ∈ closure Ω ∧
      η < |u ε x - ubar u x| := by
    intro n
    obtain ⟨ε, hε0, hε1, x, hx, hbad⟩ := hcon (1 / ((n : ℝ) + 1)) (by positivity)
    exact ⟨ε, x, hε0, hε1, hx, hbad⟩
  choose εs xs hεs0 hεs1 hxs hbad using hseq
  -- a convergent subsequence
  obtain ⟨xstar, hxstar, φ, hφ, hxT⟩ := tendsto_subseq_of_bounded hΩb.closure hxs
  rw [closure_closure] at hxstar
  have hεT : Tendsto (fun n => εs (φ n)) atTop (𝓝[>] 0) := by
    rw [tendsto_nhdsWithin_iff]
    refine ⟨?_, Eventually.of_forall fun n => hεs0 (φ n)⟩
    have h1 : Tendsto (fun n => 1 / ((φ n : ℝ) + 1)) atTop (𝓝 0) :=
      tendsto_one_div_add_atTop_nhds_zero_nat.comp hφ.tendsto_atTop
    exact squeeze_zero (fun n => (hεs0 (φ n)).le) (fun n => (hεs1 (φ n)).le) h1
  have hqT : Tendsto (fun n => (εs (φ n), xs (φ n))) atTop (relaxFilter xstar) :=
    hεT.prodMk hxT
  -- four eventual bounds at x*
  have hb : 0 < η / 3 := by positivity
  have e1 : ∀ᶠ n in atTop, u (εs (φ n)) (xs (φ n)) < ubar u xstar + η / 3 :=
    hqT.eventually (eventually_lt_of_ubar_lt u hC xstar (by linarith))
  have e2 : ∀ᶠ n in atTop, -u (εs (φ n)) (xs (φ n)) < -lbar u xstar + η / 3 := by
    have h : ubar (fun ε y => -u ε y) xstar < -lbar u xstar + η / 3 := by
      rw [lbar_eq_neg_ubar_neg]; linarith
    exact hqT.eventually (eventually_lt_of_ubar_lt _ hC' xstar h)
  have e3 : ∀ᶠ n in atTop, ubar u (xs (φ n)) < ubar u xstar + η / 3 :=
    hxT.eventually (upperSemicontinuous_ubar u hC xstar _ (by linarith))
  have e4 : ∀ᶠ n in atTop, lbar u xstar - η / 3 < lbar u (xs (φ n)) :=
    hxT.eventually (lowerSemicontinuous_lbar u hC xstar _ (by linarith))
  obtain ⟨n, h1, h2, h3, h4⟩ := (e1.and (e2.and (e3.and e4))).exists
  have h5 := heq (xs (φ n)) (hxs (φ n))
  have h6 := heq xstar hxstar
  have h7 := hbad (φ n)
  have : |u (εs (φ n)) (xs (φ n)) - ubar u (xs (φ n))| < η := by
    rw [abs_lt]; constructor <;> linarith
  linarith

Plaplacian/MaxSub.lean6 declarations

theoremisLocalMax_of_attains_left
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMax}(y \mapsto \operatorname{max}(u(y), v(y)) - \varphi(y), x_{0})$ hmax
  • $u(x_{0}) = \operatorname{max}(u(x_{0}), v(x_{0}))$ hattain

Then $\operatorname{IsLocalMax}(y \mapsto u(y) - \varphi(y), x_{0})$.

PLaplacian.isLocalMax_of_attains_leftPlaplacian/MaxSub.lean, lines 52–62
/-- At a contact point for the maximum, the test function also touches whichever
function attains the maximum there. -/
theorem isLocalMax_of_attains_left {u v φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d}
    (hmax : IsLocalMax (fun y => max (u y) (v y) - φ y) x₀)
    (hattain : u x₀ = max (u x₀) (v x₀)) :
    IsLocalMax (fun y => u y - φ y) x₀ := by
  filter_upwards [hmax] with y hy
  have h1 : u y ≤ max (u y) (v y) := le_max_left _ _
  rw [hattain]
  linarith
theoremisLocalMax_of_attains_right
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMax}(y \mapsto \operatorname{max}(u(y), v(y)) - \varphi(y), x_{0})$ hmax
  • $v(x_{0}) = \operatorname{max}(u(x_{0}), v(x_{0}))$ hattain

Then $\operatorname{IsLocalMax}(y \mapsto v(y) - \varphi(y), x_{0})$.

PLaplacian.isLocalMax_of_attains_rightPlaplacian/MaxSub.lean, lines 64–73
/-- The same on the right. -/
theorem isLocalMax_of_attains_right {u v φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d}
    (hmax : IsLocalMax (fun y => max (u y) (v y) - φ y) x₀)
    (hattain : v x₀ = max (u x₀) (v x₀)) :
    IsLocalMax (fun y => v y - φ y) x₀ := by
  filter_upwards [hmax] with y hy
  have h1 : v y ≤ max (u y) (v y) := le_max_right _ _
  rw [hattain]
  linarith
theoremIsViscositySubsolution.maxTheorem 2.8 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u, v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ hu
  • $v\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ hv

Then PLaplacian.IsViscositySubsolution p Ω f fun y => max (u y) (v y).

PLaplacian.IsViscositySubsolution.maxPlaplacian/MaxSub.lean, lines 75–93
/-- **The maximum of two subsolutions is a subsolution.** -/
theorem IsViscositySubsolution.max {p : ℝ} {Ω : Set (EuclSpace d)}
    {f u v : EuclSpace d → ℝ}
    (hu : IsViscositySubsolution p Ω f u)
    (hv : IsViscositySubsolution p Ω f v) :
    IsViscositySubsolution p Ω f (fun y => max (u y) (v y)) where
  usc := UpperSemicontinuousOn.sup hu.usc hv.usc
  regular := fun φ hφ x₀ hx₀ hmax hgrad => by
    rcases max_cases (u x₀) (v x₀) with ⟨heq, -⟩ | ⟨heq, -⟩
    · exact hu.regular φ hφ x₀ hx₀
        (isLocalMax_of_attains_left hmax heq.symm) hgrad
    · exact hv.regular φ hφ x₀ hx₀
        (isLocalMax_of_attains_right hmax heq.symm) hgrad
  singular := fun φ hφ x₀ hx₀ hmax hgrad => by
    rcases max_cases (u x₀) (v x₀) with ⟨heq, -⟩ | ⟨heq, -⟩
    · exact hu.singular φ hφ x₀ hx₀
        (isLocalMax_of_attains_left hmax heq.symm) hgrad
    · exact hv.singular φ hφ x₀ hx₀
        (isLocalMax_of_attains_right hmax heq.symm) hgrad
theoremisLocalMin_of_attains_left
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMin}(y \mapsto \operatorname{min}(u(y), v(y)) - \varphi(y), x_{0})$ hmin
  • $u(x_{0}) = \operatorname{min}(u(x_{0}), v(x_{0}))$ hattain

Then $\operatorname{IsLocalMin}(y \mapsto u(y) - \varphi(y), x_{0})$.

PLaplacian.isLocalMin_of_attains_leftPlaplacian/MaxSub.lean, lines 95–104
/-- Dually, the minimum of two supersolutions is a supersolution. -/
theorem isLocalMin_of_attains_left {u v φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d}
    (hmin : IsLocalMin (fun y => min (u y) (v y) - φ y) x₀)
    (hattain : u x₀ = min (u x₀) (v x₀)) :
    IsLocalMin (fun y => u y - φ y) x₀ := by
  filter_upwards [hmin] with y hy
  have h1 : min (u y) (v y) ≤ u y := min_le_left _ _
  rw [hattain]
  linarith
theoremisLocalMin_of_attains_right
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMin}(y \mapsto \operatorname{min}(u(y), v(y)) - \varphi(y), x_{0})$ hmin
  • $v(x_{0}) = \operatorname{min}(u(x_{0}), v(x_{0}))$ hattain

Then $\operatorname{IsLocalMin}(y \mapsto v(y) - \varphi(y), x_{0})$.

PLaplacian.isLocalMin_of_attains_rightPlaplacian/MaxSub.lean, lines 106–114
theorem isLocalMin_of_attains_right {u v φ : EuclSpace d → ℝ}
    {x₀ : EuclSpace d}
    (hmin : IsLocalMin (fun y => min (u y) (v y) - φ y) x₀)
    (hattain : v x₀ = min (u x₀) (v x₀)) :
    IsLocalMin (fun y => v y - φ y) x₀ := by
  filter_upwards [hmin] with y hy
  have h1 : min (u y) (v y) ≤ v y := min_le_right _ _
  rw [hattain]
  linarith
theoremIsViscositySupersolution.min
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u, v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $u\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ hu
  • $v\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ hv

Then PLaplacian.IsViscositySupersolution p Ω f fun y => min (u y) (v y).

PLaplacian.IsViscositySupersolution.minPlaplacian/MaxSub.lean, lines 116–133
theorem IsViscositySupersolution.min {p : ℝ} {Ω : Set (EuclSpace d)}
    {f u v : EuclSpace d → ℝ}
    (hu : IsViscositySupersolution p Ω f u)
    (hv : IsViscositySupersolution p Ω f v) :
    IsViscositySupersolution p Ω f (fun y => min (u y) (v y)) where
  lsc := LowerSemicontinuousOn.inf hu.lsc hv.lsc
  regular := fun φ hφ x₀ hx₀ hmin hgrad => by
    rcases min_cases (u x₀) (v x₀) with ⟨heq, -⟩ | ⟨heq, -⟩
    · exact hu.regular φ hφ x₀ hx₀
        (isLocalMin_of_attains_left hmin heq.symm) hgrad
    · exact hv.regular φ hφ x₀ hx₀
        (isLocalMin_of_attains_right hmin heq.symm) hgrad
  singular := fun φ hφ x₀ hx₀ hmin hgrad => by
    rcases min_cases (u x₀) (v x₀) with ⟨heq, -⟩ | ⟨heq, -⟩
    · exact hu.singular φ hφ x₀ hx₀
        (isLocalMin_of_attains_left hmin heq.symm) hgrad
    · exact hv.singular φ hφ x₀ hx₀
        (isLocalMin_of_attains_right hmin heq.symm) hgrad

Plaplacian/Measurability.lean9 declarations

classof

No exported statement.

class of bounded measurable functions would not be invariant under a
theoremsSup_ball_gt_iff
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $\mathrm{lam} \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < \varepsilon$ hε
  • $\exists C,\ \forall y,\ \lvert v(y)\rvert \le C$ hb

Then lam < sSup (v '' Metric.ball x ε) ↔ ∃ y ∈ Metric.ball x ε, lam < v y.

/-- `sup_{B ε x} v > λ` exactly when some point of the ball has `v y > λ`. -/
theorem sSup_ball_gt_iff (v : EuclSpace d → ℝ) {ε : ℝ} (hε : 0 < ε)
    (hb : ∃ C, ∀ y, |v y| ≤ C) (lam : ℝ) (x : EuclSpace d) :
    lam < sSup (v '' ball x ε) ↔ ∃ y ∈ ball x ε, lam < v y := by
  obtain ⟨C, hC⟩ := hb
  have hne : (v '' ball x ε).Nonempty := ⟨v x, x, mem_ball_self hε, rfl⟩
  have hbdd : BddAbove (v '' ball x ε) :=
    ⟨C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hC y)).2⟩
  constructor
  · intro h
    by_contra hcon
    push Not at hcon
    exact absurd (csSup_le hne (by rintro a ⟨y, hy, rfl⟩; exact hcon y hy))
      (not_le.2 h)
  · rintro ⟨y, hy, hlt⟩
    exact lt_of_lt_of_le hlt (le_csSup hbdd ⟨y, hy, rfl⟩)
theoremsInf_ball_lt_iff
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $\mathrm{lam} \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < \varepsilon$ hε
  • $\exists C,\ \forall y,\ \lvert v(y)\rvert \le C$ hb

Then sInf (v '' Metric.ball x ε) < lam ↔ ∃ y ∈ Metric.ball x ε, v y < lam.

/-- `inf_{B ε x} v < λ` exactly when some point of the ball has `v y < λ`. -/
theorem sInf_ball_lt_iff (v : EuclSpace d → ℝ) {ε : ℝ} (hε : 0 < ε)
    (hb : ∃ C, ∀ y, |v y| ≤ C) (lam : ℝ) (x : EuclSpace d) :
    sInf (v '' ball x ε) < lam ↔ ∃ y ∈ ball x ε, v y < lam := by
  obtain ⟨C, hC⟩ := hb
  have hne : (v '' ball x ε).Nonempty := ⟨v x, x, mem_ball_self hε, rfl⟩
  have hbdd : BddBelow (v '' ball x ε) :=
    ⟨-C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hC y)).1⟩
  constructor
  · intro h
    by_contra hcon
    push Not at hcon
    exact absurd (le_csInf hne (by rintro a ⟨y, hy, rfl⟩; exact hcon y hy))
      (not_le.2 h)
  · rintro ⟨y, hy, hlt⟩
    exact lt_of_le_of_lt (csInf_le hbdd ⟨y, hy, rfl⟩) hlt
theoremisOpen_sSup_ball_gt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $\mathrm{lam} \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\exists C,\ \forall y,\ \lvert v(y)\rvert \le C$ hb

Then IsOpen {x | lam < sSup (v '' Metric.ball x ε)}.

PLaplacian.isOpen_sSup_ball_gtPlaplacian/Measurability.lean, lines 92–103
theorem isOpen_sSup_ball_gt (v : EuclSpace d → ℝ) {ε : ℝ} (hε : 0 < ε)
    (hb : ∃ C, ∀ y, |v y| ≤ C) (lam : ℝ) :
    IsOpen {x : EuclSpace d | lam < sSup (v '' ball x ε)} := by
  have hset : {x : EuclSpace d | lam < sSup (v '' ball x ε)}
      = ⋃ y ∈ {y : EuclSpace d | lam < v y}, ball y ε := by
    ext x
    simp only [Set.mem_ofPred_eq, mem_iUnion, exists_prop]
    rw [sSup_ball_gt_iff v hε hb lam x]
    exact ⟨fun ⟨y, hy, h⟩ => ⟨y, h, by rw [mem_ball] at hy ⊢; rwa [dist_comm]⟩,
           fun ⟨y, h, hy⟩ => ⟨y, by rw [mem_ball] at hy ⊢; rwa [dist_comm], h⟩⟩
  rw [hset]
  exact isOpen_biUnion fun y _ => isOpen_ball
theoremisOpen_sInf_ball_lt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $\mathrm{lam} \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\exists C,\ \forall y,\ \lvert v(y)\rvert \le C$ hb

Then IsOpen {x | sInf (v '' Metric.ball x ε) < lam}.

theorem isOpen_sInf_ball_lt (v : EuclSpace d → ℝ) {ε : ℝ} (hε : 0 < ε)
    (hb : ∃ C, ∀ y, |v y| ≤ C) (lam : ℝ) :
    IsOpen {x : EuclSpace d | sInf (v '' ball x ε) < lam} := by
  have hset : {x : EuclSpace d | sInf (v '' ball x ε) < lam}
      = ⋃ y ∈ {y : EuclSpace d | v y < lam}, ball y ε := by
    ext x
    simp only [Set.mem_ofPred_eq, mem_iUnion, exists_prop]
    rw [sInf_ball_lt_iff v hε hb lam x]
    exact ⟨fun ⟨y, hy, h⟩ => ⟨y, h, by rw [mem_ball] at hy ⊢; rwa [dist_comm]⟩,
           fun ⟨y, h, hy⟩ => ⟨y, by rw [mem_ball] at hy ⊢; rwa [dist_comm], h⟩⟩
  rw [hset]
  exact isOpen_biUnion fun y _ => isOpen_ball
theoremmeasurable_sSup_ballTheorem 1.4 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\exists C,\ \forall y,\ \lvert v(y)\rvert \le C$ hb

Then Measurable fun x => sSup (v '' Metric.ball x ε).

PLaplacian.measurable_sSup_ballPlaplacian/Measurability.lean, lines 120–124
/-- **The supremum over open balls is measurable.** -/
theorem measurable_sSup_ball (v : EuclSpace d → ℝ) {ε : ℝ} (hε : 0 < ε)
    (hb : ∃ C, ∀ y, |v y| ≤ C) :
    Measurable (fun x : EuclSpace d => sSup (v '' ball x ε)) :=
  measurable_of_Ioi fun lam => (isOpen_sSup_ball_gt v hε hb lam).measurableSet
theoremmeasurable_sInf_ballTheorem 1.4 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\exists C,\ \forall y,\ \lvert v(y)\rvert \le C$ hb

Then Measurable fun x => sInf (v '' Metric.ball x ε).

PLaplacian.measurable_sInf_ballPlaplacian/Measurability.lean, lines 126–130
/-- **The infimum over open balls is measurable.** -/
theorem measurable_sInf_ball (v : EuclSpace d → ℝ) {ε : ℝ} (hε : 0 < ε)
    (hb : ∃ C, ∀ y, |v y| ≤ C) :
    Measurable (fun x : EuclSpace d => sInf (v '' ball x ε)) :=
  measurable_of_Iio fun lam => (isOpen_sInf_ball_lt v hε hb lam).measurableSet
theoremsSup_sub_sSup_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $s \subseteq \mathbb{R}^{d}$.

Assume

  • $s\text{ is nonempty}$ hs
  • BddAbove (u '' s) hu
  • BddAbove ((fun y => v y - u y) '' s) hd

Then sSup (v '' s) - sSup (u '' s) ≤ sSup ((fun y => v y - u y) '' s).

/-- `sup v - sup u ≤ sup (v - u)`. -/
theorem sSup_sub_sSup_le (u v : EuclSpace d → ℝ) (s : Set (EuclSpace d))
    (hs : s.Nonempty) (hu : BddAbove (u '' s))
    (hd : BddAbove ((fun y => v y - u y) '' s)) :
    sSup (v '' s) - sSup (u '' s) ≤ sSup ((fun y => v y - u y) '' s) := by
  rw [sub_le_iff_le_add]
  refine csSup_le (hs.image v) ?_
  rintro a ⟨y, hy, rfl⟩
  have h1 : v y - u y ≤ sSup ((fun y => v y - u y) '' s) :=
    le_csSup hd ⟨y, hy, rfl⟩
  have h2 : u y ≤ sSup (u '' s) := le_csSup hu ⟨y, hy, rfl⟩
  linarith
theoremsInf_sub_sInf_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $s \subseteq \mathbb{R}^{d}$.

Assume

  • $s\text{ is nonempty}$ hs
  • BddBelow (v '' s) hv
  • BddAbove ((fun y => v y - u y) '' s) hd

Then sInf (v '' s) - sInf (u '' s) ≤ sSup ((fun y => v y - u y) '' s).

/-- `inf v - inf u ≤ sup (v - u)`. -/
theorem sInf_sub_sInf_le (u v : EuclSpace d → ℝ) (s : Set (EuclSpace d))
    (hs : s.Nonempty) (hv : BddBelow (v '' s))
    (hd : BddAbove ((fun y => v y - u y) '' s)) :
    sInf (v '' s) - sInf (u '' s) ≤ sSup ((fun y => v y - u y) '' s) := by
  rw [sub_le_iff_le_add, ← sub_le_iff_le_add']
  refine le_csInf (hs.image u) ?_
  rintro a ⟨y, hy, rfl⟩
  have h1 : v y - u y ≤ sSup ((fun y => v y - u y) '' s) :=
    le_csSup hd ⟨y, hy, rfl⟩
  have h2 : sInf (v '' s) ≤ v y := csInf_le hv ⟨y, hy, rfl⟩
  linarith

Plaplacian/MinCmp.lean2 declarations

theoremdpp_comparison_local_min
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφ
  • $y \in \Omega$ hy
  • $\forall w \in B(y, \varepsilon),\ c \le u(w) - \varphi(w)$ hge
  • $u(y) - \varphi(y) = c$ heq

Then $T_{\varepsilon} \varphi(y) \le \varphi(y)$.

PLaplacian.dpp_comparison_local_minPlaplacian/MinCmp.lean, lines 51–72
/-- **The comparison at a minimum.** -/
theorem dpp_comparison_local_min {p ε : ℝ} (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφ : BddMeas φ)
    {y : EuclSpace d} (hy : y ∈ Ω) {c : ℝ}
    (hge : ∀ w ∈ ball y ε, c ≤ u w - φ w) (heq : u y - φ y = c) :
    tugOfWarOp p ε φ y ≤ φ y := by
  -- φ + c ≤ u on the ball
  have hup : ∀ w ∈ ball y ε, φ w + c ≤ u w := by
    intro w hw
    linarith [hge w hw]
  have hψ : BddMeas (fun w => φ w + c) := bddMeas_add_const hφ c
  -- monotonicity, the other way round
  have hmono : tugOfWarOp p ε (fun w => φ w + c) y
      ≤ tugOfWarOp p ε u y :=
    tugOfWarOp_mono_ball p ε hp hε hpd hψ hu.bddMeas y hup
  rw [tugOfWarOp_add_const p ε hε hφ c y hpd] at hmono
  rw [← hu.interior y hy] at hmono
  have huy : u y = φ y + c := by linarith [heq]
  rw [huy] at hmono
  linarith [hmono]
theoremdpp_comparison_local_min'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφ
  • $y \in \Omega$ hy
  • $\forall w \in B(y, \varepsilon),\ u(y) - \varphi(y) \le u(w) - \varphi(w)$ hge

Then $T_{\varepsilon} \varphi(y) \le \varphi(y)$.

PLaplacian.dpp_comparison_local_min'Plaplacian/MinCmp.lean, lines 74–82
/-- The version needing no separate equality. -/
theorem dpp_comparison_local_min' {p ε : ℝ} (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφ : BddMeas φ)
    {y : EuclSpace d} (hy : y ∈ Ω)
    (hge : ∀ w ∈ ball y ε, u y - φ y ≤ u w - φ w) :
    tugOfWarOp p ε φ y ≤ φ y :=
  dpp_comparison_local_min hp hε hpd hu hφ hy hge rfl

Plaplacian/NearFreq.lean2 declarations

theoremeventually_cube_lt
Formal statementgenerated from the Lean declaration

Let $\tau \in \mathbb{R}$.

Assume

  • $0 < \tau$ hτ

Then ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), ε ^ 3 < τ.

PLaplacian.eventually_cube_ltPlaplacian/NearFreq.lean, lines 53–59
/-- The cube of the parameter is eventually below any positive bound. -/
theorem eventually_cube_lt {τ : ℝ} (hτ : 0 < τ) :
    ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), ε ^ 3 < τ := by
  have hc : Filter.Tendsto (fun ε : ℝ => ε ^ 3) (nhds 0) (nhds 0) := by
    have h := (continuous_pow 3).tendsto (0 : ℝ)
    simpa using h
  exact (hc.mono_left nhdsWithin_le_nhds).eventually (eventually_lt_nhds hτ)
theoremnearmax_frequently_in_ballTheorem 4.4 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r, \rho \in \mathbb{R}$, $y \colon \mathbb{R} \to \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < r$ hr
  • $0 < \rho$ hρ
  • $\operatorname{IsStrictMaxOn}(w \mapsto \overline{u}(w) - \varphi(w), x_{0}, r)$ hstrict
  • $\forall \varepsilon > 0,\ y_{\varepsilon} \in \overline{B}(x_{0}, r) \wedge \operatorname{supBall}(u, \varphi, x_{0}, r, \varepsilon) - \varepsilon ^{3} < u_{\varepsilon}(y_{\varepsilon}) - \varphi(y_{\varepsilon})$ hy

Then ∃ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), y ε ∈ Metric.ball x₀ ρ.

PLaplacian.nearmax_frequently_in_ballPlaplacian/NearFreq.lean, lines 61–95
/-- **The near-maximizer is frequently within any radius of the base
point.** -/
theorem nearmax_frequently_in_ball (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    {x₀ : EuclSpace d} {r ρ : ℝ} (hr : 0 < r) (hρ : 0 < ρ)
    (hstrict : IsStrictMaxOn (fun w => ubar u w - φ w) x₀ r)
    (y : ℝ → EuclSpace d)
    (hy : ∀ ε > 0, y ε ∈ closedBall x₀ r ∧
      supBall u φ x₀ r ε - ε ^ 3 < u ε (y ε) - φ (y ε)) :
    ∃ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), y ε ∈ ball x₀ ρ := by
  -- the gap on the annulus
  obtain ⟨η, hη, hgap⟩ := annulus_gap u hC hφ hρ hstrict
  set M := ubar u x₀ - φ x₀ with hM
  -- the family below M - η/2 on the annulus, eventually
  have hgap' : ∀ w ∈ annulus x₀ ρ r, ubar u w - φ w < M - η / 2 := by
    intro w hw; have := hgap w hw; linarith [this, hη]
  obtain ⟨S, hS, hbdS⟩ := uniform_bound_annulus u hC hφ hB hgap'
  -- the supremum frequently above M - η/4
  have hsup := frequently_supBall_large u hC hφ hB x₀ hr
    (by linarith : (0:ℝ) < η / 4)
  -- the cube eventually below η/4, and the parameter positive
  have hcube := eventually_cube_lt (by linarith : (0:ℝ) < η / 4)
  have hpos : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), 0 < ε :=
    self_mem_nhdsWithin
  -- combine
  have hev : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      ε ∈ S ∧ ε ^ 3 < η / 4 ∧ 0 < ε :=
    ((show ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), ε ∈ S from hS).and
      (hcube.and hpos))
  refine (hsup.and_eventually hev).mono ?_
  rintro ε ⟨hsupε, hεS, hεcube, hεpos⟩
  obtain ⟨hmem, hnear⟩ := hy ε hεpos
  refine nearmax_in_ball (hbdS ε hεS) hmem hnear ?_
  linarith [hsupε, hεcube]

Plaplacian/NearMin.lean1 declarations

theoremfrequently_near_min
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < \delta$ hδ

Then ∃ᶠ (q : ℝ × EuclSpace d) in PLaplacian.relaxFilter x, u q.1 q.2 - φ q.2 < PLaplacian.lbar u x - φ x + δ.

PLaplacian.frequently_near_minPlaplacian/NearMin.lean, lines 46–59
/-- **Frequent near-minimum.** -/
theorem frequently_near_min (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    (x : EuclSpace d) {δ : ℝ} (hδ : 0 < δ) :
    ∃ᶠ q in relaxFilter x,
      u q.1 q.2 - φ q.2 < lbar u x - φ x + δ := by
  -- the bound in terms of the difference's lower limit
  have hbd := abs_sub_le_of_bounds u hC hB
  have heq := lbar_sub u hC hφ hB x
  have hlt : lbar (fun ε y => u ε y - φ y) x
      < lbar u x - φ x + δ := by
    rw [heq]; linarith [hδ]
  exact frequently_gt_of_lbar_lt (fun ε y => u ε y - φ y) hbd x hlt

Plaplacian/NearSup.lean3 declarations

theoremexists_near_sup
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s \subseteq \mathbb{R}^{d}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $\tau \in \mathbb{R}$.

Assume

  • $s\text{ is nonempty}$ hs
  • BddAbove (f '' s) _hbdd
  • $0 < \tau$ hτ

Then there exists $y \in s$ such that:

  • sSup ( f '' s ) - τ < f y
PLaplacian.exists_near_supPlaplacian/NearSup.lean, lines 72–81
/-- **A near-maximizer at any tolerance.** For a function bounded above on a
nonempty set, some point of the set has value within any tolerance of the
supremum. -/
theorem exists_near_sup {s : Set (EuclSpace d)} (hs : s.Nonempty)
    {f : EuclSpace d → ℝ} (_hbdd : BddAbove (f '' s)) {τ : ℝ} (hτ : 0 < τ) :
    ∃ y ∈ s, sSup (f '' s) - τ < f y := by
  have hne : (f '' s).Nonempty := hs.image f
  have hlt : sSup (f '' s) - τ < sSup (f '' s) := by linarith
  obtain ⟨_, ⟨y, hy, rfl⟩, hval⟩ := exists_lt_of_lt_csSup hne hlt
  exact ⟨y, hy, hval⟩
theoremexists_near_sup_cubeTheorem 4.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r \in \mathbb{R}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < r$ hr
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x_{0}, r)$ such that:

  • sSup ( ( fun w => u ε w - φ w ) '' Metric.closedBall x₀ r ) - ε ^ 3 < u ε y - φ y
PLaplacian.exists_near_sup_cubePlaplacian/NearSup.lean, lines 83–102
/-- **The near-maximizer at tolerance `ε³`**, for the family on a closed ball.

The tolerance depends on the parameter, which is exactly what the earlier
set-up could not provide. -/
theorem exists_near_sup_cube (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ} {B : ℝ}
    (hB : ∀ y, |φ y| ≤ B) (x₀ : EuclSpace d) {r : ℝ} (hr : 0 < r)
    {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x₀ r,
      sSup ((fun w => u ε w - φ w) '' closedBall x₀ r) - ε ^ 3
        < u ε y - φ y := by
  have hs : (closedBall x₀ r).Nonempty := ⟨x₀, mem_closedBall_self hr.le⟩
  have hbdd : BddAbove ((fun w => u ε w - φ w) '' closedBall x₀ r) := by
    refine ⟨C + B, ?_⟩
    rintro a ⟨w, _, rfl⟩
    have h1 := abs_le.1 (hC ε w)
    have h2 := abs_le.1 (hB w)
    linarith [h1.2, h2.1]
  have hτ : (0:ℝ) < ε ^ 3 := by positivity
  exact exists_near_sup hs hbdd hτ
theoremle_sup_on_ballTheorem 4.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r, \varepsilon \in \mathbb{R}$, $w \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $w \in \overline{B}(x_{0}, r)$ a._@._internal._hyg.0

Then u ε w - φ w ≤ sSup ((fun w => u ε w - φ w) '' Metric.closedBall x₀ r).

/-- The family minus the test function is bounded by its supremum on the
ball, which is the comparison's first hypothesis. -/
theorem le_sup_on_ball (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ} {B : ℝ}
    (hB : ∀ y, |φ y| ≤ B) (x₀ : EuclSpace d) {r ε : ℝ} :
    ∀ w ∈ closedBall x₀ r,
      u ε w - φ w ≤ sSup ((fun w => u ε w - φ w) '' closedBall x₀ r) := by
  intro w hw
  have hbdd : BddAbove ((fun w => u ε w - φ w) '' closedBall x₀ r) := by
    refine ⟨C + B, ?_⟩
    rintro a ⟨v, _, rfl⟩
    have h1 := abs_le.1 (hC ε v)
    have h2 := abs_le.1 (hB v)
    linarith [h1.2, h2.1]
  exact le_csSup hbdd ⟨w, hw, rfl⟩

Plaplacian/NegOp.lean3 declarations

theorembddMeas_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then PLaplacian.BddMeas fun y => -v y.

/-- Negation preserves the admissible class. -/
theorem bddMeas_neg {v : EuclSpace d → ℝ} (hv : BddMeas v) :
    BddMeas (fun y => -v y) := by
  obtain ⟨B, hB⟩ := hv.bound
  refine ⟨hv.meas.neg, ⟨B, fun y => ?_⟩⟩
  rw [abs_neg]; exact hB y
theoremtugOfWarOp_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $T_{\varepsilon} y \mapsto - v(y)(x) = - T_{\varepsilon} v(x)$.

PLaplacian.tugOfWarOp_negPlaplacian/NegOp.lean, lines 49–63
/-- **The operator is odd.** -/
theorem tugOfWarOp_neg (p ε : ℝ) (v : EuclSpace d → ℝ) (x : EuclSpace d) :
    tugOfWarOp p ε (fun y => -v y) x = - tugOfWarOp p ε v x := by
  rw [tugOfWarOp_eq, tugOfWarOp_eq]
  have hs : sSup ((fun y => -v y) '' ball x ε) = - sInf (v '' ball x ε) := by
    have := sInf_eq_neg_sSup v (ball x ε)
    linarith
  have hi : sInf ((fun y => -v y) '' ball x ε) = - sSup (v '' ball x ε) := by
    have := sInf_eq_neg_sSup (fun y => -v y) (ball x ε)
    simp only [neg_neg] at this
    exact this
  have ha : (⨍ y in ball x ε, -v y) = - ⨍ y in ball x ε, v y :=
    MeasureTheory.average_neg _ v
  rw [hs, hi, ha]
  ring
theoremisPHarmonious_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, v \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $v\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hv

Then PLaplacian.IsPHarmonious p ε Ω (fun y => -F y) fun y => -v y.

PLaplacian.isPHarmonious_negPlaplacian/NegOp.lean, lines 65–72
/-- **The negated family is `p`-harmonious**, with negated data. -/
theorem isPHarmonious_neg {p ε : ℝ} {Ω : Set (EuclSpace d)}
    {F v : EuclSpace d → ℝ} (hv : IsPHarmonious p ε Ω F v) :
    IsPHarmonious p ε Ω (fun y => -F y) (fun y => -v y) := by
  refine ⟨bddMeas_neg hv.bddMeas, fun x hx => ?_, fun x hx => ?_⟩
  · rw [tugOfWarOp_neg, ← hv.interior x hx]
  · show -v x = -F x
    rw [hv.boundary x hx]

Plaplacian/NullImage.lean3 declarations

theoremnull_image_cle
Formal statementgenerated from the Lean declaration

Let $E$ be a type, $F$ be a type, $\mu \in \operatorname{Measure}(E)$, $\nu \in \operatorname{Measure}(F)$, L : E ≃L[ℝ] F, $s \subseteq E$.

Assume

  • $\operatorname{NormedAddCommGroup}(E)$
  • $\operatorname{NormedSpace}(\mathbb{R}, E)$
  • $\operatorname{MeasurableSpace}(E)$
  • $\operatorname{BorelSpace}(E)$
  • $\operatorname{FiniteDimensional}(\mathbb{R}, E)$
  • $\operatorname{NormedAddCommGroup}(F)$
  • $\operatorname{NormedSpace}(\mathbb{R}, F)$
  • $\operatorname{MeasurableSpace}(F)$
  • $\operatorname{BorelSpace}(F)$
  • $\operatorname{FiniteDimensional}(\mathbb{R}, F)$
  • $\mathrm{μ.IsAddHaarMeasure}$
  • $\mathrm{ν.IsAddHaarMeasure}$
  • $\mu(s) = 0$ hs

Then ν (⇑L '' s) = 0.

/-- **A continuous linear equivalence sends null sets to null sets**, for Haar
measures on finite-dimensional spaces. -/
theorem null_image_cle {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
    [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E]
    [NormedAddCommGroup F] [NormedSpace ℝ F] [MeasurableSpace F] [BorelSpace F]
    [FiniteDimensional ℝ F] (μ : Measure E) [μ.IsAddHaarMeasure]
    (ν : Measure F) [ν.IsAddHaarMeasure] (L : E ≃L[ℝ] F) {s : Set E}
    (hs : μ s = 0) : ν (L '' s) = 0 := by
  have : (Measure.map L μ).IsAddHaarMeasure := L.isAddHaarMeasure_map μ
  have hac : ν ≪ Measure.map L μ :=
    Measure.absolutelyContinuous_isAddHaarMeasure ν (Measure.map L μ)
  refine hac ?_
  have e := L.toHomeomorph.toMeasurableEquiv.map_apply (μ := μ) (L '' s)
  have hcoe : (⇑(L.toHomeomorph.toMeasurableEquiv) : E → F) = ⇑L := rfl
  rw [hcoe] at e
  rw [e, Set.preimage_image_eq _ L.injective]
  exact hs
theoremnull_image_pi_lipschitz
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $g \colon (\operatorname{Fin}(d) \to \mathbb{R}) \to \operatorname{Fin}(d) \to \mathbb{R}$, $K \in \mathrm{NNReal}$, $A \subseteq (\operatorname{Fin}(d) \to \mathbb{R})$.

Assume

  • $\operatorname{LipschitzWith}(K, g)$ hg
  • $\lambda(A) = 0$ hA

Then MeasureTheory.volume (g '' A) = 0.

PLaplacian.null_image_pi_lipschitzPlaplacian/NullImage.lean, lines 55–64
/-- **On `Fin d → ℝ`, a Lipschitz map sends null sets to null sets.** -/
theorem null_image_pi_lipschitz {g : (Fin d → ℝ) → (Fin d → ℝ)} {K : NNReal}
    (hg : LipschitzWith K g) {A : Set (Fin d → ℝ)} (hA : volume A = 0) :
    volume (g '' A) = 0 := by
  have hH := hausdorffMeasure_pi_real (ι := Fin d)
  simp only [Fintype.card_fin] at hH
  rw [← hH] at hA ⊢
  have h := hg.hausdorffMeasure_image_le (d := (d : ℝ)) (Nat.cast_nonneg d) A
  rw [hA, mul_zero] at h
  exact le_antisymm h zero_le
theoremlipschitz_image_null
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $J \colon \mathbb{R}^{d} \to \mathbb{R}^{d}$, $K \in \mathrm{NNReal}$, $N \subseteq \mathbb{R}^{d}$.

Assume

  • $\operatorname{LipschitzWith}(K, J)$ hJ
  • $\lambda(N) = 0$ hN

Then MeasureTheory.volume (J '' N) = 0.

PLaplacian.lipschitz_image_nullPlaplacian/NullImage.lean, lines 66–86
/-- **A Lipschitz map of `EuclSpace d` sends null sets to null sets.** -/
theorem lipschitz_image_null {J : EuclSpace d → EuclSpace d} {K : NNReal}
    (hJ : LipschitzWith K J) {N : Set (EuclSpace d)}
    (hN : volume N = 0) : volume (J '' N) = 0 := by
  set L := EuclideanSpace.equiv (Fin d) ℝ with hLdef
  have hLN : volume (L '' N) = 0 := null_image_cle volume volume L hN
  have hLL : LipschitzWith ‖(L : EuclSpace d →L[ℝ] (Fin d → ℝ))‖₊ L :=
    (L : EuclSpace d →L[ℝ] (Fin d → ℝ)).lipschitzWith
  have hLs : LipschitzWith ‖(L.symm : (Fin d → ℝ) →L[ℝ] EuclSpace d)‖₊ L.symm :=
    (L.symm : (Fin d → ℝ) →L[ℝ] EuclSpace d).lipschitzWith
  have hg := hLL.comp (hJ.comp hLs)
  have h1 := null_image_pi_lipschitz hg hLN
  have himg : (⇑L ∘ (J ∘ ⇑L.symm)) '' (L '' N) = L '' (J '' N) := by
    rw [Set.image_image, Set.image_image]
    congr 1
  rw [himg] at h1
  have h2 := null_image_cle volume volume L.symm h1
  have e : L.symm '' (L '' (J '' N)) = J '' N := by
    rw [Set.image_image]
    simp
  rwa [e] at h2

Plaplacian/OneDim.lean3 declarations

theoremnorm_iteratedFDeriv_eq_norm_iteratedDeriv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $g \colon \mathbb{R} \to \mathbb{R}^{d}$, $n \in \mathbb{N}$, $t \in \mathbb{R}$.

Then $\lVert \operatorname{iteratedFDeriv}(\mathbb{R}, n, g, t)\rVert = \lVert \operatorname{iteratedDeriv}(n, g, t)\rVert$.

PLaplacian.norm_iteratedFDeriv_eq_norm_iteratedDerivPlaplacian/OneDim.lean, lines 42–47
/-- The norms agree, the equivalence being an isometry. -/
theorem norm_iteratedFDeriv_eq_norm_iteratedDeriv (g : ℝ → EuclSpace d)
    (n : ℕ) (t : ℝ) :
    ‖iteratedFDeriv ℝ n g t‖ = ‖iteratedDeriv n g t‖ := by
  rw [iteratedFDeriv_eq_equiv_comp]
  exact LinearIsometryEquiv.norm_map _ _
theoremnorm_iteratedFDeriv_eq_abs_iteratedDeriv
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $n \in \mathbb{N}$, $t \in \mathbb{R}$.

Then $\lVert \operatorname{iteratedFDeriv}(\mathbb{R}, n, g, t)\rVert = \lvert \operatorname{iteratedDeriv}(n, g, t)\rvert$.

PLaplacian.norm_iteratedFDeriv_eq_abs_iteratedDerivPlaplacian/OneDim.lean, lines 49–55
/-- The scalar version, which is what we need. -/
theorem norm_iteratedFDeriv_eq_abs_iteratedDeriv (g : ℝ → ℝ) (n : ℕ)
    (t : ℝ) :
    ‖iteratedFDeriv ℝ n g t‖ = |iteratedDeriv n g t| := by
  rw [iteratedFDeriv_eq_equiv_comp, Function.comp_apply,
      LinearIsometryEquiv.norm_map]
  exact Real.norm_eq_abs _
theoremiteratedDeriv_three
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Then $\operatorname{iteratedDeriv}(3, g) = \operatorname{deriv}(\operatorname{deriv}(\operatorname{deriv}(g)))$.

PLaplacian.iteratedDeriv_threePlaplacian/OneDim.lean, lines 57–63
/-- `iteratedDeriv 3` as iterated `deriv`. -/
theorem iteratedDeriv_three (g : ℝ → ℝ) :
    iteratedDeriv 3 g = deriv (deriv (deriv g)) := by
  rw [show (3 : ℕ) = 2 + 1 from rfl, iteratedDeriv_succ,
      show (2 : ℕ) = 1 + 1 from rfl, iteratedDeriv_succ,
      show (1 : ℕ) = 0 + 1 from rfl, iteratedDeriv_succ,
      iteratedDeriv_zero]

Plaplacian/OpBounded.lean1 declarations

theoremtugOfWarOp_expansion_boundedTheorem 3.11 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $e_{1}, e_{2}, B_{1}, B_{2} \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • (sSup (φ '' Metric.ball x ε) + sInf (φ '' Metric.ball x ε)) / 2 = φ x + ε ^ 2 / 2 * PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) + e₁ hS
  • $\fint_{B(x, \varepsilon)} (\varphi(y) = \varphi(x) + \varepsilon ^{2} / (2 \cdot (d + 2)) \cdot \operatorname{laplacianOf}(\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)) + e_{2}) \, dy$ hA
  • $\lvert e_{1}\rvert \le B_{1}$ hB₁
  • $\lvert e_{2}\rvert \le B_{2}$ hB₂

Then there exists $E$ such that:

  • $T_{\varepsilon} \varphi(x) = \varphi(x) + \varepsilon ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)) + E$
  • $\lvert E\rvert \le B_{1} + B_{2}$
PLaplacian.tugOfWarOp_expansion_boundedPlaplacian/OpBounded.lean, lines 47–72
/-- **The expansion with a bounded error.**

Given the two halves with their errors bounded by `B₁` and `B₂`, the operator
expands with total error at most `B₁ + B₂`. -/
theorem tugOfWarOp_expansion_bounded (p : ℝ) (hp : 2 ≤ p)
    (hpd : 0 < p + (d : ℝ)) (ε : ℝ) (φ : EuclSpace d → ℝ)
    (x : EuclSpace d) {e₁ e₂ B₁ B₂ : ℝ}
    (hS : (sSup (φ '' ball x ε) + sInf (φ '' ball x ε)) / 2
        = φ x + (ε ^ 2 / 2)
            * infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) + e₁)
    (hA : (⨍ y in ball x ε, φ y)
        = φ x + ε ^ 2 / (2 * ((d : ℝ) + 2))
            * laplacianOf (fderiv ℝ (fderiv ℝ φ) x) + e₂)
    (hB₁ : |e₁| ≤ B₁) (hB₂ : |e₂| ≤ B₂) :
    ∃ E : ℝ,
      tugOfWarOp p ε φ x
          = φ x + ε ^ 2 / (2 * (p + (d : ℝ)))
              * normPLapOf p (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) + E
        ∧ |E| ≤ B₁ + B₂ := by
  refine ⟨(p - 2) / (p + (d : ℝ)) * e₁
    + ((d : ℝ) + 2) / (p + (d : ℝ)) * e₂, ?_, ?_⟩
  · exact tugOfWarOp_expansion_normPLap p hpd ε φ x hS hA
  · calc |(p - 2) / (p + (d : ℝ)) * e₁
            + ((d : ℝ) + 2) / (p + (d : ℝ)) * e₂|
        ≤ |e₁| + |e₂| := weighted_error_le p hp hpd e₁ e₂
      _ ≤ B₁ + B₂ := by linarith [hB₁, hB₂]

Plaplacian/OpCont.lean2 declarations

theoremcontinuous_gradient
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then Continuous fun y => gradient φ y.

PLaplacian.continuous_gradientPlaplacian/OpCont.lean, lines 52–61
/-- The gradient is continuous for a `C²` function. -/
theorem continuous_gradient {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ) :
    Continuous (fun y => gradient φ y) := by
  have hf : Continuous (fun y => fderiv ℝ φ y) :=
    hφ.continuous_fderiv (by norm_num)
  have hiso : Continuous
      (fun L : StrongDual ℝ (EuclSpace d) =>
        (InnerProductSpace.toDual ℝ (EuclSpace d)).symm L) :=
    (InnerProductSpace.toDual ℝ (EuclSpace d)).symm.continuous
  exact hiso.comp hf
theoremcontinuousAt_gradDir
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hx

Then $\operatorname{ContinuousAt}(y \mapsto \operatorname{gradDir}(\varphi, y), x_{0})$.

PLaplacian.continuousAt_gradDirPlaplacian/OpCont.lean, lines 63–74
/-- The normalized gradient is continuous away from the singular set. -/
theorem continuousAt_gradDir {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    {x₀ : EuclSpace d} (hx : gradient φ x₀ ≠ 0) :
    ContinuousAt (fun y => gradDir φ y) x₀ := by
  have hg : ContinuousAt (fun y => gradient φ y) x₀ :=
    (continuous_gradient hφ).continuousAt
  have hn : ContinuousAt (fun y => ‖gradient φ y‖) x₀ := hg.norm
  have hne : ‖gradient φ x₀‖ ≠ 0 := norm_ne_zero_iff.2 hx
  have hinv : ContinuousAt (fun y => ‖gradient φ y‖⁻¹) x₀ :=
    hn.inv₀ hne
  unfold gradDir
  exact hinv.smul hg

Plaplacian/OpContFull.lean3 declarations

theoremcontinuousAt_laplacianOf
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then $\operatorname{ContinuousAt}(y \mapsto \operatorname{laplacianOf}(\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)), x_{0})$.

PLaplacian.continuousAt_laplacianOfPlaplacian/OpContFull.lean, lines 50–58
/-- The Laplacian is continuous in the base point. -/
theorem continuousAt_laplacianOf {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 2 φ) (x₀ : EuclSpace d) :
    ContinuousAt (fun y => laplacianOf (fderiv ℝ (fderiv ℝ φ) y)) x₀ := by
  have hH : Continuous (fun y => fderiv ℝ (fderiv ℝ φ) y) :=
    continuous_hess hφ
  unfold laplacianOf
  refine (continuous_finsetSum _ fun i _ => ?_).continuousAt
  exact (hH.clm_apply continuous_const).clm_apply continuous_const
theoremcontinuousAt_infLaplacianOf
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hx

Then $\operatorname{ContinuousAt}(y \mapsto \operatorname{infLaplacianOf}(\operatorname{gradient}(\varphi, y), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)), x_{0})$.

PLaplacian.continuousAt_infLaplacianOfPlaplacian/OpContFull.lean, lines 60–75
/-- The infinity Laplacian is continuous away from the singular set. -/
theorem continuousAt_infLaplacianOf {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 2 φ) {x₀ : EuclSpace d} (hx : gradient φ x₀ ≠ 0) :
    ContinuousAt (fun y => infLaplacianOf (gradient φ y)
      (fderiv ℝ (fderiv ℝ φ) y)) x₀ := by
  have hH : ContinuousAt (fun y => fderiv ℝ (fderiv ℝ φ) y) x₀ :=
    (continuous_hess hφ).continuousAt
  have hd : ContinuousAt (fun y => gradDir φ y) x₀ :=
    continuousAt_gradDir hφ hx
  unfold infLaplacianOf
  have hdir : ContinuousAt
      (fun y => ‖gradient φ y‖⁻¹ • gradient φ y) x₀ := by
    have := continuousAt_gradDir hφ hx
    unfold gradDir at this
    exact this
  exact (hH.clm_apply hdir).clm_apply hdir
theoremnormPLapOf_continuousAt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hx

Then $\operatorname{ContinuousAt}(y \mapsto \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, y), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)), x_{0})$.

PLaplacian.normPLapOf_continuousAtPlaplacian/OpContFull.lean, lines 77–84
/-- **The operator is continuous away from the singular set.** -/
theorem normPLapOf_continuousAt {p : ℝ} {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 2 φ) {x₀ : EuclSpace d} (hx : gradient φ x₀ ≠ 0) :
    ContinuousAt (fun y => normPLapOf p (gradient φ y)
      (fderiv ℝ (fderiv ℝ φ) y)) x₀ := by
  unfold normPLapOf
  exact (continuousAt_laplacianOf hφ x₀).add
    (continuousAt_const.mul (continuousAt_infLaplacianOf hφ hx))

Plaplacian/OpEst.lean8 declarations

theoremnormPLapOf_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $A, Y \in \operatorname{Bilin}(d)$, $q \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $\operatorname{QuadLE}(A, Y)$ h

Then $\operatorname{normPLapOf}(p, q, A) \le \operatorname{normPLapOf}(p, q, Y)$.

PLaplacian.normPLapOf_monoPlaplacian/OpEst.lean, lines 38–46
/-- **Ellipticity.** -/
theorem normPLapOf_mono {p : ℝ} (hp : 2 ≤ p) {A Y : Bilin d} (h : QuadLE A Y)
    (q : EuclSpace d) : normPLapOf p q A ≤ normPLapOf p q Y := by
  unfold normPLapOf infLaplacianOf laplacianOf
  have h1 : ∑ i : Fin d, (A (EuclideanSpace.single i (1 : ℝ))) (EuclideanSpace.single i 1)
      ≤ ∑ i : Fin d, (Y (EuclideanSpace.single i (1 : ℝ))) (EuclideanSpace.single i 1) :=
    Finset.sum_le_sum fun i _ => h _
  have h2 := mul_le_mul_of_nonneg_left (h (‖q‖⁻¹ • q)) (by linarith : (0 : ℝ) ≤ p - 2)
  linarith
theoremnormPLapOf_add_id
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, $Y \in \operatorname{Bilin}(d)$, $c \in \mathbb{R}$.

Assume

  • $q \ne 0$ hq

Then $\operatorname{normPLapOf}(p, q, Y + c \cdot \operatorname{idForm}(d)) = \operatorname{normPLapOf}(p, q, Y) + c \cdot (d + p - 2)$.

PLaplacian.normPLapOf_add_idPlaplacian/OpEst.lean, lines 48–58
/-- **Adding a multiple of the identity.** -/
theorem normPLapOf_add_id {p : ℝ} {q : EuclSpace d} (hq : q ≠ 0) (Y : Bilin d) (c : ℝ) :
    normPLapOf p q (Y + c • idForm d) = normPLapOf p q Y + c * ((d : ℝ) + p - 2) := by
  have hqn : 0 < ‖q‖ := norm_pos_iff.2 hq
  unfold normPLapOf infLaplacianOf
  rw [laplacianOf_add, laplacianOf_smul, laplacianOf_idForm, add_apply, add_apply,
    smul_apply, smul_apply, smul_eq_mul, idForm_apply]
  have h1 : ‖‖q‖⁻¹ • q‖ ^ 2 = 1 := by
    rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ hqn.ne', one_pow]
  rw [h1]
  ring
theoremunit_sub_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $a, b \in \mathbb{R}^{d}$.

Assume

  • $a \ne 0$ ha
  • $b \ne 0$ hb

Then ‖‖a‖⁻¹ • a - ‖b‖⁻¹ • b‖ ≤ 2 * ‖a - b‖ / ‖b‖.

/-- **Unit vectors in nearby directions are close.** -/
theorem unit_sub_le {a b : EuclSpace d} (ha : a ≠ 0) (hb : b ≠ 0) :
    ‖‖a‖⁻¹ • a - ‖b‖⁻¹ • b‖ ≤ 2 * ‖a - b‖ / ‖b‖ := by
  have hna : 0 < ‖a‖ := norm_pos_iff.2 ha
  have hnb : 0 < ‖b‖ := norm_pos_iff.2 hb
  have e : ‖a‖⁻¹ • a - ‖b‖⁻¹ • b = (‖a‖⁻¹ - ‖b‖⁻¹) • a + ‖b‖⁻¹ • (a - b) := by
    rw [sub_smul, smul_sub]; abel
  rw [e]
  have k1 : ‖(‖a‖⁻¹ - ‖b‖⁻¹) • a‖ = |‖b‖ - ‖a‖| / ‖b‖ := by
    rw [norm_smul, Real.norm_eq_abs]
    have : ‖a‖⁻¹ - ‖b‖⁻¹ = (‖b‖ - ‖a‖) / (‖a‖ * ‖b‖) := by field_simp
    rw [this, abs_div, abs_of_pos (mul_pos hna hnb)]
    field_simp
  have k2 : ‖‖b‖⁻¹ • (a - b)‖ = ‖a - b‖ / ‖b‖ := by
    rw [norm_smul, norm_inv, norm_norm]
    field_simp
  have k3 : |‖b‖ - ‖a‖| ≤ ‖a - b‖ := by
    rw [abs_sub_comm]; exact abs_norm_sub_norm_le a b
  calc ‖(‖a‖⁻¹ - ‖b‖⁻¹) • a + ‖b‖⁻¹ • (a - b)‖
      ≤ ‖(‖a‖⁻¹ - ‖b‖⁻¹) • a‖ + ‖‖b‖⁻¹ • (a - b)‖ := norm_add_le _ _
    _ = |‖b‖ - ‖a‖| / ‖b‖ + ‖a - b‖ / ‖b‖ := by rw [k1, k2]
    _ ≤ ‖a - b‖ / ‖b‖ + ‖a - b‖ / ‖b‖ := by
        gcongr
    _ = 2 * ‖a - b‖ / ‖b‖ := by ring
theoremquad_unit_diff
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $Y \in \operatorname{Bilin}(d)$, $L \in \mathbb{R}$, $e, f \in \mathbb{R}^{d}$.

Assume

  • $0 \le L$ hL
  • $\forall v,\ \lvert (Y(v))(v)\rvert \le L \cdot \lVert v\rVert ^{2}$ hY
  • $\lVert e\rVert = 1$ he
  • $\lVert f\rVert = 1$ hf

Then $\lvert (Y(e))(e) - (Y(f))(f)\rvert \le 2 \cdot L \cdot \lVert e - f\rVert$.

PLaplacian.quad_unit_diffPlaplacian/OpEst.lean, lines 85–101
/-- **The quadratic form at nearby unit vectors.** -/
theorem quad_unit_diff {Y : Bilin d} {L : ℝ} (hL : 0 ≤ L)
    (hY : ∀ v, |(Y v) v| ≤ L * ‖v‖ ^ 2) {e f : EuclSpace d} (he : ‖e‖ = 1) (hf : ‖f‖ = 1) :
    |(Y e) e - (Y f) f| ≤ 2 * L * ‖e - f‖ := by
  rw [← symmForm_apply_self Y e, ← symmForm_apply_self Y f]
  have key : (symmForm Y e) e - (symmForm Y f) f
      = (symmForm Y (e - f)) e + (symmForm Y f) (e - f) := by
    rw [map_sub, sub_apply, map_sub]; ring
  rw [key]
  have h1 := symmForm_le_mul hL hY (e - f) e
  have h2 := symmForm_le_mul hL hY f (e - f)
  rw [he] at h1
  rw [hf] at h2
  calc |(symmForm Y (e - f)) e + (symmForm Y f) (e - f)|
      ≤ |(symmForm Y (e - f)) e| + |(symmForm Y f) (e - f)| := abs_add_le _ _
    _ ≤ L * ‖e - f‖ * 1 + L * 1 * ‖e - f‖ := add_le_add h1 h2
    _ = 2 * L * ‖e - f‖ := by ring
theoremnormPLapOf_dir
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $a, b \in \mathbb{R}^{d}$, $Y \in \operatorname{Bilin}(d)$, $L \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $a \ne 0$ ha
  • $b \ne 0$ hb
  • $0 \le L$ hL
  • $\forall v,\ \lvert (Y(v))(v)\rvert \le L \cdot \lVert v\rVert ^{2}$ hY

Then $\lvert \operatorname{normPLapOf}(p, a, Y) - \operatorname{normPLapOf}(p, b, Y)\rvert \le (p - 2) \cdot (2 \cdot L \cdot (2 \cdot \lVert a - b\rVert / \lVert b\rVert))$.

/-- **Continuity of the operator in the direction of the gradient.** -/
theorem normPLapOf_dir {p : ℝ} (hp : 2 ≤ p) {a b : EuclSpace d} (ha : a ≠ 0) (hb : b ≠ 0)
    {Y : Bilin d} {L : ℝ} (hL : 0 ≤ L) (hY : ∀ v, |(Y v) v| ≤ L * ‖v‖ ^ 2) :
    |normPLapOf p a Y - normPLapOf p b Y| ≤ (p - 2) * (2 * L * (2 * ‖a - b‖ / ‖b‖)) := by
  have hna : 0 < ‖a‖ := norm_pos_iff.2 ha
  have hnb : 0 < ‖b‖ := norm_pos_iff.2 hb
  unfold normPLapOf infLaplacianOf
  have hea : ‖‖a‖⁻¹ • a‖ = 1 := by rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ hna.ne']
  have heb : ‖‖b‖⁻¹ • b‖ = 1 := by rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ hnb.ne']
  have h1 := quad_unit_diff hL hY hea heb
  have h2 := unit_sub_le ha hb
  have h3 : |(Y (‖a‖⁻¹ • a)) (‖a‖⁻¹ • a) - (Y (‖b‖⁻¹ • b)) (‖b‖⁻¹ • b)|
      ≤ 2 * L * (2 * ‖a - b‖ / ‖b‖) :=
    h1.trans (mul_le_mul_of_nonneg_left h2 (by positivity))
  have e : laplacianOf Y + (p - 2) * (Y (‖a‖⁻¹ • a)) (‖a‖⁻¹ • a)
      - (laplacianOf Y + (p - 2) * (Y (‖b‖⁻¹ • b)) (‖b‖⁻¹ • b))
      = (p - 2) * ((Y (‖a‖⁻¹ • a)) (‖a‖⁻¹ • a) - (Y (‖b‖⁻¹ • b)) (‖b‖⁻¹ • b)) := by ring
  rw [e, abs_mul, abs_of_nonneg (by linarith : (0 : ℝ) ≤ p - 2)]
  exact mul_le_mul_of_nonneg_left h3 (by linarith)
theoremconvex_twiceDiff_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, g \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $v \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf
  • $\operatorname{TwiceDiffAt}(f, x, g, X)$ h

Then $0 \le (X(v))(v)$.

PLaplacian.convex_twiceDiff_nonnegPlaplacian/OpEst.lean, lines 125–163
/-- **A convex function's Peano Hessian is nonnegative.** -/
theorem convex_twiceDiff_nonneg {f : EuclSpace d → ℝ} (hf : ConvexOn ℝ univ f)
    {x g : EuclSpace d} {X : Bilin d} (h : TwiceDiffAt f x g X) (v : EuclSpace d) :
    0 ≤ (X v) v := by
  obtain ⟨hsup, hsub⟩ := h
  have hsg := convex_subJet_isSubgrad hf hsub
  by_contra hneg
  push Not at hneg
  set κ := -(X v) v with hκ
  have hκ0 : 0 < κ := by linarith
  set η := κ / (4 * (‖v‖ ^ 2 + 1)) with hηdef
  have hη : 0 < η := by positivity
  have hsup' : ∀ η > 0, ∀ᶠ y in 𝓝 x, f y ≤ f x + inner ℝ g (y - x)
      + 1 / 2 * (X (y - x)) (y - x) + η * ‖y - x‖ ^ 2 := hsup
  obtain ⟨ε, hε, hball⟩ := Metric.eventually_nhds_iff.1 (hsup' η hη)
  set t := ε / (2 * (‖v‖ + 1)) with ht
  have ht0 : 0 < t := by positivity
  have hdist : dist (x + t • v) x < ε := by
    rw [dist_eq_norm]
    have e : x + t • v - x = t • v := by abel
    rw [e, norm_smul, Real.norm_eq_abs, abs_of_pos ht0, ht]
    rw [div_mul_eq_mul_div, div_lt_iff₀ (by positivity)]
    nlinarith [norm_nonneg v]
  have h1 := hball hdist
  have h2 : f x + inner ℝ g (x + t • v - x) ≤ f (x + t • v) := hsg (x + t • v)
  have e : x + t • v - x = t • v := by abel
  have hXt : (X (t • v)) (t • v) = t * (t * (X v) v) := by
    simp only [map_smul, smul_apply, smul_eq_mul]
  rw [e, hXt, norm_smul, Real.norm_eq_abs, abs_of_pos ht0] at h1
  rw [e] at h2
  -- 0 ≤ t² (½ X(v,v) + η ‖v‖²) < 0
  have h3 : 0 ≤ t ^ 2 * (1 / 2 * (X v) v + η * ‖v‖ ^ 2) := by nlinarith
  have h4 : η * ‖v‖ ^ 2 ≤ κ / 4 := by
    rw [hηdef, div_mul_eq_mul_div, div_le_div_iff₀ (by positivity) (by norm_num)]
    nlinarith [sq_nonneg ‖v‖]
  have h5 : 1 / 2 * (X v) v + η * ‖v‖ ^ 2 < 0 := by linarith
  have h6 : t ^ 2 * (1 / 2 * (X v) v + η * ‖v‖ ^ 2) < 0 :=
    mul_neg_of_pos_of_neg (by positivity) h5
  linarith
theorempeanoAt_sub_halfsq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, g \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\mathrm{lam} \in \mathbb{R}$.

Assume

  • $\operatorname{PeanoAt}(f, x, g, X)$ h

Then $\operatorname{PeanoAt}(y \mapsto f(y) - \mathrm{lam} / 2 \cdot \lVert y\rVert ^{2}, x, g - \mathrm{lam} \cdot x, X - \mathrm{lam} \cdot \operatorname{idForm}(d))$.

PLaplacian.peanoAt_sub_halfsqPlaplacian/OpEst.lean, lines 165–182
/-- **From `U + (λ/2)‖·‖²` back to `U`.** -/
theorem peanoAt_sub_halfsq {f : EuclSpace d → ℝ} {x g : EuclSpace d} {X : Bilin d}
    (h : PeanoAt f x g X) (lam : ℝ) :
    PeanoAt (fun y => f y - lam / 2 * ‖y‖ ^ 2) x (g - lam • x) (X - lam • idForm d) := by
  intro ε hε
  obtain ⟨δ, hδ, hb⟩ := h ε hε
  refine ⟨δ, hδ, fun k hk => ?_⟩
  have h1 := hb k hk
  change |(f (x + k) - lam / 2 * ‖x + k‖ ^ 2) - (f x - lam / 2 * ‖x‖ ^ 2)
    - inner ℝ (g - lam • x) k - 1 / 2 * ((X - lam • idForm d) k) k| ≤ ε * ‖k‖ ^ 2
  rw [inner_sub_left, real_inner_smul_left, sub_apply, sub_apply, smul_apply, smul_apply,
    smul_eq_mul, idForm_apply, norm_add_sq_real]
  have key : (f (x + k) - lam / 2 * (‖x‖ ^ 2 + 2 * inner ℝ x k + ‖k‖ ^ 2))
      - (f x - lam / 2 * ‖x‖ ^ 2) - (inner ℝ g k - lam * inner ℝ x k)
      - 1 / 2 * ((X k) k - lam * ‖k‖ ^ 2)
      = f (x + k) - f x - inner ℝ g k - 1 / 2 * (X k) k := by ring
  rw [key]
  exact h1
theorempeanoAt_halfsq_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, g \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $\mathrm{lam} \in \mathbb{R}$.

Assume

  • $\operatorname{PeanoAt}(f, x, g, X)$ h

Then $\operatorname{PeanoAt}(y \mapsto \mathrm{lam} / 2 \cdot \lVert y\rVert ^{2} - f(y), x, \mathrm{lam} \cdot x - g, \mathrm{lam} \cdot \operatorname{idForm}(d) - X)$.

PLaplacian.peanoAt_halfsq_subPlaplacian/OpEst.lean, lines 184–201
/-- **From `-V + (λ/2)‖·‖²` back to `V`.** -/
theorem peanoAt_halfsq_sub {f : EuclSpace d → ℝ} {x g : EuclSpace d} {X : Bilin d}
    (h : PeanoAt f x g X) (lam : ℝ) :
    PeanoAt (fun y => lam / 2 * ‖y‖ ^ 2 - f y) x (lam • x - g) (lam • idForm d - X) := by
  intro ε hε
  obtain ⟨δ, hδ, hb⟩ := h ε hε
  refine ⟨δ, hδ, fun k hk => ?_⟩
  have h1 := hb k hk
  change |(lam / 2 * ‖x + k‖ ^ 2 - f (x + k)) - (lam / 2 * ‖x‖ ^ 2 - f x)
    - inner ℝ (lam • x - g) k - 1 / 2 * ((lam • idForm d - X) k) k| ≤ ε * ‖k‖ ^ 2
  rw [inner_sub_left, real_inner_smul_left, sub_apply, sub_apply, smul_apply, smul_apply,
    smul_eq_mul, idForm_apply, norm_add_sq_real]
  have key : (lam / 2 * (‖x‖ ^ 2 + 2 * inner ℝ x k + ‖k‖ ^ 2) - f (x + k))
      - (lam / 2 * ‖x‖ ^ 2 - f x) - (lam * inner ℝ x k - inner ℝ g k)
      - 1 / 2 * (lam * ‖k‖ ^ 2 - (X k) k)
      = -(f (x + k) - f x - inner ℝ g k - 1 / 2 * (X k) k) := by ring
  rw [key, abs_neg]
  exact h1

Plaplacian/OpExpansion.lean3 declarations

theoremtugOfWarOp_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then PLaplacian.tugOfWarOp p ε v x = (p - 2) / (p + ↑d) * ((sSup (v '' Metric.ball x ε) + sInf (v '' Metric.ball x ε)) / 2) + (↑d + 2) / (p + ↑d) * ⨍ (y : EuclSpace d) in Metric.ball x ε, v y.

/-- The operator, with the extreme-value average and the ball average named. -/
theorem tugOfWarOp_eq (p ε : ℝ) (v : EuclSpace d → ℝ) (x : EuclSpace d) :
    tugOfWarOp p ε v x
      = (p - 2) / (p + (d : ℝ))
          * ((sSup (v '' ball x ε) + sInf (v '' ball x ε)) / 2)
        + ((d : ℝ) + 2) / (p + (d : ℝ)) * ⨍ y in ball x ε, v y := by
  unfold tugOfWarOp
  ring
theoremtugOfWarOp_expansion
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $I, L, e_{1}, e_{2} \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd
  • (sSup (φ '' Metric.ball x ε) + sInf (φ '' Metric.ball x ε)) / 2 = φ x + ε ^ 2 / 2 * I + e₁ hS
  • $\fint_{B(x, \varepsilon)} (\varphi(y) = \varphi(x) + \varepsilon ^{2} / (2 \cdot (d + 2)) \cdot L + e_{2}) \, dy$ hA

Then $T_{\varepsilon} \varphi(x) = \varphi(x) + \varepsilon ^{2} / (2 \cdot (p + d)) \cdot ((p - 2) \cdot I + L) + ((p - 2) / (p + d) \cdot e_{1} + (d + 2) / (p + d) \cdot e_{2})$.

PLaplacian.tugOfWarOp_expansionPlaplacian/OpExpansion.lean, lines 72–91
/-- **The asymptotic expansion, with the two halves supplied.**

If the average of the extreme values expands with infinity-Laplacian term `I`
and error `e₁`, and the ball average with Laplacian term `L` and error `e₂`,
then the operator expands with the normalized `p`-Laplacian and the weighted
error. -/
theorem tugOfWarOp_expansion (p : ℝ) (hpd : 0 < p + (d : ℝ)) (ε : ℝ)
    (φ : EuclSpace d → ℝ) (x : EuclSpace d) {I L e₁ e₂ : ℝ}
    (hS : (sSup (φ '' ball x ε) + sInf (φ '' ball x ε)) / 2
        = φ x + (ε ^ 2 / 2) * I + e₁)
    (hA : (⨍ y in ball x ε, φ y)
        = φ x + ε ^ 2 / (2 * ((d : ℝ) + 2)) * L + e₂) :
    tugOfWarOp p ε φ x
      = φ x + ε ^ 2 / (2 * (p + (d : ℝ))) * ((p - 2) * I + L)
        + ((p - 2) / (p + (d : ℝ)) * e₁
            + ((d : ℝ) + 2) / (p + (d : ℝ)) * e₂) := by
  rw [tugOfWarOp_eq, hS, hA]
  have hw := combine_weights (d := d) p hpd ε I L
  have hab := alpha_add_beta (d := d) p hpd
  linear_combination hw + (φ x) * hab
theoremtugOfWarOp_expansion_normPLap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $e_{1}, e_{2} \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd
  • (sSup (φ '' Metric.ball x ε) + sInf (φ '' Metric.ball x ε)) / 2 = φ x + ε ^ 2 / 2 * PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) + e₁ hS
  • $\fint_{B(x, \varepsilon)} (\varphi(y) = \varphi(x) + \varepsilon ^{2} / (2 \cdot (d + 2)) \cdot \operatorname{laplacianOf}(\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)) + e_{2}) \, dy$ hA

Then $T_{\varepsilon} \varphi(x) = \varphi(x) + \varepsilon ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)) + ((p - 2) / (p + d) \cdot e_{1} + (d + 2) / (p + d) \cdot e_{2})$.

PLaplacian.tugOfWarOp_expansion_normPLapPlaplacian/OpExpansion.lean, lines 93–109
/-- **And the bracket is the normalized `p`-Laplacian**, so the expansion
reads with the operator of `Plaplacian.Operator`. -/
theorem tugOfWarOp_expansion_normPLap (p : ℝ) (hpd : 0 < p + (d : ℝ))
    (ε : ℝ) (φ : EuclSpace d → ℝ) (x : EuclSpace d) {e₁ e₂ : ℝ}
    (hS : (sSup (φ '' ball x ε) + sInf (φ '' ball x ε)) / 2
        = φ x + (ε ^ 2 / 2)
            * infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) + e₁)
    (hA : (⨍ y in ball x ε, φ y)
        = φ x + ε ^ 2 / (2 * ((d : ℝ) + 2))
            * laplacianOf (fderiv ℝ (fderiv ℝ φ) x) + e₂) :
    tugOfWarOp p ε φ x
      = φ x + ε ^ 2 / (2 * (p + (d : ℝ)))
          * normPLapOf p (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x)
        + ((p - 2) / (p + (d : ℝ)) * e₁
            + ((d : ℝ) + 2) / (p + (d : ℝ)) * e₂) := by
  rw [tugOfWarOp_expansion p hpd ε φ x hS hA,
      bracket_eq_normPLap p (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x)]

Plaplacian/OpLocal.lean2 declarations

theoremweights_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < p + d$ hpd

Then all of the following hold:

  • $0 \le (p - 2) / (p + d)$
  • $0 \le (d + 2) / (p + d)$
/-- The weights are nonnegative for `2 ≤ p`. -/
theorem weights_nonneg (p : ℝ) (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ)) :
    0 ≤ (p - 2) / (p + (d : ℝ)) ∧ 0 ≤ ((d : ℝ) + 2) / (p + (d : ℝ)) := by
  constructor
  · exact div_nonneg (by linarith) (le_of_lt hpd)
  · exact div_nonneg (by positivity) (le_of_lt hpd)
theoremtugOfWarOp_mono_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall w \in B(x, \varepsilon),\ u(w) \le v(w)$ hle

Then $T_{\varepsilon} u(x) \le T_{\varepsilon} v(x)$.

PLaplacian.tugOfWarOp_mono_ballPlaplacian/OpLocal.lean, lines 50–80
/-- **Local monotonicity of the operator.** -/
theorem tugOfWarOp_mono_ball (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε)
    (hpd : 0 < p + (d : ℝ)) {u v : EuclSpace d → ℝ}
    (hu : BddMeas u) (hv : BddMeas v) (x : EuclSpace d)
    (hle : ∀ w ∈ ball x ε, u w ≤ v w) :
    tugOfWarOp p ε u x ≤ tugOfWarOp p ε v x := by
  obtain ⟨hα, hβ⟩ := weights_nonneg (d := d) p hp hpd
  rw [tugOfWarOp_eq, tugOfWarOp_eq]
  -- the extreme values
  have hsup : sSup (u '' ball x ε) ≤ sSup (v '' ball x ε) := by
    refine sSup_ball_mono hε hle ?_
    obtain ⟨B, hB⟩ := hv.bound
    refine ⟨B, ?_⟩
    rintro a ⟨w, hw, rfl⟩
    exact le_of_abs_le (hB w)
  have hinf : sInf (u '' ball x ε) ≤ sInf (v '' ball x ε) := by
    refine sInf_ball_mono hε hle ?_
    obtain ⟨B, hB⟩ := hu.bound
    refine ⟨- B, ?_⟩
    rintro a ⟨w, hw, rfl⟩
    exact (abs_le.1 (hB w)).1
  -- the average
  have havg : (⨍ y in ball x ε, u y) ≤ ⨍ y in ball x ε, v y := by
    refine setAverage_ball_mono hle ?_ ?_
    · exact hu.integrableOn_ball x ε
    · exact hv.integrableOn_ball x ε
  -- combine
  have h1 : (sSup (u '' ball x ε) + sInf (u '' ball x ε)) / 2
      ≤ (sSup (v '' ball x ε) + sInf (v '' ball x ε)) / 2 := by
    linarith [hsup, hinf]
  nlinarith [h1, havg, hα, hβ]

Plaplacian/OpenClosed.lean4 declarations

theoremsSup_ball_le_sSup_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \varepsilon$ hε

Then sSup (φ '' Metric.ball x ε) ≤ sSup (φ '' Metric.closedBall x ε).

PLaplacian.sSup_ball_le_sSup_closedBallPlaplacian/OpenClosed.lean, lines 57–65
theorem sSup_ball_le_sSup_closedBall {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    sSup (φ '' ball x ε) ≤ sSup (φ '' closedBall x ε) := by
  have hne : (φ '' ball x ε).Nonempty := ⟨φ x, ⟨x, mem_ball_self hε, rfl⟩⟩
  have hbdd : BddAbove (φ '' closedBall x ε) :=
    ((isCompact_closedBall x ε).image hφ).bddAbove
  refine csSup_le hne ?_
  rintro a ⟨y, hy, rfl⟩
  exact le_csSup hbdd ⟨y, ball_subset_closedBall hy, rfl⟩
theoremsSup_closedBall_le_sSup_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \varepsilon$ hε

Then sSup (φ '' Metric.closedBall x ε) ≤ sSup (φ '' Metric.ball x ε).

PLaplacian.sSup_closedBall_le_sSup_ballPlaplacian/OpenClosed.lean, lines 67–85
theorem sSup_closedBall_le_sSup_ball {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    sSup (φ '' closedBall x ε) ≤ sSup (φ '' ball x ε) := by
  have hcl : φ '' closedBall x ε ⊆ closure (φ '' ball x ε) := by
    rw [← closure_ball x hε.ne']
    exact image_closure_subset_closure_image hφ
  have hbdd : BddAbove (φ '' ball x ε) := by
    have h := ((isCompact_closedBall x ε).image hφ).bddAbove
    exact h.mono (Set.image_mono ball_subset_closedBall)
  have hne : (φ '' closedBall x ε).Nonempty :=
    ⟨φ x, ⟨x, mem_closedBall_self hε.le, rfl⟩⟩
  refine csSup_le hne ?_
  intro a ha
  have ha' : a ∈ closure (φ '' ball x ε) := hcl ha
  have hsub : closure (φ '' ball x ε) ⊆ Iic (sSup (φ '' ball x ε)) := by
    refine closure_minimal ?_ isClosed_Iic
    intro b hb
    exact le_csSup hbdd hb
  exact hsub ha'
theoremsSup_ball_eq_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \varepsilon$ hε

Then sSup (φ '' Metric.ball x ε) = sSup (φ '' Metric.closedBall x ε).

PLaplacian.sSup_ball_eq_closedBallPlaplacian/OpenClosed.lean, lines 87–92
/-- **The suprema agree.** -/
theorem sSup_ball_eq_closedBall {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    sSup (φ '' ball x ε) = sSup (φ '' closedBall x ε) :=
  le_antisymm (sSup_ball_le_sSup_closedBall hφ x hε)
    (sSup_closedBall_le_sSup_ball hφ x hε)
theoremsInf_ball_eq_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \varepsilon$ hε

Then sInf (φ '' Metric.ball x ε) = sInf (φ '' Metric.closedBall x ε).

PLaplacian.sInf_ball_eq_closedBallPlaplacian/OpenClosed.lean, lines 94–111
/-- **And the infima**, by applying the above to the negation. -/
theorem sInf_ball_eq_closedBall {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    sInf (φ '' ball x ε) = sInf (φ '' closedBall x ε) := by
  have hneg : Continuous (fun y => -φ y) := hφ.neg
  have h := sSup_ball_eq_closedBall hneg x hε
  have himg : ∀ s : Set (EuclSpace d),
      (fun y => -φ y) '' s = -(φ '' s) := by
    intro s
    ext a
    simp only [Set.mem_image, Set.mem_neg]
    constructor
    · rintro ⟨y, hy, rfl⟩
      exact ⟨y, hy, by ring⟩
    · rintro ⟨y, hy, hay⟩
      exact ⟨y, hy, by linarith [hay]⟩
  rw [himg, himg, Real.sSup_neg, Real.sSup_neg] at h
  linarith [h]

Plaplacian/Operator.lean12 declarations

deflaplacianOf
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Its value lies in $\mathbb{R}$.

/-- The Laplacian of a bilinear form: its trace, as a sum over the standard
orthonormal basis. -/
def laplacianOf (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) : ℝ :=
  ∑ i : Fin d, X (EuclideanSpace.single i (1 : ℝ))
    (EuclideanSpace.single i (1 : ℝ))
definfLaplacianOf
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Its value lies in $\mathbb{R}$.

/-- The normalized infinity Laplacian: the bilinear form evaluated twice at the
unit vector in the direction of `q`. -/
def infLaplacianOf (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) : ℝ :=
  X (‖q‖⁻¹ • q) (‖q‖⁻¹ • q)
defnormPLapOf
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Its value lies in $\mathbb{R}$.

/-- **The normalized `p`-Laplacian of a Hessian**, at a point with gradient
`q`. This is `Delta^N_p`, not the `F` of the viscosity convention; see
`viscF`. -/
def normPLapOf (p : ℝ) (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) : ℝ :=
  laplacianOf X + (p - 2) * infLaplacianOf q X
defviscF
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Its value lies in $\mathbb{R}$.

/-- The operator in the viscosity convention, so that the equation reads
`F = 0` and subsolutions satisfy `F <= 0`. -/
def viscF (p : ℝ) (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) : ℝ :=
  - normPLapOf p q X
lemmainfLaplacianOf_of_norm_one
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Assume

  • $\lVert q\rVert = 1$ hq

Then $\operatorname{infLaplacianOf}(q, X) = (X(q))(q)$.

PLaplacian.infLaplacianOf_of_norm_onePlaplacian/Operator.lean, lines 90–96
/-- For a unit vector the infinity Laplacian is `X q q`. -/
lemma infLaplacianOf_of_norm_one {q : EuclSpace d} (hq : ‖q‖ = 1)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    infLaplacianOf q X = X q q := by
  unfold infLaplacianOf
  rw [hq]
  simp
lemmanormPLapOf_two
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then $\operatorname{normPLapOf}(2, q, X) = \operatorname{laplacianOf}(X)$.

/-- At `p = 2` the operator is the Laplacian. -/
lemma normPLapOf_two (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    normPLapOf 2 q X = laplacianOf X := by
  unfold normPLapOf
  simp
lemmalaplacianOf_smul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then $\operatorname{laplacianOf}(c \cdot X) = c \cdot \operatorname{laplacianOf}(X)$.

lemma laplacianOf_smul (c : ℝ) (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    laplacianOf (c • X) = c * laplacianOf X := by
  unfold laplacianOf
  rw [Finset.mul_sum]
  refine Finset.sum_congr rfl fun i _ => ?_
  simp
lemmainfLaplacianOf_smul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then $\operatorname{infLaplacianOf}(q, c \cdot X) = c \cdot \operatorname{infLaplacianOf}(q, X)$.

PLaplacian.infLaplacianOf_smulPlaplacian/Operator.lean, lines 114–119
lemma infLaplacianOf_smul (c : ℝ) (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    infLaplacianOf q (c • X) = c * infLaplacianOf q X := by
  unfold infLaplacianOf
  simp
  ring
theoremnormPLapOf_smul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, c \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then $\operatorname{normPLapOf}(p, q, c \cdot X) = c \cdot \operatorname{normPLapOf}(p, q, X)$.

/-- **Homogeneity of degree one in the Hessian.** -/
theorem normPLapOf_smul (p c : ℝ) (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    normPLapOf p q (c • X) = c * normPLapOf p q X := by
  unfold normPLapOf
  rw [laplacianOf_smul, infLaplacianOf_smul]
  ring
theoreminfLaplacianOf_smul_left
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Assume

  • $0 < c$ hc

Then $\operatorname{infLaplacianOf}(c \cdot q, X) = \operatorname{infLaplacianOf}(q, X)$.

PLaplacian.infLaplacianOf_smul_leftPlaplacian/Operator.lean, lines 131–146
/-- **The operator depends on the gradient only through its direction.** -/
theorem infLaplacianOf_smul_left {c : ℝ} (hc : 0 < c) (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    infLaplacianOf (c • q) X = infLaplacianOf q X := by
  unfold infLaplacianOf
  have hnorm : ‖c • q‖ = c * ‖q‖ := by
    rw [norm_smul, Real.norm_eq_abs, abs_of_pos hc]
  rw [hnorm]
  by_cases hq : q = 0
  · simp [hq]
  · have hqn : (0 : ℝ) < ‖q‖ := norm_pos_iff.2 hq
    have hkey : (c * ‖q‖)⁻¹ • (c • q) = ‖q‖⁻¹ • q := by
      rw [smul_smul]
      congr 1
      field_simp
    rw [hkey]
theoremnormPLapOf_smul_left
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, c \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Assume

  • $0 < c$ hc

Then $\operatorname{normPLapOf}(p, c \cdot q, X) = \operatorname{normPLapOf}(p, q, X)$.

PLaplacian.normPLapOf_smul_leftPlaplacian/Operator.lean, lines 148–152
theorem normPLapOf_smul_left (p : ℝ) {c : ℝ} (hc : 0 < c) (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    normPLapOf p (c • q) X = normPLapOf p q X := by
  unfold normPLapOf
  rw [infLaplacianOf_smul_left hc]
theoremviscF_antitone
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X, Y : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Assume

  • $2 \le p$ hp
  • $\forall v,\ (X(v))(v) \le (Y(v))(v)$ hXY

Then $\operatorname{viscF}(p, q, Y) \le \operatorname{viscF}(p, q, X)$.

/-- **Degenerate ellipticity.** `F` is nonincreasing in the Hessian, ordered as
a quadratic form. This is the structural hypothesis of viscosity theory. -/
theorem viscF_antitone (p : ℝ) (hp : 2 ≤ p) (q : EuclSpace d)
    (X Y : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (hXY : ∀ v : EuclSpace d, X v v ≤ Y v v) :
    viscF p q Y ≤ viscF p q X := by
  unfold viscF normPLapOf laplacianOf infLaplacianOf
  have h1 : ∑ i : Fin d, X (EuclideanSpace.single i (1 : ℝ))
        (EuclideanSpace.single i (1 : ℝ))
      ≤ ∑ i : Fin d, Y (EuclideanSpace.single i (1 : ℝ))
        (EuclideanSpace.single i (1 : ℝ)) :=
    Finset.sum_le_sum fun i _ => hXY _
  have h2 : X (‖q‖⁻¹ • q) (‖q‖⁻¹ • q) ≤ Y (‖q‖⁻¹ • q) (‖q‖⁻¹ • q) :=
    hXY _
  nlinarith [h1, h2]

Plaplacian/Order2.lean5 declarations

theoremcontDiff_lineMap_three
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, z \in \mathbb{R}^{d}$.

Then $\operatorname{ContDiff}(\mathbb{R}, 3, \operatorname{lineMap}(x, z))$.

PLaplacian.contDiff_lineMap_threePlaplacian/Order2.lean, lines 33–37
/-- The line map is smooth to any order. -/
theorem contDiff_lineMap_three (x z : EuclSpace d) :
    ContDiff ℝ 3 (lineMap x z) := by
  unfold lineMap
  fun_prop
theoremcontDiff_restrict_three
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then ContDiff ℝ 3 fun t => φ (PLaplacian.lineMap x z t).

PLaplacian.contDiff_restrict_threePlaplacian/Order2.lean, lines 39–43
/-- The restriction is `C³` when `φ` is. -/
theorem contDiff_restrict_three {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x z : EuclSpace d) :
    ContDiff ℝ 3 (fun t : ℝ => φ (lineMap x z t)) :=
  hφ.comp (contDiff_lineMap_three x z)
theoremiteratedDerivWithin_two_eventuallyEq
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $a, b, t \in \mathbb{R}$.

Assume

  • $t \in \operatorname{Ioo}(\operatorname{min}(a, b), \operatorname{max}(a, b))$ ht

Then iteratedDerivWithin 2 g (Set.uIcc a b) =ᶠ[nhds t] deriv (deriv g).

PLaplacian.iteratedDerivWithin_two_eventuallyEqPlaplacian/Order2.lean, lines 45–51
/-- The inner iterated derivative agrees with the plain one on a
neighbourhood, at order two. -/
theorem iteratedDerivWithin_two_eventuallyEq (g : ℝ → ℝ) {a b t : ℝ}
    (ht : t ∈ Ioo (min a b) (max a b)) :
    iteratedDerivWithin 2 g (uIcc a b) =ᶠ[nhds t] deriv (deriv g) := by
  filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs
  exact iteratedDerivWithin_two_eq g hs
theoremiteratedDerivWithin_three_eq
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $a, b, t \in \mathbb{R}$.

Assume

  • $t \in \operatorname{Ioo}(\operatorname{min}(a, b), \operatorname{max}(a, b))$ ht

Then $\operatorname{iteratedDerivWithin}(3, g, \operatorname{uIcc}(a, b), t) = \operatorname{deriv}(\operatorname{deriv}(\operatorname{deriv}(g)), t)$.

PLaplacian.iteratedDerivWithin_three_eqPlaplacian/Order2.lean, lines 53–59
/-- **The order-three translation.** -/
theorem iteratedDerivWithin_three_eq (g : ℝ → ℝ) {a b t : ℝ}
    (ht : t ∈ Ioo (min a b) (max a b)) :
    iteratedDerivWithin 3 g (uIcc a b) t = deriv (deriv (deriv g)) t := by
  rw [show (3 : Nat) = 2 + 1 from rfl, iteratedDerivWithin_succ]
  rw [derivWithin_of_mem_nhds (uIcc_mem_nhds ht)]
  exact (iteratedDerivWithin_two_eventuallyEq g ht).deriv_eq
theoremtaylorWithinEval_two
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $s \subseteq \mathbb{R}$, $x_{0}, x \in \mathbb{R}$.

Then $\operatorname{taylorWithinEval}(g, 2, s, x_{0}, x) = g(x_{0}) + (x - x_{0}) \cdot \operatorname{iteratedDerivWithin}(1, g, s, x_{0}) + (x - x_{0}) ^{2} / 2 \cdot \operatorname{iteratedDerivWithin}(2, g, s, x_{0})$.

PLaplacian.taylorWithinEval_twoPlaplacian/Order2.lean, lines 61–69
/-- **The Taylor polynomial at order two.** -/
theorem taylorWithinEval_two (g : ℝ → ℝ) (s : Set ℝ) (x₀ x : ℝ) :
    taylorWithinEval g 2 s x₀ x
      = g x₀ + (x - x₀) * iteratedDerivWithin 1 g s x₀
        + (x - x₀) ^ 2 / 2 * iteratedDerivWithin 2 g s x₀ := by
  rw [show (2 : Nat) = 1 + 1 from rfl, taylorWithinEval_succ,
      taylorWithinEval_one]
  simp only [Nat.factorial, Nat.cast_one, smul_eq_mul]
  ring

Plaplacian/PeanoUniq.lean4 declarations

theorempeanoAt_of_contDiff
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then $\operatorname{PeanoAt}(\varphi, x, \operatorname{gradient}(\varphi, x), \operatorname{hess}(\varphi, x))$.

PLaplacian.peanoAt_of_contDiffPlaplacian/PeanoUniq.lean, lines 32–45
/-- **A `C²` function has the expansion `(∇φ, D²φ)`.** -/
theorem peanoAt_of_contDiff {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ) (x : EuclSpace d) :
    PeanoAt φ x (gradient φ x) (hess φ x) := by
  intro ε hε
  obtain ⟨δ, hδ, hb⟩ := exists_taylorErr_le hφ x hε
  refine ⟨δ, hδ, fun k hk => ?_⟩
  have h := hb k hk
  unfold taylorErr at h
  have hg : inner ℝ (gradient φ x) k = fderiv ℝ φ x k := by
    unfold gradient
    exact InnerProductSpace.toDual_symm_apply
  rw [hg]
  unfold hess
  exact h
theorempeano_unique
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q, q' \in \mathbb{R}^{d}$, $X, X' \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{PeanoAt}(f, x, q, X)$ h1
  • $\operatorname{PeanoAt}(f, x, q', X')$ h2

Then all of the following hold:

  • $q = q'$
  • $\forall v,\ (X(v))(v) = (X'(v))(v)$
/-- **Peano expansions are unique.** -/
theorem peano_unique {f : EuclSpace d → ℝ} {x q q' : EuclSpace d} {X X' : Bilin d}
    (h1 : PeanoAt f x q X) (h2 : PeanoAt f x q' X') :
    q = q' ∧ ∀ v, (X v) v = (X' v) v := by
  have hz : ∀ᶠ z in 𝓝 x, (fun y => f y - f y) z ≤ (fun y => f y - f y) x :=
    Eventually.of_forall fun z => by simp
  obtain ⟨hq, hX⟩ := max_peano (peanoAt_sub h1 h2) hz
  obtain ⟨_, hX'⟩ := max_peano (peanoAt_sub h2 h1) hz
  refine ⟨sub_eq_zero.1 hq, fun v => ?_⟩
  have a := hX v
  have b := hX' v
  rw [sub_apply, sub_apply] at a b
  linarith
theoremnormPLapOf_congr
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $X, X' \in \operatorname{Bilin}(d)$, $q \in \mathbb{R}^{d}$.

Assume

  • $\forall v,\ (X(v))(v) = (X'(v))(v)$ h

Then $\operatorname{normPLapOf}(p, q, X) = \operatorname{normPLapOf}(p, q, X')$.

PLaplacian.normPLapOf_congrPlaplacian/PeanoUniq.lean, lines 61–65
/-- **The operator sees only the quadratic form.** -/
theorem normPLapOf_congr {p : ℝ} {X X' : Bilin d} (h : ∀ v, (X v) v = (X' v) v)
    (q : EuclSpace d) : normPLapOf p q X = normPLapOf p q X' := by
  unfold normPLapOf infLaplacianOf laplacianOf
  simp only [h]
theoremnormPLapOf_of_peano
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{PeanoAt}(\varphi, x, q, X)$ hP

Then all of the following hold:

  • $\operatorname{gradient}(\varphi, x) = q$
  • $\operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x), \operatorname{hess}(\varphi, x)) = \operatorname{normPLapOf}(p, q, X)$
PLaplacian.normPLapOf_of_peanoPlaplacian/PeanoUniq.lean, lines 67–74
/-- **The operator value of a `C²` function, from any expansion.** -/
theorem normPLapOf_of_peano {p : ℝ} {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    {x q : EuclSpace d} {X : Bilin d} (hP : PeanoAt φ x q X) :
    gradient φ x = q ∧ normPLapOf p (gradient φ x) (hess φ x) = normPLapOf p q X := by
  obtain ⟨hq, hX⟩ := peano_unique (peanoAt_of_contDiff hφ x) hP
  refine ⟨hq, ?_⟩
  rw [hq]
  exact normPLapOf_congr hX q

Plaplacian/PenaltyP.lean15 declarations

defpenP
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0}, k \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The penalty.** -/
def penP (s r α : ℝ) (h0 k : EuclSpace d) : ℝ :=
  s * penQ α h0 k + r * ‖k‖ ^ 2
defpenG
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0}, \mathrm{dd} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}^{d}$.

/-- **Its gradient** at `d`. -/
def penG (s r α : ℝ) (h0 dd : EuclSpace d) : EuclSpace d :=
  (2 * s * α⁻¹) • ((‖h0‖ ^ 2) • dd + (2 * inner ℝ h0 dd) • h0) + (2 * r) • dd
defpenM
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The constant of the quadratic bound. -/
def penM (s r α : ℝ) (h0 : EuclSpace d) : ℝ := s * (3 * α⁻¹ * ‖h0‖ ^ 2) + r
theoreminner_penG
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0}, \mathrm{dd}, k \in \mathbb{R}^{d}$.

Then $\operatorname{inner}(\mathbb{R}, \operatorname{penG}(s, r, \alpha, \mathrm{h0}, \mathrm{dd}), k) = 2 \cdot s \cdot \operatorname{penB}(\alpha, \mathrm{h0}, \mathrm{dd}, k) + 2 \cdot r \cdot \operatorname{inner}(\mathbb{R}, \mathrm{dd}, k)$.

theorem inner_penG (dd k : EuclSpace d) :
    inner ℝ (penG s r α h0 dd) k
      = 2 * s * penB α h0 dd k + 2 * r * inner ℝ dd k := by
  unfold penG penB
  rw [inner_add_left, real_inner_smul_left, real_inner_smul_left, inner_add_left,
    real_inner_smul_left, real_inner_smul_left]
  ring
theorempenP_add
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0}, \mathrm{dd}, k \in \mathbb{R}^{d}$.

Then $\operatorname{penP}(s, r, \alpha, \mathrm{h0}, \mathrm{dd} + k) = \operatorname{penP}(s, r, \alpha, \mathrm{h0}, \mathrm{dd}) + \operatorname{inner}(\mathbb{R}, \operatorname{penG}(s, r, \alpha, \mathrm{h0}, \mathrm{dd}), k) + \operatorname{penP}(s, r, \alpha, \mathrm{h0}, k)$.

/-- **The exact expansion.** -/
theorem penP_add (dd k : EuclSpace d) :
    penP s r α h0 (dd + k)
      = penP s r α h0 dd + inner ℝ (penG s r α h0 dd) k + penP s r α h0 k := by
  unfold penP
  rw [penQ_add, inner_penG, norm_add_sq_real]
  ring
theorempenP_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $k \in \mathbb{R}^{d}$.

Assume

  • $0 \le s$ hs
  • $0 \le r$ hr
  • $0 < \alpha$ hα

Then $0 \le \operatorname{penP}(s, r, \alpha, \mathrm{h0}, k)$.

theorem penP_nonneg (hs : 0 ≤ s) (hr : 0 ≤ r) (hα : 0 < α) (k : EuclSpace d) :
    0 ≤ penP s r α h0 k := by
  unfold penP
  have := penQ_nonneg hα h0 k
  positivity
theorempenP_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $k \in \mathbb{R}^{d}$.

Assume

  • $0 \le s$ hs
  • $0 < \alpha$ hα

Then $\operatorname{penP}(s, r, \alpha, \mathrm{h0}, k) \le \operatorname{penM}(s, r, \alpha, \mathrm{h0}) \cdot \lVert k\rVert ^{2}$.

theorem penP_le (hs : 0 ≤ s) (hα : 0 < α) (k : EuclSpace d) :
    penP s r α h0 k ≤ penM s r α h0 * ‖k‖ ^ 2 := by
  unfold penP penM
  have := mul_le_mul_of_nonneg_left (penQ_le hα h0 k) hs
  nlinarith
theorempenP_taylor
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $\mathrm{dd}, k \in \mathbb{R}^{d}$.

Assume

  • $0 \le s$ hs
  • $0 < \alpha$ hα

Then $\operatorname{penP}(s, r, \alpha, \mathrm{h0}, \mathrm{dd} + k) \le \operatorname{penP}(s, r, \alpha, \mathrm{h0}, \mathrm{dd}) + \operatorname{inner}(\mathbb{R}, \operatorname{penG}(s, r, \alpha, \mathrm{h0}, \mathrm{dd}), k) + \operatorname{penM}(s, r, \alpha, \mathrm{h0}) \cdot \lVert k\rVert ^{2}$.

/-- **The upper Taylor bound**, in the form `CoreLines` consumes. -/
theorem penP_taylor (hs : 0 ≤ s) (hα : 0 < α) (dd k : EuclSpace d) :
    penP s r α h0 (dd + k)
      ≤ penP s r α h0 dd + inner ℝ (penG s r α h0 dd) k
        + penM s r α h0 * ‖k‖ ^ 2 := by
  rw [penP_add]
  linarith [penP_le (r := r) (h0 := h0) hs hα k]
theorempenM_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Assume

  • $0 \le s$ hs
  • $0 \le r$ hr
  • $0 < \alpha$ hα

Then $0 \le \operatorname{penM}(s, r, \alpha, \mathrm{h0})$.

theorem penM_nonneg (hs : 0 ≤ s) (hr : 0 ≤ r) (hα : 0 < α) :
    0 ≤ penM s r α h0 := by
  unfold penM
  have : 0 ≤ α⁻¹ := inv_nonneg.2 hα.le
  positivity
theoremnorm_penG_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $\mathrm{dd} \in \mathbb{R}^{d}$.

Assume

  • $0 \le s$ hs
  • $0 \le r$ hr
  • $0 < \alpha$ hα

Then $\lVert \operatorname{penG}(s, r, \alpha, \mathrm{h0}, \mathrm{dd})\rVert \le 2 \cdot \operatorname{penM}(s, r, \alpha, \mathrm{h0}) \cdot \lVert \mathrm{dd}\rVert$.

/-- **The gradient bound**: `‖g_d‖ ≤ 2M ‖d‖`. -/
theorem norm_penG_le (hs : 0 ≤ s) (hr : 0 ≤ r) (hα : 0 < α) (dd : EuclSpace d) :
    ‖penG s r α h0 dd‖ ≤ 2 * penM s r α h0 * ‖dd‖ := by
  unfold penG penM
  have hinv : 0 ≤ α⁻¹ := inv_nonneg.2 hα.le
  have hin : |inner ℝ h0 dd| ≤ ‖h0‖ * ‖dd‖ := abs_real_inner_le_norm h0 dd
  have h1 : ‖(‖h0‖ ^ 2) • dd + (2 * inner ℝ h0 dd) • h0‖
      ≤ 3 * ‖h0‖ ^ 2 * ‖dd‖ := by
    calc ‖(‖h0‖ ^ 2) • dd + (2 * inner ℝ h0 dd) • h0‖
        ≤ ‖(‖h0‖ ^ 2) • dd‖ + ‖(2 * inner ℝ h0 dd) • h0‖ := norm_add_le _ _
      _ = ‖h0‖ ^ 2 * ‖dd‖ + 2 * |inner ℝ h0 dd| * ‖h0‖ := by
          rw [norm_smul, norm_smul, Real.norm_eq_abs, Real.norm_eq_abs,
            abs_of_nonneg (sq_nonneg _), abs_mul, abs_two]
      _ ≤ ‖h0‖ ^ 2 * ‖dd‖ + 2 * (‖h0‖ * ‖dd‖) * ‖h0‖ := by
          have := mul_le_mul_of_nonneg_right hin (norm_nonneg h0)
          nlinarith
      _ = 3 * ‖h0‖ ^ 2 * ‖dd‖ := by ring
  calc ‖(2 * s * α⁻¹) • ((‖h0‖ ^ 2) • dd + (2 * inner ℝ h0 dd) • h0)
        + (2 * r) • dd‖
      ≤ ‖(2 * s * α⁻¹) • ((‖h0‖ ^ 2) • dd + (2 * inner ℝ h0 dd) • h0)‖
        + ‖(2 * r) • dd‖ := norm_add_le _ _
    _ = (2 * s * α⁻¹) * ‖(‖h0‖ ^ 2) • dd + (2 * inner ℝ h0 dd) • h0‖
        + 2 * r * ‖dd‖ := by
        rw [norm_smul, norm_smul, Real.norm_eq_abs, Real.norm_eq_abs,
          abs_of_nonneg (by positivity), abs_of_nonneg (by positivity)]
    _ ≤ (2 * s * α⁻¹) * (3 * ‖h0‖ ^ 2 * ‖dd‖) + 2 * r * ‖dd‖ := by
        have : 0 ≤ 2 * s * α⁻¹ := by positivity
        nlinarith [mul_le_mul_of_nonneg_left h1 this]
    _ = 2 * (s * (3 * α⁻¹ * ‖h0‖ ^ 2) + r) * ‖dd‖ := by ring
theorempenP_young
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $a, b \in \mathbb{R}^{d}$.

Assume

  • $0 \le s$ hs
  • $0 \le r$ hr
  • $0 < \alpha$ hα
  • $0 < \varepsilon$ hε

Then $\operatorname{penP}(s, r, \alpha, \mathrm{h0}, a + b) \le (1 + \varepsilon) \cdot \operatorname{penP}(s, r, \alpha, \mathrm{h0}, a) + (1 + 1 / \varepsilon) \cdot \operatorname{penP}(s, r, \alpha, \mathrm{h0}, b)$.

/-- **Young's inequality for the penalty.** -/
theorem penP_young (hs : 0 ≤ s) (hr : 0 ≤ r) (hα : 0 < α) {ε : ℝ} (hε : 0 < ε)
    (a b : EuclSpace d) :
    penP s r α h0 (a + b)
      ≤ (1 + ε) * penP s r α h0 a + (1 + 1 / ε) * penP s r α h0 b := by
  unfold penP
  have h1 := mul_le_mul_of_nonneg_left (penQ_young (h0 := h0) hα hε a b) hs
  have hn : ‖a + b‖ ^ 2 ≤ (1 + ε) * ‖a‖ ^ 2 + (1 + 1 / ε) * ‖b‖ ^ 2 := by
    rw [norm_add_sq_real]
    have := young_inner hε a b
    have e : ‖b‖ ^ 2 / ε = 1 / ε * ‖b‖ ^ 2 := by ring
    rw [e] at this
    linarith
  have h2 := mul_le_mul_of_nonneg_left hn hr
  nlinarith
theoremnorm_sq_convex_comb
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $a, b \in \mathbb{R}$, $x, y \in \mathbb{R}^{d}$.

Assume

  • $a + b = 1$ hab

Then $\lVert a \cdot x + b \cdot y\rVert ^{2} = a \cdot \lVert x\rVert ^{2} + b \cdot \lVert y\rVert ^{2} - a \cdot b \cdot \lVert x - y\rVert ^{2}$.

PLaplacian.norm_sq_convex_combPlaplacian/PenaltyP.lean, lines 149–157
/-- The convexity defect of the squared norm. -/
theorem norm_sq_convex_comb {a b : ℝ} (hab : a + b = 1) (x y : EuclSpace d) :
    ‖a • x + b • y‖ ^ 2 = a * ‖x‖ ^ 2 + b * ‖y‖ ^ 2 - a * b * ‖x - y‖ ^ 2 := by
  rw [norm_add_sq_real, norm_sub_sq_real, norm_smul, norm_smul,
    real_inner_smul_left, real_inner_smul_right, Real.norm_eq_abs,
    Real.norm_eq_abs, mul_pow, mul_pow, sq_abs, sq_abs]
  have hb : b = 1 - a := by linarith
  subst hb
  ring
theorempenQ_convex_comb
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha, a, b \in \mathbb{R}$, $\mathrm{h0}, x, y \in \mathbb{R}^{d}$.

Assume

  • $a + b = 1$ hab

Then $\operatorname{penQ}(\alpha, \mathrm{h0}, a \cdot x + b \cdot y) = a \cdot \operatorname{penQ}(\alpha, \mathrm{h0}, x) + b \cdot \operatorname{penQ}(\alpha, \mathrm{h0}, y) - a \cdot b \cdot \operatorname{penQ}(\alpha, \mathrm{h0}, x - y)$.

/-- The convexity defect of the quadratic form `S`. -/
theorem penQ_convex_comb {α a b : ℝ} (hab : a + b = 1) (h0 x y : EuclSpace d) :
    penQ α h0 (a • x + b • y)
      = a * penQ α h0 x + b * penQ α h0 y - a * b * penQ α h0 (x - y) := by
  unfold penQ
  rw [norm_sq_convex_comb hab, inner_add_right, real_inner_smul_right,
    real_inner_smul_right, inner_sub_right]
  have hb : b = 1 - a := by linarith
  subst hb
  ring
theorempenP_convex_comb
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha, a, b \in \mathbb{R}$, $\mathrm{h0}, x, y \in \mathbb{R}^{d}$.

Assume

  • $a + b = 1$ hab

Then $\operatorname{penP}(s, r, \alpha, \mathrm{h0}, a \cdot x + b \cdot y) = a \cdot \operatorname{penP}(s, r, \alpha, \mathrm{h0}, x) + b \cdot \operatorname{penP}(s, r, \alpha, \mathrm{h0}, y) - a \cdot b \cdot \operatorname{penP}(s, r, \alpha, \mathrm{h0}, x - y)$.

/-- The convexity defect of the penalty. -/
theorem penP_convex_comb {s r α a b : ℝ} (hab : a + b = 1) (h0 x y : EuclSpace d) :
    penP s r α h0 (a • x + b • y)
      = a * penP s r α h0 x + b * penP s r α h0 y
        - a * b * penP s r α h0 (x - y) := by
  unfold penP
  rw [penQ_convex_comb hab, norm_sq_convex_comb hab]
  ring
theoremconvexOn_quadPart
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $s, r, \alpha, \mu \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Assume

  • $0 \le s$ hs
  • $0 \le r$ hr
  • $0 < \alpha$ hα
  • $4 \cdot \operatorname{penM}(s, r, \alpha, \mathrm{h0}) \le \mu$ hμ

Then ConvexOn ℝ Set.univ fun z => μ / 2 * (‖z.1‖ ^ 2 + ‖z.2‖ ^ 2) - PLaplacian.penP s r α h0 (z.1 - z.2).

PLaplacian.convexOn_quadPartPlaplacian/PenaltyP.lean, lines 179–207
/-- **The quadratic part of the doubled function is convex** for `μ ≥ 4M`. -/
theorem convexOn_quadPart {s r α μ : ℝ} {h0 : EuclSpace d} (hs : 0 ≤ s)
    (hr : 0 ≤ r) (hα : 0 < α) (hμ : 4 * penM s r α h0 ≤ μ) :
    ConvexOn ℝ univ (fun z : EuclSpace d × EuclSpace d =>
      μ / 2 * (‖z.1‖ ^ 2 + ‖z.2‖ ^ 2) - penP s r α h0 (z.1 - z.2)) := by
  refine ⟨convex_univ, fun z₁ _ z₂ _ a b ha hb hab => ?_⟩
  simp only [smul_eq_mul, Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd]
  have e4 : a • z₁.1 + b • z₂.1 - (a • z₁.2 + b • z₂.2)
      = a • (z₁.1 - z₁.2) + b • (z₂.1 - z₂.2) := by
    rw [smul_sub, smul_sub]; abel
  rw [e4, norm_sq_convex_comb hab z₁.1 z₂.1, norm_sq_convex_comb hab z₁.2 z₂.2,
    penP_convex_comb hab]
  -- the defect is a b times the function at the difference, which is ≥ 0
  have e5 : z₁.1 - z₁.2 - (z₂.1 - z₂.2) = (z₁.1 - z₂.1) - (z₁.2 - z₂.2) := by abel
  rw [e5]
  have hpen := penP_le (r := r) (h0 := h0) hs hα ((z₁.1 - z₂.1) - (z₁.2 - z₂.2))
  have hsq : ‖(z₁.1 - z₂.1) - (z₁.2 - z₂.2)‖ ^ 2
      ≤ 2 * (‖z₁.1 - z₂.1‖ ^ 2 + ‖z₁.2 - z₂.2‖ ^ 2) := by
    rw [norm_sub_sq_real]
    have := young_inner (one_pos) (z₁.1 - z₂.1) (-(z₁.2 - z₂.2))
    rw [inner_neg_right, norm_neg] at this
    linarith
  have hM : 0 ≤ penM s r α h0 := penM_nonneg hs hr hα
  have hF : 0 ≤ μ / 2 * (‖z₁.1 - z₂.1‖ ^ 2 + ‖z₁.2 - z₂.2‖ ^ 2)
      - penP s r α h0 ((z₁.1 - z₂.1) - (z₁.2 - z₂.2)) := by
    have h1 := mul_le_mul_of_nonneg_left hsq hM
    nlinarith
  have hab0 : 0 ≤ a * b := mul_nonneg ha hb
  nlinarith [mul_nonneg hab0 hF]

Plaplacian/PenaltyTaylor.lean15 declarations

defpenB
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0}, a, b \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The bilinear form of the second-order term. -/
def penB (α : ℝ) (h0 a b : EuclSpace d) : ℝ :=
  α⁻¹ * (‖h0‖ ^ 2 * inner ℝ a b + 2 * (inner ℝ h0 a * inner ℝ h0 b))
defpenQ
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0}, k \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The quadratic form of the second-order term.** -/
def penQ (α : ℝ) (h0 k : EuclSpace d) : ℝ :=
  α⁻¹ * (‖h0‖ ^ 2 * ‖k‖ ^ 2 + 2 * inner ℝ h0 k ^ 2)
defpenR
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0}, k \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The cubic remainder. -/
def penR (α : ℝ) (h0 k : EuclSpace d) : ℝ :=
  α⁻¹ * (inner ℝ h0 k * ‖k‖ ^ 2 + ‖k‖ ^ 4 / 4)
theorempenQ_eq_penB
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0}, k \in \mathbb{R}^{d}$.

Then $\operatorname{penQ}(\alpha, \mathrm{h0}, k) = \operatorname{penB}(\alpha, \mathrm{h0}, k, k)$.

theorem penQ_eq_penB (α : ℝ) (h0 k : EuclSpace d) :
    penQ α h0 k = penB α h0 k k := by
  unfold penQ penB
  rw [real_inner_self_eq_norm_sq]; ring
theorempenalty_expand
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0}, k \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα

Then $\lVert \mathrm{h0} + k\rVert ^{4} / 4 \cdot \alpha = \lVert \mathrm{h0}\rVert ^{4} / 4 \cdot \alpha + \operatorname{inner}(\mathbb{R}, \lVert \mathrm{h0}\rVert ^{2} / \alpha \cdot \mathrm{h0}, k) + 1 / 2 \cdot \operatorname{penQ}(\alpha, \mathrm{h0}, k) + \operatorname{penR}(\alpha, \mathrm{h0}, k)$.

/-- **The exact expansion of the penalty.** -/
theorem penalty_expand {α : ℝ} (hα : 0 < α) (h0 k : EuclSpace d) :
    ‖h0 + k‖ ^ 4 / (4 * α)
      = ‖h0‖ ^ 4 / (4 * α) + inner ℝ ((‖h0‖ ^ 2 / α) • h0) k
        + (1 / 2) * penQ α h0 k + penR α h0 k := by
  have hne : α ≠ 0 := hα.ne'
  have hsq : ‖h0 + k‖ ^ 4 = (‖h0 + k‖ ^ 2) ^ 2 := by ring
  rw [hsq, norm_add_sq_real, real_inner_smul_left]
  unfold penQ penR
  field_simp
  ring
theoremeventually_penR_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $0 < \alpha$ hα
  • $0 < \eta$ hη

Then ∀ᶠ (k : EuclSpace d) in nhds 0, PLaplacian.penR α h0 k ≤ η * ‖k‖ ^ 2.

/-- **The remainder is below any multiple of the square, near zero.** -/
theorem eventually_penR_le {α : ℝ} (hα : 0 < α) (h0 : EuclSpace d) {η : ℝ}
    (hη : 0 < η) : ∀ᶠ k in 𝓝 (0 : EuclSpace d), penR α h0 k ≤ η * ‖k‖ ^ 2 := by
  have hc : (0:ℝ) < ‖h0‖ + 1 := by positivity
  have hδ : (0:ℝ) < min 1 (η * α / (‖h0‖ + 1)) := lt_min one_pos (by positivity)
  filter_upwards [Metric.ball_mem_nhds (0 : EuclSpace d) hδ] with k hk
  rw [mem_ball, dist_zero_right] at hk
  set r := ‖k‖ with hrdef
  have hr0 : 0 ≤ r := norm_nonneg k
  have hr1 : r < 1 := lt_of_lt_of_le hk (min_le_left _ _)
  have hr2 : r < η * α / (‖h0‖ + 1) := lt_of_lt_of_le hk (min_le_right _ _)
  have hin : inner ℝ h0 k ≤ ‖h0‖ * r := real_inner_le_norm h0 k
  have e1 : inner ℝ h0 k * r ^ 2 ≤ ‖h0‖ * r ^ 3 := by
    calc inner ℝ h0 k * r ^ 2 ≤ (‖h0‖ * r) * r ^ 2 :=
          mul_le_mul_of_nonneg_right hin (sq_nonneg r)
      _ = ‖h0‖ * r ^ 3 := by ring
  have hr3 : 0 ≤ r ^ 3 := pow_nonneg hr0 3
  have e2 : r ^ 4 ≤ r ^ 3 := by
    have : r ^ 4 = r ^ 3 * r := by ring
    rw [this]
    calc r ^ 3 * r ≤ r ^ 3 * 1 := mul_le_mul_of_nonneg_left hr1.le hr3
      _ = r ^ 3 := mul_one _
  have e4 : r * (‖h0‖ + 1) ≤ η * α := ((lt_div_iff₀ hc).1 hr2).le
  have hnorm0 : (0:ℝ) ≤ ‖h0‖ := norm_nonneg h0
  have e5 : inner ℝ h0 k * r ^ 2 + r ^ 4 / 4 ≤ r ^ 2 * (η * α) := by
    have e3 : ‖h0‖ * r ^ 3 + r ^ 3 / 4 ≤ r ^ 2 * (r * (‖h0‖ + 1)) := by
      nlinarith
    have e6 : r ^ 2 * (r * (‖h0‖ + 1)) ≤ r ^ 2 * (η * α) :=
      mul_le_mul_of_nonneg_left e4 (sq_nonneg r)
    linarith
  unfold penR
  calc α⁻¹ * (inner ℝ h0 k * r ^ 2 + r ^ 4 / 4)
      ≤ α⁻¹ * (r ^ 2 * (η * α)) :=
        mul_le_mul_of_nonneg_left e5 (inv_nonneg.2 hα.le)
    _ = η * r ^ 2 := by field_simp
theorempenalty_upper
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $0 < \alpha$ hα
  • $0 < \eta$ hη

Then ∀ᶠ (k : EuclSpace d) in nhds 0, ‖h0 + k‖ ^ 4 / (4 * α) ≤ ‖h0‖ ^ 4 / (4 * α) + inner ℝ ((‖h0‖ ^ 2 / α) • h0) k + 1 / 2 * PLaplacian.penQ α h0 k + η * ‖k‖ ^ 2.

/-- **The Taylor bound of the penalty**: near `ĥ`, the penalty lies below its
second-order polynomial plus `η ‖k‖²`. -/
theorem penalty_upper {α : ℝ} (hα : 0 < α) (h0 : EuclSpace d) {η : ℝ}
    (hη : 0 < η) :
    ∀ᶠ k in 𝓝 (0 : EuclSpace d),
      ‖h0 + k‖ ^ 4 / (4 * α)
        ≤ ‖h0‖ ^ 4 / (4 * α) + inner ℝ ((‖h0‖ ^ 2 / α) • h0) k
          + (1 / 2) * penQ α h0 k + η * ‖k‖ ^ 2 := by
  filter_upwards [eventually_penR_le hα h0 hη] with k hk
  rw [penalty_expand hα h0 k]
  linarith
theorempenaltyGrad_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $x, y \in \mathbb{R}^{d}$.

Then $\operatorname{penaltyGrad}(\alpha, x, y) = (\lVert x - y\rVert ^{2} / \alpha) \cdot (x - y)$.

/-- The penalty gradient is the gradient of the expansion. -/
theorem penaltyGrad_eq (α : ℝ) (x y : EuclSpace d) :
    penaltyGrad α x y = (‖x - y‖ ^ 2 / α) • (x - y) := rfl
theorempenQ_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0}, k \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα

Then $0 \le \operatorname{penQ}(\alpha, \mathrm{h0}, k)$.

theorem penQ_nonneg {α : ℝ} (hα : 0 < α) (h0 k : EuclSpace d) :
    0 ≤ penQ α h0 k := by
  unfold penQ; positivity
theorempenQ_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0}, k \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα

Then $\operatorname{penQ}(\alpha, \mathrm{h0}, k) \le 3 \cdot \alpha(^{-1}) \cdot \lVert \mathrm{h0}\rVert ^{2} \cdot \lVert k\rVert ^{2}$.

/-- The quadratic form is bounded by a multiple of the square. -/
theorem penQ_le {α : ℝ} (hα : 0 < α) (h0 k : EuclSpace d) :
    penQ α h0 k ≤ 3 * α⁻¹ * ‖h0‖ ^ 2 * ‖k‖ ^ 2 := by
  unfold penQ
  have hcs : inner ℝ h0 k ^ 2 ≤ ‖h0‖ ^ 2 * ‖k‖ ^ 2 := by
    have := abs_real_inner_le_norm h0 k
    have h1 : |inner ℝ h0 k| ^ 2 ≤ (‖h0‖ * ‖k‖) ^ 2 :=
      pow_le_pow_left₀ (abs_nonneg _) this 2
    rw [sq_abs, mul_pow] at h1
    exact h1
  have hinv : 0 ≤ α⁻¹ := inv_nonneg.2 hα.le
  calc α⁻¹ * (‖h0‖ ^ 2 * ‖k‖ ^ 2 + 2 * inner ℝ h0 k ^ 2)
      ≤ α⁻¹ * (‖h0‖ ^ 2 * ‖k‖ ^ 2 + 2 * (‖h0‖ ^ 2 * ‖k‖ ^ 2)) :=
        mul_le_mul_of_nonneg_left (by linarith) hinv
    _ = 3 * α⁻¹ * ‖h0‖ ^ 2 * ‖k‖ ^ 2 := by ring
theorempenQ_add
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0}, a, b \in \mathbb{R}^{d}$.

Then $\operatorname{penQ}(\alpha, \mathrm{h0}, a + b) = \operatorname{penQ}(\alpha, \mathrm{h0}, a) + 2 \cdot \operatorname{penB}(\alpha, \mathrm{h0}, a, b) + \operatorname{penQ}(\alpha, \mathrm{h0}, b)$.

/-- The quadratic form of a sum. -/
theorem penQ_add (α : ℝ) (h0 a b : EuclSpace d) :
    penQ α h0 (a + b) = penQ α h0 a + 2 * penB α h0 a b + penQ α h0 b := by
  unfold penQ penB
  rw [norm_add_sq_real, inner_add_right]
  ring
theoremyoung_real
Formal statementgenerated from the Lean declaration

Let $\varepsilon \in \mathbb{R}$, $x, y \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then $2 \cdot x \cdot y \le \varepsilon \cdot x ^{2} + y ^{2} / \varepsilon$.

/-- Young's inequality for reals. -/
theorem young_real {ε : ℝ} (hε : 0 < ε) (x y : ℝ) :
    2 * x * y ≤ ε * x ^ 2 + y ^ 2 / ε := by
  have h1 : ε * (y ^ 2 / ε) = y ^ 2 := by field_simp
  have h : ε * (2 * x * y) ≤ ε * (ε * x ^ 2 + y ^ 2 / ε) := by
    nlinarith [sq_nonneg (ε * x - y)]
  exact le_of_mul_le_mul_left h hε
theoremyoung_inner
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varepsilon \in \mathbb{R}$, $a, b \in \mathbb{R}^{d}$.

Assume

  • $0 < \varepsilon$ hε

Then $2 \cdot \operatorname{inner}(\mathbb{R}, a, b) \le \varepsilon \cdot \lVert a\rVert ^{2} + \lVert b\rVert ^{2} / \varepsilon$.

/-- Young's inequality for the inner product. -/
theorem young_inner {ε : ℝ} (hε : 0 < ε) (a b : EuclSpace d) :
    2 * inner ℝ a b ≤ ε * ‖a‖ ^ 2 + ‖b‖ ^ 2 / ε := by
  have hsq := norm_sub_sq_real (ε • a) b
  rw [norm_smul, Real.norm_eq_abs, mul_pow, sq_abs, real_inner_smul_left] at hsq
  have h0 : 0 ≤ ‖ε • a - b‖ ^ 2 := sq_nonneg _
  have h1 : ε * (‖b‖ ^ 2 / ε) = ‖b‖ ^ 2 := by field_simp
  have h : ε * (2 * inner ℝ a b) ≤ ε * (ε * ‖a‖ ^ 2 + ‖b‖ ^ 2 / ε) := by
    nlinarith
  exact le_of_mul_le_mul_left h hε
theorempenB_young
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha, \varepsilon \in \mathbb{R}$, $\mathrm{h0}, a, b \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • $0 < \varepsilon$ hε

Then $2 \cdot \operatorname{penB}(\alpha, \mathrm{h0}, a, b) \le \varepsilon \cdot \operatorname{penQ}(\alpha, \mathrm{h0}, a) + \operatorname{penQ}(\alpha, \mathrm{h0}, b) / \varepsilon$.

/-- Young's inequality for the bilinear form. -/
theorem penB_young {α ε : ℝ} (hα : 0 < α) (hε : 0 < ε) (h0 a b : EuclSpace d) :
    2 * penB α h0 a b ≤ ε * penQ α h0 a + penQ α h0 b / ε := by
  have h1 := young_inner hε a b
  have h2 := young_real hε (inner ℝ h0 a) (inner ℝ h0 b)
  have hN : 0 ≤ ‖h0‖ ^ 2 := sq_nonneg _
  have hN1 := mul_le_mul_of_nonneg_left h1 hN
  have key : ‖h0‖ ^ 2 * (2 * inner ℝ a b) + 2 * (2 * (inner ℝ h0 a * inner ℝ h0 b))
      ≤ ‖h0‖ ^ 2 * (ε * ‖a‖ ^ 2 + ‖b‖ ^ 2 / ε)
        + 2 * (ε * inner ℝ h0 a ^ 2 + inner ℝ h0 b ^ 2 / ε) := by
    nlinarith
  have hinv : 0 ≤ α⁻¹ := inv_nonneg.2 hα.le
  have hmul := mul_le_mul_of_nonneg_left key hinv
  unfold penB penQ
  have eL : 2 * (α⁻¹ * (‖h0‖ ^ 2 * inner ℝ a b + 2 * (inner ℝ h0 a * inner ℝ h0 b)))
      = α⁻¹ * (‖h0‖ ^ 2 * (2 * inner ℝ a b)
          + 2 * (2 * (inner ℝ h0 a * inner ℝ h0 b))) := by ring
  have eR : ε * (α⁻¹ * (‖h0‖ ^ 2 * ‖a‖ ^ 2 + 2 * inner ℝ h0 a ^ 2))
        + α⁻¹ * (‖h0‖ ^ 2 * ‖b‖ ^ 2 + 2 * inner ℝ h0 b ^ 2) / ε
      = α⁻¹ * (‖h0‖ ^ 2 * (ε * ‖a‖ ^ 2 + ‖b‖ ^ 2 / ε)
          + 2 * (ε * inner ℝ h0 a ^ 2 + inner ℝ h0 b ^ 2 / ε)) := by ring
  rw [eL, eR]
  exact hmul
theorempenQ_young
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha, \varepsilon \in \mathbb{R}$, $\mathrm{h0}, a, b \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • $0 < \varepsilon$ hε

Then $\operatorname{penQ}(\alpha, \mathrm{h0}, a + b) \le (1 + \varepsilon) \cdot \operatorname{penQ}(\alpha, \mathrm{h0}, a) + (1 + 1 / \varepsilon) \cdot \operatorname{penQ}(\alpha, \mathrm{h0}, b)$.

/-- **Young's inequality for the quadratic form**, the decoupling estimate. -/
theorem penQ_young {α ε : ℝ} (hα : 0 < α) (hε : 0 < ε) (h0 a b : EuclSpace d) :
    penQ α h0 (a + b) ≤ (1 + ε) * penQ α h0 a + (1 + 1 / ε) * penQ α h0 b := by
  rw [penQ_add]
  have h := penB_young hα hε h0 a b
  have e : penQ α h0 b / ε = 1 / ε * penQ α h0 b := by ring
  rw [e] at h
  linarith

Plaplacian/Perturbation.lean12 declarations

defpsi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $R \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The strictly concave perturbation. Note this is *not* globally bounded, so
it is not in `BddMeas`; the comparison argument uses it on a bounded domain. -/
def psi (R : ℝ) (x : EuclSpace d) : ℝ := R ^ 2 - ‖x‖ ^ 2
lemmacontinuous_psi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $R \in \mathbb{R}$.

Then $\operatorname{psi}(R)\text{ is continuous}$.

lemma continuous_psi (R : ℝ) : Continuous (psi (d := d) R) := by
  unfold psi; fun_prop
lemmameasurable_psi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $R \in \mathbb{R}$.

Then $\operatorname{psi}(R)\text{ is Borel measurable}$.

lemma measurable_psi (R : ℝ) : Measurable (psi (d := d) R) :=
  (continuous_psi R).measurable
lemmapsi_image
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $R \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then PLaplacian.psi R '' Metric.closedBall x ε = (fun t => R ^ 2 - t ^ 2) '' (fun y => ‖y‖) '' Metric.closedBall x ε.

lemma psi_image (R : ℝ) (x : EuclSpace d) (ε : ℝ) :
    psi R '' closedBall x ε
      = (fun t : ℝ => R ^ 2 - t ^ 2) ''
          ((fun y : EuclSpace d => ‖y‖) '' closedBall x ε) := by
  rw [Set.image_image]; rfl
lemmaantitoneOn_sub_sq
Formal statementgenerated from the Lean declaration

Let $R \in \mathbb{R}$.

Then $\operatorname{AntitoneOn}(t \mapsto R ^{2} - t ^{2}, \operatorname{Ici}(0))$.

lemma antitoneOn_sub_sq (R : ℝ) :
    AntitoneOn (fun t : ℝ => R ^ 2 - t ^ 2) (Ici (0:ℝ)) := by
  intro a ha b hb hab
  simp only [mem_Ici] at ha hb
  have : a ^ 2 ≤ b ^ 2 := by nlinarith
  linarith
lemmanorm_image_subset_Ici
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then (fun y => ‖y‖) '' Metric.closedBall x ε ⊆ Set.Ici 0.

PLaplacian.norm_image_subset_IciPlaplacian/Perturbation.lean, lines 88–90
lemma norm_image_subset_Ici (x : EuclSpace d) (ε : ℝ) :
    (fun y : EuclSpace d => ‖y‖) '' closedBall x ε ⊆ Ici (0:ℝ) := by
  rintro a ⟨y, -, rfl⟩; exact norm_nonneg y
theoremisGreatest_psi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $R \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $x \ne 0$ hx
  • $0 \le \varepsilon$ hε
  • $\varepsilon \le \lVert x\rVert$ hle

Then IsGreatest (PLaplacian.psi R '' Metric.closedBall x ε) (R ^ 2 - (‖x‖ - ε) ^ 2).

/-- The supremum of `ψ` comes from the infimum of the norm. -/
theorem isGreatest_psi (R : ℝ) {x : EuclSpace d} (hx : x ≠ 0) {ε : ℝ}
    (hε : 0 ≤ ε) (hle : ε ≤ ‖x‖) :
    IsGreatest (psi R '' closedBall x ε) (R ^ 2 - (‖x‖ - ε) ^ 2) := by
  rw [psi_image]
  exact ((antitoneOn_sub_sq R).mono (norm_image_subset_Ici x ε)).map_isLeast
    (isLeast_norm_closedBall hx hε hle)
theoremisLeast_psi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $R \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $x \ne 0$ hx
  • $0 \le \varepsilon$ hε

Then IsLeast (PLaplacian.psi R '' Metric.closedBall x ε) (R ^ 2 - (‖x‖ + ε) ^ 2).

/-- The infimum of `ψ` comes from the supremum of the norm. -/
theorem isLeast_psi (R : ℝ) {x : EuclSpace d} (hx : x ≠ 0) {ε : ℝ}
    (hε : 0 ≤ ε) :
    IsLeast (psi R '' closedBall x ε) (R ^ 2 - (‖x‖ + ε) ^ 2) := by
  rw [psi_image]
  exact ((antitoneOn_sub_sq R).mono (norm_image_subset_Ici x ε)).map_isGreatest
    (isGreatest_norm_closedBall hx hε)
theoremsSup_add_sInf_psi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $R \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $x \ne 0$ hx
  • $0 \le \varepsilon$ hε
  • $\varepsilon \le \lVert x\rVert$ hle

Then sSup (PLaplacian.psi R '' Metric.closedBall x ε) + sInf (PLaplacian.psi R '' Metric.closedBall x ε) = 2 * PLaplacian.psi R x - 2 * ε ^ 2.

/-- The extreme values sum to `2 ψ x - 2 ε ^ 2`: the `ε ^ 2` deficit is the
first source of strictness. -/
theorem sSup_add_sInf_psi (R : ℝ) {x : EuclSpace d} (hx : x ≠ 0) {ε : ℝ}
    (hε : 0 ≤ ε) (hle : ε ≤ ‖x‖) :
    sSup (psi R '' closedBall x ε) + sInf (psi R '' closedBall x ε)
      = 2 * psi R x - 2 * ε ^ 2 := by
  rw [(isGreatest_psi R hx hε hle).csSup_eq, (isLeast_psi R hx hε).csInf_eq]
  unfold psi; ring
lemmaintegrableOn_normSq_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(y \mapsto \lVert y\rVert ^{2}, B(x, \varepsilon), \lambda)$.

PLaplacian.integrableOn_normSq_ballPlaplacian/Perturbation.lean, lines 119–122
lemma integrableOn_normSq_ball (x : EuclSpace d) (ε : ℝ) :
    IntegrableOn (fun y : EuclSpace d => ‖y‖ ^ 2) (ball x ε) :=
  (ContinuousOn.integrableOn_compact (isCompact_closedBall _ _)
    (by fun_prop)).mono_set ball_subset_closedBall
lemmasetAverage_const_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • $\operatorname{IntegrableOn}(f, B(x, \varepsilon), \lambda)$ hf

Then $\fint_{B(x, \varepsilon)} (c - f(y) = c - \fint_{B(x, \varepsilon)} f(y) \, dy) \, dy$.

PLaplacian.setAverage_const_subPlaplacian/Perturbation.lean, lines 124–131
lemma setAverage_const_sub (c : ℝ) (f : EuclSpace d → ℝ) (x : EuclSpace d)
    {ε : ℝ} (hε : 0 < ε) (hf : IntegrableOn f (ball x ε)) :
    (⨍ y in ball x ε, (c - f y)) = c - ⨍ y in ball x ε, f y := by
  have hc : IntegrableOn (fun _ : EuclSpace d => c) (ball x ε) :=
    integrableOn_const
  have h1 : (fun y : EuclSpace d => c - f y)
      = (fun _ : EuclSpace d => c) - f := by funext y; rfl
  rw [h1, MeasureTheory.setAverage_sub hc hf, setAverage_const_ball c x hε]
theoremsetAverage_psi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $R \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then $\fint_{B(x, \varepsilon)} (\operatorname{psi}(R, y) = \operatorname{psi}(R, x) - \fint_{B(0, \varepsilon)} \lVert z\rVert ^{2} \, dz) \, dy$.

/-- The average of `ψ` falls short of `ψ x` by the second moment: the second
source of strictness. -/
theorem setAverage_psi (R : ℝ) (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    (⨍ y in ball x ε, psi R y)
      = psi R x - ⨍ z in ball (0 : EuclSpace d) ε, ‖z‖ ^ 2 := by
  unfold psi
  rw [setAverage_const_sub (R ^ 2) (fun y => ‖y‖ ^ 2) x hε
        (integrableOn_normSq_ball x ε),
      setAverage_normSq_ball x hε]
  ring

Plaplacian/PredForm.lean4 declarations

theoremviscF_eq_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then $\operatorname{viscF}(p, q, X) = - \operatorname{normPLapOf}(p, q, X)$.

/-- `viscF` is minus the operator. -/
theorem viscF_eq_neg (p : ℝ) (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    viscF p q X = - normPLapOf p q X := rfl
theoremviscF_le_zero_of_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Assume

  • $0 \le \operatorname{normPLapOf}(p, q, X)$ h

Then $\operatorname{viscF}(p, q, X) \le 0$.

PLaplacian.viscF_le_zero_of_nonnegPlaplacian/PredForm.lean, lines 50–59
/-- **The predicate's requirement, from the chain's conclusion.**

For the homogeneous equation, nonnegativity of the normalized `p`-Laplacian is
the subsolution inequality. -/
theorem viscF_le_zero_of_nonneg {p : ℝ} {q : EuclSpace d}
    {X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ}
    (h : 0 ≤ normPLapOf p q X) :
    viscF p q X ≤ 0 := by
  rw [viscF_eq_neg]
  linarith [h]
theoremhess_eq_fderiv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\operatorname{hess}(\varphi, x) = \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)$.

/-- And the Hessian in the predicate's notation is the iterated derivative in
ours. -/
theorem hess_eq_fderiv (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    hess φ x = fderiv ℝ (fderiv ℝ φ) x := rfl
theoremviscF_le_of_chain
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 \le \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))$ h

Then $\operatorname{viscF}(p, \operatorname{gradient}(\varphi, x), \operatorname{hess}(\varphi, x)) \le 0$.

PLaplacian.viscF_le_of_chainPlaplacian/PredForm.lean, lines 66–71
/-- **The subsolution inequality, in the predicate's exact form.** -/
theorem viscF_le_of_chain {p : ℝ} {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (h : 0 ≤ normPLapOf p (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x)) :
    viscF p (gradient φ x) (hess φ x) ≤ 0 := by
  rw [hess_eq_fderiv]
  exact viscF_le_zero_of_nonneg h

Plaplacian/Prox.lean9 declarations

defproxObj
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $y, x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The proximal objective. -/
def proxObj (f : EuclSpace d → ℝ) (y x : EuclSpace d) : ℝ := f x + 1 / 2 * ‖x - y‖ ^ 2
defproxMap
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}^{d}$.

/-- **The proximal map.** -/
def proxMap (f : EuclSpace d → ℝ) (y : EuclSpace d) : EuclSpace d :=
  Classical.epsilon (fun x => ∀ z, proxObj f y x ≤ proxObj f y z)
theoremle_of_forall_small
Formal statementgenerated from the Lean declaration

Let $A, B, c \in \mathbb{R}$.

Assume

  • $0 \le c$ hc
  • $\forall t,\ 0 < t \to t \le 1 \to A \le B + t \cdot c$ h

Then $A \le B$.

PLaplacian.le_of_forall_smallPlaplacian/Prox.lean, lines 46–62
/-- If `A ≤ B + t c` for all small `t > 0`, then `A ≤ B`. -/
theorem le_of_forall_small {A B c : ℝ} (hc : 0 ≤ c)
    (h : ∀ t : ℝ, 0 < t → t ≤ 1 → A ≤ B + t * c) : A ≤ B := by
  by_contra hlt
  push Not at hlt
  have hAB : 0 < A - B := by linarith
  set t := min 1 ((A - B) / (2 * (c + 1))) with htdef
  have ht : 0 < t := lt_min one_pos (by positivity)
  have h1 := h t ht (min_le_left _ _)
  have ht2 : t ≤ (A - B) / (2 * (c + 1)) := min_le_right _ _
  have h2 : t * c ≤ (A - B) / 2 := by
    have e : (A - B) / (2 * (c + 1)) * c ≤ (A - B) / 2 := by
      rw [div_mul_eq_mul_div, div_le_div_iff₀ (by positivity) (by norm_num)]
      nlinarith
    calc t * c ≤ (A - B) / (2 * (c + 1)) * c := mul_le_mul_of_nonneg_right ht2 hc
      _ ≤ (A - B) / 2 := e
  linarith
theoremprox_exists
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then there exists $x$ such that:

  • $\forall z,\ \operatorname{proxObj}(f, y, x) \le \operatorname{proxObj}(f, y, z)$
/-- **The proximal objective attains its minimum.** -/
theorem prox_exists (hf : ConvexOn ℝ univ f) (y : EuclSpace d) :
    ∃ x, ∀ z, proxObj f y x ≤ proxObj f y z := by
  have hc := convex_continuous hf
  obtain ⟨C, hC0, hC⟩ := convex_lower_linear hf
  set V := proxObj f y y with hV
  set a := ‖y‖ with ha
  set B' := V - f 0 + C with hB'
  set R := 2 * |B'| + 2 * (a + C) + 1 with hR
  set K := {z : EuclSpace d | proxObj f y z ≤ V} with hK
  have hcont : Continuous (proxObj f y) := by unfold proxObj; fun_prop
  have hyK : y ∈ K := by rw [hK, Set.mem_ofPred_eq]
  -- the sublevel set is bounded
  have hKb : K ⊆ closedBall 0 R := by
    intro z hz
    have hz' : proxObj f y z ≤ V := hz
    rw [mem_closedBall_zero_iff]
    unfold proxObj at hz'
    set t := ‖z‖ with ht
    have ht0 : 0 ≤ t := norm_nonneg z
    have hrev : (t - a) ^ 2 ≤ ‖z - y‖ ^ 2 := by
      have h1 : |t - a| ≤ ‖z - y‖ := abs_norm_sub_norm_le z y
      have h2 : |t - a| ^ 2 ≤ ‖z - y‖ ^ 2 := pow_le_pow_left₀ (abs_nonneg _) h1 2
      rwa [sq_abs] at h2
    have hlow := hC z
    have hq : t ^ 2 ≤ 2 * B' + 2 * (a + C) * t := by nlinarith [sq_nonneg a]
    by_contra hbig
    push Not at hbig
    have ht1 : 1 ≤ t := by
      have : 0 ≤ 2 * |B'| + 2 * (a + C) := by
        have := abs_nonneg B'; have := norm_nonneg y; linarith
      linarith
    have hB : 2 * B' ≤ 2 * |B'| * t := by
      have := le_abs_self B'
      have h' : |B'| ≤ |B'| * t := le_mul_of_one_le_right (abs_nonneg _) ht1
      linarith
    have : t ^ 2 ≤ (2 * |B'| + 2 * (a + C)) * t := by nlinarith
    have : t ≤ 2 * |B'| + 2 * (a + C) := by
      by_contra h3; push Not at h3; nlinarith
    linarith
  have hKcl : IsClosed K := isClosed_le hcont continuous_const
  have hKc : IsCompact K :=
    Metric.isCompact_of_isClosed_isBounded hKcl (isBounded_closedBall.subset hKb)
  obtain ⟨x, hxK, hxmin⟩ := hKc.exists_isMinOn ⟨y, hyK⟩ hcont.continuousOn
  refine ⟨x, fun z => ?_⟩
  by_cases hz : z ∈ K
  · exact hxmin hz
  · have h1 : V < proxObj f y z := by
      by_contra h; push Not at h; exact hz h
    have h2 : proxObj f y x ≤ V := hxK
    linarith
theoremprox_min
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $y, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then $\operatorname{proxObj}(f, y, \operatorname{proxMap}(f, y)) \le \operatorname{proxObj}(f, y, z)$.

theorem prox_min (hf : ConvexOn ℝ univ f) (y : EuclSpace d) :
    ∀ z, proxObj f y (proxMap f y) ≤ proxObj f y z :=
  Classical.epsilon_spec (prox_exists hf y)
theoremprox_unique
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $y, x_{1}, x_{2} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf
  • $\forall z,\ \operatorname{proxObj}(f, y, x_{1}) \le \operatorname{proxObj}(f, y, z)$ h₁
  • $\forall z,\ \operatorname{proxObj}(f, y, x_{2}) \le \operatorname{proxObj}(f, y, z)$ h₂

Then $x_{1} = x_{2}$.

/-- **The minimizer is unique.** -/
theorem prox_unique (hf : ConvexOn ℝ univ f) {y x₁ x₂ : EuclSpace d}
    (h₁ : ∀ z, proxObj f y x₁ ≤ proxObj f y z) (h₂ : ∀ z, proxObj f y x₂ ≤ proxObj f y z) :
    x₁ = x₂ := by
  set mid := (1 / 2 : ℝ) • x₁ + (1 / 2 : ℝ) • x₂ with hmid
  have hconv := hf.2 (mem_univ x₁) (mem_univ x₂) (by norm_num : (0:ℝ) ≤ 1 / 2)
    (by norm_num : (0:ℝ) ≤ 1 / 2) (by norm_num : (1:ℝ) / 2 + 1 / 2 = 1)
  simp only [smul_eq_mul] at hconv
  have hsq := norm_sq_convex_comb (by norm_num : (1:ℝ) / 2 + 1 / 2 = 1) (x₁ - y) (x₂ - y)
  have e1 : (1 / 2 : ℝ) • (x₁ - y) + (1 / 2 : ℝ) • (x₂ - y) = mid - y := by
    rw [hmid, smul_sub, smul_sub]; module
  have e2 : x₁ - y - (x₂ - y) = x₁ - x₂ := by abel
  rw [e1, e2] at hsq
  have hm1 := h₁ mid
  have h12 := h₁ x₂
  have h21 := h₂ x₁
  unfold proxObj at hm1 h12 h21
  have hn : ‖x₁ - x₂‖ ^ 2 ≤ 0 := by nlinarith
  have hn0 : ‖x₁ - x₂‖ = 0 := by
    have := sq_nonneg ‖x₁ - x₂‖
    have h0 : ‖x₁ - x₂‖ ^ 2 = 0 := le_antisymm hn this
    exact (pow_eq_zero_iff (by norm_num)).1 h0
  exact sub_eq_zero.1 (norm_eq_zero.1 hn0)
theoremprox_subgrad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then $\operatorname{IsSubgrad}(f, \operatorname{proxMap}(f, y), y - \operatorname{proxMap}(f, y))$.

/-- **The variational inequality**: `y - J y` is a subgradient at `J y`. -/
theorem prox_subgrad (hf : ConvexOn ℝ univ f) (y : EuclSpace d) :
    IsSubgrad f (proxMap f y) (y - proxMap f y) := by
  set x := proxMap f y with hx
  intro z
  apply le_of_forall_small (c := 1 / 2 * ‖z - x‖ ^ 2) (by positivity)
  intro t ht0 ht1
  set xt := (1 - t) • x + t • z with hxt
  have hmin := prox_min hf y xt
  rw [← hx] at hmin
  unfold proxObj at hmin
  have hconv := hf.2 (mem_univ x) (mem_univ z) (by linarith : 0 ≤ 1 - t) ht0.le
    (by ring : 1 - t + t = 1)
  simp only [smul_eq_mul] at hconv
  have e1 : xt - y = (x - y) + t • (z - x) := by rw [hxt]; module
  have hexp : ‖xt - y‖ ^ 2
      = ‖x - y‖ ^ 2 + 2 * t * inner ℝ (x - y) (z - x) + t ^ 2 * ‖z - x‖ ^ 2 := by
    rw [e1, norm_add_sq_real, inner_smul_right, norm_smul, Real.norm_eq_abs,
      abs_of_pos ht0, mul_pow]
    ring
  rw [hexp] at hmin
  have hin : inner ℝ (y - x) (z - x) = -inner ℝ (x - y) (z - x) := by
    rw [← inner_neg_left, neg_sub]
  rw [hin]
  -- divide by t
  have key : t * (f x - inner ℝ (x - y) (z - x))
      ≤ t * (f z + t * (1 / 2 * ‖z - x‖ ^ 2)) := by nlinarith
  have := le_of_mul_le_mul_left key ht0
  linarith
theoremprox_of_subgrad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, p \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf
  • $\operatorname{IsSubgrad}(f, x, p)$ hp

Then $\operatorname{proxMap}(f, x + p) = x$.

PLaplacian.prox_of_subgradPlaplacian/Prox.lean, lines 178–191
/-- **`J(x + p) = x`** for every subgradient `p` at `x`. -/
theorem prox_of_subgrad (hf : ConvexOn ℝ univ f) {x p : EuclSpace d}
    (hp : IsSubgrad f x p) : proxMap f (x + p) = x := by
  have hxmin : ∀ z, proxObj f (x + p) x ≤ proxObj f (x + p) z := by
    intro z
    unfold proxObj
    have h1 := hp z
    have e1 : x - (x + p) = -p := by abel
    have e2 : z - (x + p) = (z - x) - p := by abel
    rw [e1, e2, norm_neg, norm_sub_sq_real]
    have : 0 ≤ ‖z - x‖ ^ 2 := sq_nonneg _
    have hc : inner ℝ (z - x) p = inner ℝ p (z - x) := real_inner_comm _ _
    nlinarith
  exact (prox_unique hf (prox_min hf (x + p)) hxmin)
theoremprox_lipschitz
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then $\operatorname{LipschitzWith}(1, \operatorname{proxMap}(f))$.

PLaplacian.prox_lipschitzPlaplacian/Prox.lean, lines 193–218
/-- **The proximal map is one-Lipschitz.** -/
theorem prox_lipschitz (hf : ConvexOn ℝ univ f) : LipschitzWith 1 (proxMap f) := by
  apply LipschitzWith.of_dist_le_mul
  intro y y'
  simp only [NNReal.coe_one, one_mul, dist_eq_norm]
  set x := proxMap f y
  set x' := proxMap f y'
  have h1 := prox_subgrad hf y x'
  have h2 := prox_subgrad hf y' x
  -- monotonicity
  have hmono : ‖x - x'‖ ^ 2 ≤ inner ℝ (y - y') (x - x') := by
    have e : inner ℝ (y - y') (x - x') - ‖x - x'‖ ^ 2
        = -(inner ℝ (y - x) (x' - x) + inner ℝ (y' - x') (x - x')) := by
      rw [← real_inner_self_eq_norm_sq]
      have a1 : x' - x = -(x - x') := by abel
      rw [a1, inner_neg_right]
      have a2 : y - y' = (y - x) - (y' - x') + (x - x') := by abel
      rw [a2, inner_add_left, inner_sub_left]
      ring
    linarith
  have hcs : inner ℝ (y - y') (x - x') ≤ ‖y - y'‖ * ‖x - x'‖ := real_inner_le_norm _ _
  by_cases h0 : ‖x - x'‖ = 0
  · rw [h0]; exact norm_nonneg _
  · have hpos : 0 < ‖x - x'‖ := lt_of_le_of_ne (norm_nonneg _) (Ne.symm h0)
    have : ‖x - x'‖ * ‖x - x'‖ ≤ ‖y - y'‖ * ‖x - x'‖ := by nlinarith
    exact le_of_mul_le_mul_right this hpos

Plaplacian/PsiSemi.lean5 declarations

theoremsemiconvex_of_supports
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $L \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\forall x,\ \exists g,\ \forall y,\ f(x) + \operatorname{inner}(\mathbb{R}, g, y - x) - L / 2 \cdot \lVert y - x\rVert ^{2} \le f(y)$ h

Then $\operatorname{SemiconvexWith}(L, f)$.

PLaplacian.semiconvex_of_supportsPlaplacian/PsiSemi.lean, lines 37–66
/-- **Uniform lower supports give semiconvexity.** -/
theorem semiconvex_of_supports {L : ℝ} {f : EuclSpace d → ℝ}
    (h : ∀ x, ∃ g, ∀ y, f x + inner ℝ g (y - x) - L / 2 * ‖y - x‖ ^ 2 ≤ f y) :
    SemiconvexWith L f := by
  refine ⟨convex_univ, fun y₁ _ y₂ _ a b ha hb hab => ?_⟩
  simp only [smul_eq_mul]
  set z := a • y₁ + b • y₂ with hz
  obtain ⟨g, hg⟩ := h z
  set G := g + L • z with hG
  -- the subgradient inequality for f + (L/2)‖·‖² at z
  have hsub : ∀ y, f z + L / 2 * ‖z‖ ^ 2 + inner ℝ G (y - z) ≤ f y + L / 2 * ‖y‖ ^ 2 := by
    intro y
    have h1 := hg y
    have hn := congrArg (fun t => L / 2 * t) (norm_sq_about' z y)
    rw [hG, inner_add_left, real_inner_smul_left]
    linarith
  have h1 := hsub y₁
  have h2 := hsub y₂
  -- the linear terms cancel
  have hsum : a • (y₁ - z) + b • (y₂ - z) = 0 := by
    have e : a • (y₁ - z) + b • (y₂ - z) = (a • y₁ + b • y₂) - (a + b) • z := by module
    rw [e, hab, one_smul, ← hz, sub_self]
  have hi : a * inner ℝ G (y₁ - z) + b * inner ℝ G (y₂ - z) = 0 := by
    rw [← real_inner_smul_right, ← real_inner_smul_right, ← inner_add_right, hsum,
      inner_zero_right]
  have k1 := mul_le_mul_of_nonneg_left h1 ha
  have k2 := mul_le_mul_of_nonneg_left h2 hb
  have e : a * (f z + L / 2 * ‖z‖ ^ 2) + b * (f z + L / 2 * ‖z‖ ^ 2)
      = f z + L / 2 * ‖z‖ ^ 2 := by rw [← add_mul, hab, one_mul]
  nlinarith
theoremsemiconcave_psiTheorem 6.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam}, \eta, \mathrm{Cc} \in \mathbb{R}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $0 \le \eta$ hη
  • PLaplacian.SemiconvexWith lam fun y => -V y hV
  • $\forall y,\ 0 \le 1 - 2 \cdot \eta \cdot V(y)$ hc
  • $\forall y,\ 1 - 2 \cdot \eta \cdot V(y) \le \mathrm{Cc}$ hcC

Then PLaplacian.SemiconvexWith (Cc * lam) fun y => -(V y - η * V y ^ 2).

PLaplacian.semiconcave_psiPlaplacian/PsiSemi.lean, lines 68–90
/-- **`V - η V²` is semiconcave.** -/
theorem semiconcave_psi {V : EuclSpace d → ℝ} {lam η Cc : ℝ} (hlam : 0 ≤ lam) (hη : 0 ≤ η)
    (hV : SemiconvexWith lam (fun y => -V y))
    (hc : ∀ y, 0 ≤ 1 - 2 * η * V y) (hcC : ∀ y, 1 - 2 * η * V y ≤ Cc) :
    SemiconvexWith (Cc * lam) (fun y => -(V y - η * V y ^ 2)) := by
  apply semiconvex_of_supports
  intro x
  obtain ⟨P, hP⟩ := semiconvex_support hV x
  refine ⟨(1 - 2 * η * V x) • P, fun y => ?_⟩
  have h1 : -V x + inner ℝ P (y - x) - lam / 2 * ‖y - x‖ ^ 2 ≤ -V y := hP y
  have hc0 := hc x
  have hcx := hcC x
  -- ψ(V y) - ψ(V x) ≤ ψ'(V x)(V y - V x)
  have hψ : (V y - η * V y ^ 2) - (V x - η * V x ^ 2)
      = (1 - 2 * η * V x) * (V y - V x) - η * (V y - V x) ^ 2 := by ring
  have hsq : 0 ≤ η * (V y - V x) ^ 2 := by positivity
  have hcV : (1 - 2 * η * V x) * (V y - V x)
      ≤ (1 - 2 * η * V x) * (-inner ℝ P (y - x) + lam / 2 * ‖y - x‖ ^ 2) :=
    mul_le_mul_of_nonneg_left (by linarith) hc0
  have hlamC : (1 - 2 * η * V x) * (lam / 2 * ‖y - x‖ ^ 2) ≤ Cc * (lam / 2 * ‖y - x‖ ^ 2) :=
    mul_le_mul_of_nonneg_right hcx (by positivity)
  rw [real_inner_smul_left]
  nlinarith
theoremviscF_neg_one
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $q \ne 0$ hq

Then $\operatorname{viscF}(p, - 1 \cdot q, - 1 \cdot X) = - \operatorname{viscF}(p, q, X)$.

/-- The operator at `((-1) • q, (-1) • X)`. -/
theorem viscF_neg_one {p : ℝ} {q : EuclSpace d} (hq : q ≠ 0) (X : Bilin d) :
    viscF p ((-1 : ℝ) • q) ((-1 : ℝ) • X) = -viscF p q X := by
  have hqn : 0 < ‖q‖ := norm_pos_iff.2 hq
  rw [viscF_eq_neg, viscF_eq_neg]
  unfold normPLapOf infLaplacianOf
  rw [laplacianOf_smul]
  have hn : ‖(-1 : ℝ) • q‖ = ‖q‖ := by rw [norm_smul]; simp
  rw [hn]
  have e : ‖q‖⁻¹ • ((-1 : ℝ) • q) = (-1 : ℝ) • (‖q‖⁻¹ • q) := by rw [smul_comm]
  rw [e]
  simp only [map_smul, smul_apply, smul_eq_mul]
  ring
theoremsuperJet_negOne_of_subJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$, $w, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • (q, X) ∈ PLaplacian.SubJet V w h

Then (-1 • q, -1 • X) ∈ PLaplacian.SuperJet (fun y => -V y) w.

PLaplacian.superJet_negOne_of_subJetPlaplacian/PsiSemi.lean, lines 108–119
/-- **A subjet of `V` gives a superjet of `-V`.** -/
theorem superJet_negOne_of_subJet {V : EuclSpace d → ℝ} {w q : EuclSpace d} {X : Bilin d}
    (h : (q, X) ∈ SubJet V w) :
    ((-1 : ℝ) • q, (-1 : ℝ) • X) ∈ SuperJet (fun y => -V y) w := by
  have h' : ∀ η > 0, ∀ᶠ y in 𝓝 w, V w + inner ℝ q (y - w)
      + 1 / 2 * (X (y - w)) (y - w) - η * ‖y - w‖ ^ 2 ≤ V y := h
  intro η hη
  filter_upwards [h' η hη] with y hy
  change -V y ≤ -V w + inner ℝ ((-1 : ℝ) • q) (y - w)
    + 1 / 2 * (((-1 : ℝ) • X) (y - w)) (y - w) + η * ‖y - w‖ ^ 2
  rw [real_inner_smul_left, smul_apply, smul_apply, smul_eq_mul]
  linarith
theoremsubJet_ineq_of_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $O \subseteq \mathbb{R}^{d}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \in \mathbb{R}^{d}$, $q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • ∀ w ∈ O, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SuperJet (fun y => -V y) w → q ≠ 0 → PLaplacian.viscF p q X ≤ 0 hneg
  • $w \in O$ a._@._internal._hyg.0
  • (q, X) ∈ PLaplacian.SubJet V w a._@._internal._hyg.0
  • $q \ne 0$ a._@._internal._hyg.0

Then $0 \le \operatorname{viscF}(p, q, X)$.

PLaplacian.subJet_ineq_of_negPlaplacian/PsiSemi.lean, lines 121–131
/-- **The supersolution jet inequality, from superjets of `-V`.** -/
theorem subJet_ineq_of_neg {p : ℝ} {O : Set (EuclSpace d)} {V : EuclSpace d → ℝ}
    (hneg : ∀ w ∈ O, ∀ (q : EuclSpace d) (X : Bilin d),
      (q, X) ∈ SuperJet (fun y => -V y) w → q ≠ 0 → viscF p q X ≤ 0) :
    ∀ w ∈ O, ∀ (q : EuclSpace d) (X : Bilin d), (q, X) ∈ SubJet V w →
      q ≠ 0 → 0 ≤ viscF p q X := by
  intro w hw q X hj hq
  have hq' : (-1 : ℝ) • q ≠ 0 := smul_ne_zero (by norm_num) hq
  have h1 := hneg w hw _ _ (superJet_negOne_of_subJet hj) hq'
  rw [viscF_neg_one hq] at h1
  linarith

Plaplacian/QuadAverage.lean13 declarations

theoremsum_single_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $z \in \mathbb{R}^{d}$.

Then ∑ i, z.ofLp i • EuclideanSpace.single i 1 = z.

theorem sum_single_eq (z : EuclSpace d) :
    ∑ i : Fin d, (z.ofLp i) • EuclideanSpace.single i (1:ℝ) = z := by
  have h := (EuclideanSpace.basisFun (Fin d) ℝ).sum_repr z
  simpa [EuclideanSpace.basisFun_apply, EuclideanSpace.basisFun_repr] using h
theorembilinear_expand_left
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $z, w \in \mathbb{R}^{d}$.

Then (X z) w = ∑ i, z.ofLp i * (X (EuclideanSpace.single i 1)) w.

PLaplacian.bilinear_expand_leftPlaplacian/QuadAverage.lean, lines 52–57
theorem bilinear_expand_left (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (z w : EuclSpace d) :
    X z w = ∑ i : Fin d,
      (z.ofLp i) * X (EuclideanSpace.single i (1:ℝ)) w := by
  conv_lhs => rw [← sum_single_eq z]
  rw [map_sum]; simp
theorembilinear_expand_right
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $v, w \in \mathbb{R}^{d}$.

Then (X v) w = ∑ j, w.ofLp j * (X v) (EuclideanSpace.single j 1).

PLaplacian.bilinear_expand_rightPlaplacian/QuadAverage.lean, lines 59–64
theorem bilinear_expand_right (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (v w : EuclSpace d) :
    X v w = ∑ j : Fin d,
      (w.ofLp j) * X v (EuclideanSpace.single j (1:ℝ)) := by
  conv_lhs => rw [← sum_single_eq w]
  rw [map_sum]; simp
theoremquadratic_expand
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $z \in \mathbb{R}^{d}$.

Then (X z) z = ∑ i, ∑ j, z.ofLp i * z.ofLp j * (X (EuclideanSpace.single i 1)) (EuclideanSpace.single j 1).

theorem quadratic_expand (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (z : EuclSpace d) :
    X z z = ∑ i : Fin d, ∑ j : Fin d,
      (z.ofLp i) * (z.ofLp j)
        * X (EuclideanSpace.single i (1:ℝ))
            (EuclideanSpace.single j (1:ℝ)) := by
  rw [bilinear_expand_left X z z]
  refine Finset.sum_congr rfl fun i _ => ?_
  rw [bilinear_expand_right X (EuclideanSpace.single i (1:ℝ)) z,
      Finset.mul_sum]
  refine Finset.sum_congr rfl fun j _ => ?_
  ring
theoremsetAverage_mul_const
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$, $s \subseteq \mathbb{R}^{d}$.

Then $\fint_{s} (f(z) \cdot c = \fint_{s} f(z) \, dz \cdot c) \, dz$.

PLaplacian.setAverage_mul_constPlaplacian/QuadAverage.lean, lines 81–87
/-- Mathlib has `integral_mul_const` but no set-average analogue. -/
theorem setAverage_mul_const (f : EuclSpace d → ℝ) (c : ℝ)
    (s : Set (EuclSpace d)) :
    (⨍ z in s, f z * c) = (⨍ z in s, f z) * c := by
  rw [MeasureTheory.setAverage_eq, MeasureTheory.setAverage_eq,
      MeasureTheory.integral_mul_const, smul_eq_mul, smul_eq_mul]
  ring
theoremsetAverage_finsetSum
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\iota$ be a type, $s \in \operatorname{Finset}(\iota)$, $f \colon \iota \to \mathbb{R}^{d} \to \mathbb{R}$, $t \subseteq \mathbb{R}^{d}$.

Assume

  • $\forall i \in s,\ \operatorname{IntegrableOn}(f(i), t, \lambda)$ hf

Then ⨍ (z : EuclSpace d) in t, ∑ i ∈ s, f i z = ∑ i ∈ s, ⨍ (z : EuclSpace d) in t, f i z.

PLaplacian.setAverage_finsetSumPlaplacian/QuadAverage.lean, lines 89–95
/-- Mathlib has `setAverage_add` but no finite-sum version. -/
theorem setAverage_finsetSum {ι : Type*} (s : Finset ι)
    (f : ι → EuclSpace d → ℝ) (t : Set (EuclSpace d))
    (hf : ∀ i ∈ s, MeasureTheory.IntegrableOn (f i) t) :
    (⨍ z in t, ∑ i ∈ s, f i z) = ∑ i ∈ s, ⨍ z in t, f i z := by
  simp only [MeasureTheory.setAverage_eq, smul_eq_mul]
  rw [MeasureTheory.integral_finsetSum s hf, Finset.mul_sum]
theoremsetAverage_mul_coord_eq_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i, j \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Assume

  • $i \ne j$ hij

Then $\fint_{B(0, \varepsilon)} (\operatorname{z.ofLp}(i) \cdot \operatorname{z.ofLp}(j) = 0) \, dz$.

PLaplacian.setAverage_mul_coord_eq_zeroPlaplacian/QuadAverage.lean, lines 99–102
theorem setAverage_mul_coord_eq_zero (i j : Fin d) (hij : i ≠ j) {ε : ℝ} :
    (⨍ z in ball (0 : EuclSpace d) ε, (z.ofLp i) * (z.ofLp j)) = 0 := by
  rw [MeasureTheory.setAverage_eq, integral_mul_coord_ball_eq_zero i j hij ε]
  simp
theoremsetAverage_mul_coord_diag
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $0 < \varepsilon$ hε

Then $\fint_{B(0, \varepsilon)} (\operatorname{z.ofLp}(i) \cdot \operatorname{z.ofLp}(i) = \varepsilon ^{2} / (d + 2)) \, dz$.

PLaplacian.setAverage_mul_coord_diagPlaplacian/QuadAverage.lean, lines 104–112
theorem setAverage_mul_coord_diag [Nontrivial (EuclSpace d)] (hd : 0 < d)
    (i : Fin d) {ε : ℝ} (hε : 0 < ε) :
    (⨍ z in ball (0 : EuclSpace d) ε, (z.ofLp i) * (z.ofLp i))
      = ε ^ 2 / ((d : ℝ) + 2) := by
  have h : (fun z : EuclSpace d => (z.ofLp i) * (z.ofLp i))
      = fun z : EuclSpace d => (z.ofLp i) ^ 2 := by
    funext z; ring
  rw [h]
  exact Radius.setAverage_sq_coord_ball_eps hd i hε
theoremsetAverage_term
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $i, j \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $0 < \varepsilon$ hε

Then ⨍ (z : EuclSpace d) in Metric.ball 0 ε, z.ofLp i * z.ofLp j * (X (EuclideanSpace.single i 1)) (EuclideanSpace.single j 1) = (if i = j then ε ^ 2 / (↑d + 2) else 0) * (X (EuclideanSpace.single i 1)) (EuclideanSpace.single j 1).

theorem setAverage_term [Nontrivial (EuclSpace d)] (hd : 0 < d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) (i j : Fin d) {ε : ℝ}
    (hε : 0 < ε) :
    (⨍ z in ball (0 : EuclSpace d) ε, (z.ofLp i) * (z.ofLp j)
        * X (EuclideanSpace.single i (1:ℝ)) (EuclideanSpace.single j (1:ℝ)))
      = (if i = j then ε ^ 2 / ((d : ℝ) + 2) else 0)
        * X (EuclideanSpace.single i (1:ℝ))
            (EuclideanSpace.single j (1:ℝ)) := by
  rw [setAverage_mul_const (fun z => (z.ofLp i) * (z.ofLp j))]
  by_cases h : i = j
  · subst h
    rw [ite_eq_left rfl, setAverage_mul_coord_diag hd i hε]
  · rw [ite_eq_right h, setAverage_mul_coord_eq_zero i j h]
theoreminner_sum_collapse
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $i \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Then ∑ j, (if i = j then ε ^ 2 / (↑d + 2) else 0) * (X (EuclideanSpace.single i 1)) (EuclideanSpace.single j 1) = ε ^ 2 / (↑d + 2) * (X (EuclideanSpace.single i 1)) (EuclideanSpace.single i 1).

theorem inner_sum_collapse (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (i : Fin d) {ε : ℝ} :
    (∑ j : Fin d, (if i = j then ε ^ 2 / ((d : ℝ) + 2) else 0)
        * X (EuclideanSpace.single i (1:ℝ))
            (EuclideanSpace.single j (1:ℝ)))
      = ε ^ 2 / ((d : ℝ) + 2)
        * X (EuclideanSpace.single i (1:ℝ))
            (EuclideanSpace.single i (1:ℝ)) := by
  rw [Finset.sum_congr rfl (fun j _ => ite_mul _ _ _ _)]
  simp
theoremintegrableOn_term
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $i, j \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Then $\operatorname{IntegrableOn}(z \mapsto \operatorname{z.ofLp}(i) \cdot \operatorname{z.ofLp}(j) \cdot (X(\operatorname{EuclideanSpace.single}(i, 1)))(\operatorname{EuclideanSpace.single}(j, 1)), B(0, \varepsilon), \lambda)$.

theorem integrableOn_term (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (i j : Fin d) (ε : ℝ) :
    MeasureTheory.IntegrableOn
      (fun z : EuclSpace d => (z.ofLp i) * (z.ofLp j)
        * X (EuclideanSpace.single i (1:ℝ)) (EuclideanSpace.single j (1:ℝ)))
      (ball (0 : EuclSpace d) ε) :=
  (ContinuousOn.integrableOn_compact (isCompact_closedBall _ _)
    (by fun_prop)).mono_set ball_subset_closedBall
theoremintegrableOn_inner_sum
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $i \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Then MeasureTheory.IntegrableOn (fun z => ∑ j, z.ofLp i * z.ofLp j * (X (EuclideanSpace.single i 1)) (EuclideanSpace.single j 1)) (Metric.ball 0 ε) MeasureTheory.volume.

PLaplacian.integrableOn_inner_sumPlaplacian/QuadAverage.lean, lines 150–156
theorem integrableOn_inner_sum (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (i : Fin d) (ε : ℝ) :
    MeasureTheory.IntegrableOn
      (fun z : EuclSpace d => ∑ j : Fin d, (z.ofLp i) * (z.ofLp j)
        * X (EuclideanSpace.single i (1:ℝ)) (EuclideanSpace.single j (1:ℝ)))
      (ball (0 : EuclSpace d) ε) :=
  MeasureTheory.integrable_finsetSum _ fun j _ => integrableOn_term X i j ε
theoremsetAverage_quadraticTheorem 3.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $0 < \varepsilon$ hε

Then $\fint_{B(0, \varepsilon)} ((X(z))(z) = \varepsilon ^{2} / (d + 2) \cdot \operatorname{laplacianOf}(X)) \, dz$.

PLaplacian.setAverage_quadraticPlaplacian/QuadAverage.lean, lines 160–194
/-- **The average of a quadratic form over a centred ball.**

The theorem the moment computations of `Plaplacian.BallMoments` were built
for: the average of `X z z` over a ball of radius `ε` is `ε² / (d+2)` times
the trace. -/
theorem setAverage_quadratic [Nontrivial (EuclSpace d)] (hd : 0 < d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) {ε : ℝ} (hε : 0 < ε) :
    (⨍ z in ball (0 : EuclSpace d) ε, X z z)
      = ε ^ 2 / ((d : ℝ) + 2) * laplacianOf X := by
  have hexp : (⨍ z in ball (0 : EuclSpace d) ε, X z z)
      = ⨍ z in ball (0 : EuclSpace d) ε,
          ∑ i : Fin d, ∑ j : Fin d, (z.ofLp i) * (z.ofLp j)
            * X (EuclideanSpace.single i (1:ℝ))
                (EuclideanSpace.single j (1:ℝ)) := by
    congr 1
    funext z
    exact quadratic_expand X z
  rw [hexp]
  rw [setAverage_finsetSum Finset.univ _ _
      (fun i _ => integrableOn_inner_sum X i ε)]
  have hstep : ∀ i : Fin d,
      (⨍ z in ball (0 : EuclSpace d) ε, ∑ j : Fin d, (z.ofLp i) * (z.ofLp j)
          * X (EuclideanSpace.single i (1:ℝ))
              (EuclideanSpace.single j (1:ℝ)))
        = ε ^ 2 / ((d : ℝ) + 2)
          * X (EuclideanSpace.single i (1:ℝ))
              (EuclideanSpace.single i (1:ℝ)) := by
    intro i
    rw [setAverage_finsetSum Finset.univ _ _
        (fun j _ => integrableOn_term X i j ε)]
    rw [Finset.sum_congr rfl (fun j _ => setAverage_term hd X i j hε)]
    exact inner_sum_collapse X i
  rw [Finset.sum_congr rfl (fun i _ => hstep i)]
  unfold laplacianOf
  rw [Finset.mul_sum]

Plaplacian/QuadBound.lean2 declarations

theoremquad_term_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\lVert w\rVert \le \varepsilon$ hw
  • $0 < \varepsilon$ hε

Then $\lvert 1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(w))(w)\rvert \le 1 / 2 \cdot \lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \cdot \varepsilon ^{2}$.

/-- The quadratic term at an increment inside the ball. -/
theorem quad_term_le {φ : EuclSpace d → ℝ} (x : EuclSpace d)
    {w : EuclSpace d} {ε : ℝ} (hw : ‖w‖ ≤ ε) (hε : 0 < ε) :
    |(1 / 2) * fderiv ℝ (fderiv ℝ φ) x w w|
      ≤ (1 / 2) * ‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 := by
  have h := quadratic_le_of_norm_le (fderiv ℝ (fderiv ℝ φ) x)
    (le_refl ‖fderiv ℝ (fderiv ℝ φ) x‖) w
  have hw2 : ‖w‖ ^ 2 ≤ ε ^ 2 := by
    have h0 : (0:ℝ) ≤ ‖w‖ := norm_nonneg w
    nlinarith [hw, h0]
  have hnn : (0:ℝ) ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ :=
    ContinuousLinearMap.opNorm_nonneg _
  rw [abs_mul, abs_of_nonneg (by norm_num : (0:ℝ) ≤ 1/2)]
  nlinarith [h, hw2, hnn]
theoremquad_diff_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w, v \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\lVert w\rVert \le \varepsilon$ hw
  • $\lVert v\rVert \le \varepsilon$ hv
  • $0 < \varepsilon$ hε

Then $1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(w))(w) - 1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(v))(v) \le \lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \cdot \varepsilon ^{2}$.

/-- The difference of two quadratic terms is bounded. -/
theorem quad_diff_le {φ : EuclSpace d → ℝ} (x : EuclSpace d)
    {w v : EuclSpace d} {ε : ℝ} (hw : ‖w‖ ≤ ε) (hv : ‖v‖ ≤ ε)
    (hε : 0 < ε) :
    (1 / 2) * fderiv ℝ (fderiv ℝ φ) x w w
        - (1 / 2) * fderiv ℝ (fderiv ℝ φ) x v v
      ≤ ‖fderiv ℝ (fderiv ℝ φ) x‖ * ε ^ 2 := by
  have h1 := quad_term_le (φ := φ) x hw hε
  have h2 := quad_term_le (φ := φ) x hv hε
  have h1' := abs_le.1 h1
  have h2' := abs_le.1 h2
  linarith [h1'.1, h1'.2, h2'.1, h2'.2]

Plaplacian/QuadCompare.lean2 declarations

theoremquad_sub_quad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $u, v \in \mathbb{R}^{d}$.

Then $(X(u))(u) - (X(v))(v) = (X(u - v))(u) + (X(v))(u - v)$.

/-- The bilinear difference identity. -/
theorem quad_sub_quad (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (u v : EuclSpace d) :
    X u u - X v v = X (u - v) u + X v (u - v) := by
  have h1 : X (u - v) u = X u u - X v u := by
    rw [map_sub]
    rfl
  have h2 : X v (u - v) = X v u - X v v := by
    rw [map_sub]
  rw [h1, h2]
  ring
theoremquad_diff_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $u, v \in \mathbb{R}^{d}$.

Then $\lvert (X(u))(u) - (X(v))(v)\rvert \le \lVert X\rVert \cdot \lVert u - v\rVert \cdot (\lVert u\rVert + \lVert v\rVert)$.

/-- **The quadratic terms differ by a controlled amount.** -/
theorem quad_diff_bound (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (u v : EuclSpace d) :
    |X u u - X v v| ≤ ‖X‖ * ‖u - v‖ * (‖u‖ + ‖v‖) := by
  rw [quad_sub_quad X u v]
  have h1 : |X (u - v) u| ≤ ‖X‖ * ‖u - v‖ * ‖u‖ := by
    have a1 : ‖X (u - v) u‖ ≤ ‖X (u - v)‖ * ‖u‖ :=
      ContinuousLinearMap.le_opNorm _ _
    have a2 : ‖X (u - v)‖ ≤ ‖X‖ * ‖u - v‖ :=
      ContinuousLinearMap.le_opNorm _ _
    have hu : (0:ℝ) ≤ ‖u‖ := norm_nonneg u
    simp only [Real.norm_eq_abs] at a1
    nlinarith [a1, a2, hu, norm_nonneg (X (u - v))]
  have h2 : |X v (u - v)| ≤ ‖X‖ * ‖v‖ * ‖u - v‖ := by
    have a1 : ‖X v (u - v)‖ ≤ ‖X v‖ * ‖u - v‖ :=
      ContinuousLinearMap.le_opNorm _ _
    have a2 : ‖X v‖ ≤ ‖X‖ * ‖v‖ :=
      ContinuousLinearMap.le_opNorm _ _
    have huv : (0:ℝ) ≤ ‖u - v‖ := norm_nonneg _
    simp only [Real.norm_eq_abs] at a1
    nlinarith [a1, a2, huv, norm_nonneg (X v)]
  have h3 : |X (u - v) u + X v (u - v)|
      ≤ |X (u - v) u| + |X v (u - v)| := abs_add_le _ _
  nlinarith [h1, h2, h3]

Plaplacian/QuadForms.lean13 declarations

defidForm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in $\operatorname{Bilin}(d)$.

/-- **The identity form**, as the second derivative of `½‖·‖²`. -/
def idForm (d : ℕ) : Bilin d :=
  fderiv ℝ (fderiv ℝ (fun y : EuclSpace d => (1 / 2) * ‖y‖ ^ 2)) 0
theoremidForm_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \in \mathbb{R}^{d}$.

Then $((\operatorname{idForm}(d))(v))(v) = \lVert v\rVert ^{2}$.

theorem idForm_apply (v : EuclSpace d) : (idForm d v) v = ‖v‖ ^ 2 := by
  unfold idForm
  set ψ : EuclSpace d → ℝ := fun y => (1 / 2) * ‖y‖ ^ 2 with hψ
  have hc : ContDiff ℝ 2 ψ := contDiff_const.mul (contDiff_norm_sq ℝ)
  rw [← line_deriv_two hc 0 v]
  have hfun : (fun s : ℝ => ψ (0 + s • v))
      = fun s => 0 + s * 0 + s ^ 2 * ((1 / 2) * ‖v‖ ^ 2) := by
    funext s
    simp only [hψ, zero_add, norm_smul, Real.norm_eq_abs, mul_pow, sq_abs]
    ring
  rw [hfun, deriv_deriv_quad_poly]
  ring
defsymmForm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$.

Its value lies in $\operatorname{Bilin}(d)$.

/-- **The symmetrization of a form.** -/
def symmForm (X : Bilin d) : Bilin d := (1 / 2 : ℝ) • (X + X.flip)
theoremsymmForm_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$, $u, w \in \mathbb{R}^{d}$.

Then $((\operatorname{symmForm}(X))(u))(w) = 1 / 2 \cdot ((X(u))(w) + (X(w))(u))$.

theorem symmForm_apply (X : Bilin d) (u w : EuclSpace d) :
    (symmForm X u) w = (1 / 2) * ((X u) w + (X w) u) := by
  simp only [symmForm, smul_apply,
    add_apply, ContinuousLinearMap.flip_apply, smul_eq_mul]
theoremsymmForm_apply_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$, $v \in \mathbb{R}^{d}$.

Then $((\operatorname{symmForm}(X))(v))(v) = (X(v))(v)$.

PLaplacian.symmForm_apply_selfPlaplacian/QuadForms.lean, lines 75–77
theorem symmForm_apply_self (X : Bilin d) (v : EuclSpace d) :
    (symmForm X v) v = (X v) v := by
  rw [symmForm_apply]; ring
theoremsymmForm_comm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$, $u, w \in \mathbb{R}^{d}$.

Then $((\operatorname{symmForm}(X))(u))(w) = ((\operatorname{symmForm}(X))(w))(u)$.

theorem symmForm_comm (X : Bilin d) (u w : EuclSpace d) :
    (symmForm X u) w = (symmForm X w) u := by
  rw [symmForm_apply, symmForm_apply]; ring
theoremsuperJet_symmForm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • (q, X) ∈ PLaplacian.SuperJet u x h

Then (q, PLaplacian.symmForm X) ∈ PLaplacian.SuperJet u x.

PLaplacian.superJet_symmFormPlaplacian/QuadForms.lean, lines 83–92
/-- Symmetrization keeps a superjet. -/
theorem superJet_symmForm {u : EuclSpace d → ℝ} {x q : EuclSpace d}
    {X : Bilin d} (h : (q, X) ∈ SuperJet u x) :
    (q, symmForm X) ∈ SuperJet u x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change u y ≤ u x + inner ℝ q (y - x) + (1 / 2) * (symmForm X (y - x)) (y - x)
    + η * ‖y - x‖ ^ 2
  rw [symmForm_apply_self]
  exact hy
theoremsubJet_symmForm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • (q, X) ∈ PLaplacian.SubJet u x h

Then (q, PLaplacian.symmForm X) ∈ PLaplacian.SubJet u x.

/-- Symmetrization keeps a subjet. -/
theorem subJet_symmForm {u : EuclSpace d → ℝ} {x q : EuclSpace d}
    {X : Bilin d} (h : (q, X) ∈ SubJet u x) :
    (q, symmForm X) ∈ SubJet u x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change u x + inner ℝ q (y - x) + (1 / 2) * (symmForm X (y - x)) (y - x)
    - η * ‖y - x‖ ^ 2 ≤ u y
  rw [symmForm_apply_self]
  exact hy
theoremquadLE_symmForm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X, Y \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{QuadLE}(X, Y)$ h

Then $\operatorname{QuadLE}(\operatorname{symmForm}(X), \operatorname{symmForm}(Y))$.

theorem quadLE_symmForm {X Y : Bilin d} (h : QuadLE X Y) :
    QuadLE (symmForm X) (symmForm Y) := by
  intro v
  rw [symmForm_apply_self, symmForm_apply_self]
  exact h v
theorempolar_symmForm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$, $u, w \in \mathbb{R}^{d}$.

Then $4 \cdot ((\operatorname{symmForm}(X))(u))(w) = ((\operatorname{symmForm}(X))(u + w))(u + w) - ((\operatorname{symmForm}(X))(u - w))(u - w)$.

/-- Polarization for a symmetric form. -/
theorem polar_symmForm (X : Bilin d) (u w : EuclSpace d) :
    4 * (symmForm X u) w
      = (symmForm X (u + w)) (u + w) - (symmForm X (u - w)) (u - w) := by
  simp only [map_add, map_sub, add_apply,
    sub_apply]
  have h := symmForm_comm X u w
  ring_nf
  linarith
theoremsymmForm_le_half
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$, $L \in \mathbb{R}$, $u, w \in \mathbb{R}^{d}$.

Assume

  • $\forall v,\ \lvert (X(v))(v)\rvert \le L \cdot \lVert v\rVert ^{2}$ hX

Then $\lvert ((\operatorname{symmForm}(X))(u))(w)\rvert \le L / 2 \cdot (\lVert u\rVert ^{2} + \lVert w\rVert ^{2})$.

/-- The polarization bound. -/
theorem symmForm_le_half {X : Bilin d} {L : ℝ}
    (hX : ∀ v, |(X v) v| ≤ L * ‖v‖ ^ 2) (u w : EuclSpace d) :
    |(symmForm X u) w| ≤ L / 2 * (‖u‖ ^ 2 + ‖w‖ ^ 2) := by
  have hp := polar_symmForm X u w
  have h1 := hX (u + w)
  have h2 := hX (u - w)
  rw [← symmForm_apply_self X (u + w)] at h1
  rw [← symmForm_apply_self X (u - w)] at h2
  have hpar : ‖u + w‖ ^ 2 + ‖u - w‖ ^ 2 = 2 * (‖u‖ ^ 2 + ‖w‖ ^ 2) := by
    rw [norm_add_sq_real, norm_sub_sq_real]; ring
  have hparL : L * ‖u + w‖ ^ 2 + L * ‖u - w‖ ^ 2
      = L * (2 * (‖u‖ ^ 2 + ‖w‖ ^ 2)) := by rw [← hpar]; ring
  rw [abs_le] at h1 h2 ⊢
  obtain ⟨h1a, h1b⟩ := h1
  obtain ⟨h2a, h2b⟩ := h2
  constructor <;> linarith
theoremsymmForm_le_mul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$, $L \in \mathbb{R}$, $u, w \in \mathbb{R}^{d}$.

Assume

  • $0 \le L$ _hL
  • $\forall v,\ \lvert (X(v))(v)\rvert \le L \cdot \lVert v\rVert ^{2}$ hX

Then $\lvert ((\operatorname{symmForm}(X))(u))(w)\rvert \le L \cdot \lVert u\rVert \cdot \lVert w\rVert$.

/-- **The rescaled bound**: `|Xˢ(u,w)| ≤ L ‖u‖ ‖w‖`. -/
theorem symmForm_le_mul {X : Bilin d} {L : ℝ} (_hL : 0 ≤ L)
    (hX : ∀ v, |(X v) v| ≤ L * ‖v‖ ^ 2) (u w : EuclSpace d) :
    |(symmForm X u) w| ≤ L * ‖u‖ * ‖w‖ := by
  by_cases hu : u = 0
  · subst hu; simp
  by_cases hw : w = 0
  · subst hw; simp
  have hnu : 0 < ‖u‖ := norm_pos_iff.2 hu
  have hnw : 0 < ‖w‖ := norm_pos_iff.2 hw
  set t := Real.sqrt (‖w‖ / ‖u‖) with htdef
  have ht : 0 < t := Real.sqrt_pos.2 (div_pos hnw hnu)
  have ht2 : t ^ 2 = ‖w‖ / ‖u‖ := Real.sq_sqrt (div_pos hnw hnu).le
  -- the form is unchanged when u is scaled by t and w by 1/t
  have hscale : (symmForm X (t • u)) (t⁻¹ • w) = (symmForm X u) w := by
    simp only [map_smul, smul_apply, smul_eq_mul]
    field_simp
  have hb := symmForm_le_half hX (t • u) (t⁻¹ • w)
  rw [hscale] at hb
  have e1 : ‖t • u‖ ^ 2 = ‖u‖ * ‖w‖ := by
    rw [norm_smul, Real.norm_eq_abs, abs_of_pos ht, mul_pow, ht2]
    field_simp
  have e2 : ‖t⁻¹ • w‖ ^ 2 = ‖u‖ * ‖w‖ := by
    rw [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_pos ht, mul_pow, inv_pow, ht2]
    field_simp
  rw [e1, e2] at hb
  linarith
theoremnorm_symmForm_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$, $L \in \mathbb{R}$.

Assume

  • $0 \le L$ hL
  • $\forall v,\ \lvert (X(v))(v)\rvert \le L \cdot \lVert v\rVert ^{2}$ hX

Then $\lVert \operatorname{symmForm}(X)\rVert \le L$.

/-- **The operator norm of a symmetrized form is bounded by its quadratic
bound.** -/
theorem norm_symmForm_le {X : Bilin d} {L : ℝ} (hL : 0 ≤ L)
    (hX : ∀ v, |(X v) v| ≤ L * ‖v‖ ^ 2) : ‖symmForm X‖ ≤ L := by
  apply ContinuousLinearMap.opNorm_le_bound₂ _ hL
  intro u w
  rw [Real.norm_eq_abs]
  exact symmForm_le_mul hL hX u w

Plaplacian/QuadInf.lean2 declarations

theoremgradDir_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\operatorname{gradDir}(\varphi, x) = \lVert \operatorname{gradient}(\varphi, x)\rVert(^{-1}) \cdot \operatorname{gradient}(\varphi, x)$.

/-- `gradDir` is the vector appearing in `infLaplacianOf`. -/
theorem gradDir_eq (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    gradDir φ x = ‖gradient φ x‖⁻¹ • gradient φ x := rfl
theoremquad_at_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Then $1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(\varepsilon \cdot \operatorname{gradDir}(\varphi, x)))(\varepsilon \cdot \operatorname{gradDir}(\varphi, x)) = \varepsilon ^{2} / 2 \cdot \operatorname{infLaplacianOf}(\operatorname{gradient}(\varphi, x), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))$.

/-- **The quadratic term at the shifted point is the infinity Laplacian.** -/
theorem quad_at_shift {φ : EuclSpace d → ℝ} (x : EuclSpace d) (ε : ℝ) :
    (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (ε • gradDir φ x)
        (ε • gradDir φ x)
      = (ε ^ 2 / 2) * infLaplacianOf (gradient φ x)
          (fderiv ℝ (fderiv ℝ φ) x) := by
  unfold infLaplacianOf
  rw [gradDir_eq]
  simp only [ContinuousLinearMap.map_smul, FunLike.coe_smul,
    Pi.smul_apply, smul_eq_mul]
  ring

Plaplacian/Quartic.lean11 declarations

defquartS
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, \mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The squared distance to the base point. -/
def quartS (x₀ : EuclSpace d) : EuclSpace d → ℝ := fun w => ‖w - x₀‖ ^ 2
defquart
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, \mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The quartic perturbation. -/
def quart (x₀ : EuclSpace d) : EuclSpace d → ℝ := fun w => (‖w - x₀‖ ^ 2) ^ 2
theoremcontDiff_quartS
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$, $n \in \operatorname{WithTop}(\mathbb{N}, \infty)$.

Then $\operatorname{ContDiff}(\mathbb{R}, n, \operatorname{quartS}(x_{0}))$.

PLaplacian.contDiff_quartSPlaplacian/Quartic.lean, lines 57–60
theorem contDiff_quartS (x₀ : EuclSpace d) {n : WithTop ℕ∞} :
    ContDiff ℝ n (quartS x₀) := by
  unfold quartS
  exact (contDiff_norm_sq ℝ).comp (contDiff_id.sub contDiff_const)
theoremcontDiff_quart
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$, $n \in \operatorname{WithTop}(\mathbb{N}, \infty)$.

Then $\operatorname{ContDiff}(\mathbb{R}, n, \operatorname{quart}(x_{0}))$.

theorem contDiff_quart (x₀ : EuclSpace d) {n : WithTop ℕ∞} :
    ContDiff ℝ n (quart x₀) := by
  have h : quart x₀ = fun w => quartS x₀ w ^ 2 := rfl
  rw [h]
  exact (contDiff_quartS x₀).pow 2
theoremquart_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$.

Then $\operatorname{quart}(x_{0}, x_{0}) = 0$.

theorem quart_self (x₀ : EuclSpace d) : quart x₀ x₀ = 0 := by
  simp [quart]
theoremquart_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, w \in \mathbb{R}^{d}$.

Assume

  • $w \ne x_{0}$ hw

Then $0 < \operatorname{quart}(x_{0}, w)$.

theorem quart_pos {x₀ w : EuclSpace d} (hw : w ≠ x₀) : 0 < quart x₀ w := by
  unfold quart
  have : 0 < ‖w - x₀‖ := norm_pos_iff.2 (sub_ne_zero.2 hw)
  positivity
theoremquart_nonneg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, w \in \mathbb{R}^{d}$.

Then $0 \le \operatorname{quart}(x_{0}, w)$.

theorem quart_nonneg (x₀ w : EuclSpace d) : 0 ≤ quart x₀ w := by
  unfold quart; positivity
theoremfderiv_quartS_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$.

Then $\operatorname{fderiv}(\mathbb{R}, \operatorname{quartS}(x_{0}), x_{0}) = 0$.

PLaplacian.fderiv_quartS_selfPlaplacian/Quartic.lean, lines 79–86
/-- The squared distance has a minimum at the base point, so its derivative
there vanishes. -/
theorem fderiv_quartS_self (x₀ : EuclSpace d) :
    fderiv ℝ (quartS x₀) x₀ = 0 := by
  apply IsLocalMin.fderiv_eq_zero
  refine Filter.Eventually.of_forall (fun w => ?_)
  unfold quartS
  simp
theoremfderiv_quart_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, w \in \mathbb{R}^{d}$.

Then $\operatorname{fderiv}(\mathbb{R}, \operatorname{quart}(x_{0}), w) = 2 \cdot \operatorname{quartS}(x_{0}, w) \cdot \operatorname{fderiv}(\mathbb{R}, \operatorname{quartS}(x_{0}), w)$.

PLaplacian.fderiv_quart_eqPlaplacian/Quartic.lean, lines 88–98
/-- The derivative of the quartic, as twice the squared distance times the
derivative of the squared distance. -/
theorem fderiv_quart_eq (x₀ w : EuclSpace d) :
    fderiv ℝ (quart x₀) w = (2 * quartS x₀ w) • fderiv ℝ (quartS x₀) w := by
  have hd : HasFDerivAt (quartS x₀) (fderiv ℝ (quartS x₀) w) w :=
    ((contDiff_quartS x₀ (n := 1)).differentiable (by norm_num) w).hasFDerivAt
  have h := hd.pow 2
  have hq : quart x₀ = fun x => quartS x₀ x ^ 2 := rfl
  rw [hq, h.fderiv]
  congr 1
  simp
theoremfderiv_quart_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$.

Then $\operatorname{fderiv}(\mathbb{R}, \operatorname{quart}(x_{0}), x_{0}) = 0$.

PLaplacian.fderiv_quart_selfPlaplacian/Quartic.lean, lines 100–103
/-- **The gradient of the quartic vanishes at the base point.** -/
theorem fderiv_quart_self (x₀ : EuclSpace d) :
    fderiv ℝ (quart x₀) x₀ = 0 := by
  rw [fderiv_quart_eq, fderiv_quartS_self, smul_zero]
theoremhess_quart_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$.

Then $\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \operatorname{quart}(x_{0})), x_{0}) = 0$.

/-- **The Hessian of the quartic vanishes at the base point.** -/
theorem hess_quart_self (x₀ : EuclSpace d) :
    fderiv ℝ (fderiv ℝ (quart x₀)) x₀ = 0 := by
  have heq : fderiv ℝ (quart x₀)
      = (fun w => 2 * quartS x₀ w) • fderiv ℝ (quartS x₀) := by
    funext w; exact fderiv_quart_eq x₀ w
  rw [heq]
  -- the scalar factor
  have hcd : Differentiable ℝ (fun w => 2 * quartS x₀ w) :=
    ((contDiff_quartS x₀ (n := 1)).differentiable (by norm_num)).const_mul 2
  have hc := (hcd x₀).hasFDerivAt
  -- the derivative factor
  have hLd : Differentiable ℝ (fderiv ℝ (quartS x₀)) :=
    ((contDiff_quartS x₀ (n := 2)).fderiv_right (m := 1)
      (by norm_num)).differentiable (by norm_num)
  have hL := (hLd x₀).hasFDerivAt
  -- the product rule, with both factors vanishing at the base point
  have h := hc.smul hL
  have hs0 : quartS x₀ x₀ = 0 := by simp [quartS]
  have hval : (2 * quartS x₀ x₀) • fderiv ℝ (fderiv ℝ (quartS x₀)) x₀
      + (fderiv ℝ (fun w => 2 * quartS x₀ w) x₀).smulRight
          (fderiv ℝ (quartS x₀) x₀) = 0 := by
    rw [fderiv_quartS_self, hs0]
    ext v w
    simp
  rw [hval] at h
  exact h.fderiv

Plaplacian/QuarticJets.lean9 declarations

theoremsuperJet_add
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f, g \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q_{1}, q_{2} \in \mathbb{R}^{d}$, $X_{1}, X_{2} \in \operatorname{Bilin}(d)$.

Assume

  • (q₁, X₁) ∈ PLaplacian.SuperJet f x h₁
  • (q₂, X₂) ∈ PLaplacian.SuperJet g x h₂

Then (q₁ + q₂, X₁ + X₂) ∈ PLaplacian.SuperJet (fun y => f y + g y) x.

/-- **Superjets add.** -/
theorem superJet_add (h₁ : (q₁, X₁) ∈ SuperJet f x) (h₂ : (q₂, X₂) ∈ SuperJet g x) :
    (q₁ + q₂, X₁ + X₂) ∈ SuperJet (fun y => f y + g y) x := by
  intro η hη
  filter_upwards [h₁ (η / 2) (by positivity), h₂ (η / 2) (by positivity)]
    with y hy₁ hy₂
  change f y ≤ f x + inner ℝ q₁ (y - x) + (1 / 2) * (X₁ (y - x)) (y - x)
    + η / 2 * ‖y - x‖ ^ 2 at hy₁
  change g y ≤ g x + inner ℝ q₂ (y - x) + (1 / 2) * (X₂ (y - x)) (y - x)
    + η / 2 * ‖y - x‖ ^ 2 at hy₂
  change f y + g y ≤ f x + g x + inner ℝ (q₁ + q₂) (y - x)
    + (1 / 2) * ((X₁ + X₂) (y - x)) (y - x) + η * ‖y - x‖ ^ 2
  rw [inner_add_left, add_form_apply]
  linarith
theoremsuperJet_comp_add
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q_{1} \in \mathbb{R}^{d}$, $X_{1} \in \operatorname{Bilin}(d)$, $c \in \mathbb{R}^{d}$.

Assume

  • (q₁, X₁) ∈ PLaplacian.SuperJet f (x + c) h

Then (q₁, X₁) ∈ PLaplacian.SuperJet (fun y => f (y + c)) x.

PLaplacian.superJet_comp_addPlaplacian/QuarticJets.lean, lines 57–71
/-- **Superjets translate.** -/
theorem superJet_comp_add (c : EuclSpace d) (h : (q₁, X₁) ∈ SuperJet f (x + c)) :
    (q₁, X₁) ∈ SuperJet (fun y => f (y + c)) x := by
  intro η hη
  have hT : Tendsto (fun y : EuclSpace d => y + c) (𝓝 x) (𝓝 (x + c)) :=
    (continuous_id.add continuous_const).tendsto x
  filter_upwards [hT.eventually (h η hη)] with y hy
  change f (y + c) ≤ f (x + c) + inner ℝ q₁ (y + c - (x + c))
    + (1 / 2) * (X₁ (y + c - (x + c))) (y + c - (x + c))
    + η * ‖y + c - (x + c)‖ ^ 2 at hy
  change f (y + c) ≤ f (x + c) + inner ℝ q₁ (y - x) + (1 / 2) * (X₁ (y - x)) (y - x)
    + η * ‖y - x‖ ^ 2
  have e : y + c - (x + c) = y - x := by abel
  rw [e] at hy
  exact hy
theoremsuperJet_add_affine
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q_{1} \in \mathbb{R}^{d}$, $X_{1} \in \operatorname{Bilin}(d)$, $p \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • (q₁, X₁) ∈ PLaplacian.SuperJet f x h

Then (q₁ + p, X₁) ∈ PLaplacian.SuperJet (fun y => f y + inner ℝ p y + c) x.

PLaplacian.superJet_add_affinePlaplacian/QuarticJets.lean, lines 73–84
/-- Adding an affine function shifts a superjet's gradient. -/
theorem superJet_add_affine (h : (q₁, X₁) ∈ SuperJet f x) (p : EuclSpace d) (c : ℝ) :
    (q₁ + p, X₁) ∈ SuperJet (fun y => f y + inner ℝ p y + c) x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change f y ≤ f x + inner ℝ q₁ (y - x) + (1 / 2) * (X₁ (y - x)) (y - x)
    + η * ‖y - x‖ ^ 2 at hy
  change f y + inner ℝ p y + c ≤ f x + inner ℝ p x + c + inner ℝ (q₁ + p) (y - x)
    + (1 / 2) * (X₁ (y - x)) (y - x) + η * ‖y - x‖ ^ 2
  have e : inner ℝ p (y - x) = inner ℝ p y - inner ℝ p x := inner_sub_right _ _ _
  rw [inner_add_left]
  linarith
theoremquartic_expand
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, k \in \mathbb{R}^{d}$.

Then $\lVert x + k\rVert ^{4} = \lVert x\rVert ^{4} + \operatorname{inner}(\mathbb{R}, 4 \cdot \lVert x\rVert ^{2} \cdot x, k) + (2 \cdot \lVert x\rVert ^{2} \cdot \lVert k\rVert ^{2} + 4 \cdot \operatorname{inner}(\mathbb{R}, x, k) ^{2}) + \operatorname{penR}(1 / 4, x, k)$.

/-- **The exact expansion of the quartic.** -/
theorem quartic_expand (x k : EuclSpace d) :
    ‖x + k‖ ^ 4 = ‖x‖ ^ 4 + inner ℝ ((4 * ‖x‖ ^ 2) • x) k
      + (2 * ‖x‖ ^ 2 * ‖k‖ ^ 2 + 4 * inner ℝ x k ^ 2) + penR (1 / 4) x k := by
  have hsq : ‖x + k‖ ^ 4 = (‖x + k‖ ^ 2) ^ 2 := by ring
  rw [hsq, norm_add_sq_real, real_inner_smul_left]
  unfold penR
  ring
theoremquartic_quad_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, k \in \mathbb{R}^{d}$.

Then $2 \cdot \lVert x\rVert ^{2} \cdot \lVert k\rVert ^{2} + 4 \cdot \operatorname{inner}(\mathbb{R}, x, k) ^{2} \le 6 \cdot \lVert x\rVert ^{2} \cdot \lVert k\rVert ^{2}$.

/-- The quadratic part of the quartic is at most `6 ‖x‖² ‖k‖²`. -/
theorem quartic_quad_le (x k : EuclSpace d) :
    2 * ‖x‖ ^ 2 * ‖k‖ ^ 2 + 4 * inner ℝ x k ^ 2 ≤ 6 * ‖x‖ ^ 2 * ‖k‖ ^ 2 := by
  have hcs : inner ℝ x k ^ 2 ≤ ‖x‖ ^ 2 * ‖k‖ ^ 2 := by
    have h1 : |inner ℝ x k| ^ 2 ≤ (‖x‖ * ‖k‖) ^ 2 :=
      pow_le_pow_left₀ (abs_nonneg _) (abs_real_inner_le_norm x k) 2
    rw [sq_abs, mul_pow] at h1
    exact h1
  linarith
theoremsuperJet_quartic
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c, x \in \mathbb{R}^{d}$.

Then ((4 * ‖x - c‖ ^ 2) • (x - c), (12 * ‖x - c‖ ^ 2) • PLaplacian.idForm d) ∈ PLaplacian.SuperJet (fun y => ‖y - c‖ ^ 4) x.

/-- **A superjet of the quartic `‖· - c‖⁴`.** -/
theorem superJet_quartic (c x : EuclSpace d) :
    ((4 * ‖x - c‖ ^ 2) • (x - c), (12 * ‖x - c‖ ^ 2) • idForm d)
      ∈ SuperJet (fun y => ‖y - c‖ ^ 4) x := by
  intro η hη
  have hT : Tendsto (fun y : EuclSpace d => y - x) (𝓝 x) (𝓝 0) := by
    have h0 : Continuous (fun y : EuclSpace d => y - x) := by fun_prop
    have := h0.tendsto x
    simpa using this
  filter_upwards [hT.eventually (eventually_penR_le (by norm_num : (0:ℝ) < 1 / 4)
    (x - c) hη)] with y hy
  change ‖y - c‖ ^ 4 ≤ ‖x - c‖ ^ 4 + inner ℝ ((4 * ‖x - c‖ ^ 2) • (x - c)) (y - x)
    + (1 / 2) * (((12 * ‖x - c‖ ^ 2) • idForm d) (y - x)) (y - x)
    + η * ‖y - x‖ ^ 2
  rw [smul_form_apply, idForm_apply]
  have e : y - c = (x - c) + (y - x) := by abel
  rw [e, quartic_expand]
  have hq := quartic_quad_le (x - c) (y - x)
  linarith
theoremsubJet_neg_quartic
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c, x \in \mathbb{R}^{d}$.

Then (-((4 * ‖x - c‖ ^ 2) • (x - c)), -((12 * ‖x - c‖ ^ 2) • PLaplacian.idForm d)) ∈ PLaplacian.SubJet (fun y => -‖y - c‖ ^ 4) x.

/-- **A subjet of the negated quartic.** -/
theorem subJet_neg_quartic (c x : EuclSpace d) :
    (-((4 * ‖x - c‖ ^ 2) • (x - c)), -((12 * ‖x - c‖ ^ 2) • idForm d))
      ∈ SubJet (fun y => -‖y - c‖ ^ 4) x :=
  subJet_neg_of_superJet (superJet_quartic c x)
theoremtendsto_quartic_grad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}^{d}$, $\mathrm{xs} \colon \mathbb{N} \to \mathbb{R}^{d}$.

Assume

  • $\operatorname{Tendsto}(\mathrm{xs}, \mathrm{atTop}, \operatorname{nhds}(c))$ hxs

Then $\operatorname{Tendsto}(n \mapsto (4 \cdot \lVert \operatorname{xs}(n) - c\rVert ^{2}) \cdot (\operatorname{xs}(n) - c), \mathrm{atTop}, \operatorname{nhds}(0))$.

PLaplacian.tendsto_quartic_gradPlaplacian/QuarticJets.lean, lines 135–145
/-- The gradient of the quartic tends to zero at its centre. -/
theorem tendsto_quartic_grad {c : EuclSpace d} {xs : ℕ → EuclSpace d}
    (hxs : Tendsto xs atTop (𝓝 c)) :
    Tendsto (fun n => (4 * ‖xs n - c‖ ^ 2) • (xs n - c)) atTop (𝓝 0) := by
  have h0 : Tendsto (fun n => xs n - c) atTop (𝓝 0) := by
    have := hxs.sub_const c
    simpa using this
  have h1 : Tendsto (fun n => 4 * ‖xs n - c‖ ^ 2) atTop (𝓝 (4 * ‖(0:EuclSpace d)‖ ^ 2)) :=
    (h0.norm.pow 2).const_mul 4
  have := h1.smul h0
  simpa using this
theoremtendsto_quartic_coef
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $c \in \mathbb{R}^{d}$, $\mathrm{xs} \colon \mathbb{N} \to \mathbb{R}^{d}$.

Assume

  • $\operatorname{Tendsto}(\mathrm{xs}, \mathrm{atTop}, \operatorname{nhds}(c))$ hxs

Then $\operatorname{Tendsto}(n \mapsto 12 \cdot \lVert \operatorname{xs}(n) - c\rVert ^{2}, \mathrm{atTop}, \operatorname{nhds}(0))$.

PLaplacian.tendsto_quartic_coefPlaplacian/QuarticJets.lean, lines 147–155
/-- The coefficient of the quartic's form tends to zero at its centre. -/
theorem tendsto_quartic_coef {c : EuclSpace d} {xs : ℕ → EuclSpace d}
    (hxs : Tendsto xs atTop (𝓝 c)) :
    Tendsto (fun n => 12 * ‖xs n - c‖ ^ 2) atTop (𝓝 0) := by
  have h0 : Tendsto (fun n => xs n - c) atTop (𝓝 0) := by
    have := hxs.sub_const c
    simpa using this
  have := (h0.norm.pow 2).const_mul 12
  simpa using this

Plaplacian/QuotZero.lean1 declarations

theoremquotient_le_of_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\eta \in \mathbb{R}$, $E \colon \mathbb{R} \to \mathbb{R}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd
  • $0 < \varepsilon$ hε
  • $\lvert E_{\varepsilon}\rvert \le \eta \cdot \varepsilon ^{2}$ hE

Then $\lvert 2 \cdot (p + d) \cdot E_{\varepsilon} / \varepsilon ^{2}\rvert \le 2 \cdot (p + d) \cdot \eta$.

PLaplacian.quotient_le_of_boundPlaplacian/QuotZero.lean, lines 66–79
/-- **The arithmetic core.** If the error is bounded by `η ε²` then the
quotient is bounded by `2(p+d) η`. -/
theorem quotient_le_of_bound {p : ℝ} (hpd : 0 < p + (d : ℝ))
    {η : ℝ} {E : ℝ → ℝ} {ε : ℝ} (hε : 0 < ε)
    (hE : |E ε| ≤ η * ε ^ 2) :
    |(2 * (p + (d : ℝ))) * E ε / ε ^ 2| ≤ 2 * (p + (d : ℝ)) * η := by
  have h2 : (0:ℝ) < ε ^ 2 := by positivity
  have hpd2 : (0:ℝ) < 2 * (p + (d : ℝ)) := by linarith
  rw [abs_div, abs_mul, abs_of_pos hpd2, abs_of_pos h2]
  rw [div_le_iff₀ h2]
  calc 2 * (p + (d : ℝ)) * |E ε|
      ≤ 2 * (p + (d : ℝ)) * (η * ε ^ 2) :=
        mul_le_mul_of_nonneg_left hE (le_of_lt hpd2)
    _ = 2 * (p + (d : ℝ)) * η * ε ^ 2 := by ring

Plaplacian/Radius.lean10 declarations

lemmaRadius.integral_Ioi_indicator_pow_eps
Formal statementgenerated from the Lean declaration

Let $n \in \mathbb{N}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then ∫ (y : ℝ) in Set.Ioi 0, (Set.Iio ε).indicator (fun t => t ^ n) y = ε ^ (n + 1) / (↑n + 1).

PLaplacian.Radius.integral_Ioi_indicator_pow_epsPlaplacian/Radius.lean, lines 56–66
/-- The one-dimensional value at radius `ε`. -/
lemma integral_Ioi_indicator_pow_eps (n : ℕ) {ε : ℝ} (hε : 0 < ε) :
    (∫ y in Set.Ioi (0:ℝ),
        Set.indicator (Set.Iio ε) (fun t : ℝ => t ^ n) y)
      = ε ^ (n + 1) / (n + 1 : ℝ) := by
  rw [MeasureTheory.setIntegral_indicator measurableSet_Iio,
      Set.Ioi_inter_Iio,
      ← MeasureTheory.integral_Ioc_eq_integral_Ioo,
      ← intervalIntegral.integral_of_le hε.le,
      integral_pow]
  simp
lemmaRadius.smul_indicator_sq_eps
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varepsilon, y \in \mathbb{R}$.

Assume

  • $0 < d$ hd

Then y ^ (d - 1) • (Set.Iio ε).indicator (fun t => t ^ 2) y = (Set.Iio ε).indicator (fun t => t ^ (d + 1)) y.

PLaplacian.Radius.smul_indicator_sq_epsPlaplacian/Radius.lean, lines 68–74
lemma smul_indicator_sq_eps (hd : 0 < d) {ε : ℝ} (y : ℝ) :
    y ^ (d - 1) • Set.indicator (Set.Iio ε) (fun t : ℝ => t ^ 2) y
      = Set.indicator (Set.Iio ε) (fun t : ℝ => t ^ (d + 1)) y := by
  by_cases h : y ∈ Set.Iio ε
  · simp only [Set.indicator_of_mem h, smul_eq_mul]
    exact _root_.Diagonal.pow_sub_one_mul_sq hd y
  · simp only [Set.indicator_of_notMem h, smul_zero]
theoremRadius.integral_radial_sq_eps
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < d$ hd
  • $0 < \varepsilon$ hε

Then ∫ (y : ℝ) in Set.Ioi 0, y ^ (d - 1) • (Set.Iio ε).indicator (fun t => t ^ 2) y = ε ^ (d + 2) / (↑d + 2).

PLaplacian.Radius.integral_radial_sq_epsPlaplacian/Radius.lean, lines 76–83
/-- **The radial integral at radius `ε`.** -/
theorem integral_radial_sq_eps (hd : 0 < d) {ε : ℝ} (hε : 0 < ε) :
    (∫ y in Set.Ioi (0:ℝ), y ^ (d - 1) •
        Set.indicator (Set.Iio ε) (fun t : ℝ => t ^ 2) y)
      = ε ^ (d + 2) / (d + 2 : ℝ) := by
  rw [funext (smul_indicator_sq_eps hd), integral_Ioi_indicator_pow_eps _ hε]
  push_cast
  ring
lemmaRadius.setIntegral_normSq_eq_indicator
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varepsilon \in \mathbb{R}$.

Then ∫ (z : EuclSpace d) in Metric.ball 0 ε, ‖z‖ ^ 2 = ∫ (z : EuclSpace d), (Metric.ball 0 ε).indicator (fun w => ‖w‖ ^ 2) z.

PLaplacian.Radius.setIntegral_normSq_eq_indicatorPlaplacian/Radius.lean, lines 94–100
/-- The squared norm on a ball, as an indicator integral over the space. -/
lemma setIntegral_normSq_eq_indicator {ε : ℝ} :
    (∫ z in Metric.ball (0 : EuclSpace d) ε, ‖z‖ ^ 2)
      = ∫ z : EuclSpace d,
          Set.indicator (Metric.ball (0 : EuclSpace d) ε)
            (fun w => ‖w‖ ^ 2) z := by
  rw [← MeasureTheory.integral_indicator measurableSet_ball]
lemmaRadius.indicator_ball_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varepsilon \in \mathbb{R}$, $z \in \mathbb{R}^{d}$.

Then (Metric.ball 0 ε).indicator (fun w => ‖w‖ ^ 2) z = (Set.Iio ε).indicator (fun t => t ^ 2) ‖z‖.

PLaplacian.Radius.indicator_ball_eqPlaplacian/Radius.lean, lines 102–113
/-- The indicator of a ball, as a function of the norm. -/
lemma indicator_ball_eq {ε : ℝ} (z : EuclSpace d) :
    Set.indicator (Metric.ball (0 : EuclSpace d) ε)
        (fun w => ‖w‖ ^ 2) z
      = Set.indicator (Set.Iio ε) (fun t : ℝ => t ^ 2) ‖z‖ := by
  by_cases h : ‖z‖ < ε
  · have hz : z ∈ Metric.ball (0 : EuclSpace d) ε := by
      simpa [Metric.mem_ball, dist_zero_right] using h
    rw [Set.indicator_of_mem hz, Set.indicator_of_mem (by exact h)]
  · have hz : z ∉ Metric.ball (0 : EuclSpace d) ε := by
      simpa [Metric.mem_ball, dist_zero_right] using h
    rw [Set.indicator_of_notMem hz, Set.indicator_of_notMem (by exact h)]
theoremRadius.integral_normSq_ball_eps
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $0 < \varepsilon$ hε

Then $\int_{B(0, \varepsilon)} (\lVert z\rVert ^{2} = d \cdot \operatorname{volume.real}(B(0, 1)) \cdot (\varepsilon ^{d + 2} / (d + 2))) \, dz$.

PLaplacian.Radius.integral_normSq_ball_epsPlaplacian/Radius.lean, lines 115–126
/-- **The squared-norm integral at radius `ε`.** -/
theorem integral_normSq_ball_eps [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {ε : ℝ} (hε : 0 < ε) :
    (∫ z in Metric.ball (0 : EuclSpace d) ε, ‖z‖ ^ 2)
      = d * volume.real (Metric.ball (0 : EuclSpace d) 1)
        * (ε ^ (d + 2) / (d + 2 : ℝ)) := by
  rw [setIntegral_normSq_eq_indicator]
  rw [funext (indicator_ball_eq (d := d) (ε := ε))]
  rw [MeasureTheory.integral_fun_norm_addHaar volume
        (fun t : ℝ => Set.indicator (Set.Iio ε) (fun s : ℝ => s ^ 2) t)]
  rw [finrank_euclideanSpace_fin, integral_radial_sq_eps hd hε]
  simp [mul_assoc]
theoremRadius.integral_sq_coord_ball_eps
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $0 < \varepsilon$ hε

Then $\int_{B(0, \varepsilon)} (\operatorname{z.ofLp}(i) ^{2} = \operatorname{volume.real}(B(0, 1)) \cdot (\varepsilon ^{d + 2} / (d + 2))) \, dz$.

PLaplacian.Radius.integral_sq_coord_ball_epsPlaplacian/Radius.lean, lines 136–147
/-- **The coordinate second moment at radius `ε`.** -/
theorem integral_sq_coord_ball_eps [Nontrivial (EuclSpace d)] (hd : 0 < d)
    (i : Fin d) {ε : ℝ} (hε : 0 < ε) :
    (∫ z in Metric.ball (0 : EuclSpace d) ε, (z.ofLp i) ^ 2)
      = volume.real (Metric.ball (0 : EuclSpace d) 1)
        * (ε ^ (d + 2) / (d + 2 : ℝ)) := by
  have hdne : (d : ℝ) ≠ 0 := Nat.cast_ne_zero.2 hd.ne'
  have hsum := Diagonal.integral_normSq_eq_nsmul i ε
  have hnorm := integral_normSq_ball_eps hd hε
  rw [hnorm] at hsum
  field_simp at hsum ⊢
  linarith [hsum]
theoremRadius.volumeReal_ball_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < \varepsilon$ hε

Then $\operatorname{volume.real}(B(0, \varepsilon)) = \varepsilon ^{d} \cdot \operatorname{volume.real}(B(0, 1))$.

PLaplacian.Radius.volumeReal_ball_eqPlaplacian/Radius.lean, lines 149–157
/-- The ball volume scales as the `d`-th power of the radius, in
`Measure.real` form. -/
theorem volumeReal_ball_eq [Nontrivial (EuclSpace d)] {ε : ℝ} (hε : 0 < ε) :
    volume.real (Metric.ball (0 : EuclSpace d) ε)
      = ε ^ d * volume.real (Metric.ball (0 : EuclSpace d) 1) := by
  have h := Measure.addHaar_ball_of_pos volume (0 : EuclSpace d) hε
  rw [finrank_euclideanSpace_fin] at h
  simp only [MeasureTheory.Measure.real]
  rw [h, ENNReal.toReal_mul, ENNReal.toReal_ofReal (by positivity)]
theoremRadius.volumeReal_unitBall_pos'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$

Then $0 < \operatorname{volume.real}(B(0, 1))$.

PLaplacian.Radius.volumeReal_unitBall_pos'Plaplacian/Radius.lean, lines 159–166
theorem volumeReal_unitBall_pos' [Nontrivial (EuclSpace d)] :
    (0 : ℝ) < volume.real (Metric.ball (0 : EuclSpace d) 1) := by
  have h1 : volume (Metric.ball (0 : EuclSpace d) 1) ≠ 0 :=
    measure_ball_ne_zero 0 (by norm_num)
  have h2 : volume (Metric.ball (0 : EuclSpace d) 1) ≠ ⊤ :=
    measure_ball_lt_top.ne
  simp only [MeasureTheory.Measure.real]
  exact ENNReal.toReal_pos h1 h2
theoremRadius.setAverage_sq_coord_ball_eps
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $i \in \operatorname{Fin}(d)$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $0 < \varepsilon$ hε

Then $\fint_{B(0, \varepsilon)} (\operatorname{z.ofLp}(i) ^{2} = \varepsilon ^{2} / (d + 2)) \, dz$.

PLaplacian.Radius.setAverage_sq_coord_ball_epsPlaplacian/Radius.lean, lines 168–179
/-- **The coordinate second moment as an average.** -/
theorem setAverage_sq_coord_ball_eps [Nontrivial (EuclSpace d)] (hd : 0 < d)
    (i : Fin d) {ε : ℝ} (hε : 0 < ε) :
    (⨍ z in Metric.ball (0 : EuclSpace d) ε, (z.ofLp i) ^ 2)
      = ε ^ 2 / ((d : ℝ) + 2) := by
  rw [MeasureTheory.setAverage_eq, integral_sq_coord_ball_eps hd i hε,
      volumeReal_ball_eq hε, smul_eq_mul]
  have hvol := volumeReal_unitBall_pos' (d := d)
  have hεd : (0 : ℝ) < ε ^ d := by positivity
  have hd2 : (0 : ℝ) < (d : ℝ) + 2 := by positivity
  field_simp
  ring

Plaplacian/Reduce1.lean14 declarations

defuTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{xh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$, $\xi \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The translated, strictified first function. -/
def uTilde (u : EuclSpace d → ℝ) (q xh : EuclSpace d) (K : ℝ) (ξ : EuclSpace d) : ℝ :=
  u (xh + ξ) - inner ℝ q (xh + ξ) - K * ‖ξ‖ ^ 4 - (u xh - inner ℝ q xh)
defvTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{yh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$, $\zeta \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The translated, strictified second function. -/
def vTilde (v : EuclSpace d → ℝ) (q yh : EuclSpace d) (K : ℝ) (ζ : EuclSpace d) : ℝ :=
  v (yh + ζ) - inner ℝ q (yh + ζ) + K * ‖ζ‖ ^ 4 - (v yh - inner ℝ q yh)
theoremuTilde_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{xh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$.

Then $\operatorname{uTilde}(u, q, \mathrm{xh}, K, 0) = 0$.

theorem uTilde_zero : uTilde u q xh K 0 = 0 := by simp [uTilde]
theoremvTilde_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{yh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$.

Then $\operatorname{vTilde}(v, q, \mathrm{yh}, K, 0) = 0$.

theorem vTilde_zero : vTilde v q yh K 0 = 0 := by simp [vTilde]
theoremuTilde_sub_vTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{xh}, \mathrm{yh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$, $\xi, \zeta \in \mathbb{R}^{d}$.

Then $\operatorname{uTilde}(u, q, \mathrm{xh}, K, \xi) - \operatorname{vTilde}(v, q, \mathrm{yh}, K, \zeta) = u(\mathrm{xh} + \xi) - v(\mathrm{yh} + \zeta) - \operatorname{inner}(\mathbb{R}, q, \xi - \zeta) - (u(\mathrm{xh}) - v(\mathrm{yh})) - K \cdot (\lVert \xi\rVert ^{4} + \lVert \zeta\rVert ^{4})$.

PLaplacian.uTilde_sub_vTildePlaplacian/Reduce1.lean, lines 58–65
/-- The difference, in terms of the original functions. -/
theorem uTilde_sub_vTilde (ξ ζ : EuclSpace d) :
    uTilde u q xh K ξ - vTilde v q yh K ζ
      = (u (xh + ξ) - v (yh + ζ) - inner ℝ q (ξ - ζ)) - (u xh - v yh)
        - K * (‖ξ‖ ^ 4 + ‖ζ‖ ^ 4) := by
  unfold uTilde vTilde
  rw [inner_add_right, inner_add_right, inner_sub_right]
  ring
theoremsub_pow_four_le_one
Formal statementgenerated from the Lean declaration

Let $t \in \mathbb{R}$.

Assume

  • $0 \le t$ ht

Then $t - t ^{4} \le 1$.

PLaplacian.sub_pow_four_le_onePlaplacian/Reduce1.lean, lines 69–79
/-- `t - t⁴ ≤ 1` for `t ≥ 0`. -/
theorem sub_pow_four_le_one {t : ℝ} (ht : 0 ≤ t) : t - t ^ 4 ≤ 1 := by
  rcases le_total t 1 with h | h
  · have : 0 ≤ t ^ 4 := by positivity
    linarith
  · have h3 : 1 ≤ t ^ 3 := one_le_pow₀ h
    have : t ≤ t ^ 4 := by
      calc t = t * 1 := (mul_one t).symm
        _ ≤ t * t ^ 3 := mul_le_mul_of_nonneg_left h3 ht
        _ = t ^ 4 := by ring
    linarith
theorembddAbove_uTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{xh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$.

Assume

  • $\lVert q\rVert + 1 \le K$ hK
  • $u\text{ is bounded above}$ hub

Then $\operatorname{uTilde}(u, q, \mathrm{xh}, K)\text{ is bounded above}$.

PLaplacian.bddAbove_uTildePlaplacian/Reduce1.lean, lines 85–110
/-- **`ũ` is bounded above.** -/
theorem bddAbove_uTilde (hK : ‖q‖ + 1 ≤ K) (hub : BddAbove (range u)) :
    BddAbove (range (uTilde u q xh K)) := by
  obtain ⟨SU, hSU⟩ := hub
  refine ⟨SU - inner ℝ q xh + ‖q‖ - (u xh - inner ℝ q xh), ?_⟩
  rintro _ ⟨ξ, rfl⟩
  unfold uTilde
  rw [inner_add_right]
  have h1 : u (xh + ξ) ≤ SU := hSU ⟨xh + ξ, rfl⟩
  have h2 : -inner ℝ q ξ ≤ ‖q‖ * ‖ξ‖ := by
    have := abs_real_inner_le_norm q ξ
    rw [abs_le] at this
    linarith [this.1]
  have h3 := sub_pow_four_le_one (norm_nonneg ξ)
  have hq0 : 0 ≤ ‖q‖ := norm_nonneg q
  have h4 : 0 ≤ ‖ξ‖ ^ 4 := by positivity
  have h5 : ‖q‖ * ‖ξ‖ - K * ‖ξ‖ ^ 4 ≤ ‖q‖ := by
    have e1 : ‖q‖ * ‖ξ‖ - K * ‖ξ‖ ^ 4 ≤ ‖q‖ * ‖ξ‖ - ‖q‖ * ‖ξ‖ ^ 4 := by
      have : ‖q‖ * ‖ξ‖ ^ 4 ≤ K * ‖ξ‖ ^ 4 :=
        mul_le_mul_of_nonneg_right (by linarith) h4
      linarith
    have e2 : ‖q‖ * ‖ξ‖ - ‖q‖ * ‖ξ‖ ^ 4 ≤ ‖q‖ * 1 := by
      have := mul_le_mul_of_nonneg_left h3 hq0
      linarith
    linarith
  linarith
theorembddAbove_neg_vTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{yh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$.

Assume

  • $\lVert q\rVert + 1 \le K$ hK
  • $v\text{ is bounded below}$ hvb

Then BddAbove (Set.range fun ζ => -PLaplacian.vTilde v q yh K ζ).

PLaplacian.bddAbove_neg_vTildePlaplacian/Reduce1.lean, lines 112–135
/-- **`-ṽ` is bounded above.** -/
theorem bddAbove_neg_vTilde (hK : ‖q‖ + 1 ≤ K) (hvb : BddBelow (range v)) :
    BddAbove (range (fun ζ => -vTilde v q yh K ζ)) := by
  obtain ⟨IV, hIV⟩ := hvb
  refine ⟨-IV + inner ℝ q yh + ‖q‖ + (v yh - inner ℝ q yh), ?_⟩
  rintro _ ⟨ζ, rfl⟩
  change -vTilde v q yh K ζ ≤ _
  unfold vTilde
  rw [inner_add_right]
  have h1 : IV ≤ v (yh + ζ) := hIV ⟨yh + ζ, rfl⟩
  have h2 : inner ℝ q ζ ≤ ‖q‖ * ‖ζ‖ := real_inner_le_norm q ζ
  have h3 := sub_pow_four_le_one (norm_nonneg ζ)
  have hq0 : 0 ≤ ‖q‖ := norm_nonneg q
  have h4 : 0 ≤ ‖ζ‖ ^ 4 := by positivity
  have h5 : ‖q‖ * ‖ζ‖ - K * ‖ζ‖ ^ 4 ≤ ‖q‖ := by
    have e1 : ‖q‖ * ‖ζ‖ - K * ‖ζ‖ ^ 4 ≤ ‖q‖ * ‖ζ‖ - ‖q‖ * ‖ζ‖ ^ 4 := by
      have : ‖q‖ * ‖ζ‖ ^ 4 ≤ K * ‖ζ‖ ^ 4 :=
        mul_le_mul_of_nonneg_right (by linarith) h4
      linarith
    have e2 : ‖q‖ * ‖ζ‖ - ‖q‖ * ‖ζ‖ ^ 4 ≤ ‖q‖ * 1 := by
      have := mul_le_mul_of_nonneg_left h3 hq0
      linarith
    linarith
  linarith
theoremusc_uTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{xh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$.

Assume

  • $u\text{ is upper semicontinuous}$ hu

Then $\operatorname{uTilde}(u, q, \mathrm{xh}, K)\text{ is upper semicontinuous}$.

/-- **`ũ` is upper semicontinuous.** -/
theorem usc_uTilde (hu : UpperSemicontinuous u) :
    UpperSemicontinuous (uTilde u q xh K) := by
  have h1 : UpperSemicontinuous (fun ξ : EuclSpace d => u (xh + ξ)) :=
    hu.comp (continuous_const.add continuous_id)
  have h2 : UpperSemicontinuous (fun ξ : EuclSpace d =>
      -inner ℝ q (xh + ξ) - K * ‖ξ‖ ^ 4 - (u xh - inner ℝ q xh)) := by
    apply Continuous.upperSemicontinuous; fun_prop
  have heq : uTilde u q xh K = fun ξ => u (xh + ξ)
      + (-inner ℝ q (xh + ξ) - K * ‖ξ‖ ^ 4 - (u xh - inner ℝ q xh)) := by
    funext ξ; unfold uTilde; ring
  rw [heq]
  exact h1.add h2
theoremusc_neg_vTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{yh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$.

Assume

  • $v\text{ is lower semicontinuous}$ hv

Then UpperSemicontinuous fun ζ => -PLaplacian.vTilde v q yh K ζ.

/-- **`-ṽ` is upper semicontinuous.** -/
theorem usc_neg_vTilde (hv : LowerSemicontinuous v) :
    UpperSemicontinuous (fun ζ => -vTilde v q yh K ζ) := by
  have h1 : UpperSemicontinuous (fun ζ : EuclSpace d => -v (yh + ζ)) :=
    hv.neg.comp (continuous_const.add continuous_id)
  have h2 : UpperSemicontinuous (fun ζ : EuclSpace d =>
      inner ℝ q (yh + ζ) - K * ‖ζ‖ ^ 4 + (v yh - inner ℝ q yh)) := by
    apply Continuous.upperSemicontinuous; fun_prop
  have heq : (fun ζ => -vTilde v q yh K ζ) = fun ζ => -v (yh + ζ)
      + (inner ℝ q (yh + ζ) - K * ‖ζ‖ ^ 4 + (v yh - inner ℝ q yh)) := by
    funext ζ; unfold vTilde; ring
  rw [heq]
  exact h1.add h2
theoremlocal_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{xh}, \mathrm{yh} \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • IsLocalMax (fun z => u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, yh) hmax

Then there exists $\rho > 0$ such that:

  • ∀ ( ξ ζ : EuclSpace d ) , ‖ ( ξ , ζ ) ‖ < ρ → u ( xh + ξ ) - v ( yh + ζ ) - inner ℝ ( ( ‖ xh - yh ‖ ^ 2 / α ) • ( xh - yh ) ) ( ξ - ζ ) - PLaplacian.penP ( 1 / 2 ) 1 α ( xh - yh ) ( ξ - ζ ) ≤ u xh - v yh
/-- **The local bound**: near the origin, the local maximum and the Taylor bound
of the penalty give the reduced inequality. -/
theorem local_bound (hα : 0 < α)
    (hmax : IsLocalMax (fun z : EuclSpace d × EuclSpace d =>
      u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, yh)) :
    ∃ ρ > 0, ∀ ξ ζ : EuclSpace d, ‖(ξ, ζ)‖ < ρ →
      u (xh + ξ) - v (yh + ζ)
        - inner ℝ ((‖xh - yh‖ ^ 2 / α) • (xh - yh)) (ξ - ζ)
        - penP (1 / 2) 1 α (xh - yh) (ξ - ζ) ≤ u xh - v yh := by
  have hT := penalty_upper hα (xh - yh) (one_pos : (0 : ℝ) < 1)
  have hm : Tendsto (fun w : EuclSpace d × EuclSpace d => (xh + w.1, yh + w.2))
      (𝓝 0) (𝓝 (xh, yh)) := by
    have h0 : Continuous (fun w : EuclSpace d × EuclSpace d => (xh + w.1, yh + w.2)) := by
      fun_prop
    have := h0.tendsto 0
    simpa using this
  have hk : Tendsto (fun w : EuclSpace d × EuclSpace d => w.1 - w.2) (𝓝 0) (𝓝 0) := by
    have h0 : Continuous (fun w : EuclSpace d × EuclSpace d => w.1 - w.2) := by fun_prop
    have := h0.tendsto 0
    simpa using this
  have hev : ∀ᶠ w in 𝓝 (0 : EuclSpace d × EuclSpace d),
      u (xh + w.1) - v (yh + w.2)
        - inner ℝ ((‖xh - yh‖ ^ 2 / α) • (xh - yh)) (w.1 - w.2)
        - penP (1 / 2) 1 α (xh - yh) (w.1 - w.2) ≤ u xh - v yh := by
    filter_upwards [hm.eventually hmax, hk.eventually hT] with w h1 h2
    change u (xh + w.1) - v (yh + w.2) - ‖xh + w.1 - (yh + w.2)‖ ^ 4 / (4 * α)
      ≤ u xh - v yh - ‖xh - yh‖ ^ 4 / (4 * α) at h1
    have e : xh + w.1 - (yh + w.2) = (xh - yh) + (w.1 - w.2) := by abel
    rw [e] at h1
    unfold penP
    linarith
  obtain ⟨ρ, hρ, hball⟩ := Metric.eventually_nhds_iff.1 hev
  exact ⟨ρ, hρ, fun ξ ζ h => hball (by rwa [dist_zero_right])⟩
theoremnorm_pow_four_le_sum
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $w \in \mathbb{R}^{d} \times \mathbb{R}^{d}$.

Then $\lVert w\rVert ^{4} \le \lVert \mathrm{w.1}\rVert ^{4} + \lVert \mathrm{w.2}\rVert ^{4}$.

PLaplacian.norm_pow_four_le_sumPlaplacian/Reduce1.lean, lines 205–218
/-- `‖w‖⁴ ≤ ‖w.1‖⁴ + ‖w.2‖⁴` on the product. -/
theorem norm_pow_four_le_sum (w : EuclSpace d × EuclSpace d) :
    ‖w‖ ^ 4 ≤ ‖w.1‖ ^ 4 + ‖w.2‖ ^ 4 := by
  have hmax : ‖w‖ ≤ max ‖w.1‖ ‖w.2‖ :=
    norm_prod_le_iff.2 ⟨le_max_left _ _, le_max_right _ _⟩
  have h1 : 0 ≤ ‖w.1‖ ^ 4 := by positivity
  have h2 : 0 ≤ ‖w.2‖ ^ 4 := by positivity
  rcases le_total ‖w.1‖ ‖w.2‖ with h | h
  · rw [max_eq_right h] at hmax
    have := pow_le_pow_left₀ (norm_nonneg w) hmax 4
    linarith
  · rw [max_eq_left h] at hmax
    have := pow_le_pow_left₀ (norm_nonneg w) hmax 4
    linarith
theoremsum_pow_four_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $w \in \mathbb{R}^{d} \times \mathbb{R}^{d}$.

Assume

  • $w \ne 0$ hw

Then $0 < \lVert \mathrm{w.1}\rVert ^{4} + \lVert \mathrm{w.2}\rVert ^{4}$.

PLaplacian.sum_pow_four_posPlaplacian/Reduce1.lean, lines 220–231
/-- Off the origin, the sum of fourth powers is positive. -/
theorem sum_pow_four_pos {w : EuclSpace d × EuclSpace d} (hw : w ≠ 0) :
    0 < ‖w.1‖ ^ 4 + ‖w.2‖ ^ 4 := by
  by_contra hc
  push Not at hc
  have h1 : 0 ≤ ‖w.1‖ ^ 4 := by positivity
  have h2 : 0 ≤ ‖w.2‖ ^ 4 := by positivity
  have e1 : ‖w.1‖ ^ 4 = 0 := by linarith
  have e2 : ‖w.2‖ ^ 4 = 0 := by linarith
  have f1 : w.1 = 0 := norm_eq_zero.1 ((pow_eq_zero_iff (by norm_num)).1 e1)
  have f2 : w.2 = 0 := norm_eq_zero.1 ((pow_eq_zero_iff (by norm_num)).1 e2)
  exact hw (Prod.ext f1 f2)
theoremexists_K_strict
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{xh}, \mathrm{yh} \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • $u\text{ is bounded above}$ hub
  • $v\text{ is bounded below}$ hvb
  • IsLocalMax (fun z => u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, yh) hmax

Then there exists $K$ such that:

  • $\lVert (\lVert \mathrm{xh} - \mathrm{yh}\rVert ^{2} / \alpha) \cdot (\mathrm{xh} - \mathrm{yh})\rVert + 1 \le K$
  • $\forall w,\ w \ne 0 \to \operatorname{uTilde}(u, (\lVert \mathrm{xh} - \mathrm{yh}\rVert ^{2} / \alpha) \cdot (\mathrm{xh} - \mathrm{yh}), \mathrm{xh}, K, \mathrm{w.1}) - \operatorname{vTilde}(v, (\lVert \mathrm{xh} - \mathrm{yh}\rVert ^{2} / \alpha) \cdot (\mathrm{xh} - \mathrm{yh}), \mathrm{yh}, K, \mathrm{w.2}) - \operatorname{penP}(1 / 2, 1, \alpha, \mathrm{xh} - \mathrm{yh}, \mathrm{w.1} - \mathrm{w.2}) < 0$
/-- **The strict global maximum.** -/
theorem exists_K_strict (hα : 0 < α) (hub : BddAbove (range u))
    (hvb : BddBelow (range v))
    (hmax : IsLocalMax (fun z : EuclSpace d × EuclSpace d =>
      u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, yh)) :
    ∃ K : ℝ, ‖(‖xh - yh‖ ^ 2 / α) • (xh - yh)‖ + 1 ≤ K ∧
      ∀ w : EuclSpace d × EuclSpace d, w ≠ 0 →
        uTilde u ((‖xh - yh‖ ^ 2 / α) • (xh - yh)) xh K w.1
          - vTilde v ((‖xh - yh‖ ^ 2 / α) • (xh - yh)) yh K w.2
          - penP (1 / 2) 1 α (xh - yh) (w.1 - w.2) < 0 := by
  set q := (‖xh - yh‖ ^ 2 / α) • (xh - yh) with hqdef
  obtain ⟨ρ, hρ, hloc⟩ := local_bound hα hmax
  obtain ⟨SU, hSU⟩ := hub
  obtain ⟨IV, hIV⟩ := hvb
  have hU : ∀ x, u x ≤ SU := fun x => hSU ⟨x, rfl⟩
  have hV : ∀ y, IV ≤ v y := fun y => hIV ⟨y, rfl⟩
  set B := SU - IV - (u xh - v yh) with hBdef
  have hB : 0 ≤ B := by have := hU xh; have := hV yh; rw [hBdef]; linarith
  have hq0 : 0 ≤ ‖q‖ := norm_nonneg q
  set K := (B + 1) / ρ ^ 4 + 2 * ‖q‖ / ρ ^ 3 + ‖q‖ + 1 with hKdef
  have hK1 : ‖q‖ + 1 ≤ K := by
    have : 0 ≤ (B + 1) / ρ ^ 4 := by positivity
    have : 0 ≤ 2 * ‖q‖ / ρ ^ 3 := by positivity
    rw [hKdef]; linarith
  have hKpos : 0 < K := by linarith
  refine ⟨K, hK1, fun w hw => ?_⟩
  rw [uTilde_sub_vTilde]
  have hP0 : 0 ≤ penP (1 / 2) 1 α (xh - yh) (w.1 - w.2) :=
    penP_nonneg (by norm_num) zero_le_one hα _
  have hw4 := sum_pow_four_pos hw
  by_cases hsmall : ‖w‖ < ρ
  · -- near the origin
    have h1 := hloc w.1 w.2 hsmall
    have := mul_pos hKpos hw4
    linarith
  · -- far from the origin
    push Not at hsmall
    set t := ‖w‖ with htdef
    have ht0 : 0 < t := lt_of_lt_of_le hρ hsmall
    have hn1 : ‖w.1‖ ≤ t := norm_fst_le w
    have hn2 : ‖w.2‖ ≤ t := norm_snd_le w
    have hinner : -inner ℝ q (w.1 - w.2) ≤ 2 * ‖q‖ * t := by
      have h1 : -inner ℝ q (w.1 - w.2) ≤ ‖q‖ * ‖w.1 - w.2‖ := by
        have := abs_real_inner_le_norm q (w.1 - w.2)
        rw [abs_le] at this
        linarith [this.1]
      have h2 : ‖w.1 - w.2‖ ≤ 2 * t := by
        have := norm_sub_le w.1 w.2
        linarith
      have := mul_le_mul_of_nonneg_left h2 hq0
      linarith
    have hfour := norm_pow_four_le_sum w
    have hKt : K * t ^ 4 ≤ K * (‖w.1‖ ^ 4 + ‖w.2‖ ^ 4) :=
      mul_le_mul_of_nonneg_left hfour hKpos.le
    -- K t⁴ ≥ B + 1 + 2 ‖q‖ t
    have hρ3 : ρ ^ 3 ≤ t ^ 3 := pow_le_pow_left₀ hρ.le hsmall 3
    have hKρ : (B + 1) / ρ + 2 * ‖q‖ ≤ K * ρ ^ 3 := by
      have e : K * ρ ^ 3 = (B + 1) / ρ + 2 * ‖q‖ + (‖q‖ + 1) * ρ ^ 3 := by
        rw [hKdef]; field_simp; ring
      have : 0 ≤ (‖q‖ + 1) * ρ ^ 3 := by positivity
      linarith
    have hA : K * ρ ^ 3 * t ≤ K * t ^ 4 := by
      have : K * ρ ^ 3 ≤ K * t ^ 3 := mul_le_mul_of_nonneg_left hρ3 hKpos.le
      have e : K * t ^ 4 = K * t ^ 3 * t := by ring
      rw [e]
      exact mul_le_mul_of_nonneg_right this ht0.le
    have hB1 : B + 1 ≤ (B + 1) / ρ * t := by
      have : (B + 1) / ρ * ρ = B + 1 := div_mul_cancel₀ _ hρ.ne'
      have h2 : (B + 1) / ρ * ρ ≤ (B + 1) / ρ * t :=
        mul_le_mul_of_nonneg_left hsmall (by positivity)
      linarith
    have hC : ((B + 1) / ρ + 2 * ‖q‖) * t ≤ K * ρ ^ 3 * t :=
      mul_le_mul_of_nonneg_right hKρ ht0.le
    have hu1 := hU (xh + w.1)
    have hv1 := hV (yh + w.2)
    nlinarith

Plaplacian/Reduce2.lean10 declarations

deflamC
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The convolution parameter. -/
def lamC (α : ℝ) (h0 : EuclSpace d) : ℝ := 8 * penM (1 / 2) 1 α h0 + 1
theoremlamC_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα

Then $0 < \operatorname{lamC}(\alpha, \mathrm{h0})$.

theorem lamC_pos {α : ℝ} (hα : 0 < α) (h0 : EuclSpace d) : 0 < lamC α h0 := by
  unfold lamC
  have := penM_nonneg (h0 := h0) (by norm_num : (0:ℝ) ≤ 1 / 2) zero_le_one hα
  linarith
theoremnorm_sub_sq_le_two
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $a, b \in \mathbb{R}^{d}$.

Then $\lVert a - b\rVert ^{2} \le 2 \cdot (\lVert a\rVert ^{2} + \lVert b\rVert ^{2})$.

PLaplacian.norm_sub_sq_le_twoPlaplacian/Reduce2.lean, lines 50–56
/-- `‖a - b‖² ≤ 2(‖a‖² + ‖b‖²)`. -/
theorem norm_sub_sq_le_two (a b : EuclSpace d) :
    ‖a - b‖ ^ 2 ≤ 2 * (‖a‖ ^ 2 + ‖b‖ ^ 2) := by
  rw [norm_sub_sq_real]
  have := young_inner (one_pos) a (-b)
  rw [inner_neg_right, norm_neg] at this
  linarith
theorempen_decouple
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $\mathrm{h0}, x, y, \xi, \zeta \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα

Then $\operatorname{penP}(1 / 2, 1, \alpha, \mathrm{h0}, x - y) \le \operatorname{penP}(1, 2, \alpha, \mathrm{h0}, \xi - \zeta) + \operatorname{lamC}(\alpha, \mathrm{h0}) / 2 \cdot (\lVert x - \xi\rVert ^{2} + \lVert y - \zeta\rVert ^{2})$.

/-- **The decoupling of the penalty.** -/
theorem pen_decouple {α : ℝ} (hα : 0 < α) (h0 x y ξ ζ : EuclSpace d) :
    penP (1 / 2) 1 α h0 (x - y)
      ≤ penP 1 2 α h0 (ξ - ζ) + lamC α h0 / 2 * (‖x - ξ‖ ^ 2 + ‖y - ζ‖ ^ 2) := by
  have e : x - y = (ξ - ζ) + ((x - ξ) - (y - ζ)) := by abel
  rw [e]
  set b := (x - ξ) - (y - ζ) with hb
  have hy := penP_young (s := 1 / 2) (r := 1) (h0 := h0) (by norm_num) zero_le_one hα
    one_pos (ξ - ζ) b
  have hle := penP_le (s := 1 / 2) (r := 1) (h0 := h0) (by norm_num) hα b
  have hsq := norm_sub_sq_le_two (x - ξ) (y - ζ)
  have hM0 := penM_nonneg (h0 := h0) (by norm_num : (0:ℝ) ≤ 1 / 2) zero_le_one hα
  have h2 : (1 + 1) * penP (1 / 2) 1 α h0 (ξ - ζ) = penP 1 2 α h0 (ξ - ζ) := by
    unfold penP; ring
  have p2 : penM (1 / 2) 1 α h0 * ‖b‖ ^ 2
      ≤ penM (1 / 2) 1 α h0 * (2 * (‖x - ξ‖ ^ 2 + ‖y - ζ‖ ^ 2)) :=
    mul_le_mul_of_nonneg_left hsq hM0
  have p3 : 0 ≤ ‖x - ξ‖ ^ 2 + ‖y - ζ‖ ^ 2 := by positivity
  unfold lamC
  norm_num at hy
  nlinarith
theorempsi_nonpos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{uT}, \mathrm{vT} \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $x, y \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ _hα
  • $\operatorname{uT}(0) = 0$ hu0
  • $\operatorname{vT}(0) = 0$ hv0
  • $\forall w,\ w \ne 0 \to \operatorname{uT}(\mathrm{w.1}) - \operatorname{vT}(\mathrm{w.2}) - \operatorname{penP}(1 / 2, 1, \alpha, \mathrm{h0}, \mathrm{w.1} - \mathrm{w.2}) < 0$ hΨ

Then $\operatorname{uT}(x) - \operatorname{vT}(y) \le \operatorname{penP}(1 / 2, 1, \alpha, \mathrm{h0}, x - y)$.

/-- The doubled function is nonpositive everywhere. -/
theorem psi_nonpos (_hα : 0 < α) (hu0 : uT 0 = 0) (hv0 : vT 0 = 0)
    (hΨ : ∀ w : EuclSpace d × EuclSpace d, w ≠ 0 →
      uT w.1 - vT w.2 - penP (1 / 2) 1 α h0 (w.1 - w.2) < 0)
    (x y : EuclSpace d) :
    uT x - vT y ≤ penP (1 / 2) 1 α h0 (x - y) := by
  by_cases h : (x, y) = (0 : EuclSpace d × EuclSpace d)
  · have hx : x = 0 := congrArg Prod.fst h
    have hy : y = 0 := congrArg Prod.snd h
    subst hx; subst hy
    simp [hu0, hv0, penP_zero]
  · have := hΨ (x, y) h
    linarith
theoremsupConv_sum_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{uT}, \mathrm{vT} \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $\xi, \zeta \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • $\operatorname{uT}(0) = 0$ hu0
  • $\operatorname{vT}(0) = 0$ hv0
  • $\forall w,\ w \ne 0 \to \operatorname{uT}(\mathrm{w.1}) - \operatorname{vT}(\mathrm{w.2}) - \operatorname{penP}(1 / 2, 1, \alpha, \mathrm{h0}, \mathrm{w.1} - \mathrm{w.2}) < 0$ hΨ

Then $\operatorname{supConv}(\operatorname{lamC}(\alpha, \mathrm{h0}), \mathrm{uT}, \xi) + \operatorname{supConv}(\operatorname{lamC}(\alpha, \mathrm{h0}), y \mapsto - \operatorname{vT}(y), \zeta) \le \operatorname{penP}(1, 2, \alpha, \mathrm{h0}, \xi - \zeta)$.

/-- **The convolutions are bounded by the doubled penalty.** -/
theorem supConv_sum_le (hα : 0 < α) (hu0 : uT 0 = 0) (hv0 : vT 0 = 0)
    (hΨ : ∀ w : EuclSpace d × EuclSpace d, w ≠ 0 →
      uT w.1 - vT w.2 - penP (1 / 2) 1 α h0 (w.1 - w.2) < 0)
    (ξ ζ : EuclSpace d) :
    supConv (lamC α h0) uT ξ + supConv (lamC α h0) (fun y => -vT y) ζ
      ≤ penP 1 2 α h0 (ξ - ζ) := by
  set L := lamC α h0
  have hdec : ∀ x y, uT x - L / 2 * ‖x - ξ‖ ^ 2 + (-vT y - L / 2 * ‖y - ζ‖ ^ 2)
      ≤ penP 1 2 α h0 (ξ - ζ) := by
    intro x y
    have h1 := psi_nonpos hα hu0 hv0 hΨ x y
    have h2 := pen_decouple (h0 := h0) hα x y ξ ζ
    linarith
  have hn : ∀ x, supConv L (fun y => -vT y) ζ
      ≤ penP 1 2 α h0 (ξ - ζ) - (uT x - L / 2 * ‖x - ξ‖ ^ 2) := by
    intro x
    apply ciSup_le
    intro y
    have := hdec x y
    linarith
  have hu : supConv L uT ξ ≤ penP 1 2 α h0 (ξ - ζ) - supConv L (fun y => -vT y) ζ := by
    apply ciSup_le
    intro x
    have := hn x
    linarith
  linarith
theoremsupConv_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{uT}, \mathrm{vT} \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • $\operatorname{uT}(0) = 0$ hu0
  • $\operatorname{vT}(0) = 0$ hv0
  • $\mathrm{uT}\text{ is bounded above}$ hub
  • BddAbove (Set.range fun y => -vT y) hvb
  • $\forall w,\ w \ne 0 \to \operatorname{uT}(\mathrm{w.1}) - \operatorname{vT}(\mathrm{w.2}) - \operatorname{penP}(1 / 2, 1, \alpha, \mathrm{h0}, \mathrm{w.1} - \mathrm{w.2}) < 0$ hΨ

Then all of the following hold:

  • $\operatorname{supConv}(\operatorname{lamC}(\alpha, \mathrm{h0}), \mathrm{uT}, 0) = 0$
  • $\operatorname{supConv}(\operatorname{lamC}(\alpha, \mathrm{h0}), y \mapsto - \operatorname{vT}(y), 0) = 0$
/-- **Both convolutions vanish at the origin.** -/
theorem supConv_zero (hα : 0 < α) (hu0 : uT 0 = 0) (hv0 : vT 0 = 0)
    (hub : BddAbove (range uT)) (hvb : BddAbove (range (fun y => -vT y)))
    (hΨ : ∀ w : EuclSpace d × EuclSpace d, w ≠ 0 →
      uT w.1 - vT w.2 - penP (1 / 2) 1 α h0 (w.1 - w.2) < 0) :
    supConv (lamC α h0) uT 0 = 0 ∧
      supConv (lamC α h0) (fun y => -vT y) 0 = 0 := by
  have hL := (lamC_pos hα h0).le
  have h1 := self_le_supConv hL hub 0
  have h2 := self_le_supConv hL hvb 0
  have h3 := supConv_sum_le hα hu0 hv0 hΨ (h0 := h0) 0 0
  rw [hu0] at h1
  simp only [hv0, neg_zero] at h2
  rw [sub_zero, penP_zero] at h3
  constructor <;> linarith
theoremdblW0_conv_strict
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{uT}, \mathrm{vT} \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$, $w \in \mathbb{R}^{d} \times \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • $\operatorname{uT}(0) = 0$ hu0
  • $\operatorname{vT}(0) = 0$ hv0
  • $\mathrm{uT}\text{ is upper semicontinuous}$ huu
  • $\mathrm{uT}\text{ is bounded above}$ hub
  • UpperSemicontinuous fun y => -vT y hvv
  • BddAbove (Set.range fun y => -vT y) hvb
  • $\forall w,\ w \ne 0 \to \operatorname{uT}(\mathrm{w.1}) - \operatorname{vT}(\mathrm{w.2}) - \operatorname{penP}(1 / 2, 1, \alpha, \mathrm{h0}, \mathrm{w.1} - \mathrm{w.2}) < 0$ hΨ
  • $w \ne 0$ a._@._internal._hyg.0

Then $\operatorname{dblW0}(\operatorname{supConv}(\operatorname{lamC}(\alpha, \mathrm{h0}), \mathrm{uT}), \zeta \mapsto - \operatorname{supConv}(\operatorname{lamC}(\alpha, \mathrm{h0}), y \mapsto - \operatorname{vT}(y), \zeta), 1, 2, \alpha, \mathrm{h0}, w) < \operatorname{dblW0}(\operatorname{supConv}(\operatorname{lamC}(\alpha, \mathrm{h0}), \mathrm{uT}), \zeta \mapsto - \operatorname{supConv}(\operatorname{lamC}(\alpha, \mathrm{h0}), y \mapsto - \operatorname{vT}(y), \zeta), 1, 2, \alpha, \mathrm{h0}, 0)$.

PLaplacian.dblW0_conv_strictPlaplacian/Reduce2.lean, lines 142–196
/-- **The convolved doubled function has a strict maximum at the origin.** -/
theorem dblW0_conv_strict (hα : 0 < α) (hu0 : uT 0 = 0) (hv0 : vT 0 = 0)
    (huu : UpperSemicontinuous uT) (hub : BddAbove (range uT))
    (hvv : UpperSemicontinuous (fun y => -vT y))
    (hvb : BddAbove (range (fun y => -vT y)))
    (hΨ : ∀ w : EuclSpace d × EuclSpace d, w ≠ 0 →
      uT w.1 - vT w.2 - penP (1 / 2) 1 α h0 (w.1 - w.2) < 0) :
    ∀ w : EuclSpace d × EuclSpace d, w ≠ 0 →
      dblW0 (supConv (lamC α h0) uT)
          (fun ζ => -supConv (lamC α h0) (fun y => -vT y) ζ) 1 2 α h0 w
        < dblW0 (supConv (lamC α h0) uT)
          (fun ζ => -supConv (lamC α h0) (fun y => -vT y) ζ) 1 2 α h0 0 := by
  intro w hw
  set L := lamC α h0 with hLdef
  have hLpos := lamC_pos hα h0
  obtain ⟨hz1, hz2⟩ := supConv_zero hα hu0 hv0 hub hvb hΨ
  -- the value at the origin is zero
  have h0val : dblW0 (supConv L uT) (fun ζ => -supConv L (fun y => -vT y) ζ)
      1 2 α h0 0 = 0 := by
    unfold dblW0
    simp only [Prod.fst_zero, Prod.snd_zero, sub_zero, penP_zero]
    rw [hz1, hz2, neg_zero, sub_zero]
  rw [h0val]
  -- attainment
  obtain ⟨xs, hxs⟩ := supConv_attained hLpos huu hub w.1
  obtain ⟨ys, hys⟩ := supConv_attained hLpos hvv hvb w.2
  unfold dblW0
  simp only
  rw [hxs, hys]
  change uT xs - L / 2 * ‖xs - w.1‖ ^ 2 - -(-vT ys - L / 2 * ‖ys - w.2‖ ^ 2)
    - penP 1 2 α h0 (w.1 - w.2) < 0
  by_cases hz : (xs, ys) = (0 : EuclSpace d × EuclSpace d)
  · -- both maximizers vanish
    have hx : xs = 0 := congrArg Prod.fst hz
    have hy : ys = 0 := congrArg Prod.snd hz
    subst hx; subst hy
    rw [hu0, hv0]
    simp only [zero_sub, norm_neg]
    have hw4 := sum_pow_four_pos hw
    have hpos : 0 < ‖w.1‖ ^ 2 + ‖w.2‖ ^ 2 := by
      by_contra hc
      push Not at hc
      have a1 : ‖w.1‖ ^ 2 = 0 := by nlinarith [sq_nonneg ‖w.1‖, sq_nonneg ‖w.2‖]
      have a2 : ‖w.2‖ ^ 2 = 0 := by nlinarith [sq_nonneg ‖w.1‖, sq_nonneg ‖w.2‖]
      have b1 : ‖w.1‖ = 0 := (pow_eq_zero_iff (by norm_num)).1 a1
      have b2 : ‖w.2‖ = 0 := (pow_eq_zero_iff (by norm_num)).1 a2
      rw [b1, b2] at hw4
      norm_num at hw4
    have hP := penP_nonneg (h0 := h0) zero_le_one (by norm_num : (0:ℝ) ≤ 2) hα (w.1 - w.2)
    nlinarith
  · -- otherwise Ψ < 0 at the maximizers
    have h1 := hΨ (xs, ys) hz
    have h2 := pen_decouple (h0 := h0) hα xs ys w.1 w.2
    simp only at h1
    linarith
theoremsemiconvex_uconv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{uT} \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • $\mathrm{uT}\text{ is bounded above}$ hub

Then $\operatorname{SemiconvexWith}(\operatorname{lamC}(\alpha, \mathrm{h0}), \operatorname{supConv}(\operatorname{lamC}(\alpha, \mathrm{h0}), \mathrm{uT}))$.

PLaplacian.semiconvex_uconvPlaplacian/Reduce2.lean, lines 198–201
/-- The first convolution is semiconvex. -/
theorem semiconvex_uconv (hα : 0 < α) (hub : BddAbove (range uT)) :
    SemiconvexWith (lamC α h0) (supConv (lamC α h0) uT) :=
  semiconvex_supConv (lamC_pos hα h0).le hub
theoremsemiconvex_vconv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{vT} \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{h0} \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • BddAbove (Set.range fun y => -vT y) hvb

Then PLaplacian.SemiconvexWith (PLaplacian.lamC α h0) fun y => -(fun ζ => -PLaplacian.supConv (PLaplacian.lamC α h0) (fun y => -vT y) ζ) y.

PLaplacian.semiconvex_vconvPlaplacian/Reduce2.lean, lines 203–210
/-- The negated second convolution is semiconvex. -/
theorem semiconvex_vconv (hα : 0 < α) (hvb : BddAbove (range (fun y => -vT y))) :
    SemiconvexWith (lamC α h0)
      (fun y => -(fun ζ => -supConv (lamC α h0) (fun y => -vT y) ζ) y) := by
  have h := semiconvex_supConv (lamC_pos hα h0).le hvb (lam := lamC α h0)
  unfold SemiconvexWith at h ⊢
  simp only [neg_neg]
  exact h

Plaplacian/RegPair.lean13 declarations

defregU
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $U \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The regularized subsolution. -/
def regU (lam : ℝ) (U : EuclSpace d → ℝ) : EuclSpace d → ℝ := supConv lam U
defregV
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The regularized supersolution. -/
def regV (lam : ℝ) (V : EuclSpace d → ℝ) : EuclSpace d → ℝ :=
  fun ξ => -supConv lam (fun y => -V y) ξ
theoremusc_neg_of_lsc
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $V\text{ is lower semicontinuous}$ hV

Then UpperSemicontinuous fun y => -V y.

theorem usc_neg_of_lsc {V : EuclSpace d → ℝ} (hV : LowerSemicontinuous V) :
    UpperSemicontinuous (fun y => -V y) := by
  intro x c hc
  have := hV x (-c) (by linarith)
  exact this.mono fun y hy => by linarith
theorembddAbove_neg_of_bddBelow
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $V\text{ is bounded below}$ hVb

Then BddAbove (Set.range fun y => -V y).

PLaplacian.bddAbove_neg_of_bddBelowPlaplacian/RegPair.lean, lines 46–52
theorem bddAbove_neg_of_bddBelow {V : EuclSpace d → ℝ} (hVb : BddBelow (range V)) :
    BddAbove (range (fun y => -V y)) := by
  obtain ⟨m, hm⟩ := hVb
  refine ⟨-m, ?_⟩
  rintro _ ⟨y, rfl⟩
  have := hm ⟨y, rfl⟩
  linarith
theoremneg_regV
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$.

Then (fun z => -PLaplacian.regV lam V z) = PLaplacian.supConv lam fun y => -V y.

theorem neg_regV (lam : ℝ) (V : EuclSpace d → ℝ) :
    (fun z => -regV lam V z) = supConv lam (fun y => -V y) := by
  funext z
  simp [regV]
theoremregU_bounds
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $U \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{SU}, \mathrm{SL} \in \mathbb{R}$, $\xi \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $U\text{ is bounded above}$ hUb
  • $\forall x,\ U(x) \le \mathrm{SU}$ hSU
  • $\forall x,\ \mathrm{SL} \le U(x)$ hSL

Then all of the following hold:

  • $U(\xi) \le \operatorname{regU}(\mathrm{lam}, U, \xi)$
  • $\operatorname{regU}(\mathrm{lam}, U, \xi) \le \mathrm{SU}$
  • $\mathrm{SL} \le \operatorname{regU}(\mathrm{lam}, U, \xi)$
theorem regU_bounds {lam : ℝ} (hlam : 0 ≤ lam) {U : EuclSpace d → ℝ}
    (hUb : BddAbove (range U)) {SU SL : ℝ} (hSU : ∀ x, U x ≤ SU) (hSL : ∀ x, SL ≤ U x)
    (ξ : EuclSpace d) :
    U ξ ≤ regU lam U ξ ∧ regU lam U ξ ≤ SU ∧ SL ≤ regU lam U ξ := by
  have h1 := self_le_supConv hlam hUb ξ
  have h2 := supConv_le_bound hlam hSU ξ
  exact ⟨h1, h2, le_trans (hSL ξ) h1⟩
theoremregV_bounds
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{TU}, \mathrm{TL} \in \mathbb{R}$, $\xi \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $V\text{ is bounded below}$ hVb
  • $\forall x,\ V(x) \le \mathrm{TU}$ hTU
  • $\forall x,\ \mathrm{TL} \le V(x)$ hTL

Then all of the following hold:

  • $\operatorname{regV}(\mathrm{lam}, V, \xi) \le V(\xi)$
  • $\mathrm{TL} \le \operatorname{regV}(\mathrm{lam}, V, \xi)$
  • $\operatorname{regV}(\mathrm{lam}, V, \xi) \le \mathrm{TU}$
theorem regV_bounds {lam : ℝ} (hlam : 0 ≤ lam) {V : EuclSpace d → ℝ}
    (hVb : BddBelow (range V)) {TU TL : ℝ} (hTU : ∀ x, V x ≤ TU) (hTL : ∀ x, TL ≤ V x)
    (ξ : EuclSpace d) :
    regV lam V ξ ≤ V ξ ∧ TL ≤ regV lam V ξ ∧ regV lam V ξ ≤ TU := by
  have hb := bddAbove_neg_of_bddBelow hVb
  have h1 := self_le_supConv hlam hb ξ
  have h2 := supConv_le_bound hlam (fun x => (by linarith [hTL x] : -V x ≤ -TL)) ξ
  unfold regV
  refine ⟨by linarith, by linarith, by linarith [hTU ξ]⟩
theoremregU_semiconvex
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $U \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $U\text{ is bounded above}$ hUb

Then $\operatorname{SemiconvexWith}(\mathrm{lam}, \operatorname{regU}(\mathrm{lam}, U))$.

PLaplacian.regU_semiconvexPlaplacian/RegPair.lean, lines 81–83
theorem regU_semiconvex {lam : ℝ} (hlam : 0 ≤ lam) {U : EuclSpace d → ℝ}
    (hUb : BddAbove (range U)) : SemiconvexWith lam (regU lam U) :=
  semiconvex_supConv hlam hUb
theoremregV_semiconcave
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $V\text{ is bounded below}$ hVb

Then PLaplacian.SemiconvexWith lam fun y => -PLaplacian.regV lam V y.

PLaplacian.regV_semiconcavePlaplacian/RegPair.lean, lines 85–88
theorem regV_semiconcave {lam : ℝ} (hlam : 0 ≤ lam) {V : EuclSpace d → ℝ}
    (hVb : BddBelow (range V)) : SemiconvexWith lam (fun y => -regV lam V y) := by
  rw [neg_regV]
  exact semiconvex_supConv hlam (bddAbove_neg_of_bddBelow hVb)
theoremregU_continuous
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $U \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $U\text{ is bounded above}$ hUb

Then $\operatorname{regU}(\mathrm{lam}, U)\text{ is continuous}$.

PLaplacian.regU_continuousPlaplacian/RegPair.lean, lines 90–92
theorem regU_continuous {lam : ℝ} (hlam : 0 ≤ lam) {U : EuclSpace d → ℝ}
    (hUb : BddAbove (range U)) : Continuous (regU lam U) :=
  semiconvex_continuous (regU_semiconvex hlam hUb)
theoremregV_continuous
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $V\text{ is bounded below}$ hVb

Then $\operatorname{regV}(\mathrm{lam}, V)\text{ is continuous}$.

PLaplacian.regV_continuousPlaplacian/RegPair.lean, lines 94–97
theorem regV_continuous {lam : ℝ} (hlam : 0 ≤ lam) {V : EuclSpace d → ℝ}
    (hVb : BddBelow (range V)) : Continuous (regV lam V) := by
  have h := semiconvex_continuous (regV_semiconcave hlam hVb)
  exact h.neg.congr fun y => neg_neg _
theoremregU_jet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $U \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam} \in \mathbb{R}$, $\mathrm{SU}, \mathrm{SL} \in \mathbb{R}$, $\xi \in \mathbb{R}^{d}$, $\rho \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $U\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsub
  • $0 < \mathrm{lam}$ hlam
  • $U\text{ is upper semicontinuous}$ hU
  • $U\text{ is bounded above}$ hUb
  • $\forall x,\ U(x) \le \mathrm{SU}$ hSU
  • $\forall x,\ \mathrm{SL} \le U(x)$ hSL
  • $2 \cdot (\mathrm{SU} - \mathrm{SL}) / \mathrm{lam} < \rho ^{2}$ hρ
  • $0 < \rho$ hρ0
  • $B(\xi, \rho) \subseteq \Omega$ hball
  • (q, X) ∈ PLaplacian.SuperJet (PLaplacian.regU lam U) ξ hj
  • $q \ne 0$ hq

Then $\operatorname{viscF}(p, q, X) \le 0$.

theorem regU_jet (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {Ω : Set (EuclSpace d)}
    {U : EuclSpace d → ℝ} (hsub : IsViscositySubsolution p Ω (fun _ => 0) U)
    {lam : ℝ} (hlam : 0 < lam) (hU : UpperSemicontinuous U) (hUb : BddAbove (range U))
    {SU SL : ℝ} (hSU : ∀ x, U x ≤ SU) (hSL : ∀ x, SL ≤ U x)
    {ξ : EuclSpace d} {ρ : ℝ} (hρ : 2 * (SU - SL) / lam < ρ ^ 2) (hρ0 : 0 < ρ)
    (hball : ball ξ ρ ⊆ Ω) {q : EuclSpace d} {X : Bilin d}
    (hj : (q, X) ∈ SuperJet (regU lam U) ξ) (hq : q ≠ 0) : viscF p q X ≤ 0 :=
  supConv_jet hd hp hsub hlam hU hUb
    (supConv_maximizer_mem hlam hUb hSU hSL hρ hρ0 hball) hj hq
theoremregV_jet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam} \in \mathbb{R}$, $\mathrm{TU}, \mathrm{TL} \in \mathbb{R}$, $\xi \in \mathbb{R}^{d}$, $\rho \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $V\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsup
  • $0 < \mathrm{lam}$ hlam
  • $V\text{ is lower semicontinuous}$ hV
  • $V\text{ is bounded below}$ hVb
  • $\forall x,\ V(x) \le \mathrm{TU}$ hTU
  • $\forall x,\ \mathrm{TL} \le V(x)$ hTL
  • $2 \cdot (\mathrm{TU} - \mathrm{TL}) / \mathrm{lam} < \rho ^{2}$ hρ
  • $0 < \rho$ hρ0
  • $B(\xi, \rho) \subseteq \Omega$ hball
  • (q, X) ∈ PLaplacian.SuperJet (fun z => -PLaplacian.regV lam V z) ξ hj
  • $q \ne 0$ hq

Then $\operatorname{viscF}(p, q, X) \le 0$.

theorem regV_jet (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {Ω : Set (EuclSpace d)}
    {V : EuclSpace d → ℝ} (hsup : IsViscositySupersolution p Ω (fun _ => 0) V)
    {lam : ℝ} (hlam : 0 < lam) (hV : LowerSemicontinuous V) (hVb : BddBelow (range V))
    {TU TL : ℝ} (hTU : ∀ x, V x ≤ TU) (hTL : ∀ x, TL ≤ V x)
    {ξ : EuclSpace d} {ρ : ℝ} (hρ : 2 * (TU - TL) / lam < ρ ^ 2) (hρ0 : 0 < ρ)
    (hball : ball ξ ρ ⊆ Ω) {q : EuclSpace d} {X : Bilin d}
    (hj : (q, X) ∈ SuperJet (fun z => -regV lam V z) ξ) (hq : q ≠ 0) :
    viscF p q X ≤ 0 := by
  rw [neg_regV] at hj
  have hb := bddAbove_neg_of_bddBelow hVb
  have hρ' : 2 * (-TL - -TU) / lam < ρ ^ 2 := by
    rw [show -TL - -TU = TU - TL by ring]; exact hρ
  exact supConv_jet hd hp hsup.neg hlam (usc_neg_of_lsc hV) hb
    (supConv_maximizer_mem hlam hb (fun x => (by linarith [hTL x] : -V x ≤ -TL))
      (fun x => (by linarith [hTU x] : -TU ≤ -V x)) hρ' hρ0 hball) hj hq

Plaplacian/Regular.lean1 declarations

theoremregular_subsolTheorem 4.6 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < r$ hr
  • $\overline{B}(x_{0}, r) \subseteq \Omega$ hΩ
  • $\operatorname{IsStrictMaxOn}(w \mapsto \overline{u}(w) - \varphi(w), x_{0}, r)$ hstrict
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hx₀

Then $0 \le \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x_{0}))$.

/-- **The regular-case subsolution inequality.** -/
theorem regular_subsol [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) (hφb : BddMeas φ)
    {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    {x₀ : EuclSpace d} {r : ℝ} (hr : 0 < r) (hΩ : closedBall x₀ r ⊆ Ω)
    (hstrict : IsStrictMaxOn (fun w => ubar u w - φ w) x₀ r)
    (hx₀ : gradient φ x₀ ≠ 0) :
    0 ≤ normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) := by
  by_contra hneg
  push Not at hneg
  set N := fun y => normPLapOf p (gradient φ y) (fderiv ℝ (fderiv ℝ φ) y)
    with hNdef
  set γ := -N x₀ with hγdef
  have hγ : 0 < γ := by rw [hγdef]; linarith
  -- continuity keeps the operator below -γ/2 near the maximum
  have hcont := normPLapOf_continuousAt (p := p) (hφ.of_le (by norm_num)) hx₀
  have hev1 : ∀ᶠ y in nhds x₀, N y < -γ / 2 :=
    hcont.eventually (eventually_lt_nhds (by rw [hγdef]; linarith))
  rw [Metric.eventually_nhds_iff] at hev1
  obtain ⟨ρ₁, hρ₁, hN⟩ := hev1
  -- the uniform expansion
  obtain ⟨ρ₂, hρ₂, H, K, Ka, g, _hg, _hK, _hH, _hKa, hexp⟩ :=
    expansion_uniform hd hp hpd hφ hx₀
  set η := γ / (8 * (p + (d : ℝ))) with hηdef
  have hη : 0 < η := by rw [hηdef]; positivity
  -- the radius for the near-maximizer
  set ρ := min (min ρ₁ ρ₂) (r / 2) with hρdef
  have hρ : 0 < ρ := by
    rw [hρdef]; exact lt_min (lt_min hρ₁ hρ₂) (by linarith)
  -- the near-maximizer as a function of the parameter
  have hex : ∀ ε : ℝ, 0 < ε → ∃ z ∈ closedBall x₀ r,
      sSup ((fun w => u ε w - φ w) '' closedBall x₀ r) - ε ^ 3
        < u ε z - φ z :=
    fun ε hε => exists_near_sup_cube u hC hB x₀ hr hε
  choose! y hymem hynear using hex
  have hfreq := nearmax_frequently_in_ball u hC hφ.continuous hB hr hρ
    hstrict y (fun ε hε => ⟨hymem ε hε, hynear ε hε⟩)
  -- the eventual conditions on the parameter
  have hsmall := eventually_bound_le (H := H) (K := K) (Ka := Ka) (g := g) hη
  have hlt : ∀ {a : ℝ}, 0 < a →
      ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), ε < a := by
    intro a ha
    exact Filter.mem_of_superset (Ioo_mem_nhdsGT ha) (fun x hx => hx.2)
  have hpos : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), 0 < ε :=
    self_mem_nhdsWithin
  have hev : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      ((H * ε * Real.sqrt (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g))
          + K * ε ^ 3) + Ka * ε ^ 3 ≤ η * ε ^ 2)
      ∧ ε < r / 2 ∧ ε < ρ₂ ∧ ε < η ∧ 0 < ε :=
    hsmall.and ((hlt (by linarith : (0:ℝ) < r / 2)).and
      ((hlt hρ₂).and ((hlt hη).and hpos)))
  -- a parameter satisfying all of it
  obtain ⟨ε, hyball, hbd, hεr, hερ₂, hεη, hε⟩ :=
    (hfreq.and_eventually hev).exists
  -- the near-maximizer's position
  have hyρ : dist (y ε) x₀ < ρ := hyball
  have hy₁ : y ε ∈ ball x₀ ρ₁ := by
    rw [mem_ball]
    exact lt_of_lt_of_le hyρ (le_trans (min_le_left _ _) (min_le_left _ _))
  have hy₂ : y ε ∈ ball x₀ ρ₂ := by
    rw [mem_ball]
    exact lt_of_lt_of_le hyρ (le_trans (min_le_left _ _) (min_le_right _ _))
  have hyr : dist (y ε) x₀ < r / 2 :=
    lt_of_lt_of_le hyρ (min_le_right _ _)
  -- the expansion at the near-maximizer
  obtain ⟨E, hTeq, hEbd⟩ := hexp (y ε) hy₂ ε hε (le_of_lt hερ₂)
  -- the approximate comparison at the near-maximizer
  have hyΩ : y ε ∈ Ω := hΩ (hymem ε hε)
  have hle : ∀ w ∈ ball (y ε) ε,
      u ε w - φ w ≤ sSup ((fun w => u ε w - φ w) '' closedBall x₀ r) := by
    intro w hw
    have hwc : w ∈ closedBall x₀ r := by
      rw [mem_closedBall]
      rw [mem_ball] at hw
      have := dist_triangle w (y ε) x₀
      linarith
    exact le_sup_on_ball u hC hB x₀ w hwc
  have hcmp := dpp_comparison_approx hp hε hpd (hu ε hε) hφb hyΩ hle
    (le_of_lt (hynear ε hε))
  -- combine
  rw [hTeq] at hcmp
  have hNy : N (y ε) < -γ / 2 := hN hy₁
  have hc : 0 < ε ^ 2 / (2 * (p + (d : ℝ))) := by positivity
  have hε2 : 0 < ε ^ 2 := by positivity
  have hcγ : ε ^ 2 / (2 * (p + (d : ℝ))) * (γ / 2) = 2 * η * ε ^ 2 := by
    rw [hηdef]; field_simp; ring
  have h1 : ε ^ 2 / (2 * (p + (d : ℝ))) * N (y ε) < -(2 * η * ε ^ 2) := by
    have := mul_lt_mul_of_pos_left hNy hc
    linarith [this, hcγ]
  have h2 : E ≤ η * ε ^ 2 := le_trans (le_abs_self E) (le_trans hEbd hbd)
  have h3 : ε ^ 3 < η * ε ^ 2 := by
    have : ε * ε ^ 2 < η * ε ^ 2 := mul_lt_mul_of_pos_right hεη hε2
    nlinarith [this]
  have h4 : 0 ≤ ε ^ 2 / (2 * (p + (d : ℝ))) * N (y ε) + E + ε ^ 3 := by
    simp only [hNdef] at h1 ⊢
    linarith [hcmp]
  linarith [h1, h2, h3, h4]

Plaplacian/Regularize.lean1 declarations

theoremregularizeTheorem 4.12 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $V, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $R \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{IsLocalMax}(w \mapsto V(w) - \varphi(w), x_{0})$ hmax
  • $0 < R$ hR

Then there exists $\psi, r$ such that:

  • $0 < r$
  • $r \le R$
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \psi)$
  • $\psi\text{ is admissible (bounded and Borel measurable)}$
  • $\exists B,\ \forall y,\ \lvert \psi(y)\rvert \le B$
  • $\operatorname{IsStrictMaxOn}(w \mapsto V(w) - \psi(w), x_{0}, r)$
  • $\operatorname{gradient}(\psi, x_{0}) = \operatorname{gradient}(\varphi, x_{0})$
  • $\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \psi), x_{0}) = \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x_{0})$
/-- **Regularization.** From a local maximum of `V - φ`, a bounded `C³` test
function with a strict maximum of `V - ψ` on a closed ball, agreeing with `φ`
to second order at the base point. -/
theorem regularize {V φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x₀ : EuclSpace d} (hmax : IsLocalMax (fun w => V w - φ w) x₀)
    {R : ℝ} (hR : 0 < R) :
    ∃ ψ : EuclSpace d → ℝ, ∃ r : ℝ, 0 < r ∧ r ≤ R ∧
      ContDiff ℝ 3 ψ ∧ BddMeas ψ ∧ (∃ B, ∀ y, |ψ y| ≤ B) ∧
      IsStrictMaxOn (fun w => V w - ψ w) x₀ r ∧
      gradient ψ x₀ = gradient φ x₀ ∧
      fderiv ℝ (fderiv ℝ ψ) x₀ = fderiv ℝ (fderiv ℝ φ) x₀ := by
  -- the bump, the perturbed function, and the cut-off one
  let χ : ContDiffBump x₀ := ⟨R, 2 * R, hR, by linarith⟩
  set ψ0 : EuclSpace d → ℝ := fun w => φ w + quart x₀ w with hψ0def
  set ψ : EuclSpace d → ℝ := fun w => χ w * ψ0 w with hψdef
  have hψ0 : ContDiff ℝ 3 ψ0 := hφ.add (contDiff_quart x₀)
  have hψ : ContDiff ℝ 3 ψ := (χ.contDiff (n := 3)).mul hψ0
  -- the cut-off function agrees with the perturbed one on the inner ball
  have hagree : ∀ w ∈ closedBall x₀ R, ψ w = ψ0 w := by
    intro w hw
    have h1 : χ w = 1 := χ.one_of_mem_closedBall hw
    simp only [hψdef, h1, one_mul]
  have hev : ψ =ᶠ[𝓝 x₀] ψ0 := by
    filter_upwards [closedBall_mem_nhds x₀ hR] with w hw
    exact hagree w hw
  -- so their derivatives agree at the base point
  have hd1 : fderiv ℝ ψ x₀ = fderiv ℝ ψ0 x₀ := hev.fderiv_eq
  have hd2 : fderiv ℝ (fderiv ℝ ψ) x₀ = fderiv ℝ (fderiv ℝ ψ0) x₀ :=
    hev.fderiv.fderiv_eq
  -- and the perturbed function has the derivatives of the original
  have hφd : Differentiable ℝ φ := hφ.differentiable (by norm_num)
  have hqd : Differentiable ℝ (quart x₀) :=
    (contDiff_quart x₀ (n := 1)).differentiable (by norm_num)
  have hψ0d1 : fderiv ℝ ψ0 = fun w => fderiv ℝ φ w + fderiv ℝ (quart x₀) w := by
    funext w; exact fderiv_add (hφd w) (hqd w)
  have hfx : fderiv ℝ ψ0 x₀ = fderiv ℝ φ x₀ := by
    rw [hψ0d1]; simp only [fderiv_quart_self, add_zero]
  have hhx : fderiv ℝ (fderiv ℝ ψ0) x₀ = fderiv ℝ (fderiv ℝ φ) x₀ := by
    rw [hψ0d1]
    have hφd2 : Differentiable ℝ (fderiv ℝ φ) :=
      (hφ.fderiv_right (m := 1) (by norm_num)).differentiable (by norm_num)
    have hqd2 : Differentiable ℝ (fderiv ℝ (quart x₀)) :=
      ((contDiff_quart x₀ (n := 2)).fderiv_right (m := 1)
        (by norm_num)).differentiable (by norm_num)
    rw [show (fun w => fderiv ℝ φ w + fderiv ℝ (quart x₀) w)
        = fderiv ℝ φ + fderiv ℝ (quart x₀) from rfl,
      fderiv_add (hφd2 x₀) (hqd2 x₀), hess_quart_self, add_zero]
  have hgrad : gradient ψ x₀ = gradient φ x₀ := by
    unfold gradient; rw [hd1, hfx]
  -- boundedness, from compact support
  have hcs : HasCompactSupport ψ := χ.hasCompactSupport.mul_right
  obtain ⟨B, hB⟩ := hψ.continuous.bounded_above_of_compact_support hcs
  have hbd : ∀ y, |ψ y| ≤ B := fun y => by
    rw [← Real.norm_eq_abs]; exact hB y
  have hbm : BddMeas ψ := ⟨hψ.continuous.measurable, ⟨B, hbd⟩⟩
  -- the strict maximum
  obtain ⟨ρ, hρ, hloc⟩ := exists_radius_of_isLocalMax hmax
  set r := min (ρ / 2) R with hrdef
  have hr : 0 < r := lt_min (by linarith) hR
  have hrR : r ≤ R := min_le_right _ _
  refine ⟨ψ, r, hr, hrR, hψ, hbm, ⟨B, hbd⟩, ?_, hgrad, by rw [hd2, hhx]⟩
  intro w hw hne
  have hwR : w ∈ closedBall x₀ R := closedBall_subset_closedBall hrR hw
  have hwρ : w ∈ ball x₀ ρ := by
    rw [mem_ball]
    rw [mem_closedBall] at hw
    have := min_le_left (ρ / 2) R
    linarith
  have hψw : ψ w = φ w + quart x₀ w := hagree w hwR
  have hψx : ψ x₀ = φ x₀ := by
    rw [hagree x₀ (mem_closedBall_self hR.le)]
    simp only [hψ0def, quart_self, add_zero]
  have hlw := hloc w hwρ
  have hqp := quart_pos hne
  change V w - ψ w < V x₀ - ψ x₀
  rw [hψw, hψx]
  linarith

Plaplacian/Relaxed.lean8 declarations

theorembounds

No exported statement.

theorem bounds a solution by the bound on the initial datum with no dependence
defrelaxFilter
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\operatorname{Filter}(\mathbb{R} \times \mathbb{R}^{d})$.

/-- The filter along which the limits are taken. -/
def relaxFilter (x : EuclSpace d) : Filter (ℝ × EuclSpace d) :=
  (nhdsWithin (0 : ℝ) (Set.Ioi 0)) ×ˢ (nhds x)
defubar
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The upper half-relaxed limit. -/
def ubar (u : ℝ → EuclSpace d → ℝ) (x : EuclSpace d) : ℝ :=
  Filter.limsup (fun q : ℝ × EuclSpace d => u q.1 q.2) (relaxFilter x)
deflbar
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The lower half-relaxed limit. -/
def lbar (u : ℝ → EuclSpace d → ℝ) (x : EuclSpace d) : ℝ :=
  Filter.liminf (fun q : ℝ × EuclSpace d => u q.1 q.2) (relaxFilter x)
instancerelaxFilter_neBot
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Then (PLaplacian.relaxFilter x).NeBot.

PLaplacian.relaxFilter_neBotPlaplacian/Relaxed.lean, lines 65–70
/-- The filter is not trivial. -/
instance relaxFilter_neBot (x : EuclSpace d) : (relaxFilter x).NeBot := by
  unfold relaxFilter
  have h1 : (nhdsWithin (0 : ℝ) (Set.Ioi 0)).NeBot := by
    infer_instance
  exact Filter.prod_neBot.2 ⟨h1, inferInstance⟩
theoremisBoundedUnder_le_of_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC

Then Filter.IsBoundedUnder (fun x1 x2 => x1 ≤ x2) (PLaplacian.relaxFilter x) fun q => u q.1 q.2.

PLaplacian.isBoundedUnder_le_of_boundPlaplacian/Relaxed.lean, lines 72–78
/-- A uniform bound gives boundedness above along the filter. -/
theorem isBoundedUnder_le_of_bound (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) (x : EuclSpace d) :
    Filter.IsBoundedUnder (· ≤ ·) (relaxFilter x)
      (fun q : ℝ × EuclSpace d => u q.1 q.2) := by
  refine Filter.isBoundedUnder_of ⟨C, fun q => ?_⟩
  exact le_of_abs_le (hC q.1 q.2)
theoremisBoundedUnder_ge_of_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC

Then Filter.IsBoundedUnder (fun x1 x2 => x1 ≥ x2) (PLaplacian.relaxFilter x) fun q => u q.1 q.2.

PLaplacian.isBoundedUnder_ge_of_boundPlaplacian/Relaxed.lean, lines 80–88
/-- And below. -/
theorem isBoundedUnder_ge_of_bound (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) (x : EuclSpace d) :
    Filter.IsBoundedUnder (· ≥ ·) (relaxFilter x)
      (fun q : ℝ × EuclSpace d => u q.1 q.2) := by
  refine Filter.isBoundedUnder_of ⟨-C, fun q => ?_⟩
  have h := hC q.1 q.2
  have := abs_le.1 h
  exact this.1
theoremlbar_le_ubarTheorem 4.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC

Then $\underline{u}(x) \le \overline{u}(x)$.

/-- **The lower limit does not exceed the upper.** -/
theorem lbar_le_ubar (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) (x : EuclSpace d) :
    lbar u x ≤ ubar u x := by
  unfold lbar ubar
  exact Filter.liminf_le_limsup
    (isBoundedUnder_le_of_bound u hC x)
    (isBoundedUnder_ge_of_bound u hC x)

Plaplacian/RiemannTaylor.lean2 declarations

theoremsum_range_affine
Formal statementgenerated from the Lean declaration

Let $N \in \mathbb{N}$, $a, b \in \mathbb{R}$.

Then ∑ k ∈ Finset.range N, (a + b * ↑k) = ↑N * a + b * (↑N * (↑N - 1) / 2).

/-- The sum of an affine function over a range. -/
theorem sum_range_affine (N : ℕ) (a b : ℝ) :
    ∑ k ∈ range N, (a + b * (k : ℝ)) = N * a + b * ((N : ℝ) * ((N : ℝ) - 1) / 2) := by
  induction N with
  | zero => simp
  | succ n ih => rw [sum_range_succ, ih]; push_cast; ring
theorempeano_of_approx
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, \mathrm{p0} \in \mathbb{R}^{d}$, A : EuclSpace d →L[ℝ] EuclSpace d, $\mathrm{sel} \colon \mathbb{R}^{d} \to \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\forall z,\ \operatorname{IsSubgrad}(f, z, \operatorname{sel}(z))$ hsel
  • $\forall \varepsilon > 0,\ \exists \delta > 0,\ \forall z,\ \lVert z - x\rVert < \delta \to \lVert \operatorname{sel}(z) - \mathrm{p0} - A(z - x)\rVert \le \varepsilon \cdot \lVert z - x\rVert$ happrox
  • $0 < \varepsilon$ hε

Then there exists $\delta > 0$ such that:

  • $\forall h,\ \lVert h\rVert < \delta \to \lvert f(x + h) - f(x) - \operatorname{inner}(\mathbb{R}, \mathrm{p0}, h) - 1 / 2 \cdot \operatorname{inner}(\mathbb{R}, A(h), h)\rvert \le \varepsilon \cdot \lVert h\rVert ^{2}$
/-- **The second-order expansion from a linear approximation of subgradients.** -/
theorem peano_of_approx {f : EuclSpace d → ℝ} {x p0 : EuclSpace d}
    {A : EuclSpace d →L[ℝ] EuclSpace d} {sel : EuclSpace d → EuclSpace d}
    (hsel : ∀ z, IsSubgrad f z (sel z))
    (happrox : ∀ ε > 0, ∃ δ > 0, ∀ z, ‖z - x‖ < δ →
      ‖sel z - p0 - A (z - x)‖ ≤ ε * ‖z - x‖)
    {ε : ℝ} (hε : 0 < ε) :
    ∃ δ > 0, ∀ h : EuclSpace d, ‖h‖ < δ →
      |f (x + h) - f x - inner ℝ p0 h - 1 / 2 * inner ℝ (A h) h| ≤ ε * ‖h‖ ^ 2 := by
  set CA := ‖A‖ with hCA
  have hCA0 : 0 ≤ CA := norm_nonneg _
  -- the number of steps
  set N : ℕ := ⌈CA / ε⌉₊ + 1 with hNdef
  set Nr : ℝ := (N : ℝ) with hNr
  have hN1 : (1 : ℝ) ≤ Nr := by
    rw [hNr, hNdef]; push_cast; have := Nat.cast_nonneg (α := ℝ) ⌈CA / ε⌉₊; linarith
  have hNpos : 0 < Nr := by linarith
  have hCAN : CA ≤ ε * Nr := by
    have h1 : CA / ε ≤ (⌈CA / ε⌉₊ : ℝ) := Nat.le_ceil _
    have h2 : CA / ε ≤ Nr := by rw [hNr, hNdef]; push_cast; linarith
    rw [div_le_iff₀ hε] at h2
    linarith
  obtain ⟨δ, hδ, hap⟩ := happrox (ε / 2) (by positivity)
  refine ⟨δ, hδ, fun h hh => ?_⟩
  set z : ℕ → EuclSpace d := fun k => x + ((k : ℝ) / Nr) • h with hzdef
  set Q := inner ℝ (A h) h with hQ
  set c := inner ℝ p0 h with hc
  set e := ε / 2 * ‖h‖ ^ 2 with he
  have hz0 : z 0 = x := by simp [hzdef]
  have hzN : z N = x + h := by
    simp only [hzdef]
    rw [show ((N : ℝ) / Nr) = 1 by rw [hNr]; exact div_self hNpos.ne', one_smul]
  have hdz : ∀ k, z (k + 1) - z k = (1 / Nr) • h := by
    intro k
    simp only [hzdef]
    rw [show x + (((k + 1 : ℕ) : ℝ) / Nr) • h - (x + ((k : ℝ) / Nr) • h)
        = ((((k + 1 : ℕ) : ℝ) / Nr) - (k : ℝ) / Nr) • h by rw [sub_smul]; abel]
    congr 1
    push_cast
    field_simp
    ring
  have hzx : ∀ k, k ≤ N → ‖z k - x‖ ≤ ‖h‖ := by
    intro k hk
    have e1 : z k - x = ((k : ℝ) / Nr) • h := by simp [hzdef]
    rw [e1, norm_smul, Real.norm_eq_abs]
    have hk0 : 0 ≤ (k : ℝ) / Nr := by positivity
    have hk1 : (k : ℝ) / Nr ≤ 1 := by
      rw [div_le_one hNpos, hNr]; exact_mod_cast hk
    rw [abs_of_nonneg hk0]
    calc (k : ℝ) / Nr * ‖h‖ ≤ 1 * ‖h‖ := mul_le_mul_of_nonneg_right hk1 (norm_nonneg h)
      _ = ‖h‖ := one_mul _
  -- the subgradients along the segment
  have hak : ∀ k, k ≤ N → |inner ℝ (sel (z k)) h - (c + (k : ℝ) / Nr * Q)| ≤ e := by
    intro k hk
    have hzk := hzx k hk
    have hb := hap (z k) (lt_of_le_of_lt hzk hh)
    have e1 : z k - x = ((k : ℝ) / Nr) • h := by simp [hzdef]
    have e2 : inner ℝ (sel (z k)) h - (c + (k : ℝ) / Nr * Q)
        = inner ℝ (sel (z k) - p0 - A (z k - x)) h := by
      rw [e1, map_smul, inner_sub_left, inner_sub_left, real_inner_smul_left]
      rw [hc, hQ]; ring
    rw [e2]
    calc |inner ℝ (sel (z k) - p0 - A (z k - x)) h|
        ≤ ‖sel (z k) - p0 - A (z k - x)‖ * ‖h‖ := abs_real_inner_le_norm _ _
      _ ≤ (ε / 2 * ‖z k - x‖) * ‖h‖ := mul_le_mul_of_nonneg_right hb (norm_nonneg h)
      _ ≤ (ε / 2 * ‖h‖) * ‖h‖ := by
          apply mul_le_mul_of_nonneg_right _ (norm_nonneg h)
          exact mul_le_mul_of_nonneg_left hzk (by positivity)
      _ = e := by rw [he]; ring
  -- the increments along the segment
  have hlow : ∀ k, (1 / Nr) * inner ℝ (sel (z k)) h ≤ f (z (k + 1)) - f (z k) := by
    intro k
    have h1 := hsel (z k) (z (k + 1))
    rw [hdz k, real_inner_smul_right] at h1
    linarith
  have hupp : ∀ k, f (z (k + 1)) - f (z k) ≤ (1 / Nr) * inner ℝ (sel (z (k + 1))) h := by
    intro k
    have h1 := hsel (z (k + 1)) (z k)
    have e1 : z k - z (k + 1) = -((1 / Nr) • h) := by rw [← hdz k]; abel
    rw [e1, inner_neg_right, real_inner_smul_right] at h1
    linarith
  -- telescoping
  have hS : f (x + h) - f x = ∑ k ∈ range N, (f (z (k + 1)) - f (z k)) := by
    rw [sum_range_sub (fun k => f (z k)) N, hzN, hz0]
  -- the lower sum
  have hL : ∑ k ∈ range N, ((1 / Nr) * (c - e) + Q / Nr ^ 2 * (k : ℝ)) ≤ f (x + h) - f x := by
    rw [hS]
    apply sum_le_sum
    intro k hk
    have hk' : k ≤ N := (mem_range.1 hk).le
    have h1 := (abs_le.1 (hak k hk')).1
    have h2 := hlow k
    have e3 : (1 / Nr) * (c - e) + Q / Nr ^ 2 * (k : ℝ)
        = (1 / Nr) * (c + (k : ℝ) / Nr * Q - e) := by field_simp; ring
    rw [e3]
    have h3 := mul_le_mul_of_nonneg_left
      (by linarith : c + (k : ℝ) / Nr * Q - e ≤ inner ℝ (sel (z k)) h)
      (by positivity : (0 : ℝ) ≤ 1 / Nr)
    linarith
  have hLval : ∑ k ∈ range N, ((1 / Nr) * (c - e) + Q / Nr ^ 2 * (k : ℝ))
      = (c - e) + Q * (Nr - 1) / (2 * Nr) := by
    rw [sum_range_affine]
    rw [← hNr]
    field_simp
  -- the upper sum
  have hU : f (x + h) - f x
      ≤ ∑ k ∈ range N, ((1 / Nr) * (c + Q / Nr + e) + Q / Nr ^ 2 * (k : ℝ)) := by
    rw [hS]
    apply sum_le_sum
    intro k hk
    have hk' : k + 1 ≤ N := mem_range.1 hk
    have h1 := (abs_le.1 (hak (k + 1) hk')).2
    have h2 := hupp k
    have e3 : (1 / Nr) * (c + Q / Nr + e) + Q / Nr ^ 2 * (k : ℝ)
        = (1 / Nr) * (c + ((k + 1 : ℕ) : ℝ) / Nr * Q + e) := by push_cast; field_simp; ring
    rw [e3]
    have h3 := mul_le_mul_of_nonneg_left
      (by linarith : inner ℝ (sel (z (k + 1))) h ≤ c + ((k + 1 : ℕ) : ℝ) / Nr * Q + e)
      (by positivity : (0 : ℝ) ≤ 1 / Nr)
    linarith
  have hUval : ∑ k ∈ range N, ((1 / Nr) * (c + Q / Nr + e) + Q / Nr ^ 2 * (k : ℝ))
      = (c + e) + Q * (Nr + 1) / (2 * Nr) := by
    rw [sum_range_affine]
    rw [← hNr]
    field_simp
    ring
  rw [hLval] at hL
  rw [hUval] at hU
  -- the quadratic term
  have hQb : |Q| ≤ CA * ‖h‖ ^ 2 := by
    calc |Q| ≤ ‖A h‖ * ‖h‖ := abs_real_inner_le_norm _ _
      _ ≤ (CA * ‖h‖) * ‖h‖ := mul_le_mul_of_nonneg_right (A.le_opNorm h) (norm_nonneg h)
      _ = CA * ‖h‖ ^ 2 := by ring
  have hQN : |Q| / (2 * Nr) ≤ ε / 2 * ‖h‖ ^ 2 := by
    rw [div_le_iff₀ (by positivity)]
    have h1 : CA * ‖h‖ ^ 2 ≤ ε * Nr * ‖h‖ ^ 2 :=
      mul_le_mul_of_nonneg_right hCAN (by positivity)
    nlinarith
  have hlow2 : -(e + |Q| / (2 * Nr)) ≤ f (x + h) - f x - c - 1 / 2 * Q := by
    have e1 : (c - e) + Q * (Nr - 1) / (2 * Nr) = c + 1 / 2 * Q - e - Q / (2 * Nr) := by
      field_simp; ring
    have : Q / (2 * Nr) ≤ |Q| / (2 * Nr) :=
      div_le_div_of_nonneg_right (le_abs_self Q) (by positivity)
    linarith
  have hupp2 : f (x + h) - f x - c - 1 / 2 * Q ≤ e + |Q| / (2 * Nr) := by
    have e1 : (c + e) + Q * (Nr + 1) / (2 * Nr) = c + 1 / 2 * Q + e + Q / (2 * Nr) := by
      field_simp; ring
    have : Q / (2 * Nr) ≤ |Q| / (2 * Nr) :=
      div_le_div_of_nonneg_right (le_abs_self Q) (by positivity)
    linarith
  rw [abs_le]
  constructor <;> nlinarith

Plaplacian/SMP.lean5 declarations

theorembarrier_annulus_bound
Formal statementgenerated from the Lean declaration

Let $t, r, \kappa \in \mathbb{R}$.

Assume

  • $0 < r$ hr
  • $0 < \kappa$ hκ0
  • $\kappa \le 1 / 12$ hκ1
  • $r - \kappa \cdot r \le t$ h1
  • $t \le r$ h2

Then $(t ^{2} - (r ^{2} + \kappa \cdot r ^{2})) ^{2} \le 9 \cdot \kappa ^{2} \cdot r ^{4}$.

PLaplacian.barrier_annulus_boundPlaplacian/SMP.lean, lines 44–62
/-- **The barrier on the annulus.** -/
theorem barrier_annulus_bound {t r κ : ℝ} (hr : 0 < r) (hκ0 : 0 < κ) (hκ1 : κ ≤ 1 / 12)
    (h1 : r - κ * r ≤ t) (h2 : t ≤ r) :
    (t ^ 2 - (r ^ 2 + κ * r ^ 2)) ^ 2 ≤ 9 * κ ^ 2 * r ^ 4 := by
  have hκr : κ * r ≤ r / 12 := by
    have := mul_le_mul_of_nonneg_right hκ1 hr.le
    linarith
  have h0 : 0 ≤ r - κ * r := by linarith
  have hlo : (r - κ * r) ^ 2 ≤ t ^ 2 := by
    rw [sq, sq]; exact mul_self_le_mul_self h0 h1
  have hhi : t ^ 2 ≤ r ^ 2 := by
    rw [sq, sq]; exact mul_self_le_mul_self (by linarith) h2
  have hk2 : 0 ≤ κ ^ 2 * r ^ 2 := by positivity
  have hk1 : 0 ≤ κ * r ^ 2 := by positivity
  have e0 : (r - κ * r) ^ 2 = r ^ 2 - 2 * (κ * r ^ 2) + κ ^ 2 * r ^ 2 := by ring
  have e1 : -(3 * κ * r ^ 2) ≤ t ^ 2 - (r ^ 2 + κ * r ^ 2) := by linarith
  have e2 : t ^ 2 - (r ^ 2 + κ * r ^ 2) ≤ 3 * κ * r ^ 2 := by linarith
  calc (t ^ 2 - (r ^ 2 + κ * r ^ 2)) ^ 2 ≤ (3 * κ * r ^ 2) ^ 2 := sq_le_sq' e1 e2
    _ = 9 * κ ^ 2 * r ^ 4 := by ring
theorembarrier_outside_bound
Formal statementgenerated from the Lean declaration

Let $t, r, \kappa \in \mathbb{R}$.

Assume

  • $0 < r$ hr
  • $0 < \kappa$ hκ0
  • $\kappa \le 1 / 12$ hκ1
  • $r < t$ h1
  • $t < r + \kappa \cdot r / 2$ h2

Then $(t ^{2} - (r ^{2} + \kappa \cdot r ^{2})) ^{2} \le \kappa \cdot r ^{2} ^{2}$.

PLaplacian.barrier_outside_boundPlaplacian/SMP.lean, lines 64–77
/-- **The barrier just outside the annulus.** -/
theorem barrier_outside_bound {t r κ : ℝ} (hr : 0 < r) (hκ0 : 0 < κ) (hκ1 : κ ≤ 1 / 12)
    (h1 : r < t) (h2 : t < r + κ * r / 2) :
    (t ^ 2 - (r ^ 2 + κ * r ^ 2)) ^ 2 ≤ (κ * r ^ 2) ^ 2 := by
  have hlo : r ^ 2 < t ^ 2 := by nlinarith
  have hhi : t ^ 2 < (r + κ * r / 2) ^ 2 := by nlinarith
  have e0 : (r + κ * r / 2) ^ 2 = r ^ 2 + κ * r ^ 2 + κ ^ 2 * r ^ 2 / 4 := by ring
  have hk : κ ^ 2 * r ^ 2 ≤ κ * r ^ 2 := by
    have : κ ^ 2 ≤ κ := by nlinarith
    exact mul_le_mul_of_nonneg_right this (by positivity)
  have hk1 : 0 ≤ κ * r ^ 2 := by positivity
  have e1 : -(κ * r ^ 2) ≤ t ^ 2 - (r ^ 2 + κ * r ^ 2) := by linarith
  have e2 : t ^ 2 - (r ^ 2 + κ * r ^ 2) ≤ κ * r ^ 2 := by linarith
  exact sq_le_sq' e1 e2
theoremsmp_value_pos
Formal statementgenerated from the Lean declaration

Let $p, D, r, \kappa, s \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < D$ hD
  • $0 < r$ hr
  • $0 < \kappa$ hκ0
  • $\kappa \le 1 / 12$ hκ1
  • $\kappa \cdot 12 \cdot D = p - 1$ hκD
  • $(r - \kappa \cdot r) ^{2} \le s$ hslo

Then $0 < 8 \cdot (p - 1) \cdot s - 4 \cdot (r ^{2} + \kappa \cdot r ^{2} - s) \cdot D$.

PLaplacian.smp_value_posPlaplacian/SMP.lean, lines 79–104
/-- **The operator's value at the maximizer is positive.** -/
theorem smp_value_pos {p D r κ s : ℝ} (hp : 2 ≤ p) (hD : 0 < D) (hr : 0 < r)
    (hκ0 : 0 < κ) (hκ1 : κ ≤ 1 / 12) (hκD : κ * (12 * D) = p - 1)
    (hslo : (r - κ * r) ^ 2 ≤ s) :
    0 < 8 * (p - 1) * s - 4 * (r ^ 2 + κ * r ^ 2 - s) * D := by
  have hκr : κ * r ≤ r / 12 := by
    have := mul_le_mul_of_nonneg_right hκ1 hr.le
    linarith
  have h0 : r / 2 ≤ r - κ * r := by linarith
  have hs4 : r ^ 2 / 4 ≤ s := by
    have := mul_self_le_mul_self (by positivity) h0
    nlinarith
  have hBs : r ^ 2 + κ * r ^ 2 - s ≤ 3 * κ * r ^ 2 := by
    have e0 : (r - κ * r) ^ 2 = r ^ 2 - 2 * (κ * r ^ 2) + κ ^ 2 * r ^ 2 := by ring
    have : 0 ≤ κ ^ 2 * r ^ 2 := by positivity
    linarith
  have e1 : 2 * (p - 1) * r ^ 2 ≤ 8 * (p - 1) * s := by
    have := mul_le_mul_of_nonneg_left hs4 (by linarith : (0 : ℝ) ≤ 8 * (p - 1))
    linarith
  have e2 : 4 * (r ^ 2 + κ * r ^ 2 - s) * D ≤ (p - 1) * r ^ 2 := by
    have := mul_le_mul_of_nonneg_right hBs (by linarith : (0 : ℝ) ≤ 4 * D)
    have e : 3 * κ * r ^ 2 * (4 * D) = (p - 1) * r ^ 2 := by rw [← hκD]; ring
    linarith
  have hp1 : 0 < p - 1 := by linarith
  have : 0 < (p - 1) * r ^ 2 := by positivity
  linarith
theoremsmp_ball_jetTheorem 6.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $R \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\operatorname{UpperSemicontinuousOn}(u, \Omega)$ husc
  • ∀ w ∈ Ω, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SuperJet u w → q ≠ 0 → PLaplacian.viscF p q X ≤ 0 hjetc
  • $0 < R$ hR
  • $B(x, R) \subseteq \Omega$ hball
  • $\forall y \in B(x, R),\ u(y) \le u(x)$ hmax
  • $y \in B(x, R / 3)$ a._@._internal._hyg.0

Then $u(y) = u(x)$.

/-- **The strong maximum principle on a ball**, for an upper semicontinuous
function whose superjets with nonzero gradient satisfy the subsolution
inequality. -/
theorem smp_ball_jet (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {Ω : Set (EuclSpace d)}
    {u : EuclSpace d → ℝ} (husc : UpperSemicontinuousOn u Ω)
    (hjetc : ∀ w ∈ Ω, ∀ (q : EuclSpace d) (X : Bilin d), (q, X) ∈ SuperJet u w →
      q ≠ 0 → viscF p q X ≤ 0)
    {x : EuclSpace d} {R : ℝ} (hR : 0 < R) (hball : ball x R ⊆ Ω)
    (hmax : ∀ y ∈ ball x R, u y ≤ u x) :
    ∀ y ∈ ball x (R / 3), u y = u x := by
  intro y₀ hy₀
  by_contra hne
  set m := u x with hm
  have hy₀x : dist y₀ x < R / 3 := hy₀
  have hy₀R : y₀ ∈ ball x R := ball_subset_ball (by linarith) hy₀
  have hlt : u y₀ < m := lt_of_le_of_ne (hmax y₀ hy₀R) hne
  -- the ball K around y₀
  have hK : closedBall y₀ (R / 2) ⊆ ball x R := by
    intro y hy
    rw [mem_closedBall] at hy
    rw [mem_ball]
    calc dist y x ≤ dist y y₀ + dist y₀ x := dist_triangle _ _ _
      _ < R := by linarith
  -- the contact set
  set S := closedBall y₀ (R / 2) ∩ {y | m ≤ u y} with hSdef
  have hxS : x ∈ S :=
    ⟨by rw [mem_closedBall, dist_comm]; linarith, by change m ≤ u x; exact le_rfl⟩
  have hSc : IsClosed S := by
    rw [← closure_subset_iff_isClosed]
    intro y hy
    have hyK : y ∈ closedBall y₀ (R / 2) :=
      closure_minimal inter_subset_left isClosed_closedBall hy
    refine ⟨hyK, ?_⟩
    change m ≤ u y
    by_contra hcon
    push Not at hcon
    have hyΩ : y ∈ Ω := hball (hK hyK)
    have hev := husc y hyΩ m hcon
    rw [eventually_nhdsWithin_iff] at hev
    have hN : {y' | y' ∈ Ω → u y' < m} ∩ ball x R ∈ 𝓝 y :=
      inter_mem hev (isOpen_ball.mem_nhds (hK hyK))
    obtain ⟨z, ⟨hz1, hz2⟩, hzS⟩ := mem_closure_iff_nhds.1 hy _ hN
    have h1 : u z < m := hz1 (hball hz2)
    have h2 : m ≤ u z := hzS.2
    linarith
  have hScpt : IsCompact S :=
    (isCompact_closedBall y₀ (R / 2)).of_isClosed_subset hSc inter_subset_left
  have hSne : S.Nonempty := ⟨x, hxS⟩
  have hy₀S : y₀ ∉ S := fun h => by have : m ≤ u y₀ := h.2; linarith
  -- the nearest contact point
  set r := infDist y₀ S with hrdef
  have hr : 0 < r := (hSc.notMem_iff_infDist_pos hSne).1 hy₀S
  have hrx : r < R / 3 := by
    have := infDist_le_dist_of_mem (x := y₀) hxS
    linarith
  obtain ⟨z, hzS, hzd⟩ := hScpt.exists_infDist_eq_dist hSne y₀
  have hzr : dist z y₀ = r := by rw [dist_comm, ← hzd]
  have hin : ∀ y, dist y y₀ < r → u y < m := by
    intro y hy
    have hyK : y ∈ closedBall y₀ (R / 2) := by rw [mem_closedBall]; linarith
    by_contra hcon
    push Not at hcon
    have hyS : y ∈ S := ⟨hyK, hcon⟩
    have := infDist_le_dist_of_mem (x := y₀) hyS
    rw [dist_comm] at this
    linarith
  have huz : u z = m := le_antisymm (hmax z (hK hzS.1)) hzS.2
  -- the parameters
  have hd1 : (1 : ℝ) ≤ d := by exact_mod_cast hd
  have hdp : 0 < (d : ℝ) + p - 2 := by linarith
  set κ := (p - 1) / (12 * ((d : ℝ) + p - 2)) with hκdef
  have hκ0 : 0 < κ := div_pos (by linarith) (by positivity)
  have hκ12 : κ * (12 * ((d : ℝ) + p - 2)) = p - 1 := by
    rw [hκdef]; field_simp
  have hκ1 : κ ≤ 1 / 12 := by
    rw [hκdef, div_le_div_iff₀ (by positivity) (by norm_num)]
    linarith
  have hκr : κ * r ≤ r / 12 := by
    have := mul_le_mul_of_nonneg_right hκ1 hr.le
    linarith
  set θ := κ * r with hθ
  have hθ0 : 0 < θ := mul_pos hκ0 hr
  set B := r ^ 2 + κ * r ^ 2 with hB
  -- the gap on the inner ball
  have hCsub : closedBall y₀ (r - θ) ⊆ closedBall y₀ (R / 2) :=
    closedBall_subset_closedBall (by linarith)
  have hCΩ : closedBall y₀ (r - θ) ⊆ Ω := fun y hy => hball (hK (hCsub hy))
  obtain ⟨y₁, hy₁C, hy₁max⟩ := UpperSemicontinuousOn.exists_isMaxOn
    ⟨y₀, mem_closedBall_self (by linarith)⟩ (isCompact_closedBall y₀ (r - θ))
    (husc.mono hCΩ)
  have hy₁lt : u y₁ < m := hin y₁ (by rw [mem_closedBall] at hy₁C; linarith)
  set δ := m - u y₁ with hδ
  have hδ0 : 0 < δ := by linarith
  have hgapC : ∀ y ∈ closedBall y₀ (r - θ), u y ≤ m - δ := fun y hy => by
    have h' : u y ≤ u y₁ := hy₁max hy
    linarith
  -- ε
  set M₀ := 9 * κ ^ 2 * r ^ 4 with hM₀
  have hM₀0 : 0 ≤ M₀ := by positivity
  set ε := δ / (2 * (M₀ + 1)) with hεdef
  have hε0 : 0 < ε := by positivity
  have hεM : ε * M₀ ≤ δ / 2 := by
    rw [hεdef, div_mul_eq_mul_div, div_le_div_iff₀ (by positivity) (by norm_num)]
    have : 0 ≤ δ := hδ0.le
    linarith
  -- the barrier on the annulus and at z
  have hbar_le : ∀ y, r - θ ≤ dist y y₀ → dist y y₀ ≤ r → barrier y₀ B y ≤ M₀ := by
    intro y h1 h2
    unfold barrier
    rw [← dist_eq_norm]
    exact barrier_annulus_bound hr hκ0 hκ1 h1 h2
  have hbar_z : barrier y₀ B z = (κ * r ^ 2) ^ 2 := by
    unfold barrier
    rw [← dist_eq_norm, hzr, hB]
    ring
  -- the annulus
  set A := closedBall y₀ r ∩ {y | r - θ ≤ dist y y₀} with hAdef
  have hAc : IsCompact A :=
    (isCompact_closedBall y₀ r).inter_right
      (isClosed_le continuous_const (continuous_id.dist continuous_const))
  have hzA : z ∈ A := ⟨by rw [mem_closedBall, hzr], by
    change r - θ ≤ dist z y₀
    rw [hzr]; linarith⟩
  have hAΩ : A ⊆ Ω := fun y hy =>
    hball (hK (closedBall_subset_closedBall (by linarith) hy.1))
  -- the maximizer of g = u + ε φ
  set g : EuclSpace d → ℝ := fun y => u y + ε * barrier y₀ B y with hgdef
  have hgusc : UpperSemicontinuousOn g A := by
    have h1 := husc.mono hAΩ
    have h2 : Continuous (fun y => ε * barrier y₀ B y) := by
      unfold barrier; fun_prop
    exact h1.add (h2.upperSemicontinuous.upperSemicontinuousOn A)
  obtain ⟨w, hwA, hwmax⟩ := UpperSemicontinuousOn.exists_isMaxOn ⟨z, hzA⟩ hAc hgusc
  have hgz : g z = m + ε * (κ * r ^ 2) ^ 2 := by
    change u z + ε * barrier y₀ B z = _
    rw [huz, hbar_z]
  have hgw : g z ≤ g w := hwmax hzA
  have hwr : dist w y₀ ≤ r := by
    have := hwA.1
    rwa [mem_closedBall] at this
  -- w is not on the inner sphere
  have hwd : r - θ < dist w y₀ := by
    by_contra hcon
    push Not at hcon
    have hwC : w ∈ closedBall y₀ (r - θ) := by rw [mem_closedBall]; exact hcon
    have h1 := hgapC w hwC
    have h2 := hbar_le w hwA.2 hwr
    have h3 : g w ≤ m - δ + ε * M₀ := by
      change u w + ε * barrier y₀ B w ≤ _
      have := mul_le_mul_of_nonneg_left h2 hε0.le
      linarith
    have h4 : 0 ≤ ε * (κ * r ^ 2) ^ 2 := by positivity
    linarith
  -- w is a local maximum of g
  set ρ₀ := min (dist w y₀ - (r - θ)) (κ * r / 2) with hρ₀
  have hρ₀pos : 0 < ρ₀ := lt_min (by linarith) (by positivity)
  have hloc : ∀ᶠ y in 𝓝 w, u y + ε * barrier y₀ B y ≤ u w + ε * barrier y₀ B w := by
    filter_upwards [Metric.ball_mem_nhds w hρ₀pos] with y hy
    rw [mem_ball] at hy
    have hy1 : dist y w < dist w y₀ - (r - θ) := lt_of_lt_of_le hy (min_le_left _ _)
    have hy2 : dist y w < κ * r / 2 := lt_of_lt_of_le hy (min_le_right _ _)
    have hyd1 : r - θ < dist y y₀ := by
      have := dist_triangle w y y₀
      rw [dist_comm w y] at this
      linarith
    have hyd2 : dist y y₀ < r + κ * r / 2 := by
      have := dist_triangle y w y₀
      linarith
    by_cases hyr : dist y y₀ ≤ r
    · have hyA : y ∈ A := ⟨by rw [mem_closedBall]; exact hyr, hyd1.le⟩
      exact hwmax hyA
    · push Not at hyr
      have hyK : y ∈ closedBall y₀ (R / 2) := by
        rw [mem_closedBall]; linarith
      have huy : u y ≤ m := hmax y (hK hyK)
      have hby : barrier y₀ B y ≤ (κ * r ^ 2) ^ 2 := by
        unfold barrier
        rw [← dist_eq_norm]
        exact barrier_outside_bound hr hκ0 hκ1 hyr hyd2
      have h1 : u y + ε * barrier y₀ B y ≤ m + ε * (κ * r ^ 2) ^ 2 := by
        have := mul_le_mul_of_nonneg_left hby hε0.le
        linarith
      have h2 : g z ≤ u w + ε * barrier y₀ B w := hgw
      linarith
  -- the jet at w, and the contradiction
  have hwn : ‖w - y₀‖ = dist w y₀ := (dist_eq_norm w y₀).symm
  have hv0 : w - y₀ ≠ 0 := by
    intro h
    rw [h, norm_zero] at hwn
    linarith
  have hsr : ‖w - y₀‖ ^ 2 ≤ r ^ 2 := by
    rw [hwn, sq, sq]; exact mul_self_le_mul_self dist_nonneg hwr
  have hc : 0 < 4 * ε * (B - ‖w - y₀‖ ^ 2) := by
    have h1 : 0 < κ * r ^ 2 := mul_pos hκ0 (pow_pos hr 2)
    have : 0 < B - ‖w - y₀‖ ^ 2 := by rw [hB]; linarith
    positivity
  have hjet := superJet_barrier (u := u) (w := w) (y₀ := y₀) (B := B) hε0 hloc
  have hw : w ∈ Ω := hAΩ hwA
  have hq : (4 * ε * (B - ‖w - y₀‖ ^ 2)) • (w - y₀) ≠ 0 := smul_ne_zero hc.ne' hv0
  have hvisc := hjetc w hw _ _ hjet hq
  change _ ≤ (0 : ℝ) at hvisc
  rw [viscF_barrierJet hv0 hc] at hvisc
  -- the value is positive
  have hslo : (r - θ) ^ 2 ≤ ‖w - y₀‖ ^ 2 := by
    rw [hwn, sq, sq]; exact mul_self_le_mul_self (by linarith) hwd.le
  rw [hB] at hvisc
  set s := ‖w - y₀‖ ^ 2 with hs
  have hpos0 := smp_value_pos hp hdp hr hκ0 hκ1 hκ12 hslo
  have hpos := mul_pos hε0 hpos0
  have eq : -((4 * ε * (r ^ 2 + κ * r ^ 2 - s) * d - 8 * ε * s)
      + (p - 2) * (4 * ε * (r ^ 2 + κ * r ^ 2 - s) - 8 * ε * s))
      = ε * (8 * (p - 1) * s - 4 * (r ^ 2 + κ * r ^ 2 - s) * ((d : ℝ) + p - 2)) := by ring
  linarith
theoremsmp_ballTheorem 6.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $R \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsub
  • $0 < R$ hR
  • $B(x, R) \subseteq \Omega$ hball
  • $\forall y \in B(x, R),\ u(y) \le u(x)$ hmax
  • $y \in B(x, R / 3)$ a._@._internal._hyg.0

Then $u(y) = u(x)$.

/-- **The strong maximum principle on a ball.** -/
theorem smp_ball (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {Ω : Set (EuclSpace d)}
    {u : EuclSpace d → ℝ} (hsub : IsViscositySubsolution p Ω (fun _ => 0) u)
    {x : EuclSpace d} {R : ℝ} (hR : 0 < R) (hball : ball x R ⊆ Ω)
    (hmax : ∀ y ∈ ball x R, u y ≤ u x) :
    ∀ y ∈ ball x (R / 3), u y = u x :=
  smp_ball_jet hd hp hsub.usc (fun _ hw _ _ hj hq => superJet_regular hd hp hsub hw hj hq)
    hR hball hmax

Plaplacian/SMPBarrier.lean10 declarations

defrankOne
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \in \mathbb{R}^{d}$.

Its value lies in $\operatorname{Bilin}(d)$.

/-- **The rank-one form** `(u, w) ↦ ⟪v, u⟫ ⟪v, w⟫`. -/
def rankOne (v : EuclSpace d) : Bilin d :=
  (innerSL ℝ v).smulRight (innerSL ℝ v)
theoremrankOne_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v, u, w \in \mathbb{R}^{d}$.

Then $((\operatorname{rankOne}(v))(u))(w) = \operatorname{inner}(\mathbb{R}, v, u) \cdot \operatorname{inner}(\mathbb{R}, v, w)$.

theorem rankOne_apply (v u w : EuclSpace d) :
    (rankOne v u) w = inner ℝ v u * inner ℝ v w := by
  simp [rankOne, smul_eq_mul]
theoremlaplacianOf_add
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X, Y \in \operatorname{Bilin}(d)$.

Then $\operatorname{laplacianOf}(X + Y) = \operatorname{laplacianOf}(X) + \operatorname{laplacianOf}(Y)$.

theorem laplacianOf_add (X Y : Bilin d) :
    laplacianOf (X + Y) = laplacianOf X + laplacianOf Y := by
  simp [laplacianOf, Finset.sum_add_distrib]
theoremlaplacianOf_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X, Y \in \operatorname{Bilin}(d)$.

Then $\operatorname{laplacianOf}(X - Y) = \operatorname{laplacianOf}(X) - \operatorname{laplacianOf}(Y)$.

theorem laplacianOf_sub (X Y : Bilin d) :
    laplacianOf (X - Y) = laplacianOf X - laplacianOf Y := by
  simp [laplacianOf, Finset.sum_sub_distrib]
theoremlaplacianOf_idForm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Then $\operatorname{laplacianOf}(\operatorname{idForm}(d)) = d$.

PLaplacian.laplacianOf_idFormPlaplacian/SMPBarrier.lean, lines 56–58
theorem laplacianOf_idForm : laplacianOf (idForm d) = d := by
  unfold laplacianOf
  simp [idForm_apply]
theoremlaplacianOf_rankOne
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \in \mathbb{R}^{d}$.

Then $\operatorname{laplacianOf}(\operatorname{rankOne}(v)) = \lVert v\rVert ^{2}$.

PLaplacian.laplacianOf_rankOnePlaplacian/SMPBarrier.lean, lines 60–67
theorem laplacianOf_rankOne (v : EuclSpace d) : laplacianOf (rankOne v) = ‖v‖ ^ 2 := by
  have h := (EuclideanSpace.basisFun (Fin d) ℝ).sum_inner_mul_inner v v
  simp only [EuclideanSpace.basisFun_apply] at h
  rw [real_inner_self_eq_norm_sq] at h
  unfold laplacianOf
  rw [← h]
  refine Finset.sum_congr rfl fun i _ => ?_
  rw [rankOne_apply, real_inner_comm (EuclideanSpace.single i (1 : ℝ)) v]
theoremviscF_barrierJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $v \in \mathbb{R}^{d}$, $c, b \in \mathbb{R}$.

Assume

  • $v \ne 0$ hv
  • $0 < c$ hc

Then $\operatorname{viscF}(p, c \cdot v, c \cdot \operatorname{idForm}(d) - b \cdot \operatorname{rankOne}(v)) = - (c \cdot d - b \cdot \lVert v\rVert ^{2} + (p - 2) \cdot (c - b \cdot \lVert v\rVert ^{2}))$.

/-- **The operator on `(c v, c I - b v ⊗ v)`**, for `c > 0` and `v ≠ 0`. -/
theorem viscF_barrierJet {p : ℝ} {v : EuclSpace d} (hv : v ≠ 0) {c b : ℝ} (hc : 0 < c) :
    viscF p (c • v) (c • idForm d - b • rankOne v)
      = -((c * d - b * ‖v‖ ^ 2) + (p - 2) * (c - b * ‖v‖ ^ 2)) := by
  have hvn : 0 < ‖v‖ := norm_pos_iff.2 hv
  unfold viscF normPLapOf infLaplacianOf
  rw [laplacianOf_sub, laplacianOf_smul, laplacianOf_smul, laplacianOf_idForm,
    laplacianOf_rankOne]
  have hn : ‖c • v‖ = c * ‖v‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_pos hc]
  have he : ‖c • v‖⁻¹ • (c • v) = ‖v‖⁻¹ • v := by
    rw [hn, smul_smul]
    congr 1
    field_simp
  rw [he]
  have h1 : ‖‖v‖⁻¹ • v‖ ^ 2 = 1 := by
    rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ hvn.ne', one_pow]
  have h2 : inner ℝ v (‖v‖⁻¹ • v) = ‖v‖ := by
    rw [real_inner_smul_right, real_inner_self_eq_norm_sq]
    field_simp
  rw [sub_apply, sub_apply, smul_apply, smul_apply, smul_apply, smul_apply, smul_eq_mul,
    smul_eq_mul, idForm_apply, rankOne_apply, h1, h2]
  ring
defbarrier
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $y_{0} \in \mathbb{R}^{d}$, $B \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The barrier** `(‖y - y₀‖² - B)²`. -/
def barrier (y₀ : EuclSpace d) (B : ℝ) (y : EuclSpace d) : ℝ :=
  (‖y - y₀‖ ^ 2 - B) ^ 2
theorembarrier_expand
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $y_{0} \in \mathbb{R}^{d}$, $B \in \mathbb{R}$, $w, h \in \mathbb{R}^{d}$.

Then $\operatorname{barrier}(y_{0}, B, w + h) - \operatorname{barrier}(y_{0}, B, w) = 4 \cdot (\lVert w - y_{0}\rVert ^{2} - B) \cdot \operatorname{inner}(\mathbb{R}, w - y_{0}, h) + 2 \cdot (\lVert w - y_{0}\rVert ^{2} - B) \cdot \lVert h\rVert ^{2} + 4 \cdot \operatorname{inner}(\mathbb{R}, w - y_{0}, h) ^{2} + 4 \cdot \operatorname{inner}(\mathbb{R}, w - y_{0}, h) \cdot \lVert h\rVert ^{2} + \lVert h\rVert ^{4}$.

/-- **The exact expansion of the barrier.** -/
theorem barrier_expand (y₀ : EuclSpace d) (B : ℝ) (w h : EuclSpace d) :
    barrier y₀ B (w + h) - barrier y₀ B w
      = 4 * (‖w - y₀‖ ^ 2 - B) * inner ℝ (w - y₀) h + 2 * (‖w - y₀‖ ^ 2 - B) * ‖h‖ ^ 2
        + 4 * inner ℝ (w - y₀) h ^ 2 + 4 * inner ℝ (w - y₀) h * ‖h‖ ^ 2 + ‖h‖ ^ 4 := by
  unfold barrier
  have e : w + h - y₀ = (w - y₀) + h := by abel
  rw [e, norm_add_sq_real]
  ring
theoremsuperJet_barrier
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w, y_{0} \in \mathbb{R}^{d}$, $B, \varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε
  • ∀ᶠ (y : EuclSpace d) in nhds w, u y + ε * PLaplacian.barrier y₀ B y ≤ u w + ε * PLaplacian.barrier y₀ B w hloc

Then ((4 * ε * (B - ‖w - y₀‖ ^ 2)) • (w - y₀), (4 * ε * (B - ‖w - y₀‖ ^ 2)) • PLaplacian.idForm d - (8 * ε) • PLaplacian.rankOne (w - y₀)) ∈ PLaplacian.SuperJet u w.

/-- **A maximum of `u + ε φ` gives a superjet of `u`.** -/
theorem superJet_barrier {u : EuclSpace d → ℝ} {w y₀ : EuclSpace d} {B ε : ℝ}
    (hε : 0 < ε)
    (hloc : ∀ᶠ y in 𝓝 w, u y + ε * barrier y₀ B y ≤ u w + ε * barrier y₀ B w) :
    ((4 * ε * (B - ‖w - y₀‖ ^ 2)) • (w - y₀),
      (4 * ε * (B - ‖w - y₀‖ ^ 2)) • idForm d - (8 * ε) • rankOne (w - y₀))
      ∈ SuperJet u w := by
  intro η hη
  set v := w - y₀ with hv
  set s := ‖v‖ ^ 2 with hs
  set c := 4 * ε * (B - s) with hc
  have hρ : 0 < η / (ε * (4 * ‖v‖ + 1)) := by positivity
  filter_upwards [hloc, Metric.ball_mem_nhds w hρ] with y hy hyb
  rw [mem_ball, dist_eq_norm] at hyb
  set h := y - w with hhdef
  have hyw : y = w + h := by rw [hhdef]; abel
  have hexp := barrier_expand y₀ B w h
  rw [← hyw, ← hv, ← hs] at hexp
  -- the jet terms
  have hQ : inner ℝ (c • v) h = c * inner ℝ v h := real_inner_smul_left _ _ _
  have hX : ((c • idForm d - (8 * ε) • rankOne v) h) h
      = c * ‖h‖ ^ 2 - 8 * ε * (inner ℝ v h * inner ℝ v h) := by
    rw [sub_apply, sub_apply, smul_apply, smul_apply, smul_apply, smul_apply, smul_eq_mul,
      smul_eq_mul, idForm_apply, rankOne_apply]
  rw [hQ, hX]
  -- the remainder
  have hvh : |inner ℝ v h| ≤ ‖v‖ * ‖h‖ := abs_real_inner_le_norm v h
  have k1 : -(‖v‖ * ‖h‖) ≤ inner ℝ v h := neg_le_of_abs_le hvh
  have hh0 : 0 ≤ ‖h‖ := norm_nonneg h
  have hsmall : ε * (4 * ‖v‖ + 1) * ‖h‖ ≤ η := by
    have := (lt_div_iff₀ (by positivity : 0 < ε * (4 * ‖v‖ + 1))).1 hyb
    linarith
  have k2 : -(4 * ε * ‖v‖ * ‖h‖ ^ 3) ≤ 4 * ε * inner ℝ v h * ‖h‖ ^ 2 := by
    have := mul_le_mul_of_nonneg_right k1 (by positivity : (0 : ℝ) ≤ 4 * ε * ‖h‖ ^ 2)
    nlinarith
  have k3 : 4 * ε * ‖v‖ * ‖h‖ ^ 3 ≤ η * ‖h‖ ^ 2 := by
    have := mul_le_mul_of_nonneg_right hsmall (by positivity : (0 : ℝ) ≤ ‖h‖ ^ 2)
    nlinarith [norm_nonneg v]
  have k4 : 0 ≤ ε * ‖h‖ ^ 4 := by positivity
  have hεexp := congrArg (fun t => ε * t) hexp
  rw [hc]
  nlinarith

Plaplacian/SMPMin.lean4 declarations

theoremgradient_neg_eq_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{gradient}(\varphi, x) = 0$ h

Then $\operatorname{gradient}(y \mapsto - \varphi(y), x) = 0$.

PLaplacian.gradient_neg_eq_zeroPlaplacian/SMPMin.lean, lines 32–37
/-- The gradient of a negated function vanishes when the original does. -/
theorem gradient_neg_eq_zero {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (h : gradient φ x = 0) : gradient (fun y => -φ y) x = 0 := by
  unfold gradient at h ⊢
  change (InnerProductSpace.toDual ℝ (EuclSpace d)).symm (fderiv ℝ (-φ) x) = 0
  rw [fderiv_neg, map_neg, h, neg_zero]
theoremisLocalMin_of_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $V, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMax}(y \mapsto (y \mapsto - V(y))(y) - \varphi(y), x_{0})$ h

Then $\operatorname{IsLocalMin}(y \mapsto V(y) - (y \mapsto - \varphi(y))(y), x_{0})$.

PLaplacian.isLocalMin_of_negPlaplacian/SMPMin.lean, lines 39–46
/-- A local maximum of `-V - φ` is a local minimum of `V - (-φ)`. -/
theorem isLocalMin_of_neg {V φ : EuclSpace d → ℝ} {x₀ : EuclSpace d}
    (h : IsLocalMax (fun y => (fun y => -V y) y - φ y) x₀) :
    IsLocalMin (fun y => V y - (fun y => -φ y) y) x₀ := by
  have hm : ∀ᶠ y in 𝓝 x₀, -V y - φ y ≤ -V x₀ - φ x₀ := h
  refine hm.mono fun y hy => ?_
  change V x₀ - -φ x₀ ≤ V y - -φ y
  linarith
theoremIsViscositySupersolution.neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $V\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ h

Then PLaplacian.IsViscositySubsolution p Ω (fun x => 0) fun y => -V y.

PLaplacian.IsViscositySupersolution.negPlaplacian/SMPMin.lean, lines 48–83
/-- **The negation of a supersolution is a subsolution.** -/
theorem IsViscositySupersolution.neg {p : ℝ} {Ω : Set (EuclSpace d)}
    {V : EuclSpace d → ℝ} (h : IsViscositySupersolution p Ω (fun _ => 0) V) :
    IsViscositySubsolution p Ω (fun _ => 0) (fun y => -V y) where
  usc := by
    intro x hx c hc
    have hev := h.lsc x hx (-c) (by linarith)
    exact hev.mono fun y hy => by linarith
  regular := by
    intro φ hφ x₀ hx₀ hmax hg
    have hmin := isLocalMin_of_neg hmax
    have h1 := h.regular (fun y => -φ y) hφ.neg x₀ hx₀ hmin (gradient_neg_ne_zero hg)
    change (0 : ℝ) ≤ _ at h1
    change viscF p (gradient φ x₀) (hess φ x₀) ≤ (0 : ℝ)
    rw [viscF_eq_neg] at h1 ⊢
    unfold hess at h1 ⊢
    rw [normPLapOf_neg] at h1
    linarith
  singular := by
    intro φ hφ x₀ hx₀ hmax hg
    have hmin := isLocalMin_of_neg hmax
    have h1 := h.singular (fun y => -φ y) hφ.neg x₀ hx₀ hmin (gradient_neg_eq_zero hg)
    change (0 : ℝ) ≤ _ at h1
    change viscFLower p (hess φ x₀) ≤ (0 : ℝ)
    unfold hess at h1 ⊢
    rw [hess_neg] at h1
    unfold viscFUpper at h1
    unfold viscFLower
    rw [laplacianOf_neg] at h1
    set X := fderiv ℝ (fderiv ℝ φ) x₀ with hX
    have hl : lamMax (-(-X)) = -lamMin (-X) := lamMax_neg (-X)
    have e : lamMax (-(-X)) = lamMax X := congrArg lamMax (neg_neg X)
    have hmin' : lamMin (-X) = -lamMax X := by linarith
    change (0 : ℝ) ≤ - -laplacianOf X - (p - 2) * lamMin (-X) at h1
    rw [hmin'] at h1
    linarith
theoremsmp_ball_minTheorem 6.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $V \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $R \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $V\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsup
  • $0 < R$ hR
  • $B(x, R) \subseteq \Omega$ hball
  • $\forall y \in B(x, R),\ V(x) \le V(y)$ hmin
  • $y \in B(x, R / 3)$ a._@._internal._hyg.0

Then $V(y) = V(x)$.

/-- **The strong minimum principle on a ball.** -/
theorem smp_ball_min (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {Ω : Set (EuclSpace d)}
    {V : EuclSpace d → ℝ} (hsup : IsViscositySupersolution p Ω (fun _ => 0) V)
    {x : EuclSpace d} {R : ℝ} (hR : 0 < R) (hball : ball x R ⊆ Ω)
    (hmin : ∀ y ∈ ball x R, V x ≤ V y) :
    ∀ y ∈ ball x (R / 3), V y = V x := by
  have key := smp_ball hd hp hsup.neg hR hball (fun y hy => neg_le_neg (hmin y hy))
  intro y hy
  exact neg_inj.1 (key y hy)

Plaplacian/Sandwich.lean3 declarations

theoremeq_add_err_of_le_of_le
Formal statementgenerated from the Lean declaration

Let $a, S, U \in \mathbb{R}$.

Assume

  • $a \le S$ hlow
  • $S \le U$ hupp

Then there exists $e$ such that:

  • $S = a + e$
  • $0 \le e$
  • $e \le U - a$
PLaplacian.eq_add_err_of_le_of_lePlaplacian/Sandwich.lean, lines 52–56
/-- **Sandwich to equality.** Any quantity lying between two bounds equals the
lower one plus a nonnegative error at most the sandwich width. -/
theorem eq_add_err_of_le_of_le {a S U : ℝ} (hlow : a ≤ S) (hupp : S ≤ U) :
    ∃ e : ℝ, S = a + e ∧ 0 ≤ e ∧ e ≤ U - a := by
  refine ⟨S - a, by ring, by linarith, by linarith⟩
theoremeq_add_err_of_sandwich
Formal statementgenerated from the Lean declaration

Let $T, S, \mathrm{lo}, \mathrm{hi} \in \mathbb{R}$.

Assume

  • $T + \mathrm{lo} \le S$ hlow
  • $S \le T + \mathrm{hi}$ hupp

Then there exists $e$ such that:

  • $S = T + e$
  • $\mathrm{lo} \le e$
  • $e \le \mathrm{hi}$
PLaplacian.eq_add_err_of_sandwichPlaplacian/Sandwich.lean, lines 58–63
/-- The version with a target value and a symmetric error, which is the form
the expansion consumes. -/
theorem eq_add_err_of_sandwich {T S lo hi : ℝ}
    (hlow : T + lo ≤ S) (hupp : S ≤ T + hi) :
    ∃ e : ℝ, S = T + e ∧ lo ≤ e ∧ e ≤ hi := by
  refine ⟨S - T, by ring, by linarith, by linarith⟩
theoremextreme_avg_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon, I, \mathrm{loS}, \mathrm{hiS}, \mathrm{loI}, \mathrm{hiI} \in \mathbb{R}$.

Assume

  • φ x + ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + loS ≤ sSup (φ '' Metric.closedBall x ε) hSlow
  • sSup (φ '' Metric.closedBall x ε) ≤ φ x + ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + hiS hSupp
  • φ x - ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + loI ≤ sInf (φ '' Metric.closedBall x ε) hIlow
  • sInf (φ '' Metric.closedBall x ε) ≤ φ x - ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + hiI hIupp

Then there exists $e$ such that:

  • ( sSup ( φ '' Metric.closedBall x ε ) + sInf ( φ '' Metric.closedBall x ε ) ) / 2 = φ x + ε ^ 2 / 2 * I + e
  • $(\mathrm{loS} + \mathrm{loI}) / 2 \le e$
  • $e \le (\mathrm{hiS} + \mathrm{hiI}) / 2$
/-- **The average of the extreme values, as an equality.**

Given the sandwich on the supremum and the dual on the infimum, their average
equals the value at the centre plus the infinity-Laplacian term plus an error
bounded by the two sandwich widths. -/
theorem extreme_avg_eq {φ : EuclSpace d → ℝ} {x : EuclSpace d} {ε : ℝ}
    {I loS hiS loI hiI : ℝ}
    (hSlow : φ x + ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + loS
        ≤ sSup (φ '' closedBall x ε))
    (hSupp : sSup (φ '' closedBall x ε)
        ≤ φ x + ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + hiS)
    (hIlow : φ x - ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + loI
        ≤ sInf (φ '' closedBall x ε))
    (hIupp : sInf (φ '' closedBall x ε)
        ≤ φ x - ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + hiI) :
    ∃ e : ℝ,
      (sSup (φ '' closedBall x ε) + sInf (φ '' closedBall x ε)) / 2
          = φ x + (ε ^ 2 / 2) * I + e
        ∧ (loS + loI) / 2 ≤ e ∧ e ≤ (hiS + hiI) / 2 := by
  refine ⟨(sSup (φ '' closedBall x ε) + sInf (φ '' closedBall x ε)) / 2
    - (φ x + (ε ^ 2 / 2) * I), by ring, by linarith, by linarith⟩

Plaplacian/SecondOrder.lean4 declarations

lemmacontinuous_deriv_deriv
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, g)$ hg

Then $\operatorname{deriv}(\operatorname{deriv}(g))\text{ is continuous}$.

/-- The second derivative of a `C²` function is continuous. -/
lemma continuous_deriv_deriv {g : ℝ → ℝ} (hg : ContDiff ℝ 2 g) :
    Continuous (deriv (deriv g)) := by
  have hd : Differentiable ℝ (deriv g) := hg.differentiable_deriv_two
  -- continuity of the second derivative from ContDiff 2
  have h1 : ContDiff ℝ 1 (deriv g) := ContDiff.deriv' hg
  exact h1.continuous_deriv le_rfl
lemmaexists_interval_deriv_pos
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, g)$ hg
  • $0 < \operatorname{deriv}(\operatorname{deriv}(g), 0)$ hpos

Then there exists $\delta > 0$ such that:

  • $\forall t \in \operatorname{Ioo}(- \delta, \delta),\ 0 < \operatorname{deriv}(\operatorname{deriv}(g), t)$
/-- If the second derivative is positive at a point it is positive on an
interval around it. -/
lemma exists_interval_deriv_pos {g : ℝ → ℝ} (hg : ContDiff ℝ 2 g)
    (hpos : 0 < deriv (deriv g) 0) :
    ∃ δ > 0, ∀ t ∈ Ioo (-δ) δ, 0 < deriv (deriv g) t := by
  have hcont : ContinuousAt (deriv (deriv g)) 0 :=
    (continuous_deriv_deriv hg).continuousAt
  have hev : ∀ᶠ t in 𝓝 (0 : ℝ), 0 < deriv (deriv g) t :=
    hcont.eventually (eventually_gt_nhds hpos)
  obtain ⟨ε, hε, hball⟩ := Metric.eventually_nhds_iff.1 hev
  refine ⟨ε, hε, fun t ht => ?_⟩
  refine hball ?_
  rw [Real.dist_eq, sub_zero, abs_lt]
  exact ⟨ht.1, ht.2⟩
theoremIsLocalMax.deriv_deriv_nonposTheorem 2.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, g)$ hg
  • $\operatorname{IsLocalMax}(g, 0)$ hmax

Then $\operatorname{deriv}(\operatorname{deriv}(g), 0) \le 0$.

IsLocalMax.deriv_deriv_nonposPlaplacian/SecondOrder.lean, lines 77–127
/-- **The second-order necessary condition.** -/
theorem IsLocalMax.deriv_deriv_nonpos {g : ℝ → ℝ} (hg : ContDiff ℝ 2 g)
    (hmax : IsLocalMax g 0) : deriv (deriv g) 0 ≤ 0 := by
  by_contra hcon
  push Not at hcon
  obtain ⟨δ, hδ, hposδ⟩ := exists_interval_deriv_pos hg hcon
  -- `g'` is strictly increasing on the interval
  have hg1 : Differentiable ℝ (deriv g) := hg.differentiable_deriv_two
  have hmono : StrictMonoOn (deriv g) (Icc (-δ/2) (δ/2)) := by
    refine strictMonoOn_of_deriv_pos (convex_Icc _ _)
      (hg1.continuous.continuousOn) ?_
    intro t ht
    rw [interior_Icc] at ht
    exact hposδ t ⟨by linarith [ht.1], by linarith [ht.2]⟩
  -- Fermat: `g' 0 = 0`
  have h0 : deriv g 0 = 0 := hmax.deriv_eq_zero
  -- hence `g' > 0` on the right half
  have hpos' : ∀ t ∈ Ioc (0 : ℝ) (δ/2), 0 < deriv g t := by
    intro t ht
    have h1 : (0 : ℝ) ∈ Icc (-δ/2) (δ/2) := ⟨by linarith, by linarith⟩
    have h2 : t ∈ Icc (-δ/2) (δ/2) := ⟨by linarith [ht.1], ht.2⟩
    have := hmono h1 h2 ht.1
    rw [h0] at this
    exact this
  -- so `g` is strictly increasing on the right half
  have hgmono : StrictMonoOn g (Icc (0 : ℝ) (δ/2)) := by
    refine strictMonoOn_of_deriv_pos (convex_Icc _ _)
      (hg.continuous.continuousOn) ?_
    intro t ht
    rw [interior_Icc] at ht
    exact hpos' t ⟨ht.1, le_of_lt ht.2⟩
  -- contradicting the local maximum
  have hmaxev : ∀ᶠ y in 𝓝 (0 : ℝ), g y ≤ g 0 := hmax
  obtain ⟨η, hη, hb⟩ := Metric.eventually_nhds_iff.1 hmaxev
  have hmaxη : ∀ y, |y - 0| < η → g y ≤ g 0 := by
    intro y hy
    exact hb (by rwa [Real.dist_eq])
  obtain ⟨s, hs1, hs2, hs3⟩ :
      ∃ s : ℝ, 0 < s ∧ s ≤ δ/2 ∧ s < η := by
    have hL : (δ/4 : ℝ) ≤ δ/2 := by linarith
    have hR : (η/2 : ℝ) < η := by linarith
    refine ⟨Min.min (δ/4 : ℝ) (η/2 : ℝ), ?_, ?_, ?_⟩
    · exact lt_min (by linarith : (0:ℝ) < δ/4) (by linarith : (0:ℝ) < η/2)
    · exact le_trans (min_le_left (δ/4 : ℝ) (η/2 : ℝ)) hL
    · exact lt_of_le_of_lt (min_le_right (δ/4 : ℝ) (η/2 : ℝ)) hR
  have hsIcc : s ∈ Icc (0 : ℝ) (δ/2) := ⟨le_of_lt hs1, hs2⟩
  have hsabs : |s - 0| < η := by
    rw [sub_zero, abs_of_pos hs1]
    exact hs3
  have hlt : g 0 < g s := hgmono ⟨le_rfl, by linarith⟩ hsIcc hs1
  exact absurd (hmaxη s hsabs) (not_le.2 hlt)
theoremIsLocalMin.deriv_deriv_nonneg
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, g)$ hg
  • $\operatorname{IsLocalMin}(g, 0)$ hmin

Then $0 \le \operatorname{deriv}(\operatorname{deriv}(g), 0)$.

/-- The dual statement at a local minimum. -/
theorem IsLocalMin.deriv_deriv_nonneg {g : ℝ → ℝ} (hg : ContDiff ℝ 2 g)
    (hmin : IsLocalMin g 0) : 0 ≤ deriv (deriv g) 0 := by
  have hneg : IsLocalMax (fun t => -g t) 0 := hmin.neg
  have hgn : ContDiff ℝ 2 (fun t => -g t) := hg.neg
  have h := IsLocalMax.deriv_deriv_nonpos hgn hneg
  have hd1 : deriv (fun t => -g t) = fun t => -deriv g t := by
    funext t
    exact deriv.neg
  rw [hd1] at h
  have hd2 : deriv (fun t => -deriv g t) 0 = -deriv (deriv g) 0 := deriv.neg
  rw [hd2] at h
  linarith

Plaplacian/Selection.lean2 declarations

theoremexists_sel
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $M, \delta \in \mathbb{R}$, $k \in \mathbb{N}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $0 < \delta$ hδ
  • $\forall k,\ M \le \operatorname{deficitSup}(S, u, w(k + 1))$ hMk
  • $\forall x,\ \operatorname{Tendsto}(j \mapsto w(j, x), \mathrm{atTop}, \operatorname{nhds}(u(x)))$ hconv

Then there exists $x_{0} \in S$ such that:

  • $\exists l,\ M - 2 \cdot \delta \le w(l + 1, x_{0}) - w(k + 1, x_{0})$
/-- **LPS's (2.8).**

Pick `x_0` nearly attaining the deficit supremum at stage `k+1`, so that
`u(x_0) - u_{k+1}(x_0) >= M - delta`. Then pick a late index `l` with
`u(x_0) - u_{l+1}(x_0) < delta`. Subtracting,

  `u_{l+1}(x_0) - u_{k+1}(x_0) >= M - 2 delta`,

which is the chained estimate's left-hand side since the iterates at `l+1` and
`k+1` are the operator applied at `l` and `k`.
-/
theorem exists_sel {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u : EuclSpace d → ℝ} {w : ℕ → EuclSpace d → ℝ} {M δ : ℝ} (hδ : 0 < δ)
    (hMk : ∀ k, M ≤ deficitSup S u (w (k + 1)))
    (hconv : ∀ x, Tendsto (fun j => w j x) atTop (nhds (u x)))
    (k : ℕ) :
    ∃ x₀ ∈ S, ∃ l : ℕ, M - 2 * δ ≤ w (l + 1) x₀ - w (k + 1) x₀ := by
  obtain ⟨x₀, hx₀S, hx₀⟩ :=
    exists_point_near (S := S) hS (u := u) (w := w (k + 1)) hδ
  obtain ⟨l, -, hl⟩ := exists_late_index (u := u) (w := w) hδ (hconv x₀) k
  refine ⟨x₀, hx₀S, l, ?_⟩
  have h1 : M - δ ≤ u x₀ - w (k + 1) x₀ := by
    have := hMk k
    linarith [hx₀]
  linarith [hl]
theoremle_deficitSup_of_antitone
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $M, C \in \mathbb{R}$, $k \in \mathbb{N}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $\forall j, x,\ \lvert u(x) - w(j, x)\rvert \le C$ hC
  • $\forall j, x,\ w(j, x) \le w(j + 1, x)$ hmono
  • $\operatorname{Tendsto}(j \mapsto \operatorname{deficitSup}(S, u, w(j)), \mathrm{atTop}, \operatorname{nhds}(M))$ hlim

Then $M \le \operatorname{deficitSup}(S, u, w(k))$.

PLaplacian.le_deficitSup_of_antitonePlaplacian/Selection.lean, lines 61–72
/-- The deficit supremum is at least `M` at every stage, since the suprema
decrease to `M`. -/
theorem le_deficitSup_of_antitone {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u : EuclSpace d → ℝ} {w : ℕ → EuclSpace d → ℝ} {M C : ℝ}
    (hC : ∀ j x, |u x - w j x| ≤ C)
    (hmono : ∀ j x, w j x ≤ w (j + 1) x)
    (hlim : Tendsto (fun j => deficitSup S u (w j)) atTop (nhds M))
    (k : ℕ) :
    M ≤ deficitSup S u (w k) := by
  have hanti := deficitSup_antitone hS hC hmono
  refine le_of_tendsto hlim (Filter.eventually_atTop.2 ⟨k, fun j hj => ?_⟩)
  exact hanti hj

Plaplacian/Semicont.lean4 declarations

theoremeventually_lt_of_ubar_lt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $a \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\overline{u}(x) < a$ ha

Then ∀ᶠ (q : ℝ × EuclSpace d) in PLaplacian.relaxFilter x, u q.1 q.2 < a.

PLaplacian.eventually_lt_of_ubar_ltPlaplacian/Semicont.lean, lines 45–51
/-- The family is eventually below any bound exceeding the upper limit. -/
theorem eventually_lt_of_ubar_lt (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) (x : EuclSpace d) {a : ℝ}
    (ha : ubar u x < a) :
    ∀ᶠ q in relaxFilter x, u q.1 q.2 < a := by
  refine eventually_lt_of_limsup_lt ha ?_
  exact isBoundedUnder_le_of_bound u hC x
theoremexists_prod_nhds_of_ubar_lt
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $a \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\overline{u}(x) < a$ ha

Then there exists $S \in \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0))$ such that:

  • $\exists V \in \operatorname{nhds}(x),\ \forall \varepsilon \in S,\ \forall y \in V,\ u_{\varepsilon}(y) < a$
PLaplacian.exists_prod_nhds_of_ubar_ltPlaplacian/Semicont.lean, lines 53–64
/-- The eventual bound as a product neighbourhood. -/
theorem exists_prod_nhds_of_ubar_lt (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) (x : EuclSpace d) {a : ℝ}
    (ha : ubar u x < a) :
    ∃ S ∈ nhdsWithin (0 : ℝ) (Set.Ioi 0), ∃ V ∈ nhds x,
      ∀ ε ∈ S, ∀ y ∈ V, u ε y < a := by
  have hev := eventually_lt_of_ubar_lt u hC x ha
  unfold relaxFilter at hev
  rw [Filter.eventually_iff, Filter.mem_prod_iff] at hev
  obtain ⟨S, hS, V, hV, hsub⟩ := hev
  refine ⟨S, hS, V, hV, fun ε hεS y hyV => ?_⟩
  exact hsub (Set.mk_mem_prod hεS hyV)
theoremubar_le_of_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $S \subseteq \mathbb{R}$, $V \subseteq \mathbb{R}^{d}$, $b \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $S \in \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0))$ hS
  • $\forall \varepsilon \in S,\ \forall y \in V,\ u_{\varepsilon}(y) \le b$ hbd
  • $V \in \operatorname{nhds}(y)$ hyV

Then $\overline{u}(y) \le b$.

PLaplacian.ubar_le_of_boundPlaplacian/Semicont.lean, lines 66–81
/-- At a point of the witnessing neighbourhood the upper limit is bounded. -/
theorem ubar_le_of_bound (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {S : Set ℝ}
    (hS : S ∈ nhdsWithin (0 : ℝ) (Set.Ioi 0)) {V : Set (EuclSpace d)}
    {b : ℝ} (hbd : ∀ ε ∈ S, ∀ y ∈ V, u ε y ≤ b)
    {y : EuclSpace d} (hyV : V ∈ nhds y) :
    ubar u y ≤ b := by
  unfold ubar
  refine Filter.limsup_le_of_le ?_ ?_
  · exact (isBoundedUnder_ge_of_bound u hC y).isCobounded_flip
  · rw [Filter.eventually_iff]
    unfold relaxFilter
    rw [Filter.mem_prod_iff]
    refine ⟨S, hS, V, hyV, ?_⟩
    intro q hq
    exact hbd q.1 hq.1 q.2 hq.2
theoremupperSemicontinuous_ubarTheorem 4.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC

Then $\overline{u}\text{ is upper semicontinuous}$.

PLaplacian.upperSemicontinuous_ubarPlaplacian/Semicont.lean, lines 83–98
/-- **The upper limit is upper semicontinuous.** -/
theorem upperSemicontinuous_ubar (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) :
    UpperSemicontinuous (ubar u) := by
  intro x a ha
  -- an intermediate value
  obtain ⟨b, hb1, hb2⟩ := exists_between ha
  obtain ⟨S, hS, V, hV, hbd⟩ := exists_prod_nhds_of_ubar_lt u hC x hb1
  -- shrink to an open subset, which is a neighbourhood of each of its points
  obtain ⟨W, hWV, hWopen, hxW⟩ := _root_.mem_nhds_iff.1 hV
  filter_upwards [hWopen.mem_nhds hxW] with y hyW
  have hWy : W ∈ nhds y := hWopen.mem_nhds hyW
  have hle : ubar u y ≤ b :=
    ubar_le_of_bound u hC hS
      (fun ε hεS w hwW => le_of_lt (hbd ε hεS w (hWV hwW))) hWy
  linarith [hle, hb2]

Plaplacian/SeqExtract.lean2 declarations

instancerelaxFilter_countablyGenerated
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Then (PLaplacian.relaxFilter x).IsCountablyGenerated.

PLaplacian.relaxFilter_countablyGeneratedPlaplacian/SeqExtract.lean, lines 50–57
/-- The relaxed filter is countably generated. Registered as an instance so
that downstream uses do not have to unfold the definition: instance
resolution does not see through a def, and every use would otherwise repeat
the unfolding. -/
instance relaxFilter_countablyGenerated (x : EuclSpace d) :
    (relaxFilter x).IsCountablyGenerated := by
  unfold relaxFilter
  infer_instance
theoremexists_seq_relax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$.

Then there exists $q$ such that:

  • $\operatorname{Tendsto}(q, \mathrm{atTop}, \operatorname{relaxFilter}(x))$
/-- Hence there is a sequence tending along it. -/
theorem exists_seq_relax (x : EuclSpace d) :
    ∃ q : ℕ → ℝ × EuclSpace d,
      Filter.Tendsto q Filter.atTop (relaxFilter x) := by
  exact Filter.exists_seq_tendsto (relaxFilter x)

Plaplacian/Shift.lean3 declarations

theorembddMeas_add_const
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$.

Assume

  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφ

Then PLaplacian.BddMeas fun y => φ y + c.

PLaplacian.bddMeas_add_constPlaplacian/Shift.lean, lines 55–61
/-- Adding a constant preserves boundedness and measurability. -/
theorem bddMeas_add_const {φ : EuclSpace d → ℝ} (hφ : BddMeas φ) (c : ℝ) :
    BddMeas (fun y => φ y + c) := by
  obtain ⟨B, hB⟩ := hφ.bound
  refine ⟨hφ.meas.add measurable_const, ⟨B + |c|, fun y => ?_⟩⟩
  calc |φ y + c| ≤ |φ y| + |c| := abs_add_le _ _
    _ ≤ B + |c| := by linarith [hB y]
theoremdpp_comparison_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $y \in \Omega$ hy
  • $\forall w,\ u(w) - \varphi(w) \le u(y) - \varphi(y)$ hmax

Then $\varphi(y) \le T_{\varepsilon} \varphi(y)$.

PLaplacian.dpp_comparison_shiftPlaplacian/Shift.lean, lines 63–73
/-- **The shifted comparison.** If the difference is bounded by its value at
`y`, the comparison applies to the shifted test function, and the conclusion
transfers back. -/
theorem dpp_comparison_shift {p ε : ℝ} (hp : 2 ≤ p) (hd : 0 < d)
    (hε : 0 < ε) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφb : BddMeas φ)
    {y : EuclSpace d} (hy : y ∈ Ω)
    (hmax : ∀ w, u w - φ w ≤ u y - φ y) :
    φ y ≤ tugOfWarOp p ε φ y :=
  dpp_comparison hp hd hε hpd hu hφb hy hmax rfl
theoremdpp_comparison_of_shifted
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $y \in \Omega$ hy
  • $\forall w,\ u(w) - (\varphi(w) + c) \le u(y) - (\varphi(y) + c)$ hmax

Then $\varphi(y) \le T_{\varepsilon} \varphi(y)$.

PLaplacian.dpp_comparison_of_shiftedPlaplacian/Shift.lean, lines 75–87
/-- The same with an explicit shift, for the case where the maximum is
attained only up to a constant. -/
theorem dpp_comparison_of_shifted {p ε : ℝ} (hp : 2 ≤ p) (hd : 0 < d)
    (hε : 0 < ε) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφb : BddMeas φ)
    {y : EuclSpace d} (hy : y ∈ Ω) (c : ℝ)
    (hmax : ∀ w, u w - (φ w + c) ≤ u y - (φ y + c)) :
    φ y ≤ tugOfWarOp p ε φ y := by
  have hψb : BddMeas (fun w => φ w + c) := bddMeas_add_const hφb c
  have h := dpp_comparison_shift hp hd hε hpd hu hψb hy hmax
  rw [tugOfWarOp_add_const p ε hε hφb c y hpd] at h
  linarith [h]

Plaplacian/SingEigen.lean4 declarations

theorembddAbove_quad_sphere
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then BddAbove ((fun v => (X v) v) '' {v | ‖v‖ = 1}).

PLaplacian.bddAbove_quad_spherePlaplacian/SingEigen.lean, lines 54–66
/-- The values on the unit sphere are bounded above, by the operator norm. -/
theorem bddAbove_quad_sphere (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    BddAbove ((fun v => (X v) v) '' {v : EuclSpace d | ‖v‖ = 1}) := by
  refine ⟨‖X‖, ?_⟩
  rintro a ⟨w, hw, rfl⟩
  simp only [Set.mem_ofPred_eq] at hw
  have h1 := X.le_opNorm w
  have h2 := (X w).le_opNorm w
  calc (X w) w ≤ |(X w) w| := le_abs_self _
    _ = ‖(X w) w‖ := (Real.norm_eq_abs _).symm
    _ ≤ ‖X w‖ * ‖w‖ := h2
    _ ≤ (‖X‖ * ‖w‖) * ‖w‖ := mul_le_mul_of_nonneg_right h1 (norm_nonneg _)
    _ = ‖X‖ := by rw [hw]; ring
theoremquad_le_lamMax_norm
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $z \in \mathbb{R}^{d}$.

Then $(X(z))(z) \le \operatorname{lamMax}(X) \cdot \lVert z\rVert ^{2}$.

PLaplacian.quad_le_lamMax_normPlaplacian/SingEigen.lean, lines 68–87
/-- **A quadratic form is at most the largest eigenvalue times the squared
norm**, for every vector. -/
theorem quad_le_lamMax_norm (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (z : EuclSpace d) : (X z) z ≤ lamMax X * ‖z‖ ^ 2 := by
  by_cases hz : z = 0
  · subst hz; simp
  · have hn : 0 < ‖z‖ := norm_pos_iff.2 hz
    set v := ‖z‖⁻¹ • z with hvdef
    have hv : ‖v‖ = 1 := by
      rw [hvdef, norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ (ne_of_gt hn)]
    have hle : (X v) v ≤ lamMax X :=
      le_csSup (bddAbove_quad_sphere X) ⟨v, hv, rfl⟩
    have hzv : z = ‖z‖ • v := by
      rw [hvdef, smul_smul, mul_inv_cancel₀ (ne_of_gt hn), one_smul]
    have hexp : (X z) z = ‖z‖ ^ 2 * (X v) v := by
      conv_lhs => rw [hzv]
      simp
      ring
    rw [hexp]
    nlinarith [hle, sq_nonneg ‖z‖]
theoremlaplacianOf_le_lamMax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then $\operatorname{laplacianOf}(X) \le d \cdot \operatorname{lamMax}(X)$.

PLaplacian.laplacianOf_le_lamMaxPlaplacian/SingEigen.lean, lines 89–102
/-- **The trace is at most the dimension times the largest eigenvalue.** -/
theorem laplacianOf_le_lamMax (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    laplacianOf X ≤ (d : ℝ) * lamMax X := by
  unfold laplacianOf
  have h : ∀ i : Fin d,
      (X (EuclideanSpace.single i 1)) (EuclideanSpace.single i 1)
        ≤ lamMax X := by
    intro i
    have := quad_le_lamMax_norm X (EuclideanSpace.single i 1)
    simpa using this
  calc ∑ i, (X (EuclideanSpace.single i 1)) (EuclideanSpace.single i 1)
      ≤ ∑ _i : Fin d, lamMax X := Finset.sum_le_sum (fun i _ => h i)
    _ = (d : ℝ) * lamMax X := by
        simp [Finset.sum_const]
theoremreflect_neg_of_envelope_posLemma 4.9 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Assume

  • $2 \le p$ _hp
  • $0 < d$ hd
  • $0 < \operatorname{viscFLower}(p, X)$ hpos

Then $(p - 2) \cdot \operatorname{max}(\operatorname{lamMax}(X), 0) + \operatorname{laplacianOf}(X) < 0$.

PLaplacian.reflect_neg_of_envelope_posPlaplacian/SingEigen.lean, lines 104–117
/-- **The reflection quantity is negative when the envelope is positive.** -/
theorem reflect_neg_of_envelope_pos {p : ℝ} (_hp : 2 ≤ p) (hd : 0 < d)
    {X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ}
    (hpos : 0 < viscFLower p X) :
    (p - 2) * max (lamMax X) 0 + laplacianOf X < 0 := by
  unfold viscFLower at hpos
  by_cases h : 0 ≤ lamMax X
  · rw [max_eq_left h]; linarith
  · push Not at h
    rw [max_eq_right (le_of_lt h), mul_zero, zero_add]
    have htr := laplacianOf_le_lamMax X
    have hd' : (0:ℝ) < d := by exact_mod_cast hd
    have : (d : ℝ) * lamMax X < 0 := mul_neg_of_pos_of_neg hd' h
    linarith

Plaplacian/Singular.lean4 declarations

theoremfderiv_eq_zero_of_gradient_eq_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{gradient}(\varphi, x) = 0$ hx

Then $(\operatorname{fderiv}(\mathbb{R}, \varphi, x))(z) = 0$.

PLaplacian.fderiv_eq_zero_of_gradient_eq_zeroPlaplacian/Singular.lean, lines 51–54
theorem fderiv_eq_zero_of_gradient_eq_zero {φ : EuclSpace d → ℝ}
    {x : EuclSpace d} (hx : gradient φ x = 0) (z : EuclSpace d) :
    fderiv ℝ φ x z = 0 := by
  rw [← inner_gradient_left, hx, inner_zero_left]
theoremdecomp_at_singular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{gradient}(\varphi, x) = 0$ hx

Then $\varphi(x + z) = \varphi(x) + 1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(z))(z) + \operatorname{taylorErr}(\varphi, x, z)$.

PLaplacian.decomp_at_singularPlaplacian/Singular.lean, lines 56–61
theorem decomp_at_singular {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (hx : gradient φ x = 0) (z : EuclSpace d) :
    φ (x + z) = φ x + (1 / 2) * fderiv ℝ (fderiv ℝ φ) x z z
      + taylorErr φ x z := by
  rw [decomp_at φ x z, fderiv_eq_zero_of_gradient_eq_zero hx]
  ring
theoremquad_eq_norm_sq_mul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $z \in \mathbb{R}^{d}$.

Assume

  • $z \ne 0$ hz

Then $(X(z))(z) = \lVert z\rVert ^{2} \cdot \operatorname{infLaplacianOf}(z, X)$.

PLaplacian.quad_eq_norm_sq_mulPlaplacian/Singular.lean, lines 63–71
/-- The quadratic form at `z`, in terms of the form at the normalized `z`. -/
theorem quad_eq_norm_sq_mul (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    {z : EuclSpace d} (hz : z ≠ 0) :
    X z z = ‖z‖ ^ 2 * infLaplacianOf z X := by
  unfold infLaplacianOf
  have hn : ‖z‖ ≠ 0 := norm_ne_zero_iff.2 hz
  simp only [ContinuousLinearMap.map_smul, FunLike.coe_smul, Pi.smul_apply,
    smul_eq_mul]
  field_simp
theoremquad_le_lamMax_ballTheorem 3.7 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $z \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\lVert z\rVert \le \varepsilon$ hz
  • $z \ne 0$ hzne
  • $0 \le \operatorname{lamMax}(X)$ hpos

Then $(X(z))(z) \le \varepsilon ^{2} \cdot \operatorname{lamMax}(X)$.

PLaplacian.quad_le_lamMax_ballPlaplacian/Singular.lean, lines 73–87
/-- **The quadratic form over the ball is at most `ε²` times the largest
eigenvalue**, provided that eigenvalue is nonnegative --- which holds whenever
the form is not negative definite, and in particular at a maximum. -/
theorem quad_le_lamMax_ball (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    {z : EuclSpace d} {ε : ℝ} (hz : ‖z‖ ≤ ε) (hzne : z ≠ 0)
    (hpos : 0 ≤ lamMax X) :
    X z z ≤ ε ^ 2 * lamMax X := by
  rw [quad_eq_norm_sq_mul X hzne]
  have h1 : infLaplacianOf z X ≤ lamMax X :=
    infLaplacianOf_le_lamMax hzne X
  have h2 : ‖z‖ ^ 2 ≤ ε ^ 2 := by
    have h0 : (0:ℝ) ≤ ‖z‖ := norm_nonneg z
    nlinarith [hz, h0]
  have h3 : (0:ℝ) ≤ ‖z‖ ^ 2 := by positivity
  nlinarith [h1, h2, h3, hpos]

Plaplacian/SingularCase.lean4 declarations

theoremreflect_boundTheorem 4.8 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$, $\varepsilon, K \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $0 < \varepsilon$ hε
  • $\forall z,\ \lVert z\rVert \le \varepsilon \to \lvert \operatorname{taylorErr}(\varphi, y, z)\rvert \le K \cdot \varepsilon ^{3}$ hTerr

Then there exists $z$ such that:

  • $\lVert z\rVert \le \varepsilon$
  • ( sSup ( φ '' Metric.closedBall y ε ) + sInf ( φ '' Metric.closedBall y ε ) ) / 2 ≤ φ y + 1 / 2 * ( ( fderiv ℝ ( fderiv ℝ φ ) y ) z ) z + K * ε ^ 3
/-- **The reflection bound.** The average of the supremum and infimum over the
closed ball is at most the value plus half the Hessian on some increment of
norm at most `ε`, plus the Taylor error. -/
theorem reflect_bound {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (y : EuclSpace d) {ε K : ℝ} (hε : 0 < ε)
    (hTerr : ∀ z : EuclSpace d, ‖z‖ ≤ ε → |taylorErr φ y z| ≤ K * ε ^ 3) :
    ∃ z : EuclSpace d, ‖z‖ ≤ ε ∧
      (sSup (φ '' closedBall y ε) + sInf (φ '' closedBall y ε)) / 2
        ≤ φ y + (1 / 2) * (fderiv ℝ (fderiv ℝ φ) y z) z + K * ε ^ 3 := by
  obtain ⟨w, hw, hsup⟩ := exists_sSup_closedBall hφ.continuous y hε
  set z := w - y with hzdef
  have hz : ‖z‖ ≤ ε := norm_sub_le_of_mem hw
  have hwz : w = y + z := by rw [hzdef]; abel
  -- the reflected point is in the ball, so the infimum is below its value
  have hmem : y + -z ∈ closedBall y ε := by
    rw [mem_closedBall, dist_eq_norm]
    have : y + -z - y = -z := by abel
    rw [this, norm_neg]; exact hz
  have hbdd : BddBelow (φ '' closedBall y ε) :=
    ((isCompact_closedBall y ε).image hφ.continuous).bddBelow
  have hinf : sInf (φ '' closedBall y ε) ≤ φ (y + -z) :=
    csInf_le hbdd ⟨y + -z, hmem, rfl⟩
  -- the two expansions
  have hplus := decomp_at φ y z
  have hminus := decomp_at φ y (-z)
  have hlin : fderiv ℝ φ y (-z) = - fderiv ℝ φ y z := map_neg _ _
  have hquad : (fderiv ℝ (fderiv ℝ φ) y (-z)) (-z)
      = (fderiv ℝ (fderiv ℝ φ) y z) z := by simp
  rw [hlin, hquad] at hminus
  -- the errors
  have he1 := (abs_le.1 (hTerr z hz)).2
  have he2 := (abs_le.1 (hTerr (-z) (by rw [norm_neg]; exact hz))).2
  refine ⟨z, hz, ?_⟩
  rw [hsup, hwz]
  linarith [hinf, hplus, hminus, he1, he2]
theoremsingular_subsolTheorem 4.10 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < r$ hr
  • $\overline{B}(x_{0}, r) \subseteq \Omega$ hΩ
  • $\operatorname{IsStrictMaxOn}(w \mapsto \overline{u}(w) - \varphi(w), x_{0}, r)$ hstrict

Then $\operatorname{viscFLower}(p, \operatorname{hess}(\varphi, x_{0})) \le 0$.

/-- **The singular subsolution inequality.** At a strict maximum of the upper
relaxed limit minus a bounded `C³` test function, the lower envelope is
nonpositive. No condition on the gradient is needed. -/
theorem singular_subsol [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) (hφb : BddMeas φ)
    {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    {x₀ : EuclSpace d} {r : ℝ} (hr : 0 < r) (hΩ : closedBall x₀ r ⊆ Ω)
    (hstrict : IsStrictMaxOn (fun w => ubar u w - φ w) x₀ r) :
    viscFLower p (hess φ x₀) ≤ 0 := by
  by_contra hneg
  push Not at hneg
  set X := fderiv ℝ (fderiv ℝ φ) x₀ with hXdef
  have hQ := reflect_neg_of_envelope_pos hp hd (X := X) hneg
  set lp := max (lamMax X) 0 with hlpdef
  set γ := -((p - 2) * lp + laplacianOf X) with hγdef
  have hγ : 0 < γ := by rw [hγdef]; linarith
  have hp0 : 0 < p := by linarith
  -- the Hessian, uniformly near the maximum
  obtain ⟨ρ₁, hρ₁, hhess⟩ :=
    hess_quad_cont hφ x₀ (by positivity : (0:ℝ) < γ / (4 * p))
  -- the Laplacian, near the maximum
  have hlapc := continuousAt_laplacianOf (hφ.of_le (by norm_num)) x₀
  have hev1 : ∀ᶠ y in nhds x₀,
      laplacianOf (fderiv ℝ (fderiv ℝ φ) y) < laplacianOf X + γ / 4 :=
    hlapc.eventually (eventually_lt_nhds (by linarith))
  rw [Metric.eventually_nhds_iff] at hev1
  obtain ⟨ρ₂, hρ₂, hlap⟩ := hev1
  -- the uniform Taylor and average constants
  obtain ⟨K₀, hK₀⟩ := taylorErr_le_cubic_uniform hφ x₀ r
  obtain ⟨Ka₀, hKa₀⟩ := avgErr_uniform hφ x₀ r
  set K := max K₀ 0 with hKdef
  set Ka := max Ka₀ 0 with hKadef
  have hK : 0 ≤ K := le_max_right _ _
  have hKa : 0 ≤ Ka := le_max_right _ _
  -- the weights
  set α := (p - 2) / (p + (d : ℝ)) with hαdef
  set β := ((d : ℝ) + 2) / (p + (d : ℝ)) with hβdef
  have hα : 0 ≤ α := by rw [hαdef]; exact div_nonneg (by linarith) hpd.le
  have hβ : 0 ≤ β := by rw [hβdef]; positivity
  set Cc := α * K + β * Ka + 1 with hCcdef
  have hCc : 0 < Cc := by rw [hCcdef]; positivity
  -- the radius for the near-maximizer
  set ρ := min (min ρ₁ ρ₂) (r / 2) with hρdef
  have hρ : 0 < ρ := by
    rw [hρdef]; exact lt_min (lt_min hρ₁ hρ₂) (by linarith)
  have hex : ∀ ε : ℝ, 0 < ε → ∃ z ∈ closedBall x₀ r,
      sSup ((fun w => u ε w - φ w) '' closedBall x₀ r) - ε ^ 3
        < u ε z - φ z :=
    fun ε hε => exists_near_sup_cube u hC hB x₀ hr hε
  choose! y hymem hynear using hex
  have hfreq := nearmax_frequently_in_ball u hC hφ.continuous hB hr hρ
    hstrict y (fun ε hε => ⟨hymem ε hε, hynear ε hε⟩)
  -- the eventual conditions
  have hlt : ∀ {a : ℝ}, 0 < a →
      ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), ε < a := by
    intro a ha
    exact Filter.mem_of_superset (Ioo_mem_nhdsGT ha) (fun x hx => hx.2)
  have hpos : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), 0 < ε :=
    self_mem_nhdsWithin
  set τ := γ / (4 * (p + (d : ℝ)) * Cc) with hτdef
  have hτ : 0 < τ := by rw [hτdef]; positivity
  have hev : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      ε < r / 2 ∧ ε < τ ∧ 0 < ε :=
    (hlt (by linarith : (0:ℝ) < r / 2)).and ((hlt hτ).and hpos)
  obtain ⟨ε, hyball, hεr, hετ, hε⟩ := (hfreq.and_eventually hev).exists
  -- the near-maximizer's position
  have hyρ : dist (y ε) x₀ < ρ := hyball
  have hy₁ : y ε ∈ ball x₀ ρ₁ := by
    rw [mem_ball]
    exact lt_of_lt_of_le hyρ (le_trans (min_le_left _ _) (min_le_left _ _))
  have hy₂ : dist (y ε) x₀ < ρ₂ :=
    lt_of_lt_of_le hyρ (le_trans (min_le_left _ _) (min_le_right _ _))
  have hyr : dist (y ε) x₀ < r / 2 := lt_of_lt_of_le hyρ (min_le_right _ _)
  have hyc : y ε ∈ closedBall x₀ r := hymem ε hε
  have hεR : ε ≤ r := by linarith
  -- the Taylor error bound at the near-maximizer
  have hTerr : ∀ z : EuclSpace d, ‖z‖ ≤ ε →
      |taylorErr φ (y ε) z| ≤ K * ε ^ 3 := by
    intro z hz
    have h1 := hK₀ (y ε) hyc z (le_trans hz hεR)
    have hz3 : ‖z‖ ^ 3 ≤ ε ^ 3 := pow_le_pow_left₀ (norm_nonneg z) hz 3
    have hz3nn : (0:ℝ) ≤ ‖z‖ ^ 3 := by positivity
    have hA : K₀ * ‖z‖ ^ 3 ≤ K * ‖z‖ ^ 3 :=
      mul_le_mul_of_nonneg_right (le_max_left _ _) hz3nn
    have hB : K * ‖z‖ ^ 3 ≤ K * ε ^ 3 := mul_le_mul_of_nonneg_left hz3 hK
    linarith [h1, hA, hB]
  -- the reflection bound
  obtain ⟨z, hz, hrefl⟩ := reflect_bound hφ (y ε) hε hTerr
  -- the Hessian quadratic form, bounded by the eigenvalue part
  have hq1 := hhess (y ε) hy₁ z
  have hq2 := quad_le_lamMax_norm X z
  have hz2 : ‖z‖ ^ 2 ≤ ε ^ 2 := pow_le_pow_left₀ (norm_nonneg z) hz 2
  have hz2nn : (0:ℝ) ≤ ‖z‖ ^ 2 := by positivity
  have hlpge : lamMax X ≤ lp := le_max_left _ _
  have hlpnn : 0 ≤ lp := le_max_right _ _
  have hquad : (fderiv ℝ (fderiv ℝ φ) (y ε) z) z
      ≤ (lp + γ / (4 * p)) * ε ^ 2 := by
    have hA : lamMax X * ‖z‖ ^ 2 ≤ lp * ‖z‖ ^ 2 :=
      mul_le_mul_of_nonneg_right hlpge hz2nn
    have hB : lp * ‖z‖ ^ 2 ≤ lp * ε ^ 2 :=
      mul_le_mul_of_nonneg_left hz2 hlpnn
    have hC : γ / (4 * p) * ‖z‖ ^ 2 ≤ γ / (4 * p) * ε ^ 2 :=
      mul_le_mul_of_nonneg_left hz2 (by positivity)
    have hexp : (lp + γ / (4 * p)) * ε ^ 2
        = lp * ε ^ 2 + γ / (4 * p) * ε ^ 2 := by ring
    rw [hexp]
    linarith [hq1, hq2, hA, hB, hC]
  -- the extreme-value part over the open ball
  have hext : (sSup (φ '' ball (y ε) ε) + sInf (φ '' ball (y ε) ε)) / 2
      ≤ φ (y ε) + (1 / 2) * ((lp + γ / (4 * p)) * ε ^ 2) + K * ε ^ 3 := by
    rw [sSup_ball_eq_closedBall hφ.continuous (y ε) hε,
      sInf_ball_eq_closedBall hφ.continuous (y ε) hε]
    linarith [hrefl, hquad]
  -- the average part
  have havgeq := setAverage_expansion hd (hφ.of_le (by norm_num)) (y ε) hε
  have havgerr := (abs_le.1 (hKa₀ (y ε) hyc ε hε hεR)).2
  have hε3 : (0:ℝ) ≤ ε ^ 3 := by positivity
  have hKa3 : Ka₀ * ε ^ 3 ≤ Ka * ε ^ 3 :=
    mul_le_mul_of_nonneg_right (le_max_left _ _) hε3
  have hlapy := hlap hy₂
  have hε2 : 0 < ε ^ 2 := by positivity
  have hcoefA : (0:ℝ) ≤ ε ^ 2 / (2 * ((d : ℝ) + 2)) := by positivity
  have havg : (⨍ w in ball (y ε) ε, φ w)
      ≤ φ (y ε) + ε ^ 2 / (2 * ((d : ℝ) + 2)) * (laplacianOf X + γ / 4)
        + Ka * ε ^ 3 := by
    rw [havgeq]
    have : ε ^ 2 / (2 * ((d : ℝ) + 2)) * laplacianOf (hess φ (y ε))
        ≤ ε ^ 2 / (2 * ((d : ℝ) + 2)) * (laplacianOf X + γ / 4) :=
      mul_le_mul_of_nonneg_left (le_of_lt hlapy) hcoefA
    linarith [havgerr, hKa3]
  -- the comparison at the near-maximizer
  have hyΩ : y ε ∈ Ω := hΩ hyc
  have hle : ∀ w ∈ ball (y ε) ε,
      u ε w - φ w ≤ sSup ((fun w => u ε w - φ w) '' closedBall x₀ r) := by
    intro w hw
    have hwc : w ∈ closedBall x₀ r := by
      rw [mem_closedBall]
      rw [mem_ball] at hw
      have := dist_triangle w (y ε) x₀
      linarith
    exact le_sup_on_ball u hC hB x₀ w hwc
  have hcmp := dpp_comparison_approx hp hε hpd (hu ε hε) hφb hyΩ hle
    (le_of_lt (hynear ε hε))
  rw [tugOfWarOp_eq] at hcmp
  -- combine: the weights sum to one, and the bracket is at most -γ/2
  have hsum : α + β = 1 := by
    rw [hαdef, hβdef]; field_simp; ring
  have hc1 : α * ((1 / 2) * ((lp + γ / (4 * p)) * ε ^ 2))
      = ε ^ 2 / (2 * (p + (d : ℝ))) * ((p - 2) * (lp + γ / (4 * p))) := by
    rw [hαdef]; field_simp
  have hc2 : β * (ε ^ 2 / (2 * ((d : ℝ) + 2)) * (laplacianOf X + γ / 4))
      = ε ^ 2 / (2 * (p + (d : ℝ))) * (laplacianOf X + γ / 4) := by
    rw [hβdef]; field_simp
  have hbr : (p - 2) * (lp + γ / (4 * p)) + (laplacianOf X + γ / 4)
      ≤ -(γ / 2) := by
    have : (p - 2) * (γ / (4 * p)) ≤ γ / 4 := by
      have hpγ : (p - 2) * (γ / (4 * p)) ≤ p * (γ / (4 * p)) :=
        mul_le_mul_of_nonneg_right (by linarith) (by positivity)
      have : p * (γ / (4 * p)) = γ / 4 := by field_simp
      linarith
    have hexp : (p - 2) * (lp + γ / (4 * p))
        = (p - 2) * lp + (p - 2) * (γ / (4 * p)) := by ring
    rw [hexp]
    linarith [this, hγdef]
  have hc : 0 < ε ^ 2 / (2 * (p + (d : ℝ))) := by positivity
  have hfin : α * ((sSup (φ '' ball (y ε) ε) + sInf (φ '' ball (y ε) ε)) / 2)
      + β * (⨍ w in ball (y ε) ε, φ w)
      ≤ φ (y ε) + ε ^ 2 / (2 * (p + (d : ℝ))) * (-(γ / 2))
        + (α * K + β * Ka) * ε ^ 3 := by
    have h1 := mul_le_mul_of_nonneg_left hext hα
    have h2 := mul_le_mul_of_nonneg_left havg hβ
    have h3 := mul_le_mul_of_nonneg_left hbr (le_of_lt hc)
    have e1 : α * (φ (y ε) + (1 / 2) * ((lp + γ / (4 * p)) * ε ^ 2)
          + K * ε ^ 3)
        = α * φ (y ε) + α * ((1 / 2) * ((lp + γ / (4 * p)) * ε ^ 2))
          + α * K * ε ^ 3 := by ring
    have e2 : β * (φ (y ε) + ε ^ 2 / (2 * ((d : ℝ) + 2))
          * (laplacianOf X + γ / 4) + Ka * ε ^ 3)
        = β * φ (y ε) + β * (ε ^ 2 / (2 * ((d : ℝ) + 2))
          * (laplacianOf X + γ / 4)) + β * Ka * ε ^ 3 := by ring
    have e3 : ε ^ 2 / (2 * (p + (d : ℝ)))
          * ((p - 2) * (lp + γ / (4 * p)) + (laplacianOf X + γ / 4))
        = ε ^ 2 / (2 * (p + (d : ℝ))) * ((p - 2) * (lp + γ / (4 * p)))
          + ε ^ 2 / (2 * (p + (d : ℝ))) * (laplacianOf X + γ / 4) := by ring
    have e4 : α * φ (y ε) + β * φ (y ε) = φ (y ε) := by
      rw [← add_mul, hsum, one_mul]
    have e5 : (α * K + β * Ka) * ε ^ 3 = α * K * ε ^ 3 + β * Ka * ε ^ 3 := by
      ring
    rw [e1] at h1
    rw [e2] at h2
    rw [e3] at h3
    linarith [h1, h2, h3, hc1, hc2, e4, e5]
  -- the parameter is small enough that the cube does not compensate
  have hsmall : Cc * ε ^ 3 < ε ^ 2 / (2 * (p + (d : ℝ))) * (γ / 2) := by
    have hετ' : Cc * ε < γ / (4 * (p + (d : ℝ))) := by
      have := mul_lt_mul_of_pos_left hετ hCc
      rw [hτdef] at this
      have hval : Cc * (γ / (4 * (p + (d : ℝ)) * Cc))
          = γ / (4 * (p + (d : ℝ))) := by field_simp
      linarith
    have hval2 : ε ^ 2 / (2 * (p + (d : ℝ))) * (γ / 2)
        = ε ^ 2 * (γ / (4 * (p + (d : ℝ)))) := by field_simp; ring
    rw [hval2]
    have : Cc * ε ^ 3 = ε ^ 2 * (Cc * ε) := by ring
    rw [this]
    exact mul_lt_mul_of_pos_left hετ' hε2
  have hCcexp : Cc * ε ^ 3 = (α * K + β * Ka) * ε ^ 3 + ε ^ 3 := by
    rw [hCcdef]; ring
  have hneg : ε ^ 2 / (2 * (p + (d : ℝ))) * (-(γ / 2))
      = -(ε ^ 2 / (2 * (p + (d : ℝ))) * (γ / 2)) := by ring
  linarith [hcmp, hfin, hsmall, hCcexp, hneg]
theoremlamMax_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then $\operatorname{lamMax}(- X) = - \operatorname{lamMin}(X)$.

/-- The largest eigenvalue of a negated form is minus the smallest. -/
theorem lamMax_neg (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    lamMax (-X) = - lamMin X := by
  unfold lamMax lamMin
  have hf : (fun v => ((-X) v) v) = fun v => -((X v) v) := by
    funext v; simp
  rw [hf]
  have := sInf_eq_neg_sSup (fun v => (X v) v) {v : EuclSpace d | ‖v‖ = 1}
  linarith
theoremsingular_supsolTheorem 4.11 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < r$ hr
  • $\overline{B}(x_{0}, r) \subseteq \Omega$ hΩ
  • $\forall w \in \overline{B}(x_{0}, r),\ w \ne x_{0} \to \underline{u}(x_{0}) - \varphi(x_{0}) < \underline{u}(w) - \varphi(w)$ hmin

Then $0 \le \operatorname{viscFUpper}(p, \operatorname{hess}(\varphi, x_{0}))$.

/-- **The singular supersolution inequality**, by transport. -/
theorem singular_supsol [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) (hφb : BddMeas φ)
    {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    {x₀ : EuclSpace d} {r : ℝ} (hr : 0 < r) (hΩ : closedBall x₀ r ⊆ Ω)
    (hmin : ∀ w ∈ closedBall x₀ r, w ≠ x₀ →
      lbar u x₀ - φ x₀ < lbar u w - φ w) :
    0 ≤ viscFUpper p (hess φ x₀) := by
  have hCn : ∀ ε y, |(fun ε y => -u ε y) ε y| ≤ C := by
    intro ε y; simp only; rw [abs_neg]; exact hC ε y
  have hun : ∀ ε > 0, IsPHarmonious p ε Ω (fun y => -F y)
      ((fun ε y => -u ε y) ε) :=
    fun ε hε => isPHarmonious_neg (hu ε hε)
  have hBn : ∀ y, |(fun y => -φ y) y| ≤ B := by
    intro y; simp only; rw [abs_neg]; exact hB y
  have hstrict : IsStrictMaxOn
      (fun w => ubar (fun ε y => -u ε y) w - (fun y => -φ y) w) x₀ r := by
    intro w hw hne
    have h1 := lbar_eq_neg_ubar_neg u w
    have h2 := lbar_eq_neg_ubar_neg u x₀
    have h3 := hmin w hw hne
    simp only
    linarith [h1, h2, h3]
  have h := singular_subsol hd hp hpd hCn hun (contDiff_neg' hφ)
    (bddMeas_neg hφb) hBn hr hΩ hstrict
  unfold viscFLower at h
  unfold viscFUpper
  rw [hess_eq_fderiv, hess_neg, laplacianOf_neg, lamMax_neg] at h
  rw [hess_eq_fderiv]
  linarith [h]

Plaplacian/Squeeze.lean2 declarations

theoremextreme_avg_squeezed
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon, I, \mathrm{loS}, \mathrm{hiS}, \mathrm{loI}, \mathrm{hiI} \in \mathbb{R}$.

Assume

  • φ x + ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + loS ≤ sSup (φ '' Metric.closedBall x ε) hSlow
  • sSup (φ '' Metric.closedBall x ε) ≤ φ x + ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + hiS hSupp
  • φ x - ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + loI ≤ sInf (φ '' Metric.closedBall x ε) hIlow
  • sInf (φ '' Metric.closedBall x ε) ≤ φ x - ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + hiI hIupp

Then there exists $e$ such that:

  • ( sSup ( φ '' Metric.closedBall x ε ) + sInf ( φ '' Metric.closedBall x ε ) ) / 2 = φ x + ε ^ 2 / 2 * I + e
  • $(\mathrm{loS} + \mathrm{loI}) / 2 \le e$
  • $e \le (\mathrm{hiS} + \mathrm{hiI}) / 2$
PLaplacian.extreme_avg_squeezedPlaplacian/Squeeze.lean, lines 58–78
/-- **The extreme-value average, with the error squeezed.**

The average of the supremum and infimum equals the target plus an error lying
between the averaged sandwich bounds. Since `Plaplacian.ElimMax` and
`Plaplacian.LocalizeDist` bound those, the error is controlled. -/
theorem extreme_avg_squeezed {φ : EuclSpace d → ℝ}
    {x : EuclSpace d} {ε : ℝ} {I loS hiS loI hiI : ℝ}
    (hSlow : φ x + ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + loS
        ≤ sSup (φ '' closedBall x ε))
    (hSupp : sSup (φ '' closedBall x ε)
        ≤ φ x + ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + hiS)
    (hIlow : φ x - ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + loI
        ≤ sInf (φ '' closedBall x ε))
    (hIupp : sInf (φ '' closedBall x ε)
        ≤ φ x - ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + hiI) :
    ∃ e : ℝ,
      (sSup (φ '' closedBall x ε) + sInf (φ '' closedBall x ε)) / 2
          = φ x + (ε ^ 2 / 2) * I + e
        ∧ (loS + loI) / 2 ≤ e
        ∧ e ≤ (hiS + hiI) / 2 :=
  extreme_avg_eq hSlow hSupp hIlow hIupp
theoremextreme_avg_squeezed_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$, $I, \mathrm{loS}, \mathrm{hiS}, \mathrm{loI}, \mathrm{hiI} \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \varepsilon$ hε
  • φ x + ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + loS ≤ sSup (φ '' Metric.closedBall x ε) hSlow
  • sSup (φ '' Metric.closedBall x ε) ≤ φ x + ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + hiS hSupp
  • φ x - ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + loI ≤ sInf (φ '' Metric.closedBall x ε) hIlow
  • sInf (φ '' Metric.closedBall x ε) ≤ φ x - ε * ‖gradient φ x‖ + ε ^ 2 / 2 * I + hiI hIupp

Then there exists $e$ such that:

  • ( sSup ( φ '' Metric.ball x ε ) + sInf ( φ '' Metric.ball x ε ) ) / 2 = φ x + ε ^ 2 / 2 * I + e
  • $(\mathrm{loS} + \mathrm{loI}) / 2 \le e$
  • $e \le (\mathrm{hiS} + \mathrm{hiI}) / 2$
PLaplacian.extreme_avg_squeezed_ballPlaplacian/Squeeze.lean, lines 80–101
/-- **The same on the open ball**, which is what the operator uses. -/
theorem extreme_avg_squeezed_ball {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {x : EuclSpace d} {ε : ℝ} (hε : 0 < ε)
    {I loS hiS loI hiI : ℝ}
    (hSlow : φ x + ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + loS
        ≤ sSup (φ '' closedBall x ε))
    (hSupp : sSup (φ '' closedBall x ε)
        ≤ φ x + ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + hiS)
    (hIlow : φ x - ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + loI
        ≤ sInf (φ '' closedBall x ε))
    (hIupp : sInf (φ '' closedBall x ε)
        ≤ φ x - ε * ‖gradient φ x‖ + (ε ^ 2 / 2) * I + hiI) :
    ∃ e : ℝ,
      (sSup (φ '' ball x ε) + sInf (φ '' ball x ε)) / 2
          = φ x + (ε ^ 2 / 2) * I + e
        ∧ (loS + loI) / 2 ≤ e
        ∧ e ≤ (hiS + hiI) / 2 := by
  obtain ⟨e, he, hlo, hhi⟩ :=
    extreme_avg_squeezed hSlow hSupp hIlow hIupp
  refine ⟨e, ?_, hlo, hhi⟩
  rw [sSup_ball_eq_closedBall hφ x hε, sInf_ball_eq_closedBall hφ x hε]
  exact he

Plaplacian/Stability.lean8 declarations

theoremIsViscositySubsolution.monoTheorem 2.5 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega, \Omega' \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ h
  • $\Omega' \subseteq \Omega$ hsub

Then $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega'$.

PLaplacian.IsViscositySubsolution.monoPlaplacian/Stability.lean, lines 49–57
theorem IsViscositySubsolution.mono {p : ℝ} {Ω Ω' : Set (EuclSpace d)}
    {f u : EuclSpace d → ℝ} (h : IsViscositySubsolution p Ω f u)
    (hsub : Ω' ⊆ Ω) :
    IsViscositySubsolution p Ω' f u where
  usc := h.usc.mono hsub
  regular := fun φ hφ x₀ hx₀ hmax hgrad =>
    h.regular φ hφ x₀ (hsub hx₀) hmax hgrad
  singular := fun φ hφ x₀ hx₀ hmax hgrad =>
    h.singular φ hφ x₀ (hsub hx₀) hmax hgrad
theoremIsViscositySupersolution.mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega, \Omega' \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $u\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ h
  • $\Omega' \subseteq \Omega$ hsub

Then $u\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega'$.

PLaplacian.IsViscositySupersolution.monoPlaplacian/Stability.lean, lines 59–67
theorem IsViscositySupersolution.mono {p : ℝ} {Ω Ω' : Set (EuclSpace d)}
    {f u : EuclSpace d → ℝ} (h : IsViscositySupersolution p Ω f u)
    (hsub : Ω' ⊆ Ω) :
    IsViscositySupersolution p Ω' f u where
  lsc := h.lsc.mono hsub
  regular := fun φ hφ x₀ hx₀ hmin hgrad =>
    h.regular φ hφ x₀ (hsub hx₀) hmin hgrad
  singular := fun φ hφ x₀ hx₀ hmin hgrad =>
    h.singular φ hφ x₀ (hsub hx₀) hmin hgrad
theoremIsViscositySolution.mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega, \Omega' \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{IsViscositySolution}(p, \Omega, f, u)$ h
  • $\Omega' \subseteq \Omega$ hsub

Then $\operatorname{IsViscositySolution}(p, \Omega', f, u)$.

PLaplacian.IsViscositySolution.monoPlaplacian/Stability.lean, lines 69–74
theorem IsViscositySolution.mono {p : ℝ} {Ω Ω' : Set (EuclSpace d)}
    {f u : EuclSpace d → ℝ} (h : IsViscositySolution p Ω f u)
    (hsub : Ω' ⊆ Ω) :
    IsViscositySolution p Ω' f u where
  sub := h.sub.mono hsub
  super := h.super.mono hsub
theoremgradient_add_const
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $\operatorname{gradient}(y \mapsto \varphi(y) + c, x) = \operatorname{gradient}(\varphi, x)$.

PLaplacian.gradient_add_constPlaplacian/Stability.lean, lines 78–83
/-- The gradient is unchanged by adding a constant. Mathlib has
`fderiv_add_const` but not the gradient form. -/
theorem gradient_add_const (φ : EuclSpace d → ℝ) (c : ℝ) (x : EuclSpace d) :
    gradient (fun y => φ y + c) x = gradient φ x := by
  refine ext_inner_right ℝ fun v => ?_
  rw [inner_gradient_left, inner_gradient_left, fderiv_add_const]
theoremisLocalMax_add_const
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMax}(y \mapsto u(y) - \varphi(y), x_{0})$ hmax

Then $\operatorname{IsLocalMax}(y \mapsto u(y) + c - \varphi(y), x_{0})$.

PLaplacian.isLocalMax_add_constPlaplacian/Stability.lean, lines 85–93
/-- Adding a constant preserves a local maximum of a difference. -/
theorem isLocalMax_add_const {u φ : EuclSpace d → ℝ} (c : ℝ)
    {x₀ : EuclSpace d} (hmax : IsLocalMax (fun y => u y - φ y) x₀) :
    IsLocalMax (fun y => (u y + c) - φ y) x₀ := by
  have heq : (fun y => (u y + c) - φ y) = fun y => (u y - φ y) + c := by
    funext y; ring
  rw [heq]
  filter_upwards [hmax] with y hy
  linarith [hy]
theoremupperSemicontinuousOn_add_const
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • $\operatorname{UpperSemicontinuousOn}(u, \Omega)$ h

Then $\operatorname{UpperSemicontinuousOn}(y \mapsto u(y) + c, \Omega)$.

PLaplacian.upperSemicontinuousOn_add_constPlaplacian/Stability.lean, lines 95–102
/-- Semicontinuity is preserved by adding a constant. -/
theorem upperSemicontinuousOn_add_const {u : EuclSpace d → ℝ}
    {Ω : Set (EuclSpace d)} (h : UpperSemicontinuousOn u Ω) (c : ℝ) :
    UpperSemicontinuousOn (fun y => u y + c) Ω := by
  intro x hx y hy
  have := h x hx (y - c) (by linarith)
  filter_upwards [this] with z hz
  linarith
theoremhess_add_const
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$.

Then (PLaplacian.hess fun y => φ y + c) = PLaplacian.hess φ.

/-- The Hessian is unchanged by adding a constant. -/
theorem hess_add_const (φ : EuclSpace d → ℝ) (c : ℝ) :
    hess (fun y => φ y + c) = hess φ := by
  funext x
  unfold hess
  have h1 : fderiv ℝ (fun y => φ y + c) = fderiv ℝ φ := by
    funext y
    exact fderiv_add_const c
  rw [h1]
theoremIsViscositySubsolution.add_constTheorem 2.6 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$.

Assume

  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = f\text{ in }\Omega$ h

Then PLaplacian.IsViscositySubsolution p Ω f fun y => u y + c.

PLaplacian.IsViscositySubsolution.add_constPlaplacian/Stability.lean, lines 114–155
/-- **Adding a constant preserves subsolutions.** The operator sees only the
gradient and the Hessian, both unchanged. -/
theorem IsViscositySubsolution.add_const {p : ℝ} {Ω : Set (EuclSpace d)}
    {f u : EuclSpace d → ℝ} (h : IsViscositySubsolution p Ω f u) (c : ℝ) :
    IsViscositySubsolution p Ω f (fun y => u y + c) where
  usc := upperSemicontinuousOn_add_const h.usc c
  regular := fun φ hφ x₀ hx₀ hmax hgrad => by
    have hmax' : IsLocalMax (fun y => u y - (fun z => φ z - c) y) x₀ := by
      have heq : (fun y => u y - (fun z => φ z - c) y)
          = fun y => (u y + c) - φ y := by funext y; ring
      rw [heq]
      exact hmax
    have hφ' : ContDiff ℝ 2 (fun z => φ z - c) := hφ.sub contDiff_const
    have hgrad' : gradient (fun z => φ z - c) x₀ ≠ 0 := by
      have : gradient (fun z => φ z - c) x₀ = gradient φ x₀ := by
        have heq : (fun z => φ z - c) = fun z => φ z + (-c) := by
          funext z; ring
        rw [heq, gradient_add_const]
      rwa [this]
    have hg : gradient (fun z => φ z - c) x₀ = gradient φ x₀ := by
      have heq : (fun z => φ z - c) = fun z => φ z + (-c) := by funext z; ring
      rw [heq, gradient_add_const]
    have hh : hess (fun z => φ z - c) x₀ = hess φ x₀ := by
      have heq : (fun z => φ z - c) = fun z => φ z + (-c) := by funext z; ring
      rw [heq, hess_add_const]
    have hres := h.regular (fun z => φ z - c) hφ' x₀ hx₀ hmax' hgrad'
    rwa [hg, hh] at hres
  singular := fun φ hφ x₀ hx₀ hmax hgrad => by
    have hmax' : IsLocalMax (fun y => u y - (fun z => φ z - c) y) x₀ := by
      have heq : (fun y => u y - (fun z => φ z - c) y)
          = fun y => (u y + c) - φ y := by funext y; ring
      rw [heq]; exact hmax
    have hφ' : ContDiff ℝ 2 (fun z => φ z - c) := hφ.sub contDiff_const
    have hg : gradient (fun z => φ z - c) x₀ = gradient φ x₀ := by
      have heq : (fun z => φ z - c) = fun z => φ z + (-c) := by funext z; ring
      rw [heq, gradient_add_const]
    have hh : hess (fun z => φ z - c) x₀ = hess φ x₀ := by
      have heq : (fun z => φ z - c) = fun z => φ z + (-c) := by funext z; ring
      rw [heq, hess_add_const]
    have hgrad' : gradient (fun z => φ z - c) x₀ = 0 := by rwa [hg]
    have hres := h.singular (fun z => φ z - c) hφ' x₀ hx₀ hmax' hgrad'
    rwa [hh] at hres

Plaplacian/Step2.lean3 declarations

theoremstep2_point
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam}, \mu, \eta \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\rho \in \mathbb{R}$, $r, \delta, \mathrm{δJ} \in \mathbb{R}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $0 \le \mu$ hμ
  • $\operatorname{SemiconvexWith}(\mathrm{lam}, U)$ hU
  • PLaplacian.SemiconvexWith lam fun y => -V y hV
  • PLaplacian.SemiconvexWith μ fun y => -(V y - η * V y ^ 2) hW
  • $\forall y \in B(x, \rho),\ U(y) - (V(y) - \eta \cdot V(y) ^{2}) \le U(x) - (V(x) - \eta \cdot V(x) ^{2})$ hmax
  • $0 < r$ hr0
  • $r < \rho$ hrρ
  • $0 \le \delta$ hδ0
  • $0 < \mathrm{δJ}$ hδJ
  • $2 \cdot \mathrm{δJ} \cdot r < \delta \cdot r ^{2}$ hδJr

Then there exists $y_{0}, a, b, A, B, \pi$ such that:

  • $\lVert y_{0} - x\rVert < r$
  • $\lVert \pi\rVert \le \mathrm{δJ}$
  • $\operatorname{PeanoAt}(U, y_{0}, a, A)$
  • $\operatorname{PeanoAt}(V, y_{0}, b, B)$
  • $\forall v,\ - \mathrm{lam} \cdot \lVert v\rVert ^{2} \le (A(v))(v)$
  • $\forall v,\ (B(v))(v) \le \mathrm{lam} \cdot \lVert v\rVert ^{2}$
  • $a - (1 - 2 \cdot \eta \cdot V(y_{0})) \cdot b = 2 \cdot \delta \cdot (y_{0} - x) - \pi$
  • $\operatorname{QuadLE}(A, (1 - 2 \cdot \eta \cdot V(y_{0})) \cdot B - 2 \cdot \eta \cdot \operatorname{rankOne}(b) + 2 \cdot \delta \cdot \operatorname{idForm}(d))$
/-- **A point of Jensen's set where `U` and `V` are twice differentiable.** -/
theorem step2_point {U V : EuclSpace d → ℝ} {lam μ η : ℝ} (hlam : 0 ≤ lam) (hμ : 0 ≤ μ)
    (hU : SemiconvexWith lam U) (hV : SemiconvexWith lam (fun y => -V y))
    (hW : SemiconvexWith μ (fun y => -(V y - η * V y ^ 2)))
    {x : EuclSpace d} {ρ : ℝ}
    (hmax : ∀ y ∈ ball x ρ, U y - (V y - η * V y ^ 2) ≤ U x - (V x - η * V x ^ 2))
    {r δ δJ : ℝ} (hr0 : 0 < r) (hrρ : r < ρ) (hδ0 : 0 ≤ δ) (hδJ : 0 < δJ)
    (hδJr : 2 * δJ * r < δ * r ^ 2) :
    ∃ (y₀ a b : EuclSpace d) (A B : Bilin d) (π : EuclSpace d),
      ‖y₀ - x‖ < r ∧ ‖π‖ ≤ δJ ∧ PeanoAt U y₀ a A ∧ PeanoAt V y₀ b B ∧
      (∀ v, -(lam * ‖v‖ ^ 2) ≤ (A v) v) ∧ (∀ v, (B v) v ≤ lam * ‖v‖ ^ 2) ∧
      a - (1 - 2 * η * V y₀) • b = (2 * δ) • (y₀ - x) - π ∧
      QuadLE A ((1 - 2 * η * V y₀) • B - (2 * η) • rankOne b + (2 * δ) • idForm d) := by
  -- Jensen's lemma for Z = U - W - δ|· - x|²
  have hC0 : 0 ≤ lam + μ + 2 * δ := by positivity
  have hZconv : ConvexOn ℝ univ (fun y => (U y - (V y - η * V y ^ 2) - δ * ‖y - x‖ ^ 2)
      + (lam + μ + 2 * δ) / 2 * ‖y‖ ^ 2) :=
    convexOn_Z (W := fun y => V y - η * V y ^ 2) hU hW x
  have hsphere : ∀ y, ‖y - x‖ = r →
      (U y - (V y - η * V y ^ 2) - δ * ‖y - x‖ ^ 2) + 2 * δJ * r
        < U x - (V x - η * V x ^ 2) - δ * ‖x - x‖ ^ 2 := by
    intro y hy
    have hyb : y ∈ ball x ρ := by rw [mem_ball, dist_eq_norm, hy]; exact hrρ
    have h1 := hmax y hyb
    rw [hy, sub_self, norm_zero, zero_pow two_ne_zero, mul_zero, sub_zero]
    linarith
  have hpos := jensen_positive_measure
    (fun y => U y - (V y - η * V y ^ 2) - δ * ‖y - x‖ ^ 2) (lam + μ + 2 * δ) hC0 hZconv
    x x r δJ hr0 hδJ (mem_closedBall_self hr0.le) hsphere
  -- the Alexandrov sets
  have hAU := alexandrov (d := d) (fun y => U y + lam / 2 * ‖y‖ ^ 2) hU
  have hAV := alexandrov (d := d) (fun y => -V y + lam / 2 * ‖y‖ ^ 2) hV
  obtain ⟨y₀, hy₀K, ⟨gU, XU, hTU⟩, ⟨gV, XV, hTV⟩⟩ := exists_mem_pos_ae hpos (hAU.and hAV)
  obtain ⟨hy₀b, π, hπ, hπmax⟩ := hy₀K
  have hy₀x : ‖y₀ - x‖ < r := by rw [mem_ball, dist_eq_norm] at hy₀b; exact hy₀b
  -- the expansions of U and V
  have hPU : PeanoAt U y₀ (gU - lam • y₀) (XU - lam • idForm d) := by
    have h := peanoAt_sub_halfsq (peanoAt_of_twiceDiffAt hTU) lam
    intro ε hε
    obtain ⟨δ', hδ', hb⟩ := h ε hε
    refine ⟨δ', hδ', fun k hk => ?_⟩
    have := hb k hk
    simpa only [add_sub_cancel_right] using this
  have hPV : PeanoAt V y₀ (lam • y₀ - gV) (lam • idForm d - XV) := by
    have h := peanoAt_halfsq_sub (peanoAt_of_twiceDiffAt hTV) lam
    have e : ∀ y : EuclSpace d, lam / 2 * ‖y‖ ^ 2 - (-V y + lam / 2 * ‖y‖ ^ 2) = V y :=
      fun y => by ring
    intro ε hε
    obtain ⟨δ', hδ', hb⟩ := h ε hε
    refine ⟨δ', hδ', fun k hk => ?_⟩
    have := hb k hk
    simpa only [e] using this
  -- the Hessian bounds
  have hXU := convex_twiceDiff_nonneg hU hTU
  have hXV := convex_twiceDiff_nonneg hV hTV
  have hAv : ∀ v, -(lam * ‖v‖ ^ 2) ≤ ((XU - lam • idForm d) v) v := fun v => by
    simp only [sub_apply, smul_apply, smul_eq_mul, idForm_apply]
    linarith [hXU v]
  have hBv : ∀ v, ((lam • idForm d - XV) v) v ≤ lam * ‖v‖ ^ 2 := fun v => by
    simp only [sub_apply, smul_apply, smul_eq_mul, idForm_apply]
    linarith [hXV v]
  -- the expansion of F, and its maximum at y₀
  have hPF := peanoAt_add (peanoAt_sub hPU (peanoAt_cv hPV η)) (peanoAt_quadlin x y₀ π δ)
  have hFmax : ∀ᶠ z in 𝓝 y₀,
      (fun y => (U y - (V y - η * V y ^ 2)) + (-δ * ‖y - x‖ ^ 2 + inner ℝ π y)) z
        ≤ (fun y => (U y - (V y - η * V y ^ 2)) + (-δ * ‖y - x‖ ^ 2 + inner ℝ π y)) y₀ := by
    filter_upwards [isOpen_ball.mem_nhds hy₀b] with z hz
    have h1 : U z - (V z - η * V z ^ 2) - δ * ‖z - x‖ ^ 2 + inner ℝ π z
        ≤ U y₀ - (V y₀ - η * V y₀ ^ 2) - δ * ‖y₀ - x‖ ^ 2 + inner ℝ π y₀ :=
      hπmax z (ball_subset_closedBall hz)
    change (U z - (V z - η * V z ^ 2)) + (-δ * ‖z - x‖ ^ 2 + inner ℝ π z)
      ≤ (U y₀ - (V y₀ - η * V y₀ ^ 2)) + (-δ * ‖y₀ - x‖ ^ 2 + inner ℝ π y₀)
    linarith
  obtain ⟨hgrad, hhess⟩ := max_peano hPF hFmax
  refine ⟨y₀, gU - lam • y₀, lam • y₀ - gV, XU - lam • idForm d, lam • idForm d - XV, π,
    hy₀x, hπ, hPU, hPV, hAv, hBv, ?_, ?_⟩
  · exact sub_eq_zero.1 (by rw [← hgrad]; abel)
  · intro v
    have h := hhess v
    simp only [add_apply, sub_apply, smul_apply, smul_eq_mul, idForm_apply] at h ⊢
    linarith
theoremstep2_chain
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $a, b \in \mathbb{R}^{d}$, $A, B \in \operatorname{Bilin}(d)$, $c, \eta, \delta, \mathrm{lam}, \mathrm{Cc}, Q \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \eta$ hη
  • $0 < c$ hc0
  • $c \le \mathrm{Cc}$ hcC
  • $0 \le \mathrm{lam}$ hlam
  • $0 < \delta$ hδ0
  • $\delta \le 1 / 2$ hδ1
  • $0 < Q$ hQ
  • $0 \le \operatorname{normPLapOf}(p, a, A)$ hUi
  • $\operatorname{normPLapOf}(p, b, B) \le 0$ hVi
  • $\operatorname{QuadLE}(A, c \cdot B - 2 \cdot \eta \cdot \operatorname{rankOne}(b) + 2 \cdot \delta \cdot \operatorname{idForm}(d))$ hquad
  • $\forall v,\ - \mathrm{lam} \cdot \lVert v\rVert ^{2} \le (A(v))(v)$ hAv
  • $\forall v,\ (B(v))(v) \le \mathrm{lam} \cdot \lVert v\rVert ^{2}$ hBv
  • $\lVert a - c \cdot b\rVert \le 3 \cdot \delta$ hab
  • $Q / 2 \le \lVert c \cdot b\rVert$ hcb
  • $a \ne 0$ ha0

Then $2 \cdot \eta \cdot (p - 1) \cdot \lVert b\rVert ^{2} \le 2 \cdot \delta \cdot (d + p - 2) + (p - 2) \cdot (2 \cdot (\mathrm{lam} \cdot (1 + \mathrm{Cc}) + 1) \cdot 12 \cdot \delta / Q)$.

/-- **The operator chain at the point.** -/
theorem step2_chain {p : ℝ} (hp : 2 ≤ p) {a b : EuclSpace d} {A B : Bilin d}
    {c η δ lam Cc Q : ℝ} (hη : 0 < η) (hc0 : 0 < c) (hcC : c ≤ Cc) (hlam : 0 ≤ lam)
    (hδ0 : 0 < δ) (hδ1 : δ ≤ 1 / 2) (hQ : 0 < Q)
    (hUi : 0 ≤ normPLapOf p a A) (hVi : normPLapOf p b B ≤ 0)
    (hquad : QuadLE A (c • B - (2 * η) • rankOne b + (2 * δ) • idForm d))
    (hAv : ∀ v, -(lam * ‖v‖ ^ 2) ≤ (A v) v) (hBv : ∀ v, (B v) v ≤ lam * ‖v‖ ^ 2)
    (hab : ‖a - c • b‖ ≤ 3 * δ) (hcb : Q / 2 ≤ ‖c • b‖) (ha0 : a ≠ 0) :
    2 * η * (p - 1) * ‖b‖ ^ 2
      ≤ 2 * δ * ((d : ℝ) + p - 2) + (p - 2) * (2 * (lam * (1 + Cc) + 1) * (12 * δ / Q)) := by
  have hcb0 : c • b ≠ 0 := by
    intro h; rw [h, norm_zero] at hcb; linarith
  have hb0 : b ≠ 0 := by
    intro h; apply hcb0; rw [h, smul_zero]
  have hp2 : 0 ≤ p - 2 := by linarith
  have hCc : 0 < Cc := lt_of_lt_of_le hc0 hcC
  set L0 := lam * (1 + Cc) + 1 with hL0
  have hL00 : 0 ≤ L0 := by positivity
  -- the quadratic bound on Y
  have hYv : ∀ v, |((c • B - (2 * η) • rankOne b + (2 * δ) • idForm d) v) v|
      ≤ L0 * ‖v‖ ^ 2 := by
    intro v
    have hv2 : 0 ≤ ‖v‖ ^ 2 := by positivity
    have hlo : -(L0 * ‖v‖ ^ 2) ≤ ((c • B - (2 * η) • rankOne b + (2 * δ) • idForm d) v) v := by
      have h1 := hquad v
      have h2 := hAv v
      have h3 : lam * ‖v‖ ^ 2 ≤ L0 * ‖v‖ ^ 2 := by
        apply mul_le_mul_of_nonneg_right _ hv2
        rw [hL0]; nlinarith
      linarith
    have hhi : ((c • B - (2 * η) • rankOne b + (2 * δ) • idForm d) v) v ≤ L0 * ‖v‖ ^ 2 := by
      simp only [add_apply, sub_apply, smul_apply, smul_eq_mul, rankOne_apply, idForm_apply]
      have h1 : c * (B v) v ≤ c * (lam * ‖v‖ ^ 2) := mul_le_mul_of_nonneg_left (hBv v) hc0.le
      have h2 : c * (lam * ‖v‖ ^ 2) ≤ Cc * (lam * ‖v‖ ^ 2) :=
        mul_le_mul_of_nonneg_right hcC (by positivity)
      have h3 : 0 ≤ 2 * η * (inner ℝ b v * inner ℝ b v) := by
        have := mul_self_nonneg (inner ℝ b v)
        positivity
      have h4 : 2 * δ * ‖v‖ ^ 2 ≤ 1 * ‖v‖ ^ 2 :=
        mul_le_mul_of_nonneg_right (by linarith) hv2
      have h5 : Cc * (lam * ‖v‖ ^ 2) + 1 * ‖v‖ ^ 2 ≤ L0 * ‖v‖ ^ 2 := by
        rw [hL0]; nlinarith
      linarith
    exact abs_le.2 ⟨hlo, hhi⟩
  -- the five estimates
  have e2 := normPLapOf_mono hp hquad a
  have e3 := (abs_le.1 (normPLapOf_dir hp ha0 hcb0 hL00 hYv)).2
  have e4 := normPLapOf_add_id (p := p) hcb0 (c • B - (2 * η) • rankOne b) (2 * δ)
  have e5 := normPLapOf_cv_strict hp hb0 hc0 hη.le hVi
  rw [e4] at e3
  -- the direction term
  have hdiv : 2 * ‖a - c • b‖ / ‖c • b‖ ≤ 12 * δ / Q := by
    rw [div_le_div_iff₀ (by positivity) hQ]
    have := mul_le_mul hab hcb (by positivity) (by positivity)
    nlinarith
  have hdirm : (p - 2) * (2 * L0 * (2 * ‖a - c • b‖ / ‖c • b‖))
      ≤ (p - 2) * (2 * L0 * (12 * δ / Q)) :=
    mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hdiv (by positivity)) hp2
  linarith
theoremstep2Theorem 6.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam}, \mu, \eta, \mathrm{Cc} \in \mathbb{R}$, $O \subseteq \mathbb{R}^{d}$, $x \in \mathbb{R}^{d}$, $\rho \in \mathbb{R}$, $q \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 \le \mathrm{lam}$ hlam
  • $0 \le \mu$ hμ
  • $0 < \eta$ hη
  • $\operatorname{SemiconvexWith}(\mathrm{lam}, U)$ hU
  • PLaplacian.SemiconvexWith lam fun y => -V y hV
  • PLaplacian.SemiconvexWith μ fun y => -(V y - η * V y ^ 2) hW
  • ∀ y ∈ O, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SuperJet U y → q ≠ 0 → PLaplacian.viscF p q X ≤ 0 hUjet
  • ∀ y ∈ O, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SubJet V y → q ≠ 0 → 0 ≤ PLaplacian.viscF p q X hVjet
  • $\forall y \in O,\ 0 < 1 - 2 \cdot \eta \cdot V(y)$ hc
  • $\forall y \in O,\ 1 - 2 \cdot \eta \cdot V(y) \le \mathrm{Cc}$ hCc
  • $0 < \rho$ hρ
  • $B(x, \rho) \subseteq O$ hball
  • $\forall y \in B(x, \rho),\ U(y) - (V(y) - \eta \cdot V(y) ^{2}) \le U(x) - (V(x) - \eta \cdot V(x) ^{2})$ hmax
  • $\forall y,\ U(x) + \operatorname{inner}(\mathbb{R}, q, y - x) - \mathrm{lam} / 2 \cdot \lVert y - x\rVert ^{2} \le U(y)$ hq

Then $q = 0$.

/-- **At a maximum of `U - ψ(V)`, the common gradient is zero.** -/
theorem step2 (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {U V : EuclSpace d → ℝ} {lam μ η Cc : ℝ}
    (hlam : 0 ≤ lam) (hμ : 0 ≤ μ) (hη : 0 < η)
    (hU : SemiconvexWith lam U) (hV : SemiconvexWith lam (fun y => -V y))
    (hW : SemiconvexWith μ (fun y => -(V y - η * V y ^ 2)))
    {O : Set (EuclSpace d)}
    (hUjet : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d), (q, X) ∈ SuperJet U y →
      q ≠ 0 → viscF p q X ≤ 0)
    (hVjet : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d), (q, X) ∈ SubJet V y →
      q ≠ 0 → 0 ≤ viscF p q X)
    (hc : ∀ y ∈ O, 0 < 1 - 2 * η * V y) (hCc : ∀ y ∈ O, 1 - 2 * η * V y ≤ Cc)
    {x : EuclSpace d} {ρ : ℝ} (hρ : 0 < ρ) (hball : ball x ρ ⊆ O)
    (hmax : ∀ y ∈ ball x ρ, U y - (V y - η * V y ^ 2) ≤ U x - (V x - η * V x ^ 2))
    {q : EuclSpace d}
    (hq : ∀ y, U x + inner ℝ q (y - x) - lam / 2 * ‖y - x‖ ^ 2 ≤ U y) :
    q = 0 := by
  by_contra hq0
  have hQ : 0 < ‖q‖ := norm_pos_iff.2 hq0
  have hxO : x ∈ O := hball (mem_ball_self hρ)
  have hCc0 : 0 < Cc := lt_of_lt_of_le (hc x hxO) (hCc x hxO)
  have hp2 : 0 ≤ p - 2 := by linarith
  have hd1 : (1 : ℝ) ≤ d := by exact_mod_cast hd
  have hD0 : 0 < (d : ℝ) + p - 2 := by linarith
  have hL00 : 0 ≤ lam * (1 + Cc) + 1 := by positivity
  set κ := 2 * η * (p - 1) * (‖q‖ / (2 * Cc)) ^ 2 with hκ
  have hκ0 : 0 < κ := by
    have : 0 < p - 1 := by linarith
    positivity
  -- the parameters
  set r := min (ρ / 4) (min 1 (‖q‖ / (2 * (lam + 2 * μ + 3)))) with hr
  have hr0 : 0 < r := lt_min (by positivity) (lt_min one_pos (by positivity))
  have hrρ : r ≤ ρ / 4 := min_le_left _ _
  have hr1 : r ≤ 1 := le_trans (min_le_right _ _) (min_le_left _ _)
  have hrq : r ≤ ‖q‖ / (2 * (lam + 2 * μ + 3)) :=
    le_trans (min_le_right _ _) (min_le_right _ _)
  set δ := min (1 / 2) (min (κ / (6 * ((d : ℝ) + p - 2)))
    (κ * ‖q‖ / (72 * ((p - 2) * (lam * (1 + Cc) + 1) + 1)))) with hδ
  have hδ0 : 0 < δ := lt_min (by norm_num) (lt_min (by positivity) (by positivity))
  have hδ1 : δ ≤ 1 / 2 := min_le_left _ _
  have hδ2 : δ ≤ κ / (6 * ((d : ℝ) + p - 2)) := le_trans (min_le_right _ _) (min_le_left _ _)
  have hδ3 : δ ≤ κ * ‖q‖ / (72 * ((p - 2) * (lam * (1 + Cc) + 1) + 1)) :=
    le_trans (min_le_right _ _) (min_le_right _ _)
  set δJ := δ * r / 4 with hδJ
  have hδJ0 : 0 < δJ := by positivity
  have hδJr : 2 * δJ * r < δ * r ^ 2 := by
    rw [hδJ]
    have : 0 < δ * r ^ 2 := by positivity
    nlinarith
  -- the point
  obtain ⟨y₀, a, b, A, B, π, hy₀x, hπ, hPU, hPV, hAv, hBv, hgr, hquad⟩ :=
    step2_point hlam hμ hU hV hW hmax hr0 (by linarith) hδ0.le hδJ0 hδJr
  have hy₀O : y₀ ∈ O := hball (by rw [mem_ball, dist_eq_norm]; linarith)
  set c := 1 - 2 * η * V y₀ with hcdef
  have hc0 : 0 < c := hc y₀ hy₀O
  have hcC : c ≤ Cc := hCc y₀ hy₀O
  -- the gradient relation, in norm
  have hπn : ‖(2 * δ) • (y₀ - x) - π‖ ≤ 2 * δ * ‖y₀ - x‖ + δJ := by
    calc ‖(2 * δ) • (y₀ - x) - π‖ ≤ ‖(2 * δ) • (y₀ - x)‖ + ‖π‖ := norm_sub_le _ _
      _ = 2 * δ * ‖y₀ - x‖ + ‖π‖ := by
          rw [norm_smul, Real.norm_eq_abs, abs_of_pos (by positivity)]
      _ ≤ 2 * δ * ‖y₀ - x‖ + δJ := by linarith
  have hδy : 2 * δ * ‖y₀ - x‖ ≤ 2 * δ * r :=
    mul_le_mul_of_nonneg_left hy₀x.le (by positivity)
  have hδJδ : δJ ≤ δ := by rw [hδJ]; nlinarith
  have hδJr' : δJ ≤ r := by rw [hδJ]; nlinarith
  have h2δr : 2 * δ * r ≤ r := by nlinarith
  have h2δ : 2 * δ * r ≤ 2 * δ := by nlinarith
  have hab_n : ‖a - c • b‖ ≤ 3 * δ := by rw [hgr]; linarith
  have hab_r : ‖a - c • b‖ ≤ 2 * r := by rw [hgr]; linarith
  -- the gradient estimate
  have hsupp := semiconvex_subJet_support hU (twiceDiffAt_of_peanoAt hPU).2
  have hgest := grad_est (W := fun y => V y - η * V y ^ 2) hlam hμ hρ hW hmax hq
    (by linarith : ‖y₀ - x‖ < ρ / 3) hsupp
  have hgest' : ‖a - q‖ ≤ (lam + 2 * μ) * r :=
    hgest.trans (mul_le_mul_of_nonneg_left hy₀x.le (by positivity))
  have hrq' : (lam + 2 * μ + 2) * r ≤ ‖q‖ / 2 := by
    have := (le_div_iff₀ (by positivity : (0 : ℝ) < 2 * (lam + 2 * μ + 3))).1 hrq
    nlinarith
  -- the gradients are bounded below
  have hq_a : ‖q‖ ≤ ‖a - q‖ + ‖a‖ := by
    have := norm_sub_le a (a - q)
    rw [sub_sub_cancel] at this
    linarith
  have ha_cb : ‖a‖ ≤ ‖a - c • b‖ + ‖c • b‖ := by
    have := norm_sub_le (a - c • b) (-(c • b))
    rw [sub_neg_eq_add, sub_add_cancel, norm_neg] at this
    exact this
  have hcb : ‖q‖ / 2 ≤ ‖c • b‖ := by linarith
  have ha0 : a ≠ 0 := by
    intro h
    rw [h, zero_sub, norm_neg] at hgest'
    linarith
  have hcbn : ‖c • b‖ = c * ‖b‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_pos hc0]
  have hbq : ‖q‖ / (2 * Cc) ≤ ‖b‖ := by
    rw [div_le_iff₀ (by positivity)]
    have : c * ‖b‖ ≤ Cc * ‖b‖ := mul_le_mul_of_nonneg_right hcC (norm_nonneg _)
    linarith
  have hbκ : κ ≤ 2 * η * (p - 1) * ‖b‖ ^ 2 := by
    rw [hκ]
    have h1 : (‖q‖ / (2 * Cc)) ^ 2 ≤ ‖b‖ ^ 2 := by
      rw [sq, sq]; exact mul_self_le_mul_self (by positivity) hbq
    exact mul_le_mul_of_nonneg_left h1 (by have : 0 < p - 1 := (by linarith); positivity)
  -- the jet inequalities
  have hUi := hUjet y₀ hy₀O a A (twiceDiffAt_of_peanoAt hPU).1 ha0
  have hb0 : b ≠ 0 := by
    intro h; rw [h, smul_zero, norm_zero] at hcb; linarith
  have hVi := hVjet y₀ hy₀O b B (twiceDiffAt_of_peanoAt hPV).2 hb0
  rw [viscF_eq_neg] at hUi hVi
  -- the chain
  have hchain := step2_chain hp hη hc0 hcC hlam hδ0 hδ1 hQ (by linarith) (by linarith)
    hquad hAv hBv hab_n hcb ha0
  -- the right side is at most 2κ/3
  have hδD : 2 * δ * ((d : ℝ) + p - 2) ≤ κ / 3 := by
    have := (le_div_iff₀ (by positivity : (0 : ℝ) < 6 * ((d : ℝ) + p - 2))).1 hδ2
    linarith
  have hdir : (p - 2) * (2 * (lam * (1 + Cc) + 1) * (12 * δ / ‖q‖)) ≤ κ / 3 := by
    have h2 : (p - 2) * (2 * (lam * (1 + Cc) + 1) * (12 * δ / ‖q‖))
        = 24 * ((p - 2) * (lam * (1 + Cc) + 1) * δ) / ‖q‖ := by ring
    have h3 : δ * (72 * ((p - 2) * (lam * (1 + Cc) + 1) + 1)) ≤ κ * ‖q‖ :=
      (le_div_iff₀ (by positivity)).1 hδ3
    rw [h2, div_le_iff₀ hQ]
    have : 0 ≤ δ := hδ0.le
    linarith
  linarith

Plaplacian/Step2Prelim.lean7 declarations

theorempeanoAt_add
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f, g \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, \mathrm{gf}, \mathrm{gg} \in \mathbb{R}^{d}$, $\mathrm{Xf}, \mathrm{Xg} \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{PeanoAt}(f, x, \mathrm{gf}, \mathrm{Xf})$ hf
  • $\operatorname{PeanoAt}(g, x, \mathrm{gg}, \mathrm{Xg})$ hg

Then $\operatorname{PeanoAt}(y \mapsto f(y) + g(y), x, \mathrm{gf} + \mathrm{gg}, \mathrm{Xf} + \mathrm{Xg})$.

theorem peanoAt_add {f g : EuclSpace d → ℝ} {x gf gg : EuclSpace d} {Xf Xg : Bilin d}
    (hf : PeanoAt f x gf Xf) (hg : PeanoAt g x gg Xg) :
    PeanoAt (fun y => f y + g y) x (gf + gg) (Xf + Xg) := by
  intro ε hε
  obtain ⟨δ₁, hδ₁, h1⟩ := hf (ε / 2) (by positivity)
  obtain ⟨δ₂, hδ₂, h2⟩ := hg (ε / 2) (by positivity)
  refine ⟨min δ₁ δ₂, lt_min hδ₁ hδ₂, fun k hk => ?_⟩
  have a1 := h1 k (lt_of_lt_of_le hk (min_le_left _ _))
  have a2 := h2 k (lt_of_lt_of_le hk (min_le_right _ _))
  change |(f (x + k) + g (x + k)) - (f x + g x) - inner ℝ (gf + gg) k
    - 1 / 2 * ((Xf + Xg) k) k| ≤ ε * ‖k‖ ^ 2
  rw [inner_add_left, add_apply, add_apply]
  obtain ⟨b1, b2⟩ := abs_le.1 a1
  obtain ⟨c1, c2⟩ := abs_le.1 a2
  rw [abs_le]
  constructor <;> linarith
theorempeanoAt_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f, g \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, \mathrm{gf}, \mathrm{gg} \in \mathbb{R}^{d}$, $\mathrm{Xf}, \mathrm{Xg} \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{PeanoAt}(f, x, \mathrm{gf}, \mathrm{Xf})$ hf
  • $\operatorname{PeanoAt}(g, x, \mathrm{gg}, \mathrm{Xg})$ hg

Then $\operatorname{PeanoAt}(y \mapsto f(y) - g(y), x, \mathrm{gf} - \mathrm{gg}, \mathrm{Xf} - \mathrm{Xg})$.

theorem peanoAt_sub {f g : EuclSpace d → ℝ} {x gf gg : EuclSpace d} {Xf Xg : Bilin d}
    (hf : PeanoAt f x gf Xf) (hg : PeanoAt g x gg Xg) :
    PeanoAt (fun y => f y - g y) x (gf - gg) (Xf - Xg) := by
  intro ε hε
  obtain ⟨δ₁, hδ₁, h1⟩ := hf (ε / 2) (by positivity)
  obtain ⟨δ₂, hδ₂, h2⟩ := hg (ε / 2) (by positivity)
  refine ⟨min δ₁ δ₂, lt_min hδ₁ hδ₂, fun k hk => ?_⟩
  have a1 := h1 k (lt_of_lt_of_le hk (min_le_left _ _))
  have a2 := h2 k (lt_of_lt_of_le hk (min_le_right _ _))
  change |(f (x + k) - g (x + k)) - (f x - g x) - inner ℝ (gf - gg) k
    - 1 / 2 * ((Xf - Xg) k) k| ≤ ε * ‖k‖ ^ 2
  rw [inner_sub_left, sub_apply, sub_apply]
  obtain ⟨b1, b2⟩ := abs_le.1 a1
  obtain ⟨c1, c2⟩ := abs_le.1 a2
  rw [abs_le]
  constructor <;> linarith
theorempeanoAt_quadlin
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y_{0}, \pi \in \mathbb{R}^{d}$, $\delta \in \mathbb{R}$.

Then $\operatorname{PeanoAt}(y \mapsto - \delta \cdot \lVert y - x\rVert ^{2} + \operatorname{inner}(\mathbb{R}, \pi, y), y_{0}, \pi - 2 \cdot \delta \cdot (y_{0} - x), - 2 \cdot \delta \cdot \operatorname{idForm}(d))$.

/-- **The exact expansion of the penalty and the tilt.** -/
theorem peanoAt_quadlin (x y₀ π : EuclSpace d) (δ : ℝ) :
    PeanoAt (fun y => -δ * ‖y - x‖ ^ 2 + inner ℝ π y) y₀
      (π - (2 * δ) • (y₀ - x)) ((-2 * δ) • idForm d) := by
  intro ε hε
  refine ⟨1, one_pos, fun k _ => ?_⟩
  change |(-δ * ‖y₀ + k - x‖ ^ 2 + inner ℝ π (y₀ + k)) - (-δ * ‖y₀ - x‖ ^ 2 + inner ℝ π y₀)
    - inner ℝ (π - (2 * δ) • (y₀ - x)) k - 1 / 2 * (((-2 * δ) • idForm d) k) k|
      ≤ ε * ‖k‖ ^ 2
  have e : y₀ + k - x = (y₀ - x) + k := by abel
  rw [e, norm_add_sq_real, inner_add_right, inner_sub_left π ((2 * δ) • (y₀ - x)) k,
    real_inner_smul_left, smul_apply, smul_apply, smul_eq_mul, idForm_apply]
  have key : (-δ * (‖y₀ - x‖ ^ 2 + 2 * inner ℝ (y₀ - x) k + ‖k‖ ^ 2)
      + (inner ℝ π y₀ + inner ℝ π k)) - (-δ * ‖y₀ - x‖ ^ 2 + inner ℝ π y₀)
      - (inner ℝ π k - 2 * δ * inner ℝ (y₀ - x) k) - 1 / 2 * (-2 * δ * ‖k‖ ^ 2) = 0 := by
    ring
  rw [key, abs_zero]
  positivity
theoremmax_peano
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $y, g \in \mathbb{R}^{d}$, $G \in \operatorname{Bilin}(d)$.

Assume

  • $\operatorname{PeanoAt}(F, y, g, G)$ hF
  • ∀ᶠ (z : EuclSpace d) in nhds y, F z ≤ F y hmax

Then all of the following hold:

  • $g = 0$
  • $\forall v,\ (G(v))(v) \le 0$
/-- **At a local maximum, an expansion has gradient zero and Hessian `≤ 0`.** -/
theorem max_peano {F : EuclSpace d → ℝ} {y g : EuclSpace d} {G : Bilin d}
    (hF : PeanoAt F y g G) (hmax : ∀ᶠ z in 𝓝 y, F z ≤ F y) :
    g = 0 ∧ ∀ v, (G v) v ≤ 0 := by
  obtain ⟨r₀, hr₀, hball⟩ := Metric.eventually_nhds_iff.1 hmax
  -- the lower expansion along t w
  have key : ∀ (w : EuclSpace d) (ε : ℝ), 0 < ε → ∃ t > 0,
      t * inner ℝ g w + 1 / 2 * t ^ 2 * (G w) w - ε * t ^ 2 * ‖w‖ ^ 2 ≤ 0 ∧
      ∀ s, 0 < s → s ≤ t →
        s * inner ℝ g w + 1 / 2 * s ^ 2 * (G w) w - ε * s ^ 2 * ‖w‖ ^ 2 ≤ 0 := by
    intro w ε hε
    obtain ⟨δ, hδ, hb⟩ := hF ε hε
    set t := min δ r₀ / (2 * (‖w‖ + 1)) with ht
    have ht0 : 0 < t := by positivity
    have hs : ∀ s, 0 < s → s ≤ t →
        s * inner ℝ g w + 1 / 2 * s ^ 2 * (G w) w - ε * s ^ 2 * ‖w‖ ^ 2 ≤ 0 := by
      intro s hs0 hst
      have hsw : ‖s • w‖ < min δ r₀ := by
        rw [norm_smul, Real.norm_eq_abs, abs_of_pos hs0]
        have h1 : s * (2 * (‖w‖ + 1)) ≤ min δ r₀ := (le_div_iff₀ (by positivity)).1 hst
        have hm : 0 < min δ r₀ := lt_min hδ hr₀
        nlinarith [norm_nonneg w]
      have a1 := hb (s • w) (lt_of_lt_of_le hsw (min_le_left _ _))
      have a2 : F (y + s • w) ≤ F y := hball (by
        rw [dist_eq_norm]
        have e : y + s • w - y = s • w := by abel
        rw [e]; exact lt_of_lt_of_le hsw (min_le_right _ _))
      have hGs : (G (s • w)) (s • w) = s * (s * (G w) w) := by
        simp only [map_smul, smul_apply, smul_eq_mul]
      rw [real_inner_smul_right, hGs, norm_smul, Real.norm_eq_abs, abs_of_pos hs0] at a1
      have := (abs_le.1 a1).1
      nlinarith
    exact ⟨t, ht0, hs t ht0 le_rfl, hs⟩
  -- the gradient vanishes
  have hg : g = 0 := by
    by_contra hne
    have hgn : 0 < ‖g‖ := norm_pos_iff.2 hne
    obtain ⟨t, ht0, _, hs⟩ := key g 1 one_pos
    rw [real_inner_self_eq_norm_sq] at hs
    set s := min t (‖g‖ ^ 2 / (2 * (|(G g) g| + ‖g‖ ^ 2 + 1))) with hsdef
    have hs0 : 0 < s := lt_min ht0 (by positivity)
    have h1 := hs s hs0 (min_le_left _ _)
    have h2 : s ≤ ‖g‖ ^ 2 / (2 * (|(G g) g| + ‖g‖ ^ 2 + 1)) := min_le_right _ _
    have h3 : s * (2 * (|(G g) g| + ‖g‖ ^ 2 + 1)) ≤ ‖g‖ ^ 2 := (le_div_iff₀ (by positivity)).1 h2
    have h4' : -((G g) g) ≤ |(G g) g| := neg_le_abs _
    have h45 : -(1 / 2 * s ^ 2 * (G g) g) ≤ s ^ 2 * |(G g) g| := by
      have := mul_le_mul_of_nonneg_left h4' (sq_nonneg s)
      have h0 : 0 ≤ s ^ 2 * |(G g) g| := by positivity
      linarith
    -- s ‖g‖² ≤ s² (‖g‖² + |G g g|), so ‖g‖² ≤ s (‖g‖² + |G g g|) < ‖g‖²
    have h5 : s * ‖g‖ ^ 2 ≤ s ^ 2 * (‖g‖ ^ 2 + |(G g) g|) := by linarith
    have h6 : ‖g‖ ^ 2 ≤ s * (‖g‖ ^ 2 + |(G g) g|) := by
      have := h5
      have hs2 : s ^ 2 = s * s := by ring
      rw [hs2, mul_assoc] at this
      exact le_of_mul_le_mul_left this hs0
    have hg2 : 0 < ‖g‖ ^ 2 := pow_pos hgn 2
    nlinarith [abs_nonneg ((G g) g)]
  refine ⟨hg, fun v => ?_⟩
  by_contra hpos
  push Not at hpos
  set κ := (G v) v with hκ
  have hv : v ≠ 0 := by
    intro h; rw [h] at hκ; simp at hκ; linarith
  set ε := κ / (4 * (‖v‖ ^ 2 + 1)) with hεdef
  have hε : 0 < ε := by positivity
  obtain ⟨t, ht0, h1, _⟩ := key v ε hε
  rw [hg, inner_zero_left, mul_zero, zero_add] at h1
  have h2 : ε * ‖v‖ ^ 2 ≤ κ / 4 := by
    rw [hεdef, div_mul_eq_mul_div, div_le_div_iff₀ (by positivity) (by norm_num)]
    nlinarith [sq_nonneg ‖v‖]
  have h3 : t ^ 2 * (1 / 2 * κ - ε * ‖v‖ ^ 2) ≤ 0 := by nlinarith
  have h4 : 0 < t ^ 2 * (1 / 2 * κ - ε * ‖v‖ ^ 2) := by
    apply mul_pos (by positivity); linarith
  linarith
theoremconvexOn_affine
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $c, c_{0} \in \mathbb{R}$.

Then ConvexOn ℝ Set.univ fun y => c * inner ℝ x y + c₀.

/-- An affine function is convex. -/
theorem convexOn_affine (x : EuclSpace d) (c c₀ : ℝ) :
    ConvexOn ℝ univ (fun y : EuclSpace d => c * inner ℝ x y + c₀) := by
  refine ⟨convex_univ, fun y₁ _ y₂ _ a b ha hb hab => ?_⟩
  simp only [smul_eq_mul, inner_add_right, real_inner_smul_right]
  have : c₀ = a * c₀ + b * c₀ := by rw [← add_mul, hab, one_mul]
  nlinarith
theoremconvexOn_Z
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, W \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam}, \mu, \delta \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{SemiconvexWith}(\mathrm{lam}, U)$ hU
  • PLaplacian.SemiconvexWith μ fun y => -W y hW

Then ConvexOn ℝ Set.univ fun y => U y - W y - δ * ‖y - x‖ ^ 2 + (lam + μ + 2 * δ) / 2 * ‖y‖ ^ 2.

/-- **`U - W - δ‖· - x‖²` is semiconvex**, with constant `λ + μ + 2δ`. -/
theorem convexOn_Z {U W : EuclSpace d → ℝ} {lam μ δ : ℝ} (hU : SemiconvexWith lam U)
    (hW : SemiconvexWith μ (fun y => -W y)) (x : EuclSpace d) :
    ConvexOn ℝ univ (fun y => (U y - W y - δ * ‖y - x‖ ^ 2)
      + (lam + μ + 2 * δ) / 2 * ‖y‖ ^ 2) := by
  have h := (hU.add hW).add (convexOn_affine x (2 * δ) (-δ * ‖x‖ ^ 2))
  refine h.congr fun y _ => ?_
  simp only [Pi.add_apply]
  have e : ‖y - x‖ ^ 2 = ‖y‖ ^ 2 - 2 * inner ℝ x y + ‖x‖ ^ 2 := by
    rw [norm_sub_sq_real, real_inner_comm]
  rw [e]
  ring
theoremexists_mem_pos_ae
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $K \subseteq \mathbb{R}^{d}$, $P \colon \mathbb{R}^{d} \to \mathrm{Prop}$.

Assume

  • $0 < \lambda(K)$ hK
  • $\forall ᵐ, y,\ P(y)$ hP

Then there exists $y \in K$ such that:

  • $P(y)$
theorem exists_mem_pos_ae {K : Set (EuclSpace d)} {P : EuclSpace d → Prop}
    (hK : 0 < volume K) (hP : ∀ᵐ y ∂(volume : Measure (EuclSpace d)), P y) :
    ∃ y ∈ K, P y := by
  by_contra hcon
  push Not at hcon
  have hsub : K ⊆ {y | ¬ P y} := fun y hy => hcon y hy
  have h0 : volume K = 0 := measure_mono_null hsub (ae_iff.1 hP)
  exact (ne_of_gt hK) h0

Plaplacian/Step3.lean1 declarations

theoremstep3Theorem 6.4 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam}, \mu, \eta, \mathrm{Cc} \in \mathbb{R}$, $O \subseteq \mathbb{R}^{d}$, $G \subseteq \mathbb{R}^{d}$, $R_{0} \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 \le \mathrm{lam}$ hlam
  • $0 \le \mu$ hμ
  • $0 < \eta$ hη
  • $\operatorname{SemiconvexWith}(\mathrm{lam}, U)$ hU
  • PLaplacian.SemiconvexWith lam fun y => -V y hV
  • PLaplacian.SemiconvexWith μ fun y => -(V y - η * V y ^ 2) hW
  • $U\text{ is continuous}$ hUc
  • $V\text{ is continuous}$ hVc
  • ∀ y ∈ O, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SuperJet U y → q ≠ 0 → PLaplacian.viscF p q X ≤ 0 hUjet
  • ∀ y ∈ O, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SuperJet (fun z => -V z) y → q ≠ 0 → PLaplacian.viscF p q X ≤ 0 hVneg
  • $\forall y \in O,\ 0 < 1 - 2 \cdot \eta \cdot V(y)$ hc
  • $\forall y \in O,\ 1 - 2 \cdot \eta \cdot V(y) \le \mathrm{Cc}$ hCc
  • $G\text{ is open}$ hGo
  • $G\text{ is bounded}$ hGb
  • $G\text{ is nonempty}$ hne
  • $\operatorname{IsPreconnected}(G)$ hGc
  • $0 < R_{0}$ hR₀
  • $\forall x \in \overline{G},\ B(x, R_{0}) \subseteq O$ hGO
  • $x_{0} \in G$ hx₀
  • $\forall z \in \partial G,\ U(z) - (V(z) - \eta \cdot V(z) ^{2}) < U(x_{0}) - (V(x_{0}) - \eta \cdot V(x_{0}) ^{2})$ hgap

Then $\mathrm{False}$.

/-- **The third step.** -/
theorem step3 (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {U V : EuclSpace d → ℝ} {lam μ η Cc : ℝ}
    (hlam : 0 ≤ lam) (hμ : 0 ≤ μ) (hη : 0 < η)
    (hU : SemiconvexWith lam U) (hV : SemiconvexWith lam (fun y => -V y))
    (hW : SemiconvexWith μ (fun y => -(V y - η * V y ^ 2)))
    (hUc : Continuous U) (hVc : Continuous V)
    {O : Set (EuclSpace d)}
    (hUjet : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d), (q, X) ∈ SuperJet U y →
      q ≠ 0 → viscF p q X ≤ 0)
    (hVneg : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d),
      (q, X) ∈ SuperJet (fun z => -V z) y → q ≠ 0 → viscF p q X ≤ 0)
    (hc : ∀ y ∈ O, 0 < 1 - 2 * η * V y) (hCc : ∀ y ∈ O, 1 - 2 * η * V y ≤ Cc)
    {G : Set (EuclSpace d)} (hGo : IsOpen G) (hGb : Bornology.IsBounded G)
    (hne : G.Nonempty) (hGc : IsPreconnected G)
    {R₀ : ℝ} (hR₀ : 0 < R₀) (hGO : ∀ x ∈ closure G, ball x R₀ ⊆ O)
    {x₀ : EuclSpace d} (hx₀ : x₀ ∈ G)
    (hgap : ∀ z ∈ frontier G, U z - (V z - η * V z ^ 2) < U x₀ - (V x₀ - η * V x₀ ^ 2)) :
    False := by
  obtain ⟨h₁, hh₁, hconst, hint⟩ := Mfun_const hd hp hlam hμ hη hU hV hW hUc hVc hUjet hVneg
    hc hCc hGo hGb hne hR₀ hGO hx₀ hgap
  set M0 := Mfun U V η G 0 with hM0
  have hf0c : Continuous (fun z => U z - (V z - η * V z ^ 2)) := by fun_prop
  -- the bound by M(h), and its value
  have hleM : ∀ h, ‖h‖ < h₁ → ∀ x ∈ closure G, U (x + h) - (V x - η * V x ^ 2) ≤ M0 := by
    intro h hh x hx
    obtain ⟨_, _, _, hle⟩ := Mfun_attained (η := η) hUc hVc hGb hne h
    rw [← hconst h hh]
    exact hle x hx
  -- the contact set
  set K := {x | x ∈ G ∧ U x - (V x - η * V x ^ 2) = M0} with hKdef
  have hKne : (G ∩ K).Nonempty := by
    obtain ⟨xh, hxh, hxhM, _⟩ := Mfun_attained (η := η) hUc hVc hGb hne 0
    have hxhG : xh ∈ G := hint 0 (by rw [norm_zero]; exact hh₁) xh hxh hxhM
    rw [add_zero] at hxhM
    exact ⟨xh, hxhG, hxhG, hxhM⟩
  -- the semicontinuity needed by the strong principles
  have hUusc : UpperSemicontinuousOn U O := hUc.upperSemicontinuous.upperSemicontinuousOn O
  have hVusc : UpperSemicontinuousOn (fun z => -V z) O :=
    hVc.neg.upperSemicontinuous.upperSemicontinuousOn O
  -- K is open
  have hKo : IsOpen K := by
    rw [Metric.isOpen_iff]
    rintro x ⟨hxG, hxM⟩
    obtain ⟨ρ₁, hρ₁, hρ₁G⟩ := Metric.isOpen_iff.1 hGo x hxG
    set R := min h₁ (min ρ₁ R₀) with hR
    have hR0 : 0 < R := lt_min hh₁ (lt_min hρ₁ hR₀)
    have hRG : ball x R ⊆ G :=
      fun y hy => hρ₁G (ball_subset_ball (le_trans (min_le_right _ _) (min_le_left _ _)) hy)
    have hRO : ball x R ⊆ O := fun y hy =>
      hGO x (subset_closure hxG)
        (ball_subset_ball (le_trans (min_le_right _ _) (min_le_right _ _)) hy)
    have hRh : ∀ y ∈ ball x R, ‖y - x‖ < h₁ := by
      intro y hy
      rw [mem_ball, dist_eq_norm] at hy
      exact lt_of_lt_of_le hy (min_le_left _ _)
    -- U has a local maximum at x
    have hUmax : ∀ y ∈ ball x R, U y ≤ U x := by
      intro y hy
      have h1 := hleM (y - x) (hRh y hy) x (subset_closure hxG)
      have e : x + (y - x) = y := by abel
      rw [e] at h1
      linarith
    -- V has a local minimum at x
    have hVmin : ∀ y ∈ ball x R, -V y ≤ -V x := by
      intro y hy
      have hy' : ‖x - y‖ < h₁ := by rw [norm_sub_rev]; exact hRh y hy
      have h1 := hleM (x - y) hy' y (subset_closure (hRG hy))
      have e : y + (x - y) = x := by abel
      rw [e] at h1
      have hW : V x - η * V x ^ 2 ≤ V y - η * V y ^ 2 := by linarith
      have := psi_mono (hc x (hRO (mem_ball_self hR0))) (hc y (hRO hy)) hW
      linarith
    have hUconst := smp_ball_jet hd hp hUusc hUjet hR0 hRO hUmax
    have hVconst := smp_ball_jet hd hp hVusc hVneg hR0 hRO hVmin
    refine ⟨R / 3, by positivity, fun y hy => ⟨hRG (ball_subset_ball (by linarith) hy), ?_⟩⟩
    have h1 := hUconst y hy
    have h2 : V y = V x := by have := hVconst y hy; linarith
    rw [h1, h2]
    exact hxM
  -- the complement in G is open
  have hSo : IsOpen {x | U x - (V x - η * V x ^ 2) ≠ M0} :=
    isOpen_ne_fun hf0c continuous_const
  have hdisj : Disjoint K {x | U x - (V x - η * V x ^ 2) ≠ M0} :=
    Set.disjoint_left.2 fun x hxK hxS => hxS hxK.2
  have hcover : G ⊆ K ∪ {x | U x - (V x - η * V x ^ 2) ≠ M0} := by
    intro x hx
    by_cases h : U x - (V x - η * V x ^ 2) = M0
    · exact Or.inl ⟨hx, h⟩
    · exact Or.inr h
  -- connectedness
  have hGK : G ⊆ K :=
    IsPreconnected.subset_left_of_subset_union hKo hSo hdisj hcover hKne hGc
  have hclosed : closure G ⊆ {x | U x - (V x - η * V x ^ 2) = M0} := by
    apply closure_minimal _ (isClosed_eq hf0c continuous_const)
    intro x hx
    exact (hGK hx).2
  -- the contradiction at a frontier point
  obtain ⟨z, hz⟩ := frontier_nonempty hd hGo hGb hne
  have h1 : U z - (V z - η * V z ^ 2) = M0 := hclosed (frontier_subset_closure hz)
  have h2 := hleM 0 (by rw [norm_zero]; exact hh₁) x₀ (subset_closure hx₀)
  rw [add_zero] at h2
  have h3 := hgap z hz
  linarith

Plaplacian/Step3M.lean5 declarations

defMfun
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\eta \in \mathbb{R}$, $G \subseteq \mathbb{R}^{d}$, $h \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The translated maximum.** -/
def Mfun (U V : EuclSpace d → ℝ) (η : ℝ) (G : Set (EuclSpace d)) (h : EuclSpace d) : ℝ :=
  sSup ((fun x => U (x + h) - (V x - η * V x ^ 2)) '' closure G)
theoremMfun_attained
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\eta \in \mathbb{R}$, $G \subseteq \mathbb{R}^{d}$, $h \in \mathbb{R}^{d}$.

Assume

  • $U\text{ is continuous}$ hUc
  • $V\text{ is continuous}$ hVc
  • $G\text{ is bounded}$ hGb
  • $G\text{ is nonempty}$ hne

Then there exists $\mathrm{xh} \in \overline{G}$ such that:

  • $U(\mathrm{xh} + h) - (V(\mathrm{xh}) - \eta \cdot V(\mathrm{xh}) ^{2}) = \operatorname{Mfun}(U, V, \eta, G, h)$
  • $\forall x \in \overline{G},\ U(x + h) - (V(x) - \eta \cdot V(x) ^{2}) \le \operatorname{Mfun}(U, V, \eta, G, h)$
/-- **The translated maximum is attained.** -/
theorem Mfun_attained (hUc : Continuous U) (hVc : Continuous V)
    (hGb : Bornology.IsBounded G) (hne : G.Nonempty) (h : EuclSpace d) :
    ∃ xh ∈ closure G, U (xh + h) - (V xh - η * V xh ^ 2) = Mfun U V η G h ∧
      ∀ x ∈ closure G, U (x + h) - (V x - η * V x ^ 2) ≤ Mfun U V η G h := by
  have hK : IsCompact (closure G) := hGb.isCompact_closure
  have hcont : Continuous (fun x => U (x + h) - (V x - η * V x ^ 2)) := by fun_prop
  obtain ⟨xh, hxh, hmax⟩ := hK.exists_isMaxOn (hne.mono subset_closure) hcont.continuousOn
  have hle : ∀ x ∈ closure G, U (x + h) - (V x - η * V x ^ 2)
      ≤ U (xh + h) - (V xh - η * V xh ^ 2) := fun x hx => hmax hx
  have hbdd : BddAbove ((fun x => U (x + h) - (V x - η * V x ^ 2)) '' closure G) := by
    refine ⟨U (xh + h) - (V xh - η * V xh ^ 2), ?_⟩
    rintro _ ⟨x, hx, rfl⟩
    exact hle x hx
  have hM : Mfun U V η G h = U (xh + h) - (V xh - η * V xh ^ 2) := by
    unfold Mfun
    refine le_antisymm (csSup_le ((hne.mono subset_closure).image _) ?_)
      (le_csSup hbdd ⟨xh, hxh, rfl⟩)
    rintro _ ⟨x, hx, rfl⟩
    exact hle x hx
  refine ⟨xh, hxh, hM.symm, fun x hx => ?_⟩
  rw [hM]
  exact hle x hx
theoremMfun_interior
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\eta \in \mathbb{R}$, $G \subseteq \mathbb{R}^{d}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $U\text{ is continuous}$ hUc
  • $V\text{ is continuous}$ hVc
  • $G\text{ is open}$ hGo
  • $G\text{ is bounded}$ hGb
  • $G\text{ is nonempty}$ hne
  • $x_{0} \in G$ hx₀
  • $\forall z \in \partial G,\ U(z) - (V(z) - \eta \cdot V(z) ^{2}) < U(x_{0}) - (V(x_{0}) - \eta \cdot V(x_{0}) ^{2})$ hgap

Then there exists $h_{0} > 0$ such that:

  • $\forall h,\ \lVert h\rVert < h_{0} \to \forall x \in \overline{G},\ U(x + h) - (V(x) - \eta \cdot V(x) ^{2}) = \operatorname{Mfun}(U, V, \eta, G, h) \to x \in G$
/-- **Maximizers are interior for small translations.** -/
theorem Mfun_interior (hUc : Continuous U) (hVc : Continuous V) (hGo : IsOpen G)
    (hGb : Bornology.IsBounded G) (hne : G.Nonempty) {x₀ : EuclSpace d} (hx₀ : x₀ ∈ G)
    (hgap : ∀ z ∈ frontier G, U z - (V z - η * V z ^ 2) < U x₀ - (V x₀ - η * V x₀ ^ 2)) :
    ∃ h₀ > 0, ∀ h, ‖h‖ < h₀ → ∀ x ∈ closure G,
      U (x + h) - (V x - η * V x ^ 2) = Mfun U V η G h → x ∈ G := by
  have hK : IsCompact (closure G) := hGb.isCompact_closure
  have hf0 : Continuous (fun z => U z - (V z - η * V z ^ 2)) := by fun_prop
  -- a definite gap on the frontier
  obtain ⟨γ, hγ, hgapγ⟩ : ∃ γ > 0, ∀ z ∈ frontier G,
      U z - (V z - η * V z ^ 2) ≤ U x₀ - (V x₀ - η * V x₀ ^ 2) - γ := by
    by_cases hfr : (frontier G).Nonempty
    · have hFc : IsCompact (frontier G) :=
        hK.of_isClosed_subset isClosed_frontier frontier_subset_closure
      obtain ⟨z₀, hz₀, hzmax⟩ := hFc.exists_isMaxOn hfr hf0.continuousOn
      have h1 := hgap z₀ hz₀
      refine ⟨U x₀ - (V x₀ - η * V x₀ ^ 2) - (U z₀ - (V z₀ - η * V z₀ ^ 2)), by linarith,
        fun z hz => ?_⟩
      have : U z - (V z - η * V z ^ 2) ≤ U z₀ - (V z₀ - η * V z₀ ^ 2) := hzmax hz
      linarith
    · refine ⟨1, one_pos, fun z hz => absurd ⟨z, hz⟩ hfr⟩
  -- uniform continuity of U near Ḡ
  have hKt : IsCompact (closure G + closedBall (0 : EuclSpace d) 1) :=
    hK.add (isCompact_closedBall 0 1)
  have hUu := hKt.uniformContinuousOn_of_continuous hUc.continuousOn
  obtain ⟨δ₁, hδ₁, hu⟩ := Metric.uniformContinuousOn_iff.1 hUu (γ / 2) (by positivity)
  have hclose : ∀ h : EuclSpace d, ‖h‖ < min 1 δ₁ → ∀ y ∈ closure G,
      |U (y + h) - U y| < γ / 2 := by
    intro h hh y hy
    have h1 : y + h ∈ closure G + closedBall (0 : EuclSpace d) 1 :=
      add_mem_add hy (mem_closedBall_zero_iff.2 (le_trans hh.le (min_le_left _ _)))
    have h2 : y ∈ closure G + closedBall (0 : EuclSpace d) 1 := by
      have := add_mem_add hy (mem_closedBall_self (x := (0 : EuclSpace d)) zero_le_one)
      rwa [add_zero] at this
    have h3 : dist (y + h) y < δ₁ := by
      rw [dist_eq_norm, add_sub_cancel_left]
      exact lt_of_lt_of_le hh (min_le_right _ _)
    have := hu _ h1 _ h2 h3
    rwa [Real.dist_eq] at this
  refine ⟨min 1 δ₁, lt_min one_pos hδ₁, fun h hh x hx hxM => ?_⟩
  by_contra hxG
  have hxF : x ∈ frontier G := ⟨hx, by rw [hGo.interior_eq]; exact hxG⟩
  have h1 := hgapγ x hxF
  have h2 := hclose h hh x hx
  have h3 := hclose h hh x₀ (subset_closure hx₀)
  obtain ⟨_, _, _, hle⟩ := Mfun_attained (η := η) hUc hVc hGb hne h
  have h4 := hle x₀ (subset_closure hx₀)
  obtain ⟨a1, a2⟩ := abs_le.1 h2.le
  obtain ⟨b1, b2⟩ := abs_lt.1 h3
  obtain ⟨c1, c2⟩ := abs_lt.1 h2
  linarith
theoremMfun_lower
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\eta \in \mathbb{R}$, $G \subseteq \mathbb{R}^{d}$, $p \in \mathbb{R}$, $\mathrm{lam}, \mu, \mathrm{Cc} \in \mathbb{R}$, $O \subseteq \mathbb{R}^{d}$, $R_{0} \in \mathbb{R}$, $h \in \mathbb{R}^{d}$, $k \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 \le \mathrm{lam}$ hlam
  • $0 \le \mu$ hμ
  • $0 < \eta$ hη
  • $\operatorname{SemiconvexWith}(\mathrm{lam}, U)$ hU
  • PLaplacian.SemiconvexWith lam fun y => -V y hV
  • PLaplacian.SemiconvexWith μ fun y => -(V y - η * V y ^ 2) hW
  • $U\text{ is continuous}$ hUc
  • $V\text{ is continuous}$ hVc
  • ∀ y ∈ O, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SuperJet U y → q ≠ 0 → PLaplacian.viscF p q X ≤ 0 hUjet
  • ∀ y ∈ O, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SuperJet (fun z => -V z) y → q ≠ 0 → PLaplacian.viscF p q X ≤ 0 hVneg
  • $\forall y \in O,\ 0 < 1 - 2 \cdot \eta \cdot V(y)$ hc
  • $\forall y \in O,\ 1 - 2 \cdot \eta \cdot V(y) \le \mathrm{Cc}$ hCc
  • $G\text{ is open}$ hGo
  • $G\text{ is bounded}$ hGb
  • $G\text{ is nonempty}$ hne
  • $0 < R_{0}$ hR₀
  • $\forall x \in \overline{G},\ B(x, R_{0}) \subseteq O$ hGO
  • $\lVert h\rVert < R_{0} / 2$ hh
  • $\forall x \in \overline{G},\ U(x + h) - (V(x) - \eta \cdot V(x) ^{2}) = \operatorname{Mfun}(U, V, \eta, G, h) \to x \in G$ hint

Then $\operatorname{Mfun}(U, V, \eta, G, h) - \mathrm{lam} / 2 \cdot \lVert k\rVert ^{2} \le \operatorname{Mfun}(U, V, \eta, G, h + k)$.

/-- **`M(h + k) ≥ M(h) - (λ/2)|k|²` for small `h`.** -/
theorem Mfun_lower (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {lam μ Cc : ℝ}
    (hlam : 0 ≤ lam) (hμ : 0 ≤ μ) (hη : 0 < η)
    (hU : SemiconvexWith lam U) (hV : SemiconvexWith lam (fun y => -V y))
    (hW : SemiconvexWith μ (fun y => -(V y - η * V y ^ 2)))
    (hUc : Continuous U) (hVc : Continuous V)
    {O : Set (EuclSpace d)}
    (hUjet : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d), (q, X) ∈ SuperJet U y →
      q ≠ 0 → viscF p q X ≤ 0)
    (hVneg : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d),
      (q, X) ∈ SuperJet (fun z => -V z) y → q ≠ 0 → viscF p q X ≤ 0)
    (hc : ∀ y ∈ O, 0 < 1 - 2 * η * V y) (hCc : ∀ y ∈ O, 1 - 2 * η * V y ≤ Cc)
    (hGo : IsOpen G) (hGb : Bornology.IsBounded G) (hne : G.Nonempty)
    {R₀ : ℝ} (hR₀ : 0 < R₀) (hGO : ∀ x ∈ closure G, ball x R₀ ⊆ O)
    {h : EuclSpace d} (hh : ‖h‖ < R₀ / 2)
    (hint : ∀ x ∈ closure G, U (x + h) - (V x - η * V x ^ 2) = Mfun U V η G h → x ∈ G) :
    ∀ k, Mfun U V η G h - lam / 2 * ‖k‖ ^ 2 ≤ Mfun U V η G (h + k) := by
  obtain ⟨xh, hxh, hxhM, hle⟩ := Mfun_attained (η := η) hUc hVc hGb hne h
  have hxhG : xh ∈ G := hint xh hxh hxhM
  obtain ⟨ρ₁, hρ₁, hρ₁G⟩ := Metric.isOpen_iff.1 hGo xh hxhG
  set ρ := min ρ₁ (R₀ / 2) with hρ
  have hρ0 : 0 < ρ := lt_min hρ₁ (by positivity)
  -- the ball around xh: inside G, and inside O together with its translate
  have hballG : ball xh ρ ⊆ G := fun y hy => hρ₁G (ball_subset_ball (min_le_left _ _) hy)
  have hO1 : ∀ y ∈ ball xh ρ, y ∈ O := fun y hy =>
    hGO xh hxh (ball_subset_ball (by linarith [min_le_right ρ₁ (R₀ / 2)]) hy)
  have hO2 : ∀ y ∈ ball xh ρ, y + h ∈ O := by
    intro y hy
    apply hGO xh hxh
    rw [mem_ball] at hy ⊢
    calc dist (y + h) xh ≤ dist y xh + dist (y + h) y := by
          have := dist_triangle (y + h) y xh
          linarith
      _ = dist y xh + ‖h‖ := by rw [dist_eq_norm (y + h) y, add_sub_cancel_left]
      _ < R₀ / 2 + R₀ / 2 := by
          have : ρ ≤ R₀ / 2 := min_le_right _ _
          linarith
      _ = R₀ := by ring
  -- the hypotheses of the second step for U(· + h)
  have hUjet' : ∀ y ∈ ball xh ρ, ∀ (q : EuclSpace d) (X : Bilin d),
      (q, X) ∈ SuperJet (fun z => U (z + h)) y → q ≠ 0 → viscF p q X ≤ 0 :=
    fun y hy q X hj hq => hUjet (y + h) (hO2 y hy) q X (superJet_translate hj) hq
  have hVjetO := subJet_ineq_of_neg hVneg
  have hVjet' : ∀ y ∈ ball xh ρ, ∀ (q : EuclSpace d) (X : Bilin d),
      (q, X) ∈ SubJet V y → q ≠ 0 → 0 ≤ viscF p q X :=
    fun y hy => hVjetO y (hO1 y hy)
  have hc' : ∀ y ∈ ball xh ρ, 0 < 1 - 2 * η * V y := fun y hy => hc y (hO1 y hy)
  have hCc' : ∀ y ∈ ball xh ρ, 1 - 2 * η * V y ≤ Cc := fun y hy => hCc y (hO1 y hy)
  have hmax' : ∀ y ∈ ball xh ρ, U (y + h) - (V y - η * V y ^ 2)
      ≤ U (xh + h) - (V xh - η * V xh ^ 2) := by
    intro y hy
    rw [hxhM]
    exact hle y (subset_closure (hballG hy))
  -- the lower support of U(· + h) at xh is zero
  obtain ⟨q, hq⟩ := semiconvex_support (semiconvex_translate hU h) xh
  have hq' : ∀ y, U (xh + h) + inner ℝ q (y - xh) - lam / 2 * ‖y - xh‖ ^ 2 ≤ U (y + h) := hq
  have hq0 : q = 0 := step2 hd hp hlam hμ hη (semiconvex_translate hU h) hV hW
    hUjet' hVjet' hc' hCc' hρ0 (subset_refl _) hmax' hq'
  -- the lower bound
  intro k
  have h1 := hq' (xh + k)
  rw [hq0, inner_zero_left, add_zero] at h1
  have e1 : xh + k - xh = k := by abel
  rw [e1] at h1
  obtain ⟨_, _, _, hle'⟩ := Mfun_attained (η := η) hUc hVc hGb hne (h + k)
  have h2 := hle' xh hxh
  have e2 : xh + (h + k) = xh + k + h := by abel
  rw [e2] at h2
  rw [← hxhM]
  linarith
theoremMfun_const
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\eta \in \mathbb{R}$, $G \subseteq \mathbb{R}^{d}$, $p \in \mathbb{R}$, $\mathrm{lam}, \mu, \mathrm{Cc} \in \mathbb{R}$, $O \subseteq \mathbb{R}^{d}$, $R_{0} \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 \le \mathrm{lam}$ hlam
  • $0 \le \mu$ hμ
  • $0 < \eta$ hη
  • $\operatorname{SemiconvexWith}(\mathrm{lam}, U)$ hU
  • PLaplacian.SemiconvexWith lam fun y => -V y hV
  • PLaplacian.SemiconvexWith μ fun y => -(V y - η * V y ^ 2) hW
  • $U\text{ is continuous}$ hUc
  • $V\text{ is continuous}$ hVc
  • ∀ y ∈ O, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SuperJet U y → q ≠ 0 → PLaplacian.viscF p q X ≤ 0 hUjet
  • ∀ y ∈ O, ∀ (q : EuclSpace d) (X : PLaplacian.Bilin d), (q, X) ∈ PLaplacian.SuperJet (fun z => -V z) y → q ≠ 0 → PLaplacian.viscF p q X ≤ 0 hVneg
  • $\forall y \in O,\ 0 < 1 - 2 \cdot \eta \cdot V(y)$ hc
  • $\forall y \in O,\ 1 - 2 \cdot \eta \cdot V(y) \le \mathrm{Cc}$ hCc
  • $G\text{ is open}$ hGo
  • $G\text{ is bounded}$ hGb
  • $G\text{ is nonempty}$ hne
  • $0 < R_{0}$ hR₀
  • $\forall x \in \overline{G},\ B(x, R_{0}) \subseteq O$ hGO
  • $x_{0} \in G$ hx₀
  • $\forall z \in \partial G,\ U(z) - (V(z) - \eta \cdot V(z) ^{2}) < U(x_{0}) - (V(x_{0}) - \eta \cdot V(x_{0}) ^{2})$ hgap

Then there exists $h_{1} > 0$ such that:

  • $\forall h,\ \lVert h\rVert < h_{1} \to \operatorname{Mfun}(U, V, \eta, G, h) = \operatorname{Mfun}(U, V, \eta, G, 0)$
  • $\forall h,\ \lVert h\rVert < h_{1} \to \forall x \in \overline{G},\ U(x + h) - (V(x) - \eta \cdot V(x) ^{2}) = \operatorname{Mfun}(U, V, \eta, G, h) \to x \in G$
/-- **The translated maximum is constant near `0`.** -/
theorem Mfun_const (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {lam μ Cc : ℝ}
    (hlam : 0 ≤ lam) (hμ : 0 ≤ μ) (hη : 0 < η)
    (hU : SemiconvexWith lam U) (hV : SemiconvexWith lam (fun y => -V y))
    (hW : SemiconvexWith μ (fun y => -(V y - η * V y ^ 2)))
    (hUc : Continuous U) (hVc : Continuous V)
    {O : Set (EuclSpace d)}
    (hUjet : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d), (q, X) ∈ SuperJet U y →
      q ≠ 0 → viscF p q X ≤ 0)
    (hVneg : ∀ y ∈ O, ∀ (q : EuclSpace d) (X : Bilin d),
      (q, X) ∈ SuperJet (fun z => -V z) y → q ≠ 0 → viscF p q X ≤ 0)
    (hc : ∀ y ∈ O, 0 < 1 - 2 * η * V y) (hCc : ∀ y ∈ O, 1 - 2 * η * V y ≤ Cc)
    (hGo : IsOpen G) (hGb : Bornology.IsBounded G) (hne : G.Nonempty)
    {R₀ : ℝ} (hR₀ : 0 < R₀) (hGO : ∀ x ∈ closure G, ball x R₀ ⊆ O)
    {x₀ : EuclSpace d} (hx₀ : x₀ ∈ G)
    (hgap : ∀ z ∈ frontier G, U z - (V z - η * V z ^ 2) < U x₀ - (V x₀ - η * V x₀ ^ 2)) :
    ∃ h₁ > 0, (∀ h, ‖h‖ < h₁ → Mfun U V η G h = Mfun U V η G 0) ∧
      (∀ h, ‖h‖ < h₁ → ∀ x ∈ closure G,
        U (x + h) - (V x - η * V x ^ 2) = Mfun U V η G h → x ∈ G) := by
  obtain ⟨h₀, hh₀, hint⟩ := Mfun_interior (η := η) hUc hVc hGo hGb hne hx₀ hgap
  set h₁ := min h₀ (R₀ / 2) with hh₁def
  have hh₁ : 0 < h₁ := lt_min hh₀ (by positivity)
  have hint' : ∀ h, ‖h‖ < h₁ → ∀ x ∈ closure G,
      U (x + h) - (V x - η * V x ^ 2) = Mfun U V η G h → x ∈ G :=
    fun h hh => hint h (lt_of_lt_of_le hh (min_le_left _ _))
  have hlow : ∀ h ∈ ball (0 : EuclSpace d) h₁, ∀ k,
      Mfun U V η G h - lam / 2 * ‖k‖ ^ 2 ≤ Mfun U V η G (h + k) := by
    intro h hh
    rw [mem_ball_zero_iff] at hh
    exact Mfun_lower hd hp hlam hμ hη hU hV hW hUc hVc hUjet hVneg hc hCc hGo hGb hne hR₀ hGO
      (lt_of_lt_of_le hh (min_le_right _ _)) (hint' h hh)
  have hC : 0 ≤ lam / 2 := by positivity
  have hmono := const_of_quad_lower (g := Mfun U V η G) hC hlow
  refine ⟨h₁, hh₁, fun h hh => ?_, hint'⟩
  have h0 : (0 : EuclSpace d) ∈ ball (0 : EuclSpace d) h₁ := mem_ball_self hh₁
  have hb : h ∈ ball (0 : EuclSpace d) h₁ := mem_ball_zero_iff.2 hh
  exact le_antisymm (hmono h hb 0 h0) (hmono 0 h0 h hb)

Plaplacian/Step3Tools.lean5 declarations

theoremsemiconvex_translate
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $U \colon \mathbb{R}^{d} \to \mathbb{R}$, $a \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{SemiconvexWith}(\mathrm{lam}, U)$ h

Then PLaplacian.SemiconvexWith lam fun y => U (y + a).

PLaplacian.semiconvex_translatePlaplacian/Step3Tools.lean, lines 34–48
/-- **Translation preserves semiconvexity.** -/
theorem semiconvex_translate {lam : ℝ} {U : EuclSpace d → ℝ} (h : SemiconvexWith lam U)
    (a : EuclSpace d) : SemiconvexWith lam (fun y => U (y + a)) := by
  have h1 : ConvexOn ℝ univ (fun y => U (y + a) + lam / 2 * ‖y + a‖ ^ 2) := by
    refine ⟨convex_univ, fun y₁ _ y₂ _ s t hs ht hst => ?_⟩
    have h0 := h.2 (mem_univ (y₁ + a)) (mem_univ (y₂ + a)) hs ht hst
    have e : s • (y₁ + a) + t • (y₂ + a) = s • y₁ + t • y₂ + (s + t) • a := by module
    rw [hst, one_smul] at e
    rw [e] at h0
    exact h0
  have h2 := convexOn_affine a (-lam) (-(lam / 2) * ‖a‖ ^ 2)
  refine (h1.add h2).congr fun y _ => ?_
  simp only [Pi.add_apply]
  rw [norm_add_sq_real, real_inner_comm]
  ring
theoremsuperJet_translate
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $a, y, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • (q, X) ∈ PLaplacian.SuperJet (fun z => u (z + a)) y h

Then (q, X) ∈ PLaplacian.SuperJet u (y + a).

PLaplacian.superJet_translatePlaplacian/Step3Tools.lean, lines 50–66
/-- **A superjet of a translate is a superjet at the translated point.** -/
theorem superJet_translate {u : EuclSpace d → ℝ} {a y q : EuclSpace d} {X : Bilin d}
    (h : (q, X) ∈ SuperJet (fun z => u (z + a)) y) : (q, X) ∈ SuperJet u (y + a) := by
  have h' : ∀ η > 0, ∀ᶠ z in 𝓝 y, u (z + a) ≤ u (y + a) + inner ℝ q (z - y)
      + 1 / 2 * (X (z - y)) (z - y) + η * ‖z - y‖ ^ 2 := h
  intro η hη
  have hT : Tendsto (fun z : EuclSpace d => z - a) (𝓝 (y + a)) (𝓝 y) := by
    have h0 : Continuous (fun z : EuclSpace d => z - a) := by fun_prop
    have := h0.tendsto (y + a)
    simpa using this
  filter_upwards [hT.eventually (h' η hη)] with z hz
  have e1 : z - a + a = z := sub_add_cancel z a
  have e2 : z - a - y = z - (y + a) := by abel
  rw [e1, e2] at hz
  change u z ≤ u (y + a) + inner ℝ q (z - (y + a)) + 1 / 2 * (X (z - (y + a))) (z - (y + a))
    + η * ‖z - (y + a)‖ ^ 2
  exact hz
theoremconst_of_quad_lower
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $g \colon \mathbb{R}^{d} \to \mathbb{R}$, $C, \rho \in \mathbb{R}$, $h_{1} \in \mathbb{R}^{d}$, $h_{2} \in \mathbb{R}^{d}$.

Assume

  • $0 \le C$ hC
  • $\forall h_{1} \in B(0, \rho),\ \forall k,\ g(h_{1}) - C \cdot \lVert k\rVert ^{2} \le g(h_{1} + k)$ h
  • $h_{1} \in B(0, \rho)$ a._@._internal._hyg.0
  • $h_{2} \in B(0, \rho)$ a._@._internal._hyg.0

Then $g(h_{1}) \le g(h_{2})$.

PLaplacian.const_of_quad_lowerPlaplacian/Step3Tools.lean, lines 70–138
/-- **A function that loses at most `C|k|²` per step is constant on a ball.** -/
theorem const_of_quad_lower {g : EuclSpace d → ℝ} {C ρ : ℝ} (hC : 0 ≤ C)
    (h : ∀ h₁ ∈ ball (0 : EuclSpace d) ρ, ∀ k, g h₁ - C * ‖k‖ ^ 2 ≤ g (h₁ + k)) :
    ∀ h₁ ∈ ball (0 : EuclSpace d) ρ, ∀ h₂ ∈ ball (0 : EuclSpace d) ρ, g h₁ ≤ g h₂ := by
  intro h₁ hh₁ h₂ hh₂
  set Δ := h₂ - h₁ with hΔ
  -- the points of the subdivision lie in the ball
  have hmem : ∀ t : ℝ, 0 ≤ t → t ≤ 1 → h₁ + t • Δ ∈ ball (0 : EuclSpace d) ρ := by
    intro t ht0 ht1
    have := (convex_ball (0 : EuclSpace d) ρ) hh₁ hh₂ (by linarith : (0 : ℝ) ≤ 1 - t) ht0
      (by ring : (1 - t) + t = 1)
    have e : (1 - t) • h₁ + t • h₂ = h₁ + t • Δ := by rw [hΔ]; module
    rwa [e] at this
  -- the loss after j of N steps
  have key : ∀ N : ℕ, 0 < N → g h₁ - C * ‖Δ‖ ^ 2 / N ≤ g h₂ := by
    intro N hN
    have hNr : (0 : ℝ) < N := by exact_mod_cast hN
    have step : ∀ j : ℕ, j ≤ N →
        g h₁ - C * j * ‖Δ‖ ^ 2 / (N : ℝ) ^ 2 ≤ g (h₁ + ((j : ℝ) / N) • Δ) := by
      intro j
      induction j with
      | zero => intro _; simp
      | succ j ih =>
        intro hj
        have ih' := ih (by omega)
        have hjN : ((j : ℝ) / N) ≤ 1 := by
          rw [div_le_one hNr]; exact_mod_cast (by omega : j ≤ N)
        have hP := hmem ((j : ℝ) / N) (by positivity) hjN
        have h1 := h _ hP ((1 / (N : ℝ)) • Δ)
        have e : h₁ + ((j : ℝ) / N) • Δ + (1 / (N : ℝ)) • Δ
            = h₁ + (((j + 1 : ℕ) : ℝ) / N) • Δ := by
          rw [add_assoc, ← add_smul]
          congr 2
          push_cast
          ring
        rw [e] at h1
        have hk : ‖(1 / (N : ℝ)) • Δ‖ ^ 2 = ‖Δ‖ ^ 2 / (N : ℝ) ^ 2 := by
          rw [norm_smul, Real.norm_eq_abs, abs_of_pos (by positivity)]
          field_simp
        rw [hk] at h1
        have e2 : C * ((j + 1 : ℕ) : ℝ) * ‖Δ‖ ^ 2 / (N : ℝ) ^ 2
            = C * j * ‖Δ‖ ^ 2 / (N : ℝ) ^ 2 + C * (‖Δ‖ ^ 2 / (N : ℝ) ^ 2) := by
          push_cast; ring
        rw [e2]
        linarith
    have hN' := step N le_rfl
    have e : h₁ + ((N : ℝ) / N) • Δ = h₂ := by
      rw [div_self hNr.ne', one_smul, hΔ]; abel
    rw [e] at hN'
    have e2 : C * (N : ℝ) * ‖Δ‖ ^ 2 / (N : ℝ) ^ 2 = C * ‖Δ‖ ^ 2 / N := by
      field_simp
    rw [e2] at hN'
    exact hN'
  -- let N grow
  by_contra hcon
  push Not at hcon
  set gap := g h₁ - g h₂ with hgap
  have hgap0 : 0 < gap := by linarith
  obtain ⟨N, hN⟩ := exists_nat_gt (C * ‖Δ‖ ^ 2 / gap)
  have hN0 : 0 < N := by
    have : (0 : ℝ) ≤ C * ‖Δ‖ ^ 2 / gap := by positivity
    exact_mod_cast (lt_of_le_of_lt this hN)
  have h1 := key N hN0
  have hNr : (0 : ℝ) < N := by exact_mod_cast hN0
  have h2 : C * ‖Δ‖ ^ 2 / N < gap := by
    rw [div_lt_iff₀ hNr]
    have := (div_lt_iff₀ hgap0).1 hN
    linarith
  linarith
theoremfrontier_nonempty
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $G \subseteq \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $G\text{ is open}$ hG
  • $G\text{ is bounded}$ hb
  • $G\text{ is nonempty}$ hne

Then (frontier G).Nonempty.

/-- **A bounded nonempty open set in `ℝᵈ`, `d ≥ 1`, has nonempty frontier.** -/
theorem frontier_nonempty (hd : 0 < d) {G : Set (EuclSpace d)} (hG : IsOpen G)
    (hb : Bornology.IsBounded G) (hne : G.Nonempty) : (frontier G).Nonempty := by
  by_contra hfr
  rw [not_nonempty_iff_eq_empty] at hfr
  have hcl : closure G = G := by
    rw [closure_eq_interior_union_frontier, hfr, union_empty, hG.interior_eq]
  have hclosed : IsClosed G := closure_eq_iff_isClosed.1 hcl
  have huniv : G = univ := IsClopen.eq_univ ⟨hclosed, hG⟩ hne
  obtain ⟨C, hC⟩ := isBounded_iff_forall_norm_le.1 hb
  set e := EuclideanSpace.single (⟨0, hd⟩ : Fin d) (1 : ℝ) with he
  have hen : ‖e‖ = 1 := by rw [he]; simp
  have hmem : (|C| + 1) • e ∈ G := by rw [huniv]; exact mem_univ _
  have h1 := hC _ hmem
  rw [norm_smul, hen, mul_one, Real.norm_eq_abs, abs_of_pos (by positivity)] at h1
  have := le_abs_self C
  linarith
theorempsi_mono
Formal statementgenerated from the Lean declaration

Let $\eta, s, t \in \mathbb{R}$.

Assume

  • $0 < 1 - 2 \cdot \eta \cdot s$ hs
  • $0 < 1 - 2 \cdot \eta \cdot t$ ht
  • $s - \eta \cdot s ^{2} \le t - \eta \cdot t ^{2}$ h

Then $s \le t$.

/-- **`ψ` is increasing where `ψ' > 0`.** -/
theorem psi_mono {η s t : ℝ} (hs : 0 < 1 - 2 * η * s) (ht : 0 < 1 - 2 * η * t)
    (h : s - η * s ^ 2 ≤ t - η * t ^ 2) : s ≤ t := by
  by_contra hcon
  push Not at hcon
  have e : (t - η * t ^ 2) - (s - η * s ^ 2) = (t - s) * (1 - η * (t + s)) := by ring
  have hpos : 0 < 1 - η * (t + s) := by linarith
  have hneg : (t - s) * (1 - η * (t + s)) < 0 := mul_neg_of_neg_of_pos (by linarith) hpos
  linarith

Plaplacian/StepOperator.lean19 declarations

structureBddMeasDefinition 1.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$.

This defines a property of these parameters.

/-- Bounded and measurable: the class on which the step operator is defined.
See the module docstring for why neither boundedness alone nor continuity is
the right condition. -/
structure BddMeas (v : EuclSpace d → ℝ) : Prop where
  meas : Measurable v
  bound : ∃ C, ∀ y, |v y| ≤ C
lemmaBddMeas.integrableOn_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then $\operatorname{IntegrableOn}(v, B(x, \varepsilon), \lambda)$.

PLaplacian.BddMeas.integrableOn_ballPlaplacian/StepOperator.lean, lines 82–90
/-- A bounded measurable function is integrable on a ball, which is what the
average term requires. -/
lemma BddMeas.integrableOn_ball {v : EuclSpace d → ℝ} (hv : BddMeas v)
    (x : EuclSpace d) (ε : ℝ) : IntegrableOn v (ball x ε) := by
  obtain ⟨C, hC⟩ := hv.bound
  have hconst : IntegrableOn (fun _ : EuclSpace d => C) (ball x ε) :=
    integrableOn_const
  exact hconst.mono' hv.meas.aestronglyMeasurable.restrict
    (Filter.Eventually.of_forall fun y => by simpa using hC y)
lemmaBddMeas.bddAbove_image
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $s \subseteq \mathbb{R}^{d}$.

Assume

  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then BddAbove (v '' s).

PLaplacian.BddMeas.bddAbove_imagePlaplacian/StepOperator.lean, lines 92–96
/-- Without this the `sSup` in the operator is a junk value. -/
lemma BddMeas.bddAbove_image {v : EuclSpace d → ℝ} (hv : BddMeas v)
    (s : Set (EuclSpace d)) : BddAbove (v '' s) := by
  obtain ⟨C, hC⟩ := hv.bound
  exact ⟨C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hC y)).2⟩
lemmaBddMeas.bddBelow_image
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $s \subseteq \mathbb{R}^{d}$.

Assume

  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then BddBelow (v '' s).

PLaplacian.BddMeas.bddBelow_imagePlaplacian/StepOperator.lean, lines 98–102
/-- Without this the `sInf` in the operator is a junk value. -/
lemma BddMeas.bddBelow_image {v : EuclSpace d → ℝ} (hv : BddMeas v)
    (s : Set (EuclSpace d)) : BddBelow (v '' s) := by
  obtain ⟨C, hC⟩ := hv.bound
  exact ⟨-C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hC y)).1⟩
lemmanonempty_closedBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 \le \varepsilon$ hε

Then (Metric.closedBall x ε).Nonempty.

PLaplacian.nonempty_closedBallPlaplacian/StepOperator.lean, lines 104–106
lemma nonempty_closedBall (x : EuclSpace d) {ε : ℝ} (hε : 0 ≤ ε) :
    (closedBall x ε : Set (EuclSpace d)).Nonempty :=
  ⟨x, mem_closedBall_self hε⟩
lemmanonempty_ball
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $0 < \varepsilon$ hε

Then (Metric.ball x ε).Nonempty.

/-- The OPEN ball is nonempty for `0 < ε`. This is what the operator needs;
see `Plaplacian.Measurability` for why the balls must be open. -/
lemma nonempty_ball (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    (ball x ε : Set (EuclSpace d)).Nonempty :=
  ⟨x, mem_ball_self hε⟩
lemmasSup_image_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $s \subseteq \mathbb{R}^{d}$.

Assume

  • $s\text{ is nonempty}$ hs
  • BddAbove (v '' s) hv
  • $\forall y,\ u(y) \le v(y)$ h

Then sSup (u '' s) ≤ sSup (v '' s).

/-- Monotonicity of `sSup` over an image under a pointwise bound. -/
lemma sSup_image_mono {u v : EuclSpace d → ℝ} {s : Set (EuclSpace d)}
    (hs : s.Nonempty) (hv : BddAbove (v '' s)) (h : ∀ y, u y ≤ v y) :
    sSup (u '' s) ≤ sSup (v '' s) := by
  refine csSup_le (hs.image u) ?_
  rintro a ⟨y, hy, rfl⟩
  exact le_trans (h y) (le_csSup hv ⟨y, hy, rfl⟩)
lemmasInf_image_mono
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $s \subseteq \mathbb{R}^{d}$.

Assume

  • $s\text{ is nonempty}$ hs
  • BddBelow (u '' s) hu
  • $\forall y,\ u(y) \le v(y)$ h

Then sInf (u '' s) ≤ sInf (v '' s).

/-- Monotonicity of `sInf` over an image under a pointwise bound. -/
lemma sInf_image_mono {u v : EuclSpace d → ℝ} {s : Set (EuclSpace d)}
    (hs : s.Nonempty) (hu : BddBelow (u '' s)) (h : ∀ y, u y ≤ v y) :
    sInf (u '' s) ≤ sInf (v '' s) := by
  refine le_csInf (hs.image v) ?_
  rintro a ⟨y, hy, rfl⟩
  exact le_trans (csInf_le hu ⟨y, hy, rfl⟩) (h y)
deftugOfWarOpDefinition 1.2 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The tug-of-war step operator.** -/
def tugOfWarOp (p ε : ℝ) (v : EuclSpace d → ℝ) (x : EuclSpace d) : ℝ :=
  (p - 2) / (p + (d : ℝ)) / 2 *
      (sSup (v '' ball x ε) + sInf (v '' ball x ε))
    + ((d : ℝ) + 2) / (p + (d : ℝ)) * (⨍ y in ball x ε, v y)
lemmaalpha_add_beta
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$.

Assume

  • $0 < p + d$ hp

Then $(p - 2) / (p + d) + (d + 2) / (p + d) = 1$.

/-- The weights are a partition of unity: `α + β = 1`. -/
lemma alpha_add_beta (p : ℝ) (hp : 0 < p + (d : ℝ)) :
    (p - 2) / (p + (d : ℝ)) + ((d : ℝ) + 2) / (p + (d : ℝ)) = 1 := by
  field_simp
  ring
theoremtugOfWarOp_monotoneTheorem 1.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < \varepsilon$ hε
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ u(y) \le v(y)$ h

Then $T_{\varepsilon} u(x) \le T_{\varepsilon} v(x)$.

PLaplacian.tugOfWarOp_monotonePlaplacian/StepOperator.lean, lines 146–165
/-- **Monotonicity of the step operator, for `2 ≤ p`.**

The hypothesis `2 ≤ p` is essential: for `1 < p < 2` the weight `α` is negative
and the `sup + inf` term is anti-monotone. -/
theorem tugOfWarOp_monotone (p ε : ℝ) (hp : 2 ≤ p) (hd : 0 < d) (hε : 0 < ε)
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v)
    (h : ∀ y, u y ≤ v y) (x : EuclSpace d) :
    tugOfWarOp p ε u x ≤ tugOfWarOp p ε v x := by
  have hpd : 0 < p + (d : ℝ) := by positivity
  have hα : 0 ≤ (p - 2) / (p + (d : ℝ)) / 2 := by
    apply div_nonneg (div_nonneg (by linarith) hpd.le)
    norm_num
  have hβ : 0 ≤ ((d : ℝ) + 2) / (p + (d : ℝ)) := by positivity
  have hne := nonempty_ball x hε
  have hsup := sSup_image_mono (u := u) (v := v) hne (hv.bddAbove_image (ball x ε)) h
  have hinf := sInf_image_mono (u := u) (v := v) hne (hu.bddBelow_image (ball x ε)) h
  have havg := setAverage_mono_ball x (hu.integrableOn_ball x ε)
    (hv.integrableOn_ball x ε) h
  unfold tugOfWarOp
  gcongr
lemmabddAbove_image_add_const
Formal statementgenerated from the Lean declaration

Let $t \subseteq \mathbb{R}$, $K \in \mathbb{R}$.

Assume

  • $t\text{ is bounded above}$ hb

Then BddAbove ((fun r => r + K) '' t).

PLaplacian.bddAbove_image_add_constPlaplacian/StepOperator.lean, lines 175–182
lemma bddAbove_image_add_const {t : Set ℝ} (K : ℝ) (hb : BddAbove t) :
    BddAbove ((fun r => r + K) '' t) := by
  obtain ⟨M, hM⟩ := hb
  refine ⟨M + K, ?_⟩
  rintro a ⟨r, hr, rfl⟩
  have := hM hr
  simp only
  linarith
lemmabddBelow_image_add_const
Formal statementgenerated from the Lean declaration

Let $t \subseteq \mathbb{R}$, $K \in \mathbb{R}$.

Assume

  • $t\text{ is bounded below}$ hb

Then BddBelow ((fun r => r + K) '' t).

PLaplacian.bddBelow_image_add_constPlaplacian/StepOperator.lean, lines 184–191
lemma bddBelow_image_add_const {t : Set ℝ} (K : ℝ) (hb : BddBelow t) :
    BddBelow ((fun r => r + K) '' t) := by
  obtain ⟨M, hM⟩ := hb
  refine ⟨M + K, ?_⟩
  rintro a ⟨r, hr, rfl⟩
  have := hM hr
  simp only
  linarith
lemmasSup_image_add_const
Formal statementgenerated from the Lean declaration

Let $t \subseteq \mathbb{R}$, $K \in \mathbb{R}$.

Assume

  • $t\text{ is nonempty}$ ht
  • $t\text{ is bounded above}$ hb

Then sSup ((fun r => r + K) '' t) = sSup t + K.

PLaplacian.sSup_image_add_constPlaplacian/StepOperator.lean, lines 193–207
lemma sSup_image_add_const (t : Set ℝ) (K : ℝ) (ht : t.Nonempty)
    (hb : BddAbove t) :
    sSup ((fun r => r + K) '' t) = sSup t + K := by
  have hbi := bddAbove_image_add_const K hb
  refine le_antisymm (csSup_le (ht.image _) ?_) ?_
  · rintro a ⟨r, hr, rfl⟩
    have := le_csSup hb hr
    simp only
    linarith
  · have h : sSup t ≤ sSup ((fun r => r + K) '' t) - K := by
      refine csSup_le ht fun r hr => ?_
      have := le_csSup hbi ⟨r, hr, rfl⟩
      simp only at this
      linarith
    linarith
lemmasInf_image_add_const
Formal statementgenerated from the Lean declaration

Let $t \subseteq \mathbb{R}$, $K \in \mathbb{R}$.

Assume

  • $t\text{ is nonempty}$ ht
  • $t\text{ is bounded below}$ hb

Then sInf ((fun r => r + K) '' t) = sInf t + K.

PLaplacian.sInf_image_add_constPlaplacian/StepOperator.lean, lines 209–223
lemma sInf_image_add_const (t : Set ℝ) (K : ℝ) (ht : t.Nonempty)
    (hb : BddBelow t) :
    sInf ((fun r => r + K) '' t) = sInf t + K := by
  have hbi := bddBelow_image_add_const K hb
  refine le_antisymm ?_ (le_csInf (ht.image _) ?_)
  · have h : sInf ((fun r => r + K) '' t) - K ≤ sInf t := by
      refine le_csInf ht fun r hr => ?_
      have := csInf_le hbi ⟨r, hr, rfl⟩
      simp only at this
      linarith
    linarith
  · rintro a ⟨r, hr, rfl⟩
    have := csInf_le hb hr
    simp only
    linarith
theoremtugOfWarOp_add_constTheorem 1.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $K \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < \varepsilon$ hε
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $0 < p + d$ hpd

Then $T_{\varepsilon} y \mapsto v(y) + K(x) = T_{\varepsilon} v(x) + K$.

PLaplacian.tugOfWarOp_add_constPlaplacian/StepOperator.lean, lines 225–248
/-- **Translation equivariance of the step operator.** -/
theorem tugOfWarOp_add_const (p ε : ℝ) (hε : 0 < ε)
    {v : EuclSpace d → ℝ} (hv : BddMeas v) (K : ℝ) (x : EuclSpace d)
    (hpd : 0 < p + (d : ℝ)) :
    tugOfWarOp p ε (fun y => v y + K) x = tugOfWarOp p ε v x + K := by
  have hne : (v '' ball x ε).Nonempty :=
    ⟨v x, x, mem_ball_self hε, rfl⟩
  have hab := hv.bddAbove_image (ball x ε)
  have hbb := hv.bddBelow_image (ball x ε)
  have himg : (fun y => v y + K) '' ball x ε
      = (fun r => r + K) '' (v '' ball x ε) := by
    rw [Set.image_image]
  have havg : (⨍ y in ball x ε, (v y + K))
      = (⨍ y in ball x ε, v y) + K := by
    rw [show (fun y => v y + K) = v + (fun _ => K) from rfl,
        MeasureTheory.setAverage_add (hv.integrableOn_ball x ε)
          integrableOn_const,
        setAverage_const_ball K x hε]
  unfold tugOfWarOp
  rw [himg, sSup_image_add_const _ K hne hab,
      sInf_image_add_const _ K hne hbb, havg]
  have h1 := alpha_add_beta (d := d) p hpd
  field_simp
  ring_nf
lemmaBddMeas.add_const'
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $K \in \mathbb{R}$.

Assume

  • $v\text{ is admissible (bounded and Borel measurable)}$ hv

Then PLaplacian.BddMeas fun y => v y + K.

/-- Adding a constant preserves `BddMeas`. -/
lemma BddMeas.add_const' {v : EuclSpace d → ℝ} (hv : BddMeas v) (K : ℝ) :
    BddMeas (fun y => v y + K) := by
  obtain ⟨C, hC⟩ := hv.bound
  refine ⟨hv.meas.add_const K, ⟨C + |K|, fun y => ?_⟩⟩
  calc |v y + K| ≤ |v y| + |K| := abs_add_le _ _
    _ ≤ C + |K| := by linarith [hC y]
lemmale_add_of_abs_sub_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $K \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $\forall y,\ \lvert u(y) - v(y)\rvert \le K$ h

Then $u(y) \le v(y) + K$.

PLaplacian.le_add_of_abs_sub_lePlaplacian/StepOperator.lean, lines 267–271
/-- A two-sided bound gives the pointwise inequality monotonicity needs. -/
lemma le_add_of_abs_sub_le {u v : EuclSpace d → ℝ} {K : ℝ}
    (h : ∀ y, |u y - v y| ≤ K) (y : EuclSpace d) : u y ≤ v y + K := by
  have := (abs_le.1 (h y)).2
  linarith
theoremtugOfWarOp_nonexpansiveTheorem 1.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $K \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ \lvert u(y) - v(y)\rvert \le K$ h

Then $\lvert T_{\varepsilon} u(x) - T_{\varepsilon} v(x)\rvert \le K$.

PLaplacian.tugOfWarOp_nonexpansivePlaplacian/StepOperator.lean, lines 273–290
/-- **Nonexpansiveness in the sup norm.** -/
theorem tugOfWarOp_nonexpansive (p ε : ℝ) (hp : 2 ≤ p) (hd : 0 < d)
    (hε : 0 < ε) (hpd : 0 < p + (d : ℝ))
    {u v : EuclSpace d → ℝ} (hu : BddMeas u) (hv : BddMeas v) {K : ℝ}
    (h : ∀ y, |u y - v y| ≤ K) (x : EuclSpace d) :
    |tugOfWarOp p ε u x - tugOfWarOp p ε v x| ≤ K := by
  have h1 : tugOfWarOp p ε u x ≤ tugOfWarOp p ε v x + K := by
    have := tugOfWarOp_monotone p ε hp hd hε hu (hv.add_const' K)
      (le_add_of_abs_sub_le h) x
    rwa [tugOfWarOp_add_const p ε hε hv K x hpd] at this
  have h2 : tugOfWarOp p ε v x ≤ tugOfWarOp p ε u x + K := by
    have hsym : ∀ y, |v y - u y| ≤ K := fun y => by
      rw [abs_sub_comm]; exact h y
    have := tugOfWarOp_monotone p ε hp hd hε hv (hu.add_const' K)
      (le_add_of_abs_sub_le hsym) x
    rwa [tugOfWarOp_add_const p ε hε hu K x hpd] at this
  rw [abs_le]
  constructor <;> linarith

Plaplacian/Strict.lean5 declarations

defIsStrictMaxOn
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Its value lies in $\mathrm{Prop}$.

/-- A strict local maximum on a closed ball. -/
def IsStrictMaxOn (f : EuclSpace d → ℝ) (x₀ : EuclSpace d) (r : ℝ) : Prop :=
  ∀ w ∈ closedBall x₀ r, w ≠ x₀ → f w < f x₀
theoremeq_of_strict
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r \in \mathbb{R}$, $z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsStrictMaxOn}(f, x_{0}, r)$ hstrict
  • $z \in \overline{B}(x_{0}, r)$ hz
  • $f(x_{0}) \le f(z)$ hge

Then $z = x_{0}$.

/-- **The strictness step.** A point of the ball at which the function is at
least its value at the strict maximum is the maximum. -/
theorem eq_of_strict {f : EuclSpace d → ℝ} {x₀ : EuclSpace d} {r : ℝ}
    (hstrict : IsStrictMaxOn f x₀ r) {z : EuclSpace d}
    (hz : z ∈ closedBall x₀ r) (hge : f x₀ ≤ f z) :
    z = x₀ := by
  by_contra hne
  have := hstrict z hz hne
  linarith [this, hge]
theoremquartic_at
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$.

Then $\lVert x_{0} - x_{0}\rVert ^{4} = 0$.

/-- The quartic perturbation leaves the value at the point unchanged. -/
theorem quartic_at (x₀ : EuclSpace d) :
    ‖x₀ - x₀‖ ^ 4 = 0 := by
  simp
theoremquartic_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, w \in \mathbb{R}^{d}$.

Assume

  • $w \ne x_{0}$ hw

Then $0 < \lVert w - x_{0}\rVert ^{4}$.

/-- And it is positive away from the point. -/
theorem quartic_pos {x₀ w : EuclSpace d} (hw : w ≠ x₀) :
    0 < ‖w - x₀‖ ^ 4 := by
  have h : 0 < ‖w - x₀‖ := norm_pos_iff.2 (sub_ne_zero.2 hw)
  positivity
theoremstrict_of_perturb
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $\forall w \in \overline{B}(x_{0}, r),\ f(w) \le f(x_{0})$ hmax

Then $\operatorname{IsStrictMaxOn}(w \mapsto f(w) - \lVert w - x_{0}\rVert ^{4}, x_{0}, r)$.

PLaplacian.strict_of_perturbPlaplacian/Strict.lean, lines 81–91
/-- **Strictness from the perturbation.** A non-strict maximum becomes strict
once the quartic is subtracted. -/
theorem strict_of_perturb {f : EuclSpace d → ℝ} {x₀ : EuclSpace d} {r : ℝ}
    (hmax : ∀ w ∈ closedBall x₀ r, f w ≤ f x₀) :
    IsStrictMaxOn (fun w => f w - ‖w - x₀‖ ^ 4) x₀ r := by
  intro w hw hne
  simp only
  have h1 := hmax w hw
  have h2 := quartic_pos hne
  rw [quartic_at]
  linarith [h1, h2]

Plaplacian/StrictComp.lean6 declarations

defdblPhi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $z \in \mathbb{R}^{d} \times \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The doubled functional. -/
def dblPhi (U V : EuclSpace d → ℝ) (α : ℝ) (z : EuclSpace d × EuclSpace d) : ℝ :=
  U z.1 - V z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)
theoremusc_dblPhi
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$.

Assume

  • $U\text{ is upper semicontinuous}$ hU
  • $V\text{ is lower semicontinuous}$ hV

Then $\operatorname{dblPhi}(U, V, \alpha)\text{ is upper semicontinuous}$.

theorem usc_dblPhi {U V : EuclSpace d → ℝ} (hU : UpperSemicontinuous U)
    (hV : LowerSemicontinuous V) (α : ℝ) : UpperSemicontinuous (dblPhi U V α) := by
  have h1 : UpperSemicontinuous (fun z : EuclSpace d × EuclSpace d => U z.1) :=
    hU.comp continuous_fst
  have h2 : UpperSemicontinuous (fun z : EuclSpace d × EuclSpace d => -V z.2) :=
    hV.neg.comp continuous_snd
  have h3 : UpperSemicontinuous
      (fun z : EuclSpace d × EuclSpace d => -(‖z.1 - z.2‖ ^ 4 / (4 * α))) := by
    apply Continuous.upperSemicontinuous
    fun_prop
  have heq : dblPhi U V α
      = fun z => U z.1 + -V z.2 + -(‖z.1 - z.2‖ ^ 4 / (4 * α)) := by
    funext z; unfold dblPhi; ring
  rw [heq]
  exact (h1.add h2).add h3
theoremexists_interior_max
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $U\text{ is upper semicontinuous}$ hU
  • $V\text{ is lower semicontinuous}$ hV
  • $U\text{ is bounded above}$ hUb
  • $V\text{ is bounded below}$ hVb
  • $\forall x \in \partial \Omega,\ U(x) \le V(x)$ hbd
  • $x_{0} \in \Omega$ hx₀
  • $V(x_{0}) < U(x_{0})$ hpos

Then there exists $\alpha > 0$ such that:

  • ∃ xh ∈ Ω , ∃ yh ∈ Ω , IsMaxOn ( PLaplacian.dblPhi U V α ) ( closure Ω × ˢ closure Ω ) ( xh , yh )
PLaplacian.exists_interior_maxPlaplacian/StrictComp.lean, lines 71–166
/-- **The doubling lemma.** -/
theorem exists_interior_max {Ω : Set (EuclSpace d)} (hΩo : IsOpen Ω)
    (hΩb : Bornology.IsBounded Ω) {U V : EuclSpace d → ℝ}
    (hU : UpperSemicontinuous U) (hV : LowerSemicontinuous V)
    (hUb : BddAbove (range U)) (hVb : BddBelow (range V))
    (hbd : ∀ x ∈ frontier Ω, U x ≤ V x) {x₀ : EuclSpace d} (hx₀ : x₀ ∈ Ω)
    (hpos : V x₀ < U x₀) :
    ∃ α > 0, ∃ xh ∈ Ω, ∃ yh ∈ Ω,
      IsMaxOn (dblPhi U V α) (closure Ω ×ˢ closure Ω) (xh, yh) := by
  set K := closure Ω ×ˢ closure Ω with hKdef
  have hKc : IsCompact K := hΩb.isCompact_closure.prod hΩb.isCompact_closure
  have hx₀K : (x₀, x₀) ∈ K := ⟨subset_closure hx₀, subset_closure hx₀⟩
  -- a maximizer for each parameter 1/(n+1)
  have hex : ∀ n : ℕ, ∃ z ∈ K, IsMaxOn (dblPhi U V (1 / ((n : ℝ) + 1))) K z :=
    fun n => ((usc_dblPhi hU hV _).upperSemicontinuousOn K).exists_isMaxOn
      ⟨_, hx₀K⟩ hKc
  choose z hzK hzmax using hex
  set m := U x₀ - V x₀ with hm
  have hmpos : 0 < m := by rw [hm]; linarith
  obtain ⟨SU, hSU⟩ := hUb
  obtain ⟨IV, hIV⟩ := hVb
  have hUle : ∀ x, U x ≤ SU := fun x => hSU ⟨x, rfl⟩
  have hVge : ∀ y, IV ≤ V y := fun y => hIV ⟨y, rfl⟩
  -- the value at each maximizer is at least m
  have hval : ∀ n : ℕ, m ≤ dblPhi U V (1 / ((n : ℝ) + 1)) (z n) := fun n => by
    have h1 : dblPhi U V (1 / ((n : ℝ) + 1)) (x₀, x₀)
        ≤ dblPhi U V (1 / ((n : ℝ) + 1)) (z n) := hzmax n hx₀K
    have h0 : dblPhi U V (1 / ((n : ℝ) + 1)) (x₀, x₀) = m := by
      simp [dblPhi, hm]
    linarith
  -- the penalty is bounded
  have hpen : ∀ n, ‖(z n).1 - (z n).2‖ ^ 4
      ≤ (SU - IV - m) * (4 * (1 / ((n : ℝ) + 1))) := fun n => by
    have h1 := hval n
    have h2 := hUle (z n).1
    have h3 := hVge (z n).2
    unfold dblPhi at h1
    have h4α : (0 : ℝ) < 4 * (1 / ((n : ℝ) + 1)) := by positivity
    have hq : ‖(z n).1 - (z n).2‖ ^ 4 / (4 * (1 / ((n : ℝ) + 1)))
        ≤ SU - IV - m := by linarith
    exact (div_le_iff₀ h4α).1 hq
  -- a convergent subsequence
  obtain ⟨a, haK, φ, hφ, hlim⟩ := hKc.tendsto_subseq hzK
  have hlim1 : Tendsto (fun n => (z (φ n)).1) atTop (𝓝 a.1) :=
    (continuous_fst.tendsto a).comp hlim
  have hlim2 : Tendsto (fun n => (z (φ n)).2) atTop (𝓝 a.2) :=
    (continuous_snd.tendsto a).comp hlim
  -- the limit is on the diagonal
  have hdiag : a.1 = a.2 := by
    have hT : Tendsto (fun n => ‖(z (φ n)).1 - (z (φ n)).2‖ ^ 4) atTop
        (𝓝 (‖a.1 - a.2‖ ^ 4)) := ((hlim1.sub hlim2).norm).pow 4
    have hB : Tendsto (fun n => (SU - IV - m) * (4 * (1 / ((φ n : ℝ) + 1))))
        atTop (𝓝 0) := by
      have h := ((tendsto_one_div_add_atTop_nhds_zero_nat.comp
        hφ.tendsto_atTop).const_mul 4).const_mul (SU - IV - m)
      rw [show (SU - IV - m) * (4 * (0 : ℝ)) = 0 by ring] at h
      exact h
    have hle : ‖a.1 - a.2‖ ^ 4 ≤ 0 :=
      le_of_tendsto_of_tendsto hT hB (Eventually.of_forall fun n => hpen (φ n))
    have h0 : (0 : ℝ) ≤ ‖a.1 - a.2‖ ^ 4 := by positivity
    have h4 : ‖a.1 - a.2‖ ^ 4 = 0 := le_antisymm hle h0
    have hn : ‖a.1 - a.2‖ = 0 := (pow_eq_zero_iff (by norm_num)).1 h4
    exact sub_eq_zero.1 (norm_eq_zero.1 hn)
  -- the limit value is at least m
  have hlimval : m ≤ U a.1 - V a.2 := by
    by_contra h
    push Not at h
    set ε := (m - (U a.1 - V a.2)) / 2 with hεdef
    have hεpos : 0 < ε := by rw [hεdef]; linarith
    have hu : ∀ᶠ n in atTop, U (z (φ n)).1 < U a.1 + ε :=
      hlim1.eventually (hU a.1 (U a.1 + ε) (by linarith))
    have hv : ∀ᶠ n in atTop, V a.2 - ε < V (z (φ n)).2 :=
      hlim2.eventually (hV a.2 (V a.2 - ε) (by linarith))
    obtain ⟨n, hn1, hn2⟩ := (hu.and hv).exists
    have h1 := hval (φ n)
    have hpen0 : (0 : ℝ) ≤ ‖(z (φ n)).1 - (z (φ n)).2‖ ^ 4
        / (4 * (1 / ((φ n : ℝ) + 1))) := by positivity
    unfold dblPhi at h1
    linarith
  -- so the limit point is interior
  have ha1Ω : a.1 ∈ Ω := by
    have ha1K : a.1 ∈ closure Ω := haK.1
    rw [closure_eq_self_union_frontier] at ha1K
    rcases ha1K with h | h
    · exact h
    · exfalso
      have hb := hbd a.1 h
      rw [← hdiag] at hlimval
      linarith
  have ha2Ω : a.2 ∈ Ω := hdiag ▸ ha1Ω
  -- and so, eventually, are the maximizers
  have hev1 : ∀ᶠ n in atTop, (z (φ n)).1 ∈ Ω := hlim1 (hΩo.mem_nhds ha1Ω)
  have hev2 : ∀ᶠ n in atTop, (z (φ n)).2 ∈ Ω := hlim2 (hΩo.mem_nhds ha2Ω)
  obtain ⟨n, hn1, hn2⟩ := (hev1.and hev2).exists
  exact ⟨1 / ((φ n : ℝ) + 1), by positivity, (z (φ n)).1, hn1, (z (φ n)).2, hn2,
    hzmax (φ n)⟩
theoremisLocalMax_of_interior
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $F \colon \mathbb{R}^{d} \times \mathbb{R}^{d} \to \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $\mathrm{xh}, \mathrm{yh} \in \mathbb{R}^{d}$.

Assume

  • $\Omega\text{ is open}$ hΩo
  • $\mathrm{xh} \in \Omega$ hx
  • $\mathrm{yh} \in \Omega$ hy
  • IsMaxOn F (closure Ω ×ˢ closure Ω) (xh, yh) hmax

Then IsLocalMax F (xh, yh).

PLaplacian.isLocalMax_of_interiorPlaplacian/StrictComp.lean, lines 168–177
/-- A maximum over the closed product at an interior pair is a local
maximum. -/
theorem isLocalMax_of_interior {F : EuclSpace d × EuclSpace d → ℝ}
    {Ω : Set (EuclSpace d)} (hΩo : IsOpen Ω) {xh yh : EuclSpace d}
    (hx : xh ∈ Ω) (hy : yh ∈ Ω)
    (hmax : IsMaxOn F (closure Ω ×ˢ closure Ω) (xh, yh)) :
    IsLocalMax F (xh, yh) := by
  apply hmax.isLocalMax
  have h : Ω ×ˢ Ω ∈ 𝓝 (xh, yh) := (hΩo.prod hΩo).mem_nhds ⟨hx, hy⟩
  exact Filter.mem_of_superset h (Set.prod_mono subset_closure subset_closure)
theorempenaltyGrad_ne_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\alpha \in \mathbb{R}$, $x, y \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • $x \ne y$ h

Then $\operatorname{penaltyGrad}(\alpha, x, y) \ne 0$.

PLaplacian.penaltyGrad_ne_zeroPlaplacian/StrictComp.lean, lines 179–185
/-- Away from the diagonal the gradient of the penalty is nonzero. -/
theorem penaltyGrad_ne_zero {α : ℝ} (hα : 0 < α) {x y : EuclSpace d}
    (h : x ≠ y) : penaltyGrad α x y ≠ 0 := by
  unfold penaltyGrad
  have hxy : x - y ≠ 0 := sub_ne_zero.2 h
  have hn : 0 < ‖x - y‖ := norm_pos_iff.2 hxy
  exact smul_ne_zero (by positivity) hxy
theoremcomparison_strict
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\operatorname{TheoremOfSums}(d)$ hTS
  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $U\text{ is upper semicontinuous}$ hU
  • $V\text{ is lower semicontinuous}$ hV
  • $U\text{ is bounded above}$ hUb
  • $V\text{ is bounded below}$ hVb
  • $0 < c$ hc
  • $U\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = x \mapsto - c\text{ in }\Omega$ hsub
  • $V\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsup
  • $\forall x \in \partial \Omega,\ U(x) \le V(x)$ hbd
  • $x \in \Omega$ a._@._internal._hyg.0

Then $U(x) \le V(x)$.

/-- **The comparison principle for strict subsolutions**, assuming the theorem
of sums. -/
theorem comparison_strict (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hTS : TheoremOfSums d) {Ω : Set (EuclSpace d)} (hΩo : IsOpen Ω)
    (hΩb : Bornology.IsBounded Ω) {U V : EuclSpace d → ℝ}
    (hU : UpperSemicontinuous U) (hV : LowerSemicontinuous V)
    (hUb : BddAbove (range U)) (hVb : BddBelow (range V))
    {c : ℝ} (hc : 0 < c)
    (hsub : IsViscositySubsolution p Ω (fun _ => -c) U)
    (hsup : IsViscositySupersolution p Ω (fun _ => 0) V)
    (hbd : ∀ x ∈ frontier Ω, U x ≤ V x) :
    ∀ x ∈ Ω, U x ≤ V x := by
  intro x₀ hx₀
  by_contra hlt
  push Not at hlt
  obtain ⟨α, hα, xh, hxh, yh, hyh, hmax⟩ :=
    exists_interior_max hΩo hΩb hU hV hUb hVb hbd hx₀ hlt
  have hloc := isLocalMax_of_interior hΩo hxh hyh hmax
  obtain ⟨X, Y, hX, hY, hXY, hsing⟩ := hTS U V hU hV hUb hVb α hα xh yh hloc
  by_cases heq : xh = yh
  · -- the singular case
    have hq0 : penaltyGrad α xh yh = 0 := by rw [heq, penaltyGrad_self]
    rw [hq0] at hX
    have h1 := clSuperJet_singular hd hp hΩo hsub hxh hX
    have h2 := viscFLower_nonneg_of_nonpos hd hp (hsing heq).1
    linarith
  · -- the regular case
    have hq := penaltyGrad_ne_zero hα heq
    have h1 := clSuperJet_regular hd hp hΩo hsub hxh hX hq
    have h2 := clSubJet_regular hd hp hΩo hsup hyh hY hq
    have h3 := viscF_anti hp hXY (penaltyGrad α xh yh)
    linarith

Plaplacian/SubJetAlg.lean10 declarations

theoremadd_form_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X_{1}, X_{2} \in \operatorname{Bilin}(d)$, $v \in \mathbb{R}^{d}$.

Then $((X_{1} + X_{2})(v))(v) = (X_{1}(v))(v) + (X_{2}(v))(v)$.

theorem add_form_apply (X₁ X₂ : Bilin d) (v : EuclSpace d) :
    ((X₁ + X₂) v) v = (X₁ v) v + (X₂ v) v := by
  simp only [add_apply]
theoremneg_form_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$, $v \in \mathbb{R}^{d}$.

Then $((- X)(v))(v) = - (X(v))(v)$.

theorem neg_form_apply (X : Bilin d) (v : EuclSpace d) :
    ((-X) v) v = -((X v) v) := by
  simp only [neg_apply]
theoremsubJet_add
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f, g \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q_{1}, q_{2} \in \mathbb{R}^{d}$, $X_{1}, X_{2} \in \operatorname{Bilin}(d)$.

Assume

  • (q₁, X₁) ∈ PLaplacian.SubJet f x h₁
  • (q₂, X₂) ∈ PLaplacian.SubJet g x h₂

Then (q₁ + q₂, X₁ + X₂) ∈ PLaplacian.SubJet (fun y => f y + g y) x.

/-- **Subjets add.** -/
theorem subJet_add (h₁ : (q₁, X₁) ∈ SubJet f x) (h₂ : (q₂, X₂) ∈ SubJet g x) :
    (q₁ + q₂, X₁ + X₂) ∈ SubJet (fun y => f y + g y) x := by
  intro η hη
  filter_upwards [h₁ (η / 2) (by positivity), h₂ (η / 2) (by positivity)]
    with y hy₁ hy₂
  change f x + inner ℝ q₁ (y - x) + (1 / 2) * (X₁ (y - x)) (y - x)
    - η / 2 * ‖y - x‖ ^ 2 ≤ f y at hy₁
  change g x + inner ℝ q₂ (y - x) + (1 / 2) * (X₂ (y - x)) (y - x)
    - η / 2 * ‖y - x‖ ^ 2 ≤ g y at hy₂
  change f x + g x + inner ℝ (q₁ + q₂) (y - x)
    + (1 / 2) * ((X₁ + X₂) (y - x)) (y - x) - η * ‖y - x‖ ^ 2 ≤ f y + g y
  rw [inner_add_left, add_form_apply]
  linarith
theoremsubJet_neg_of_superJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q_{1} \in \mathbb{R}^{d}$, $X_{1} \in \operatorname{Bilin}(d)$.

Assume

  • (q₁, X₁) ∈ PLaplacian.SuperJet f x h

Then (-q₁, -X₁) ∈ PLaplacian.SubJet (fun y => -f y) x.

PLaplacian.subJet_neg_of_superJetPlaplacian/SubJetAlg.lean, lines 61–71
/-- **A superjet, negated, is a subjet of the negated function.** -/
theorem subJet_neg_of_superJet (h : (q₁, X₁) ∈ SuperJet f x) :
    (-q₁, -X₁) ∈ SubJet (fun y => -f y) x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change f y ≤ f x + inner ℝ q₁ (y - x) + (1 / 2) * (X₁ (y - x)) (y - x)
    + η * ‖y - x‖ ^ 2 at hy
  change -f x + inner ℝ (-q₁) (y - x) + (1 / 2) * ((-X₁) (y - x)) (y - x)
    - η * ‖y - x‖ ^ 2 ≤ -f y
  rw [inner_neg_left, neg_form_apply]
  linarith
theoremsuperJet_neg_of_subJet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q_{1} \in \mathbb{R}^{d}$, $X_{1} \in \operatorname{Bilin}(d)$.

Assume

  • (q₁, X₁) ∈ PLaplacian.SubJet f x h

Then (-q₁, -X₁) ∈ PLaplacian.SuperJet (fun y => -f y) x.

PLaplacian.superJet_neg_of_subJetPlaplacian/SubJetAlg.lean, lines 73–83
/-- **A subjet, negated, is a superjet of the negated function.** -/
theorem superJet_neg_of_subJet (h : (q₁, X₁) ∈ SubJet f x) :
    (-q₁, -X₁) ∈ SuperJet (fun y => -f y) x := by
  intro η hη
  filter_upwards [h η hη] with y hy
  change f x + inner ℝ q₁ (y - x) + (1 / 2) * (X₁ (y - x)) (y - x)
    - η * ‖y - x‖ ^ 2 ≤ f y at hy
  change -f y ≤ -f x + inner ℝ (-q₁) (y - x) + (1 / 2) * ((-X₁) (y - x)) (y - x)
    + η * ‖y - x‖ ^ 2
  rw [inner_neg_left, neg_form_apply]
  linarith
theoremsubJet_comp_add
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q_{1} \in \mathbb{R}^{d}$, $X_{1} \in \operatorname{Bilin}(d)$, $c \in \mathbb{R}^{d}$.

Assume

  • (q₁, X₁) ∈ PLaplacian.SubJet f (x + c) h

Then (q₁, X₁) ∈ PLaplacian.SubJet (fun y => f (y + c)) x.

/-- **Subjets translate.** -/
theorem subJet_comp_add (c : EuclSpace d) (h : (q₁, X₁) ∈ SubJet f (x + c)) :
    (q₁, X₁) ∈ SubJet (fun y => f (y + c)) x := by
  intro η hη
  have hT : Tendsto (fun y : EuclSpace d => y + c) (𝓝 x) (𝓝 (x + c)) :=
    (continuous_id.add continuous_const).tendsto x
  filter_upwards [hT.eventually (h η hη)] with y hy
  change f (x + c) + inner ℝ q₁ (y + c - (x + c))
    + (1 / 2) * (X₁ (y + c - (x + c))) (y + c - (x + c))
    - η * ‖y + c - (x + c)‖ ^ 2 ≤ f (y + c) at hy
  change f (x + c) + inner ℝ q₁ (y - x) + (1 / 2) * (X₁ (y - x)) (y - x)
    - η * ‖y - x‖ ^ 2 ≤ f (y + c)
  have e : y + c - (x + c) = y - x := by abel
  rw [e] at hy
  exact hy
theoremsubJet_of_lower
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $g \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q_{1} \in \mathbb{R}^{d}$, $Z \in \operatorname{Bilin}(d)$.

Assume

  • $\forall k,\ g(x) + \operatorname{inner}(\mathbb{R}, q_{1}, k) + 1 / 2 \cdot (Z(k))(k) \le g(x + k)$ h

Then (q₁, Z) ∈ PLaplacian.SubJet g x.

/-- **An exact quadratic lower bound gives a subjet.** -/
theorem subJet_of_lower {Z : Bilin d}
    (h : ∀ k : EuclSpace d, g x + inner ℝ q₁ k + (1 / 2) * (Z k) k ≤ g (x + k)) :
    (q₁, Z) ∈ SubJet g x := by
  intro η hη
  refine Eventually.of_forall (fun y => ?_)
  change g x + inner ℝ q₁ (y - x) + (1 / 2) * (Z (y - x)) (y - x)
    - η * ‖y - x‖ ^ 2 ≤ g y
  have h1 := h (y - x)
  have e : x + (y - x) = y := by abel
  rw [e] at h1
  have h2 : 0 ≤ η * ‖y - x‖ ^ 2 := by positivity
  linarith
theoremsubJet_inner
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, p \in \mathbb{R}^{d}$.

Then (p, 0) ∈ PLaplacian.SubJet (fun y => inner ℝ p y) x.

/-- A linear function has the subjet `(p, 0)`. -/
theorem subJet_inner (p : EuclSpace d) :
    (p, (0 : Bilin d)) ∈ SubJet (fun y => inner ℝ p y) x := by
  apply subJet_of_lower
  intro k
  rw [inner_add_right]
  simp
theoremsubJet_const
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Then (0, 0) ∈ PLaplacian.SubJet (fun x => c) x.

/-- A constant has the subjet `(0, 0)`. -/
theorem subJet_const (c : ℝ) :
    ((0 : EuclSpace d), (0 : Bilin d)) ∈ SubJet (fun _ => c) x := by
  apply subJet_of_lower
  intro k
  simp
theoremsubJet_congr
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f, g \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $f = g$ hfg
  • (q, X) ∈ PLaplacian.SubJet f x h

Then (q, X) ∈ PLaplacian.SubJet g x.

/-- **Subjet congruence**: a subjet of `f` is one of any function equal to it. -/
theorem subJet_congr {f g : EuclSpace d → ℝ} (hfg : f = g) {x q : EuclSpace d}
    {X : Bilin d} (h : (q, X) ∈ SubJet f x) : (q, X) ∈ SubJet g x := by
  subst hfg; exact h

Plaplacian/Subgrad.lean6 declarations

theoremisSubgrad_of_smul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{lam} \in \mathbb{R}$, $z, v \in \mathbb{R}^{d}$.

Assume

  • $0 < \mathrm{lam}$ hlam
  • $\operatorname{IsSubgrad}(w \mapsto \mathrm{lam} \cdot f(w), z, v)$ h

Then $\operatorname{IsSubgrad}(f, z, \operatorname{lam}(^{-1}) \cdot v)$.

PLaplacian.isSubgrad_of_smulPlaplacian/Subgrad.lean, lines 40–51
/-- A subgradient of `λ f`, divided by `λ`, is a subgradient of `f`. -/
theorem isSubgrad_of_smul {lam : ℝ} (hlam : 0 < lam) {z v : EuclSpace d}
    (h : IsSubgrad (fun w => lam • f w) z v) : IsSubgrad f z (lam⁻¹ • v) := by
  intro w
  have h1 := h w
  simp only [smul_eq_mul] at h1
  rw [real_inner_smul_left]
  have h2 := mul_le_mul_of_nonneg_left h1 (inv_nonneg.2 hlam.le)
  have e1 : lam⁻¹ * (lam * f z + inner ℝ v (w - z)) = f z + lam⁻¹ * inner ℝ v (w - z) := by
    field_simp
  have e2 : lam⁻¹ * (lam * f w) = f w := by field_simp
  linarith
theoremprox_smul_dist
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\mathrm{lam} \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf
  • $0 \le C$ hC0
  • $\forall x,\ f(0) - C \cdot (1 + \lVert x\rVert) \le f(x)$ hC
  • $0 < \mathrm{lam}$ hlam

Then ‖PLaplacian.proxMap (fun w => lam • f w) x - x‖ ≤ 2 * lam * (f x - f 0 + C * (1 + ‖x‖) + C) + √(2 * lam * (f x - f 0 + C * (1 + ‖x‖) + C)).

/-- **The proximal points of `λ f` approach `x`.** -/
theorem prox_smul_dist (hf : ConvexOn ℝ univ f) {C : ℝ} (hC0 : 0 ≤ C)
    (hC : ∀ x, f 0 - C * (1 + ‖x‖) ≤ f x) {lam : ℝ} (hlam : 0 < lam) (x : EuclSpace d) :
    ‖proxMap (fun w => lam • f w) x - x‖
      ≤ 2 * lam * ((f x - f 0 + C * (1 + ‖x‖)) + C)
        + Real.sqrt (2 * lam * ((f x - f 0 + C * (1 + ‖x‖)) + C)) := by
  set A := f x - f 0 + C * (1 + ‖x‖) with hA
  have hA0 : 0 ≤ A := by have := hC x; linarith
  set z := proxMap (fun w => lam • f w) x with hz
  have hmin := prox_min (hf.smul hlam.le) x x
  rw [← hz] at hmin
  unfold proxObj at hmin
  simp only [smul_eq_mul, sub_self, norm_zero] at hmin
  set r := ‖z - x‖ with hr
  have hr0 : 0 ≤ r := norm_nonneg _
  -- the lower bound at z
  have hlow := hC z
  have hzn : ‖z‖ ≤ ‖x‖ + r := by
    have : z = x + (z - x) := by abel
    calc ‖z‖ = ‖x + (z - x)‖ := by rw [← this]
      _ ≤ ‖x‖ + ‖z - x‖ := norm_add_le _ _
  have hfz : f x - f z ≤ A + C * r := by
    have := mul_le_mul_of_nonneg_left hzn hC0
    nlinarith
  have hq : r ^ 2 ≤ 2 * lam * (A + C * r) := by
    have := mul_le_mul_of_nonneg_left hfz hlam.le
    nlinarith
  have hs0 : 0 ≤ Real.sqrt (2 * lam * (A + C)) := Real.sqrt_nonneg _
  have hl0 : 0 ≤ 2 * lam * (A + C) := by positivity
  rcases le_or_gt r 1 with h1 | h1
  · -- r ≤ 1
    have h2 : r ^ 2 ≤ 2 * lam * (A + C) := by
      have : C * r ≤ C := by nlinarith
      nlinarith
    have h3 : r ≤ Real.sqrt (2 * lam * (A + C)) := by
      have := Real.sqrt_le_sqrt h2
      rwa [Real.sqrt_sq hr0] at this
    linarith
  · -- r > 1
    have h2 : r ^ 2 ≤ 2 * lam * (A + C) * r := by
      have : A ≤ A * r := le_mul_of_one_le_right hA0 h1.le
      nlinarith
    have h3 : r ≤ 2 * lam * (A + C) := by
      have hrpos : 0 < r := by linarith
      have : r * r ≤ 2 * lam * (A + C) * r := by nlinarith
      exact le_of_mul_le_mul_right this hrpos
    linarith
theoremsubgrad_exists
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then there exists $p$ such that:

  • $\operatorname{IsSubgrad}(f, x, p)$
/-- **A convex function has a subgradient at every point.** -/
theorem subgrad_exists (hf : ConvexOn ℝ univ f) (x : EuclSpace d) :
    ∃ p, IsSubgrad f x p := by
  obtain ⟨C, hC0, hC⟩ := convex_lower_linear hf
  set A := f x - f 0 + C * (1 + ‖x‖) with hA
  have hA0 : 0 ≤ A := by have := hC x; linarith
  set lam : ℕ → ℝ := fun n => 1 / ((n : ℝ) + 1) with hlamdef
  have hlam : ∀ n, 0 < lam n := fun n => by rw [hlamdef]; positivity
  set z : ℕ → EuclSpace d := fun n => proxMap (fun w => lam n • f w) x with hzdef
  set pp : ℕ → EuclSpace d := fun n => (lam n)⁻¹ • (x - z n) with hppdef
  have hsub : ∀ n, IsSubgrad f (z n) (pp n) := fun n =>
    isSubgrad_of_smul (hlam n) (prox_subgrad (hf.smul (hlam n).le) x)
  -- the proximal points converge to x
  have hlamT : Tendsto lam atTop (𝓝 0) := tendsto_one_div_add_atTop_nhds_zero_nat
  have hbT : Tendsto (fun n => 2 * lam n * (A + C) + Real.sqrt (2 * lam n * (A + C)))
      atTop (𝓝 0) := by
    have h1 : Tendsto (fun n => 2 * lam n * (A + C)) atTop (𝓝 (2 * 0 * (A + C))) :=
      (hlamT.const_mul 2).mul_const (A + C)
    rw [mul_zero, zero_mul] at h1
    have h2 : Tendsto (fun n => Real.sqrt (2 * lam n * (A + C))) atTop (𝓝 (Real.sqrt 0)) :=
      (Real.continuous_sqrt.tendsto 0).comp h1
    rw [Real.sqrt_zero] at h2
    have := h1.add h2
    rwa [add_zero] at this
  have hzT : Tendsto z atTop (𝓝 x) := by
    rw [tendsto_iff_norm_sub_tendsto_zero]
    exact squeeze_zero (fun n => norm_nonneg _)
      (fun n => prox_smul_dist hf hC0 hC (hlam n) x) hbT
  -- the subgradients are eventually bounded
  obtain ⟨M, hM⟩ := convex_bdd_above_ball hf x (2 * 1)
  obtain ⟨m, hm⟩ := convex_bdd_below_ball hf x (2 * 1)
  have hev : ∀ᶠ n in atTop, z n ∈ closedBall x 1 := hzT (closedBall_mem_nhds x one_pos)
  obtain ⟨N, hN⟩ := eventually_atTop.1 hev
  have hpb : ∀ n, ‖pp (n + N)‖ ≤ M - m := fun n => by
    have := subgrad_norm_le one_pos hM hm (hN (n + N) (by omega)) (hsub (n + N))
    linarith
  -- a convergent subsequence, whose limit is a subgradient at x
  obtain ⟨p, _, φ, hφ, hlim⟩ :=
    tendsto_subseq_of_bounded (isBounded_closedBall (x := (0 : EuclSpace d)) (r := M - m))
      (fun n => mem_closedBall_zero_iff.2 (hpb n))
  have hidx : Tendsto (fun n => φ n + N) atTop atTop :=
    (tendsto_add_atTop_nat N).comp hφ.tendsto_atTop
  exact ⟨p, isSubgrad_of_tendsto (convex_continuous hf)
    (zs := fun n => z (φ n + N)) (ps := fun n => pp (φ n + N))
    (hzT.comp hidx) hlim (fun n => hsub _)⟩
defsubgradSel
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}^{d}$.

/-- **A chosen subgradient** at each point. -/
def subgradSel (f : EuclSpace d → ℝ) (x : EuclSpace d) : EuclSpace d :=
  Classical.epsilon (IsSubgrad f x)
theoremsubgradSel_spec
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then $\operatorname{IsSubgrad}(f, x, \operatorname{subgradSel}(f, x))$.

theorem subgradSel_spec {f : EuclSpace d → ℝ} (hf : ConvexOn ℝ univ f) (x : EuclSpace d) :
    IsSubgrad f x (subgradSel f x) :=
  Classical.epsilon_spec (subgrad_exists hf x)
theoremprox_surj
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf

Then $\operatorname{proxMap}(f, x + \operatorname{subgradSel}(f, x)) = x$.

/-- **The proximal map is onto**: every point is the proximal point of itself
plus a subgradient. -/
theorem prox_surj {f : EuclSpace d → ℝ} (hf : ConvexOn ℝ univ f) (x : EuclSpace d) :
    proxMap f (x + subgradSel f x) = x :=
  prox_of_subgrad hf (subgradSel_spec hf x)

Plaplacian/SubgradApprox.lean6 declarations

theoremisSubgrad_comb
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, p, q \in \mathbb{R}^{d}$, $s \in \mathbb{R}$.

Assume

  • $\operatorname{IsSubgrad}(f, x, p)$ hp
  • $\operatorname{IsSubgrad}(f, x, q)$ hq
  • $0 \le s$ hs0
  • $s \le 1$ hs1

Then $\operatorname{IsSubgrad}(f, x, (1 - s) \cdot p + s \cdot q)$.

/-- A convex combination of subgradients is a subgradient. -/
theorem isSubgrad_comb {f : EuclSpace d → ℝ} {x p q : EuclSpace d}
    (hp : IsSubgrad f x p) (hq : IsSubgrad f x q) {s : ℝ} (hs0 : 0 ≤ s) (hs1 : s ≤ 1) :
    IsSubgrad f x ((1 - s) • p + s • q) := by
  intro w
  rw [inner_add_left, real_inner_smul_left, real_inner_smul_left]
  have h1 := mul_le_mul_of_nonneg_left (hp w) (by linarith : 0 ≤ 1 - s)
  have h2 := mul_le_mul_of_nonneg_left (hq w) hs0
  nlinarith
theoremfderiv_approx
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $J \colon \mathbb{R}^{d} \to \mathbb{R}^{d}$, B : EuclSpace d →L[ℝ] EuclSpace d, $y \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{HasFDerivAt}(J, B, y)$ hJ
  • $0 < \eta$ hη

Then there exists $\delta > 0$ such that:

  • $\forall k,\ \lVert k\rVert < \delta \to \lVert J(y + k) - J(y) - B(k)\rVert \le \eta \cdot \lVert k\rVert$
/-- **The derivative bound**, in the form used here. -/
theorem fderiv_approx {J : EuclSpace d → EuclSpace d} {B : EuclSpace d →L[ℝ] EuclSpace d}
    {y : EuclSpace d} (hJ : HasFDerivAt J B y) {η : ℝ} (hη : 0 < η) :
    ∃ δ > 0, ∀ k : EuclSpace d, ‖k‖ < δ → ‖J (y + k) - J y - B k‖ ≤ η * ‖k‖ := by
  have h := (hasFDerivAt_iff_isLittleO_nhds_zero.1 hJ).def hη
  obtain ⟨δ, hδ, hball⟩ := Metric.eventually_nhds_iff.1 h
  exact ⟨δ, hδ, fun k hk => hball (by rwa [dist_zero_right])⟩
theoremexists_inv_of_det
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, B : EuclSpace d →L[ℝ] EuclSpace d.

Assume

  • $\mathrm{B.det} \ne 0$ hdet

Then there exists $\mathrm{Binv}$ such that:

  • $\forall v,\ \operatorname{Binv}(B(v)) = v$
  • $\forall v,\ B(\operatorname{Binv}(v)) = v$
/-- **An invertible map has a continuous inverse.** -/
theorem exists_inv_of_det {B : EuclSpace d →L[ℝ] EuclSpace d} (hdet : B.det ≠ 0) :
    ∃ Binv : EuclSpace d →L[ℝ] EuclSpace d,
      (∀ v, Binv (B v) = v) ∧ (∀ v, B (Binv v) = v) := by
  have hu : IsUnit (B : EuclSpace d →ₗ[ℝ] EuclSpace d) :=
    (LinearMap.isUnit_iff_isUnit_det _).2 (isUnit_iff_ne_zero.2 hdet)
  have hker := (LinearMap.isUnit_iff_ker_eq_bot _).1 hu
  have hran := (LinearMap.isUnit_iff_range_eq_top _).1 hu
  set Be := ContinuousLinearEquiv.ofBijective B hker hran with hBe
  have happ : ∀ v, Be v = B v := fun v => rfl
  refine ⟨(Be.symm : EuclSpace d →L[ℝ] EuclSpace d), fun v => ?_, fun v => ?_⟩
  · change Be.symm (B v) = v
    rw [← happ, ContinuousLinearEquiv.symm_apply_apply]
  · change B (Be.symm v) = v
    rw [← happ, ContinuousLinearEquiv.apply_symm_apply]
theoremsubgrad_unique_at_good
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, y \in \mathbb{R}^{d}$, B, Binv : EuclSpace d →L[ℝ] EuclSpace d, $p \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf
  • $\operatorname{proxMap}(f, y) = x$ hJy
  • $\operatorname{HasFDerivAt}(\operatorname{proxMap}(f), B, y)$ hd
  • $\forall v,\ \operatorname{Binv}(B(v)) = v$ hinv
  • $\operatorname{IsSubgrad}(f, x, y - x)$ hp0
  • $\operatorname{IsSubgrad}(f, x, p)$ hp

Then $p = y - x$.

PLaplacian.subgrad_unique_at_goodPlaplacian/SubgradApprox.lean, lines 80–124
/-- **The subgradient at a good point is unique.** -/
theorem subgrad_unique_at_good (hf : ConvexOn ℝ univ f) (hJy : proxMap f y = x)
    (hd : HasFDerivAt (proxMap f) B y) (hinv : ∀ v, Binv (B v) = v)
    (hp0 : IsSubgrad f x (y - x)) {p : EuclSpace d} (hp : IsSubgrad f x p) :
    p = y - x := by
  set v := p - (y - x) with hv
  -- J is constant along the segment from y in the direction v
  have hconst : ∀ s : ℝ, 0 ≤ s → s ≤ 1 → proxMap f (y + s • v) = x := by
    intro s hs0 hs1
    have hsub := isSubgrad_comb hp0 hp hs0 hs1
    have e : x + ((1 - s) • (y - x) + s • p) = y + s • v := by rw [hv]; module
    rw [← e]
    exact prox_of_subgrad hf hsub
  -- so B v = 0
  have hBv : B v = 0 := by
    by_contra hne
    have hpos : 0 < ‖B v‖ := norm_pos_iff.2 hne
    set η := ‖B v‖ / (2 * (‖v‖ + 1)) with hηdef
    have hη : 0 < η := by positivity
    obtain ⟨δ, hδ, hbd⟩ := fderiv_approx hd hη
    set s := min 1 (δ / (2 * (‖v‖ + 1))) with hsdef
    have hs0 : 0 < s := lt_min one_pos (by positivity)
    have hs1 : s ≤ 1 := min_le_left _ _
    have hsv : ‖s • v‖ < δ := by
      rw [norm_smul, Real.norm_eq_abs, abs_of_pos hs0]
      have : s ≤ δ / (2 * (‖v‖ + 1)) := min_le_right _ _
      have h2 : s * ‖v‖ ≤ δ / (2 * (‖v‖ + 1)) * ‖v‖ :=
        mul_le_mul_of_nonneg_right this (norm_nonneg v)
      have h3 : δ / (2 * (‖v‖ + 1)) * ‖v‖ < δ := by
        rw [div_mul_eq_mul_div, div_lt_iff₀ (by positivity)]; nlinarith [norm_nonneg v]
      linarith
    have h1 := hbd (s • v) hsv
    rw [hconst s hs0.le hs1, hJy, sub_self, zero_sub, norm_neg, map_smul, norm_smul,
      norm_smul, Real.norm_eq_abs, abs_of_pos hs0] at h1
    -- s ‖B v‖ ≤ η s ‖v‖, so ‖B v‖ ≤ η ‖v‖ < ‖B v‖
    have h2 : ‖B v‖ ≤ η * ‖v‖ := by
      have := le_of_mul_le_mul_left (by linarith : s * ‖B v‖ ≤ s * (η * ‖v‖)) hs0
      exact this
    have h3 : η * ‖v‖ < ‖B v‖ := by
      rw [hηdef, div_mul_eq_mul_div, div_lt_iff₀ (by positivity)]
      nlinarith [norm_nonneg v]
    linarith
  have hv0 : v = 0 := by rw [← hinv v, hBv, map_zero]
  rw [hv] at hv0
  exact sub_eq_zero.1 hv0
theoremsubgrad_near_at_good
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, y \in \mathbb{R}^{d}$, B, Binv : EuclSpace d →L[ℝ] EuclSpace d, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf
  • $\operatorname{proxMap}(f, y) = x$ hJy
  • $\operatorname{HasFDerivAt}(\operatorname{proxMap}(f), B, y)$ hd
  • $\forall v,\ \operatorname{Binv}(B(v)) = v$ hinv
  • $\operatorname{IsSubgrad}(f, x, y - x)$ hp0
  • $0 < \varepsilon$ hε

Then there exists $\delta > 0$ such that:

  • $\forall z, p,\ \lVert z - x\rVert < \delta \to \operatorname{IsSubgrad}(f, z, p) \to \lVert p - (y - x)\rVert < \varepsilon$
PLaplacian.subgrad_near_at_goodPlaplacian/SubgradApprox.lean, lines 126–162
/-- **Subgradients near a good point are near its subgradient.** -/
theorem subgrad_near_at_good (hf : ConvexOn ℝ univ f) (hJy : proxMap f y = x)
    (hd : HasFDerivAt (proxMap f) B y) (hinv : ∀ v, Binv (B v) = v)
    (hp0 : IsSubgrad f x (y - x)) {ε : ℝ} (hε : 0 < ε) :
    ∃ δ > 0, ∀ z p : EuclSpace d, ‖z - x‖ < δ → IsSubgrad f z p → ‖p - (y - x)‖ < ε := by
  by_contra hcon
  push Not at hcon
  have hseq : ∀ n : ℕ, ∃ z p : EuclSpace d, ‖z - x‖ < 1 / ((n : ℝ) + 1) ∧
      IsSubgrad f z p ∧ ε ≤ ‖p - (y - x)‖ := fun n => hcon _ (by positivity)
  choose zs ps hzs hps hpe using hseq
  obtain ⟨M, hM⟩ := convex_bdd_above_ball hf x (2 * 1)
  obtain ⟨m, hm⟩ := convex_bdd_below_ball hf x (2 * 1)
  have hzb : ∀ n, zs n ∈ closedBall x 1 := fun n => by
    rw [mem_closedBall, dist_eq_norm]
    have : 1 / ((n : ℝ) + 1) ≤ 1 := by
      rw [div_le_one (by positivity)]; have := Nat.cast_nonneg (α := ℝ) n; linarith
    linarith [hzs n]
  have hpb : ∀ n, ‖ps n‖ ≤ M - m := fun n => by
    have := subgrad_norm_le one_pos hM hm (hzb n) (hps n)
    linarith
  have hzT : Tendsto zs atTop (𝓝 x) := by
    rw [tendsto_iff_norm_sub_tendsto_zero]
    exact squeeze_zero (fun n => norm_nonneg _) (fun n => (hzs n).le)
      tendsto_one_div_add_atTop_nhds_zero_nat
  obtain ⟨q, _, φ, hφ, hlim⟩ :=
    tendsto_subseq_of_bounded (isBounded_closedBall (x := (0 : EuclSpace d)) (r := M - m))
      (fun n => mem_closedBall_zero_iff.2 (hpb n))
  have hq : IsSubgrad f x q := isSubgrad_of_tendsto (convex_continuous hf)
    (zs := fun n => zs (φ n)) (ps := fun n => ps (φ n)) (hzT.comp hφ.tendsto_atTop)
    hlim (fun n => hps _)
  have hqe := subgrad_unique_at_good hf hJy hd hinv hp0 hq
  have hlim' : Tendsto (fun n => ‖ps (φ n) - (y - x)‖) atTop (𝓝 0) := by
    have := (hlim.sub_const (y - x)).norm
    rwa [hqe, sub_self, norm_zero] at this
  have hge : ∀ n, ε ≤ ‖ps (φ n) - (y - x)‖ := fun n => hpe _
  have := ge_of_tendsto hlim' (Eventually.of_forall hge)
  linarith
theoremsubgrad_linear_approx
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, y \in \mathbb{R}^{d}$, B, Binv : EuclSpace d →L[ℝ] EuclSpace d, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ConvexOn}(\mathbb{R}, \mathrm{univ}, f)$ hf
  • $\operatorname{proxMap}(f, y) = x$ hJy
  • $\operatorname{HasFDerivAt}(\operatorname{proxMap}(f), B, y)$ hd
  • $\forall v,\ \operatorname{Binv}(B(v)) = v$ hinv
  • $\operatorname{IsSubgrad}(f, x, y - x)$ hp0
  • $0 < \varepsilon$ hε

Then there exists $\delta > 0$ such that:

  • $\forall z, p,\ \lVert z - x\rVert < \delta \to \operatorname{IsSubgrad}(f, z, p) \to \lVert p - (y - x) - (\operatorname{Binv}(z - x) - (z - x))\rVert \le \varepsilon \cdot \lVert z - x\rVert$
PLaplacian.subgrad_linear_approxPlaplacian/SubgradApprox.lean, lines 164–233
/-- **The linear approximation of subgradients at a good point.** -/
theorem subgrad_linear_approx (hf : ConvexOn ℝ univ f) (hJy : proxMap f y = x)
    (hd : HasFDerivAt (proxMap f) B y) (hinv : ∀ v, Binv (B v) = v)
    (hp0 : IsSubgrad f x (y - x)) {ε : ℝ} (hε : 0 < ε) :
    ∃ δ > 0, ∀ z p : EuclSpace d, ‖z - x‖ < δ → IsSubgrad f z p →
      ‖p - (y - x) - (Binv (z - x) - (z - x))‖ ≤ ε * ‖z - x‖ := by
  set Ci := ‖Binv‖ with hCi
  have hCi0 : 0 ≤ Ci := norm_nonneg _
  set η := min (1 / (2 * (Ci + 1))) (ε / (2 * (Ci + 1) ^ 2)) with hηdef
  have hη : 0 < η := lt_min (by positivity) (by positivity)
  have hη1 : η ≤ 1 / (2 * (Ci + 1)) := min_le_left _ _
  have hη2 : η ≤ ε / (2 * (Ci + 1) ^ 2) := min_le_right _ _
  obtain ⟨δ₁, hδ₁, hbd⟩ := fderiv_approx hd hη
  obtain ⟨δ₂, hδ₂, hnear⟩ :=
    subgrad_near_at_good hf hJy hd hinv hp0 (by linarith : 0 < δ₁ / 2)
  refine ⟨min δ₂ (δ₁ / 2), lt_min hδ₂ (by linarith), fun z p hz hp => ?_⟩
  have hz2 : ‖z - x‖ < δ₂ := lt_of_lt_of_le hz (min_le_left _ _)
  have hz1 : ‖z - x‖ < δ₁ / 2 := lt_of_lt_of_le hz (min_le_right _ _)
  set h := (z - x) + (p - (y - x)) with hhdef
  have hh : ‖h‖ < δ₁ := by
    have := hnear z p hz2 hp
    calc ‖h‖ ≤ ‖z - x‖ + ‖p - (y - x)‖ := norm_add_le _ _
      _ < δ₁ / 2 + δ₁ / 2 := by linarith
      _ = δ₁ := by ring
  -- J(y + h) = z
  have hw : y + h = z + p := by rw [hhdef]; abel
  have hJw : proxMap f (y + h) = z := by rw [hw]; exact prox_of_subgrad hf hp
  have h1 := hbd h hh
  rw [hJw, hJy] at h1
  -- ‖h‖ ≤ 2 Ci ‖z - x‖
  have hinvb : ‖h‖ ≤ Ci * ‖B h‖ := by
    calc ‖h‖ = ‖Binv (B h)‖ := by rw [hinv h]
      _ ≤ Ci * ‖B h‖ := ContinuousLinearMap.le_opNorm _ _
  have hBh : ‖B h‖ ≤ ‖z - x‖ + η * ‖h‖ := by
    have e : B h = (z - x) - (z - x - B h) := by abel
    rw [e]
    calc ‖(z - x) - (z - x - B h)‖ ≤ ‖z - x‖ + ‖z - x - B h‖ := norm_sub_le _ _
      _ ≤ ‖z - x‖ + η * ‖h‖ := by linarith
  have hCη : Ci * η ≤ 1 / 2 := by
    have : Ci * η ≤ Ci * (1 / (2 * (Ci + 1))) := mul_le_mul_of_nonneg_left hη1 hCi0
    have e : Ci * (1 / (2 * (Ci + 1))) ≤ 1 / 2 := by
      rw [mul_one_div, div_le_div_iff₀ (by positivity) (by norm_num)]; nlinarith
    linarith
  have hh2 : ‖h‖ ≤ 2 * Ci * ‖z - x‖ := by
    have hnh : 0 ≤ ‖h‖ := norm_nonneg _
    have h3 := mul_le_mul_of_nonneg_left hBh hCi0
    nlinarith
  -- the approximation
  have e2 : p - (y - x) - (Binv (z - x) - (z - x)) = Binv (B h - (z - x)) := by
    rw [map_sub Binv (B h) (z - x), hinv h, hhdef]; abel
  rw [e2]
  have h4 : ‖Binv (B h - (z - x))‖ ≤ Ci * (η * ‖h‖) := by
    calc ‖Binv (B h - (z - x))‖ ≤ Ci * ‖B h - (z - x)‖ := ContinuousLinearMap.le_opNorm _ _
      _ ≤ Ci * (η * ‖h‖) := by
          apply mul_le_mul_of_nonneg_left _ hCi0
          rw [norm_sub_rev]; exact h1
  have h5 : Ci * (η * ‖h‖) ≤ Ci * η * (2 * Ci * ‖z - x‖) := by
    have := mul_le_mul_of_nonneg_left hh2 (mul_nonneg hCi0 hη.le)
    nlinarith
  have h6 : Ci * η * (2 * Ci) ≤ ε := by
    have : 2 * Ci ^ 2 * η ≤ 2 * Ci ^ 2 * (ε / (2 * (Ci + 1) ^ 2)) :=
      mul_le_mul_of_nonneg_left hη2 (by positivity)
    have e : 2 * Ci ^ 2 * (ε / (2 * (Ci + 1) ^ 2)) ≤ ε := by
      rw [mul_div_assoc', div_le_iff₀ (by positivity)]
      nlinarith [sq_nonneg Ci]
    nlinarith
  have h7 : Ci * η * (2 * Ci * ‖z - x‖) ≤ ε * ‖z - x‖ := by
    have := mul_le_mul_of_nonneg_right h6 (norm_nonneg (z - x))
    nlinarith
  linarith

Plaplacian/Subsol.lean3 declarations

theoremsubsol_at
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F, u, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $2 \le p$ hp
  • $0 < d$ hd
  • $0 < \varepsilon$ hε
  • $0 < p + d$ hpd
  • $u\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $y \in \Omega$ hy
  • $\operatorname{gradient}(\varphi, y) \ne 0$ hgrad
  • $\forall w,\ u(w) - \varphi(w) \le u(y) - \varphi(y)$ hmax

Then there exists $E$ such that:

  • $0 \le \varepsilon ^{2} / (2 \cdot (p + d)) \cdot \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, y), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)) + E$
/-- **The subsolution inequality at a contact point, at fixed parameter.**

If the difference of a solution and the test function is maximal at an
interior point with nonvanishing gradient, then the normalized
`p`-Laplacian of the test function is bounded below by the error, scaled. -/
theorem subsol_at [Nontrivial (EuclSpace d)] {p ε : ℝ} (hp : 2 ≤ p)
    (hd : 0 < d) (hε : 0 < ε) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F u φ : EuclSpace d → ℝ}
    (hu : IsPHarmonious p ε Ω F u) (hφ : ContDiff ℝ 3 φ)
    (hφb : BddMeas φ) {y : EuclSpace d} (hy : y ∈ Ω)
    (hgrad : gradient φ y ≠ 0)
    (hmax : ∀ w, u w - φ w ≤ u y - φ y) :
    ∃ E : ℝ,
      0 ≤ ε ^ 2 / (2 * (p + (d : ℝ)))
          * normPLapOf p (gradient φ y) (fderiv ℝ (fderiv ℝ φ) y) + E :=
  diff_inequality hp hd hε hpd hu hφ hφb hy hgrad hmax rfl
theoremsubsol_limit
Formal statementgenerated from the Lean declaration

Let $I \in \mathbb{R}$, $q \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$ hq
  • ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), q ε ≤ I hle

Then $0 \le I$.

/-- **The subsolution inequality in the limit**, given the rate.

If the errors tend to zero after division, the normalized `p`-Laplacian is
nonnegative --- which is the subsolution inequality `- Δ^N_p φ ≤ 0`. -/
theorem subsol_limit {I : ℝ} {q : ℝ → ℝ}
    (hq : Filter.Tendsto q (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0))
    (hle : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), q ε ≤ I) :
    0 ≤ I :=
  nonneg_of_rate hq hle
theoremubar_usc
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC

Then $\overline{u}\text{ is upper semicontinuous}$.

/-- The upper relaxed limit is upper semicontinuous, which is the first field
of the subsolution predicate. -/
theorem ubar_usc (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) :
    UpperSemicontinuous (ubar u) :=
  upperSemicontinuous_ubar u hC

Plaplacian/SumsFinal.lean8 declarations

theoremtendsto_form_apply
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{Xs} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $X \in \operatorname{Bilin}(d)$, $w \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{Xs}(n) - X\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$ h

Then $\operatorname{Tendsto}(n \mapsto ((\operatorname{Xs}(n))(w))(w), \mathrm{atTop}, \operatorname{nhds}((X(w))(w)))$.

PLaplacian.tendsto_form_applyPlaplacian/SumsFinal.lean, lines 38–52
/-- Norm convergence of forms gives convergence of the quadratic form. -/
theorem tendsto_form_apply {Xs : ℕ → Bilin d} {X : Bilin d}
    (h : Tendsto (fun n => ‖Xs n - X‖) atTop (𝓝 0)) (w : EuclSpace d) :
    Tendsto (fun n => (Xs n w) w) atTop (𝓝 ((X w) w)) := by
  rw [tendsto_iff_norm_sub_tendsto_zero]
  have hg : Tendsto (fun n => ‖Xs n - X‖ * (‖w‖ * ‖w‖)) atTop (𝓝 0) := by
    have := h.mul_const (‖w‖ * ‖w‖)
    rwa [zero_mul] at this
  refine squeeze_zero (fun n => norm_nonneg _) (fun n => ?_) hg
  rw [← form_sub_apply]
  calc ‖((Xs n - X) w) w‖ ≤ ‖(Xs n - X) w‖ * ‖w‖ :=
        ContinuousLinearMap.le_opNorm _ _
    _ ≤ ‖Xs n - X‖ * ‖w‖ * ‖w‖ :=
        mul_le_mul_of_nonneg_right (ContinuousLinearMap.le_opNorm _ _) (norm_nonneg _)
    _ = ‖Xs n - X‖ * (‖w‖ * ‖w‖) := by ring
theoremtendsto_norm_quartic_form
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $K \in \mathbb{R}$, $\mathrm{xs} \colon \mathbb{N} \to \mathbb{R}^{d}$.

Assume

  • $\operatorname{Tendsto}(\mathrm{xs}, \mathrm{atTop}, \operatorname{nhds}(0))$ hxs

Then $\operatorname{Tendsto}(n \mapsto \lVert K\rVert \cdot \lVert 12 \cdot\rVert(\mathrm{xs}, n, \lVert ^{2}\rVert) \cdot \lVert \operatorname{idForm}(d)\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$.

PLaplacian.tendsto_norm_quartic_formPlaplacian/SumsFinal.lean, lines 56–63
/-- The quartic's form term tends to zero in norm. -/
theorem tendsto_norm_quartic_form {K : ℝ} {xs : ℕ → EuclSpace d}
    (hxs : Tendsto xs atTop (𝓝 0)) :
    Tendsto (fun n => ‖K‖ * (‖12 * ‖xs n‖ ^ 2‖ * ‖idForm d‖)) atTop (𝓝 0) := by
  have hc : Tendsto (fun n => 12 * ‖xs n‖ ^ 2) atTop (𝓝 0) := by
    simpa using tendsto_quartic_coef (c := 0) hxs
  have := (hc.norm.mul_const ‖idForm d‖).const_mul ‖K‖
  simpa using this
theoremclSuperJet_u_of
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{xh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$, $\mathrm{xs}, \mathrm{as} \colon \mathbb{N} \to \mathbb{R}^{d}$, $\mathrm{As} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $\mathrm{Xl} \in \operatorname{Bilin}(d)$.

Assume

  • $0 \le K$ hK
  • ∀ (n : ℕ), (as n, As n) ∈ PLaplacian.SuperJet (PLaplacian.uTilde u q xh K) (xs n) hj
  • $\operatorname{Tendsto}(\mathrm{xs}, \mathrm{atTop}, \operatorname{nhds}(0))$ hxs
  • $\operatorname{Tendsto}(\mathrm{as}, \mathrm{atTop}, \operatorname{nhds}(0))$ has
  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{As}(n) - \mathrm{Xl}\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$ hAs
  • $\operatorname{Tendsto}(n \mapsto \operatorname{uTilde}(u, q, \mathrm{xh}, K, \operatorname{xs}(n)), \mathrm{atTop}, \operatorname{nhds}(0))$ hval

Then (q, Xl) ∈ PLaplacian.ClSuperJet u xh.

/-- **The closed superjet of `u`**, from jets of `ũ` at points tending to
zero. -/
theorem clSuperJet_u_of (hK : 0 ≤ K) {xs as : ℕ → EuclSpace d} {As : ℕ → Bilin d}
    {Xl : Bilin d}
    (hj : ∀ n, (as n, As n) ∈ SuperJet (uTilde u q xh K) (xs n))
    (hxs : Tendsto xs atTop (𝓝 0)) (has : Tendsto as atTop (𝓝 0))
    (hAs : Tendsto (fun n => ‖As n - Xl‖) atTop (𝓝 0))
    (hval : Tendsto (fun n => uTilde u q xh K (xs n)) atTop (𝓝 0)) :
    (q, Xl) ∈ ClSuperJet u xh := by
  refine ⟨fun n => xh + xs n, fun n => as n + K • ((4 * ‖xs n‖ ^ 2) • xs n) + q,
    fun n => As n + K • ((12 * ‖xs n‖ ^ 2) • idForm d),
    fun n => superJet_u_of_uTilde hK (hj n), ?_, ?_, ?_, ?_⟩
  · -- the points
    have := tendsto_const_nhds (x := xh) |>.add hxs
    simpa using this
  · -- the values
    have e : (fun n => u (xh + xs n)) = fun n => uTilde u q xh K (xs n)
        + inner ℝ q (xh + xs n) + K * ‖xs n‖ ^ 4 + (u xh - inner ℝ q xh) :=
      funext fun n => u_apply_eq u q xh K (xs n)
    rw [e]
    have h1 : Tendsto (fun n => inner ℝ q (xh + xs n)) atTop
        (𝓝 (inner ℝ q (xh + 0))) :=
      ((continuous_const.inner (continuous_const.add continuous_id)).tendsto 0).comp hxs
    have h2 : Tendsto (fun n => K * ‖xs n‖ ^ 4) atTop (𝓝 (K * ‖(0 : EuclSpace d)‖ ^ 4)) :=
      ((hxs.norm).pow 4).const_mul K
    have h3 := ((hval.add h1).add h2).add
      (tendsto_const_nhds (x := u xh - inner ℝ q xh))
    have hlim : 0 + inner ℝ q (xh + 0) + K * ‖(0 : EuclSpace d)‖ ^ 4
        + (u xh - inner ℝ q xh) = u xh := by
      rw [add_zero, norm_zero]; ring
    rw [hlim] at h3
    exact h3
  · -- the gradients
    have hg : Tendsto (fun n => (4 * ‖xs n‖ ^ 2) • xs n) atTop (𝓝 0) := by
      simpa using tendsto_quartic_grad (c := 0) hxs
    have := (has.add (hg.const_smul K)).add (tendsto_const_nhds (x := q))
    simpa using this
  · -- the forms
    have hb : ∀ n, ‖(As n + K • ((12 * ‖xs n‖ ^ 2) • idForm d)) - Xl‖
        ≤ ‖As n - Xl‖ + ‖K‖ * (‖12 * ‖xs n‖ ^ 2‖ * ‖idForm d‖) := by
      intro n
      have e : (As n + K • ((12 * ‖xs n‖ ^ 2) • idForm d)) - Xl
          = (As n - Xl) + K • ((12 * ‖xs n‖ ^ 2) • idForm d) := by abel
      rw [e]
      refine (ContinuousLinearMap.opNorm_add_le _ _).trans ?_
      have h1 := ContinuousLinearMap.opNorm_smul_le K ((12 * ‖xs n‖ ^ 2) • idForm d)
      have h2 := ContinuousLinearMap.opNorm_smul_le (12 * ‖xs n‖ ^ 2) (idForm d)
      have hK' : 0 ≤ ‖K‖ := norm_nonneg _
      have h3 := mul_le_mul_of_nonneg_left h2 hK'
      linarith
    have hR := hAs.add (tendsto_norm_quartic_form (K := K) hxs)
    rw [add_zero] at hR
    exact squeeze_zero (fun n => ContinuousLinearMap.opNorm_nonneg _) hb hR
theoremclSubJet_v_of
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{yh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$, $\mathrm{ys}, \mathrm{bs} \colon \mathbb{N} \to \mathbb{R}^{d}$, $\mathrm{Bs} \colon \mathbb{N} \to \operatorname{Bilin}(d)$, $\mathrm{Yl} \in \operatorname{Bilin}(d)$.

Assume

  • $0 \le K$ hK
  • ∀ (n : ℕ), (bs n, Bs n) ∈ PLaplacian.SubJet (PLaplacian.vTilde v q yh K) (ys n) hj
  • $\operatorname{Tendsto}(\mathrm{ys}, \mathrm{atTop}, \operatorname{nhds}(0))$ hys
  • $\operatorname{Tendsto}(\mathrm{bs}, \mathrm{atTop}, \operatorname{nhds}(0))$ hbs
  • $\operatorname{Tendsto}(n \mapsto \lVert \operatorname{Bs}(n) - \mathrm{Yl}\rVert, \mathrm{atTop}, \operatorname{nhds}(0))$ hBs
  • $\operatorname{Tendsto}(n \mapsto \operatorname{vTilde}(v, q, \mathrm{yh}, K, \operatorname{ys}(n)), \mathrm{atTop}, \operatorname{nhds}(0))$ hval

Then (q, Yl) ∈ PLaplacian.ClSubJet v yh.

/-- **The closed subjet of `v`**, from jets of `ṽ` at points tending to zero. -/
theorem clSubJet_v_of (hK : 0 ≤ K) {ys bs : ℕ → EuclSpace d} {Bs : ℕ → Bilin d}
    {Yl : Bilin d}
    (hj : ∀ n, (bs n, Bs n) ∈ SubJet (vTilde v q yh K) (ys n))
    (hys : Tendsto ys atTop (𝓝 0)) (hbs : Tendsto bs atTop (𝓝 0))
    (hBs : Tendsto (fun n => ‖Bs n - Yl‖) atTop (𝓝 0))
    (hval : Tendsto (fun n => vTilde v q yh K (ys n)) atTop (𝓝 0)) :
    (q, Yl) ∈ ClSubJet v yh := by
  refine ⟨fun n => yh + ys n, fun n => bs n + K • (-((4 * ‖ys n‖ ^ 2) • ys n)) + q,
    fun n => Bs n + K • (-((12 * ‖ys n‖ ^ 2) • idForm d)),
    fun n => subJet_v_of_vTilde hK (hj n), ?_, ?_, ?_, ?_⟩
  · have := tendsto_const_nhds (x := yh) |>.add hys
    simpa using this
  · have e : (fun n => v (yh + ys n)) = fun n => vTilde v q yh K (ys n)
        + inner ℝ q (yh + ys n) - K * ‖ys n‖ ^ 4 + (v yh - inner ℝ q yh) :=
      funext fun n => v_apply_eq v q yh K (ys n)
    rw [e]
    have h1 : Tendsto (fun n => inner ℝ q (yh + ys n)) atTop
        (𝓝 (inner ℝ q (yh + 0))) :=
      ((continuous_const.inner (continuous_const.add continuous_id)).tendsto 0).comp hys
    have h2 : Tendsto (fun n => K * ‖ys n‖ ^ 4) atTop (𝓝 (K * ‖(0 : EuclSpace d)‖ ^ 4)) :=
      ((hys.norm).pow 4).const_mul K
    have h3 := ((hval.add h1).sub h2).add
      (tendsto_const_nhds (x := v yh - inner ℝ q yh))
    have hlim : 0 + inner ℝ q (yh + 0) - K * ‖(0 : EuclSpace d)‖ ^ 4
        + (v yh - inner ℝ q yh) = v yh := by
      rw [add_zero, norm_zero]; ring
    rw [hlim] at h3
    exact h3
  · have hg : Tendsto (fun n => (4 * ‖ys n‖ ^ 2) • ys n) atTop (𝓝 0) := by
      simpa using tendsto_quartic_grad (c := 0) hys
    have := (hbs.add (hg.neg.const_smul K)).add (tendsto_const_nhds (x := q))
    simpa using this
  · have hb : ∀ n, ‖(Bs n + K • (-((12 * ‖ys n‖ ^ 2) • idForm d))) - Yl‖
        ≤ ‖Bs n - Yl‖ + ‖K‖ * (‖12 * ‖ys n‖ ^ 2‖ * ‖idForm d‖) := by
      intro n
      have e : (Bs n + K • (-((12 * ‖ys n‖ ^ 2) • idForm d))) - Yl
          = (Bs n - Yl) + K • (-((12 * ‖ys n‖ ^ 2) • idForm d)) := by abel
      rw [e]
      refine (ContinuousLinearMap.opNorm_add_le _ _).trans ?_
      have h1 := ContinuousLinearMap.opNorm_smul_le K (-((12 * ‖ys n‖ ^ 2) • idForm d))
      rw [ContinuousLinearMap.opNorm_neg] at h1
      have h2 := ContinuousLinearMap.opNorm_smul_le (12 * ‖ys n‖ ^ 2) (idForm d)
      have hK' : 0 ≤ ‖K‖ := norm_nonneg _
      have h3 := mul_le_mul_of_nonneg_left h2 hK'
      linarith
    have hR := hBs.add (tendsto_norm_quartic_form (K := K) hys)
    rw [add_zero] at hR
    exact squeeze_zero (fun n => ContinuousLinearMap.opNorm_nonneg _) hb hR
theoremsymmForm_entry_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $X \in \operatorname{Bilin}(d)$, $L \in \mathbb{R}$, $i, j \in \operatorname{Fin}(d)$.

Assume

  • $0 \le L$ hL
  • $\forall w,\ \lvert (X(w))(w)\rvert \le L \cdot \lVert w\rVert ^{2}$ hX

Then $\lvert ((\operatorname{symmForm}(X))((\operatorname{obasis}(d))(i)))((\operatorname{obasis}(d))(j))\rvert \le L$.

PLaplacian.symmForm_entry_lePlaplacian/SumsFinal.lean, lines 181–187
/-- Entry bound for a symmetrized form with bounded quadratic form. -/
theorem symmForm_entry_le {X : Bilin d} {L : ℝ} (hL : 0 ≤ L)
    (hX : ∀ w, |(X w) w| ≤ L * ‖w‖ ^ 2) (i j : Fin d) :
    |(symmForm X (obasis d i)) (obasis d j)| ≤ L := by
  have h := symmForm_le_mul hL hX (obasis d i) (obasis d j)
  rw [(obasis d).orthonormal.1 i, (obasis d).orthonormal.1 j, mul_one, mul_one] at h
  exact h
theoremtheoremOfSumsRegular_ofTheorem 5.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Assume

  • $\operatorname{AlexandrovThm}(d)$ hA
  • $\operatorname{JensenLemma}(d)$ hJ

Then $\operatorname{TheoremOfSumsRegular}(d)$.

PLaplacian.theoremOfSumsRegular_ofPlaplacian/SumsFinal.lean, lines 193–326
/-- **The regular half of the theorem of sums**, from Alexandrov's theorem and
Jensen's lemma. -/
theorem theoremOfSumsRegular_of (hA : AlexandrovThm d) (hJ : JensenLemma d) :
    TheoremOfSumsRegular d := by
  intro u v hu hv hub hvb α hα xh yh _hne hmax
  set q := (‖xh - yh‖ ^ 2 / α) • (xh - yh) with hqdef
  obtain ⟨K, hK, hΨ⟩ := exists_K_strict hα hub hvb hmax
  have hK0 : 0 ≤ K := by have := norm_nonneg q; linarith
  set uT := uTilde u q xh K with huT
  set vT := vTilde v q yh K with hvT
  have hu0 : uT 0 = 0 := uTilde_zero
  have hv0 : vT 0 = 0 := vTilde_zero
  have huu : UpperSemicontinuous uT := usc_uTilde hu
  have hub' : BddAbove (range uT) := bddAbove_uTilde hK hub
  have hvv : UpperSemicontinuous (fun y => -vT y) := usc_neg_vTilde hv
  have hvb' : BddAbove (range (fun y => -vT y)) := bddAbove_neg_vTilde hK hvb
  set h0 := xh - yh with hh0
  set L := lamC α h0 with hLdef
  have hL : 0 < L := lamC_pos hα h0
  set U := supConv L uT with hUdef
  set N := supConv L (fun y => -vT y) with hNdef
  have hstrict := dblW0_conv_strict (h0 := h0) hα hu0 hv0 huu hub' hvv hvb' hΨ
  obtain ⟨hU0, hN0⟩ := supConv_zero (h0 := h0) hα hu0 hv0 hub' hvb' hΨ
  have hU0' : U 0 = 0 := hU0
  have hN0' : N 0 = 0 := hN0
  -- the core
  obtain ⟨ξs, ζs, as, bs, Xs, Ys, hsup, hsub, hξ, hζ, ha, hb, hle, hXl, hYu⟩ :=
    core_sequences (u := U) (v := fun ζ => -N ζ) hA hJ hL
      (semiconvex_uconv hα hub') (semiconvex_vconv hα hvb') zero_le_one
      (by norm_num) hα hstrict
  -- the maximizers, and the jets of ũ there
  have hxe : ∀ n, ∃ x, U (ξs n) = uT x - L / 2 * ‖x - ξs n‖ ^ 2 :=
    fun n => supConv_attained hL huu hub' (ξs n)
  choose xs hxs using hxe
  have hjU : ∀ n, (as n, Xs n) ∈ SuperJet uT (xs n) :=
    fun n => superJet_of_supConv hL.le hub' (hxs n) (hsup n)
  have hgU : ∀ n, as n = L • (xs n - ξs n) :=
    fun n => supConv_grad hL.le hub' (hxs n) (hsup n)
  -- the maximizers, and the jets of ṽ there
  have hye : ∀ n, ∃ y, N (ζs n) = -vT y - L / 2 * ‖y - ζs n‖ ^ 2 :=
    fun n => supConv_attained hL hvv hvb' (ζs n)
  choose ys hys using hye
  have hsupN : ∀ n, (-(bs n), -(Ys n)) ∈ SuperJet N (ζs n) :=
    fun n => superJet_congr (by funext y; simp) (superJet_neg_of_subJet (hsub n))
  have hjN : ∀ n, (-(bs n), -(Ys n)) ∈ SuperJet (fun y => -vT y) (ys n) :=
    fun n => superJet_of_supConv hL.le hvb' (hys n) (hsupN n)
  have hgN : ∀ n, -(bs n) = L • (ys n - ζs n) :=
    fun n => supConv_grad hL.le hvb' (hys n) (hsupN n)
  have hjV : ∀ n, (bs n, Ys n) ∈ SubJet vT (ys n) := by
    intro n
    have h1 := subJet_neg_of_superJet (hjN n)
    have eY : - -Ys n = Ys n := by ext x y; simp
    rw [neg_neg, eY] at h1
    exact subJet_congr (by funext y; simp) h1
  -- the maximizers converge
  have hdU : ∀ n, xs n - ξs n = L⁻¹ • as n := by
    intro n; rw [hgU n, smul_smul, inv_mul_cancel₀ hL.ne', one_smul]
  have hdV : ∀ n, ys n - ζs n = L⁻¹ • -(bs n) := by
    intro n; rw [hgN n, smul_smul, inv_mul_cancel₀ hL.ne', one_smul]
  have hxsT : Tendsto xs atTop (𝓝 0) := by
    have h1 : Tendsto (fun n => ξs n + L⁻¹ • as n) atTop (𝓝 (0 + L⁻¹ • 0)) :=
      hξ.add (ha.const_smul L⁻¹)
    rw [smul_zero, add_zero] at h1
    refine h1.congr (fun n => ?_)
    rw [← hdU n]; abel
  have hysT : Tendsto ys atTop (𝓝 0) := by
    have h1 : Tendsto (fun n => ζs n + L⁻¹ • -(bs n)) atTop (𝓝 (0 + L⁻¹ • -0)) :=
      hζ.add (hb.neg.const_smul L⁻¹)
    rw [neg_zero, smul_zero, add_zero] at h1
    refine h1.congr (fun n => ?_)
    rw [← hdV n]; abel
  -- the values converge
  have hUc : Continuous U := semiconvex_continuous (semiconvex_uconv (h0 := h0) hα hub')
  have hNc : Continuous N := semiconvex_continuous (semiconvex_supConv hL.le hvb')
  have hvalU : Tendsto (fun n => uT (xs n)) atTop (𝓝 0) := by
    have h1 : Tendsto (fun n => U (ξs n)) atTop (𝓝 0) := by
      have := (hUc.tendsto 0).comp hξ
      rw [hU0'] at this
      exact this
    have h2 : Tendsto (fun n => L / 2 * ‖L⁻¹ • as n‖ ^ 2) atTop (𝓝 0) := by
      have := (((ha.const_smul L⁻¹).norm).pow 2).const_mul (L / 2)
      simpa using this
    have h3 := h1.add h2
    rw [add_zero] at h3
    refine h3.congr (fun n => ?_)
    have := hxs n
    rw [hdU n] at this
    linarith
  have hvalV : Tendsto (fun n => vT (ys n)) atTop (𝓝 0) := by
    have h1 : Tendsto (fun n => N (ζs n)) atTop (𝓝 0) := by
      have := (hNc.tendsto 0).comp hζ
      rw [hN0'] at this
      exact this
    have h2 : Tendsto (fun n => L / 2 * ‖L⁻¹ • -(bs n)‖ ^ 2) atTop (𝓝 0) := by
      have := (((hb.neg.const_smul L⁻¹).norm).pow 2).const_mul (L / 2)
      simpa using this
    have h3 := (h1.add h2).neg
    rw [add_zero, neg_zero] at h3
    refine h3.congr (fun n => ?_)
    have := hys n
    rw [hdV n] at this
    linarith
  -- symmetrize, and bound the entries
  have habsX : ∀ n w, |(Xs n w) w| ≤ L * ‖w‖ ^ 2 := fun n w =>
    abs_le.2 ⟨by linarith [hXl n w], (hle n w).trans (hYu n w)⟩
  have habsY : ∀ n w, |(Ys n w) w| ≤ L * ‖w‖ ^ 2 := fun n w =>
    abs_le.2 ⟨by linarith [hXl n w, hle n w], hYu n w⟩
  have hjU' : ∀ n, (as n, symmForm (Xs n)) ∈ SuperJet uT (xs n) :=
    fun n => superJet_symmForm (hjU n)
  have hjV' : ∀ n, (bs n, symmForm (Ys n)) ∈ SubJet vT (ys n) :=
    fun n => subJet_symmForm (hjV n)
  -- two extractions
  obtain ⟨Xl, φ, hφ, hXconv⟩ := exists_subseq_form (fun n => symmForm (Xs n))
    (fun n i j => symmForm_entry_le hL.le (habsX n) i j)
  obtain ⟨Yl, ψ, hψ, hYconv⟩ := exists_subseq_form (fun n => symmForm (Ys (φ n)))
    (fun n i j => symmForm_entry_le hL.le (habsY (φ n)) i j)
  have hσ : StrictMono (fun n => φ (ψ n)) := hφ.comp hψ
  have hσT := hσ.tendsto_atTop
  have hXconv' : Tendsto (fun n => ‖symmForm (Xs (φ (ψ n))) - Xl‖) atTop (𝓝 0) :=
    hXconv.comp hψ.tendsto_atTop
  refine ⟨Xl, Yl, ?_, ?_, ?_⟩
  · -- the closed superjet of u
    exact clSuperJet_u_of hK0 (fun n => hjU' (φ (ψ n))) (hxsT.comp hσT)
      (ha.comp hσT) hXconv' (hvalU.comp hσT)
  · -- the closed subjet of v
    exact clSubJet_v_of hK0 (fun n => hjV' (φ (ψ n))) (hysT.comp hσT)
      (hb.comp hσT) hYconv (hvalV.comp hσT)
  · -- X ≤ Y in the limit
    intro w
    have h1 := tendsto_form_apply hXconv' w
    have h2 := tendsto_form_apply hYconv w
    refine le_of_tendsto_of_tendsto h1 h2 (Eventually.of_forall fun n => ?_)
    have := quadLE_symmForm (hle (φ (ψ n))) w
    exact this
theoremcomparison_strict_of_AJTheorem 5.4 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\operatorname{AlexandrovThm}(d)$ hA
  • $\operatorname{JensenLemma}(d)$ hJ
  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $U\text{ is upper semicontinuous}$ hU
  • $V\text{ is lower semicontinuous}$ hV
  • $U\text{ is bounded above}$ hUb
  • $V\text{ is bounded below}$ hVb
  • $0 < c$ hc
  • $U\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = x \mapsto - c\text{ in }\Omega$ hsub
  • $V\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsup
  • $\forall x \in \partial \Omega,\ U(x) \le V(x)$ hbd
  • $x \in \Omega$ a._@._internal._hyg.0

Then $U(x) \le V(x)$.

PLaplacian.comparison_strict_of_AJPlaplacian/SumsFinal.lean, lines 330–343
/-- **The comparison principle for strict subsolutions**, from Alexandrov's
theorem and Jensen's lemma. -/
theorem comparison_strict_of_AJ (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hA : AlexandrovThm d) (hJ : JensenLemma d) {Ω : Set (EuclSpace d)}
    (hΩo : IsOpen Ω) (hΩb : Bornology.IsBounded Ω) {U V : EuclSpace d → ℝ}
    (hU : UpperSemicontinuous U) (hV : LowerSemicontinuous V)
    (hUb : BddAbove (range U)) (hVb : BddBelow (range V))
    {c : ℝ} (hc : 0 < c)
    (hsub : IsViscositySubsolution p Ω (fun _ => -c) U)
    (hsup : IsViscositySupersolution p Ω (fun _ => 0) V)
    (hbd : ∀ x ∈ frontier Ω, U x ≤ V x) :
    ∀ x ∈ Ω, U x ≤ V x :=
  comparison_strict_of_regular hd hp (theoremOfSumsRegular_of hA hJ) hΩo hΩb hU hV
    hUb hVb hc hsub hsup hbd
theoremand

No exported statement.

theorem and Jensen's lemma. -/

Plaplacian/SumsSplit.lean6 declarations

defTheoremOfSumsRegular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Its value lies in $\mathrm{Prop}$.

PLaplacian.TheoremOfSumsRegularPlaplacian/SumsSplit.lean, lines 42–53
/-- **The regular half of the theorem of sums**, off the diagonal. -/
def TheoremOfSumsRegular (d : ℕ) : Prop :=
  ∀ (u v : EuclSpace d → ℝ), UpperSemicontinuous u → LowerSemicontinuous v →
    BddAbove (range u) → BddBelow (range v) →
    ∀ α : ℝ, 0 < α → ∀ xh yh : EuclSpace d, xh ≠ yh →
      IsLocalMax
        (fun z : EuclSpace d × EuclSpace d =>
          u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, yh) →
      ∃ X Y : Bilin d,
        (penaltyGrad α xh yh, X) ∈ ClSuperJet u xh ∧
        (penaltyGrad α xh yh, Y) ∈ ClSubJet v yh ∧
        QuadLE X Y
theoremeventually_quartic_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x \in \mathbb{R}^{d}$, $\alpha, \eta \in \mathbb{R}$.

Assume

  • $0 < \alpha$ hα
  • $0 < \eta$ hη

Then ∀ᶠ (y : EuclSpace d) in nhds x, ‖y - x‖ ^ 4 / (4 * α) ≤ η * ‖y - x‖ ^ 2.

PLaplacian.eventually_quartic_lePlaplacian/SumsSplit.lean, lines 55–71
/-- The quartic is eventually below any multiple of the square. -/
theorem eventually_quartic_le {x : EuclSpace d} {α η : ℝ} (hα : 0 < α)
    (hη : 0 < η) :
    ∀ᶠ y in 𝓝 x, ‖y - x‖ ^ 4 / (4 * α) ≤ η * ‖y - x‖ ^ 2 := by
  have hr : (0:ℝ) < 4 * α * η := by positivity
  filter_upwards [Metric.ball_mem_nhds x (Real.sqrt_pos.2 hr)] with y hy
  rw [mem_ball, dist_eq_norm] at hy
  have hn : (0:ℝ) ≤ ‖y - x‖ := norm_nonneg _
  have hsq : ‖y - x‖ ^ 2 ≤ 4 * α * η := by
    have h1 : ‖y - x‖ ^ 2 < (Real.sqrt (4 * α * η)) ^ 2 :=
      pow_lt_pow_left₀ hy hn (by norm_num)
    rw [Real.sq_sqrt hr.le] at h1
    exact h1.le
  have h4α : (0:ℝ) < 4 * α := by positivity
  rw [div_le_iff₀ h4α]
  have h2 : (0:ℝ) ≤ ‖y - x‖ ^ 2 := by positivity
  nlinarith [mul_le_mul_of_nonneg_left hsq h2]
theoremsuperJet_zero_of_diag
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{xh} \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • IsLocalMax (fun z => u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, xh) hmax

Then (0, 0) ∈ PLaplacian.SuperJet u xh.

PLaplacian.superJet_zero_of_diagPlaplacian/SumsSplit.lean, lines 73–90
/-- **On the diagonal, `(0, 0)` is a superjet of `u`.** -/
theorem superJet_zero_of_diag {u v : EuclSpace d → ℝ} {α : ℝ} (hα : 0 < α)
    {xh : EuclSpace d}
    (hmax : IsLocalMax
      (fun z : EuclSpace d × EuclSpace d =>
        u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, xh)) :
    ((0 : EuclSpace d), (0 : Bilin d)) ∈ SuperJet u xh := by
  intro η hη
  have hslice : Tendsto (fun x : EuclSpace d => (x, xh)) (𝓝 xh) (𝓝 (xh, xh)) :=
    (continuous_id.prodMk continuous_const).tendsto xh
  have h1 := hslice.eventually hmax
  have h2 := eventually_quartic_le (x := xh) hα hη
  filter_upwards [h1, h2] with x hx hq
  simp only [inner_zero_left, zero_apply, mul_zero,
    add_zero]
  have hself : ‖xh - xh‖ ^ 4 / (4 * α) = 0 := by simp
  rw [hself] at hx
  linarith
theoremsubJet_zero_of_diag
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $\alpha \in \mathbb{R}$, $\mathrm{xh} \in \mathbb{R}^{d}$.

Assume

  • $0 < \alpha$ hα
  • IsLocalMax (fun z => u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, xh) hmax

Then (0, 0) ∈ PLaplacian.SubJet v xh.

PLaplacian.subJet_zero_of_diagPlaplacian/SumsSplit.lean, lines 92–111
/-- **On the diagonal, `(0, 0)` is a subjet of `v`.** -/
theorem subJet_zero_of_diag {u v : EuclSpace d → ℝ} {α : ℝ} (hα : 0 < α)
    {xh : EuclSpace d}
    (hmax : IsLocalMax
      (fun z : EuclSpace d × EuclSpace d =>
        u z.1 - v z.2 - ‖z.1 - z.2‖ ^ 4 / (4 * α)) (xh, xh)) :
    ((0 : EuclSpace d), (0 : Bilin d)) ∈ SubJet v xh := by
  intro η hη
  have hslice : Tendsto (fun y : EuclSpace d => (xh, y)) (𝓝 xh) (𝓝 (xh, xh)) :=
    (continuous_const.prodMk continuous_id).tendsto xh
  have h1 := hslice.eventually hmax
  have h2 := eventually_quartic_le (x := xh) hα hη
  filter_upwards [h1, h2] with y hy hq
  simp only [inner_zero_left, zero_apply, mul_zero,
    add_zero]
  have hself : ‖xh - xh‖ ^ 4 / (4 * α) = 0 := by simp
  rw [hself] at hy
  have hsym : ‖xh - y‖ = ‖y - xh‖ := norm_sub_rev xh y
  rw [hsym] at hy
  linarith
theoremtheoremOfSums_of_regularTheorem 5.3 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Assume

  • $\operatorname{TheoremOfSumsRegular}(d)$ hreg

Then $\operatorname{TheoremOfSums}(d)$.

PLaplacian.theoremOfSums_of_regularPlaplacian/SumsSplit.lean, lines 113–127
/-- **The theorem of sums, from its regular half.** -/
theorem theoremOfSums_of_regular (hreg : TheoremOfSumsRegular d) :
    TheoremOfSums d := by
  intro u v hu hv hub hvb α hα xh yh hmax
  by_cases heq : xh = yh
  · -- on the diagonal: the zero forms
    subst heq
    refine ⟨0, 0, ?_, ?_, QuadLE.refl 0, fun _ => ⟨QuadLE.refl 0, QuadLE.refl 0⟩⟩
    · rw [penaltyGrad_self]
      exact superJet_subset_cl u xh (superJet_zero_of_diag hα hmax)
    · rw [penaltyGrad_self]
      exact subJet_subset_cl v xh (subJet_zero_of_diag hα hmax)
  · -- off the diagonal: the regular half
    obtain ⟨X, Y, hX, hY, hXY⟩ := hreg u v hu hv hub hvb α hα xh yh heq hmax
    exact ⟨X, Y, hX, hY, hXY, fun h => absurd h heq⟩
theoremcomparison_strict_of_regular
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $U, V \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\operatorname{TheoremOfSumsRegular}(d)$ hreg
  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $U\text{ is upper semicontinuous}$ hU
  • $V\text{ is lower semicontinuous}$ hV
  • $U\text{ is bounded above}$ hUb
  • $V\text{ is bounded below}$ hVb
  • $0 < c$ hc
  • $U\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = x \mapsto - c\text{ in }\Omega$ hsub
  • $V\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsup
  • $\forall x \in \partial \Omega,\ U(x) \le V(x)$ hbd
  • $x \in \Omega$ a._@._internal._hyg.0

Then $U(x) \le V(x)$.

PLaplacian.comparison_strict_of_regularPlaplacian/SumsSplit.lean, lines 129–142
/-- **The comparison principle for strict subsolutions, assuming only the
regular half of the theorem of sums.** -/
theorem comparison_strict_of_regular (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    (hreg : TheoremOfSumsRegular d) {Ω : Set (EuclSpace d)} (hΩo : IsOpen Ω)
    (hΩb : Bornology.IsBounded Ω) {U V : EuclSpace d → ℝ}
    (hU : UpperSemicontinuous U) (hV : LowerSemicontinuous V)
    (hUb : BddAbove (range U)) (hVb : BddBelow (range V))
    {c : ℝ} (hc : 0 < c)
    (hsub : IsViscositySubsolution p Ω (fun _ => -c) U)
    (hsup : IsViscositySupersolution p Ω (fun _ => 0) V)
    (hbd : ∀ x ∈ frontier Ω, U x ≤ V x) :
    ∀ x ∈ Ω, U x ≤ V x :=
  comparison_strict hd hp (theoremOfSums_of_regular hreg) hΩo hΩb hU hV hUb hVb
    hc hsub hsup hbd

Plaplacian/SumsTransfer.lean9 declarations

theoremsuperJet_smul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $c \in \mathbb{R}$.

Assume

  • $0 \le c$ hc
  • (q, X) ∈ PLaplacian.SuperJet f x h

Then (c • q, c • X) ∈ PLaplacian.SuperJet (fun y => c * f y) x.

/-- **Scaling a superjet** by a nonnegative constant. -/
theorem superJet_smul (hc : 0 ≤ c) (h : (q, X) ∈ SuperJet f x) :
    (c • q, c • X) ∈ SuperJet (fun y => c * f y) x := by
  intro η hη
  have hη' : 0 < η / (c + 1) := by positivity
  filter_upwards [h (η / (c + 1)) hη'] with y hy
  change f y ≤ f x + inner ℝ q (y - x) + (1 / 2) * (X (y - x)) (y - x)
    + η / (c + 1) * ‖y - x‖ ^ 2 at hy
  change c * f y ≤ c * f x + inner ℝ (c • q) (y - x)
    + (1 / 2) * ((c • X) (y - x)) (y - x) + η * ‖y - x‖ ^ 2
  rw [real_inner_smul_left, smul_form_apply]
  have h1 := mul_le_mul_of_nonneg_left hy hc
  have h2 : c * (η / (c + 1)) ≤ η := by
    rw [mul_div_assoc', div_le_iff₀ (by linarith)]; nlinarith
  have h3 : c * (η / (c + 1)) * ‖y - x‖ ^ 2 ≤ η * ‖y - x‖ ^ 2 :=
    mul_le_mul_of_nonneg_right h2 (by positivity)
  nlinarith
theoremsubJet_smul
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $c \in \mathbb{R}$.

Assume

  • $0 \le c$ hc
  • (q, X) ∈ PLaplacian.SubJet f x h

Then (c • q, c • X) ∈ PLaplacian.SubJet (fun y => c * f y) x.

/-- **Scaling a subjet** by a nonnegative constant. -/
theorem subJet_smul (hc : 0 ≤ c) (h : (q, X) ∈ SubJet f x) :
    (c • q, c • X) ∈ SubJet (fun y => c * f y) x := by
  intro η hη
  have hη' : 0 < η / (c + 1) := by positivity
  filter_upwards [h (η / (c + 1)) hη'] with y hy
  change f x + inner ℝ q (y - x) + (1 / 2) * (X (y - x)) (y - x)
    - η / (c + 1) * ‖y - x‖ ^ 2 ≤ f y at hy
  change c * f x + inner ℝ (c • q) (y - x)
    + (1 / 2) * ((c • X) (y - x)) (y - x) - η * ‖y - x‖ ^ 2 ≤ c * f y
  rw [real_inner_smul_left, smul_form_apply]
  have h1 := mul_le_mul_of_nonneg_left hy hc
  have h2 : c * (η / (c + 1)) ≤ η := by
    rw [mul_div_assoc', div_le_iff₀ (by linarith)]; nlinarith
  have h3 : c * (η / (c + 1)) * ‖y - x‖ ^ 2 ≤ η * ‖y - x‖ ^ 2 :=
    mul_le_mul_of_nonneg_right h2 (by positivity)
  nlinarith
theoremsemiconvex_continuous
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{SemiconvexWith}(\mathrm{lam}, f)$ hf

Then $f\text{ is continuous}$.

PLaplacian.semiconvex_continuousPlaplacian/SumsTransfer.lean, lines 76–87
/-- **A semiconvex function is continuous.** -/
theorem semiconvex_continuous {lam : ℝ} {f : EuclSpace d → ℝ}
    (hf : SemiconvexWith lam f) : Continuous f := by
  have hc : ContinuousOn (fun x => f x + lam / 2 * ‖x‖ ^ 2) univ :=
    ConvexOn.continuousOn isOpen_univ hf
  have hc' : Continuous (fun x => f x + lam / 2 * ‖x‖ ^ 2) :=
    continuousOn_univ.1 hc
  have hq : Continuous (fun x : EuclSpace d => lam / 2 * ‖x‖ ^ 2) := by fun_prop
  have heq : f = fun x => (f x + lam / 2 * ‖x‖ ^ 2) - lam / 2 * ‖x‖ ^ 2 := by
    funext x; ring
  rw [heq]
  exact hc'.sub hq
theoremu_eq_uTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{xh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$.

Then $u = z \mapsto \operatorname{uTilde}(u, q, \mathrm{xh}, K, z + - \mathrm{xh}) + K \cdot \lVert z - \mathrm{xh}\rVert ^{4} + \operatorname{inner}(\mathbb{R}, q, z) + (u(\mathrm{xh}) - \operatorname{inner}(\mathbb{R}, q, \mathrm{xh}))$.

/-- `u` in terms of `ũ`. -/
theorem u_eq_uTilde (u : EuclSpace d → ℝ) (q xh : EuclSpace d) (K : ℝ) :
    u = fun z => uTilde u q xh K (z + -xh) + K * ‖z - xh‖ ^ 4 + inner ℝ q z
      + (u xh - inner ℝ q xh) := by
  funext z
  unfold uTilde
  have e1 : xh + (z + -xh) = z := by abel
  have e2 : z + -xh = z - xh := (sub_eq_add_neg z xh).symm
  rw [e1, e2]
  ring
theoremv_eq_vTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{yh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$.

Then $v = z \mapsto \operatorname{vTilde}(v, q, \mathrm{yh}, K, z + - \mathrm{yh}) + - K \cdot \lVert z - \mathrm{yh}\rVert ^{4} + \operatorname{inner}(\mathbb{R}, q, z) + (v(\mathrm{yh}) - \operatorname{inner}(\mathbb{R}, q, \mathrm{yh}))$.

/-- `v` in terms of `ṽ`. -/
theorem v_eq_vTilde (v : EuclSpace d → ℝ) (q yh : EuclSpace d) (K : ℝ) :
    v = fun z => vTilde v q yh K (z + -yh) + -K * ‖z - yh‖ ^ 4 + inner ℝ q z
      + (v yh - inner ℝ q yh) := by
  funext z
  unfold vTilde
  have e1 : yh + (z + -yh) = z := by abel
  have e2 : z + -yh = z - yh := (sub_eq_add_neg z yh).symm
  rw [e1, e2]
  ring
theoremsuperJet_u_of_uTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{xh}, x, a \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$, $K \in \mathbb{R}$.

Assume

  • $0 \le K$ hK
  • (a, X) ∈ PLaplacian.SuperJet (PLaplacian.uTilde u q xh K) x h

Then (a + K • (4 * ‖x‖ ^ 2) • x + q, X + K • (12 * ‖x‖ ^ 2) • PLaplacian.idForm d) ∈ PLaplacian.SuperJet u (xh + x).

PLaplacian.superJet_u_of_uTildePlaplacian/SumsTransfer.lean, lines 116–130
/-- **The transfer of a superjet from `ũ` to `u`.** -/
theorem superJet_u_of_uTilde (hK : 0 ≤ K) (h : (a, X) ∈ SuperJet (uTilde u q xh K) x) :
    (a + K • ((4 * ‖x‖ ^ 2) • x) + q, X + K • ((12 * ‖x‖ ^ 2) • idForm d))
      ∈ SuperJet u (xh + x) := by
  have h1 : (a, X) ∈ SuperJet (fun z => uTilde u q xh K (z + -xh)) (xh + x) := by
    apply superJet_comp_add
    have e : xh + x + -xh = x := by abel
    rw [e]; exact h
  have h2 := superJet_quartic xh (xh + x)
  have e : xh + x - xh = x := by abel
  rw [e] at h2
  have h3 := superJet_smul hK h2
  have h4 := superJet_add h1 h3
  have h5 := superJet_add_affine h4 q (u xh - inner ℝ q xh)
  exact superJet_congr (u_eq_uTilde u q xh K).symm h5
theoremsubJet_v_of_vTilde
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{yh}, y, b \in \mathbb{R}^{d}$, $Y \in \operatorname{Bilin}(d)$, $K \in \mathbb{R}$.

Assume

  • $0 \le K$ hK
  • (b, Y) ∈ PLaplacian.SubJet (PLaplacian.vTilde v q yh K) y h

Then (b + K • -((4 * ‖y‖ ^ 2) • y) + q, Y + K • -((12 * ‖y‖ ^ 2) • PLaplacian.idForm d)) ∈ PLaplacian.SubJet v (yh + y).

/-- **The transfer of a subjet from `ṽ` to `v`.** -/
theorem subJet_v_of_vTilde (hK : 0 ≤ K) (h : (b, Y) ∈ SubJet (vTilde v q yh K) y) :
    (b + K • (-((4 * ‖y‖ ^ 2) • y)) + q, Y + K • (-((12 * ‖y‖ ^ 2) • idForm d)))
      ∈ SubJet v (yh + y) := by
  have h1 : (b, Y) ∈ SubJet (fun z => vTilde v q yh K (z + -yh)) (yh + y) := by
    apply subJet_comp_add
    have e : yh + y + -yh = y := by abel
    rw [e]; exact h
  have h2 := subJet_neg_quartic yh (yh + y)
  have e : yh + y - yh = y := by abel
  rw [e] at h2
  have h3 := subJet_smul hK h2
  have h4 := subJet_add h1 h3
  have h5 := subJet_add_affine h4 q (v yh - inner ℝ q yh)
  have hfun : (fun z => vTilde v q yh K (z + -yh) + K * -‖z - yh‖ ^ 4
        + inner ℝ q z + (v yh - inner ℝ q yh)) = v := by
    funext z
    unfold vTilde
    have e1 : yh + (z + -yh) = z := by abel
    have e2 : z + -yh = z - yh := (sub_eq_add_neg z yh).symm
    rw [e1, e2]
    ring
  exact subJet_congr hfun h5
theoremu_apply_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{xh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then $u(\mathrm{xh} + x) = \operatorname{uTilde}(u, q, \mathrm{xh}, K, x) + \operatorname{inner}(\mathbb{R}, q, \mathrm{xh} + x) + K \cdot \lVert x\rVert ^{4} + (u(\mathrm{xh}) - \operatorname{inner}(\mathbb{R}, q, \mathrm{xh}))$.

/-- The value of `u` in terms of `ũ`. -/
theorem u_apply_eq (u : EuclSpace d → ℝ) (q xh : EuclSpace d) (K : ℝ)
    (x : EuclSpace d) :
    u (xh + x) = uTilde u q xh K x + inner ℝ q (xh + x) + K * ‖x‖ ^ 4
      + (u xh - inner ℝ q xh) := by
  unfold uTilde; ring
theoremv_apply_eq
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $v \colon \mathbb{R}^{d} \to \mathbb{R}$, $q, \mathrm{yh} \in \mathbb{R}^{d}$, $K \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Then $v(\mathrm{yh} + y) = \operatorname{vTilde}(v, q, \mathrm{yh}, K, y) + \operatorname{inner}(\mathbb{R}, q, \mathrm{yh} + y) - K \cdot \lVert y\rVert ^{4} + (v(\mathrm{yh}) - \operatorname{inner}(\mathbb{R}, q, \mathrm{yh}))$.

/-- The value of `v` in terms of `ṽ`. -/
theorem v_apply_eq (v : EuclSpace d → ℝ) (q yh : EuclSpace d) (K : ℝ)
    (y : EuclSpace d) :
    v (yh + y) = vTilde v q yh K y + inner ℝ q (yh + y) - K * ‖y‖ ^ 4
      + (v yh - inner ℝ q yh) := by
  unfold vTilde; ring

Plaplacian/SupAbs.lean1 declarations

theoremsup_err_abs
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon, K, H, g \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε
  • $0 \le K$ hK
  • $\forall z,\ \lVert z\rVert \le \varepsilon \to \lvert \operatorname{taylorErr}(\varphi, x, z)\rvert \le K \cdot \varepsilon ^{3}$ hTerr
  • $\lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \le H$ hH
  • $0 < g$ hg
  • $g \le \lVert \operatorname{gradient}(\varphi, x)\rVert$ hgx

Then |sSup (φ '' Metric.closedBall x ε) - (φ x + ε * ‖gradient φ x‖ + ε ^ 2 / 2 * PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x))| ≤ H * ε * √(2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) + K * ε ^ 3.

/-- **The supremum's two-sided error, uniformly.** -/
theorem sup_err_abs {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε K H g : ℝ}
    (hε : 0 < ε) (hK : 0 ≤ K)
    (hTerr : ∀ z : EuclSpace d, ‖z‖ ≤ ε → |taylorErr φ x z| ≤ K * ε ^ 3)
    (hH : ‖fderiv ℝ (fderiv ℝ φ) x‖ ≤ H) (hg : 0 < g)
    (hgx : g ≤ ‖gradient φ x‖) :
    |sSup (φ '' closedBall x ε)
        - (φ x + ε * ‖gradient φ x‖
            + ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
                (fderiv ℝ (fderiv ℝ φ) x))|
      ≤ H * ε * Real.sqrt (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g))
        + K * ε ^ 3 := by
  -- the upper half
  have hup := sup_err_le hφ hx hε hK hTerr hH hg hgx
  -- the lower half
  have hlow := sSup_lower_infLap hφ hx hε
  have hshift : ‖ε • gradDir φ x‖ = ε := norm_eps_gradDir hx hε
  have hTs := hTerr (ε • gradDir φ x) (le_of_eq hshift)
  have hTs' := (abs_le.1 hTs).1
  -- the upper bound's extra term is nonnegative
  have hHnn : (0:ℝ) ≤ H :=
    le_trans (ContinuousLinearMap.opNorm_nonneg _) hH
  have hsq : (0:ℝ) ≤ Real.sqrt
      (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) := Real.sqrt_nonneg _
  have hextra : (0:ℝ) ≤ H * ε * Real.sqrt
      (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) := by
    have : (0:ℝ) ≤ H * ε := mul_nonneg hHnn (le_of_lt hε)
    exact mul_nonneg this hsq
  rw [abs_le]
  constructor
  · linarith [hlow, hTs', hextra]
  · exact hup

Plaplacian/SupBound.lean3 declarations

theoremle_sSup_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, \nu \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $\lVert \nu\rVert = 1$ hν
  • $0 < \varepsilon$ hε

Then φ (x + ε • ν) ≤ sSup (φ '' Metric.closedBall x ε).

/-- The supremum dominates the value at the shifted point. -/
theorem le_sSup_shift {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    (x : EuclSpace d) {ν : EuclSpace d} (hν : ‖ν‖ = 1) {ε : ℝ}
    (hε : 0 < ε) :
    φ (x + ε • ν) ≤ sSup (φ '' closedBall x ε) := by
  have hbdd : BddAbove (φ '' closedBall x ε) :=
    (isCompact_closedBall x ε).image hφ |>.bddAbove
  exact le_csSup hbdd ⟨x + ε • ν, mem_closedBall_shift x hν hε, rfl⟩
theoremsInf_shift_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, \nu \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $\lVert \nu\rVert = 1$ hν
  • $0 < \varepsilon$ hε

Then sInf (φ '' Metric.closedBall x ε) ≤ φ (x - ε • ν).

/-- Dually for the infimum. -/
theorem sInf_shift_le {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    (x : EuclSpace d) {ν : EuclSpace d} (hν : ‖ν‖ = 1) {ε : ℝ}
    (hε : 0 < ε) :
    sInf (φ '' closedBall x ε) ≤ φ (x - ε • ν) := by
  have hbdd : BddBelow (φ '' closedBall x ε) :=
    (isCompact_closedBall x ε).image hφ |>.bddBelow
  exact csInf_le hbdd ⟨x - ε • ν, mem_closedBall_shift_neg x hν hε, rfl⟩
theoremsSup_lower_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then φ x + ε * ‖gradient φ x‖ + 1 / 2 * ((fderiv ℝ (fderiv ℝ φ) x) (ε • PLaplacian.gradDir φ x)) (ε • PLaplacian.gradDir φ x) + PLaplacian.taylorErr φ x (ε • PLaplacian.gradDir φ x) ≤ sSup (φ '' Metric.closedBall x ε).

PLaplacian.sSup_lower_boundPlaplacian/SupBound.lean, lines 75–86
/-- **The lower bound on the supremum.** Taylor at the shifted point. -/
theorem sSup_lower_bound {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    φ x + ε * ‖gradient φ x‖
        + (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (ε • gradDir φ x)
            (ε • gradDir φ x)
        + taylorErr φ x (ε • gradDir φ x)
      ≤ sSup (φ '' closedBall x ε) := by
  have hcont : Continuous φ := hφ.continuous
  have h := le_sSup_shift hcont x (norm_gradDir hx) hε
  rw [decomp_at φ x (ε • gradDir φ x), fderiv_eq_at_shift hx] at h
  exact h

Plaplacian/SupConv.lean11 declarations

defsupConv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\xi \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The sup-convolution.** -/
def supConv (lam : ℝ) (u : EuclSpace d → ℝ) (ξ : EuclSpace d) : ℝ :=
  ⨆ x : EuclSpace d, (u x - lam / 2 * ‖x - ξ‖ ^ 2)
theorembddAbove_supConv_family
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\xi \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $u\text{ is bounded above}$ hub

Then BddAbove (Set.range fun x => u x - lam / 2 * ‖x - ξ‖ ^ 2).

PLaplacian.bddAbove_supConv_familyPlaplacian/SupConv.lean, lines 47–56
theorem bddAbove_supConv_family (hlam : 0 ≤ lam) (hub : BddAbove (range u))
    (ξ : EuclSpace d) :
    BddAbove (range fun x => u x - lam / 2 * ‖x - ξ‖ ^ 2) := by
  obtain ⟨SU, hSU⟩ := hub
  refine ⟨SU, ?_⟩
  rintro _ ⟨x, rfl⟩
  change u x - lam / 2 * ‖x - ξ‖ ^ 2 ≤ SU
  have h1 : u x ≤ SU := hSU ⟨x, rfl⟩
  have h2 : 0 ≤ lam / 2 * ‖x - ξ‖ ^ 2 := by positivity
  linarith
theoremle_supConv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, \xi \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $u\text{ is bounded above}$ hub

Then $u(x) - \mathrm{lam} / 2 \cdot \lVert x - \xi\rVert ^{2} \le \operatorname{supConv}(\mathrm{lam}, u, \xi)$.

theorem le_supConv (hlam : 0 ≤ lam) (hub : BddAbove (range u))
    (x ξ : EuclSpace d) : u x - lam / 2 * ‖x - ξ‖ ^ 2 ≤ supConv lam u ξ :=
  le_ciSup (bddAbove_supConv_family hlam hub ξ) x
theoremself_le_supConv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\xi \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $u\text{ is bounded above}$ hub

Then $u(\xi) \le \operatorname{supConv}(\mathrm{lam}, u, \xi)$.

PLaplacian.self_le_supConvPlaplacian/SupConv.lean, lines 62–66
/-- `u ≤ û`. -/
theorem self_le_supConv (hlam : 0 ≤ lam) (hub : BddAbove (range u))
    (ξ : EuclSpace d) : u ξ ≤ supConv lam u ξ := by
  have := le_supConv hlam hub ξ ξ
  simpa using this
theoremsupConv_le_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{SU} \in \mathbb{R}$, $\xi \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $\forall x,\ u(x) \le \mathrm{SU}$ hSU

Then $\operatorname{supConv}(\mathrm{lam}, u, \xi) \le \mathrm{SU}$.

PLaplacian.supConv_le_boundPlaplacian/SupConv.lean, lines 68–75
/-- `û ≤ sup u`. -/
theorem supConv_le_bound (hlam : 0 ≤ lam) {SU : ℝ} (hSU : ∀ x, u x ≤ SU)
    (ξ : EuclSpace d) : supConv lam u ξ ≤ SU := by
  apply ciSup_le
  intro x
  have h1 := hSU x
  have h2 : 0 ≤ lam / 2 * ‖x - ξ‖ ^ 2 := by positivity
  linarith
theoremsupConv_term_affine
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, \xi \in \mathbb{R}^{d}$.

Then $u(x) - \mathrm{lam} / 2 \cdot \lVert x - \xi\rVert ^{2} + \mathrm{lam} / 2 \cdot \lVert \xi\rVert ^{2} = u(x) - \mathrm{lam} / 2 \cdot \lVert x\rVert ^{2} + \mathrm{lam} \cdot \operatorname{inner}(\mathbb{R}, x, \xi)$.

PLaplacian.supConv_term_affinePlaplacian/SupConv.lean, lines 77–81
/-- The affine identity behind semiconvexity. -/
theorem supConv_term_affine (x ξ : EuclSpace d) :
    u x - lam / 2 * ‖x - ξ‖ ^ 2 + lam / 2 * ‖ξ‖ ^ 2
      = u x - lam / 2 * ‖x‖ ^ 2 + lam * inner ℝ x ξ := by
  rw [norm_sub_sq_real]; ring
theoremsemiconvex_supConv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $u\text{ is bounded above}$ hub

Then $\operatorname{SemiconvexWith}(\mathrm{lam}, \operatorname{supConv}(\mathrm{lam}, u))$.

PLaplacian.semiconvex_supConvPlaplacian/SupConv.lean, lines 83–104
/-- **The sup-convolution is semiconvex.** -/
theorem semiconvex_supConv (hlam : 0 ≤ lam) (hub : BddAbove (range u)) :
    SemiconvexWith lam (supConv lam u) := by
  refine ⟨convex_univ, fun ξ₁ _ ξ₂ _ a b ha hb hab => ?_⟩
  simp only [smul_eq_mul]
  set z := a • ξ₁ + b • ξ₂ with hz
  -- every term at z is the convex combination of the terms at ξ₁ and ξ₂
  have key : supConv lam u z ≤ a * (supConv lam u ξ₁ + lam / 2 * ‖ξ₁‖ ^ 2)
      + b * (supConv lam u ξ₂ + lam / 2 * ‖ξ₂‖ ^ 2) - lam / 2 * ‖z‖ ^ 2 := by
    apply ciSup_le
    intro x
    have e0 := supConv_term_affine (u := u) (lam := lam) x z
    have e1 := supConv_term_affine (u := u) (lam := lam) x ξ₁
    have e2 := supConv_term_affine (u := u) (lam := lam) x ξ₂
    have hin : inner ℝ x z = a * inner ℝ x ξ₁ + b * inner ℝ x ξ₂ := by
      rw [hz, inner_add_right, real_inner_smul_right, real_inner_smul_right]
    have h1 := le_supConv hlam hub x ξ₁
    have h2 := le_supConv hlam hub x ξ₂
    have hb' : b = 1 - a := by linarith
    subst hb'
    nlinarith [mul_le_mul_of_nonneg_left h1 ha, mul_le_mul_of_nonneg_left h2 hb]
  linarith
theoremusc_supConv_term
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\xi \in \mathbb{R}^{d}$.

Assume

  • $u\text{ is upper semicontinuous}$ hu

Then UpperSemicontinuous fun x => u x - lam / 2 * ‖x - ξ‖ ^ 2.

PLaplacian.usc_supConv_termPlaplacian/SupConv.lean, lines 112–120
/-- The term of the sup-convolution is upper semicontinuous. -/
theorem usc_supConv_term (hu : UpperSemicontinuous u) (ξ : EuclSpace d) :
    UpperSemicontinuous (fun x => u x - lam / 2 * ‖x - ξ‖ ^ 2) := by
  have hg : UpperSemicontinuous (fun x : EuclSpace d => -(lam / 2 * ‖x - ξ‖ ^ 2)) := by
    apply Continuous.upperSemicontinuous; fun_prop
  have heq : (fun x => u x - lam / 2 * ‖x - ξ‖ ^ 2)
      = fun x => u x + -(lam / 2 * ‖x - ξ‖ ^ 2) := by funext x; ring
  rw [heq]
  exact hu.add hg
theoremsupConv_attained
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\xi \in \mathbb{R}^{d}$.

Assume

  • $0 < \mathrm{lam}$ hlam
  • $u\text{ is upper semicontinuous}$ hu
  • $u\text{ is bounded above}$ hub

Then there exists $\mathrm{xs}$ such that:

  • $\operatorname{supConv}(\mathrm{lam}, u, \xi) = u(\mathrm{xs}) - \mathrm{lam} / 2 \cdot \lVert \mathrm{xs} - \xi\rVert ^{2}$
PLaplacian.supConv_attainedPlaplacian/SupConv.lean, lines 122–164
/-- **The supremum is attained**, for `u` upper semicontinuous. -/
theorem supConv_attained (hlam : 0 < lam) (hu : UpperSemicontinuous u)
    (hub : BddAbove (range u)) (ξ : EuclSpace d) :
    ∃ xs, supConv lam u ξ = u xs - lam / 2 * ‖xs - ξ‖ ^ 2 := by
  have hub' := hub
  obtain ⟨SU, hSU⟩ := hub
  set K := {x : EuclSpace d | lam / 2 * ‖x - ξ‖ ^ 2 ≤ SU - u ξ} with hKdef
  have hξK : ξ ∈ K := by
    change lam / 2 * ‖ξ - ξ‖ ^ 2 ≤ SU - u ξ
    have := hSU ⟨ξ, rfl⟩
    simp only [sub_self, norm_zero]
    have h0 : (0:ℝ) ^ 2 = 0 := by norm_num
    rw [h0, mul_zero]
    linarith
  have hKcl : IsClosed K := isClosed_le (by fun_prop) continuous_const
  have hKb : Bornology.IsBounded K := by
    refine (isBounded_closedBall (x := ξ) (r := 2 * (SU - u ξ) / lam + 1)).subset ?_
    intro x hx
    have hx' : lam / 2 * ‖x - ξ‖ ^ 2 ≤ SU - u ξ := hx
    rw [mem_closedBall, dist_eq_norm]
    have hsq : ‖x - ξ‖ ^ 2 ≤ 2 * (SU - u ξ) / lam := by
      rw [le_div_iff₀ hlam]; linarith
    nlinarith [sq_nonneg (‖x - ξ‖ - 1), norm_nonneg (x - ξ)]
  have hKc : IsCompact K := Metric.isCompact_of_isClosed_isBounded hKcl hKb
  obtain ⟨xs, _, hxsmax⟩ :=
    ((usc_supConv_term (lam := lam) hu ξ).upperSemicontinuousOn K).exists_isMaxOn
      ⟨ξ, hξK⟩ hKc
  refine ⟨xs, le_antisymm ?_ (le_supConv hlam.le hub' xs ξ)⟩
  apply ciSup_le
  intro x
  by_cases hx : x ∈ K
  · exact hxsmax hx
  · have h1 : SU - u ξ < lam / 2 * ‖x - ξ‖ ^ 2 := by
      by_contra h
      push Not at h
      exact hx h
    have h2 : u x ≤ SU := hSU ⟨x, rfl⟩
    have h3 : u ξ - lam / 2 * ‖ξ - ξ‖ ^ 2 ≤ u xs - lam / 2 * ‖xs - ξ‖ ^ 2 :=
      hxsmax hξK
    simp only [sub_self, norm_zero] at h3
    have h0 : (0:ℝ) ^ 2 = 0 := by norm_num
    rw [h0, mul_zero, sub_zero] at h3
    linarith
theoremsuperJet_of_supConv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\xi, \mathrm{xs}, p \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $u\text{ is bounded above}$ hub
  • $\operatorname{supConv}(\mathrm{lam}, u, \xi) = u(\mathrm{xs}) - \mathrm{lam} / 2 \cdot \lVert \mathrm{xs} - \xi\rVert ^{2}$ hmax
  • (p, X) ∈ PLaplacian.SuperJet (PLaplacian.supConv lam u) ξ hj

Then (p, X) ∈ PLaplacian.SuperJet u xs.

PLaplacian.superJet_of_supConvPlaplacian/SupConv.lean, lines 172–195
/-- **The magic property**: a superjet of the sup-convolution at `ξ` is a
superjet of `u` at the maximizer. -/
theorem superJet_of_supConv (hlam : 0 ≤ lam) (hub : BddAbove (range u))
    (hmax : supConv lam u ξ = u xs - lam / 2 * ‖xs - ξ‖ ^ 2)
    (hj : (p, X) ∈ SuperJet (supConv lam u) ξ) :
    (p, X) ∈ SuperJet u xs := by
  intro η hη
  have hT : Tendsto (fun x' : EuclSpace d => ξ + (x' - xs)) (𝓝 xs) (𝓝 ξ) := by
    have h0 : Continuous (fun x' : EuclSpace d => ξ + (x' - xs)) := by fun_prop
    have := h0.tendsto xs
    simpa using this
  filter_upwards [hT.eventually (hj η hη)] with x' hx'
  change supConv lam u (ξ + (x' - xs)) ≤ supConv lam u ξ
    + inner ℝ p (ξ + (x' - xs) - ξ)
    + (1 / 2) * (X (ξ + (x' - xs) - ξ)) (ξ + (x' - xs) - ξ)
    + η * ‖ξ + (x' - xs) - ξ‖ ^ 2 at hx'
  change u x' ≤ u xs + inner ℝ p (x' - xs) + (1 / 2) * (X (x' - xs)) (x' - xs)
    + η * ‖x' - xs‖ ^ 2
  have e1 : ξ + (x' - xs) - ξ = x' - xs := by abel
  rw [e1] at hx'
  have hle := le_supConv hlam hub x' (ξ + (x' - xs))
  have e2 : x' - (ξ + (x' - xs)) = xs - ξ := by abel
  rw [e2] at hle
  linarith
theoremsupConv_grad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\xi, \mathrm{xs}, p \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $u\text{ is bounded above}$ hub
  • $\operatorname{supConv}(\mathrm{lam}, u, \xi) = u(\mathrm{xs}) - \mathrm{lam} / 2 \cdot \lVert \mathrm{xs} - \xi\rVert ^{2}$ hmax
  • (p, X) ∈ PLaplacian.SuperJet (PLaplacian.supConv lam u) ξ hj

Then $p = \mathrm{lam} \cdot (\mathrm{xs} - \xi)$.

/-- **The gradient at a superjet of the sup-convolution** is `λ (x* - ξ)`. -/
theorem supConv_grad (hlam : 0 ≤ lam) (hub : BddAbove (range u))
    (hmax : supConv lam u ξ = u xs - lam / 2 * ‖xs - ξ‖ ^ 2)
    (hj : (p, X) ∈ SuperJet (supConv lam u) ξ) :
    p = lam • (xs - ξ) := by
  set a := lam • (xs - ξ) - p with hadef
  -- along every line, the coefficient of t vanishes
  have hline : ∀ w : EuclSpace d, inner ℝ a w = 0 := by
    intro w
    apply eq_zero_of_eventually_mul_le
      (C := lam / 2 * ‖w‖ ^ 2 + (1 / 2) * (X w) w + ‖w‖ ^ 2)
    have hT : Tendsto (fun t : ℝ => ξ + t • w) (𝓝 0) (𝓝 ξ) := by
      have h0 : Continuous (fun t : ℝ => ξ + t • w) :=
        continuous_const.add (continuous_id.smul continuous_const)
      have := h0.tendsto 0
      simpa using this
    filter_upwards [hT.eventually (hj 1 one_pos)] with t ht
    change supConv lam u (ξ + t • w) ≤ supConv lam u ξ + inner ℝ p (ξ + t • w - ξ)
      + (1 / 2) * (X (ξ + t • w - ξ)) (ξ + t • w - ξ)
      + 1 * ‖ξ + t • w - ξ‖ ^ 2 at ht
    have e1 : ξ + t • w - ξ = t • w := by abel
    rw [e1] at ht
    have hle := le_supConv hlam hub xs (ξ + t • w)
    have e2 : xs - (ξ + t • w) = (xs - ξ) - t • w := by abel
    rw [e2, norm_sub_sq_real] at hle
    simp only [inner_smul_right, map_smul, smul_eq_mul, norm_smul,
      Real.norm_eq_abs, mul_pow, sq_abs, smul_apply] at ht hle
    have ha : inner ℝ a w = lam * inner ℝ (xs - ξ) w - inner ℝ p w := by
      rw [hadef, inner_sub_left, real_inner_smul_left]
    rw [ha]
    nlinarith
  have h0 : inner ℝ a a = 0 := hline a
  have ha0 : a = 0 := inner_self_eq_zero.1 h0
  rw [hadef] at ha0
  exact (sub_eq_zero.1 ha0).symm

Plaplacian/SupConvJet.lean3 declarations

theoremsupConv_maximizer_close
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{SU} \in \mathbb{R}$, $\xi, \mathrm{xs} \in \mathbb{R}^{d}$.

Assume

  • $0 \le \mathrm{lam}$ hlam
  • $u\text{ is bounded above}$ hub
  • $\forall x,\ u(x) \le \mathrm{SU}$ hSU
  • $\operatorname{supConv}(\mathrm{lam}, u, \xi) = u(\mathrm{xs}) - \mathrm{lam} / 2 \cdot \lVert \mathrm{xs} - \xi\rVert ^{2}$ hxs

Then $\mathrm{lam} / 2 \cdot \lVert \mathrm{xs} - \xi\rVert ^{2} \le \mathrm{SU} - u(\xi)$.

PLaplacian.supConv_maximizer_closePlaplacian/SupConvJet.lean, lines 36–45
/-- **Maximizers of the sup-convolution are close.** -/
theorem supConv_maximizer_close (hlam : 0 ≤ lam) (hub : BddAbove (range u)) {SU : ℝ}
    (hSU : ∀ x, u x ≤ SU) {ξ xs : EuclSpace d}
    (hxs : supConv lam u ξ = u xs - lam / 2 * ‖xs - ξ‖ ^ 2) :
    lam / 2 * ‖xs - ξ‖ ^ 2 ≤ SU - u ξ := by
  have h1 : u ξ - lam / 2 * ‖ξ - ξ‖ ^ 2 ≤ supConv lam u ξ :=
    le_ciSup (bddAbove_supConv_family hlam hub ξ) ξ
  rw [sub_self, norm_zero] at h1
  have h2 := hSU xs
  nlinarith
theoremsupConv_jet
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $\xi \in \mathbb{R}^{d}$, $q \in \mathbb{R}^{d}$, $X \in \operatorname{Bilin}(d)$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $u\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ hsub
  • $0 < \mathrm{lam}$ hlam
  • $u\text{ is upper semicontinuous}$ hu
  • $u\text{ is bounded above}$ hub
  • $\forall \mathrm{xs},\ \operatorname{supConv}(\mathrm{lam}, u, \xi) = u(\mathrm{xs}) - \mathrm{lam} / 2 \cdot \lVert \mathrm{xs} - \xi\rVert ^{2} \to \mathrm{xs} \in \Omega$ hξ
  • (q, X) ∈ PLaplacian.SuperJet (PLaplacian.supConv lam u) ξ hj
  • $q \ne 0$ hq

Then $\operatorname{viscF}(p, q, X) \le 0$.

/-- **The jet form of the subsolution inequality for a sup-convolution.** -/
theorem supConv_jet (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) {Ω : Set (EuclSpace d)}
    (hsub : IsViscositySubsolution p Ω (fun _ => 0) u) (hlam : 0 < lam)
    (hu : UpperSemicontinuous u) (hub : BddAbove (range u)) {ξ : EuclSpace d}
    (hξ : ∀ xs, supConv lam u ξ = u xs - lam / 2 * ‖xs - ξ‖ ^ 2 → xs ∈ Ω)
    {q : EuclSpace d} {X : Bilin d} (hj : (q, X) ∈ SuperJet (supConv lam u) ξ)
    (hq : q ≠ 0) : viscF p q X ≤ 0 := by
  obtain ⟨xs, hxs⟩ := supConv_attained hlam hu hub ξ
  exact superJet_regular hd hp hsub (hξ xs hxs) (superJet_of_supConv hlam.le hub hxs hj) hq
theoremsupConv_maximizer_mem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\mathrm{lam} \in \mathbb{R}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $\mathrm{SU}, \mathrm{SL} \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $\xi \in \mathbb{R}^{d}$, $\rho \in \mathbb{R}$, $\mathrm{xs} \in \mathbb{R}^{d}$.

Assume

  • $0 < \mathrm{lam}$ hlam
  • $u\text{ is bounded above}$ hub
  • $\forall x,\ u(x) \le \mathrm{SU}$ hSU
  • $\forall x,\ \mathrm{SL} \le u(x)$ hSL
  • $2 \cdot (\mathrm{SU} - \mathrm{SL}) / \mathrm{lam} < \rho ^{2}$ hρ
  • $0 < \rho$ hρ0
  • $B(\xi, \rho) \subseteq \Omega$ hball
  • $\operatorname{supConv}(\mathrm{lam}, u, \xi) = u(\mathrm{xs}) - \mathrm{lam} / 2 \cdot \lVert \mathrm{xs} - \xi\rVert ^{2}$ a._@._internal._hyg.0

Then $\mathrm{xs} \in \Omega$.

PLaplacian.supConv_maximizer_memPlaplacian/SupConvJet.lean, lines 57–71
/-- **Maximizers lie in `Ω` when a ball around `ξ` does.** -/
theorem supConv_maximizer_mem (hlam : 0 < lam) (hub : BddAbove (range u)) {SU SL : ℝ}
    (hSU : ∀ x, u x ≤ SU) (hSL : ∀ x, SL ≤ u x) {Ω : Set (EuclSpace d)} {ξ : EuclSpace d}
    {ρ : ℝ} (hρ : 2 * (SU - SL) / lam < ρ ^ 2) (hρ0 : 0 < ρ) (hball : ball ξ ρ ⊆ Ω) :
    ∀ xs, supConv lam u ξ = u xs - lam / 2 * ‖xs - ξ‖ ^ 2 → xs ∈ Ω := by
  intro xs hxs
  apply hball
  rw [mem_ball, dist_eq_norm]
  have h1 := supConv_maximizer_close hlam.le hub hSU hxs
  have h2 := hSL ξ
  have h3 : ‖xs - ξ‖ ^ 2 ≤ 2 * (SU - SL) / lam := by
    rw [le_div_iff₀ hlam]
    nlinarith
  have h4 : ‖xs - ξ‖ ^ 2 < ρ ^ 2 := lt_of_le_of_lt h3 hρ
  exact lt_of_pow_lt_pow_left₀ 2 hρ0.le h4

Plaplacian/SupErrUnif.lean1 declarations

theoremsup_err_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon, K, H, g \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε
  • $0 \le K$ hK
  • $\forall z,\ \lVert z\rVert \le \varepsilon \to \lvert \operatorname{taylorErr}(\varphi, x, z)\rvert \le K \cdot \varepsilon ^{3}$ hTerr
  • $\lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)\rVert \le H$ hH
  • $0 < g$ hg
  • $g \le \lVert \operatorname{gradient}(\varphi, x)\rVert$ hgx

Then sSup (φ '' Metric.closedBall x ε) - (φ x + ε * ‖gradient φ x‖ + ε ^ 2 / 2 * PLaplacian.infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x)) ≤ H * ε * √(2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g)) + K * ε ^ 3.

/-- **The supremum's upper error, uniformly.** -/
theorem sup_err_le {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε K H g : ℝ}
    (hε : 0 < ε) (hK : 0 ≤ K)
    (hTerr : ∀ z : EuclSpace d, ‖z‖ ≤ ε → |taylorErr φ x z| ≤ K * ε ^ 3)
    (hH : ‖fderiv ℝ (fderiv ℝ φ) x‖ ≤ H) (hg : 0 < g)
    (hgx : g ≤ ‖gradient φ x‖) :
    sSup (φ '' closedBall x ε)
        - (φ x + ε * ‖gradient φ x‖
            + ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
                (fderiv ℝ (fderiv ℝ φ) x))
      ≤ H * ε * Real.sqrt (2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g))
        + K * ε ^ 3 := by
  obtain ⟨y, hyMem, _hsup, hdom, hbound⟩ := sup_upper_at_max hφ hx hε
  have hyb : ‖y - x‖ ≤ ε := norm_sub_le_of_mem hyMem
  have hshift : ‖ε • gradDir φ x‖ = ε := norm_eps_gradDir hx hε
  have hTy := hTerr (y - x) hyb
  have hTs := hTerr (ε • gradDir φ x) (le_of_eq hshift)
  -- the localization distance, uniformly
  have hD := loc_dist_unif hx hε hK hyb hdom hTy hTs hH hg hgx
  set U := 2 * ε * ((H * ε ^ 2 + 2 * K * ε ^ 3) / g) with hU
  -- the factors and their bounds
  have hHnn : (0:ℝ) ≤ H :=
    le_trans (ContinuousLinearMap.opNorm_nonneg _) hH
  have hsum : ‖y - x‖ + ‖ε • gradDir φ x‖ ≤ 2 * ε := by
    rw [hshift]; linarith [hyb]
  have hsumnn : (0:ℝ) ≤ ‖y - x‖ + ‖ε • gradDir φ x‖ := by positivity
  have hsqnn : (0:ℝ) ≤ Real.sqrt U := Real.sqrt_nonneg U
  -- the comparison term
  have hAB : ‖fderiv ℝ (fderiv ℝ φ) x‖ * ‖y - x - ε • gradDir φ x‖
      ≤ H * Real.sqrt U :=
    mul_le_mul hH hD (norm_nonneg _) hHnn
  have hABC : ‖fderiv ℝ (fderiv ℝ φ) x‖ * ‖y - x - ε • gradDir φ x‖
        * (‖y - x‖ + ‖ε • gradDir φ x‖)
      ≤ H * Real.sqrt U * (2 * ε) :=
    mul_le_mul hAB hsum hsumnn (mul_nonneg hHnn hsqnn)
  have hcomp : (1 / 2) * (‖fderiv ℝ (fderiv ℝ φ) x‖
        * ‖y - x - ε • gradDir φ x‖ * (‖y - x‖ + ‖ε • gradDir φ x‖))
      ≤ H * ε * Real.sqrt U := by
    nlinarith [hABC]
  -- the Taylor error at the maximizer
  have hTy' := (abs_le.1 hTy).2
  linarith [hbound, hcomp, hTy']

Plaplacian/SupFreq.lean2 declarations

defsupBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r, \varepsilon \in \mathbb{R}$.

Its value lies in $\mathbb{R}$.

/-- The parameter's supremum over the closed ball. -/
def supBall (u : ℝ → EuclSpace d → ℝ) (φ : EuclSpace d → ℝ)
    (x₀ : EuclSpace d) (r ε : ℝ) : ℝ :=
  sSup ((fun w => u ε w - φ w) '' closedBall x₀ r)
theoremfrequently_supBall_large
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r, \delta \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < r$ hr
  • $0 < \delta$ hδ

Then ∃ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), PLaplacian.ubar u x₀ - φ x₀ - δ < PLaplacian.supBall u φ x₀ r ε.

PLaplacian.frequently_supBall_largePlaplacian/SupFreq.lean, lines 57–85
/-- **The supremum is frequently near the maximum.** -/
theorem frequently_supBall_large (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    (x₀ : EuclSpace d) {r δ : ℝ} (hr : 0 < r) (hδ : 0 < δ) :
    ∃ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0),
      ubar u x₀ - φ x₀ - δ < supBall u φ x₀ r ε := by
  -- near-contact, frequently on the product
  have hnear := frequently_near_max u hC hφ hB x₀ hδ
  -- the point eventually in the ball
  have hin : ∀ᶠ q in relaxFilter x₀, q.2 ∈ closedBall x₀ r := by
    have h := eventually_near (x₀ := x₀) (r := 2 * r) (by linarith)
    filter_upwards [h] with q hq
    rw [mem_closedBall, dist_eq_norm]
    have : ‖q.2 - x₀‖ < 2 * r / 2 := hq.2
    linarith [this]
  -- both, frequently
  have hboth := hnear.and_eventually hin
  -- so the supremum is large, a property of the parameter alone
  have hsup : ∃ᶠ q in relaxFilter x₀,
      ubar u x₀ - φ x₀ - δ < supBall u φ x₀ r q.1 := by
    refine hboth.mono ?_
    rintro q ⟨hv, hmem⟩
    have hle := le_sup_on_ball u hC hB x₀ (r := r) (ε := q.1) q.2 hmem
    unfold supBall
    linarith [hv, hle]
  -- project to the parameter
  unfold relaxFilter at hsup
  exact frequently_fst_of_prod hsup

Plaplacian/SupMax.lean1 declarations

theoremsup_upper_at_max
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • sSup ( φ '' Metric.closedBall x ε ) = φ y
  • $\varphi(x + (y - x)) \ge \varphi(x + \varepsilon \cdot \operatorname{gradDir}(\varphi, x))$
  • sSup ( φ '' Metric.closedBall x ε ) ≤ φ x + ε * ‖ gradient φ x ‖ + ε ^ 2 / 2 * PLaplacian.infLaplacianOf ( gradient φ x ) ( fderiv ℝ ( fderiv ℝ φ ) x ) + 1 / 2 * ( ‖ fderiv ℝ ( fderiv ℝ φ ) x ‖ * ‖ y - x - ε • PLaplacian.gradDir φ x ‖ * ( ‖ y - x ‖ + ‖ ε • PLaplacian.gradDir φ x ‖ ) ) + PLaplacian.taylorErr φ x ( y - x )
PLaplacian.sup_upper_at_maxPlaplacian/SupMax.lean, lines 55–107
/-- **The maximizer, with attainment, domination and the upper bound.** -/
theorem sup_upper_at_max {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε,
      sSup (φ '' closedBall x ε) = φ y
      ∧ φ (x + (y - x)) ≥ φ (x + ε • gradDir φ x)
      ∧ sSup (φ '' closedBall x ε)
          ≤ φ x + ε * ‖gradient φ x‖
            + ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
                (fderiv ℝ (fderiv ℝ φ) x)
            + (1 / 2) * (‖fderiv ℝ (fderiv ℝ φ) x‖
                * ‖(y - x) - ε • gradDir φ x‖
                * (‖y - x‖ + ‖ε • gradDir φ x‖))
            + taylorErr φ x (y - x) := by
  obtain ⟨y, hyMem, hySup⟩ := exists_sSup_closedBall hφ.continuous x hε
  have hxy : x + (y - x) = y := by abel
  -- domination: the maximizer's value is the supremum, which dominates
  have hdom : φ (x + (y - x)) ≥ φ (x + ε • gradDir φ x) := by
    rw [hxy, ← hySup]
    exact le_sSup_shift hφ.continuous x (norm_gradDir hx) hε
  refine ⟨y, hyMem, hySup, hdom, ?_⟩
  -- the decomposed value at the maximizer
  have hval : sSup (φ '' closedBall x ε)
      = φ x + ‖gradient φ x‖ * inner ℝ (gradDir φ x) (y - x)
        + (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (y - x) (y - x)
        + taylorErr φ x (y - x) := by
    rw [hySup]
    conv_lhs => rw [← hxy]
    rw [decomp_at φ x (y - x), fderiv_eq_norm_mul_inner hx]
  -- the linear term is at most ε times the gradient norm
  have hcs : inner ℝ (gradDir φ x) (y - x) ≤ ε := by
    have h1 := inner_gradDir_le hx (y - x)
    have h2 := norm_sub_le_of_mem hyMem
    linarith [h1, h2]
  have hgnn : (0:ℝ) ≤ ‖gradient φ x‖ := norm_nonneg _
  -- the quadratic term, compared with the one at the shifted point
  have hcmp := quad_diff_bound (fderiv ℝ (fderiv ℝ φ) x) (y - x)
    (ε • gradDir φ x)
  have hcmp' := (abs_le.1 hcmp).2
  have hq := quad_at_shift (φ := φ) x ε
  have hstep : (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (y - x) (y - x)
      ≤ ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
            (fderiv ℝ (fderiv ℝ φ) x)
        + (1 / 2) * (‖fderiv ℝ (fderiv ℝ φ) x‖
            * ‖(y - x) - ε • gradDir φ x‖
            * (‖y - x‖ + ‖ε • gradDir φ x‖)) := by
    have hqq : (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (ε • gradDir φ x)
        (ε • gradDir φ x)
        = ε ^ 2 / 2 * infLaplacianOf (gradient φ x)
            (fderiv ℝ (fderiv ℝ φ) x) := hq
    linarith [hcmp', hqq]
  rw [hval]
  nlinarith [hcs, hgnn, hstep]

Plaplacian/SupUpper.lean3 declarations

theoremsSup_eq_at_max
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • sSup ( φ '' Metric.closedBall x ε ) = φ x + ‖ gradient φ x ‖ * inner ℝ ( PLaplacian.gradDir φ x ) ( y - x ) + 1 / 2 * ( ( fderiv ℝ ( fderiv ℝ φ ) x ) ( y - x ) ) ( y - x ) + PLaplacian.taylorErr φ x ( y - x )
/-- The supremum, expanded at the maximizer. -/
theorem sSup_eq_at_max {φ : EuclSpace d → ℝ} (hφ : Continuous φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε,
      sSup (φ '' closedBall x ε)
        = φ x + ‖gradient φ x‖ * inner ℝ (gradDir φ x) (y - x)
          + (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (y - x) (y - x)
          + taylorErr φ x (y - x) := by
  obtain ⟨y, hyMem, hySup⟩ := exists_sSup_closedBall hφ x hε
  refine ⟨y, hyMem, ?_⟩
  rw [hySup]
  have hxy : x + (y - x) = y := by abel
  conv_lhs => rw [← hxy]
  rw [decomp_at φ x (y - x), fderiv_eq_norm_mul_inner hx]
theoremnorm_sub_le_of_mem
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x, y \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $y \in \overline{B}(x, \varepsilon)$ hy

Then $\lVert y - x\rVert \le \varepsilon$.

PLaplacian.norm_sub_le_of_memPlaplacian/SupUpper.lean, lines 68–72
/-- The increment at a point of the closed ball has norm at most `ε`. -/
theorem norm_sub_le_of_mem {x y : EuclSpace d} {ε : ℝ}
    (hy : y ∈ closedBall x ε) : ‖y - x‖ ≤ ε := by
  rw [← dist_eq_norm]
  exact mem_closedBall.1 hy
theoremsSup_upper_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then there exists $y \in \overline{B}(x, \varepsilon)$ such that:

  • sSup ( φ '' Metric.closedBall x ε ) ≤ φ x + ε * ‖ gradient φ x ‖ + 1 / 2 * ( ( fderiv ℝ ( fderiv ℝ φ ) x ) ( y - x ) ) ( y - x ) + PLaplacian.taylorErr φ x ( y - x )
PLaplacian.sSup_upper_boundPlaplacian/SupUpper.lean, lines 74–90
/-- **The upper bound on the supremum.** -/
theorem sSup_upper_bound {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    ∃ y ∈ closedBall x ε,
      sSup (φ '' closedBall x ε)
        ≤ φ x + ε * ‖gradient φ x‖
          + (1 / 2) * fderiv ℝ (fderiv ℝ φ) x (y - x) (y - x)
          + taylorErr φ x (y - x) := by
  obtain ⟨y, hyMem, hyEq⟩ := sSup_eq_at_max hφ.continuous hx hε
  refine ⟨y, hyMem, ?_⟩
  rw [hyEq]
  have hcs : inner ℝ (gradDir φ x) (y - x) ≤ ε := by
    have h1 := inner_gradDir_le hx (y - x)
    have h2 := norm_sub_le_of_mem hyMem
    linarith [h1, h2]
  have hgnn : (0:ℝ) ≤ ‖gradient φ x‖ := norm_nonneg _
  nlinarith [hcs, hgnn]

Plaplacian/Super.lean3 declarations

theoremlaplacianOf_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then $\operatorname{laplacianOf}(- X) = - \operatorname{laplacianOf}(X)$.

PLaplacian.laplacianOf_negPlaplacian/Super.lean, lines 51–55
/-- The Laplacian of a negated bilinear form. -/
theorem laplacianOf_neg (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    laplacianOf (-X) = - laplacianOf X := by
  unfold laplacianOf
  simp [Finset.sum_neg_distrib]
theoremnormPLapOf_neg
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Then PLaplacian.normPLapOf p (gradient (fun y => -φ y) x) (fderiv ℝ (fderiv ℝ fun y => -φ y) x) = -PLaplacian.normPLapOf p (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x).

PLaplacian.normPLapOf_negPlaplacian/Super.lean, lines 57–64
/-- **The normalized `p`-Laplacian flips sign under negation.** -/
theorem normPLapOf_neg (p : ℝ) (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    normPLapOf p (gradient (fun y => -φ y) x)
        (fderiv ℝ (fderiv ℝ (fun y => -φ y)) x)
      = - normPLapOf p (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) := by
  unfold normPLapOf
  rw [infLaplacianOf_neg, hess_neg, laplacianOf_neg]
  ring
theoremregular_supsolTheorem 4.7 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\varphi\text{ is admissible (bounded and Borel measurable)}$ hφb
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < r$ hr
  • $\overline{B}(x_{0}, r) \subseteq \Omega$ hΩ
  • $\forall w \in \overline{B}(x_{0}, r),\ w \ne x_{0} \to \underline{u}(x_{0}) - \varphi(x_{0}) < \underline{u}(w) - \varphi(w)$ hmin
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hx₀

Then $\operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x_{0})) \le 0$.

PLaplacian.regular_supsolPlaplacian/Super.lean, lines 66–100
/-- **The regular-case supersolution inequality.** -/
theorem regular_supsol [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) (hφb : BddMeas φ)
    {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    {x₀ : EuclSpace d} {r : ℝ} (hr : 0 < r) (hΩ : closedBall x₀ r ⊆ Ω)
    (hmin : ∀ w ∈ closedBall x₀ r, w ≠ x₀ →
      lbar u x₀ - φ x₀ < lbar u w - φ w)
    (hx₀ : gradient φ x₀ ≠ 0) :
    normPLapOf p (gradient φ x₀) (fderiv ℝ (fderiv ℝ φ) x₀) ≤ 0 := by
  -- the negated family and test function
  have hCn : ∀ ε y, |(fun ε y => -u ε y) ε y| ≤ C := by
    intro ε y; simp only; rw [abs_neg]; exact hC ε y
  have hun : ∀ ε > 0, IsPHarmonious p ε Ω (fun y => -F y)
      ((fun ε y => -u ε y) ε) :=
    fun ε hε => isPHarmonious_neg (hu ε hε)
  have hBn : ∀ y, |(fun y => -φ y) y| ≤ B := by
    intro y; simp only; rw [abs_neg]; exact hB y
  -- the strict minimum becomes a strict maximum of the negations
  have hstrict : IsStrictMaxOn
      (fun w => ubar (fun ε y => -u ε y) w - (fun y => -φ y) w) x₀ r := by
    intro w hw hne
    have h1 := lbar_eq_neg_ubar_neg u w
    have h2 := lbar_eq_neg_ubar_neg u x₀
    have h3 := hmin w hw hne
    simp only
    linarith [h1, h2, h3]
  -- the subsolution inequality for the negations
  have h := regular_subsol hd hp hpd hCn hun (contDiff_neg' hφ)
    (bddMeas_neg hφb) hBn hr hΩ hstrict (gradient_neg_ne_zero hx₀)
  rw [normPLapOf_neg] at h
  linarith [h]

Plaplacian/SuperForm.lean3 declarations

theoremnonpos_of_rate
Formal statementgenerated from the Lean declaration

Let $I \in \mathbb{R}$, $q \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Tendsto}(q, \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0)), \operatorname{nhds}(0))$ hq
  • ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Set.Ioi 0), I ≤ q ε hle

Then $I \le 0$.

/-- **The dual limit argument.** A quantity bounded above by terms tending to
zero is nonpositive. -/
theorem nonpos_of_rate {I : ℝ} {q : ℝ → ℝ}
    (hq : Filter.Tendsto q (nhdsWithin (0 : ℝ) (Set.Ioi 0)) (nhds 0))
    (hle : ∀ᶠ ε in nhdsWithin (0 : ℝ) (Set.Ioi 0), I ≤ q ε) :
    I ≤ 0 :=
  ge_of_tendsto hq hle
theoremle_viscF_of_nonpos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Assume

  • $\operatorname{normPLapOf}(p, q, X) \le 0$ h

Then $0 \le \operatorname{viscF}(p, q, X)$.

PLaplacian.le_viscF_of_nonposPlaplacian/SuperForm.lean, lines 56–62
/-- **The predicate's requirement for a supersolution.** -/
theorem le_viscF_of_nonpos {p : ℝ} {q : EuclSpace d}
    {X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ}
    (h : normPLapOf p q X ≤ 0) :
    0 ≤ viscF p q X := by
  rw [viscF_eq_neg]
  linarith [h]
theoremle_viscF_of_chain
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x)) \le 0$ h

Then $0 \le \operatorname{viscF}(p, \operatorname{gradient}(\varphi, x), \operatorname{hess}(\varphi, x))$.

PLaplacian.le_viscF_of_chainPlaplacian/SuperForm.lean, lines 64–69
/-- In the predicate's exact notation. -/
theorem le_viscF_of_chain {p : ℝ} {φ : EuclSpace d → ℝ} {x : EuclSpace d}
    (h : normPLapOf p (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x) ≤ 0) :
    0 ≤ viscF p (gradient φ x) (hess φ x) := by
  rw [hess_eq_fderiv]
  exact le_viscF_of_nonpos h

Plaplacian/Taylor1D.lean4 declarations

theoremuIoo_zero_one
Formal statementgenerated from the Lean declaration

$\operatorname{uIoo}(0, 1) = \operatorname{Ioo}(0, 1)$.

/-- `uIoo 0 1` is `Ioo 0 1`. -/
theorem uIoo_zero_one : uIoo (0 : ℝ) 1 = Ioo 0 1 := by
  rw [uIoo_of_le (by norm_num : (0:ℝ) ≤ 1)]
theoremcontDiffOn_of_contDiff
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, g)$ hg

Then $\operatorname{ContDiffOn}(\mathbb{R}, 1, g, \operatorname{uIcc}(0, 1))$.

PLaplacian.contDiffOn_of_contDiffPlaplacian/Taylor1D.lean, lines 63–67
/-- Taylor's first hypothesis. -/
theorem contDiffOn_of_contDiff (g : ℝ → ℝ) (hg : ContDiff ℝ 2 g) :
    ContDiffOn ℝ 1 g (uIcc (0:ℝ) 1) := by
  refine ContDiff.contDiffOn ?_
  exact hg.of_le (by norm_num)
theoremdifferentiableOn_iteratedDerivWithin_one
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, g)$ hg

Then $\operatorname{DifferentiableOn}(\mathbb{R}, \operatorname{iteratedDerivWithin}(1, g, \operatorname{uIcc}(0, 1)), \operatorname{uIoo}(0, 1))$.

PLaplacian.differentiableOn_iteratedDerivWithin_onePlaplacian/Taylor1D.lean, lines 69–84
/-- Taylor's second hypothesis: the within-derivative is differentiable on the
open interval, because there it agrees with `deriv g` on a neighbourhood. -/
theorem differentiableOn_iteratedDerivWithin_one (g : ℝ → ℝ)
    (hg : ContDiff ℝ 2 g) :
    DifferentiableOn ℝ (iteratedDerivWithin 1 g (uIcc (0:ℝ) 1))
      (uIoo (0:ℝ) 1) := by
  rw [uIoo_zero_one]
  intro t ht
  have htmm : t ∈ Ioo (min (0:ℝ) 1) (max (0:ℝ) 1) := by
    simpa using ht
  have heq : iteratedDerivWithin 1 g (uIcc (0:ℝ) 1) =ᶠ[nhds t] deriv g := by
    rw [iteratedDerivWithin_one]
    exact derivWithin_eventuallyEq g htmm
  have hd : DifferentiableAt ℝ (deriv g) t :=
    (ContDiff.differentiable_deriv_two hg) t
  exact ((hd.congr_of_eventuallyEq heq).differentiableWithinAt)
theoremtaylor_one_deriv
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, g)$ hg

Then there exists $\xi \in \operatorname{Ioo}(0, 1)$ such that:

  • $g(1) = g(0) + \operatorname{deriv}(g, 0) + 1 / 2 \cdot \operatorname{deriv}(\operatorname{deriv}(g), \xi)$
PLaplacian.taylor_one_derivPlaplacian/Taylor1D.lean, lines 86–102
/-- **One-dimensional Taylor at order one, in plain `deriv` form.** -/
theorem taylor_one_deriv (g : ℝ → ℝ) (hg : ContDiff ℝ 2 g) :
    ∃ ξ ∈ Ioo (0:ℝ) 1,
      g 1 = g 0 + deriv g 0 + (1/2) * deriv (deriv g) ξ := by
  obtain ⟨ξ, hξ, hres⟩ := taylor_mean_remainder_lagrange
    (f := g) (x₀ := 0) (x := 1) (n := 1)
    (by norm_num) (contDiffOn_of_contDiff g hg)
    (differentiableOn_iteratedDerivWithin_one g hg)
  rw [uIoo_zero_one] at hξ
  refine ⟨ξ, hξ, ?_⟩
  have htmm : ξ ∈ Ioo (min (0:ℝ) 1) (max (0:ℝ) 1) := by simpa using hξ
  rw [uIcc_zero_one] at hres
  rw [taylorWithinEval_one_unit_deriv g (hg.differentiable (by norm_num))]
    at hres
  rw [← uIcc_zero_one, iteratedDerivWithin_two_eq g htmm] at hres
  norm_num at hres
  linarith [hres]

Plaplacian/Taylor2D.lean3 declarations

theoremderiv_restrict
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then (deriv fun s => φ (PLaplacian.lineMap x z s)) = fun t => (fderiv ℝ φ (PLaplacian.lineMap x z t)) z.

/-- The first derivative of the restriction, as a function. -/
theorem deriv_restrict {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x z : EuclSpace d) :
    deriv (fun s : ℝ => φ (lineMap x z s))
      = fun t => fderiv ℝ φ (lineMap x z t) z := by
  funext t
  exact (hasDerivAt_first hφ x z t).deriv
theoremderiv_deriv_restrict
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then deriv (deriv fun s => φ (PLaplacian.lineMap x z s)) = fun t => ((fderiv ℝ (fderiv ℝ φ) (PLaplacian.lineMap x z t)) z) z.

PLaplacian.deriv_deriv_restrictPlaplacian/Taylor2D.lean, lines 60–67
/-- The second derivative of the restriction, as a function. -/
theorem deriv_deriv_restrict {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x z : EuclSpace d) :
    deriv (deriv (fun s : ℝ => φ (lineMap x z s)))
      = fun t => fderiv ℝ (fderiv ℝ φ) (lineMap x z t) z z := by
  rw [deriv_restrict hφ]
  funext t
  exact (hasDerivAt_second_at hφ x z t).deriv
theoremtaylor_two_lagrange
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then there exists $\xi \in \operatorname{Ioo}(0, 1)$ such that:

  • $\varphi(x + z) = \varphi(x) + (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(z) + 1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x + \xi \cdot z))(z))(z)$
PLaplacian.taylor_two_lagrangePlaplacian/Taylor2D.lean, lines 69–82
/-- **The several-variable expansion with Lagrange remainder.** -/
theorem taylor_two_lagrange {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x z : EuclSpace d) :
    ∃ ξ ∈ Ioo (0:ℝ) 1,
      φ (x + z) = φ x + fderiv ℝ φ x z
        + (1/2) * fderiv ℝ (fderiv ℝ φ) (x + ξ • z) z z := by
  obtain ⟨ξ, hξ, hres⟩ :=
    taylor_one_deriv (fun s : ℝ => φ (lineMap x z s))
      (contDiff_restrict hφ x z)
  refine ⟨ξ, hξ, ?_⟩
  rw [deriv_restrict hφ] at hres
  rw [(hasDerivAt_second_at hφ x z ξ).deriv] at hres
  simp only [lineMap] at hres
  simpa using hres

Plaplacian/Taylor2Deriv.lean5 declarations

theoremcontDiffOn_two_of_three
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, g)$ hg

Then $\operatorname{ContDiffOn}(\mathbb{R}, 2, g, \operatorname{uIcc}(0, 1))$.

PLaplacian.contDiffOn_two_of_threePlaplacian/Taylor2Deriv.lean, lines 62–64
theorem contDiffOn_two_of_three (g : ℝ → ℝ) (hg : ContDiff ℝ 3 g) :
    ContDiffOn ℝ 2 g (uIcc (0:ℝ) 1) :=
  (hg.of_le (by norm_num)).contDiffOn
theoremdifferentiableOn_iteratedDerivWithin_two
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, g)$ hg

Then $\operatorname{DifferentiableOn}(\mathbb{R}, \operatorname{iteratedDerivWithin}(2, g, \operatorname{uIcc}(0, 1)), \operatorname{uIoo}(0, 1))$.

PLaplacian.differentiableOn_iteratedDerivWithin_twoPlaplacian/Taylor2Deriv.lean, lines 66–79
theorem differentiableOn_iteratedDerivWithin_two (g : ℝ → ℝ)
    (hg : ContDiff ℝ 3 g) :
    DifferentiableOn ℝ (iteratedDerivWithin 2 g (uIcc (0:ℝ) 1))
      (uIoo (0:ℝ) 1) := by
  rw [uIoo_zero_one]
  intro t ht
  have htmm : t ∈ Ioo (min (0:ℝ) 1) (max (0:ℝ) 1) := by simpa using ht
  have heq : iteratedDerivWithin 2 g (uIcc (0:ℝ) 1) =ᶠ[nhds t]
      deriv (deriv g) :=
    iteratedDerivWithin_two_eventuallyEq g htmm
  have h1 : ContDiff ℝ 2 (deriv g) := ContDiff.deriv' hg
  have hd : DifferentiableAt ℝ (deriv (deriv g)) t :=
    (ContDiff.differentiable_deriv_two h1) t
  exact (hd.congr_of_eventuallyEq heq).differentiableWithinAt
theoremiteratedDerivWithin_one_eqOn
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $a, b \in \mathbb{R}$.

Assume

  • $\operatorname{Differentiable}(\mathbb{R}, g)$ hg
  • $a < b$ hab

Then $\operatorname{EqOn}(\operatorname{iteratedDerivWithin}(1, g, \operatorname{Icc}(a, b)), \operatorname{deriv}(g), \operatorname{Icc}(a, b))$.

PLaplacian.iteratedDerivWithin_one_eqOnPlaplacian/Taylor2Deriv.lean, lines 81–85
theorem iteratedDerivWithin_one_eqOn (g : ℝ → ℝ) (hg : Differentiable ℝ g)
    {a b : ℝ} (hab : a < b) :
    EqOn (iteratedDerivWithin 1 g (Icc a b)) (deriv g) (Icc a b) := by
  intro t ht
  exact iteratedDerivWithin_one_endpoint g hg hab ht
theoremiteratedDerivWithin_two_endpoint
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $a, b, t \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, g)$ hg
  • $a < b$ hab
  • $t \in \operatorname{Icc}(a, b)$ ht

Then $\operatorname{iteratedDerivWithin}(2, g, \operatorname{Icc}(a, b), t) = \operatorname{deriv}(\operatorname{deriv}(g), t)$.

PLaplacian.iteratedDerivWithin_two_endpointPlaplacian/Taylor2Deriv.lean, lines 87–99
theorem iteratedDerivWithin_two_endpoint (g : ℝ → ℝ)
    (hg : ContDiff ℝ 2 g) {a b t : ℝ} (hab : a < b) (ht : t ∈ Icc a b) :
    iteratedDerivWithin 2 g (Icc a b) t = deriv (deriv g) t := by
  rw [show (2 : Nat) = 1 + 1 from rfl, iteratedDerivWithin_succ]
  have hcongr : derivWithin (iteratedDerivWithin 1 g (Icc a b)) (Icc a b) t
      = derivWithin (deriv g) (Icc a b) t := by
    apply derivWithin_congr
    · exact iteratedDerivWithin_one_eqOn g (hg.differentiable (by norm_num)) hab
    · exact iteratedDerivWithin_one_endpoint g
        (hg.differentiable (by norm_num)) hab ht
  rw [hcongr]
  exact (ContDiff.differentiable_deriv_two hg t).derivWithin
    (uniqueDiffOn_Icc hab t ht)
theoremtaylor_two_deriv
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, g)$ hg

Then there exists $\xi \in \operatorname{Ioo}(0, 1)$ such that:

  • $g(1) = g(0) + \operatorname{deriv}(g, 0) + 1 / 2 \cdot \operatorname{deriv}(\operatorname{deriv}(g), 0) + 1 / 6 \cdot \operatorname{deriv}(\operatorname{deriv}(\operatorname{deriv}(g)), \xi)$
/-- **Order-two Taylor with Lagrange remainder, in plain `deriv` form.** -/
theorem taylor_two_deriv (g : ℝ → ℝ) (hg : ContDiff ℝ 3 g) :
    ∃ ξ ∈ Ioo (0:ℝ) 1,
      g 1 = g 0 + deriv g 0 + (1/2) * deriv (deriv g) 0
        + (1/6) * deriv (deriv (deriv g)) ξ := by
  obtain ⟨ξ, hξ, hres⟩ := taylor_mean_remainder_lagrange
    (f := g) (x₀ := 0) (x := 1) (n := 2)
    (by norm_num) (contDiffOn_two_of_three g hg)
    (differentiableOn_iteratedDerivWithin_two g hg)
  rw [uIoo_zero_one] at hξ
  refine ⟨ξ, hξ, ?_⟩
  have htmm : ξ ∈ Ioo (min (0:ℝ) 1) (max (0:ℝ) 1) := by simpa using hξ
  rw [uIcc_zero_one] at hres
  rw [taylorWithinEval_two] at hres
  rw [iteratedDerivWithin_one_endpoint g (hg.differentiable (by norm_num))
        (by norm_num) (by norm_num : (0:ℝ) ∈ Icc (0:ℝ) 1)] at hres
  rw [iteratedDerivWithin_two_endpoint g (hg.of_le (by norm_num))
        (by norm_num) (by norm_num : (0:ℝ) ∈ Icc (0:ℝ) 1)] at hres
  rw [← uIcc_zero_one, iteratedDerivWithin_three_eq g htmm] at hres
  norm_num at hres
  linarith [hres]

Plaplacian/TaylorBound.lean3 declarations

theoremcontinuous_deriv_three_restrict
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then Continuous (deriv (deriv (deriv fun t => φ (PLaplacian.lineMap x z t)))).

PLaplacian.continuous_deriv_three_restrictPlaplacian/TaylorBound.lean, lines 40–49
theorem continuous_deriv_three_restrict {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 3 φ) (x z : EuclSpace d) :
    Continuous (deriv (deriv (deriv (fun t : ℝ => φ (lineMap x z t))))) := by
  have h3 : ContDiff ℝ 3 (fun t : ℝ => φ (lineMap x z t)) :=
    contDiff_restrict_three hφ x z
  have h2 : ContDiff ℝ 2 (deriv (fun t : ℝ => φ (lineMap x z t))) :=
    ContDiff.deriv' h3
  have h1 : ContDiff ℝ 1 (deriv (deriv (fun t : ℝ => φ (lineMap x z t)))) :=
    ContDiff.deriv' h2
  exact h1.continuous_deriv le_rfl
theoremexists_bound_deriv_three
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $C$ such that:

  • ∀ t ∈ Set.Icc 0 1 , | deriv ( deriv ( deriv fun s => φ ( PLaplacian.lineMap x z s ) ) ) t | ≤ C
PLaplacian.exists_bound_deriv_threePlaplacian/TaylorBound.lean, lines 51–62
theorem exists_bound_deriv_three {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 3 φ) (x z : EuclSpace d) :
    ∃ C : ℝ, ∀ t ∈ Icc (0:ℝ) 1,
      |deriv (deriv (deriv (fun s : ℝ => φ (lineMap x z s)))) t| ≤ C := by
  have hcont : Continuous
      (fun t => |deriv (deriv (deriv (fun s : ℝ => φ (lineMap x z s)))) t|) :=
    (continuous_deriv_three_restrict hφ x z).abs
  obtain ⟨t₀, ht₀, hmax⟩ := (isCompact_Icc (a := (0:ℝ)) (b := 1)).exists_isMaxOn
    (by exact ⟨0, by norm_num⟩) hcont.continuousOn
  refine ⟨|deriv (deriv (deriv (fun s : ℝ => φ (lineMap x z s)))) t₀|,
    fun t ht => ?_⟩
  exact hmax ht
theoremtaylor_two_boundedTheorem 3.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $C$ such that:

  • $\lvert \varphi(x + z) - \varphi(x) - (\operatorname{fderiv}(\mathbb{R}, \varphi, x))(z) - 1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(z))(z)\rvert \le C / 6$
PLaplacian.taylor_two_boundedPlaplacian/TaylorBound.lean, lines 64–100
/-- **The several-variable expansion with an explicit cubic remainder.**

For each direction `z` there is a constant `C`, depending on `z`, such that
the second-order Taylor error is bounded by `C / 6`. The constant is the
supremum of the third derivative along the segment, which exists by
compactness --- its value is never needed. -/
theorem taylor_two_bounded {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x z : EuclSpace d) :
    ∃ C : ℝ, |φ (x + z) - φ x - fderiv ℝ φ x z
        - (1/2) * fderiv ℝ (fderiv ℝ φ) x z z| ≤ C / 6 := by
  obtain ⟨C, hC⟩ := exists_bound_deriv_three hφ x z
  obtain ⟨ξ, hξ, hres⟩ := taylor_two_deriv
    (fun t : ℝ => φ (lineMap x z t)) (contDiff_restrict_three hφ x z)
  refine ⟨C, ?_⟩
  -- identify the three polynomial terms
  rw [deriv_restrict (hφ.of_le (by norm_num)) x z] at hres
  rw [(hasDerivAt_second_at (hφ.of_le (by norm_num)) x z 0).deriv] at hres
  simp only [lineMap, one_smul, zero_smul, add_zero] at hres
  -- align the bound with the remainder term
  have halign : (fun s : ℝ => φ (lineMap x z s))
      = fun s : ℝ => φ (x + s • z) := by
    funext s; simp [lineMap]
  rw [halign] at hC
  have hinner : (fun t : ℝ => (fderiv ℝ φ (x + t • z)) z)
      = deriv (fun s : ℝ => φ (x + s • z)) := by
    rw [← halign, deriv_restrict (hφ.of_le (by norm_num)) x z]
    funext t; simp [lineMap]
  rw [hinner] at hres
  -- the remainder is bounded
  have hξIcc : ξ ∈ Icc (0:ℝ) 1 := ⟨le_of_lt hξ.1, le_of_lt hξ.2⟩
  have hbd := hC ξ hξIcc
  set R := deriv (deriv (deriv fun s : ℝ => φ (x + s • z))) ξ with hR
  have hE : φ (x + z) - φ x - fderiv ℝ φ x z
      - (1/2) * fderiv ℝ (fderiv ℝ φ) x z z = (1/6) * R := by
    linarith [hres]
  rw [hE, abs_mul, abs_of_nonneg (by norm_num : (0:ℝ) ≤ 1/6)]
  linarith [hbd]

Plaplacian/TaylorInfra.lean11 declarations

theoremhasDerivAt_second_at
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$, $t \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then $\operatorname{HasDerivAt}(s \mapsto (\operatorname{fderiv}(\mathbb{R}, \varphi, \operatorname{lineMap}(x, z, s)))(z), ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), \operatorname{lineMap}(x, z, t)))(z))(z), t)$.

PLaplacian.hasDerivAt_second_atPlaplacian/TaylorInfra.lean, lines 61–80
/-- The second derivative along a line, at any point of it. The base-point
case is `hasDerivAt_second`; the general case holds because
`hasFDerivAt_fderiv` and `hasDerivAt_lineMap` hold everywhere. -/
theorem hasDerivAt_second_at {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x z : EuclSpace d) (t : ℝ) :
    HasDerivAt (fun s : ℝ => fderiv ℝ φ (lineMap x z s) z)
      (fderiv ℝ (fderiv ℝ φ) (lineMap x z t) z z) t := by
  have hcomp : HasDerivAt (fun s : ℝ => fderiv ℝ φ (lineMap x z s))
      (fderiv ℝ (fderiv ℝ φ) (lineMap x z t) z) t := by
    have h1 : HasFDerivAt (fderiv ℝ φ)
        (fderiv ℝ (fderiv ℝ φ) (lineMap x z t)) (lineMap x z t) :=
      hasFDerivAt_fderiv hφ _
    exact h1.comp_hasDerivAt t (hasDerivAt_lineMap x z t)
  have heval : HasFDerivAt (fun L : EuclSpace d →L[ℝ] ℝ => L z)
      (ContinuousLinearMap.apply ℝ ℝ z)
      (fderiv ℝ φ (lineMap x z t)) :=
    (ContinuousLinearMap.apply ℝ ℝ z).hasFDerivAt
  have hres := heval.comp_hasDerivAt t hcomp
  simp only [Function.comp_def, ContinuousLinearMap.apply_apply] at hres
  exact hres
theoremcontinuous_hess
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ

Then Continuous fun y => fderiv ℝ (fderiv ℝ φ) y.

/-- Continuity of the Hessian, needed to convert the Lagrange remainder into
a little-o estimate. -/
theorem continuous_hess {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ) :
    Continuous (fun y => fderiv ℝ (fderiv ℝ φ) y) := by
  have h1 : ContDiff ℝ 1 (fderiv ℝ φ) := hφ.fderiv_right (by norm_num)
  exact h1.continuous_fderiv (by norm_num)
theoremuIcc_mem_nhds
Formal statementgenerated from the Lean declaration

Let $a, b, t \in \mathbb{R}$.

Assume

  • $t \in \operatorname{Ioo}(\operatorname{min}(a, b), \operatorname{max}(a, b))$ ht

Then $\operatorname{uIcc}(a, b) \in \operatorname{nhds}(t)$.

theorem uIcc_mem_nhds {a b t : ℝ} (ht : t ∈ Ioo (min a b) (max a b)) :
    uIcc a b ∈ nhds t := by
  rw [uIcc]
  exact Filter.mem_of_superset (Ioo_mem_nhds ht.1 ht.2) Ioo_subset_Icc_self
theoremiteratedDerivWithin_one_eq
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $a, b, t \in \mathbb{R}$.

Assume

  • $t \in \operatorname{Ioo}(\operatorname{min}(a, b), \operatorname{max}(a, b))$ ht

Then $\operatorname{iteratedDerivWithin}(1, g, \operatorname{uIcc}(a, b), t) = \operatorname{deriv}(g, t)$.

PLaplacian.iteratedDerivWithin_one_eqPlaplacian/TaylorInfra.lean, lines 96–100
theorem iteratedDerivWithin_one_eq (g : ℝ → ℝ) {a b t : ℝ}
    (ht : t ∈ Ioo (min a b) (max a b)) :
    iteratedDerivWithin 1 g (uIcc a b) t = deriv g t := by
  rw [iteratedDerivWithin_one]
  exact derivWithin_of_mem_nhds (uIcc_mem_nhds ht)
theoremderivWithin_eventuallyEq
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $a, b, t \in \mathbb{R}$.

Assume

  • $t \in \operatorname{Ioo}(\operatorname{min}(a, b), \operatorname{max}(a, b))$ ht

Then derivWithin g (Set.uIcc a b) =ᶠ[nhds t] deriv g.

PLaplacian.derivWithin_eventuallyEqPlaplacian/TaylorInfra.lean, lines 102–108
/-- The inner derivative agrees with `deriv g` on a whole neighbourhood, which
is what licenses differentiating it again. -/
theorem derivWithin_eventuallyEq (g : ℝ → ℝ) {a b t : ℝ}
    (ht : t ∈ Ioo (min a b) (max a b)) :
    derivWithin g (uIcc a b) =ᶠ[nhds t] deriv g := by
  filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs
  exact derivWithin_of_mem_nhds (uIcc_mem_nhds hs)
theoremiteratedDerivWithin_two_eq
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $a, b, t \in \mathbb{R}$.

Assume

  • $t \in \operatorname{Ioo}(\operatorname{min}(a, b), \operatorname{max}(a, b))$ ht

Then $\operatorname{iteratedDerivWithin}(2, g, \operatorname{uIcc}(a, b), t) = \operatorname{deriv}(\operatorname{deriv}(g), t)$.

PLaplacian.iteratedDerivWithin_two_eqPlaplacian/TaylorInfra.lean, lines 110–117
/-- **The order-two translation.** -/
theorem iteratedDerivWithin_two_eq (g : ℝ → ℝ) {a b t : ℝ}
    (ht : t ∈ Ioo (min a b) (max a b)) :
    iteratedDerivWithin 2 g (uIcc a b) t = deriv (deriv g) t := by
  rw [show (2 : Nat) = 1 + 1 from rfl, iteratedDerivWithin_succ,
      iteratedDerivWithin_one]
  rw [derivWithin_of_mem_nhds (uIcc_mem_nhds ht)]
  exact (derivWithin_eventuallyEq g ht).deriv_eq
theoremiteratedDerivWithin_one_endpoint
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $a, b, t \in \mathbb{R}$.

Assume

  • $\operatorname{Differentiable}(\mathbb{R}, g)$ hg
  • $a < b$ hab
  • $t \in \operatorname{Icc}(a, b)$ ht

Then $\operatorname{iteratedDerivWithin}(1, g, \operatorname{Icc}(a, b), t) = \operatorname{deriv}(g, t)$.

PLaplacian.iteratedDerivWithin_one_endpointPlaplacian/TaylorInfra.lean, lines 121–127
/-- At an endpoint the interval is not a neighbourhood, but it has unique
differentiability, which suffices at order one. -/
theorem iteratedDerivWithin_one_endpoint (g : ℝ → ℝ)
    (hg : Differentiable ℝ g) {a b t : ℝ} (hab : a < b) (ht : t ∈ Icc a b) :
    iteratedDerivWithin 1 g (Icc a b) t = deriv g t := by
  rw [iteratedDerivWithin_one]
  exact (hg t).derivWithin (uniqueDiffOn_Icc hab t ht)
theoremuIcc_zero_one
Formal statementgenerated from the Lean declaration

$\operatorname{uIcc}(0, 1) = \operatorname{Icc}(0, 1)$.

theorem uIcc_zero_one : uIcc (0 : ℝ) 1 = Icc 0 1 := by
  rw [uIcc_of_le (by norm_num : (0:ℝ) ≤ 1)]
theoremtaylorWithinEval_one
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$, $s \subseteq \mathbb{R}$, $x_{0}, x \in \mathbb{R}$.

Then $\operatorname{taylorWithinEval}(g, 1, s, x_{0}, x) = g(x_{0}) + (x - x_{0}) \cdot \operatorname{iteratedDerivWithin}(1, g, s, x_{0})$.

PLaplacian.taylorWithinEval_onePlaplacian/TaylorInfra.lean, lines 134–139
theorem taylorWithinEval_one (g : ℝ → ℝ) (s : Set ℝ) (x₀ x : ℝ) :
    taylorWithinEval g 1 s x₀ x
      = g x₀ + (x - x₀) * iteratedDerivWithin 1 g s x₀ := by
  rw [show (1 : Nat) = 0 + 1 from rfl, taylorWithinEval_succ,
      taylor_within_zero_eval]
  simp
theoremtaylorWithinEval_one_unit
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Then $\operatorname{taylorWithinEval}(g, 1, \operatorname{Icc}(0, 1), 0, 1) = g(0) + \operatorname{iteratedDerivWithin}(1, g, \operatorname{Icc}(0, 1), 0)$.

PLaplacian.taylorWithinEval_one_unitPlaplacian/TaylorInfra.lean, lines 141–145
theorem taylorWithinEval_one_unit (g : ℝ → ℝ) :
    taylorWithinEval g 1 (Icc (0:ℝ) 1) 0 1
      = g 0 + iteratedDerivWithin 1 g (Icc (0:ℝ) 1) 0 := by
  rw [taylorWithinEval_one]
  ring
theoremtaylorWithinEval_one_unit_deriv
Formal statementgenerated from the Lean declaration

Let $g \colon \mathbb{R} \to \mathbb{R}$.

Assume

  • $\operatorname{Differentiable}(\mathbb{R}, g)$ hg

Then $\operatorname{taylorWithinEval}(g, 1, \operatorname{Icc}(0, 1), 0, 1) = g(0) + \operatorname{deriv}(g, 0)$.

PLaplacian.taylorWithinEval_one_unit_derivPlaplacian/TaylorInfra.lean, lines 147–155
/-- **The Taylor polynomial at order one on the unit interval**, with the
derivative identified. This is exactly what
`taylor_mean_remainder_lagrange` subtracts. -/
theorem taylorWithinEval_one_unit_deriv (g : ℝ → ℝ)
    (hg : Differentiable ℝ g) :
    taylorWithinEval g 1 (Icc (0:ℝ) 1) 0 1 = g 0 + deriv g 0 := by
  rw [taylorWithinEval_one_unit,
      iteratedDerivWithin_one_endpoint g hg (by norm_num)
        (by norm_num : (0:ℝ) ∈ Icc (0:ℝ) 1)]

Plaplacian/TaylorTest.lean14 declarations

theoremline_deriv_one
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\psi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \psi)$ hψ

Then $\operatorname{deriv}(s \mapsto \psi(x + s \cdot z), 0) = (\operatorname{fderiv}(\mathbb{R}, \psi, x))(z)$.

/-- The first derivative along a line, for a `C²` function. -/
theorem line_deriv_one {ψ : EuclSpace d → ℝ} (hψ : ContDiff ℝ 2 ψ)
    (x z : EuclSpace d) :
    deriv (fun s : ℝ => ψ (x + s • z)) 0 = fderiv ℝ ψ x z := by
  have h := hasDerivAt_first hψ x z 0
  simp only [lineMap, zero_smul, add_zero] at h
  exact h.deriv
theoremline_deriv_two
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\psi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \psi)$ hψ

Then deriv (deriv fun s => ψ (x + s • z)) 0 = ((fderiv ℝ (fderiv ℝ ψ) x) z) z.

/-- The second derivative along a line, for a `C²` function. -/
theorem line_deriv_two {ψ : EuclSpace d → ℝ} (hψ : ContDiff ℝ 2 ψ)
    (x z : EuclSpace d) :
    deriv (deriv (fun s : ℝ => ψ (x + s • z))) 0
      = fderiv ℝ (fderiv ℝ ψ) x z z := by
  have h := hasDerivAt_second_at hψ x z 0
  simp only [lineMap, zero_smul, add_zero] at h
  have hfun : deriv (fun s : ℝ => ψ (x + s • z))
      = fun t => fderiv ℝ ψ (x + t • z) z := by
    funext t
    have ht := hasDerivAt_first hψ x z t
    simp only [lineMap] at ht
    exact ht.deriv
  rw [hfun]
  exact h.deriv
theoremhasDerivAt_quad_poly
Formal statementgenerated from the Lean declaration

Let $a, b, c, t \in \mathbb{R}$.

Then $\operatorname{HasDerivAt}(s \mapsto a + s \cdot b + s ^{2} \cdot c, b + 2 \cdot t \cdot c, t)$.

PLaplacian.hasDerivAt_quad_polyPlaplacian/TaylorTest.lean, lines 78–87
/-- The first derivative of a quadratic polynomial at zero. -/
theorem hasDerivAt_quad_poly (a b c t : ℝ) :
    HasDerivAt (fun s : ℝ => a + s * b + s ^ 2 * c) (b + 2 * t * c) t := by
  have h := ((hasDerivAt_const t a).add ((hasDerivAt_id' t).mul_const b)).add
    ((hasDerivAt_pow 2 t).mul_const c)
  have hfun : (fun s : ℝ => a + s * b + s ^ 2 * c)
      = ((fun _ : ℝ => a) + fun y : ℝ => y * b) + fun y : ℝ => y ^ 2 * c := by
    funext s; simp
  rw [hfun]
  exact h.congr_deriv (by norm_num)
theoremderiv_quad_poly
Formal statementgenerated from the Lean declaration

Let $a, b, c \in \mathbb{R}$.

Then $\operatorname{deriv}(s \mapsto a + s \cdot b + s ^{2} \cdot c, 0) = b$.

theorem deriv_quad_poly (a b c : ℝ) :
    deriv (fun s : ℝ => a + s * b + s ^ 2 * c) 0 = b := by
  rw [(hasDerivAt_quad_poly a b c 0).deriv]; ring
theoremderiv_deriv_quad_poly
Formal statementgenerated from the Lean declaration

Let $a, b, c \in \mathbb{R}$.

Then deriv (deriv fun s => a + s * b + s ^ 2 * c) 0 = 2 * c.

PLaplacian.deriv_deriv_quad_polyPlaplacian/TaylorTest.lean, lines 93–105
theorem deriv_deriv_quad_poly (a b c : ℝ) :
    deriv (deriv (fun s : ℝ => a + s * b + s ^ 2 * c)) 0 = 2 * c := by
  have hfun : deriv (fun s : ℝ => a + s * b + s ^ 2 * c)
      = fun t => b + 2 * t * c := by
    funext t; exact (hasDerivAt_quad_poly a b c t).deriv
  rw [hfun]
  have h0 := (hasDerivAt_const (0:ℝ) b).add
    (((hasDerivAt_id' (0:ℝ)).const_mul 2).mul_const c)
  have hfun2 : (fun t : ℝ => b + 2 * t * c)
      = (fun _ : ℝ => b) + fun y : ℝ => 2 * y * c := by
    funext t; simp
  rw [hfun2]
  exact (h0.congr_deriv (by norm_num)).deriv
deftPoly
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\kappa \in \mathbb{R}$, $\mathrm{a.\_@.\_internal.\_hyg.0} \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- **The Taylor test function.** -/
def tPoly (φ : EuclSpace d → ℝ) (x₀ : EuclSpace d) (κ : ℝ) :
    EuclSpace d → ℝ := fun w =>
  φ x₀ + fderiv ℝ φ x₀ (w - x₀)
    + (1 / 2) * fderiv ℝ (fderiv ℝ φ) x₀ (w - x₀) (w - x₀)
    + κ * ‖w - x₀‖ ^ 2
theoremcontDiff_tPoly
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\kappa \in \mathbb{R}$, $n \in \operatorname{WithTop}(\mathbb{N}, \infty)$.

Then $\operatorname{ContDiff}(\mathbb{R}, n, \operatorname{tPoly}(\varphi, x_{0}, \kappa))$.

theorem contDiff_tPoly (φ : EuclSpace d → ℝ) (x₀ : EuclSpace d) (κ : ℝ)
    {n : WithTop ℕ∞} : ContDiff ℝ n (tPoly φ x₀ κ) := by
  unfold tPoly
  have h1 : ContDiff ℝ n (fun w : EuclSpace d => w - x₀) :=
    contDiff_id.sub contDiff_const
  have hL : ContDiff ℝ n (fun w => fderiv ℝ φ x₀ (w - x₀)) :=
    (fderiv ℝ φ x₀).contDiff.comp h1
  have hX : ContDiff ℝ n
      (fun w => fderiv ℝ (fderiv ℝ φ) x₀ (w - x₀) (w - x₀)) :=
    ((fderiv ℝ (fderiv ℝ φ) x₀).contDiff.comp h1).clm_apply h1
  have hN : ContDiff ℝ n (fun w => ‖w - x₀‖ ^ 2) :=
    (contDiff_norm_sq ℝ).comp h1
  exact ((contDiff_const.add hL).add (contDiff_const.mul hX)).add
    (contDiff_const.mul hN)
theoremtPoly_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\kappa \in \mathbb{R}$.

Then $\operatorname{tPoly}(\varphi, x_{0}, \kappa, x_{0}) = \varphi(x_{0})$.

theorem tPoly_self (φ : EuclSpace d → ℝ) (x₀ : EuclSpace d) (κ : ℝ) :
    tPoly φ x₀ κ x₀ = φ x₀ := by
  simp [tPoly]
theoremtPoly_line
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0}, z \in \mathbb{R}^{d}$, $\kappa, s \in \mathbb{R}$.

Then $\operatorname{tPoly}(\varphi, x_{0}, \kappa, x_{0} + s \cdot z) = \varphi(x_{0}) + s \cdot (\operatorname{fderiv}(\mathbb{R}, \varphi, x_{0}))(z) + s ^{2} \cdot (1 / 2 \cdot ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x_{0}))(z))(z) + \kappa \cdot \lVert z\rVert ^{2})$.

/-- Along a line through the base point, the Taylor test function is a
quadratic in the parameter. -/
theorem tPoly_line (φ : EuclSpace d → ℝ) (x₀ z : EuclSpace d) (κ s : ℝ) :
    tPoly φ x₀ κ (x₀ + s • z)
      = φ x₀ + s * fderiv ℝ φ x₀ z
        + s ^ 2 * ((1 / 2) * fderiv ℝ (fderiv ℝ φ) x₀ z z + κ * ‖z‖ ^ 2) := by
  unfold tPoly
  have hsub : x₀ + s • z - x₀ = s • z := by abel
  rw [hsub]
  simp only [map_smul, smul_eq_mul, norm_smul, Real.norm_eq_abs, mul_pow,
    sq_abs, smul_apply]
  ring
theoremfderiv_tPoly_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\kappa \in \mathbb{R}$.

Then $\operatorname{fderiv}(\mathbb{R}, \operatorname{tPoly}(\varphi, x_{0}, \kappa), x_{0}) = \operatorname{fderiv}(\mathbb{R}, \varphi, x_{0})$.

/-- **Its gradient at the base point is that of the original.** -/
theorem fderiv_tPoly_self (φ : EuclSpace d → ℝ) (x₀ : EuclSpace d) (κ : ℝ) :
    fderiv ℝ (tPoly φ x₀ κ) x₀ = fderiv ℝ φ x₀ := by
  ext z
  rw [← line_deriv_one (contDiff_tPoly φ x₀ κ) x₀ z]
  have hline : (fun s : ℝ => tPoly φ x₀ κ (x₀ + s • z))
      = fun s => φ x₀ + s * fderiv ℝ φ x₀ z
        + s ^ 2 * ((1 / 2) * fderiv ℝ (fderiv ℝ φ) x₀ z z + κ * ‖z‖ ^ 2) := by
    funext s; exact tPoly_line φ x₀ z κ s
  rw [hline, deriv_quad_poly]
theoremgradient_tPoly_self
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\kappa \in \mathbb{R}$.

Then $\operatorname{gradient}(\operatorname{tPoly}(\varphi, x_{0}, \kappa), x_{0}) = \operatorname{gradient}(\varphi, x_{0})$.

PLaplacian.gradient_tPoly_selfPlaplacian/TaylorTest.lean, lines 157–159
theorem gradient_tPoly_self (φ : EuclSpace d → ℝ) (x₀ : EuclSpace d)
    (κ : ℝ) : gradient (tPoly φ x₀ κ) x₀ = gradient φ x₀ := by
  unfold gradient; rw [fderiv_tPoly_self]
theoremhess_tPoly_quad
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0}, z \in \mathbb{R}^{d}$, $\kappa \in \mathbb{R}$.

Then $((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \operatorname{tPoly}(\varphi, x_{0}, \kappa)), x_{0}))(z))(z) = ((\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x_{0}))(z))(z) + 2 \cdot \kappa \cdot \lVert z\rVert ^{2}$.

/-- **Its Hessian quadratic form is the original's plus `2κ‖z‖²`.** -/
theorem hess_tPoly_quad (φ : EuclSpace d → ℝ) (x₀ z : EuclSpace d) (κ : ℝ) :
    fderiv ℝ (fderiv ℝ (tPoly φ x₀ κ)) x₀ z z
      = fderiv ℝ (fderiv ℝ φ) x₀ z z + 2 * κ * ‖z‖ ^ 2 := by
  rw [← line_deriv_two (contDiff_tPoly φ x₀ κ) x₀ z]
  have hline : (fun s : ℝ => tPoly φ x₀ κ (x₀ + s • z))
      = fun s => φ x₀ + s * fderiv ℝ φ x₀ z
        + s ^ 2 * ((1 / 2) * fderiv ℝ (fderiv ℝ φ) x₀ z z + κ * ‖z‖ ^ 2) := by
    funext s; exact tPoly_line φ x₀ z κ s
  rw [hline, deriv_deriv_quad_poly]
  ring
theoremlocalMax_tPoly
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{IsLocalMax}(y \mapsto U(y) - \varphi(y), x_{0})$ hmax
  • $0 < \eta$ hη

Then $\operatorname{IsLocalMax}(y \mapsto U(y) - \operatorname{tPoly}(\varphi, x_{0}, \eta, y), x_{0})$.

/-- **Touching from above.** If `U - φ` has a local maximum at `x₀`, so does
`U` minus the Taylor test function with positive `κ`. -/
theorem localMax_tPoly {U φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    {x₀ : EuclSpace d} (hmax : IsLocalMax (fun y => U y - φ y) x₀)
    {η : ℝ} (hη : 0 < η) :
    IsLocalMax (fun y => U y - tPoly φ x₀ η y) x₀ := by
  obtain ⟨δ, hδ, hT⟩ := exists_taylorErr_le hφ x₀ hη
  unfold IsLocalMax IsMaxFilter at hmax ⊢
  filter_upwards [hmax, Metric.ball_mem_nhds x₀ hδ] with y hy hyb
  change U y - φ y ≤ U x₀ - φ x₀ at hy
  change U y - tPoly φ x₀ η y ≤ U x₀ - tPoly φ x₀ η x₀
  have hz : ‖y - x₀‖ < δ := by rw [mem_ball, dist_eq_norm] at hyb; exact hyb
  have herr := (abs_le.1 (hT (y - x₀) hz)).2
  have hdec := decomp_at φ x₀ (y - x₀)
  have hxy : x₀ + (y - x₀) = y := by abel
  rw [hxy] at hdec
  rw [tPoly_self]
  simp only [tPoly]
  linarith
theoremlocalMin_tPoly
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $U, \varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{IsLocalMin}(y \mapsto U(y) - \varphi(y), x_{0})$ hmin
  • $0 < \eta$ hη

Then $\operatorname{IsLocalMin}(y \mapsto U(y) - \operatorname{tPoly}(\varphi, x_{0}, - \eta, y), x_{0})$.

/-- **Touching from below.** If `U - φ` has a local minimum at `x₀`, so does
`U` minus the Taylor test function with negative `κ`. -/
theorem localMin_tPoly {U φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    {x₀ : EuclSpace d} (hmin : IsLocalMin (fun y => U y - φ y) x₀)
    {η : ℝ} (hη : 0 < η) :
    IsLocalMin (fun y => U y - tPoly φ x₀ (-η) y) x₀ := by
  obtain ⟨δ, hδ, hT⟩ := exists_taylorErr_le hφ x₀ hη
  unfold IsLocalMin IsMinFilter at hmin ⊢
  filter_upwards [hmin, Metric.ball_mem_nhds x₀ hδ] with y hy hyb
  change U x₀ - φ x₀ ≤ U y - φ y at hy
  change U x₀ - tPoly φ x₀ (-η) x₀ ≤ U y - tPoly φ x₀ (-η) y
  have hz : ‖y - x₀‖ < δ := by rw [mem_ball, dist_eq_norm] at hyb; exact hyb
  have herr := (abs_le.1 (hT (y - x₀) hz)).1
  have hdec := decomp_at φ x₀ (y - x₀)
  have hxy : x₀ + (y - x₀) = y := by abel
  rw [hxy] at hdec
  rw [tPoly_self]
  simp only [tPoly]
  linarith

Plaplacian/TendProd.lean2 declarations

theoremIoo_mem_nhdsWithin_Ioi'
Formal statementgenerated from the Lean declaration

Let $\delta \in \mathbb{R}$.

Assume

  • $0 < \delta$ hδ

Then $\operatorname{Ioo}(0, \delta) \in \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0))$.

PLaplacian.Ioo_mem_nhdsWithin_Ioi'Plaplacian/TendProd.lean, lines 49–52
/-- The parameters below a radius form a member of the filter. -/
theorem Ioo_mem_nhdsWithin_Ioi' {δ : ℝ} (hδ : 0 < δ) :
    Set.Ioo (0:ℝ) δ ∈ nhdsWithin (0:ℝ) (Set.Ioi 0) := by
  exact Ioo_mem_nhdsGT hδ
theoremeventually_quotient_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < c$ hc

Then there exists $\delta > 0$ such that:

  • $\forall r,\ \mathrm{r.1} \in \operatorname{Ioo}(0, \delta) \to \lVert \mathrm{r.2} - x\rVert \le \mathrm{r.1} \to \lvert 2 \cdot (p + d) \cdot \operatorname{taylorErr}(\varphi, x, \mathrm{r.2} - x) / \mathrm{r.1} ^{2}\rvert \le c$
PLaplacian.eventually_quotient_lePlaplacian/TendProd.lean, lines 54–64
/-- **The eventual bound on the product filter**, for pairs whose point lies
in the parameter's ball about the base point. -/
theorem eventually_quotient_le {p : ℝ} (hpd : 0 < p + (d : ℝ))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {c : ℝ} (hc : 0 < c) :
    ∃ δ > 0, ∀ r : ℝ × EuclSpace d, r.1 ∈ Set.Ioo (0:ℝ) δ →
      ‖r.2 - x‖ ≤ r.1 →
        |(2 * (p + (d : ℝ))) * taylorErr φ x (r.2 - x) / r.1 ^ 2| ≤ c := by
  obtain ⟨δ, hδ, hbd⟩ := quotient_le_of_pos hpd hφ x hc
  refine ⟨δ, hδ, fun r hr hball => ?_⟩
  exact hbd r.1 hr.1 hr.2 (r.2 - x) hball

Plaplacian/TendZero.lean2 declarations

theoremexists_eta
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $c \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd
  • $0 < c$ hc

Then there exists $\eta > 0$ such that:

  • $2 \cdot (p + d) \cdot \eta = c$
/-- Every positive number is `2(p+d) η` for some positive `η`. -/
theorem exists_eta {p : ℝ} (hpd : 0 < p + (d : ℝ)) {c : ℝ} (hc : 0 < c) :
    ∃ η > 0, 2 * (p + (d : ℝ)) * η = c := by
  have hpd2 : (0:ℝ) < 2 * (p + (d : ℝ)) := by linarith
  refine ⟨c / (2 * (p + (d : ℝ))), by positivity, ?_⟩
  field_simp
theoremquotient_le_of_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $c \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < c$ hc

Then there exists $\delta > 0$ such that:

  • $\forall \varepsilon,\ 0 < \varepsilon \to \varepsilon < \delta \to \forall w,\ \lVert w\rVert \le \varepsilon \to \lvert 2 \cdot (p + d) \cdot \operatorname{taylorErr}(\varphi, x, w) / \varepsilon ^{2}\rvert \le c$
PLaplacian.quotient_le_of_posPlaplacian/TendZero.lean, lines 51–65
/-- **The quotient bound, with an arbitrary multiple.**

For every `c > 0` there is a radius within which the quotient is below `c`. -/
theorem quotient_le_of_pos {p : ℝ} (hpd : 0 < p + (d : ℝ))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {c : ℝ} (hc : 0 < c) :
    ∃ δ > 0, ∀ ε : ℝ, 0 < ε → ε < δ →
      ∀ w : EuclSpace d, ‖w‖ ≤ ε →
        |(2 * (p + (d : ℝ))) * taylorErr φ x w / ε ^ 2| ≤ c := by
  obtain ⟨η, hη, hηc⟩ := exists_eta (d := d) hpd hc
  obtain ⟨δ, hδ, hbd⟩ := quotient_le_uniform hpd hφ x hη
  refine ⟨δ, hδ, fun ε hε hεδ w hw => ?_⟩
  have h := hbd ε hε hεδ w hw
  rw [hηc] at h
  exact h

Plaplacian/Thread.lean1 declarations

theoremextreme_avg_threaded
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x) \ne 0$ hx
  • $0 < \varepsilon$ hε

Then there exists $e, \mathrm{lo}, \mathrm{hi}$ such that:

  • ( sSup ( φ '' Metric.ball x ε ) + sInf ( φ '' Metric.ball x ε ) ) / 2 = φ x + ε ^ 2 / 2 * PLaplacian.infLaplacianOf ( gradient φ x ) ( fderiv ℝ ( fderiv ℝ φ ) x ) + e
  • $\mathrm{lo} \le e$
  • $e \le \mathrm{hi}$
PLaplacian.extreme_avg_threadedPlaplacian/Thread.lean, lines 48–86
/-- **The extreme-value average, with the error bounded by proved
quantities.**

Obtaining the maximizer and minimizer from the two upper bounds, the average
equals the target plus an error squeezed between quantities built from the
Taylor errors and the quadratic comparison terms at those points. -/
theorem extreme_avg_threaded {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    {x : EuclSpace d} (hx : gradient φ x ≠ 0) {ε : ℝ} (hε : 0 < ε) :
    ∃ e lo hi : ℝ,
      (sSup (φ '' ball x ε) + sInf (φ '' ball x ε)) / 2
          = φ x + (ε ^ 2 / 2) * infLaplacianOf (gradient φ x)
              (fderiv ℝ (fderiv ℝ φ) x) + e
        ∧ lo ≤ e ∧ e ≤ hi := by
  -- the supremum, from below
  have hSlow := sSup_lower_infLap hφ hx hε
  -- the supremum, from above, with a maximizer
  obtain ⟨y, hyMem, hSupp⟩ := sSup_upper_infLap hφ hx hε
  -- the infimum, from below, with a minimizer
  obtain ⟨w, hwMem, hIlow⟩ := sInf_lower_infLap hφ hx hε
  -- the infimum, from above
  have hIupp := sInf_upper_infLap hφ hx hε
  -- assemble
  obtain ⟨e, he, hlo, hhi⟩ :=
    extreme_avg_squeezed_ball (x := x) hφ.continuous hε
      (I := infLaplacianOf (gradient φ x) (fderiv ℝ (fderiv ℝ φ) x))
      (loS := taylorErr φ x (ε • gradDir φ x))
      (hiS := (1 / 2) * (‖fderiv ℝ (fderiv ℝ φ) x‖
          * ‖y - x - ε • gradDir φ x‖
          * (‖y - x‖ + ‖ε • gradDir φ x‖))
        + taylorErr φ x (y - x))
      (loI := - (1 / 2) * (‖fderiv ℝ (fderiv ℝ (fun z => -φ z)) x‖
            * ‖w - x - ε • gradDir (fun z => -φ z) x‖
            * (‖w - x‖ + ‖ε • gradDir (fun z => -φ z) x‖))
          - taylorErr (fun z => -φ z) x (w - x))
      (hiI := - taylorErr (fun z => -φ z) x
          (ε • gradDir (fun z => -φ z) x))
      (by linarith [hSlow]) (by linarith [hSupp])
      (by linarith [hIlow]) (by linarith [hIupp])
  exact ⟨e, _, _, he, hlo, hhi⟩

Plaplacian/Thread2.lean3 declarations

theoremfrequently_near_and_small
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\delta, r \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < \delta$ hδ
  • $0 < r$ hr

Then all of the following hold:

  • ∃ᶠ ( q : ℝ × EuclSpace d ) in PLaplacian.relaxFilter x₀ , PLaplacian.ubar u x₀ - φ x₀ - δ < u q.1 q.2 - φ q.2
  • $\mathrm{q.1} < r / 2$
  • $\lVert \mathrm{q.2} - x_{0}\rVert < r / 2$
PLaplacian.frequently_near_and_smallPlaplacian/Thread2.lean, lines 48–61
/-- **Near-contact with the containment.**

Frequently along the filter, the pair is near-contact and the parameter and
displacement are each below half the radius --- so the ball about the point is
contained in the ball about the base point. -/
theorem frequently_near_and_small (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    (x₀ : EuclSpace d) {δ r : ℝ} (hδ : 0 < δ) (hr : 0 < r) :
    ∃ᶠ q in relaxFilter x₀,
      (ubar u x₀ - φ x₀ - δ < u q.1 q.2 - φ q.2)
      ∧ (q.1 < r / 2 ∧ ‖q.2 - x₀‖ < r / 2) := by
  exact (frequently_near_max u hC hφ hB x₀ hδ).and_eventually
    (eventually_near (x₀ := x₀) hr)
theoremcontainment_of_near
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$, $q \in \mathbb{R} \times \mathbb{R}^{d}$, $r \in \mathbb{R}$.

Assume

  • $\mathrm{q.1} < r / 2 \wedge \lVert \mathrm{q.2} - x_{0}\rVert < r / 2$ h

Then $B(\mathrm{q.2}, \mathrm{q.1}) \subseteq B(x_{0}, r)$.

PLaplacian.containment_of_nearPlaplacian/Thread2.lean, lines 63–67
/-- At such a pair, the ball containment holds. -/
theorem containment_of_near {x₀ : EuclSpace d} {q : ℝ × EuclSpace d}
    {r : ℝ} (h : q.1 < r / 2 ∧ ‖q.2 - x₀‖ < r / 2) :
    ball q.2 q.1 ⊆ ball x₀ r :=
  ball_subset_of_near h.1 h.2
theorembound_transfer
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$, $q \in \mathbb{R} \times \mathbb{R}^{d}$, $r \in \mathbb{R}$, $f \colon \mathbb{R}^{d} \to \mathbb{R}$, $c \in \mathbb{R}$, $w \in \mathbb{R}^{d}$.

Assume

  • $\mathrm{q.1} < r / 2 \wedge \lVert \mathrm{q.2} - x_{0}\rVert < r / 2$ h
  • $\forall w \in B(x_{0}, r),\ f(w) \le c$ hbd
  • $w \in B(\mathrm{q.2}, \mathrm{q.1})$ a._@._internal._hyg.0

Then $f(w) \le c$.

/-- And the bound transfers: a bound on the larger ball gives one on the
smaller. -/
theorem bound_transfer {x₀ : EuclSpace d} {q : ℝ × EuclSpace d} {r : ℝ}
    (h : q.1 < r / 2 ∧ ‖q.2 - x₀‖ < r / 2)
    {f : EuclSpace d → ℝ} {c : ℝ}
    (hbd : ∀ w ∈ ball x₀ r, f w ≤ c) :
    ∀ w ∈ ball q.2 q.1, f w ≤ c := by
  intro w hw
  exact hbd w (containment_of_near h hw)

Plaplacian/ThreeRadii.lean2 declarations

theoremtaylorErr_le_uniform
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < \eta$ hη

Then there exists $\delta > 0$ such that:

  • $\forall \varepsilon,\ 0 < \varepsilon \to \varepsilon < \delta \to \forall w,\ \lVert w\rVert \le \varepsilon \to \lvert \operatorname{taylorErr}(\varphi, x, w)\rvert \le \eta \cdot \varepsilon ^{2}$
PLaplacian.taylorErr_le_uniformPlaplacian/ThreeRadii.lean, lines 53–70
/-- **The error bound, uniform in the parameter and the increment.**

For every `η > 0` there is `δ > 0` such that for every `ε` below `δ` and every
increment of norm at most `ε`, the Taylor error is at most `η ε²`. -/
theorem taylorErr_le_uniform {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∃ δ > 0, ∀ ε : ℝ, 0 < ε → ε < δ →
      ∀ w : EuclSpace d, ‖w‖ ≤ ε → |taylorErr φ x w| ≤ η * ε ^ 2 := by
  obtain ⟨δ, hδ, hbd⟩ := exists_taylorErr_le hφ x hη
  refine ⟨δ, hδ, fun ε hε hεδ w hw => ?_⟩
  -- the increment is below the radius
  have hwδ : ‖w‖ < δ := lt_of_le_of_lt hw hεδ
  have h1 := hbd w hwδ
  -- and its square is below the parameter's
  have hw2 : ‖w‖ ^ 2 ≤ ε ^ 2 := by
    have h0 : (0:ℝ) ≤ ‖w‖ := norm_nonneg w
    nlinarith [hw, h0, hε]
  nlinarith [h1, hw2, hη.le, sq_nonneg ‖w‖]
theoremquotient_le_uniform
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $0 < p + d$ hpd
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < \eta$ hη

Then there exists $\delta > 0$ such that:

  • $\forall \varepsilon,\ 0 < \varepsilon \to \varepsilon < \delta \to \forall w,\ \lVert w\rVert \le \varepsilon \to \lvert 2 \cdot (p + d) \cdot \operatorname{taylorErr}(\varphi, x, w) / \varepsilon ^{2}\rvert \le 2 \cdot (p + d) \cdot \eta$
PLaplacian.quotient_le_uniformPlaplacian/ThreeRadii.lean, lines 72–86
/-- **The quotient bound, with the radii ordered.**

Combining with the arithmetic core: for every `η` there is a radius within
which the quotient is below `2(p+d) η`. -/
theorem quotient_le_uniform {p : ℝ} (hpd : 0 < p + (d : ℝ))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∃ δ > 0, ∀ ε : ℝ, 0 < ε → ε < δ →
      ∀ w : EuclSpace d, ‖w‖ ≤ ε →
        |(2 * (p + (d : ℝ))) * taylorErr φ x w / ε ^ 2|
          ≤ 2 * (p + (d : ℝ)) * η := by
  obtain ⟨δ, hδ, hbd⟩ := taylorErr_le_uniform hφ x hη
  refine ⟨δ, hδ, fun ε hε hεδ w hw => ?_⟩
  exact quotient_le_of_bound (E := fun _ => taylorErr φ x w) hpd hε
    (hbd ε hε hεδ w hw)

Plaplacian/Transfer.lean2 declarations

theoremtendsto_snd_relax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0} \in \mathbb{R}^{d}$.

Then $\operatorname{Tendsto}(q \mapsto \mathrm{q.2}, \operatorname{relaxFilter}(x_{0}), \operatorname{nhds}(x_{0}))$.

PLaplacian.tendsto_snd_relaxPlaplacian/Transfer.lean, lines 68–73
/-- The second coordinate tends to the base point along the filter. -/
theorem tendsto_snd_relax (x₀ : EuclSpace d) :
    Filter.Tendsto (fun q : ℝ × EuclSpace d => q.2)
      (relaxFilter x₀) (nhds x₀) := by
  unfold relaxFilter
  exact Filter.tendsto_snd
theoremtendsto_normPLapOf
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hx

Then $\operatorname{Tendsto}(q \mapsto \operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, \mathrm{q.2}), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), \mathrm{q.2})), \operatorname{relaxFilter}(x_{0}), \operatorname{nhds}(\operatorname{normPLapOf}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x_{0}))))$.

PLaplacian.tendsto_normPLapOfPlaplacian/Transfer.lean, lines 75–86
/-- **The operator at the near-contact point tends to the operator at the
base point.** -/
theorem tendsto_normPLapOf {p : ℝ} {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 2 φ) {x₀ : EuclSpace d} (hx : gradient φ x₀ ≠ 0) :
    Filter.Tendsto
      (fun q : ℝ × EuclSpace d =>
        normPLapOf p (gradient φ q.2) (fderiv ℝ (fderiv ℝ φ) q.2))
      (relaxFilter x₀)
      (nhds (normPLapOf p (gradient φ x₀)
        (fderiv ℝ (fderiv ℝ φ) x₀))) := by
  have hcont := normPLapOf_continuousAt (p := p) hφ hx
  exact hcont.tendsto.comp (tendsto_snd_relax x₀)

Plaplacian/UbarSub.lean3 declarations

theoremabs_sub_le_of_bounds
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $\varepsilon \in \mathbb{R}$, $y \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB

Then $\lvert u_{\varepsilon}(y) - \varphi(y)\rvert \le C + B$.

PLaplacian.abs_sub_le_of_boundsPlaplacian/UbarSub.lean, lines 51–58
/-- The difference is globally bounded when both are. -/
theorem abs_sub_le_of_bounds (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ} {B : ℝ}
    (hB : ∀ y, |φ y| ≤ B) :
    ∀ ε y, |u ε y - φ y| ≤ C + B := by
  intro ε y
  calc |u ε y - φ y| ≤ |u ε y| + |φ y| := abs_sub _ _
    _ ≤ C + B := by linarith [hC ε y, hB y]
theoremeventually_sub_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \eta$ hη

Then ∀ᶠ (q : ℝ × EuclSpace d) in PLaplacian.relaxFilter x, u q.1 q.2 - φ q.2 ≤ u q.1 q.2 + (-φ x + η).

PLaplacian.eventually_sub_lePlaplacian/UbarSub.lean, lines 60–76
/-- The difference is eventually below the shifted family. -/
theorem eventually_sub_le (u : ℝ → EuclSpace d → ℝ) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) (x : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∀ᶠ q in relaxFilter x,
      u q.1 q.2 - φ q.2 ≤ u q.1 q.2 + (- φ x + η) := by
  -- continuity gives φ x - η < φ y near x
  have hcont : ∀ᶠ y in nhds x, φ x - η < φ y := by
    have h : Filter.Tendsto φ (nhds x) (nhds (φ x)) := hφ.continuousAt
    exact h.eventually (eventually_gt_nhds (by linarith : φ x - η < φ x))
  unfold relaxFilter
  rw [Filter.eventually_iff, Filter.mem_prod_iff]
  refine ⟨Set.univ, Filter.univ_mem, {y | φ x - η < φ y}, hcont, ?_⟩
  intro q hq
  have := hq.2
  simp only [Set.mem_ofPred_eq] at this
  simp only [Set.mem_ofPred_eq]
  linarith [this]
theoremubar_sub_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB

Then $\overline{\varepsilon, y \mapsto u_{\varepsilon}(y) - \varphi(y)}(x) \le \overline{u}(x) - \varphi(x)$.

/-- **One direction: the relaxed limit of the difference is at most the
difference.** -/
theorem ubar_sub_le (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B) (x : EuclSpace d) :
    ubar (fun ε y => u ε y - φ y) x ≤ ubar u x - φ x := by
  refine le_of_forall_pos_le_add ?_
  intro η hη
  -- the eventual bound
  have hev := eventually_sub_le u hφ x hη
  -- transfer through the limsup
  have hmono : ubar (fun ε y => u ε y - φ y) x
      ≤ Filter.limsup (fun q : ℝ × EuclSpace d =>
          u q.1 q.2 + (- φ x + η)) (relaxFilter x) := by
    unfold ubar
    refine Filter.limsup_le_limsup hev ?_ ?_
    · exact (isBoundedUnder_ge_of_bound _
        (abs_sub_le_of_bounds u hC hB) x).isCobounded_flip
    · refine Filter.isBoundedUnder_of ⟨C + |(- φ x + η)|, fun q => ?_⟩
      have h1 := hC q.1 q.2
      have h2 := abs_le.1 h1
      have h3 := le_abs_self (- φ x + η)
      linarith [h2.2, h3]
  -- the constant comes out
  rw [limsup_add_const (relaxFilter x) _ (- φ x + η)
      (isBoundedUnder_le_of_bound u hC x)
      ((isBoundedUnder_ge_of_bound u hC x).isCobounded_flip)] at hmono
  unfold ubar at hmono ⊢
  linarith [hmono]

Plaplacian/UbarSubEq.lean3 declarations

theoremeventually_le_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\varphi\text{ is continuous}$ hφ
  • $0 < \eta$ hη

Then ∀ᶠ (q : ℝ × EuclSpace d) in PLaplacian.relaxFilter x, u q.1 q.2 + (-φ x - η) ≤ u q.1 q.2 - φ q.2.

PLaplacian.eventually_le_subPlaplacian/UbarSubEq.lean, lines 42–58
/-- Near the point the test function exceeds its value less `η`, so the
family is eventually above the difference less the constant. -/
theorem eventually_le_sub (u : ℝ → EuclSpace d → ℝ) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) (x : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∀ᶠ q in relaxFilter x,
      u q.1 q.2 + (- φ x - η) ≤ u q.1 q.2 - φ q.2 := by
  have hcont : ∀ᶠ y in nhds x, φ y < φ x + η := by
    have h : Filter.Tendsto φ (nhds x) (nhds (φ x)) := hφ.continuousAt
    exact h.eventually (eventually_lt_nhds (by linarith : φ x < φ x + η))
  unfold relaxFilter
  rw [Filter.eventually_iff, Filter.mem_prod_iff]
  refine ⟨Set.univ, Filter.univ_mem, {y | φ y < φ x + η}, hcont, ?_⟩
  intro q hq
  have h2 := hq.2
  simp only [Set.mem_ofPred_eq] at h2
  simp only [Set.mem_ofPred_eq]
  linarith [h2]
theoremle_ubar_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB

Then $\overline{u}(x) - \varphi(x) \le \overline{\varepsilon, y \mapsto u_{\varepsilon}(y) - \varphi(y)}(x)$.

/-- **The reverse direction.** -/
theorem le_ubar_sub (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B) (x : EuclSpace d) :
    ubar u x - φ x ≤ ubar (fun ε y => u ε y - φ y) x := by
  refine le_of_forall_pos_le_add ?_
  intro η hη
  have hev := eventually_le_sub u hφ x hη
  have hmono : Filter.limsup (fun q : ℝ × EuclSpace d =>
        u q.1 q.2 + (- φ x - η)) (relaxFilter x)
      ≤ ubar (fun ε y => u ε y - φ y) x := by
    unfold ubar
    refine Filter.limsup_le_limsup hev ?_ ?_
    · have hb : Filter.IsBoundedUnder (· ≥ ·) (relaxFilter x)
          (fun q : ℝ × EuclSpace d => u q.1 q.2 + (- φ x - η)) := by
        refine Filter.isBoundedUnder_of ⟨- C + (- φ x - η), fun q => ?_⟩
        have h1 := abs_le.1 (hC q.1 q.2)
        linarith [h1.1]
      exact hb.isCobounded_flip
    · exact isBoundedUnder_le_of_bound _
        (abs_sub_le_of_bounds u hC hB) x
  rw [limsup_add_const (relaxFilter x) _ (- φ x - η)
      (isBoundedUnder_le_of_bound u hC x)
      ((isBoundedUnder_ge_of_bound u hC x).isCobounded_flip)] at hmono
  unfold ubar at hmono ⊢
  linarith [hmono]
theoremubar_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB

Then $\overline{\varepsilon, y \mapsto u_{\varepsilon}(y) - \varphi(y)}(x) = \overline{u}(x) - \varphi(x)$.

/-- **The relaxed limit of a difference.** -/
theorem ubar_sub (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B) (x : EuclSpace d) :
    ubar (fun ε y => u ε y - φ y) x = ubar u x - φ x :=
  le_antisymm (ubar_sub_le u hC hφ hB x) (le_ubar_sub u hC hφ hB x)

Plaplacian/UnifBase.lean2 declarations

theoremsegment_mem_bigBall
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $x_{0}, y, z \in \mathbb{R}^{d}$, $R, t \in \mathbb{R}$.

Assume

  • $y \in \overline{B}(x_{0}, R)$ hy
  • $\lVert z\rVert \le R$ hz
  • $t \in \operatorname{Icc}(0, 1)$ ht

Then $y + t \cdot z \in \overline{B}(x_{0}, 2 \cdot R)$.

PLaplacian.segment_mem_bigBallPlaplacian/UnifBase.lean, lines 61–75
/-- A point of the segment from a base point near the maximum, with a small
increment, lies in the large ball. -/
theorem segment_mem_bigBall {x₀ y z : EuclSpace d} {R t : ℝ}
    (hy : y ∈ closedBall x₀ R) (hz : ‖z‖ ≤ R) (ht : t ∈ Icc (0 : ℝ) 1) :
    y + t • z ∈ closedBall x₀ (2 * R) := by
  rw [mem_closedBall, dist_eq_norm] at hy ⊢
  have htz : ‖t • z‖ ≤ ‖z‖ := by
    rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht.1]
    calc t * ‖z‖ ≤ 1 * ‖z‖ :=
          mul_le_mul_of_nonneg_right ht.2 (norm_nonneg z)
      _ = ‖z‖ := one_mul _
  calc ‖y + t • z - x₀‖ = ‖(y - x₀) + t • z‖ := by congr 1; abel
    _ ≤ ‖y - x₀‖ + ‖t • z‖ := norm_add_le _ _
    _ ≤ R + R := add_le_add hy (le_trans htz hz)
    _ = 2 * R := by ring
theoremderiv_three_uniform
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $R \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $C$ such that:

  • ∀ y ∈ Metric.closedBall x₀ R , ∀ ( z : EuclSpace d ) , ‖ z ‖ ≤ R → ∀ t ∈ Set.Icc 0 1 , | deriv ( deriv ( deriv fun s => φ ( y + s • z ) ) ) t | ≤ 6 * C * ‖ z ‖ ^ 3
PLaplacian.deriv_three_uniformPlaplacian/UnifBase.lean, lines 77–90
/-- **The third-derivative bound, uniform in the base point.** -/
theorem deriv_three_uniform {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x₀ : EuclSpace d) (R : ℝ) :
    ∃ C : ℝ, ∀ y ∈ closedBall x₀ R, ∀ z : EuclSpace d, ‖z‖ ≤ R →
      ∀ t ∈ Icc (0:ℝ) 1,
        |deriv (deriv (deriv (fun s : ℝ => φ (y + s • z)))) t|
          ≤ 6 * C * ‖z‖ ^ 3 := by
  obtain ⟨C, hC⟩ := exists_bound_all_orders hφ x₀ (2 * R)
  refine ⟨C, fun y hy z hz t ht => ?_⟩
  have hmem := segment_mem_bigBall hy hz ht
  have hbd := norm_iteratedFDeriv_three_comp hφ y z t (hC _ hmem)
  rw [comp_line_eq] at hbd
  rw [← iteratedDeriv_three, ← norm_iteratedFDeriv_eq_abs_iteratedDeriv]
  exact hbd

Plaplacian/UnifConst.lean2 declarations

theoremhess_bound_uniform
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $R \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $H$ such that:

  • $\forall y \in \overline{B}(x_{0}, R),\ \lVert \operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), y)\rVert \le H$
PLaplacian.hess_bound_uniformPlaplacian/UnifConst.lean, lines 49–56
/-- **The Hessian is uniformly bounded on a ball.** -/
theorem hess_bound_uniform {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (x₀ : EuclSpace d) (R : ℝ) :
    ∃ H : ℝ, ∀ y ∈ closedBall x₀ R, ‖fderiv ℝ (fderiv ℝ φ) y‖ ≤ H := by
  obtain ⟨C, hC⟩ := exists_bound_all_orders hφ x₀ R
  refine ⟨C, fun y hy => ?_⟩
  rw [norm_hess_eq_flat]
  exact hC y hy 2 (by norm_num)
theoremgrad_lower_uniform
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hx

Then there exists $\rho > 0$ such that:

  • $\forall y \in B(x_{0}, \rho),\ \lVert \operatorname{gradient}(\varphi, x_{0})\rVert / 2 < \lVert \operatorname{gradient}(\varphi, y)\rVert$
PLaplacian.grad_lower_uniformPlaplacian/UnifConst.lean, lines 58–70
/-- **The gradient is uniformly bounded below near the maximum.** -/
theorem grad_lower_uniform {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    {x₀ : EuclSpace d} (hx : gradient φ x₀ ≠ 0) :
    ∃ ρ > 0, ∀ y ∈ ball x₀ ρ,
      ‖gradient φ x₀‖ / 2 < ‖gradient φ y‖ := by
  have hpos : (0:ℝ) < ‖gradient φ x₀‖ := norm_pos_iff.2 hx
  have hcont : ContinuousAt (fun y => ‖gradient φ y‖) x₀ :=
    (continuous_gradient hφ).norm.continuousAt
  have hev : ∀ᶠ y in nhds x₀, ‖gradient φ x₀‖ / 2 < ‖gradient φ y‖ :=
    hcont.eventually (eventually_gt_nhds (by linarith))
  rw [Metric.eventually_nhds_iff] at hev
  obtain ⟨ρ, hρ, hball⟩ := hev
  exact ⟨ρ, hρ, fun y hy => hball hy⟩

Plaplacian/UnifContinuity.lean3 declarations

theoremabs_sSup_sub_sSup_leTheorem 1.10 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $K \in \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $\forall y,\ \lvert u(y) - v(y)\rvert \le K$ hK
  • $\forall y,\ \lvert u(y)\rvert \le C$ hCu
  • $\forall y,\ \lvert v(y)\rvert \le C$ hCv

Then |sSup (u '' S) - sSup (v '' S)| ≤ K.

PLaplacian.abs_sSup_sub_sSup_lePlaplacian/UnifContinuity.lean, lines 36–57
theorem abs_sSup_sub_sSup_le {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u v : EuclSpace d → ℝ} {K : ℝ} (hK : ∀ y, |u y - v y| ≤ K)
    {C : ℝ} (hCu : ∀ y, |u y| ≤ C) (hCv : ∀ y, |v y| ≤ C) :
    |sSup (u '' S) - sSup (v '' S)| ≤ K := by
  have hbu : BddAbove (u '' S) :=
    ⟨C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hCu y)).2⟩
  have hbv : BddAbove (v '' S) :=
    ⟨C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hCv y)).2⟩
  have h1 : sSup (u '' S) ≤ sSup (v '' S) + K := by
    refine csSup_le (hS.image u) ?_
    rintro a ⟨y, hy, rfl⟩
    have h2 : u y ≤ v y + K := by linarith [(abs_le.1 (hK y)).2]
    have h3 : v y ≤ sSup (v '' S) := le_csSup hbv ⟨y, hy, rfl⟩
    linarith
  have h4 : sSup (v '' S) ≤ sSup (u '' S) + K := by
    refine csSup_le (hS.image v) ?_
    rintro a ⟨y, hy, rfl⟩
    have h2 : v y ≤ u y + K := by linarith [(abs_le.1 (hK y)).1]
    have h3 : u y ≤ sSup (u '' S) := le_csSup hbu ⟨y, hy, rfl⟩
    linarith
  rw [abs_le]
  constructor <;> linarith
theoremabs_sInf_sub_sInf_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $K \in \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $\forall y,\ \lvert u(y) - v(y)\rvert \le K$ hK
  • $\forall y,\ \lvert u(y)\rvert \le C$ hCu
  • $\forall y,\ \lvert v(y)\rvert \le C$ hCv

Then |sInf (u '' S) - sInf (v '' S)| ≤ K.

PLaplacian.abs_sInf_sub_sInf_lePlaplacian/UnifContinuity.lean, lines 59–84
theorem abs_sInf_sub_sInf_le {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u v : EuclSpace d → ℝ} {K : ℝ} (hK : ∀ y, |u y - v y| ≤ K)
    {C : ℝ} (hCu : ∀ y, |u y| ≤ C) (hCv : ∀ y, |v y| ≤ C) :
    |sInf (u '' S) - sInf (v '' S)| ≤ K := by
  have hbu : BddBelow (u '' S) :=
    ⟨-C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hCu y)).1⟩
  have hbv : BddBelow (v '' S) :=
    ⟨-C, by rintro a ⟨y, -, rfl⟩; exact (abs_le.1 (hCv y)).1⟩
  have h1 : sInf (u '' S) ≤ sInf (v '' S) + K := by
    have hstep : sInf (u '' S) - K ≤ sInf (v '' S) := by
      refine le_csInf (hS.image v) ?_
      rintro a ⟨y, hy, rfl⟩
      have h2 : u y - K ≤ v y := by linarith [(abs_le.1 (hK y)).2]
      have h3 : sInf (u '' S) ≤ u y := csInf_le hbu ⟨y, hy, rfl⟩
      linarith
    linarith
  have h4 : sInf (v '' S) ≤ sInf (u '' S) + K := by
    have hstep : sInf (v '' S) - K ≤ sInf (u '' S) := by
      refine le_csInf (hS.image u) ?_
      rintro a ⟨y, hy, rfl⟩
      have h2 : v y - K ≤ u y := by linarith [(abs_le.1 (hK y)).1]
      have h3 : sInf (v '' S) ≤ v y := csInf_le hbv ⟨y, hy, rfl⟩
      linarith
    linarith
  rw [abs_le]
  constructor <;> linarith
theoremabs_setAverage_sub_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u, v \colon \mathbb{R}^{d} \to \mathbb{R}$, $K \in \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\varepsilon \in \mathbb{R}$.

Assume

  • $u\text{ is admissible (bounded and Borel measurable)}$ hu
  • $v\text{ is admissible (bounded and Borel measurable)}$ hv
  • $\forall y,\ \lvert u(y) - v(y)\rvert \le K$ hK
  • $0 < \varepsilon$ hε

Then $\lvert \fint_{B(x, \varepsilon)} u(y) \, dy - \fint_{B(x, \varepsilon)} v(y) \, dy\rvert \le K$.

PLaplacian.abs_setAverage_sub_lePlaplacian/UnifContinuity.lean, lines 86–118
/-- The average term is also uniformly continuous. -/
theorem abs_setAverage_sub_le {u v : EuclSpace d → ℝ}
    (hu : BddMeas u) (hv : BddMeas v) {K : ℝ} (hK : ∀ y, |u y - v y| ≤ K)
    (x : EuclSpace d) {ε : ℝ} (hε : 0 < ε) :
    |(⨍ y in ball x ε, u y) - ⨍ y in ball x ε, v y| ≤ K := by
  have h1 : (⨍ y in ball x ε, u y) ≤ (⨍ y in ball x ε, v y) + K := by
    have hc : (⨍ _y in ball x ε, K) = K := setAverage_const_ball K x hε
    have hstep : (⨍ y in ball x ε, u y)
        ≤ ⨍ y in ball x ε, (v y + K) := by
      refine setAverage_mono_ball x (hu.integrableOn_ball x ε) ?_ ?_
      · exact (hv.add_const' K).integrableOn_ball x ε
      · exact fun y => by linarith [(abs_le.1 (hK y)).2]
    have heq : (⨍ y in ball x ε, (v y + K))
        = (⨍ y in ball x ε, v y) + K := by
      rw [show (fun y : EuclSpace d => v y + K) = v + (fun _ => K) from rfl,
          MeasureTheory.setAverage_add (hv.integrableOn_ball x ε)
            integrableOn_const, hc]
    linarith [hstep, heq]
  have h4 : (⨍ y in ball x ε, v y) ≤ (⨍ y in ball x ε, u y) + K := by
    have hc : (⨍ _y in ball x ε, K) = K := setAverage_const_ball K x hε
    have hstep : (⨍ y in ball x ε, v y)
        ≤ ⨍ y in ball x ε, (u y + K) := by
      refine setAverage_mono_ball x (hv.integrableOn_ball x ε) ?_ ?_
      · exact (hu.add_const' K).integrableOn_ball x ε
      · exact fun y => by linarith [(abs_le.1 (hK y)).1]
    have heq : (⨍ y in ball x ε, (u y + K))
        = (⨍ y in ball x ε, u y) + K := by
      rw [show (fun y : EuclSpace d => u y + K) = u + (fun _ => K) from rfl,
          MeasureTheory.setAverage_add (hu.integrableOn_ball x ε)
            integrableOn_const, hc]
    linarith [hstep, heq]
  rw [abs_le]
  constructor <;> linarith

Plaplacian/UnifErr.lean2 declarations

theoremtaylorErr_eq_third_deriv
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $y, z \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $\xi \in \operatorname{Ioo}(0, 1)$ such that:

  • PLaplacian.taylorErr φ y z = 1 / 6 * deriv ( deriv ( deriv fun s => φ ( y + s • z ) ) ) ξ
PLaplacian.taylorErr_eq_third_derivPlaplacian/UnifErr.lean, lines 49–82
/-- **The Taylor error as a third derivative.** At any base point, for some
intermediate parameter, the error is one sixth of the third derivative of the
restriction there. -/
theorem taylorErr_eq_third_deriv {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ)
    (y z : EuclSpace d) :
    ∃ ξ ∈ Ioo (0:ℝ) 1,
      taylorErr φ y z
        = (1 / 6) * deriv (deriv (deriv (fun s : ℝ => φ (y + s • z)))) ξ := by
  obtain ⟨ξ, hξ, hres⟩ := taylor_two_deriv
    (fun s : ℝ => φ (y + s • z)) (by
      have h := contDiff_restrict_three hφ y z
      simpa [lineMap] using h)
  have hd1 : deriv (fun s : ℝ => φ (y + s • z)) 0
      = fderiv ℝ φ y z := by
    have h := hasDerivAt_first (hφ.of_le (by norm_num)) y z 0
    simp only [lineMap, zero_smul, add_zero] at h
    exact h.deriv
  have hd2 : deriv (deriv (fun s : ℝ => φ (y + s • z))) 0
      = fderiv ℝ (fderiv ℝ φ) y z z := by
    have h := hasDerivAt_second_at (hφ.of_le (by norm_num)) y z 0
    simp only [lineMap, zero_smul, add_zero] at h
    have hfun : deriv (fun s : ℝ => φ (y + s • z))
        = fun t => fderiv ℝ φ (y + t • z) z := by
      funext t
      have ht := hasDerivAt_first (hφ.of_le (by norm_num)) y z t
      simp only [lineMap] at ht
      exact ht.deriv
    rw [hfun]
    exact h.deriv
  refine ⟨ξ, hξ, ?_⟩
  unfold taylorErr
  simp only [one_smul, zero_smul, add_zero] at hres
  rw [hd1, hd2] at hres
  linarith [hres]
theoremtaylorErr_le_cubic_uniform
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $R \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ

Then there exists $K$ such that:

  • $\forall y \in \overline{B}(x_{0}, R),\ \forall z,\ \lVert z\rVert \le R \to \lvert \operatorname{taylorErr}(\varphi, y, z)\rvert \le K \cdot \lVert z\rVert ^{3}$
PLaplacian.taylorErr_le_cubic_uniformPlaplacian/UnifErr.lean, lines 84–94
/-- **The cubic Taylor bound, uniform in the base point.** -/
theorem taylorErr_le_cubic_uniform {φ : EuclSpace d → ℝ}
    (hφ : ContDiff ℝ 3 φ) (x₀ : EuclSpace d) (R : ℝ) :
    ∃ K : ℝ, ∀ y ∈ closedBall x₀ R, ∀ z : EuclSpace d, ‖z‖ ≤ R →
      |taylorErr φ y z| ≤ K * ‖z‖ ^ 3 := by
  obtain ⟨C, hC⟩ := deriv_three_uniform hφ x₀ R
  refine ⟨C, fun y hy z hz => ?_⟩
  obtain ⟨ξ, hξ, herr⟩ := taylorErr_eq_third_deriv hφ y z
  have hbd := hC y hy z hz ξ ⟨le_of_lt hξ.1, le_of_lt hξ.2⟩
  rw [herr, abs_mul, abs_of_nonneg (by norm_num : (0:ℝ) ≤ 1 / 6)]
  linarith [hbd]

Plaplacian/UnifEv.lean2 declarations

theorempointwise_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\rho, r, a \in \mathbb{R}$, $w \in \mathbb{R}^{d}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $\forall w \in \operatorname{annulus}(x_{0}, \rho, r),\ \overline{u}(w) - \varphi(w) < a$ hgap
  • $w \in \operatorname{annulus}(x_{0}, \rho, r)$ a._@._internal._hyg.0

Then there exists $S \in \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0))$ such that:

  • $\exists V \in \operatorname{nhds}(w),\ \forall \varepsilon \in S,\ \forall y \in V,\ u_{\varepsilon}(y) - \varphi(y) < a$
PLaplacian.pointwise_boundPlaplacian/UnifEv.lean, lines 55–70
/-- Pointwise: at each point of the annulus, a parameter set and a
neighbourhood carrying the bound. -/
theorem pointwise_bound (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    {x₀ : EuclSpace d} {ρ r a : ℝ}
    (hgap : ∀ w ∈ annulus x₀ ρ r, ubar u w - φ w < a) :
    ∀ w ∈ annulus x₀ ρ r,
      ∃ S ∈ nhdsWithin (0 : ℝ) (Set.Ioi 0), ∃ V ∈ nhds w,
        ∀ ε ∈ S, ∀ y ∈ V, u ε y - φ y < a := by
  intro w hw
  have hbd := abs_sub_le_of_bounds u hC hB
  have heq := ubar_sub u hC hφ hB w
  have hlt : ubar (fun ε y => u ε y - φ y) w < a := by
    rw [heq]; exact hgap w hw
  exact exists_prod_nhds_of_ubar_lt (fun ε y => u ε y - φ y) hbd w hlt
theoremuniform_bound_annulus
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\rho, r, a \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $\forall w \in \operatorname{annulus}(x_{0}, \rho, r),\ \overline{u}(w) - \varphi(w) < a$ hgap

Then there exists $S \in \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0))$ such that:

  • $\forall \varepsilon \in S,\ \forall y \in \operatorname{annulus}(x_{0}, \rho, r),\ u_{\varepsilon}(y) - \varphi(y) < a$
PLaplacian.uniform_bound_annulusPlaplacian/UnifEv.lean, lines 72–92
/-- **The uniform eventual bound on the annulus.** -/
theorem uniform_bound_annulus (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    {x₀ : EuclSpace d} {ρ r a : ℝ}
    (hgap : ∀ w ∈ annulus x₀ ρ r, ubar u w - φ w < a) :
    ∃ S ∈ nhdsWithin (0 : ℝ) (Set.Ioi 0),
      ∀ ε ∈ S, ∀ y ∈ annulus x₀ ρ r, u ε y - φ y < a := by
  have hpt := pointwise_bound u hC hφ hB hgap
  -- choose the parameter set and neighbourhood at each point
  choose! Sf hSf Vf hVf hbd using hpt
  -- a finite subcover of the annulus by the neighbourhoods
  obtain ⟨t, ht, hcover⟩ :=
    (isCompact_annulus x₀ ρ r).elim_nhds_subcover Vf hVf
  -- the intersection of the finitely many parameter sets
  refine ⟨⋂ w ∈ t, Sf w, ?_, ?_⟩
  · exact (Filter.biInter_finset_mem t).2 (fun w hw => hSf w (ht w hw))
  · intro ε hε y hy
    obtain ⟨w, hwt, hyw⟩ := Set.mem_iUnion₂.1 (hcover hy)
    have hεw : ε ∈ Sf w := Set.mem_iInter₂.1 hε w hwt
    exact hbd w (ht w hwt) ε hεw y hyw

Plaplacian/Uniform.lean2 declarations

deferr2
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x, w \in \mathbb{R}^{d}$.

Its value lies in $\mathbb{R}$.

/-- The second-order Taylor error. -/
def err2 (φ : EuclSpace d → ℝ) (x w : EuclSpace d) : ℝ :=
  φ (x + w) - φ x - fderiv ℝ φ x w
    - (1/2) * fderiv ℝ (fderiv ℝ φ) x w w
theoremfderiv_increment_small
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$, $\eta \in \mathbb{R}$.

Assume

  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $0 < \eta$ hη

Then there exists $\delta > 0$ such that:

  • $\forall w,\ \lVert w\rVert < \delta \to \lVert \operatorname{fderiv}(\mathbb{R}, \varphi, x + w) - \operatorname{fderiv}(\mathbb{R}, \varphi, x) - (\operatorname{fderiv}(\mathbb{R}, \operatorname{fderiv}(\mathbb{R}, \varphi), x))(w)\rVert \le \eta \cdot \lVert w\rVert$
PLaplacian.fderiv_increment_smallPlaplacian/Uniform.lean, lines 63–82
/-- **The derivative increment is uniformly small.** For every `η > 0` there
is a radius within which the derivative map differs from its linearisation by
at most `η` times the distance --- the little-o form of the above, with the
radius chosen before the increment. -/
theorem fderiv_increment_small {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ)
    (x : EuclSpace d) {η : ℝ} (hη : 0 < η) :
    ∃ δ > 0, ∀ w : EuclSpace d, ‖w‖ < δ →
      ‖fderiv ℝ φ (x + w) - fderiv ℝ φ x
          - fderiv ℝ (fderiv ℝ φ) x w‖ ≤ η * ‖w‖ := by
  have h := (hasFDerivAt_fderiv hφ x).isLittleO
  rw [Asymptotics.isLittleO_iff] at h
  have hev := h hη
  rw [Metric.eventually_nhds_iff] at hev
  obtain ⟨δ, hδ, hsub⟩ := hev
  refine ⟨δ, hδ, fun w hw => ?_⟩
  have hx : dist (x + w) x < δ := by
    rw [dist_eq_norm]
    simpa using hw
  have hres := hsub hx
  simpa using hres

Plaplacian/UniformConvergence.lean2 declarations

theoremunif_arithTheorem 1.11 in the blueprint
Formal statementgenerated from the Lean declaration

Let $\alpha, \beta, M, \delta, A, S \in \mathbb{R}$.

Assume

  • $0 \le \alpha$ hα
  • $\alpha + \beta = 1$ hab
  • $M - 2 \cdot \delta \le \alpha \cdot S + \beta \cdot A$ h1
  • $S \le M + \delta$ hS
  • $\beta \cdot A \le \delta$ hA

Then $\beta \cdot M \le \delta \cdot (3 + \alpha)$.

/-- **The chained inequality.** Given
`M - 2δ ≤ α S + β A`, `S ≤ M + δ` and `β A ≤ δ`, one has
`β M ≤ δ (3 + α)`.

Note that neither `0 < β` nor `0 < δ` is required: this step is algebra, using
only `α ≥ 0` and `α + β = 1`. -/
theorem unif_arith {α β M δ A S : ℝ}
    (hα : 0 ≤ α) (hab : α + β = 1)
    (h1 : M - 2 * δ ≤ α * S + β * A)
    (hS : S ≤ M + δ)
    (hA : β * A ≤ δ) :
    β * M ≤ δ * (3 + α) := by
  have hstep : α * S ≤ α * (M + δ) := mul_le_mul_of_nonneg_left hS hα
  have hexp : α * (M + δ) = α * M + α * δ := by ring
  have hbm : β * M = M - α * M := by
    have hβα : β = 1 - α := by linarith
    rw [hβα]; ring
  rw [hbm]
  linarith [h1, hstep, hexp, hA]
theoremle_zero_of_forall_ltTheorem 1.11 in the blueprint
Formal statementgenerated from the Lean declaration

Let $\beta, M, \alpha \in \mathbb{R}$.

Assume

  • $0 < \beta$ hβ
  • $0 \le \alpha$ hα
  • $\forall \delta > 0,\ \beta \cdot M \le \delta \cdot (3 + \alpha)$ h

Then $M \le 0$.

/-- **The limiting step.** This is where `β > 0` is used: if `β M` is bounded
by an arbitrarily small multiple of `3 + α`, then `M ≤ 0`. -/
theorem le_zero_of_forall_lt {β M α : ℝ} (hβ : 0 < β) (hα : 0 ≤ α)
    (h : ∀ δ > 0, β * M ≤ δ * (3 + α)) : M ≤ 0 := by
  by_contra hcon
  push Not at hcon
  have hpos : 0 < β * M := mul_pos hβ hcon
  obtain ⟨δ, hδpos, hδlt⟩ : ∃ δ > 0, δ * (3 + α) < β * M := by
    refine ⟨(β * M) / (2 * (3 + α)), by positivity, ?_⟩
    have h3 : 0 < 3 + α := by linarith
    rw [div_mul_eq_mul_div, div_lt_iff₀ (by positivity)]
    nlinarith [hpos, h3]
  exact absurd (h δ hδpos) (not_le.2 hδlt)

Plaplacian/UniformIteration.lean1 declarations

theoremdeficitLimit_eq_zeroTheorem 1.12 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p, \varepsilon \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{0} \colon \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $M \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < \varepsilon$ hε
  • $0 < d$ hd
  • $0 < p + d$ hpd
  • $\Omega\text{ is nonempty}$ _hΩ
  • $u_{0}\text{ is admissible (bounded and Borel measurable)}$ hu₀
  • $\forall y,\ \lvert u_{0}(y)\rvert \le C$ hC
  • $\forall x,\ u_{0}(x) \le T_{\varepsilon} u_{0}(x)$ hstep
  • $\operatorname{iterLimit}(p, \varepsilon, u_{0})\text{ is admissible (bounded and Borel measurable)}$ hBMu
  • $\forall \eta > 0,\ \forall \delta' > 0,\ \exists k,\ \int_{\Omega_{\varepsilon}} (\operatorname{iterLimit}(p, \varepsilon, u_{0}, y) - \operatorname{iter}(p, \varepsilon, u_{0}, k, y) \le \eta \wedge \operatorname{deficitSup}(\Omega_{\varepsilon}, \operatorname{iterLimit}(p, \varepsilon, u_{0}), \operatorname{iter}(p, \varepsilon, u_{0}, k)) \le M + \delta') \, dy$ hglob
  • $\forall k,\ \operatorname{IntegrableOn}(y \mapsto \operatorname{iterLimit}(p, \varepsilon, u_{0}, y) - \operatorname{iter}(p, \varepsilon, u_{0}, k, y), \Omega_{\varepsilon}, \lambda)$ hint
  • $\forall \delta,\ 0 < \delta \to \forall k,\ \exists x_{0} \in \Omega,\ \exists l,\ M - 2 \cdot \delta \le T_{\varepsilon} \operatorname{iter}(p, \varepsilon, u_{0}, l)(x_{0}) - T_{\varepsilon} \operatorname{iter}(p, \varepsilon, u_{0}, k)(x_{0})$ hsel

Then $M \le 0$.

/-- **Uniform convergence of the Perron iteration.** LPS Theorem 2.1.

The two limiting inputs and the index selections are taken as hypotheses; they
follow from `tendsto_setIntegral_deficit`, `tendsto_iterLimit` and the LPS
choices, and are discharged in a wrapper. Keeping them abstract isolates the
chained estimate, which is the substance.

Note that `hglob` carries two independent tolerances. The informal proof writes
`delta` for both the supremum bound and the integral bound, but they play
different roles: the integral target must absorb the factor
`beta / |B eps|` before it becomes a bound on the average term. -/
theorem deficitLimit_eq_zero (p ε : ℝ) (hp : 2 ≤ p) (hε : 0 < ε) (hd : 0 < d)
    (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (_hΩ : Ω.Nonempty)
    {u₀ : EuclSpace d → ℝ} (hu₀ : BddMeas u₀) {C : ℝ}
    (hC : ∀ y, |u₀ y| ≤ C)
    (hstep : ∀ x, u₀ x ≤ tugOfWarOp p ε u₀ x)
    (hBMu : BddMeas (iterLimit p ε u₀))
    {M : ℝ}
    (hglob : ∀ η > 0, ∀ δ' > 0, ∃ k, (∫ y in closureEps Ω ε,
      (iterLimit p ε u₀ y - iter p ε u₀ k y)) ≤ η
      ∧ deficitSup (closureEps Ω ε) (iterLimit p ε u₀)
          (iter p ε u₀ k) ≤ M + δ')
    (hint : ∀ k, MeasureTheory.IntegrableOn
      (fun y => iterLimit p ε u₀ y - iter p ε u₀ k y) (closureEps Ω ε))
    (hsel : ∀ (δ : ℝ), 0 < δ → ∀ k : ℕ, ∃ x₀ ∈ Ω, ∃ l : ℕ,
      M - 2 * δ ≤ tugOfWarOp p ε (iter p ε u₀ l) x₀
        - tugOfWarOp p ε (iter p ε u₀ k) x₀) :
    M ≤ 0 := by
  have hα : (0 : ℝ) ≤ (p - 2) / (p + (d : ℝ)) :=
    div_nonneg (by linarith) hpd.le
  have hβ : (0 : ℝ) < ((d : ℝ) + 2) / (p + (d : ℝ)) := by positivity
  have hvol : (0 : ℝ) < volume.real (ball (0 : EuclSpace d) ε) := by
    have h1 : volume (ball (0 : EuclSpace d) ε) ≠ 0 :=
      measure_ball_ne_zero 0 hε
    have h2 : volume (ball (0 : EuclSpace d) ε) ≠ ⊤ := measure_ball_lt_top.ne
    simp only [MeasureTheory.Measure.real]
    exact ENNReal.toReal_pos h1 h2
  set u := iterLimit p ε u₀ with hu
  have hCd : ∀ j y, |u y - iter p ε u₀ j y| ≤ 2 * C := fun j y =>
    abs_deficit_le p ε hp hε hd hpd hu₀ hC hstep j y
  have hnn : ∀ j y, 0 ≤ u y - iter p ε u₀ j y := fun j y =>
    deficit_nonneg p ε hp hε hd hpd hu₀ hC hstep j y
  have hBM : ∀ j, BddMeas (iter p ε u₀ j) := fun j =>
    bddMeas_iter p ε hp hε hpd hu₀ j
  refine deficitLimit_le_zero hα hβ (alpha_add_beta p hpd) ?_
  intro δ hδ
  -- the target for the global integral, chosen so the average bound is exactly δ
  set η := δ * volume.real (ball (0 : EuclSpace d) ε)
    / (((d : ℝ) + 2) / (p + (d : ℝ))) with hηdef
  have hηpos : 0 < η := by
    rw [hηdef]; positivity
  have hηeq : ((d : ℝ) + 2) / (p + (d : ℝ))
      * ((volume.real (ball (0 : EuclSpace d) ε))⁻¹ * η) = δ := by
    rw [hηdef]
    field_simp
  obtain ⟨k, hksmall, hksup⟩ := hglob η hηpos δ hδ
  obtain ⟨x₀, hx₀Ω, l, hchain⟩ := hsel δ hδ k
  refine ⟨⨍ y in ball x₀ ε, (u y - iter p ε u₀ k y),
          sSup ((fun y => u y - iter p ε u₀ k y) '' ball x₀ ε),
          ?_, ?_, ?_⟩
  · refine le_trans hchain ?_
    exact bound_one p ε hp hε hpd hBMu (hBM l) (hBM k)
      (fun y => iter_le_iterLimit p ε hp hε hd hpd hu₀ hC hstep l y)
      (hCd k) x₀
  · exact bound_two (hCd k) hksup hx₀Ω hε
  · rw [← hηeq]
    exact bound_three hε (hnn k) (hint k) hx₀Ω hβ.le hksmall

Plaplacian/UniformLimit.lean2 declarations

theoremdeficitLimit_le_zero
Formal statementgenerated from the Lean declaration

Let $M, \alpha, \beta \in \mathbb{R}$.

Assume

  • $0 \le \alpha$ hα
  • $0 < \beta$ hβ
  • $\alpha + \beta = 1$ hab
  • $\forall \delta > 0,\ \exists A, S',\ M - 2 \cdot \delta \le \alpha \cdot S' + \beta \cdot A \wedge S' \le M + \delta \wedge \beta \cdot A \le \delta$ hkey

Then $M \le 0$.

PLaplacian.deficitLimit_le_zeroPlaplacian/UniformLimit.lean, lines 35–47
/-- **Uniform convergence, abstract form.**

If the deficit sups converge to `M`, and for every `δ > 0` one can produce the
three bounds of `unif_arith`, then `M ≤ 0` --- i.e. the convergence is
uniform. This isolates the quantifier structure from the analysis. -/
theorem deficitLimit_le_zero {M α β : ℝ}
    (hα : 0 ≤ α) (hβ : 0 < β) (hab : α + β = 1)
    (hkey : ∀ δ > 0, ∃ A S', M - 2 * δ ≤ α * S' + β * A
      ∧ S' ≤ M + δ ∧ β * A ≤ δ) :
    M ≤ 0 := by
  refine le_zero_of_forall_lt hβ hα fun δ hδ => ?_
  obtain ⟨A, S', h1, hS, hA⟩ := hkey δ hδ
  exact unif_arith hα hab h1 hS hA
theoremtendsto_deficitSup_zero
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $S \subseteq \mathbb{R}^{d}$, $u \colon \mathbb{R}^{d} \to \mathbb{R}$, $w \colon \mathbb{N} \to \mathbb{R}^{d} \to \mathbb{R}$, $M, C \in \mathbb{R}$.

Assume

  • $S\text{ is nonempty}$ hS
  • $\forall j, x,\ \lvert u(x) - w(j, x)\rvert \le C$ hC
  • $\forall j, x,\ 0 \le u(x) - w(j, x)$ hnn
  • $\operatorname{Tendsto}(j \mapsto \operatorname{deficitSup}(S, u, w(j)), \mathrm{atTop}, \operatorname{nhds}(M))$ hlim
  • $M \le 0$ hM

Then $\operatorname{Tendsto}(j \mapsto \operatorname{deficitSup}(S, u, w(j)), \mathrm{atTop}, \operatorname{nhds}(0))$.

PLaplacian.tendsto_deficitSup_zeroPlaplacian/UniformLimit.lean, lines 49–62
/-- Uniform convergence follows: the deficit sups converge to `M ≤ 0`, and
being nonnegative they converge to `0`. -/
theorem tendsto_deficitSup_zero {S : Set (EuclSpace d)} (hS : S.Nonempty)
    {u : EuclSpace d → ℝ} {w : ℕ → EuclSpace d → ℝ} {M C : ℝ}
    (hC : ∀ j x, |u x - w j x| ≤ C)
    (hnn : ∀ j x, 0 ≤ u x - w j x)
    (hlim : Tendsto (fun j => deficitSup S u (w j)) atTop (nhds M))
    (hM : M ≤ 0) :
    Tendsto (fun j => deficitSup S u (w j)) atTop (nhds 0) := by
  have hMnn : 0 ≤ M :=
    ge_of_tendsto hlim (Filter.Eventually.of_forall fun j =>
      deficitSup_nonneg hS (hC j) (hnn j))
  have : M = 0 := le_antisymm hM hMnn
  rwa [this] at hlim

Plaplacian/UpperEv.lean1 declarations

theoremexists_upper_bound
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $B \in \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$, $\kappa \in \mathbb{R}$.

Assume

  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\varphi\text{ is continuous}$ hφ
  • $\forall y,\ \lvert \varphi(y)\rvert \le B$ hB
  • $0 < \kappa$ hκ

Then there exists $S \in \operatorname{nhdsWithin}(0, \operatorname{Ioi}(0))$ such that:

  • $\exists V \in \operatorname{nhds}(x_{0}),\ \forall \varepsilon \in S,\ \forall w \in V,\ u_{\varepsilon}(w) - \varphi(w) < \overline{u}(x_{0}) - \varphi(x_{0}) + \kappa$
PLaplacian.exists_upper_boundPlaplacian/UpperEv.lean, lines 67–84
/-- **The eventual upper bound, unpacked.**

There are a set of parameters and a neighbourhood of the base point on which
the family minus the test function is below the maximum plus any given
slack. -/
theorem exists_upper_bound (u : ℝ → EuclSpace d → ℝ) {C : ℝ}
    (hC : ∀ ε y, |u ε y| ≤ C) {φ : EuclSpace d → ℝ}
    (hφ : Continuous φ) {B : ℝ} (hB : ∀ y, |φ y| ≤ B)
    (x₀ : EuclSpace d) {κ : ℝ} (hκ : 0 < κ) :
    ∃ S ∈ nhdsWithin (0 : ℝ) (Set.Ioi 0), ∃ V ∈ nhds x₀,
      ∀ ε ∈ S, ∀ w ∈ V,
        u ε w - φ w < ubar u x₀ - φ x₀ + κ := by
  have hbd := abs_sub_le_of_bounds u hC hB
  have heq := ubar_sub u hC hφ hB x₀
  have hlt : ubar (fun ε y => u ε y - φ y) x₀
      < ubar u x₀ - φ x₀ + κ := by
    rw [heq]; linarith [hκ]
  exact exists_prod_nhds_of_ubar_lt (fun ε y => u ε y - φ y) hbd x₀ hlt

Plaplacian/ViscC2.lean17 declarations

theorembddBelow_quad_sphere
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then BddBelow ((fun v => (X v) v) '' {v | ‖v‖ = 1}).

PLaplacian.bddBelow_quad_spherePlaplacian/ViscC2.lean, lines 67–80
/-- The quadratic form on the unit sphere is bounded below. -/
theorem bddBelow_quad_sphere (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    BddBelow ((fun v => (X v) v) '' {v : EuclSpace d | ‖v‖ = 1}) := by
  refine ⟨-‖X‖, ?_⟩
  rintro a ⟨w, hw, rfl⟩
  have hw' : ‖w‖ = 1 := hw
  have h1 := X.le_opNorm w
  have h2 := (X w).le_opNorm w
  have h3 : |(X w) w| ≤ ‖X‖ := by
    calc |(X w) w| = ‖(X w) w‖ := (Real.norm_eq_abs _).symm
      _ ≤ ‖X w‖ * ‖w‖ := h2
      _ ≤ (‖X‖ * ‖w‖) * ‖w‖ := mul_le_mul_of_nonneg_right h1 (norm_nonneg _)
      _ = ‖X‖ := by rw [hw']; ring
  exact (abs_le.1 h3).1
theoremsphere_nonempty
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Assume

  • $0 < d$ hd

Then {v | ‖v‖ = 1}.Nonempty.

PLaplacian.sphere_nonemptyPlaplacian/ViscC2.lean, lines 82–85
/-- The unit sphere is nonempty in positive dimension. -/
theorem sphere_nonempty (hd : 0 < d) :
    {v : EuclSpace d | ‖v‖ = 1}.Nonempty :=
  ⟨EuclideanSpace.single (⟨0, hd⟩ : Fin d) 1, by simp⟩
theoremlaplacianOf_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X, Y : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $\kappa \in \mathbb{R}$.

Assume

  • $\forall v,\ (Y(v))(v) = (X(v))(v) + 2 \cdot \kappa \cdot \lVert v\rVert ^{2}$ hYX

Then $\operatorname{laplacianOf}(Y) = \operatorname{laplacianOf}(X) + 2 \cdot \kappa \cdot d$.

PLaplacian.laplacianOf_shiftPlaplacian/ViscC2.lean, lines 91–101
theorem laplacianOf_shift (hYX : ∀ v, (Y v) v = (X v) v + 2 * κ * ‖v‖ ^ 2) :
    laplacianOf Y = laplacianOf X + 2 * κ * d := by
  unfold laplacianOf
  have h : ∀ i : Fin d,
      (Y (EuclideanSpace.single i 1)) (EuclideanSpace.single i 1)
        = (X (EuclideanSpace.single i 1)) (EuclideanSpace.single i 1)
          + 2 * κ := by
    intro i; rw [hYX]; simp
  rw [Finset.sum_congr rfl (fun i _ => h i), Finset.sum_add_distrib]
  simp [Finset.sum_const]
  ring
theoreminfLaplacianOf_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X, Y : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $\kappa \in \mathbb{R}$, $q \in \mathbb{R}^{d}$.

Assume

  • $\forall v,\ (Y(v))(v) = (X(v))(v) + 2 \cdot \kappa \cdot \lVert v\rVert ^{2}$ hYX
  • $q \ne 0$ hq

Then $\operatorname{infLaplacianOf}(q, Y) = \operatorname{infLaplacianOf}(q, X) + 2 \cdot \kappa$.

PLaplacian.infLaplacianOf_shiftPlaplacian/ViscC2.lean, lines 103–110
theorem infLaplacianOf_shift (hYX : ∀ v, (Y v) v = (X v) v + 2 * κ * ‖v‖ ^ 2)
    {q : EuclSpace d} (hq : q ≠ 0) :
    infLaplacianOf q Y = infLaplacianOf q X + 2 * κ := by
  unfold infLaplacianOf
  rw [hYX]
  have hn : ‖‖q‖⁻¹ • q‖ = 1 := by
    rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ (norm_ne_zero_iff.2 hq)]
  rw [hn]; ring
theoremlamMax_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X, Y : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $\kappa \in \mathbb{R}$.

Assume

  • $0 < d$ hd
  • $\forall v,\ (Y(v))(v) = (X(v))(v) + 2 \cdot \kappa \cdot \lVert v\rVert ^{2}$ hYX

Then $\operatorname{lamMax}(Y) = \operatorname{lamMax}(X) + 2 \cdot \kappa$.

theorem lamMax_shift (hd : 0 < d)
    (hYX : ∀ v, (Y v) v = (X v) v + 2 * κ * ‖v‖ ^ 2) :
    lamMax Y = lamMax X + 2 * κ := by
  unfold lamMax
  have hS := sphere_nonempty hd
  have hbX := bddAbove_quad_sphere X
  have hbY := bddAbove_quad_sphere Y
  have hv : ∀ v ∈ {v : EuclSpace d | ‖v‖ = 1}, (Y v) v = (X v) v + 2 * κ := by
    intro v hvS
    have : ‖v‖ = 1 := hvS
    rw [hYX, this]; ring
  apply le_antisymm
  · apply csSup_le (hS.image _)
    rintro _ ⟨v, hvS, rfl⟩
    change (Y v) v ≤ _
    rw [hv v hvS]
    have := le_csSup hbX ⟨v, hvS, rfl⟩
    linarith
  · have hle : sSup ((fun v => (X v) v) '' {v : EuclSpace d | ‖v‖ = 1})
        ≤ sSup ((fun v => (Y v) v) '' {v : EuclSpace d | ‖v‖ = 1}) - 2 * κ := by
      apply csSup_le (hS.image _)
      rintro _ ⟨v, hvS, rfl⟩
      change (X v) v ≤ _
      have h1 : (Y v) v ≤ sSup ((fun v => (Y v) v) '' {v : EuclSpace d | ‖v‖ = 1}) :=
        le_csSup hbY ⟨v, hvS, rfl⟩
      rw [hv v hvS] at h1
      linarith
    linarith
theoremlamMin_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X, Y : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $\kappa \in \mathbb{R}$.

Assume

  • $0 < d$ hd
  • $\forall v,\ (Y(v))(v) = (X(v))(v) + 2 \cdot \kappa \cdot \lVert v\rVert ^{2}$ hYX

Then $\operatorname{lamMin}(Y) = \operatorname{lamMin}(X) + 2 \cdot \kappa$.

theorem lamMin_shift (hd : 0 < d)
    (hYX : ∀ v, (Y v) v = (X v) v + 2 * κ * ‖v‖ ^ 2) :
    lamMin Y = lamMin X + 2 * κ := by
  unfold lamMin
  have hS := sphere_nonempty hd
  have hbX := bddBelow_quad_sphere X
  have hbY := bddBelow_quad_sphere Y
  have hv : ∀ v ∈ {v : EuclSpace d | ‖v‖ = 1}, (Y v) v = (X v) v + 2 * κ := by
    intro v hvS
    have : ‖v‖ = 1 := hvS
    rw [hYX, this]; ring
  apply le_antisymm
  · have hle : sInf ((fun v => (Y v) v) '' {v : EuclSpace d | ‖v‖ = 1}) - 2 * κ
        ≤ sInf ((fun v => (X v) v) '' {v : EuclSpace d | ‖v‖ = 1}) := by
      apply le_csInf (hS.image _)
      rintro _ ⟨v, hvS, rfl⟩
      change _ ≤ (X v) v
      have h1 : sInf ((fun v => (Y v) v) '' {v : EuclSpace d | ‖v‖ = 1}) ≤ (Y v) v :=
        csInf_le hbY ⟨v, hvS, rfl⟩
      rw [hv v hvS] at h1
      linarith
    linarith
  · apply le_csInf (hS.image _)
    rintro _ ⟨v, hvS, rfl⟩
    change _ ≤ (Y v) v
    rw [hv v hvS]
    have := csInf_le hbX ⟨v, hvS, rfl⟩
    linarith
theoremviscF_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X, Y : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $\kappa \in \mathbb{R}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$.

Assume

  • $\forall v,\ (Y(v))(v) = (X(v))(v) + 2 \cdot \kappa \cdot \lVert v\rVert ^{2}$ hYX
  • $q \ne 0$ hq

Then $\operatorname{viscF}(p, q, Y) = \operatorname{viscF}(p, q, X) - 2 \cdot \kappa \cdot (d + p - 2)$.

theorem viscF_shift (hYX : ∀ v, (Y v) v = (X v) v + 2 * κ * ‖v‖ ^ 2)
    {p : ℝ} {q : EuclSpace d} (hq : q ≠ 0) :
    viscF p q Y = viscF p q X - 2 * κ * ((d : ℝ) + p - 2) := by
  rw [viscF_eq_neg, viscF_eq_neg]
  unfold normPLapOf
  rw [laplacianOf_shift hYX, infLaplacianOf_shift hYX hq]
  ring
theoremviscFLower_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X, Y : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $\kappa \in \mathbb{R}$, $p \in \mathbb{R}$.

Assume

  • $0 < d$ hd
  • $\forall v,\ (Y(v))(v) = (X(v))(v) + 2 \cdot \kappa \cdot \lVert v\rVert ^{2}$ hYX

Then $\operatorname{viscFLower}(p, Y) = \operatorname{viscFLower}(p, X) - 2 \cdot \kappa \cdot (d + p - 2)$.

PLaplacian.viscFLower_shiftPlaplacian/ViscC2.lean, lines 178–183
theorem viscFLower_shift (hd : 0 < d)
    (hYX : ∀ v, (Y v) v = (X v) v + 2 * κ * ‖v‖ ^ 2) {p : ℝ} :
    viscFLower p Y = viscFLower p X - 2 * κ * ((d : ℝ) + p - 2) := by
  unfold viscFLower
  rw [laplacianOf_shift hYX, lamMax_shift hd hYX]
  ring
theoremviscFUpper_shift
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X, Y : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ, $\kappa \in \mathbb{R}$, $p \in \mathbb{R}$.

Assume

  • $0 < d$ hd
  • $\forall v,\ (Y(v))(v) = (X(v))(v) + 2 \cdot \kappa \cdot \lVert v\rVert ^{2}$ hYX

Then $\operatorname{viscFUpper}(p, Y) = \operatorname{viscFUpper}(p, X) - 2 \cdot \kappa \cdot (d + p - 2)$.

PLaplacian.viscFUpper_shiftPlaplacian/ViscC2.lean, lines 185–190
theorem viscFUpper_shift (hd : 0 < d)
    (hYX : ∀ v, (Y v) v = (X v) v + 2 * κ * ‖v‖ ^ 2) {p : ℝ} :
    viscFUpper p Y = viscFUpper p X - 2 * κ * ((d : ℝ) + p - 2) := by
  unfold viscFUpper
  rw [laplacianOf_shift hYX, lamMin_shift hd hYX]
  ring
theoremnonpos_of_forall_le_mul
Formal statementgenerated from the Lean declaration

Let $a, D \in \mathbb{R}$.

Assume

  • $0 < D$ hD
  • $\forall \eta > 0,\ a \le 2 \cdot \eta \cdot D$ h

Then $a \le 0$.

PLaplacian.nonpos_of_forall_le_mulPlaplacian/ViscC2.lean, lines 194–201
/-- A quantity bounded by every positive multiple of a positive constant is
nonpositive. -/
theorem nonpos_of_forall_le_mul {a D : ℝ} (hD : 0 < D)
    (h : ∀ η > 0, a ≤ 2 * η * D) : a ≤ 0 := by
  refine le_of_forall_pos_le_add (fun ε hε => ?_)
  have h1 := h (ε / (2 * D)) (by positivity)
  have h2 : 2 * (ε / (2 * D)) * D = ε := by field_simp
  linarith
theoremdim_pos
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp

Then $0 < d + p - 2$.

theorem dim_pos {p : ℝ} (hd : 0 < d) (hp : 2 ≤ p) : 0 < (d : ℝ) + p - 2 := by
  have : (1 : ℝ) ≤ d := by exact_mod_cast hd
  linarith
theoremvisc2_reg_subTheorem 4.13 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $x_{0} \in \Omega$ hx₀
  • $\operatorname{IsLocalMax}(y \mapsto \overline{u}(y) - \varphi(y), x_{0})$ hmax
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hg

Then $\operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0})) \le 0$.

/-- **The regular subsolution field, for `C²` test functions.** -/
theorem visc2_reg_sub [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ) {x₀ : EuclSpace d}
    (hx₀ : x₀ ∈ Ω) (hmax : IsLocalMax (fun y => ubar u y - φ y) x₀)
    (hg : gradient φ x₀ ≠ 0) :
    viscF p (gradient φ x₀) (hess φ x₀) ≤ 0 := by
  have key : ∀ η > 0, viscF p (gradient φ x₀) (hess φ x₀)
      ≤ 2 * η * ((d : ℝ) + p - 2) := by
    intro η hη
    have hgP : gradient (tPoly φ x₀ η) x₀ ≠ 0 := by
      rw [gradient_tPoly_self]; exact hg
    have h := visc_reg_sub hd hp hpd hΩ hC hu (contDiff_tPoly φ x₀ η) hx₀
      (localMax_tPoly hφ hmax hη) hgP
    rw [gradient_tPoly_self] at h
    rw [viscF_shift (X := hess φ x₀) (fun v => hess_tPoly_quad φ x₀ v η) hg] at h
    linarith
  exact nonpos_of_forall_le_mul (dim_pos hd hp) key
theoremvisc2_sing_subTheorem 4.13 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $x_{0} \in \Omega$ hx₀
  • $\operatorname{IsLocalMax}(y \mapsto \overline{u}(y) - \varphi(y), x_{0})$ hmax

Then $\operatorname{viscFLower}(p, \operatorname{hess}(\varphi, x_{0})) \le 0$.

/-- **The singular subsolution field, for `C²` test functions.** -/
theorem visc2_sing_sub [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ) {x₀ : EuclSpace d}
    (hx₀ : x₀ ∈ Ω) (hmax : IsLocalMax (fun y => ubar u y - φ y) x₀) :
    viscFLower p (hess φ x₀) ≤ 0 := by
  have key : ∀ η > 0, viscFLower p (hess φ x₀)
      ≤ 2 * η * ((d : ℝ) + p - 2) := by
    intro η hη
    have h := visc_sing_sub hd hp hpd hΩ hC hu (contDiff_tPoly φ x₀ η) hx₀
      (localMax_tPoly hφ hmax hη)
    rw [viscFLower_shift (X := hess φ x₀) hd
      (fun v => hess_tPoly_quad φ x₀ v η)] at h
    linarith
  exact nonpos_of_forall_le_mul (dim_pos hd hp) key
theoremvisc2_reg_superTheorem 4.13 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $x_{0} \in \Omega$ hx₀
  • $\operatorname{IsLocalMin}(y \mapsto \underline{u}(y) - \varphi(y), x_{0})$ hmin
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hg

Then $0 \le \operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0}))$.

PLaplacian.visc2_reg_superPlaplacian/ViscC2.lean, lines 248–269
/-- **The regular supersolution field, for `C²` test functions.** -/
theorem visc2_reg_super [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ) {x₀ : EuclSpace d}
    (hx₀ : x₀ ∈ Ω) (hmin : IsLocalMin (fun y => lbar u y - φ y) x₀)
    (hg : gradient φ x₀ ≠ 0) :
    0 ≤ viscF p (gradient φ x₀) (hess φ x₀) := by
  have key : ∀ η > 0, -viscF p (gradient φ x₀) (hess φ x₀)
      ≤ 2 * η * ((d : ℝ) + p - 2) := by
    intro η hη
    have hgP : gradient (tPoly φ x₀ (-η)) x₀ ≠ 0 := by
      rw [gradient_tPoly_self]; exact hg
    have h := visc_reg_super hd hp hpd hΩ hC hu (contDiff_tPoly φ x₀ (-η))
      hx₀ (localMin_tPoly hφ hmin hη) hgP
    rw [gradient_tPoly_self] at h
    rw [viscF_shift (X := hess φ x₀) (fun v => hess_tPoly_quad φ x₀ v (-η))
      hg] at h
    linarith
  linarith [nonpos_of_forall_le_mul (dim_pos hd hp) key]
theoremvisc2_sing_superTheorem 4.13 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 2, \varphi)$ hφ
  • $x_{0} \in \Omega$ hx₀
  • $\operatorname{IsLocalMin}(y \mapsto \underline{u}(y) - \varphi(y), x_{0})$ hmin

Then $0 \le \operatorname{viscFUpper}(p, \operatorname{hess}(\varphi, x_{0}))$.

PLaplacian.visc2_sing_superPlaplacian/ViscC2.lean, lines 271–288
/-- **The singular supersolution field, for `C²` test functions.** -/
theorem visc2_sing_super [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 2 φ) {x₀ : EuclSpace d}
    (hx₀ : x₀ ∈ Ω) (hmin : IsLocalMin (fun y => lbar u y - φ y) x₀) :
    0 ≤ viscFUpper p (hess φ x₀) := by
  have key : ∀ η > 0, -viscFUpper p (hess φ x₀)
      ≤ 2 * η * ((d : ℝ) + p - 2) := by
    intro η hη
    have h := visc_sing_super hd hp hpd hΩ hC hu (contDiff_tPoly φ x₀ (-η))
      hx₀ (localMin_tPoly hφ hmin hη)
    rw [viscFUpper_shift (X := hess φ x₀) hd
      (fun v => hess_tPoly_quad φ x₀ v (-η))] at h
    linarith
  linarith [nonpos_of_forall_le_mul (dim_pos hd hp) key]
theoremubar_isViscositySubsolutionTheorem 4.14 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu

Then $\overline{u}\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$.

PLaplacian.ubar_isViscositySubsolutionPlaplacian/ViscC2.lean, lines 290–302
/-- **The upper relaxed limit is a viscosity subsolution** of the homogeneous
normalized `p`-Laplace equation, in the sense of the layer-two predicate. -/
theorem ubar_isViscositySubsolution [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε)) :
    IsViscositySubsolution p Ω (fun _ => 0) (ubar u) :=
  ⟨(upperSemicontinuous_ubar u hC).upperSemicontinuousOn _,
   fun _φ hφ _x₀ hx₀ hmax hg =>
     visc2_reg_sub hd hp hpd hΩ hC hu hφ hx₀ hmax hg,
   fun _φ hφ _x₀ hx₀ hmax _ =>
     visc2_sing_sub hd hp hpd hΩ hC hu hφ hx₀ hmax⟩
theoremlbar_isViscositySupersolutionTheorem 4.14 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu

Then $\underline{u}\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$.

PLaplacian.lbar_isViscositySupersolutionPlaplacian/ViscC2.lean, lines 304–316
/-- **The lower relaxed limit is a viscosity supersolution** of the homogeneous
normalized `p`-Laplace equation, in the sense of the layer-two predicate. -/
theorem lbar_isViscositySupersolution [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε)) :
    IsViscositySupersolution p Ω (fun _ => 0) (lbar u) :=
  ⟨(lowerSemicontinuous_lbar u hC).lowerSemicontinuousOn _,
   fun _φ hφ _x₀ hx₀ hmin hg =>
     visc2_reg_super hd hp hpd hΩ hC hu hφ hx₀ hmin hg,
   fun _φ hφ _x₀ hx₀ hmin _ =>
     visc2_sing_super hd hp hpd hΩ hC hu hφ hx₀ hmin⟩

Plaplacian/ViscC3.lean10 declarations

structureIsViscositySubsolution3
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

This defines a property of these parameters.

PLaplacian.IsViscositySubsolution3Plaplacian/ViscC3.lean, lines 68–77
/-- The subsolution predicate, with test functions of class `C³`. -/
structure IsViscositySubsolution3 (p : ℝ) (Ω : Set (EuclSpace d))
    (f u : EuclSpace d → ℝ) : Prop where
  usc : UpperSemicontinuousOn u Ω
  regular : ∀ φ : EuclSpace d → ℝ, ContDiff ℝ 3 φ → ∀ x₀ ∈ Ω,
    IsLocalMax (fun y => u y - φ y) x₀ → gradient φ x₀ ≠ 0 →
      viscF p (gradient φ x₀) (hess φ x₀) ≤ f x₀
  singular : ∀ φ : EuclSpace d → ℝ, ContDiff ℝ 3 φ → ∀ x₀ ∈ Ω,
    IsLocalMax (fun y => u y - φ y) x₀ → gradient φ x₀ = 0 →
      viscFLower p (hess φ x₀) ≤ f x₀
structureIsViscositySupersolution3
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

This defines a property of these parameters.

PLaplacian.IsViscositySupersolution3Plaplacian/ViscC3.lean, lines 79–88
/-- The supersolution predicate, with test functions of class `C³`. -/
structure IsViscositySupersolution3 (p : ℝ) (Ω : Set (EuclSpace d))
    (f u : EuclSpace d → ℝ) : Prop where
  lsc : LowerSemicontinuousOn u Ω
  regular : ∀ φ : EuclSpace d → ℝ, ContDiff ℝ 3 φ → ∀ x₀ ∈ Ω,
    IsLocalMin (fun y => u y - φ y) x₀ → gradient φ x₀ ≠ 0 →
      f x₀ ≤ viscF p (gradient φ x₀) (hess φ x₀)
  singular : ∀ φ : EuclSpace d → ℝ, ContDiff ℝ 3 φ → ∀ x₀ ∈ Ω,
    IsLocalMin (fun y => u y - φ y) x₀ → gradient φ x₀ = 0 →
      f x₀ ≤ viscFUpper p (hess φ x₀)
theoremexists_closedBall_subset
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\Omega \subseteq \mathbb{R}^{d}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\Omega\text{ is open}$ hΩ
  • $x_{0} \in \Omega$ hx₀

Then there exists $R > 0$ such that:

  • $\overline{B}(x_{0}, R) \subseteq \Omega$
PLaplacian.exists_closedBall_subsetPlaplacian/ViscC3.lean, lines 90–96
/-- An open set contains a closed ball about each of its points. -/
theorem exists_closedBall_subset {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω)
    {x₀ : EuclSpace d} (hx₀ : x₀ ∈ Ω) :
    ∃ R > 0, closedBall x₀ R ⊆ Ω := by
  obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 hΩ x₀ hx₀
  exact ⟨ε / 2, by linarith,
    (closedBall_subset_ball (by linarith)).trans hball⟩
theoremlocalMax_neg_of_localMin
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\operatorname{IsLocalMin}(y \mapsto \underline{u}(y) - \varphi(y), x_{0})$ hmin

Then $\operatorname{IsLocalMax}(y \mapsto \overline{\varepsilon, y \mapsto - u_{\varepsilon}(y)}(y) - (y \mapsto - \varphi(y))(y), x_{0})$.

PLaplacian.localMax_neg_of_localMinPlaplacian/ViscC3.lean, lines 98–113
/-- A local minimum of the lower limit minus the test function is a local
maximum of the upper limit of the negated family minus the negated test
function. -/
theorem localMax_neg_of_localMin {u : ℝ → EuclSpace d → ℝ}
    {φ : EuclSpace d → ℝ} {x₀ : EuclSpace d}
    (hmin : IsLocalMin (fun y => lbar u y - φ y) x₀) :
    IsLocalMax (fun y => ubar (fun ε y => -u ε y) y - (fun y => -φ y) y) x₀ := by
  unfold IsLocalMin IsMinFilter at hmin
  unfold IsLocalMax IsMaxFilter
  filter_upwards [hmin] with w hw
  have h1 := lbar_eq_neg_ubar_neg u w
  have h2 := lbar_eq_neg_ubar_neg u x₀
  change lbar u x₀ - φ x₀ ≤ lbar u w - φ w at hw
  change ubar (fun ε y => -u ε y) w - -φ w
    ≤ ubar (fun ε y => -u ε y) x₀ - -φ x₀
  linarith
theoremvisc_reg_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $x_{0} \in \Omega$ hx₀
  • $\operatorname{IsLocalMax}(y \mapsto \overline{u}(y) - \varphi(y), x_{0})$ hmax
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hg

Then $\operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0})) \le 0$.

/-- **The regular subsolution field.** -/
theorem visc_reg_sub [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) {x₀ : EuclSpace d}
    (hx₀ : x₀ ∈ Ω) (hmax : IsLocalMax (fun y => ubar u y - φ y) x₀)
    (hg : gradient φ x₀ ≠ 0) :
    viscF p (gradient φ x₀) (hess φ x₀) ≤ 0 := by
  obtain ⟨R, hR, hcb⟩ := exists_closedBall_subset hΩ hx₀
  obtain ⟨ψ, r, hr, hrR, hψ, hψb, ⟨B, hB⟩, hstrict, hgrad, hhess⟩ :=
    regularize (V := ubar u) hφ hmax hR
  have hΩr : closedBall x₀ r ⊆ Ω :=
    (closedBall_subset_closedBall hrR).trans hcb
  have hgψ : gradient ψ x₀ ≠ 0 := by rw [hgrad]; exact hg
  have h := regular_subsol hd hp hpd hC hu hψ hψb hB hr hΩr hstrict hgψ
  rw [hgrad, hhess] at h
  exact viscF_le_of_chain h
theoremvisc_sing_sub
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $x_{0} \in \Omega$ hx₀
  • $\operatorname{IsLocalMax}(y \mapsto \overline{u}(y) - \varphi(y), x_{0})$ hmax

Then $\operatorname{viscFLower}(p, \operatorname{hess}(\varphi, x_{0})) \le 0$.

/-- **The singular subsolution field.** -/
theorem visc_sing_sub [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) {x₀ : EuclSpace d}
    (hx₀ : x₀ ∈ Ω) (hmax : IsLocalMax (fun y => ubar u y - φ y) x₀) :
    viscFLower p (hess φ x₀) ≤ 0 := by
  obtain ⟨R, hR, hcb⟩ := exists_closedBall_subset hΩ hx₀
  obtain ⟨ψ, r, hr, hrR, hψ, hψb, ⟨B, hB⟩, hstrict, _hgrad, hhess⟩ :=
    regularize (V := ubar u) hφ hmax hR
  have hΩr : closedBall x₀ r ⊆ Ω :=
    (closedBall_subset_closedBall hrR).trans hcb
  have h := singular_subsol hd hp hpd hC hu hψ hψb hB hr hΩr hstrict
  rw [hess_eq_fderiv, hhess] at h
  rw [hess_eq_fderiv]
  exact h
theoremvisc_reg_super
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $x_{0} \in \Omega$ hx₀
  • $\operatorname{IsLocalMin}(y \mapsto \underline{u}(y) - \varphi(y), x_{0})$ hmin
  • $\operatorname{gradient}(\varphi, x_{0}) \ne 0$ hg

Then $0 \le \operatorname{viscF}(p, \operatorname{gradient}(\varphi, x_{0}), \operatorname{hess}(\varphi, x_{0}))$.

/-- **The regular supersolution field**, through the negated family. -/
theorem visc_reg_super [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) {x₀ : EuclSpace d}
    (hx₀ : x₀ ∈ Ω) (hmin : IsLocalMin (fun y => lbar u y - φ y) x₀)
    (hg : gradient φ x₀ ≠ 0) :
    0 ≤ viscF p (gradient φ x₀) (hess φ x₀) := by
  obtain ⟨R, hR, hcb⟩ := exists_closedBall_subset hΩ hx₀
  obtain ⟨ψ, r, hr, hrR, hψ, hψb, ⟨B, hB⟩, hstrict, hgrad, hhess⟩ :=
    regularize (V := ubar (fun ε y => -u ε y)) (contDiff_neg' hφ)
      (localMax_neg_of_localMin hmin) hR
  have hΩr : closedBall x₀ r ⊆ Ω :=
    (closedBall_subset_closedBall hrR).trans hcb
  have hgψ : gradient ψ x₀ ≠ 0 := by
    rw [hgrad]; exact gradient_neg_ne_zero hg
  have hCn : ∀ ε y, |(fun ε y => -u ε y) ε y| ≤ C := by
    intro ε y; simp only; rw [abs_neg]; exact hC ε y
  have hun : ∀ ε > 0, IsPHarmonious p ε Ω (fun y => -F y)
      ((fun ε y => -u ε y) ε) :=
    fun ε hε => isPHarmonious_neg (hu ε hε)
  have h := regular_subsol hd hp hpd hCn hun hψ hψb hB hr hΩr hstrict hgψ
  rw [hgrad, hhess, normPLapOf_neg] at h
  rw [viscF_eq_neg, hess_eq_fderiv]
  linarith
theoremvisc_sing_super
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x_{0} \in \mathbb{R}^{d}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu
  • $\operatorname{ContDiff}(\mathbb{R}, 3, \varphi)$ hφ
  • $x_{0} \in \Omega$ hx₀
  • $\operatorname{IsLocalMin}(y \mapsto \underline{u}(y) - \varphi(y), x_{0})$ hmin

Then $0 \le \operatorname{viscFUpper}(p, \operatorname{hess}(\varphi, x_{0}))$.

PLaplacian.visc_sing_superPlaplacian/ViscC3.lean, lines 182–207
/-- **The singular supersolution field**, through the negated family. -/
theorem visc_sing_super [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε))
    {φ : EuclSpace d → ℝ} (hφ : ContDiff ℝ 3 φ) {x₀ : EuclSpace d}
    (hx₀ : x₀ ∈ Ω) (hmin : IsLocalMin (fun y => lbar u y - φ y) x₀) :
    0 ≤ viscFUpper p (hess φ x₀) := by
  obtain ⟨R, hR, hcb⟩ := exists_closedBall_subset hΩ hx₀
  obtain ⟨ψ, r, hr, hrR, hψ, hψb, ⟨B, hB⟩, hstrict, _hgrad, hhess⟩ :=
    regularize (V := ubar (fun ε y => -u ε y)) (contDiff_neg' hφ)
      (localMax_neg_of_localMin hmin) hR
  have hΩr : closedBall x₀ r ⊆ Ω :=
    (closedBall_subset_closedBall hrR).trans hcb
  have hCn : ∀ ε y, |(fun ε y => -u ε y) ε y| ≤ C := by
    intro ε y; simp only; rw [abs_neg]; exact hC ε y
  have hun : ∀ ε > 0, IsPHarmonious p ε Ω (fun y => -F y)
      ((fun ε y => -u ε y) ε) :=
    fun ε hε => isPHarmonious_neg (hu ε hε)
  have h := singular_subsol hd hp hpd hCn hun hψ hψb hB hr hΩr hstrict
  unfold viscFLower at h
  unfold viscFUpper
  rw [hess_eq_fderiv, hhess, hess_neg, laplacianOf_neg, lamMax_neg] at h
  rw [hess_eq_fderiv]
  linarith
theoremubar_isViscositySubsolution3
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu

Then $\operatorname{IsViscositySubsolution3}(p, \Omega, x \mapsto 0, \overline{u})$.

PLaplacian.ubar_isViscositySubsolution3Plaplacian/ViscC3.lean, lines 209–221
/-- **The upper relaxed limit is a viscosity subsolution**, for `C³` test
functions. -/
theorem ubar_isViscositySubsolution3 [Nontrivial (EuclSpace d)] (hd : 0 < d)
    {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε)) :
    IsViscositySubsolution3 p Ω (fun _ => 0) (ubar u) :=
  ⟨(upperSemicontinuous_ubar u hC).upperSemicontinuousOn _,
   fun _φ hφ _x₀ hx₀ hmax hg =>
     visc_reg_sub hd hp hpd hΩ hC hu hφ hx₀ hmax hg,
   fun _φ hφ _x₀ hx₀ hmax _ =>
     visc_sing_sub hd hp hpd hΩ hC hu hφ hx₀ hmax⟩
theoremlbar_isViscositySupersolution3
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $F \colon \mathbb{R}^{d} \to \mathbb{R}$, $u \colon \mathbb{R} \to \mathbb{R}^{d} \to \mathbb{R}$, $C \in \mathbb{R}$.

Assume

  • $\mathbb{R}^{d}\text{ is nontrivial}$
  • $0 < d$ hd
  • $2 \le p$ hp
  • $0 < p + d$ hpd
  • $\Omega\text{ is open}$ hΩ
  • $\forall \varepsilon, y,\ \lvert u_{\varepsilon}(y)\rvert \le C$ hC
  • $\forall \varepsilon > 0,\ u_{\varepsilon}\text{ is }p\text{-harmonious in }\Omega\text{ with step }\varepsilon\text{ and data }F$ hu

Then $\operatorname{IsViscositySupersolution3}(p, \Omega, x \mapsto 0, \underline{u})$.

PLaplacian.lbar_isViscositySupersolution3Plaplacian/ViscC3.lean, lines 223–235
/-- **The lower relaxed limit is a viscosity supersolution**, for `C³` test
functions. -/
theorem lbar_isViscositySupersolution3 [Nontrivial (EuclSpace d)]
    (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    {Ω : Set (EuclSpace d)} (hΩ : IsOpen Ω) {F : EuclSpace d → ℝ}
    {u : ℝ → EuclSpace d → ℝ} {C : ℝ} (hC : ∀ ε y, |u ε y| ≤ C)
    (hu : ∀ ε > 0, IsPHarmonious p ε Ω F (u ε)) :
    IsViscositySupersolution3 p Ω (fun _ => 0) (lbar u) :=
  ⟨(lowerSemicontinuous_lbar u hC).lowerSemicontinuousOn _,
   fun _φ hφ _x₀ hx₀ hmin hg =>
     visc_reg_super hd hp hpd hΩ hC hu hφ hx₀ hmin hg,
   fun _φ hφ _x₀ hx₀ hmin _ =>
     visc_sing_super hd hp hpd hΩ hC hu hφ hx₀ hmin⟩

Plaplacian/ViscUnique.lean1 declarations

theoremvisc_uniqueTheorem 6.6 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $u_{1}, u_{2} \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Assume

  • $0 < d$ hd
  • $2 \le p$ hp
  • $\Omega\text{ is open}$ hΩo
  • $\Omega\text{ is bounded}$ hΩb
  • $u_{1}\text{ is continuous}$ h₁c
  • $u_{2}\text{ is continuous}$ h₂c
  • $u_{1}\text{ is bounded above}$ h₁a
  • $u_{1}\text{ is bounded below}$ h₁b
  • $u_{2}\text{ is bounded above}$ h₂a
  • $u_{2}\text{ is bounded below}$ h₂b
  • $u_{1}\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ h₁sub
  • $u_{1}\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ h₁sup
  • $u_{2}\text{ is a viscosity subsolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ h₂sub
  • $u_{2}\text{ is a viscosity supersolution of }-\Delta_{p}^{\mathrm N} u = 0\text{ in }\Omega$ h₂sup
  • $\forall x \in \partial \Omega,\ u_{1}(x) = u_{2}(x)$ hbd
  • $x \in \Omega$ a._@._internal._hyg.0

Then $u_{1}(x) = u_{2}(x)$.

/-- **Uniqueness of viscosity solutions.** Two bounded continuous viscosity
solutions of the homogeneous normalized `p`-Laplace equation in a bounded open
set `Ω`, equal on `frontier Ω`, are equal in `Ω`. -/
theorem visc_unique (hd : 0 < d) {p : ℝ} (hp : 2 ≤ p)
    {Ω : Set (EuclSpace d)} (hΩo : IsOpen Ω) (hΩb : Bornology.IsBounded Ω)
    {u₁ u₂ : EuclSpace d → ℝ}
    (h₁c : Continuous u₁) (h₂c : Continuous u₂)
    (h₁a : BddAbove (range u₁)) (h₁b : BddBelow (range u₁))
    (h₂a : BddAbove (range u₂)) (h₂b : BddBelow (range u₂))
    (h₁sub : IsViscositySubsolution p Ω (fun _ => 0) u₁)
    (h₁sup : IsViscositySupersolution p Ω (fun _ => 0) u₁)
    (h₂sub : IsViscositySubsolution p Ω (fun _ => 0) u₂)
    (h₂sup : IsViscositySupersolution p Ω (fun _ => 0) u₂)
    (hbd : ∀ x ∈ frontier Ω, u₁ x = u₂ x) :
    ∀ x ∈ Ω, u₁ x = u₂ x := by
  intro x hx
  apply le_antisymm
  · exact visc_comparison hd hp hΩo hΩb h₁c.upperSemicontinuous
      h₂c.lowerSemicontinuous h₁a h₁b h₂b h₂a h₁sub h₂sup
      (fun y hy => (hbd y hy).le) x hx
  · exact visc_comparison hd hp hΩo hΩb h₂c.upperSemicontinuous
      h₁c.lowerSemicontinuous h₂a h₂b h₁b h₁a h₂sub h₁sup
      (fun y hy => (hbd y hy).ge) x hx

Plaplacian/Viscosity.lean13 declarations

deflamMax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Its value lies in $\mathbb{R}$.

/-- The largest eigenvalue of a bilinear form, as the supremum of the
quadratic form over the unit sphere. -/
def lamMax (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) : ℝ :=
  sSup ((fun v : EuclSpace d => X v v) '' {v | ‖v‖ = 1})
deflamMin
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Its value lies in $\mathbb{R}$.

/-- The smallest eigenvalue. -/
def lamMin (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) : ℝ :=
  sInf ((fun v : EuclSpace d => X v v) '' {v | ‖v‖ = 1})
lemmanonempty_unitSphere
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$.

Assume

  • $0 < d$ hd

Then {v | ‖v‖ = 1}.Nonempty.

PLaplacian.nonempty_unitSpherePlaplacian/Viscosity.lean, lines 86–89
/-- The unit sphere is nonempty in dimension at least one. -/
lemma nonempty_unitSphere (hd : 0 < d) :
    {v : EuclSpace d | ‖v‖ = 1}.Nonempty :=
  ⟨EuclideanSpace.single (⟨0, hd⟩ : Fin d) (1 : ℝ), by simp⟩
lemmabddAbove_quadratic
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Then BddAbove ((fun v => (X v) v) '' {v | ‖v‖ = 1}).

PLaplacian.bddAbove_quadraticPlaplacian/Viscosity.lean, lines 91–103
/-- The quadratic form is bounded on the unit sphere by the operator norm, so
`lamMax` is not a junk value. -/
lemma bddAbove_quadratic (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    BddAbove ((fun v : EuclSpace d => X v v) '' {v | ‖v‖ = 1}) := by
  refine ⟨‖X‖, ?_⟩
  rintro a ⟨v, hv, rfl⟩
  have h1 : ‖X v v‖ ≤ ‖X v‖ * ‖v‖ := ContinuousLinearMap.le_opNorm _ _
  have h2 : ‖X v‖ ≤ ‖X‖ * ‖v‖ := ContinuousLinearMap.le_opNorm _ _
  have hv1 : ‖v‖ = 1 := hv
  rw [hv1] at h1 h2
  simp only [Real.norm_eq_abs] at h1
  have := le_abs_self (X v v)
  nlinarith [h1, h2, norm_nonneg (X v)]
lemmainfLaplacianOf_le_lamMax
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Assume

  • $q \ne 0$ hq

Then $\operatorname{infLaplacianOf}(q, X) \le \operatorname{lamMax}(X)$.

PLaplacian.infLaplacianOf_le_lamMaxPlaplacian/Viscosity.lean, lines 105–115
/-- The infinity Laplacian in any direction is below the largest eigenvalue.
This is what identifies `lamMax` as an envelope value. -/
lemma infLaplacianOf_le_lamMax {q : EuclSpace d} (hq : q ≠ 0)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) :
    infLaplacianOf q X ≤ lamMax X := by
  unfold infLaplacianOf lamMax
  have hqn : (0 : ℝ) < ‖q‖ := norm_pos_iff.2 hq
  have hunit : ‖(‖q‖⁻¹ • q)‖ = 1 := by
    rw [norm_smul, Real.norm_eq_abs, abs_of_pos (by positivity)]
    field_simp
  exact le_csSup (bddAbove_quadratic X) ⟨‖q‖⁻¹ • q, hunit, rfl⟩
defviscFLower
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Its value lies in $\mathbb{R}$.

/-- The lower envelope at a singular point; used for subsolutions. -/
def viscFLower (p : ℝ) (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) : ℝ :=
  - laplacianOf X - (p - 2) * lamMax X
defviscFUpper
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Its value lies in $\mathbb{R}$.

/-- The upper envelope at a singular point; used for supersolutions. -/
def viscFUpper (p : ℝ) (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ) : ℝ :=
  - laplacianOf X - (p - 2) * lamMin X
theoremviscFLower_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $q \in \mathbb{R}^{d}$, X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

Assume

  • $2 \le p$ hp
  • $\operatorname{infLaplacianOf}(q, X) \le \operatorname{lamMax}(X)$ hub

Then $\operatorname{viscFLower}(p, X) \le \operatorname{viscF}(p, q, X)$.

/-- **Consistency of the lower envelope**: it does not exceed the operator.
This is what makes the singular case a relaxation rather than an arbitrary
choice. -/
theorem viscFLower_le (p : ℝ) (hp : 2 ≤ p) (q : EuclSpace d)
    (X : EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ)
    (hub : infLaplacianOf q X ≤ lamMax X) :
    viscFLower p X ≤ viscF p q X := by
  unfold viscFLower viscF normPLapOf
  nlinarith [hub]
abbrevhess
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $\varphi \colon \mathbb{R}^{d} \to \mathbb{R}$, $x \in \mathbb{R}^{d}$.

Its value lies in EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ.

/-- The Hessian of a test function, as a continuous bilinear map. An `abbrev`
so that `fderiv` lemmas apply without unfolding. -/
abbrev hess (φ : EuclSpace d → ℝ) (x : EuclSpace d) :
    EuclSpace d →L[ℝ] EuclSpace d →L[ℝ] ℝ :=
  fderiv ℝ (fderiv ℝ φ) x
structureIsViscositySubsolutionDefinition 2.1 in the blueprint
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

This defines a property of these parameters.

PLaplacian.IsViscositySubsolutionPlaplacian/Viscosity.lean, lines 145–156
/-- **Viscosity subsolution of `- Delta^N_p u = f`.** -/
structure IsViscositySubsolution (p : ℝ) (Ω : Set (EuclSpace d))
    (f : EuclSpace d → ℝ) (u : EuclSpace d → ℝ) : Prop where
  usc : UpperSemicontinuousOn u Ω
  regular : ∀ (φ : EuclSpace d → ℝ), ContDiff ℝ 2 φ →
    ∀ x₀ ∈ Ω, IsLocalMax (fun y => u y - φ y) x₀ →
      gradient φ x₀ ≠ 0 →
      viscF p (gradient φ x₀) (hess φ x₀) ≤ f x₀
  singular : ∀ (φ : EuclSpace d → ℝ), ContDiff ℝ 2 φ →
    ∀ x₀ ∈ Ω, IsLocalMax (fun y => u y - φ y) x₀ →
      gradient φ x₀ = 0 →
      viscFLower p (hess φ x₀) ≤ f x₀
structureIsViscositySupersolution
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

This defines a property of these parameters.

PLaplacian.IsViscositySupersolutionPlaplacian/Viscosity.lean, lines 158–169
/-- **Viscosity supersolution.** -/
structure IsViscositySupersolution (p : ℝ) (Ω : Set (EuclSpace d))
    (f : EuclSpace d → ℝ) (u : EuclSpace d → ℝ) : Prop where
  lsc : LowerSemicontinuousOn u Ω
  regular : ∀ (φ : EuclSpace d → ℝ), ContDiff ℝ 2 φ →
    ∀ x₀ ∈ Ω, IsLocalMin (fun y => u y - φ y) x₀ →
      gradient φ x₀ ≠ 0 →
      f x₀ ≤ viscF p (gradient φ x₀) (hess φ x₀)
  singular : ∀ (φ : EuclSpace d → ℝ), ContDiff ℝ 2 φ →
    ∀ x₀ ∈ Ω, IsLocalMin (fun y => u y - φ y) x₀ →
      gradient φ x₀ = 0 →
      f x₀ ≤ viscFUpper p (hess φ x₀)
structureIsViscositySolution
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

This defines a property of these parameters.

PLaplacian.IsViscositySolutionPlaplacian/Viscosity.lean, lines 171–175
/-- **Viscosity solution.** -/
structure IsViscositySolution (p : ℝ) (Ω : Set (EuclSpace d))
    (f : EuclSpace d → ℝ) (u : EuclSpace d → ℝ) : Prop where
  sub : IsViscositySubsolution p Ω f u
  super : IsViscositySupersolution p Ω f u
theoremIsViscositySolution.semicontinuous
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $\Omega \subseteq \mathbb{R}^{d}$, $f, u \colon \mathbb{R}^{d} \to \mathbb{R}$.

Assume

  • $\operatorname{IsViscositySolution}(p, \Omega, f, u)$ h

Then all of the following hold:

  • $\operatorname{UpperSemicontinuousOn}(u, \Omega)$
  • $\operatorname{LowerSemicontinuousOn}(u, \Omega)$
PLaplacian.IsViscositySolution.semicontinuousPlaplacian/Viscosity.lean, lines 177–181
/-- A solution is semicontinuous from both sides on the domain. -/
theorem IsViscositySolution.semicontinuous {p : ℝ} {Ω : Set (EuclSpace d)}
    {f u : EuclSpace d → ℝ} (h : IsViscositySolution p Ω f u) :
    UpperSemicontinuousOn u Ω ∧ LowerSemicontinuousOn u Ω :=
  ⟨h.sub.usc, h.super.lsc⟩

Plaplacian/WeightErr.lean3 declarations

theoremabs_alpha_le_one
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < p + d$ hpd

Then $\lvert (p - 2) / (p + d)\rvert \le 1$.

PLaplacian.abs_alpha_le_onePlaplacian/WeightErr.lean, lines 53–59
/-- The weights are bounded by one for `2 ≤ p`. -/
theorem abs_alpha_le_one (p : ℝ) (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ)) :
    |(p - 2) / (p + (d : ℝ))| ≤ 1 := by
  rw [abs_div, abs_of_nonneg (by linarith : (0:ℝ) ≤ p - 2),
      abs_of_pos hpd, div_le_one hpd]
  have hd : (0:ℝ) ≤ (d : ℝ) := Nat.cast_nonneg d
  linarith
theoremabs_beta_le_one
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < p + d$ hpd

Then $\lvert (d + 2) / (p + d)\rvert \le 1$.

theorem abs_beta_le_one (p : ℝ) (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ)) :
    |((d : ℝ) + 2) / (p + (d : ℝ))| ≤ 1 := by
  have hd2 : (0:ℝ) < (d : ℝ) + 2 := by positivity
  rw [abs_div, abs_of_pos hd2, abs_of_pos hpd, div_le_one hpd]
  linarith
structureweighted_error_le
Formal statementgenerated from the Lean declaration

Let $d \in \mathbb{N}$, $p \in \mathbb{R}$, $e_{1}, e_{2} \in \mathbb{R}$.

Assume

  • $2 \le p$ hp
  • $0 < p + d$ hpd

Then $\lvert (p - 2) / (p + d) \cdot e_{1} + (d + 2) / (p + d) \cdot e_{2}\rvert \le \lvert e_{1}\rvert + \lvert e_{2}\rvert$.

PLaplacian.weighted_error_lePlaplacian/WeightErr.lean, lines 67–90
/-- **The weighted error, bounded by the sum of the halves.**

This is the step that makes the rate meaningful: the weights do not amplify,
so a rate for each half gives a rate for the total, with the same constant
structure and no dependence on `ε` beyond the halves' own. -/
theorem weighted_error_le (p : ℝ) (hp : 2 ≤ p) (hpd : 0 < p + (d : ℝ))
    (e₁ e₂ : ℝ) :
    |(p - 2) / (p + (d : ℝ)) * e₁
        + ((d : ℝ) + 2) / (p + (d : ℝ)) * e₂|
      ≤ |e₁| + |e₂| := by
  have ha := abs_alpha_le_one (d := d) p hp hpd
  have hb := abs_beta_le_one (d := d) p hp hpd
  calc |(p - 2) / (p + (d : ℝ)) * e₁
          + ((d : ℝ) + 2) / (p + (d : ℝ)) * e₂|
      ≤ |(p - 2) / (p + (d : ℝ)) * e₁|
        + |((d : ℝ) + 2) / (p + (d : ℝ)) * e₂| := abs_add_le _ _
    _ = |(p - 2) / (p + (d : ℝ))| * |e₁|
        + |((d : ℝ) + 2) / (p + (d : ℝ))| * |e₂| := by
          rw [abs_mul, abs_mul]
    _ ≤ 1 * |e₁| + 1 * |e₂| := by
          have h1 : (0:ℝ) ≤ |e₁| := abs_nonneg e₁
          have h2 : (0:ℝ) ≤ |e₂| := abs_nonneg e₂
          nlinarith [ha, hb, h1, h2]
    _ = |e₁| + |e₂| := by ring