File: Mathlib/Probability/Kernel/WithDensity.lean

full_name: ProbabilityTheory.Kernel.withDensity
code: /-- Kernel with image `(κ a).withDensity (f a)` if `Function.uncurry f` is measurable, and
with image 0 otherwise. If `Function.uncurry f` is measurable, it satisfies
`∫⁻ b, g b ∂(withDensity κ f hf a) = ∫⁻ b, f a b * g b ∂(κ a)`. -/
noncomputable def withDensity (κ : Kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) :
    Kernel α β 
goal: ProbabilityTheory.Kernel α β

full_name: ProbabilityTheory.Kernel.withDensity_of_not_measurable
code: theorem withDensity_of_not_measurable (κ : Kernel α β) [IsSFiniteKernel κ]
    (hf : ¬Measurable (Function.uncurry f)) : withDensity κ f = 0 
goal: κ.withDensity f = 0

full_name: ProbabilityTheory.Kernel.withDensity_apply
code: protected theorem withDensity_apply (κ : Kernel α β) [IsSFiniteKernel κ]
    (hf : Measurable (Function.uncurry f)) (a : α) :
    withDensity κ f a = (κ a).withDensity (f a) 
goal: (κ.withDensity f) a = (κ a).withDensity (f a)

full_name: ProbabilityTheory.Kernel.withDensity_apply'
code: protected theorem withDensity_apply' (κ : Kernel α β) [IsSFiniteKernel κ]
    (hf : Measurable (Function.uncurry f)) (a : α) (s : Set β) :
    withDensity κ f a s = ∫⁻ b in s, f a b ∂κ a 
goal: ((κ.withDensity f) a) s = ∫⁻ (b : β) in s, f a b ∂κ a

full_name: ProbabilityTheory.Kernel.withDensity_congr_ae
code: nonrec lemma withDensity_congr_ae (κ : Kernel α β) [IsSFiniteKernel κ] {f g : α → β → ℝ≥0∞}
    (hf : Measurable (Function.uncurry f)) (hg : Measurable (Function.uncurry g))
    (hfg : ∀ a, f a =ᵐ[κ a] g a) :
    withDensity κ f = withDensity κ g 
goal: κ.withDensity f = κ.withDensity g

full_name: ProbabilityTheory.Kernel.withDensity_absolutelyContinuous
code: nonrec lemma withDensity_absolutelyContinuous [IsSFiniteKernel κ]
    (f : α → β → ℝ≥0∞) (a : α) :
    Kernel.withDensity κ f a ≪ κ a 
goal: (κ.withDensity f) a ≪ κ a

full_name: ProbabilityTheory.Kernel.withDensity_one
code: @[simp]
lemma withDensity_one (κ : Kernel α β) [IsSFiniteKernel κ] :
    Kernel.withDensity κ 1 = κ 
goal: κ.withDensity 1 = κ

full_name: ProbabilityTheory.Kernel.withDensity_one'
code: @[simp]
lemma withDensity_one' (κ : Kernel α β) [IsSFiniteKernel κ] :
    Kernel.withDensity κ (fun _ _ ↦ 1) = κ 
goal: (κ.withDensity fun x x => 1) = κ

full_name: ProbabilityTheory.Kernel.withDensity_zero
code: @[simp]
lemma withDensity_zero (κ : Kernel α β) [IsSFiniteKernel κ] :
    Kernel.withDensity κ 0 = 0 
goal: κ.withDensity 0 = 0

full_name: ProbabilityTheory.Kernel.withDensity_zero'
code: @[simp]
lemma withDensity_zero' (κ : Kernel α β) [IsSFiniteKernel κ] :
    Kernel.withDensity κ (fun _ _ ↦ 0) = 0 
goal: (κ.withDensity fun x x => 0) = 0

full_name: ProbabilityTheory.Kernel.lintegral_withDensity
code: theorem lintegral_withDensity (κ : Kernel α β) [IsSFiniteKernel κ]
    (hf : Measurable (Function.uncurry f)) (a : α) {g : β → ℝ≥0∞} (hg : Measurable g) :
    ∫⁻ b, g b ∂withDensity κ f a = ∫⁻ b, f a b * g b ∂κ a 
goal: ∫⁻ (b : β), g b ∂(κ.withDensity f) a = ∫⁻ (b : β), f a b * g b ∂κ a

