l3lab/ntp-mathlib huggingface dataset:
theorem tendsto_embedBox_toFilteriUnion_top (l : IntegrationParams) (h : I ≤ J) :
    Tendsto (TaggedPrepartition.embedBox I J h) (l.toFilteriUnion I ⊤)
      (l.toFilteriUnion J (Prepartition.single J I h)) := by
  simp only [toFilteriUnion, tendsto_iSup]; intro c
  set π₀ := Prepartition.single J I h
  refine' le_iSup_of_le (max c π₀.compl.distortion) _
  refine' ((l.hasBasis_toFilterDistortioniUnion I c ⊤).tendsto_iff
    (l.hasBasis_toFilterDistortioniUnion J _ _)).2 fun r hr => _
  refine' ⟨r, hr, fun π hπ => _⟩
  rw [mem_setOf_eq, Prepartition.iUnion_top] at hπ
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
I J : Box ι
c✝ c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π✝ π₁ π₂ : TaggedPrepartition I
l✝ l₁ l₂ l : IntegrationParams
h : I ≤ J
c : ℝ≥0
π₀ : Prepartition J := Prepartition.single J I h
r : (ι → ℝ) → ↑(Set.Ioi 0)
hr : RCond l r
π : TaggedPrepartition I
hπ : MemBaseSet l I c r π ∧ TaggedPrepartition.iUnion π = ↑I
⊢ (embedBox I J h) π ∈
    {π |
      MemBaseSet l J (max c (Prepartition.distortion (Prepartition.compl π₀))) r π ∧
        TaggedPrepartition.iUnion π = Prepartition.iUnion π₀}

Next tactic:
refine' ⟨⟨hπ.1.1, hπ.1.2, fun hD => le_trans (hπ.1.3 hD) (le_max_left _ _), fun _ => _⟩, _⟩
theorem tendsto_embedBox_toFilteriUnion_top (l : IntegrationParams) (h : I ≤ J) :
    Tendsto (TaggedPrepartition.embedBox I J h) (l.toFilteriUnion I ⊤)
      (l.toFilteriUnion J (Prepartition.single J I h)) := by
  simp only [toFilteriUnion, tendsto_iSup]; intro c
  set π₀ := Prepartition.single J I h
  refine' le_iSup_of_le (max c π₀.compl.distortion) _
  refine' ((l.hasBasis_toFilterDistortioniUnion I c ⊤).tendsto_iff
    (l.hasBasis_toFilterDistortioniUnion J _ _)).2 fun r hr => _
  refine' ⟨r, hr, fun π hπ => _⟩
  rw [mem_setOf_eq, Prepartition.iUnion_top] at hπ
  refine' ⟨⟨hπ.1.1, hπ.1.2, fun hD => le_trans (hπ.1.3 hD) (le_max_left _ _), fun _ => _⟩, _⟩
  · 

Proof state:
case refine'_1
ι : Type u_1
inst✝ : Fintype ι
I J : Box ι
c✝ c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π✝ π₁ π₂ : TaggedPrepartition I
l✝ l₁ l₂ l : IntegrationParams
h : I ≤ J
c : ℝ≥0
π₀ : Prepartition J := Prepartition.single J I h
r : (ι → ℝ) → ↑(Set.Ioi 0)
hr : RCond l r
π : TaggedPrepartition I
hπ : MemBaseSet l I c r π ∧ TaggedPrepartition.iUnion π = ↑I
x✝ : l.bDistortion = true
⊢ ∃ π',
    Prepartition.iUnion π' = ↑J \ TaggedPrepartition.iUnion ((embedBox I J h) π) ∧
      Prepartition.distortion π' ≤ max c (Prepartition.distortion (Prepartition.compl π₀))

Next tactic:
refine' ⟨_, π₀.iUnion_compl.trans _, le_max_right _ _⟩
theorem tendsto_embedBox_toFilteriUnion_top (l : IntegrationParams) (h : I ≤ J) :
    Tendsto (TaggedPrepartition.embedBox I J h) (l.toFilteriUnion I ⊤)
      (l.toFilteriUnion J (Prepartition.single J I h)) := by
  simp only [toFilteriUnion, tendsto_iSup]; intro c
  set π₀ := Prepartition.single J I h
  refine' le_iSup_of_le (max c π₀.compl.distortion) _
  refine' ((l.hasBasis_toFilterDistortioniUnion I c ⊤).tendsto_iff
    (l.hasBasis_toFilterDistortioniUnion J _ _)).2 fun r hr => _
  refine' ⟨r, hr, fun π hπ => _⟩
  rw [mem_setOf_eq, Prepartition.iUnion_top] at hπ
  refine' ⟨⟨hπ.1.1, hπ.1.2, fun hD => le_trans (hπ.1.3 hD) (le_max_left _ _), fun _ => _⟩, _⟩
  · refine' ⟨_, π₀.iUnion_compl.trans _, le_max_right _ _⟩
    

