l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem Iic_sInf (S : Set α) : Iic (sInf S) = ⨅ a ∈ S, Iic a :=
  SetLike.ext fun c => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : CompleteLattice α
S : Set α
c : α
⊢ c ∈ Iic (sInf S) ↔ c ∈ ⨅ a ∈ S, Iic a

Next tactic:
simp only [mem_Iic_iff, mem_iInf₂_iff, le_sInf_iff]
@[simp]
theorem Iic_iInf (f : ι → α) : Iic (⨅ i, f i) = ⨅ i, Iic (f i) :=
  SetLike.ext fun c => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : CompleteLattice α
f : ι → α
c : α
⊢ c ∈ Iic (⨅ i, f i) ↔ c ∈ ⨅ i, Iic (f i)

Next tactic:
simp only [mem_Iic_iff, mem_iInf_iff, le_iInf_iff]
theorem Iic_iInf₂ (f : ∀ i, κ i → α) : Iic (⨅ (i) (j), f i j) = ⨅ (i) (j), Iic (f i j) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : CompleteLattice α
f : (i : ι) → κ i → α
⊢ Iic (⨅ i, ⨅ j, f i j) = ⨅ i, ⨅ j, Iic (f i j)

Next tactic:
simp_rw [Iic_iInf]
@[norm_cast]
theorem coe_upperClosure (s : Set α) : ↑(upperClosure s) = ⋃ a ∈ s, Ici a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
x : α
s : Set α
⊢ ↑(upperClosure s) = ⋃ a ∈ s, Ici a

Next tactic:
ext
@[norm_cast]
theorem coe_upperClosure (s : Set α) : ↑(upperClosure s) = ⋃ a ∈ s, Ici a := by
  ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
x : α
s : Set α
x✝ : α
⊢ x✝ ∈ ↑(upperClosure s) ↔ x✝ ∈ ⋃ a ∈ s, Ici a

Next tactic:
simp
@[norm_cast]
theorem coe_lowerClosure (s : Set α) : ↑(lowerClosure s) = ⋃ a ∈ s, Iic a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
x : α
s : Set α
⊢ ↑(lowerClosure s) = ⋃ a ∈ s, Iic a

Next tactic:
ext
@[norm_cast]
theorem coe_lowerClosure (s : Set α) : ↑(lowerClosure s) = ⋃ a ∈ s, Iic a := by
  ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
x : α
s : Set α
x✝ : α
⊢ x✝ ∈ ↑(lowerClosure s) ↔ x✝ ∈ ⋃ a ∈ s, Iic a

Next tactic:
simp
@[simp]
theorem upperClosure_image (f : α ≃o β) :
    upperClosure (f '' s) = UpperSet.map f (upperClosure s) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
f : α ≃o β
⊢ upperClosure (⇑f '' s) = (UpperSet.map f) (upperClosure s)

Next tactic:
rw [← f.symm_symm, ← UpperSet.symm_map, f.symm_symm]
@[simp]
theorem upperClosure_image (f : α ≃o β) :
    upperClosure (f '' s) = UpperSet.map f (upperClosure s) := by
  rw [← f.symm_symm, ← UpperSet.symm_map, f.symm_symm]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
f : α ≃o β
⊢ upperClosure (⇑f '' s) = (OrderIso.symm (UpperSet.map (OrderIso.symm f))) (upperClosure s)

Next tactic:
ext
@[simp]
theorem upperClosure_image (f : α ≃o β) :
    upperClosure (f '' s) = UpperSet.map f (upperClosure s) := by
  rw [← f.symm_symm, ← UpperSet.symm_map, f.symm_symm]
  ext
  

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
f : α ≃o β
x✝ : β
⊢ x✝ ∈ ↑(upperClosure (⇑f '' s)) ↔ x✝ ∈ ↑((OrderIso.symm (UpperSet.map (OrderIso.symm f))) (upperClosure s))

Next tactic:
simp [-UpperSet.symm_map, UpperSet.map, OrderIso.symm, ← f.le_symm_apply]
@[simp]
theorem lowerClosure_image (f : α ≃o β) :
    lowerClosure (f '' s) = LowerSet.map f (lowerClosure s) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
