Documentation

Analysis.MeasureTheory.Section_1_2_1

Introduction to Measure Theory, Section 1.2.1: Properties of Lebesgue outer measure #

A companion to (the introduction to) Section 1.2.1 of the book "An introduction to Measure Theory".

Exercise 1.2.3(i) (Empty set)

Exercise 1.2.3(ii) (Monotonicity)

Lebesgue outer measure is non-negative. Since it's the sInf of sums of box volumes, which are all ≥ 0, the result is ≥ 0.

Exercise 1.2.3(iii) (Countable subadditivity)

theorem Lebesgue_outer_measure.finite_union_le {d n : } (E : Fin nSet (EuclideanSpace' d)) :
Lebesgue_outer_measure (⋃ (i : Fin n), E i) i : Fin n, Lebesgue_outer_measure (E i)

Finite subadditivity

noncomputable def set_dist {X : Type u_1} [PseudoMetricSpace X] (A B : Set X) :
Equations
Instances For

    Extract the left and right endpoints of a BoundedInterval. Returns (a, b) where a is the left endpoint and b is the right endpoint.

    Equations
    Instances For

      Compute the midpoint of a BoundedInterval.

      Equations
      Instances For

        Bisect a BoundedInterval into left and right halves using closed intervals. Left half: [a, m], Right half: [m, b], where m is the midpoint. Using closed intervals ensures coverage (union equals original) while maintaining measure-theoretic properties (overlap has measure zero).

        Equations
        Instances For

          The left half of bisection has half the original length

          The right half of bisection has half the original length

          Bisecting preserves total length

          @[simp]

          The left endpoint of bisect.fst is I.a

          @[simp]

          The left endpoint of bisect.snd is I.midpoint

          The midpoint equals a + length/2 when a ≤ b (non-degenerate interval)

          The midpoint is in the first half of bisection (as the right endpoint of Icc)

          The midpoint is in the second half of bisection (as the left endpoint of Icc)

          theorem BoundedInterval.mem_bisect_snd_iff (I : BoundedInterval) (x : ) (hx : x I) :
          x I.bisect.2 x I.midpoint

          A point is in I.bisect.snd iff it's in I.toSet and at or above the midpoint

          theorem BoundedInterval.mem_bisect_fst_iff (I : BoundedInterval) (x : ) (hx : x I) :
          x I.bisect.1 x I.midpoint

          A point is in I.bisect.fst iff it's in I.toSet and below the midpoint

          theorem BoundedInterval.bisect_fst_eq_endpoints {I₁ I₂ : BoundedInterval} (h : I₁.bisect.1 = I₂.bisect.1) :
          I₁.a = I₂.a I₁.b = I₂.b

          If two intervals have equal bisect.fst, then their endpoints match

          theorem BoundedInterval.bisect_snd_eq_endpoints {I₁ I₂ : BoundedInterval} (h : I₁.bisect.2 = I₂.bisect.2) :
          I₁.a = I₂.a I₁.b = I₂.b

          If two intervals have equal bisect.snd, then their endpoints match

          theorem BoundedInterval.bisect_fst_eq_snd_shift {I₁ I₂ : BoundedInterval} (h : I₁.bisect.1 = I₂.bisect.2) :
          I₁.a = (I₂.a + I₂.b) / 2

          Cross-case: if bisect.fst = bisect.snd, the intervals have overlapping midpoint and endpoint

          noncomputable def Box.diameter {d : } (B : Box d) :

          The diameter of a box is the supremum of Euclidean distances between points in the box

          Equations
          Instances For
            theorem Box.diameter_nonneg {d : } (B : Box d) :

            Diameter is always nonnegative

            theorem Box.diameter_of_empty {d : } (B : Box d) (h : B = ) :

            Empty box has diameter 0

            theorem Box.dist_le_diameter {d : } (B : Box d) {x y : EuclideanSpace' d} (hx : x B) (hy : y B) :
            (∑ i : Fin d, (x i - y i) ^ 2) B.diameter

            Any two points in a box have Euclidean distance at most the diameter

            theorem Box.BoundedInterval.exists_points_with_diff {I : BoundedInterval} (h_nonempty : (↑I).Nonempty) {t : } (ht_nonneg : 0 t) (ht : t < I.length) :
            xI, yI, t < |x - y|

            For any nonempty interval and target value less than the length, we can find two points in the interval with separation exceeding the target. This is the key density fact: achievable differences are dense in [0, length].

            theorem Box.diameter_eq_sqrt_sum_sq {d : } (B : Box d) (h : (↑B).Nonempty) :
            B.diameter = (∑ i : Fin d, (B.side i).length ^ 2)

            The diameter of a nonempty box equals the diagonal length √(∑ |side i|ₗ²). This is the key fact: the supremum of pairwise distances equals the diagonal. For closed intervals, the diagonal is achieved at corners. For open intervals, the diagonal is the limit (supremum) of achievable distances.

            theorem Box.diameter_ge_dist_of_intersects {d : } (B : Box d) (E F : Set (EuclideanSpace' d)) (hE : (B E).Nonempty) (hF : (B F).Nonempty) :

            If a box intersects two sets, any two points (one from each set) in the box have distance at most the diameter

            theorem Box.not_intersects_both_of_diameter_lt {d : } (B : Box d) (E F : Set (EuclideanSpace' d)) (h : B.diameter < set_dist E F) :
            ¬((B E).Nonempty (B F).Nonempty)

            If B.diameter < set_dist E F, then B cannot intersect both E and F. This is the core geometric fact needed for finite additivity of separated sets.

            noncomputable instance Box.instDecidableEq {d : } :

            Decidable equality for boxes, needed for Finset operations

            Equations
            noncomputable def Box.subdivide {d : } (B : Box d) :

            Subdivide a box by bisecting each coordinate axis, producing 2^d sub-boxes. Each sub-box is formed by taking one half-interval from each coordinate. We use Finset.univ (all possible d-bit patterns) to enumerate all 2^d combinations.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem Box.volume_subdivide {d : } (B : Box d) :
              B'B.subdivide, B'.volume = B.volume

              The volume of a subdivided box equals the sum of its sub-box volumes

              theorem Box.subdivide_diameter_bound {d : } (B : Box d) (hB : (↑B).Nonempty) (B' : Box d) :

              Each sub-box of a subdivision has diameter at most the original diameter divided by √2. This follows because each side is halved, reducing the diagonal by a factor related to √2. Note: The hypothesis that B is nonempty is necessary because bisection always creates closed intervals, which can turn degenerate open intervals (Ioo a a) into nonempty singletons.

              noncomputable def Box.subdivide_iter {d : } (B : Box d) :
              Finset (Box d)

              Subdivide a box k times, producing a Finset of boxes. After k iterations, each original box becomes up to 2^(d*k) sub-boxes.

              Equations
              Instances For
                theorem Box.subdivide_side_is_Icc {d : } (B B' : Box d) (hB' : B' B.subdivide) (i : Fin d) :
                ∃ (a : ) (b : ), B'.side i = BoundedInterval.Icc a b

                All sides in subdivide (single level) are Icc intervals

                theorem Box.subdivide_iter_side_is_Icc {d : } (B : Box d) (k : ) (B' : Box d) (hB' : B' B.subdivide_iter (k + 1)) (i : Fin d) :
                ∃ (a : ) (b : ), B'.side i = BoundedInterval.Icc a b

                All sides in subdivide_iter for k ≥ 1 are Icc intervals

                theorem Box.subdivide_iter_side_length {d : } (B : Box d) (k : ) (B' : Box d) (hB' : B' B.subdivide_iter k) (i : Fin d) :
                (B'.side i).length = (B.side i).length / 2 ^ k

                All boxes in subdivide_iter have the same side lengths at each coordinate

                theorem Box.subdivide_one_step_nonempty {d : } (B : Box d) (hB : (↑B).Nonempty) (B' : Box d) :
                B' B.subdivide(↑B').Nonempty

                A nonempty box remains nonempty after subdivision

                theorem Box.subdivide_iter_nonempty {d : } (B : Box d) (hB : (↑B).Nonempty) (k : ) (B' : Box d) :
                B' B.subdivide_iter k(↑B').Nonempty

                A nonempty box remains nonempty after k iterations of subdivision

                theorem Box.subdivide_iter_side_grid {d : } (B : Box d) (hB : (↑B).Nonempty) (k : ) (B' : Box d) (hB' : B' B.subdivide_iter k) (i : Fin d) :
                j < 2 ^ k, (B'.side i).a = (B.side i).a + j * ((B.side i).length / 2 ^ k)

                Grid alignment: sides in subdivide_iter start at grid positions. Requires nonempty box to ensure sides have a ≤ b (backwards intervals break the formula).

                theorem Box.volume_subdivide_iter {d : } (B : Box d) (hB : (↑B).Nonempty) (k : ) :
                B'B.subdivide_iter k, B'.volume = B.volume

                Volume is preserved through iterative subdivision

                theorem Box.diameter_subdivide_iter {d : } (B : Box d) (hB : (↑B).Nonempty) (k : ) (B' : Box d) :

                Diameter bound after k iterations of subdivision. Each iteration reduces diameter by factor of √2.

                noncomputable def Box.iter_count {d : } (B : Box d) (r : ) :

                Number of subdivisions needed to get diameter below threshold r. Each subdivision reduces diameter by factor of √2, so after k iterations: diameter ≤ original_diameter / (√2)^k We need (√2)^k > diameter/r, i.e., k > log(diameter/r) / log(√2) = 2·log₂(diameter/r).

                Equations
                Instances For
                  theorem Box.diameter_lt_of_iter_count {d : } (B : Box d) (hB : (↑B).Nonempty) (r : ) (hr : 0 < r) (B' : Box d) :
                  B' B.subdivide_iter (B.iter_count r)B'.diameter < r

                  After iter_count subdivisions, all sub-boxes have diameter < r

                  theorem Box.subdivide_iter_covers {d : } (B : Box d) (k : ) (x : EuclideanSpace' d) (hx : x B) :
                  B'B.subdivide_iter k, x B'

                  Subdivided boxes cover the original box: any point in B.toSet is contained in some box in subdivide_iter B k.

                  theorem Box.volume_nonneg {d : } (B : Box d) :

                  Box volume is non-negative (product of non-negative interval lengths).

                  theorem Box.isCompact {d : } (B : Box d) (h_closed : ∀ (i : Fin d), ∃ (a : ) (b : ), B.side i = BoundedInterval.Icc a b) :

                  Closed boxes (all sides are Icc) in Euclidean space are compact sets.

                  theorem Lebesgue_outer_measure.le_of_nat_cover {d : } (hd : 0 < d) (E : Set (EuclideanSpace' d)) (S : Box d) (hcover : E ⋃ (n : ), (S n)) :

                  Any ℕ-indexed cover gives an upper bound on outer measure. Follows directly from the infimum definition.

                  theorem Lebesgue_outer_measure.le_of_finset_cover {d : } (hd : 0 < d) (E : Set (EuclideanSpace' d)) (I : Finset (Box d)) (hcover : E ⋃ (n : ), BI n, B) :
                  Lebesgue_outer_measure E ∑' (n : ), (∑ BI n, B.volume)

                  Upper bound from finset-indexed cover: if a set is covered by ⋃ n, ⋃ B ∈ I n, B.toSet where each I n is a finite set of boxes, then the outer measure is bounded by the sum of volumes.

                  Proof strategy:

                  1. The sigma type (n : ℕ) × ↑(I n) is countable (and hence encodable)
                  2. Use Encodable instance to define S : ℕ → Box d via decoding
                  3. Pad with zero-volume box for invalid decodings
                  4. Apply le_of_nat_cover and bound the enumerated sum
                  theorem Lebesgue_outer_measure.exists_cover_close {d : } (hd : 0 < d) (E : Set (EuclideanSpace' d)) (ε : ) ( : 0 < ε) (h_finite : Lebesgue_outer_measure E ) :
                  ∃ (S : Box d), E ⋃ (n : ), (S n) ∑' (n : ), (S n).volume Lebesgue_outer_measure E + ε

                  For any set with finite outer measure, we can find a cover whose volume is within ε of the outer measure. This follows from the definition of outer measure as an infimum.

                  Lemma 1.2.5 (Finite additivity for separated sets). If E and F are separated (dist(E,F) > 0), then m*(E ∪ F) = m*(E) + m*(F).

                  Proof strategy (from textbook):

                  1. Direction ≤: Use subadditivity
                  2. Direction ≥: Show m*(E ∪ F) ≥ m*(E) + m*(F)
                    • If m*(E ∪ F) = ⊤, trivial
                    • If m*(E ∪ F) < ⊤:
                      • Get epsilon-close cover of E ∪ F
                      • Refine cover so all boxes have diameter < dist(E,F)
                      • Partition boxes into E-intersecting and F-intersecting (disjoint by geometric separation)
                      • Sum volumes separately: m*(E) + m*(F) ≤ sum of refined cover ≤ m*(E ∪ F) + ε
                      • Take ε → 0 to conclude
                  theorem dist_of_disj_compact_pos {d : } (E F : Set (EuclideanSpace' d)) (hE : IsCompact E) (hF : IsCompact F) (hdisj : E F = ) :
                  set_dist E F > 0

                  Exercise 1.2.4

                  theorem tsum_geometric_inflate {δ : } (_hδ : 0 < δ) :
                  ∑' (n : ), δ / 2 ^ (n + 2) = δ / 2

                  Sum of geometric series δ/2^{n+2} equals δ/2

                  theorem card_ratio_bound {α : Type u_1} {P_nonempty P : Finset α} (hP_nonempty_sub : P_nonempty P) {δ : } (hδ_pos : 0 < δ) (hcard_pos : 0 < P.card) :
                  P_nonempty.card * (δ / (4 * P.card)) δ / 4

                  When P_nonempty ⊆ P, the loss from scaling is bounded by δ/4.

                  theorem partition_volume_bound {d : } {P P_nonempty : Finset (Box d)} (_hP_nonempty_sub : P_nonempty P) {B' : (B : Box d) → B P_nonemptyBox d} {ε : } (_hε_pos : 0 < ε) (h_vol_bound : ∀ (B : Box d) (hB : B P_nonempty), B.volume (B' B hB).volume + ε) :
                  BP_nonempty, B.volume x : { B : Box d // B P_nonempty }, (B' x ).volume + P_nonempty.card * ε

                  Sum bound from partition filter: if volumes B' satisfy B.vol ≤ B'.vol + ε, then summing over P_nonempty gives total bound with card * ε term.

                  theorem injective_of_shrunk_nonempty {d : } {P P_nonempty : Finset (Box d)} (hP_nonempty_sub : P_nonempty P) {B' : (B : Box d) → B P_nonemptyBox d} (hP_disj : (↑P).PairwiseDisjoint Box.toSet) (h_sub : ∀ (B : Box d) (hB : B P_nonempty), (B' B hB) B) (h_nonempty : ∀ (B : Box d) (hB : B P_nonempty), (↑(B' B hB)).Nonempty) :
                  Function.Injective fun (x : { B : Box d // B P_nonempty }) => B' x

                  Shrunk boxes B' inherit injectivity from parent boxes' disjointness when B' are nonempty.

                  Every bounded interval (Ioo, Icc, Ioc, Ico) is a bounded set

                  theorem Box.isBounded {d : } (B : Box d) :

                  Every box is bounded (product of bounded intervals)

                  theorem Box.inflate {d : } (B : Box d) (δ : ) ( : 0 < δ) :
                  ∃ (B' : Box d), B interior B' IsOpen (interior B') B'.volume B.volume + δ

                  Enlarge a box to an open box with controlled volume increase

                  theorem Box.shrink_to_closed {d : } (B : Box d) (hB : (↑B).Nonempty) (δ : ) ( : 0 < δ) :
                  ∃ (B' : Box d), B' B IsClosed B' B'.volume B.volume - δ (↑B').Nonempty

                  Shrink a box to a closed sub-box with controlled volume decrease. The output is always nonempty when the input is nonempty.

                  Elementary sets are bounded (finite union of bounded boxes)

                  theorem IsElementary.measure_of_empty_eq {d : } {E : Set (EuclideanSpace' d)} (hE : IsElementary E) (hempty : E = ) :
                  hE.measure = 0

                  Elementary measure of empty set is zero (handles proof term mismatch)

                  theorem IsElementary.iUnion_boxes {d : } {ι : Type u_1} [Fintype ι] (B : ιBox d) :
                  IsElementary (⋃ (i : ι), (B i))

                  Finite indexed union of boxes is elementary (uses IsElementary.union' which takes a finset of sets)

                  theorem IsElementary.measure_le_finset_boxes_volume' {d : } (t : Finset ) (B : Box d) :
                  .measure nt, (B n).volume

                  The measure of a finite union of boxes (indexed by finset membership) is at most the sum of volumes. This is finite subadditivity specialized to boxes with a finset index.

                  theorem IsElementary.measure_le_cover_sum {d : } (_hd : 0 < d) {E : Set (EuclideanSpace' d)} (hE : IsElementary E) (S : Box d) (hS_cover : E ⋃ (n : ), (S n)) :
                  hE.measure ∑' (n : ), (S n).volume

                  For any box cover of an elementary set, the sum of volumes bounds the measure from below. This is the key step using Heine-Borel compactness: inflate boxes to open cover, extract finite subcover of compact approximation, use finite subadditivity.

                  Direction 1: Elementary measure is a lower bound for outer measure (Partition gives a finite cover, outer measure is infimum over covers) Uses measure_le_cover_sum for the core Heine-Borel argument.

                  Direction 2: Outer measure is bounded by elementary measure (Uses: m*(E) ≤ J*(E) for bounded E, and J*(E) ≤ hE.measure for elementary E)

                  Dimension 0 case of Lemma 1.2.6

                  Lemma 1.2.6 (Outer measure of elementary sets). For any elementary set E, Lebesgue outer measure equals elementary measure.

                  Cantor's theorem

                  The distance on EuclideanSpace' 1 equals the distance in ℝ via equiv_Real

                  Preimage of closed interval [a,b] under equiv_Real equals the corresponding 1D box

                  theorem tsum_geometric_eps (ε : ) (_hε : 0 < ε) :
                  ∑' (n : ), ε / 2 ^ (n + 1) = ε

                  Geometric series: ∑ ε/2^{n+1} = ε

                  theorem tsum_interval_lengths (ε : ) ( : 0 < ε) :
                  ∑' (n : ), 2 * ε / 2 ^ (n + 1) = 2 * ε

                  The sum of interval lengths is 2ε

                  theorem tsum_interval_summable (ε : ) :
                  Summable fun (n : ) => 2 * ε / 2 ^ (n + 1)

                  Summability of the geometric series

                  Lebesgue outer measure of a closed interval [a,b] equals b - a

                  Lebesgue measure of an open interval ≤ length (when a < b)

                  Monotonicity of Jordan outer measure, for two bounded sets

                  Rationals in [0,1] form a nonempty countable set.

                  noncomputable def Remark_1_2_8.q_enum :
                  { x : // x Set.Icc 0 1 Set.range fun (q : ) => q }

                  An enumeration function of rationals in [0,1]

                  Equations
                  Instances For
                    noncomputable def Remark_1_2_8.q (n : ) :

                    An enumeration of rationals in [0,1] as real numbers

                    Equations
                    Instances For
                      theorem Remark_1_2_8.q_mem (n : ) :
                      q n Set.Icc 0 1 Set.range fun (r : ) => r
                      theorem Remark_1_2_8.q_surj (x : ) :
                      (x Set.Icc 0 1 Set.range fun (r : ) => r) → ∃ (n : ), q n = x
                      noncomputable def Remark_1_2_8.U_real (ε : ) :

                      The counterexample set U: union of open intervals around rationals in [0,1]. U(ε) = ⋃_{n:ℕ} (q_n - ε/2^{n+1}, q_n + ε/2^{n+1})

                      Equations
                      Instances For
                        noncomputable def Remark_1_2_8.U (ε : ) :

                        The set U lifted to EuclideanSpace' 1

                        Equations
                        Instances For

                          U_real is open (union of open intervals)

                          theorem Remark_1_2_8.U_isOpen (ε : ) :
                          IsOpen (U ε)

                          U is open in EuclideanSpace' 1

                          noncomputable def Remark_1_2_8.radius (ε : ) (n : ) :

                          The radius at step n

                          Equations
                          Instances For
                            theorem Remark_1_2_8.U_real_subset (ε : ) ( : 0 < ε) :
                            U_real ε Set.Ioo (-ε) (1 + ε)

                            U_real is contained in (-ε, 1+ε)

                            theorem Remark_1_2_8.U_isBounded (ε : ) ( : 0 < ε) :

                            U is bounded

                            theorem Remark_1_2_8.component_lebesgue_le (ε : ) ( : 0 < ε) (n : ) :
                            Lebesgue_outer_measure (EuclideanSpace'.equiv_Real ⁻¹' Set.Ioo (q n - ε / 2 ^ (n + 1)) (q n + ε / 2 ^ (n + 1))) ↑(2 * ε / 2 ^ (n + 1))

                            Bound on each component interval's Lebesgue measure

                            Closure of U_real contains [0,1] (density of rationals)

                            @[reducible, inline]

                            Unit interval [0,1] as a BoundedInterval

                            Equations
                            Instances For
                              @[reducible, inline]

                              Unit box in 1D: [0,1] lifted to Box 1

                              Equations
                              Instances For

                                Unit interval as the preimage of [0,1] equals unit box

                                Volume of unit box is 1

                                Jordan outer measure of unit box is 1

                                Closure of U contains the preimage of [0,1]

                                theorem Remark_1_2_8.U_jordan_outer_ge (ε : ) ( : 0 < ε) :

                                Jordan outer measure of U ≥ 1. Proof uses: density of ℚ → closure(U) ⊇ [0,1] → Jordan_outer(U) ≥ Jordan_outer([0,1]) = 1.

                                theorem Remark_1_2_8.U_lebesgue_le (ε : ) ( : 0 < ε) :
                                Lebesgue_outer_measure (U ε) ↑(2 * ε)

                                Lebesgue outer measure of U ≤ 2ε (countable subadditivity). U = ⋃_n (q_n - ε/2^{n+1}, q_n + ε/2^{n+1}), each interval has length 2ε/2^{n+1}, and ∑ 2ε/2^{n+1} = 2ε.

                                Proof structure:

                                1. Express U as countable union: U = ⋃_n E_n
                                2. By countable subadditivity (union_le): m*(U) ≤ ∑' m*(E_n)
                                3. Each component bounded: m*(E_n) ≤ 2ε/2^{n+1} (component_lebesgue_le)
                                4. Geometric sum: ∑' 2ε/2^{n+1} = 2ε (tsum_interval_lengths)
                                5. EReal tsum comparison: ∑' m*(E_n) ≤ ∑' (2ε/2^{n+1}) = 2ε
                                def AlmostDisjoint {d : } (B B' : Box d) :
                                Equations
                                Instances For

                                  Measure is additive on unions of elementary sets with disjoint interiors: μ(E ∪ F) = μ(E) + μ(F).

                                  theorem Fin.iUnion_succ_eq_union_last {α : Type u_1} {n : } (f : Fin (n + 1)Set α) :
                                  ⋃ (i : Fin (n + 1)), f i = (⋃ (i : Fin n), f i.castSucc) f (last n)

                                  Split a Fin (n+1) indexed union into a Fin n indexed union plus the last element. This is a general helper for induction on finite unions.

                                  When boxes are pairwise almost-disjoint, restricting to the first n boxes preserves this.

                                  theorem AlmostDisjoint.castSucc_last {d n : } {B : Fin (n + 1)Box d} (hdisj : Pairwise (Function.onFun AlmostDisjoint B)) (i : Fin n) :

                                  When boxes are pairwise almost-disjoint, any of the first n is almost-disjoint from the last.

                                  For any BoundedInterval, interior (closure I) ⊆ closure (interior I). This holds because all interval types (Ioo, Icc, Ioc, Ico) have closure = Icc and interior = Ioo, so interior(closure(I)) = Ioo ⊆ Icc = closure(interior(I)).

                                  For any box, the interior of its frontier is empty. This holds regardless of whether the box uses closed intervals (Icc), open intervals (Ioo), or half-open intervals, because the frontier of a box is a lower-dimensional set (union of faces).

                                  theorem interior_iUnion_Box_frontier_eq_empty {d n : } (B : Fin nBox d) :
                                  interior (⋃ (i : Fin n), frontier (B i)) =

                                  The interior of a finite union of box frontiers is empty. This is because each box frontier is a closed set with empty interior, and we can apply interior_union_isClosed_of_interior_empty iteratively.

                                  theorem IsElementary.almost_disjoint {d k : } {E : Set (EuclideanSpace' d)} (hE : IsElementary E) (B : Fin kBox d) (hEB : E = ⋃ (i : Fin k), (B i)) (hdisj : Pairwise (Function.onFun AlmostDisjoint B)) :
                                  hE.measure = i : Fin k, (B i).volume
                                  theorem AlmostDisjoint.restrict_fin {d : } {B : Box d} (h : Pairwise (Function.onFun AlmostDisjoint B)) (N : ) :
                                  Pairwise (Function.onFun AlmostDisjoint fun (i : Fin N) => B i)

                                  Restricting pairwise almost-disjoint from ℕ to Fin N preserves the property.

                                  theorem EReal.tsum_le_of_sum_range_le {f : } {c : EReal} (hf : ∀ (n : ), 0 f n) (h : ∀ (N : ), iFinset.range N, (f i) c) :
                                  ∑' (n : ), (f n) c

                                  For nonneg Real sequences, if all partial sums are ≤ c (an EReal bound), then tsum ≤ c. This is the converse direction of EReal.finset_sum_le_tsum.

                                  Lemma 1.2.9 (Outer measure of countable unions of almost disjoint boxes). For pairwise almost disjoint boxes, m*(⋃ Bᵢ) = ∑' m*(Bᵢ) = ∑' |Bᵢ|.

                                  theorem Box.sum_volume_eq {d : } (B B' : Box d) (hdisj : Pairwise (Function.onFun AlmostDisjoint B)) (hdisj' : Pairwise (Function.onFun AlmostDisjoint B')) (hcover : ⋃ (n : ), (B n) = ⋃ (n : ), (B' n)) :
                                  ∑' (n : ), (B n).volume = ∑' (n : ), (B' n).volume

                                  Remark 1.2.10

                                  Exercise 1.2.5: For any set that equals a countable union of almost disjoint boxes, the Lebesgue outer measure equals the Jordan inner measure.

                                  def IsCube {d : } (B : Box d) :
                                  Equations
                                  Instances For
                                    noncomputable def DyadicCube {d : } (n : ) (a : Fin d) :
                                    Box d
                                    Equations
                                    Instances For
                                      theorem DyadicCube.isCube {d : } (n : ) (a : Fin d) :
                                      def Box.IsDyadicAtScale {d : } (B : Box d) (n : ) :
                                      Equations
                                      Instances For
                                        def Box.IsDyadic {d : } (B : Box d) :
                                        Equations
                                        Instances For
                                          theorem Box.IsDyadic.all_sides_Icc {d : } {B : Box d} (hB : B.IsDyadic) (i : Fin d) :
                                          ∃ (a : ) (b : ), B.side i = BoundedInterval.Icc a b

                                          Dyadic boxes have all sides as closed intervals (Icc).

                                          theorem DyadicCube.sidelength {d : } (n : ) (a : Fin d) (i : Fin d) :
                                          ((DyadicCube n a).side i).length = 2 ^ (-n)

                                          The sidelength of a dyadic cube at scale n is 2^(-n).

                                          theorem DyadicCube.sidelength_le_one {d n : } (a : Fin d) (i : Fin d) :
                                          ((DyadicCube (↑n) a).side i).length 1

                                          Dyadic cubes at scale n ≥ 0 have sidelength at most 1.

                                          theorem DyadicCube.interior {d : } (n : ) (a : Fin d) :
                                          _root_.interior (DyadicCube n a) = Set.univ.pi fun (i : Fin d) => Set.Ioo ((a i) / 2 ^ n) (((a i) + 1) / 2 ^ n)

                                          The interior of a dyadic cube.

                                          theorem DyadicCube.almost_disjoint_same_scale {d : } {n : } {a b : Fin d} (hab : a b) :

                                          Dyadic cubes at the same scale with different indices have disjoint interiors.

                                          theorem DyadicCube.cover_univ {d : } (n : ) :
                                          ⋃ (a : Fin d), (DyadicCube n a) = Set.univ

                                          The dyadic cubes at scale n cover all of ℝᵈ.

                                          Dyadic cubes at the same scale are pairwise almost disjoint.

                                          theorem DyadicCube.nesting {d : } {n m : } {a b : Fin d} :
                                          AlmostDisjoint (DyadicCube n a) (DyadicCube m b) (DyadicCube n a) (DyadicCube m b) (DyadicCube m b) (DyadicCube n a)

                                          Two dyadic cubes are either almost disjoint or one contains the other.

                                          theorem IsOpen.exists_dyadic_cube_subset {d : } {E : Set (EuclideanSpace' d)} (hE : IsOpen E) {x : EuclideanSpace' d} (hx : x E) :
                                          ∃ (n : ) (a : Fin d), x (DyadicCube (↑n) a) (DyadicCube (↑n) a) E

                                          For any point x in an open set E, there exists a dyadic cube containing x with the cube contained in E.

                                          noncomputable def dyadicCubeContaining {d : } (n : ) (x : EuclideanSpace' d) :
                                          Box d

                                          For a point x, the unique dyadic cube at scale n containing x.

                                          Equations
                                          Instances For

                                            The dyadic cube containing x at scale n indeed contains x.

                                            theorem dyadicCubeInteriorNonempty {d : } (n : ) (a : Fin d) :

                                            The interior of a dyadic cube is nonempty.

                                            theorem dyadicCubeNoProperContainmentSameScale {d : } {n : } {a b : Fin d} (h_sub : (DyadicCube n a) (DyadicCube n b)) :
                                            a = b

                                            At the same scale, dyadic cubes with different indices cannot have one contained in the other (since containment would imply empty interior for one).

                                            theorem dyadicCubeLargerNotInSmaller {d : } (hd : 0 < d) {n m : } (hnm : n < m) {a b : Fin d} :
                                            ¬(DyadicCube n a) (DyadicCube m b)

                                            A larger dyadic cube (coarser scale n) cannot be contained in a smaller dyadic cube (finer scale m) when d > 0. This is because the sidelength 2^(-n) > 2^(-m) when n < m.

                                            theorem IsOpen.eq_union_boxes {d : } (hd : 0 < d) (E : Set (EuclideanSpace' d)) (hE : IsOpen E) (hE_nonempty : E.Nonempty) :
                                            ∃ (B : Box d), E = ⋃ (n : ), (B n) (∀ (n : ), (B n).IsDyadic) Pairwise (Function.onFun AlmostDisjoint B)

                                            Lemma 1.2.11: Every open set is a countable union of almost disjoint dyadic cubes. Note: every dyadic cube is nonempty Proof outline: 1. For each x ∈ E, by exists_dyadic_cube_subset, there exists a dyadic cube containing x ⊆ E 2. The set of all such dyadic cubes is countable (subset of ℕ × (Fin d → ℤ)) 3. Take maximal cubes (not strictly contained in another cube in the collection) 4. By DyadicCube.nesting, distinct maximal cubes are almost disjoint 5. E equals the union of these maximal cubes

                                            Lemma 1.2.12 (Outer regularity). Proof has not been formalized yet.

                                            For any set E and ε > 0, there exists an open U ⊇ E with m*(U) ≤ m*(E) + ε. This follows from outer regularity (Lemma 1.2.12).

                                            Compact sets in Euclidean space have finite Lebesgue outer measure.