Proof state:
case refine'_1
ι : Type u_1
inst✝ : Fintype ι
I J : Box ι
c✝ c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π✝ π₁ π₂ : TaggedPrepartition I
l✝ l₁ l₂ l : IntegrationParams
h : I ≤ J
c : ℝ≥0
π₀ : Prepartition J := Prepartition.single J I h
r : (ι → ℝ) → ↑(Set.Ioi 0)
hr : RCond l r
π : TaggedPrepartition I
hπ : MemBaseSet l I c r π ∧ TaggedPrepartition.iUnion π = ↑I
x✝ : l.bDistortion = true
⊢ ↑J \ Prepartition.iUnion π₀ = ↑J \ TaggedPrepartition.iUnion ((embedBox I J h) π)

Next tactic:
congr 1
theorem tendsto_embedBox_toFilteriUnion_top (l : IntegrationParams) (h : I ≤ J) :
    Tendsto (TaggedPrepartition.embedBox I J h) (l.toFilteriUnion I ⊤)
      (l.toFilteriUnion J (Prepartition.single J I h)) := by
  simp only [toFilteriUnion, tendsto_iSup]; intro c
  set π₀ := Prepartition.single J I h
  refine' le_iSup_of_le (max c π₀.compl.distortion) _
  refine' ((l.hasBasis_toFilterDistortioniUnion I c ⊤).tendsto_iff
    (l.hasBasis_toFilterDistortioniUnion J _ _)).2 fun r hr => _
  refine' ⟨r, hr, fun π hπ => _⟩
  rw [mem_setOf_eq, Prepartition.iUnion_top] at hπ
  refine' ⟨⟨hπ.1.1, hπ.1.2, fun hD => le_trans (hπ.1.3 hD) (le_max_left _ _), fun _ => _⟩, _⟩
  · refine' ⟨_, π₀.iUnion_compl.trans _, le_max_right _ _⟩
    congr 1
    

Proof state:
case refine'_1.e_a
ι : Type u_1
inst✝ : Fintype ι
I J : Box ι
c✝ c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π✝ π₁ π₂ : TaggedPrepartition I
l✝ l₁ l₂ l : IntegrationParams
h : I ≤ J
c : ℝ≥0
π₀ : Prepartition J := Prepartition.single J I h
r : (ι → ℝ) → ↑(Set.Ioi 0)
hr : RCond l r
π : TaggedPrepartition I
hπ : MemBaseSet l I c r π ∧ TaggedPrepartition.iUnion π = ↑I
x✝ : l.bDistortion = true
⊢ Prepartition.iUnion π₀ = TaggedPrepartition.iUnion ((embedBox I J h) π)

Next tactic:
exact (Prepartition.iUnion_single h).trans hπ.2.symm
theorem tendsto_embedBox_toFilteriUnion_top (l : IntegrationParams) (h : I ≤ J) :
    Tendsto (TaggedPrepartition.embedBox I J h) (l.toFilteriUnion I ⊤)
      (l.toFilteriUnion J (Prepartition.single J I h)) := by
  simp only [toFilteriUnion, tendsto_iSup]; intro c
  set π₀ := Prepartition.single J I h
  refine' le_iSup_of_le (max c π₀.compl.distortion) _
  refine' ((l.hasBasis_toFilterDistortioniUnion I c ⊤).tendsto_iff
    (l.hasBasis_toFilterDistortioniUnion J _ _)).2 fun r hr => _
  refine' ⟨r, hr, fun π hπ => _⟩
  rw [mem_setOf_eq, Prepartition.iUnion_top] at hπ
  refine' ⟨⟨hπ.1.1, hπ.1.2, fun hD => le_trans (hπ.1.3 hD) (le_max_left _ _), fun _ => _⟩, _⟩
  · refine' ⟨_, π₀.iUnion_compl.trans _, le_max_right _ _⟩
    congr 1
    exact (Prepartition.iUnion_single h).trans hπ.2.symm
  · 