f : α ≃o β
⊢ lowerClosure (⇑f '' s) = (LowerSet.map f) (lowerClosure s)

Next tactic:
rw [← f.symm_symm, ← LowerSet.symm_map, f.symm_symm]
@[simp]
theorem lowerClosure_image (f : α ≃o β) :
    lowerClosure (f '' s) = LowerSet.map f (lowerClosure s) := by
  rw [← f.symm_symm, ← LowerSet.symm_map, f.symm_symm]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
f : α ≃o β
⊢ lowerClosure (⇑f '' s) = (OrderIso.symm (LowerSet.map (OrderIso.symm f))) (lowerClosure s)

Next tactic:
ext
@[simp]
theorem lowerClosure_image (f : α ≃o β) :
    lowerClosure (f '' s) = LowerSet.map f (lowerClosure s) := by
  rw [← f.symm_symm, ← LowerSet.symm_map, f.symm_symm]
  ext
  

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
f : α ≃o β
x✝ : β
⊢ x✝ ∈ ↑(lowerClosure (⇑f '' s)) ↔ x✝ ∈ ↑((OrderIso.symm (LowerSet.map (OrderIso.symm f))) (lowerClosure s))

Next tactic:
simp [-LowerSet.symm_map, LowerSet.map, OrderIso.symm, ← f.symm_apply_le]
@[simp]
theorem UpperSet.iInf_Ici (s : Set α) : ⨅ a ∈ s, UpperSet.Ici a = upperClosure s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
x : α
s : Set α
⊢ ⨅ a ∈ s, Ici a = upperClosure s

Next tactic:
ext
@[simp]
theorem UpperSet.iInf_Ici (s : Set α) : ⨅ a ∈ s, UpperSet.Ici a = upperClosure s := by
  ext
  

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
x : α
s : Set α
x✝ : α
⊢ x✝ ∈ ↑(⨅ a ∈ s, Ici a) ↔ x✝ ∈ ↑(upperClosure s)

Next tactic:
simp
@[simp]
theorem LowerSet.iSup_Iic (s : Set α) : ⨆ a ∈ s, LowerSet.Iic a = lowerClosure s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
x : α
s : Set α
⊢ ⨆ a ∈ s, Iic a = lowerClosure s

Next tactic:
ext
@[simp]
theorem LowerSet.iSup_Iic (s : Set α) : ⨆ a ∈ s, LowerSet.Iic a = lowerClosure s := by
  ext
  

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
x : α
s : Set α
x✝ : α
⊢ x✝ ∈ ↑(⨆ a ∈ s, Iic a) ↔ x✝ ∈ ↑(lowerClosure s)

Next tactic:
simp
@[simp]
theorem upperClosure_singleton (a : α) : upperClosure ({a} : Set α) = UpperSet.Ici a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x a : α
⊢ upperClosure {a} = UpperSet.Ici a

Next tactic:
ext
@[simp]
theorem upperClosure_singleton (a : α) : upperClosure ({a} : Set α) = UpperSet.Ici a := by
  ext
  

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x a x✝ : α
⊢ x✝ ∈ ↑(upperClosure {a}) ↔ x✝ ∈ ↑(UpperSet.Ici a)

Next tactic:
simp
@[simp]
theorem lowerClosure_singleton (a : α) : lowerClosure ({a} : Set α) = LowerSet.Iic a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x a : α
⊢ lowerClosure {a} = LowerSet.Iic a

Next tactic:
ext
@[simp]
theorem lowerClosure_singleton (a : α) : lowerClosure ({a} : Set α) = LowerSet.Iic a := by
  ext
  

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x a x✝ : α
⊢ x✝ ∈ ↑(lowerClosure {a}) ↔ x✝ ∈ ↑(LowerSet.Iic a)

Next tactic:
simp
@[simp]
theorem upperClosure_sUnion (S : Set (Set α)) : upperClosure (⋃₀ S) = ⨅ s ∈ S, upperClosure s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
S : Set (Set α)
⊢ upperClosure (⋃₀ S) = ⨅ s ∈ S, upperClosure s

