File: Mathlib/Analysis/BoxIntegral/Partition/Split.lean

full_name: BoxIntegral.Box.splitLower
code: /-- Given a box `I` and `x ∈ (I.lower i, I.upper i)`, the hyperplane `{y : ι → ℝ | y i = x}` splits
`I` into two boxes. `BoxIntegral.Box.splitLower I i x` is the box `I ∩ {y | y i ≤ x}`
(if it is nonempty). As usual, we represent a box that may be empty as
`WithBot (BoxIntegral.Box ι)`. -/
def splitLower (I : Box ι) (i : ι) (x : ℝ) : WithBot (Box ι) 
goal: WithBot (BoxIntegral.Box ι)

full_name: BoxIntegral.Box.coe_splitLower
code: @[simp]
theorem coe_splitLower : (splitLower I i x : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } 
goal: ↑(I.splitLower i x) = ↑I ∩ {y | y i ≤ x}

full_name: BoxIntegral.Box.splitLower_le
code: theorem splitLower_le : I.splitLower i x ≤ I 
goal: I.splitLower i x ≤ ↑I

full_name: BoxIntegral.Box.splitLower_eq_bot
code: @[simp]
theorem splitLower_eq_bot {i x} : I.splitLower i x = ⊥ ↔ x ≤ I.lower i 
goal: I.splitLower i x = ⊥ ↔ x ≤ I.lower i

full_name: BoxIntegral.Box.splitLower_eq_self
code: @[simp]
theorem splitLower_eq_self : I.splitLower i x = I ↔ I.upper i ≤ x 
goal: I.splitLower i x = ↑I ↔ I.upper i ≤ x