Proof state:
case refine'_2
ι : Type u_1
inst✝ : Fintype ι
I J : Box ι
c✝ c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π✝ π₁ π₂ : TaggedPrepartition I
l✝ l₁ l₂ l : IntegrationParams
h : I ≤ J
c : ℝ≥0
π₀ : Prepartition J := Prepartition.single J I h
r : (ι → ℝ) → ↑(Set.Ioi 0)
hr : RCond l r
π : TaggedPrepartition I
hπ : MemBaseSet l I c r π ∧ TaggedPrepartition.iUnion π = ↑I
⊢ TaggedPrepartition.iUnion ((embedBox I J h) π) = Prepartition.iUnion π₀

Next tactic:
exact hπ.2.trans (Prepartition.iUnion_single _).symm
theorem exists_memBaseSet_le_iUnion_eq (l : IntegrationParams) (π₀ : Prepartition I)
    (hc₁ : π₀.distortion ≤ c) (hc₂ : π₀.compl.distortion ≤ c) (r : (ι → ℝ) → Ioi (0 : ℝ)) :
    ∃ π, l.MemBaseSet I c r π ∧ π.toPrepartition ≤ π₀ ∧ π.iUnion = π₀.iUnion := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
I J : Box ι
c c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π π₁ π₂ : TaggedPrepartition I
l✝ l₁ l₂ l : IntegrationParams
π₀ : Prepartition I
hc₁ : Prepartition.distortion π₀ ≤ c
hc₂ : Prepartition.distortion (Prepartition.compl π₀) ≤ c
r : (ι → ℝ) → ↑(Set.Ioi 0)
⊢ ∃ π, MemBaseSet l I c r π ∧ π.toPrepartition ≤ π₀ ∧ TaggedPrepartition.iUnion π = Prepartition.iUnion π₀

Next tactic:
rcases π₀.exists_tagged_le_isHenstock_isSubordinate_iUnion_eq r with ⟨π, hle, hH, hr, hd, hU⟩
theorem exists_memBaseSet_le_iUnion_eq (l : IntegrationParams) (π₀ : Prepartition I)
    (hc₁ : π₀.distortion ≤ c) (hc₂ : π₀.compl.distortion ≤ c) (r : (ι → ℝ) → Ioi (0 : ℝ)) :
    ∃ π, l.MemBaseSet I c r π ∧ π.toPrepartition ≤ π₀ ∧ π.iUnion = π₀.iUnion := by
  rcases π₀.exists_tagged_le_isHenstock_isSubordinate_iUnion_eq r with ⟨π, hle, hH, hr, hd, hU⟩
  

Proof state:
case intro.intro.intro.intro.intro
ι : Type u_1
inst✝ : Fintype ι
I J : Box ι
c c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π✝ π₁ π₂ : TaggedPrepartition I
l✝ l₁ l₂ l : IntegrationParams
π₀ : Prepartition I
hc₁ : Prepartition.distortion π₀ ≤ c
hc₂ : Prepartition.distortion (Prepartition.compl π₀) ≤ c
r : (ι → ℝ) → ↑(Set.Ioi 0)
π : TaggedPrepartition I
hle : π.toPrepartition ≤ π₀
hH : IsHenstock π
hr : IsSubordinate π r
hd : distortion π = Prepartition.distortion π₀
hU : TaggedPrepartition.iUnion π = Prepartition.iUnion π₀
⊢ ∃ π, MemBaseSet l I c r π ∧ π.toPrepartition ≤ π₀ ∧ TaggedPrepartition.iUnion π = Prepartition.iUnion π₀

Next tactic:
refine' ⟨π, ⟨hr, fun _ => hH, fun _ => hd.trans_le hc₁, fun _ => ⟨π₀.compl, _, hc₂⟩⟩, ⟨hle, hU⟩⟩
theorem exists_memBaseSet_le_iUnion_eq (l : IntegrationParams) (π₀ : Prepartition I)
    (hc₁ : π₀.distortion ≤ c) (hc₂ : π₀.compl.distortion ≤ c) (r : (ι → ℝ) → Ioi (0 : ℝ)) :
    ∃ π, l.MemBaseSet I c r π ∧ π.toPrepartition ≤ π₀ ∧ π.iUnion = π₀.iUnion := by
  rcases π₀.exists_tagged_le_isHenstock_isSubordinate_iUnion_eq r with ⟨π, hle, hH, hr, hd, hU⟩
  refine' ⟨π, ⟨hr, fun _ => hH, fun _ => hd.trans_le hc₁, fun _ => ⟨π₀.compl, _, hc₂⟩⟩, ⟨hle, hU⟩⟩
  

