openAI-math-dataset / lean /OAI /Analysis /Crouzeix /ContourExistence.lean
roseking's picture
Add lean source and binary files (part 17)
ddc84c5 verified
Raw History Blame Contribute Delete
13.6 kB
import Mathlib
import OAI.Analysis.Crouzeix.Definitions
namespace OAI
/-! Contour Existence. -/
noncomputable section
open scoped Topology InnerProductSpace TensorProduct Matrix.Norms.L2Operator
open Set Filter Metric
namespace CrouzeixHilbert
theorem sub_div_sub_mem_slitPlane {a b w : ℂ} (hw : w ∉ segment ℝ a b) :
(w - a) / (w - b) ∈ Complex.slitPlane := by
rw [Complex.mem_slitPlane_iff]
by_contra h
push Not at h
have hwb : w - b ≠ 0 := by
intro he
exact hw ((sub_eq_zero.mp he) ▸ right_mem_segment ℝ a b)
let r : ℝ := ((w - a) / (w - b)).re
have hr : r ≤ 0 := h.1
have hrc : (r : ℂ) = (w - a) / (w - b) := by
apply Complex.ext
· rfl
· simpa only [Complex.ofReal_im] using h.2.symm
have hmul : (r : ℂ) * (w - b) = w - a := by rw [hrc, div_mul_cancel₀ _ hwb]
have hp : 0 < 1 - r := by linarith
have hpn : (1 - (r : ℂ)) ≠ 0 := by exact_mod_cast hp.ne'
apply hw
refine ⟨(1 - r)⁻¹, -r / (1 - r), inv_nonneg.mpr hp.le,
div_nonneg (neg_nonneg.mpr hr) hp.le, ?_, ?_⟩
· field_simp
ring
· simp only [Complex.real_smul, Complex.ofReal_inv, Complex.ofReal_sub,
Complex.ofReal_one, Complex.ofReal_div, Complex.ofReal_neg]
apply (mul_right_cancel₀ hpn)
field_simp
linear_combination hmul
theorem SmoothContour.intervalIntegrable_indexIntegrand (Γ : SmoothContour) {a : ℂ}
(ha : a ∉ Γ.path '' Icc (0 : ℝ) 1) :
IntervalIntegrable (fun t => deriv Γ.path t / (Γ.path t - a))
MeasureTheory.volume (0 : ℝ) 1 := by
apply ContinuousOn.intervalIntegrable
rw [uIcc_of_le zero_le_one]
apply Γ.smooth.continuous_deriv_one.continuousOn.div
(Γ.smooth.continuous.sub continuous_const).continuousOn
intro t ht he
exact ha ⟨t, ht, sub_eq_zero.mp he⟩
theorem SmoothContour.index_eq_of_segment_avoids (Γ : SmoothContour) {a b : ℂ}
(h : ∀ t ∈ Icc (0 : ℝ) 1, Γ.path t ∉ segment ℝ a b) :
Γ.index a = Γ.index b := by
have hnza (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : Γ.path t - a ≠ 0 := by
intro he
exact h t ht ((sub_eq_zero.mp he) ▸ left_mem_segment ℝ a b)
have hnzb (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : Γ.path t - b ≠ 0 := by
intro he
exact h t ht ((sub_eq_zero.mp he) ▸ right_mem_segment ℝ a b)
have ha : a ∉ Γ.path '' Icc (0 : ℝ) 1 := by
rintro ⟨t, ht, he⟩
exact hnza t ht (sub_eq_zero.mpr he)
have hb : b ∉ Γ.path '' Icc (0 : ℝ) 1 := by
rintro ⟨t, ht, he⟩
exact hnzb t ht (sub_eq_zero.mpr he)
have hd (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) :
HasDerivAt (fun t => Complex.log ((Γ.path t - a) / (Γ.path t - b)))
(deriv Γ.path t / (Γ.path t - a) - deriv Γ.path t / (Γ.path t - b)) t := by
have hg := (Γ.smooth.differentiable (by norm_num) t).hasDerivAt
have he := ((hg.sub_const a).div (hg.sub_const b) (hnzb t ht)).clog_real
(sub_div_sub_mem_slitPlane (h t ht))
simp only [Pi.div_apply] at he
convert! he using 1
field_simp [hnza t ht, hnzb t ht]
have he := intervalIntegral.integral_eq_sub_of_hasDerivAt
(fun t ht => hd t (by simpa only [uIcc_of_le zero_le_one] using ht))
((Γ.intervalIntegrable_indexIntegrand ha).sub (Γ.intervalIntegrable_indexIntegrand hb))
rw [Γ.closed, sub_self, intervalIntegral.integral_sub
(Γ.intervalIntegrable_indexIntegrand ha) (Γ.intervalIntegrable_indexIntegrand hb)] at he
unfold SmoothContour.index
rw [sub_eq_zero.mp he]
theorem SmoothContour.index_eq_zero_of_re_pos (Γ : SmoothContour) {a c : ℂ}
(hc : c ≠ 0) (h : ∀ t ∈ Icc (0 : ℝ) 1, 0 < (c * (Γ.path t - a)).re) :
Γ.index a = 0 := by
have hnz (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : Γ.path t - a ≠ 0 := by
intro he
simpa only [he, mul_zero, Complex.zero_re, lt_self_iff_false] using h t ht
have ha : a ∉ Γ.path '' Icc (0 : ℝ) 1 := by
rintro ⟨t, ht, he⟩
exact hnz t ht (sub_eq_zero.mpr he)
have hd (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) :
HasDerivAt (fun t => Complex.log (c * (Γ.path t - a)))
(deriv Γ.path t / (Γ.path t - a)) t := by
have he := (((Γ.smooth.differentiable (by norm_num) t).hasDerivAt.sub_const a).const_mul c).clog_real
(Complex.mem_slitPlane_iff.mpr (Or.inl (h t ht)))
simpa only [mul_div_mul_left _ _ hc] using he
have he := intervalIntegral.integral_eq_sub_of_hasDerivAt
(fun t ht => hd t (by simpa only [uIcc_of_le zero_le_one] using ht))
(Γ.intervalIntegrable_indexIntegrand ha)
rw [Γ.closed, sub_self] at he
simp only [SmoothContour.index, he, mul_zero]
theorem SmoothContour.index_eq_zero_of_convex (Γ : SmoothContour) {V : Set ℂ}
(hV : Convex ℝ V) (hVc : IsClosed V) (hΓ : Γ.path '' Icc (0 : ℝ) 1 ⊆ V)
{a : ℂ} (ha : a ∉ V) :
Γ.index a = 0 := by
obtain ⟨l, r, hla, hlV⟩ :=
RCLike.geometric_hahn_banach_point_closed (𝕜 := ℂ) hV hVc ha
have hl (z : ℂ) : l z = l 1 * z := by
calc
l z = l (z • (1 : ℂ)) := by simp
_ = z • l 1 := l.map_smul z 1
_ = l 1 * z := by simp [mul_comm]
have hp (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) :
0 < (l 1 * (Γ.path t - a)).re := by
rw [← hl, map_sub, Complex.sub_re]
exact sub_pos.mpr (hla.trans (hlV _ (hΓ ⟨t, ht, rfl⟩)))
apply Γ.index_eq_zero_of_re_pos ?_ hp
intro he
have := hp 0 ⟨le_rfl, zero_le_one⟩
simp only [he, zero_mul, Complex.zero_re, lt_self_iff_false] at this
theorem exists_smooth_radial_frontier_approx {V : Set ℂ}
(hV : Convex ℝ V) (hV0 : V ∈ 𝓝 (0 : ℂ)) (hVb : Bornology.IsBounded V)
{ε : ℝ} (hε : 0 < ε) :
∃ q : ℂ → ℝ, ContDiff ℝ 1 q ∧ (∀ z, 0 < q z) ∧
∀ z : ℂ, ‖z‖ = 1 → ∃ w ∈ frontier V, dist (q z • z) w < ε := by
obtain ⟨R, hR, hVR⟩ := hVb.subset_closedBall_lt 0 0
let r : ℂ → ℝ := fun z => (max R⁻¹ (gauge V z))⁻¹
have hrp (z : ℂ) : 0 < r z := inv_pos.mpr ((inv_pos.mpr hR).trans_le (le_max_left _ _))
have hrc : Continuous r :=
(continuous_const.max (continuous_gauge hV hV0)).inv₀ (fun z => ((inv_pos.mpr hR).trans_le (le_max_left _ _)).ne')
obtain ⟨q, hq, hqr, -⟩ := hrc.exists_contDiff_approx 1
(continuous_const.min (hrc.div_const 2)) (fun z => lt_min hε (half_pos (hrp z)))
refine ⟨q, by simpa using hq, ?_, ?_⟩
· intro z
have he := (abs_lt.mp (hqr z)).1
have := min_le_right ε (r z / 2)
linarith [hrp z]
· intro z hz
have hg : R⁻¹ ≤ gauge V z := by
simpa only [hz, one_div] using
(le_gauge_of_subset_closedBall (absorbent_nhds_zero hV0) hR.le hVR (x := z))
have hr : r z = (gauge V z)⁻¹ := inv_inj.mpr (max_eq_right hg)
have hgz : gauge V z ≠ 0 := ne_of_gt ((inv_pos.mpr hR).trans_le hg)
refine ⟨r z • z, (gauge_eq_one_iff_mem_frontier hV hV0).mp ?_, ?_⟩
· rw [gauge_smul_of_nonneg (hrp z).le, smul_eq_mul, hr, inv_mul_cancel₀ hgz]
· calc
dist (q z • z) (r z • z) = |q z - r z| := by
rw [dist_eq_norm, ← sub_smul, norm_smul, hz, mul_one, Real.norm_eq_abs]
_ < min ε (r z / 2) := hqr z
_ ≤ ε := min_le_left _ _
def unitCirclePath (t : ℝ) : ℂ := circleMap 0 1 (2 * Real.pi * t)
theorem unitCirclePath_norm (t : ℝ) : ‖unitCirclePath t‖ = 1 := by
simp only [unitCirclePath, norm_circleMap_zero, abs_one]
theorem unitCirclePath_ne_zero (t : ℝ) : unitCirclePath t ≠ 0 := by
apply norm_ne_zero_iff.mp
rw [unitCirclePath_norm]
norm_num
theorem unitCirclePath_smooth : ContDiff ℝ 1 unitCirclePath :=
(contDiff_circleMap 0 1).comp (contDiff_const.mul contDiff_id)
theorem unitCirclePath_closed : unitCirclePath 0 = unitCirclePath 1 := by
simpa only [unitCirclePath, mul_zero, mul_one, zero_add] using
((periodic_circleMap 0 1) 0).symm
theorem hasDerivAt_unitCirclePath (t : ℝ) :
HasDerivAt unitCirclePath (unitCirclePath t * (2 * (Real.pi : ℂ) * Complex.I)) t := by
convert! (hasDerivAt_circleMap 0 1 (2 * Real.pi * t)).scomp t
((hasDerivAt_id t).const_mul (2 * Real.pi)) using 1
simp only [unitCirclePath, mul_one, Complex.real_smul, Complex.ofReal_mul, Complex.ofReal_ofNat]
ring
def radialContour (a : ℂ) (q : ℂ → ℝ) (hq : ContDiff ℝ 1 q) : SmoothContour where
path := fun t => a + q (unitCirclePath t) • unitCirclePath t
smooth := contDiff_const.add ((hq.comp unitCirclePath_smooth).smul unitCirclePath_smooth)
closed := by rw [unitCirclePath_closed]
theorem radialContour_index_center (a : ℂ) (q : ℂ → ℝ) (hq : ContDiff ℝ 1 q)
(hqp : ∀ z, 0 < q z) : (radialContour a q hq).index a = 1 := by
let f : ℝ → ℝ := fun t => q (unitCirclePath t)
have hf : ContDiff ℝ 1 f := hq.comp unitCirclePath_smooth
have hfp (t : ℝ) : f t ≠ 0 := (hqp _).ne'
have hfc : f 0 = f 1 := by dsimp [f]; rw [unitCirclePath_closed]
have hdiff (t : ℝ) : HasDerivAt f (deriv f t) t :=
(hf.differentiable (by norm_num) t).hasDerivAt
have hd (t : ℝ) : deriv (radialContour a q hq).path t =
f t • (unitCirclePath t * (2 * (Real.pi : ℂ) * Complex.I)) +
deriv f t • unitCirclePath t :=
((hdiff t).smul (hasDerivAt_unitCirclePath t)).const_add a |>.deriv
have hi : IntervalIntegrable (fun t => deriv f t / f t) MeasureTheory.volume (0 : ℝ) 1 :=
(hf.continuous_deriv_one.div hf.continuous hfp).intervalIntegrable 0 1
have he := intervalIntegral.integral_eq_sub_of_hasDerivAt
(fun t (_ : t ∈ uIcc (0 : ℝ) 1) => (hdiff t).log (hfp t)) hi
rw [← hfc, sub_self] at he
have heq (t : ℝ) : deriv (radialContour a q hq).path t /
((radialContour a q hq).path t - a) =
((deriv f t / f t : ℝ) : ℂ) + 2 * (Real.pi : ℂ) * Complex.I := by
rw [hd]
change ((f t : ℂ) * (unitCirclePath t * (2 * (Real.pi : ℂ) * Complex.I)) +
((deriv f t : ℝ) : ℂ) * unitCirclePath t) /
(a + (f t : ℂ) * unitCirclePath t - a) = _
rw [add_sub_cancel_left, Complex.ofReal_div]
field_simp [Complex.ofReal_ne_zero.mpr (hfp t), unitCirclePath_ne_zero t]
ring
have hic : IntervalIntegrable (fun t => ((deriv f t / f t : ℝ) : ℂ))
MeasureTheory.volume (0 : ℝ) 1 :=
(Complex.continuous_ofReal.comp (hf.continuous_deriv_one.div hf.continuous hfp)).intervalIntegrable 0 1
simp only [SmoothContour.index, heq]
rw [intervalIntegral.integral_add hic intervalIntegrable_const,
intervalIntegral.integral_ofReal, he, Complex.ofReal_zero, zero_add,
intervalIntegral.integral_const]
simp only [sub_zero, one_smul]
apply inv_mul_cancel₀
exact mul_ne_zero (mul_ne_zero (by norm_num) (Complex.ofReal_ne_zero.mpr Real.pi_ne_zero)) Complex.I_ne_zero
theorem exists_calculusContour {K U : Set ℂ} (hK : IsCompact K)
(hKc : Convex ℝ K) (hKne : K.Nonempty) (hU : IsOpen U) (hKU : K ⊆ U) :
Nonempty (CalculusContour K U) := by
obtain ⟨a, ha⟩ := hKne
obtain ⟨ε, hε, hεU⟩ := hK.exists_cthickening_subset_open hU hKU
let e : ℂ ≃ₜ ℂ := Homeomorph.addLeft a
let V : Set ℂ := e ⁻¹' (cthickening (ε / 2) K)
have hV : Convex ℝ V := by
convert! (hKc.cthickening (ε / 2)).translate (-a) using 1
ext z
constructor
· intro hz
exact ⟨a + z, hz, by simp⟩
· rintro ⟨w, hw, rfl⟩
change a + (-a + w) ∈ cthickening (ε / 2) K
simpa using hw
have hV0 : V ∈ 𝓝 (0 : ℂ) := by
rw [← mem_interior_iff_mem_nhds]
change 0 ∈ interior (e ⁻¹' (cthickening (ε / 2) K))
rw [← e.preimage_interior]
change a + 0 ∈ interior (cthickening (ε / 2) K)
rw [add_zero]
exact thickening_subset_interior_cthickening _ _ (self_subset_thickening (half_pos hε) _ ha)
have hVb : Bornology.IsBounded V := (e.isCompact_preimage.mpr hK.cthickening).isBounded
obtain ⟨q, hq, hqp, hqV⟩ := exists_smooth_radial_frontier_approx hV hV0 hVb
(div_pos hε (by norm_num : (0 : ℝ) < 4))
let Γ : SmoothContour := radialContour a q hq
have hΓ (t : ℝ) : Γ.path t ∈ cthickening ε K ∧ Γ.path t ∉ K := by
obtain ⟨w, hw, hd⟩ := hqV (unitCirclePath t) (unitCirclePath_norm t)
have hw' : a + w ∈ frontier (cthickening (ε / 2) K) := by
change w ∈ e ⁻¹' frontier (cthickening (ε / 2) K)
rw [e.preimage_frontier]
exact hw
have hiw : infDist (a + w) K = ε / 2 := by
unfold infDist
rw [frontier_cthickening_subset K hw', ENNReal.toReal_ofReal (half_pos hε).le]
have hd' : dist (Γ.path t) (a + w) < ε / 4 := by
simpa only [Γ, radialContour, dist_add_left] using hd
have hi : infDist (Γ.path t) K < ε := by
have hle := infDist_le_infDist_add_dist (s := K) (x := Γ.path t) (y := a + w)
rw [hiw] at hle
linarith
refine ⟨thickening_subset_cthickening ε K ((mem_thickening_iff_infDist_lt ⟨a, ha⟩).mpr hi), ?_⟩
intro htK
have hle := infDist_le_infDist_add_dist (s := K) (x := a + w) (y := Γ.path t)
rw [hiw, infDist_zero_of_mem htK, zero_add, dist_comm] at hle
linarith
refine ⟨{ toSmoothContour := Γ, avoids := ?_, index_inside := ?_, index_outside := ?_ }⟩
· intro t _ht
exact ⟨hεU (hΓ t).1, (hΓ t).2⟩
· intro z hz
calc
Γ.index z = Γ.index a := Γ.index_eq_of_segment_avoids (fun t _ht htz =>
(hΓ t).2 (hKc.segment_subset hz ha htz))
_ = 1 := radialContour_index_center a q hq hqp
· intro z hz
exact Γ.index_eq_zero_of_convex (hKc.cthickening ε) isClosed_cthickening
(by rintro _ ⟨t, _ht, rfl⟩; exact (hΓ t).1) (fun he => hz (hεU he))
end CrouzeixHilbert
end
end OAI