# Documentation

Mathlib.Analysis.BoxIntegral.Box.Basic

# Rectangular boxes in ℝⁿ#

In this file we define rectangular boxes in ℝⁿ. As usual, we represent ℝⁿ as the type of functions ι → ℝ (usually ι = Fin n for some n). When we need to interpret a box [l, u] as a set, we use the product {x | ∀ i, l i < x i ∧ x i ≤ u i} of half-open intervals (l i, u i]. We exclude l i because this way boxes of a partition are disjoint as sets in ℝⁿ.

Currently, the only use cases for these constructions are the definitions of Riemann-style integrals (Riemann, Henstock-Kurzweil, McShane).

## Main definitions #

We use the same structure BoxIntegral.Box both for ambient boxes and for elements of a partition. Each box is stored as two points lower upper : ι → ℝ and a proof of ∀ i, lower i < upper i. We define instances Membership (ι → ℝ) (Box ι) and CoeTC (Box ι) (Set <| ι → ℝ) so that each box is interpreted as the set {x | ∀ i, x i ∈ Set.Ioc (I.lower i) (I.upper i)}. This way boxes of a partition are pairwise disjoint and their union is exactly the original box.

We require boxes to be nonempty, because this way coercion to sets is injective. The empty box can be represented as ⊥ : WithBot (BoxIntegral.Box ι).

We define the following operations on boxes:

• coercion to Set (ι → ℝ) and Membership (ι → ℝ) (BoxIntegral.Box ι) as described above;
• PartialOrder and SemilatticeSup instances such that I ≤ J is equivalent to (I : Set (ι → ℝ)) ⊆ J;
• Lattice instances on WithBot (BoxIntegral.Box ι);
• BoxIntegral.Box.Icc: the closed box Set.Icc I.lower I.upper; defined as a bundled monotone map from Box ι to Set (ι → ℝ);
• BoxIntegral.Box.face I i : Box (Fin n): a hyperface of I : BoxIntegral.Box (Fin (n + 1));
• BoxIntegral.Box.distortion: the maximal ratio of two lengths of edges of a box; defined as the supremum of nndist I.lower I.upper / nndist (I.lower i) (I.upper i).

We also provide a convenience constructor BoxIntegral.Box.mk' (l u : ι → ℝ) : WithBot (Box ι) that returns the box ⟨l, u, _⟩ if it is nonempty and ⊥ otherwise.

## Tags #

rectangular box

### Rectangular box: definition and partial order #

structure BoxIntegral.Box (ι : Type u_2) :
Type u_2
• lower : ι
• upper : ι
• lower_lt_upper : ∀ (i : ι),

A nontrivial rectangular box in ι → ℝ with corners lower and upper. Represents the product of half-open intervals (lower i, upper i].

