File: Mathlib/Topology/MetricSpace/Contracting.lean

full_name: ContractingWith
code: /-- A map is said to be `ContractingWith K`, if `K < 1` and `f` is `LipschitzWith K`. -/
def ContractingWith [EMetricSpace α] (K : ℝ≥0) (f : α → α) 
goal: Prop

full_name: ContractingWith.toLipschitzWith
code: theorem toLipschitzWith (hf : ContractingWith K f) : LipschitzWith K f 
goal: LipschitzWith K f

full_name: ContractingWith.one_sub_K_pos'
code: theorem one_sub_K_pos' (hf : ContractingWith K f) : (0 : ℝ≥0∞) < 1 - K 
goal: 0 < 1 - ↑K

full_name: ContractingWith.one_sub_K_ne_zero
code: theorem one_sub_K_ne_zero (hf : ContractingWith K f) : (1 : ℝ≥0∞) - K ≠ 0 
goal: 1 - ↑K ≠ 0

full_name: ContractingWith.one_sub_K_ne_top
code: theorem one_sub_K_ne_top : (1 : ℝ≥0∞) - K ≠ ∞ 
goal: 1 - ↑K ≠ ⊤

full_name: ContractingWith.edist_inequality
code: theorem edist_inequality (hf : ContractingWith K f) {x y} (h : edist x y ≠ ∞) :
    edist x y ≤ (edist x (f x) + edist y (f y)) / (1 - K) 
goal: edist x y ≤ (edist x (f x) + edist y (f y)) / (1 - ↑K)

full_name: ContractingWith.edist_le_of_fixedPoint
code: theorem edist_le_of_fixedPoint (hf : ContractingWith K f) {x y} (h : edist x y ≠ ∞)
    (hy : IsFixedPt f y) : edist x y ≤ edist x (f x) / (1 - K) 
goal: edist x y ≤ edist x (f x) / (1 - ↑K)

full_name: ContractingWith.eq_or_edist_eq_top_of_fixedPoints
code: theorem eq_or_edist_eq_top_of_fixedPoints (hf : ContractingWith K f) {x y} (hx : IsFixedPt f x)
    (hy : IsFixedPt f y) : x = y ∨ edist x y = ∞ 
goal: x = y ∨ edist x y = ⊤

full_name: ContractingWith.restrict
code: /-- If a map `f` is `ContractingWith K`, and `s` is a forward-invariant set, then
restriction of `f` to `s` is `ContractingWith K` as well. -/
theorem restrict (hf : ContractingWith K f) {s : Set α} (hs : MapsTo f s s) :
    ContractingWith K (hs.restrict f s s) 
goal: ContractingWith K (Set.MapsTo.restrict f s s hs)

full_name: ContractingWith.exists_fixedPoint
code: /-- Banach fixed-point theorem, contraction mapping theorem, `EMetricSpace` version.
A contracting map on a complete metric space has a fixed point.
We include more conclusions in this theorem to avoid proving them again later.

The main API for this theorem are the functions `efixedPoint` and `fixedPoint`,
and lemmas about these functions. -/
theorem exists_fixedPoint (hf : ContractingWith K f) (x : α) (hx : edist x (f x) ≠ ∞) :
    ∃ y, IsFixedPt f y ∧ Tendsto (fun n ↦ f^[n] x) atTop (𝓝 y) ∧
      ∀ n : ℕ, edist (f^[n] x) y ≤ edist x (f x) * (K : ℝ≥0∞) ^ n / (1 - K) 
goal: ∃ y,
  Function.IsFixedPt f y ∧
    Filter.Tendsto (fun n => f^[n] x) Filter.atTop (𝓝 y) ∧
      ∀ (n : ℕ), edist (f^[n] x) y ≤ edist x (f x) * ↑K ^ n / (1 - ↑K)

full_name: ContractingWith.efixedPoint
code: /-- Let `x` be a point of a complete emetric space. Suppose that `f` is a contracting map,
and `edist x (f x) ≠ ∞`. Then `efixedPoint` is the unique fixed point of `f`
in `EMetric.ball x ∞`. -/
noncomputable def efixedPoint (hf : ContractingWith K f) (x : α) (hx : edist x (f x) ≠ ∞) : α 
goal: α

full_name: ContractingWith.efixedPoint_isFixedPt
code: theorem efixedPoint_isFixedPt (hf : ContractingWith K f) {x : α} (hx : edist x (f x) ≠ ∞) :
    IsFixedPt f (efixedPoint f hf x hx) 
goal: Function.IsFixedPt f (ContractingWith.efixedPoint f hf x hx)

