src/HOL/Hyperreal/NatStar.ML
changeset 14378 69c4d5997669
parent 14371 c78c7da09519
equal deleted inserted replaced
14377:f454b3004f8f 14378:69c4d5997669
     4     Description : *-transforms in NSA which extends 
     4     Description : *-transforms in NSA which extends 
     5                   sets of reals, and nat=>real, 
     5                   sets of reals, and nat=>real, 
     6                   nat=>nat functions
     6                   nat=>nat functions
     7 *) 
     7 *) 
     8 
     8 
       
     9 val hypnat_of_nat_eq = thm"hypnat_of_nat_eq";
       
    10 val SHNat_eq = thm"SHNat_eq";
       
    11 
     9 Goalw [starsetNat_def] 
    12 Goalw [starsetNat_def] 
    10       "*sNat*(UNIV::nat set) = (UNIV::hypnat set)";
    13       "*sNat*(UNIV::nat set) = (UNIV::hypnat set)";
    11 by (auto_tac (claset(), simpset() addsimps [FreeUltrafilterNat_Nat_set]));
    14 by (auto_tac (claset(), simpset() addsimps [FreeUltrafilterNat_Nat_set]));
    12 qed "NatStar_real_set";
    15 qed "NatStar_real_set";
    13 
    16 
   109 
   112 
   110 Goalw [starsetNat_def] "A <= B ==> *sNat* A <= *sNat* B";
   113 Goalw [starsetNat_def] "A <= B ==> *sNat* A <= *sNat* B";
   111 by (REPEAT(blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 1));
   114 by (REPEAT(blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 1));
   112 qed "NatStar_subset";
   115 qed "NatStar_subset";
   113 
   116 
   114 Goalw [starsetNat_def,hypnat_of_nat_def] 
   117 Goal "a : A ==> hypnat_of_nat a : *sNat* A";
   115           "a : A ==> hypnat_of_nat a : *sNat* A";
       
   116 by (auto_tac (claset() addIs [FreeUltrafilterNat_subset],
   118 by (auto_tac (claset() addIs [FreeUltrafilterNat_subset],
   117          simpset()));
   119          simpset() addsimps [starsetNat_def,hypnat_of_nat_eq]));
   118 qed "NatStar_mem";
   120 qed "NatStar_mem";
   119 
   121 
   120 Goalw [starsetNat_def] "hypnat_of_nat ` A <= *sNat* A";
   122 Goalw [starsetNat_def] "hypnat_of_nat ` A <= *sNat* A";
   121 by (auto_tac (claset(), simpset() addsimps [hypnat_of_nat_def]));
   123 by (auto_tac (claset(), simpset() addsimps [hypnat_of_nat_eq]));
   122 by (blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 1);
   124 by (blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 1);
   123 qed "NatStar_hypreal_of_real_image_subset";
   125 qed "NatStar_hypreal_of_real_image_subset";
   124 
   126 
   125 Goal "Nats <= *sNat* (UNIV:: nat set)";
   127 Goal "Nats <= *sNat* (UNIV:: nat set)";
   126 by (simp_tac (simpset() addsimps [SHNat_hypnat_of_nat_iff,
   128 by (auto_tac (claset(), simpset() addsimps [starsetNat_def,SHNat_eq,hypnat_of_nat_eq]));
   127                           NatStar_hypreal_of_real_image_subset]) 1);
       
   128 qed "NatStar_SHNat_subset";
   129 qed "NatStar_SHNat_subset";
   129 
   130 
   130 Goalw [starsetNat_def] 
   131 Goalw [starsetNat_def] 
   131      "*sNat* X Int Nats = hypnat_of_nat ` X";
   132      "*sNat* X Int Nats = hypnat_of_nat ` X";
   132 by (auto_tac (claset(),
   133 by (auto_tac (claset(),
   133          simpset() addsimps 
   134          simpset() addsimps 
   134            [hypnat_of_nat_def,SHNat_def]));
   135            [hypnat_of_nat_eq,SHNat_eq]));
   135 by (fold_tac [hypnat_of_nat_def]);
   136 by (simp_tac (simpset() addsimps [hypnat_of_nat_eq RS sym]) 1);
   136 by (rtac imageI 1 THEN rtac ccontr 1);
   137 by (rtac imageI 1 THEN rtac ccontr 1);
   137 by (dtac bspec 1);
   138 by (dtac bspec 1);
   138 by (rtac lemma_hypnatrel_refl 1);
   139 by (rtac lemma_hypnatrel_refl 1);
   139 by (blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 2);
   140 by (blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 2);
   140 by (Auto_tac);
   141 by (Auto_tac);
   287 qed "starfunNat_const_fun";
   288 qed "starfunNat_const_fun";
   288 Addsimps [starfunNat_const_fun];
   289 Addsimps [starfunNat_const_fun];
   289 
   290 
   290 Goal "( *fNat2* (%x. k)) z = hypnat_of_nat  k";
   291 Goal "( *fNat2* (%x. k)) z = hypnat_of_nat  k";
   291 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   292 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   292 by (auto_tac (claset(), simpset() addsimps [starfunNat2, hypnat_of_nat_def]));
   293 by (auto_tac (claset(), simpset() addsimps [starfunNat2, hypnat_of_nat_eq]));
   293 qed "starfunNat2_const_fun";
   294 qed "starfunNat2_const_fun";
   294 
   295 
   295 Addsimps [starfunNat2_const_fun];
   296 Addsimps [starfunNat2_const_fun];
   296 
   297 
   297 Goal "- ( *fNat* f) x = ( *fNat* (%x. - f x)) x";
   298 Goal "- ( *fNat* f) x = ( *fNat* (%x. - f x)) x";
   310    for all natural arguments (c.f. Hoskins pg. 107- SEQ)
   311    for all natural arguments (c.f. Hoskins pg. 107- SEQ)
   311  -------------------------------------------------------*)
   312  -------------------------------------------------------*)
   312 
   313 
   313 Goal "( *fNat* f) (hypnat_of_nat a) = hypreal_of_real (f a)";
   314 Goal "( *fNat* f) (hypnat_of_nat a) = hypreal_of_real (f a)";
   314 by (auto_tac (claset(),
   315 by (auto_tac (claset(),
   315       simpset() addsimps [starfunNat,hypnat_of_nat_def,hypreal_of_real_def]));
   316       simpset() addsimps [starfunNat,hypnat_of_nat_eq,hypreal_of_real_def]));
   316 qed "starfunNat_eq";
   317 qed "starfunNat_eq";
   317 
   318 
   318 Addsimps [starfunNat_eq];
   319 Addsimps [starfunNat_eq];
   319 
   320 
   320 Goal "( *fNat2* f) (hypnat_of_nat a) = hypnat_of_nat (f a)";
   321 Goal "( *fNat2* f) (hypnat_of_nat a) = hypnat_of_nat (f a)";
   321 by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_of_nat_def]));
   322 by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_of_nat_eq]));
   322 qed "starfunNat2_eq";
   323 qed "starfunNat2_eq";
   323 
   324 
   324 Addsimps [starfunNat2_eq];
   325 Addsimps [starfunNat2_eq];
   325 
   326 
   326 Goal "( *fNat* f) (hypnat_of_nat a) @= hypreal_of_real (f a)";
   327 Goal "( *fNat* f) (hypnat_of_nat a) @= hypreal_of_real (f a)";
   335 Goal "ALL n. N <= n --> f n <= g n \
   336 Goal "ALL n. N <= n --> f n <= g n \
   336 \         ==> ALL n. hypnat_of_nat N <= n --> ( *fNat* f) n <= ( *fNat* g) n";
   337 \         ==> ALL n. hypnat_of_nat N <= n --> ( *fNat* f) n <= ( *fNat* g) n";
   337 by (Step_tac 1);
   338 by (Step_tac 1);
   338 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   339 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   339 by (auto_tac (claset(),
   340 by (auto_tac (claset(),
   340          simpset() addsimps [starfunNat, hypnat_of_nat_def,hypreal_le,
   341          simpset() addsimps [starfunNat, hypnat_of_nat_eq,hypreal_le,
   341                              hypreal_less, hypnat_le,hypnat_less]));
   342                              hypreal_less, hypnat_le,hypnat_less]));
   342 by (Ultra_tac 1);
   343 by (Ultra_tac 1);
   343 by Auto_tac;
   344 by Auto_tac;
   344 qed "starfun_le_mono";
   345 qed "starfun_le_mono";
   345 
   346 
   347 Goal "ALL n. N <= n --> f n < g n \
   348 Goal "ALL n. N <= n --> f n < g n \
   348 \         ==> ALL n. hypnat_of_nat N <= n --> ( *fNat* f) n < ( *fNat* g) n";
   349 \         ==> ALL n. hypnat_of_nat N <= n --> ( *fNat* f) n < ( *fNat* g) n";
   349 by (Step_tac 1);
   350 by (Step_tac 1);
   350 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   351 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   351 by (auto_tac (claset(),
   352 by (auto_tac (claset(),
   352          simpset() addsimps [starfunNat, hypnat_of_nat_def,hypreal_le,
   353          simpset() addsimps [starfunNat, hypnat_of_nat_eq,hypreal_le,
   353                              hypreal_less, hypnat_le,hypnat_less]));
   354                              hypreal_less, hypnat_le,hypnat_less]));
   354 by (Ultra_tac 1);
   355 by (Ultra_tac 1);
   355 by Auto_tac;
   356 by Auto_tac;
   356 qed "starfun_less_mono";
   357 qed "starfun_less_mono";
   357 
   358 
   382 qed "starfunNat_pow";
   383 qed "starfunNat_pow";
   383 
   384 
   384 Goal "( *fNat* (%n. (X n) ^ m)) N = ( *fNat* X) N pow hypnat_of_nat m";
   385 Goal "( *fNat* (%n. (X n) ^ m)) N = ( *fNat* X) N pow hypnat_of_nat m";
   385 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   386 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   386 by (auto_tac (claset(),
   387 by (auto_tac (claset(),
   387          simpset() addsimps [hyperpow, hypnat_of_nat_def,starfunNat]));
   388          simpset() addsimps [hyperpow, hypnat_of_nat_eq,starfunNat]));
   388 qed "starfunNat_pow2";
   389 qed "starfunNat_pow2";
   389 
   390 
   390 Goalw [hypnat_of_nat_def] "( *f* (%r. r ^ n)) R = (R) pow hypnat_of_nat n";
   391 Goal "( *f* (%r. r ^ n)) R = (R) pow hypnat_of_nat n";
   391 by (res_inst_tac [("z","R")] eq_Abs_hypreal 1);
   392 by (res_inst_tac [("z","R")] eq_Abs_hypreal 1);
   392 by (auto_tac (claset(), simpset() addsimps [hyperpow,starfun]));
   393 by (auto_tac (claset(), simpset() addsimps [hyperpow,starfun,hypnat_of_nat_eq]));
   393 qed "starfun_pow";
   394 qed "starfun_pow";
   394 
   395 
   395 (*----------------------------------------------------- 
   396 (*----------------------------------------------------- 
   396    hypreal_of_hypnat as NS extension of real (from "nat")! 
   397    hypreal_of_hypnat as NS extension of real (from "nat")! 
   397 -------------------------------------------------------*)
   398 -------------------------------------------------------*)
   467 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   468 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   468 by (auto_tac (claset(), simpset() addsimps [starfunNat_n, hypreal_minus]));
   469 by (auto_tac (claset(), simpset() addsimps [starfunNat_n, hypreal_minus]));
   469 qed "starfunNat_n_minus";
   470 qed "starfunNat_n_minus";
   470 
   471 
   471 Goal "( *fNatn* f) (hypnat_of_nat n) = Abs_hypreal(hyprel `` {%i. f i n})";
   472 Goal "( *fNatn* f) (hypnat_of_nat n) = Abs_hypreal(hyprel `` {%i. f i n})";
   472 by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypnat_of_nat_def]));
   473 by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypnat_of_nat_eq]));
   473 qed "starfunNat_n_eq";
   474 qed "starfunNat_n_eq";
   474 Addsimps [starfunNat_n_eq];
   475 Addsimps [starfunNat_n_eq];
   475 
   476 
   476 Goal "(( *fNat* f) = ( *fNat* g)) = (f = g)";
   477 Goal "(( *fNat* f) = ( *fNat* g)) = (f = g)";
   477 by Auto_tac;
   478 by Auto_tac;
   478 by (rtac ext 1 THEN rtac ccontr 1);
   479 by (rtac ext 1 THEN rtac ccontr 1);
   479 by (dres_inst_tac [("x","hypnat_of_nat(x)")] fun_cong 1);
   480 by (dres_inst_tac [("x","hypnat_of_nat(x)")] fun_cong 1);
   480 by (auto_tac (claset(), simpset() addsimps [starfunNat,hypnat_of_nat_def]));
   481 by (auto_tac (claset(), simpset() addsimps [starfunNat,hypnat_of_nat_eq]));
   481 qed "starfun_eq_iff";
   482 qed "starfun_eq_iff";
   482 
   483 
   483 
   484 
   484 
   485 
   485 (*MOVE UP*)
   486 (*MOVE UP*)