File: Mathlib/Probability/ConditionalProbability.lean

full_name: ProbabilityTheory.cond
code: /-- The conditional probability measure of measure `μ` on set `s` is `μ` restricted to `s`
and scaled by the inverse of `μ s` (to make it a probability measure):
`(μ s)⁻¹ • μ.restrict s`. -/
def cond (s : Set Ω) : Measure Ω 
goal: MeasureTheory.Measure Ω

full_name: ProbabilityTheory._aux_Mathlib_Probability_ConditionalProbability___unexpand_ProbabilityTheory_cond_1
code: @[inherit_doc] scoped notation μ "[" s "|" t "]" => ProbabilityTheory.cond μ t s
goal: Lean.PrettyPrinter.Unexpander

full_name: ProbabilityTheory.«_aux_Mathlib_Probability_ConditionalProbability___macroRules_ProbabilityTheory_term_[_|_]_1»
code: @[inherit_doc] scoped notation μ "[" s "|" t "]" => ProbabilityTheory.cond μ t s
goal: Lean.Macro

full_name: ProbabilityTheory.«_aux_Mathlib_Probability_ConditionalProbability___macroRules_ProbabilityTheory_term_[|_]_1»
code: @[inherit_doc] scoped notation:max μ "[|" t "]" => ProbabilityTheory.cond μ t
goal: Lean.Macro

full_name: ProbabilityTheory._aux_Mathlib_Probability_ConditionalProbability___unexpand_ProbabilityTheory_cond_2
code: @[inherit_doc] scoped notation:max μ "[|" t "]" => ProbabilityTheory.cond μ t
goal: Lean.PrettyPrinter.Unexpander

full_name: ProbabilityTheory.«_aux_Mathlib_Probability_ConditionalProbability___macroRules_ProbabilityTheory_term_[|_←_]_1»
code: /-- The conditional probability measure of measure `μ` on `{ω | X ω = x}`.

It is `μ` restricted to `{ω | X ω = x}` and scaled by the inverse of `μ {ω | X ω = x}`
(to make it a probability measure): `(μ {ω | X ω = x})⁻¹ • μ.restrict {ω | X ω = x}`. -/
scoped notation:max μ "[|" X " ← " x "]" => μ[|X ⁻¹' {x}]
goal: Lean.Macro

full_name: ProbabilityTheory.cond_isProbabilityMeasure_of_finite
code: /-- The conditional probability measure of any measure on any set of finite positive measure
is a probability measure. -/
theorem cond_isProbabilityMeasure_of_finite (hcs : μ s ≠ 0) (hs : μ s ≠ ∞) :
    IsProbabilityMeasure μ[|s] 
goal: MeasureTheory.IsProbabilityMeasure (ProbabilityTheory.cond μ s)

full_name: ProbabilityTheory.cond_isProbabilityMeasure
code: /-- The conditional probability measure of any finite measure on any set of positive measure
is a probability measure. -/
theorem cond_isProbabilityMeasure [IsFiniteMeasure μ] (hcs : μ s ≠ 0) :
    IsProbabilityMeasure μ[|s] 
goal: MeasureTheory.IsProbabilityMeasure (ProbabilityTheory.cond μ s)

full_name: ProbabilityTheory.cond_isFiniteMeasure
code: instance cond_isFiniteMeasure : IsFiniteMeasure μ[|s] 
goal: MeasureTheory.IsFiniteMeasure (ProbabilityTheory.cond μ s)

full_name: ProbabilityTheory.cond_toMeasurable_eq
code: theorem cond_toMeasurable_eq :
    μ[|(toMeasurable μ s)] = μ[|s] 
goal: ProbabilityTheory.cond μ (MeasureTheory.toMeasurable μ s) = ProbabilityTheory.cond μ s

full_name: ProbabilityTheory.cond_absolutelyContinuous
code: lemma cond_absolutelyContinuous : μ[|s] ≪ μ 
goal: ProbabilityTheory.cond μ s ≪ μ

full_name: ProbabilityTheory.absolutelyContinuous_cond_univ
code: lemma absolutelyContinuous_cond_univ [IsFiniteMeasure μ] : μ ≪ μ[|univ] 
goal: μ ≪ ProbabilityTheory.cond μ Set.univ

full_name: ProbabilityTheory.cond_empty
code: @[simp]
theorem cond_empty : μ[|∅] = 0 
goal: ProbabilityTheory.cond μ ∅ = 0

full_name: ProbabilityTheory.cond_univ
code: @[simp]
theorem cond_univ [IsProbabilityMeasure μ] : μ[|Set.univ] = μ 
goal: ProbabilityTheory.cond μ Set.univ = μ

full_name: ProbabilityTheory.cond_eq_zero
code: @[simp] lemma cond_eq_zero (hμs : μ s ≠ ⊤) : μ[|s] = 0 ↔ μ s = 0 
goal: ProbabilityTheory.cond μ s = 0 ↔ μ s = 0

full_name: ProbabilityTheory.cond_eq_zero_of_meas_eq_zero
code: lemma cond_eq_zero_of_meas_eq_zero (hμs : μ s = 0) : μ[|s] = 0 
goal: ProbabilityTheory.cond μ s = 0

full_name: ProbabilityTheory.cond_apply
code: /-- The axiomatic definition of conditional probability derived from a measure-theoretic one. -/
theorem cond_apply (hms : MeasurableSet s) (t : Set Ω) : μ[t|s] = (μ s)⁻¹ * μ (s ∩ t) 
goal: (ProbabilityTheory.cond μ s) t = (μ s)⁻¹ * μ (s ∩ t)

full_name: ProbabilityTheory.cond_apply'
code: theorem cond_apply' {t : Set Ω} (hA : MeasurableSet t) : μ[t|s] = (μ s)⁻¹ * μ (s ∩ t) 
goal: (ProbabilityTheory.cond μ s) t = (μ s)⁻¹ * μ (s ∩ t)

full_name: ProbabilityTheory.cond_inter_self
code: theorem cond_inter_self (hms : MeasurableSet s) (t : Set Ω) : μ[s ∩ t|s] = μ[t|s] 
goal: (ProbabilityTheory.cond μ s) (s ∩ t) = (ProbabilityTheory.cond μ s) t

full_name: ProbabilityTheory.inter_pos_of_cond_ne_zero
code: theorem inter_pos_of_cond_ne_zero (hms : MeasurableSet s) (hcst : μ[t|s] ≠ 0) : 0 < μ (s ∩ t) 
goal: 0 < μ (s ∩ t)

full_name: ProbabilityTheory.cond_pos_of_inter_ne_zero
code: theorem cond_pos_of_inter_ne_zero [IsFiniteMeasure μ]
    (hms : MeasurableSet s) (hci : μ (s ∩ t) ≠ 0) : 0 < μ[|s] t 
goal: 0 < (ProbabilityTheory.cond μ s) t

full_name: ProbabilityTheory.cond_cond_eq_cond_inter'
code: lemma cond_cond_eq_cond_inter' (hms : MeasurableSet s) (hmt : MeasurableSet t) (hcs : μ s ≠ ∞) :
    μ[|s][|t] = μ[|s ∩ t] 
goal: ProbabilityTheory.cond (ProbabilityTheory.cond μ s) t = ProbabilityTheory.cond μ (s ∩ t)

full_name: ProbabilityTheory.cond_cond_eq_cond_inter
code: /-- Conditioning first on `s` and then on `t` results in the same measure as conditioning
on `s ∩ t`. -/
theorem cond_cond_eq_cond_inter [IsFiniteMeasure μ] (hms : MeasurableSet s)
    (hmt : MeasurableSet t) : μ[|s][|t] = μ[|s ∩ t] 
goal: ProbabilityTheory.cond (ProbabilityTheory.cond μ s) t = ProbabilityTheory.cond μ (s ∩ t)

full_name: ProbabilityTheory.cond_mul_eq_inter'
code: theorem cond_mul_eq_inter' (hms : MeasurableSet s) (hcs' : μ s ≠ ∞) (t : Set Ω) :
    μ[t|s] * μ s = μ (s ∩ t) 