Instances For
theorem BoxIntegral.Box.lower_le_upper {ι : Type u_1} (I : ) :
I.lower I.upper
theorem BoxIntegral.Box.lower_ne_upper {ι : Type u_1} (I : ) (i : ι) :
def BoxIntegral.Box.toSet {ι : Type u_1} (I : ) :
Set (ι)
Instances For
@[simp]
theorem BoxIntegral.Box.mem_mk {ι : Type u_1} {l : ι} {u : ι} {x : ι} {H : ∀ (i : ι), l i < u i} :
x { lower := l, upper := u, lower_lt_upper := H } ∀ (i : ι), x i Set.Ioc (l i) (u i)
@[simp]
theorem BoxIntegral.Box.mem_coe {ι : Type u_1} (I : ) {x : ι} :
x I x I
theorem BoxIntegral.Box.mem_def {ι : Type u_1} (I : ) {x : ι} :
x I ∀ (i : ι), x i Set.Ioc () ()
theorem BoxIntegral.Box.mem_univ_Ioc {ι : Type u_1} {x : ι} {I : } :
(x Set.pi Set.univ fun i => Set.Ioc () ()) x I
theorem BoxIntegral.Box.coe_eq_pi {ι : Type u_1} (I : ) :
I = Set.pi Set.univ fun i => Set.Ioc () ()
@[simp]
theorem BoxIntegral.Box.upper_mem {ι : Type u_1} (I : ) :
I.upper I
theorem BoxIntegral.Box.exists_mem {ι : Type u_1} (I : ) :
x, x I
theorem BoxIntegral.Box.nonempty_coe {ι : Type u_1} (I : ) :
@[simp]
theorem BoxIntegral.Box.coe_ne_empty {ι : Type u_1} (I : ) :
I
@[simp]
theorem BoxIntegral.Box.empty_ne_coe {ι : Type u_1} (I : ) :
I
theorem BoxIntegral.Box.le_def {ι : Type u_1} (I : ) (J : ) :
I J ∀ (x : ι), x Ix J
theorem BoxIntegral.Box.le_TFAE {ι : Type u_1} (I : ) (J : ) :
List.TFAE [I J, I J, Set.Icc I.lower I.upper Set.Icc J.lower J.upper, J.lower I.lower I.upper J.upper]
@[simp]
theorem BoxIntegral.Box.coe_subset_coe {ι : Type u_1} {I : } {J : } :
I J I J
theorem BoxIntegral.Box.le_iff_bounds {ι : Type u_1} {I : } {J : } :
I J J.lower I.lower I.upper J.upper
theorem BoxIntegral.Box.injective_coe {ι : Type u_1} :
Function.Injective BoxIntegral.Box.toSet
@[simp]
theorem BoxIntegral.Box.coe_inj {ι : Type u_1} {I : } {J : } :
I = J I = J
theorem BoxIntegral.Box.ext {ι : Type u_1} {I : } {J : } (H : ∀ (x : ι), x I x J) :
I = J
theorem BoxIntegral.Box.ne_of_disjoint_coe {ι : Type u_1} {I : } {J : } (h : Disjoint I J) :
I J
def BoxIntegral.Box.Icc {ι : Type u_1} :
↪o Set (ι)

Closed box corresponding to I : BoxIntegral.Box ι.

Instances For
theorem BoxIntegral.Box.Icc_def {ι : Type u_1} {I : } :
BoxIntegral.Box.Icc I = Set.Icc I.lower I.upper
@[simp]
theorem BoxIntegral.Box.upper_mem_Icc {ι : Type u_1} (I : ) :
I.upper BoxIntegral.Box.Icc I
@[simp]
theorem BoxIntegral.Box.lower_mem_Icc {ι : Type u_1} (I : ) :
I.lower BoxIntegral.Box.Icc I
theorem BoxIntegral.Box.isCompact_Icc {ι : Type u_1} (I : ) :
IsCompact (BoxIntegral.Box.Icc I)
theorem BoxIntegral.Box.Icc_eq_pi {ι : Type u_1} {I : } :
BoxIntegral.Box.Icc I = Set.pi Set.univ fun i => Set.Icc () ()
theorem BoxIntegral.Box.le_iff_Icc {ι : Type u_1} {I : } {J : } :
I J BoxIntegral.Box.Icc I BoxIntegral.Box.Icc J
theorem BoxIntegral.Box.antitone_lower {ι : Type u_1} :
Antitone fun I => I.lower
theorem BoxIntegral.Box.monotone_upper {ι : Type u_1} :
Monotone fun I => I.upper
theorem BoxIntegral.Box.coe_subset_Icc {ι : Type u_1} {I : } :
I BoxIntegral.Box.Icc I

### Supremum of two boxes #

instance BoxIntegral.Box.instSupBox {ι : Type u_1} :

I ⊔ J is the least box that includes both I and J. Since ↑I ∪ ↑J is usually not a box, ↑(I ⊔ J) is larger than ↑I ∪ ↑J.

### WithBot (Box ι)#

In this section we define coercion from WithBot (Box ι) to Set (ι → ℝ) by sending ⊥ to ∅.

