src/HOL/NSA/HyperDef.thy
changeset 61609 77b453bd616f
parent 61378 3e04c9ca001a
child 61806 d2e62ae01cd8
equal deleted inserted replaced
61553:933eb9e6a1cc 61609:77b453bd616f
   229 Use assumption that member @{term FreeUltrafilterNat} is not finite.*}
   229 Use assumption that member @{term FreeUltrafilterNat} is not finite.*}
   230 
   230 
   231 
   231 
   232 text{*A few lemmas first*}
   232 text{*A few lemmas first*}
   233 
   233 
   234 lemma lemma_omega_empty_singleton_disj: "{n::nat. x = real n} = {} |
   234 lemma lemma_omega_empty_singleton_disj: 
   235       (\<exists>y. {n::nat. x = real n} = {y})"
   235   "{n::nat. x = real n} = {} \<or> (\<exists>y. {n::nat. x = real n} = {y})"
   236 by force
   236 by force
   237 
   237 
   238 lemma lemma_finite_omega_set: "finite {n::nat. x = real n}"
   238 lemma lemma_finite_omega_set: "finite {n::nat. x = real n}"
   239 by (cut_tac x = x in lemma_omega_empty_singleton_disj, auto)
   239   using lemma_omega_empty_singleton_disj [of x] by auto
   240 
   240 
   241 lemma not_ex_hypreal_of_real_eq_omega:
   241 lemma not_ex_hypreal_of_real_eq_omega:
   242       "~ (\<exists>x. hypreal_of_real x = omega)"
   242       "~ (\<exists>x. hypreal_of_real x = omega)"
   243 apply (simp add: omega_def)
   243 apply (simp add: omega_def star_of_def star_n_eq_iff)
   244 apply (simp add: star_of_def star_n_eq_iff)
   244 apply clarify
   245 apply (auto simp add: real_of_nat_Suc diff_eq_eq [symmetric]
   245 apply (rule_tac x2="x-1" in lemma_finite_omega_set [THEN FreeUltrafilterNat.finite, THEN notE])
   246             lemma_finite_omega_set [THEN FreeUltrafilterNat.finite])
   246 apply (rule eventually_mono)
       
   247 prefer 2 apply assumption
       
   248 apply auto
   247 done
   249 done
   248 
   250 
   249 lemma hypreal_of_real_not_eq_omega: "hypreal_of_real x \<noteq> omega"
   251 lemma hypreal_of_real_not_eq_omega: "hypreal_of_real x \<noteq> omega"
   250 by (insert not_ex_hypreal_of_real_eq_omega, auto)
   252 by (insert not_ex_hypreal_of_real_eq_omega, auto)
   251 
   253 
   260 lemma lemma_finite_epsilon_set: "finite {n. x = inverse(real(Suc n))}"
   262 lemma lemma_finite_epsilon_set: "finite {n. x = inverse(real(Suc n))}"
   261 by (cut_tac x = x in lemma_epsilon_empty_singleton_disj, auto)
   263 by (cut_tac x = x in lemma_epsilon_empty_singleton_disj, auto)
   262 
   264 
   263 lemma not_ex_hypreal_of_real_eq_epsilon: "~ (\<exists>x. hypreal_of_real x = epsilon)"
   265 lemma not_ex_hypreal_of_real_eq_epsilon: "~ (\<exists>x. hypreal_of_real x = epsilon)"
   264 by (auto simp add: epsilon_def star_of_def star_n_eq_iff
   266 by (auto simp add: epsilon_def star_of_def star_n_eq_iff
   265                    lemma_finite_epsilon_set [THEN FreeUltrafilterNat.finite] simp del: real_of_nat_Suc)
   267                    lemma_finite_epsilon_set [THEN FreeUltrafilterNat.finite] simp del: of_nat_Suc)
   266 
   268 
   267 lemma hypreal_of_real_not_eq_epsilon: "hypreal_of_real x \<noteq> epsilon"
   269 lemma hypreal_of_real_not_eq_epsilon: "hypreal_of_real x \<noteq> epsilon"
   268 by (insert not_ex_hypreal_of_real_eq_epsilon, auto)
   270 by (insert not_ex_hypreal_of_real_eq_epsilon, auto)
   269 
   271 
   270 lemma hypreal_epsilon_not_zero: "epsilon \<noteq> 0"
   272 lemma hypreal_epsilon_not_zero: "epsilon \<noteq> 0"
   305 (*------------------------------------------------------------*)
   307 (*------------------------------------------------------------*)
   306 (* naturals embedded in hyperreals                            *)
   308 (* naturals embedded in hyperreals                            *)
   307 (* is a hyperreal c.f. NS extension                           *)
   309 (* is a hyperreal c.f. NS extension                           *)
   308 (*------------------------------------------------------------*)
   310 (*------------------------------------------------------------*)
   309 
   311 
   310 lemma hypreal_of_nat_eq:
   312 lemma hypreal_of_nat: "hypreal_of_nat m = star_n (%n. real m)"
   311      "hypreal_of_nat (n::nat) = hypreal_of_real (real n)"
   313 by (simp add: star_of_def [symmetric])
   312 by (simp add: real_of_nat_def)
       
   313 
       
   314 lemma hypreal_of_nat:
       
   315      "hypreal_of_nat m = star_n (%n. real m)"
       
   316 apply (fold star_of_def)
       
   317 apply (simp add: real_of_nat_def)
       
   318 done
       
   319 
       
   320 (*
       
   321 FIXME: we should declare this, as for type int, but many proofs would break.
       
   322 It replaces x+-y by x-y.
       
   323 Addsimps [symmetric hypreal_diff_def]
       
   324 *)
       
   325 
   314 
   326 declaration {*
   315 declaration {*
   327   K (Lin_Arith.add_inj_thms [@{thm star_of_le} RS iffD2,
   316   K (Lin_Arith.add_inj_thms [@{thm star_of_le} RS iffD2,
   328     @{thm star_of_less} RS iffD2, @{thm star_of_eq} RS iffD2]
   317     @{thm star_of_less} RS iffD2, @{thm star_of_eq} RS iffD2]
   329   #> Lin_Arith.add_simps [@{thm star_of_zero}, @{thm star_of_one},
   318   #> Lin_Arith.add_simps [@{thm star_of_zero}, @{thm star_of_one},
   380      "abs(x ^ Suc (Suc 0)) = (x::hypreal) ^ Suc (Suc 0)"
   369      "abs(x ^ Suc (Suc 0)) = (x::hypreal) ^ Suc (Suc 0)"
   381 by (simp add: abs_mult)
   370 by (simp add: abs_mult)
   382 
   371 
   383 lemma two_hrealpow_ge_one [simp]: "(1::hypreal) \<le> 2 ^ n"
   372 lemma two_hrealpow_ge_one [simp]: "(1::hypreal) \<le> 2 ^ n"
   384 by (insert power_increasing [of 0 n "2::hypreal"], simp)
   373 by (insert power_increasing [of 0 n "2::hypreal"], simp)
   385 
       
   386 lemma two_hrealpow_gt [simp]: "hypreal_of_nat n < 2 ^ n"
       
   387 apply (induct n)
       
   388 apply (auto simp add: distrib_right)
       
   389 apply (cut_tac n = n in two_hrealpow_ge_one, arith)
       
   390 done
       
   391 
   374 
   392 lemma hrealpow:
   375 lemma hrealpow:
   393     "star_n X ^ m = star_n (%n. (X n::real) ^ m)"
   376     "star_n X ^ m = star_n (%n. (X n::real) ^ m)"
   394 apply (induct_tac "m")
   377 apply (induct_tac "m")
   395 apply (auto simp add: star_n_one_num star_n_mult power_0)
   378 apply (auto simp add: star_n_one_num star_n_mult power_0)