goal: (ProbabilityTheory.cond μ s) t * μ s = μ (s ∩ t)

full_name: ProbabilityTheory.cond_mul_eq_inter
code: theorem cond_mul_eq_inter [IsFiniteMeasure μ] (hms : MeasurableSet s) (t : Set Ω) :
    μ[t|s] * μ s = μ (s ∩ t) 
goal: (ProbabilityTheory.cond μ s) t * μ s = μ (s ∩ t)

full_name: ProbabilityTheory.cond_add_cond_compl_eq
code: /-- A version of the law of total probability. -/
theorem cond_add_cond_compl_eq [IsFiniteMeasure μ] (hms : MeasurableSet s) :
    μ[t|s] * μ s + μ[t|sᶜ] * μ sᶜ = μ t 
goal: (ProbabilityTheory.cond μ s) t * μ s + (ProbabilityTheory.cond μ sᶜ) t * μ sᶜ = μ t

full_name: ProbabilityTheory.cond_eq_inv_mul_cond_mul
code: /-- **Bayes' Theorem** -/
theorem cond_eq_inv_mul_cond_mul [IsFiniteMeasure μ]
    (hms : MeasurableSet s) (hmt : MeasurableSet t) : μ[t|s] = (μ s)⁻¹ * μ[s|t] * μ t 
goal: (ProbabilityTheory.cond μ s) t = (μ s)⁻¹ * (ProbabilityTheory.cond μ t) s * μ t

full_name: ProbabilityTheory.comap_cond
code: lemma comap_cond {i : Ω' → Ω} (hi : MeasurableEmbedding i) (hi' : ∀ᵐ ω ∂μ, ω ∈ range i)
    (hs : MeasurableSet s) : comap i μ[|s] = (comap i μ)[|i ⁻¹' s] 
goal: MeasureTheory.Measure.comap i (ProbabilityTheory.cond μ s) =
  ProbabilityTheory.cond (MeasureTheory.Measure.comap i μ) (i ⁻¹' s)

full_name: ProbabilityTheory.sum_meas_smul_cond_fiber
code: /-- The **law of total probability** for a random variable taking finitely many values: a measure
`μ` can be expressed as a linear combination of its conditional measures `μ[|X ← x]` on fibers of a
random variable `X` valued in a fintype. -/
lemma sum_meas_smul_cond_fiber {X : Ω → α} (hX : Measurable X) (μ : Measure Ω) [IsFiniteMeasure μ] :
    ∑ x, μ (X ⁻¹' {x}) • μ[|X ← x] = μ 
goal: ∑ x : α, μ (X ⁻¹' {x}) • ProbabilityTheory.cond μ (X ⁻¹' {x}) = μ