l3lab/ntp-mathlib huggingface dataset:
theorem finset_sup_compact_of_compact {α β : Type*} [CompleteLattice α] {f : β → α} (s : Finset β)
    (h : ∀ x ∈ s, IsCompactElement (f x)) : IsCompactElement (s.sup f) := by
  classical
    rw [isCompactElement_iff_le_of_directed_sSup_le]
    intro d hemp hdir hsup
    rw [← Function.comp.left_id f]
    rw [← Finset.sup_image]
    apply Finset.sup_le_of_le_directed d hemp hdir
    rintro x hx
    obtain ⟨p, ⟨hps, rfl⟩⟩ := Finset.mem_image.mp hx
    specialize h p hps
    rw [isCompactElement_iff_le_of_directed_sSup_le] at h
    specialize h d hemp hdir (le_trans (Finset.le_sup hps) hsup)
    

Proof state:
case a.intro.intro
ι : Sort u_1
α✝ : Type u_2
inst✝¹ : CompleteLattice α✝
f✝ : ι → α✝
α : Type u_3
β : Type u_4
inst✝ : CompleteLattice α
f : β → α
s : Finset β
d : Set α
hemp : Set.Nonempty d
hdir : DirectedOn (fun x x_1 => x ≤ x_1) d
hsup : Finset.sup s f ≤ sSup d
p : β
hps : p ∈ s
hx : f p ∈ Finset.image f s
h : ∃ x ∈ d, f p ≤ x
⊢ ∃ y ∈ d, f p ≤ y

Next tactic:
simpa only [exists_prop]
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
⊢ ∃ t, ↑t ⊆ s ∧ sSup s = Finset.sup t id

Next tactic:
let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
S : Set α := {x | ∃ t, ↑t ⊆ s ∧ Finset.sup t id = x}
⊢ ∃ t, ↑t ⊆ s ∧ sSup s = Finset.sup t id

Next tactic:
obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := h.has_min S ⟨⊥, ∅, by simp⟩
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
  obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := h.has_min S ⟨⊥, ∅, by 

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
S : Set α := {x | ∃ t, ↑t ⊆ s ∧ Finset.sup t id = x}
⊢ ↑∅ ⊆ s ∧ Finset.sup ∅ id = ⊥

Next tactic:
simp
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
  obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := h.has_min S ⟨⊥, ∅, by simp⟩
  

Proof state:
case intro.intro.intro.intro
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
S : Set α := {x | ∃ t, ↑t ⊆ s ∧ Finset.sup t id = x}
t : Finset α
ht₁ : ↑t ⊆ s
hm : ∀ x ∈ S, ¬x > Finset.sup t id
⊢ ∃ t, ↑t ⊆ s ∧ sSup s = Finset.sup t id

Next tactic:
refine' ⟨t, ht₁, (sSup_le _ _ fun y hy => _).antisymm _⟩
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
  obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := h.has_min S ⟨⊥, ∅, by simp⟩
  refine' ⟨t, ht₁, (sSup_le _ _ fun y hy => _).antisymm _⟩
  · 

Proof state:
case intro.intro.intro.intro.refine'_1
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
S : Set α := {x | ∃ t, ↑t ⊆ s ∧ Finset.sup t id = x}
t : Finset α
ht₁ : ↑t ⊆ s
hm : ∀ x ∈ S, ¬x > Finset.sup t id
y : α
hy : y ∈ s
⊢ y ≤ Finset.sup t id

Next tactic:
classical
    rw [eq_of_le_of_not_lt (Finset.sup_mono (t.subset_insert y))
        (hm _ ⟨insert y t, by simp [Set.insert_subset_iff, hy, ht₁]⟩)]
    simp
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
  obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := h.has_min S ⟨⊥, ∅, by simp⟩
  refine' ⟨t, ht₁, (sSup_le _ _ fun y hy => _).antisymm _⟩
  · classical
    

Proof state:
case intro.intro.intro.intro.refine'_1
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
S : Set α := {x | ∃ t, ↑t ⊆ s ∧ Finset.sup t id = x}
t : Finset α
ht₁ : ↑t ⊆ s
hm : ∀ x ∈ S, ¬x > Finset.sup t id
y : α
hy : y ∈ s
⊢ y ≤ Finset.sup t id

