src/HOL/NSA/HyperNat.thy
changeset 60041 6c86d58ab0ca
parent 58878 f962e42e324d
child 61975 b4b11391c676
equal deleted inserted replaced
60040:1fa1023b13b9 60041:6c86d58ab0ca
   272   (* omega is in fact an infinite hypernatural number = [<1,2,3,...>] *)
   272   (* omega is in fact an infinite hypernatural number = [<1,2,3,...>] *)
   273   whn :: hypnat where
   273   whn :: hypnat where
   274   hypnat_omega_def: "whn = star_n (%n::nat. n)"
   274   hypnat_omega_def: "whn = star_n (%n::nat. n)"
   275 
   275 
   276 lemma hypnat_of_nat_neq_whn: "hypnat_of_nat n \<noteq> whn"
   276 lemma hypnat_of_nat_neq_whn: "hypnat_of_nat n \<noteq> whn"
   277 by (simp add: hypnat_omega_def star_of_def star_n_eq_iff)
   277 by (simp add: FreeUltrafilterNat.singleton' hypnat_omega_def star_of_def star_n_eq_iff)
   278 
   278 
   279 lemma whn_neq_hypnat_of_nat: "whn \<noteq> hypnat_of_nat n"
   279 lemma whn_neq_hypnat_of_nat: "whn \<noteq> hypnat_of_nat n"
   280 by (simp add: hypnat_omega_def star_of_def star_n_eq_iff)
   280 by (simp add: FreeUltrafilterNat.singleton hypnat_omega_def star_of_def star_n_eq_iff)
   281 
   281 
   282 lemma whn_not_Nats [simp]: "whn \<notin> Nats"
   282 lemma whn_not_Nats [simp]: "whn \<notin> Nats"
   283 by (simp add: Nats_def image_def whn_neq_hypnat_of_nat)
   283 by (simp add: Nats_def image_def whn_neq_hypnat_of_nat)
   284 
   284 
   285 lemma HNatInfinite_whn [simp]: "whn \<in> HNatInfinite"
   285 lemma HNatInfinite_whn [simp]: "whn \<in> HNatInfinite"
   286 by (simp add: HNatInfinite_def)
   286 by (simp add: HNatInfinite_def)
   287 
   287 
   288 lemma lemma_unbounded_set [simp]: "{n::nat. m < n} \<in> FreeUltrafilterNat"
   288 lemma lemma_unbounded_set [simp]: "eventually (\<lambda>n::nat. m < n) \<U>"
   289 apply (insert finite_atMost [of m])
   289   by (rule filter_leD[OF FreeUltrafilterNat.le_cofinite])
   290 apply (drule FreeUltrafilterNat.finite)
   290      (auto simp add: cofinite_eq_sequentially eventually_at_top_dense)
   291 apply (drule FreeUltrafilterNat.not_memD)
       
   292 apply (simp add: Collect_neg_eq [symmetric] linorder_not_le atMost_def)
       
   293 done
       
   294 
       
   295 lemma Compl_Collect_le: "- {n::nat. N \<le> n} = {n. n < N}"
       
   296 by (simp add: Collect_neg_eq [symmetric] linorder_not_le) 
       
   297 
   291 
   298 lemma hypnat_of_nat_eq:
   292 lemma hypnat_of_nat_eq:
   299      "hypnat_of_nat m  = star_n (%n::nat. m)"
   293      "hypnat_of_nat m  = star_n (%n::nat. m)"
   300 by (simp add: star_of_def)
   294 by (simp add: star_of_def)
   301 
   295 
   325 
   319 
   326 text{* @{term "HNatInfinite = {N. \<forall>n \<in> Nats. n < N}"}*}
   320 text{* @{term "HNatInfinite = {N. \<forall>n \<in> Nats. n < N}"}*}
   327 
   321 
   328 (*??delete? similar reasoning in hypnat_omega_gt_SHNat above*)
   322 (*??delete? similar reasoning in hypnat_omega_gt_SHNat above*)
   329 lemma HNatInfinite_FreeUltrafilterNat_lemma:
   323 lemma HNatInfinite_FreeUltrafilterNat_lemma:
   330   assumes "\<forall>N::nat. {n. f n \<noteq> N} \<in> FreeUltrafilterNat"
   324   assumes "\<forall>N::nat. eventually (\<lambda>n. f n \<noteq> N) \<U>"
   331   shows "{n. N < f n} \<in> FreeUltrafilterNat"
   325   shows "eventually (\<lambda>n. N < f n) \<U>"
   332 apply (induct N)
   326 apply (induct N)
   333 using assms
   327 using assms
   334 apply (drule_tac x = 0 in spec, simp)
   328 apply (drule_tac x = 0 in spec, simp)
   335 using assms
   329 using assms
   336 apply (drule_tac x = "Suc N" in spec)
   330 apply (drule_tac x = "Suc N" in spec)
   337 apply (elim ultra, auto)
   331 apply (auto elim: eventually_elim2)
   338 done
   332 done
   339 
   333 
   340 lemma HNatInfinite_iff: "HNatInfinite = {N. \<forall>n \<in> Nats. n < N}"
   334 lemma HNatInfinite_iff: "HNatInfinite = {N. \<forall>n \<in> Nats. n < N}"
   341 apply (safe intro!: Nats_less_HNatInfinite)
   335 apply (safe intro!: Nats_less_HNatInfinite)
   342 apply (auto simp add: HNatInfinite_def)
   336 apply (auto simp add: HNatInfinite_def)
   345 
   339 
   346 subsubsection{*Alternative Characterization of @{term HNatInfinite} using 
   340 subsubsection{*Alternative Characterization of @{term HNatInfinite} using 
   347 Free Ultrafilter*}
   341 Free Ultrafilter*}
   348 
   342 
   349 lemma HNatInfinite_FreeUltrafilterNat:
   343 lemma HNatInfinite_FreeUltrafilterNat:
   350      "star_n X \<in> HNatInfinite ==> \<forall>u. {n. u < X n}:  FreeUltrafilterNat"
   344      "star_n X \<in> HNatInfinite ==> \<forall>u. eventually (\<lambda>n. u < X n) FreeUltrafilterNat"
   351 apply (auto simp add: HNatInfinite_iff SHNat_eq)
   345 apply (auto simp add: HNatInfinite_iff SHNat_eq)
   352 apply (drule_tac x="star_of u" in spec, simp)
   346 apply (drule_tac x="star_of u" in spec, simp)
   353 apply (simp add: star_of_def star_less_def starP2_star_n)
   347 apply (simp add: star_of_def star_less_def starP2_star_n)
   354 done
   348 done
   355 
   349 
   356 lemma FreeUltrafilterNat_HNatInfinite:
   350 lemma FreeUltrafilterNat_HNatInfinite:
   357      "\<forall>u. {n. u < X n}:  FreeUltrafilterNat ==> star_n X \<in> HNatInfinite"
   351      "\<forall>u. eventually (\<lambda>n. u < X n) FreeUltrafilterNat ==> star_n X \<in> HNatInfinite"
   358 by (auto simp add: star_less_def starP2_star_n HNatInfinite_iff SHNat_eq hypnat_of_nat_eq)
   352 by (auto simp add: star_less_def starP2_star_n HNatInfinite_iff SHNat_eq hypnat_of_nat_eq)
   359 
   353 
   360 lemma HNatInfinite_FreeUltrafilterNat_iff:
   354 lemma HNatInfinite_FreeUltrafilterNat_iff:
   361      "(star_n X \<in> HNatInfinite) = (\<forall>u. {n. u < X n}:  FreeUltrafilterNat)"
   355      "(star_n X \<in> HNatInfinite) = (\<forall>u. eventually (\<lambda>n. u < X n) FreeUltrafilterNat)"
   362 by (rule iffI [OF HNatInfinite_FreeUltrafilterNat 
   356 by (rule iffI [OF HNatInfinite_FreeUltrafilterNat 
   363                  FreeUltrafilterNat_HNatInfinite])
   357                  FreeUltrafilterNat_HNatInfinite])
   364 
   358 
   365 subsection {* Embedding of the Hypernaturals into other types *}
   359 subsection {* Embedding of the Hypernaturals into other types *}
   366 
   360