-- Mathlib/GroupTheory/CosetCover.lean
theorem exists_finiteIndex_of_leftCoset_cover_aux [DecidableEq (Subgroup G)]
    (j : ι) (hj : j ∈ s) (hcovers' : ⋃ i ∈ s.filter (H · = H j), g i • (H i : Set G) ≠ Set.univ) :
    ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex

Proof state:
case inl
G : Type u_1
inst✝¹ : Group G
inst✝ : DecidableEq (Subgroup G)
n : ℕ
ih :
  ∀ m < n,
    ∀ {ι : Type u_2} {H : ι → Subgroup G} {g : ι → G} {s : Finset ι},
      ⋃ i ∈ s, g i • ↑(H i) = Set.univ →
        ∀ j ∈ s,
          ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ →
            m = (Finset.image H s).card → ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex
ι : Type u_2
H : ι → Subgroup G
g : ι → G
s : Finset ι
j : ι
hcovers :
  (⋃ x ∈ Finset.filter (fun x => H x = H j) s, g x • ↑(H x)) ∪
      ⋃ x ∈ Finset.filter (fun a => ¬H a = H j) s, g x • ↑(H x) =
    Set.univ
hj : j ∈ s
hcovers' : ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ
hn : n = (Finset.image H s).card
x : G
hx : ∀ (y : G), y • ↑(H j) ⊆ ⋃ i ∈ Finset.filter (fun x => H x ≠ H j) s, (y * x⁻¹ * g i) • ↑(H i)
κ : Type u_2 :=
  { x // x ∈ Finset.filter (fun x => H x ≠ H j) s } × Option { x // x ∈ Finset.filter (fun x => H x = H j) s }
f : κ → G :=
  fun x_1 =>
    match x_1 with
    | (k₁, some k₂) => g ↑k₂ * x⁻¹ * g ↑k₁
    | (k₁, none) => g ↑k₁
K : κ → Subgroup G := fun k => H ↑k.1
hK' : ∀ (k : κ), K k ∈ (Finset.image H s).erase (H j)
hK : ∀ (k : κ), K k ≠ H j
y : G
hy : y ∈ ⋃ x ∈ Finset.filter (fun x => H x = H j) s, g x • ↑(H x)
⊢ ∃ i, ∃ (_ : i ∈ Finset.univ), y ∈ f i • ↑(K i)

Tactic:
have ⟨k, hk, hy⟩ := Set.mem_iUnion₂.mp hy

Result:
case inl
G : Type u_1
inst✝¹ : Group G
inst✝ : DecidableEq (Subgroup G)
n : ℕ
ih :
  ∀ m < n,
    ∀ {ι : Type u_2} {H : ι → Subgroup G} {g : ι → G} {s : Finset ι},
      ⋃ i ∈ s, g i • ↑(H i) = Set.univ →
        ∀ j ∈ s,
          ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ →
            m = (Finset.image H s).card → ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex
ι : Type u_2
H : ι → Subgroup G
g : ι → G
s : Finset ι
j : ι
hcovers :
  (⋃ x ∈ Finset.filter (fun x => H x = H j) s, g x • ↑(H x)) ∪
      ⋃ x ∈ Finset.filter (fun a => ¬H a = H j) s, g x • ↑(H x) =
    Set.univ
hj : j ∈ s
hcovers' : ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ
hn : n = (Finset.image H s).card
x : G
hx : ∀ (y : G), y • ↑(H j) ⊆ ⋃ i ∈ Finset.filter (fun x => H x ≠ H j) s, (y * x⁻¹ * g i) • ↑(H i)
κ : Type u_2 :=
  { x // x ∈ Finset.filter (fun x => H x ≠ H j) s } × Option { x // x ∈ Finset.filter (fun x => H x = H j) s }
f : κ → G :=
  fun x_1 =>
    match x_1 with
    | (k₁, some k₂) => g ↑k₂ * x⁻¹ * g ↑k₁
    | (k₁, none) => g ↑k₁
K : κ → Subgroup G := fun k => H ↑k.1
hK' : ∀ (k : κ), K k ∈ (Finset.image H s).erase (H j)
hK : ∀ (k : κ), K k ≠ H j
y : G
hy✝ : y ∈ ⋃ x ∈ Finset.filter (fun x => H x = H j) s, g x • ↑(H x)
k : ι
hk : k ∈ Finset.filter (fun x => H x = H j) s
hy : y ∈ g k • ↑(H k)
⊢ ∃ i, ∃ (_ : i ∈ Finset.univ), y ∈ f i • ↑(K i)

Proof state:
G : Type u_1
inst✝¹ : Group G
inst✝ : DecidableEq (Subgroup G)
n : ℕ
ih :
  ∀ m < n,
    ∀ {ι : Type u_2} {H : ι → Subgroup G} {g : ι → G} {s : Finset ι},
      ⋃ i ∈ s, g i • ↑(H i) = Set.univ →
        ∀ j ∈ s,
          ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ →
            m = (Finset.image H s).card → ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex
ι : Type u_2
H : ι → Subgroup G
g : ι → G
s : Finset ι
hcovers : ⋃ i ∈ s, g i • ↑(H i) = Set.univ
j : ι
hj : j ∈ s
hcovers' : ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ
hn : n = (Finset.image H s).card
⊢ ∃ x, ∀ i ∈ s, H i = H j → ↑(g i) ≠ ↑x

Tactic:
simpa [Set.eq_univ_iff_forall, mem_leftCoset_iff, ← QuotientGroup.eq] using hcovers'

Result:
no goals

Proof state:
case ind
G : Type u_1
inst✝¹ : Group G
inst✝ : DecidableEq (Subgroup G)
n : ℕ
ih :
  ∀ m < n,
    ∀ {ι : Type u_2} {H : ι → Subgroup G} {g : ι → G} {s : Finset ι},
      ⋃ i ∈ s, g i • ↑(H i) = Set.univ →
        ∀ j ∈ s,
          ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ →
            m = (Finset.image H s).card → ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex
ι : Type u_2
H : ι → Subgroup G
g : ι → G
s : Finset ι
j : ι
hj : j ∈ s
hcovers' : ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ
hn : n = (Finset.image H s).card
x : G
hx : ∀ (y : G), y • ↑(H j) ⊆ ⋃ i ∈ Finset.filter (fun x => H x ≠ H j) s, (y * x⁻¹ * g i) • ↑(H i)
κ : Type u_2 :=
  { x // x ∈ Finset.filter (fun x => H x ≠ H j) s } × Option { x // x ∈ Finset.filter (fun x => H x = H j) s }
f : κ → G :=
  fun x_1 =>
    match x_1 with
    | (k₁, some k₂) => g ↑k₂ * x⁻¹ * g ↑k₁
    | (k₁, none) => g ↑k₁
K : κ → Subgroup G := fun k => H ↑k.1
hK' : ∀ (k : κ), K k ∈ (Finset.image H s).erase (H j)
hK : ∀ (k : κ), K k ≠ H j
hcovers : ⋃ k ∈ Finset.univ, f k • ↑(K k) = Set.univ
⊢ ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex

Tactic:
have ⟨k⟩ : Nonempty κ := not_isEmpty_iff.mp fun hempty => by
  rw [Set.iUnion_of_empty] at hcovers
  exact Set.empty_ne_univ hcovers

Result:
case ind
G : Type u_1
inst✝¹ : Group G
inst✝ : DecidableEq (Subgroup G)
n : ℕ
ih :
  ∀ m < n,
    ∀ {ι : Type u_2} {H : ι → Subgroup G} {g : ι → G} {s : Finset ι},
      ⋃ i ∈ s, g i • ↑(H i) = Set.univ →
        ∀ j ∈ s,
          ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ →
            m = (Finset.image H s).card → ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex
ι : Type u_2
H : ι → Subgroup G
g : ι → G
s : Finset ι
j : ι
hj : j ∈ s
hcovers' : ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ
hn : n = (Finset.image H s).card
x : G
hx : ∀ (y : G), y • ↑(H j) ⊆ ⋃ i ∈ Finset.filter (fun x => H x ≠ H j) s, (y * x⁻¹ * g i) • ↑(H i)
κ : Type u_2 :=
  { x // x ∈ Finset.filter (fun x => H x ≠ H j) s } × Option { x // x ∈ Finset.filter (fun x => H x = H j) s }
f : κ → G :=
  fun x_1 =>
    match x_1 with
    | (k₁, some k₂) => g ↑k₂ * x⁻¹ * g ↑k₁
    | (k₁, none) => g ↑k₁
K : κ → Subgroup G := fun k => H ↑k.1
hK' : ∀ (k : κ), K k ∈ (Finset.image H s).erase (H j)
hK : ∀ (k : κ), K k ≠ H j
hcovers : ⋃ k ∈ Finset.univ, f k • ↑(K k) = Set.univ
k : κ
⊢ ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex

Proof state:
G : Type u_1
inst✝¹ : Group G
ι : Type u_2
H : ι → Subgroup G
g : ι → G
s : Finset ι
hcovers : ⋃ i ∈ s, g i • ↑(H i) = Set.univ
inst✝ : DecidableEq (Subgroup G)
j : ι
hj : j ∈ s
hcovers' : ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ
⊢ ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex

Tactic:
have ⟨n, hn⟩ : ∃ n, n = (s.image H).card := exists_eq

Result:
G : Type u_1
inst✝¹ : Group G
ι : Type u_2
H : ι → Subgroup G
g : ι → G
s : Finset ι
hcovers : ⋃ i ∈ s, g i • ↑(H i) = Set.univ
inst✝ : DecidableEq (Subgroup G)
j : ι
hj : j ∈ s
hcovers' : ⋃ i ∈ Finset.filter (fun x => H x = H j) s, g i • ↑(H i) ≠ Set.univ
n : ℕ
hn : n = (Finset.image H s).card
⊢ ∃ i ∈ s, H i ≠ H j ∧ (H i).FiniteIndex