full_name: ContractingWith.tendsto_iterate_efixedPoint
code: theorem tendsto_iterate_efixedPoint (hf : ContractingWith K f) {x : α} (hx : edist x (f x) ≠ ∞) :
    Tendsto (fun n ↦ f^[n] x) atTop (𝓝 <| efixedPoint f hf x hx) 
goal: Filter.Tendsto (fun n => f^[n] x) Filter.atTop (𝓝 (ContractingWith.efixedPoint f hf x hx))

full_name: ContractingWith.apriori_edist_iterate_efixedPoint_le
code: theorem apriori_edist_iterate_efixedPoint_le (hf : ContractingWith K f) {x : α}
    (hx : edist x (f x) ≠ ∞) (n : ℕ) :
    edist (f^[n] x) (efixedPoint f hf x hx) ≤ edist x (f x) * (K : ℝ≥0∞) ^ n / (1 - K) 
goal: edist (f^[n] x) (ContractingWith.efixedPoint f hf x hx) ≤ edist x (f x) * ↑K ^ n / (1 - ↑K)

full_name: ContractingWith.edist_efixedPoint_le
code: theorem edist_efixedPoint_le (hf : ContractingWith K f) {x : α} (hx : edist x (f x) ≠ ∞) :
    edist x (efixedPoint f hf x hx) ≤ edist x (f x) / (1 - K) 
goal: edist x (ContractingWith.efixedPoint f hf x hx) ≤ edist x (f x) / (1 - ↑K)

full_name: ContractingWith.edist_efixedPoint_lt_top
code: theorem edist_efixedPoint_lt_top (hf : ContractingWith K f) {x : α} (hx : edist x (f x) ≠ ∞) :
    edist x (efixedPoint f hf x hx) < ∞ 
goal: edist x (ContractingWith.efixedPoint f hf x hx) < ⊤

full_name: ContractingWith.efixedPoint_eq_of_edist_lt_top
code: theorem efixedPoint_eq_of_edist_lt_top (hf : ContractingWith K f) {x : α} (hx : edist x (f x) ≠ ∞)
    {y : α} (hy : edist y (f y) ≠ ∞) (h : edist x y ≠ ∞) :
    efixedPoint f hf x hx = efixedPoint f hf y hy 
goal: ContractingWith.efixedPoint f hf x hx = ContractingWith.efixedPoint f hf y hy

full_name: ContractingWith.exists_fixedPoint'
code: /-- Banach fixed-point theorem for maps contracting on a complete subset. -/
theorem exists_fixedPoint' {s : Set α} (hsc : IsComplete s) (hsf : MapsTo f s s)
    (hf : ContractingWith K <| hsf.restrict f s s) {x : α} (hxs : x ∈ s) (hx : edist x (f x) ≠ ∞) :
    ∃ y ∈ s, IsFixedPt f y ∧ Tendsto (fun n ↦ f^[n] x) atTop (𝓝 y) ∧
      ∀ n : ℕ, edist (f^[n] x) y ≤ edist x (f x) * (K : ℝ≥0∞) ^ n / (1 - K) 
goal: ∃ y ∈ s,
  Function.IsFixedPt f y ∧
    Filter.Tendsto (fun n => f^[n] x) Filter.atTop (𝓝 y) ∧
      ∀ (n : ℕ), edist (f^[n] x) y ≤ edist x (f x) * ↑K ^ n / (1 - ↑K)

full_name: ContractingWith.efixedPoint'
code: /-- Let `s` be a complete forward-invariant set of a self-map `f`. If `f` contracts on `s`
and `x ∈ s` satisfies `edist x (f x) ≠ ∞`, then `efixedPoint'` is the unique fixed point
of the restriction of `f` to `s ∩ EMetric.ball x ∞`. -/
noncomputable def efixedPoint' {s : Set α} (hsc : IsComplete s) (hsf : MapsTo f s s)
    (hf : ContractingWith K <| hsf.restrict f s s) (x : α) (hxs : x ∈ s) (hx : edist x (f x) ≠ ∞) :
    α 
goal: α

full_name: ContractingWith.efixedPoint_mem'
code: theorem efixedPoint_mem' {s : Set α} (hsc : IsComplete s) (hsf : MapsTo f s s)
    (hf : ContractingWith K <| hsf.restrict f s s) {x : α} (hxs : x ∈ s) (hx : edist x (f x) ≠ ∞) :
    efixedPoint' f hsc hsf hf x hxs hx ∈ s 
goal: ContractingWith.efixedPoint' f hsc hsf hf x hxs hx ∈ s

