import Mathlib
import Optlib


open Set Bornology Filter BigOperators Topology BCD

open BCD

theorem extracted_formal_statement_197.{u_2, u_1} {E : Type u_1} {F : Type u_2} [inst : NormedAddCommGroup E]
  [inst_1 : InnerProductSpace ℝ E] [inst_2 : CompleteSpace E] [inst_3 : NormedAddCommGroup F]
  [inst_4 : InnerProductSpace ℝ F] [inst_5 : CompleteSpace F] {f : E → ℝ} {g : F → ℝ} {H : WithLp 2 (E × F) → ℝ}
  {x0 : E} {y0 : F} {l : NNReal} {alg : BCD f g H l x0 y0} [inst_6 : ProperSpace E] [inst_7 : ProperSpace F] (γ : ℝ)
  (hγ : γ > 1) (ck : ∀ (k : ℕ), alg.c k = 1 / (γ * ↑l)) (dk : ∀ (k : ℕ), alg.d k = 1 / (γ * ↑l))
  (bd : Bornology.IsBounded (z '' univ)) (lbdψ : BddBelow (ψ '' univ)) (a b : Set (WithLp 2 (E × F)))
  (closea : IsClosed a) (closeb : IsClosed b) (sub_ab : limit_set z ⊆ a ∪ b) (nez_a : (limit_set z ∩ a).Nonempty)
  (nz_ab : limit_set z ∩ (a ∩ b) = ∅) :
  let A := limit_set z ∩ a;
  let B := limit_set z ∩ b;
  A ∪ B = limit_set z →
    A ∩ B = ∅ →
      let ω := fun z => (EMetric.infEdist z A).toReal / ((EMetric.infEdist z A).toReal + (EMetric.infEdist z B).toReal);
      (∀ (z : WithLp 2 (E × F)), (EMetric.infEdist z A).toReal + (EMetric.infEdist z B).toReal ≠ 0) →
        Continuous ω →
          let U := {z | ω z < 1 / 4};
          let V := {z | 3 / 4 < ω z};
          (∀ z_ ∈ A, ω z_ = 0) →
            (∀ z_ ∈ B, ω z_ = 1) →
              ∀ (k0 : ℕ),
                (∀ (k : ℕ), k0 ≤ k → z k ∈ U ∨ z k ∈ V) →
                  UniformContinuousOn ω (closure (z '' univ)) →
                    (∀ ε > 0,
                        ∃ δ > 0,
                          ∀ x1 ∈ closure (z '' univ), ∀ x2 ∈ closure (z '' univ), ‖x1 - x2‖ < δ → ‖ω x1 - ω x2‖ < ε) →
                      (∀ ε > 0, ∃ N, ∀ n ≥ N, ‖ω (z (n + 1)) - ω (z n)‖ < ε) →
                        ∀ (N : ℕ),
                          (∀ n ≥ N, ‖ω (z (n + 1)) - ω (z n)‖ < 1 / 2) →
                            ∀ (M : ℕ),
                              (∀ n ≥ M, z n ∈ U) →
                                ∀ z_ ∈ limit_set z ∩ b,
                                  z_ ∈ limit_set z →
                                    ∀ (φ : ℕ → ℕ),
                                      StrictMono φ →
                                        Tendsto (z ∘ φ) atTop (𝓝 z_) →
                                          (∀ᶠ (c : ℕ) in atTop, (ω ∘ z ∘ φ) c ≤ 1 / 4) →
                                            ∃ a, ∀ (b : ℕ), a ≤ b → ω (z (φ b)) ≤ 4⁻¹ := sorry

Tactic state before:
E : Type u_1
F : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : InnerProductSpace ℝ E
inst✝⁵ : CompleteSpace E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : InnerProductSpace ℝ F
inst✝² : CompleteSpace F
f : E → ℝ
g : F → ℝ
H : WithLp 2 (E × F) → ℝ
x0 : E
y0 : F
l : NNReal
alg : BCD f g H l x0 y0
inst✝¹ : ProperSpace E
inst✝ : ProperSpace F
γ : ℝ
hγ : γ > 1
ck : ∀ (k : ℕ), alg.c k = 1 / (γ * ↑l)
dk : ∀ (k : ℕ), alg.d k = 1 / (γ * ↑l)
bd : Bornology.IsBounded (z '' univ)
lbdψ : BddBelow (ψ '' univ)
a b : Set (WithLp 2 (E × F))
closea : IsClosed a
closeb : IsClosed b
sub_ab : limit_set z ⊆ a ∪ b
nez_a : (limit_set z ∩ a).Nonempty
nz_ab : limit_set z ∩ (a ∩ b) = ∅
A : Set (WithLp 2 (E × F)) := limit_set z ∩ a
B : Set (WithLp 2 (E × F)) := limit_set z ∩ b
eqAB : A ∪ B = limit_set z
disjoint_AB : A ∩ B = ∅
ω : WithLp 2 (E × F) → ℝ :=
  fun z => (EMetric.infEdist z A).toReal / ((EMetric.infEdist z A).toReal + (EMetric.infEdist z B).toReal)
