The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V20. Probability

Mathlib.Probability.Kernel.Posterior

27 declarations. Mathlib docs · Source

Posterior kernel

For μ : Measure Ω (called prior measure), seen as a measure on a parameter, and a kernel κ : Kernel Ω 𝓧 that gives the conditional distribution of "data" in 𝓧 given the prior parameter, we can get the distribution of the data with κ ∘ₘ μ, and the joint distribution of parameter and data with μ ⊗ₘ κ : Measure (Ω × 𝓧).

The posterior distribution of the parameter given the data is a Markov kernel κ†μ : Kernel 𝓧 Ω such that (κ ∘ₘ μ) ⊗ₘ κ†μ = (μ ⊗ₘ κ).map Prod.swap. That is, the joint distribution of parameter and data can be recovered from the distribution of the data and the posterior.

Main definitions

  • posterior κ μ: posterior of a kernel κ for a prior measure μ.

Main statements

  • compProd_posterior_eq_map_swap: the main property of the posterior, (κ ∘ₘ μ) ⊗ₘ κ†μ = (μ ⊗ₘ κ).map Prod.swap.

  • ae_eq_posterior_of_compProd_eq

  • posterior_comp_self: κ†μ ∘ₘ κ ∘ₘ μ = μ

  • posterior_posterior: (κ†μ)†(κ ∘ₘ μ) =ᵐ[μ] κ

  • posterior_comp: (η ∘ₖ κ)†μ =ᵐ[η ∘ₘ κ ∘ₘ μ] κ†μ ∘ₖ η†(κ ∘ₘ μ)

  • posterior_eq_withDensity: If κ ω ≪ κ ∘ₘ μ for μ-almost every ω, then for κ ∘ₘ μ-almost every x, κ†μ x = μ.withDensity (fun ω ↦ κ.rnDeriv (Kernel.const _ (κ ∘ₘ μ)) ω x). The condition is true for countable Ω: see absolutelyContinuous_comp_of_countable.

Notation

κ†μ denotes the posterior of κ with respect to μ, posterior κ μ. † can be typed as \dag or \dagger.

This notation emphasizes that the posterior is a kind of inverse of κ, which we would want to denote κ†, but we have to also specify the measure μ.

theorem ProbabilityTheory.posterior.congr_simp E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} [inst : StandardBorelSpace Ω]
  [inst_1 : Nonempty Ω] (κ κ_1 : ProbabilityTheory.Kernel Ω 𝓧) (e_κ : κ = κ_1) (μ μ_1 : MeasureTheory.Measure Ω)
  (e_μ : μ = μ_1) [inst_2 : MeasureTheory.IsFiniteMeasure μ] [inst_3 : ProbabilityTheory.IsFiniteKernel κ],
  ProbabilityTheory.posterior κ μ = ProbabilityTheory.posterior κ_1 μ_1

def ProbabilityTheory.posterior E1 #

{Ω : Type u_1} →
  {𝓧 : Type u_2} →
    {mΩ : MeasurableSpace Ω} →
      {m𝓧 : MeasurableSpace 𝓧} →
        [StandardBorelSpace Ω] →
          [Nonempty Ω] →
            (κ : ProbabilityTheory.Kernel Ω 𝓧) →
              (μ : MeasureTheory.Measure Ω) →
                [MeasureTheory.IsFiniteMeasure μ] → [ProbabilityTheory.IsFiniteKernel κ] → ProbabilityTheory.Kernel 𝓧 Ω

Posterior of the kernel κ with respect to the measure μ.

def ProbabilityTheory.«term_†_» E1 #

Lean.TrailingParserDescr

Posterior of the kernel κ with respect to the measure μ.

instance ProbabilityTheory.instIsMarkovKernelPosterior E0 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω],
  ProbabilityTheory.IsMarkovKernel (ProbabilityTheory.posterior κ μ)

The posterior is a Markov kernel.

theorem ProbabilityTheory.compProd_posterior_eq_map_swap E3 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω],
  (μ.bind ⇑κ).compProd (ProbabilityTheory.posterior κ μ) = MeasureTheory.Measure.map Prod.swap (μ.compProd κ)

The main property of the posterior.

theorem ProbabilityTheory.compProd_posterior_eq_swap_comp E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω],
  (μ.bind ⇑κ).compProd (ProbabilityTheory.posterior κ μ) = (μ.compProd κ).bind ⇑(ProbabilityTheory.Kernel.swap Ω 𝓧)