Proof state:
case intro.intro.intro.intro.intro
ι : Type u_1
inst✝ : Fintype ι
I J : Box ι
c c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π✝ π₁ π₂ : TaggedPrepartition I
l✝ l₁ l₂ l : IntegrationParams
π₀ : Prepartition I
hc₁ : Prepartition.distortion π₀ ≤ c
hc₂ : Prepartition.distortion (Prepartition.compl π₀) ≤ c
r : (ι → ℝ) → ↑(Set.Ioi 0)
π : TaggedPrepartition I
hle : π.toPrepartition ≤ π₀
hH : IsHenstock π
hr : IsSubordinate π r
hd : distortion π = Prepartition.distortion π₀
hU : TaggedPrepartition.iUnion π = Prepartition.iUnion π₀
x✝ : l.bDistortion = true
⊢ Prepartition.iUnion (Prepartition.compl π₀) = ↑I \ TaggedPrepartition.iUnion π

Next tactic:
exact Prepartition.compl_congr hU ▸ π.toPrepartition.iUnion_compl
theorem exists_memBaseSet_isPartition (l : IntegrationParams) (I : Box ι) (hc : I.distortion ≤ c)
    (r : (ι → ℝ) → Ioi (0 : ℝ)) : ∃ π, l.MemBaseSet I c r π ∧ π.IsPartition := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
I✝ J : Box ι
c c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π π₁ π₂ : TaggedPrepartition I✝
l✝ l₁ l₂ l : IntegrationParams
I : Box ι
hc : Box.distortion I ≤ c
r : (ι → ℝ) → ↑(Set.Ioi 0)
⊢ ∃ π, MemBaseSet l I c r π ∧ IsPartition π

Next tactic:
rw [← Prepartition.distortion_top] at hc
theorem exists_memBaseSet_isPartition (l : IntegrationParams) (I : Box ι) (hc : I.distortion ≤ c)
    (r : (ι → ℝ) → Ioi (0 : ℝ)) : ∃ π, l.MemBaseSet I c r π ∧ π.IsPartition := by
  rw [← Prepartition.distortion_top] at hc
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
I✝ J : Box ι
c c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π π₁ π₂ : TaggedPrepartition I✝
l✝ l₁ l₂ l : IntegrationParams
I : Box ι
hc : Prepartition.distortion ⊤ ≤ c
r : (ι → ℝ) → ↑(Set.Ioi 0)
⊢ ∃ π, MemBaseSet l I c r π ∧ IsPartition π

Next tactic:
have hc' : (⊤ : Prepartition I).compl.distortion ≤ c := by simp
theorem exists_memBaseSet_isPartition (l : IntegrationParams) (I : Box ι) (hc : I.distortion ≤ c)
    (r : (ι → ℝ) → Ioi (0 : ℝ)) : ∃ π, l.MemBaseSet I c r π ∧ π.IsPartition := by
  rw [← Prepartition.distortion_top] at hc
  have hc' : (⊤ : Prepartition I).compl.distortion ≤ c := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
I✝ J : Box ι
c c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π π₁ π₂ : TaggedPrepartition I✝
l✝ l₁ l₂ l : IntegrationParams
I : Box ι
hc : Prepartition.distortion ⊤ ≤ c
r : (ι → ℝ) → ↑(Set.Ioi 0)
⊢ Prepartition.distortion (Prepartition.compl ⊤) ≤ c

Next tactic:
simp
theorem exists_memBaseSet_isPartition (l : IntegrationParams) (I : Box ι) (hc : I.distortion ≤ c)
    (r : (ι → ℝ) → Ioi (0 : ℝ)) : ∃ π, l.MemBaseSet I c r π ∧ π.IsPartition := by
  rw [← Prepartition.distortion_top] at hc
  have hc' : (⊤ : Prepartition I).compl.distortion ≤ c := by simp
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
I✝ J : Box ι
c c₁ c₂ : ℝ≥0
r✝ r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π π₁ π₂ : TaggedPrepartition I✝
l✝ l₁ l₂ l : IntegrationParams
I : Box ι
hc : Prepartition.distortion ⊤ ≤ c
r : (ι → ℝ) → ↑(Set.Ioi 0)
hc' : Prepartition.distortion (Prepartition.compl ⊤) ≤ c
⊢ ∃ π, MemBaseSet l I c r π ∧ IsPartition π

