|
| 1 | +/- |
| 2 | +Copyright (c) 2018 Rohan Mitta. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Rohan Mitta, Kevin Buzzard, Alistair Tucker |
| 5 | +-/ |
| 6 | +import analysis.limits analysis.normed_space |
| 7 | +open nat filter |
| 8 | + |
| 9 | +lemma fixed_point_of_iteration_limit {α : Type*} [topological_space α] [t2_space α] {f : α → α} |
| 10 | + {x : α} : continuous f → (∃ x₀ : α, tendsto (λ n, f^[n] x₀) at_top (nhds x)) → x = f x := |
| 11 | +begin |
| 12 | + intros hf hx, |
| 13 | + cases hx with x₀ hx, |
| 14 | + apply @tendsto_nhds_unique α ℕ _ _ (λ n, f^[succ n] x₀) at_top x (f x), |
| 15 | + { exact at_top_ne_bot }, |
| 16 | + { rewrite @tendsto_comp_succ_at_top_iff α (λ n, f^[n] x₀) (nhds x), |
| 17 | + exact hx }, |
| 18 | + { rewrite funext (λ n, iterate_succ' f n x₀), |
| 19 | + exact tendsto.comp hx (continuous.tendsto hf x) }, |
| 20 | +end |
| 21 | + |
| 22 | +def lipschitz {α : Type*} [metric_space α] (K : ℝ) (f : α → α) := |
| 23 | +0 ≤ K ∧ ∀ (x y : α), dist (f x) (f y) ≤ K * (dist x y) |
| 24 | + |
| 25 | +lemma uniform_continuous_of_lipschitz {α : Type*} [metric_space α] {K : ℝ} {f : α → α} : |
| 26 | + lipschitz K f → uniform_continuous f := |
| 27 | +λ hf, uniform_continuous_of_metric.mpr (λ ε hε, or.elim (lt_or_le K ε) |
| 28 | + (λ h, ⟨(1 : ℝ), zero_lt_one, (λ x y hd, lt_of_le_of_lt (hf.right x y) |
| 29 | + (lt_of_le_of_lt (mul_le_mul_of_nonneg_left (le_of_lt hd) hf.left) (symm (mul_one K) ▸ h)))⟩) |
| 30 | + (λ h, ⟨ε / K, div_pos_of_pos_of_pos hε (lt_of_lt_of_le hε h), |
| 31 | + (λ x y hd, lt_of_le_of_lt (hf.right x y) |
| 32 | + (mul_comm (dist x y) K ▸ mul_lt_of_lt_div (lt_of_lt_of_le hε h) hd))⟩)) |
| 33 | + |
| 34 | +lemma iterated_lipschitz_of_lipschitz {α : Type*} [metric_space α] {K : ℝ} {f : α → α} : |
| 35 | + lipschitz K f → ∀ (n : ℕ), lipschitz (K ^ n) (f^[n]) := |
| 36 | +begin |
| 37 | + intros hf n, |
| 38 | + induction n with n ih, |
| 39 | + { apply and.intro, |
| 40 | + { exact pow_zero K ▸ zero_le_one, }, |
| 41 | + { intros x y, |
| 42 | + rewrite [pow_zero K, one_mul, iterate_zero f x, iterate_zero f y], }, }, |
| 43 | + { apply and.intro, |
| 44 | + { exact mul_nonneg hf.left ih.left, }, |
| 45 | + { intros x y, |
| 46 | + rewrite [iterate_succ', iterate_succ'], |
| 47 | + apply le_trans (hf.right (f^[n] x) (f^[n] y)), |
| 48 | + rewrite [pow_succ K n, mul_assoc], |
| 49 | + exact mul_le_mul_of_nonneg_left (ih.right x y) hf.left, }, }, |
| 50 | +end |
| 51 | + |
| 52 | +lemma dist_inequality_of_contraction {α : Type*} [metric_space α] {K : ℝ} {f : α → α} (hK₁ : K < 1) : |
| 53 | + lipschitz K f → ∀ (x y : α), dist x y ≤ (dist x (f x) + dist y (f y)) / (1 - K) := |
| 54 | +begin |
| 55 | + intros hf x y, |
| 56 | + apply le_div_of_mul_le (sub_pos_of_lt hK₁), |
| 57 | + rewrite [mul_comm, sub_mul, one_mul], |
| 58 | + apply sub_left_le_of_le_add, |
| 59 | + apply le_trans, |
| 60 | + exact dist_triangle_right x y (f x), |
| 61 | + apply le_trans, |
| 62 | + apply add_le_add_left, |
| 63 | + exact dist_triangle_right y (f x) (f y), |
| 64 | + rewrite [←add_assoc, add_comm], |
| 65 | + apply add_le_add_right, |
| 66 | + exact hf.right x y, |
| 67 | +end |
| 68 | + |
| 69 | +theorem fixed_point_unique_of_contraction {α : Type*} [metric_space α] {K : ℝ} {f : α → α} : |
| 70 | + K < 1 → lipschitz K f → ∀ (x : α), x = f x → ∀ (y : α), y = f y → x = y := |
| 71 | +begin |
| 72 | + intros hK₁ hf x hx y hy, |
| 73 | + apply iff.mp dist_le_zero, |
| 74 | + apply le_trans, |
| 75 | + exact dist_inequality_of_contraction hK₁ hf x y, |
| 76 | + rewrite [iff.mpr dist_eq_zero hx, iff.mpr dist_eq_zero hy], |
| 77 | + norm_num, |
| 78 | +end |
| 79 | + |
| 80 | +lemma dist_bound_of_contraction {α : Type*} [metric_space α] {K : ℝ} {f : α → α} : |
| 81 | + K < 1 → lipschitz K f → ∀ (x₀ : α) (n : ℕ × ℕ), |
| 82 | + dist (f^[n.1] x₀) (f^[n.2] x₀) ≤ (K ^ n.1 + K ^ n.2) * dist x₀ (f x₀) / (1 - K) := |
| 83 | +begin |
| 84 | + intros hK₁ hf x₀ n, |
| 85 | + apply le_trans, |
| 86 | + exact dist_inequality_of_contraction hK₁ hf (f^[n.1] x₀) (f^[n.2] x₀), |
| 87 | + apply div_le_div_of_le_of_pos _ (sub_pos_of_lt hK₁), |
| 88 | + have h : ∀ (m : ℕ), dist (f^[m] x₀) (f (f^[m] x₀)) ≤ K ^ m * dist x₀ (f x₀), |
| 89 | + intro m, |
| 90 | + rewrite [←iterate_succ' f m x₀, iterate_succ f m x₀], |
| 91 | + exact and.right (iterated_lipschitz_of_lipschitz hf m) x₀ (f x₀), |
| 92 | + rewrite add_mul, |
| 93 | + apply add_le_add, |
| 94 | + { exact h n.1, }, |
| 95 | + { exact h n.2, }, |
| 96 | +end |
| 97 | + |
| 98 | +lemma continuous_prod_snd {α β γ : Type*} [topological_space α] [topological_space β] |
| 99 | + [topological_space γ] {f : α × β → γ} {a : α} (hf : continuous f) : continuous (λ b, f (a, b)) := |
| 100 | +continuous.comp (continuous.prod_mk continuous_const continuous_id) hf |
| 101 | + |
| 102 | +local attribute [instance] prod.prod_semilattice_sup |
| 103 | + |
| 104 | +lemma tendsto_dist_bound_at_top_nhds_0 {K : ℝ} (hK₀ : 0 ≤ K) (hK₁ : K < 1) (z : ℝ) : |
| 105 | + tendsto (λ (n : ℕ × ℕ), (K ^ n.1 + K ^ n.2) * z / (1 - K)) at_top (nhds 0) := |
| 106 | +begin |
| 107 | + let f := λ (n : ℕ × ℕ), (K ^ n.1, K ^ n.2), |
| 108 | + let g := λ (y : ℝ × ℝ), (y.1 + y.2) * z / (1 - K), |
| 109 | + show tendsto (g ∘ f) at_top (nhds 0), |
| 110 | + apply tendsto.comp, |
| 111 | + { show tendsto f at_top (nhds (0, 0)), |
| 112 | + rw ←prod_at_top_at_top_eq, |
| 113 | + apply tendsto_prod_mk_nhds, |
| 114 | + { apply tendsto.comp tendsto_fst, |
| 115 | + exact tendsto_pow_at_top_nhds_0_of_lt_1 hK₀ hK₁, }, |
| 116 | + { apply tendsto.comp tendsto_snd, |
| 117 | + exact tendsto_pow_at_top_nhds_0_of_lt_1 hK₀ hK₁, }, }, |
| 118 | + { show tendsto g (nhds (0, 0)) (nhds 0), |
| 119 | + have hg : g = λ (y : ℝ × ℝ), z / (1 - K) * (y.1 + y.2), |
| 120 | + ext, |
| 121 | + rewrite [mul_comm, ←mul_div_assoc], |
| 122 | + have hc : continuous g, |
| 123 | + rewrite hg, |
| 124 | + apply continuous.comp, |
| 125 | + exact continuous_add', |
| 126 | + exact continuous_prod_snd continuous_mul', |
| 127 | + have h₀ := continuous.tendsto hc (0, 0), |
| 128 | + suffices h : g (0, 0) = 0, |
| 129 | + rewrite h at h₀, |
| 130 | + exact h₀, |
| 131 | + rewrite hg, |
| 132 | + norm_num, }, |
| 133 | +end |
| 134 | + |
| 135 | +theorem fixed_point_exists_of_contraction {α : Type*} [inhabited α] [metric_space α] |
| 136 | + [complete_space α] {K : ℝ} {f : α → α} : K < 1 → lipschitz K f → ∃ (x : α), x = f x := |
| 137 | +begin |
| 138 | + intros hK₁ hf, |
| 139 | + let x₀ := default α, |
| 140 | + suffices h : cauchy_seq (λ n, f^[n] x₀), |
| 141 | + cases cauchy_seq_tendsto_of_complete h with x hx, |
| 142 | + use x, |
| 143 | + apply @fixed_point_of_iteration_limit α _, |
| 144 | + { exact uniform_continuous.continuous (uniform_continuous_of_lipschitz hf), }, |
| 145 | + { exact ⟨x₀, hx⟩, }, |
| 146 | + apply iff.mpr cauchy_seq_iff_tendsto_dist_at_top_0, |
| 147 | + apply squeeze_zero, |
| 148 | + { intro x, |
| 149 | + exact dist_nonneg, }, |
| 150 | + { exact dist_bound_of_contraction hK₁ hf x₀, }, |
| 151 | + { exact tendsto_dist_bound_at_top_nhds_0 hf.left hK₁ (dist x₀ (f x₀)), }, |
| 152 | +end |
0 commit comments