theorem ProbabilityTheory.swap_compProd_posterior E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω],
  ((μ.bind ⇑κ).compProd (ProbabilityTheory.posterior κ μ)).bind ⇑(ProbabilityTheory.Kernel.swap 𝓧 Ω) = μ.compProd κ

theorem ProbabilityTheory.parallelProd_posterior_comp_copy_comp E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω],
  ((μ.bind ⇑κ).bind ⇑(ProbabilityTheory.Kernel.copy 𝓧)).bind
      ⇑(ProbabilityTheory.Kernel.id.parallelComp (ProbabilityTheory.posterior κ μ)) =
    (μ.bind ⇑(ProbabilityTheory.Kernel.copy Ω)).bind ⇑(κ.parallelComp ProbabilityTheory.Kernel.id)

The main property of the posterior, as equality of the following diagrams:

         -- id          -- κ
μ -- κ -|        =  μ -|
         -- κ†μ         -- id

theorem ProbabilityTheory.posterior_prod_id_comp E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω],
  (μ.bind ⇑κ).bind ⇑((ProbabilityTheory.posterior κ μ).prod ProbabilityTheory.Kernel.id) = μ.compProd κ

theorem ProbabilityTheory.ae_eq_posterior_of_compProd_eq E3 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] {η : ProbabilityTheory.Kernel 𝓧 Ω}
  [ProbabilityTheory.IsFiniteKernel η],
  (μ.bind ⇑κ).compProd η = MeasureTheory.Measure.map Prod.swap (μ.compProd κ) →
    ⇑η =ᵐ[μ.bind ⇑κ] ⇑(ProbabilityTheory.posterior κ μ)

The posterior is unique up to a κ ∘ₘ μ-null set.

theorem ProbabilityTheory.ae_eq_posterior_of_compProd_eq_swap_comp E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] (η : ProbabilityTheory.Kernel 𝓧 Ω)
  [ProbabilityTheory.IsFiniteKernel η],
  (μ.bind ⇑κ).compProd η = (μ.compProd κ).bind ⇑(ProbabilityTheory.Kernel.swap Ω 𝓧) →
    ⇑η =ᵐ[μ.bind ⇑κ] ⇑(ProbabilityTheory.posterior κ μ)

The posterior is unique up to a κ ∘ₘ μ-null set.

theorem ProbabilityTheory.posterior_comp_self E3 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] [ProbabilityTheory.IsMarkovKernel κ],
  (μ.bind ⇑κ).bind ⇑(ProbabilityTheory.posterior κ μ) = μ

theorem ProbabilityTheory.posterior_id E1 #

∀ {Ω : Type u_1} {mΩ : MeasurableSpace Ω} [inst : StandardBorelSpace Ω] [inst_1 : Nonempty Ω]
  (μ : MeasureTheory.Measure Ω) [inst_2 : MeasureTheory.IsFiniteMeasure μ],
  ⇑(ProbabilityTheory.posterior ProbabilityTheory.Kernel.id μ) =ᵐ[μ] ⇑ProbabilityTheory.Kernel.id

The posterior of the identity kernel is the identity kernel.

theorem ProbabilityTheory.deterministic_comp_posterior E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {μ : MeasureTheory.Measure Ω}
  [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : StandardBorelSpace Ω] [inst_2 : Nonempty Ω]
  [MeasurableSpace.CountablyGenerated 𝓧] {f : Ω → 𝓧} (hf : Measurable f),
  ⇑((ProbabilityTheory.Kernel.deterministic f hf).comp
        (ProbabilityTheory.posterior (ProbabilityTheory.Kernel.deterministic f hf) μ)) =ᵐ[MeasureTheory.Measure.map f μ]
    ⇑ProbabilityTheory.Kernel.id

For a deterministic kernel κ, κ ∘ₖ κ†μ is μ.map f-a.e. equal to the identity kernel.

theorem ProbabilityTheory.absolutelyContinuous_posterior E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] {ν : MeasureTheory.Measure 𝓧} [MeasureTheory.SFinite ν],
  (∀ᵐ (ω : Ω) ∂μ, (κ ω).AbsolutelyContinuous ν) →
    ∀ᵐ (b : 𝓧) ∂μ.bind ⇑κ, ((ProbabilityTheory.posterior κ μ) b).AbsolutelyContinuous μ

theorem ProbabilityTheory.posterior_posterior E3 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] [inst_4 : StandardBorelSpace 𝓧] [inst_5 : Nonempty 𝓧]
  [ProbabilityTheory.IsMarkovKernel κ],
  ⇑(ProbabilityTheory.posterior (ProbabilityTheory.posterior κ μ) (μ.bind ⇑κ)) =ᵐ[μ] ⇑κ

