Theorem: ProbabilityTheory.condCount_disjoint_union
File: Mathlib/Probability/CondCount.lean

tactic: rcases s.eq_empty_or_nonempty with (rfl | hs') <;> rcases t.eq_empty_or_nonempty with (rfl | ht')
state_before: Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
⊢ ↑↑(condCount s) u * ↑↑(condCount (s ∪ t)) s + ↑↑(condCount t) u * ↑↑(condCount (s ∪ t)) t = ↑↑(condCount (s ∪ t)) u

tactic: rw [condCount, condCount, condCount, cond_apply _ hs.measurableSet,
  cond_apply _ ht.measurableSet, cond_apply _ (hs.union ht).measurableSet,
  cond_apply _ (hs.union ht).measurableSet, cond_apply _ (hs.union ht).measurableSet]
state_before: case inr.inr
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
hs' : Set.Nonempty s
ht' : Set.Nonempty t
⊢ ↑↑(condCount s) u * ↑↑(condCount (s ∪ t)) s + ↑↑(condCount t) u * ↑↑(condCount (s ∪ t)) t = ↑↑(condCount (s ∪ t)) u

tactic: conv_lhs =>
  rw [Set.union_inter_cancel_left, Set.union_inter_cancel_right,
    mul_comm (Measure.count (s ∪ t))⁻¹, mul_comm (Measure.count (s ∪ t))⁻¹, ← mul_assoc,
    ← mul_assoc, mul_comm _ (Measure.count s), mul_comm _ (Measure.count t), ← mul_assoc,
    ← mul_assoc]
state_before: case inr.inr
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
hs' : Set.Nonempty s
ht' : Set.Nonempty t
⊢ (↑↑Measure.count s)⁻¹ * ↑↑Measure.count (s ∩ u) * ((↑↑Measure.count (s ∪ t))⁻¹ * ↑↑Measure.count ((s ∪ t) ∩ s)) +
      (↑↑Measure.count t)⁻¹ * ↑↑Measure.count (t ∩ u) * ((↑↑Measure.count (s ∪ t))⁻¹ * ↑↑Measure.count ((s ∪ t) ∩ t)) =
    (↑↑Measure.count (s ∪ t))⁻¹ * ↑↑Measure.count ((s ∪ t) ∩ u)

tactic: rw [ENNReal.mul_inv_cancel, ENNReal.mul_inv_cancel, one_mul, one_mul, ← add_mul, ← measure_union,
  Set.union_inter_distrib_right, mul_comm]
state_before: case inr.inr
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
hs' : Set.Nonempty s
ht' : Set.Nonempty t
⊢ ↑↑Measure.count s * (↑↑Measure.count s)⁻¹ * ↑↑Measure.count (s ∩ u) * (↑↑Measure.count (s ∪ t))⁻¹ +
      ↑↑Measure.count t * (↑↑Measure.count t)⁻¹ * ↑↑Measure.count (t ∩ u) * (↑↑Measure.count (s ∪ t))⁻¹ =
    (↑↑Measure.count (s ∪ t))⁻¹ * ↑↑Measure.count ((s ∪ t) ∩ u)

tactic: exacts [hst.mono inf_le_left inf_le_left, (ht.inter_of_left _).measurableSet,
  Measure.count_ne_zero ht', (Measure.count_apply_lt_top.2 ht).ne, Measure.count_ne_zero hs',
  (Measure.count_apply_lt_top.2 hs).ne]
state_before: case inr.inr.hd
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
hs' : Set.Nonempty s
ht' : Set.Nonempty t
⊢ Disjoint (s ∩ u) (t ∩ u)

case inr.inr.h
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
hs' : Set.Nonempty s
ht' : Set.Nonempty t
⊢ MeasurableSet (t ∩ u)

case inr.inr.h0
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
hs' : Set.Nonempty s
ht' : Set.Nonempty t
⊢ ↑↑Measure.count t ≠ 0

case inr.inr.ht
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
hs' : Set.Nonempty s
ht' : Set.Nonempty t
⊢ ↑↑Measure.count t ≠ ⊤

case inr.inr.h0
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
hs' : Set.Nonempty s
ht' : Set.Nonempty t
⊢ ↑↑Measure.count s ≠ 0

case inr.inr.ht
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s t u : Set Ω
hs : Set.Finite s
ht : Set.Finite t
hst : Disjoint s t
hs' : Set.Nonempty s
ht' : Set.Nonempty t
⊢ ↑↑Measure.count s ≠ ⊤

tactic: simp
state_before: case inl.inl
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
u : Set Ω
hs ht : Set.Finite ∅
hst : Disjoint ∅ ∅
⊢ ↑↑(condCount ∅) u * ↑↑(condCount (∅ ∪ ∅)) ∅ + ↑↑(condCount ∅) u * ↑↑(condCount (∅ ∪ ∅)) ∅ = ↑↑(condCount (∅ ∪ ∅)) u

tactic: simp [condCount_self ht ht']
state_before: case inl.inr
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
t u : Set Ω
ht : Set.Finite t
hs : Set.Finite ∅
hst : Disjoint ∅ t
ht' : Set.Nonempty t
⊢ ↑↑(condCount ∅) u * ↑↑(condCount (∅ ∪ t)) ∅ + ↑↑(condCount t) u * ↑↑(condCount (∅ ∪ t)) t = ↑↑(condCount (∅ ∪ t)) u

tactic: simp [condCount_self hs hs']
state_before: case inr.inl
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSingletonClass Ω
s u : Set Ω
hs : Set.Finite s
hs' : Set.Nonempty s
ht : Set.Finite ∅
hst : Disjoint s ∅
⊢ ↑↑(condCount s) u * ↑↑(condCount (s ∪ ∅)) s + ↑↑(condCount ∅) u * ↑↑(condCount (s ∪ ∅)) ∅ = ↑↑(condCount (s ∪ ∅)) u