Next tactic:
rw [eq_of_le_of_not_lt (Finset.sup_mono (t.subset_insert y))
        (hm _ ⟨insert y t, by simp [Set.insert_subset_iff, hy, ht₁]⟩)]
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
  obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := h.has_min S ⟨⊥, ∅, by simp⟩
  refine' ⟨t, ht₁, (sSup_le _ _ fun y hy => _).antisymm _⟩
  · classical
    rw [eq_of_le_of_not_lt (Finset.sup_mono (t.subset_insert y))
        (hm _ ⟨insert y t, by 

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
S : Set α := {x | ∃ t, ↑t ⊆ s ∧ Finset.sup t id = x}
t : Finset α
ht₁ : ↑t ⊆ s
hm : ∀ x ∈ S, ¬x > Finset.sup t id
y : α
hy : y ∈ s
⊢ ↑(insert y t) ⊆ s ∧ Finset.sup (insert y t) id = Finset.sup (insert y t) id

Next tactic:
simp [Set.insert_subset_iff, hy, ht₁]
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
  obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := h.has_min S ⟨⊥, ∅, by simp⟩
  refine' ⟨t, ht₁, (sSup_le _ _ fun y hy => _).antisymm _⟩
  · classical
    rw [eq_of_le_of_not_lt (Finset.sup_mono (t.subset_insert y))
        (hm _ ⟨insert y t, by simp [Set.insert_subset_iff, hy, ht₁]⟩)]
    

Proof state:
case intro.intro.intro.intro.refine'_1
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
S : Set α := {x | ∃ t, ↑t ⊆ s ∧ Finset.sup t id = x}
t : Finset α
ht₁ : ↑t ⊆ s
hm : ∀ x ∈ S, ¬x > Finset.sup t id
y : α
hy : y ∈ s
⊢ y ≤ Finset.sup (insert y t) id

Next tactic:
simp
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
  obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := h.has_min S ⟨⊥, ∅, by simp⟩
  refine' ⟨t, ht₁, (sSup_le _ _ fun y hy => _).antisymm _⟩
  · classical
    rw [eq_of_le_of_not_lt (Finset.sup_mono (t.subset_insert y))
        (hm _ ⟨insert y t, by simp [Set.insert_subset_iff, hy, ht₁]⟩)]
    simp
  · 

Proof state:
case intro.intro.intro.intro.refine'_2
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
S : Set α := {x | ∃ t, ↑t ⊆ s ∧ Finset.sup t id = x}
t : Finset α
ht₁ : ↑t ⊆ s
hm : ∀ x ∈ S, ¬x > Finset.sup t id
⊢ Finset.sup t id ≤ sSup s

Next tactic:
rw [Finset.sup_id_eq_sSup]
theorem WellFounded.isSupFiniteCompact (h : WellFounded ((· > ·) : α → α → Prop)) :
    IsSupFiniteCompact α := fun s => by
  let S := { x | ∃ t : Finset α, ↑t ⊆ s ∧ t.sup id = x }
  obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := h.has_min S ⟨⊥, ∅, by simp⟩
  refine' ⟨t, ht₁, (sSup_le _ _ fun y hy => _).antisymm _⟩
  · classical
    rw [eq_of_le_of_not_lt (Finset.sup_mono (t.subset_insert y))
        (hm _ ⟨insert y t, by simp [Set.insert_subset_iff, hy, ht₁]⟩)]
    simp
  · rw [Finset.sup_id_eq_sSup]
    

Proof state:
case intro.intro.intro.intro.refine'_2
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : WellFounded fun x x_1 => x > x_1
s : Set α
S : Set α := {x | ∃ t, ↑t ⊆ s ∧ Finset.sup t id = x}
t : Finset α
ht₁ : ↑t ⊆ s
hm : ∀ x ∈ S, ¬x > Finset.sup t id
⊢ sSup ↑t ≤ sSup s

Next tactic:
exact sSup_le_sSup ht₁
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupFiniteCompact α
⊢ IsSupClosedCompact α

Next tactic:
intro s hne hsc
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  intro s hne hsc; 

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupFiniteCompact α
s : Set α
hne : Set.Nonempty s
hsc : SupClosed s
⊢ sSup s ∈ s

Next tactic:
obtain ⟨t, ht₁, ht₂⟩ := h s
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  intro s hne hsc; obtain ⟨t, ht₁, ht₂⟩ := h s; 

Proof state:
case intro.intro
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupFiniteCompact α
s : Set α
hne : Set.Nonempty s
hsc : SupClosed s
t : Finset α
ht₁ : ↑t ⊆ s
ht₂ : sSup s = Finset.sup t id
⊢ sSup s ∈ s

Next tactic:
clear h
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  intro s hne hsc; obtain ⟨t, ht₁, ht₂⟩ := h s; clear h
  

Proof state:
case intro.intro
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
s : Set α
hne : Set.Nonempty s
hsc : SupClosed s
t : Finset α
ht₁ : ↑t ⊆ s
ht₂ : sSup s = Finset.sup t id
⊢ sSup s ∈ s

Next tactic:
rcases t.eq_empty_or_nonempty with h | h
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  intro s hne hsc; obtain ⟨t, ht₁, ht₂⟩ := h s; clear h
  rcases t.eq_empty_or_nonempty with h | h
  · 

Proof state:
case intro.intro.inl
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
s : Set α
hne : Set.Nonempty s
hsc : SupClosed s
t : Finset α
ht₁ : ↑t ⊆ s
ht₂ : sSup s = Finset.sup t id
h : t = ∅
⊢ sSup s ∈ s

Next tactic:
subst h
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  intro s hne hsc; obtain ⟨t, ht₁, ht₂⟩ := h s; clear h
  rcases t.eq_empty_or_nonempty with h | h
  · subst h
    

Proof state:
case intro.intro.inl
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
s : Set α
hne : Set.Nonempty s
hsc : SupClosed s
ht₁ : ↑∅ ⊆ s
ht₂ : sSup s = Finset.sup ∅ id
⊢ sSup s ∈ s

Next tactic:
rw [Finset.sup_empty] at ht₂
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  intro s hne hsc; obtain ⟨t, ht₁, ht₂⟩ := h s; clear h
  rcases t.eq_empty_or_nonempty with h | h
  · subst h
    rw [Finset.sup_empty] at ht₂
    

Proof state:
case intro.intro.inl
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
s : Set α
hne : Set.Nonempty s
hsc : SupClosed s
ht₁ : ↑∅ ⊆ s
ht₂ : sSup s = ⊥
⊢ sSup s ∈ s

Next tactic:
rw [ht₂]
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  intro s hne hsc; obtain ⟨t, ht₁, ht₂⟩ := h s; clear h
  rcases t.eq_empty_or_nonempty with h | h
  · subst h
    rw [Finset.sup_empty] at ht₂
    rw [ht₂]
    

Proof state:
case intro.intro.inl
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
s : Set α
hne : Set.Nonempty s
hsc : SupClosed s
ht₁ : ↑∅ ⊆ s
ht₂ : sSup s = ⊥
⊢ ⊥ ∈ s

Next tactic:
simp [eq_singleton_bot_of_sSup_eq_bot_of_nonempty ht₂ hne]
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  intro s hne hsc; obtain ⟨t, ht₁, ht₂⟩ := h s; clear h
  rcases t.eq_empty_or_nonempty with h | h
  · subst h
    rw [Finset.sup_empty] at ht₂
    rw [ht₂]
    simp [eq_singleton_bot_of_sSup_eq_bot_of_nonempty ht₂ hne]
  · 

Proof state:
case intro.intro.inr
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
s : Set α
hne : Set.Nonempty s
hsc : SupClosed s
t : Finset α
ht₁ : ↑t ⊆ s
ht₂ : sSup s = Finset.sup t id
h : Finset.Nonempty t
⊢ sSup s ∈ s

Next tactic:
rw [ht₂]
theorem IsSupFiniteCompact.isSupClosedCompact (h : IsSupFiniteCompact α) :
    IsSupClosedCompact α := by
  intro s hne hsc; obtain ⟨t, ht₁, ht₂⟩ := h s; clear h
  rcases t.eq_empty_or_nonempty with h | h
  · subst h
    rw [Finset.sup_empty] at ht₂
    rw [ht₂]
    simp [eq_singleton_bot_of_sSup_eq_bot_of_nonempty ht₂ hne]
  · rw [ht₂]
    

Proof state:
case intro.intro.inr
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
s : Set α
hne : Set.Nonempty s
hsc : SupClosed s
t : Finset α
ht₁ : ↑t ⊆ s
ht₂ : sSup s = Finset.sup t id
h : Finset.Nonempty t
⊢ Finset.sup t id ∈ s

Next tactic:
exact hsc.finsetSup_mem h ht₁
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
⊢ WellFounded fun x x_1 => x > x_1

Next tactic:
refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
⊢ False

Next tactic:
suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    apply le_sSup
    apply Set.mem_range_self
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
this : sSup (range ⇑a) ∈ range ⇑a
⊢ False

Next tactic:
obtain ⟨n, hn⟩ := Set.mem_range.mp this
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    

Proof state:
case intro
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
this : sSup (range ⇑a) ∈ range ⇑a
n : ℕ
hn : a n = sSup (range ⇑a)
⊢ False

Next tactic:
have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
this : sSup (range ⇑a) ∈ range ⇑a
n : ℕ
hn : a n = sSup (range ⇑a)
⊢ sSup (range ⇑a) < a (n + 1)

Next tactic:
change _ > _
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
this : sSup (range ⇑a) ∈ range ⇑a
n : ℕ
hn : a n = sSup (range ⇑a)
⊢ a (n + 1) > sSup (range ⇑a)

Next tactic:
simp [← hn, a.map_rel_iff]
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    

Proof state:
case intro
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
this : sSup (range ⇑a) ∈ range ⇑a
n : ℕ
hn : a n = sSup (range ⇑a)
h' : sSup (range ⇑a) < a (n + 1)
⊢ False

Next tactic:
apply lt_irrefl (a (n + 1))
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    

Proof state:
case intro
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
this : sSup (range ⇑a) ∈ range ⇑a
n : ℕ
hn : a n = sSup (range ⇑a)
h' : sSup (range ⇑a) < a (n + 1)
⊢ a (n + 1) < a (n + 1)

Next tactic:
apply lt_of_le_of_lt _ h'
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
this : sSup (range ⇑a) ∈ range ⇑a
n : ℕ
hn : a n = sSup (range ⇑a)
h' : sSup (range ⇑a) < a (n + 1)
⊢ a (n + 1) ≤ sSup (range ⇑a)

Next tactic:
apply le_sSup
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    apply le_sSup
    

Proof state:
case a
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
this : sSup (range ⇑a) ∈ range ⇑a
n : ℕ
hn : a n = sSup (range ⇑a)
h' : sSup (range ⇑a) < a (n + 1)
⊢ a (n + 1) ∈ range ⇑a

Next tactic:
apply Set.mem_range_self
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    apply le_sSup
    apply Set.mem_range_self
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
⊢ sSup (range ⇑a) ∈ range ⇑a

Next tactic:
apply h (Set.range a)
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    apply le_sSup
    apply Set.mem_range_self
  apply h (Set.range a)
  · 

Proof state:
case x
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
⊢ Set.Nonempty (range ⇑a)

Next tactic:
use a 37
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    apply le_sSup
    apply Set.mem_range_self
  apply h (Set.range a)
  · use a 37
    

Proof state:
case h
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
⊢ a 37 ∈ range ⇑a

Next tactic:
apply Set.mem_range_self
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    apply le_sSup
    apply Set.mem_range_self
  apply h (Set.range a)
  · use a 37
    apply Set.mem_range_self
  · 

Proof state:
case a
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
⊢ SupClosed (range ⇑a)

Next tactic:
rintro x ⟨m, hm⟩ y ⟨n, hn⟩
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    apply le_sSup
    apply Set.mem_range_self
  apply h (Set.range a)
  · use a 37
    apply Set.mem_range_self
  · rintro x ⟨m, hm⟩ y ⟨n, hn⟩
    

Proof state:
case a.intro.intro
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
x : α
m : ℕ
hm : a m = x
y : α
n : ℕ
hn : a n = y
⊢ x ⊔ y ∈ range ⇑a

Next tactic:
use m ⊔ n
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    apply le_sSup
    apply Set.mem_range_self
  apply h (Set.range a)
  · use a 37
    apply Set.mem_range_self
  · rintro x ⟨m, hm⟩ y ⟨n, hn⟩
    use m ⊔ n
    

Proof state:
case h
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
x : α
m : ℕ
hm : a m = x
y : α
n : ℕ
hn : a n = y
⊢ a (m ⊔ n) = x ⊔ y

Next tactic:
rw [← hm, ← hn]
theorem IsSupClosedCompact.wellFounded (h : IsSupClosedCompact α) :
    WellFounded ((· > ·) : α → α → Prop) := by
  refine' RelEmbedding.wellFounded_iff_no_descending_seq.mpr ⟨fun a => _⟩
  suffices sSup (Set.range a) ∈ Set.range a by
    obtain ⟨n, hn⟩ := Set.mem_range.mp this
    have h' : sSup (Set.range a) < a (n + 1) := by
      change _ > _
      simp [← hn, a.map_rel_iff]
    apply lt_irrefl (a (n + 1))
    apply lt_of_le_of_lt _ h'
    apply le_sSup
    apply Set.mem_range_self
  apply h (Set.range a)
  · use a 37
    apply Set.mem_range_self
  · rintro x ⟨m, hm⟩ y ⟨n, hn⟩
    use m ⊔ n
    rw [← hm, ← hn]
    

Proof state:
case h
ι : Sort u_1
α : Type u_2
inst✝ : CompleteLattice α
f : ι → α
h : IsSupClosedCompact α
a : (fun x x_1 => x > x_1) ↪r fun x x_1 => x > x_1
x : α
m : ℕ
hm : a m = x
y : α
n : ℕ
hn : a n = y
⊢ a (m ⊔ n) = a m ⊔ a n

Next tactic:
apply RelHomClass.map_sup a