l3lab/ntp-mathlib huggingface dataset:
/-- If `μ i` is a countable family of outer measures, then for every set `s` there exists
a measurable set `t ⊇ s` such that `μ i t = (μ i).trim s` for all `i`. -/
theorem exists_measurable_superset_forall_eq_trim {ι} [Countable ι] (μ : ι → OuterMeasure α)
    (s : Set α) : ∃ t, s ⊆ t ∧ MeasurableSet t ∧ ∀ i, μ i t = (μ i).trim s := by
  choose t hst ht hμt using fun i => (μ i).exists_measurable_superset_eq_trim s
  replace hst := subset_iInter hst
  

Proof state:
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
s : Set α
t : ι → Set α
ht : ∀ (i : ι), MeasurableSet (t i)
hμt : ∀ (i : ι), ↑(μ i) (t i) = ↑(trim (μ i)) s
hst : s ⊆ ⋂ i, t i
⊢ ∃ t, s ⊆ t ∧ MeasurableSet t ∧ ∀ (i : ι), ↑(μ i) t = ↑(trim (μ i)) s

Next tactic:
replace ht := MeasurableSet.iInter ht
/-- If `μ i` is a countable family of outer measures, then for every set `s` there exists
a measurable set `t ⊇ s` such that `μ i t = (μ i).trim s` for all `i`. -/
theorem exists_measurable_superset_forall_eq_trim {ι} [Countable ι] (μ : ι → OuterMeasure α)
    (s : Set α) : ∃ t, s ⊆ t ∧ MeasurableSet t ∧ ∀ i, μ i t = (μ i).trim s := by
  choose t hst ht hμt using fun i => (μ i).exists_measurable_superset_eq_trim s
  replace hst := subset_iInter hst
  replace ht := MeasurableSet.iInter ht
  

Proof state:
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
s : Set α
t : ι → Set α
hμt : ∀ (i : ι), ↑(μ i) (t i) = ↑(trim (μ i)) s
hst : s ⊆ ⋂ i, t i
ht : MeasurableSet (⋂ b, t b)
⊢ ∃ t, s ⊆ t ∧ MeasurableSet t ∧ ∀ (i : ι), ↑(μ i) t = ↑(trim (μ i)) s

Next tactic:
refine' ⟨⋂ i, t i, hst, ht, fun i => le_antisymm _ _⟩
/-- If `μ i` is a countable family of outer measures, then for every set `s` there exists
a measurable set `t ⊇ s` such that `μ i t = (μ i).trim s` for all `i`. -/
theorem exists_measurable_superset_forall_eq_trim {ι} [Countable ι] (μ : ι → OuterMeasure α)
    (s : Set α) : ∃ t, s ⊆ t ∧ MeasurableSet t ∧ ∀ i, μ i t = (μ i).trim s := by
  choose t hst ht hμt using fun i => (μ i).exists_measurable_superset_eq_trim s
  replace hst := subset_iInter hst
  replace ht := MeasurableSet.iInter ht
  refine' ⟨⋂ i, t i, hst, ht, fun i => le_antisymm _ _⟩
  

Proof state:
case refine'_1
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
s : Set α
t : ι → Set α
hμt : ∀ (i : ι), ↑(μ i) (t i) = ↑(trim (μ i)) s
hst : s ⊆ ⋂ i, t i
ht : MeasurableSet (⋂ b, t b)
i : ι
⊢ ↑(μ i) (⋂ i, t i) ≤ ↑(trim (μ i)) s
case refine'_2
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
s : Set α
t : ι → Set α
hμt : ∀ (i : ι), ↑(μ i) (t i) = ↑(trim (μ i)) s
hst : s ⊆ ⋂ i, t i
ht : MeasurableSet (⋂ b, t b)
i : ι
⊢ ↑(trim (μ i)) s ≤ ↑(μ i) (⋂ i, t i)