Next tactic:
simp_rw [sUnion_eq_biUnion, upperClosure_iUnion]
@[simp]
theorem lowerClosure_sUnion (S : Set (Set α)) : lowerClosure (⋃₀ S) = ⨆ s ∈ S, lowerClosure s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
S : Set (Set α)
⊢ lowerClosure (⋃₀ S) = ⨆ s ∈ S, lowerClosure s

Next tactic:
simp_rw [sUnion_eq_biUnion, lowerClosure_iUnion]
theorem ordConnected_iff_upperClosure_inter_lowerClosure :
    s.OrdConnected ↔ ↑(upperClosure s) ∩ ↑(lowerClosure s) = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
⊢ OrdConnected s ↔ ↑(upperClosure s) ∩ ↑(lowerClosure s) = s

Next tactic:
refine' ⟨Set.OrdConnected.upperClosure_inter_lowerClosure, fun h => _⟩
theorem ordConnected_iff_upperClosure_inter_lowerClosure :
    s.OrdConnected ↔ ↑(upperClosure s) ∩ ↑(lowerClosure s) = s := by
  refine' ⟨Set.OrdConnected.upperClosure_inter_lowerClosure, fun h => _⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
h : ↑(upperClosure s) ∩ ↑(lowerClosure s) = s
⊢ OrdConnected s

Next tactic:
rw [← h]
theorem ordConnected_iff_upperClosure_inter_lowerClosure :
    s.OrdConnected ↔ ↑(upperClosure s) ∩ ↑(lowerClosure s) = s := by
  refine' ⟨Set.OrdConnected.upperClosure_inter_lowerClosure, fun h => _⟩
  rw [← h]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
h : ↑(upperClosure s) ∩ ↑(lowerClosure s) = s
⊢ OrdConnected (↑(upperClosure s) ∩ ↑(lowerClosure s))

Next tactic:
exact (UpperSet.upper _).ordConnected.inter (LowerSet.lower _).ordConnected
@[simp]
theorem bddAbove_lowerClosure : BddAbove (lowerClosure s : Set α) ↔ BddAbove s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
⊢ BddAbove ↑(lowerClosure s) ↔ BddAbove s

Next tactic:
simp_rw [BddAbove, upperBounds_lowerClosure]
@[simp]
theorem bddBelow_upperClosure : BddBelow (upperClosure s : Set α) ↔ BddBelow s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
⊢ BddBelow ↑(upperClosure s) ↔ BddBelow s

Next tactic:
simp_rw [BddBelow, lowerBounds_upperClosure]
@[simp] lemma IsLowerSet.disjoint_upperClosure_left (ht : IsLowerSet t) :
    Disjoint ↑(upperClosure s) t ↔ Disjoint s t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
ht : IsLowerSet t
⊢ Disjoint (↑(upperClosure s)) t ↔ Disjoint s t

Next tactic:
refine ⟨Disjoint.mono_left subset_upperClosure, ?_⟩
@[simp] lemma IsLowerSet.disjoint_upperClosure_left (ht : IsLowerSet t) :
    Disjoint ↑(upperClosure s) t ↔ Disjoint s t := by
  refine ⟨Disjoint.mono_left subset_upperClosure, ?_⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
ht : IsLowerSet t
⊢ Disjoint s t → Disjoint (↑(upperClosure s)) t

Next tactic:
simp only [disjoint_left, SetLike.mem_coe, mem_upperClosure, forall_exists_index, and_imp]
@[simp] lemma IsLowerSet.disjoint_upperClosure_left (ht : IsLowerSet t) :
    Disjoint ↑(upperClosure s) t ↔ Disjoint s t := by
  refine ⟨Disjoint.mono_left subset_upperClosure, ?_⟩
  simp only [disjoint_left, SetLike.mem_coe, mem_upperClosure, forall_exists_index, and_imp]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
ht : IsLowerSet t
⊢ (∀ ⦃a : α⦄, a ∈ s → a ∉ t) → ∀ ⦃a : α⦄, ∀ x ∈ s, x ≤ a → a ∉ t

