-- Mathlib/Dynamics/TopologicalEntropy/CoverEntropy.lean
/-- From a dynamical cover `s` with entourage `U` and time `m`, we construct covers with entourage
`U ○ U` and any multiple `m * n` of `m` with controlled cardinality. This lemma is the first step
in a submultiplicative-like property of `coverMincard`, with consequences such as explicit bounds
for the topological entropy (`coverEntropyInfEntourage_le_card_div`) and an equality between
two notions of topological entropy (`coverEntropyInf_eq_coverEntropySup_of_inv`). -/
lemma IsDynCoverOf.iterate_le_pow {T : X → X} {F : Set X} (F_inv : MapsTo T F F) {U : Set (X × X)}
    (U_symm : SymmetricRel U) {m : ℕ} (n : ℕ) {s : Finset X} (h : IsDynCoverOf T F U m s) :
    ∃ t : Finset X, IsDynCoverOf T F (U ○ U) (m * n) t ∧ t.card ≤ s.card ^ n

Proof state:
case inr.intro.inr.refine_1
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
m n : ℕ
s : Finset X
h : IsDynCoverOf T F U m ↑s
x✝¹ : Nonempty X
s_nemp : s.Nonempty
x : X
x_F : x ∈ F
m_pos : m > 0
dyncover : (Fin n → { x // x ∈ s }) → X
h_dyncover :
  ∀ (t : Fin n → { x // x ∈ s }),
    ⋂ k, T^[m * ↑k] ⁻¹' ball (↑(t k)) (dynEntourage T U m) ⊆ ball (dyncover t) (dynEntourage T (U ○ U) (m * n))
sn : Set X := range dyncover
this : Fintype ↑(range dyncover)
x✝ : Nonempty { x // x ∈ s }
y : X
y_F : y ∈ F
t : Fin n → { x // x ∈ s }
ht : ∀ (k : Fin n), y ∈ T^[m * ↑k] ⁻¹' ball (↑(t k)) (dynEntourage T U m)
⊢ y ∈ ⋃ x ∈ ↑sn.toFinset, ball x (dynEntourage T (U ○ U) (m * n))

Tactic:
simp only [toFinset_range, Finset.coe_image, Finset.coe_univ, image_univ, mem_range,
  iUnion_exists, iUnion_iUnion_eq', mem_iUnion, sn]

Result:
case inr.intro.inr.refine_1
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
m n : ℕ
s : Finset X
h : IsDynCoverOf T F U m ↑s
x✝¹ : Nonempty X
s_nemp : s.Nonempty
x : X
x_F : x ∈ F
m_pos : m > 0
dyncover : (Fin n → { x // x ∈ s }) → X
h_dyncover :
  ∀ (t : Fin n → { x // x ∈ s }),
    ⋂ k, T^[m * ↑k] ⁻¹' ball (↑(t k)) (dynEntourage T U m) ⊆ ball (dyncover t) (dynEntourage T (U ○ U) (m * n))
sn : Set X := range dyncover
this : Fintype ↑(range dyncover)
x✝ : Nonempty { x // x ∈ s }
y : X
y_F : y ∈ F
t : Fin n → { x // x ∈ s }
ht : ∀ (k : Fin n), y ∈ T^[m * ↑k] ⁻¹' ball (↑(t k)) (dynEntourage T U m)
⊢ ∃ i, y ∈ ball (dyncover i) (dynEntourage T (U ○ U) (m * n))

Proof state:
case h
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
n : ℕ
s : Finset X
x✝ : Nonempty X
s_nemp : (↑s).Nonempty
x : X
x_F : x ∈ F
h : IsDynCoverOf T F U 0 ↑s
⊢ IsDynCoverOf T F (U ○ U) (0 * n) ↑{x} ∧ {x}.card ≤ s.card ^ n

Tactic:
simp only [zero_mul, Finset.coe_singleton, Finset.card_singleton]

Result:
case h
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
n : ℕ
s : Finset X
x✝ : Nonempty X
s_nemp : (↑s).Nonempty
x : X
x_F : x ∈ F
h : IsDynCoverOf T F U 0 ↑s
⊢ IsDynCoverOf T F (U ○ U) 0 {x} ∧ 1 ≤ s.card ^ n

Proof state:
X : Type u_1
T : X → X
U : Set (X × X)
U_symm : SymmetricRel U
m n : ℕ
s : Finset X
F_inv : MapsTo T ∅ ∅
h : IsDynCoverOf T ∅ U m ↑s
⊢ IsDynCoverOf T ∅ (U ○ U) (m * n) ↑∅ ∧ ∅.card ≤ s.card ^ n

Tactic:
simp

Result:
no goals

Proof state:
case inr.intro
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
m n : ℕ
s : Finset X
h : IsDynCoverOf T F U m ↑s
x✝ : Nonempty X
s_nemp : (↑s).Nonempty
x : X
x_F : x ∈ F
m_pos : m > 0
t : Fin n → { x // x ∈ s }
y z : X
y_int : ∀ (i : Fin n), ∀ i_1 < m, (T^[i_1] ↑(t i), T^[i_1] (T^[m * ↑i] y)) ∈ U
z_int : ∀ (i : Fin n), ∀ i_1 < m, (T^[i_1] ↑(t i), T^[i_1] (T^[m * ↑i] z)) ∈ U
⊢ ∀ i < m * n, (T^[i] y, T^[i] z) ∈ U ○ U

Tactic:
intro k k_mn

Result:
case inr.intro
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
m n : ℕ
s : Finset X
h : IsDynCoverOf T F U m ↑s
x✝ : Nonempty X
s_nemp : (↑s).Nonempty
x : X
x_F : x ∈ F
m_pos : m > 0
t : Fin n → { x // x ∈ s }
y z : X
y_int : ∀ (i : Fin n), ∀ i_1 < m, (T^[i_1] ↑(t i), T^[i_1] (T^[m * ↑i] y)) ∈ U
z_int : ∀ (i : Fin n), ∀ i_1 < m, (T^[i_1] ↑(t i), T^[i_1] (T^[m * ↑i] z)) ∈ U
k : ℕ
k_mn : k < m * n
⊢ (T^[k] y, T^[k] z) ∈ U ○ U

Proof state:
case intro.intro
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
m n : ℕ
s : Finset X
h : IsDynCoverOf T F U m ↑s
x✝¹ : Nonempty X
s_nemp : s.Nonempty
x : X
x_F : x ∈ F
m_pos : m > 0
dyncover : (Fin n → { x // x ∈ s }) → X
h_dyncover :
  ∀ (t : Fin n → { x // x ∈ s }),
    ⋂ k, T^[m * ↑k] ⁻¹' ball (↑(t k)) (dynEntourage T U m) ⊆ ball (dyncover t) (dynEntourage T (U ○ U) (m * n))
sn : Set X := range dyncover
this : Fintype ↑(range dyncover)
x✝ : Nonempty { x // x ∈ s }
y : X
y_F : y ∈ F
k : Fin n
z : X
z_s : z ∈ ↑s
hz : T^[m * ↑k] y ∈ ball z (dynEntourage T U m)
⊢ ∃ z, y ∈ T^[m * ↑k] ⁻¹' ball (↑z) (dynEntourage T U m)

Tactic:
exact ⟨⟨z, z_s⟩, hz⟩

Result:
no goals

Proof state:
case h.a
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
m n : ℕ
s : Finset X
h : IsDynCoverOf T F U m ↑s
x✝¹ : Nonempty X
s_nemp : s.Nonempty
x : X
x_F : x ∈ F
m_pos : m > 0
dyncover : (Fin n → { x // x ∈ s }) → X
h_dyncover :
  ∀ (t : Fin n → { x // x ∈ s }),
    ⋂ k, T^[m * ↑k] ⁻¹' ball (↑(t k)) (dynEntourage T U m) ⊆ ball (dyncover t) (dynEntourage T (U ○ U) (m * n))
sn : Set X := range dyncover
this : Fintype ↑(range dyncover)
x✝ : Nonempty { x // x ∈ s }
y : X
y_F : y ∈ F
t : Fin n → { x // x ∈ s }
ht : ∀ (k : Fin n), T^[m * ↑k] y ∈ ball (↑(t k)) (dynEntourage T U m)
⊢ ∀ (i : Fin n), T^[m * ↑i] y ∈ ball (↑(t i)) (dynEntourage T U m)

Tactic:
exact ht

Result:
no goals

Proof state:
case inr.intro.inr.refine_1
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
m n : ℕ
s : Finset X
h : IsDynCoverOf T F U m ↑s
x✝ : Nonempty X
s_nemp : s.Nonempty
x : X
x_F : x ∈ F
m_pos : m > 0
dyncover : (Fin n → { x // x ∈ s }) → X
h_dyncover :
  ∀ (t : Fin n → { x // x ∈ s }),
    ⋂ k, T^[m * ↑k] ⁻¹' ball (↑(t k)) (dynEntourage T U m) ⊆ ball (dyncover t) (dynEntourage T (U ○ U) (m * n))
sn : Set X := range dyncover
this : Fintype ↑(range dyncover)
⊢ IsDynCoverOf T F (U ○ U) (m * n) ↑sn.toFinset

Tactic:
have _ : Nonempty s := Finset.Nonempty.coe_sort s_nemp

Result:
case inr.intro.inr.refine_1
X : Type u_1
T : X → X
F : Set X
F_inv : MapsTo T F F
U : Set (X × X)
U_symm : SymmetricRel U
m n : ℕ
s : Finset X
h : IsDynCoverOf T F U m ↑s
x✝¹ : Nonempty X
s_nemp : s.Nonempty
x : X
x_F : x ∈ F
m_pos : m > 0
dyncover : (Fin n → { x // x ∈ s }) → X
h_dyncover :
  ∀ (t : Fin n → { x // x ∈ s }),
    ⋂ k, T^[m * ↑k] ⁻¹' ball (↑(t k)) (dynEntourage T U m) ⊆ ball (dyncover t) (dynEntourage T (U ○ U) (m * n))
sn : Set X := range dyncover
this : Fintype ↑(range dyncover)
x✝ : Nonempty { x // x ∈ s }
⊢ IsDynCoverOf T F (U ○ U) (m * n) ↑sn.toFinset