Theorem: MeasureTheory.measure_iUnion_eq_iSup
File: Mathlib/MeasureTheory/Measure/MeasureSpace.lean

tactic: cases nonempty_encodable ι
state_before: α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
ι : Type u_1
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s✝ s₁ s₂ t : Set α
inst✝ : Countable ι
s : ι → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) s
⊢ ↑↑μ (⋃ (i : ι), s i) = ⨆ (i : ι), ↑↑μ (s i)

tactic: generalize ht : Function.extend Encodable.encode s ⊥ = t
state_before: case intro
α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
ι : Type u_1
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s✝ s₁ s₂ t : Set α
inst✝ : Countable ι
s : ι → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) s
val✝ : Encodable ι
⊢ ↑↑μ (⋃ (i : ι), s i) = ⨆ (i : ι), ↑↑μ (s i)

tactic: clear! ι
state_before: case intro
α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
ι : Type u_1
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s✝ s₁ s₂ t✝ : Set α
inst✝ : Countable ι
s : ι → Set α
val✝ : Encodable ι
t : ℕ → Set α
ht : Function.extend Encodable.encode s ⊥ = t
hd : Directed (fun x x_1 => x ⊆ x_1) t
⊢ ↑↑μ (⋃ (n : ℕ), t n) = ⨆ (n : ℕ), ↑↑μ (t n)

tactic: refine' le_antisymm _ (iSup_le fun i => measure_mono <| subset_iUnion _ _)
state_before: case intro
α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s s₁ s₂ t✝ : Set α
t : ℕ → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) t
⊢ ↑↑μ (⋃ (n : ℕ), t n) = ⨆ (n : ℕ), ↑↑μ (t n)

tactic: set T : ℕ → Set α := fun n => toMeasurable μ (t n)
state_before: case intro
α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s s₁ s₂ t✝ : Set α
t : ℕ → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) t
⊢ ↑↑μ (⋃ (n : ℕ), t n) ≤ ⨆ (n : ℕ), ↑↑μ (t n)

tactic: set Td : ℕ → Set α := disjointed T
state_before: case intro
α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s s₁ s₂ t✝ : Set α
t : ℕ → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) t
T : ℕ → Set α := fun n => toMeasurable μ (t n)
⊢ ↑↑μ (⋃ (n : ℕ), t n) ≤ ⨆ (n : ℕ), ↑↑μ (t n)

tactic: have hm : ∀ n, MeasurableSet (Td n) :=
  MeasurableSet.disjointed fun n => measurableSet_toMeasurable _ _
state_before: case intro
α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s s₁ s₂ t✝ : Set α
t : ℕ → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) t
T : ℕ → Set α := fun n => toMeasurable μ (t n)
Td : ℕ → Set α := disjointed T
⊢ ↑↑μ (⋃ (n : ℕ), t n) ≤ ⨆ (n : ℕ), ↑↑μ (t n)

tactic: calc
  μ (⋃ n, t n) ≤ μ (⋃ n, T n) := measure_mono (iUnion_mono fun i => subset_toMeasurable _ _)
  _ = μ (⋃ n, Td n) := by rw [iUnion_disjointed]
  _ ≤ ∑' n, μ (Td n) := (measure_iUnion_le _)
  _ = ⨆ I : Finset ℕ, ∑ n in I, μ (Td n) := ENNReal.tsum_eq_iSup_sum
  _ ≤ ⨆ n, μ (t n) := iSup_le fun I => by
    rcases hd.finset_le I with ⟨N, hN⟩
    calc
      (∑ n in I, μ (Td n)) = μ (⋃ n ∈ I, Td n) :=
        (measure_biUnion_finset ((disjoint_disjointed T).set_pairwise I) fun n _ => hm n).symm
      _ ≤ μ (⋃ n ∈ I, T n) := (measure_mono (iUnion₂_mono fun n _hn => disjointed_subset _ _))
      _ = μ (⋃ n ∈ I, t n) := (measure_biUnion_toMeasurable I.countable_toSet _)
      _ ≤ μ (t N) := (measure_mono (iUnion₂_subset hN))
      _ ≤ ⨆ n, μ (t n) := le_iSup (μ ∘ t) N