The posterior is involutive (up to μ-a.e. equality).

theorem ProbabilityTheory.posterior_comp E3 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {𝓨 : Type u_3} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧}
  {m𝓨 : MeasurableSpace 𝓨} {κ : ProbabilityTheory.Kernel Ω 𝓧} {μ : MeasureTheory.Measure Ω}
  [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ] [inst_2 : StandardBorelSpace Ω]
  [inst_3 : Nonempty Ω] [inst_4 : StandardBorelSpace 𝓧] [inst_5 : Nonempty 𝓧] {η : ProbabilityTheory.Kernel 𝓧 𝓨}
  [inst_6 : ProbabilityTheory.IsFiniteKernel η],
  ⇑(ProbabilityTheory.posterior (η.comp κ) μ) =ᵐ[(μ.bind ⇑κ).bind ⇑η]
    ⇑((ProbabilityTheory.posterior κ μ).comp (ProbabilityTheory.posterior η (μ.bind ⇑κ)))

The posterior is contravariant.

theorem ProbabilityTheory.absolutelyContinuous_of_posterior E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] [MeasurableSpace.CountableOrCountablyGenerated Ω 𝓧],
  (∀ᵐ (b : 𝓧) ∂μ.bind ⇑κ, ((ProbabilityTheory.posterior κ μ) b).AbsolutelyContinuous μ) →
    ∀ᵐ (ω : Ω) ∂μ, (κ ω).AbsolutelyContinuous (μ.bind ⇑κ)

theorem ProbabilityTheory.absolutelyContinuous_posterior_iff E0 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] [MeasurableSpace.CountableOrCountablyGenerated Ω 𝓧],
  (∀ᵐ (b : 𝓧) ∂μ.bind ⇑κ, ((ProbabilityTheory.posterior κ μ) b).AbsolutelyContinuous μ) ↔
    ∀ᵐ (ω : Ω) ∂μ, (κ ω).AbsolutelyContinuous (μ.bind ⇑κ)

theorem ProbabilityTheory.Kernel.absolutelyContinuous_comp_of_absolutelyContinuous E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure μ] [ProbabilityTheory.IsFiniteKernel κ]
  [StandardBorelSpace Ω] [Nonempty Ω] [MeasurableSpace.CountableOrCountablyGenerated Ω 𝓧] {ν : MeasureTheory.Measure 𝓧}
  [MeasureTheory.SFinite ν],
  (∀ᵐ (ω : Ω) ∂μ, (κ ω).AbsolutelyContinuous ν) → ∀ᵐ (ω : Ω) ∂μ, (κ ω).AbsolutelyContinuous (μ.bind ⇑κ)

theorem ProbabilityTheory.rnDeriv_posterior_ae_prod E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] [inst_4 : MeasurableSpace.CountableOrCountablyGenerated Ω 𝓧],
  (∀ᵐ (ω : Ω) ∂μ, (κ ω).AbsolutelyContinuous (μ.bind ⇑κ)) →
    ∀ᵐ (p : Ω × 𝓧) ∂μ.prod (μ.bind ⇑κ),
      (ProbabilityTheory.posterior κ μ).rnDeriv (ProbabilityTheory.Kernel.const 𝓧 μ) p.2 p.1 =
        κ.rnDeriv (ProbabilityTheory.Kernel.const Ω (μ.bind ⇑κ)) p.1 p.2

theorem ProbabilityTheory.rnDeriv_posterior E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] [inst_4 : MeasurableSpace.CountableOrCountablyGenerated Ω 𝓧],
  (∀ᵐ (ω : Ω) ∂μ, (κ ω).AbsolutelyContinuous (μ.bind ⇑κ)) →
    ∀ᵐ (ω : Ω) ∂μ,
      ∀ᵐ (x : 𝓧) ∂μ.bind ⇑κ,
        (ProbabilityTheory.posterior κ μ).rnDeriv (ProbabilityTheory.Kernel.const 𝓧 μ) x ω =
          κ.rnDeriv (ProbabilityTheory.Kernel.const Ω (μ.bind ⇑κ)) ω x

