-- Mathlib/MeasureTheory/Constructions/BorelSpace/Order.lean
theorem measure_eq_measure_preimage_add_measure_tsum_Ico_zpow {α : Type*} {mα : MeasurableSpace α}
    (μ : Measure α) {f : α → ℝ≥0∞} (hf : Measurable f) {s : Set α} (hs : MeasurableSet s)
    {t : ℝ≥0} (ht : 1 < t) :
    μ s =
      μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' {∞}) +
      ∑' n : ℤ, μ (s ∩ f ⁻¹' Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1)))

Proof state:
case h.e_6.h.e_a.h
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
x : α
⊢ 0 < f x ↔ f x = ⊤ ∨ 0 < f x ∧ f x < ⊤

Tactic:
obtain (H | H) : f x = ∞ ∨ f x < ∞ := eq_or_lt_of_le le_top

Result:
case h.e_6.h.e_a.h.inl
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
x : α
H : f x = ⊤
⊢ 0 < f x ↔ f x = ⊤ ∨ 0 < f x ∧ f x < ⊤

case h.e_6.h.e_a.h.inr
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
x : α
H : f x < ⊤
⊢ 0 < f x ↔ f x = ⊤ ∨ 0 < f x ∧ f x < ⊤

Proof state:
case hd
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
x : α
hx : x ∈ s ∩ f ⁻¹' {⊤}
h'x : x ∈ s ∩ f ⁻¹' Ioo 0 ⊤
this : f x < ⊤
⊢ False

Tactic:
exact lt_irrefl _ (this.trans_le (le_of_eq hx.2.symm))

Result:
no goals

Proof state:
case hn
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
B : μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ f ⁻¹' {⊤}) + μ (s ∩ f ⁻¹' Ioo 0 ⊤)
i j : ℤ
hij : i ≠ j
⊢ Function.onFun Disjoint (fun n => s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1))) i j

Tactic:
wlog h : i < j generalizing i j

Result:
case hn.inr
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
B : μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ f ⁻¹' {⊤}) + μ (s ∩ f ⁻¹' Ioo 0 ⊤)
i j : ℤ
hij : i ≠ j
this : ∀ ⦃i j : ℤ⦄, i ≠ j → i < j → Function.onFun Disjoint (fun n => s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1))) i j
h : ¬i < j
⊢ Function.onFun Disjoint (fun n => s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1))) i j

α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
B : μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ f ⁻¹' {⊤}) + μ (s ∩ f ⁻¹' Ioo 0 ⊤)
i j : ℤ
hij : i ≠ j
h : i < j
⊢ Function.onFun Disjoint (fun n => s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1))) i j

Proof state:
case h.e_6.h.e_a.h
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
x : α
⊢ x ∈ f ⁻¹' Ioi 0 ↔ x ∈ f ⁻¹' {⊤} ∪ f ⁻¹' Ioo 0 ⊤

Tactic:
simp only [mem_singleton_iff, mem_union, mem_Ioo, mem_Ioi, mem_preimage]

Result:
case h.e_6.h.e_a.h
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
x : α
⊢ 0 < f x ↔ f x = ⊤ ∨ 0 < f x ∧ f x < ⊤

Proof state:
case h
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
B : μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ f ⁻¹' {⊤}) + μ (s ∩ f ⁻¹' Ioo 0 ⊤)
n : ℤ
⊢ MeasurableSet (s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1)))

Tactic:
exact hs.inter (hf measurableSet_Ico)

Result:
no goals

Proof state:
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
⊢ μ s = μ (s ∩ f ⁻¹' {0} ∪ s ∩ f ⁻¹' Ioi 0)

Tactic:
rw [← inter_union_distrib_left, ← preimage_union, singleton_union, Ioi_insert,
  ← _root_.bot_eq_zero, Ici_bot, preimage_univ, inter_univ]

Result:
no goals

Proof state:
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
B : μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ f ⁻¹' {⊤}) + μ (s ∩ f ⁻¹' Ioo 0 ⊤)
i j : ℤ
hij : i ≠ j
h : i < j
x : α
hx : x ∈ (fun n => s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1))) i
h'x : x ∈ (fun n => s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1))) j
⊢ f x < f x

Tactic:
calc
  f x < (t : ℝ≥0∞) ^ (i + 1) := hx.2.2
  _ ≤ (t : ℝ≥0∞) ^ j := ENNReal.zpow_le_of_le (ENNReal.one_le_coe_iff.2 ht.le) h
  _ ≤ f x := h'x.2.1

Result:
no goals

Proof state:
case h
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
B : μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ f ⁻¹' {⊤}) + μ (s ∩ f ⁻¹' Ioo 0 ⊤)
⊢ ∀ (i : ℤ), MeasurableSet (s ∩ f ⁻¹' Ico (↑t ^ i) (↑t ^ (i + 1)))

Tactic:
intro n

Result:
case h
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
B : μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ f ⁻¹' {⊤}) + μ (s ∩ f ⁻¹' Ioo 0 ⊤)
n : ℤ
⊢ MeasurableSet (s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1)))

Proof state:
case h.e_6.h.e_a
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
⊢ f ⁻¹' Ioi 0 = f ⁻¹' {⊤} ∪ f ⁻¹' Ioo 0 ⊤

Tactic:
ext x

Result:
case h.e_6.h.e_a.h
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
x : α
⊢ x ∈ f ⁻¹' Ioi 0 ↔ x ∈ f ⁻¹' {⊤} ∪ f ⁻¹' Ioo 0 ⊤

Proof state:
case hn.inr
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
B : μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ f ⁻¹' {⊤}) + μ (s ∩ f ⁻¹' Ioo 0 ⊤)
i j : ℤ
hij : i ≠ j
this : ∀ ⦃i j : ℤ⦄, i ≠ j → i < j → Function.onFun Disjoint (fun n => s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1))) i j
h : ¬i < j
⊢ Function.onFun Disjoint (fun n => s ∩ f ⁻¹' Ico (↑t ^ n) (↑t ^ (n + 1))) i j

Tactic:
exact (this hij.symm (hij.lt_or_lt.resolve_left h)).symm

Result:
no goals

Proof state:
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
⊢ μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ f ⁻¹' {⊤} ∪ s ∩ f ⁻¹' Ioo 0 ⊤)

Tactic:
rw [← inter_union_distrib_left]

Result:
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
⊢ μ (s ∩ f ⁻¹' Ioi 0) = μ (s ∩ (f ⁻¹' {⊤} ∪ f ⁻¹' Ioo 0 ⊤))

Proof state:
case h.e_6.h.e_a.h.inr
α : Type u_5
mα : MeasurableSpace α
μ : Measure α
f : α → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : ℝ≥0
ht : 1 < t
A : μ s = μ (s ∩ f ⁻¹' {0}) + μ (s ∩ f ⁻¹' Ioi 0)
x : α
H : f x < ⊤
⊢ 0 < f x ↔ f x = ⊤ ∨ 0 < f x ∧ f x < ⊤

Tactic:
simp only [H, H.ne, and_true, false_or]

Result:
no goals