Next tactic:
simpa [isPartition_iff_iUnion_eq] using l.exists_memBaseSet_le_iUnion_eq ⊤ hc hc' r
instance toFilterDistortion_neBot (l : IntegrationParams) (I : Box ι) :
    (l.toFilterDistortion I I.distortion).NeBot := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
I✝ J : Box ι
c c₁ c₂ : ℝ≥0
r r₁ r₂ : (ι → ℝ) → ↑(Set.Ioi 0)
π π₁ π₂ : TaggedPrepartition I✝
l✝ l₁ l₂ l : IntegrationParams
I : Box ι
⊢ NeBot (toFilterDistortion l I (Box.distortion I))

Next tactic:
simpa using (l.toFilterDistortioniUnion_neBot' I ⊤).mono inf_le_left
@[simp]
theorem ite_eq_lt_distrib (c : Prop) [Decidable c] (a b : Ordering) :
    ((if c then a else b) = Ordering.lt) = if c then a = Ordering.lt else b = Ordering.lt := by
  

Proof state:
c : Prop
inst✝ : Decidable c
a b : Ordering
⊢ ((if c then a else b) = lt) = if c then a = lt else b = lt

Next tactic:
by_cases c
@[simp]
theorem ite_eq_lt_distrib (c : Prop) [Decidable c] (a b : Ordering) :
    ((if c then a else b) = Ordering.lt) = if c then a = Ordering.lt else b = Ordering.lt := by
  by_cases c <;> 

Proof state:
case pos
c : Prop
inst✝ : Decidable c
a b : Ordering
h✝ : c
⊢ ((if c then a else b) = lt) = if c then a = lt else b = lt

Next tactic:
simp [*]
@[simp]
theorem ite_eq_lt_distrib (c : Prop) [Decidable c] (a b : Ordering) :
    ((if c then a else b) = Ordering.lt) = if c then a = Ordering.lt else b = Ordering.lt := by
  by_cases c <;> 

Proof state:
case neg
c : Prop
inst✝ : Decidable c
a b : Ordering
h✝ : ¬c
⊢ ((if c then a else b) = lt) = if c then a = lt else b = lt

Next tactic:
simp [*]
@[simp]
theorem ite_eq_eq_distrib (c : Prop) [Decidable c] (a b : Ordering) :
    ((if c then a else b) = Ordering.eq) = if c then a = Ordering.eq else b = Ordering.eq := by
  

Proof state:
c : Prop
inst✝ : Decidable c
a b : Ordering
⊢ ((if c then a else b) = eq) = if c then a = eq else b = eq

Next tactic:
by_cases c
@[simp]
theorem ite_eq_eq_distrib (c : Prop) [Decidable c] (a b : Ordering) :
    ((if c then a else b) = Ordering.eq) = if c then a = Ordering.eq else b = Ordering.eq := by
  by_cases c <;> 

Proof state:
case pos
c : Prop
inst✝ : Decidable c
a b : Ordering
h✝ : c
⊢ ((if c then a else b) = eq) = if c then a = eq else b = eq

Next tactic:
simp [*]
@[simp]
theorem ite_eq_eq_distrib (c : Prop) [Decidable c] (a b : Ordering) :
    ((if c then a else b) = Ordering.eq) = if c then a = Ordering.eq else b = Ordering.eq := by
  by_cases c <;> 

Proof state:
case neg
c : Prop
inst✝ : Decidable c
a b : Ordering
h✝ : ¬c
⊢ ((if c then a else b) = eq) = if c then a = eq else b = eq

Next tactic:
simp [*]
@[simp]
theorem ite_eq_gt_distrib (c : Prop) [Decidable c] (a b : Ordering) :
    ((if c then a else b) = Ordering.gt) = if c then a = Ordering.gt else b = Ordering.gt := by
  

Proof state:
c : Prop
inst✝ : Decidable c
a b : Ordering
⊢ ((if c then a else b) = gt) = if c then a = gt else b = gt

Next tactic:
by_cases c
@[simp]
theorem ite_eq_gt_distrib (c : Prop) [Decidable c] (a b : Ordering) :
    ((if c then a else b) = Ordering.gt) = if c then a = Ordering.gt else b = Ordering.gt := by
  by_cases c <;> 

Proof state:
case pos
c : Prop
inst✝ : Decidable c
a b : Ordering
h✝ : c
⊢ ((if c then a else b) = gt) = if c then a = gt else b = gt

Next tactic:
simp [*]
@[simp]
theorem ite_eq_gt_distrib (c : Prop) [Decidable c] (a b : Ordering) :
    ((if c then a else b) = Ordering.gt) = if c then a = Ordering.gt else b = Ordering.gt := by
  by_cases c <;> 

Proof state:
case neg
c : Prop
inst✝ : Decidable c
a b : Ordering
h✝ : ¬c
⊢ ((if c then a else b) = gt) = if c then a = gt else b = gt

Next tactic:
simp [*]
@[simp]
theorem cmpUsing_eq_lt (a b : α) : (cmpUsing lt a b = Ordering.lt) = lt a b := by
  

Proof state:
α : Type u
lt : α → α → Prop
inst✝ : DecidableRel lt
a b : α
⊢ (cmpUsing lt a b = Ordering.lt) = lt a b

Next tactic:
simp only [cmpUsing, Ordering.ite_eq_lt_distrib, ite_self, if_false_right_eq_and, and_true]
@[simp]
theorem cmpUsing_eq_gt [IsStrictOrder α lt] (a b : α) :
    (cmpUsing lt a b = Ordering.gt) = lt b a := by
  

Proof state:
α : Type u
lt : α → α → Prop
inst✝¹ : DecidableRel lt
inst✝ : IsStrictOrder α lt
a b : α
⊢ (cmpUsing lt a b = Ordering.gt) = lt b a

Next tactic:
simp only [cmpUsing, Ordering.ite_eq_gt_distrib, if_false_right_eq_and, and_true,
    if_false_left_eq_and]
@[simp]
theorem cmpUsing_eq_gt [IsStrictOrder α lt] (a b : α) :
    (cmpUsing lt a b = Ordering.gt) = lt b a := by
  simp only [cmpUsing, Ordering.ite_eq_gt_distrib, if_false_right_eq_and, and_true,
    if_false_left_eq_and]
  

Proof state:
α : Type u
lt : α → α → Prop
inst✝¹ : DecidableRel lt
inst✝ : IsStrictOrder α lt
a b : α
⊢ (¬lt a b ∧ lt b a) = lt b a

Next tactic:
apply propext
@[simp]
theorem cmpUsing_eq_gt [IsStrictOrder α lt] (a b : α) :
    (cmpUsing lt a b = Ordering.gt) = lt b a := by
  simp only [cmpUsing, Ordering.ite_eq_gt_distrib, if_false_right_eq_and, and_true,
    if_false_left_eq_and]
  apply propext
  

Proof state:
case a
α : Type u
lt : α → α → Prop
inst✝¹ : DecidableRel lt
inst✝ : IsStrictOrder α lt
a b : α
⊢ ¬lt a b ∧ lt b a ↔ lt b a

Next tactic:
apply Iff.intro
@[simp]
theorem cmpUsing_eq_gt [IsStrictOrder α lt] (a b : α) :
    (cmpUsing lt a b = Ordering.gt) = lt b a := by
  simp only [cmpUsing, Ordering.ite_eq_gt_distrib, if_false_right_eq_and, and_true,
    if_false_left_eq_and]
  apply propext
  apply Iff.intro
  · 

Proof state:
case a.mp
α : Type u
lt : α → α → Prop
inst✝¹ : DecidableRel lt
inst✝ : IsStrictOrder α lt
a b : α
⊢ ¬lt a b ∧ lt b a → lt b a

Next tactic:
exact fun h => h.2
@[simp]
theorem cmpUsing_eq_gt [IsStrictOrder α lt] (a b : α) :
    (cmpUsing lt a b = Ordering.gt) = lt b a := by
  simp only [cmpUsing, Ordering.ite_eq_gt_distrib, if_false_right_eq_and, and_true,
    if_false_left_eq_and]
  apply propext
  apply Iff.intro
  · exact fun h => h.2
  · 

Proof state:
case a.mpr
α : Type u
lt : α → α → Prop
inst✝¹ : DecidableRel lt
inst✝ : IsStrictOrder α lt
a b : α
⊢ lt b a → ¬lt a b ∧ lt b a

Next tactic:
intro hba
@[simp]
theorem cmpUsing_eq_gt [IsStrictOrder α lt] (a b : α) :
    (cmpUsing lt a b = Ordering.gt) = lt b a := by
  simp only [cmpUsing, Ordering.ite_eq_gt_distrib, if_false_right_eq_and, and_true,
    if_false_left_eq_and]
  apply propext
  apply Iff.intro
  · exact fun h => h.2
  · intro hba
    

Proof state:
case a.mpr
α : Type u
lt : α → α → Prop
inst✝¹ : DecidableRel lt
inst✝ : IsStrictOrder α lt
a b : α
hba : lt b a
⊢ ¬lt a b ∧ lt b a

Next tactic:
constructor
@[simp]
theorem cmpUsing_eq_gt [IsStrictOrder α lt] (a b : α) :
    (cmpUsing lt a b = Ordering.gt) = lt b a := by
  simp only [cmpUsing, Ordering.ite_eq_gt_distrib, if_false_right_eq_and, and_true,
    if_false_left_eq_and]
  apply propext
  apply Iff.intro
  · exact fun h => h.2
  · intro hba
    constructor
    · 

Proof state:
case a.mpr.left
α : Type u
lt : α → α → Prop
inst✝¹ : DecidableRel lt
inst✝ : IsStrictOrder α lt
a b : α
hba : lt b a
⊢ ¬lt a b

Next tactic:
intro hab
@[simp]
theorem cmpUsing_eq_gt [IsStrictOrder α lt] (a b : α) :
    (cmpUsing lt a b = Ordering.gt) = lt b a := by
  simp only [cmpUsing, Ordering.ite_eq_gt_distrib, if_false_right_eq_and, and_true,
    if_false_left_eq_and]
  apply propext
  apply Iff.intro
  · exact fun h => h.2
  · intro hba
    constructor
    · intro hab
      

Proof state:
case a.mpr.left
α : Type u
lt : α → α → Prop
inst✝¹ : DecidableRel lt
inst✝ : IsStrictOrder α lt
a b : α
hba : lt b a
hab : lt a b
⊢ False

Next tactic:
exact absurd (_root_.trans hab hba) (irrefl a)
@[simp]
theorem cmpUsing_eq_gt [IsStrictOrder α lt] (a b : α) :
    (cmpUsing lt a b = Ordering.gt) = lt b a := by
  simp only [cmpUsing, Ordering.ite_eq_gt_distrib, if_false_right_eq_and, and_true,
    if_false_left_eq_and]
  apply propext
  apply Iff.intro
  · exact fun h => h.2
  · intro hba
    constructor
    · intro hab
      exact absurd (_root_.trans hab hba) (irrefl a)
    · 

Proof state:
case a.mpr.right
α : Type u
lt : α → α → Prop
inst✝¹ : DecidableRel lt
inst✝ : IsStrictOrder α lt
a b : α
hba : lt b a
⊢ lt b a

Next tactic:
assumption
@[simp]
theorem cmpUsing_eq_eq (a b : α) : (cmpUsing lt a b = Ordering.eq) = (¬lt a b ∧ ¬lt b a) := by 

Proof state:
α : Type u
lt : α → α → Prop
inst✝ : DecidableRel lt
a b : α
⊢ (cmpUsing lt a b = Ordering.eq) = (¬lt a b ∧ ¬lt b a)

Next tactic:
simp
@[simp]
theorem Ici_disjoint_Iic : Disjoint (Ici a) (Iic b) ↔ ¬a ≤ b := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝ : Preorder α
a b c : α
⊢ Disjoint (Ici a) (Iic b) ↔ ¬a ≤ b

Next tactic:
rw [Set.disjoint_iff_inter_eq_empty, Ici_inter_Iic, Icc_eq_empty_iff]
@[simp]
theorem iUnion_Icc_right (a : α) : ⋃ b, Icc a b = Ici a := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝ : Preorder α
a✝ b c a : α
⊢ ⋃ b, Icc a b = Ici a

Next tactic:
simp only [← Ici_inter_Iic, ← inter_iUnion, iUnion_Iic, inter_univ]
@[simp]
theorem iUnion_Ioc_right (a : α) : ⋃ b, Ioc a b = Ioi a := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝ : Preorder α
a✝ b c a : α
⊢ ⋃ b, Ioc a b = Ioi a

Next tactic:
simp only [← Ioi_inter_Iic, ← inter_iUnion, iUnion_Iic, inter_univ]
@[simp]
theorem iUnion_Icc_left (b : α) : ⋃ a, Icc a b = Iic b := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝ : Preorder α
a b✝ c b : α
⊢ ⋃ a, Icc a b = Iic b

Next tactic:
simp only [← Ici_inter_Iic, ← iUnion_inter, iUnion_Ici, univ_inter]
@[simp]
theorem iUnion_Ico_left (b : α) : ⋃ a, Ico a b = Iio b := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝ : Preorder α
a b✝ c b : α
⊢ ⋃ a, Ico a b = Iio b

Next tactic:
simp only [← Ici_inter_Iio, ← iUnion_inter, iUnion_Ici, univ_inter]
@[simp]
theorem iUnion_Ico_right [NoMaxOrder α] (a : α) : ⋃ b, Ico a b = Ici a := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝¹ : Preorder α
a✝ b c : α
inst✝ : NoMaxOrder α
a : α
⊢ ⋃ b, Ico a b = Ici a

Next tactic:
simp only [← Ici_inter_Iio, ← inter_iUnion, iUnion_Iio, inter_univ]
@[simp]
theorem iUnion_Ioo_right [NoMaxOrder α] (a : α) : ⋃ b, Ioo a b = Ioi a := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝¹ : Preorder α
a✝ b c : α
inst✝ : NoMaxOrder α
a : α
⊢ ⋃ b, Ioo a b = Ioi a

Next tactic:
simp only [← Ioi_inter_Iio, ← inter_iUnion, iUnion_Iio, inter_univ]
@[simp]
theorem iUnion_Ioc_left [NoMinOrder α] (b : α) : ⋃ a, Ioc a b = Iic b := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝¹ : Preorder α
a b✝ c : α
inst✝ : NoMinOrder α
b : α
⊢ ⋃ a, Ioc a b = Iic b

Next tactic:
simp only [← Ioi_inter_Iic, ← iUnion_inter, iUnion_Ioi, univ_inter]
@[simp]
theorem iUnion_Ioo_left [NoMinOrder α] (b : α) : ⋃ a, Ioo a b = Iio b := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝¹ : Preorder α
a b✝ c : α
inst✝ : NoMinOrder α
b : α
⊢ ⋃ a, Ioo a b = Iio b

Next tactic:
simp only [← Ioi_inter_Iio, ← iUnion_inter, iUnion_Ioi, univ_inter]
@[simp]
theorem Ico_disjoint_Ico : Disjoint (Ico a₁ a₂) (Ico b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝ : LinearOrder α
a₁ a₂ b₁ b₂ : α
⊢ Disjoint (Ico a₁ a₂) (Ico b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁

Next tactic:
simp_rw [Set.disjoint_iff_inter_eq_empty, Ico_inter_Ico, Ico_eq_empty_iff, inf_eq_min, sup_eq_max,
    not_lt]
@[simp]
theorem Ioc_disjoint_Ioc : Disjoint (Ioc a₁ a₂) (Ioc b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝ : LinearOrder α
a₁ a₂ b₁ b₂ : α
⊢ Disjoint (Ioc a₁ a₂) (Ioc b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁

Next tactic:
have h : _ ↔ min (toDual a₁) (toDual b₁) ≤ max (toDual a₂) (toDual b₂) := Ico_disjoint_Ico
@[simp]
theorem Ioc_disjoint_Ioc : Disjoint (Ioc a₁ a₂) (Ioc b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁ := by
  have h : _ ↔ min (toDual a₁) (toDual b₁) ≤ max (toDual a₂) (toDual b₂) := Ico_disjoint_Ico
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝ : LinearOrder α
a₁ a₂ b₁ b₂ : α
h :
  Disjoint (Ico (toDual a₂) (toDual a₁)) (Ico (toDual b₂) (toDual b₁)) ↔
    min (toDual a₁) (toDual b₁) ≤ max (toDual a₂) (toDual b₂)
⊢ Disjoint (Ioc a₁ a₂) (Ioc b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁

Next tactic:
simpa only [dual_Ico] using h
/-- If two half-open intervals are disjoint and the endpoint of one lies in the other,
  then it must be equal to the endpoint of the other. -/
theorem eq_of_Ico_disjoint {x₁ x₂ y₁ y₂ : α} (h : Disjoint (Ico x₁ x₂) (Ico y₁ y₂)) (hx : x₁ < x₂)
    (h2 : x₂ ∈ Ico y₁ y₂) : y₁ = x₂ := by
  

Proof state:
ι : Sort u
α : Type v
β : Type w
inst✝ : LinearOrder α
a₁ a₂ b₁ b₂ x₁ x₂ y₁ y₂ : α
h : Disjoint (Ico x₁ x₂) (Ico y₁ y₂)
hx : x₁ < x₂
h2 : x₂ ∈ Ico y₁ y₂
⊢ y₁ = x₂

Next tactic:
rw [Ico_disjoint_Ico, min_eq_left (le_of_lt h2.2), le_max_iff] at h