theorem ProbabilityTheory.rnDeriv_posterior_symm E1 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] [inst_4 : MeasurableSpace.CountableOrCountablyGenerated Ω 𝓧],
  (∀ᵐ (ω : Ω) ∂μ, (κ ω).AbsolutelyContinuous (μ.bind ⇑κ)) →
    ∀ᵐ (x : 𝓧) ∂μ.bind ⇑κ,
      ∀ᵐ (ω : Ω) ∂μ,
        (ProbabilityTheory.posterior κ μ).rnDeriv (ProbabilityTheory.Kernel.const 𝓧 μ) x ω =
          κ.rnDeriv (ProbabilityTheory.Kernel.const Ω (μ.bind ⇑κ)) ω x

theorem ProbabilityTheory.posterior_eq_withDensity E3 #

∀ {Ω : Type u_1} {𝓧 : Type u_2} {mΩ : MeasurableSpace Ω} {m𝓧 : MeasurableSpace 𝓧} {κ : ProbabilityTheory.Kernel Ω 𝓧}
  {μ : MeasureTheory.Measure Ω} [inst : MeasureTheory.IsFiniteMeasure μ] [inst_1 : ProbabilityTheory.IsFiniteKernel κ]
  [inst_2 : StandardBorelSpace Ω] [inst_3 : Nonempty Ω] [inst_4 : MeasurableSpace.CountableOrCountablyGenerated Ω 𝓧],
  (∀ᵐ (ω : Ω) ∂μ, (κ ω).AbsolutelyContinuous (μ.bind ⇑κ)) →
    ∀ᵐ (x : 𝓧) ∂μ.bind ⇑κ,
      (ProbabilityTheory.posterior κ μ) x =
        μ.withDensity fun ω ↦ κ.rnDeriv (ProbabilityTheory.Kernel.const Ω (μ.bind ⇑κ)) ω x

If κ ω ≪ κ ∘ₘ μ for μ-almost every ω, then for κ ∘ₘ μ-almost every x, κ†μ x = μ.withDensity (fun ω ↦ κ.rnDeriv (Kernel.const _ (κ ∘ₘ μ)) ω x). This is a form of Bayes' theorem. The condition is true for example for countable Ω.

theorem ProbabilityTheory.posterior_eq_withDensity_of_countable E1 #

∀ {𝓧 : Type u_2} {m𝓧 : MeasurableSpace 𝓧} {Ω : Type u_4} [Countable Ω] [inst : MeasurableSpace Ω] [inst_1 : Nonempty Ω]
  [inst_2 : StandardBorelSpace Ω] (κ : ProbabilityTheory.Kernel Ω 𝓧) [inst_3 : ProbabilityTheory.IsFiniteKernel κ]
  (μ : MeasureTheory.Measure Ω) [inst_4 : MeasureTheory.IsFiniteMeasure μ],
  ∀ᵐ (x : 𝓧) ∂μ.bind ⇑κ, (ProbabilityTheory.posterior κ μ) x = μ.withDensity fun ω ↦ (κ ω).rnDeriv (μ.bind ⇑κ) x

theorem ProbabilityTheory.posterior_boolKernel_apply_false E1 #

∀ {𝓧 : Type u_2} {m𝓧 : MeasurableSpace 𝓧} (μ ν : MeasureTheory.Measure 𝓧) [inst : MeasureTheory.IsFiniteMeasure μ]
  [inst_1 : MeasureTheory.IsFiniteMeasure ν] (π : MeasureTheory.Measure Bool)
  [inst_2 : MeasureTheory.IsFiniteMeasure π],
  ∀ᵐ (x : 𝓧) ∂π.bind ⇑(ProbabilityTheory.Kernel.boolKernel μ ν),
    ((ProbabilityTheory.posterior (ProbabilityTheory.Kernel.boolKernel μ ν) π) x) {false} =
      π {false} * μ.rnDeriv (π.bind ⇑(ProbabilityTheory.Kernel.boolKernel μ ν)) x

theorem ProbabilityTheory.posterior_boolKernel_apply_true E1 #

∀ {𝓧 : Type u_2} {m𝓧 : MeasurableSpace 𝓧} (μ ν : MeasureTheory.Measure 𝓧) [inst : MeasureTheory.IsFiniteMeasure μ]
  [inst_1 : MeasureTheory.IsFiniteMeasure ν] (π : MeasureTheory.Measure Bool)
  [inst_2 : MeasureTheory.IsFiniteMeasure π],
  ∀ᵐ (x : 𝓧) ∂π.bind ⇑(ProbabilityTheory.Kernel.boolKernel μ ν),
    ((ProbabilityTheory.posterior (ProbabilityTheory.Kernel.boolKernel μ ν) π) x) {true} =
      π {true} * ν.rnDeriv (π.bind ⇑(ProbabilityTheory.Kernel.boolKernel μ ν)) x