src/HOL/Hyperreal/NSA.ML
changeset 14331 8dbbb7cf3637
parent 14329 ff3210fe968f
child 14334 6137d24eef79
equal deleted inserted replaced
14330:eb8b8241ef5b 14331:8dbbb7cf3637
   268 
   268 
   269 Goal "[|x : HFinite; y <= x; 0 <= y |] ==> y: HFinite";
   269 Goal "[|x : HFinite; y <= x; 0 <= y |] ==> y: HFinite";
   270 by (case_tac "x <= 0" 1);
   270 by (case_tac "x <= 0" 1);
   271 by (dres_inst_tac [("y","x")] order_trans 1);
   271 by (dres_inst_tac [("y","x")] order_trans 1);
   272 by (dtac hypreal_le_anti_sym 2);
   272 by (dtac hypreal_le_anti_sym 2);
   273 by (auto_tac (claset() addSDs [not_hypreal_leE], simpset()));
   273 by (auto_tac (claset(), simpset() addsimps [linorder_not_le]));
   274 by (auto_tac (claset() addSIs [bexI] addIs [order_le_less_trans],
   274 by (auto_tac (claset() addSIs [bexI] addIs [order_le_less_trans],
   275      simpset() addsimps [hrabs_eqI1,hrabs_eqI2,hrabs_minus_eqI1,HFinite_def]));
   275      simpset() addsimps [hrabs_eqI1,hrabs_eqI2,hrabs_minus_eqI1,HFinite_def]));
   276 qed "HFinite_bounded";
   276 qed "HFinite_bounded";
   277 
   277 
   278 (*------------------------------------------------------------------
   278 (*------------------------------------------------------------------
   349 by (eres_inst_tac [("x","inverse r")] ballE 1);
   349 by (eres_inst_tac [("x","inverse r")] ballE 1);
   350 by (forw_inst_tac [("x1","r"),("z","abs x")]
   350 by (forw_inst_tac [("x1","r"),("z","abs x")]
   351     (hypreal_inverse_gt_0 RS order_less_trans) 1);
   351     (hypreal_inverse_gt_0 RS order_less_trans) 1);
   352 by (assume_tac 1);
   352 by (assume_tac 1);
   353 by (dtac ((inverse_inverse_eq RS sym) RS subst) 1);
   353 by (dtac ((inverse_inverse_eq RS sym) RS subst) 1);
   354 by (rtac (hypreal_inverse_less_iff RS iffD1) 1);
   354 by (rtac (inverse_less_iff_less RS iffD1) 1);
   355 by (auto_tac (claset(), simpset() addsimps [SReal_inverse]));
   355 by (auto_tac (claset(), simpset() addsimps [SReal_inverse]));
   356 qed "HInfinite_inverse_Infinitesimal";
   356 qed "HInfinite_inverse_Infinitesimal";
   357 
   357 
   358 
   358 
   359 
   359 
   362 by (eres_inst_tac [("x","1")] ballE 1);
   362 by (eres_inst_tac [("x","1")] ballE 1);
   363 by (eres_inst_tac [("x","r")] ballE 1);
   363 by (eres_inst_tac [("x","r")] ballE 1);
   364 by (case_tac "y=0" 1);
   364 by (case_tac "y=0" 1);
   365 by (cut_inst_tac [("x","1"),("y","abs x"),
   365 by (cut_inst_tac [("x","1"),("y","abs x"),
   366                   ("u","r"),("v","abs y")] hypreal_mult_less_mono 2);
   366                   ("u","r"),("v","abs y")] hypreal_mult_less_mono 2);
   367 by (auto_tac (claset(), simpset() addsimps hypreal_mult_ac));
   367 by (auto_tac (claset(), simpset() addsimps mult_ac));
   368 qed "HInfinite_mult";
   368 qed "HInfinite_mult";
   369 
   369 
   370 Goalw [HInfinite_def]
   370 Goalw [HInfinite_def]
   371       "[|x: HInfinite; 0 <= y; 0 <= x|] ==> (x + y): HInfinite";
   371       "[|x: HInfinite; 0 <= y; 0 <= x|] ==> (x + y): HInfinite";
   372 by (auto_tac (claset() addSIs [hypreal_add_zero_less_le_mono],
   372 by (auto_tac (claset() addSIs [hypreal_add_zero_less_le_mono],
   390 
   390 
   391 Goal "[|x: HInfinite; y <= 0; x <= 0|] ==> (x + y): HInfinite";
   391 Goal "[|x: HInfinite; y <= 0; x <= 0|] ==> (x + y): HInfinite";
   392 by (dtac (HInfinite_minus_iff RS iffD2) 1);
   392 by (dtac (HInfinite_minus_iff RS iffD2) 1);
   393 by (rtac (HInfinite_minus_iff RS iffD1) 1);
   393 by (rtac (HInfinite_minus_iff RS iffD1) 1);
   394 by (auto_tac (claset() addIs [HInfinite_add_ge_zero],
   394 by (auto_tac (claset() addIs [HInfinite_add_ge_zero],
   395               simpset() addsimps [hypreal_minus_zero_le_iff]));
   395               simpset()));
   396 qed "HInfinite_add_le_zero";
   396 qed "HInfinite_add_le_zero";
   397 
   397 
   398 Goal "[|x: HInfinite; y < 0; x < 0|] ==> (x + y): HInfinite";
   398 Goal "[|x: HInfinite; y < 0; x < 0|] ==> (x + y): HInfinite";
   399 by (blast_tac (claset() addIs [HInfinite_add_le_zero,
   399 by (blast_tac (claset() addIs [HInfinite_add_le_zero,
   400                                order_less_imp_le]) 1);
   400                                order_less_imp_le]) 1);
   454      "[| x ~: Infinitesimal;  y ~: Infinitesimal|] ==> (x*y) ~:Infinitesimal";
   454      "[| x ~: Infinitesimal;  y ~: Infinitesimal|] ==> (x*y) ~:Infinitesimal";
   455 by (Clarify_tac 1);
   455 by (Clarify_tac 1);
   456 by (asm_full_simp_tac (simpset() addsimps [linorder_not_less]) 1);
   456 by (asm_full_simp_tac (simpset() addsimps [linorder_not_less]) 1);
   457 by (eres_inst_tac [("x","r*ra")] ballE 1);
   457 by (eres_inst_tac [("x","r*ra")] ballE 1);
   458 by (fast_tac (claset() addIs [SReal_mult]) 2);
   458 by (fast_tac (claset() addIs [SReal_mult]) 2);
   459 by (auto_tac (claset(), simpset() addsimps [hypreal_0_less_mult_iff]));
   459 by (auto_tac (claset(), simpset() addsimps [zero_less_mult_iff]));
   460 by (cut_inst_tac [("x","ra"),("y","abs y"),
   460 by (cut_inst_tac [("x","ra"),("y","abs y"),
   461                   ("u","r"),("v","abs x")] hypreal_mult_le_mono 1);
   461                   ("u","r"),("v","abs x")] hypreal_mult_le_mono 1);
   462 by Auto_tac;
   462 by Auto_tac;
   463 qed "not_Infinitesimal_mult";
   463 qed "not_Infinitesimal_mult";
   464 
   464 
   596 by (blast_tac (claset() addIs [approx_trans, approx_sym]) 1);
   596 by (blast_tac (claset() addIs [approx_trans, approx_sym]) 1);
   597 qed "Infinitesimal_approx";
   597 qed "Infinitesimal_approx";
   598 
   598 
   599 val prem1::prem2::rest =
   599 val prem1::prem2::rest =
   600 goalw thy [approx_def] "[| a @= b; c @= d |] ==> a+c @= b+d";
   600 goalw thy [approx_def] "[| a @= b; c @= d |] ==> a+c @= b+d";
   601 by (stac hypreal_minus_add_distrib 1);
   601 by (stac minus_add_distrib 1);
   602 by (stac hypreal_add_assoc 1);
   602 by (stac hypreal_add_assoc 1);
   603 by (res_inst_tac [("y1","c")] (hypreal_add_left_commute RS subst) 1);
   603 by (res_inst_tac [("b1","c")] (add_left_commute RS subst) 1);
   604 by (rtac (hypreal_add_assoc RS subst) 1);
   604 by (rtac (hypreal_add_assoc RS subst) 1);
   605 by (rtac ([prem1,prem2] MRS Infinitesimal_add) 1);
   605 by (rtac ([prem1,prem2] MRS Infinitesimal_add) 1);
   606 qed "approx_add";
   606 qed "approx_add";
   607 
   607 
   608 Goal "a @= b ==> -a @= -b";
   608 Goal "a @= b ==> -a @= -b";
   625 by (blast_tac (claset() addSIs [approx_add,approx_minus]) 1);
   625 by (blast_tac (claset() addSIs [approx_add,approx_minus]) 1);
   626 qed "approx_add_minus";
   626 qed "approx_add_minus";
   627 
   627 
   628 Goalw [approx_def] "[| a @= b; c: HFinite|] ==> a*c @= b*c";
   628 Goalw [approx_def] "[| a @= b; c: HFinite|] ==> a*c @= b*c";
   629 by (asm_full_simp_tac (simpset() addsimps [Infinitesimal_HFinite_mult,
   629 by (asm_full_simp_tac (simpset() addsimps [Infinitesimal_HFinite_mult,
   630     hypreal_minus_mult_eq1,hypreal_add_mult_distrib RS sym]
   630     minus_mult_left,left_distrib RS sym]
   631     delsimps [hypreal_minus_mult_eq1 RS sym]) 1);
   631     delsimps [minus_mult_left RS sym]) 1);
   632 qed "approx_mult1";
   632 qed "approx_mult1";
   633 
   633 
   634 Goal "[|a @= b; c: HFinite|] ==> c*a @= c*b";
   634 Goal "[|a @= b; c: HFinite|] ==> c*a @= c*b";
   635 by (asm_simp_tac (simpset() addsimps [approx_mult1,hypreal_mult_commute]) 1);
   635 by (asm_simp_tac (simpset() addsimps [approx_mult1,hypreal_mult_commute]) 1);
   636 qed "approx_mult2";
   636 qed "approx_mult2";
   666 qed "bex_Infinitesimal_iff2";
   666 qed "bex_Infinitesimal_iff2";
   667 
   667 
   668 Goal "[| y: Infinitesimal; x + y = z |] ==> x @= z";
   668 Goal "[| y: Infinitesimal; x + y = z |] ==> x @= z";
   669 by (rtac (bex_Infinitesimal_iff RS iffD1) 1);
   669 by (rtac (bex_Infinitesimal_iff RS iffD1) 1);
   670 by (dtac (Infinitesimal_minus_iff RS iffD2) 1);
   670 by (dtac (Infinitesimal_minus_iff RS iffD2) 1);
   671 by (auto_tac (claset(), simpset() addsimps [hypreal_minus_add_distrib,
   671 by (auto_tac (claset(), simpset() addsimps [minus_add_distrib,
   672     hypreal_add_assoc RS sym]));
   672     hypreal_add_assoc RS sym]));
   673 qed "Infinitesimal_add_approx";
   673 qed "Infinitesimal_add_approx";
   674 
   674 
   675 Goal "y: Infinitesimal ==> x @= x + y";
   675 Goal "y: Infinitesimal ==> x @= x + y";
   676 by (rtac (bex_Infinitesimal_iff RS iffD1) 1);
   676 by (rtac (bex_Infinitesimal_iff RS iffD1) 1);
   677 by (dtac (Infinitesimal_minus_iff RS iffD2) 1);
   677 by (dtac (Infinitesimal_minus_iff RS iffD2) 1);
   678 by (auto_tac (claset(), simpset() addsimps [hypreal_minus_add_distrib,
   678 by (auto_tac (claset(), simpset() addsimps [minus_add_distrib,
   679     hypreal_add_assoc RS sym]));
   679     hypreal_add_assoc RS sym]));
   680 qed "Infinitesimal_add_approx_self";
   680 qed "Infinitesimal_add_approx_self";
   681 
   681 
   682 Goal "y: Infinitesimal ==> x @= y + x";
   682 Goal "y: Infinitesimal ==> x @= y + x";
   683 by (auto_tac (claset() addDs [Infinitesimal_add_approx_self],
   683 by (auto_tac (claset() addDs [Infinitesimal_add_approx_self],
   703 qed "Infinitesimal_add_right_cancel";
   703 qed "Infinitesimal_add_right_cancel";
   704 
   704 
   705 Goal "d + b  @= d + c ==> b @= c";
   705 Goal "d + b  @= d + c ==> b @= c";
   706 by (dtac (approx_minus_iff RS iffD1) 1);
   706 by (dtac (approx_minus_iff RS iffD1) 1);
   707 by (asm_full_simp_tac (simpset() addsimps
   707 by (asm_full_simp_tac (simpset() addsimps
   708     [hypreal_minus_add_distrib,approx_minus_iff RS sym]
   708     [minus_add_distrib,approx_minus_iff RS sym]
   709     @ hypreal_add_ac) 1);
   709     @ add_ac) 1);
   710 qed "approx_add_left_cancel";
   710 qed "approx_add_left_cancel";
   711 
   711 
   712 Goal "b + d @= c + d ==> b @= c";
   712 Goal "b + d @= c + d ==> b @= c";
   713 by (rtac approx_add_left_cancel 1);
   713 by (rtac approx_add_left_cancel 1);
   714 by (asm_full_simp_tac (simpset() addsimps
   714 by (asm_full_simp_tac (simpset() addsimps
   716 qed "approx_add_right_cancel";
   716 qed "approx_add_right_cancel";
   717 
   717 
   718 Goal "b @= c ==> d + b @= d + c";
   718 Goal "b @= c ==> d + b @= d + c";
   719 by (rtac (approx_minus_iff RS iffD2) 1);
   719 by (rtac (approx_minus_iff RS iffD2) 1);
   720 by (asm_full_simp_tac (simpset() addsimps
   720 by (asm_full_simp_tac (simpset() addsimps
   721     [hypreal_minus_add_distrib,approx_minus_iff RS sym]
   721     [minus_add_distrib,approx_minus_iff RS sym]
   722     @ hypreal_add_ac) 1);
   722     @ add_ac) 1);
   723 qed "approx_add_mono1";
   723 qed "approx_add_mono1";
   724 
   724 
   725 Goal "b @= c ==> b + a @= c + a";
   725 Goal "b @= c ==> b + a @= c + a";
   726 by (asm_simp_tac (simpset() addsimps
   726 by (asm_simp_tac (simpset() addsimps
   727     [hypreal_add_commute,approx_add_mono1]) 1);
   727     [hypreal_add_commute,approx_add_mono1]) 1);
  1052 Goal "[| x: HFinite; \
  1052 Goal "[| x: HFinite; \
  1053 \        isLub Reals {s. s: Reals & s < x} t; \
  1053 \        isLub Reals {s. s: Reals & s < x} t; \
  1054 \        r: Reals; 0 < r |] \
  1054 \        r: Reals; 0 < r |] \
  1055 \     ==> t + -r <= x";
  1055 \     ==> t + -r <= x";
  1056 by (ftac isLubD1a 1);
  1056 by (ftac isLubD1a 1);
  1057 by (rtac ccontr 1 THEN dtac not_hypreal_leE 1);
  1057 by (rtac ccontr 1 THEN dtac (linorder_not_le RS iffD1) 1);
  1058 by (dtac SReal_minus 1 THEN dres_inst_tac [("x","t")]
  1058 by (dtac SReal_minus 1 THEN dres_inst_tac [("x","t")]
  1059     SReal_add 1 THEN assume_tac 1);
  1059     SReal_add 1 THEN assume_tac 1);
  1060 by (dtac lemma_st_part_gt_ub 1 THEN REPEAT(assume_tac 1));
  1060 by (dtac lemma_st_part_gt_ub 1 THEN REPEAT(assume_tac 1));
  1061 by (dtac isLub_le_isUb 1 THEN assume_tac 1);
  1061 by (dtac isLub_le_isUb 1 THEN assume_tac 1);
  1062 by (dtac lemma_minus_le_zero 1);
  1062 by (dtac lemma_minus_le_zero 1);
  1115 
  1115 
  1116 Goal "[| x: HFinite; \
  1116 Goal "[| x: HFinite; \
  1117 \        isLub Reals {s. s: Reals & s < x} t; \
  1117 \        isLub Reals {s. s: Reals & s < x} t; \
  1118 \        r: Reals; 0 < r |] \
  1118 \        r: Reals; 0 < r |] \
  1119 \     ==> -(x + -t) ~= r";
  1119 \     ==> -(x + -t) ~= r";
  1120 by (auto_tac (claset(), simpset() addsimps [hypreal_minus_add_distrib]));
  1120 by (auto_tac (claset(), simpset() addsimps [minus_add_distrib]));
  1121 by (ftac isLubD1a 1);
  1121 by (ftac isLubD1a 1);
  1122 by (dtac SReal_add_cancel 1 THEN assume_tac 1);
  1122 by (dtac SReal_add_cancel 1 THEN assume_tac 1);
  1123 by (dres_inst_tac [("x","-x")] SReal_minus 1);
  1123 by (dres_inst_tac [("x","-x")] SReal_minus 1);
  1124 by (Asm_full_simp_tac 1);
  1124 by (Asm_full_simp_tac 1);
  1125 by (dres_inst_tac [("x","x")] lemma_SReal_lub 1);
  1125 by (dres_inst_tac [("x","x")] lemma_SReal_lub 1);
  1398 
  1398 
  1399 Goal "[| 0 < x;  x ~:Infinitesimal;  e :Infinitesimal |] ==> e < x";
  1399 Goal "[| 0 < x;  x ~:Infinitesimal;  e :Infinitesimal |] ==> e < x";
  1400 by (rtac ccontr 1);
  1400 by (rtac ccontr 1);
  1401 by (auto_tac (claset()
  1401 by (auto_tac (claset()
  1402                addIs [Infinitesimal_zero RSN (2, Infinitesimal_interval)]
  1402                addIs [Infinitesimal_zero RSN (2, Infinitesimal_interval)]
  1403                addSDs [hypreal_leI, order_le_imp_less_or_eq],
  1403                addSDs [order_le_imp_less_or_eq],
  1404               simpset()));
  1404               simpset() addsimps [linorder_not_less]));
  1405 qed "less_Infinitesimal_less";
  1405 qed "less_Infinitesimal_less";
  1406 
  1406 
  1407 Goal "[| 0 < x;  x ~: Infinitesimal; u: monad x |] ==> 0 < u";
  1407 Goal "[| 0 < x;  x ~: Infinitesimal; u: monad x |] ==> 0 < u";
  1408 by (dtac (mem_monad_approx RS approx_sym) 1);
  1408 by (dtac (mem_monad_approx RS approx_sym) 1);
  1409 by (etac (bex_Infinitesimal_iff2 RS iffD2 RS bexE) 1);
  1409 by (etac (bex_Infinitesimal_iff2 RS iffD2 RS bexE) 1);
  1543 by (blast_tac (claset() addSIs [hypreal_of_real_le_iff RS iffD1,
  1543 by (blast_tac (claset() addSIs [hypreal_of_real_le_iff RS iffD1,
  1544                           hypreal_of_real_le_add_Infininitesimal_cancel]) 1);
  1544                           hypreal_of_real_le_add_Infininitesimal_cancel]) 1);
  1545 qed "hypreal_of_real_le_add_Infininitesimal_cancel2";
  1545 qed "hypreal_of_real_le_add_Infininitesimal_cancel2";
  1546 
  1546 
  1547 Goal "[| hypreal_of_real x < e; e: Infinitesimal |] ==> hypreal_of_real x <= 0";
  1547 Goal "[| hypreal_of_real x < e; e: Infinitesimal |] ==> hypreal_of_real x <= 0";
  1548 by (rtac hypreal_leI 1 THEN Step_tac 1);
  1548 by (rtac (linorder_not_less RS iffD1) 1 THEN Safe_tac);
  1549 by (dtac Infinitesimal_interval 1);
  1549 by (dtac Infinitesimal_interval 1);
  1550 by (dtac (SReal_hypreal_of_real RS SReal_Infinitesimal_zero) 4);
  1550 by (dtac (SReal_hypreal_of_real RS SReal_Infinitesimal_zero) 4);
  1551 by Auto_tac;
  1551 by Auto_tac;
  1552 qed "hypreal_of_real_less_Infinitesimal_le_zero";
  1552 qed "hypreal_of_real_less_Infinitesimal_le_zero";
  1553 
  1553 
  1608 qed "HFinite_sum_square_cancel";
  1608 qed "HFinite_sum_square_cancel";
  1609 Addsimps [HFinite_sum_square_cancel];
  1609 Addsimps [HFinite_sum_square_cancel];
  1610 
  1610 
  1611 Goal "y*y + x*x + z*z : Infinitesimal ==> x*x : Infinitesimal";
  1611 Goal "y*y + x*x + z*z : Infinitesimal ==> x*x : Infinitesimal";
  1612 by (rtac Infinitesimal_sum_square_cancel 1);
  1612 by (rtac Infinitesimal_sum_square_cancel 1);
  1613 by (asm_full_simp_tac (simpset() addsimps hypreal_add_ac) 1);
  1613 by (asm_full_simp_tac (simpset() addsimps add_ac) 1);
  1614 qed "Infinitesimal_sum_square_cancel2";
  1614 qed "Infinitesimal_sum_square_cancel2";
  1615 Addsimps [Infinitesimal_sum_square_cancel2];
  1615 Addsimps [Infinitesimal_sum_square_cancel2];
  1616 
  1616 
  1617 Goal "y*y + x*x + z*z : HFinite ==> x*x : HFinite";
  1617 Goal "y*y + x*x + z*z : HFinite ==> x*x : HFinite";
  1618 by (rtac HFinite_sum_square_cancel 1);
  1618 by (rtac HFinite_sum_square_cancel 1);
  1619 by (asm_full_simp_tac (simpset() addsimps hypreal_add_ac) 1);
  1619 by (asm_full_simp_tac (simpset() addsimps add_ac) 1);
  1620 qed "HFinite_sum_square_cancel2";
  1620 qed "HFinite_sum_square_cancel2";
  1621 Addsimps [HFinite_sum_square_cancel2];
  1621 Addsimps [HFinite_sum_square_cancel2];
  1622 
  1622 
  1623 Goal "z*z + y*y + x*x : Infinitesimal ==> x*x : Infinitesimal";
  1623 Goal "z*z + y*y + x*x : Infinitesimal ==> x*x : Infinitesimal";
  1624 by (rtac Infinitesimal_sum_square_cancel 1);
  1624 by (rtac Infinitesimal_sum_square_cancel 1);
  1625 by (asm_full_simp_tac (simpset() addsimps hypreal_add_ac) 1);
  1625 by (asm_full_simp_tac (simpset() addsimps add_ac) 1);
  1626 qed "Infinitesimal_sum_square_cancel3";
  1626 qed "Infinitesimal_sum_square_cancel3";
  1627 Addsimps [Infinitesimal_sum_square_cancel3];
  1627 Addsimps [Infinitesimal_sum_square_cancel3];
  1628 
  1628 
  1629 Goal "z*z + y*y + x*x : HFinite ==> x*x : HFinite";
  1629 Goal "z*z + y*y + x*x : HFinite ==> x*x : HFinite";
  1630 by (rtac HFinite_sum_square_cancel 1);
  1630 by (rtac HFinite_sum_square_cancel 1);
  1631 by (asm_full_simp_tac (simpset() addsimps hypreal_add_ac) 1);
  1631 by (asm_full_simp_tac (simpset() addsimps add_ac) 1);
  1632 qed "HFinite_sum_square_cancel3";
  1632 qed "HFinite_sum_square_cancel3";
  1633 Addsimps [HFinite_sum_square_cancel3];
  1633 Addsimps [HFinite_sum_square_cancel3];
  1634 
  1634 
  1635 Goal "[| y: monad x; 0 < hypreal_of_real e |] \
  1635 Goal "[| y: monad x; 0 < hypreal_of_real e |] \
  1636 \     ==> abs (y + -x) < hypreal_of_real e";
  1636 \     ==> abs (y + -x) < hypreal_of_real e";
  1727 by (forw_inst_tac [("x","y")] HFinite_st_Infinitesimal_add 1);
  1727 by (forw_inst_tac [("x","y")] HFinite_st_Infinitesimal_add 1);
  1728 by (Step_tac 1);
  1728 by (Step_tac 1);
  1729 by (subgoal_tac "st (x + y) = st ((st x + e) + (st y + ea))" 1);
  1729 by (subgoal_tac "st (x + y) = st ((st x + e) + (st y + ea))" 1);
  1730 by (dtac sym 2 THEN dtac sym 2);
  1730 by (dtac sym 2 THEN dtac sym 2);
  1731 by (Asm_full_simp_tac 2);
  1731 by (Asm_full_simp_tac 2);
  1732 by (asm_simp_tac (simpset() addsimps hypreal_add_ac) 1);
  1732 by (asm_simp_tac (simpset() addsimps add_ac) 1);
  1733 by (REPEAT(dtac st_SReal 1));
  1733 by (REPEAT(dtac st_SReal 1));
  1734 by (dtac SReal_add 1 THEN assume_tac 1);
  1734 by (dtac SReal_add 1 THEN assume_tac 1);
  1735 by (dtac Infinitesimal_add 1 THEN assume_tac 1);
  1735 by (dtac Infinitesimal_add 1 THEN assume_tac 1);
  1736 by (rtac (hypreal_add_assoc RS subst) 1);
  1736 by (rtac (hypreal_add_assoc RS subst) 1);
  1737 by (blast_tac (claset() addSIs [st_Infinitesimal_add_SReal2]) 1);
  1737 by (blast_tac (claset() addSIs [st_Infinitesimal_add_SReal2]) 1);
  1768 \      ==> e*y + x*ea + e*ea: Infinitesimal";
  1768 \      ==> e*y + x*ea + e*ea: Infinitesimal";
  1769 by (forw_inst_tac [("x","e"),("y","y")] Infinitesimal_HFinite_mult 1);
  1769 by (forw_inst_tac [("x","e"),("y","y")] Infinitesimal_HFinite_mult 1);
  1770 by (forw_inst_tac [("x","ea"),("y","x")] Infinitesimal_HFinite_mult 2);
  1770 by (forw_inst_tac [("x","ea"),("y","x")] Infinitesimal_HFinite_mult 2);
  1771 by (dtac Infinitesimal_mult 3);
  1771 by (dtac Infinitesimal_mult 3);
  1772 by (auto_tac (claset() addIs [Infinitesimal_add],
  1772 by (auto_tac (claset() addIs [Infinitesimal_add],
  1773               simpset() addsimps hypreal_add_ac @ hypreal_mult_ac));
  1773               simpset() addsimps add_ac @ mult_ac));
  1774 qed "lemma_st_mult";
  1774 qed "lemma_st_mult";
  1775 
  1775 
  1776 Goal "[| x: HFinite; y: HFinite |] \
  1776 Goal "[| x: HFinite; y: HFinite |] \
  1777 \              ==> st (x * y) = st(x) * st(y)";
  1777 \              ==> st (x * y) = st(x) * st(y)";
  1778 by (ftac HFinite_st_Infinitesimal_add 1);
  1778 by (ftac HFinite_st_Infinitesimal_add 1);
  1781 by (subgoal_tac "st (x * y) = st ((st x + e) * (st y + ea))" 1);
  1781 by (subgoal_tac "st (x * y) = st ((st x + e) * (st y + ea))" 1);
  1782 by (dtac sym 2 THEN dtac sym 2);
  1782 by (dtac sym 2 THEN dtac sym 2);
  1783 by (Asm_full_simp_tac 2);
  1783 by (Asm_full_simp_tac 2);
  1784 by (thin_tac "x = st x + e" 1);
  1784 by (thin_tac "x = st x + e" 1);
  1785 by (thin_tac "y = st y + ea" 1);
  1785 by (thin_tac "y = st y + ea" 1);
  1786 by (asm_full_simp_tac (simpset() addsimps
  1786 by (asm_full_simp_tac (simpset() addsimps [left_distrib,right_distrib]) 1);
  1787     [hypreal_add_mult_distrib,hypreal_add_mult_distrib2]) 1);
       
  1788 by (REPEAT(dtac st_SReal 1));
  1787 by (REPEAT(dtac st_SReal 1));
  1789 by (full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1);
  1788 by (full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1);
  1790 by (rtac st_Infinitesimal_add_SReal 1);
  1789 by (rtac st_Infinitesimal_add_SReal 1);
  1791 by (blast_tac (claset() addSIs [SReal_mult]) 1);
  1790 by (blast_tac (claset() addSIs [SReal_mult]) 1);
  1792 by (REPEAT(dtac (SReal_subset_HFinite RS subsetD) 1));
  1791 by (REPEAT(dtac (SReal_subset_HFinite RS subsetD) 1));
  1872 by Auto_tac;
  1871 by Auto_tac;
  1873 qed "st_zero_ge";
  1872 qed "st_zero_ge";
  1874 
  1873 
  1875 Goal "x: HFinite ==> abs(st x) = st(abs x)";
  1874 Goal "x: HFinite ==> abs(st x) = st(abs x)";
  1876 by (case_tac "0 <= x" 1);
  1875 by (case_tac "0 <= x" 1);
  1877 by (auto_tac (claset() addSDs [not_hypreal_leE, order_less_imp_le],
  1876 by (auto_tac (claset() addSDs [order_less_imp_le],
  1878               simpset() addsimps [st_zero_le,hrabs_eqI1, hrabs_minus_eqI1,
  1877               simpset() addsimps [linorder_not_le,st_zero_le,hrabs_eqI1, hrabs_minus_eqI1,
  1879                                   st_zero_ge,st_minus]));
  1878                                   st_zero_ge,st_minus]));
  1880 qed "st_hrabs";
  1879 qed "st_hrabs";
  1881 
  1880 
  1882 (*--------------------------------------------------------------------
  1881 (*--------------------------------------------------------------------
  1883    Alternative definitions for HFinite using Free ultrafilter
  1882    Alternative definitions for HFinite using Free ultrafilter
  2212  -----------------------------------------------------------------------*)
  2211  -----------------------------------------------------------------------*)
  2213 
  2212 
  2214 Goal "0 < u  ==> \
  2213 Goal "0 < u  ==> \
  2215 \     (u < inverse (real(Suc n))) = (real(Suc n) < inverse u)";
  2214 \     (u < inverse (real(Suc n))) = (real(Suc n) < inverse u)";
  2216 by (asm_full_simp_tac (simpset() addsimps [inverse_eq_divide]) 1);
  2215 by (asm_full_simp_tac (simpset() addsimps [inverse_eq_divide]) 1);
  2217 by (stac pos_real_less_divide_eq 1);
  2216 by (stac pos_less_divide_eq 1);
  2218 by (assume_tac 1);
  2217 by (assume_tac 1);
  2219 by (stac pos_real_less_divide_eq 1);
  2218 by (stac pos_less_divide_eq 1);
  2220 by (simp_tac (simpset() addsimps [real_mult_commute]) 2);
  2219 by (simp_tac (simpset() addsimps [real_mult_commute]) 2);
  2221 by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1);
  2220 by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1);
  2222 qed "real_of_nat_less_inverse_iff";
  2221 qed "real_of_nat_less_inverse_iff";
  2223 
  2222 
  2224 Goal "0 < u ==> finite {n. u < inverse(real(Suc n))}";
  2223 Goal "0 < u ==> finite {n. u < inverse(real(Suc n))}";
  2235 qed "lemma_real_le_Un_eq2";
  2234 qed "lemma_real_le_Un_eq2";
  2236 
  2235 
  2237 Goal "(inverse (real(Suc n)) <= r) = (1 <= r * real(Suc n))";
  2236 Goal "(inverse (real(Suc n)) <= r) = (1 <= r * real(Suc n))";
  2238 by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1);
  2237 by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1);
  2239 by (simp_tac (simpset() addsimps [inverse_eq_divide]) 1);
  2238 by (simp_tac (simpset() addsimps [inverse_eq_divide]) 1);
  2240 by (stac pos_real_less_divide_eq 1);
  2239 by (stac pos_less_divide_eq 1);
  2241 by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1);
  2240 by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1);
  2242 by (simp_tac (simpset() addsimps [real_mult_commute]) 1);
  2241 by (simp_tac (simpset() addsimps [real_mult_commute]) 1);
  2243 qed "real_of_nat_inverse_le_iff";
  2242 qed "real_of_nat_inverse_le_iff";
  2244 
  2243 
  2245 Goal "(u = inverse (real(Suc n))) = (real(Suc n) = inverse u)";
  2244 Goal "(u = inverse (real(Suc n))) = (real(Suc n) = inverse u)";