state_before: case intro
α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s s₁ s₂ t✝ : Set α
t : ℕ → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) t
T : ℕ → Set α := fun n => toMeasurable μ (t n)
Td : ℕ → Set α := disjointed T
hm : ∀ (n : ℕ), MeasurableSet (Td n)
⊢ ↑↑μ (⋃ (n : ℕ), t n) ≤ ⨆ (n : ℕ), ↑↑μ (t n)

tactic: exact this.trans (iSup_extend_bot Encodable.encode_injective _)
state_before: α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
ι : Type u_1
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s✝ s₁ s₂ t✝ : Set α
inst✝ : Countable ι
s : ι → Set α
val✝ : Encodable ι
t : ℕ → Set α
ht : Function.extend Encodable.encode s ⊥ = t
hd : Directed (fun x x_1 => x ⊆ x_1) t
this : ↑↑μ (⨆ (i : ι), s i) = ⨆ (n : ℕ), Function.extend Encodable.encode (fun x => ↑↑μ (s x)) (fun x => 0) n
⊢ ↑↑μ (⋃ (i : ι), s i) = ⨆ (i : ι), ↑↑μ (s i)

tactic: rw [iUnion_disjointed]
state_before: α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s s₁ s₂ t✝ : Set α
t : ℕ → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) t
T : ℕ → Set α := fun n => toMeasurable μ (t n)
Td : ℕ → Set α := disjointed T
hm : ∀ (n : ℕ), MeasurableSet (Td n)
⊢ ↑↑μ (⋃ (n : ℕ), T n) = ↑↑μ (⋃ (n : ℕ), Td n)

tactic: rcases hd.finset_le I with ⟨N, hN⟩
state_before: α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s s₁ s₂ t✝ : Set α
t : ℕ → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) t
T : ℕ → Set α := fun n => toMeasurable μ (t n)
Td : ℕ → Set α := disjointed T
hm : ∀ (n : ℕ), MeasurableSet (Td n)
I : Finset ℕ
⊢ ∑ n in I, ↑↑μ (Td n) ≤ ⨆ (n : ℕ), ↑↑μ (t n)

tactic: calc
  (∑ n in I, μ (Td n)) = μ (⋃ n ∈ I, Td n) :=
    (measure_biUnion_finset ((disjoint_disjointed T).set_pairwise I) fun n _ => hm n).symm
  _ ≤ μ (⋃ n ∈ I, T n) := (measure_mono (iUnion₂_mono fun n _hn => disjointed_subset _ _))
  _ = μ (⋃ n ∈ I, t n) := (measure_biUnion_toMeasurable I.countable_toSet _)
  _ ≤ μ (t N) := (measure_mono (iUnion₂_subset hN))
  _ ≤ ⨆ n, μ (t n) := le_iSup (μ ∘ t) N
state_before: case intro
α : Type u_2
β : Type ?u.46518
γ : Type ?u.46521
δ : Type ?u.46524
R : Type ?u.46530
R' : Type ?u.46533
m : MeasurableSpace α
μ μ₁ μ₂ : Measure α
s s₁ s₂ t✝ : Set α
t : ℕ → Set α
hd : Directed (fun x x_1 => x ⊆ x_1) t
T : ℕ → Set α := fun n => toMeasurable μ (t n)
Td : ℕ → Set α := disjointed T
hm : ∀ (n : ℕ), MeasurableSet (Td n)
I : Finset ℕ
N : ℕ
hN : ∀ (i : ℕ), i ∈ I → t i ⊆ t N
⊢ ∑ n in I, ↑↑μ (Td n) ≤ ⨆ (n : ℕ), ↑↑μ (t n)