full_name: BoxIntegral.Box.splitLower_def
code: 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 ι) 
goal: I.splitLower i x = ↑{ lower := I.lower, upper := Function.update I.upper i x, lower_lt_upper := h' }

full_name: BoxIntegral.Box.splitUpper
code: /-- Given a box `I` and `x ∈ (I.lower i, I.upper i)`, the hyperplane `{y : ι → ℝ | y i = x}` splits
`I` into two boxes. `BoxIntegral.Box.splitUpper I i x` is the box `I ∩ {y | x < y i}`
(if it is nonempty). As usual, we represent a box that may be empty as
`WithBot (BoxIntegral.Box ι)`. -/
def splitUpper (I : Box ι) (i : ι) (x : ℝ) : WithBot (Box ι) 
goal: WithBot (BoxIntegral.Box ι)

full_name: BoxIntegral.Box.coe_splitUpper
code: @[simp]
theorem coe_splitUpper : (splitUpper I i x : Set (ι → ℝ)) = ↑I ∩ { y | x < y i } 
goal: ↑(I.splitUpper i x) = ↑I ∩ {y | x < y i}

full_name: BoxIntegral.Box.splitUpper_le
code: theorem splitUpper_le : I.splitUpper i x ≤ I 
goal: I.splitUpper i x ≤ ↑I

full_name: BoxIntegral.Box.splitUpper_eq_bot
code: @[simp]
theorem splitUpper_eq_bot {i x} : I.splitUpper i x = ⊥ ↔ I.upper i ≤ x 
goal: I.splitUpper i x = ⊥ ↔ I.upper i ≤ x

full_name: BoxIntegral.Box.splitUpper_eq_self
code: @[simp]
theorem splitUpper_eq_self : I.splitUpper i x = I ↔ x ≤ I.lower i 
goal: I.splitUpper i x = ↑I ↔ x ≤ I.lower i

full_name: BoxIntegral.Box.splitUpper_def
code: 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 ι) 
goal: I.splitUpper i x = ↑{ lower := Function.update I.lower i x, upper := I.upper, lower_lt_upper := h' }

full_name: BoxIntegral.Box.disjoint_splitLower_splitUpper
code: theorem disjoint_splitLower_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    Disjoint (I.splitLower i x) (I.splitUpper i x) 
goal: Disjoint (I.splitLower i x) (I.splitUpper i x)

full_name: BoxIntegral.Box.splitLower_ne_splitUpper
code: theorem splitLower_ne_splitUpper (I : Box ι) (i : ι) (x : ℝ) :
    I.splitLower i x ≠ I.splitUpper i x 
goal: I.splitLower i x ≠ I.splitUpper i x

full_name: BoxIntegral.Prepartition.split
code: /-- 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 
goal: BoxIntegral.Prepartition I

full_name: BoxIntegral.Prepartition.mem_split_iff
code: @[simp]
theorem mem_split_iff : J ∈ split I i x ↔ ↑J = I.splitLower i x ∨ ↑J = I.splitUpper i x 
goal: J ∈ BoxIntegral.Prepartition.split I i x ↔ ↑J = I.splitLower i x ∨ ↑J = I.splitUpper i x

full_name: BoxIntegral.Prepartition.mem_split_iff'
code: theorem mem_split_iff' : J ∈ split I i x ↔
    (J : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } ∨ (J : Set (ι → ℝ)) = ↑I ∩ { y | x < y i } 
goal: J ∈ BoxIntegral.Prepartition.split I i x ↔ ↑J = ↑I ∩ {y | y i ≤ x} ∨ ↑J = ↑I ∩ {y | x < y i}

full_name: BoxIntegral.Prepartition.iUnion_split
code: @[simp]
theorem iUnion_split (I : Box ι) (i : ι) (x : ℝ) : (split I i x).iUnion = I 
goal: (BoxIntegral.Prepartition.split I i x).iUnion = ↑I

full_name: BoxIntegral.Prepartition.isPartitionSplit
code: theorem isPartitionSplit (I : Box ι) (i : ι) (x : ℝ) : IsPartition (split I i x) 
goal: (BoxIntegral.Prepartition.split I i x).IsPartition

full_name: BoxIntegral.Prepartition.sum_split_boxes
code: theorem sum_split_boxes {M : Type*} [AddCommMonoid M] (I : Box ι) (i : ι) (x : ℝ) (f : Box ι → M) :
    (∑ J ∈ (split I i x).boxes, f J) =
      (I.splitLower i x).elim' 0 f + (I.splitUpper i x).elim' 0 f 
goal: ∑ J ∈ (BoxIntegral.Prepartition.split I i x).boxes, f J =
  Option.elim' 0 f (I.splitLower i x) + Option.elim' 0 f (I.splitUpper i x)

full_name: BoxIntegral.Prepartition.split_of_not_mem_Ioo
code: /-- 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 = ⊤ 
goal: BoxIntegral.Prepartition.split I i x = ⊤

full_name: BoxIntegral.Prepartition.coe_eq_of_mem_split_of_mem_le
code: 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 } 
goal: ↑J = ↑I ∩ {y | y i ≤ x}

full_name: BoxIntegral.Prepartition.coe_eq_of_mem_split_of_lt_mem
code: theorem coe_eq_of_mem_split_of_lt_mem {y : ι → ℝ} (h₁ : J ∈ split I i x) (h₂ : y ∈ J)
    (h₃ : x < y i) : (J : Set (ι → ℝ)) = ↑I ∩ { y | x < y i } 
goal: ↑J = ↑I ∩ {y | x < y i}

full_name: BoxIntegral.Prepartition.restrict_split
code: @[simp]
theorem restrict_split (h : I ≤ J) (i : ι) (x : ℝ) : (split J i x).restrict I = split I i x 
goal: (BoxIntegral.Prepartition.split J i x).restrict I = BoxIntegral.Prepartition.split I i x

full_name: BoxIntegral.Prepartition.inf_split
code: theorem inf_split (π : Prepartition I) (i : ι) (x : ℝ) :
    π ⊓ split I i x = π.biUnion fun J => split J i x 
goal: π ⊓ BoxIntegral.Prepartition.split I i x = π.biUnion fun J => BoxIntegral.Prepartition.split J i x

full_name: BoxIntegral.Prepartition.splitMany
code: /-- Split a box along many hyperplanes `{y | y i = x}`; each hyperplane is given by the pair
`(i x)`. -/
def splitMany (I : Box ι) (s : Finset (ι × ℝ)) : Prepartition I 
goal: BoxIntegral.Prepartition I