sum_ne_zero : ∀ (z : WithLp 2 (E × F)), (EMetric.infEdist z A).toReal + (EMetric.infEdist z B).toReal ≠ 0
contω : Continuous ω
U : Set (WithLp 2 (E × F)) := {z | ω z < 1 / 4}
V : Set (WithLp 2 (E × F)) := {z | 3 / 4 < ω z}
A0 : ∀ z_ ∈ A, ω z_ = 0
B1 : ∀ z_ ∈ B, ω z_ = 1
k0 : ℕ
hk0 : ∀ (k : ℕ), k0 ≤ k → z k ∈ U ∨ z k ∈ V
unicont : UniformContinuousOn ω (closure (z '' univ))
this✝¹ : ∀ ε > 0, ∃ δ > 0, ∀ x1 ∈ closure (z '' univ), ∀ x2 ∈ closure (z '' univ), ‖x1 - x2‖ < δ → ‖ω x1 - ω x2‖ < ε
this✝ : ∀ ε > 0, ∃ N, ∀ n ≥ N, ‖ω (z (n + 1)) - ω (z n)‖ < ε
N : ℕ
key : ∀ n ≥ N, ‖ω (z (n + 1)) - ω (z n)‖ < 1 / 2
M : ℕ
h1 : ∀ n ≥ M, z n ∈ U
z_ : WithLp 2 (E × F)
inB : z_ ∈ limit_set z ∩ b
this : z_ ∈ limit_set z
φ : ℕ → ℕ
monoφ : StrictMono φ
conv : Tendsto (z ∘ φ) atTop (𝓝 z_)
⊢ ∀ᶠ (c : ℕ) in atTop, (ω ∘ z ∘ φ) c ≤ 1 / 4

Tactic:
simp

Tactic state after:
[E : Type u_1
 F : Type u_2
 inst✝⁷ : NormedAddCommGroup E
 inst✝⁶ : InnerProductSpace ℝ E
 inst✝⁵ : CompleteSpace E
 inst✝⁴ : NormedAddCommGroup F
 inst✝³ : InnerProductSpace ℝ F
 inst✝² : CompleteSpace F
 f : E → ℝ
 g : F → ℝ
 H : WithLp 2 (E × F) → ℝ
 x0 : E
 y0 : F
 l : NNReal
 alg : BCD f g H l x0 y0
 inst✝¹ : ProperSpace E
 inst✝ : ProperSpace F
 γ : ℝ
 hγ : γ > 1
 ck : ∀ (k : ℕ), alg.c k = 1 / (γ * ↑l)
 dk : ∀ (k : ℕ), alg.d k = 1 / (γ * ↑l)
 bd : Bornology.IsBounded (z '' univ)
 lbdψ : BddBelow (ψ '' univ)
 a b : Set (WithLp 2 (E × F))
 closea : IsClosed a
 closeb : IsClosed b
 sub_ab : limit_set z ⊆ a ∪ b
 nez_a : (limit_set z ∩ a).Nonempty
 nz_ab : limit_set z ∩ (a ∩ b) = ∅
 A : Set (WithLp 2 (E × F)) := limit_set z ∩ a
 B : Set (WithLp 2 (E × F)) := limit_set z ∩ b
 eqAB : A ∪ B = limit_set z
 disjoint_AB : A ∩ B = ∅
 ω : WithLp 2 (E × F) → ℝ :=
   fun z => (EMetric.infEdist z A).toReal / ((EMetric.infEdist z A).toReal + (EMetric.infEdist z B).toReal)
 sum_ne_zero : ∀ (z : WithLp 2 (E × F)), (EMetric.infEdist z A).toReal + (EMetric.infEdist z B).toReal ≠ 0
 contω : Continuous ω
 U : Set (WithLp 2 (E × F)) := {z | ω z < 1 / 4}
 V : Set (WithLp 2 (E × F)) := {z | 3 / 4 < ω z}
 A0 : ∀ z_ ∈ A, ω z_ = 0
 B1 : ∀ z_ ∈ B, ω z_ = 1
 k0 : ℕ
 hk0 : ∀ (k : ℕ), k0 ≤ k → z k ∈ U ∨ z k ∈ V
 unicont : UniformContinuousOn ω (closure (z '' univ))
 this✝¹ : ∀ ε > 0, ∃ δ > 0, ∀ x1 ∈ closure (z '' univ), ∀ x2 ∈ closure (z '' univ), ‖x1 - x2‖ < δ → ‖ω x1 - ω x2‖ < ε
 this✝ : ∀ ε > 0, ∃ N, ∀ n ≥ N, ‖ω (z (n + 1)) - ω (z n)‖ < ε
 N : ℕ
 key : ∀ n ≥ N, ‖ω (z (n + 1)) - ω (z n)‖ < 1 / 2
 M : ℕ
 h1 : ∀ n ≥ M, z n ∈ U
 z_ : WithLp 2 (E × F)
 inB : z_ ∈ limit_set z ∩ b
 this : z_ ∈ limit_set z
 φ : ℕ → ℕ
 monoφ : StrictMono φ
 conv : Tendsto (z ∘ φ) atTop (𝓝 z_)
 ⊢ ∃ a, ∀ (b : ℕ), a ≤ b → ω (z (φ b)) ≤ 4⁻¹]