Next tactic:
exact fun h a b hb hba ha ↦ h hb $ ht hba ha
@[simp] lemma IsLowerSet.disjoint_upperClosure_right (hs : IsLowerSet s) :
    Disjoint s (upperClosure t) ↔ Disjoint s t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
x : α
hs : IsLowerSet s
⊢ Disjoint s ↑(upperClosure t) ↔ Disjoint s t

Next tactic:
simpa only [disjoint_comm] using hs.disjoint_upperClosure_left
@[simp] lemma sdiff_singleton (s : LowerSet α) (a : α) : s.sdiff {a} = s.erase a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s✝ : LowerSet α
t : Set α
a✝ : α
s : LowerSet α
a : α
⊢ sdiff s {a} = erase s a

Next tactic:
simp [sdiff, erase]
@[simp] protected lemma sdiff_eq_left : s.sdiff t = s ↔ Disjoint ↑s t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a : α
⊢ sdiff s t = s ↔ Disjoint (↑s) t

Next tactic:
simp [← SetLike.coe_set_eq]
@[simp] lemma erase_eq : s.erase a = s ↔ a ∉ s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a : α
⊢ erase s a = s ↔ a ∉ s

Next tactic:
rw [← sdiff_singleton]
@[simp] lemma erase_eq : s.erase a = s ↔ a ∉ s := by rw [← sdiff_singleton]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a : α
⊢ sdiff s {a} = s ↔ a ∉ s

Next tactic:
simp [-sdiff_singleton]
lemma sdiff_sup_lowerClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t) :
    s.sdiff t ⊔ lowerClosure t = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t
⊢ sdiff s t ⊔ lowerClosure t = s

Next tactic:
refine' le_antisymm (sup_le sdiff_le_left $ lowerClosure_le.2 hts) fun a ha ↦ _
lemma sdiff_sup_lowerClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t) :
    s.sdiff t ⊔ lowerClosure t = s := by
  refine' le_antisymm (sup_le sdiff_le_left $ lowerClosure_le.2 hts) fun a ha ↦ _
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t
a : α
ha : a ∈ ↑s
⊢ a ∈ ↑(sdiff s t ⊔ lowerClosure t)

Next tactic:
obtain hat | hat := em (a ∈ t)
lemma sdiff_sup_lowerClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t) :
    s.sdiff t ⊔ lowerClosure t = s := by
  refine' le_antisymm (sup_le sdiff_le_left $ lowerClosure_le.2 hts) fun a ha ↦ _
  obtain hat | hat := em (a ∈ t)
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t
a : α
ha : a ∈ ↑s
hat : a ∈ t
⊢ a ∈ ↑(sdiff s t ⊔ lowerClosure t)

Next tactic:
exact subset_union_right _ _ (subset_lowerClosure hat)
lemma sdiff_sup_lowerClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t) :
    s.sdiff t ⊔ lowerClosure t = s := by
  refine' le_antisymm (sup_le sdiff_le_left $ lowerClosure_le.2 hts) fun a ha ↦ _
  obtain hat | hat := em (a ∈ t)
  · exact subset_union_right _ _ (subset_lowerClosure hat)
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t
a : α
ha : a ∈ ↑s
hat : a ∉ t
⊢ a ∈ ↑(sdiff s t ⊔ lowerClosure t)

Next tactic:
refine subset_union_left _ _ ⟨ha, ?_⟩
lemma sdiff_sup_lowerClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t) :
    s.sdiff t ⊔ lowerClosure t = s := by
  refine' le_antisymm (sup_le sdiff_le_left $ lowerClosure_le.2 hts) fun a ha ↦ _
  obtain hat | hat := em (a ∈ t)
  · exact subset_union_right _ _ (subset_lowerClosure hat)
  · refine subset_union_left _ _ ⟨ha, ?_⟩
    

Proof state:
case inr
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t
a : α
ha : a ∈ ↑s
hat : a ∉ t
⊢ a ∉ ↑(upperClosure t)