full_name: BoxIntegral.Prepartition.splitMany_empty
code: @[simp]
theorem splitMany_empty (I : Box ι) : splitMany I ∅ = ⊤ 
goal: BoxIntegral.Prepartition.splitMany I ∅ = ⊤

full_name: BoxIntegral.Prepartition.splitMany_insert
code: @[simp]
theorem splitMany_insert (I : Box ι) (s : Finset (ι × ℝ)) (p : ι × ℝ) :
    splitMany I (insert p s) = splitMany I s ⊓ split I p.1 p.2 
goal: BoxIntegral.Prepartition.splitMany I (insert p s) =
  BoxIntegral.Prepartition.splitMany I s ⊓ BoxIntegral.Prepartition.split I p.1 p.2

full_name: BoxIntegral.Prepartition.splitMany_le_split
code: theorem splitMany_le_split (I : Box ι) {s : Finset (ι × ℝ)} {p : ι × ℝ} (hp : p ∈ s) :
    splitMany I s ≤ split I p.1 p.2 
goal: BoxIntegral.Prepartition.splitMany I s ≤ BoxIntegral.Prepartition.split I p.1 p.2

full_name: BoxIntegral.Prepartition.isPartition_splitMany
code: theorem isPartition_splitMany (I : Box ι) (s : Finset (ι × ℝ)) : IsPartition (splitMany I s) 
goal: (BoxIntegral.Prepartition.splitMany I s).IsPartition

full_name: BoxIntegral.Prepartition.iUnion_splitMany
code: @[simp]
theorem iUnion_splitMany (I : Box ι) (s : Finset (ι × ℝ)) : (splitMany I s).iUnion = I 
goal: (BoxIntegral.Prepartition.splitMany I s).iUnion = ↑I

full_name: BoxIntegral.Prepartition.inf_splitMany
code: theorem inf_splitMany {I : Box ι} (π : Prepartition I) (s : Finset (ι × ℝ)) :
    π ⊓ splitMany I s = π.biUnion fun J => splitMany J s 
goal: π ⊓ BoxIntegral.Prepartition.splitMany I s = π.biUnion fun J => BoxIntegral.Prepartition.splitMany J s

full_name: BoxIntegral.Prepartition.not_disjoint_imp_le_of_subset_of_mem_splitMany
code: /-- Let `s : Finset (ι × ℝ)` be a set of hyperplanes `{x : ι → ℝ | x i = r}` in `ι → ℝ` encoded as
pairs `(i, r)`. Suppose that this set contains all faces of a box `J`. The hyperplanes of `s` split
a box `I` into subboxes. Let `Js` be one of them. If `J` and `Js` have nonempty intersection, then
`Js` is a subbox of `J`.  -/
theorem not_disjoint_imp_le_of_subset_of_mem_splitMany {I J Js : Box ι} {s : Finset (ι × ℝ)}
    (H : ∀ i, {(i, J.lower i), (i, J.upper i)} ⊆ s) (HJs : Js ∈ splitMany I s)
    (Hn : ¬Disjoint (J : WithBot (Box ι)) Js) : Js ≤ J 
goal: Js ≤ J

full_name: BoxIntegral.Prepartition.eventually_not_disjoint_imp_le_of_mem_splitMany
code: /-- Let `s` be a finite set of boxes in `ℝⁿ = ι → ℝ`. Then there exists a finite set `t₀` of
hyperplanes (namely, the set of all hyperfaces of boxes in `s`) such that for any `t ⊇ t₀`
and any box `I` in `ℝⁿ` the following holds. The hyperplanes from `t` split `I` into subboxes.
Let `J'` be one of them, and let `J` be one of the boxes in `s`. If these boxes have a nonempty
intersection, then `J' ≤ J`. -/
theorem eventually_not_disjoint_imp_le_of_mem_splitMany (s : Finset (Box ι)) :
    ∀ᶠ t : Finset (ι × ℝ) in atTop, ∀ (I : Box ι), ∀ J ∈ s, ∀ J' ∈ splitMany I t,
      ¬Disjoint (J : WithBot (Box ι)) J' → J' ≤ J 
