src/HOL/Hyperreal/NatStar.ML
changeset 13810 c3fbfd472365
parent 12486 0ed8bdd883e0
child 14268 5cf13e80be0e
equal deleted inserted replaced
13809:a4cd9057d2ee 13810:c3fbfd472365
    68 \     ==> (X Int Y) : InternalNatSets";
    68 \     ==> (X Int Y) : InternalNatSets";
    69 by (auto_tac (claset(),
    69 by (auto_tac (claset(),
    70          simpset() addsimps [starsetNat_n_Int RS sym]));
    70          simpset() addsimps [starsetNat_n_Int RS sym]));
    71 qed "InternalNatSets_Int";
    71 qed "InternalNatSets_Int";
    72 
    72 
    73 Goalw [starsetNat_def] "*sNat* (-A) = -(*sNat* A)";
    73 Goalw [starsetNat_def] "*sNat* (-A) = -( *sNat* A)";
    74 by (Auto_tac);
    74 by (Auto_tac);
    75 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
    75 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
    76 by (res_inst_tac [("z","x")] eq_Abs_hypnat 2);
    76 by (res_inst_tac [("z","x")] eq_Abs_hypnat 2);
    77 by (REPEAT(Step_tac 1) THEN Auto_tac);
    77 by (REPEAT(Step_tac 1) THEN Auto_tac);
    78 by (TRYALL(Ultra_tac));
    78 by (TRYALL(Ultra_tac));
    79 qed "NatStar_Compl";
    79 qed "NatStar_Compl";
    80 
    80 
    81 Goalw [starsetNat_n_def] "*sNatn* ((%n. - A n)) = -(*sNatn* A)";
    81 Goalw [starsetNat_n_def] "*sNatn* ((%n. - A n)) = -( *sNatn* A)";
    82 by (Auto_tac);
    82 by (Auto_tac);
    83 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
    83 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
    84 by (res_inst_tac [("z","x")] eq_Abs_hypnat 2);
    84 by (res_inst_tac [("z","x")] eq_Abs_hypnat 2);
    85 by (REPEAT(Step_tac 1) THEN Auto_tac);
    85 by (REPEAT(Step_tac 1) THEN Auto_tac);
    86 by (TRYALL(Ultra_tac));
    86 by (TRYALL(Ultra_tac));
   146 
   146 
   147 Goalw [starsetNat_n_def,starsetNat_def] "*sNat* X = *sNatn* (%n. X)";
   147 Goalw [starsetNat_n_def,starsetNat_def] "*sNat* X = *sNatn* (%n. X)";
   148 by Auto_tac;
   148 by Auto_tac;
   149 qed "starsetNat_starsetNat_n_eq";
   149 qed "starsetNat_starsetNat_n_eq";
   150 
   150 
   151 Goalw [InternalNatSets_def] "(*sNat* X) : InternalNatSets";
   151 Goalw [InternalNatSets_def] "( *sNat* X) : InternalNatSets";
   152 by (auto_tac (claset(),
   152 by (auto_tac (claset(),
   153          simpset() addsimps [starsetNat_starsetNat_n_eq]));
   153          simpset() addsimps [starsetNat_starsetNat_n_eq]));
   154 qed "InternalNatSets_starsetNat_n";
   154 qed "InternalNatSets_starsetNat_n";
   155 Addsimps [InternalNatSets_starsetNat_n];
   155 Addsimps [InternalNatSets_starsetNat_n];
   156 
   156 
   193 by (ALLGOALS(Fuf_tac));
   193 by (ALLGOALS(Fuf_tac));
   194 qed "starfunNat_congruent";
   194 qed "starfunNat_congruent";
   195 
   195 
   196 (* f::nat=>real *)
   196 (* f::nat=>real *)
   197 Goalw [starfunNat_def]
   197 Goalw [starfunNat_def]
   198       "(*fNat* f) (Abs_hypnat(hypnatrel``{%n. X n})) = \
   198       "( *fNat* f) (Abs_hypnat(hypnatrel``{%n. X n})) = \
   199 \      Abs_hypreal(hyprel `` {%n. f (X n)})";
   199 \      Abs_hypreal(hyprel `` {%n. f (X n)})";
   200 by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1);
   200 by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1);
   201 by (simp_tac (simpset() addsimps 
   201 by (simp_tac (simpset() addsimps 
   202    [hyprel_in_hypreal RS Abs_hypreal_inverse]) 1);
   202    [hyprel_in_hypreal RS Abs_hypreal_inverse]) 1);
   203 by (Auto_tac THEN Fuf_tac 1);
   203 by (Auto_tac THEN Fuf_tac 1);
   204 qed "starfunNat";
   204 qed "starfunNat";
   205 
   205 
   206 (* f::nat=>nat *)
   206 (* f::nat=>nat *)
   207 Goalw [starfunNat2_def]
   207 Goalw [starfunNat2_def]
   208       "(*fNat2* f) (Abs_hypnat(hypnatrel``{%n. X n})) = \
   208       "( *fNat2* f) (Abs_hypnat(hypnatrel``{%n. X n})) = \
   209 \      Abs_hypnat(hypnatrel `` {%n. f (X n)})";
   209 \      Abs_hypnat(hypnatrel `` {%n. f (X n)})";
   210 by (res_inst_tac [("f","Abs_hypnat")] arg_cong 1);
   210 by (res_inst_tac [("f","Abs_hypnat")] arg_cong 1);
   211 by (simp_tac (simpset() addsimps 
   211 by (simp_tac (simpset() addsimps 
   212    [hypnatrel_in_hypnat RS Abs_hypnat_inverse,
   212    [hypnatrel_in_hypnat RS Abs_hypnat_inverse,
   213     [equiv_hypnatrel, starfunNat_congruent] MRS UN_equiv_class]) 1);
   213     [equiv_hypnatrel, starfunNat_congruent] MRS UN_equiv_class]) 1);
   214 qed "starfunNat2";
   214 qed "starfunNat2";
   215 
   215 
   216 (*---------------------------------------------
   216 (*---------------------------------------------
   217   multiplication: ( *f ) x ( *g ) = *(f x g)  
   217   multiplication: ( *f ) x ( *g ) = *(f x g)  
   218  ---------------------------------------------*)
   218  ---------------------------------------------*)
   219 Goal "(*fNat* f) z * (*fNat* g) z = (*fNat* (%x. f x * g x)) z";
   219 Goal "( *fNat* f) z * ( *fNat* g) z = ( *fNat* (%x. f x * g x)) z";
   220 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   220 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   221 by (auto_tac (claset(), simpset() addsimps [starfunNat,hypreal_mult]));
   221 by (auto_tac (claset(), simpset() addsimps [starfunNat,hypreal_mult]));
   222 qed "starfunNat_mult";
   222 qed "starfunNat_mult";
   223 
   223 
   224 Goal "(*fNat2* f) z * (*fNat2* g) z = (*fNat2* (%x. f x * g x)) z";
   224 Goal "( *fNat2* f) z * ( *fNat2* g) z = ( *fNat2* (%x. f x * g x)) z";
   225 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   225 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   226 by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_mult]));
   226 by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_mult]));
   227 qed "starfunNat2_mult";
   227 qed "starfunNat2_mult";
   228 
   228 
   229 (*---------------------------------------
   229 (*---------------------------------------
   230   addition: ( *f ) + ( *g ) = *(f + g)  
   230   addition: ( *f ) + ( *g ) = *(f + g)  
   231  ---------------------------------------*)
   231  ---------------------------------------*)
   232 Goal "(*fNat* f) z + (*fNat* g) z = (*fNat* (%x. f x + g x)) z";
   232 Goal "( *fNat* f) z + ( *fNat* g) z = ( *fNat* (%x. f x + g x)) z";
   233 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   233 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   234 by (auto_tac (claset(), simpset() addsimps [starfunNat,hypreal_add]));
   234 by (auto_tac (claset(), simpset() addsimps [starfunNat,hypreal_add]));
   235 qed "starfunNat_add";
   235 qed "starfunNat_add";
   236 
   236 
   237 Goal "(*fNat2* f) z + (*fNat2* g) z = (*fNat2* (%x. f x + g x)) z";
   237 Goal "( *fNat2* f) z + ( *fNat2* g) z = ( *fNat2* (%x. f x + g x)) z";
   238 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   238 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   239 by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_add]));
   239 by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_add]));
   240 qed "starfunNat2_add";
   240 qed "starfunNat2_add";
   241 
   241 
   242 Goal "(*fNat2* f) z - (*fNat2* g) z = (*fNat2* (%x. f x - g x)) z";
   242 Goal "( *fNat2* f) z - ( *fNat2* g) z = ( *fNat2* (%x. f x - g x)) z";
   243 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   243 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   244 by (auto_tac (claset(), simpset() addsimps [starfunNat2, hypnat_minus]));
   244 by (auto_tac (claset(), simpset() addsimps [starfunNat2, hypnat_minus]));
   245 qed "starfunNat2_minus";
   245 qed "starfunNat2_minus";
   246 
   246 
   247 (*--------------------------------------
   247 (*--------------------------------------
   248   composition: ( *f ) o ( *g ) = *(f o g)  
   248   composition: ( *f ) o ( *g ) = *(f o g)  
   249  ---------------------------------------*)
   249  ---------------------------------------*)
   250 (***** ( *f::nat=>real ) o ( *g::nat=>nat ) = *(f o g) *****)
   250 (***** ( *f::nat=>real ) o ( *g::nat=>nat ) = *(f o g) *****)
   251  
   251  
   252 Goal "(*fNat* f) o (*fNat2* g) = (*fNat* (f o g))";
   252 Goal "( *fNat* f) o ( *fNat2* g) = ( *fNat* (f o g))";
   253 by (rtac ext 1);
   253 by (rtac ext 1);
   254 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   254 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   255 by (auto_tac (claset(), simpset() addsimps [starfunNat2, starfunNat]));
   255 by (auto_tac (claset(), simpset() addsimps [starfunNat2, starfunNat]));
   256 qed "starfunNatNat2_o";
   256 qed "starfunNatNat2_o";
   257 
   257 
   258 Goal "(%x. (*fNat* f) ((*fNat2* g) x)) = (*fNat* (%x. f(g x)))";
   258 Goal "(%x. ( *fNat* f) (( *fNat2* g) x)) = ( *fNat* (%x. f(g x)))";
   259 by (rtac ( simplify (simpset() addsimps [o_def]) starfunNatNat2_o) 1);
   259 by (rtac ( simplify (simpset() addsimps [o_def]) starfunNatNat2_o) 1);
   260 qed "starfunNatNat2_o2";
   260 qed "starfunNatNat2_o2";
   261 
   261 
   262 (***** ( *f::nat=>nat ) o ( *g::nat=>nat ) = *(f o g) *****)
   262 (***** ( *f::nat=>nat ) o ( *g::nat=>nat ) = *(f o g) *****)
   263 Goal "(*fNat2* f) o (*fNat2* g) = (*fNat2* (f o g))";
   263 Goal "( *fNat2* f) o ( *fNat2* g) = ( *fNat2* (f o g))";
   264 by (rtac ext 1);
   264 by (rtac ext 1);
   265 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   265 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   266 by (auto_tac (claset(), simpset() addsimps [starfunNat2]));
   266 by (auto_tac (claset(), simpset() addsimps [starfunNat2]));
   267 qed "starfunNat2_o";
   267 qed "starfunNat2_o";
   268 
   268 
   269 (***** ( *f::real=>real ) o ( *g::nat=>real ) = *(f o g) *****)
   269 (***** ( *f::real=>real ) o ( *g::nat=>real ) = *(f o g) *****)
   270 
   270 
   271 Goal "(*f* f) o (*fNat* g) = (*fNat* (f o g))"; 
   271 Goal "( *f* f) o ( *fNat* g) = ( *fNat* (f o g))"; 
   272 by (rtac ext 1);
   272 by (rtac ext 1);
   273 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   273 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   274 by (auto_tac (claset(), simpset() addsimps [starfunNat,starfun]));
   274 by (auto_tac (claset(), simpset() addsimps [starfunNat,starfun]));
   275 qed "starfun_stafunNat_o";
   275 qed "starfun_stafunNat_o";
   276 
   276 
   277 Goal "(%x. (*f* f) ((*fNat* g) x)) = (*fNat* (%x. f (g x)))"; 
   277 Goal "(%x. ( *f* f) (( *fNat* g) x)) = ( *fNat* (%x. f (g x)))"; 
   278 by (rtac ( simplify (simpset() addsimps [o_def]) starfun_stafunNat_o) 1);
   278 by (rtac ( simplify (simpset() addsimps [o_def]) starfun_stafunNat_o) 1);
   279 qed "starfun_stafunNat_o2";
   279 qed "starfun_stafunNat_o2";
   280 
   280 
   281 (*--------------------------------------
   281 (*--------------------------------------
   282   NS extension of constant function
   282   NS extension of constant function
   283  --------------------------------------*)
   283  --------------------------------------*)
   284 Goal "(*fNat* (%x. k)) z = hypreal_of_real k";
   284 Goal "( *fNat* (%x. k)) z = hypreal_of_real k";
   285 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   285 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   286 by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_of_real_def]));
   286 by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_of_real_def]));
   287 qed "starfunNat_const_fun";
   287 qed "starfunNat_const_fun";
   288 Addsimps [starfunNat_const_fun];
   288 Addsimps [starfunNat_const_fun];
   289 
   289 
   290 Goal "(*fNat2* (%x. k)) z = hypnat_of_nat  k";
   290 Goal "( *fNat2* (%x. k)) z = hypnat_of_nat  k";
   291 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   291 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   292 by (auto_tac (claset(), simpset() addsimps [starfunNat2, hypnat_of_nat_def]));
   292 by (auto_tac (claset(), simpset() addsimps [starfunNat2, hypnat_of_nat_def]));
   293 qed "starfunNat2_const_fun";
   293 qed "starfunNat2_const_fun";
   294 
   294 
   295 Addsimps [starfunNat2_const_fun];
   295 Addsimps [starfunNat2_const_fun];
   296 
   296 
   297 Goal "- (*fNat* f) x = (*fNat* (%x. - f x)) x";
   297 Goal "- ( *fNat* f) x = ( *fNat* (%x. - f x)) x";
   298 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   298 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   299 by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_minus]));
   299 by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_minus]));
   300 qed "starfunNat_minus";
   300 qed "starfunNat_minus";
   301 
   301 
   302 Goal "inverse ((*fNat* f) x) = (*fNat* (%x. inverse (f x))) x";
   302 Goal "inverse (( *fNat* f) x) = ( *fNat* (%x. inverse (f x))) x";
   303 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   303 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   304 by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_inverse]));
   304 by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_inverse]));
   305 qed "starfunNat_inverse";
   305 qed "starfunNat_inverse";
   306 
   306 
   307 (*--------------------------------------------------------
   307 (*--------------------------------------------------------
   308    extented function has same solution as its standard
   308    extented function has same solution as its standard
   309    version for natural arguments. i.e they are the same
   309    version for natural arguments. i.e they are the same
   310    for all natural arguments (c.f. Hoskins pg. 107- SEQ)
   310    for all natural arguments (c.f. Hoskins pg. 107- SEQ)
   311  -------------------------------------------------------*)
   311  -------------------------------------------------------*)
   312 
   312 
   313 Goal "(*fNat* f) (hypnat_of_nat a) = hypreal_of_real (f a)";
   313 Goal "( *fNat* f) (hypnat_of_nat a) = hypreal_of_real (f a)";
   314 by (auto_tac (claset(),
   314 by (auto_tac (claset(),
   315       simpset() addsimps [starfunNat,hypnat_of_nat_def,hypreal_of_real_def]));
   315       simpset() addsimps [starfunNat,hypnat_of_nat_def,hypreal_of_real_def]));
   316 qed "starfunNat_eq";
   316 qed "starfunNat_eq";
   317 
   317 
   318 Addsimps [starfunNat_eq];
   318 Addsimps [starfunNat_eq];
   319 
   319 
   320 Goal "(*fNat2* f) (hypnat_of_nat a) = hypnat_of_nat (f a)";
   320 Goal "( *fNat2* f) (hypnat_of_nat a) = hypnat_of_nat (f a)";
   321 by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_of_nat_def]));
   321 by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_of_nat_def]));
   322 qed "starfunNat2_eq";
   322 qed "starfunNat2_eq";
   323 
   323 
   324 Addsimps [starfunNat2_eq];
   324 Addsimps [starfunNat2_eq];
   325 
   325 
   326 Goal "(*fNat* f) (hypnat_of_nat a) @= hypreal_of_real (f a)";
   326 Goal "( *fNat* f) (hypnat_of_nat a) @= hypreal_of_real (f a)";
   327 by (Auto_tac);
   327 by (Auto_tac);
   328 qed "starfunNat_approx";
   328 qed "starfunNat_approx";
   329 
   329 
   330 
   330 
   331 (*-----------------------------------------------------------------
   331 (*-----------------------------------------------------------------
   332     Example of transfer of a property from reals to hyperreals
   332     Example of transfer of a property from reals to hyperreals
   333     --- used for limit comparison of sequences
   333     --- used for limit comparison of sequences
   334  ----------------------------------------------------------------*)
   334  ----------------------------------------------------------------*)
   335 Goal "ALL n. N <= n --> f n <= g n \
   335 Goal "ALL n. N <= n --> f n <= g n \
   336 \         ==> ALL n. hypnat_of_nat N <= n --> (*fNat* f) n <= (*fNat* g) n";
   336 \         ==> ALL n. hypnat_of_nat N <= n --> ( *fNat* f) n <= ( *fNat* g) n";
   337 by (Step_tac 1);
   337 by (Step_tac 1);
   338 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   338 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   339 by (auto_tac (claset(),
   339 by (auto_tac (claset(),
   340          simpset() addsimps [starfunNat, hypnat_of_nat_def,hypreal_le,
   340          simpset() addsimps [starfunNat, hypnat_of_nat_def,hypreal_le,
   341                              hypreal_less, hypnat_le,hypnat_less]));
   341                              hypreal_less, hypnat_le,hypnat_less]));
   343 by Auto_tac;
   343 by Auto_tac;
   344 qed "starfun_le_mono";
   344 qed "starfun_le_mono";
   345 
   345 
   346 (*****----- and another -----*****) 
   346 (*****----- and another -----*****) 
   347 Goal "ALL n. N <= n --> f n < g n \
   347 Goal "ALL n. N <= n --> f n < g n \
   348 \         ==> ALL n. hypnat_of_nat N <= n --> (*fNat* f) n < (*fNat* g) n";
   348 \         ==> ALL n. hypnat_of_nat N <= n --> ( *fNat* f) n < ( *fNat* g) n";
   349 by (Step_tac 1);
   349 by (Step_tac 1);
   350 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   350 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   351 by (auto_tac (claset(),
   351 by (auto_tac (claset(),
   352          simpset() addsimps [starfunNat, hypnat_of_nat_def,hypreal_le,
   352          simpset() addsimps [starfunNat, hypnat_of_nat_def,hypreal_le,
   353                              hypreal_less, hypnat_le,hypnat_less]));
   353                              hypreal_less, hypnat_le,hypnat_less]));
   356 qed "starfun_less_mono";
   356 qed "starfun_less_mono";
   357 
   357 
   358 (*----------------------------------------------------------------
   358 (*----------------------------------------------------------------
   359             NS extension when we displace argument by one
   359             NS extension when we displace argument by one
   360  ---------------------------------------------------------------*)
   360  ---------------------------------------------------------------*)
   361 Goal "(*fNat* (%n. f (Suc n))) N = (*fNat* f) (N + (1::hypnat))";
   361 Goal "( *fNat* (%n. f (Suc n))) N = ( *fNat* f) (N + (1::hypnat))";
   362 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   362 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   363 by (auto_tac (claset(),
   363 by (auto_tac (claset(),
   364          simpset() addsimps [starfunNat, hypnat_one_def,hypnat_add]));
   364          simpset() addsimps [starfunNat, hypnat_one_def,hypnat_add]));
   365 qed "starfunNat_shift_one";
   365 qed "starfunNat_shift_one";
   366 
   366 
   367 (*----------------------------------------------------------------
   367 (*----------------------------------------------------------------
   368                  NS extension with rabs    
   368                  NS extension with rabs    
   369  ---------------------------------------------------------------*)
   369  ---------------------------------------------------------------*)
   370 Goal "(*fNat* (%n. abs (f n))) N = abs((*fNat* f) N)";
   370 Goal "( *fNat* (%n. abs (f n))) N = abs(( *fNat* f) N)";
   371 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   371 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   372 by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_hrabs]));
   372 by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_hrabs]));
   373 qed "starfunNat_rabs";
   373 qed "starfunNat_rabs";
   374 
   374 
   375 (*----------------------------------------------------------------
   375 (*----------------------------------------------------------------
   376        The hyperpow function as a NS extension of realpow
   376        The hyperpow function as a NS extension of realpow
   377  ----------------------------------------------------------------*)
   377  ----------------------------------------------------------------*)
   378 Goal "(*fNat* (%n. r ^ n)) N = (hypreal_of_real r) pow N";
   378 Goal "( *fNat* (%n. r ^ n)) N = (hypreal_of_real r) pow N";
   379 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   379 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   380 by (auto_tac (claset(),
   380 by (auto_tac (claset(),
   381          simpset() addsimps [hyperpow, hypreal_of_real_def,starfunNat]));
   381          simpset() addsimps [hyperpow, hypreal_of_real_def,starfunNat]));
   382 qed "starfunNat_pow";
   382 qed "starfunNat_pow";
   383 
   383 
   384 Goal "(*fNat* (%n. (X n) ^ m)) N = (*fNat* X) N pow hypnat_of_nat m";
   384 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);
   385 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   386 by (auto_tac (claset(),
   386 by (auto_tac (claset(),
   387          simpset() addsimps [hyperpow, hypnat_of_nat_def,starfunNat]));
   387          simpset() addsimps [hyperpow, hypnat_of_nat_def,starfunNat]));
   388 qed "starfunNat_pow2";
   388 qed "starfunNat_pow2";
   389 
   389 
   390 Goalw [hypnat_of_nat_def] "(*f* (%r. r ^ n)) R = (R) pow hypnat_of_nat n";
   390 Goalw [hypnat_of_nat_def] "( *f* (%r. r ^ n)) R = (R) pow hypnat_of_nat n";
   391 by (res_inst_tac [("z","R")] eq_Abs_hypreal 1);
   391 by (res_inst_tac [("z","R")] eq_Abs_hypreal 1);
   392 by (auto_tac (claset(), simpset() addsimps [hyperpow,starfun]));
   392 by (auto_tac (claset(), simpset() addsimps [hyperpow,starfun]));
   393 qed "starfun_pow";
   393 qed "starfun_pow";
   394 
   394 
   395 (*----------------------------------------------------- 
   395 (*----------------------------------------------------- 
   396    hypreal_of_hypnat as NS extension of real (from "nat")! 
   396    hypreal_of_hypnat as NS extension of real (from "nat")! 
   397 -------------------------------------------------------*)
   397 -------------------------------------------------------*)
   398 Goal "(*fNat* real) = hypreal_of_hypnat";
   398 Goal "( *fNat* real) = hypreal_of_hypnat";
   399 by (rtac ext 1);
   399 by (rtac ext 1);
   400 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   400 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   401 by (auto_tac (claset(), simpset() addsimps [hypreal_of_hypnat,starfunNat]));
   401 by (auto_tac (claset(), simpset() addsimps [hypreal_of_hypnat,starfunNat]));
   402 qed "starfunNat_real_of_nat";
   402 qed "starfunNat_real_of_nat";
   403 
   403 
   404 Goal "N : HNatInfinite \
   404 Goal "N : HNatInfinite \
   405 \  ==> (*fNat* (%x::nat. inverse(real x))) N = inverse(hypreal_of_hypnat N)";
   405 \  ==> ( *fNat* (%x::nat. inverse(real x))) N = inverse(hypreal_of_hypnat N)";
   406 by (res_inst_tac [("f1","inverse")]  (starfun_stafunNat_o2 RS subst) 1);
   406 by (res_inst_tac [("f1","inverse")]  (starfun_stafunNat_o2 RS subst) 1);
   407 by (subgoal_tac "hypreal_of_hypnat N ~= 0" 1);
   407 by (subgoal_tac "hypreal_of_hypnat N ~= 0" 1);
   408 by (auto_tac (claset(), 
   408 by (auto_tac (claset(), 
   409        simpset() addsimps [starfunNat_real_of_nat, starfun_inverse_inverse]));
   409        simpset() addsimps [starfunNat_real_of_nat, starfun_inverse_inverse]));
   410 qed "starfunNat_inverse_real_of_nat_eq";
   410 qed "starfunNat_inverse_real_of_nat_eq";
   417 by Safe_tac;
   417 by Safe_tac;
   418 by (ALLGOALS(Fuf_tac));
   418 by (ALLGOALS(Fuf_tac));
   419 qed "starfunNat_n_congruent";
   419 qed "starfunNat_n_congruent";
   420 
   420 
   421 Goalw [starfunNat_n_def]
   421 Goalw [starfunNat_n_def]
   422      "(*fNatn* f) (Abs_hypnat(hypnatrel``{%n. X n})) = \
   422      "( *fNatn* f) (Abs_hypnat(hypnatrel``{%n. X n})) = \
   423 \     Abs_hypreal(hyprel `` {%n. f n (X n)})";
   423 \     Abs_hypreal(hyprel `` {%n. f n (X n)})";
   424 by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1);
   424 by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1);
   425 by Auto_tac;
   425 by Auto_tac;
   426 by (Ultra_tac 1);
   426 by (Ultra_tac 1);
   427 qed "starfunNat_n";
   427 qed "starfunNat_n";
   428 
   428 
   429 (*-------------------------------------------------
   429 (*-------------------------------------------------
   430   multiplication: ( *fn ) x ( *gn ) = *(fn x gn)  
   430   multiplication: ( *fn ) x ( *gn ) = *(fn x gn)  
   431  -------------------------------------------------*)
   431  -------------------------------------------------*)
   432 Goal "(*fNatn* f) z * (*fNatn* g) z = (*fNatn* (% i x. f i x * g i x)) z";
   432 Goal "( *fNatn* f) z * ( *fNatn* g) z = ( *fNatn* (% i x. f i x * g i x)) z";
   433 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   433 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   434 by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypreal_mult]));
   434 by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypreal_mult]));
   435 qed "starfunNat_n_mult";
   435 qed "starfunNat_n_mult";
   436 
   436 
   437 (*-----------------------------------------------
   437 (*-----------------------------------------------
   438   addition: ( *fn ) + ( *gn ) = *(fn + gn)  
   438   addition: ( *fn ) + ( *gn ) = *(fn + gn)  
   439  -----------------------------------------------*)
   439  -----------------------------------------------*)
   440 Goal "(*fNatn* f) z + (*fNatn* g) z = (*fNatn* (%i x. f i x + g i x)) z";
   440 Goal "( *fNatn* f) z + ( *fNatn* g) z = ( *fNatn* (%i x. f i x + g i x)) z";
   441 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   441 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   442 by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypreal_add]));
   442 by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypreal_add]));
   443 qed "starfunNat_n_add";
   443 qed "starfunNat_n_add";
   444 
   444 
   445 (*-------------------------------------------------
   445 (*-------------------------------------------------
   446   subtraction: ( *fn ) + -( *gn ) = *(fn + -gn)  
   446   subtraction: ( *fn ) + -( *gn ) = *(fn + -gn)  
   447  -------------------------------------------------*)
   447  -------------------------------------------------*)
   448 Goal "(*fNatn* f) z + -(*fNatn* g) z = (*fNatn* (%i x. f i x + -g i x)) z";
   448 Goal "( *fNatn* f) z + -( *fNatn* g) z = ( *fNatn* (%i x. f i x + -g i x)) z";
   449 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   449 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   450 by (auto_tac (claset(), 
   450 by (auto_tac (claset(), 
   451           simpset() addsimps [starfunNat_n, hypreal_minus,hypreal_add]));
   451           simpset() addsimps [starfunNat_n, hypreal_minus,hypreal_add]));
   452 qed "starfunNat_n_add_minus";
   452 qed "starfunNat_n_add_minus";
   453 
   453 
   454 (*--------------------------------------------------
   454 (*--------------------------------------------------
   455   composition: ( *fn ) o ( *gn ) = *(fn o gn)  
   455   composition: ( *fn ) o ( *gn ) = *(fn o gn)  
   456  -------------------------------------------------*)
   456  -------------------------------------------------*)
   457  
   457  
   458 Goal "(*fNatn* (%i x. k)) z = hypreal_of_real  k";
   458 Goal "( *fNatn* (%i x. k)) z = hypreal_of_real  k";
   459 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   459 by (res_inst_tac [("z","z")] eq_Abs_hypnat 1);
   460 by (auto_tac (claset(), 
   460 by (auto_tac (claset(), 
   461        simpset() addsimps [starfunNat_n, hypreal_of_real_def]));
   461        simpset() addsimps [starfunNat_n, hypreal_of_real_def]));
   462 qed "starfunNat_n_const_fun";
   462 qed "starfunNat_n_const_fun";
   463 
   463 
   464 Addsimps [starfunNat_n_const_fun];
   464 Addsimps [starfunNat_n_const_fun];
   465 
   465 
   466 Goal "- (*fNatn* f) x = (*fNatn* (%i x. - (f i) x)) x";
   466 Goal "- ( *fNatn* f) x = ( *fNatn* (%i x. - (f i) x)) x";
   467 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   467 by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
   468 by (auto_tac (claset(), simpset() addsimps [starfunNat_n, hypreal_minus]));
   468 by (auto_tac (claset(), simpset() addsimps [starfunNat_n, hypreal_minus]));
   469 qed "starfunNat_n_minus";
   469 qed "starfunNat_n_minus";
   470 
   470 
   471 Goal "(*fNatn* f) (hypnat_of_nat n) = Abs_hypreal(hyprel `` {%i. f i n})";
   471 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]));
   472 by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypnat_of_nat_def]));
   473 qed "starfunNat_n_eq";
   473 qed "starfunNat_n_eq";
   474 Addsimps [starfunNat_n_eq];
   474 Addsimps [starfunNat_n_eq];
   475 
   475 
   476 Goal "((*fNat* f) = (*fNat* g)) = (f = g)";
   476 Goal "(( *fNat* f) = ( *fNat* g)) = (f = g)";
   477 by Auto_tac;
   477 by Auto_tac;
   478 by (rtac ext 1 THEN rtac ccontr 1);
   478 by (rtac ext 1 THEN rtac ccontr 1);
   479 by (dres_inst_tac [("x","hypnat_of_nat(x)")] fun_cong 1);
   479 by (dres_inst_tac [("x","hypnat_of_nat(x)")] fun_cong 1);
   480 by (auto_tac (claset(), simpset() addsimps [starfunNat,hypnat_of_nat_def]));
   480 by (auto_tac (claset(), simpset() addsimps [starfunNat,hypnat_of_nat_def]));
   481 qed "starfun_eq_iff";
   481 qed "starfun_eq_iff";