def BoxIntegral.Box.withBotToSet {ι : Type u_1} (o : ) :
Set (ι)
Instances For
instance BoxIntegral.Box.withBotCoe {ι : Type u_1} :
CoeTC () (Set (ι))
@[simp]
theorem BoxIntegral.Box.coe_bot {ι : Type u_1} :
=
@[simp]
theorem BoxIntegral.Box.coe_coe {ι : Type u_1} {I : } :
I = I
theorem BoxIntegral.Box.isSome_iff {ι : Type u_1} {I : } :
theorem BoxIntegral.Box.biUnion_coe_eq_coe {ι : Type u_1} (I : ) :
⋃ (J : ) (_ : J = I), J = I
@[simp]
theorem BoxIntegral.Box.withBotCoe_subset_iff {ι : Type u_1} {I : } {J : } :
I J I J
@[simp]
theorem BoxIntegral.Box.withBotCoe_inj {ι : Type u_1} {I : } {J : } :
I = J I = J
def BoxIntegral.Box.mk' {ι : Type u_1} (l : ι) (u : ι) :

Make a WithBot (Box ι) from a pair of corners l u : ι → ℝ. If l i < u i for all i, then the result is ⟨l, u, _⟩ : Box ι, otherwise it is ⊥. In any case, the result interpreted as a set in ι → ℝ is the set {x : ι → ℝ | ∀ i, x i ∈ Ioc (l i) (u i)}.

Instances For
@[simp]
theorem BoxIntegral.Box.mk'_eq_bot {ι : Type u_1} {l : ι} {u : ι} :
i, u i l i
@[simp]
theorem BoxIntegral.Box.mk'_eq_coe {ι : Type u_1} {I : } {l : ι} {u : ι} :
= I l = I.lower u = I.upper
@[simp]
theorem BoxIntegral.Box.coe_mk' {ι : Type u_1} (l : ι) (u : ι) :
↑() = Set.pi Set.univ fun i => Set.Ioc (l i) (u i)
@[simp]
theorem BoxIntegral.Box.coe_inf {ι : Type u_1} (I : ) (J : ) :
↑(I J) = I J
@[simp]
theorem BoxIntegral.Box.disjoint_withBotCoe {ι : Type u_1} {I : } {J : } :
Disjoint I J Disjoint I J
theorem BoxIntegral.Box.disjoint_coe {ι : Type u_1} {I : } {J : } :
Disjoint I J Disjoint I J
theorem BoxIntegral.Box.not_disjoint_coe_iff_nonempty_inter {ι : Type u_1} {I : } {J : } :
¬Disjoint I J Set.Nonempty (I J)

### Hyperface of a box in ℝⁿ⁺¹ = Fin (n + 1) → ℝ#

@[simp]
theorem BoxIntegral.Box.face_upper {n : } (I : BoxIntegral.Box (Fin (n + 1))) (i : Fin (n + 1)) :
∀ (a : Fin n),
@[simp]
theorem BoxIntegral.Box.face_lower {n : } (I : BoxIntegral.Box (Fin (n + 1))) (i : Fin (n + 1)) :
∀ (a : Fin n),
def BoxIntegral.Box.face {n : } (I : BoxIntegral.Box (Fin (n + 1))) (i : Fin (n + 1)) :

Face of a box in ℝⁿ⁺¹ = Fin (n + 1) → ℝ: the box in ℝⁿ = Fin n → ℝ with corners at I.lower ∘ Fin.succAbove i and I.upper ∘ Fin.succAbove i.

