1813 fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{banach, second_countable_topology}" |
1813 fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{banach, second_countable_topology}" |
1814 assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M" |
1814 assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M" |
1815 shows "(\<lambda>x. suminf (\<lambda>i. f i x)) \<in> borel_measurable M" |
1815 shows "(\<lambda>x. suminf (\<lambda>i. f i x)) \<in> borel_measurable M" |
1816 unfolding suminf_def sums_def[abs_def] lim_def[symmetric] by simp |
1816 unfolding suminf_def sums_def[abs_def] lim_def[symmetric] by simp |
1817 |
1817 |
|
1818 lemma Collect_closed_imp_pred_borel: "closed {x. P x} \<Longrightarrow> Measurable.pred borel P" |
|
1819 by (simp add: pred_def) |
|
1820 |
1818 (* Proof by Jeremy Avigad and Luke Serafin *) |
1821 (* Proof by Jeremy Avigad and Luke Serafin *) |
|
1822 lemma isCont_borel_pred[measurable]: |
|
1823 fixes f :: "'b::metric_space \<Rightarrow> 'a::metric_space" |
|
1824 shows "Measurable.pred borel (isCont f)" |
|
1825 proof (subst measurable_cong) |
|
1826 let ?I = "\<lambda>j. inverse(real (Suc j))" |
|
1827 show "isCont f x = (\<forall>i. \<exists>j. \<forall>y z. dist x y < ?I j \<and> dist x z < ?I j \<longrightarrow> dist (f y) (f z) \<le> ?I i)" for x |
|
1828 unfolding continuous_at_eps_delta |
|
1829 proof safe |
|
1830 fix i assume "\<forall>e>0. \<exists>d>0. \<forall>y. dist y x < d \<longrightarrow> dist (f y) (f x) < e" |
|
1831 moreover have "0 < ?I i / 2" |
|
1832 by simp |
|
1833 ultimately obtain d where d: "0 < d" "\<And>y. dist x y < d \<Longrightarrow> dist (f y) (f x) < ?I i / 2" |
|
1834 by (metis dist_commute) |
|
1835 then obtain j where j: "?I j < d" |
|
1836 by (metis reals_Archimedean) |
|
1837 |
|
1838 show "\<exists>j. \<forall>y z. dist x y < ?I j \<and> dist x z < ?I j \<longrightarrow> dist (f y) (f z) \<le> ?I i" |
|
1839 proof (safe intro!: exI[where x=j]) |
|
1840 fix y z assume *: "dist x y < ?I j" "dist x z < ?I j" |
|
1841 have "dist (f y) (f z) \<le> dist (f y) (f x) + dist (f z) (f x)" |
|
1842 by (rule dist_triangle2) |
|
1843 also have "\<dots> < ?I i / 2 + ?I i / 2" |
|
1844 by (intro add_strict_mono d less_trans[OF _ j] *) |
|
1845 also have "\<dots> \<le> ?I i" |
|
1846 by (simp add: field_simps of_nat_Suc) |
|
1847 finally show "dist (f y) (f z) \<le> ?I i" |
|
1848 by simp |
|
1849 qed |
|
1850 next |
|
1851 fix e::real assume "0 < e" |
|
1852 then obtain n where n: "?I n < e" |
|
1853 by (metis reals_Archimedean) |
|
1854 assume "\<forall>i. \<exists>j. \<forall>y z. dist x y < ?I j \<and> dist x z < ?I j \<longrightarrow> dist (f y) (f z) \<le> ?I i" |
|
1855 from this[THEN spec, of "Suc n"] |
|
1856 obtain j where j: "\<And>y z. dist x y < ?I j \<Longrightarrow> dist x z < ?I j \<Longrightarrow> dist (f y) (f z) \<le> ?I (Suc n)" |
|
1857 by auto |
|
1858 |
|
1859 show "\<exists>d>0. \<forall>y. dist y x < d \<longrightarrow> dist (f y) (f x) < e" |
|
1860 proof (safe intro!: exI[of _ "?I j"]) |
|
1861 fix y assume "dist y x < ?I j" |
|
1862 then have "dist (f y) (f x) \<le> ?I (Suc n)" |
|
1863 by (intro j) (auto simp: dist_commute) |
|
1864 also have "?I (Suc n) < ?I n" |
|
1865 by simp |
|
1866 also note n |
|
1867 finally show "dist (f y) (f x) < e" . |
|
1868 qed simp |
|
1869 qed |
|
1870 qed (intro pred_intros_countable closed_Collect_all closed_Collect_le open_Collect_less |
|
1871 Collect_closed_imp_pred_borel closed_Collect_imp open_Collect_conj continuous_intros) |
|
1872 |
1819 lemma isCont_borel: |
1873 lemma isCont_borel: |
1820 fixes f :: "'b::metric_space \<Rightarrow> 'a::metric_space" |
1874 fixes f :: "'b::metric_space \<Rightarrow> 'a::metric_space" |
1821 shows "{x. isCont f x} \<in> sets borel" |
1875 shows "{x. isCont f x} \<in> sets borel" |
1822 proof - |
1876 by simp |
1823 let ?I = "\<lambda>j. inverse(real (Suc j))" |
|
1824 |
|
1825 { fix x |
|
1826 have "isCont f x = (\<forall>i. \<exists>j. \<forall>y z. dist x y < ?I j \<and> dist x z < ?I j \<longrightarrow> dist (f y) (f z) \<le> ?I i)" |
|
1827 unfolding continuous_at_eps_delta |
|
1828 proof safe |
|
1829 fix i assume "\<forall>e>0. \<exists>d>0. \<forall>y. dist y x < d \<longrightarrow> dist (f y) (f x) < e" |
|
1830 moreover have "0 < ?I i / 2" |
|
1831 by simp |
|
1832 ultimately obtain d where d: "0 < d" "\<And>y. dist x y < d \<Longrightarrow> dist (f y) (f x) < ?I i / 2" |
|
1833 by (metis dist_commute) |
|
1834 then obtain j where j: "?I j < d" |
|
1835 by (metis reals_Archimedean) |
|
1836 |
|
1837 show "\<exists>j. \<forall>y z. dist x y < ?I j \<and> dist x z < ?I j \<longrightarrow> dist (f y) (f z) \<le> ?I i" |
|
1838 proof (safe intro!: exI[where x=j]) |
|
1839 fix y z assume *: "dist x y < ?I j" "dist x z < ?I j" |
|
1840 have "dist (f y) (f z) \<le> dist (f y) (f x) + dist (f z) (f x)" |
|
1841 by (rule dist_triangle2) |
|
1842 also have "\<dots> < ?I i / 2 + ?I i / 2" |
|
1843 by (intro add_strict_mono d less_trans[OF _ j] *) |
|
1844 also have "\<dots> \<le> ?I i" |
|
1845 by (simp add: field_simps of_nat_Suc) |
|
1846 finally show "dist (f y) (f z) \<le> ?I i" |
|
1847 by simp |
|
1848 qed |
|
1849 next |
|
1850 fix e::real assume "0 < e" |
|
1851 then obtain n where n: "?I n < e" |
|
1852 by (metis reals_Archimedean) |
|
1853 assume "\<forall>i. \<exists>j. \<forall>y z. dist x y < ?I j \<and> dist x z < ?I j \<longrightarrow> dist (f y) (f z) \<le> ?I i" |
|
1854 from this[THEN spec, of "Suc n"] |
|
1855 obtain j where j: "\<And>y z. dist x y < ?I j \<Longrightarrow> dist x z < ?I j \<Longrightarrow> dist (f y) (f z) \<le> ?I (Suc n)" |
|
1856 by auto |
|
1857 |
|
1858 show "\<exists>d>0. \<forall>y. dist y x < d \<longrightarrow> dist (f y) (f x) < e" |
|
1859 proof (safe intro!: exI[of _ "?I j"]) |
|
1860 fix y assume "dist y x < ?I j" |
|
1861 then have "dist (f y) (f x) \<le> ?I (Suc n)" |
|
1862 by (intro j) (auto simp: dist_commute) |
|
1863 also have "?I (Suc n) < ?I n" |
|
1864 by simp |
|
1865 also note n |
|
1866 finally show "dist (f y) (f x) < e" . |
|
1867 qed simp |
|
1868 qed } |
|
1869 note * = this |
|
1870 |
|
1871 have **: "\<And>e y. open {x. dist x y < e}" |
|
1872 using open_ball by (simp_all add: ball_def dist_commute) |
|
1873 |
|
1874 have "{x\<in>space borel. isCont f x} \<in> sets borel" |
|
1875 unfolding * |
|
1876 apply (intro sets.sets_Collect_countable_All sets.sets_Collect_countable_Ex) |
|
1877 apply (simp add: Collect_all_eq) |
|
1878 apply (intro borel_closed closed_INT ballI closed_Collect_imp open_Collect_conj **) |
|
1879 apply auto |
|
1880 done |
|
1881 then show ?thesis |
|
1882 by simp |
|
1883 qed |
|
1884 |
|
1885 lemma isCont_borel_pred[measurable]: |
|
1886 fixes f :: "'b::metric_space \<Rightarrow> 'a::metric_space" |
|
1887 shows "Measurable.pred borel (isCont f)" |
|
1888 unfolding pred_def by (simp add: isCont_borel) |
|
1889 |
1877 |
1890 lemma is_real_interval: |
1878 lemma is_real_interval: |
1891 assumes S: "is_interval S" |
1879 assumes S: "is_interval S" |
1892 shows "\<exists>a b::real. S = {} \<or> S = UNIV \<or> S = {..<b} \<or> S = {..b} \<or> S = {a<..} \<or> S = {a..} \<or> |
1880 shows "\<exists>a b::real. S = {} \<or> S = UNIV \<or> S = {..<b} \<or> S = {..b} \<or> S = {a<..} \<or> S = {a..} \<or> |
1893 S = {a<..<b} \<or> S = {a<..b} \<or> S = {a..<b} \<or> S = {a..b}" |
1881 S = {a<..<b} \<or> S = {a<..b} \<or> S = {a..<b} \<or> S = {a..b}" |