l3lab/ntp-mathlib huggingface dataset:
theorem intrinsicInterior_nonempty (hs : Convex ℝ s) :
    (intrinsicInterior ℝ s).Nonempty ↔ s.Nonempty :=
  ⟨by simp_rw [nonempty_iff_ne_empty]; rintro h rfl; 

Proof state:
𝕜 : Type u_1
V : Type u_2
W : Type u_3
Q : Type u_4
P : Type u_5
inst✝² : NormedAddCommGroup V
inst✝¹ : NormedSpace ℝ V
inst✝ : FiniteDimensional ℝ V
hs : Convex ℝ ∅
h : intrinsicInterior ℝ ∅ ≠ ∅
⊢ False

Next tactic:
exact h intrinsicInterior_empty
@[simp]
theorem coe_splitLower : (splitLower I i x : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y : ι → ℝ
⊢ ↑(splitLower I i x) = ↑I ∩ {y | y i ≤ x}

Next tactic:
rw [splitLower, coe_mk']
@[simp]
theorem coe_splitLower : (splitLower I i x : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } := by
  rw [splitLower, coe_mk']
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y : ι → ℝ
⊢ (Set.pi univ fun i_1 => Ioc (lower I i_1) (update I.upper i (min x (upper I i)) i_1)) = ↑I ∩ {y | y i ≤ x}

Next tactic:
ext y
@[simp]
theorem coe_splitLower : (splitLower I i x : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } := by
  rw [splitLower, coe_mk']
  ext y
  

Proof state:
case h
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y✝ y : ι → ℝ
⊢ (y ∈ Set.pi univ fun i_1 => Ioc (lower I i_1) (update I.upper i (min x (upper I i)) i_1)) ↔ y ∈ ↑I ∩ {y | y i ≤ x}

Next tactic:
simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and, ← Pi.le_def,
    le_update_iff, le_min_iff, and_assoc, and_forall_ne (p := fun j => y j ≤ upper I j) i, mem_def]
@[simp]
theorem coe_splitLower : (splitLower I i x : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } := by
  rw [splitLower, coe_mk']
  ext y
  simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and, ← Pi.le_def,
    le_update_iff, le_min_iff, and_assoc, and_forall_ne (p := fun j => y j ≤ upper I j) i, mem_def]
  

Proof state:
case h
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y✝ y : ι → ℝ
⊢ ((∀ (x : ι), lower I x < y x) ∧ y i ≤ x ∧ (fun i => y i) ≤ fun i => upper I i) ↔
    (∀ (x : ι), lower I x < y x) ∧ ((fun i => y i) ≤ fun i => upper I i) ∧ y i ≤ x

Next tactic:
rw [and_comm (a := y i ≤ x), Pi.le_def]
theorem splitLower_le : I.splitLower i x ≤ I :=
  withBotCoe_subset_iff.1 <| by 

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y : ι → ℝ
⊢ ↑(splitLower I i x) ⊆ ↑↑I

Next tactic:
simp
@[simp]
theorem splitLower_eq_bot {i x} : I.splitLower i x = ⊥ ↔ x ≤ I.lower i := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
i : ι
x : ℝ
⊢ splitLower I i x = ⊥ ↔ x ≤ lower I i

Next tactic:
rw [splitLower, mk'_eq_bot, exists_update_iff I.upper fun j y => y ≤ I.lower j]
@[simp]
theorem splitLower_eq_bot {i x} : I.splitLower i x = ⊥ ↔ x ≤ I.lower i := by
  rw [splitLower, mk'_eq_bot, exists_update_iff I.upper fun j y => y ≤ I.lower j]
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
i : ι
x : ℝ
⊢ (min x (upper I i) ≤ lower I i ∨ ∃ x, ∃ (_ : x ≠ i), upper I x ≤ lower I x) ↔ x ≤ lower I i

Next tactic:
simp [(I.lower_lt_upper _).not_le]
@[simp]
theorem splitLower_eq_self : I.splitLower i x = I ↔ I.upper i ≤ x := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y : ι → ℝ
⊢ splitLower I i x = ↑I ↔ upper I i ≤ x

Next tactic:
simp [splitLower, update_eq_iff]
theorem splitLower_def [DecidableEq ι] {i x} (h : x ∈ Ioo (I.lower i) (I.upper i))
    (h' : ∀ j, I.lower j < update I.upper i x j :=
      (forall_update_iff I.upper fun j y => I.lower j < y).2
        ⟨h.1, fun j _ => I.lower_lt_upper _⟩) :
    I.splitLower i x = (⟨I.lower, update I.upper i x, h'⟩ : Box ι) := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
inst✝ : DecidableEq ι
i : ι
x : ℝ
h : x ∈ Ioo (lower I i) (upper I i)
h' : optParam (∀ (j : ι), lower I j < update I.upper i x j) (_ : ∀ (x_1 : ι), lower I x_1 < update I.upper i x x_1)
⊢ splitLower I i x = ↑{ lower := I.lower, upper := update I.upper i x, lower_lt_upper := h' }

Next tactic:
simp (config := { unfoldPartialApp := true }) only [splitLower, mk'_eq_coe, min_eq_left h.2.le,
    update, and_self]
@[simp]
theorem coe_splitUpper : (splitUpper I i x : Set (ι → ℝ)) = ↑I ∩ { y | x < y i } := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y : ι → ℝ
⊢ ↑(splitUpper I i x) = ↑I ∩ {y | x < y i}

Next tactic:
rw [splitUpper, coe_mk']
@[simp]
theorem coe_splitUpper : (splitUpper I i x : Set (ι → ℝ)) = ↑I ∩ { y | x < y i } := by
  rw [splitUpper, coe_mk']
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y : ι → ℝ
⊢ (Set.pi univ fun i_1 => Ioc (update I.lower i (max x (lower I i)) i_1) (upper I i_1)) = ↑I ∩ {y | x < y i}

Next tactic:
ext y
@[simp]
theorem coe_splitUpper : (splitUpper I i x : Set (ι → ℝ)) = ↑I ∩ { y | x < y i } := by
  rw [splitUpper, coe_mk']
  ext y
  

Proof state:
case h
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y✝ y : ι → ℝ
⊢ (y ∈ Set.pi univ fun i_1 => Ioc (update I.lower i (max x (lower I i)) i_1) (upper I i_1)) ↔ y ∈ ↑I ∩ {y | x < y i}

Next tactic:
simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and,
    forall_update_iff I.lower fun j z => z < y j, max_lt_iff, and_assoc (a := x < y i),
    and_forall_ne (p := fun j => lower I j < y j) i, mem_def]
@[simp]
theorem coe_splitUpper : (splitUpper I i x : Set (ι → ℝ)) = ↑I ∩ { y | x < y i } := by
  rw [splitUpper, coe_mk']
  ext y
  simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and,
    forall_update_iff I.lower fun j z => z < y j, max_lt_iff, and_assoc (a := x < y i),
    and_forall_ne (p := fun j => lower I j < y j) i, mem_def]
  

Proof state:
case h
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y✝ y : ι → ℝ
⊢ (x < y i ∧ (∀ (b : ι), lower I b < y b) ∧ ∀ (x : ι), y x ≤ upper I x) ↔
    ((∀ (x : ι), lower I x < y x) ∧ ∀ (x : ι), y x ≤ upper I x) ∧ x < y i

Next tactic:
exact and_comm
theorem splitUpper_le : I.splitUpper i x ≤ I :=
  withBotCoe_subset_iff.1 <| by 

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y : ι → ℝ
⊢ ↑(splitUpper I i x) ⊆ ↑↑I

Next tactic:
simp
@[simp]
theorem splitUpper_eq_bot {i x} : I.splitUpper i x = ⊥ ↔ I.upper i ≤ x := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
i : ι
x : ℝ
⊢ splitUpper I i x = ⊥ ↔ upper I i ≤ x

Next tactic:
rw [splitUpper, mk'_eq_bot, exists_update_iff I.lower fun j y => I.upper j ≤ y]
@[simp]
theorem splitUpper_eq_bot {i x} : I.splitUpper i x = ⊥ ↔ I.upper i ≤ x := by
  rw [splitUpper, mk'_eq_bot, exists_update_iff I.lower fun j y => I.upper j ≤ y]
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
i : ι
x : ℝ
⊢ (upper I i ≤ max x (lower I i) ∨ ∃ x, ∃ (_ : x ≠ i), upper I x ≤ lower I x) ↔ upper I i ≤ x

Next tactic:
simp [(I.lower_lt_upper _).not_le]
@[simp]
theorem splitUpper_eq_self : I.splitUpper i x = I ↔ x ≤ I.lower i := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i : ι
x : ℝ
y : ι → ℝ
⊢ splitUpper I i x = ↑I ↔ x ≤ lower I i

Next tactic:
simp [splitUpper, update_eq_iff]
theorem splitUpper_def [DecidableEq ι] {i x} (h : x ∈ Ioo (I.lower i) (I.upper i))
    (h' : ∀ j, update I.lower i x j < I.upper j :=
      (forall_update_iff I.lower fun j y => y < I.upper j).2
        ⟨h.2, fun j _ => I.lower_lt_upper _⟩) :
    I.splitUpper i x = (⟨update I.lower i x, I.upper, h'⟩ : Box ι) := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
inst✝ : DecidableEq ι
i : ι
x : ℝ
h : x ∈ Ioo (lower I i) (upper I i)
h' : optParam (∀ (j : ι), update I.lower i x j < upper I j) (_ : ∀ (x_1 : ι), update I.lower i x x_1 < upper I x_1)
⊢ splitUpper I i x = ↑{ lower := update I.lower i x, upper := I.upper, lower_lt_upper := h' }

Next tactic:
simp (config := { unfoldPartialApp := true }) only [splitUpper, mk'_eq_coe, max_eq_left h.1.le,
    update, and_self]
theorem disjoint_splitLower_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    Disjoint (I.splitLower i x) (I.splitUpper i x) := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
I : Box ι
i : ι
x : ℝ
⊢ Disjoint (splitLower I i x) (splitUpper I i x)

Next tactic:
rw [← disjoint_withBotCoe, coe_splitLower, coe_splitUpper]
theorem disjoint_splitLower_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    Disjoint (I.splitLower i x) (I.splitUpper i x) := by
  rw [← disjoint_withBotCoe, coe_splitLower, coe_splitUpper]
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
I : Box ι
i : ι
x : ℝ
⊢ Disjoint (↑I ∩ {y | y i ≤ x}) (↑I ∩ {y | x < y i})

Next tactic:
refine' (Disjoint.inf_left' _ _).inf_right' _
theorem disjoint_splitLower_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    Disjoint (I.splitLower i x) (I.splitUpper i x) := by
  rw [← disjoint_withBotCoe, coe_splitLower, coe_splitUpper]
  refine' (Disjoint.inf_left' _ _).inf_right' _
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
I : Box ι
i : ι
x : ℝ
⊢ Disjoint {y | y i ≤ x} {y | x < y i}

Next tactic:
rw [Set.disjoint_left]
theorem disjoint_splitLower_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    Disjoint (I.splitLower i x) (I.splitUpper i x) := by
  rw [← disjoint_withBotCoe, coe_splitLower, coe_splitUpper]
  refine' (Disjoint.inf_left' _ _).inf_right' _
  rw [Set.disjoint_left]
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
I : Box ι
i : ι
x : ℝ
⊢ ∀ ⦃a : ι → ℝ⦄, a ∈ {y | y i ≤ x} → a ∉ {y | x < y i}

Next tactic:
exact fun y (hle : y i ≤ x) hlt => not_lt_of_le hle hlt
theorem splitLower_ne_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    I.splitLower i x ≠ I.splitUpper i x := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
I : Box ι
i : ι
x : ℝ
⊢ splitLower I i x ≠ splitUpper I i x

Next tactic:
cases' le_or_lt x (I.lower i) with h
theorem splitLower_ne_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    I.splitLower i x ≠ I.splitUpper i x := by
  cases' le_or_lt x (I.lower i) with h
  · 

Proof state:
case inl
ι : Type u_1
M : Type u_2
n : ℕ
I✝ : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
I : Box ι
i : ι
x : ℝ
h : x ≤ lower I i
⊢ splitLower I i x ≠ splitUpper I i x

Next tactic:
rw [splitUpper_eq_self.2 h, splitLower_eq_bot.2 h]
theorem splitLower_ne_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    I.splitLower i x ≠ I.splitUpper i x := by
  cases' le_or_lt x (I.lower i) with h
  · rw [splitUpper_eq_self.2 h, splitLower_eq_bot.2 h]
    

Proof state:
case inl
ι : Type u_1
M : Type u_2
n : ℕ
I✝ : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
I : Box ι
i : ι
x : ℝ
h : x ≤ lower I i
⊢ ⊥ ≠ ↑I

Next tactic:
exact WithBot.bot_ne_coe
theorem splitLower_ne_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    I.splitLower i x ≠ I.splitUpper i x := by
  cases' le_or_lt x (I.lower i) with h
  · rw [splitUpper_eq_self.2 h, splitLower_eq_bot.2 h]
    exact WithBot.bot_ne_coe
  · 

Proof state:
case inr
ι : Type u_1
M : Type u_2
n : ℕ
I✝ : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
I : Box ι
i : ι
x : ℝ
h✝ : lower I i < x
⊢ splitLower I i x ≠ splitUpper I i x

Next tactic:
refine' (disjoint_splitLower_splitUpper I i x).ne _
theorem splitLower_ne_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    I.splitLower i x ≠ I.splitUpper i x := by
  cases' le_or_lt x (I.lower i) with h
  · rw [splitUpper_eq_self.2 h, splitLower_eq_bot.2 h]
    exact WithBot.bot_ne_coe
  · refine' (disjoint_splitLower_splitUpper I i x).ne _
    

Proof state:
case inr
ι : Type u_1
M : Type u_2
n : ℕ
I✝ : Box ι
i✝ : ι
x✝ : ℝ
y : ι → ℝ
I : Box ι
i : ι
x : ℝ
h✝ : lower I i < x
⊢ splitLower I i x ≠ ⊥

Next tactic:
rwa [Ne.def, splitLower_eq_bot, not_le]
/-- The partition of `I : Box ι` into the boxes `I ∩ {y | y ≤ x i}` and `I ∩ {y | x i < y}`.
One of these boxes can be empty, then this partition is just the single-box partition `⊤`. -/
def split (I : Box ι) (i : ι) (x : ℝ) : Prepartition I :=
  ofWithBot {I.splitLower i x, I.splitUpper i x}
    (by
      

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ J : Box ι
i✝ : ι
x✝ : ℝ
I : Box ι
i : ι
x : ℝ
⊢ ∀ J ∈ {Box.splitLower I i x, Box.splitUpper I i x}, J ≤ ↑I

Next tactic:
simp only [Finset.mem_insert, Finset.mem_singleton]
/-- The partition of `I : Box ι` into the boxes `I ∩ {y | y ≤ x i}` and `I ∩ {y | x i < y}`.
One of these boxes can be empty, then this partition is just the single-box partition `⊤`. -/
def split (I : Box ι) (i : ι) (x : ℝ) : Prepartition I :=
  ofWithBot {I.splitLower i x, I.splitUpper i x}
    (by
      simp only [Finset.mem_insert, Finset.mem_singleton]
      

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ J : Box ι
i✝ : ι
x✝ : ℝ
I : Box ι
i : ι
x : ℝ
⊢ ∀ (J : WithBot (Box ι)), J = Box.splitLower I i x ∨ J = Box.splitUpper I i x → J ≤ ↑I

Next tactic:
rintro J (rfl | rfl)
/-- The partition of `I : Box ι` into the boxes `I ∩ {y | y ≤ x i}` and `I ∩ {y | x i < y}`.
One of these boxes can be empty, then this partition is just the single-box partition `⊤`. -/
def split (I : Box ι) (i : ι) (x : ℝ) : Prepartition I :=
  ofWithBot {I.splitLower i x, I.splitUpper i x}
    (by
      simp only [Finset.mem_insert, Finset.mem_singleton]
      rintro J (rfl | rfl)
      

Proof state:
case inl
ι : Type u_1
M : Type u_2
n : ℕ
I✝ J : Box ι
i✝ : ι
x✝ : ℝ
I : Box ι
i : ι
x : ℝ
⊢ Box.splitLower I i x ≤ ↑I
case inr ι : Type u_1 M : Type u_2 n : ℕ I✝ J : Box ι i✝ : ι x✝ : ℝ I : Box ι i : ι x : ℝ ⊢ Box.splitUpper I i x ≤ ↑I

Next tactic:
exacts [Box.splitLower_le, Box.splitUpper_le]
/-- The partition of `I : Box ι` into the boxes `I ∩ {y | y ≤ x i}` and `I ∩ {y | x i < y}`.
One of these boxes can be empty, then this partition is just the single-box partition `⊤`. -/
def split (I : Box ι) (i : ι) (x : ℝ) : Prepartition I :=
  ofWithBot {I.splitLower i x, I.splitUpper i x}
    (by
      simp only [Finset.mem_insert, Finset.mem_singleton]
      rintro J (rfl | rfl)
      exacts [Box.splitLower_le, Box.splitUpper_le])
    (by
      

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ J : Box ι
i✝ : ι
x✝ : ℝ
I : Box ι
i : ι
x : ℝ
⊢ Set.Pairwise (↑{Box.splitLower I i x, Box.splitUpper I i x}) Disjoint

Next tactic:
simp only [Finset.coe_insert, Finset.coe_singleton, true_and_iff, Set.mem_singleton_iff,
        pairwise_insert_of_symmetric symmetric_disjoint, pairwise_singleton]
/-- The partition of `I : Box ι` into the boxes `I ∩ {y | y ≤ x i}` and `I ∩ {y | x i < y}`.
One of these boxes can be empty, then this partition is just the single-box partition `⊤`. -/
def split (I : Box ι) (i : ι) (x : ℝ) : Prepartition I :=
  ofWithBot {I.splitLower i x, I.splitUpper i x}
    (by
      simp only [Finset.mem_insert, Finset.mem_singleton]
      rintro J (rfl | rfl)
      exacts [Box.splitLower_le, Box.splitUpper_le])
    (by
      simp only [Finset.coe_insert, Finset.coe_singleton, true_and_iff, Set.mem_singleton_iff,
        pairwise_insert_of_symmetric symmetric_disjoint, pairwise_singleton]
      

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ J : Box ι
i✝ : ι
x✝ : ℝ
I : Box ι
i : ι
x : ℝ
⊢ ∀ (b : WithBot (Box ι)), b = Box.splitUpper I i x → Box.splitLower I i x ≠ b → Disjoint (Box.splitLower I i x) b

Next tactic:
rintro J rfl -
/-- The partition of `I : Box ι` into the boxes `I ∩ {y | y ≤ x i}` and `I ∩ {y | x i < y}`.
One of these boxes can be empty, then this partition is just the single-box partition `⊤`. -/
def split (I : Box ι) (i : ι) (x : ℝ) : Prepartition I :=
  ofWithBot {I.splitLower i x, I.splitUpper i x}
    (by
      simp only [Finset.mem_insert, Finset.mem_singleton]
      rintro J (rfl | rfl)
      exacts [Box.splitLower_le, Box.splitUpper_le])
    (by
      simp only [Finset.coe_insert, Finset.coe_singleton, true_and_iff, Set.mem_singleton_iff,
        pairwise_insert_of_symmetric symmetric_disjoint, pairwise_singleton]
      rintro J rfl -
      

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ J : Box ι
i✝ : ι
x✝ : ℝ
I : Box ι
i : ι
x : ℝ
⊢ Disjoint (Box.splitLower I i x) (Box.splitUpper I i x)

Next tactic:
exact I.disjoint_splitLower_splitUpper i x
@[simp]
theorem mem_split_iff : J ∈ split I i x ↔ ↑J = I.splitLower i x ∨ ↑J = I.splitUpper i x := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I J : Box ι
i : ι
x : ℝ
⊢ J ∈ split I i x ↔ ↑J = Box.splitLower I i x ∨ ↑J = Box.splitUpper I i x

Next tactic:
simp [split]
theorem mem_split_iff' : J ∈ split I i x ↔
    (J : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } ∨ (J : Set (ι → ℝ)) = ↑I ∩ { y | x < y i } := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I J : Box ι
i : ι
x : ℝ
⊢ J ∈ split I i x ↔ ↑J = ↑I ∩ {y | y i ≤ x} ∨ ↑J = ↑I ∩ {y | x < y i}

Next tactic:
simp [mem_split_iff, ← Box.withBotCoe_inj]
@[simp]
theorem iUnion_split (I : Box ι) (i : ι) (x : ℝ) : (split I i x).iUnion = I := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I✝ J : Box ι
i✝ : ι
x✝ : ℝ
I : Box ι
i : ι
x : ℝ
⊢ Prepartition.iUnion (split I i x) = ↑I

Next tactic:
simp [split, ← inter_union_distrib_left, ← setOf_or, le_or_lt]
theorem sum_split_boxes {M : Type*} [AddCommMonoid M] (I : Box ι) (i : ι) (x : ℝ) (f : Box ι → M) :
    (∑ J in (split I i x).boxes, f J) =
      (I.splitLower i x).elim' 0 f + (I.splitUpper i x).elim' 0 f := by
  

Proof state:
ι : Type u_1
M✝ : Type u_2
n : ℕ
I✝ J : Box ι
i✝ : ι
x✝ : ℝ
M : Type u_3
inst✝ : AddCommMonoid M
I : Box ι
i : ι
x : ℝ
f : Box ι → M
⊢ ∑ J in (split I i x).boxes, f J = Option.elim' 0 f (Box.splitLower I i x) + Option.elim' 0 f (Box.splitUpper I i x)

Next tactic:
rw [split, sum_ofWithBot, Finset.sum_pair (I.splitLower_ne_splitUpper i x)]
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I J : Box ι
i : ι
x : ℝ
h : x ∉ Ioo (Box.lower I i) (Box.upper I i)
⊢ split I i x = ⊤

Next tactic:
refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I J✝ : Box ι
i : ι
x : ℝ
h : x ∉ Ioo (Box.lower I i) (Box.upper I i)
J : Box ι
hJ : J ∈ ⊤.boxes
⊢ J ∈ (split I i x).boxes

Next tactic:
rcases mem_top.1 hJ with rfl
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  rcases mem_top.1 hJ with rfl; 

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
J✝ : Box ι
i : ι
x : ℝ
J : Box ι
h : x ∉ Ioo (Box.lower J i) (Box.upper J i)
hJ : J ∈ ⊤.boxes
⊢ J ∈ (split J i x).boxes

Next tactic:
clear hJ
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  rcases mem_top.1 hJ with rfl; clear hJ
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
J✝ : Box ι
i : ι
x : ℝ
J : Box ι
h : x ∉ Ioo (Box.lower J i) (Box.upper J i)
⊢ J ∈ (split J i x).boxes

Next tactic:
rw [mem_boxes, mem_split_iff]
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  rcases mem_top.1 hJ with rfl; clear hJ
  rw [mem_boxes, mem_split_iff]
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
J✝ : Box ι
i : ι
x : ℝ
J : Box ι
h : x ∉ Ioo (Box.lower J i) (Box.upper J i)
⊢ ↑J = Box.splitLower J i x ∨ ↑J = Box.splitUpper J i x

Next tactic:
rw [mem_Ioo, not_and_or, not_lt, not_lt] at h
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  rcases mem_top.1 hJ with rfl; clear hJ
  rw [mem_boxes, mem_split_iff]
  rw [mem_Ioo, not_and_or, not_lt, not_lt] at h
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
J✝ : Box ι
i : ι
x : ℝ
J : Box ι
h : x ≤ Box.lower J i ∨ Box.upper J i ≤ x
⊢ ↑J = Box.splitLower J i x ∨ ↑J = Box.splitUpper J i x

Next tactic:
cases h <;> [right; left]
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  rcases mem_top.1 hJ with rfl; clear hJ
  rw [mem_boxes, mem_split_iff]
  rw [mem_Ioo, not_and_or, not_lt, not_lt] at h
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
J✝ : Box ι
i : ι
x : ℝ
J : Box ι
h : x ≤ Box.lower J i ∨ Box.upper J i ≤ x
⊢ ↑J = Box.splitLower J i x ∨ ↑J = Box.splitUpper J i x

Next tactic:
cases h
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  rcases mem_top.1 hJ with rfl; clear hJ
  rw [mem_boxes, mem_split_iff]
  rw [mem_Ioo, not_and_or, not_lt, not_lt] at h
  cases h <;> [

Proof state:
case inl
ι : Type u_1
M : Type u_2
n : ℕ
J✝ : Box ι
i : ι
x : ℝ
J : Box ι
h✝ : x ≤ Box.lower J i
⊢ ↑J = Box.splitLower J i x ∨ ↑J = Box.splitUpper J i x

Next tactic:
right
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  rcases mem_top.1 hJ with rfl; clear hJ
  rw [mem_boxes, mem_split_iff]
  rw [mem_Ioo, not_and_or, not_lt, not_lt] at h
  cases h <;> [right; 

Proof state:
case inr
ι : Type u_1
M : Type u_2
n : ℕ
J✝ : Box ι
i : ι
x : ℝ
J : Box ι
h✝ : Box.upper J i ≤ x
⊢ ↑J = Box.splitLower J i x ∨ ↑J = Box.splitUpper J i x

Next tactic:
left
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  rcases mem_top.1 hJ with rfl; clear hJ
  rw [mem_boxes, mem_split_iff]
  rw [mem_Ioo, not_and_or, not_lt, not_lt] at h
  cases h <;> [right; left]
  · 

Proof state:
case inl.h
ι : Type u_1
M : Type u_2
n : ℕ
J✝ : Box ι
i : ι
x : ℝ
J : Box ι
h✝ : x ≤ Box.lower J i
⊢ ↑J = Box.splitUpper J i x

Next tactic:
rwa [eq_comm, Box.splitUpper_eq_self]
/-- If `x ∉ (I.lower i, I.upper i)`, then the hyperplane `{y | y i = x}` does not split `I`. -/
theorem split_of_not_mem_Ioo (h : x ∉ Ioo (I.lower i) (I.upper i)) : split I i x = ⊤ := by
  refine' ((isPartitionTop I).eq_of_boxes_subset fun J hJ => _).symm
  rcases mem_top.1 hJ with rfl; clear hJ
  rw [mem_boxes, mem_split_iff]
  rw [mem_Ioo, not_and_or, not_lt, not_lt] at h
  cases h <;> [right; left]
  · rwa [eq_comm, Box.splitUpper_eq_self]
  · 

Proof state:
case inr.h
ι : Type u_1
M : Type u_2
n : ℕ
J✝ : Box ι
i : ι
x : ℝ
J : Box ι
h✝ : Box.upper J i ≤ x
⊢ ↑J = Box.splitLower J i x

Next tactic:
rwa [eq_comm, Box.splitLower_eq_self]
theorem coe_eq_of_mem_split_of_mem_le {y : ι → ℝ} (h₁ : J ∈ split I i x) (h₂ : y ∈ J)
    (h₃ : y i ≤ x) : (J : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } := by
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I J : Box ι
i : ι
x : ℝ
y : ι → ℝ
h₁ : J ∈ split I i x
h₂ : y ∈ J
h₃ : y i ≤ x
⊢ ↑J = ↑I ∩ {y | y i ≤ x}

Next tactic:
refine' (mem_split_iff'.1 h₁).resolve_right fun H => _
theorem coe_eq_of_mem_split_of_mem_le {y : ι → ℝ} (h₁ : J ∈ split I i x) (h₂ : y ∈ J)
    (h₃ : y i ≤ x) : (J : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } := by
  refine' (mem_split_iff'.1 h₁).resolve_right fun H => _
  

Proof state:
ι : Type u_1
M : Type u_2
n : ℕ
I J : Box ι
i : ι
x : ℝ
y : ι → ℝ
h₁ : J ∈ split I i x
h₂ : y ∈ J
h₃ : y i ≤ x
H : ↑J = ↑I ∩ {y | x < y i}
⊢ False

Next tactic:
rw [← Box.mem_coe, H] at h₂