goal: ∀ᶠ (t : Finset (ι × ℝ)) in Filter.atTop,
  ∀ (I J : BoxIntegral.Box ι), J ∈ s → ∀ J' ∈ BoxIntegral.Prepartition.splitMany I t, ¬Disjoint ↑J ↑J' → J' ≤ J

full_name: BoxIntegral.Prepartition.eventually_splitMany_inf_eq_filter
code: theorem eventually_splitMany_inf_eq_filter (π : Prepartition I) :
    ∀ᶠ t : Finset (ι × ℝ) in atTop,
      π ⊓ splitMany I t = (splitMany I t).filter fun J => ↑J ⊆ π.iUnion 
goal: ∀ᶠ (t : Finset (ι × ℝ)) in Filter.atTop,
  π ⊓ BoxIntegral.Prepartition.splitMany I t = (BoxIntegral.Prepartition.splitMany I t).filter fun J => ↑J ⊆ π.iUnion

full_name: BoxIntegral.Prepartition.exists_splitMany_inf_eq_filter_of_finite
code: theorem exists_splitMany_inf_eq_filter_of_finite (s : Set (Prepartition I)) (hs : s.Finite) :
    ∃ t : Finset (ι × ℝ),
      ∀ π ∈ s, π ⊓ splitMany I t = (splitMany I t).filter fun J => ↑J ⊆ π.iUnion 
goal: ∃ t,
  ∀ π ∈ s,
    π ⊓ BoxIntegral.Prepartition.splitMany I t = (BoxIntegral.Prepartition.splitMany I t).filter fun J => ↑J ⊆ π.iUnion

full_name: BoxIntegral.Prepartition.IsPartition.exists_splitMany_le
code: /-- If `π` is a partition of `I`, then there exists a finite set `s` of hyperplanes such that
`splitMany I s ≤ π`. -/
theorem IsPartition.exists_splitMany_le {I : Box ι} {π : Prepartition I} (h : IsPartition π) :
    ∃ s, splitMany I s ≤ π 
goal: ∃ s, BoxIntegral.Prepartition.splitMany I s ≤ π

full_name: BoxIntegral.Prepartition.exists_iUnion_eq_diff
code: /-- For every prepartition `π` of `I` there exists a prepartition that covers exactly
`I \ π.iUnion`. -/
theorem exists_iUnion_eq_diff (π : Prepartition I) :
    ∃ π' : Prepartition I, π'.iUnion = ↑I \ π.iUnion 
goal: ∃ π', π'.iUnion = ↑I \ π.iUnion

full_name: BoxIntegral.Prepartition.compl
code: /-- If `π` is a prepartition of `I`, then `π.compl` is a prepartition of `I`
such that `π.compl.iUnion = I \ π.iUnion`. -/
def compl (π : Prepartition I) : Prepartition I 
goal: BoxIntegral.Prepartition I

full_name: BoxIntegral.Prepartition.iUnion_compl
code: @[simp]
theorem iUnion_compl (π : Prepartition I) : π.compl.iUnion = ↑I \ π.iUnion 
goal: π.compl.iUnion = ↑I \ π.iUnion

full_name: BoxIntegral.Prepartition.compl_congr
code: /-- Since the definition of `BoxIntegral.Prepartition.compl` uses `Exists.choose`,
the result depends only on `π.iUnion`. -/
theorem compl_congr {π₁ π₂ : Prepartition I} (h : π₁.iUnion = π₂.iUnion) : π₁.compl = π₂.compl 
goal: π₁.compl = π₂.compl

full_name: BoxIntegral.Prepartition.IsPartition.compl_eq_bot
code: theorem IsPartition.compl_eq_bot {π : Prepartition I} (h : IsPartition π) : π.compl = ⊥ 
goal: π.compl = ⊥

full_name: BoxIntegral.Prepartition.compl_top
code: @[simp]
theorem compl_top : (⊤ : Prepartition I).compl = ⊥ 
goal: ⊤.compl = ⊥