Next tactic:
rintro ⟨b, hb, hba⟩
lemma sdiff_sup_lowerClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t) :
    s.sdiff t ⊔ lowerClosure t = s := by
  refine' le_antisymm (sup_le sdiff_le_left $ lowerClosure_le.2 hts) fun a ha ↦ _
  obtain hat | hat := em (a ∈ t)
  · exact subset_union_right _ _ (subset_lowerClosure hat)
  · refine subset_union_left _ _ ⟨ha, ?_⟩
    rintro ⟨b, hb, hba⟩
    

Proof state:
case inr.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t
a : α
ha : a ∈ ↑s
hat : a ∉ t
b : α
hb : b ∈ t
hba : b ≤ a
⊢ False

Next tactic:
exact hat $ hst _ ha _ hb hba
lemma lowerClosure_sup_sdiff (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t) :
    lowerClosure t ⊔ s.sdiff t = s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, c ≤ b → b ∈ t
⊢ lowerClosure t ⊔ sdiff s t = s

Next tactic:
rw [sup_comm, sdiff_sup_lowerClosure hts hst]
lemma erase_sup_Iic (ha : a ∈ s) (has : ∀ b ∈ s, a ≤ b → b = a) : s.erase a ⊔ Iic a = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a : α
ha : a ∈ s
has : ∀ b ∈ s, a ≤ b → b = a
⊢ erase s a ⊔ Iic a = s

Next tactic:
rw [← lowerClosure_singleton, ← sdiff_singleton, sdiff_sup_lowerClosure]
lemma erase_sup_Iic (ha : a ∈ s) (has : ∀ b ∈ s, a ≤ b → b = a) : s.erase a ⊔ Iic a = s := by
  rw [← lowerClosure_singleton, ← sdiff_singleton, sdiff_sup_lowerClosure] <;> 

Proof state:
case hts
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a : α
ha : a ∈ s
has : ∀ b ∈ s, a ≤ b → b = a
⊢ {a} ⊆ ↑s

Next tactic:
simpa
lemma erase_sup_Iic (ha : a ∈ s) (has : ∀ b ∈ s, a ≤ b → b = a) : s.erase a ⊔ Iic a = s := by
  rw [← lowerClosure_singleton, ← sdiff_singleton, sdiff_sup_lowerClosure] <;> 

Proof state:
case hst
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a : α
ha : a ∈ s
has : ∀ b ∈ s, a ≤ b → b = a
⊢ ∀ b ∈ s, ∀ c ∈ {a}, c ≤ b → b ∈ {a}

Next tactic:
simpa
lemma Iic_sup_erase (ha : a ∈ s) (has : ∀ b ∈ s, a ≤ b → b = a) : Iic a ⊔ s.erase a = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : LowerSet α
t : Set α
a : α
ha : a ∈ s
has : ∀ b ∈ s, a ≤ b → b = a
⊢ Iic a ⊔ erase s a = s

Next tactic:
rw [sup_comm, erase_sup_Iic ha has]
@[simp] lemma sdiff_singleton (s : UpperSet α) (a : α) : s.sdiff {a} = s.erase a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s✝ : UpperSet α
t : Set α
a✝ : α
s : UpperSet α
a : α
⊢ sdiff s {a} = erase s a

Next tactic:
simp [sdiff, erase]
@[simp] protected lemma sdiff_eq_left : s.sdiff t = s ↔ Disjoint ↑s t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a : α
⊢ sdiff s t = s ↔ Disjoint (↑s) t

Next tactic:
simp [← SetLike.coe_set_eq]
@[simp] lemma erase_eq : s.erase a = s ↔ a ∉ s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a : α
⊢ erase s a = s ↔ a ∉ s

Next tactic:
rw [← sdiff_singleton]
@[simp] lemma erase_eq : s.erase a = s ↔ a ∉ s := by rw [← sdiff_singleton]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a : α
⊢ sdiff s {a} = s ↔ a ∉ s

Next tactic:
simp [-sdiff_singleton]
lemma sdiff_inf_upperClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t) :
    s.sdiff t ⊓ upperClosure t = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t
⊢ sdiff s t ⊓ upperClosure t = s

