Theorem: ProbabilityTheory.truncation_eq_of_nonneg
File: Mathlib/Probability/StrongLaw.lean

tactic: ext x
state_before: α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
⊢ truncation f A = (Set.Ioc 0 A).indicator id ∘ f
state_after: case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
⊢ truncation f A x = ((Set.Ioc 0 A).indicator id ∘ f) x

tactic: rcases (h x).lt_or_eq with (hx | hx)
state_before: case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
⊢ truncation f A x = ((Set.Ioc 0 A).indicator id ∘ f) x
state_after: case h.inl
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
⊢ truncation f A x = ((Set.Ioc 0 A).indicator id ∘ f) x

case h.inr
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 = f x
⊢ truncation f A x = ((Set.Ioc 0 A).indicator id ∘ f) x

tactic: simp only [truncation, indicator, hx, Set.mem_Ioc, id, Function.comp_apply, true_and_iff]
state_before: case h.inl
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
⊢ truncation f A x = ((Set.Ioc 0 A).indicator id ∘ f) x
state_after: case h.inl
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0

tactic: by_cases h'x : f x ≤ A
state_before: case h.inl
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0
state_after: case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : f x ≤ A
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0

case neg
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : ¬f x ≤ A
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0

tactic: have : -A < f x := by linarith [h x]
state_before: case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : f x ≤ A
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0
state_after: case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : f x ≤ A
this : -A < f x
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0

tactic: simp only [this, true_and_iff]
state_before: case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : f x ≤ A
this : -A < f x
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0
state_after: no goals

tactic: linarith [h x]
state_before: α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : f x ≤ A
⊢ -A < f x
state_after: no goals

tactic: simp only [h'x, and_false_iff]
state_before: case neg
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 < f x
h'x : ¬f x ≤ A
⊢ (if -A < f x ∧ f x ≤ A then f x else 0) = if f x ≤ A then f x else 0
state_after: no goals

tactic: simp only [truncation, indicator, hx, id, Function.comp_apply, ite_self]
state_before: case h.inr
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f✝ f : α → ℝ
A : ℝ
h : ∀ (x : α), 0 ≤ f x
x : α
hx : 0 = f x
⊢ truncation f A x = ((Set.Ioc 0 A).indicator id ∘ f) x
state_after: no goals