Next tactic:
exacts [hμt i ▸ (μ i).mono (iInter_subset _ _), (mono' _ hst).trans_eq ((μ i).trim_eq ht)]
/-- If `m₁ s = op (m₂ s) (m₃ s)` for all `s`, then the same is true for `m₁.trim`, `m₂.trim`,
and `m₃ s`. -/
theorem trim_binop {m₁ m₂ m₃ : OuterMeasure α} {op : ℝ≥0∞ → ℝ≥0∞ → ℝ≥0∞}
    (h : ∀ s, m₁ s = op (m₂ s) (m₃ s)) (s : Set α) : m₁.trim s = op (m₂.trim s) (m₃.trim s) := by
  

Proof state:
α : Type u_1
inst✝ : MeasurableSpace α
m m₁ m₂ m₃ : OuterMeasure α
op : ℝ≥0∞ → ℝ≥0∞ → ℝ≥0∞
h : ∀ (s : Set α), ↑m₁ s = op (↑m₂ s) (↑m₃ s)
s : Set α
⊢ ↑(trim m₁) s = op (↑(trim m₂) s) (↑(trim m₃) s)

Next tactic:
rcases exists_measurable_superset_forall_eq_trim ![m₁, m₂, m₃] s with ⟨t, _hst, _ht, htm⟩
/-- If `m₁ s = op (m₂ s) (m₃ s)` for all `s`, then the same is true for `m₁.trim`, `m₂.trim`,
and `m₃ s`. -/
theorem trim_binop {m₁ m₂ m₃ : OuterMeasure α} {op : ℝ≥0∞ → ℝ≥0∞ → ℝ≥0∞}
    (h : ∀ s, m₁ s = op (m₂ s) (m₃ s)) (s : Set α) : m₁.trim s = op (m₂.trim s) (m₃.trim s) := by
  rcases exists_measurable_superset_forall_eq_trim ![m₁, m₂, m₃] s with ⟨t, _hst, _ht, htm⟩
  

Proof state:
case intro.intro.intro
α : Type u_1
inst✝ : MeasurableSpace α
m m₁ m₂ m₃ : OuterMeasure α
op : ℝ≥0∞ → ℝ≥0∞ → ℝ≥0∞
h : ∀ (s : Set α), ↑m₁ s = op (↑m₂ s) (↑m₃ s)
s t : Set α
_hst : s ⊆ t
_ht : MeasurableSet t
htm :
  ∀ (i : Fin (Nat.succ (Nat.succ (Nat.succ 0)))),
    ↑(Matrix.vecCons m₁ ![m₂, m₃] i) t = ↑(trim (Matrix.vecCons m₁ ![m₂, m₃] i)) s
⊢ ↑(trim m₁) s = op (↑(trim m₂) s) (↑(trim m₃) s)

Next tactic:
simp only [Fin.forall_fin_succ, Matrix.cons_val_zero, Matrix.cons_val_succ] at htm
/-- If `m₁ s = op (m₂ s) (m₃ s)` for all `s`, then the same is true for `m₁.trim`, `m₂.trim`,
and `m₃ s`. -/
theorem trim_binop {m₁ m₂ m₃ : OuterMeasure α} {op : ℝ≥0∞ → ℝ≥0∞ → ℝ≥0∞}
    (h : ∀ s, m₁ s = op (m₂ s) (m₃ s)) (s : Set α) : m₁.trim s = op (m₂.trim s) (m₃.trim s) := by
  rcases exists_measurable_superset_forall_eq_trim ![m₁, m₂, m₃] s with ⟨t, _hst, _ht, htm⟩
  simp only [Fin.forall_fin_succ, Matrix.cons_val_zero, Matrix.cons_val_succ] at htm
  

Proof state:
case intro.intro.intro
α : Type u_1
inst✝ : MeasurableSpace α
m m₁ m₂ m₃ : OuterMeasure α
op : ℝ≥0∞ → ℝ≥0∞ → ℝ≥0∞
h : ∀ (s : Set α), ↑m₁ s = op (↑m₂ s) (↑m₃ s)
s t : Set α
_hst : s ⊆ t
_ht : MeasurableSet t
htm : ↑m₁ t = ↑(trim m₁) s ∧ ↑m₂ t = ↑(trim m₂) s ∧ ↑m₃ t = ↑(trim m₃) s ∧ ∀ (i : Fin 0), ↑![] t = ↑(trim ![]) s
⊢ ↑(trim m₁) s = op (↑(trim m₂) s) (↑(trim m₃) s)

Next tactic:
rw [← htm.1, ← htm.2.1, ← htm.2.2.1, h]
/-- `trim` sends the supremum of a countable family of outer measures to the supremum
of the trimmed measures. -/
theorem trim_iSup {ι} [Countable ι] (μ : ι → OuterMeasure α) :
    trim (⨆ i, μ i) = ⨆ i, trim (μ i) := by
  

Proof state:
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
⊢ trim (⨆ i, μ i) = ⨆ i, trim (μ i)

Next tactic:
simp_rw [← @iSup_plift_down _ ι]
/-- `trim` sends the supremum of a countable family of outer measures to the supremum
of the trimmed measures. -/
theorem trim_iSup {ι} [Countable ι] (μ : ι → OuterMeasure α) :
    trim (⨆ i, μ i) = ⨆ i, trim (μ i) := by
  simp_rw [← @iSup_plift_down _ ι]
  

Proof state:
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
⊢ trim (⨆ i, μ i.down) = ⨆ i, trim (μ i.down)

Next tactic:
ext1 s
/-- `trim` sends the supremum of a countable family of outer measures to the supremum
of the trimmed measures. -/
theorem trim_iSup {ι} [Countable ι] (μ : ι → OuterMeasure α) :
    trim (⨆ i, μ i) = ⨆ i, trim (μ i) := by
  simp_rw [← @iSup_plift_down _ ι]
  ext1 s
  

Proof state:
case h
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
s : Set α
⊢ ↑(trim (⨆ i, μ i.down)) s = ↑(⨆ i, trim (μ i.down)) s

Next tactic:
obtain ⟨t, _, _, hμt⟩ :=
    exists_measurable_superset_forall_eq_trim
      (Option.elim' (⨆ i, μ (PLift.down i)) (μ ∘ PLift.down)) s
/-- `trim` sends the supremum of a countable family of outer measures to the supremum
of the trimmed measures. -/
theorem trim_iSup {ι} [Countable ι] (μ : ι → OuterMeasure α) :
    trim (⨆ i, μ i) = ⨆ i, trim (μ i) := by
  simp_rw [← @iSup_plift_down _ ι]
  ext1 s
  obtain ⟨t, _, _, hμt⟩ :=
    exists_measurable_superset_forall_eq_trim
      (Option.elim' (⨆ i, μ (PLift.down i)) (μ ∘ PLift.down)) s
  

Proof state:
case h.intro.intro.intro
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
s t : Set α
left✝¹ : s ⊆ t
left✝ : MeasurableSet t
hμt :
  ∀ (i : Option (PLift ι)),
    ↑(Option.elim' (⨆ i, μ i.down) (μ ∘ PLift.down) i) t = ↑(trim (Option.elim' (⨆ i, μ i.down) (μ ∘ PLift.down) i)) s
⊢ ↑(trim (⨆ i, μ i.down)) s = ↑(⨆ i, trim (μ i.down)) s

Next tactic:
simp only [Option.forall, Option.elim'] at hμt
/-- `trim` sends the supremum of a countable family of outer measures to the supremum
of the trimmed measures. -/
theorem trim_iSup {ι} [Countable ι] (μ : ι → OuterMeasure α) :
    trim (⨆ i, μ i) = ⨆ i, trim (μ i) := by
  simp_rw [← @iSup_plift_down _ ι]
  ext1 s
  obtain ⟨t, _, _, hμt⟩ :=
    exists_measurable_superset_forall_eq_trim
      (Option.elim' (⨆ i, μ (PLift.down i)) (μ ∘ PLift.down)) s
  simp only [Option.forall, Option.elim'] at hμt
  

Proof state:
case h.intro.intro.intro
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
s t : Set α
left✝¹ : s ⊆ t
left✝ : MeasurableSet t
hμt :
  ↑(⨆ i, μ i.down) t = ↑(trim (⨆ i, μ i.down)) s ∧
    ∀ (x : PLift ι), ↑((μ ∘ PLift.down) x) t = ↑(trim ((μ ∘ PLift.down) x)) s
⊢ ↑(trim (⨆ i, μ i.down)) s = ↑(⨆ i, trim (μ i.down)) s

Next tactic:
simp only [iSup_apply, ← hμt.1]
/-- `trim` sends the supremum of a countable family of outer measures to the supremum
of the trimmed measures. -/
theorem trim_iSup {ι} [Countable ι] (μ : ι → OuterMeasure α) :
    trim (⨆ i, μ i) = ⨆ i, trim (μ i) := by
  simp_rw [← @iSup_plift_down _ ι]
  ext1 s
  obtain ⟨t, _, _, hμt⟩ :=
    exists_measurable_superset_forall_eq_trim
      (Option.elim' (⨆ i, μ (PLift.down i)) (μ ∘ PLift.down)) s
  simp only [Option.forall, Option.elim'] at hμt
  simp only [iSup_apply, ← hμt.1]
  

Proof state:
case h.intro.intro.intro
α : Type u_1
inst✝¹ : MeasurableSpace α
m : OuterMeasure α
ι : Sort u_2
inst✝ : Countable ι
μ : ι → OuterMeasure α
s t : Set α
left✝¹ : s ⊆ t
left✝ : MeasurableSet t
hμt :
  ↑(⨆ i, μ i.down) t = ↑(trim (⨆ i, μ i.down)) s ∧
    ∀ (x : PLift ι), ↑((μ ∘ PLift.down) x) t = ↑(trim ((μ ∘ PLift.down) x)) s
⊢ ⨆ i, ↑(μ i.down) t = ⨆ i, ↑(trim (μ i.down)) s

Next tactic:
exact iSup_congr hμt.2
/-- The trimmed property of a measure μ states that `μ.toOuterMeasure.trim = μ.toOuterMeasure`.
This theorem shows that a restricted trimmed outer measure is a trimmed outer measure. -/
theorem restrict_trim {μ : OuterMeasure α} {s : Set α} (hs : MeasurableSet s) :
    (restrict s μ).trim = restrict s μ.trim := by
  

Proof state:
α : Type u_1
inst✝ : MeasurableSpace α
m μ : OuterMeasure α
s : Set α
hs : MeasurableSet s
⊢ trim ((restrict s) μ) = (restrict s) (trim μ)

Next tactic:
refine' le_antisymm (fun t => _) (le_trim_iff.2 fun t ht => _)
/-- The trimmed property of a measure μ states that `μ.toOuterMeasure.trim = μ.toOuterMeasure`.
This theorem shows that a restricted trimmed outer measure is a trimmed outer measure. -/
theorem restrict_trim {μ : OuterMeasure α} {s : Set α} (hs : MeasurableSet s) :
    (restrict s μ).trim = restrict s μ.trim := by
  refine' le_antisymm (fun t => _) (le_trim_iff.2 fun t ht => _)
  · 

Proof state:
case refine'_1
α : Type u_1
inst✝ : MeasurableSpace α
m μ : OuterMeasure α
s : Set α
hs : MeasurableSet s
t : Set α
⊢ ↑(trim ((restrict s) μ)) t ≤ ↑((restrict s) (trim μ)) t

Next tactic:
rw [restrict_apply]
/-- The trimmed property of a measure μ states that `μ.toOuterMeasure.trim = μ.toOuterMeasure`.
This theorem shows that a restricted trimmed outer measure is a trimmed outer measure. -/
theorem restrict_trim {μ : OuterMeasure α} {s : Set α} (hs : MeasurableSet s) :
    (restrict s μ).trim = restrict s μ.trim := by
  refine' le_antisymm (fun t => _) (le_trim_iff.2 fun t ht => _)
  · rw [restrict_apply]
    

Proof state:
case refine'_1
α : Type u_1
inst✝ : MeasurableSpace α
m μ : OuterMeasure α
s : Set α
hs : MeasurableSet s
t : Set α
⊢ ↑(trim ((restrict s) μ)) t ≤ ↑(trim μ) (t ∩ s)

Next tactic:
rcases μ.exists_measurable_superset_eq_trim (t ∩ s) with ⟨t', htt', ht', hμt'⟩
/-- The trimmed property of a measure μ states that `μ.toOuterMeasure.trim = μ.toOuterMeasure`.
This theorem shows that a restricted trimmed outer measure is a trimmed outer measure. -/
theorem restrict_trim {μ : OuterMeasure α} {s : Set α} (hs : MeasurableSet s) :
    (restrict s μ).trim = restrict s μ.trim := by
  refine' le_antisymm (fun t => _) (le_trim_iff.2 fun t ht => _)
  · rw [restrict_apply]
    rcases μ.exists_measurable_superset_eq_trim (t ∩ s) with ⟨t', htt', ht', hμt'⟩
    

Proof state:
case refine'_1.intro.intro.intro
α : Type u_1
inst✝ : MeasurableSpace α
m μ : OuterMeasure α
s : Set α
hs : MeasurableSet s
t t' : Set α
htt' : t ∩ s ⊆ t'
ht' : MeasurableSet t'
hμt' : ↑μ t' = ↑(trim μ) (t ∩ s)
⊢ ↑(trim ((restrict s) μ)) t ≤ ↑(trim μ) (t ∩ s)

Next tactic:
rw [← hμt']
/-- The trimmed property of a measure μ states that `μ.toOuterMeasure.trim = μ.toOuterMeasure`.
This theorem shows that a restricted trimmed outer measure is a trimmed outer measure. -/
theorem restrict_trim {μ : OuterMeasure α} {s : Set α} (hs : MeasurableSet s) :
    (restrict s μ).trim = restrict s μ.trim := by
  refine' le_antisymm (fun t => _) (le_trim_iff.2 fun t ht => _)
  · rw [restrict_apply]
    rcases μ.exists_measurable_superset_eq_trim (t ∩ s) with ⟨t', htt', ht', hμt'⟩
    rw [← hμt']
    

Proof state:
case refine'_1.intro.intro.intro
α : Type u_1
inst✝ : MeasurableSpace α
m μ : OuterMeasure α
s : Set α
hs : MeasurableSet s
t t' : Set α
htt' : t ∩ s ⊆ t'
ht' : MeasurableSet t'
hμt' : ↑μ t' = ↑(trim μ) (t ∩ s)
⊢ ↑(trim ((restrict s) μ)) t ≤ ↑μ t'

Next tactic:
rw [inter_subset] at htt'
/-- The trimmed property of a measure μ states that `μ.toOuterMeasure.trim = μ.toOuterMeasure`.
This theorem shows that a restricted trimmed outer measure is a trimmed outer measure. -/
theorem restrict_trim {μ : OuterMeasure α} {s : Set α} (hs : MeasurableSet s) :
    (restrict s μ).trim = restrict s μ.trim := by
  refine' le_antisymm (fun t => _) (le_trim_iff.2 fun t ht => _)
  · rw [restrict_apply]
    rcases μ.exists_measurable_superset_eq_trim (t ∩ s) with ⟨t', htt', ht', hμt'⟩
    rw [← hμt']
    rw [inter_subset] at htt'
    

Proof state:
case refine'_1.intro.intro.intro
α : Type u_1
inst✝ : MeasurableSpace α
m μ : OuterMeasure α
s : Set α
hs : MeasurableSet s
t t' : Set α
htt' : t ⊆ sᶜ ∪ t'
ht' : MeasurableSet t'
hμt' : ↑μ t' = ↑(trim μ) (t ∩ s)
⊢ ↑(trim ((restrict s) μ)) t ≤ ↑μ t'

Next tactic:
refine' (mono' _ htt').trans _
/-- The trimmed property of a measure μ states that `μ.toOuterMeasure.trim = μ.toOuterMeasure`.
This theorem shows that a restricted trimmed outer measure is a trimmed outer measure. -/
theorem restrict_trim {μ : OuterMeasure α} {s : Set α} (hs : MeasurableSet s) :
    (restrict s μ).trim = restrict s μ.trim := by
  refine' le_antisymm (fun t => _) (le_trim_iff.2 fun t ht => _)
  · rw [restrict_apply]
    rcases μ.exists_measurable_superset_eq_trim (t ∩ s) with ⟨t', htt', ht', hμt'⟩
    rw [← hμt']
    rw [inter_subset] at htt'
    refine' (mono' _ htt').trans _
    

Proof state:
case refine'_1.intro.intro.intro
α : Type u_1
inst✝ : MeasurableSpace α
m μ : OuterMeasure α
s : Set α
hs : MeasurableSet s
t t' : Set α
htt' : t ⊆ sᶜ ∪ t'
ht' : MeasurableSet t'
hμt' : ↑μ t' = ↑(trim μ) (t ∩ s)
⊢ ↑(trim ((restrict s) μ)) (sᶜ ∪ t') ≤ ↑μ t'

Next tactic:
rw [trim_eq _ (hs.compl.union ht'), restrict_apply, union_inter_distrib_right, compl_inter_self,
      Set.empty_union]
/-- The trimmed property of a measure μ states that `μ.toOuterMeasure.trim = μ.toOuterMeasure`.
This theorem shows that a restricted trimmed outer measure is a trimmed outer measure. -/
theorem restrict_trim {μ : OuterMeasure α} {s : Set α} (hs : MeasurableSet s) :
    (restrict s μ).trim = restrict s μ.trim := by
  refine' le_antisymm (fun t => _) (le_trim_iff.2 fun t ht => _)
  · rw [restrict_apply]
    rcases μ.exists_measurable_superset_eq_trim (t ∩ s) with ⟨t', htt', ht', hμt'⟩
    rw [← hμt']
    rw [inter_subset] at htt'
    refine' (mono' _ htt').trans _
    rw [trim_eq _ (hs.compl.union ht'), restrict_apply, union_inter_distrib_right, compl_inter_self,
      Set.empty_union]
    

Proof state:
case refine'_1.intro.intro.intro
α : Type u_1
inst✝ : MeasurableSpace α
m μ : OuterMeasure α
s : Set α
hs : MeasurableSet s
t t' : Set α
htt' : t ⊆ sᶜ ∪ t'
ht' : MeasurableSet t'
hμt' : ↑μ t' = ↑(trim μ) (t ∩ s)
⊢ ↑μ (t' ∩ s) ≤ ↑μ t'

Next tactic:
exact μ.mono' (inter_subset_left _ _)
/-- The trimmed property of a measure μ states that `μ.toOuterMeasure.trim = μ.toOuterMeasure`.
This theorem shows that a restricted trimmed outer measure is a trimmed outer measure. -/
theorem restrict_trim {μ : OuterMeasure α} {s : Set α} (hs : MeasurableSet s) :
    (restrict s μ).trim = restrict s μ.trim := by
  refine' le_antisymm (fun t => _) (le_trim_iff.2 fun t ht => _)
  · rw [restrict_apply]
    rcases μ.exists_measurable_superset_eq_trim (t ∩ s) with ⟨t', htt', ht', hμt'⟩
    rw [← hμt']
    rw [inter_subset] at htt'
    refine' (mono' _ htt').trans _
    rw [trim_eq _ (hs.compl.union ht'), restrict_apply, union_inter_distrib_right, compl_inter_self,
      Set.empty_union]
    exact μ.mono' (inter_subset_left _ _)
  · 

Proof state:
case refine'_2
α : Type u_1
inst✝ : MeasurableSpace α
m μ : OuterMeasure α
s : Set α
hs : MeasurableSet s
t : Set α
ht : MeasurableSet t
⊢ ↑((restrict s) (trim μ)) t ≤ ↑((restrict s) μ) t

Next tactic:
rw [restrict_apply, trim_eq _ (ht.inter hs), restrict_apply]
instance [Preorder α] : OrderHomClass (ClosureOperator α) α α where
  coe c := c.1
  coe_injective' := by 

Proof state:
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝ : Preorder α
⊢ Function.Injective fun c => ⇑c.toOrderHom

Next tactic:
rintro ⟨⟩ ⟨⟩ h
instance [Preorder α] : OrderHomClass (ClosureOperator α) α α where
  coe c := c.1
  coe_injective' := by rintro ⟨⟩ ⟨⟩ h; 

Proof state:
case mk.mk
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝ : Preorder α
toOrderHom✝¹ : α →o α
le_closure'✝¹ : ∀ (x : α), x ≤ OrderHom.toFun toOrderHom✝¹ x
idempotent'✝¹ : ∀ (x : α), OrderHom.toFun toOrderHom✝¹ (OrderHom.toFun toOrderHom✝¹ x) = OrderHom.toFun toOrderHom✝¹ x
IsClosed✝¹ : α → Prop
isClosed_iff✝¹ : ∀ {x : α}, IsClosed✝¹ x ↔ OrderHom.toFun toOrderHom✝¹ x = x
toOrderHom✝ : α →o α
le_closure'✝ : ∀ (x : α), x ≤ OrderHom.toFun toOrderHom✝ x
idempotent'✝ : ∀ (x : α), OrderHom.toFun toOrderHom✝ (OrderHom.toFun toOrderHom✝ x) = OrderHom.toFun toOrderHom✝ x
IsClosed✝ : α → Prop
isClosed_iff✝ : ∀ {x : α}, IsClosed✝ x ↔ OrderHom.toFun toOrderHom✝ x = x
h :
  (fun c => ⇑c.toOrderHom) (mk toOrderHom✝¹ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹) =
    (fun c => ⇑c.toOrderHom) (mk toOrderHom✝ le_closure'✝ idempotent'✝ IsClosed✝)
⊢ mk toOrderHom✝¹ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹ = mk toOrderHom✝ le_closure'✝ idempotent'✝ IsClosed✝

Next tactic:
obtain rfl := FunLike.ext' h
instance [Preorder α] : OrderHomClass (ClosureOperator α) α α where
  coe c := c.1
  coe_injective' := by rintro ⟨⟩ ⟨⟩ h; obtain rfl := FunLike.ext' h; 

Proof state:
case mk.mk
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝ : Preorder α
toOrderHom✝ : α →o α
le_closure'✝¹ : ∀ (x : α), x ≤ OrderHom.toFun toOrderHom✝ x
idempotent'✝¹ : ∀ (x : α), OrderHom.toFun toOrderHom✝ (OrderHom.toFun toOrderHom✝ x) = OrderHom.toFun toOrderHom✝ x
IsClosed✝¹ : α → Prop
isClosed_iff✝¹ : ∀ {x : α}, IsClosed✝¹ x ↔ OrderHom.toFun toOrderHom✝ x = x
IsClosed✝ : α → Prop
le_closure'✝ : ∀ (x : α), x ≤ OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom x
idempotent'✝ :
  ∀ (x : α),
    OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom
        (OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom x) =
      OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom x
isClosed_iff✝ :
  ∀ {x : α}, IsClosed✝ x ↔ OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom x = x
h :
  (fun c => ⇑c.toOrderHom) (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹) =
    (fun c => ⇑c.toOrderHom)
      (mk (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom le_closure'✝ idempotent'✝ IsClosed✝)
⊢ mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹ =
    mk (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom le_closure'✝ idempotent'✝ IsClosed✝

Next tactic:
congr with x
instance [Preorder α] : OrderHomClass (ClosureOperator α) α α where
  coe c := c.1
  coe_injective' := by rintro ⟨⟩ ⟨⟩ h; obtain rfl := FunLike.ext' h; congr with x; 

Proof state:
case mk.mk.e_IsClosed.h.a
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝ : Preorder α
toOrderHom✝ : α →o α
le_closure'✝¹ : ∀ (x : α), x ≤ OrderHom.toFun toOrderHom✝ x
idempotent'✝¹ : ∀ (x : α), OrderHom.toFun toOrderHom✝ (OrderHom.toFun toOrderHom✝ x) = OrderHom.toFun toOrderHom✝ x
IsClosed✝¹ : α → Prop
isClosed_iff✝¹ : ∀ {x : α}, IsClosed✝¹ x ↔ OrderHom.toFun toOrderHom✝ x = x
IsClosed✝ : α → Prop
le_closure'✝ : ∀ (x : α), x ≤ OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom x
idempotent'✝ :
  ∀ (x : α),
    OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom
        (OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom x) =
      OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom x
isClosed_iff✝ :
  ∀ {x : α}, IsClosed✝ x ↔ OrderHom.toFun (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom x = x
h :
  (fun c => ⇑c.toOrderHom) (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹) =
    (fun c => ⇑c.toOrderHom)
      (mk (mk toOrderHom✝ le_closure'✝¹ idempotent'✝¹ IsClosed✝¹).toOrderHom le_closure'✝ idempotent'✝ IsClosed✝)
x : α
⊢ IsClosed✝¹ x ↔ IsClosed✝ x

Next tactic:
simp [*]
/-- The set of closed elements for `c` is exactly its range. -/
theorem setOf_isClosed_eq_range_closure : {x | c.IsClosed x} = Set.range c := by
  

Proof state:
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝¹ inst✝ : PartialOrder α
c : ClosureOperator α
x y : α
⊢ {x | IsClosed c x} = range ⇑c

Next tactic:
ext x
/-- The set of closed elements for `c` is exactly its range. -/
theorem setOf_isClosed_eq_range_closure : {x | c.IsClosed x} = Set.range c := by
  ext x; 

Proof state:
case h
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝¹ inst✝ : PartialOrder α
c : ClosureOperator α
x✝ y x : α
⊢ x ∈ {x | IsClosed c x} ↔ x ∈ range ⇑c

Next tactic:
exact ⟨fun hx ↦ ⟨x, hx.closure_eq⟩, by rintro ⟨y, rfl⟩; exact c.isClosed_closure _⟩
/-- The set of closed elements for `c` is exactly its range. -/
theorem setOf_isClosed_eq_range_closure : {x | c.IsClosed x} = Set.range c := by
  ext x; exact ⟨fun hx ↦ ⟨x, hx.closure_eq⟩, by 

Proof state:
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝¹ inst✝ : PartialOrder α
c : ClosureOperator α
x✝ y x : α
⊢ x ∈ range ⇑c → x ∈ {x | IsClosed c x}

Next tactic:
rintro ⟨y, rfl⟩
/-- The set of closed elements for `c` is exactly its range. -/
theorem setOf_isClosed_eq_range_closure : {x | c.IsClosed x} = Set.range c := by
  ext x; exact ⟨fun hx ↦ ⟨x, hx.closure_eq⟩, by rintro ⟨y, rfl⟩; 

Proof state:
case intro
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝¹ inst✝ : PartialOrder α
c : ClosureOperator α
x y✝ y : α
⊢ c y ∈ {x | IsClosed c x}

Next tactic:
exact c.isClosed_closure _
@[simp]
theorem IsClosed.closure_le_iff (hy : c.IsClosed y) : c x ≤ y ↔ x ≤ y := by
  

Proof state:
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝¹ inst✝ : PartialOrder α
c : ClosureOperator α
x y : α
hy : IsClosed c y
⊢ c x ≤ y ↔ x ≤ y

Next tactic:
rw [← hy.closure_eq, ← le_closure_iff]
/-- A closure operator is equal to the closure operator obtained by feeding `c.closed` into the
`ofPred` constructor. -/
theorem eq_ofPred_closed (c : ClosureOperator α) :
    c = ofPred c c.IsClosed c.le_closure c.isClosed_closure fun x y ↦ closure_min := by
  

Proof state:
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝¹ inst✝ : PartialOrder α
c✝ : ClosureOperator α
x y : α
c : ClosureOperator α
⊢ c =
    ofPred (⇑c) c.IsClosed (_ : ∀ (x : α), x ≤ c x) (_ : ∀ (x : α), IsClosed c (c x))
      (_ : ∀ (x y : α), x ≤ y → IsClosed c y → c x ≤ y)

Next tactic:
ext
/-- A closure operator is equal to the closure operator obtained by feeding `c.closed` into the
`ofPred` constructor. -/
theorem eq_ofPred_closed (c : ClosureOperator α) :
    c = ofPred c c.IsClosed c.le_closure c.isClosed_closure fun x y ↦ closure_min := by
  ext
  

Proof state:
case a.h
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝¹ inst✝ : PartialOrder α
c✝ : ClosureOperator α
x y : α
c : ClosureOperator α
x✝ : α
⊢ c x✝ =
    (ofPred (⇑c) c.IsClosed (_ : ∀ (x : α), x ≤ c x) (_ : ∀ (x : α), IsClosed c (c x))
        (_ : ∀ (x y : α), x ≤ y → IsClosed c y → c x ≤ y))
      x✝

Next tactic:
rfl
theorem closure_sup_closure_right (x y : α) : c (x ⊔ c y) = c (x ⊔ y) := by
  

Proof state:
α : Type u_1
ι : Sort u_2
κ : ι → Sort u_3
inst✝ : SemilatticeSup α
c : ClosureOperator α
x y : α
⊢ c (x ⊔ c y) = c (x ⊔ y)

Next tactic:
rw [sup_comm, closure_sup_closure_left, sup_comm (a := x)]