full_name: ContractingWith.efixedPoint_isFixedPt'
code: theorem efixedPoint_isFixedPt' {s : Set α} (hsc : IsComplete s) (hsf : MapsTo f s s)
    (hf : ContractingWith K <| hsf.restrict f s s) {x : α} (hxs : x ∈ s) (hx : edist x (f x) ≠ ∞) :
    IsFixedPt f (efixedPoint' f hsc hsf hf x hxs hx) 
goal: Function.IsFixedPt f (ContractingWith.efixedPoint' f hsc hsf hf x hxs hx)

full_name: ContractingWith.tendsto_iterate_efixedPoint'
code: theorem tendsto_iterate_efixedPoint' {s : Set α} (hsc : IsComplete s) (hsf : MapsTo f s s)
    (hf : ContractingWith K <| hsf.restrict f s s) {x : α} (hxs : x ∈ s) (hx : edist x (f x) ≠ ∞) :
    Tendsto (fun n ↦ f^[n] x) atTop (𝓝 <| efixedPoint' f hsc hsf hf x hxs hx) 
goal: Filter.Tendsto (fun n => f^[n] x) Filter.atTop (𝓝 (ContractingWith.efixedPoint' f hsc hsf hf x hxs hx))

full_name: ContractingWith.apriori_edist_iterate_efixedPoint_le'
code: theorem apriori_edist_iterate_efixedPoint_le' {s : Set α} (hsc : IsComplete s) (hsf : MapsTo f s s)
    (hf : ContractingWith K <| hsf.restrict f s s) {x : α} (hxs : x ∈ s) (hx : edist x (f x) ≠ ∞)
    (n : ℕ) :
    edist (f^[n] x) (efixedPoint' f hsc hsf hf x hxs hx) ≤
      edist x (f x) * (K : ℝ≥0∞) ^ n / (1 - K) 
goal: edist (f^[n] x) (ContractingWith.efixedPoint' f hsc hsf hf x hxs hx) ≤ edist x (f x) * ↑K ^ n / (1 - ↑K)

full_name: ContractingWith.edist_efixedPoint_le'
code: theorem edist_efixedPoint_le' {s : Set α} (hsc : IsComplete s) (hsf : MapsTo f s s)
    (hf : ContractingWith K <| hsf.restrict f s s) {x : α} (hxs : x ∈ s) (hx : edist x (f x) ≠ ∞) :
    edist x (efixedPoint' f hsc hsf hf x hxs hx) ≤ edist x (f x) / (1 - K) 
goal: edist x (ContractingWith.efixedPoint' f hsc hsf hf x hxs hx) ≤ edist x (f x) / (1 - ↑K)

full_name: ContractingWith.edist_efixedPoint_lt_top'
code: theorem edist_efixedPoint_lt_top' {s : Set α} (hsc : IsComplete s) (hsf : MapsTo f s s)
    (hf : ContractingWith K <| hsf.restrict f s s) {x : α} (hxs : x ∈ s) (hx : edist x (f x) ≠ ∞) :
    edist x (efixedPoint' f hsc hsf hf x hxs hx) < ∞ 
goal: edist x (ContractingWith.efixedPoint' f hsc hsf hf x hxs hx) < ⊤

full_name: ContractingWith.efixedPoint_eq_of_edist_lt_top'
code: /-- If a globally contracting map `f` has two complete forward-invariant sets `s`, `t`,
and `x ∈ s` is at a finite distance from `y ∈ t`, then the `efixedPoint'` constructed by `x`
is the same as the `efixedPoint'` constructed by `y`.

This lemma takes additional arguments stating that `f` contracts on `s` and `t` because this way
it can be used to prove the desired equality with non-trivial proofs of these facts. -/
theorem efixedPoint_eq_of_edist_lt_top' (hf : ContractingWith K f) {s : Set α} (hsc : IsComplete s)
    (hsf : MapsTo f s s) (hfs : ContractingWith K <| hsf.restrict f s s) {x : α} (hxs : x ∈ s)
    (hx : edist x (f x) ≠ ∞) {t : Set α} (htc : IsComplete t) (htf : MapsTo f t t)
    (hft : ContractingWith K <| htf.restrict f t t) {y : α} (hyt : y ∈ t) (hy : edist y (f y) ≠ ∞)
    (hxy : edist x y ≠ ∞) :
    efixedPoint' f hsc hsf hfs x hxs hx = efixedPoint' f htc htf hft y hyt hy 
goal: ContractingWith.efixedPoint' f hsc hsf hfs x hxs hx = ContractingWith.efixedPoint' f htc htf hft y hyt hy

full_name: ContractingWith.one_sub_K_pos
code: theorem one_sub_K_pos (hf : ContractingWith K f) : (0 : ℝ) < 1 - K 
goal: 0 < 1 - ↑K

full_name: ContractingWith.dist_le_mul
code: theorem dist_le_mul (x y : α) : dist (f x) (f y) ≤ K * dist x y 
goal: dist (f x) (f y) ≤ ↑K * dist x y

full_name: ContractingWith.dist_inequality
code: theorem dist_inequality (x y) : dist x y ≤ (dist x (f x) + dist y (f y)) / (1 - K) 
goal: dist x y ≤ (dist x (f x) + dist y (f y)) / (1 - ↑K)

full_name: ContractingWith.dist_le_of_fixedPoint
code: theorem dist_le_of_fixedPoint (x) {y} (hy : IsFixedPt f y) : dist x y ≤ dist x (f x) / (1 - K) 
goal: dist x y ≤ dist x (f x) / (1 - ↑K)

full_name: ContractingWith.fixedPoint_unique'
code: theorem fixedPoint_unique' {x y} (hx : IsFixedPt f x) (hy : IsFixedPt f y) : x = y 
goal: x = y

full_name: ContractingWith.dist_fixedPoint_fixedPoint_of_dist_le'
code: /-- Let `f` be a contracting map with constant `K`; let `g` be another map uniformly
`C`-close to `f`. If `x` and `y` are their fixed points, then `dist x y ≤ C / (1 - K)`. -/
theorem dist_fixedPoint_fixedPoint_of_dist_le' (g : α → α) {x y} (hx : IsFixedPt f x)
    (hy : IsFixedPt g y) {C} (hfg : ∀ z, dist (f z) (g z) ≤ C) : dist x y ≤ C / (1 - K) 
goal: dist x y ≤ C / (1 - ↑K)

full_name: ContractingWith.fixedPoint
code: /-- The unique fixed point of a contracting map in a nonempty complete metric space. -/
noncomputable def fixedPoint : α 
goal: α

full_name: ContractingWith.fixedPoint_isFixedPt
code: /-- The point provided by `ContractingWith.fixedPoint` is actually a fixed point. -/
theorem fixedPoint_isFixedPt : IsFixedPt f (fixedPoint f hf) 
goal: Function.IsFixedPt f (ContractingWith.fixedPoint f hf)

full_name: ContractingWith.fixedPoint_unique
code: theorem fixedPoint_unique {x} (hx : IsFixedPt f x) : x = fixedPoint f hf 
goal: x = ContractingWith.fixedPoint f hf

full_name: ContractingWith.dist_fixedPoint_le
code: theorem dist_fixedPoint_le (x) : dist x (fixedPoint f hf) ≤ dist x (f x) / (1 - K) 
goal: dist x (ContractingWith.fixedPoint f hf) ≤ dist x (f x) / (1 - ↑K)

full_name: ContractingWith.aposteriori_dist_iterate_fixedPoint_le
code: /-- Aposteriori estimates on the convergence of iterates to the fixed point. -/
theorem aposteriori_dist_iterate_fixedPoint_le (x n) :
    dist (f^[n] x) (fixedPoint f hf) ≤ dist (f^[n] x) (f^[n + 1] x) / (1 - K) 
goal: dist (f^[n] x) (ContractingWith.fixedPoint f hf) ≤ dist (f^[n] x) (f^[n + 1] x) / (1 - ↑K)

full_name: ContractingWith.apriori_dist_iterate_fixedPoint_le
code: theorem apriori_dist_iterate_fixedPoint_le (x n) :
    dist (f^[n] x) (fixedPoint f hf) ≤ dist x (f x) * (K : ℝ) ^ n / (1 - K) 
goal: dist (f^[n] x) (ContractingWith.fixedPoint f hf) ≤ dist x (f x) * ↑K ^ n / (1 - ↑K)

full_name: ContractingWith.tendsto_iterate_fixedPoint
code: theorem tendsto_iterate_fixedPoint (x) :
    Tendsto (fun n ↦ f^[n] x) atTop (𝓝 <| fixedPoint f hf) 
goal: Filter.Tendsto (fun n => f^[n] x) Filter.atTop (𝓝 (ContractingWith.fixedPoint f hf))

full_name: ContractingWith.fixedPoint_lipschitz_in_map
code: theorem fixedPoint_lipschitz_in_map {g : α → α} (hg : ContractingWith K g) {C}
    (hfg : ∀ z, dist (f z) (g z) ≤ C) : dist (fixedPoint f hf) (fixedPoint g hg) ≤ C / (1 - K) 
goal: dist (ContractingWith.fixedPoint f hf) (ContractingWith.fixedPoint g hg) ≤ C / (1 - ↑K)

full_name: ContractingWith.isFixedPt_fixedPoint_iterate
code: /-- If a map `f` has a contracting iterate `f^[n]`, then the fixed point of `f^[n]` is also a fixed
point of `f`. -/
theorem isFixedPt_fixedPoint_iterate {n : ℕ} (hf : ContractingWith K f^[n]) :
    IsFixedPt f (hf.fixedPoint f^[n]) 
goal: Function.IsFixedPt f (ContractingWith.fixedPoint f^[n] hf)