1540 shows "integral f = (\<Sum> r \<in> f ` space M. r * measure M (f -` {r} \<inter> space M))" |
1540 shows "integral f = (\<Sum> r \<in> f ` space M. r * measure M (f -` {r} \<inter> space M))" |
1541 using integral_finite_on_sets[OF assms top] |
1541 using integral_finite_on_sets[OF assms top] |
1542 integral_cong[of "\<lambda>x. f x * indicator_fn (space M) x" f] |
1542 integral_cong[of "\<lambda>x. f x * indicator_fn (space M) x" f] |
1543 by (auto simp add: indicator_fn_def) |
1543 by (auto simp add: indicator_fn_def) |
1544 |
1544 |
1545 lemma integral_finite_singleton: |
1545 section "Radon–Nikodym derivative" |
1546 assumes fin: "finite (space M)" and "Pow (space M) = sets M" |
1546 |
1547 shows "integral f = (\<Sum>x \<in> space M. f x * measure M {x})" |
1547 definition |
|
1548 "RN_deriv v \<equiv> SOME f. measure_space (M\<lparr>measure := v\<rparr>) \<and> |
|
1549 f \<in> borel_measurable M \<and> |
|
1550 (\<forall>a \<in> sets M. (integral (\<lambda>x. f x * indicator_fn a x) = v a))" |
|
1551 |
|
1552 end |
|
1553 |
|
1554 locale finite_measure_space = measure_space + |
|
1555 assumes finite_space: "finite (space M)" |
|
1556 and sets_eq_Pow: "sets M = Pow (space M)" |
|
1557 |
|
1558 lemma sigma_algebra_cong: |
|
1559 fixes M :: "('a, 'b) algebra_scheme" and M' :: "('a, 'c) algebra_scheme" |
|
1560 assumes *: "sigma_algebra M" |
|
1561 and cong: "space M = space M'" "sets M = sets M'" |
|
1562 shows "sigma_algebra M'" |
|
1563 using * unfolding sigma_algebra_def algebra_def sigma_algebra_axioms_def unfolding cong . |
|
1564 |
|
1565 lemma finite_Pow_additivity_sufficient: |
|
1566 assumes "finite (space M)" and "sets M = Pow (space M)" |
|
1567 and "positive M (measure M)" and "additive M (measure M)" |
|
1568 shows "finite_measure_space M" |
|
1569 proof - |
|
1570 have "sigma_algebra M" |
|
1571 using assms by (auto intro!: sigma_algebra_cong[OF sigma_algebra_Pow]) |
|
1572 |
|
1573 have "measure_space M" |
|
1574 by (rule Measure.finite_additivity_sufficient) (fact+) |
|
1575 thus ?thesis |
|
1576 unfolding finite_measure_space_def finite_measure_space_axioms_def |
|
1577 using assms by simp |
|
1578 qed |
|
1579 |
|
1580 lemma finite_measure_spaceI: |
|
1581 assumes "measure_space M" and "finite (space M)" and "sets M = Pow (space M)" |
|
1582 shows "finite_measure_space M" |
|
1583 unfolding finite_measure_space_def finite_measure_space_axioms_def |
|
1584 using assms by simp |
|
1585 |
|
1586 lemma (in finite_measure_space) integral_finite_singleton: |
|
1587 "integral f = (\<Sum>x \<in> space M. f x * measure M {x})" |
1548 proof - |
1588 proof - |
1549 have "f \<in> borel_measurable M" |
1589 have "f \<in> borel_measurable M" |
1550 unfolding borel_measurable_le_iff |
1590 unfolding borel_measurable_le_iff |
1551 using assms by auto |
1591 using sets_eq_Pow by auto |
1552 { fix r let ?x = "f -` {r} \<inter> space M" |
1592 { fix r let ?x = "f -` {r} \<inter> space M" |
1553 have "?x \<subseteq> space M" by auto |
1593 have "?x \<subseteq> space M" by auto |
1554 with assms have "measure M ?x = (\<Sum>i \<in> ?x. measure M {i})" |
1594 with finite_space sets_eq_Pow have "measure M ?x = (\<Sum>i \<in> ?x. measure M {i})" |
1555 by (auto intro!: measure_real_sum_image) } |
1595 by (auto intro!: measure_real_sum_image) } |
1556 note measure_eq_setsum = this |
1596 note measure_eq_setsum = this |
1557 show ?thesis |
1597 show ?thesis |
1558 unfolding integral_finite[OF `f \<in> borel_measurable M` fin] |
1598 unfolding integral_finite[OF `f \<in> borel_measurable M` finite_space] |
1559 measure_eq_setsum setsum_right_distrib |
1599 measure_eq_setsum setsum_right_distrib |
1560 apply (subst setsum_Sigma) |
1600 apply (subst setsum_Sigma) |
1561 apply (simp add: assms) |
1601 apply (simp add: finite_space) |
1562 apply (simp add: assms) |
1602 apply (simp add: finite_space) |
1563 proof (rule setsum_reindex_cong[symmetric]) |
1603 proof (rule setsum_reindex_cong[symmetric]) |
1564 fix a assume "a \<in> Sigma (f ` space M) (\<lambda>x. f -` {x} \<inter> space M)" |
1604 fix a assume "a \<in> Sigma (f ` space M) (\<lambda>x. f -` {x} \<inter> space M)" |
1565 thus "(\<lambda>(x, y). x * measure M {y}) a = f (snd a) * measure_space.measure M {snd a}" |
1605 thus "(\<lambda>(x, y). x * measure M {y}) a = f (snd a) * measure_space.measure M {snd a}" |
1566 by auto |
1606 by auto |
1567 qed (auto intro!: image_eqI inj_onI) |
1607 qed (auto intro!: image_eqI inj_onI) |
1568 qed |
1608 qed |
1569 |
1609 |
1570 section "Radon–Nikodym derivative" |
1610 lemma (in finite_measure_space) RN_deriv_finite_singleton: |
1571 |
|
1572 definition |
|
1573 "RN_deriv v \<equiv> SOME f. measure_space (M\<lparr>measure := v\<rparr>) \<and> |
|
1574 f \<in> borel_measurable M \<and> |
|
1575 (\<forall>a \<in> sets M. (integral (\<lambda>x. f x * indicator_fn a x) = v a))" |
|
1576 |
|
1577 lemma RN_deriv_finite_singleton: |
|
1578 fixes v :: "'a set \<Rightarrow> real" |
1611 fixes v :: "'a set \<Rightarrow> real" |
1579 assumes finite: "finite (space M)" and Pow: "Pow (space M) = sets M" |
1612 assumes ms_v: "measure_space (M\<lparr>measure := v\<rparr>)" |
1580 and ms_v: "measure_space (M\<lparr>measure := v\<rparr>)" |
|
1581 and eq_0: "\<And>x. measure M {x} = 0 \<Longrightarrow> v {x} = 0" |
1613 and eq_0: "\<And>x. measure M {x} = 0 \<Longrightarrow> v {x} = 0" |
1582 and "x \<in> space M" and "measure M {x} \<noteq> 0" |
1614 and "x \<in> space M" and "measure M {x} \<noteq> 0" |
1583 shows "RN_deriv v x = v {x} / (measure M {x})" (is "_ = ?v x") |
1615 shows "RN_deriv v x = v {x} / (measure M {x})" (is "_ = ?v x") |
1584 unfolding RN_deriv_def |
1616 unfolding RN_deriv_def |
1585 proof (rule someI2_ex[where Q = "\<lambda>f. f x = ?v x"], rule exI[where x = ?v], safe) |
1617 proof (rule someI2_ex[where Q = "\<lambda>f. f x = ?v x"], rule exI[where x = ?v], safe) |
1586 show "(\<lambda>a. v {a} / measure_space.measure M {a}) \<in> borel_measurable M" |
1618 show "(\<lambda>a. v {a} / measure_space.measure M {a}) \<in> borel_measurable M" |
1587 unfolding borel_measurable_le_iff using Pow by auto |
1619 unfolding borel_measurable_le_iff using sets_eq_Pow by auto |
1588 next |
1620 next |
1589 fix a assume "a \<in> sets M" |
1621 fix a assume "a \<in> sets M" |
1590 hence "a \<subseteq> space M" and "finite a" |
1622 hence "a \<subseteq> space M" and "finite a" |
1591 using sets_into_space finite by (auto intro: finite_subset) |
1623 using sets_into_space finite_space by (auto intro: finite_subset) |
1592 have *: "\<And>x a. (if measure M {x} = 0 then 0 else v {x} * indicator_fn a x) = |
1624 have *: "\<And>x a. (if measure M {x} = 0 then 0 else v {x} * indicator_fn a x) = |
1593 v {x} * indicator_fn a x" using eq_0 by auto |
1625 v {x} * indicator_fn a x" using eq_0 by auto |
1594 |
1626 |
1595 from measure_space.measure_real_sum_image[OF ms_v, of a] |
1627 from measure_space.measure_real_sum_image[OF ms_v, of a] |
1596 Pow `a \<in> sets M` sets_into_space `finite a` |
1628 sets_eq_Pow `a \<in> sets M` sets_into_space `finite a` |
1597 have "v a = (\<Sum>x\<in>a. v {x})" by auto |
1629 have "v a = (\<Sum>x\<in>a. v {x})" by auto |
1598 thus "integral (\<lambda>x. v {x} / measure_space.measure M {x} * indicator_fn a x) = v a" |
1630 thus "integral (\<lambda>x. v {x} / measure_space.measure M {x} * indicator_fn a x) = v a" |
1599 apply (simp add: eq_0 integral_finite_singleton[OF finite Pow]) |
1631 apply (simp add: eq_0 integral_finite_singleton) |
1600 apply (unfold divide_1) |
1632 apply (unfold divide_1) |
1601 by (simp add: * indicator_fn_def if_distrib setsum_cases finite `a \<subseteq> space M` Int_absorb1) |
1633 by (simp add: * indicator_fn_def if_distrib setsum_cases finite_space `a \<subseteq> space M` Int_absorb1) |
1602 next |
1634 next |
1603 fix w assume "w \<in> borel_measurable M" |
1635 fix w assume "w \<in> borel_measurable M" |
1604 assume int_eq_v: "\<forall>a\<in>sets M. integral (\<lambda>x. w x * indicator_fn a x) = v a" |
1636 assume int_eq_v: "\<forall>a\<in>sets M. integral (\<lambda>x. w x * indicator_fn a x) = v a" |
1605 have "{x} \<in> sets M" using Pow `x \<in> space M` by auto |
1637 have "{x} \<in> sets M" using sets_eq_Pow `x \<in> space M` by auto |
1606 |
1638 |
1607 have "w x * measure M {x} = |
1639 have "w x * measure M {x} = |
1608 (\<Sum>y\<in>space M. w y * indicator_fn {x} y * measure M {y})" |
1640 (\<Sum>y\<in>space M. w y * indicator_fn {x} y * measure M {y})" |
1609 apply (subst (3) mult_commute) |
1641 apply (subst (3) mult_commute) |
1610 unfolding indicator_fn_def if_distrib setsum_cases[OF finite] |
1642 unfolding indicator_fn_def if_distrib setsum_cases[OF finite_space] |
1611 using `x \<in> space M` by simp |
1643 using `x \<in> space M` by simp |
1612 also have "... = v {x}" |
1644 also have "... = v {x}" |
1613 using int_eq_v[rule_format, OF `{x} \<in> sets M`] |
1645 using int_eq_v[rule_format, OF `{x} \<in> sets M`] |
1614 by (simp add: integral_finite_singleton[OF finite Pow]) |
1646 by (simp add: integral_finite_singleton) |
1615 finally show "w x = v {x} / measure M {x}" |
1647 finally show "w x = v {x} / measure M {x}" |
1616 using `measure M {x} \<noteq> 0` by (simp add: eq_divide_eq) |
1648 using `measure M {x} \<noteq> 0` by (simp add: eq_divide_eq) |
1617 qed fact |
1649 qed fact |
1618 |
1650 |
1619 end |
1651 end |
1620 |
|
1621 end |
|