-- Mathlib/Probability/Process/Stopping.lean
theorem measurableSet_eq_of_countable_range (hτ : IsStoppingTime f τ)
    (h_countable : (Set.range τ).Countable) (i : ι) : MeasurableSet[f i] {ω | τ ω = i}

Proof state:
case h.mpr
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
a : Ω
h : τ a ≤ i ∧ ∀ (x : Ω), τ x < i → ¬τ a ≤ τ x
⊢ τ a = i

Tactic:
exact h.1.eq_or_lt.resolve_right fun h_lt => h.2 a h_lt le_rfl

Result:
no goals

Proof state:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
j : ι
x✝ : j ∈ Set.range τ
⊢ MeasurableSet (⋃ (_ : j < i), {ω | τ ω ≤ j})

Tactic:
rw [Set.iUnion_eq_if]

Result:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
j : ι
x✝ : j ∈ Set.range τ
⊢ MeasurableSet (if j < i then {ω | τ ω ≤ j} else ∅)

Proof state:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
⊢ {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}

Tactic:
ext1 a

Result:
case h
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
a : Ω
⊢ a ∈ {ω | τ ω = i} ↔ a ∈ {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}

Proof state:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
⊢ MeasurableSet (⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j})

Tactic:
refine MeasurableSet.biUnion h_countable fun j _ => ?_

Result:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
j : ι
x✝ : j ∈ Set.range τ
⊢ MeasurableSet (⋃ (_ : j < i), {ω | τ ω ≤ j})

Proof state:
case h
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
a : Ω
⊢ a ∈ {ω | τ ω = i} ↔ a ∈ {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}

Tactic:
simp only [Set.mem_setOf_eq, Set.mem_range, Set.iUnion_exists, Set.iUnion_iUnion_eq',
  Set.mem_diff, Set.mem_iUnion, exists_prop, not_exists, not_and, not_le]

Result:
case h
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
a : Ω
⊢ τ a = i ↔ τ a ≤ i ∧ ∀ (x : Ω), τ x < i → ¬τ a ≤ τ x

Proof state:
case pos
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
j : ι
x✝ : j ∈ Set.range τ
hji : j < i
⊢ MeasurableSet {ω | τ ω ≤ j}

Tactic:
exact f.mono hji.le _ (hτ.measurableSet_le j)

Result:
no goals

Proof state:
case h
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
a : Ω
⊢ τ a = i ↔ τ a ≤ i ∧ ∀ (x : Ω), τ x < i → ¬τ a ≤ τ x

Tactic:
constructor <;> intro h

Result:
case h.mp
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
a : Ω
h : τ a = i
⊢ τ a ≤ i ∧ ∀ (x : Ω), τ x < i → ¬τ a ≤ τ x

case h.mpr
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
a : Ω
h : τ a ≤ i ∧ ∀ (x : Ω), τ x < i → ¬τ a ≤ τ x
⊢ τ a = i

Proof state:
case h.mp
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
a : Ω
h : τ a = i
⊢ τ a ≤ i ∧ ∀ (x : Ω), τ x < i → ¬τ a ≤ τ x

Tactic:
simp only [h, lt_iff_le_not_le, le_refl, and_imp, imp_self, imp_true_iff, and_self_iff]

Result:
no goals

Proof state:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
⊢ MeasurableSet ({ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j})

Tactic:
refine (hτ.measurableSet_le i).diff ?_

Result:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
⊢ MeasurableSet (⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j})

Proof state:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
⊢ MeasurableSet {ω | τ ω = i}

Tactic:
rw [this]

Result:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
⊢ MeasurableSet ({ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j})

Proof state:
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
j : ι
x✝ : j ∈ Set.range τ
⊢ MeasurableSet (if j < i then {ω | τ ω ≤ j} else ∅)

Tactic:
split_ifs with hji

Result:
case pos
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
j : ι
x✝ : j ∈ Set.range τ
hji : j < i
⊢ MeasurableSet {ω | τ ω ≤ j}

case neg
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
j : ι
x✝ : j ∈ Set.range τ
hji : ¬j < i
⊢ MeasurableSet ∅

Proof state:
case neg
Ω : Type u_1
ι : Type u_3
m : MeasurableSpace Ω
inst✝ : PartialOrder ι
τ : Ω → ι
f : Filtration ι m
hτ : IsStoppingTime f τ
h_countable : (Set.range τ).Countable
i : ι
this : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ j ∈ Set.range τ, ⋃ (_ : j < i), {ω | τ ω ≤ j}
j : ι
x✝ : j ∈ Set.range τ
hji : ¬j < i
⊢ MeasurableSet ∅

Tactic:
exact @MeasurableSet.empty _ (f i)

Result:
no goals