l3lab/ntp-mathlib huggingface dataset:
/-- `SimpleFunc.lintegral` depends only on the measures of `f ⁻¹' {y}`. -/
theorem lintegral_eq_of_measure_preimage [MeasurableSpace β] {f : α →ₛ ℝ≥0∞} {g : β →ₛ ℝ≥0∞}
    {ν : Measure β} (H : ∀ y, μ (f ⁻¹' {y}) = ν (g ⁻¹' {y})) : f.lintegral μ = g.lintegral ν := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν✝ : Measure α
inst✝ : MeasurableSpace β
f : α →ₛ ℝ≥0∞
g : β →ₛ ℝ≥0∞
ν : Measure β
H : ∀ (y : ℝ≥0∞), ↑↑μ (↑f ⁻¹' {y}) = ↑↑ν (↑g ⁻¹' {y})
⊢ lintegral f μ = lintegral g ν

Next tactic:
simp only [lintegral, ← H]
/-- `SimpleFunc.lintegral` depends only on the measures of `f ⁻¹' {y}`. -/
theorem lintegral_eq_of_measure_preimage [MeasurableSpace β] {f : α →ₛ ℝ≥0∞} {g : β →ₛ ℝ≥0∞}
    {ν : Measure β} (H : ∀ y, μ (f ⁻¹' {y}) = ν (g ⁻¹' {y})) : f.lintegral μ = g.lintegral ν := by
  simp only [lintegral, ← H]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν✝ : Measure α
inst✝ : MeasurableSpace β
f : α →ₛ ℝ≥0∞
g : β →ₛ ℝ≥0∞
ν : Measure β
H : ∀ (y : ℝ≥0∞), ↑↑μ (↑f ⁻¹' {y}) = ↑↑ν (↑g ⁻¹' {y})
⊢ ∑ x in SimpleFunc.range f, x * ↑↑μ (↑f ⁻¹' {x}) = ∑ x in SimpleFunc.range g, x * ↑↑μ (↑f ⁻¹' {x})

Next tactic:
apply lintegral_eq_of_subset
/-- `SimpleFunc.lintegral` depends only on the measures of `f ⁻¹' {y}`. -/
theorem lintegral_eq_of_measure_preimage [MeasurableSpace β] {f : α →ₛ ℝ≥0∞} {g : β →ₛ ℝ≥0∞}
    {ν : Measure β} (H : ∀ y, μ (f ⁻¹' {y}) = ν (g ⁻¹' {y})) : f.lintegral μ = g.lintegral ν := by
  simp only [lintegral, ← H]
  apply lintegral_eq_of_subset
  

