src/HOL/Topological_Spaces.thy
changeset 66447 a1f5c5c26fa6
parent 66162 65cd285f6b9c
child 66827 c94531b5007d
equal deleted inserted replaced
66445:407de0768126 66447:a1f5c5c26fa6
  1067 
  1067 
  1068 lemma decseq_def: "decseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)"
  1068 lemma decseq_def: "decseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)"
  1069   unfolding antimono_def ..
  1069   unfolding antimono_def ..
  1070 
  1070 
  1071 text \<open>Definition of subsequence.\<close>
  1071 text \<open>Definition of subsequence.\<close>
  1072 definition subseq :: "(nat \<Rightarrow> nat) \<Rightarrow> bool"
  1072 
  1073   where "subseq f \<longleftrightarrow> (\<forall>m. \<forall>n>m. f m < f n)"
  1073 (* For compatibility with the old "subseq" *)
  1074 
  1074 lemma strict_mono_leD: "strict_mono r \<Longrightarrow> m \<le> n \<Longrightarrow> r m \<le> r n"
  1075 lemma subseq_le_mono: "subseq r \<Longrightarrow> m \<le> n \<Longrightarrow> r m \<le> r n"
  1075   by (erule (1) monoD [OF strict_mono_mono])
  1076   by (simp add: less_mono_imp_le_mono subseq_def)
  1076 
  1077 
  1077 lemma strict_mono_id: "strict_mono id"
  1078 lemma subseq_id: "subseq id"
  1078   by (simp add: strict_mono_def)
  1079   by (simp add: subseq_def)
       
  1080 
  1079 
  1081 lemma incseq_SucI: "(\<And>n. X n \<le> X (Suc n)) \<Longrightarrow> incseq X"
  1080 lemma incseq_SucI: "(\<And>n. X n \<le> X (Suc n)) \<Longrightarrow> incseq X"
  1082   using lift_Suc_mono_le[of X] by (auto simp: incseq_def)
  1081   using lift_Suc_mono_le[of X] by (auto simp: incseq_def)
  1083 
  1082 
  1084 lemma incseqD: "incseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f i \<le> f j"
  1083 lemma incseqD: "incseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f i \<le> f j"
  1142 qed
  1141 qed
  1143 
  1142 
  1144 
  1143 
  1145 text \<open>Subsequence (alternative definition, (e.g. Hoskins)\<close>
  1144 text \<open>Subsequence (alternative definition, (e.g. Hoskins)\<close>
  1146 
  1145 
  1147 lemma subseq_Suc_iff: "subseq f \<longleftrightarrow> (\<forall>n. f n < f (Suc n))"
  1146 lemma strict_mono_Suc_iff: "strict_mono f \<longleftrightarrow> (\<forall>n. f n < f (Suc n))"
  1148   apply (simp add: subseq_def)
  1147 proof (intro iffI strict_monoI)
  1149   apply (auto dest!: less_imp_Suc_add)
  1148   assume *: "\<forall>n. f n < f (Suc n)"
  1150   apply (induct_tac k)
  1149   fix m n :: nat assume "m < n"
  1151    apply (auto intro: less_trans)
  1150   thus "f m < f n"
  1152   done
  1151     by (induction rule: less_Suc_induct) (use * in auto)
  1153 
  1152 qed (auto simp: strict_mono_def)
  1154 lemma subseq_add: "subseq (\<lambda>n. n + k)"
  1153 
  1155   by (auto simp: subseq_Suc_iff)
  1154 lemma strict_mono_add: "strict_mono (\<lambda>n::'a::linordered_semidom. n + k)"
       
  1155   by (auto simp: strict_mono_def)
  1156 
  1156 
  1157 text \<open>For any sequence, there is a monotonic subsequence.\<close>
  1157 text \<open>For any sequence, there is a monotonic subsequence.\<close>
  1158 lemma seq_monosub:
  1158 lemma seq_monosub:
  1159   fixes s :: "nat \<Rightarrow> 'a::linorder"
  1159   fixes s :: "nat \<Rightarrow> 'a::linorder"
  1160   shows "\<exists>f. subseq f \<and> monoseq (\<lambda>n. (s (f n)))"
  1160   shows "\<exists>f. strict_mono f \<and> monoseq (\<lambda>n. (s (f n)))"
  1161 proof (cases "\<forall>n. \<exists>p>n. \<forall>m\<ge>p. s m \<le> s p")
  1161 proof (cases "\<forall>n. \<exists>p>n. \<forall>m\<ge>p. s m \<le> s p")
  1162   case True
  1162   case True
  1163   then have "\<exists>f. \<forall>n. (\<forall>m\<ge>f n. s m \<le> s (f n)) \<and> f n < f (Suc n)"
  1163   then have "\<exists>f. \<forall>n. (\<forall>m\<ge>f n. s m \<le> s (f n)) \<and> f n < f (Suc n)"
  1164     by (intro dependent_nat_choice) (auto simp: conj_commute)
  1164     by (intro dependent_nat_choice) (auto simp: conj_commute)
  1165   then obtain f where f: "subseq f" and mono: "\<And>n m. f n \<le> m \<Longrightarrow> s m \<le> s (f n)"
  1165   then obtain f :: "nat \<Rightarrow> nat" 
  1166     by (auto simp: subseq_Suc_iff)
  1166     where f: "strict_mono f" and mono: "\<And>n m. f n \<le> m \<Longrightarrow> s m \<le> s (f n)"
       
  1167     by (auto simp: strict_mono_Suc_iff)
  1167   then have "incseq f"
  1168   then have "incseq f"
  1168     unfolding subseq_Suc_iff incseq_Suc_iff by (auto intro: less_imp_le)
  1169     unfolding strict_mono_Suc_iff incseq_Suc_iff by (auto intro: less_imp_le)
  1169   then have "monoseq (\<lambda>n. s (f n))"
  1170   then have "monoseq (\<lambda>n. s (f n))"
  1170     by (auto simp add: incseq_def intro!: mono monoI2)
  1171     by (auto simp add: incseq_def intro!: mono monoI2)
  1171   with f show ?thesis
  1172   with f show ?thesis
  1172     by auto
  1173     by auto
  1173 next
  1174 next
  1180     assume "N < x" with N[of x]
  1181     assume "N < x" with N[of x]
  1181     show "\<exists>y>N. x < y \<and> s x \<le> s y"
  1182     show "\<exists>y>N. x < y \<and> s x \<le> s y"
  1182       by (auto intro: less_trans)
  1183       by (auto intro: less_trans)
  1183   qed auto
  1184   qed auto
  1184   then show ?thesis
  1185   then show ?thesis
  1185     by (auto simp: monoseq_iff incseq_Suc_iff subseq_Suc_iff)
  1186     by (auto simp: monoseq_iff incseq_Suc_iff strict_mono_Suc_iff)
  1186 qed
  1187 qed
  1187 
  1188 
  1188 lemma seq_suble:
  1189 lemma seq_suble:
  1189   assumes sf: "subseq f"
  1190   assumes sf: "strict_mono (f :: nat \<Rightarrow> nat)"
  1190   shows "n \<le> f n"
  1191   shows "n \<le> f n"
  1191 proof (induct n)
  1192 proof (induct n)
  1192   case 0
  1193   case 0
  1193   show ?case by simp
  1194   show ?case by simp
  1194 next
  1195 next
  1195   case (Suc n)
  1196   case (Suc n)
  1196   with sf [unfolded subseq_Suc_iff, rule_format, of n] have "n < f (Suc n)"
  1197   with sf [unfolded strict_mono_Suc_iff, rule_format, of n] have "n < f (Suc n)"
  1197      by arith
  1198      by arith
  1198   then show ?case by arith
  1199   then show ?case by arith
  1199 qed
  1200 qed
  1200 
  1201 
  1201 lemma eventually_subseq:
  1202 lemma eventually_subseq:
  1202   "subseq r \<Longrightarrow> eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially"
  1203   "strict_mono r \<Longrightarrow> eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially"
  1203   unfolding eventually_sequentially by (metis seq_suble le_trans)
  1204   unfolding eventually_sequentially by (metis seq_suble le_trans)
  1204 
  1205 
  1205 lemma not_eventually_sequentiallyD:
  1206 lemma not_eventually_sequentiallyD:
  1206   assumes "\<not> eventually P sequentially"
  1207   assumes "\<not> eventually P sequentially"
  1207   shows "\<exists>r. subseq r \<and> (\<forall>n. \<not> P (r n))"
  1208   shows "\<exists>r::nat\<Rightarrow>nat. strict_mono r \<and> (\<forall>n. \<not> P (r n))"
  1208 proof -
  1209 proof -
  1209   from assms have "\<forall>n. \<exists>m\<ge>n. \<not> P m"
  1210   from assms have "\<forall>n. \<exists>m\<ge>n. \<not> P m"
  1210     unfolding eventually_sequentially by (simp add: not_less)
  1211     unfolding eventually_sequentially by (simp add: not_less)
  1211   then obtain r where "\<And>n. r n \<ge> n" "\<And>n. \<not> P (r n)"
  1212   then obtain r where "\<And>n. r n \<ge> n" "\<And>n. \<not> P (r n)"
  1212     by (auto simp: choice_iff)
  1213     by (auto simp: choice_iff)
  1213   then show ?thesis
  1214   then show ?thesis
  1214     by (auto intro!: exI[of _ "\<lambda>n. r (((Suc \<circ> r) ^^ Suc n) 0)"]
  1215     by (auto intro!: exI[of _ "\<lambda>n. r (((Suc \<circ> r) ^^ Suc n) 0)"]
  1215              simp: less_eq_Suc_le subseq_Suc_iff)
  1216              simp: less_eq_Suc_le strict_mono_Suc_iff)
  1216 qed
  1217 qed
  1217 
  1218 
  1218 lemma filterlim_subseq: "subseq f \<Longrightarrow> filterlim f sequentially sequentially"
  1219 lemma filterlim_subseq: "strict_mono f \<Longrightarrow> filterlim f sequentially sequentially"
  1219   unfolding filterlim_iff by (metis eventually_subseq)
  1220   unfolding filterlim_iff by (metis eventually_subseq)
  1220 
  1221 
  1221 lemma subseq_o: "subseq r \<Longrightarrow> subseq s \<Longrightarrow> subseq (r \<circ> s)"
  1222 lemma strict_mono_o: "strict_mono r \<Longrightarrow> strict_mono s \<Longrightarrow> strict_mono (r \<circ> s)"
  1222   unfolding subseq_def by simp
  1223   unfolding strict_mono_def by simp
  1223 
       
  1224 lemma subseq_mono: "subseq r \<Longrightarrow> m < n \<Longrightarrow> r m < r n"
       
  1225   by (auto simp: subseq_def)
       
  1226 
       
  1227 lemma subseq_imp_inj_on: "subseq g \<Longrightarrow> inj_on g A"
       
  1228 proof (rule inj_onI)
       
  1229   assume g: "subseq g"
       
  1230   fix x y
       
  1231   assume "g x = g y"
       
  1232   with subseq_mono[OF g, of x y] subseq_mono[OF g, of y x] show "x = y"
       
  1233     by (cases x y rule: linorder_cases) simp_all
       
  1234 qed
       
  1235 
       
  1236 lemma subseq_strict_mono: "subseq g \<Longrightarrow> strict_mono g"
       
  1237   by (intro strict_monoI subseq_mono[of g])
       
  1238 
  1224 
  1239 lemma incseq_imp_monoseq:  "incseq X \<Longrightarrow> monoseq X"
  1225 lemma incseq_imp_monoseq:  "incseq X \<Longrightarrow> monoseq X"
  1240   by (simp add: incseq_def monoseq_def)
  1226   by (simp add: incseq_def monoseq_def)
  1241 
  1227 
  1242 lemma decseq_imp_monoseq:  "decseq X \<Longrightarrow> monoseq X"
  1228 lemma decseq_imp_monoseq:  "decseq X \<Longrightarrow> monoseq X"
  1322     (\<forall>n. a n \<le> x) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n) \<or>
  1308     (\<forall>n. a n \<le> x) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n) \<or>
  1323     (\<forall>n. x \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m)"
  1309     (\<forall>n. x \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m)"
  1324   for x :: "'a::linorder_topology"
  1310   for x :: "'a::linorder_topology"
  1325   by (metis LIMSEQ_le_const LIMSEQ_le_const2 decseq_def incseq_def monoseq_iff)
  1311   by (metis LIMSEQ_le_const LIMSEQ_le_const2 decseq_def incseq_def monoseq_iff)
  1326 
  1312 
  1327 lemma LIMSEQ_subseq_LIMSEQ: "X \<longlonglongrightarrow> L \<Longrightarrow> subseq f \<Longrightarrow> (X \<circ> f) \<longlonglongrightarrow> L"
  1313 lemma LIMSEQ_subseq_LIMSEQ: "X \<longlonglongrightarrow> L \<Longrightarrow> strict_mono f \<Longrightarrow> (X \<circ> f) \<longlonglongrightarrow> L"
  1328   unfolding comp_def by (rule filterlim_compose [of X, OF _ filterlim_subseq])
  1314   unfolding comp_def by (rule filterlim_compose [of X, OF _ filterlim_subseq])
  1329 
  1315 
  1330 lemma convergent_subseq_convergent: "convergent X \<Longrightarrow> subseq f \<Longrightarrow> convergent (X \<circ> f)"
  1316 lemma convergent_subseq_convergent: "convergent X \<Longrightarrow> strict_mono f \<Longrightarrow> convergent (X \<circ> f)"
  1331   by (auto simp: convergent_def intro: LIMSEQ_subseq_LIMSEQ)
  1317   by (auto simp: convergent_def intro: LIMSEQ_subseq_LIMSEQ)
  1332 
  1318 
  1333 lemma limI: "X \<longlonglongrightarrow> L \<Longrightarrow> lim X = L"
  1319 lemma limI: "X \<longlonglongrightarrow> L \<Longrightarrow> lim X = L"
  1334   by (rule tendsto_Lim) (rule trivial_limit_sequentially)
  1320   by (rule tendsto_Lim) (rule trivial_limit_sequentially)
  1335 
  1321 
  1649       and "X (s n) < a"
  1635       and "X (s n) < a"
  1650       and "incseq (\<lambda>n. X (s n))"
  1636       and "incseq (\<lambda>n. X (s n))"
  1651       and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a"
  1637       and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a"
  1652       and "\<not> P (X (s n))"
  1638       and "\<not> P (X (s n))"
  1653       for n
  1639       for n
  1654       by (auto simp: subseq_Suc_iff Suc_le_eq incseq_Suc_iff
  1640       by (auto simp: strict_mono_Suc_iff Suc_le_eq incseq_Suc_iff
  1655           intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def])
  1641           intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def])
  1656     from *[OF this(1,2,3,4)] this(5) show False
  1642     from *[OF this(1,2,3,4)] this(5) show False
  1657       by auto
  1643       by auto
  1658   qed
  1644   qed
  1659 qed
  1645 qed
  1698       and "X (s n) < b"
  1684       and "X (s n) < b"
  1699       and "decseq (\<lambda>n. X (s n))"
  1685       and "decseq (\<lambda>n. X (s n))"
  1700       and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a"
  1686       and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a"
  1701       and "\<not> P (X (s n))"
  1687       and "\<not> P (X (s n))"
  1702       for n
  1688       for n
  1703       by (auto simp: subseq_Suc_iff Suc_le_eq decseq_Suc_iff
  1689       by (auto simp: strict_mono_Suc_iff Suc_le_eq decseq_Suc_iff
  1704           intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def])
  1690           intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def])
  1705     from *[OF this(1,2,3,4)] this(5) show False
  1691     from *[OF this(1,2,3,4)] this(5) show False
  1706       by auto
  1692       by auto
  1707   qed
  1693   qed
  1708 qed
  1694 qed
  3141 
  3127 
  3142 lemma LIMSEQ_imp_Cauchy: "X \<longlonglongrightarrow> x \<Longrightarrow> Cauchy X"
  3128 lemma LIMSEQ_imp_Cauchy: "X \<longlonglongrightarrow> x \<Longrightarrow> Cauchy X"
  3143   unfolding Cauchy_uniform filterlim_def by (intro nhds_imp_cauchy_filter)
  3129   unfolding Cauchy_uniform filterlim_def by (intro nhds_imp_cauchy_filter)
  3144 
  3130 
  3145 lemma Cauchy_subseq_Cauchy:
  3131 lemma Cauchy_subseq_Cauchy:
  3146   assumes "Cauchy X" "subseq f"
  3132   assumes "Cauchy X" "strict_mono f"
  3147   shows "Cauchy (X \<circ> f)"
  3133   shows "Cauchy (X \<circ> f)"
  3148   unfolding Cauchy_uniform comp_def filtermap_filtermap[symmetric] cauchy_filter_def
  3134   unfolding Cauchy_uniform comp_def filtermap_filtermap[symmetric] cauchy_filter_def
  3149   by (rule order_trans[OF _ \<open>Cauchy X\<close>[unfolded Cauchy_uniform cauchy_filter_def]])
  3135   by (rule order_trans[OF _ \<open>Cauchy X\<close>[unfolded Cauchy_uniform cauchy_filter_def]])
  3150      (intro prod_filter_mono filtermap_mono filterlim_subseq[OF \<open>subseq f\<close>, unfolded filterlim_def])
  3136      (intro prod_filter_mono filtermap_mono filterlim_subseq[OF \<open>strict_mono f\<close>, unfolded filterlim_def])
  3151 
  3137 
  3152 lemma convergent_Cauchy: "convergent X \<Longrightarrow> Cauchy X"
  3138 lemma convergent_Cauchy: "convergent X \<Longrightarrow> Cauchy X"
  3153   unfolding convergent_def by (erule exE, erule LIMSEQ_imp_Cauchy)
  3139   unfolding convergent_def by (erule exE, erule LIMSEQ_imp_Cauchy)
  3154 
  3140 
  3155 definition complete :: "'a set \<Rightarrow> bool"
  3141 definition complete :: "'a set \<Rightarrow> bool"