Next tactic:
refine' ge_antisymm (le_inf le_sdiff_left $ le_upperClosure.2 hts) fun a ha ↦ _
lemma sdiff_inf_upperClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t) :
    s.sdiff t ⊓ upperClosure t = s := by
  refine' ge_antisymm (le_inf le_sdiff_left $ le_upperClosure.2 hts) fun a ha ↦ _
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t
a : α
ha : a ∈ (⇑toDual ∘ SetLike.coe) s
⊢ a ∈ (⇑toDual ∘ SetLike.coe) (sdiff s t ⊓ upperClosure t)

Next tactic:
obtain hat | hat := em (a ∈ t)
lemma sdiff_inf_upperClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t) :
    s.sdiff t ⊓ upperClosure t = s := by
  refine' ge_antisymm (le_inf le_sdiff_left $ le_upperClosure.2 hts) fun a ha ↦ _
  obtain hat | hat := em (a ∈ t)
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t
a : α
ha : a ∈ (⇑toDual ∘ SetLike.coe) s
hat : a ∈ t
⊢ a ∈ (⇑toDual ∘ SetLike.coe) (sdiff s t ⊓ upperClosure t)

Next tactic:
exact subset_union_right _ _ (subset_upperClosure hat)
lemma sdiff_inf_upperClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t) :
    s.sdiff t ⊓ upperClosure t = s := by
  refine' ge_antisymm (le_inf le_sdiff_left $ le_upperClosure.2 hts) fun a ha ↦ _
  obtain hat | hat := em (a ∈ t)
  · exact subset_union_right _ _ (subset_upperClosure hat)
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t
a : α
ha : a ∈ (⇑toDual ∘ SetLike.coe) s
hat : a ∉ t
⊢ a ∈ (⇑toDual ∘ SetLike.coe) (sdiff s t ⊓ upperClosure t)

Next tactic:
refine subset_union_left _ _ ⟨ha, ?_⟩
lemma sdiff_inf_upperClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t) :
    s.sdiff t ⊓ upperClosure t = s := by
  refine' ge_antisymm (le_inf le_sdiff_left $ le_upperClosure.2 hts) fun a ha ↦ _
  obtain hat | hat := em (a ∈ t)
  · exact subset_union_right _ _ (subset_upperClosure hat)
  · refine subset_union_left _ _ ⟨ha, ?_⟩
    

Proof state:
case inr
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t
a : α
ha : a ∈ (⇑toDual ∘ SetLike.coe) s
hat : a ∉ t
⊢ a ∉ ↑(lowerClosure t)

Next tactic:
rintro ⟨b, hb, hab⟩
lemma sdiff_inf_upperClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t) :
    s.sdiff t ⊓ upperClosure t = s := by
  refine' ge_antisymm (le_inf le_sdiff_left $ le_upperClosure.2 hts) fun a ha ↦ _
  obtain hat | hat := em (a ∈ t)
  · exact subset_union_right _ _ (subset_upperClosure hat)
  · refine subset_union_left _ _ ⟨ha, ?_⟩
    rintro ⟨b, hb, hab⟩
    

Proof state:
case inr.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a✝ : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t
a : α
ha : a ∈ (⇑toDual ∘ SetLike.coe) s
hat : a ∉ t
b : α
hb : b ∈ t
hab : a ≤ b
⊢ False

Next tactic:
exact hat $ hst _ ha _ hb hab
lemma upperClosure_inf_sdiff (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t) :
    upperClosure t ⊓ s.sdiff t = s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a : α
hts : t ⊆ ↑s
hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t
⊢ upperClosure t ⊓ sdiff s t = s

Next tactic:
rw [inf_comm, sdiff_inf_upperClosure hts hst]
lemma erase_inf_Ici (ha : a ∈ s) (has : ∀ b ∈ s, b ≤ a → b = a) : s.erase a ⊓ Ici a = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a : α
ha : a ∈ s
has : ∀ b ∈ s, b ≤ a → b = a
⊢ erase s a ⊓ Ici a = s

Next tactic:
rw [← upperClosure_singleton, ← sdiff_singleton, sdiff_inf_upperClosure]