Proof state:
case hs
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν✝ : Measure α
inst✝ : MeasurableSpace β
f : α →ₛ ℝ≥0∞
g : β →ₛ ℝ≥0∞
ν : Measure β
H : ∀ (y : ℝ≥0∞), ↑↑μ (↑f ⁻¹' {y}) = ↑↑ν (↑g ⁻¹' {y})
⊢ ∀ (x : α), ↑f x ≠ 0 → ↑↑μ (↑f ⁻¹' {↑f x}) ≠ 0 → ↑f x ∈ SimpleFunc.range g

Next tactic:
simp only [H]
/-- `SimpleFunc.lintegral` depends only on the measures of `f ⁻¹' {y}`. -/
theorem lintegral_eq_of_measure_preimage [MeasurableSpace β] {f : α →ₛ ℝ≥0∞} {g : β →ₛ ℝ≥0∞}
    {ν : Measure β} (H : ∀ y, μ (f ⁻¹' {y}) = ν (g ⁻¹' {y})) : f.lintegral μ = g.lintegral ν := by
  simp only [lintegral, ← H]
  apply lintegral_eq_of_subset
  simp only [H]
  

Proof state:
case hs
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν✝ : Measure α
inst✝ : MeasurableSpace β
f : α →ₛ ℝ≥0∞
g : β →ₛ ℝ≥0∞
ν : Measure β
H : ∀ (y : ℝ≥0∞), ↑↑μ (↑f ⁻¹' {y}) = ↑↑ν (↑g ⁻¹' {y})
⊢ ∀ (x : α), ↑f x ≠ 0 → ↑↑ν (↑g ⁻¹' {↑f x}) ≠ 0 → ↑f x ∈ SimpleFunc.range g

Next tactic:
intros
/-- `SimpleFunc.lintegral` depends only on the measures of `f ⁻¹' {y}`. -/
theorem lintegral_eq_of_measure_preimage [MeasurableSpace β] {f : α →ₛ ℝ≥0∞} {g : β →ₛ ℝ≥0∞}
    {ν : Measure β} (H : ∀ y, μ (f ⁻¹' {y}) = ν (g ⁻¹' {y})) : f.lintegral μ = g.lintegral ν := by
  simp only [lintegral, ← H]
  apply lintegral_eq_of_subset
  simp only [H]
  intros
  

Proof state:
case hs
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν✝ : Measure α
inst✝ : MeasurableSpace β
f : α →ₛ ℝ≥0∞
g : β →ₛ ℝ≥0∞
ν : Measure β
H : ∀ (y : ℝ≥0∞), ↑↑μ (↑f ⁻¹' {y}) = ↑↑ν (↑g ⁻¹' {y})
x✝ : α
a✝¹ : ↑f x✝ ≠ 0
a✝ : ↑↑ν (↑g ⁻¹' {↑f x✝}) ≠ 0
⊢ ↑f x✝ ∈ SimpleFunc.range g

Next tactic:
exact mem_range_of_measure_ne_zero ‹_›
/-- If two simple functions are equal a.e., then their `lintegral`s are equal. -/
theorem lintegral_congr {f g : α →ₛ ℝ≥0∞} (h : f =ᵐ[μ] g) : f.lintegral μ = g.lintegral μ :=
  lintegral_eq_of_measure_preimage fun y =>
    measure_congr <| Eventually.set_eq <| h.mono fun x hx => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
f g : α →ₛ ℝ≥0∞
h : ↑f =ᵐ[μ] ↑g
y : ℝ≥0∞
x : α
hx : ↑f x = ↑g x
⊢ x ∈ ↑f ⁻¹' {y} ↔ x ∈ ↑g ⁻¹' {y}

Next tactic:
simp [hx]
theorem lintegral_map' {β} [MeasurableSpace β] {μ' : Measure β} (f : α →ₛ ℝ≥0∞) (g : β →ₛ ℝ≥0∞)
    (m' : α → β) (eq : ∀ a, f a = g (m' a)) (h : ∀ s, MeasurableSet s → μ' s = μ (m' ⁻¹' s)) :
    f.lintegral μ = g.lintegral μ' :=
  lintegral_eq_of_measure_preimage fun y => by
    

Proof state:
α : Type u_1
β✝ : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
β : Type u_5
inst✝ : MeasurableSpace β
μ' : Measure β
f : α →ₛ ℝ≥0∞
g : β →ₛ ℝ≥0∞
m' : α → β
eq : ∀ (a : α), ↑f a = ↑g (m' a)
h : ∀ (s : Set β), MeasurableSet s → ↑↑μ' s = ↑↑μ (m' ⁻¹' s)
y : ℝ≥0∞
⊢ ↑↑μ (↑f ⁻¹' {y}) = ↑↑μ' (↑g ⁻¹' {y})

Next tactic:
simp only [preimage, eq]
theorem lintegral_map' {β} [MeasurableSpace β] {μ' : Measure β} (f : α →ₛ ℝ≥0∞) (g : β →ₛ ℝ≥0∞)
    (m' : α → β) (eq : ∀ a, f a = g (m' a)) (h : ∀ s, MeasurableSet s → μ' s = μ (m' ⁻¹' s)) :
    f.lintegral μ = g.lintegral μ' :=
  lintegral_eq_of_measure_preimage fun y => by
    simp only [preimage, eq]
    

Proof state:
α : Type u_1
β✝ : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
β : Type u_5
inst✝ : MeasurableSpace β
μ' : Measure β
f : α →ₛ ℝ≥0∞
g : β →ₛ ℝ≥0∞
m' : α → β
eq : ∀ (a : α), ↑f a = ↑g (m' a)
h : ∀ (s : Set β), MeasurableSet s → ↑↑μ' s = ↑↑μ (m' ⁻¹' s)
y : ℝ≥0∞
⊢ ↑↑μ {x | ↑g (m' x) ∈ {y}} = ↑↑μ' {x | ↑g x ∈ {y}}

Next tactic:
exact (h (g ⁻¹' {y}) (g.measurableSet_preimage _)).symm
theorem support_eq [MeasurableSpace α] [Zero β] (f : α →ₛ β) :
    support f = ⋃ y ∈ f.range.filter fun y => y ≠ 0, f ⁻¹' {y} :=
  Set.ext fun x => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝¹ : MeasurableSpace α
inst✝ : Zero β
f : α →ₛ β
x : α
⊢ x ∈ support ↑f ↔ x ∈ ⋃ y ∈ filter (fun y => y ≠ 0) (SimpleFunc.range f), ↑f ⁻¹' {y}

Next tactic:
simp only [mem_support, Set.mem_preimage, mem_filter, mem_range_self, true_and_iff, exists_prop,
      mem_iUnion, Set.mem_range, mem_singleton_iff, exists_eq_right']
theorem measurableSet_support [MeasurableSpace α] (f : α →ₛ β) : MeasurableSet (support f) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝² : Zero β
inst✝¹ : Zero γ
μ : Measure α
f✝ : α →ₛ β
inst✝ : MeasurableSpace α
f : α →ₛ β
⊢ MeasurableSet (support ↑f)

Next tactic:
rw [f.support_eq]
theorem measurableSet_support [MeasurableSpace α] (f : α →ₛ β) : MeasurableSet (support f) := by
  rw [f.support_eq]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝² : Zero β
inst✝¹ : Zero γ
μ : Measure α
f✝ : α →ₛ β
inst✝ : MeasurableSpace α
f : α →ₛ β
⊢ MeasurableSet (⋃ y ∈ filter (fun y => y ≠ 0) (SimpleFunc.range f), ↑f ⁻¹' {y})

Next tactic:
exact Finset.measurableSet_biUnion _ fun y _ => measurableSet_fiber _ _
theorem finMeasSupp_iff : f.FinMeasSupp μ ↔ ∀ y, y ≠ 0 → μ (f ⁻¹' {y}) < ∞ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f : α →ₛ β
⊢ SimpleFunc.FinMeasSupp f μ ↔ ∀ (y : β), y ≠ 0 → ↑↑μ (↑f ⁻¹' {y}) < ⊤

Next tactic:
constructor
theorem finMeasSupp_iff : f.FinMeasSupp μ ↔ ∀ y, y ≠ 0 → μ (f ⁻¹' {y}) < ∞ := by
  constructor
  · 

Proof state:
case mp
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f : α →ₛ β
⊢ SimpleFunc.FinMeasSupp f μ → ∀ (y : β), y ≠ 0 → ↑↑μ (↑f ⁻¹' {y}) < ⊤

Next tactic:
refine' fun h y hy => lt_of_le_of_lt (measure_mono _) h
theorem finMeasSupp_iff : f.FinMeasSupp μ ↔ ∀ y, y ≠ 0 → μ (f ⁻¹' {y}) < ∞ := by
  constructor
  · refine' fun h y hy => lt_of_le_of_lt (measure_mono _) h
    

Proof state:
case mp
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f : α →ₛ β
h : SimpleFunc.FinMeasSupp f μ
y : β
hy : y ≠ 0
⊢ ↑f ⁻¹' {y} ⊆ {x | (fun x => ↑f x = OfNat.ofNat 0 x) x}ᶜ

Next tactic:
exact fun x hx (H : f x = 0) => hy <| H ▸ Eq.symm hx
theorem finMeasSupp_iff : f.FinMeasSupp μ ↔ ∀ y, y ≠ 0 → μ (f ⁻¹' {y}) < ∞ := by
  constructor
  · refine' fun h y hy => lt_of_le_of_lt (measure_mono _) h
    exact fun x hx (H : f x = 0) => hy <| H ▸ Eq.symm hx
  · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f : α →ₛ β
⊢ (∀ (y : β), y ≠ 0 → ↑↑μ (↑f ⁻¹' {y}) < ⊤) → SimpleFunc.FinMeasSupp f μ

Next tactic:
intro H
theorem finMeasSupp_iff : f.FinMeasSupp μ ↔ ∀ y, y ≠ 0 → μ (f ⁻¹' {y}) < ∞ := by
  constructor
  · refine' fun h y hy => lt_of_le_of_lt (measure_mono _) h
    exact fun x hx (H : f x = 0) => hy <| H ▸ Eq.symm hx
  · intro H
    

Proof state:
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f : α →ₛ β
H : ∀ (y : β), y ≠ 0 → ↑↑μ (↑f ⁻¹' {y}) < ⊤
⊢ SimpleFunc.FinMeasSupp f μ

Next tactic:
rw [finMeasSupp_iff_support, support_eq]
theorem finMeasSupp_iff : f.FinMeasSupp μ ↔ ∀ y, y ≠ 0 → μ (f ⁻¹' {y}) < ∞ := by
  constructor
  · refine' fun h y hy => lt_of_le_of_lt (measure_mono _) h
    exact fun x hx (H : f x = 0) => hy <| H ▸ Eq.symm hx
  · intro H
    rw [finMeasSupp_iff_support, support_eq]
    

Proof state:
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f : α →ₛ β
H : ∀ (y : β), y ≠ 0 → ↑↑μ (↑f ⁻¹' {y}) < ⊤
⊢ ↑↑μ (⋃ y ∈ filter (fun y => y ≠ 0) (SimpleFunc.range f), ↑f ⁻¹' {y}) < ⊤

Next tactic:
refine' lt_of_le_of_lt (measure_biUnion_finset_le _ _) (sum_lt_top _)
theorem finMeasSupp_iff : f.FinMeasSupp μ ↔ ∀ y, y ≠ 0 → μ (f ⁻¹' {y}) < ∞ := by
  constructor
  · refine' fun h y hy => lt_of_le_of_lt (measure_mono _) h
    exact fun x hx (H : f x = 0) => hy <| H ▸ Eq.symm hx
  · intro H
    rw [finMeasSupp_iff_support, support_eq]
    refine' lt_of_le_of_lt (measure_biUnion_finset_le _ _) (sum_lt_top _)
    

Proof state:
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f : α →ₛ β
H : ∀ (y : β), y ≠ 0 → ↑↑μ (↑f ⁻¹' {y}) < ⊤
⊢ ∀ a ∈ filter (fun y => y ≠ 0) (SimpleFunc.range f), ↑↑μ (↑f ⁻¹' {a}) ≠ ⊤

Next tactic:
exact fun y hy => (H y (Finset.mem_filter.1 hy).2).ne
protected theorem add {β} [AddMonoid β] {f g : α →ₛ β} (hf : f.FinMeasSupp μ)
    (hg : g.FinMeasSupp μ) : (f + g).FinMeasSupp μ := by
  

Proof state:
α : Type u_1
β✝ : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝² : Zero β✝
inst✝¹ : Zero γ
μ : Measure α
f✝ : α →ₛ β✝
β : Type u_5
inst✝ : AddMonoid β
f g : α →ₛ β
hf : SimpleFunc.FinMeasSupp f μ
hg : SimpleFunc.FinMeasSupp g μ
⊢ SimpleFunc.FinMeasSupp (f + g) μ

Next tactic:
rw [add_eq_map₂]
protected theorem add {β} [AddMonoid β] {f g : α →ₛ β} (hf : f.FinMeasSupp μ)
    (hg : g.FinMeasSupp μ) : (f + g).FinMeasSupp μ := by
  rw [add_eq_map₂]
  

Proof state:
α : Type u_1
β✝ : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝² : Zero β✝
inst✝¹ : Zero γ
μ : Measure α
f✝ : α →ₛ β✝
β : Type u_5
inst✝ : AddMonoid β
f g : α →ₛ β
hf : SimpleFunc.FinMeasSupp f μ
hg : SimpleFunc.FinMeasSupp g μ
⊢ SimpleFunc.FinMeasSupp (map (fun p => p.1 + p.2) (pair f g)) μ

Next tactic:
exact hf.map₂ hg (zero_add 0)
protected theorem mul {β} [MonoidWithZero β] {f g : α →ₛ β} (hf : f.FinMeasSupp μ)
    (hg : g.FinMeasSupp μ) : (f * g).FinMeasSupp μ := by
  

Proof state:
α : Type u_1
β✝ : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝² : Zero β✝
inst✝¹ : Zero γ
μ : Measure α
f✝ : α →ₛ β✝
β : Type u_5
inst✝ : MonoidWithZero β
f g : α →ₛ β
hf : SimpleFunc.FinMeasSupp f μ
hg : SimpleFunc.FinMeasSupp g μ
⊢ SimpleFunc.FinMeasSupp (f * g) μ

Next tactic:
rw [mul_eq_map₂]
protected theorem mul {β} [MonoidWithZero β] {f g : α →ₛ β} (hf : f.FinMeasSupp μ)
    (hg : g.FinMeasSupp μ) : (f * g).FinMeasSupp μ := by
  rw [mul_eq_map₂]
  

Proof state:
α : Type u_1
β✝ : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝² : Zero β✝
inst✝¹ : Zero γ
μ : Measure α
f✝ : α →ₛ β✝
β : Type u_5
inst✝ : MonoidWithZero β
f g : α →ₛ β
hf : SimpleFunc.FinMeasSupp f μ
hg : SimpleFunc.FinMeasSupp g μ
⊢ SimpleFunc.FinMeasSupp (map (fun p => p.1 * p.2) (pair f g)) μ

Next tactic:
exact hf.map₂ hg (zero_mul 0)
theorem lintegral_lt_top {f : α →ₛ ℝ≥0∞} (hm : f.FinMeasSupp μ) (hf : ∀ᵐ a ∂μ, f a ≠ ∞) :
    f.lintegral μ < ∞ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
hm : SimpleFunc.FinMeasSupp f μ
hf : ∀ᵐ (a : α) ∂μ, ↑f a ≠ ⊤
⊢ lintegral f μ < ⊤

Next tactic:
refine' sum_lt_top fun a ha => _
theorem lintegral_lt_top {f : α →ₛ ℝ≥0∞} (hm : f.FinMeasSupp μ) (hf : ∀ᵐ a ∂μ, f a ≠ ∞) :
    f.lintegral μ < ∞ := by
  refine' sum_lt_top fun a ha => _
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
hm : SimpleFunc.FinMeasSupp f μ
hf : ∀ᵐ (a : α) ∂μ, ↑f a ≠ ⊤
a : ℝ≥0∞
ha : a ∈ SimpleFunc.range f
⊢ a * ↑↑μ (↑f ⁻¹' {a}) ≠ ⊤

Next tactic:
rcases eq_or_ne a ∞ with (rfl | ha)
theorem lintegral_lt_top {f : α →ₛ ℝ≥0∞} (hm : f.FinMeasSupp μ) (hf : ∀ᵐ a ∂μ, f a ≠ ∞) :
    f.lintegral μ < ∞ := by
  refine' sum_lt_top fun a ha => _
  rcases eq_or_ne a ∞ with (rfl | ha)
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
hm : SimpleFunc.FinMeasSupp f μ
hf : ∀ᵐ (a : α) ∂μ, ↑f a ≠ ⊤
ha : ⊤ ∈ SimpleFunc.range f
⊢ ⊤ * ↑↑μ (↑f ⁻¹' {⊤}) ≠ ⊤

Next tactic:
simp only [ae_iff, Ne.def, Classical.not_not] at hf
theorem lintegral_lt_top {f : α →ₛ ℝ≥0∞} (hm : f.FinMeasSupp μ) (hf : ∀ᵐ a ∂μ, f a ≠ ∞) :
    f.lintegral μ < ∞ := by
  refine' sum_lt_top fun a ha => _
  rcases eq_or_ne a ∞ with (rfl | ha)
  · simp only [ae_iff, Ne.def, Classical.not_not] at hf
    

Proof state:
case inl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
hm : SimpleFunc.FinMeasSupp f μ
ha : ⊤ ∈ SimpleFunc.range f
hf : ↑↑μ {a | ↑f a = ⊤} = 0
⊢ ⊤ * ↑↑μ (↑f ⁻¹' {⊤}) ≠ ⊤

Next tactic:
simp [Set.preimage, hf]
theorem lintegral_lt_top {f : α →ₛ ℝ≥0∞} (hm : f.FinMeasSupp μ) (hf : ∀ᵐ a ∂μ, f a ≠ ∞) :
    f.lintegral μ < ∞ := by
  refine' sum_lt_top fun a ha => _
  rcases eq_or_ne a ∞ with (rfl | ha)
  · simp only [ae_iff, Ne.def, Classical.not_not] at hf
    simp [Set.preimage, hf]
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
hm : SimpleFunc.FinMeasSupp f μ
hf : ∀ᵐ (a : α) ∂μ, ↑f a ≠ ⊤
a : ℝ≥0∞
ha✝ : a ∈ SimpleFunc.range f
ha : a ≠ ⊤
⊢ a * ↑↑μ (↑f ⁻¹' {a}) ≠ ⊤

Next tactic:
by_cases ha0 : a = 0
theorem lintegral_lt_top {f : α →ₛ ℝ≥0∞} (hm : f.FinMeasSupp μ) (hf : ∀ᵐ a ∂μ, f a ≠ ∞) :
    f.lintegral μ < ∞ := by
  refine' sum_lt_top fun a ha => _
  rcases eq_or_ne a ∞ with (rfl | ha)
  · simp only [ae_iff, Ne.def, Classical.not_not] at hf
    simp [Set.preimage, hf]
  · by_cases ha0 : a = 0
    · 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
hm : SimpleFunc.FinMeasSupp f μ
hf : ∀ᵐ (a : α) ∂μ, ↑f a ≠ ⊤
a : ℝ≥0∞
ha✝ : a ∈ SimpleFunc.range f
ha : a ≠ ⊤
ha0 : a = 0
⊢ a * ↑↑μ (↑f ⁻¹' {a}) ≠ ⊤

Next tactic:
subst a
theorem lintegral_lt_top {f : α →ₛ ℝ≥0∞} (hm : f.FinMeasSupp μ) (hf : ∀ᵐ a ∂μ, f a ≠ ∞) :
    f.lintegral μ < ∞ := by
  refine' sum_lt_top fun a ha => _
  rcases eq_or_ne a ∞ with (rfl | ha)
  · simp only [ae_iff, Ne.def, Classical.not_not] at hf
    simp [Set.preimage, hf]
  · by_cases ha0 : a = 0
    · subst a
      

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
hm : SimpleFunc.FinMeasSupp f μ
hf : ∀ᵐ (a : α) ∂μ, ↑f a ≠ ⊤
ha✝ : 0 ∈ SimpleFunc.range f
ha : 0 ≠ ⊤
⊢ 0 * ↑↑μ (↑f ⁻¹' {0}) ≠ ⊤

Next tactic:
rwa [zero_mul]
theorem lintegral_lt_top {f : α →ₛ ℝ≥0∞} (hm : f.FinMeasSupp μ) (hf : ∀ᵐ a ∂μ, f a ≠ ∞) :
    f.lintegral μ < ∞ := by
  refine' sum_lt_top fun a ha => _
  rcases eq_or_ne a ∞ with (rfl | ha)
  · simp only [ae_iff, Ne.def, Classical.not_not] at hf
    simp [Set.preimage, hf]
  · by_cases ha0 : a = 0
    · subst a
      rwa [zero_mul]
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
hm : SimpleFunc.FinMeasSupp f μ
hf : ∀ᵐ (a : α) ∂μ, ↑f a ≠ ⊤
a : ℝ≥0∞
ha✝ : a ∈ SimpleFunc.range f
ha : a ≠ ⊤
ha0 : ¬a = 0
⊢ a * ↑↑μ (↑f ⁻¹' {a}) ≠ ⊤

Next tactic:
exact mul_ne_top ha (finMeasSupp_iff.1 hm _ ha0).ne
theorem of_lintegral_ne_top {f : α →ₛ ℝ≥0∞} (h : f.lintegral μ ≠ ∞) : f.FinMeasSupp μ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
h : lintegral f μ ≠ ⊤
⊢ SimpleFunc.FinMeasSupp f μ

Next tactic:
refine' finMeasSupp_iff.2 fun b hb => _
theorem of_lintegral_ne_top {f : α →ₛ ℝ≥0∞} (h : f.lintegral μ ≠ ∞) : f.FinMeasSupp μ := by
  refine' finMeasSupp_iff.2 fun b hb => _
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
h : lintegral f μ ≠ ⊤
b : ℝ≥0∞
hb : b ≠ 0
⊢ ↑↑μ (↑f ⁻¹' {b}) < ⊤

Next tactic:
rw [f.lintegral_eq_of_subset' (Finset.subset_insert b _)] at h
theorem of_lintegral_ne_top {f : α →ₛ ℝ≥0∞} (h : f.lintegral μ ≠ ∞) : f.FinMeasSupp μ := by
  refine' finMeasSupp_iff.2 fun b hb => _
  rw [f.lintegral_eq_of_subset' (Finset.subset_insert b _)] at h
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
b : ℝ≥0∞
h : ∑ x in insert b (SimpleFunc.range f \ {0}), x * ↑↑μ (↑f ⁻¹' {x}) ≠ ⊤
hb : b ≠ 0
⊢ ↑↑μ (↑f ⁻¹' {b}) < ⊤

Next tactic:
refine' ENNReal.lt_top_of_mul_ne_top_right _ hb
theorem of_lintegral_ne_top {f : α →ₛ ℝ≥0∞} (h : f.lintegral μ ≠ ∞) : f.FinMeasSupp μ := by
  refine' finMeasSupp_iff.2 fun b hb => _
  rw [f.lintegral_eq_of_subset' (Finset.subset_insert b _)] at h
  refine' ENNReal.lt_top_of_mul_ne_top_right _ hb
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
inst✝¹ : Zero β
inst✝ : Zero γ
μ : Measure α
f✝ : α →ₛ β
f : α →ₛ ℝ≥0∞
b : ℝ≥0∞
h : ∑ x in insert b (SimpleFunc.range f \ {0}), x * ↑↑μ (↑f ⁻¹' {x}) ≠ ⊤
hb : b ≠ 0
⊢ b * ↑↑μ (↑f ⁻¹' {b}) ≠ ⊤

Next tactic:
exact (lt_top_of_sum_ne_top h (Finset.mem_insert_self _ _)).ne
/-- To prove something for an arbitrary simple function, it suffices to show
that the property holds for (multiples of) characteristic functions and is closed under
addition (of functions with disjoint support).

It is possible to make the hypotheses in `h_add` a bit stronger, and such conditions can be added
once we need them (for example it is only necessary to consider the case where `g` is a multiple
of a characteristic function, and that this multiple doesn't appear in the image of `f`) -/
@[elab_as_elim]
protected theorem induction {α γ} [MeasurableSpace α] [AddMonoid γ] {P : SimpleFunc α γ → Prop}
    (h_ind :
      ∀ (c) {s} (hs : MeasurableSet s),
        P (SimpleFunc.piecewise s hs (SimpleFunc.const _ c) (SimpleFunc.const _ 0)))
    (h_add : ∀ ⦃f g : SimpleFunc α γ⦄, Disjoint (support f) (support g) → P f → P g → P (f + g))
    (f : SimpleFunc α γ) : P f := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
α : Type u_5
γ : Type u_6
inst✝¹ : MeasurableSpace α
inst✝ : AddMonoid γ
P : (α →ₛ γ) → Prop
h_ind : ∀ (c : γ) {s : Set α} (hs : MeasurableSet s), P (piecewise s hs (const α c) (const α 0))
h_add : ∀ ⦃f g : α →ₛ γ⦄, Disjoint (support ↑f) (support ↑g) → P f → P g → P (f + g)
f : α →ₛ γ
⊢ P f

Next tactic:
generalize h : f.range \ {0} = s
/-- To prove something for an arbitrary simple function, it suffices to show
that the property holds for (multiples of) characteristic functions and is closed under
addition (of functions with disjoint support).

It is possible to make the hypotheses in `h_add` a bit stronger, and such conditions can be added
once we need them (for example it is only necessary to consider the case where `g` is a multiple
of a characteristic function, and that this multiple doesn't appear in the image of `f`) -/
@[elab_as_elim]
protected theorem induction {α γ} [MeasurableSpace α] [AddMonoid γ] {P : SimpleFunc α γ → Prop}
    (h_ind :
      ∀ (c) {s} (hs : MeasurableSet s),
        P (SimpleFunc.piecewise s hs (SimpleFunc.const _ c) (SimpleFunc.const _ 0)))
    (h_add : ∀ ⦃f g : SimpleFunc α γ⦄, Disjoint (support f) (support g) → P f → P g → P (f + g))
    (f : SimpleFunc α γ) : P f := by
  generalize h : f.range \ {0} = s
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
α : Type u_5
γ : Type u_6
inst✝¹ : MeasurableSpace α
inst✝ : AddMonoid γ
P : (α →ₛ γ) → Prop
h_ind : ∀ (c : γ) {s : Set α} (hs : MeasurableSet s), P (piecewise s hs (const α c) (const α 0))
h_add : ∀ ⦃f g : α →ₛ γ⦄, Disjoint (support ↑f) (support ↑g) → P f → P g → P (f + g)
f : α →ₛ γ
s : Finset γ
h : SimpleFunc.range f \ {0} = s
⊢ P f

Next tactic:
rw [← Finset.coe_inj, Finset.coe_sdiff, Finset.coe_singleton, SimpleFunc.coe_range] at h
/-- To prove something for an arbitrary simple function, it suffices to show
that the property holds for (multiples of) characteristic functions and is closed under
addition (of functions with disjoint support).

It is possible to make the hypotheses in `h_add` a bit stronger, and such conditions can be added
once we need them (for example it is only necessary to consider the case where `g` is a multiple
of a characteristic function, and that this multiple doesn't appear in the image of `f`) -/
@[elab_as_elim]
protected theorem induction {α γ} [MeasurableSpace α] [AddMonoid γ] {P : SimpleFunc α γ → Prop}
    (h_ind :
      ∀ (c) {s} (hs : MeasurableSet s),
        P (SimpleFunc.piecewise s hs (SimpleFunc.const _ c) (SimpleFunc.const _ 0)))
    (h_add : ∀ ⦃f g : SimpleFunc α γ⦄, Disjoint (support f) (support g) → P f → P g → P (f + g))
    (f : SimpleFunc α γ) : P f := by
  generalize h : f.range \ {0} = s
  rw [← Finset.coe_inj, Finset.coe_sdiff, Finset.coe_singleton, SimpleFunc.coe_range] at h
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
α : Type u_5
γ : Type u_6
inst✝¹ : MeasurableSpace α
inst✝ : AddMonoid γ
P : (α →ₛ γ) → Prop
h_ind : ∀ (c : γ) {s : Set α} (hs : MeasurableSet s), P (piecewise s hs (const α c) (const α 0))
h_add : ∀ ⦃f g : α →ₛ γ⦄, Disjoint (support ↑f) (support ↑g) → P f → P g → P (f + g)
f : α →ₛ γ
s : Finset γ
h : range ↑f \ {0} = ↑s
⊢ P f

Next tactic:
induction s using Finset.induction generalizing f with
  | empty =>
    rw [Finset.coe_empty, diff_eq_empty, range_subset_singleton] at h
    convert h_ind 0 MeasurableSet.univ
    ext x
    simp [h]
  | @insert x s hxs ih =>
    have mx := f.measurableSet_preimage {x}
    let g := SimpleFunc.piecewise (f ⁻¹' {x}) mx 0 f
    have Pg : P g := by
      apply ih
      simp only [SimpleFunc.coe_piecewise, range_piecewise]
      rw [image_compl_preimage, union_diff_distrib, diff_diff_comm, h, Finset.coe_insert,
        insert_diff_self_of_not_mem, diff_eq_empty.mpr, Set.empty_union]
      · rw [Set.image_subset_iff]
        convert Set.subset_univ _
        exact preimage_const_of_mem (mem_singleton _)
      · rwa [Finset.mem_coe]
    convert h_add _ Pg (h_ind x mx)
    · ext1 y
      by_cases hy : y ∈ f ⁻¹' {x}
      · simpa [piecewise_eq_of_mem _ _ _ hy, -piecewise_eq_indicator]
      · simp [piecewise_eq_of_not_mem _ _ _ hy, -piecewise_eq_indicator]
    rw [disjoint_iff_inf_le]
    rintro y
    by_cases hy : y ∈ f ⁻¹' {x}
    · simp [piecewise_eq_of_mem _ _ _ hy, -piecewise_eq_indicator]
    · simp [piecewise_eq_of_not_mem _ _ _ hy, -piecewise_eq_indicator]