Instances For
@[simp]
theorem BoxIntegral.Box.face_mk {n : } (l : Fin (n + 1)) (u : Fin (n + 1)) (h : ∀ (i : Fin (n + 1)), l i < u i) (i : Fin (n + 1)) :
BoxIntegral.Box.face { lower := l, upper := u, lower_lt_upper := h } i = { lower := , upper := , lower_lt_upper := fun x => h () }
theorem BoxIntegral.Box.face_mono {n : } {I : BoxIntegral.Box (Fin (n + 1))} {J : BoxIntegral.Box (Fin (n + 1))} (h : I J) (i : Fin (n + 1)) :
theorem BoxIntegral.Box.monotone_face {n : } (i : Fin (n + 1)) :
Monotone fun I =>
theorem BoxIntegral.Box.mapsTo_insertNth_face_Icc {n : } (I : BoxIntegral.Box (Fin (n + 1))) {i : Fin (n + 1)} {x : } (hx : x Set.Icc () ()) :
Set.MapsTo () (BoxIntegral.Box.Icc ()) (BoxIntegral.Box.Icc I)
theorem BoxIntegral.Box.mapsTo_insertNth_face {n : } (I : BoxIntegral.Box (Fin (n + 1))) {i : Fin (n + 1)} {x : } (hx : x Set.Ioc () ()) :
Set.MapsTo () ↑() I
theorem BoxIntegral.Box.continuousOn_face_Icc {X : Type u_2} [] {n : } {f : (Fin (n + 1)) → X} {I : BoxIntegral.Box (Fin (n + 1))} (h : ContinuousOn f (BoxIntegral.Box.Icc I)) {i : Fin (n + 1)} {x : } (hx : x Set.Icc () ()) :
ContinuousOn (f ) (BoxIntegral.Box.Icc ())

### Covering of the interior of a box by a monotone sequence of smaller boxes #

def BoxIntegral.Box.Ioo {ι : Type u_1} :
→o Set (ι)

The interior of a box.

Instances For
theorem BoxIntegral.Box.Ioo_subset_coe {ι : Type u_1} (I : ) :
BoxIntegral.Box.Ioo I I
theorem BoxIntegral.Box.Ioo_subset_Icc {ι : Type u_1} (I : ) :
BoxIntegral.Box.Ioo I BoxIntegral.Box.Icc I
theorem BoxIntegral.Box.iUnion_Ioo_of_tendsto {ι : Type u_1} [] {I : } {J : } (hJ : ) (hl : Filter.Tendsto (BoxIntegral.Box.lower J) Filter.atTop (nhds I.lower)) (hu : Filter.Tendsto (BoxIntegral.Box.upper J) Filter.atTop (nhds I.upper)) :
⋃ (n : ), BoxIntegral.Box.Ioo (J n) = BoxIntegral.Box.Ioo I
theorem BoxIntegral.Box.exists_seq_mono_tendsto {ι : Type u_1} (I : ) :
J, (∀ (n : ), BoxIntegral.Box.Icc (J n) BoxIntegral.Box.Ioo I) Filter.Tendsto (BoxIntegral.Box.lower J) Filter.atTop (nhds I.lower) Filter.Tendsto (BoxIntegral.Box.upper J) Filter.atTop (nhds I.upper)
def BoxIntegral.Box.distortion {ι : Type u_1} [] (I : ) :

The distortion of a box I is the maximum of the ratios of the lengths of its edges. It is defined as the maximum of the ratios nndist I.lower I.upper / nndist (I.lower i) (I.upper i).

Instances For
theorem BoxIntegral.Box.distortion_eq_of_sub_eq_div {ι : Type u_1} [] {I : } {J : } {r : } (h : ∀ (i : ι), = () / r) :
theorem BoxIntegral.Box.nndist_le_distortion_mul {ι : Type u_1} [] (I : ) (i : ι) :
nndist I.lower I.upper
theorem BoxIntegral.Box.dist_le_distortion_mul {ι : Type u_1} [] (I : ) (i : ι) :
dist I.lower I.upper
theorem BoxIntegral.Box.diam_Icc_le_of_distortion_le {ι : Type u_1} [] (I : ) (i : ι) {c : NNReal} (h : ) :
Metric.diam (BoxIntegral.Box.Icc I) c * ()