Theorem: ProbabilityTheory.Kernel.withDensity_sub_add_cancel
File: Mathlib/Probability/Kernel/WithDensity.lean

Proof steps:
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
⊢ (κ.withDensity fun a x => f a x - g a x) + κ.withDensity g = κ.withDensity f
state_after: α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
⊢ κ.withDensity ((fun a x => f a x - g a x) + g) = κ.withDensity f

α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
⊢ Measurable (Function.uncurry fun a x => f a x - g a x)
tactic: rw [← withDensity_add_right _ hg]
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
⊢ κ.withDensity ((fun a x => f a x - g a x) + g) = κ.withDensity f

α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
⊢ Measurable (Function.uncurry fun a x => f a x - g a x)
state_after: α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
⊢ Measurable (Function.uncurry fun a x => f a x - g a x)

α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
⊢ κ.withDensity ((fun a x => f a x - g a x) + g) = κ.withDensity f
tactic: swap
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
⊢ κ.withDensity ((fun a x => f a x - g a x) + g) = κ.withDensity f
state_after: α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
a : α
⊢ ((fun a x => f a x - g a x) + g) a =ᶠ[ae (κ a)] f a
tactic: refine withDensity_congr_ae κ ((hf.sub hg).add hg) hf (fun a ↦ ?_)
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
a : α
⊢ ((fun a x => f a x - g a x) + g) a =ᶠ[ae (κ a)] f a
state_after: case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
a : α
x : β
hx : g a x ≤ f a x
⊢ ((fun a x => f a x - g a x) + g) a x = f a x
tactic: filter_upwards [hfg a] with x hx
state_before: case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ : Kernel α β
f✝ : α → β → ℝ≥0∞
inst✝ : IsSFiniteKernel κ
f g : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
hg : Measurable (Function.uncurry g)
hfg : ∀ (a : α), g a ≤ᶠ[ae (κ a)] f a
a : α
x : β
hx : g a x ≤ f a x
⊢ ((fun a x => f a x - g a x) + g) a x = f a x
state_after: no goals
tactic: rwa [Pi.add_apply, Pi.add_apply, tsub_add_cancel_iff_le]