probability.probability_mass_function.monad
⟷
Mathlib.Probability.ProbabilityMassFunction.Monad
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -363,7 +363,7 @@ theorem bindOnSupport_bindOnSupport (p : PMF α) (f : ∀ a ∈ p.support, PMF
refine' ennreal.tsum_comm.trans (tsum_congr fun a' => tsum_congr fun b => _)
split_ifs
any_goals ring1
- · have := h_1 a'; simp [h] at this ; contradiction
+ · have := h_1 a'; simp [h] at this; contradiction
· simp [h_2]
#align pmf.bind_on_support_bind_on_support PMF.bindOnSupport_bindOnSupport
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -358,7 +358,7 @@ theorem bindOnSupport_bindOnSupport (p : PMF α) (f : ∀ a ∈ p.support, PMF
refine' PMF.ext fun a => _
simp only [ennreal.coe_eq_coe.symm, bind_on_support_apply, ← tsum_dite_right,
ennreal.tsum_mul_left.symm, ennreal.tsum_mul_right.symm]
- simp only [ENNReal.tsum_eq_zero, ENNReal.coe_eq_coe, ENNReal.coe_eq_zero, ENNReal.coe_zero,
+ simp only [ENNReal.tsum_eq_zero, ENNReal.coe_inj, ENNReal.coe_eq_zero, ENNReal.coe_zero,
dite_eq_left_iff, mul_eq_zero]
refine' ennreal.tsum_comm.trans (tsum_congr fun a' => tsum_congr fun b => _)
split_ifs
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -322,7 +322,8 @@ theorem bindOnSupport_eq_bind (p : PMF α) (f : α → PMF β) :
theorem bindOnSupport_eq_zero_iff (b : β) :
p.bindOnSupport f b = 0 ↔ ∀ (a) (ha : p a ≠ 0), f a ha b = 0 :=
by
- simp only [bind_on_support_apply, ENNReal.tsum_eq_zero, mul_eq_zero, or_iff_not_imp_left]
+ simp only [bind_on_support_apply, ENNReal.tsum_eq_zero, mul_eq_zero,
+ Classical.or_iff_not_imp_left]
exact ⟨fun h a ha => trans (dif_neg ha).symm (h a ha), fun h a ha => trans (dif_neg ha) (h a ha)⟩
#align pmf.bind_on_support_eq_zero_iff PMF.bindOnSupport_eq_zero_iff
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/b1abe23ae96fef89ad30d9f4362c307f72a55010
@@ -286,7 +286,7 @@ theorem support_bindOnSupport :
by
refine' Set.ext fun b => _
simp only [ENNReal.tsum_eq_zero, not_or, mem_support_iff, bind_on_support_apply, Ne.def,
- not_forall, mul_eq_zero, Set.mem_iUnion]
+ Classical.not_forall, mul_eq_zero, Set.mem_iUnion]
exact
⟨fun hb =>
let ⟨a, ⟨ha, ha'⟩⟩ := hb
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -32,60 +32,60 @@ open scoped Classical BigOperators NNReal ENNReal
open MeasureTheory
-namespace Pmf
+namespace PMF
section Pure
-#print Pmf.pure /-
+#print PMF.pure /-
/-- The pure `pmf` is the `pmf` where all the mass lies in one point.
The value of `pure a` is `1` at `a` and `0` elsewhere. -/
-def pure (a : α) : Pmf α :=
+def pure (a : α) : PMF α :=
⟨fun a' => if a' = a then 1 else 0, hasSum_ite_eq _ _⟩
-#align pmf.pure Pmf.pure
+#align pmf.pure PMF.pure
-/
variable (a a' : α)
-#print Pmf.pure_apply /-
+#print PMF.pure_apply /-
@[simp]
theorem pure_apply : pure a a' = if a' = a then 1 else 0 :=
rfl
-#align pmf.pure_apply Pmf.pure_apply
+#align pmf.pure_apply PMF.pure_apply
-/
-#print Pmf.support_pure /-
+#print PMF.support_pure /-
@[simp]
theorem support_pure : (pure a).support = {a} :=
Set.ext fun a' => by simp [mem_support_iff]
-#align pmf.support_pure Pmf.support_pure
+#align pmf.support_pure PMF.support_pure
-/
-#print Pmf.mem_support_pure_iff /-
+#print PMF.mem_support_pure_iff /-
theorem mem_support_pure_iff : a' ∈ (pure a).support ↔ a' = a := by simp
-#align pmf.mem_support_pure_iff Pmf.mem_support_pure_iff
+#align pmf.mem_support_pure_iff PMF.mem_support_pure_iff
-/
-#print Pmf.pure_apply_self /-
+#print PMF.pure_apply_self /-
@[simp]
theorem pure_apply_self : pure a a = 1 :=
if_pos rfl
-#align pmf.pure_apply_self Pmf.pure_apply_self
+#align pmf.pure_apply_self PMF.pure_apply_self
-/
-#print Pmf.pure_apply_of_ne /-
+#print PMF.pure_apply_of_ne /-
theorem pure_apply_of_ne (h : a' ≠ a) : pure a a' = 0 :=
if_neg h
-#align pmf.pure_apply_of_ne Pmf.pure_apply_of_ne
+#align pmf.pure_apply_of_ne PMF.pure_apply_of_ne
-/
-instance [Inhabited α] : Inhabited (Pmf α) :=
+instance [Inhabited α] : Inhabited (PMF α) :=
⟨pure default⟩
section Measure
variable (s : Set α)
-#print Pmf.toOuterMeasure_pure_apply /-
+#print PMF.toOuterMeasure_pure_apply /-
@[simp]
theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then 1 else 0 :=
by
@@ -95,31 +95,31 @@ theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then
exact ite_eq_left_iff.2 fun hb => symm (ite_eq_right_iff.2 fun h => (hb <| h.symm ▸ ha).elim)
· refine' (tsum_congr fun b => _).trans tsum_zero
exact ite_eq_right_iff.2 fun hb => ite_eq_right_iff.2 fun h => (ha <| h ▸ hb).elim
-#align pmf.to_outer_measure_pure_apply Pmf.toOuterMeasure_pure_apply
+#align pmf.to_outer_measure_pure_apply PMF.toOuterMeasure_pure_apply
-/
variable [MeasurableSpace α]
-#print Pmf.toMeasure_pure_apply /-
+#print PMF.toMeasure_pure_apply /-
/-- The measure of a set under `pure a` is `1` for sets containing `a` and `0` otherwise -/
@[simp]
theorem toMeasure_pure_apply (hs : MeasurableSet s) :
(pure a).toMeasure s = if a ∈ s then 1 else 0 :=
(toMeasure_apply_eq_toOuterMeasure_apply (pure a) s hs).trans (toOuterMeasure_pure_apply a s)
-#align pmf.to_measure_pure_apply Pmf.toMeasure_pure_apply
+#align pmf.to_measure_pure_apply PMF.toMeasure_pure_apply
-/
-#print Pmf.toMeasure_pure /-
+#print PMF.toMeasure_pure /-
theorem toMeasure_pure : (pure a).toMeasure = Measure.dirac a :=
Measure.ext fun s hs => by simpa only [to_measure_pure_apply a s hs, measure.dirac_apply' a hs]
-#align pmf.to_measure_pure Pmf.toMeasure_pure
+#align pmf.to_measure_pure PMF.toMeasure_pure
-/
-#print Pmf.toPmf_dirac /-
+#print PMF.toPMF_dirac /-
@[simp]
-theorem toPmf_dirac [Countable α] [h : MeasurableSingletonClass α] :
- (Measure.dirac a).toPmf = pure a := by rw [to_pmf_eq_iff_to_measure_eq, to_measure_pure]
-#align pmf.to_pmf_dirac Pmf.toPmf_dirac
+theorem toPMF_dirac [Countable α] [h : MeasurableSingletonClass α] :
+ (Measure.dirac a).toPMF = pure a := by rw [to_pmf_eq_iff_to_measure_eq, to_measure_pure]
+#align pmf.to_pmf_dirac PMF.toPMF_dirac
-/
end Measure
@@ -128,83 +128,83 @@ end Pure
section Bind
-#print Pmf.bind /-
+#print PMF.bind /-
/-- The monadic bind operation for `pmf`. -/
-def bind (p : Pmf α) (f : α → Pmf β) : Pmf β :=
+def bind (p : PMF α) (f : α → PMF β) : PMF β :=
⟨fun b => ∑' a, p a * f a b,
ENNReal.summable.hasSum_iff.2
(ENNReal.tsum_comm.trans <| by simp only [ENNReal.tsum_mul_left, tsum_coe, mul_one])⟩
-#align pmf.bind Pmf.bind
+#align pmf.bind PMF.bind
-/
-variable (p : Pmf α) (f : α → Pmf β) (g : β → Pmf γ)
+variable (p : PMF α) (f : α → PMF β) (g : β → PMF γ)
-#print Pmf.bind_apply /-
+#print PMF.bind_apply /-
@[simp]
theorem bind_apply (b : β) : p.bind f b = ∑' a, p a * f a b :=
rfl
-#align pmf.bind_apply Pmf.bind_apply
+#align pmf.bind_apply PMF.bind_apply
-/
-#print Pmf.support_bind /-
+#print PMF.support_bind /-
@[simp]
theorem support_bind : (p.bind f).support = ⋃ a ∈ p.support, (f a).support :=
Set.ext fun b => by simp [mem_support_iff, ENNReal.tsum_eq_zero, not_or]
-#align pmf.support_bind Pmf.support_bind
+#align pmf.support_bind PMF.support_bind
-/
-#print Pmf.mem_support_bind_iff /-
+#print PMF.mem_support_bind_iff /-
theorem mem_support_bind_iff (b : β) :
b ∈ (p.bind f).support ↔ ∃ a ∈ p.support, b ∈ (f a).support := by
simp only [support_bind, Set.mem_iUnion, Set.mem_setOf_eq]
-#align pmf.mem_support_bind_iff Pmf.mem_support_bind_iff
+#align pmf.mem_support_bind_iff PMF.mem_support_bind_iff
-/
-#print Pmf.pure_bind /-
+#print PMF.pure_bind /-
@[simp]
-theorem pure_bind (a : α) (f : α → Pmf β) : (pure a).bind f = f a :=
+theorem pure_bind (a : α) (f : α → PMF β) : (pure a).bind f = f a :=
by
have : ∀ b a', ite (a' = a) 1 0 * f a' b = ite (a' = a) (f a b) 0 := fun b a' => by
split_ifs <;> simp <;> subst h <;> simp
ext b <;> simp [this]
-#align pmf.pure_bind Pmf.pure_bind
+#align pmf.pure_bind PMF.pure_bind
-/
-#print Pmf.bind_pure /-
+#print PMF.bind_pure /-
@[simp]
theorem bind_pure : p.bind pure = p :=
- Pmf.ext fun x =>
+ PMF.ext fun x =>
(bind_apply _ _ _).trans
(trans
(tsum_eq_single x fun y hy => by
rw [pure_apply_of_ne _ _ hy.symm, MulZeroClass.mul_zero]) <|
by rw [pure_apply_self, mul_one])
-#align pmf.bind_pure Pmf.bind_pure
+#align pmf.bind_pure PMF.bind_pure
-/
-#print Pmf.bind_const /-
+#print PMF.bind_const /-
@[simp]
-theorem bind_const (p : Pmf α) (q : Pmf β) : (p.bind fun _ => q) = q :=
- Pmf.ext fun x => by rw [bind_apply, ENNReal.tsum_mul_right, tsum_coe, one_mul]
-#align pmf.bind_const Pmf.bind_const
+theorem bind_const (p : PMF α) (q : PMF β) : (p.bind fun _ => q) = q :=
+ PMF.ext fun x => by rw [bind_apply, ENNReal.tsum_mul_right, tsum_coe, one_mul]
+#align pmf.bind_const PMF.bind_const
-/
-#print Pmf.bind_bind /-
+#print PMF.bind_bind /-
@[simp]
theorem bind_bind : (p.bind f).bind g = p.bind fun a => (f a).bind g :=
- Pmf.ext fun b => by
+ PMF.ext fun b => by
simpa only [ennreal.coe_eq_coe.symm, bind_apply, ennreal.tsum_mul_left.symm,
ennreal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
-#align pmf.bind_bind Pmf.bind_bind
+#align pmf.bind_bind PMF.bind_bind
-/
-#print Pmf.bind_comm /-
-theorem bind_comm (p : Pmf α) (q : Pmf β) (f : α → β → Pmf γ) :
+#print PMF.bind_comm /-
+theorem bind_comm (p : PMF α) (q : PMF β) (f : α → β → PMF γ) :
(p.bind fun a => q.bind (f a)) = q.bind fun b => p.bind fun a => f a b :=
- Pmf.ext fun b => by
+ PMF.ext fun b => by
simpa only [ennreal.coe_eq_coe.symm, bind_apply, ennreal.tsum_mul_left.symm,
ennreal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
-#align pmf.bind_comm Pmf.bind_comm
+#align pmf.bind_comm PMF.bind_comm
-/
section Measure
@@ -213,7 +213,7 @@ variable (s : Set β)
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (a b) -/
-#print Pmf.toOuterMeasure_bind_apply /-
+#print PMF.toOuterMeasure_bind_apply /-
@[simp]
theorem toOuterMeasure_bind_apply :
(p.bind f).toOuterMeasure s = ∑' a, p a * (f a).toOuterMeasure s :=
@@ -228,10 +228,10 @@ theorem toOuterMeasure_bind_apply :
(tsum_congr fun a => (congr_arg fun x => p a * x) <| tsum_congr fun b => by split_ifs <;> rfl)
_ = ∑' a, p a * (f a).toOuterMeasure s :=
tsum_congr fun a => by simp only [to_outer_measure_apply, Set.indicator_apply]
-#align pmf.to_outer_measure_bind_apply Pmf.toOuterMeasure_bind_apply
+#align pmf.to_outer_measure_bind_apply PMF.toOuterMeasure_bind_apply
-/
-#print Pmf.toMeasure_bind_apply /-
+#print PMF.toMeasure_bind_apply /-
/-- The measure of a set under `p.bind f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a` -/
@[simp]
@@ -241,23 +241,23 @@ theorem toMeasure_bind_apply [MeasurableSpace β] (hs : MeasurableSet s) :
((toOuterMeasure_bind_apply p f s).trans
(tsum_congr fun a =>
congr_arg (fun x => p a * x) (toMeasure_apply_eq_toOuterMeasure_apply (f a) s hs).symm))
-#align pmf.to_measure_bind_apply Pmf.toMeasure_bind_apply
+#align pmf.to_measure_bind_apply PMF.toMeasure_bind_apply
-/
end Measure
end Bind
-instance : Monad Pmf where
+instance : Monad PMF where
pure A a := pure a
bind A B pa pb := pa.bind pb
section BindOnSupport
-#print Pmf.bindOnSupport /-
+#print PMF.bindOnSupport /-
/-- Generalized version of `bind` allowing `f` to only be defined on the support of `p`.
`p.bind f` is equivalent to `p.bind_on_support (λ a _, f a)`, see `bind_on_support_eq_bind` -/
-def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
+def bindOnSupport (p : PMF α) (f : ∀ a ∈ p.support, PMF β) : PMF β :=
⟨fun b => ∑' a, p a * if h : p a = 0 then 0 else f a h b,
ENNReal.summable.hasSum_iff.2
(by
@@ -266,20 +266,20 @@ def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
split_ifs with h
· simp only [h, MulZeroClass.zero_mul]
· rw [(f a h).tsum_coe, mul_one])⟩
-#align pmf.bind_on_support Pmf.bindOnSupport
+#align pmf.bind_on_support PMF.bindOnSupport
-/
-variable {p : Pmf α} (f : ∀ a ∈ p.support, Pmf β)
+variable {p : PMF α} (f : ∀ a ∈ p.support, PMF β)
-#print Pmf.bindOnSupport_apply /-
+#print PMF.bindOnSupport_apply /-
@[simp]
theorem bindOnSupport_apply (b : β) :
p.bindOnSupport f b = ∑' a, p a * if h : p a = 0 then 0 else f a h b :=
rfl
-#align pmf.bind_on_support_apply Pmf.bindOnSupport_apply
+#align pmf.bind_on_support_apply PMF.bindOnSupport_apply
-/
-#print Pmf.support_bindOnSupport /-
+#print PMF.support_bindOnSupport /-
@[simp]
theorem support_bindOnSupport :
(p.bindOnSupport f).support = ⋃ (a : α) (h : a ∈ p.support), (f a h).support :=
@@ -294,20 +294,20 @@ theorem support_bindOnSupport :
fun hb =>
let ⟨a, ha, ha'⟩ := hb
⟨a, ⟨ha, by simpa [(mem_support_iff _ a).1 ha] using ha'⟩⟩⟩
-#align pmf.support_bind_on_support Pmf.support_bindOnSupport
+#align pmf.support_bind_on_support PMF.support_bindOnSupport
-/
-#print Pmf.mem_support_bindOnSupport_iff /-
+#print PMF.mem_support_bindOnSupport_iff /-
theorem mem_support_bindOnSupport_iff (b : β) :
b ∈ (p.bindOnSupport f).support ↔ ∃ (a : α) (h : a ∈ p.support), b ∈ (f a h).support := by
simp only [support_bind_on_support, Set.mem_setOf_eq, Set.mem_iUnion]
-#align pmf.mem_support_bind_on_support_iff Pmf.mem_support_bindOnSupport_iff
+#align pmf.mem_support_bind_on_support_iff PMF.mem_support_bindOnSupport_iff
-/
-#print Pmf.bindOnSupport_eq_bind /-
+#print PMF.bindOnSupport_eq_bind /-
/-- `bind_on_support` reduces to `bind` if `f` doesn't depend on the additional hypothesis -/
@[simp]
-theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
+theorem bindOnSupport_eq_bind (p : PMF α) (f : α → PMF β) :
(p.bindOnSupport fun a _ => f a) = p.bind f :=
by
ext b x
@@ -315,46 +315,46 @@ theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
ite_eq_right_iff.2 fun h => h.symm ▸ symm (MulZeroClass.zero_mul <| f a b)
simp only [bind_on_support_apply fun a _ => f a, p.bind_apply f, dite_eq_ite, mul_ite,
MulZeroClass.mul_zero, this]
-#align pmf.bind_on_support_eq_bind Pmf.bindOnSupport_eq_bind
+#align pmf.bind_on_support_eq_bind PMF.bindOnSupport_eq_bind
-/
-#print Pmf.bindOnSupport_eq_zero_iff /-
+#print PMF.bindOnSupport_eq_zero_iff /-
theorem bindOnSupport_eq_zero_iff (b : β) :
p.bindOnSupport f b = 0 ↔ ∀ (a) (ha : p a ≠ 0), f a ha b = 0 :=
by
simp only [bind_on_support_apply, ENNReal.tsum_eq_zero, mul_eq_zero, or_iff_not_imp_left]
exact ⟨fun h a ha => trans (dif_neg ha).symm (h a ha), fun h a ha => trans (dif_neg ha) (h a ha)⟩
-#align pmf.bind_on_support_eq_zero_iff Pmf.bindOnSupport_eq_zero_iff
+#align pmf.bind_on_support_eq_zero_iff PMF.bindOnSupport_eq_zero_iff
-/
-#print Pmf.pure_bindOnSupport /-
+#print PMF.pure_bindOnSupport /-
@[simp]
-theorem pure_bindOnSupport (a : α) (f : ∀ (a' : α) (ha : a' ∈ (pure a).support), Pmf β) :
+theorem pure_bindOnSupport (a : α) (f : ∀ (a' : α) (ha : a' ∈ (pure a).support), PMF β) :
(pure a).bindOnSupport f = f a ((mem_support_pure_iff a a).mpr rfl) :=
by
- refine' Pmf.ext fun b => _
+ refine' PMF.ext fun b => _
simp only [bind_on_support_apply, pure_apply]
refine' trans (tsum_congr fun a' => _) (tsum_ite_eq a _)
by_cases h : a' = a <;> simp [h]
-#align pmf.pure_bind_on_support Pmf.pure_bindOnSupport
+#align pmf.pure_bind_on_support PMF.pure_bindOnSupport
-/
-#print Pmf.bindOnSupport_pure /-
-theorem bindOnSupport_pure (p : Pmf α) : (p.bindOnSupport fun a _ => pure a) = p := by
- simp only [Pmf.bind_pure, Pmf.bindOnSupport_eq_bind]
-#align pmf.bind_on_support_pure Pmf.bindOnSupport_pure
+#print PMF.bindOnSupport_pure /-
+theorem bindOnSupport_pure (p : PMF α) : (p.bindOnSupport fun a _ => pure a) = p := by
+ simp only [PMF.bind_pure, PMF.bindOnSupport_eq_bind]
+#align pmf.bind_on_support_pure PMF.bindOnSupport_pure
-/
-#print Pmf.bindOnSupport_bindOnSupport /-
+#print PMF.bindOnSupport_bindOnSupport /-
@[simp]
-theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β)
- (g : ∀ b ∈ (p.bindOnSupport f).support, Pmf γ) :
+theorem bindOnSupport_bindOnSupport (p : PMF α) (f : ∀ a ∈ p.support, PMF β)
+ (g : ∀ b ∈ (p.bindOnSupport f).support, PMF γ) :
(p.bindOnSupport f).bindOnSupport g =
p.bindOnSupport fun a ha =>
(f a ha).bindOnSupport fun b hb =>
g b ((mem_support_bindOnSupport_iff f b).mpr ⟨a, ha, hb⟩) :=
by
- refine' Pmf.ext fun a => _
+ refine' PMF.ext fun a => _
simp only [ennreal.coe_eq_coe.symm, bind_on_support_apply, ← tsum_dite_right,
ennreal.tsum_mul_left.symm, ennreal.tsum_mul_right.symm]
simp only [ENNReal.tsum_eq_zero, ENNReal.coe_eq_coe, ENNReal.coe_eq_zero, ENNReal.coe_zero,
@@ -364,20 +364,20 @@ theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf
any_goals ring1
· have := h_1 a'; simp [h] at this ; contradiction
· simp [h_2]
-#align pmf.bind_on_support_bind_on_support Pmf.bindOnSupport_bindOnSupport
+#align pmf.bind_on_support_bind_on_support PMF.bindOnSupport_bindOnSupport
-/
-#print Pmf.bindOnSupport_comm /-
-theorem bindOnSupport_comm (p : Pmf α) (q : Pmf β) (f : ∀ a ∈ p.support, ∀ b ∈ q.support, Pmf γ) :
+#print PMF.bindOnSupport_comm /-
+theorem bindOnSupport_comm (p : PMF α) (q : PMF β) (f : ∀ a ∈ p.support, ∀ b ∈ q.support, PMF γ) :
(p.bindOnSupport fun a ha => q.bindOnSupport (f a ha)) =
q.bindOnSupport fun b hb => p.bindOnSupport fun a ha => f a ha b hb :=
by
- apply Pmf.ext; rintro c
+ apply PMF.ext; rintro c
simp only [ennreal.coe_eq_coe.symm, bind_on_support_apply, ← tsum_dite_right,
ennreal.tsum_mul_left.symm, ennreal.tsum_mul_right.symm]
refine' trans ENNReal.tsum_comm (tsum_congr fun b => tsum_congr fun a => _)
split_ifs with h1 h2 h2 <;> ring
-#align pmf.bind_on_support_comm Pmf.bindOnSupport_comm
+#align pmf.bind_on_support_comm PMF.bindOnSupport_comm
-/
section Measure
@@ -386,7 +386,7 @@ variable (s : Set β)
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (a b) -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
-#print Pmf.toOuterMeasure_bindOnSupport_apply /-
+#print PMF.toOuterMeasure_bindOnSupport_apply /-
@[simp]
theorem toOuterMeasure_bindOnSupport_apply :
(p.bindOnSupport f).toOuterMeasure s =
@@ -403,10 +403,10 @@ theorem toOuterMeasure_bindOnSupport_apply :
(tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, MulZeroClass.mul_zero])
_ = ∑' a, p a * dite (p a = 0) (fun h => 0) fun h => ∑' b, ite (b ∈ s) (f a h b) 0 :=
tsum_congr fun a => by split_ifs with ha <;> simp only [if_t_t, tsum_zero, eq_self_iff_true]
-#align pmf.to_outer_measure_bind_on_support_apply Pmf.toOuterMeasure_bindOnSupport_apply
+#align pmf.to_outer_measure_bind_on_support_apply PMF.toOuterMeasure_bindOnSupport_apply
-/
-#print Pmf.toMeasure_bindOnSupport_apply /-
+#print PMF.toMeasure_bindOnSupport_apply /-
/-- The measure of a set under `p.bind_on_support f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a _`.
The additional if statement is needed since `f` is only a partial function -/
@@ -416,12 +416,12 @@ theorem toMeasure_bindOnSupport_apply [MeasurableSpace β] (hs : MeasurableSet s
by
simp only [to_measure_apply_eq_to_outer_measure_apply _ _ hs,
to_outer_measure_bind_on_support_apply]
-#align pmf.to_measure_bind_on_support_apply Pmf.toMeasure_bindOnSupport_apply
+#align pmf.to_measure_bind_on_support_apply PMF.toMeasure_bindOnSupport_apply
-/
end Measure
end BindOnSupport
-end Pmf
+end PMF
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,7 +3,7 @@ Copyright (c) 2020 Devon Tuma. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Devon Tuma
-/
-import Mathbin.Probability.ProbabilityMassFunction.Basic
+import Probability.ProbabilityMassFunction.Basic
#align_import probability.probability_mass_function.monad from "leanprover-community/mathlib"@"bd15ff41b70f5e2cc210f26f25a8d5c53b20d3de"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,14 +2,11 @@
Copyright (c) 2020 Devon Tuma. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Devon Tuma
-
-! This file was ported from Lean 3 source module probability.probability_mass_function.monad
-! leanprover-community/mathlib commit bd15ff41b70f5e2cc210f26f25a8d5c53b20d3de
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Probability.ProbabilityMassFunction.Basic
+#align_import probability.probability_mass_function.monad from "leanprover-community/mathlib"@"bd15ff41b70f5e2cc210f26f25a8d5c53b20d3de"
+
/-!
# Monad Operations for Probability Mass Functions
mathlib commit https://github.com/leanprover-community/mathlib/commit/2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
@@ -313,7 +313,7 @@ theorem mem_support_bindOnSupport_iff (b : β) :
theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
(p.bindOnSupport fun a _ => f a) = p.bind f :=
by
- ext (b x)
+ ext b x
have : ∀ a, ite (p a = 0) 0 (p a * f a b) = p a * f a b := fun a =>
ite_eq_right_iff.2 fun h => h.symm ▸ symm (MulZeroClass.zero_mul <| f a b)
simp only [bind_on_support_apply fun a _ => f a, p.bind_apply f, dite_eq_ite, mul_ite,
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -49,10 +49,12 @@ def pure (a : α) : Pmf α :=
variable (a a' : α)
+#print Pmf.pure_apply /-
@[simp]
theorem pure_apply : pure a a' = if a' = a then 1 else 0 :=
rfl
#align pmf.pure_apply Pmf.pure_apply
+-/
#print Pmf.support_pure /-
@[simp]
@@ -73,9 +75,11 @@ theorem pure_apply_self : pure a a = 1 :=
#align pmf.pure_apply_self Pmf.pure_apply_self
-/
+#print Pmf.pure_apply_of_ne /-
theorem pure_apply_of_ne (h : a' ≠ a) : pure a a' = 0 :=
if_neg h
#align pmf.pure_apply_of_ne Pmf.pure_apply_of_ne
+-/
instance [Inhabited α] : Inhabited (Pmf α) :=
⟨pure default⟩
@@ -84,6 +88,7 @@ section Measure
variable (s : Set α)
+#print Pmf.toOuterMeasure_pure_apply /-
@[simp]
theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then 1 else 0 :=
by
@@ -94,15 +99,18 @@ theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then
· refine' (tsum_congr fun b => _).trans tsum_zero
exact ite_eq_right_iff.2 fun hb => ite_eq_right_iff.2 fun h => (ha <| h ▸ hb).elim
#align pmf.to_outer_measure_pure_apply Pmf.toOuterMeasure_pure_apply
+-/
variable [MeasurableSpace α]
+#print Pmf.toMeasure_pure_apply /-
/-- The measure of a set under `pure a` is `1` for sets containing `a` and `0` otherwise -/
@[simp]
theorem toMeasure_pure_apply (hs : MeasurableSet s) :
(pure a).toMeasure s = if a ∈ s then 1 else 0 :=
(toMeasure_apply_eq_toOuterMeasure_apply (pure a) s hs).trans (toOuterMeasure_pure_apply a s)
#align pmf.to_measure_pure_apply Pmf.toMeasure_pure_apply
+-/
#print Pmf.toMeasure_pure /-
theorem toMeasure_pure : (pure a).toMeasure = Measure.dirac a :=
@@ -134,10 +142,12 @@ def bind (p : Pmf α) (f : α → Pmf β) : Pmf β :=
variable (p : Pmf α) (f : α → Pmf β) (g : β → Pmf γ)
+#print Pmf.bind_apply /-
@[simp]
theorem bind_apply (b : β) : p.bind f b = ∑' a, p a * f a b :=
rfl
#align pmf.bind_apply Pmf.bind_apply
+-/
#print Pmf.support_bind /-
@[simp]
@@ -146,10 +156,12 @@ theorem support_bind : (p.bind f).support = ⋃ a ∈ p.support, (f a).support :
#align pmf.support_bind Pmf.support_bind
-/
+#print Pmf.mem_support_bind_iff /-
theorem mem_support_bind_iff (b : β) :
b ∈ (p.bind f).support ↔ ∃ a ∈ p.support, b ∈ (f a).support := by
simp only [support_bind, Set.mem_iUnion, Set.mem_setOf_eq]
#align pmf.mem_support_bind_iff Pmf.mem_support_bind_iff
+-/
#print Pmf.pure_bind /-
@[simp]
@@ -173,10 +185,12 @@ theorem bind_pure : p.bind pure = p :=
#align pmf.bind_pure Pmf.bind_pure
-/
+#print Pmf.bind_const /-
@[simp]
theorem bind_const (p : Pmf α) (q : Pmf β) : (p.bind fun _ => q) = q :=
Pmf.ext fun x => by rw [bind_apply, ENNReal.tsum_mul_right, tsum_coe, one_mul]
#align pmf.bind_const Pmf.bind_const
+-/
#print Pmf.bind_bind /-
@[simp]
@@ -187,12 +201,14 @@ theorem bind_bind : (p.bind f).bind g = p.bind fun a => (f a).bind g :=
#align pmf.bind_bind Pmf.bind_bind
-/
+#print Pmf.bind_comm /-
theorem bind_comm (p : Pmf α) (q : Pmf β) (f : α → β → Pmf γ) :
(p.bind fun a => q.bind (f a)) = q.bind fun b => p.bind fun a => f a b :=
Pmf.ext fun b => by
simpa only [ennreal.coe_eq_coe.symm, bind_apply, ennreal.tsum_mul_left.symm,
ennreal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
#align pmf.bind_comm Pmf.bind_comm
+-/
section Measure
@@ -200,6 +216,7 @@ variable (s : Set β)
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (a b) -/
+#print Pmf.toOuterMeasure_bind_apply /-
@[simp]
theorem toOuterMeasure_bind_apply :
(p.bind f).toOuterMeasure s = ∑' a, p a * (f a).toOuterMeasure s :=
@@ -215,7 +232,9 @@ theorem toOuterMeasure_bind_apply :
_ = ∑' a, p a * (f a).toOuterMeasure s :=
tsum_congr fun a => by simp only [to_outer_measure_apply, Set.indicator_apply]
#align pmf.to_outer_measure_bind_apply Pmf.toOuterMeasure_bind_apply
+-/
+#print Pmf.toMeasure_bind_apply /-
/-- The measure of a set under `p.bind f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a` -/
@[simp]
@@ -226,6 +245,7 @@ theorem toMeasure_bind_apply [MeasurableSpace β] (hs : MeasurableSet s) :
(tsum_congr fun a =>
congr_arg (fun x => p a * x) (toMeasure_apply_eq_toOuterMeasure_apply (f a) s hs).symm))
#align pmf.to_measure_bind_apply Pmf.toMeasure_bind_apply
+-/
end Measure
@@ -254,11 +274,13 @@ def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
variable {p : Pmf α} (f : ∀ a ∈ p.support, Pmf β)
+#print Pmf.bindOnSupport_apply /-
@[simp]
theorem bindOnSupport_apply (b : β) :
p.bindOnSupport f b = ∑' a, p a * if h : p a = 0 then 0 else f a h b :=
rfl
#align pmf.bind_on_support_apply Pmf.bindOnSupport_apply
+-/
#print Pmf.support_bindOnSupport /-
@[simp]
@@ -285,6 +307,7 @@ theorem mem_support_bindOnSupport_iff (b : β) :
#align pmf.mem_support_bind_on_support_iff Pmf.mem_support_bindOnSupport_iff
-/
+#print Pmf.bindOnSupport_eq_bind /-
/-- `bind_on_support` reduces to `bind` if `f` doesn't depend on the additional hypothesis -/
@[simp]
theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
@@ -296,14 +319,18 @@ theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
simp only [bind_on_support_apply fun a _ => f a, p.bind_apply f, dite_eq_ite, mul_ite,
MulZeroClass.mul_zero, this]
#align pmf.bind_on_support_eq_bind Pmf.bindOnSupport_eq_bind
+-/
+#print Pmf.bindOnSupport_eq_zero_iff /-
theorem bindOnSupport_eq_zero_iff (b : β) :
p.bindOnSupport f b = 0 ↔ ∀ (a) (ha : p a ≠ 0), f a ha b = 0 :=
by
simp only [bind_on_support_apply, ENNReal.tsum_eq_zero, mul_eq_zero, or_iff_not_imp_left]
exact ⟨fun h a ha => trans (dif_neg ha).symm (h a ha), fun h a ha => trans (dif_neg ha) (h a ha)⟩
#align pmf.bind_on_support_eq_zero_iff Pmf.bindOnSupport_eq_zero_iff
+-/
+#print Pmf.pure_bindOnSupport /-
@[simp]
theorem pure_bindOnSupport (a : α) (f : ∀ (a' : α) (ha : a' ∈ (pure a).support), Pmf β) :
(pure a).bindOnSupport f = f a ((mem_support_pure_iff a a).mpr rfl) :=
@@ -313,6 +340,7 @@ theorem pure_bindOnSupport (a : α) (f : ∀ (a' : α) (ha : a' ∈ (pure a).sup
refine' trans (tsum_congr fun a' => _) (tsum_ite_eq a _)
by_cases h : a' = a <;> simp [h]
#align pmf.pure_bind_on_support Pmf.pure_bindOnSupport
+-/
#print Pmf.bindOnSupport_pure /-
theorem bindOnSupport_pure (p : Pmf α) : (p.bindOnSupport fun a _ => pure a) = p := by
@@ -320,6 +348,7 @@ theorem bindOnSupport_pure (p : Pmf α) : (p.bindOnSupport fun a _ => pure a) =
#align pmf.bind_on_support_pure Pmf.bindOnSupport_pure
-/
+#print Pmf.bindOnSupport_bindOnSupport /-
@[simp]
theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β)
(g : ∀ b ∈ (p.bindOnSupport f).support, Pmf γ) :
@@ -339,7 +368,9 @@ theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf
· have := h_1 a'; simp [h] at this ; contradiction
· simp [h_2]
#align pmf.bind_on_support_bind_on_support Pmf.bindOnSupport_bindOnSupport
+-/
+#print Pmf.bindOnSupport_comm /-
theorem bindOnSupport_comm (p : Pmf α) (q : Pmf β) (f : ∀ a ∈ p.support, ∀ b ∈ q.support, Pmf γ) :
(p.bindOnSupport fun a ha => q.bindOnSupport (f a ha)) =
q.bindOnSupport fun b hb => p.bindOnSupport fun a ha => f a ha b hb :=
@@ -350,6 +381,7 @@ theorem bindOnSupport_comm (p : Pmf α) (q : Pmf β) (f : ∀ a ∈ p.support,
refine' trans ENNReal.tsum_comm (tsum_congr fun b => tsum_congr fun a => _)
split_ifs with h1 h2 h2 <;> ring
#align pmf.bind_on_support_comm Pmf.bindOnSupport_comm
+-/
section Measure
@@ -357,6 +389,7 @@ variable (s : Set β)
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (a b) -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
+#print Pmf.toOuterMeasure_bindOnSupport_apply /-
@[simp]
theorem toOuterMeasure_bindOnSupport_apply :
(p.bindOnSupport f).toOuterMeasure s =
@@ -374,7 +407,9 @@ theorem toOuterMeasure_bindOnSupport_apply :
_ = ∑' a, p a * dite (p a = 0) (fun h => 0) fun h => ∑' b, ite (b ∈ s) (f a h b) 0 :=
tsum_congr fun a => by split_ifs with ha <;> simp only [if_t_t, tsum_zero, eq_self_iff_true]
#align pmf.to_outer_measure_bind_on_support_apply Pmf.toOuterMeasure_bindOnSupport_apply
+-/
+#print Pmf.toMeasure_bindOnSupport_apply /-
/-- The measure of a set under `p.bind_on_support f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a _`.
The additional if statement is needed since `f` is only a partial function -/
@@ -385,6 +420,7 @@ theorem toMeasure_bindOnSupport_apply [MeasurableSpace β] (hs : MeasurableSet s
simp only [to_measure_apply_eq_to_outer_measure_apply _ _ hs,
to_outer_measure_bind_on_support_apply]
#align pmf.to_measure_bind_on_support_apply Pmf.toMeasure_bindOnSupport_apply
+-/
end Measure
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -364,7 +364,7 @@ theorem toOuterMeasure_bindOnSupport_apply :
by
simp only [to_outer_measure_apply, Set.indicator_apply, bind_on_support_apply]
calc
- (∑' b, ite (b ∈ s) (∑' a, p a * dite (p a = 0) (fun h => 0) fun h => f a h b) 0) =
+ ∑' b, ite (b ∈ s) (∑' a, p a * dite (p a = 0) (fun h => 0) fun h => f a h b) 0 =
∑' (b) (a), ite (b ∈ s) (p a * dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
tsum_congr fun b => by split_ifs with hbs <;> simp only [eq_self_iff_true, tsum_zero]
_ = ∑' (a) (b), ite (b ∈ s) (p a * dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -214,7 +214,6 @@ theorem toOuterMeasure_bind_apply :
(tsum_congr fun a => (congr_arg fun x => p a * x) <| tsum_congr fun b => by split_ifs <;> rfl)
_ = ∑' a, p a * (f a).toOuterMeasure s :=
tsum_congr fun a => by simp only [to_outer_measure_apply, Set.indicator_apply]
-
#align pmf.to_outer_measure_bind_apply Pmf.toOuterMeasure_bind_apply
/-- The measure of a set under `p.bind f` is the sum over `a : α`
@@ -374,7 +373,6 @@ theorem toOuterMeasure_bindOnSupport_apply :
(tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, MulZeroClass.mul_zero])
_ = ∑' a, p a * dite (p a = 0) (fun h => 0) fun h => ∑' b, ite (b ∈ s) (f a h b) 0 :=
tsum_congr fun a => by split_ifs with ha <;> simp only [if_t_t, tsum_zero, eq_self_iff_true]
-
#align pmf.to_outer_measure_bind_on_support_apply Pmf.toOuterMeasure_bindOnSupport_apply
/-- The measure of a set under `p.bind_on_support f` is the sum over `a : α`
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -281,7 +281,7 @@ theorem support_bindOnSupport :
#print Pmf.mem_support_bindOnSupport_iff /-
theorem mem_support_bindOnSupport_iff (b : β) :
- b ∈ (p.bindOnSupport f).support ↔ ∃ (a : α)(h : a ∈ p.support), b ∈ (f a h).support := by
+ b ∈ (p.bindOnSupport f).support ↔ ∃ (a : α) (h : a ∈ p.support), b ∈ (f a h).support := by
simp only [support_bind_on_support, Set.mem_setOf_eq, Set.mem_iUnion]
#align pmf.mem_support_bind_on_support_iff Pmf.mem_support_bindOnSupport_iff
-/
@@ -337,7 +337,7 @@ theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf
refine' ennreal.tsum_comm.trans (tsum_congr fun a' => tsum_congr fun b => _)
split_ifs
any_goals ring1
- · have := h_1 a'; simp [h] at this; contradiction
+ · have := h_1 a'; simp [h] at this ; contradiction
· simp [h_2]
#align pmf.bind_on_support_bind_on_support Pmf.bindOnSupport_bindOnSupport
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -31,7 +31,7 @@ noncomputable section
variable {α β γ : Type _}
-open Classical BigOperators NNReal ENNReal
+open scoped Classical BigOperators NNReal ENNReal
open MeasureTheory
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -49,12 +49,6 @@ def pure (a : α) : Pmf α :=
variable (a a' : α)
-/- warning: pmf.pure_apply -> Pmf.pure_apply is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (a : α) (a' : α), Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) (Pmf.pure.{u1} α a) a') (ite.{1} ENNReal (Eq.{succ u1} α a' a) (Classical.propDecidable (Eq.{succ u1} α a' a)) (OfNat.ofNat.{0} ENNReal 1 (OfNat.mk.{0} ENNReal 1 (One.one.{0} ENNReal (AddMonoidWithOne.toOne.{0} ENNReal (AddCommMonoidWithOne.toAddMonoidWithOne.{0} ENNReal ENNReal.addCommMonoidWithOne))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))
-but is expected to have type
- forall {α : Type.{u1}} (a : α) (a' : α), Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) (Pmf.pure.{u1} α a) a') (ite.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') (Eq.{succ u1} α a' a) (Classical.propDecidable (Eq.{succ u1} α a' a)) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') 1 (One.toOfNat1.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') (CanonicallyOrderedCommSemiring.toOne.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') ENNReal.instCanonicallyOrderedCommSemiringENNReal))) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') instENNRealZero)))
-Case conversion may be inaccurate. Consider using '#align pmf.pure_apply Pmf.pure_applyₓ'. -/
@[simp]
theorem pure_apply : pure a a' = if a' = a then 1 else 0 :=
rfl
@@ -79,12 +73,6 @@ theorem pure_apply_self : pure a a = 1 :=
#align pmf.pure_apply_self Pmf.pure_apply_self
-/
-/- warning: pmf.pure_apply_of_ne -> Pmf.pure_apply_of_ne is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (a : α) (a' : α), (Ne.{succ u1} α a' a) -> (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) (Pmf.pure.{u1} α a) a') (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))
-but is expected to have type
- forall {α : Type.{u1}} (a : α) (a' : α), (Ne.{succ u1} α a' a) -> (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) (Pmf.pure.{u1} α a) a') (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') instENNRealZero)))
-Case conversion may be inaccurate. Consider using '#align pmf.pure_apply_of_ne Pmf.pure_apply_of_neₓ'. -/
theorem pure_apply_of_ne (h : a' ≠ a) : pure a a' = 0 :=
if_neg h
#align pmf.pure_apply_of_ne Pmf.pure_apply_of_ne
@@ -96,12 +84,6 @@ section Measure
variable (s : Set α)
-/- warning: pmf.to_outer_measure_pure_apply -> Pmf.toOuterMeasure_pure_apply is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (a : α) (s : Set.{u1} α), Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (MeasureTheory.OuterMeasure.{u1} α) (fun (_x : MeasureTheory.OuterMeasure.{u1} α) => (Set.{u1} α) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u1} α) (Pmf.toOuterMeasure.{u1} α (Pmf.pure.{u1} α a)) s) (ite.{1} ENNReal (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a s) (Classical.propDecidable (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a s)) (OfNat.ofNat.{0} ENNReal 1 (OfNat.mk.{0} ENNReal 1 (One.one.{0} ENNReal (AddMonoidWithOne.toOne.{0} ENNReal (AddCommMonoidWithOne.toAddMonoidWithOne.{0} ENNReal ENNReal.addCommMonoidWithOne))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))
-but is expected to have type
- forall {α : Type.{u1}} (a : α) (s : Set.{u1} α), Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u1} α (Pmf.toOuterMeasure.{u1} α (Pmf.pure.{u1} α a)) s) (ite.{1} ENNReal (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a s) (Classical.propDecidable (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a s)) (OfNat.ofNat.{0} ENNReal 1 (One.toOfNat1.{0} ENNReal (CanonicallyOrderedCommSemiring.toOne.{0} ENNReal ENNReal.instCanonicallyOrderedCommSemiringENNReal))) (OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero)))
-Case conversion may be inaccurate. Consider using '#align pmf.to_outer_measure_pure_apply Pmf.toOuterMeasure_pure_applyₓ'. -/
@[simp]
theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then 1 else 0 :=
by
@@ -115,12 +97,6 @@ theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then
variable [MeasurableSpace α]
-/- warning: pmf.to_measure_pure_apply -> Pmf.toMeasure_pure_apply is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (a : α) (s : Set.{u1} α) [_inst_1 : MeasurableSpace.{u1} α], (MeasurableSet.{u1} α _inst_1 s) -> (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (MeasureTheory.Measure.{u1} α _inst_1) (fun (_x : MeasureTheory.Measure.{u1} α _inst_1) => (Set.{u1} α) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u1} α _inst_1) (Pmf.toMeasure.{u1} α _inst_1 (Pmf.pure.{u1} α a)) s) (ite.{1} ENNReal (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a s) (Classical.propDecidable (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a s)) (OfNat.ofNat.{0} ENNReal 1 (OfNat.mk.{0} ENNReal 1 (One.one.{0} ENNReal (AddMonoidWithOne.toOne.{0} ENNReal (AddCommMonoidWithOne.toAddMonoidWithOne.{0} ENNReal ENNReal.addCommMonoidWithOne))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))))
-but is expected to have type
- forall {α : Type.{u1}} (a : α) (s : Set.{u1} α) [_inst_1 : MeasurableSpace.{u1} α], (MeasurableSet.{u1} α _inst_1 s) -> (Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u1} α (MeasureTheory.Measure.toOuterMeasure.{u1} α _inst_1 (Pmf.toMeasure.{u1} α _inst_1 (Pmf.pure.{u1} α a))) s) (ite.{1} ENNReal (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a s) (Classical.propDecidable (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a s)) (OfNat.ofNat.{0} ENNReal 1 (One.toOfNat1.{0} ENNReal (CanonicallyOrderedCommSemiring.toOne.{0} ENNReal ENNReal.instCanonicallyOrderedCommSemiringENNReal))) (OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero))))
-Case conversion may be inaccurate. Consider using '#align pmf.to_measure_pure_apply Pmf.toMeasure_pure_applyₓ'. -/
/-- The measure of a set under `pure a` is `1` for sets containing `a` and `0` otherwise -/
@[simp]
theorem toMeasure_pure_apply (hs : MeasurableSet s) :
@@ -158,12 +134,6 @@ def bind (p : Pmf α) (f : α → Pmf β) : Pmf β :=
variable (p : Pmf α) (f : α → Pmf β) (g : β → Pmf γ)
-/- warning: pmf.bind_apply -> Pmf.bind_apply is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (b : β), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (Pmf.bind.{u1, u2} α β p f) b) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (f a) b)))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (b : β), Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (Pmf.bind.{u1, u2} α β p f) b) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (f a) b)))
-Case conversion may be inaccurate. Consider using '#align pmf.bind_apply Pmf.bind_applyₓ'. -/
@[simp]
theorem bind_apply (b : β) : p.bind f b = ∑' a, p a * f a b :=
rfl
@@ -176,12 +146,6 @@ theorem support_bind : (p.bind f).support = ⋃ a ∈ p.support, (f a).support :
#align pmf.support_bind Pmf.support_bind
-/
-/- warning: pmf.mem_support_bind_iff -> Pmf.mem_support_bind_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (b : β), Iff (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (Pmf.bind.{u1, u2} α β p f))) (Exists.{succ u1} α (fun (a : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) (fun (H : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a)))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (b : β), Iff (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (Pmf.bind.{u1, u2} α β p f))) (Exists.{succ u1} α (fun (a : α) => And (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a)))))
-Case conversion may be inaccurate. Consider using '#align pmf.mem_support_bind_iff Pmf.mem_support_bind_iffₓ'. -/
theorem mem_support_bind_iff (b : β) :
b ∈ (p.bind f).support ↔ ∃ a ∈ p.support, b ∈ (f a).support := by
simp only [support_bind, Set.mem_iUnion, Set.mem_setOf_eq]
@@ -209,12 +173,6 @@ theorem bind_pure : p.bind pure = p :=
#align pmf.bind_pure Pmf.bind_pure
-/
-/- warning: pmf.bind_const -> Pmf.bind_const is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (q : Pmf.{u2} β), Eq.{succ u2} (Pmf.{u2} β) (Pmf.bind.{u1, u2} α β p (fun (_x : α) => q)) q
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (p : Pmf.{u2} α) (q : Pmf.{u1} β), Eq.{succ u1} (Pmf.{u1} β) (Pmf.bind.{u2, u1} α β p (fun (_x : α) => q)) q
-Case conversion may be inaccurate. Consider using '#align pmf.bind_const Pmf.bind_constₓ'. -/
@[simp]
theorem bind_const (p : Pmf α) (q : Pmf β) : (p.bind fun _ => q) = q :=
Pmf.ext fun x => by rw [bind_apply, ENNReal.tsum_mul_right, tsum_coe, one_mul]
@@ -229,12 +187,6 @@ theorem bind_bind : (p.bind f).bind g = p.bind fun a => (f a).bind g :=
#align pmf.bind_bind Pmf.bind_bind
-/
-/- warning: pmf.bind_comm -> Pmf.bind_comm is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (p : Pmf.{u1} α) (q : Pmf.{u2} β) (f : α -> β -> (Pmf.{u3} γ)), Eq.{succ u3} (Pmf.{u3} γ) (Pmf.bind.{u1, u3} α γ p (fun (a : α) => Pmf.bind.{u2, u3} β γ q (f a))) (Pmf.bind.{u2, u3} β γ q (fun (b : β) => Pmf.bind.{u1, u3} α γ p (fun (a : α) => f a b)))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (p : Pmf.{u3} α) (q : Pmf.{u2} β) (f : α -> β -> (Pmf.{u1} γ)), Eq.{succ u1} (Pmf.{u1} γ) (Pmf.bind.{u3, u1} α γ p (fun (a : α) => Pmf.bind.{u2, u1} β γ q (f a))) (Pmf.bind.{u2, u1} β γ q (fun (b : β) => Pmf.bind.{u3, u1} α γ p (fun (a : α) => f a b)))
-Case conversion may be inaccurate. Consider using '#align pmf.bind_comm Pmf.bind_commₓ'. -/
theorem bind_comm (p : Pmf α) (q : Pmf β) (f : α → β → Pmf γ) :
(p.bind fun a => q.bind (f a)) = q.bind fun b => p.bind fun a => f a b :=
Pmf.ext fun b => by
@@ -246,12 +198,6 @@ section Measure
variable (s : Set β)
-/- warning: pmf.to_outer_measure_bind_apply -> Pmf.toOuterMeasure_bind_apply is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (s : Set.{u2} β), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (MeasureTheory.OuterMeasure.{u2} β) (fun (_x : MeasureTheory.OuterMeasure.{u2} β) => (Set.{u2} β) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u2} β) (Pmf.toOuterMeasure.{u2} β (Pmf.bind.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (coeFn.{succ u2, succ u2} (MeasureTheory.OuterMeasure.{u2} β) (fun (_x : MeasureTheory.OuterMeasure.{u2} β) => (Set.{u2} β) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u2} β) (Pmf.toOuterMeasure.{u2} β (f a)) s)))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (s : Set.{u2} β), Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u2} β (Pmf.toOuterMeasure.{u2} β (Pmf.bind.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (MeasureTheory.OuterMeasure.measureOf.{u2} β (Pmf.toOuterMeasure.{u2} β (f a)) s)))
-Case conversion may be inaccurate. Consider using '#align pmf.to_outer_measure_bind_apply Pmf.toOuterMeasure_bind_applyₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (a b) -/
@[simp]
@@ -271,12 +217,6 @@ theorem toOuterMeasure_bind_apply :
#align pmf.to_outer_measure_bind_apply Pmf.toOuterMeasure_bind_apply
-/- warning: pmf.to_measure_bind_apply -> Pmf.toMeasure_bind_apply is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (s : Set.{u2} β) [_inst_1 : MeasurableSpace.{u2} β], (MeasurableSet.{u2} β _inst_1 s) -> (Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (MeasureTheory.Measure.{u2} β _inst_1) (fun (_x : MeasureTheory.Measure.{u2} β _inst_1) => (Set.{u2} β) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u2} β _inst_1) (Pmf.toMeasure.{u2} β _inst_1 (Pmf.bind.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (coeFn.{succ u2, succ u2} (MeasureTheory.Measure.{u2} β _inst_1) (fun (_x : MeasureTheory.Measure.{u2} β _inst_1) => (Set.{u2} β) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u2} β _inst_1) (Pmf.toMeasure.{u2} β _inst_1 (f a)) s))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (s : Set.{u2} β) [_inst_1 : MeasurableSpace.{u2} β], (MeasurableSet.{u2} β _inst_1 s) -> (Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u2} β (MeasureTheory.Measure.toOuterMeasure.{u2} β _inst_1 (Pmf.toMeasure.{u2} β _inst_1 (Pmf.bind.{u1, u2} α β p f))) s) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (MeasureTheory.OuterMeasure.measureOf.{u2} β (MeasureTheory.Measure.toOuterMeasure.{u2} β _inst_1 (Pmf.toMeasure.{u2} β _inst_1 (f a))) s))))
-Case conversion may be inaccurate. Consider using '#align pmf.to_measure_bind_apply Pmf.toMeasure_bind_applyₓ'. -/
/-- The measure of a set under `p.bind f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a` -/
@[simp]
@@ -315,12 +255,6 @@ def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
variable {p : Pmf α} (f : ∀ a ∈ p.support, Pmf β)
-/- warning: pmf.bind_on_support_apply -> Pmf.bindOnSupport_apply is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (b : β), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (Pmf.bindOnSupport.{u1, u2} α β p f) b) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (dite.{1} ENNReal (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (Option.decidableEq.{0} NNReal (fun (a : NNReal) (b : NNReal) => Subtype.decidableEq.{0} Real (fun (x : Real) => LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) x) (fun (a : Real) (b : Real) => Real.decidableEq a b) a b) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (fun (h : Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) => OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) (fun (h : Not (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))) => coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (f a h) b))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (b : β), Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (Pmf.bindOnSupport.{u1, u2} α β p f) b) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (dite.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (instDecidableEq.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCompleteLinearOrderENNReal))) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (fun (h : Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) => OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) instENNRealZero)) (fun (h : Not (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero)))) => FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (f a h) b))))
-Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_apply Pmf.bindOnSupport_applyₓ'. -/
@[simp]
theorem bindOnSupport_apply (b : β) :
p.bindOnSupport f b = ∑' a, p a * if h : p a = 0 then 0 else f a h b :=
@@ -352,12 +286,6 @@ theorem mem_support_bindOnSupport_iff (b : β) :
#align pmf.mem_support_bind_on_support_iff Pmf.mem_support_bindOnSupport_iff
-/
-/- warning: pmf.bind_on_support_eq_bind -> Pmf.bindOnSupport_eq_bind is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)), Eq.{succ u2} (Pmf.{u2} β) (Pmf.bindOnSupport.{u1, u2} α β p (fun (a : α) (_x : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => f a)) (Pmf.bind.{u1, u2} α β p f)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (p : Pmf.{u2} α) (f : α -> (Pmf.{u1} β)), Eq.{succ u1} (Pmf.{u1} β) (Pmf.bindOnSupport.{u2, u1} α β p (fun (a : α) (_x : Membership.mem.{u2, u2} α (Set.{u2} α) (Set.instMembershipSet.{u2} α) a (Pmf.support.{u2} α p)) => f a)) (Pmf.bind.{u2, u1} α β p f)
-Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_eq_bind Pmf.bindOnSupport_eq_bindₓ'. -/
/-- `bind_on_support` reduces to `bind` if `f` doesn't depend on the additional hypothesis -/
@[simp]
theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
@@ -370,12 +298,6 @@ theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
MulZeroClass.mul_zero, this]
#align pmf.bind_on_support_eq_bind Pmf.bindOnSupport_eq_bind
-/- warning: pmf.bind_on_support_eq_zero_iff -> Pmf.bindOnSupport_eq_zero_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (b : β), Iff (Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (Pmf.bindOnSupport.{u1, u2} α β p f) b) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (forall (a : α) (ha : Ne.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (f a ha) b) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (b : β), Iff (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (Pmf.bindOnSupport.{u1, u2} α β p f) b) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) instENNRealZero))) (forall (a : α) (ha : Ne.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))), Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (f a ha) b) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) instENNRealZero)))
-Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_eq_zero_iff Pmf.bindOnSupport_eq_zero_iffₓ'. -/
theorem bindOnSupport_eq_zero_iff (b : β) :
p.bindOnSupport f b = 0 ↔ ∀ (a) (ha : p a ≠ 0), f a ha b = 0 :=
by
@@ -383,12 +305,6 @@ theorem bindOnSupport_eq_zero_iff (b : β) :
exact ⟨fun h a ha => trans (dif_neg ha).symm (h a ha), fun h a ha => trans (dif_neg ha) (h a ha)⟩
#align pmf.bind_on_support_eq_zero_iff Pmf.bindOnSupport_eq_zero_iff
-/- warning: pmf.pure_bind_on_support -> Pmf.pure_bindOnSupport is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (a : α) (f : forall (a' : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a' (Pmf.support.{u1} α (Pmf.pure.{u1} α a))) -> (Pmf.{u2} β)), Eq.{succ u2} (Pmf.{u2} β) (Pmf.bindOnSupport.{u1, u2} α β (Pmf.pure.{u1} α a) f) (f a (Iff.mpr (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α (Pmf.pure.{u1} α a))) (Eq.{succ u1} α a a) (Pmf.mem_support_pure_iff.{u1} α a a) (rfl.{succ u1} α a)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (a : α) (f : forall (a' : α), (Membership.mem.{u2, u2} α (Set.{u2} α) (Set.instMembershipSet.{u2} α) a' (Pmf.support.{u2} α (Pmf.pure.{u2} α a))) -> (Pmf.{u1} β)), Eq.{succ u1} (Pmf.{u1} β) (Pmf.bindOnSupport.{u2, u1} α β (Pmf.pure.{u2} α a) f) (f a (Iff.mpr (Membership.mem.{u2, u2} α (Set.{u2} α) (Set.instMembershipSet.{u2} α) a (Pmf.support.{u2} α (Pmf.pure.{u2} α a))) (Eq.{succ u2} α a a) (Pmf.mem_support_pure_iff.{u2} α a a) (rfl.{succ u2} α a)))
-Case conversion may be inaccurate. Consider using '#align pmf.pure_bind_on_support Pmf.pure_bindOnSupportₓ'. -/
@[simp]
theorem pure_bindOnSupport (a : α) (f : ∀ (a' : α) (ha : a' ∈ (pure a).support), Pmf β) :
(pure a).bindOnSupport f = f a ((mem_support_pure_iff a a).mpr rfl) :=
@@ -405,12 +321,6 @@ theorem bindOnSupport_pure (p : Pmf α) : (p.bindOnSupport fun a _ => pure a) =
#align pmf.bind_on_support_pure Pmf.bindOnSupport_pure
-/
-/- warning: pmf.bind_on_support_bind_on_support -> Pmf.bindOnSupport_bindOnSupport is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (p : Pmf.{u1} α) (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (g : forall (b : β), (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (Pmf.bindOnSupport.{u1, u2} α β p f))) -> (Pmf.{u3} γ)), Eq.{succ u3} (Pmf.{u3} γ) (Pmf.bindOnSupport.{u2, u3} β γ (Pmf.bindOnSupport.{u1, u2} α β p f) g) (Pmf.bindOnSupport.{u1, u3} α γ p (fun (a : α) (ha : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Pmf.bindOnSupport.{u2, u3} β γ (f a ha) (fun (b : β) (hb : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a ha))) => g b (Iff.mpr (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (Pmf.bindOnSupport.{u1, u2} α β p f))) (Exists.{succ u1} α (fun (a : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) (fun (h : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a h))))) (Pmf.mem_support_bindOnSupport_iff.{u1, u2} α β p f b) (Exists.intro.{succ u1} α (fun (a : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) (fun (h : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a h)))) a (Exists.intro.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) (fun (h : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a h))) ha hb))))))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (p : Pmf.{u3} α) (f : forall (a : α), (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) -> (Pmf.{u2} β)) (g : forall (b : β), (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (Pmf.bindOnSupport.{u3, u2} α β p f))) -> (Pmf.{u1} γ)), Eq.{succ u1} (Pmf.{u1} γ) (Pmf.bindOnSupport.{u2, u1} β γ (Pmf.bindOnSupport.{u3, u2} α β p f) g) (Pmf.bindOnSupport.{u3, u1} α γ p (fun (a : α) (ha : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Pmf.bindOnSupport.{u2, u1} β γ (f a ha) (fun (b : β) (hb : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a ha))) => g b (Iff.mpr (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (Pmf.bindOnSupport.{u3, u2} α β p f))) (Exists.{succ u3} α (fun (a : α) => Exists.{0} (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) (fun (h : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a h))))) (Pmf.mem_support_bindOnSupport_iff.{u3, u2} α β p f b) (Exists.intro.{succ u3} α (fun (a : α) => Exists.{0} (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) (fun (h : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a h)))) a (Exists.intro.{0} (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) (fun (h : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a h))) ha hb))))))
-Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_bind_on_support Pmf.bindOnSupport_bindOnSupportₓ'. -/
@[simp]
theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β)
(g : ∀ b ∈ (p.bindOnSupport f).support, Pmf γ) :
@@ -431,12 +341,6 @@ theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf
· simp [h_2]
#align pmf.bind_on_support_bind_on_support Pmf.bindOnSupport_bindOnSupport
-/- warning: pmf.bind_on_support_comm -> Pmf.bindOnSupport_comm is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (p : Pmf.{u1} α) (q : Pmf.{u2} β) (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (forall (b : β), (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β q)) -> (Pmf.{u3} γ))), Eq.{succ u3} (Pmf.{u3} γ) (Pmf.bindOnSupport.{u1, u3} α γ p (fun (a : α) (ha : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Pmf.bindOnSupport.{u2, u3} β γ q (f a ha))) (Pmf.bindOnSupport.{u2, u3} β γ q (fun (b : β) (hb : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β q)) => Pmf.bindOnSupport.{u1, u3} α γ p (fun (a : α) (ha : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => f a ha b hb)))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (p : Pmf.{u3} α) (q : Pmf.{u2} β) (f : forall (a : α), (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) -> (forall (b : β), (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β q)) -> (Pmf.{u1} γ))), Eq.{succ u1} (Pmf.{u1} γ) (Pmf.bindOnSupport.{u3, u1} α γ p (fun (a : α) (ha : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Pmf.bindOnSupport.{u2, u1} β γ q (f a ha))) (Pmf.bindOnSupport.{u2, u1} β γ q (fun (b : β) (hb : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β q)) => Pmf.bindOnSupport.{u3, u1} α γ p (fun (a : α) (ha : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => f a ha b hb)))
-Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_comm Pmf.bindOnSupport_commₓ'. -/
theorem bindOnSupport_comm (p : Pmf α) (q : Pmf β) (f : ∀ a ∈ p.support, ∀ b ∈ q.support, Pmf γ) :
(p.bindOnSupport fun a ha => q.bindOnSupport (f a ha)) =
q.bindOnSupport fun b hb => p.bindOnSupport fun a ha => f a ha b hb :=
@@ -452,12 +356,6 @@ section Measure
variable (s : Set β)
-/- warning: pmf.to_outer_measure_bind_on_support_apply -> Pmf.toOuterMeasure_bindOnSupport_apply is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (s : Set.{u2} β), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (MeasureTheory.OuterMeasure.{u2} β) (fun (_x : MeasureTheory.OuterMeasure.{u2} β) => (Set.{u2} β) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u2} β) (Pmf.toOuterMeasure.{u2} β (Pmf.bindOnSupport.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (dite.{1} ENNReal (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (Option.decidableEq.{0} NNReal (fun (a : NNReal) (b : NNReal) => Subtype.decidableEq.{0} Real (fun (x : Real) => LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) x) (fun (a : Real) (b : Real) => Real.decidableEq a b) a b) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (fun (h : Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) => OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) (fun (h : Not (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))) => coeFn.{succ u2, succ u2} (MeasureTheory.OuterMeasure.{u2} β) (fun (_x : MeasureTheory.OuterMeasure.{u2} β) => (Set.{u2} β) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u2} β) (Pmf.toOuterMeasure.{u2} β (f a h)) s))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (s : Set.{u2} β), Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u2} β (Pmf.toOuterMeasure.{u2} β (Pmf.bindOnSupport.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (dite.{1} ENNReal (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (instDecidableEq.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCompleteLinearOrderENNReal))) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (fun (h : Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) => OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero)) (fun (h : Not (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero)))) => MeasureTheory.OuterMeasure.measureOf.{u2} β (Pmf.toOuterMeasure.{u2} β (f a h)) s))))
-Case conversion may be inaccurate. Consider using '#align pmf.to_outer_measure_bind_on_support_apply Pmf.toOuterMeasure_bindOnSupport_applyₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (a b) -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
@[simp]
@@ -479,12 +377,6 @@ theorem toOuterMeasure_bindOnSupport_apply :
#align pmf.to_outer_measure_bind_on_support_apply Pmf.toOuterMeasure_bindOnSupport_apply
-/- warning: pmf.to_measure_bind_on_support_apply -> Pmf.toMeasure_bindOnSupport_apply is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (s : Set.{u2} β) [_inst_1 : MeasurableSpace.{u2} β], (MeasurableSet.{u2} β _inst_1 s) -> (Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (MeasureTheory.Measure.{u2} β _inst_1) (fun (_x : MeasureTheory.Measure.{u2} β _inst_1) => (Set.{u2} β) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u2} β _inst_1) (Pmf.toMeasure.{u2} β _inst_1 (Pmf.bindOnSupport.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (dite.{1} ENNReal (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (Option.decidableEq.{0} NNReal (fun (a : NNReal) (b : NNReal) => Subtype.decidableEq.{0} Real (fun (x : Real) => LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) x) (fun (a : Real) (b : Real) => Real.decidableEq a b) a b) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (fun (h : Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) => OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) (fun (h : Not (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))) => coeFn.{succ u2, succ u2} (MeasureTheory.Measure.{u2} β _inst_1) (fun (_x : MeasureTheory.Measure.{u2} β _inst_1) => (Set.{u2} β) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u2} β _inst_1) (Pmf.toMeasure.{u2} β _inst_1 (f a h)) s)))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (s : Set.{u2} β) [_inst_1 : MeasurableSpace.{u2} β], (MeasurableSet.{u2} β _inst_1 s) -> (Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u2} β (MeasureTheory.Measure.toOuterMeasure.{u2} β _inst_1 (Pmf.toMeasure.{u2} β _inst_1 (Pmf.bindOnSupport.{u1, u2} α β p f))) s) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (dite.{1} ENNReal (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (instDecidableEq.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCompleteLinearOrderENNReal))) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (fun (h : Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) => OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero)) (fun (h : Not (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero)))) => MeasureTheory.OuterMeasure.measureOf.{u2} β (MeasureTheory.Measure.toOuterMeasure.{u2} β _inst_1 (Pmf.toMeasure.{u2} β _inst_1 (f a h))) s)))))
-Case conversion may be inaccurate. Consider using '#align pmf.to_measure_bind_on_support_apply Pmf.toMeasure_bindOnSupport_applyₓ'. -/
/-- The measure of a set under `p.bind_on_support f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a _`.
The additional if statement is needed since `f` is only a partial function -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -427,9 +427,7 @@ theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf
refine' ennreal.tsum_comm.trans (tsum_congr fun a' => tsum_congr fun b => _)
split_ifs
any_goals ring1
- · have := h_1 a'
- simp [h] at this
- contradiction
+ · have := h_1 a'; simp [h] at this; contradiction
· simp [h_2]
#align pmf.bind_on_support_bind_on_support Pmf.bindOnSupport_bindOnSupport
mathlib commit https://github.com/leanprover-community/mathlib/commit/e3fb84046afd187b710170887195d50bada934ee
@@ -184,7 +184,7 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align pmf.mem_support_bind_iff Pmf.mem_support_bind_iffₓ'. -/
theorem mem_support_bind_iff (b : β) :
b ∈ (p.bind f).support ↔ ∃ a ∈ p.support, b ∈ (f a).support := by
- simp only [support_bind, Set.mem_unionᵢ, Set.mem_setOf_eq]
+ simp only [support_bind, Set.mem_iUnion, Set.mem_setOf_eq]
#align pmf.mem_support_bind_iff Pmf.mem_support_bind_iff
#print Pmf.pure_bind /-
@@ -334,7 +334,7 @@ theorem support_bindOnSupport :
by
refine' Set.ext fun b => _
simp only [ENNReal.tsum_eq_zero, not_or, mem_support_iff, bind_on_support_apply, Ne.def,
- not_forall, mul_eq_zero, Set.mem_unionᵢ]
+ not_forall, mul_eq_zero, Set.mem_iUnion]
exact
⟨fun hb =>
let ⟨a, ⟨ha, ha'⟩⟩ := hb
@@ -348,7 +348,7 @@ theorem support_bindOnSupport :
#print Pmf.mem_support_bindOnSupport_iff /-
theorem mem_support_bindOnSupport_iff (b : β) :
b ∈ (p.bindOnSupport f).support ↔ ∃ (a : α)(h : a ∈ p.support), b ∈ (f a h).support := by
- simp only [support_bind_on_support, Set.mem_setOf_eq, Set.mem_unionᵢ]
+ simp only [support_bind_on_support, Set.mem_setOf_eq, Set.mem_iUnion]
#align pmf.mem_support_bind_on_support_iff Pmf.mem_support_bindOnSupport_iff
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/403190b5419b3f03f1a2893ad9352ca7f7d8bff6
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Devon Tuma
! This file was ported from Lean 3 source module probability.probability_mass_function.monad
-! leanprover-community/mathlib commit 4ac69b290818724c159de091daa3acd31da0ee6d
+! leanprover-community/mathlib commit bd15ff41b70f5e2cc210f26f25a8d5c53b20d3de
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -13,6 +13,9 @@ import Mathbin.Probability.ProbabilityMassFunction.Basic
/-!
# Monad Operations for Probability Mass Functions
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
This file constructs two operations on `pmf` that give it a monad structure.
`pure a` is the distribution where a single value `a` has probability `1`.
`bind pa pb : pmf β` is the distribution given by sampling `a : α` from `pa : pmf α`,
mathlib commit https://github.com/leanprover-community/mathlib/commit/28b2a92f2996d28e580450863c130955de0ed398
@@ -36,32 +36,52 @@ namespace Pmf
section Pure
+#print Pmf.pure /-
/-- The pure `pmf` is the `pmf` where all the mass lies in one point.
The value of `pure a` is `1` at `a` and `0` elsewhere. -/
def pure (a : α) : Pmf α :=
⟨fun a' => if a' = a then 1 else 0, hasSum_ite_eq _ _⟩
#align pmf.pure Pmf.pure
+-/
variable (a a' : α)
+/- warning: pmf.pure_apply -> Pmf.pure_apply is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} (a : α) (a' : α), Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) (Pmf.pure.{u1} α a) a') (ite.{1} ENNReal (Eq.{succ u1} α a' a) (Classical.propDecidable (Eq.{succ u1} α a' a)) (OfNat.ofNat.{0} ENNReal 1 (OfNat.mk.{0} ENNReal 1 (One.one.{0} ENNReal (AddMonoidWithOne.toOne.{0} ENNReal (AddCommMonoidWithOne.toAddMonoidWithOne.{0} ENNReal ENNReal.addCommMonoidWithOne))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))
+but is expected to have type
+ forall {α : Type.{u1}} (a : α) (a' : α), Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) (Pmf.pure.{u1} α a) a') (ite.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') (Eq.{succ u1} α a' a) (Classical.propDecidable (Eq.{succ u1} α a' a)) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') 1 (One.toOfNat1.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') (CanonicallyOrderedCommSemiring.toOne.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') ENNReal.instCanonicallyOrderedCommSemiringENNReal))) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') instENNRealZero)))
+Case conversion may be inaccurate. Consider using '#align pmf.pure_apply Pmf.pure_applyₓ'. -/
@[simp]
theorem pure_apply : pure a a' = if a' = a then 1 else 0 :=
rfl
#align pmf.pure_apply Pmf.pure_apply
+#print Pmf.support_pure /-
@[simp]
theorem support_pure : (pure a).support = {a} :=
Set.ext fun a' => by simp [mem_support_iff]
#align pmf.support_pure Pmf.support_pure
+-/
+#print Pmf.mem_support_pure_iff /-
theorem mem_support_pure_iff : a' ∈ (pure a).support ↔ a' = a := by simp
#align pmf.mem_support_pure_iff Pmf.mem_support_pure_iff
+-/
+#print Pmf.pure_apply_self /-
@[simp]
theorem pure_apply_self : pure a a = 1 :=
if_pos rfl
#align pmf.pure_apply_self Pmf.pure_apply_self
+-/
+/- warning: pmf.pure_apply_of_ne -> Pmf.pure_apply_of_ne is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} (a : α) (a' : α), (Ne.{succ u1} α a' a) -> (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) (Pmf.pure.{u1} α a) a') (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))
+but is expected to have type
+ forall {α : Type.{u1}} (a : α) (a' : α), (Ne.{succ u1} α a' a) -> (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) (Pmf.pure.{u1} α a) a') (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a') instENNRealZero)))
+Case conversion may be inaccurate. Consider using '#align pmf.pure_apply_of_ne Pmf.pure_apply_of_neₓ'. -/
theorem pure_apply_of_ne (h : a' ≠ a) : pure a a' = 0 :=
if_neg h
#align pmf.pure_apply_of_ne Pmf.pure_apply_of_ne
@@ -73,6 +93,12 @@ section Measure
variable (s : Set α)
+/- warning: pmf.to_outer_measure_pure_apply -> Pmf.toOuterMeasure_pure_apply is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} (a : α) (s : Set.{u1} α), Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (MeasureTheory.OuterMeasure.{u1} α) (fun (_x : MeasureTheory.OuterMeasure.{u1} α) => (Set.{u1} α) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u1} α) (Pmf.toOuterMeasure.{u1} α (Pmf.pure.{u1} α a)) s) (ite.{1} ENNReal (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a s) (Classical.propDecidable (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a s)) (OfNat.ofNat.{0} ENNReal 1 (OfNat.mk.{0} ENNReal 1 (One.one.{0} ENNReal (AddMonoidWithOne.toOne.{0} ENNReal (AddCommMonoidWithOne.toAddMonoidWithOne.{0} ENNReal ENNReal.addCommMonoidWithOne))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))
+but is expected to have type
+ forall {α : Type.{u1}} (a : α) (s : Set.{u1} α), Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u1} α (Pmf.toOuterMeasure.{u1} α (Pmf.pure.{u1} α a)) s) (ite.{1} ENNReal (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a s) (Classical.propDecidable (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a s)) (OfNat.ofNat.{0} ENNReal 1 (One.toOfNat1.{0} ENNReal (CanonicallyOrderedCommSemiring.toOne.{0} ENNReal ENNReal.instCanonicallyOrderedCommSemiringENNReal))) (OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero)))
+Case conversion may be inaccurate. Consider using '#align pmf.to_outer_measure_pure_apply Pmf.toOuterMeasure_pure_applyₓ'. -/
@[simp]
theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then 1 else 0 :=
by
@@ -86,6 +112,12 @@ theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then
variable [MeasurableSpace α]
+/- warning: pmf.to_measure_pure_apply -> Pmf.toMeasure_pure_apply is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} (a : α) (s : Set.{u1} α) [_inst_1 : MeasurableSpace.{u1} α], (MeasurableSet.{u1} α _inst_1 s) -> (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (MeasureTheory.Measure.{u1} α _inst_1) (fun (_x : MeasureTheory.Measure.{u1} α _inst_1) => (Set.{u1} α) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u1} α _inst_1) (Pmf.toMeasure.{u1} α _inst_1 (Pmf.pure.{u1} α a)) s) (ite.{1} ENNReal (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a s) (Classical.propDecidable (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a s)) (OfNat.ofNat.{0} ENNReal 1 (OfNat.mk.{0} ENNReal 1 (One.one.{0} ENNReal (AddMonoidWithOne.toOne.{0} ENNReal (AddCommMonoidWithOne.toAddMonoidWithOne.{0} ENNReal ENNReal.addCommMonoidWithOne))))) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))))
+but is expected to have type
+ forall {α : Type.{u1}} (a : α) (s : Set.{u1} α) [_inst_1 : MeasurableSpace.{u1} α], (MeasurableSet.{u1} α _inst_1 s) -> (Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u1} α (MeasureTheory.Measure.toOuterMeasure.{u1} α _inst_1 (Pmf.toMeasure.{u1} α _inst_1 (Pmf.pure.{u1} α a))) s) (ite.{1} ENNReal (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a s) (Classical.propDecidable (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a s)) (OfNat.ofNat.{0} ENNReal 1 (One.toOfNat1.{0} ENNReal (CanonicallyOrderedCommSemiring.toOne.{0} ENNReal ENNReal.instCanonicallyOrderedCommSemiringENNReal))) (OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero))))
+Case conversion may be inaccurate. Consider using '#align pmf.to_measure_pure_apply Pmf.toMeasure_pure_applyₓ'. -/
/-- The measure of a set under `pure a` is `1` for sets containing `a` and `0` otherwise -/
@[simp]
theorem toMeasure_pure_apply (hs : MeasurableSet s) :
@@ -93,14 +125,18 @@ theorem toMeasure_pure_apply (hs : MeasurableSet s) :
(toMeasure_apply_eq_toOuterMeasure_apply (pure a) s hs).trans (toOuterMeasure_pure_apply a s)
#align pmf.to_measure_pure_apply Pmf.toMeasure_pure_apply
+#print Pmf.toMeasure_pure /-
theorem toMeasure_pure : (pure a).toMeasure = Measure.dirac a :=
Measure.ext fun s hs => by simpa only [to_measure_pure_apply a s hs, measure.dirac_apply' a hs]
#align pmf.to_measure_pure Pmf.toMeasure_pure
+-/
+#print Pmf.toPmf_dirac /-
@[simp]
theorem toPmf_dirac [Countable α] [h : MeasurableSingletonClass α] :
(Measure.dirac a).toPmf = pure a := by rw [to_pmf_eq_iff_to_measure_eq, to_measure_pure]
#align pmf.to_pmf_dirac Pmf.toPmf_dirac
+-/
end Measure
@@ -108,30 +144,47 @@ end Pure
section Bind
+#print Pmf.bind /-
/-- The monadic bind operation for `pmf`. -/
def bind (p : Pmf α) (f : α → Pmf β) : Pmf β :=
⟨fun b => ∑' a, p a * f a b,
ENNReal.summable.hasSum_iff.2
(ENNReal.tsum_comm.trans <| by simp only [ENNReal.tsum_mul_left, tsum_coe, mul_one])⟩
#align pmf.bind Pmf.bind
+-/
variable (p : Pmf α) (f : α → Pmf β) (g : β → Pmf γ)
+/- warning: pmf.bind_apply -> Pmf.bind_apply is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (b : β), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (Pmf.bind.{u1, u2} α β p f) b) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (f a) b)))
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (b : β), Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (Pmf.bind.{u1, u2} α β p f) b) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (f a) b)))
+Case conversion may be inaccurate. Consider using '#align pmf.bind_apply Pmf.bind_applyₓ'. -/
@[simp]
theorem bind_apply (b : β) : p.bind f b = ∑' a, p a * f a b :=
rfl
#align pmf.bind_apply Pmf.bind_apply
+#print Pmf.support_bind /-
@[simp]
theorem support_bind : (p.bind f).support = ⋃ a ∈ p.support, (f a).support :=
Set.ext fun b => by simp [mem_support_iff, ENNReal.tsum_eq_zero, not_or]
#align pmf.support_bind Pmf.support_bind
+-/
+/- warning: pmf.mem_support_bind_iff -> Pmf.mem_support_bind_iff is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (b : β), Iff (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (Pmf.bind.{u1, u2} α β p f))) (Exists.{succ u1} α (fun (a : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) (fun (H : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a)))))
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (b : β), Iff (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (Pmf.bind.{u1, u2} α β p f))) (Exists.{succ u1} α (fun (a : α) => And (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a)))))
+Case conversion may be inaccurate. Consider using '#align pmf.mem_support_bind_iff Pmf.mem_support_bind_iffₓ'. -/
theorem mem_support_bind_iff (b : β) :
b ∈ (p.bind f).support ↔ ∃ a ∈ p.support, b ∈ (f a).support := by
simp only [support_bind, Set.mem_unionᵢ, Set.mem_setOf_eq]
#align pmf.mem_support_bind_iff Pmf.mem_support_bind_iff
+#print Pmf.pure_bind /-
@[simp]
theorem pure_bind (a : α) (f : α → Pmf β) : (pure a).bind f = f a :=
by
@@ -139,7 +192,9 @@ theorem pure_bind (a : α) (f : α → Pmf β) : (pure a).bind f = f a :=
split_ifs <;> simp <;> subst h <;> simp
ext b <;> simp [this]
#align pmf.pure_bind Pmf.pure_bind
+-/
+#print Pmf.bind_pure /-
@[simp]
theorem bind_pure : p.bind pure = p :=
Pmf.ext fun x =>
@@ -149,19 +204,34 @@ theorem bind_pure : p.bind pure = p :=
rw [pure_apply_of_ne _ _ hy.symm, MulZeroClass.mul_zero]) <|
by rw [pure_apply_self, mul_one])
#align pmf.bind_pure Pmf.bind_pure
+-/
+/- warning: pmf.bind_const -> Pmf.bind_const is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (q : Pmf.{u2} β), Eq.{succ u2} (Pmf.{u2} β) (Pmf.bind.{u1, u2} α β p (fun (_x : α) => q)) q
+but is expected to have type
+ forall {α : Type.{u2}} {β : Type.{u1}} (p : Pmf.{u2} α) (q : Pmf.{u1} β), Eq.{succ u1} (Pmf.{u1} β) (Pmf.bind.{u2, u1} α β p (fun (_x : α) => q)) q
+Case conversion may be inaccurate. Consider using '#align pmf.bind_const Pmf.bind_constₓ'. -/
@[simp]
theorem bind_const (p : Pmf α) (q : Pmf β) : (p.bind fun _ => q) = q :=
Pmf.ext fun x => by rw [bind_apply, ENNReal.tsum_mul_right, tsum_coe, one_mul]
#align pmf.bind_const Pmf.bind_const
+#print Pmf.bind_bind /-
@[simp]
theorem bind_bind : (p.bind f).bind g = p.bind fun a => (f a).bind g :=
Pmf.ext fun b => by
simpa only [ennreal.coe_eq_coe.symm, bind_apply, ennreal.tsum_mul_left.symm,
ennreal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
#align pmf.bind_bind Pmf.bind_bind
+-/
+/- warning: pmf.bind_comm -> Pmf.bind_comm is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (p : Pmf.{u1} α) (q : Pmf.{u2} β) (f : α -> β -> (Pmf.{u3} γ)), Eq.{succ u3} (Pmf.{u3} γ) (Pmf.bind.{u1, u3} α γ p (fun (a : α) => Pmf.bind.{u2, u3} β γ q (f a))) (Pmf.bind.{u2, u3} β γ q (fun (b : β) => Pmf.bind.{u1, u3} α γ p (fun (a : α) => f a b)))
+but is expected to have type
+ forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (p : Pmf.{u3} α) (q : Pmf.{u2} β) (f : α -> β -> (Pmf.{u1} γ)), Eq.{succ u1} (Pmf.{u1} γ) (Pmf.bind.{u3, u1} α γ p (fun (a : α) => Pmf.bind.{u2, u1} β γ q (f a))) (Pmf.bind.{u2, u1} β γ q (fun (b : β) => Pmf.bind.{u3, u1} α γ p (fun (a : α) => f a b)))
+Case conversion may be inaccurate. Consider using '#align pmf.bind_comm Pmf.bind_commₓ'. -/
theorem bind_comm (p : Pmf α) (q : Pmf β) (f : α → β → Pmf γ) :
(p.bind fun a => q.bind (f a)) = q.bind fun b => p.bind fun a => f a b :=
Pmf.ext fun b => by
@@ -173,6 +243,12 @@ section Measure
variable (s : Set β)
+/- warning: pmf.to_outer_measure_bind_apply -> Pmf.toOuterMeasure_bind_apply is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (s : Set.{u2} β), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (MeasureTheory.OuterMeasure.{u2} β) (fun (_x : MeasureTheory.OuterMeasure.{u2} β) => (Set.{u2} β) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u2} β) (Pmf.toOuterMeasure.{u2} β (Pmf.bind.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (coeFn.{succ u2, succ u2} (MeasureTheory.OuterMeasure.{u2} β) (fun (_x : MeasureTheory.OuterMeasure.{u2} β) => (Set.{u2} β) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u2} β) (Pmf.toOuterMeasure.{u2} β (f a)) s)))
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (s : Set.{u2} β), Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u2} β (Pmf.toOuterMeasure.{u2} β (Pmf.bind.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (MeasureTheory.OuterMeasure.measureOf.{u2} β (Pmf.toOuterMeasure.{u2} β (f a)) s)))
+Case conversion may be inaccurate. Consider using '#align pmf.to_outer_measure_bind_apply Pmf.toOuterMeasure_bind_applyₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (a b) -/
@[simp]
@@ -192,6 +268,12 @@ theorem toOuterMeasure_bind_apply :
#align pmf.to_outer_measure_bind_apply Pmf.toOuterMeasure_bind_apply
+/- warning: pmf.to_measure_bind_apply -> Pmf.toMeasure_bind_apply is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (s : Set.{u2} β) [_inst_1 : MeasurableSpace.{u2} β], (MeasurableSet.{u2} β _inst_1 s) -> (Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (MeasureTheory.Measure.{u2} β _inst_1) (fun (_x : MeasureTheory.Measure.{u2} β _inst_1) => (Set.{u2} β) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u2} β _inst_1) (Pmf.toMeasure.{u2} β _inst_1 (Pmf.bind.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (coeFn.{succ u2, succ u2} (MeasureTheory.Measure.{u2} β _inst_1) (fun (_x : MeasureTheory.Measure.{u2} β _inst_1) => (Set.{u2} β) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u2} β _inst_1) (Pmf.toMeasure.{u2} β _inst_1 (f a)) s))))
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)) (s : Set.{u2} β) [_inst_1 : MeasurableSpace.{u2} β], (MeasurableSet.{u2} β _inst_1 s) -> (Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u2} β (MeasureTheory.Measure.toOuterMeasure.{u2} β _inst_1 (Pmf.toMeasure.{u2} β _inst_1 (Pmf.bind.{u1, u2} α β p f))) s) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (MeasureTheory.OuterMeasure.measureOf.{u2} β (MeasureTheory.Measure.toOuterMeasure.{u2} β _inst_1 (Pmf.toMeasure.{u2} β _inst_1 (f a))) s))))
+Case conversion may be inaccurate. Consider using '#align pmf.to_measure_bind_apply Pmf.toMeasure_bind_applyₓ'. -/
/-- The measure of a set under `p.bind f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a` -/
@[simp]
@@ -213,6 +295,7 @@ instance : Monad Pmf where
section BindOnSupport
+#print Pmf.bindOnSupport /-
/-- Generalized version of `bind` allowing `f` to only be defined on the support of `p`.
`p.bind f` is equivalent to `p.bind_on_support (λ a _, f a)`, see `bind_on_support_eq_bind` -/
def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
@@ -225,15 +308,23 @@ def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
· simp only [h, MulZeroClass.zero_mul]
· rw [(f a h).tsum_coe, mul_one])⟩
#align pmf.bind_on_support Pmf.bindOnSupport
+-/
variable {p : Pmf α} (f : ∀ a ∈ p.support, Pmf β)
+/- warning: pmf.bind_on_support_apply -> Pmf.bindOnSupport_apply is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (b : β), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (Pmf.bindOnSupport.{u1, u2} α β p f) b) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (dite.{1} ENNReal (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (Option.decidableEq.{0} NNReal (fun (a : NNReal) (b : NNReal) => Subtype.decidableEq.{0} Real (fun (x : Real) => LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) x) (fun (a : Real) (b : Real) => Real.decidableEq a b) a b) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (fun (h : Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) => OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) (fun (h : Not (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))) => coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (f a h) b))))
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (b : β), Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (Pmf.bindOnSupport.{u1, u2} α β p f) b) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (dite.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (instDecidableEq.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCompleteLinearOrderENNReal))) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (fun (h : Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) => OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) instENNRealZero)) (fun (h : Not (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero)))) => FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (f a h) b))))
+Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_apply Pmf.bindOnSupport_applyₓ'. -/
@[simp]
theorem bindOnSupport_apply (b : β) :
p.bindOnSupport f b = ∑' a, p a * if h : p a = 0 then 0 else f a h b :=
rfl
#align pmf.bind_on_support_apply Pmf.bindOnSupport_apply
+#print Pmf.support_bindOnSupport /-
@[simp]
theorem support_bindOnSupport :
(p.bindOnSupport f).support = ⋃ (a : α) (h : a ∈ p.support), (f a h).support :=
@@ -249,12 +340,21 @@ theorem support_bindOnSupport :
let ⟨a, ha, ha'⟩ := hb
⟨a, ⟨ha, by simpa [(mem_support_iff _ a).1 ha] using ha'⟩⟩⟩
#align pmf.support_bind_on_support Pmf.support_bindOnSupport
+-/
+#print Pmf.mem_support_bindOnSupport_iff /-
theorem mem_support_bindOnSupport_iff (b : β) :
b ∈ (p.bindOnSupport f).support ↔ ∃ (a : α)(h : a ∈ p.support), b ∈ (f a h).support := by
simp only [support_bind_on_support, Set.mem_setOf_eq, Set.mem_unionᵢ]
#align pmf.mem_support_bind_on_support_iff Pmf.mem_support_bindOnSupport_iff
+-/
+/- warning: pmf.bind_on_support_eq_bind -> Pmf.bindOnSupport_eq_bind is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} (p : Pmf.{u1} α) (f : α -> (Pmf.{u2} β)), Eq.{succ u2} (Pmf.{u2} β) (Pmf.bindOnSupport.{u1, u2} α β p (fun (a : α) (_x : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => f a)) (Pmf.bind.{u1, u2} α β p f)
+but is expected to have type
+ forall {α : Type.{u2}} {β : Type.{u1}} (p : Pmf.{u2} α) (f : α -> (Pmf.{u1} β)), Eq.{succ u1} (Pmf.{u1} β) (Pmf.bindOnSupport.{u2, u1} α β p (fun (a : α) (_x : Membership.mem.{u2, u2} α (Set.{u2} α) (Set.instMembershipSet.{u2} α) a (Pmf.support.{u2} α p)) => f a)) (Pmf.bind.{u2, u1} α β p f)
+Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_eq_bind Pmf.bindOnSupport_eq_bindₓ'. -/
/-- `bind_on_support` reduces to `bind` if `f` doesn't depend on the additional hypothesis -/
@[simp]
theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
@@ -267,6 +367,12 @@ theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
MulZeroClass.mul_zero, this]
#align pmf.bind_on_support_eq_bind Pmf.bindOnSupport_eq_bind
+/- warning: pmf.bind_on_support_eq_zero_iff -> Pmf.bindOnSupport_eq_zero_iff is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (b : β), Iff (Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (Pmf.bindOnSupport.{u1, u2} α β p f) b) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (forall (a : α) (ha : Ne.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (Pmf.{u2} β) (fun (_x : Pmf.{u2} β) => β -> ENNReal) (FunLike.hasCoeToFun.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (p : β) => ENNReal) (Pmf.funLike.{u2} β)) (f a ha) b) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (b : β), Iff (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (Pmf.bindOnSupport.{u1, u2} α β p f) b) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) instENNRealZero))) (forall (a : α) (ha : Ne.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))), Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) (FunLike.coe.{succ u2, succ u2, 1} (Pmf.{u2} β) β (fun (_x : β) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) _x) (Pmf.funLike.{u2} β) (f a ha) b) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : β) => ENNReal) b) instENNRealZero)))
+Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_eq_zero_iff Pmf.bindOnSupport_eq_zero_iffₓ'. -/
theorem bindOnSupport_eq_zero_iff (b : β) :
p.bindOnSupport f b = 0 ↔ ∀ (a) (ha : p a ≠ 0), f a ha b = 0 :=
by
@@ -274,6 +380,12 @@ theorem bindOnSupport_eq_zero_iff (b : β) :
exact ⟨fun h a ha => trans (dif_neg ha).symm (h a ha), fun h a ha => trans (dif_neg ha) (h a ha)⟩
#align pmf.bind_on_support_eq_zero_iff Pmf.bindOnSupport_eq_zero_iff
+/- warning: pmf.pure_bind_on_support -> Pmf.pure_bindOnSupport is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} (a : α) (f : forall (a' : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a' (Pmf.support.{u1} α (Pmf.pure.{u1} α a))) -> (Pmf.{u2} β)), Eq.{succ u2} (Pmf.{u2} β) (Pmf.bindOnSupport.{u1, u2} α β (Pmf.pure.{u1} α a) f) (f a (Iff.mpr (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α (Pmf.pure.{u1} α a))) (Eq.{succ u1} α a a) (Pmf.mem_support_pure_iff.{u1} α a a) (rfl.{succ u1} α a)))
+but is expected to have type
+ forall {α : Type.{u2}} {β : Type.{u1}} (a : α) (f : forall (a' : α), (Membership.mem.{u2, u2} α (Set.{u2} α) (Set.instMembershipSet.{u2} α) a' (Pmf.support.{u2} α (Pmf.pure.{u2} α a))) -> (Pmf.{u1} β)), Eq.{succ u1} (Pmf.{u1} β) (Pmf.bindOnSupport.{u2, u1} α β (Pmf.pure.{u2} α a) f) (f a (Iff.mpr (Membership.mem.{u2, u2} α (Set.{u2} α) (Set.instMembershipSet.{u2} α) a (Pmf.support.{u2} α (Pmf.pure.{u2} α a))) (Eq.{succ u2} α a a) (Pmf.mem_support_pure_iff.{u2} α a a) (rfl.{succ u2} α a)))
+Case conversion may be inaccurate. Consider using '#align pmf.pure_bind_on_support Pmf.pure_bindOnSupportₓ'. -/
@[simp]
theorem pure_bindOnSupport (a : α) (f : ∀ (a' : α) (ha : a' ∈ (pure a).support), Pmf β) :
(pure a).bindOnSupport f = f a ((mem_support_pure_iff a a).mpr rfl) :=
@@ -284,10 +396,18 @@ theorem pure_bindOnSupport (a : α) (f : ∀ (a' : α) (ha : a' ∈ (pure a).sup
by_cases h : a' = a <;> simp [h]
#align pmf.pure_bind_on_support Pmf.pure_bindOnSupport
+#print Pmf.bindOnSupport_pure /-
theorem bindOnSupport_pure (p : Pmf α) : (p.bindOnSupport fun a _ => pure a) = p := by
simp only [Pmf.bind_pure, Pmf.bindOnSupport_eq_bind]
#align pmf.bind_on_support_pure Pmf.bindOnSupport_pure
+-/
+/- warning: pmf.bind_on_support_bind_on_support -> Pmf.bindOnSupport_bindOnSupport is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (p : Pmf.{u1} α) (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (g : forall (b : β), (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (Pmf.bindOnSupport.{u1, u2} α β p f))) -> (Pmf.{u3} γ)), Eq.{succ u3} (Pmf.{u3} γ) (Pmf.bindOnSupport.{u2, u3} β γ (Pmf.bindOnSupport.{u1, u2} α β p f) g) (Pmf.bindOnSupport.{u1, u3} α γ p (fun (a : α) (ha : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Pmf.bindOnSupport.{u2, u3} β γ (f a ha) (fun (b : β) (hb : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a ha))) => g b (Iff.mpr (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (Pmf.bindOnSupport.{u1, u2} α β p f))) (Exists.{succ u1} α (fun (a : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) (fun (h : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a h))))) (Pmf.mem_support_bindOnSupport_iff.{u1, u2} α β p f b) (Exists.intro.{succ u1} α (fun (a : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) (fun (h : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a h)))) a (Exists.intro.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) (fun (h : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β (f a h))) ha hb))))))
+but is expected to have type
+ forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (p : Pmf.{u3} α) (f : forall (a : α), (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) -> (Pmf.{u2} β)) (g : forall (b : β), (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (Pmf.bindOnSupport.{u3, u2} α β p f))) -> (Pmf.{u1} γ)), Eq.{succ u1} (Pmf.{u1} γ) (Pmf.bindOnSupport.{u2, u1} β γ (Pmf.bindOnSupport.{u3, u2} α β p f) g) (Pmf.bindOnSupport.{u3, u1} α γ p (fun (a : α) (ha : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Pmf.bindOnSupport.{u2, u1} β γ (f a ha) (fun (b : β) (hb : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a ha))) => g b (Iff.mpr (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (Pmf.bindOnSupport.{u3, u2} α β p f))) (Exists.{succ u3} α (fun (a : α) => Exists.{0} (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) (fun (h : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a h))))) (Pmf.mem_support_bindOnSupport_iff.{u3, u2} α β p f b) (Exists.intro.{succ u3} α (fun (a : α) => Exists.{0} (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) (fun (h : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a h)))) a (Exists.intro.{0} (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) (fun (h : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β (f a h))) ha hb))))))
+Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_bind_on_support Pmf.bindOnSupport_bindOnSupportₓ'. -/
@[simp]
theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β)
(g : ∀ b ∈ (p.bindOnSupport f).support, Pmf γ) :
@@ -310,6 +430,12 @@ theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf
· simp [h_2]
#align pmf.bind_on_support_bind_on_support Pmf.bindOnSupport_bindOnSupport
+/- warning: pmf.bind_on_support_comm -> Pmf.bindOnSupport_comm is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (p : Pmf.{u1} α) (q : Pmf.{u2} β) (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (forall (b : β), (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β q)) -> (Pmf.{u3} γ))), Eq.{succ u3} (Pmf.{u3} γ) (Pmf.bindOnSupport.{u1, u3} α γ p (fun (a : α) (ha : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => Pmf.bindOnSupport.{u2, u3} β γ q (f a ha))) (Pmf.bindOnSupport.{u2, u3} β γ q (fun (b : β) (hb : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) b (Pmf.support.{u2} β q)) => Pmf.bindOnSupport.{u1, u3} α γ p (fun (a : α) (ha : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) => f a ha b hb)))
+but is expected to have type
+ forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (p : Pmf.{u3} α) (q : Pmf.{u2} β) (f : forall (a : α), (Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) -> (forall (b : β), (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β q)) -> (Pmf.{u1} γ))), Eq.{succ u1} (Pmf.{u1} γ) (Pmf.bindOnSupport.{u3, u1} α γ p (fun (a : α) (ha : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => Pmf.bindOnSupport.{u2, u1} β γ q (f a ha))) (Pmf.bindOnSupport.{u2, u1} β γ q (fun (b : β) (hb : Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) b (Pmf.support.{u2} β q)) => Pmf.bindOnSupport.{u3, u1} α γ p (fun (a : α) (ha : Membership.mem.{u3, u3} α (Set.{u3} α) (Set.instMembershipSet.{u3} α) a (Pmf.support.{u3} α p)) => f a ha b hb)))
+Case conversion may be inaccurate. Consider using '#align pmf.bind_on_support_comm Pmf.bindOnSupport_commₓ'. -/
theorem bindOnSupport_comm (p : Pmf α) (q : Pmf β) (f : ∀ a ∈ p.support, ∀ b ∈ q.support, Pmf γ) :
(p.bindOnSupport fun a ha => q.bindOnSupport (f a ha)) =
q.bindOnSupport fun b hb => p.bindOnSupport fun a ha => f a ha b hb :=
@@ -325,6 +451,12 @@ section Measure
variable (s : Set β)
+/- warning: pmf.to_outer_measure_bind_on_support_apply -> Pmf.toOuterMeasure_bindOnSupport_apply is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (s : Set.{u2} β), Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (MeasureTheory.OuterMeasure.{u2} β) (fun (_x : MeasureTheory.OuterMeasure.{u2} β) => (Set.{u2} β) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u2} β) (Pmf.toOuterMeasure.{u2} β (Pmf.bindOnSupport.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (dite.{1} ENNReal (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (Option.decidableEq.{0} NNReal (fun (a : NNReal) (b : NNReal) => Subtype.decidableEq.{0} Real (fun (x : Real) => LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) x) (fun (a : Real) (b : Real) => Real.decidableEq a b) a b) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (fun (h : Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) => OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) (fun (h : Not (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))) => coeFn.{succ u2, succ u2} (MeasureTheory.OuterMeasure.{u2} β) (fun (_x : MeasureTheory.OuterMeasure.{u2} β) => (Set.{u2} β) -> ENNReal) (MeasureTheory.OuterMeasure.instCoeFun.{u2} β) (Pmf.toOuterMeasure.{u2} β (f a h)) s))))
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (s : Set.{u2} β), Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u2} β (Pmf.toOuterMeasure.{u2} β (Pmf.bindOnSupport.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (dite.{1} ENNReal (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (instDecidableEq.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCompleteLinearOrderENNReal))) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (fun (h : Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) => OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero)) (fun (h : Not (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero)))) => MeasureTheory.OuterMeasure.measureOf.{u2} β (Pmf.toOuterMeasure.{u2} β (f a h)) s))))
+Case conversion may be inaccurate. Consider using '#align pmf.to_outer_measure_bind_on_support_apply Pmf.toOuterMeasure_bindOnSupport_applyₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (a b) -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
@[simp]
@@ -346,6 +478,12 @@ theorem toOuterMeasure_bindOnSupport_apply :
#align pmf.to_outer_measure_bind_on_support_apply Pmf.toOuterMeasure_bindOnSupport_apply
+/- warning: pmf.to_measure_bind_on_support_apply -> Pmf.toMeasure_bindOnSupport_apply is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (s : Set.{u2} β) [_inst_1 : MeasurableSpace.{u2} β], (MeasurableSet.{u2} β _inst_1 s) -> (Eq.{1} ENNReal (coeFn.{succ u2, succ u2} (MeasureTheory.Measure.{u2} β _inst_1) (fun (_x : MeasureTheory.Measure.{u2} β _inst_1) => (Set.{u2} β) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u2} β _inst_1) (Pmf.toMeasure.{u2} β _inst_1 (Pmf.bindOnSupport.{u1, u2} α β p f)) s) (tsum.{0, u1} ENNReal (OrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (OrderedSemiring.toOrderedAddCommMonoid.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))) ENNReal.topologicalSpace α (fun (a : α) => HMul.hMul.{0, 0, 0} ENNReal ENNReal ENNReal (instHMul.{0} ENNReal (Distrib.toHasMul.{0} ENNReal (NonUnitalNonAssocSemiring.toDistrib.{0} ENNReal (NonAssocSemiring.toNonUnitalNonAssocSemiring.{0} ENNReal (Semiring.toNonAssocSemiring.{0} ENNReal (OrderedSemiring.toSemiring.{0} ENNReal (OrderedCommSemiring.toOrderedSemiring.{0} ENNReal (CanonicallyOrderedCommSemiring.toOrderedCommSemiring.{0} ENNReal ENNReal.canonicallyOrderedCommSemiring)))))))) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (dite.{1} ENNReal (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (Option.decidableEq.{0} NNReal (fun (a : NNReal) (b : NNReal) => Subtype.decidableEq.{0} Real (fun (x : Real) => LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) x) (fun (a : Real) (b : Real) => Real.decidableEq a b) a b) (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) (fun (h : Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero)))) => OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))) (fun (h : Not (Eq.{1} ENNReal (coeFn.{succ u1, succ u1} (Pmf.{u1} α) (fun (_x : Pmf.{u1} α) => α -> ENNReal) (FunLike.hasCoeToFun.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (p : α) => ENNReal) (Pmf.funLike.{u1} α)) p a) (OfNat.ofNat.{0} ENNReal 0 (OfNat.mk.{0} ENNReal 0 (Zero.zero.{0} ENNReal ENNReal.hasZero))))) => coeFn.{succ u2, succ u2} (MeasureTheory.Measure.{u2} β _inst_1) (fun (_x : MeasureTheory.Measure.{u2} β _inst_1) => (Set.{u2} β) -> ENNReal) (MeasureTheory.Measure.instCoeFun.{u2} β _inst_1) (Pmf.toMeasure.{u2} β _inst_1 (f a h)) s)))))
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} {p : Pmf.{u1} α} (f : forall (a : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) a (Pmf.support.{u1} α p)) -> (Pmf.{u2} β)) (s : Set.{u2} β) [_inst_1 : MeasurableSpace.{u2} β], (MeasurableSet.{u2} β _inst_1 s) -> (Eq.{1} ENNReal (MeasureTheory.OuterMeasure.measureOf.{u2} β (MeasureTheory.Measure.toOuterMeasure.{u2} β _inst_1 (Pmf.toMeasure.{u2} β _inst_1 (Pmf.bindOnSupport.{u1, u2} α β p f))) s) (tsum.{0, u1} ENNReal (LinearOrderedAddCommMonoid.toAddCommMonoid.{0} ENNReal (LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid.{0} ENNReal ENNReal.instLinearOrderedAddCommMonoidWithTopENNReal)) ENNReal.instTopologicalSpaceENNReal α (fun (a : α) => HMul.hMul.{0, 0, 0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instHMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CanonicallyOrderedCommSemiring.toMul.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCanonicallyOrderedCommSemiringENNReal)) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (dite.{1} ENNReal (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (instDecidableEq.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (instLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (ConditionallyCompleteLinearOrderBot.toConditionallyCompleteLinearOrder.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (CompleteLinearOrder.toConditionallyCompleteLinearOrderBot.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) ENNReal.instCompleteLinearOrderENNReal))) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) (fun (h : Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero))) => OfNat.ofNat.{0} ENNReal 0 (Zero.toOfNat0.{0} ENNReal instENNRealZero)) (fun (h : Not (Eq.{1} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) (FunLike.coe.{succ u1, succ u1, 1} (Pmf.{u1} α) α (fun (_x : α) => (fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) _x) (Pmf.funLike.{u1} α) p a) (OfNat.ofNat.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) 0 (Zero.toOfNat0.{0} ((fun (x._@.Mathlib.Probability.ProbabilityMassFunction.Basic._hyg.47 : α) => ENNReal) a) instENNRealZero)))) => MeasureTheory.OuterMeasure.measureOf.{u2} β (MeasureTheory.Measure.toOuterMeasure.{u2} β _inst_1 (Pmf.toMeasure.{u2} β _inst_1 (f a h))) s)))))
+Case conversion may be inaccurate. Consider using '#align pmf.to_measure_bind_on_support_apply Pmf.toMeasure_bindOnSupport_applyₓ'. -/
/-- The measure of a set under `p.bind_on_support f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a _`.
The additional if statement is needed since `f` is only a partial function -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -144,8 +144,10 @@ theorem pure_bind (a : α) (f : α → Pmf β) : (pure a).bind f = f a :=
theorem bind_pure : p.bind pure = p :=
Pmf.ext fun x =>
(bind_apply _ _ _).trans
- (trans (tsum_eq_single x fun y hy => by rw [pure_apply_of_ne _ _ hy.symm, mul_zero]) <| by
- rw [pure_apply_self, mul_one])
+ (trans
+ (tsum_eq_single x fun y hy => by
+ rw [pure_apply_of_ne _ _ hy.symm, MulZeroClass.mul_zero]) <|
+ by rw [pure_apply_self, mul_one])
#align pmf.bind_pure Pmf.bind_pure
@[simp]
@@ -220,7 +222,7 @@ def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
refine' ennreal.tsum_comm.trans (trans (tsum_congr fun a => _) p.tsum_coe)
simp_rw [ENNReal.tsum_mul_left]
split_ifs with h
- · simp only [h, zero_mul]
+ · simp only [h, MulZeroClass.zero_mul]
· rw [(f a h).tsum_coe, mul_one])⟩
#align pmf.bind_on_support Pmf.bindOnSupport
@@ -260,9 +262,9 @@ theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
by
ext (b x)
have : ∀ a, ite (p a = 0) 0 (p a * f a b) = p a * f a b := fun a =>
- ite_eq_right_iff.2 fun h => h.symm ▸ symm (zero_mul <| f a b)
- simp only [bind_on_support_apply fun a _ => f a, p.bind_apply f, dite_eq_ite, mul_ite, mul_zero,
- this]
+ ite_eq_right_iff.2 fun h => h.symm ▸ symm (MulZeroClass.zero_mul <| f a b)
+ simp only [bind_on_support_apply fun a _ => f a, p.bind_apply f, dite_eq_ite, mul_ite,
+ MulZeroClass.mul_zero, this]
#align pmf.bind_on_support_eq_bind Pmf.bindOnSupport_eq_bind
theorem bindOnSupport_eq_zero_iff (b : β) :
@@ -338,7 +340,7 @@ theorem toOuterMeasure_bindOnSupport_apply :
_ = ∑' (a) (b), ite (b ∈ s) (p a * dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
ENNReal.tsum_comm
_ = ∑' a, p a * ∑' b, ite (b ∈ s) (dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
- (tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, mul_zero])
+ (tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, MulZeroClass.mul_zero])
_ = ∑' a, p a * dite (p a = 0) (fun h => 0) fun h => ∑' b, ite (b ∈ s) (f a h b) 0 :=
tsum_congr fun a => by split_ifs with ha <;> simp only [if_t_t, tsum_zero, eq_self_iff_true]
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Devon Tuma
! This file was ported from Lean 3 source module probability.probability_mass_function.monad
-! leanprover-community/mathlib commit 3f5c9d30716c775bda043456728a1a3ee31412e7
+! leanprover-community/mathlib commit 4ac69b290818724c159de091daa3acd31da0ee6d
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -57,6 +57,15 @@ theorem support_pure : (pure a).support = {a} :=
theorem mem_support_pure_iff : a' ∈ (pure a).support ↔ a' = a := by simp
#align pmf.mem_support_pure_iff Pmf.mem_support_pure_iff
+@[simp]
+theorem pure_apply_self : pure a a = 1 :=
+ if_pos rfl
+#align pmf.pure_apply_self Pmf.pure_apply_self
+
+theorem pure_apply_of_ne (h : a' ≠ a) : pure a a' = 0 :=
+ if_neg h
+#align pmf.pure_apply_of_ne Pmf.pure_apply_of_ne
+
instance [Inhabited α] : Inhabited (Pmf α) :=
⟨pure default⟩
@@ -133,12 +142,17 @@ theorem pure_bind (a : α) (f : α → Pmf β) : (pure a).bind f = f a :=
@[simp]
theorem bind_pure : p.bind pure = p :=
- by
- have : ∀ a a', p a * ite (a' = a) 1 0 = ite (a = a') (p a') 0 := fun a a' => by
- split_ifs <;> try subst a <;> try subst a' <;> simp_all
- ext b <;> simp [this]
+ Pmf.ext fun x =>
+ (bind_apply _ _ _).trans
+ (trans (tsum_eq_single x fun y hy => by rw [pure_apply_of_ne _ _ hy.symm, mul_zero]) <| by
+ rw [pure_apply_self, mul_one])
#align pmf.bind_pure Pmf.bind_pure
+@[simp]
+theorem bind_const (p : Pmf α) (q : Pmf β) : (p.bind fun _ => q) = q :=
+ Pmf.ext fun x => by rw [bind_apply, ENNReal.tsum_mul_right, tsum_coe, one_mul]
+#align pmf.bind_const Pmf.bind_const
+
@[simp]
theorem bind_bind : (p.bind f).bind g = p.bind fun a => (f a).bind g :=
Pmf.ext fun b => by
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -165,12 +165,12 @@ theorem toOuterMeasure_bind_apply :
calc
(p.bind f).toOuterMeasure s = ∑' b, if b ∈ s then ∑' a, p a * f a b else 0 := by
simp [to_outer_measure_apply, Set.indicator_apply]
- _ = ∑' (b) (a), p a * if b ∈ s then f a b else 0 := tsum_congr fun b => by split_ifs <;> simp
+ _ = ∑' (b) (a), p a * if b ∈ s then f a b else 0 := (tsum_congr fun b => by split_ifs <;> simp)
_ = ∑' (a) (b), p a * if b ∈ s then f a b else 0 :=
- tsum_comm' ENNReal.summable (fun _ => ENNReal.summable) fun _ => ENNReal.summable
- _ = ∑' a, p a * ∑' b, if b ∈ s then f a b else 0 := tsum_congr fun a => ENNReal.tsum_mul_left
+ (tsum_comm' ENNReal.summable (fun _ => ENNReal.summable) fun _ => ENNReal.summable)
+ _ = ∑' a, p a * ∑' b, if b ∈ s then f a b else 0 := (tsum_congr fun a => ENNReal.tsum_mul_left)
_ = ∑' a, p a * ∑' b, if b ∈ s then f a b else 0 :=
- tsum_congr fun a => (congr_arg fun x => p a * x) <| tsum_congr fun b => by split_ifs <;> rfl
+ (tsum_congr fun a => (congr_arg fun x => p a * x) <| tsum_congr fun b => by split_ifs <;> rfl)
_ = ∑' a, p a * (f a).toOuterMeasure s :=
tsum_congr fun a => by simp only [to_outer_measure_apply, Set.indicator_apply]
@@ -309,8 +309,8 @@ section Measure
variable (s : Set β)
-/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (a b) -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (b a) -/
@[simp]
theorem toOuterMeasure_bindOnSupport_apply :
(p.bindOnSupport f).toOuterMeasure s =
@@ -324,7 +324,7 @@ theorem toOuterMeasure_bindOnSupport_apply :
_ = ∑' (a) (b), ite (b ∈ s) (p a * dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
ENNReal.tsum_comm
_ = ∑' a, p a * ∑' b, ite (b ∈ s) (dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
- tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, mul_zero]
+ (tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, mul_zero])
_ = ∑' a, p a * dite (p a = 0) (fun h => 0) fun h => ∑' b, ite (b ∈ s) (f a h b) 0 :=
tsum_congr fun a => by split_ifs with ha <;> simp only [if_t_t, tsum_zero, eq_self_iff_true]
mathlib commit https://github.com/leanprover-community/mathlib/commit/eb0cb4511aaef0da2462207b67358a0e1fe1e2ee
@@ -28,7 +28,7 @@ noncomputable section
variable {α β γ : Type _}
-open Classical BigOperators NNReal Ennreal
+open Classical BigOperators NNReal ENNReal
open MeasureTheory
@@ -102,8 +102,8 @@ section Bind
/-- The monadic bind operation for `pmf`. -/
def bind (p : Pmf α) (f : α → Pmf β) : Pmf β :=
⟨fun b => ∑' a, p a * f a b,
- Ennreal.summable.hasSum_iff.2
- (Ennreal.tsum_comm.trans <| by simp only [Ennreal.tsum_mul_left, tsum_coe, mul_one])⟩
+ ENNReal.summable.hasSum_iff.2
+ (ENNReal.tsum_comm.trans <| by simp only [ENNReal.tsum_mul_left, tsum_coe, mul_one])⟩
#align pmf.bind Pmf.bind
variable (p : Pmf α) (f : α → Pmf β) (g : β → Pmf γ)
@@ -115,7 +115,7 @@ theorem bind_apply (b : β) : p.bind f b = ∑' a, p a * f a b :=
@[simp]
theorem support_bind : (p.bind f).support = ⋃ a ∈ p.support, (f a).support :=
- Set.ext fun b => by simp [mem_support_iff, Ennreal.tsum_eq_zero, not_or]
+ Set.ext fun b => by simp [mem_support_iff, ENNReal.tsum_eq_zero, not_or]
#align pmf.support_bind Pmf.support_bind
theorem mem_support_bind_iff (b : β) :
@@ -143,14 +143,14 @@ theorem bind_pure : p.bind pure = p :=
theorem bind_bind : (p.bind f).bind g = p.bind fun a => (f a).bind g :=
Pmf.ext fun b => by
simpa only [ennreal.coe_eq_coe.symm, bind_apply, ennreal.tsum_mul_left.symm,
- ennreal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using Ennreal.tsum_comm
+ ennreal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
#align pmf.bind_bind Pmf.bind_bind
theorem bind_comm (p : Pmf α) (q : Pmf β) (f : α → β → Pmf γ) :
(p.bind fun a => q.bind (f a)) = q.bind fun b => p.bind fun a => f a b :=
Pmf.ext fun b => by
simpa only [ennreal.coe_eq_coe.symm, bind_apply, ennreal.tsum_mul_left.symm,
- ennreal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using Ennreal.tsum_comm
+ ennreal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
#align pmf.bind_comm Pmf.bind_comm
section Measure
@@ -167,8 +167,8 @@ theorem toOuterMeasure_bind_apply :
simp [to_outer_measure_apply, Set.indicator_apply]
_ = ∑' (b) (a), p a * if b ∈ s then f a b else 0 := tsum_congr fun b => by split_ifs <;> simp
_ = ∑' (a) (b), p a * if b ∈ s then f a b else 0 :=
- tsum_comm' Ennreal.summable (fun _ => Ennreal.summable) fun _ => Ennreal.summable
- _ = ∑' a, p a * ∑' b, if b ∈ s then f a b else 0 := tsum_congr fun a => Ennreal.tsum_mul_left
+ tsum_comm' ENNReal.summable (fun _ => ENNReal.summable) fun _ => ENNReal.summable
+ _ = ∑' a, p a * ∑' b, if b ∈ s then f a b else 0 := tsum_congr fun a => ENNReal.tsum_mul_left
_ = ∑' a, p a * ∑' b, if b ∈ s then f a b else 0 :=
tsum_congr fun a => (congr_arg fun x => p a * x) <| tsum_congr fun b => by split_ifs <;> rfl
_ = ∑' a, p a * (f a).toOuterMeasure s :=
@@ -201,10 +201,10 @@ section BindOnSupport
`p.bind f` is equivalent to `p.bind_on_support (λ a _, f a)`, see `bind_on_support_eq_bind` -/
def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
⟨fun b => ∑' a, p a * if h : p a = 0 then 0 else f a h b,
- Ennreal.summable.hasSum_iff.2
+ ENNReal.summable.hasSum_iff.2
(by
refine' ennreal.tsum_comm.trans (trans (tsum_congr fun a => _) p.tsum_coe)
- simp_rw [Ennreal.tsum_mul_left]
+ simp_rw [ENNReal.tsum_mul_left]
split_ifs with h
· simp only [h, zero_mul]
· rw [(f a h).tsum_coe, mul_one])⟩
@@ -223,7 +223,7 @@ theorem support_bindOnSupport :
(p.bindOnSupport f).support = ⋃ (a : α) (h : a ∈ p.support), (f a h).support :=
by
refine' Set.ext fun b => _
- simp only [Ennreal.tsum_eq_zero, not_or, mem_support_iff, bind_on_support_apply, Ne.def,
+ simp only [ENNReal.tsum_eq_zero, not_or, mem_support_iff, bind_on_support_apply, Ne.def,
not_forall, mul_eq_zero, Set.mem_unionᵢ]
exact
⟨fun hb =>
@@ -254,7 +254,7 @@ theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
theorem bindOnSupport_eq_zero_iff (b : β) :
p.bindOnSupport f b = 0 ↔ ∀ (a) (ha : p a ≠ 0), f a ha b = 0 :=
by
- simp only [bind_on_support_apply, Ennreal.tsum_eq_zero, mul_eq_zero, or_iff_not_imp_left]
+ simp only [bind_on_support_apply, ENNReal.tsum_eq_zero, mul_eq_zero, or_iff_not_imp_left]
exact ⟨fun h a ha => trans (dif_neg ha).symm (h a ha), fun h a ha => trans (dif_neg ha) (h a ha)⟩
#align pmf.bind_on_support_eq_zero_iff Pmf.bindOnSupport_eq_zero_iff
@@ -283,7 +283,7 @@ theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf
refine' Pmf.ext fun a => _
simp only [ennreal.coe_eq_coe.symm, bind_on_support_apply, ← tsum_dite_right,
ennreal.tsum_mul_left.symm, ennreal.tsum_mul_right.symm]
- simp only [Ennreal.tsum_eq_zero, Ennreal.coe_eq_coe, Ennreal.coe_eq_zero, Ennreal.coe_zero,
+ simp only [ENNReal.tsum_eq_zero, ENNReal.coe_eq_coe, ENNReal.coe_eq_zero, ENNReal.coe_zero,
dite_eq_left_iff, mul_eq_zero]
refine' ennreal.tsum_comm.trans (tsum_congr fun a' => tsum_congr fun b => _)
split_ifs
@@ -301,7 +301,7 @@ theorem bindOnSupport_comm (p : Pmf α) (q : Pmf β) (f : ∀ a ∈ p.support,
apply Pmf.ext; rintro c
simp only [ennreal.coe_eq_coe.symm, bind_on_support_apply, ← tsum_dite_right,
ennreal.tsum_mul_left.symm, ennreal.tsum_mul_right.symm]
- refine' trans Ennreal.tsum_comm (tsum_congr fun b => tsum_congr fun a => _)
+ refine' trans ENNReal.tsum_comm (tsum_congr fun b => tsum_congr fun a => _)
split_ifs with h1 h2 h2 <;> ring
#align pmf.bind_on_support_comm Pmf.bindOnSupport_comm
@@ -322,9 +322,9 @@ theorem toOuterMeasure_bindOnSupport_apply :
∑' (b) (a), ite (b ∈ s) (p a * dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
tsum_congr fun b => by split_ifs with hbs <;> simp only [eq_self_iff_true, tsum_zero]
_ = ∑' (a) (b), ite (b ∈ s) (p a * dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
- Ennreal.tsum_comm
+ ENNReal.tsum_comm
_ = ∑' a, p a * ∑' b, ite (b ∈ s) (dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
- tsum_congr fun a => by simp only [← Ennreal.tsum_mul_left, mul_ite, mul_zero]
+ tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, mul_zero]
_ = ∑' a, p a * dite (p a = 0) (fun h => 0) fun h => ∑' b, ite (b ∈ s) (f a h b) 0 :=
tsum_congr fun a => by split_ifs with ha <;> simp only [if_t_t, tsum_zero, eq_self_iff_true]
mathlib commit https://github.com/leanprover-community/mathlib/commit/c23aca359d4be6975b2a577d5cdb9d77b82c7407
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Devon Tuma
! This file was ported from Lean 3 source module probability.probability_mass_function.monad
-! leanprover-community/mathlib commit feb165c980c918bb296fede8c3b21dbb4b85bb56
+! leanprover-community/mathlib commit 3f5c9d30716c775bda043456728a1a3ee31412e7
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -30,6 +30,8 @@ variable {α β γ : Type _}
open Classical BigOperators NNReal Ennreal
+open MeasureTheory
+
namespace Pmf
section Pure
@@ -73,13 +75,24 @@ theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then
exact ite_eq_right_iff.2 fun hb => ite_eq_right_iff.2 fun h => (ha <| h ▸ hb).elim
#align pmf.to_outer_measure_pure_apply Pmf.toOuterMeasure_pure_apply
+variable [MeasurableSpace α]
+
/-- The measure of a set under `pure a` is `1` for sets containing `a` and `0` otherwise -/
@[simp]
-theorem toMeasure_pure_apply [MeasurableSpace α] (hs : MeasurableSet s) :
+theorem toMeasure_pure_apply (hs : MeasurableSet s) :
(pure a).toMeasure s = if a ∈ s then 1 else 0 :=
(toMeasure_apply_eq_toOuterMeasure_apply (pure a) s hs).trans (toOuterMeasure_pure_apply a s)
#align pmf.to_measure_pure_apply Pmf.toMeasure_pure_apply
+theorem toMeasure_pure : (pure a).toMeasure = Measure.dirac a :=
+ Measure.ext fun s hs => by simpa only [to_measure_pure_apply a s hs, measure.dirac_apply' a hs]
+#align pmf.to_measure_pure Pmf.toMeasure_pure
+
+@[simp]
+theorem toPmf_dirac [Countable α] [h : MeasurableSingletonClass α] :
+ (Measure.dirac a).toPmf = pure a := by rw [to_pmf_eq_iff_to_measure_eq, to_measure_pure]
+#align pmf.to_pmf_dirac Pmf.toPmf_dirac
+
end Measure
end Pure
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -172,10 +172,10 @@ theorem toOuterMeasure_bind_apply :
calc
(p.bind f).toOuterMeasure s = ∑' b, if b ∈ s then ∑' a, p a * f a b else 0 := by
simp [toOuterMeasure_apply, Set.indicator_apply]
- _ = ∑' (b) (a), p a * if b ∈ s then f a b else 0 := (tsum_congr fun b => by split_ifs <;> simp)
+ _ = ∑' (b) (a), p a * if b ∈ s then f a b else 0 := tsum_congr fun b => by split_ifs <;> simp
_ = ∑' (a) (b), p a * if b ∈ s then f a b else 0 :=
(tsum_comm' ENNReal.summable (fun _ => ENNReal.summable) fun _ => ENNReal.summable)
- _ = ∑' a, p a * ∑' b, if b ∈ s then f a b else 0 := (tsum_congr fun a => ENNReal.tsum_mul_left)
+ _ = ∑' a, p a * ∑' b, if b ∈ s then f a b else 0 := tsum_congr fun a => ENNReal.tsum_mul_left
_ = ∑' a, p a * ∑' b, if b ∈ s then f a b else 0 :=
(tsum_congr fun a => (congr_arg fun x => p a * x) <| tsum_congr fun b => by split_ifs <;> rfl)
_ = ∑' a, p a * (f a).toOuterMeasure s :=
@@ -225,7 +225,7 @@ theorem bindOnSupport_apply (b : β) :
theorem support_bindOnSupport :
(p.bindOnSupport f).support = ⋃ (a : α) (h : a ∈ p.support), (f a h).support := by
refine' Set.ext fun b => _
- simp only [ENNReal.tsum_eq_zero, not_or, mem_support_iff, bindOnSupport_apply, Ne.def, not_forall,
+ simp only [ENNReal.tsum_eq_zero, not_or, mem_support_iff, bindOnSupport_apply, Ne, not_forall,
mul_eq_zero, Set.mem_iUnion]
exact
⟨fun hb =>
open Classical
(#11199)
We remove all but one open Classical
s, instead preferring to use open scoped Classical
. The only real side-effect this led to is moving a couple declarations to use Exists.choose
instead of Classical.choose
.
The first few commits are explicitly labelled regex replaces for ease of review.
@@ -25,7 +25,8 @@ noncomputable section
variable {α β γ : Type*}
-open Classical BigOperators NNReal ENNReal
+open scoped Classical
+open BigOperators NNReal ENNReal
open MeasureTheory
@@ -53,7 +53,7 @@ theorem support_pure : (pure a).support = {a} :=
theorem mem_support_pure_iff : a' ∈ (pure a).support ↔ a' = a := by simp
#align pmf.mem_support_pure_iff PMF.mem_support_pure_iff
--- @[simp] -- Porting note: simp can prove this
+-- @[simp] -- Porting note (#10618): simp can prove this
theorem pure_apply_self : pure a a = 1 :=
if_pos rfl
#align pmf.pure_apply_self PMF.pure_apply_self
ℝ≥0 → ℝ≥0∞
commute defeqly with nsmul
and pow
(#10225)
by tweaking the definition of the AddMonoid
and MonoidWithZero
instances for WithTop
. Also unprotect ENNReal.coe_injective
and rename ENNReal.coe_eq_coe → ENNReal.coe_inj
.
From LeanAPAP
@@ -150,14 +150,14 @@ theorem bind_const (p : PMF α) (q : PMF β) : (p.bind fun _ => q) = q :=
@[simp]
theorem bind_bind : (p.bind f).bind g = p.bind fun a => (f a).bind g :=
PMF.ext fun b => by
- simpa only [ENNReal.coe_eq_coe.symm, bind_apply, ENNReal.tsum_mul_left.symm,
+ simpa only [ENNReal.coe_inj.symm, bind_apply, ENNReal.tsum_mul_left.symm,
ENNReal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
#align pmf.bind_bind PMF.bind_bind
theorem bind_comm (p : PMF α) (q : PMF β) (f : α → β → PMF γ) :
(p.bind fun a => q.bind (f a)) = q.bind fun b => p.bind fun a => f a b :=
PMF.ext fun b => by
- simpa only [ENNReal.coe_eq_coe.symm, bind_apply, ENNReal.tsum_mul_left.symm,
+ simpa only [ENNReal.coe_inj.symm, bind_apply, ENNReal.tsum_mul_left.symm,
ENNReal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
#align pmf.bind_comm PMF.bind_comm
@@ -295,7 +295,7 @@ theorem bindOnSupport_comm (p : PMF α) (q : PMF β) (f : ∀ a ∈ p.support,
(p.bindOnSupport fun a ha => q.bindOnSupport (f a ha)) =
q.bindOnSupport fun b hb => p.bindOnSupport fun a ha => f a ha b hb := by
apply PMF.ext; rintro c
- simp only [ENNReal.coe_eq_coe.symm, bindOnSupport_apply, ← tsum_dite_right,
+ simp only [ENNReal.coe_inj.symm, bindOnSupport_apply, ← tsum_dite_right,
ENNReal.tsum_mul_left.symm, ENNReal.tsum_mul_right.symm]
refine' _root_.trans ENNReal.tsum_comm (tsum_congr fun b => tsum_congr fun a => _)
split_ifs with h1 h2 h2 <;> ring
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
@@ -286,7 +286,7 @@ theorem bindOnSupport_bindOnSupport (p : PMF α) (f : ∀ a ∈ p.support, PMF
split_ifs with h _ h_1 _ h_2
any_goals ring1
· have := h_1 a'
- simp? [h] at this says simp only [h, dite_false, mul_eq_zero, false_or] at this
+ simp? [h] at this says simp only [h, ↓reduceDite, mul_eq_zero, false_or] at this
contradiction
· simp [h_2]
#align pmf.bind_on_support_bind_on_support PMF.bindOnSupport_bindOnSupport
@@ -286,7 +286,7 @@ theorem bindOnSupport_bindOnSupport (p : PMF α) (f : ∀ a ∈ p.support, PMF
split_ifs with h _ h_1 _ h_2
any_goals ring1
· have := h_1 a'
- simp [h] at this
+ simp? [h] at this says simp only [h, dite_false, mul_eq_zero, false_or] at this
contradiction
· simp [h_2]
#align pmf.bind_on_support_bind_on_support PMF.bindOnSupport_bindOnSupport
@@ -130,7 +130,7 @@ theorem mem_support_bind_iff (b : β) :
@[simp]
theorem pure_bind (a : α) (f : α → PMF β) : (pure a).bind f = f a := by
have : ∀ b a', ite (a' = a) (f a' b) 0 = ite (a' = a) (f a b) 0 := fun b a' => by
- split_ifs with h <;> simp; subst h; simp
+ split_ifs with h <;> simp [h]
ext b
simp [this]
#align pmf.pure_bind PMF.pure_bind
@@ -10,10 +10,10 @@ import Mathlib.Probability.ProbabilityMassFunction.Basic
/-!
# Monad Operations for Probability Mass Functions
-This file constructs two operations on `Pmf` that give it a monad structure.
+This file constructs two operations on `PMF` that give it a monad structure.
`pure a` is the distribution where a single value `a` has probability `1`.
-`bind pa pb : Pmf β` is the distribution given by sampling `a : α` from `pa : Pmf α`,
-and then sampling from `pb a : Pmf β` to get a final result `b : β`.
+`bind pa pb : PMF β` is the distribution given by sampling `a : α` from `pa : PMF α`,
+and then sampling from `pb a : PMF β` to get a final result `b : β`.
`bindOnSupport` generalizes `bind` to allow binding to a partial function,
so that the second argument only needs to be defined on the support of the first argument.
@@ -29,40 +29,40 @@ open Classical BigOperators NNReal ENNReal
open MeasureTheory
-namespace Pmf
+namespace PMF
section Pure
-/-- The pure `Pmf` is the `Pmf` where all the mass lies in one point.
+/-- The pure `PMF` is the `PMF` where all the mass lies in one point.
The value of `pure a` is `1` at `a` and `0` elsewhere. -/
-def pure (a : α) : Pmf α :=
+def pure (a : α) : PMF α :=
⟨fun a' => if a' = a then 1 else 0, hasSum_ite_eq _ _⟩
-#align pmf.pure Pmf.pure
+#align pmf.pure PMF.pure
variable (a a' : α)
@[simp]
theorem pure_apply : pure a a' = if a' = a then 1 else 0 := rfl
-#align pmf.pure_apply Pmf.pure_apply
+#align pmf.pure_apply PMF.pure_apply
@[simp]
theorem support_pure : (pure a).support = {a} :=
Set.ext fun a' => by simp [mem_support_iff]
-#align pmf.support_pure Pmf.support_pure
+#align pmf.support_pure PMF.support_pure
theorem mem_support_pure_iff : a' ∈ (pure a).support ↔ a' = a := by simp
-#align pmf.mem_support_pure_iff Pmf.mem_support_pure_iff
+#align pmf.mem_support_pure_iff PMF.mem_support_pure_iff
-- @[simp] -- Porting note: simp can prove this
theorem pure_apply_self : pure a a = 1 :=
if_pos rfl
-#align pmf.pure_apply_self Pmf.pure_apply_self
+#align pmf.pure_apply_self PMF.pure_apply_self
theorem pure_apply_of_ne (h : a' ≠ a) : pure a a' = 0 :=
if_neg h
-#align pmf.pure_apply_of_ne Pmf.pure_apply_of_ne
+#align pmf.pure_apply_of_ne PMF.pure_apply_of_ne
-instance [Inhabited α] : Inhabited (Pmf α) :=
+instance [Inhabited α] : Inhabited (PMF α) :=
⟨pure default⟩
section Measure
@@ -77,7 +77,7 @@ theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then
exact ite_eq_left_iff.2 fun hb => symm (ite_eq_right_iff.2 fun h => (hb <| h.symm ▸ ha).elim)
· refine' (tsum_congr fun b => _).trans tsum_zero
exact ite_eq_right_iff.2 fun hb => ite_eq_right_iff.2 fun h => (ha <| h ▸ hb).elim
-#align pmf.to_outer_measure_pure_apply Pmf.toOuterMeasure_pure_apply
+#align pmf.to_outer_measure_pure_apply PMF.toOuterMeasure_pure_apply
variable [MeasurableSpace α]
@@ -86,17 +86,17 @@ variable [MeasurableSpace α]
theorem toMeasure_pure_apply (hs : MeasurableSet s) :
(pure a).toMeasure s = if a ∈ s then 1 else 0 :=
(toMeasure_apply_eq_toOuterMeasure_apply (pure a) s hs).trans (toOuterMeasure_pure_apply a s)
-#align pmf.to_measure_pure_apply Pmf.toMeasure_pure_apply
+#align pmf.to_measure_pure_apply PMF.toMeasure_pure_apply
theorem toMeasure_pure : (pure a).toMeasure = Measure.dirac a :=
Measure.ext fun s hs => by rw [toMeasure_pure_apply a s hs, Measure.dirac_apply' a hs]; rfl
-#align pmf.to_measure_pure Pmf.toMeasure_pure
+#align pmf.to_measure_pure PMF.toMeasure_pure
@[simp]
-theorem toPmf_dirac [Countable α] [h : MeasurableSingletonClass α] :
- (Measure.dirac a).toPmf = pure a := by
- rw [toPmf_eq_iff_toMeasure_eq, toMeasure_pure]
-#align pmf.to_pmf_dirac Pmf.toPmf_dirac
+theorem toPMF_dirac [Countable α] [h : MeasurableSingletonClass α] :
+ (Measure.dirac a).toPMF = pure a := by
+ rw [toPMF_eq_iff_toMeasure_eq, toMeasure_pure]
+#align pmf.to_pmf_dirac PMF.toPMF_dirac
end Measure
@@ -104,62 +104,62 @@ end Pure
section Bind
-/-- The monadic bind operation for `Pmf`. -/
-def bind (p : Pmf α) (f : α → Pmf β) : Pmf β :=
+/-- The monadic bind operation for `PMF`. -/
+def bind (p : PMF α) (f : α → PMF β) : PMF β :=
⟨fun b => ∑' a, p a * f a b,
ENNReal.summable.hasSum_iff.2
(ENNReal.tsum_comm.trans <| by simp only [ENNReal.tsum_mul_left, tsum_coe, mul_one])⟩
-#align pmf.bind Pmf.bind
+#align pmf.bind PMF.bind
-variable (p : Pmf α) (f : α → Pmf β) (g : β → Pmf γ)
+variable (p : PMF α) (f : α → PMF β) (g : β → PMF γ)
@[simp]
theorem bind_apply (b : β) : p.bind f b = ∑' a, p a * f a b := rfl
-#align pmf.bind_apply Pmf.bind_apply
+#align pmf.bind_apply PMF.bind_apply
@[simp]
theorem support_bind : (p.bind f).support = ⋃ a ∈ p.support, (f a).support :=
Set.ext fun b => by simp [mem_support_iff, ENNReal.tsum_eq_zero, not_or]
-#align pmf.support_bind Pmf.support_bind
+#align pmf.support_bind PMF.support_bind
theorem mem_support_bind_iff (b : β) :
b ∈ (p.bind f).support ↔ ∃ a ∈ p.support, b ∈ (f a).support := by
simp only [support_bind, Set.mem_iUnion, Set.mem_setOf_eq, exists_prop]
-#align pmf.mem_support_bind_iff Pmf.mem_support_bind_iff
+#align pmf.mem_support_bind_iff PMF.mem_support_bind_iff
@[simp]
-theorem pure_bind (a : α) (f : α → Pmf β) : (pure a).bind f = f a := by
+theorem pure_bind (a : α) (f : α → PMF β) : (pure a).bind f = f a := by
have : ∀ b a', ite (a' = a) (f a' b) 0 = ite (a' = a) (f a b) 0 := fun b a' => by
split_ifs with h <;> simp; subst h; simp
ext b
simp [this]
-#align pmf.pure_bind Pmf.pure_bind
+#align pmf.pure_bind PMF.pure_bind
@[simp]
theorem bind_pure : p.bind pure = p :=
- Pmf.ext fun x => (bind_apply _ _ _).trans (_root_.trans
+ PMF.ext fun x => (bind_apply _ _ _).trans (_root_.trans
(tsum_eq_single x fun y hy => by rw [pure_apply_of_ne _ _ hy.symm, mul_zero]) <|
by rw [pure_apply_self, mul_one])
-#align pmf.bind_pure Pmf.bind_pure
+#align pmf.bind_pure PMF.bind_pure
@[simp]
-theorem bind_const (p : Pmf α) (q : Pmf β) : (p.bind fun _ => q) = q :=
- Pmf.ext fun x => by rw [bind_apply, ENNReal.tsum_mul_right, tsum_coe, one_mul]
-#align pmf.bind_const Pmf.bind_const
+theorem bind_const (p : PMF α) (q : PMF β) : (p.bind fun _ => q) = q :=
+ PMF.ext fun x => by rw [bind_apply, ENNReal.tsum_mul_right, tsum_coe, one_mul]
+#align pmf.bind_const PMF.bind_const
@[simp]
theorem bind_bind : (p.bind f).bind g = p.bind fun a => (f a).bind g :=
- Pmf.ext fun b => by
+ PMF.ext fun b => by
simpa only [ENNReal.coe_eq_coe.symm, bind_apply, ENNReal.tsum_mul_left.symm,
ENNReal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
-#align pmf.bind_bind Pmf.bind_bind
+#align pmf.bind_bind PMF.bind_bind
-theorem bind_comm (p : Pmf α) (q : Pmf β) (f : α → β → Pmf γ) :
+theorem bind_comm (p : PMF α) (q : PMF β) (f : α → β → PMF γ) :
(p.bind fun a => q.bind (f a)) = q.bind fun b => p.bind fun a => f a b :=
- Pmf.ext fun b => by
+ PMF.ext fun b => by
simpa only [ENNReal.coe_eq_coe.symm, bind_apply, ENNReal.tsum_mul_left.symm,
ENNReal.tsum_mul_right.symm, mul_assoc, mul_left_comm, mul_comm] using ENNReal.tsum_comm
-#align pmf.bind_comm Pmf.bind_comm
+#align pmf.bind_comm PMF.bind_comm
section Measure
@@ -179,7 +179,7 @@ theorem toOuterMeasure_bind_apply :
(tsum_congr fun a => (congr_arg fun x => p a * x) <| tsum_congr fun b => by split_ifs <;> rfl)
_ = ∑' a, p a * (f a).toOuterMeasure s :=
tsum_congr fun a => by simp only [toOuterMeasure_apply, Set.indicator_apply]
-#align pmf.to_outer_measure_bind_apply Pmf.toOuterMeasure_bind_apply
+#align pmf.to_outer_measure_bind_apply PMF.toOuterMeasure_bind_apply
/-- The measure of a set under `p.bind f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a`. -/
@@ -190,13 +190,13 @@ theorem toMeasure_bind_apply [MeasurableSpace β] (hs : MeasurableSet s) :
((toOuterMeasure_bind_apply p f s).trans
(tsum_congr fun a =>
congr_arg (fun x => p a * x) (toMeasure_apply_eq_toOuterMeasure_apply (f a) s hs).symm))
-#align pmf.to_measure_bind_apply Pmf.toMeasure_bind_apply
+#align pmf.to_measure_bind_apply PMF.toMeasure_bind_apply
end Measure
end Bind
-instance : Monad Pmf where
+instance : Monad PMF where
pure a := pure a
bind pa pb := pa.bind pb
@@ -204,21 +204,21 @@ section BindOnSupport
/-- Generalized version of `bind` allowing `f` to only be defined on the support of `p`.
`p.bind f` is equivalent to `p.bindOnSupport (fun a _ ↦ f a)`, see `bindOnSupport_eq_bind`. -/
-def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
+def bindOnSupport (p : PMF α) (f : ∀ a ∈ p.support, PMF β) : PMF β :=
⟨fun b => ∑' a, p a * if h : p a = 0 then 0 else f a h b, ENNReal.summable.hasSum_iff.2 (by
refine' ENNReal.tsum_comm.trans (_root_.trans (tsum_congr fun a => _) p.tsum_coe)
simp_rw [ENNReal.tsum_mul_left]
split_ifs with h
· simp only [h, zero_mul]
· rw [(f a h).tsum_coe, mul_one])⟩
-#align pmf.bind_on_support Pmf.bindOnSupport
+#align pmf.bind_on_support PMF.bindOnSupport
-variable {p : Pmf α} (f : ∀ a ∈ p.support, Pmf β)
+variable {p : PMF α} (f : ∀ a ∈ p.support, PMF β)
@[simp]
theorem bindOnSupport_apply (b : β) :
p.bindOnSupport f b = ∑' a, p a * if h : p a = 0 then 0 else f a h b := rfl
-#align pmf.bind_on_support_apply Pmf.bindOnSupport_apply
+#align pmf.bind_on_support_apply PMF.bindOnSupport_apply
@[simp]
theorem support_bindOnSupport :
@@ -233,52 +233,52 @@ theorem support_bindOnSupport :
fun hb =>
let ⟨a, ha, ha'⟩ := hb
⟨a, ⟨ha, by simpa [(mem_support_iff _ a).1 ha] using ha'⟩⟩⟩
-#align pmf.support_bind_on_support Pmf.support_bindOnSupport
+#align pmf.support_bind_on_support PMF.support_bindOnSupport
theorem mem_support_bindOnSupport_iff (b : β) :
b ∈ (p.bindOnSupport f).support ↔ ∃ (a : α) (h : a ∈ p.support), b ∈ (f a h).support := by
simp only [support_bindOnSupport, Set.mem_setOf_eq, Set.mem_iUnion]
-#align pmf.mem_support_bind_on_support_iff Pmf.mem_support_bindOnSupport_iff
+#align pmf.mem_support_bind_on_support_iff PMF.mem_support_bindOnSupport_iff
/-- `bindOnSupport` reduces to `bind` if `f` doesn't depend on the additional hypothesis. -/
@[simp]
-theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
+theorem bindOnSupport_eq_bind (p : PMF α) (f : α → PMF β) :
(p.bindOnSupport fun a _ => f a) = p.bind f := by
ext b
have : ∀ a, ite (p a = 0) 0 (p a * f a b) = p a * f a b :=
fun a => ite_eq_right_iff.2 fun h => h.symm ▸ symm (zero_mul <| f a b)
simp only [bindOnSupport_apply fun a _ => f a, p.bind_apply f, dite_eq_ite, mul_ite,
mul_zero, this]
-#align pmf.bind_on_support_eq_bind Pmf.bindOnSupport_eq_bind
+#align pmf.bind_on_support_eq_bind PMF.bindOnSupport_eq_bind
theorem bindOnSupport_eq_zero_iff (b : β) :
p.bindOnSupport f b = 0 ↔ ∀ (a) (ha : p a ≠ 0), f a ha b = 0 := by
simp only [bindOnSupport_apply, ENNReal.tsum_eq_zero, mul_eq_zero, or_iff_not_imp_left]
exact ⟨fun h a ha => Trans.trans (dif_neg ha).symm (h a ha),
fun h a ha => Trans.trans (dif_neg ha) (h a ha)⟩
-#align pmf.bind_on_support_eq_zero_iff Pmf.bindOnSupport_eq_zero_iff
+#align pmf.bind_on_support_eq_zero_iff PMF.bindOnSupport_eq_zero_iff
@[simp]
-theorem pure_bindOnSupport (a : α) (f : ∀ (a' : α) (_ : a' ∈ (pure a).support), Pmf β) :
+theorem pure_bindOnSupport (a : α) (f : ∀ (a' : α) (_ : a' ∈ (pure a).support), PMF β) :
(pure a).bindOnSupport f = f a ((mem_support_pure_iff a a).mpr rfl) := by
- refine' Pmf.ext fun b => _
+ refine' PMF.ext fun b => _
simp only [bindOnSupport_apply, pure_apply]
refine' _root_.trans (tsum_congr fun a' => _) (tsum_ite_eq a _)
by_cases h : a' = a <;> simp [h]
-#align pmf.pure_bind_on_support Pmf.pure_bindOnSupport
+#align pmf.pure_bind_on_support PMF.pure_bindOnSupport
-theorem bindOnSupport_pure (p : Pmf α) : (p.bindOnSupport fun a _ => pure a) = p := by
- simp only [Pmf.bind_pure, Pmf.bindOnSupport_eq_bind]
-#align pmf.bind_on_support_pure Pmf.bindOnSupport_pure
+theorem bindOnSupport_pure (p : PMF α) : (p.bindOnSupport fun a _ => pure a) = p := by
+ simp only [PMF.bind_pure, PMF.bindOnSupport_eq_bind]
+#align pmf.bind_on_support_pure PMF.bindOnSupport_pure
@[simp]
-theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β)
- (g : ∀ b ∈ (p.bindOnSupport f).support, Pmf γ) :
+theorem bindOnSupport_bindOnSupport (p : PMF α) (f : ∀ a ∈ p.support, PMF β)
+ (g : ∀ b ∈ (p.bindOnSupport f).support, PMF γ) :
(p.bindOnSupport f).bindOnSupport g =
p.bindOnSupport fun a ha =>
(f a ha).bindOnSupport fun b hb =>
g b ((mem_support_bindOnSupport_iff f b).mpr ⟨a, ha, hb⟩) := by
- refine' Pmf.ext fun a => _
+ refine' PMF.ext fun a => _
dsimp only [bindOnSupport_apply]
simp only [← tsum_dite_right, ENNReal.tsum_mul_left.symm, ENNReal.tsum_mul_right.symm]
simp only [ENNReal.tsum_eq_zero, dite_eq_left_iff]
@@ -289,17 +289,17 @@ theorem bindOnSupport_bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf
simp [h] at this
contradiction
· simp [h_2]
-#align pmf.bind_on_support_bind_on_support Pmf.bindOnSupport_bindOnSupport
+#align pmf.bind_on_support_bind_on_support PMF.bindOnSupport_bindOnSupport
-theorem bindOnSupport_comm (p : Pmf α) (q : Pmf β) (f : ∀ a ∈ p.support, ∀ b ∈ q.support, Pmf γ) :
+theorem bindOnSupport_comm (p : PMF α) (q : PMF β) (f : ∀ a ∈ p.support, ∀ b ∈ q.support, PMF γ) :
(p.bindOnSupport fun a ha => q.bindOnSupport (f a ha)) =
q.bindOnSupport fun b hb => p.bindOnSupport fun a ha => f a ha b hb := by
- apply Pmf.ext; rintro c
+ apply PMF.ext; rintro c
simp only [ENNReal.coe_eq_coe.symm, bindOnSupport_apply, ← tsum_dite_right,
ENNReal.tsum_mul_left.symm, ENNReal.tsum_mul_right.symm]
refine' _root_.trans ENNReal.tsum_comm (tsum_congr fun b => tsum_congr fun a => _)
split_ifs with h1 h2 h2 <;> ring
-#align pmf.bind_on_support_comm Pmf.bindOnSupport_comm
+#align pmf.bind_on_support_comm PMF.bindOnSupport_comm
section Measure
@@ -320,7 +320,7 @@ theorem toOuterMeasure_bindOnSupport_apply :
(tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, mul_zero])
_ = ∑' a, p a * dite (p a = 0) (fun h => 0) fun h => ∑' b, ite (b ∈ s) (f a h b) 0 :=
tsum_congr fun a => by split_ifs with ha <;> simp only [ite_self, tsum_zero, eq_self_iff_true]
-#align pmf.to_outer_measure_bind_on_support_apply Pmf.toOuterMeasure_bindOnSupport_apply
+#align pmf.to_outer_measure_bind_on_support_apply PMF.toOuterMeasure_bindOnSupport_apply
/-- The measure of a set under `p.bindOnSupport f` is the sum over `a : α`
of the probability of `a` under `p` times the measure of the set under `f a _`.
@@ -330,10 +330,10 @@ theorem toMeasure_bindOnSupport_apply [MeasurableSpace β] (hs : MeasurableSet s
(p.bindOnSupport f).toMeasure s =
∑' a, p a * if h : p a = 0 then 0 else (f a h).toMeasure s := by
simp only [toMeasure_apply_eq_toOuterMeasure_apply _ _ hs, toOuterMeasure_bindOnSupport_apply]
-#align pmf.to_measure_bind_on_support_apply Pmf.toMeasure_bindOnSupport_apply
+#align pmf.to_measure_bind_on_support_apply PMF.toMeasure_bindOnSupport_apply
end Measure
end BindOnSupport
-end Pmf
+end PMF
MulZeroClass.
in mul_zero
/zero_mul
(#6682)
Search&replace MulZeroClass.mul_zero
-> mul_zero
, MulZeroClass.zero_mul
-> zero_mul
.
These were introduced by Mathport, as the full name of mul_zero
is actually MulZeroClass.mul_zero
(it's exported with the short name).
@@ -138,7 +138,7 @@ theorem pure_bind (a : α) (f : α → Pmf β) : (pure a).bind f = f a := by
@[simp]
theorem bind_pure : p.bind pure = p :=
Pmf.ext fun x => (bind_apply _ _ _).trans (_root_.trans
- (tsum_eq_single x fun y hy => by rw [pure_apply_of_ne _ _ hy.symm, MulZeroClass.mul_zero]) <|
+ (tsum_eq_single x fun y hy => by rw [pure_apply_of_ne _ _ hy.symm, mul_zero]) <|
by rw [pure_apply_self, mul_one])
#align pmf.bind_pure Pmf.bind_pure
@@ -209,7 +209,7 @@ def bindOnSupport (p : Pmf α) (f : ∀ a ∈ p.support, Pmf β) : Pmf β :=
refine' ENNReal.tsum_comm.trans (_root_.trans (tsum_congr fun a => _) p.tsum_coe)
simp_rw [ENNReal.tsum_mul_left]
split_ifs with h
- · simp only [h, MulZeroClass.zero_mul]
+ · simp only [h, zero_mul]
· rw [(f a h).tsum_coe, mul_one])⟩
#align pmf.bind_on_support Pmf.bindOnSupport
@@ -246,9 +246,9 @@ theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
(p.bindOnSupport fun a _ => f a) = p.bind f := by
ext b
have : ∀ a, ite (p a = 0) 0 (p a * f a b) = p a * f a b :=
- fun a => ite_eq_right_iff.2 fun h => h.symm ▸ symm (MulZeroClass.zero_mul <| f a b)
+ fun a => ite_eq_right_iff.2 fun h => h.symm ▸ symm (zero_mul <| f a b)
simp only [bindOnSupport_apply fun a _ => f a, p.bind_apply f, dite_eq_ite, mul_ite,
- MulZeroClass.mul_zero, this]
+ mul_zero, this]
#align pmf.bind_on_support_eq_bind Pmf.bindOnSupport_eq_bind
theorem bindOnSupport_eq_zero_iff (b : β) :
@@ -317,7 +317,7 @@ theorem toOuterMeasure_bindOnSupport_apply :
_ = ∑' (a) (b), ite (b ∈ s) (p a * dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
ENNReal.tsum_comm
_ = ∑' a, p a * ∑' b, ite (b ∈ s) (dite (p a = 0) (fun h => 0) fun h => f a h b) 0 :=
- (tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, MulZeroClass.mul_zero])
+ (tsum_congr fun a => by simp only [← ENNReal.tsum_mul_left, mul_ite, mul_zero])
_ = ∑' a, p a * dite (p a = 0) (fun h => 0) fun h => ∑' b, ite (b ∈ s) (f a h b) 0 :=
tsum_congr fun a => by split_ifs with ha <;> simp only [ite_self, tsum_zero, eq_self_iff_true]
#align pmf.to_outer_measure_bind_on_support_apply Pmf.toOuterMeasure_bindOnSupport_apply
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -23,7 +23,7 @@ so that the second argument only needs to be defined on the support of the first
noncomputable section
-variable {α β γ : Type _}
+variable {α β γ : Type*}
open Classical BigOperators NNReal ENNReal
@@ -2,14 +2,11 @@
Copyright (c) 2020 Devon Tuma. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Devon Tuma
-
-! This file was ported from Lean 3 source module probability.probability_mass_function.monad
-! leanprover-community/mathlib commit 4ac69b290818724c159de091daa3acd31da0ee6d
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Probability.ProbabilityMassFunction.Basic
+#align_import probability.probability_mass_function.monad from "leanprover-community/mathlib"@"4ac69b290818724c159de091daa3acd31da0ee6d"
+
/-!
# Monad Operations for Probability Mass Functions
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Alex J Best <alex.j.best@gmail.com>
@@ -247,7 +247,7 @@ theorem mem_support_bindOnSupport_iff (b : β) :
@[simp]
theorem bindOnSupport_eq_bind (p : Pmf α) (f : α → Pmf β) :
(p.bindOnSupport fun a _ => f a) = p.bind f := by
- ext (b x)
+ ext b
have : ∀ a, ite (p a = 0) 0 (p a * f a b) = p a * f a b :=
fun a => ite_eq_right_iff.2 fun h => h.symm ▸ symm (MulZeroClass.zero_mul <| f a b)
simp only [bindOnSupport_apply fun a _ => f a, p.bind_apply f, dite_eq_ite, mul_ite,
sSup
/iSup
(#3938)
As discussed on Zulip
supₛ
→ sSup
infₛ
→ sInf
supᵢ
→ iSup
infᵢ
→ iInf
bsupₛ
→ bsSup
binfₛ
→ bsInf
bsupᵢ
→ biSup
binfᵢ
→ biInf
csupₛ
→ csSup
cinfₛ
→ csInf
csupᵢ
→ ciSup
cinfᵢ
→ ciInf
unionₛ
→ sUnion
interₛ
→ sInter
unionᵢ
→ iUnion
interᵢ
→ iInter
bunionₛ
→ bsUnion
binterₛ
→ bsInter
bunionᵢ
→ biUnion
binterᵢ
→ biInter
Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
@@ -127,7 +127,7 @@ theorem support_bind : (p.bind f).support = ⋃ a ∈ p.support, (f a).support :
theorem mem_support_bind_iff (b : β) :
b ∈ (p.bind f).support ↔ ∃ a ∈ p.support, b ∈ (f a).support := by
- simp only [support_bind, Set.mem_unionᵢ, Set.mem_setOf_eq, exists_prop]
+ simp only [support_bind, Set.mem_iUnion, Set.mem_setOf_eq, exists_prop]
#align pmf.mem_support_bind_iff Pmf.mem_support_bind_iff
@[simp]
@@ -228,7 +228,7 @@ theorem support_bindOnSupport :
(p.bindOnSupport f).support = ⋃ (a : α) (h : a ∈ p.support), (f a h).support := by
refine' Set.ext fun b => _
simp only [ENNReal.tsum_eq_zero, not_or, mem_support_iff, bindOnSupport_apply, Ne.def, not_forall,
- mul_eq_zero, Set.mem_unionᵢ]
+ mul_eq_zero, Set.mem_iUnion]
exact
⟨fun hb =>
let ⟨a, ⟨ha, ha'⟩⟩ := hb
@@ -240,7 +240,7 @@ theorem support_bindOnSupport :
theorem mem_support_bindOnSupport_iff (b : β) :
b ∈ (p.bindOnSupport f).support ↔ ∃ (a : α) (h : a ∈ p.support), b ∈ (f a h).support := by
- simp only [support_bindOnSupport, Set.mem_setOf_eq, Set.mem_unionᵢ]
+ simp only [support_bindOnSupport, Set.mem_setOf_eq, Set.mem_iUnion]
#align pmf.mem_support_bind_on_support_iff Pmf.mem_support_bindOnSupport_iff
/-- `bindOnSupport` reduces to `bind` if `f` doesn't depend on the additional hypothesis. -/
The unported dependencies are
algebra.order.module
init.core
algebra.order.monoid.cancel.defs
algebra.abs
algebra.group_power.lemmas
init.data.list.basic
init.data.list.default
algebra.order.monoid.cancel.basic
topology.subset_properties
init.logic
The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file