full_name: ProbabilityTheory.Kernel.integral_withDensity
code: theorem integral_withDensity {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
    {f : β → E} [IsSFiniteKernel κ] {a : α} {g : α → β → ℝ≥0}
    (hg : Measurable (Function.uncurry g)) :
    ∫ b, f b ∂withDensity κ (fun a b => g a b) a = ∫ b, g a b • f b ∂κ a 
goal: ∫ (b : β), f b ∂(κ.withDensity fun a b => ↑(g a b)) a = ∫ (b : β), g a b • f b ∂κ a

full_name: ProbabilityTheory.Kernel.withDensity_add_left
code: theorem withDensity_add_left (κ η : Kernel α β) [IsSFiniteKernel κ] [IsSFiniteKernel η]
    (f : α → β → ℝ≥0∞) : withDensity (κ + η) f = withDensity κ f + withDensity η f 
goal: (κ + η).withDensity f = κ.withDensity f + η.withDensity f

full_name: ProbabilityTheory.Kernel.withDensity_kernel_sum
code: theorem withDensity_kernel_sum [Countable ι] (κ : ι → Kernel α β) (hκ : ∀ i, IsSFiniteKernel (κ i))
    (f : α → β → ℝ≥0∞) :
    @withDensity _ _ _ _ (Kernel.sum κ) (isSFiniteKernel_sum hκ) f =
      Kernel.sum fun i => withDensity (κ i) f 
goal: (ProbabilityTheory.Kernel.sum κ).withDensity f = ProbabilityTheory.Kernel.sum fun i => (κ i).withDensity f

full_name: ProbabilityTheory.Kernel.withDensity_add_right
code: lemma withDensity_add_right [IsSFiniteKernel κ] {f g : α → β → ℝ≥0∞}
    (hf : Measurable (Function.uncurry f)) (hg : Measurable (Function.uncurry g)) :
    withDensity κ (f + g) = withDensity κ f + withDensity κ g 
goal: κ.withDensity (f + g) = κ.withDensity f + κ.withDensity g

full_name: ProbabilityTheory.Kernel.withDensity_sub_add_cancel
code: lemma withDensity_sub_add_cancel [IsSFiniteKernel κ] {f g : α → β → ℝ≥0∞}
    (hf : Measurable (Function.uncurry f)) (hg : Measurable (Function.uncurry g))
    (hfg : ∀ a, g a ≤ᵐ[κ a] f a) :
    withDensity κ (fun a x ↦ f a x - g a x) + withDensity κ g = withDensity κ f 
goal: (κ.withDensity fun a x => f a x - g a x) + κ.withDensity g = κ.withDensity f

full_name: ProbabilityTheory.Kernel.withDensity_tsum
code: theorem withDensity_tsum [Countable ι] (κ : Kernel α β) [IsSFiniteKernel κ] {f : ι → α → β → ℝ≥0∞}
    (hf : ∀ i, Measurable (Function.uncurry (f i))) :
    withDensity κ (∑' n, f n) = Kernel.sum fun n => withDensity κ (f n) 
goal: κ.withDensity (∑' (n : ι), f n) = ProbabilityTheory.Kernel.sum fun n => κ.withDensity (f n)

full_name: ProbabilityTheory.Kernel.isFiniteKernel_withDensity_of_bounded
code: /-- If a kernel `κ` is finite and a function `f : α → β → ℝ≥0∞` is bounded, then `withDensity κ f`
is finite. -/
theorem isFiniteKernel_withDensity_of_bounded (κ : Kernel α β) [IsFiniteKernel κ] {B : ℝ≥0∞}
    (hB_top : B ≠ ∞) (hf_B : ∀ a b, f a b ≤ B) : IsFiniteKernel (withDensity κ f) 
goal: ProbabilityTheory.IsFiniteKernel (κ.withDensity f)

full_name: ProbabilityTheory.Kernel.isSFiniteKernel_withDensity_of_isFiniteKernel
code: /-- Auxiliary lemma for `IsSFiniteKernel.withDensity`.
If a kernel `κ` is finite, then `withDensity κ f` is s-finite. -/
theorem isSFiniteKernel_withDensity_of_isFiniteKernel (κ : Kernel α β) [IsFiniteKernel κ]
    (hf_ne_top : ∀ a b, f a b ≠ ∞) : IsSFiniteKernel (withDensity κ f) 
goal: ProbabilityTheory.IsSFiniteKernel (κ.withDensity f)

full_name: ProbabilityTheory.Kernel.IsSFiniteKernel.withDensity
code: /-- For an s-finite kernel `κ` and a function `f : α → β → ℝ≥0∞` which is everywhere finite,
`withDensity κ f` is s-finite. -/
nonrec theorem IsSFiniteKernel.withDensity (κ : Kernel α β) [IsSFiniteKernel κ]
    (hf_ne_top : ∀ a b, f a b ≠ ∞) : IsSFiniteKernel (withDensity κ f) 
goal: ProbabilityTheory.IsSFiniteKernel (κ.withDensity f)

full_name: ProbabilityTheory.Kernel.instIsSFiniteKernelWithDensityOfNNReal
code: /-- For an s-finite kernel `κ` and a function `f : α → β → ℝ≥0`, `withDensity κ f` is s-finite. -/
instance (κ : Kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0) :
    IsSFiniteKernel (withDensity κ fun a b => f a b) 
goal: ProbabilityTheory.IsSFiniteKernel (κ.withDensity fun a b => ↑(f a b))

full_name: ProbabilityTheory.Kernel.withDensity_mul
code: nonrec lemma withDensity_mul [IsSFiniteKernel κ] {f : α → β → ℝ≥0} {g : α → β → ℝ≥0∞}
    (hf : Measurable (Function.uncurry f)) (hg : Measurable (Function.uncurry g)) :
    withDensity κ (fun a x ↦ f a x * g a x)
      = withDensity (withDensity κ fun a x ↦ f a x) g 
goal: (κ.withDensity fun a x => ↑(f a x) * g a x) = (κ.withDensity fun a x => ↑(f a x)).withDensity g