src/HOL/Real/Hyperreal/NSA.ML
changeset 10607 352f6f209775
parent 10230 5eb935d6cc69
child 10648 a8c647cfa31f
equal deleted inserted replaced
10606:e3229a37d53f 10607:352f6f209775
    25 by (Step_tac 1);
    25 by (Step_tac 1);
    26 by (res_inst_tac [("x","r * ra")] exI 1);
    26 by (res_inst_tac [("x","r * ra")] exI 1);
    27 by (simp_tac (simpset() addsimps [hypreal_of_real_mult]) 1);
    27 by (simp_tac (simpset() addsimps [hypreal_of_real_mult]) 1);
    28 qed "SReal_mult";
    28 qed "SReal_mult";
    29 
    29 
    30 Goalw [SReal_def] "[| x: SReal; x ~= 0 |] ==> hrinv x : SReal";
    30 Goalw [SReal_def] "[| x: SReal; x ~= 0 |] ==> inverse x : SReal";
    31 by (blast_tac (claset() addSDs [hypreal_of_real_hrinv2]) 1);
    31 by (blast_tac (claset() addSDs [hypreal_of_real_inverse2]) 1);
    32 qed "SReal_hrinv";
    32 qed "SReal_inverse";
    33 
    33 
    34 Goalw [SReal_def] "x: SReal ==> -x : SReal";
    34 Goalw [SReal_def] "x: SReal ==> -x : SReal";
    35 by (auto_tac (claset(),simpset() addsimps [hypreal_of_real_minus RS sym]));
    35 by (auto_tac (claset(),simpset() addsimps [hypreal_of_real_minus RS sym]));
    36 qed "SReal_minus";
    36 qed "SReal_minus";
    37 
    37 
    67 by (rtac ([SReal_one,SReal_one] MRS SReal_add) 1);
    67 by (rtac ([SReal_one,SReal_one] MRS SReal_add) 1);
    68 qed "SReal_two";
    68 qed "SReal_two";
    69 
    69 
    70 Addsimps [SReal_zero,SReal_two];
    70 Addsimps [SReal_zero,SReal_two];
    71 
    71 
    72 Goal "r : SReal ==> r*hrinv(1hr + 1hr): SReal";
    72 Goal "r : SReal ==> r*inverse(1hr + 1hr): SReal";
    73 by (blast_tac (claset() addSIs [SReal_mult,SReal_hrinv,
    73 by (blast_tac (claset() addSIs [SReal_mult,SReal_inverse,
    74     SReal_two,hypreal_two_not_zero]) 1);
    74     SReal_two,hypreal_two_not_zero]) 1);
    75 qed "SReal_half";
    75 qed "SReal_half";
    76 
    76 
    77 (* in general: move before previous thms!*)
    77 (* in general: move before previous thms!*)
    78 Goalw [SReal_def] "hypreal_of_real  x: SReal";
    78 Goalw [SReal_def] "hypreal_of_real  x: SReal";
   329 Goal "[| x : Infinitesimal; y : HFinite |] \
   329 Goal "[| x : Infinitesimal; y : HFinite |] \
   330 \     ==> (x * y) : Infinitesimal";
   330 \     ==> (x * y) : Infinitesimal";
   331 by (auto_tac (claset() addSDs [HFiniteD],
   331 by (auto_tac (claset() addSDs [HFiniteD],
   332     simpset() addsimps [Infinitesimal_def]));
   332     simpset() addsimps [Infinitesimal_def]));
   333 by (forward_tac [hrabs_less_gt_zero] 1);
   333 by (forward_tac [hrabs_less_gt_zero] 1);
   334 by (dtac (hypreal_hrinv_gt_zero RSN (2,hypreal_mult_less_mono2)) 1 
   334 by (dtac (hypreal_inverse_gt_zero RSN (2,hypreal_mult_less_mono2)) 1 
   335     THEN assume_tac 1);
   335     THEN assume_tac 1);
   336 by (dtac ((hypreal_not_refl2 RS not_sym) RSN (2,SReal_hrinv)) 1 
   336 by (dtac ((hypreal_not_refl2 RS not_sym) RSN (2,SReal_inverse)) 1 
   337     THEN assume_tac 1);
   337     THEN assume_tac 1);
   338 by (dtac SReal_mult 1 THEN assume_tac 1);
   338 by (dtac SReal_mult 1 THEN assume_tac 1);
   339 by (thin_tac "hrinv t : SReal" 1);
   339 by (thin_tac "inverse t : SReal" 1);
   340 by (auto_tac (claset() addSDs [bspec],simpset() addsimps [hrabs_mult]));
   340 by (auto_tac (claset() addSDs [bspec],simpset() addsimps [hrabs_mult]));
   341 by (dtac hrabs_mult_less 1 THEN assume_tac 1);
   341 by (dtac hrabs_mult_less 1 THEN assume_tac 1);
   342 by (dtac (hypreal_not_refl2 RS not_sym) 1);
   342 by (dtac (hypreal_not_refl2 RS not_sym) 1);
   343 by (auto_tac (claset() addSDs [hypreal_mult_hrinv],
   343 by (auto_tac (claset() addSDs [hypreal_mult_inverse],
   344      simpset() addsimps [hrabs_mult] @ hypreal_mult_ac));
   344      simpset() addsimps [hrabs_mult] @ hypreal_mult_ac));
   345 qed "Infinitesimal_HFinite_mult";
   345 qed "Infinitesimal_HFinite_mult";
   346 
   346 
   347 Goal "[| x : Infinitesimal; y : HFinite |] \
   347 Goal "[| x : Infinitesimal; y : HFinite |] \
   348 \     ==> (y * x) : Infinitesimal";
   348 \     ==> (y * x) : Infinitesimal";
   350               simpset() addsimps [hypreal_mult_commute]));
   350               simpset() addsimps [hypreal_mult_commute]));
   351 qed "Infinitesimal_HFinite_mult2";
   351 qed "Infinitesimal_HFinite_mult2";
   352 
   352 
   353 (*** rather long proof ***)
   353 (*** rather long proof ***)
   354 Goalw [HInfinite_def,Infinitesimal_def] 
   354 Goalw [HInfinite_def,Infinitesimal_def] 
   355       "x: HInfinite ==> hrinv x: Infinitesimal";
   355       "x: HInfinite ==> inverse x: Infinitesimal";
   356 by (Auto_tac);
   356 by (Auto_tac);
   357 by (eres_inst_tac [("x","hrinv r")] ballE 1);
   357 by (eres_inst_tac [("x","inverse r")] ballE 1);
   358 by (rtac (hrabs_hrinv RS ssubst) 1);
   358 by (rtac (hrabs_inverse RS ssubst) 1);
   359 by (etac (((hypreal_hrinv_gt_zero RS hypreal_less_trans) 
   359 by (etac (((hypreal_inverse_gt_zero RS hypreal_less_trans) 
   360    RS hypreal_not_refl2 RS not_sym) RS (hrabs_not_zero_iff 
   360    RS hypreal_not_refl2 RS not_sym) RS (hrabs_not_zero_iff 
   361    RS iffD2)) 1 THEN assume_tac 1);
   361    RS iffD2)) 1 THEN assume_tac 1);
   362 by (forw_inst_tac [("x1","r"),("R3.0","abs x")] 
   362 by (forw_inst_tac [("x1","r"),("R3.0","abs x")] 
   363     (hypreal_hrinv_gt_zero RS hypreal_less_trans) 1);
   363     (hypreal_inverse_gt_zero RS hypreal_less_trans) 1);
   364 by (assume_tac 1);
   364 by (assume_tac 1);
   365 by (forw_inst_tac [("s","abs x"),("t","0")] 
   365 by (forw_inst_tac [("s","abs x"),("t","0")] 
   366               (hypreal_not_refl2 RS not_sym) 1);
   366               (hypreal_not_refl2 RS not_sym) 1);
   367 by (dtac ((hypreal_hrinv_hrinv RS sym) RS subst) 1);
   367 by (dtac ((hypreal_inverse_inverse RS sym) RS subst) 1);
   368 by (rotate_tac 2 1 THEN assume_tac 1);
   368 by (rotate_tac 2 1 THEN assume_tac 1);
   369 by (dres_inst_tac [("x","abs x")] hypreal_hrinv_gt_zero 1);
   369 by (dres_inst_tac [("x","abs x")] hypreal_inverse_gt_zero 1);
   370 by (rtac (hypreal_hrinv_less_iff RS ssubst) 1);
   370 by (rtac (hypreal_inverse_less_iff RS ssubst) 1);
   371 by (auto_tac (claset() addSDs [SReal_hrinv],
   371 by (auto_tac (claset() addSDs [SReal_inverse],
   372     simpset() addsimps [hypreal_not_refl2 RS not_sym,
   372     simpset() addsimps [hypreal_not_refl2 RS not_sym,
   373     hypreal_less_not_refl]));
   373     hypreal_less_not_refl]));
   374 qed "HInfinite_hrinv_Infinitesimal";
   374 qed "HInfinite_inverse_Infinitesimal";
   375 
   375 
   376 Goalw [HInfinite_def] 
   376 Goalw [HInfinite_def] 
   377    "[|x: HInfinite;y: HInfinite|] ==> (x*y): HInfinite";
   377    "[|x: HInfinite;y: HInfinite|] ==> (x*y): HInfinite";
   378 by (Auto_tac);
   378 by (Auto_tac);
   379 by (cut_facts_tac [SReal_one] 1);
   379 by (cut_facts_tac [SReal_one] 1);
   765 by (blast_tac (claset() addSIs [inf_close_mult_HFinite,
   765 by (blast_tac (claset() addSIs [inf_close_mult_HFinite,
   766      inf_close_hypreal_of_real_HFinite,HFinite_hypreal_of_real]) 1);
   766      inf_close_hypreal_of_real_HFinite,HFinite_hypreal_of_real]) 1);
   767 qed "inf_close_mult_hypreal_of_real";
   767 qed "inf_close_mult_hypreal_of_real";
   768 
   768 
   769 Goal "!!a. [| a: SReal; a ~= 0; a*x @= 0 |] ==> x @= 0";
   769 Goal "!!a. [| a: SReal; a ~= 0; a*x @= 0 |] ==> x @= 0";
   770 by (dtac (SReal_hrinv RS (SReal_subset_HFinite RS subsetD)) 1);
   770 by (dtac (SReal_inverse RS (SReal_subset_HFinite RS subsetD)) 1);
   771 by (auto_tac (claset() addDs [inf_close_mult2],
   771 by (auto_tac (claset() addDs [inf_close_mult2],
   772     simpset() addsimps [hypreal_mult_assoc RS sym]));
   772     simpset() addsimps [hypreal_mult_assoc RS sym]));
   773 qed "inf_close_SReal_mult_cancel_zero";
   773 qed "inf_close_SReal_mult_cancel_zero";
   774 
   774 
   775 (* REM comments: newly added *)
   775 (* REM comments: newly added *)
   788     inf_close_mult_SReal2]) 1);
   788     inf_close_mult_SReal2]) 1);
   789 qed "inf_close_mult_SReal_zero_cancel_iff";
   789 qed "inf_close_mult_SReal_zero_cancel_iff";
   790 Addsimps [inf_close_mult_SReal_zero_cancel_iff];
   790 Addsimps [inf_close_mult_SReal_zero_cancel_iff];
   791 
   791 
   792 Goal "!!a. [| a: SReal; a ~= 0; a* w @= a*z |] ==> w @= z";
   792 Goal "!!a. [| a: SReal; a ~= 0; a* w @= a*z |] ==> w @= z";
   793 by (dtac (SReal_hrinv RS (SReal_subset_HFinite RS subsetD)) 1);
   793 by (dtac (SReal_inverse RS (SReal_subset_HFinite RS subsetD)) 1);
   794 by (auto_tac (claset() addDs [inf_close_mult2],
   794 by (auto_tac (claset() addDs [inf_close_mult2],
   795     simpset() addsimps [hypreal_mult_assoc RS sym]));
   795     simpset() addsimps [hypreal_mult_assoc RS sym]));
   796 qed "inf_close_SReal_mult_cancel";
   796 qed "inf_close_SReal_mult_cancel";
   797 
   797 
   798 Goal "!!a. [| a: SReal; a ~= 0|] ==> (a* w @= a*z) = (w @= z)";
   798 Goal "!!a. [| a: SReal; a ~= 0|] ==> (a* w @= a*z) = (w @= z)";
   910 by (dtac inf_close_trans3 1 THEN assume_tac 1);
   910 by (dtac inf_close_trans3 1 THEN assume_tac 1);
   911 by (blast_tac (claset() addDs [inf_close_sym]) 1);
   911 by (blast_tac (claset() addDs [inf_close_sym]) 1);
   912 qed "HFinite_diff_Infinitesimal_inf_close";
   912 qed "HFinite_diff_Infinitesimal_inf_close";
   913 
   913 
   914 Goal "[| y ~= 0; y: Infinitesimal; \
   914 Goal "[| y ~= 0; y: Infinitesimal; \
   915 \                 x*hrinv(y) : HFinite \
   915 \                 x*inverse(y) : HFinite \
   916 \              |] ==> x : Infinitesimal";
   916 \              |] ==> x : Infinitesimal";
   917 by (dtac Infinitesimal_HFinite_mult2 1);
   917 by (dtac Infinitesimal_HFinite_mult2 1);
   918 by (assume_tac 1);
   918 by (assume_tac 1);
   919 by (asm_full_simp_tac (simpset() 
   919 by (asm_full_simp_tac (simpset() 
   920     addsimps [hypreal_mult_assoc]) 1);
   920     addsimps [hypreal_mult_assoc]) 1);
  1199 
  1199 
  1200 Goal "x ~: Infinitesimal ==> x : HInfinite | x : HFinite - Infinitesimal";
  1200 Goal "x ~: Infinitesimal ==> x : HInfinite | x : HFinite - Infinitesimal";
  1201 by (fast_tac (claset() addIs [not_HFinite_HInfinite]) 1);
  1201 by (fast_tac (claset() addIs [not_HFinite_HInfinite]) 1);
  1202 qed "HInfinite_diff_HFinite_Infinitesimal_disj";
  1202 qed "HInfinite_diff_HFinite_Infinitesimal_disj";
  1203 
  1203 
  1204 Goal "[| x : HFinite; x ~: Infinitesimal |] ==> hrinv x : HFinite";
  1204 Goal "[| x : HFinite; x ~: Infinitesimal |] ==> inverse x : HFinite";
  1205 by (cut_inst_tac [("x","hrinv x")] HInfinite_HFinite_disj 1);
  1205 by (cut_inst_tac [("x","inverse x")] HInfinite_HFinite_disj 1);
  1206 by (forward_tac [not_Infinitesimal_not_zero RS hypreal_hrinv_hrinv] 1);
  1206 by (forward_tac [not_Infinitesimal_not_zero RS hypreal_inverse_inverse] 1);
  1207 by (auto_tac (claset() addSDs [HInfinite_hrinv_Infinitesimal],simpset()));
  1207 by (auto_tac (claset() addSDs [HInfinite_inverse_Infinitesimal],simpset()));
  1208 qed "HFinite_hrinv";
  1208 qed "HFinite_inverse";
  1209 
  1209 
  1210 Goal "x : HFinite - Infinitesimal ==> hrinv x : HFinite";
  1210 Goal "x : HFinite - Infinitesimal ==> inverse x : HFinite";
  1211 by (blast_tac (claset() addIs [HFinite_hrinv]) 1);
  1211 by (blast_tac (claset() addIs [HFinite_inverse]) 1);
  1212 qed "HFinite_hrinv2";
  1212 qed "HFinite_inverse2";
  1213 
  1213 
  1214 (* stronger statement possible in fact *)
  1214 (* stronger statement possible in fact *)
  1215 Goal "x ~: Infinitesimal ==> hrinv(x) : HFinite";
  1215 Goal "x ~: Infinitesimal ==> inverse(x) : HFinite";
  1216 by (dtac HInfinite_diff_HFinite_Infinitesimal_disj 1);
  1216 by (dtac HInfinite_diff_HFinite_Infinitesimal_disj 1);
  1217 by (blast_tac (claset() addIs [HFinite_hrinv,
  1217 by (blast_tac (claset() addIs [HFinite_inverse,
  1218     HInfinite_hrinv_Infinitesimal,
  1218     HInfinite_inverse_Infinitesimal,
  1219     Infinitesimal_subset_HFinite RS subsetD]) 1);
  1219     Infinitesimal_subset_HFinite RS subsetD]) 1);
  1220 qed "Infinitesimal_hrinv_HFinite";
  1220 qed "Infinitesimal_inverse_HFinite";
  1221 
  1221 
  1222 Goal "x : HFinite - Infinitesimal ==> hrinv x : HFinite - Infinitesimal";
  1222 Goal "x : HFinite - Infinitesimal ==> inverse x : HFinite - Infinitesimal";
  1223 by (auto_tac (claset() addIs [Infinitesimal_hrinv_HFinite],simpset()));
  1223 by (auto_tac (claset() addIs [Infinitesimal_inverse_HFinite],simpset()));
  1224 by (dtac Infinitesimal_HFinite_mult2 1);
  1224 by (dtac Infinitesimal_HFinite_mult2 1);
  1225 by (auto_tac (claset() addSDs [not_Infinitesimal_not_zero,
  1225 by (auto_tac (claset() addSDs [not_Infinitesimal_not_zero,
  1226     hypreal_mult_hrinv],simpset()));
  1226     hypreal_mult_inverse],simpset()));
  1227 qed "HFinite_not_Infinitesimal_hrinv";
  1227 qed "HFinite_not_Infinitesimal_inverse";
  1228 
  1228 
  1229 Goal "[| x @= y; y :  HFinite - Infinitesimal |] \
  1229 Goal "[| x @= y; y :  HFinite - Infinitesimal |] \
  1230 \     ==> hrinv x @= hrinv y";
  1230 \     ==> inverse x @= inverse y";
  1231 by (forward_tac [HFinite_diff_Infinitesimal_inf_close] 1);
  1231 by (forward_tac [HFinite_diff_Infinitesimal_inf_close] 1);
  1232 by (assume_tac 1);
  1232 by (assume_tac 1);
  1233 by (forward_tac [not_Infinitesimal_not_zero2] 1);
  1233 by (forward_tac [not_Infinitesimal_not_zero2] 1);
  1234 by (forw_inst_tac [("x","x")] not_Infinitesimal_not_zero2 1);
  1234 by (forw_inst_tac [("x","x")] not_Infinitesimal_not_zero2 1);
  1235 by (REPEAT(dtac HFinite_hrinv2 1));
  1235 by (REPEAT(dtac HFinite_inverse2 1));
  1236 by (dtac inf_close_mult2 1 THEN assume_tac 1);
  1236 by (dtac inf_close_mult2 1 THEN assume_tac 1);
  1237 by (Auto_tac);
  1237 by (Auto_tac);
  1238 by (dres_inst_tac [("c","hrinv x")] inf_close_mult1 1 
  1238 by (dres_inst_tac [("c","inverse x")] inf_close_mult1 1 
  1239     THEN assume_tac 1);
  1239     THEN assume_tac 1);
  1240 by (auto_tac (claset() addIs [inf_close_sym],
  1240 by (auto_tac (claset() addIs [inf_close_sym],
  1241     simpset() addsimps [hypreal_mult_assoc]));
  1241     simpset() addsimps [hypreal_mult_assoc]));
  1242 qed "inf_close_hrinv";
  1242 qed "inf_close_inverse";
  1243 
  1243 
  1244 Goal "[| x: HFinite - Infinitesimal; \
  1244 Goal "[| x: HFinite - Infinitesimal; \
  1245 \                     h : Infinitesimal |] ==> hrinv(x + h) @= hrinv x";
  1245 \                     h : Infinitesimal |] ==> inverse(x + h) @= inverse x";
  1246 by (auto_tac (claset() addIs [inf_close_hrinv,
  1246 by (auto_tac (claset() addIs [inf_close_inverse,
  1247     Infinitesimal_add_inf_close_self,inf_close_sym],simpset()));
  1247     Infinitesimal_add_inf_close_self,inf_close_sym],simpset()));
  1248 qed "hrinv_add_Infinitesimal_inf_close";
  1248 qed "inverse_add_Infinitesimal_inf_close";
  1249 
  1249 
  1250 Goal "[| x: HFinite - Infinitesimal; \
  1250 Goal "[| x: HFinite - Infinitesimal; \
  1251 \                     h : Infinitesimal |] ==> hrinv(h + x) @= hrinv x";
  1251 \                     h : Infinitesimal |] ==> inverse(h + x) @= inverse x";
  1252 by (rtac (hypreal_add_commute RS subst) 1);
  1252 by (rtac (hypreal_add_commute RS subst) 1);
  1253 by (blast_tac (claset() addIs [hrinv_add_Infinitesimal_inf_close]) 1);
  1253 by (blast_tac (claset() addIs [inverse_add_Infinitesimal_inf_close]) 1);
  1254 qed "hrinv_add_Infinitesimal_inf_close2";
  1254 qed "inverse_add_Infinitesimal_inf_close2";
  1255 
  1255 
  1256 Goal 
  1256 Goal 
  1257      "[| x: HFinite - Infinitesimal; \
  1257      "[| x: HFinite - Infinitesimal; \
  1258 \             h : Infinitesimal |] ==> hrinv(x + h) + -hrinv x @= h"; 
  1258 \             h : Infinitesimal |] ==> inverse(x + h) + -inverse x @= h"; 
  1259 by (rtac inf_close_trans2 1);
  1259 by (rtac inf_close_trans2 1);
  1260 by (auto_tac (claset() addIs [hrinv_add_Infinitesimal_inf_close,
  1260 by (auto_tac (claset() addIs [inverse_add_Infinitesimal_inf_close,
  1261     inf_close_minus_iff RS iffD1],simpset() addsimps [mem_infmal_iff RS sym]));
  1261     inf_close_minus_iff RS iffD1],simpset() addsimps [mem_infmal_iff RS sym]));
  1262 qed "hrinv_add_Infinitesimal_inf_close_Infinitesimal";
  1262 qed "inverse_add_Infinitesimal_inf_close_Infinitesimal";
  1263 
  1263 
  1264 Goal "(x : Infinitesimal) = (x*x : Infinitesimal)";
  1264 Goal "(x : Infinitesimal) = (x*x : Infinitesimal)";
  1265 by (auto_tac (claset() addIs [Infinitesimal_mult],simpset()));
  1265 by (auto_tac (claset() addIs [Infinitesimal_mult],simpset()));
  1266 by (rtac ccontr 1 THEN forward_tac [Infinitesimal_hrinv_HFinite] 1);
  1266 by (rtac ccontr 1 THEN forward_tac [Infinitesimal_inverse_HFinite] 1);
  1267 by (forward_tac [not_Infinitesimal_not_zero] 1);
  1267 by (forward_tac [not_Infinitesimal_not_zero] 1);
  1268 by (auto_tac (claset() addDs [Infinitesimal_HFinite_mult],
  1268 by (auto_tac (claset() addDs [Infinitesimal_HFinite_mult],
  1269     simpset() addsimps [hypreal_mult_assoc]));
  1269     simpset() addsimps [hypreal_mult_assoc]));
  1270 qed "Infinitesimal_square_iff";
  1270 qed "Infinitesimal_square_iff";
  1271 Addsimps [Infinitesimal_square_iff RS sym];
  1271 Addsimps [Infinitesimal_square_iff RS sym];
  1283 qed "HInfinite_square_iff";
  1283 qed "HInfinite_square_iff";
  1284 Addsimps [HInfinite_square_iff];
  1284 Addsimps [HInfinite_square_iff];
  1285 
  1285 
  1286 Goal "!!a. [| a: HFinite-Infinitesimal; a* w @= a*z |] ==> w @= z";
  1286 Goal "!!a. [| a: HFinite-Infinitesimal; a* w @= a*z |] ==> w @= z";
  1287 by (Step_tac 1);
  1287 by (Step_tac 1);
  1288 by (ftac HFinite_hrinv 1 THEN assume_tac 1);
  1288 by (ftac HFinite_inverse 1 THEN assume_tac 1);
  1289 by (dtac not_Infinitesimal_not_zero 1);
  1289 by (dtac not_Infinitesimal_not_zero 1);
  1290 by (auto_tac (claset() addDs [inf_close_mult2],
  1290 by (auto_tac (claset() addDs [inf_close_mult2],
  1291     simpset() addsimps [hypreal_mult_assoc RS sym]));
  1291     simpset() addsimps [hypreal_mult_assoc RS sym]));
  1292 qed "inf_close_HFinite_mult_cancel";
  1292 qed "inf_close_HFinite_mult_cancel";
  1293 
  1293 
  1799 by (fast_tac (claset() addIs [st_Infinitesimal]) 1);
  1799 by (fast_tac (claset() addIs [st_Infinitesimal]) 1);
  1800 qed "st_not_Infinitesimal";
  1800 qed "st_not_Infinitesimal";
  1801 
  1801 
  1802 val [prem1,prem2] = 
  1802 val [prem1,prem2] = 
  1803 goal thy "[| x: HFinite; st x ~= 0 |] \
  1803 goal thy "[| x: HFinite; st x ~= 0 |] \
  1804 \         ==> st(hrinv x) = hrinv (st x)";
  1804 \         ==> st(inverse x) = inverse (st x)";
  1805 by (rtac ((prem2 RS hypreal_mult_left_cancel) RS iffD1) 1);
  1805 by (rtac ((prem2 RS hypreal_mult_left_cancel) RS iffD1) 1);
  1806 by (auto_tac (claset(),simpset() addsimps [st_not_zero,
  1806 by (auto_tac (claset(),simpset() addsimps [st_not_zero,
  1807     st_mult RS sym,prem2,st_not_Infinitesimal,HFinite_hrinv,prem1]));
  1807     st_mult RS sym,prem2,st_not_Infinitesimal,HFinite_inverse,prem1]));
  1808 qed "st_hrinv";
  1808 qed "st_inverse";
  1809 
  1809 
  1810 val [prem1,prem2,prem3] = 
  1810 val [prem1,prem2,prem3] = 
  1811 goal thy "[| x: HFinite; y: HFinite; st y ~= 0 |] \
  1811 goal thy "[| x: HFinite; y: HFinite; st y ~= 0 |] \
  1812 \                 ==> st(x * hrinv y) = (st x) * hrinv (st y)";
  1812 \                 ==> st(x * inverse y) = (st x) * inverse (st y)";
  1813 by (auto_tac (claset(),simpset() addsimps [st_not_zero,prem3,
  1813 by (auto_tac (claset(),simpset() addsimps [st_not_zero,prem3,
  1814     st_mult,prem2,st_not_Infinitesimal,HFinite_hrinv,prem1,st_hrinv]));
  1814     st_mult,prem2,st_not_Infinitesimal,HFinite_inverse,prem1,st_inverse]));
  1815 qed "st_mult_hrinv";
  1815 qed "st_mult_inverse";
  1816 
  1816 
  1817 Goal "x: HFinite ==> st(st(x)) = st(x)";
  1817 Goal "x: HFinite ==> st(st(x)) = st(x)";
  1818 by (blast_tac (claset() addIs [st_HFinite,
  1818 by (blast_tac (claset() addIs [st_HFinite,
  1819     st_inf_close_self,inf_close_st_eq]) 1);
  1819     st_inf_close_self,inf_close_st_eq]) 1);
  1820 qed "st_idempotent";
  1820 qed "st_idempotent";
  2057 qed "Infinitesimal_FreeUltrafilterNat_iff";
  2057 qed "Infinitesimal_FreeUltrafilterNat_iff";
  2058 
  2058 
  2059 (*------------------------------------------------------------------------
  2059 (*------------------------------------------------------------------------
  2060          Infinitesimals as smaller than 1/n for all n::nat (> 0)
  2060          Infinitesimals as smaller than 1/n for all n::nat (> 0)
  2061  ------------------------------------------------------------------------*)
  2061  ------------------------------------------------------------------------*)
  2062 Goal "(ALL r. 0 < r --> x < r) = (ALL n. x < rinv(real_of_posnat n))";
  2062 Goal "(ALL r. 0 < r --> x < r) = (ALL n. x < inverse(real_of_posnat n))";
  2063 by (auto_tac (claset(),simpset() addsimps 
  2063 by (auto_tac (claset(),simpset() addsimps 
  2064     [rename_numerals (real_of_posnat_gt_zero RS real_rinv_gt_zero)]));
  2064     [rename_numerals (real_of_posnat_gt_zero RS real_inverse_gt_zero)]));
  2065 by (blast_tac (claset() addSDs [rename_numerals reals_Archimedean] 
  2065 by (blast_tac (claset() addSDs [rename_numerals reals_Archimedean] 
  2066     addIs [real_less_trans]) 1);
  2066     addIs [real_less_trans]) 1);
  2067 qed "lemma_Infinitesimal";
  2067 qed "lemma_Infinitesimal";
  2068 
  2068 
  2069 Goal "(ALL r: SReal. 0 < r --> x < r) = \
  2069 Goal "(ALL r: SReal. 0 < r --> x < r) = \
  2070 \     (ALL n. x < hrinv(hypreal_of_posnat n))";
  2070 \     (ALL n. x < inverse(hypreal_of_posnat n))";
  2071 by (Step_tac 1);
  2071 by (Step_tac 1);
  2072 by (dres_inst_tac [("x","hypreal_of_real (rinv(real_of_posnat n))")] bspec 1);
  2072 by (dres_inst_tac [("x","hypreal_of_real (inverse(real_of_posnat n))")] bspec 1);
  2073 by (Full_simp_tac 1);
  2073 by (Full_simp_tac 1);
  2074 by (rtac (real_of_posnat_gt_zero RS real_rinv_gt_zero RS 
  2074 by (rtac (real_of_posnat_gt_zero RS real_inverse_gt_zero RS 
  2075           (hypreal_of_real_less_iff RS iffD1) RSN(2,impE)) 1);
  2075           (hypreal_of_real_less_iff RS iffD1) RSN(2,impE)) 1);
  2076 by (assume_tac 2);
  2076 by (assume_tac 2);
  2077 by (asm_full_simp_tac (simpset() addsimps 
  2077 by (asm_full_simp_tac (simpset() addsimps 
  2078    [real_not_refl2 RS not_sym RS hypreal_of_real_hrinv RS sym,
  2078    [real_not_refl2 RS not_sym RS hypreal_of_real_inverse RS sym,
  2079    rename_numerals real_of_posnat_gt_zero,hypreal_of_real_zero,
  2079    rename_numerals real_of_posnat_gt_zero,hypreal_of_real_zero,
  2080     hypreal_of_real_of_posnat]) 1);
  2080     hypreal_of_real_of_posnat]) 1);
  2081 by (auto_tac (claset() addSDs [reals_Archimedean],
  2081 by (auto_tac (claset() addSDs [reals_Archimedean],
  2082     simpset() addsimps [SReal_iff,hypreal_of_real_zero RS sym]));
  2082     simpset() addsimps [SReal_iff,hypreal_of_real_zero RS sym]));
  2083 by (dtac (hypreal_of_real_less_iff RS iffD1) 1);
  2083 by (dtac (hypreal_of_real_less_iff RS iffD1) 1);
  2084 by (asm_full_simp_tac (simpset() addsimps 
  2084 by (asm_full_simp_tac (simpset() addsimps 
  2085    [real_not_refl2 RS not_sym RS hypreal_of_real_hrinv RS sym,
  2085    [real_not_refl2 RS not_sym RS hypreal_of_real_inverse RS sym,
  2086    rename_numerals real_of_posnat_gt_zero,hypreal_of_real_of_posnat])1);
  2086    rename_numerals real_of_posnat_gt_zero,hypreal_of_real_of_posnat])1);
  2087 by (blast_tac (claset() addIs [hypreal_less_trans]) 1);
  2087 by (blast_tac (claset() addIs [hypreal_less_trans]) 1);
  2088 qed "lemma_Infinitesimal2";
  2088 qed "lemma_Infinitesimal2";
  2089 
  2089 
  2090 Goalw [Infinitesimal_def] 
  2090 Goalw [Infinitesimal_def] 
  2091       "Infinitesimal = {x. ALL n. abs x < hrinv (hypreal_of_posnat n)}";
  2091       "Infinitesimal = {x. ALL n. abs x < inverse (hypreal_of_posnat n)}";
  2092 by (auto_tac (claset(),simpset() addsimps [lemma_Infinitesimal2]));
  2092 by (auto_tac (claset(),simpset() addsimps [lemma_Infinitesimal2]));
  2093 qed "Infinitesimal_hypreal_of_posnat_iff";
  2093 qed "Infinitesimal_hypreal_of_posnat_iff";
  2094 
  2094 
  2095 (*-----------------------------------------------------------------------------
  2095 (*-----------------------------------------------------------------------------
  2096        Actual proof that omega (whr) is an infinite number and 
  2096        Actual proof that omega (whr) is an infinite number and 
  2180 (*-----------------------------------------------
  2180 (*-----------------------------------------------
  2181        Epsilon is a member of Infinitesimal
  2181        Epsilon is a member of Infinitesimal
  2182  -----------------------------------------------*)
  2182  -----------------------------------------------*)
  2183 
  2183 
  2184 Goal "ehr : Infinitesimal";
  2184 Goal "ehr : Infinitesimal";
  2185 by (auto_tac (claset() addSIs [HInfinite_hrinv_Infinitesimal,HInfinite_omega],
  2185 by (auto_tac (claset() addSIs [HInfinite_inverse_Infinitesimal,HInfinite_omega],
  2186     simpset() addsimps [hypreal_epsilon_hrinv_omega]));
  2186     simpset() addsimps [hypreal_epsilon_inverse_omega]));
  2187 qed "Infinitesimal_epsilon";
  2187 qed "Infinitesimal_epsilon";
  2188 Addsimps [Infinitesimal_epsilon];
  2188 Addsimps [Infinitesimal_epsilon];
  2189 
  2189 
  2190 Goal "ehr : HFinite";
  2190 Goal "ehr : HFinite";
  2191 by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
  2191 by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
  2201 (*------------------------------------------------------------------------
  2201 (*------------------------------------------------------------------------
  2202   Needed for proof that we define a hyperreal [<X(n)] @= hypreal_of_real a given 
  2202   Needed for proof that we define a hyperreal [<X(n)] @= hypreal_of_real a given 
  2203   that ALL n. |X n - a| < 1/n. Used in proof of NSLIM => LIM.
  2203   that ALL n. |X n - a| < 1/n. Used in proof of NSLIM => LIM.
  2204  -----------------------------------------------------------------------*)
  2204  -----------------------------------------------------------------------*)
  2205 
  2205 
  2206 Goal "!!u. 0 < u ==> finite {n. u < rinv(real_of_posnat n)}";
  2206 Goal "!!u. 0 < u ==> finite {n. u < inverse(real_of_posnat n)}";
  2207 by (asm_simp_tac (simpset() addsimps [real_of_posnat_less_rinv_iff]) 1);
  2207 by (asm_simp_tac (simpset() addsimps [real_of_posnat_less_inverse_iff]) 1);
  2208 by (rtac finite_real_of_posnat_less_real 1);
  2208 by (rtac finite_real_of_posnat_less_real 1);
  2209 qed "finite_rinv_real_of_posnat_gt_real";
  2209 qed "finite_inverse_real_of_posnat_gt_real";
  2210 
  2210 
  2211 Goal "{n. u <= rinv(real_of_posnat n)} = \
  2211 Goal "{n. u <= inverse(real_of_posnat n)} = \
  2212 \      {n. u < rinv(real_of_posnat n)} Un {n. u = rinv(real_of_posnat n)}";
  2212 \      {n. u < inverse(real_of_posnat n)} Un {n. u = inverse(real_of_posnat n)}";
  2213 by (auto_tac (claset() addDs [real_le_imp_less_or_eq],
  2213 by (auto_tac (claset() addDs [real_le_imp_less_or_eq],
  2214     simpset() addsimps [real_le_refl,real_less_imp_le]));
  2214     simpset() addsimps [real_le_refl,real_less_imp_le]));
  2215 qed "lemma_real_le_Un_eq2";
  2215 qed "lemma_real_le_Un_eq2";
  2216 
  2216 
  2217 Goal "!!u. 0 < u ==> finite {n::nat. u = rinv(real_of_posnat  n)}";
  2217 Goal "!!u. 0 < u ==> finite {n::nat. u = inverse(real_of_posnat  n)}";
  2218 by (asm_simp_tac (simpset() addsimps [real_of_posnat_rinv_eq_iff]) 1);
  2218 by (asm_simp_tac (simpset() addsimps [real_of_posnat_inverse_eq_iff]) 1);
  2219 by (auto_tac (claset() addIs [lemma_finite_omega_set RSN 
  2219 by (auto_tac (claset() addIs [lemma_finite_omega_set RSN 
  2220     (2,finite_subset)],simpset()));
  2220     (2,finite_subset)],simpset()));
  2221 qed "lemma_finite_omega_set2";
  2221 qed "lemma_finite_omega_set2";
  2222 
  2222 
  2223 Goal "!!u. 0 < u ==> finite {n. u <= rinv(real_of_posnat n)}";
  2223 Goal "!!u. 0 < u ==> finite {n. u <= inverse(real_of_posnat n)}";
  2224 by (auto_tac (claset(),simpset() addsimps 
  2224 by (auto_tac (claset(),simpset() addsimps 
  2225     [lemma_real_le_Un_eq2,lemma_finite_omega_set2,
  2225     [lemma_real_le_Un_eq2,lemma_finite_omega_set2,
  2226      finite_rinv_real_of_posnat_gt_real]));
  2226      finite_inverse_real_of_posnat_gt_real]));
  2227 qed "finite_rinv_real_of_posnat_ge_real";
  2227 qed "finite_inverse_real_of_posnat_ge_real";
  2228 
  2228 
  2229 Goal "!!u. 0 < u ==> \
  2229 Goal "!!u. 0 < u ==> \
  2230 \    {n. u <= rinv(real_of_posnat n)} ~: FreeUltrafilterNat";
  2230 \    {n. u <= inverse(real_of_posnat n)} ~: FreeUltrafilterNat";
  2231 by (blast_tac (claset() addSIs [FreeUltrafilterNat_finite,
  2231 by (blast_tac (claset() addSIs [FreeUltrafilterNat_finite,
  2232     finite_rinv_real_of_posnat_ge_real]) 1);
  2232     finite_inverse_real_of_posnat_ge_real]) 1);
  2233 qed "rinv_real_of_posnat_ge_real_FreeUltrafilterNat";
  2233 qed "inverse_real_of_posnat_ge_real_FreeUltrafilterNat";
  2234 
  2234 
  2235 (*--------------------------------------------------------------
  2235 (*--------------------------------------------------------------
  2236     The complement of  {n. u <= rinv(real_of_posnat n)} =
  2236     The complement of  {n. u <= inverse(real_of_posnat n)} =
  2237     {n. rinv(real_of_posnat n) < u} is in FreeUltrafilterNat 
  2237     {n. inverse(real_of_posnat n) < u} is in FreeUltrafilterNat 
  2238     by property of (free) ultrafilters
  2238     by property of (free) ultrafilters
  2239  --------------------------------------------------------------*)
  2239  --------------------------------------------------------------*)
  2240 Goal "- {n. u <= rinv(real_of_posnat n)} = \
  2240 Goal "- {n. u <= inverse(real_of_posnat n)} = \
  2241 \     {n. rinv(real_of_posnat n) < u}";
  2241 \     {n. inverse(real_of_posnat n) < u}";
  2242 by (auto_tac (claset() addSDs [real_le_less_trans],
  2242 by (auto_tac (claset() addSDs [real_le_less_trans],
  2243    simpset() addsimps [not_real_leE,real_less_not_refl]));
  2243    simpset() addsimps [not_real_leE,real_less_not_refl]));
  2244 val lemma = result();
  2244 val lemma = result();
  2245 
  2245 
  2246 Goal "!!u. 0 < u ==> \
  2246 Goal "!!u. 0 < u ==> \
  2247 \     {n. rinv(real_of_posnat n) < u} : FreeUltrafilterNat";
  2247 \     {n. inverse(real_of_posnat n) < u} : FreeUltrafilterNat";
  2248 by (cut_inst_tac [("u","u")]  rinv_real_of_posnat_ge_real_FreeUltrafilterNat 1);
  2248 by (cut_inst_tac [("u","u")]  inverse_real_of_posnat_ge_real_FreeUltrafilterNat 1);
  2249 by (auto_tac (claset() addDs [FreeUltrafilterNat_Compl_mem],
  2249 by (auto_tac (claset() addDs [FreeUltrafilterNat_Compl_mem],
  2250     simpset() addsimps [lemma]));
  2250     simpset() addsimps [lemma]));
  2251 qed "FreeUltrafilterNat_rinv_real_of_posnat";
  2251 qed "FreeUltrafilterNat_inverse_real_of_posnat";
  2252 
  2252 
  2253 (*--------------------------------------------------------------
  2253 (*--------------------------------------------------------------
  2254       Example where we get a hyperreal from a real sequence
  2254       Example where we get a hyperreal from a real sequence
  2255       for which a particular property holds. The theorem is
  2255       for which a particular property holds. The theorem is
  2256       used in proofs about equivalence of nonstandard and
  2256       used in proofs about equivalence of nonstandard and
  2259       limit (the theorem was previously in REALTOPOS.thy).
  2259       limit (the theorem was previously in REALTOPOS.thy).
  2260  -------------------------------------------------------------*)
  2260  -------------------------------------------------------------*)
  2261 (*-----------------------------------------------------
  2261 (*-----------------------------------------------------
  2262     |X(n) - x| < 1/n ==> [<X n>] - hypreal_of_real x|: Infinitesimal 
  2262     |X(n) - x| < 1/n ==> [<X n>] - hypreal_of_real x|: Infinitesimal 
  2263  -----------------------------------------------------*)
  2263  -----------------------------------------------------*)
  2264 Goal "ALL n. abs(X n + -x) < rinv(real_of_posnat n) \ 
  2264 Goal "ALL n. abs(X n + -x) < inverse(real_of_posnat n) \ 
  2265 \    ==> Abs_hypreal(hyprel^^{X}) + -hypreal_of_real x : Infinitesimal";
  2265 \    ==> Abs_hypreal(hyprel^^{X}) + -hypreal_of_real x : Infinitesimal";
  2266 by (auto_tac (claset() addSIs [bexI] addDs [rename_numerals 
  2266 by (auto_tac (claset() addSIs [bexI] addDs [rename_numerals 
  2267     FreeUltrafilterNat_rinv_real_of_posnat,
  2267     FreeUltrafilterNat_inverse_real_of_posnat,
  2268     FreeUltrafilterNat_all,FreeUltrafilterNat_Int] addIs [real_less_trans,
  2268     FreeUltrafilterNat_all,FreeUltrafilterNat_Int] addIs [real_less_trans,
  2269     FreeUltrafilterNat_subset],simpset() addsimps [hypreal_minus,
  2269     FreeUltrafilterNat_subset],simpset() addsimps [hypreal_minus,
  2270     hypreal_of_real_minus RS sym,hypreal_of_real_def,hypreal_add,
  2270     hypreal_of_real_minus RS sym,hypreal_of_real_def,hypreal_add,
  2271     Infinitesimal_FreeUltrafilterNat_iff,hypreal_hrinv,hypreal_of_real_of_posnat]));
  2271     Infinitesimal_FreeUltrafilterNat_iff,hypreal_inverse,hypreal_of_real_of_posnat]));
  2272 qed "real_seq_to_hypreal_Infinitesimal";
  2272 qed "real_seq_to_hypreal_Infinitesimal";
  2273 
  2273 
  2274 Goal "ALL n. abs(X n + -x) < rinv(real_of_posnat n) \ 
  2274 Goal "ALL n. abs(X n + -x) < inverse(real_of_posnat n) \ 
  2275 \     ==> Abs_hypreal(hyprel^^{X}) @= hypreal_of_real x";
  2275 \     ==> Abs_hypreal(hyprel^^{X}) @= hypreal_of_real x";
  2276 by (rtac (inf_close_minus_iff RS ssubst) 1);
  2276 by (rtac (inf_close_minus_iff RS ssubst) 1);
  2277 by (rtac (mem_infmal_iff RS subst) 1);
  2277 by (rtac (mem_infmal_iff RS subst) 1);
  2278 by (etac real_seq_to_hypreal_Infinitesimal 1);
  2278 by (etac real_seq_to_hypreal_Infinitesimal 1);
  2279 qed "real_seq_to_hypreal_inf_close";
  2279 qed "real_seq_to_hypreal_inf_close";
  2280 
  2280 
  2281 Goal "ALL n. abs(x + -X n) < rinv(real_of_posnat n) \ 
  2281 Goal "ALL n. abs(x + -X n) < inverse(real_of_posnat n) \ 
  2282 \              ==> Abs_hypreal(hyprel^^{X}) @= hypreal_of_real x";
  2282 \              ==> Abs_hypreal(hyprel^^{X}) @= hypreal_of_real x";
  2283 by (asm_full_simp_tac (simpset() addsimps [abs_minus_add_cancel,
  2283 by (asm_full_simp_tac (simpset() addsimps [abs_minus_add_cancel,
  2284         real_seq_to_hypreal_inf_close]) 1);
  2284         real_seq_to_hypreal_inf_close]) 1);
  2285 qed "real_seq_to_hypreal_inf_close2";
  2285 qed "real_seq_to_hypreal_inf_close2";
  2286 
  2286 
  2287 Goal "ALL n. abs(X n + -Y n) < rinv(real_of_posnat n) \ 
  2287 Goal "ALL n. abs(X n + -Y n) < inverse(real_of_posnat n) \ 
  2288 \     ==> Abs_hypreal(hyprel^^{X}) + \
  2288 \     ==> Abs_hypreal(hyprel^^{X}) + \
  2289 \         -Abs_hypreal(hyprel^^{Y}) : Infinitesimal";
  2289 \         -Abs_hypreal(hyprel^^{Y}) : Infinitesimal";
  2290 by (auto_tac (claset() addSIs [bexI] addDs [rename_numerals 
  2290 by (auto_tac (claset() addSIs [bexI] addDs [rename_numerals 
  2291     FreeUltrafilterNat_rinv_real_of_posnat,
  2291     FreeUltrafilterNat_inverse_real_of_posnat,
  2292     FreeUltrafilterNat_all,FreeUltrafilterNat_Int] addIs [real_less_trans,
  2292     FreeUltrafilterNat_all,FreeUltrafilterNat_Int] addIs [real_less_trans,
  2293     FreeUltrafilterNat_subset],simpset() addsimps 
  2293     FreeUltrafilterNat_subset],simpset() addsimps 
  2294     [Infinitesimal_FreeUltrafilterNat_iff,hypreal_minus,hypreal_add, 
  2294     [Infinitesimal_FreeUltrafilterNat_iff,hypreal_minus,hypreal_add, 
  2295     hypreal_hrinv,hypreal_of_real_of_posnat]));
  2295     hypreal_inverse,hypreal_of_real_of_posnat]));
  2296 qed "real_seq_to_hypreal_Infinitesimal2";
  2296 qed "real_seq_to_hypreal_Infinitesimal2";
  2297  
  2297