src/HOL/Hyperreal/Lim.ML
changeset 10919 144ede948e58
parent 10834 a7897aebbffc
child 11172 3c82b641b642
equal deleted inserted replaced
10918:9679326489cd 10919:144ede948e58
   157 (***           End of Purely Standard Proofs                     ***)
   157 (***           End of Purely Standard Proofs                     ***)
   158 (***-------------------------------------------------------------***)
   158 (***-------------------------------------------------------------***)
   159 (*--------------------------------------------------------------
   159 (*--------------------------------------------------------------
   160        Standard and NS definitions of Limit
   160        Standard and NS definitions of Limit
   161  --------------------------------------------------------------*)
   161  --------------------------------------------------------------*)
   162 Goalw [LIM_def,NSLIM_def,inf_close_def] 
   162 Goalw [LIM_def,NSLIM_def,approx_def] 
   163       "f -- x --> L ==> f -- x --NS> L";
   163       "f -- x --> L ==> f -- x --NS> L";
   164 by (asm_full_simp_tac
   164 by (asm_full_simp_tac
   165     (simpset() addsimps [Infinitesimal_FreeUltrafilterNat_iff]) 1);
   165     (simpset() addsimps [Infinitesimal_FreeUltrafilterNat_iff]) 1);
   166 by (Step_tac 1);
   166 by (Step_tac 1);
   167 by (res_inst_tac [("z","xa")] eq_Abs_hypreal 1);
   167 by (res_inst_tac [("z","xa")] eq_Abs_hypreal 1);
   183  ---------------------------------------------------------------------*)
   183  ---------------------------------------------------------------------*)
   184 
   184 
   185 Goal "ALL s. #0 < s --> (EX xa.  xa ~= x & \
   185 Goal "ALL s. #0 < s --> (EX xa.  xa ~= x & \
   186 \        abs (xa + - x) < s  & r <= abs (f xa + -L)) \
   186 \        abs (xa + - x) < s  & r <= abs (f xa + -L)) \
   187 \     ==> ALL n::nat. EX xa.  xa ~= x & \
   187 \     ==> ALL n::nat. EX xa.  xa ~= x & \
   188 \             abs(xa + -x) < inverse(real_of_nat(Suc n)) & r <= abs(f xa + -L)";
   188 \             abs(xa + -x) < inverse(real(Suc n)) & r <= abs(f xa + -L)";
   189 by (Clarify_tac 1); 
   189 by (Clarify_tac 1); 
   190 by (cut_inst_tac [("n1","n")]
   190 by (cut_inst_tac [("n1","n")]
   191     (real_of_nat_Suc_gt_zero RS rename_numerals real_inverse_gt_zero) 1);
   191     (real_of_nat_Suc_gt_zero RS rename_numerals real_inverse_gt_zero) 1);
   192 by Auto_tac;
   192 by Auto_tac;
   193 val lemma_LIM = result();
   193 val lemma_LIM = result();
   194 
   194 
   195 Goal "ALL s. #0 < s --> (EX xa.  xa ~= x & \
   195 Goal "ALL s. #0 < s --> (EX xa.  xa ~= x & \
   196 \        abs (xa + - x) < s  & r <= abs (f xa + -L)) \
   196 \        abs (xa + - x) < s  & r <= abs (f xa + -L)) \
   197 \     ==> EX X. ALL n::nat. X n ~= x & \
   197 \     ==> EX X. ALL n::nat. X n ~= x & \
   198 \               abs(X n + -x) < inverse(real_of_nat(Suc n)) & r <= abs(f (X n) + -L)";
   198 \               abs(X n + -x) < inverse(real(Suc n)) & r <= abs(f (X n) + -L)";
   199 by (dtac lemma_LIM 1);
   199 by (dtac lemma_LIM 1);
   200 by (dtac choice 1);
   200 by (dtac choice 1);
   201 by (Blast_tac 1);
   201 by (Blast_tac 1);
   202 val lemma_skolemize_LIM2 = result();
   202 val lemma_skolemize_LIM2 = result();
   203 
   203 
   204 Goal "ALL n. X n ~= x & \
   204 Goal "ALL n. X n ~= x & \
   205 \         abs (X n + - x) < inverse (real_of_nat(Suc n)) & \
   205 \         abs (X n + - x) < inverse (real(Suc n)) & \
   206 \         r <= abs (f (X n) + - L) ==> \
   206 \         r <= abs (f (X n) + - L) ==> \
   207 \         ALL n. abs (X n + - x) < inverse (real_of_nat(Suc n))";
   207 \         ALL n. abs (X n + - x) < inverse (real(Suc n))";
   208 by (Auto_tac );
   208 by (Auto_tac );
   209 val lemma_simp = result();
   209 val lemma_simp = result();
   210  
   210  
   211 (*-------------------
   211 (*-------------------
   212     NSLIM => LIM
   212     NSLIM => LIM
   213  -------------------*)
   213  -------------------*)
   214 
   214 
   215 Goalw [LIM_def,NSLIM_def,inf_close_def] 
   215 Goalw [LIM_def,NSLIM_def,approx_def] 
   216      "f -- x --NS> L ==> f -- x --> L";
   216      "f -- x --NS> L ==> f -- x --> L";
   217 by (asm_full_simp_tac
   217 by (asm_full_simp_tac
   218     (simpset() addsimps [Infinitesimal_FreeUltrafilterNat_iff]) 1);
   218     (simpset() addsimps [Infinitesimal_FreeUltrafilterNat_iff]) 1);
   219 by (EVERY1[Step_tac, rtac ccontr, Asm_full_simp_tac]);
   219 by (EVERY1[Step_tac, rtac ccontr, Asm_full_simp_tac]);
   220 by (fold_tac [real_le_def]);
   220 by (fold_tac [real_le_def]);
   253  ------------------------------------------------*)
   253  ------------------------------------------------*)
   254 
   254 
   255 Goalw [NSLIM_def]
   255 Goalw [NSLIM_def]
   256      "[| f -- x --NS> l; g -- x --NS> m |] \
   256      "[| f -- x --NS> l; g -- x --NS> m |] \
   257 \     ==> (%x. f(x) * g(x)) -- x --NS> (l * m)";
   257 \     ==> (%x. f(x) * g(x)) -- x --NS> (l * m)";
   258 by (auto_tac (claset() addSIs [inf_close_mult_HFinite],  simpset()));
   258 by (auto_tac (claset() addSIs [approx_mult_HFinite],  simpset()));
   259 qed "NSLIM_mult";
   259 qed "NSLIM_mult";
   260 
   260 
   261 Goal "[| f -- x --> l; g -- x --> m |] \
   261 Goal "[| f -- x --> l; g -- x --> m |] \
   262 \     ==> (%x. f(x) * g(x)) -- x --> (l * m)";
   262 \     ==> (%x. f(x) * g(x)) -- x --> (l * m)";
   263 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_mult]) 1);
   263 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_mult]) 1);
   268       Note the much shorter proof
   268       Note the much shorter proof
   269  ----------------------------------------------*)
   269  ----------------------------------------------*)
   270 Goalw [NSLIM_def]
   270 Goalw [NSLIM_def]
   271      "[| f -- x --NS> l; g -- x --NS> m |] \
   271      "[| f -- x --NS> l; g -- x --NS> m |] \
   272 \     ==> (%x. f(x) + g(x)) -- x --NS> (l + m)";
   272 \     ==> (%x. f(x) + g(x)) -- x --NS> (l + m)";
   273 by (auto_tac (claset() addSIs [inf_close_add], simpset()));
   273 by (auto_tac (claset() addSIs [approx_add], simpset()));
   274 qed "NSLIM_add";
   274 qed "NSLIM_add";
   275 
   275 
   276 Goal "[| f -- x --> l; g -- x --> m |] \
   276 Goal "[| f -- x --> l; g -- x --> m |] \
   277 \     ==> (%x. f(x) + g(x)) -- x --> (l + m)";
   277 \     ==> (%x. f(x) + g(x)) -- x --> (l + m)";
   278 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_add]) 1);
   278 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_add]) 1);
   324      "[| f -- a --NS> L;  L ~= #0 |] \
   324      "[| f -- a --NS> L;  L ~= #0 |] \
   325 \     ==> (%x. inverse(f(x))) -- a --NS> (inverse L)";
   325 \     ==> (%x. inverse(f(x))) -- a --NS> (inverse L)";
   326 by (Clarify_tac 1);
   326 by (Clarify_tac 1);
   327 by (dtac spec 1);
   327 by (dtac spec 1);
   328 by (auto_tac (claset(), 
   328 by (auto_tac (claset(), 
   329               simpset() addsimps [hypreal_of_real_inf_close_inverse]));  
   329               simpset() addsimps [hypreal_of_real_approx_inverse]));  
   330 qed "NSLIM_inverse";
   330 qed "NSLIM_inverse";
   331 
   331 
   332 Goal "[| f -- a --> L; \
   332 Goal "[| f -- a --> L; \
   333 \        L ~= #0 |] ==> (%x. inverse(f(x))) -- a --> (inverse L)";
   333 \        L ~= #0 |] ==> (%x. inverse(f(x))) -- a --> (inverse L)";
   334 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_inverse]) 1);
   334 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_inverse]) 1);
   360 (*--------------------------
   360 (*--------------------------
   361    NSLIM_not_zero
   361    NSLIM_not_zero
   362  --------------------------*)
   362  --------------------------*)
   363 Goalw [NSLIM_def] "k ~= #0 ==> ~ ((%x. k) -- x --NS> #0)";
   363 Goalw [NSLIM_def] "k ~= #0 ==> ~ ((%x. k) -- x --NS> #0)";
   364 by Auto_tac;
   364 by Auto_tac;
   365 by (res_inst_tac [("x","hypreal_of_real x + ehr")] exI 1);
   365 by (res_inst_tac [("x","hypreal_of_real x + epsilon")] exI 1);
   366 by (auto_tac (claset() addIs [Infinitesimal_add_inf_close_self RS inf_close_sym],
   366 by (auto_tac (claset() addIs [Infinitesimal_add_approx_self RS approx_sym],
   367               simpset() addsimps [rename_numerals hypreal_epsilon_not_zero]));
   367               simpset() addsimps [rename_numerals hypreal_epsilon_not_zero]));
   368 qed "NSLIM_not_zero";
   368 qed "NSLIM_not_zero";
   369 
   369 
   370 (* [| k ~= #0; (%x. k) -- x --NS> #0 |] ==> R *)
   370 (* [| k ~= #0; (%x. k) -- x --NS> #0 |] ==> R *)
   371 bind_thm("NSLIM_not_zeroE", NSLIM_not_zero RS notE);
   371 bind_thm("NSLIM_not_zeroE", NSLIM_not_zero RS notE);
   421 
   421 
   422 (*----------------------------
   422 (*----------------------------
   423     NSLIM_self
   423     NSLIM_self
   424  ----------------------------*)
   424  ----------------------------*)
   425 Goalw [NSLIM_def] "(%x. x) -- a --NS> a";
   425 Goalw [NSLIM_def] "(%x. x) -- a --NS> a";
   426 by (auto_tac (claset() addIs [starfun_Idfun_inf_close],simpset()));
   426 by (auto_tac (claset() addIs [starfun_Idfun_approx],simpset()));
   427 qed "NSLIM_self";
   427 qed "NSLIM_self";
   428 
   428 
   429 Goal "(%x. x) -- a --> a";
   429 Goal "(%x. x) -- a --> a";
   430 by (simp_tac (simpset() addsimps [LIM_NSLIM_iff,NSLIM_self]) 1);
   430 by (simp_tac (simpset() addsimps [LIM_NSLIM_iff,NSLIM_self]) 1);
   431 qed "LIM_self2";
   431 qed "LIM_self2";
   505 by (dres_inst_tac [("x","hypreal_of_real a + x")] spec 1);
   505 by (dres_inst_tac [("x","hypreal_of_real a + x")] spec 1);
   506 by (dres_inst_tac [("x","-hypreal_of_real a + x")] spec 2);
   506 by (dres_inst_tac [("x","-hypreal_of_real a + x")] spec 2);
   507 by (Step_tac 1);
   507 by (Step_tac 1);
   508 by (Asm_full_simp_tac 1);
   508 by (Asm_full_simp_tac 1);
   509 by (rtac ((mem_infmal_iff RS iffD2) RS 
   509 by (rtac ((mem_infmal_iff RS iffD2) RS 
   510     (Infinitesimal_add_inf_close_self RS inf_close_sym)) 1);
   510     (Infinitesimal_add_approx_self RS approx_sym)) 1);
   511 by (rtac (inf_close_minus_iff2 RS iffD1) 4);
   511 by (rtac (approx_minus_iff2 RS iffD1) 4);
   512 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 3);
   512 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 3);
   513 by (res_inst_tac [("z","x")] eq_Abs_hypreal 2);
   513 by (res_inst_tac [("z","x")] eq_Abs_hypreal 2);
   514 by (res_inst_tac [("z","x")] eq_Abs_hypreal 4);
   514 by (res_inst_tac [("z","x")] eq_Abs_hypreal 4);
   515 by (auto_tac (claset(),
   515 by (auto_tac (claset(),
   516        simpset() addsimps [starfun, hypreal_of_real_def, hypreal_minus,
   516        simpset() addsimps [starfun, hypreal_of_real_def, hypreal_minus,
   517               hypreal_add, real_add_assoc, inf_close_refl, hypreal_zero_def]));
   517               hypreal_add, real_add_assoc, approx_refl, hypreal_zero_def]));
   518 qed "NSLIM_h_iff";
   518 qed "NSLIM_h_iff";
   519 
   519 
   520 Goal "(f -- a --NS> f a) = ((%h. f(a + h)) -- #0 --NS> f a)";
   520 Goal "(f -- a --NS> f a) = ((%h. f(a + h)) -- #0 --NS> f a)";
   521 by (rtac NSLIM_h_iff 1);
   521 by (rtac NSLIM_h_iff 1);
   522 qed "NSLIM_isCont_iff";
   522 qed "NSLIM_isCont_iff";
   535  --------------------------------------------------------------------------*)
   535  --------------------------------------------------------------------------*)
   536 (*------------------------
   536 (*------------------------
   537      sum continuous
   537      sum continuous
   538  ------------------------*)
   538  ------------------------*)
   539 Goal "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) + g(x)) a";
   539 Goal "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) + g(x)) a";
   540 by (auto_tac (claset() addIs [inf_close_add],
   540 by (auto_tac (claset() addIs [approx_add],
   541               simpset() addsimps [isNSCont_isCont_iff RS sym, isNSCont_def]));
   541               simpset() addsimps [isNSCont_isCont_iff RS sym, isNSCont_def]));
   542 qed "isCont_add";
   542 qed "isCont_add";
   543 
   543 
   544 (*------------------------
   544 (*------------------------
   545      mult continuous
   545      mult continuous
   546  ------------------------*)
   546  ------------------------*)
   547 Goal "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) * g(x)) a";
   547 Goal "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) * g(x)) a";
   548 by (auto_tac (claset() addSIs [starfun_mult_HFinite_inf_close],
   548 by (auto_tac (claset() addSIs [starfun_mult_HFinite_approx],
   549               simpset() delsimps [starfun_mult RS sym]
   549               simpset() delsimps [starfun_mult RS sym]
   550 			addsimps [isNSCont_isCont_iff RS sym, isNSCont_def]));
   550 			addsimps [isNSCont_isCont_iff RS sym, isNSCont_def]));
   551 qed "isCont_mult";
   551 qed "isCont_mult";
   552 
   552 
   553 (*-------------------------------------------
   553 (*-------------------------------------------
   598 by (Simp_tac 1);
   598 by (Simp_tac 1);
   599 qed "isNSCont_const";
   599 qed "isNSCont_const";
   600 Addsimps [isNSCont_const];
   600 Addsimps [isNSCont_const];
   601 
   601 
   602 Goalw [isNSCont_def]  "isNSCont abs a";
   602 Goalw [isNSCont_def]  "isNSCont abs a";
   603 by (auto_tac (claset() addIs [inf_close_hrabs],
   603 by (auto_tac (claset() addIs [approx_hrabs],
   604               simpset() addsimps [hypreal_of_real_hrabs RS sym,
   604               simpset() addsimps [hypreal_of_real_hrabs RS sym,
   605                                   starfun_rabs_hrabs]));
   605                                   starfun_rabs_hrabs]));
   606 qed "isNSCont_rabs";
   606 qed "isNSCont_rabs";
   607 Addsimps [isNSCont_rabs];
   607 Addsimps [isNSCont_rabs];
   608 
   608 
   620   is always an open set
   620   is always an open set
   621  ------------------------------------------------------------*%)
   621  ------------------------------------------------------------*%)
   622 Goal "[| isNSopen A; ALL x. isNSCont f x |] \
   622 Goal "[| isNSopen A; ALL x. isNSCont f x |] \
   623 \              ==> isNSopen {x. f x : A}";
   623 \              ==> isNSopen {x. f x : A}";
   624 by (auto_tac (claset(),simpset() addsimps [isNSopen_iff1]));
   624 by (auto_tac (claset(),simpset() addsimps [isNSopen_iff1]));
   625 by (dtac (mem_monad_inf_close RS inf_close_sym) 1);
   625 by (dtac (mem_monad_approx RS approx_sym) 1);
   626 by (dres_inst_tac [("x","a")] spec 1);
   626 by (dres_inst_tac [("x","a")] spec 1);
   627 by (dtac isNSContD 1 THEN assume_tac 1);
   627 by (dtac isNSContD 1 THEN assume_tac 1);
   628 by (dtac bspec 1 THEN assume_tac 1);
   628 by (dtac bspec 1 THEN assume_tac 1);
   629 by (dres_inst_tac [("x","( *f* f) x")] inf_close_mem_monad2 1);
   629 by (dres_inst_tac [("x","( *f* f) x")] approx_mem_monad2 1);
   630 by (blast_tac (claset() addIs [starfun_mem_starset]) 1);
   630 by (blast_tac (claset() addIs [starfun_mem_starset]) 1);
   631 qed "isNSCont_isNSopen";
   631 qed "isNSCont_isNSopen";
   632 
   632 
   633 Goalw [isNSCont_def]
   633 Goalw [isNSCont_def]
   634           "ALL A. isNSopen A --> isNSopen {x. f x : A} \
   634           "ALL A. isNSopen A --> isNSopen {x. f x : A} \
   635 \              ==> isNSCont f x";
   635 \              ==> isNSCont f x";
   636 by (auto_tac (claset() addSIs [(mem_infmal_iff RS iffD1) RS 
   636 by (auto_tac (claset() addSIs [(mem_infmal_iff RS iffD1) RS 
   637      (inf_close_minus_iff RS iffD2)],simpset() addsimps 
   637      (approx_minus_iff RS iffD2)],simpset() addsimps 
   638       [Infinitesimal_def,SReal_iff]));
   638       [Infinitesimal_def,SReal_iff]));
   639 by (dres_inst_tac [("x","{z. abs(z + -f(x)) < ya}")] spec 1);
   639 by (dres_inst_tac [("x","{z. abs(z + -f(x)) < ya}")] spec 1);
   640 by (etac (isNSopen_open_interval RSN (2,impE)) 1);
   640 by (etac (isNSopen_open_interval RSN (2,impE)) 1);
   641 by (auto_tac (claset(),simpset() addsimps [isNSopen_def,isNSnbhd_def]));
   641 by (auto_tac (claset(),simpset() addsimps [isNSopen_def,isNSnbhd_def]));
   642 by (dres_inst_tac [("x","x")] spec 1);
   642 by (dres_inst_tac [("x","x")] spec 1);
   643 by (auto_tac (claset() addDs [inf_close_sym RS inf_close_mem_monad],
   643 by (auto_tac (claset() addDs [approx_sym RS approx_mem_monad],
   644     simpset() addsimps [hypreal_of_real_zero RS sym,STAR_starfun_rabs_add_minus]));
   644     simpset() addsimps [hypreal_of_real_zero RS sym,STAR_starfun_rabs_add_minus]));
   645 qed "isNSopen_isNSCont";
   645 qed "isNSopen_isNSCont";
   646 
   646 
   647 Goal "(ALL x. isNSCont f x) = \
   647 Goal "(ALL x. isNSCont f x) = \
   648 \     (ALL A. isNSopen A --> isNSopen {x. f(x) : A})";
   648 \     (ALL A. isNSopen A --> isNSopen {x. f(x) : A})";
   670 Goalw [isUCont_def,isCont_def,LIM_def]
   670 Goalw [isUCont_def,isCont_def,LIM_def]
   671      "isUCont f ==> EX x. isCont f x";
   671      "isUCont f ==> EX x. isCont f x";
   672 by (Force_tac 1);
   672 by (Force_tac 1);
   673 qed "isUCont_isCont";
   673 qed "isUCont_isCont";
   674 
   674 
   675 Goalw [isNSUCont_def,isUCont_def,inf_close_def] 
   675 Goalw [isNSUCont_def,isUCont_def,approx_def] 
   676      "isUCont f ==> isNSUCont f";
   676      "isUCont f ==> isNSUCont f";
   677 by (asm_full_simp_tac (simpset() addsimps 
   677 by (asm_full_simp_tac (simpset() addsimps 
   678     [Infinitesimal_FreeUltrafilterNat_iff]) 1);
   678     [Infinitesimal_FreeUltrafilterNat_iff]) 1);
   679 by (Step_tac 1);
   679 by (Step_tac 1);
   680 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
   680 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
   691 by (Ultra_tac 1);
   691 by (Ultra_tac 1);
   692 qed "isUCont_isNSUCont";
   692 qed "isUCont_isNSUCont";
   693 
   693 
   694 Goal "ALL s. #0 < s --> (EX z y. abs (z + - y) < s & r <= abs (f z + -f y)) \
   694 Goal "ALL s. #0 < s --> (EX z y. abs (z + - y) < s & r <= abs (f z + -f y)) \
   695 \     ==> ALL n::nat. EX z y.  \
   695 \     ==> ALL n::nat. EX z y.  \
   696 \              abs(z + -y) < inverse(real_of_nat(Suc n)) & \
   696 \              abs(z + -y) < inverse(real(Suc n)) & \
   697 \              r <= abs(f z + -f y)";
   697 \              r <= abs(f z + -f y)";
   698 by (Clarify_tac 1); 
   698 by (Clarify_tac 1); 
   699 by (cut_inst_tac [("n1","n")]
   699 by (cut_inst_tac [("n1","n")]
   700     (real_of_nat_Suc_gt_zero RS rename_numerals real_inverse_gt_zero) 1);
   700     (real_of_nat_Suc_gt_zero RS rename_numerals real_inverse_gt_zero) 1);
   701 by Auto_tac;
   701 by Auto_tac;
   702 val lemma_LIMu = result();
   702 val lemma_LIMu = result();
   703 
   703 
   704 Goal "ALL s. #0 < s --> (EX z y. abs (z + - y) < s  & r <= abs (f z + -f y)) \
   704 Goal "ALL s. #0 < s --> (EX z y. abs (z + - y) < s  & r <= abs (f z + -f y)) \
   705 \     ==> EX X Y. ALL n::nat. \
   705 \     ==> EX X Y. ALL n::nat. \
   706 \              abs(X n + -(Y n)) < inverse(real_of_nat(Suc n)) & \
   706 \              abs(X n + -(Y n)) < inverse(real(Suc n)) & \
   707 \              r <= abs(f (X n) + -f (Y n))";
   707 \              r <= abs(f (X n) + -f (Y n))";
   708 by (dtac lemma_LIMu 1);
   708 by (dtac lemma_LIMu 1);
   709 by (dtac choice 1);
   709 by (dtac choice 1);
   710 by (Step_tac 1);
   710 by (Step_tac 1);
   711 by (dtac choice 1);
   711 by (dtac choice 1);
   712 by (Blast_tac 1);
   712 by (Blast_tac 1);
   713 val lemma_skolemize_LIM2u = result();
   713 val lemma_skolemize_LIM2u = result();
   714 
   714 
   715 Goal "ALL n. abs (X n + -Y n) < inverse (real_of_nat(Suc n)) & \
   715 Goal "ALL n. abs (X n + -Y n) < inverse (real(Suc n)) & \
   716 \         r <= abs (f (X n) + - f(Y n)) ==> \
   716 \         r <= abs (f (X n) + - f(Y n)) ==> \
   717 \         ALL n. abs (X n + - Y n) < inverse (real_of_nat(Suc n))";
   717 \         ALL n. abs (X n + - Y n) < inverse (real(Suc n))";
   718 by (Auto_tac );
   718 by (Auto_tac );
   719 val lemma_simpu = result();
   719 val lemma_simpu = result();
   720 
   720 
   721 Goalw [isNSUCont_def,isUCont_def,inf_close_def] 
   721 Goalw [isNSUCont_def,isUCont_def,approx_def] 
   722      "isNSUCont f ==> isUCont f";
   722      "isNSUCont f ==> isUCont f";
   723 by (asm_full_simp_tac (simpset() addsimps 
   723 by (asm_full_simp_tac (simpset() addsimps 
   724                        [Infinitesimal_FreeUltrafilterNat_iff]) 1);
   724                        [Infinitesimal_FreeUltrafilterNat_iff]) 1);
   725 by (EVERY1[Step_tac, rtac ccontr, Asm_full_simp_tac]);
   725 by (EVERY1[Step_tac, rtac ccontr, Asm_full_simp_tac]);
   726 by (fold_tac [real_le_def]);
   726 by (fold_tac [real_le_def]);
   773 qed "DERIV_unique";
   773 qed "DERIV_unique";
   774 
   774 
   775 Goalw [nsderiv_def] 
   775 Goalw [nsderiv_def] 
   776      "[| NSDERIV f x :> D; NSDERIV f x :> E |] ==> D = E";
   776      "[| NSDERIV f x :> D; NSDERIV f x :> E |] ==> D = E";
   777 by (cut_facts_tac [Infinitesimal_epsilon, hypreal_epsilon_not_zero] 1);
   777 by (cut_facts_tac [Infinitesimal_epsilon, hypreal_epsilon_not_zero] 1);
   778 by (auto_tac (claset() addSDs [inst "x" "ehr" bspec] 
   778 by (auto_tac (claset() addSDs [inst "x" "epsilon" bspec] 
   779                        addSIs [inj_hypreal_of_real RS injD] 
   779                        addSIs [inj_hypreal_of_real RS injD] 
   780                        addDs [inf_close_trans3],
   780                        addDs [approx_trans3],
   781               simpset()));
   781               simpset()));
   782 qed "NSDeriv_unique";
   782 qed "NSDeriv_unique";
   783 
   783 
   784 (*------------------------------------------------------------------------
   784 (*------------------------------------------------------------------------
   785                           Differentiable
   785                           Differentiable
   872 by (auto_tac (claset(), 
   872 by (auto_tac (claset(), 
   873               simpset() addsimps [hypreal_diff_def, hypreal_of_real_zero]));
   873               simpset() addsimps [hypreal_diff_def, hypreal_of_real_zero]));
   874 by (dres_inst_tac [("x","u")] spec 1);
   874 by (dres_inst_tac [("x","u")] spec 1);
   875 by Auto_tac;
   875 by Auto_tac;
   876 by (dres_inst_tac [("c","u - hypreal_of_real x"),("b","hypreal_of_real D")]
   876 by (dres_inst_tac [("c","u - hypreal_of_real x"),("b","hypreal_of_real D")]
   877      inf_close_mult1 1);
   877      approx_mult1 1);
   878 by (ALLGOALS(dtac (hypreal_not_eq_minus_iff RS iffD1)));
   878 by (ALLGOALS(dtac (hypreal_not_eq_minus_iff RS iffD1)));
   879 by (subgoal_tac "(*f* (%z. z - x)) u ~= (0::hypreal)" 2);
   879 by (subgoal_tac "(*f* (%z. z - x)) u ~= (0::hypreal)" 2);
   880 by (rotate_tac ~1 2);
   880 by (rotate_tac ~1 2);
   881 by (auto_tac (claset(),
   881 by (auto_tac (claset(),
   882     simpset() addsimps [real_diff_def, hypreal_diff_def, 
   882     simpset() addsimps [real_diff_def, hypreal_diff_def, 
   883 		(inf_close_minus_iff RS iffD1) RS (mem_infmal_iff RS iffD2),  
   883 		(approx_minus_iff RS iffD1) RS (mem_infmal_iff RS iffD2),  
   884 			Infinitesimal_subset_HFinite RS subsetD]));
   884 			Infinitesimal_subset_HFinite RS subsetD]));
   885 qed "NSDERIVD5";
   885 qed "NSDERIVD5";
   886 
   886 
   887 Goal "(NSDERIV f x :> D) ==> \
   887 Goal "(NSDERIV f x :> D) ==> \
   888 \     (ALL h: Infinitesimal. \
   888 \     (ALL h: Infinitesimal. \
   890 \                hypreal_of_real (f x))@= (hypreal_of_real D) * h)";
   890 \                hypreal_of_real (f x))@= (hypreal_of_real D) * h)";
   891 by (auto_tac (claset(),simpset() addsimps [nsderiv_def]));
   891 by (auto_tac (claset(),simpset() addsimps [nsderiv_def]));
   892 by (case_tac "h = (0::hypreal)" 1);
   892 by (case_tac "h = (0::hypreal)" 1);
   893 by (auto_tac (claset(),simpset() addsimps [hypreal_diff_def]));
   893 by (auto_tac (claset(),simpset() addsimps [hypreal_diff_def]));
   894 by (dres_inst_tac [("x","h")] bspec 1);
   894 by (dres_inst_tac [("x","h")] bspec 1);
   895 by (dres_inst_tac [("c","h")] inf_close_mult1 2);
   895 by (dres_inst_tac [("c","h")] approx_mult1 2);
   896 by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
   896 by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
   897               simpset() addsimps [hypreal_diff_def]));
   897               simpset() addsimps [hypreal_diff_def]));
   898 qed "NSDERIVD4";
   898 qed "NSDERIVD4";
   899 
   899 
   900 Goal "(NSDERIV f x :> D) ==> \
   900 Goal "(NSDERIV f x :> D) ==> \
   901 \     (ALL h: Infinitesimal - {0}. \
   901 \     (ALL h: Infinitesimal - {0}. \
   902 \              ((*f* f)(hypreal_of_real x + h) - \
   902 \              ((*f* f)(hypreal_of_real x + h) - \
   903 \                hypreal_of_real (f x))@= (hypreal_of_real D) * h)";
   903 \                hypreal_of_real (f x))@= (hypreal_of_real D) * h)";
   904 by (auto_tac (claset(),simpset() addsimps [nsderiv_def]));
   904 by (auto_tac (claset(),simpset() addsimps [nsderiv_def]));
   905 by (rtac ccontr 1 THEN dres_inst_tac [("x","h")] bspec 1);
   905 by (rtac ccontr 1 THEN dres_inst_tac [("x","h")] bspec 1);
   906 by (dres_inst_tac [("c","h")] inf_close_mult1 2);
   906 by (dres_inst_tac [("c","h")] approx_mult1 2);
   907 by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
   907 by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
   908               simpset() addsimps [hypreal_mult_assoc, hypreal_diff_def]));
   908               simpset() addsimps [hypreal_mult_assoc, hypreal_diff_def]));
   909 qed "NSDERIVD3";
   909 qed "NSDERIVD3";
   910 
   910 
   911 (*--------------------------------------------------------------
   911 (*--------------------------------------------------------------
   921  --------------------------------------------------*)
   921  --------------------------------------------------*)
   922 Goalw [nsderiv_def]
   922 Goalw [nsderiv_def]
   923       "NSDERIV f x :> D ==> isNSCont f x";
   923       "NSDERIV f x :> D ==> isNSCont f x";
   924 by (auto_tac (claset(),simpset() addsimps 
   924 by (auto_tac (claset(),simpset() addsimps 
   925         [isNSCont_NSLIM_iff,NSLIM_def]));
   925         [isNSCont_NSLIM_iff,NSLIM_def]));
   926 by (dtac (inf_close_minus_iff RS iffD1) 1);
   926 by (dtac (approx_minus_iff RS iffD1) 1);
   927 by (dtac (hypreal_not_eq_minus_iff RS iffD1) 1);
   927 by (dtac (hypreal_not_eq_minus_iff RS iffD1) 1);
   928 by (dres_inst_tac [("x","-hypreal_of_real x + xa")] bspec 1);
   928 by (dres_inst_tac [("x","-hypreal_of_real x + xa")] bspec 1);
   929 by (asm_full_simp_tac (simpset() addsimps 
   929 by (asm_full_simp_tac (simpset() addsimps 
   930     [hypreal_add_assoc RS sym]) 2);
   930     [hypreal_add_assoc RS sym]) 2);
   931 by (auto_tac (claset(),simpset() addsimps 
   931 by (auto_tac (claset(),simpset() addsimps 
   932     [mem_infmal_iff RS sym,hypreal_add_commute]));
   932     [mem_infmal_iff RS sym,hypreal_add_commute]));
   933 by (dres_inst_tac [("c","xa + -hypreal_of_real x")] inf_close_mult1 1);
   933 by (dres_inst_tac [("c","xa + -hypreal_of_real x")] approx_mult1 1);
   934 by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite
   934 by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite
   935     RS subsetD],simpset() addsimps [hypreal_mult_assoc]));
   935     RS subsetD],simpset() addsimps [hypreal_mult_assoc]));
   936 by (dres_inst_tac [("x3","D")] (HFinite_hypreal_of_real RSN
   936 by (dres_inst_tac [("x3","D")] (HFinite_hypreal_of_real RSN
   937     (2,Infinitesimal_HFinite_mult) RS (mem_infmal_iff RS iffD1)) 1);
   937     (2,Infinitesimal_HFinite_mult) RS (mem_infmal_iff RS iffD1)) 1);
   938 by (blast_tac (claset() addIs [inf_close_trans,
   938 by (blast_tac (claset() addIs [approx_trans,
   939     hypreal_mult_commute RS subst,
   939     hypreal_mult_commute RS subst,
   940     (inf_close_minus_iff RS iffD2)]) 1);
   940     (approx_minus_iff RS iffD2)]) 1);
   941 qed "NSDERIV_isNSCont";
   941 qed "NSDERIV_isNSCont";
   942 
   942 
   943 (* Now Sandard proof *)
   943 (* Now Sandard proof *)
   944 Goal "DERIV f x :> D ==> isCont f x";
   944 Goal "DERIV f x :> D ==> isCont f x";
   945 by (asm_full_simp_tac (simpset() addsimps 
   945 by (asm_full_simp_tac (simpset() addsimps 
   977 by (asm_full_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
   977 by (asm_full_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
   978            NSLIM_def]) 1 THEN REPEAT(Step_tac 1));
   978            NSLIM_def]) 1 THEN REPEAT(Step_tac 1));
   979 by (auto_tac (claset(),
   979 by (auto_tac (claset(),
   980        simpset() addsimps [hypreal_add_divide_distrib]));
   980        simpset() addsimps [hypreal_add_divide_distrib]));
   981 by (dres_inst_tac [("b","hypreal_of_real Da"),
   981 by (dres_inst_tac [("b","hypreal_of_real Da"),
   982                    ("d","hypreal_of_real Db")] inf_close_add 1);
   982                    ("d","hypreal_of_real Db")] approx_add 1);
   983 by (auto_tac (claset(), simpset() addsimps hypreal_add_ac));
   983 by (auto_tac (claset(), simpset() addsimps hypreal_add_ac));
   984 qed "NSDERIV_add";
   984 qed "NSDERIV_add";
   985 
   985 
   986 (* Standard theorem *)
   986 (* Standard theorem *)
   987 Goal "[| DERIV f x :> Da; DERIV g x :> Db |] \
   987 Goal "[| DERIV f x :> Da; DERIV g x :> Db |] \
  1022 by (REPEAT(dtac (bex_Infinitesimal_iff2 RS iffD2) 1));
  1022 by (REPEAT(dtac (bex_Infinitesimal_iff2 RS iffD2) 1));
  1023 by (auto_tac (claset(),
  1023 by (auto_tac (claset(),
  1024         simpset() delsimps [hypreal_times_divide1_eq]
  1024         simpset() delsimps [hypreal_times_divide1_eq]
  1025 		  addsimps [hypreal_times_divide1_eq RS sym]));
  1025 		  addsimps [hypreal_times_divide1_eq RS sym]));
  1026 by (dres_inst_tac [("D","Db")] lemma_nsderiv2 1);
  1026 by (dres_inst_tac [("D","Db")] lemma_nsderiv2 1);
  1027 by (dtac (inf_close_minus_iff RS iffD2 RS (bex_Infinitesimal_iff2 RS iffD2)) 4);
  1027 by (dtac (approx_minus_iff RS iffD2 RS (bex_Infinitesimal_iff2 RS iffD2)) 4);
  1028 by (auto_tac (claset() addSIs [inf_close_add_mono1],
  1028 by (auto_tac (claset() addSIs [approx_add_mono1],
  1029       simpset() addsimps [hypreal_add_mult_distrib, hypreal_add_mult_distrib2, 
  1029       simpset() addsimps [hypreal_add_mult_distrib, hypreal_add_mult_distrib2, 
  1030 			  hypreal_mult_commute, hypreal_add_assoc]));
  1030 			  hypreal_mult_commute, hypreal_add_assoc]));
  1031 by (res_inst_tac [("w1","hypreal_of_real Db * hypreal_of_real (f x)")]
  1031 by (res_inst_tac [("w1","hypreal_of_real Db * hypreal_of_real (f x)")]
  1032     (hypreal_add_commute RS subst) 1);
  1032     (hypreal_add_commute RS subst) 1);
  1033 by (auto_tac (claset() addSIs [Infinitesimal_add_inf_close_self2 RS inf_close_sym,
  1033 by (auto_tac (claset() addSIs [Infinitesimal_add_approx_self2 RS approx_sym,
  1034 			       Infinitesimal_add, Infinitesimal_mult,
  1034 			       Infinitesimal_add, Infinitesimal_mult,
  1035 			       Infinitesimal_hypreal_of_real_mult,
  1035 			       Infinitesimal_hypreal_of_real_mult,
  1036 			       Infinitesimal_hypreal_of_real_mult2],
  1036 			       Infinitesimal_hypreal_of_real_mult2],
  1037 	      simpset() addsimps [hypreal_add_assoc RS sym]));
  1037 	      simpset() addsimps [hypreal_add_assoc RS sym]));
  1038 qed "NSDERIV_mult";
  1038 qed "NSDERIV_mult";
  1155 \     ==> increment f x h @= #0";
  1155 \     ==> increment f x h @= #0";
  1156 by (dtac increment_thm2 1 THEN auto_tac (claset() addSIs 
  1156 by (dtac increment_thm2 1 THEN auto_tac (claset() addSIs 
  1157     [Infinitesimal_HFinite_mult2,HFinite_add],simpset() addsimps 
  1157     [Infinitesimal_HFinite_mult2,HFinite_add],simpset() addsimps 
  1158     [hypreal_add_mult_distrib RS sym,mem_infmal_iff RS sym]));
  1158     [hypreal_add_mult_distrib RS sym,mem_infmal_iff RS sym]));
  1159 by (etac (Infinitesimal_subset_HFinite RS subsetD) 1);
  1159 by (etac (Infinitesimal_subset_HFinite RS subsetD) 1);
  1160 qed "increment_inf_close_zero";
  1160 qed "increment_approx_zero";
  1161 
  1161 
  1162 (*---------------------------------------------------------------
  1162 (*---------------------------------------------------------------
  1163    Similarly to the above, the chain rule admits an entirely
  1163    Similarly to the above, the chain rule admits an entirely
  1164    straightforward derivation. Compare this with Harrison's
  1164    straightforward derivation. Compare this with Harrison's
  1165    HOL proof of the chain rule, which proved to be trickier and
  1165    HOL proof of the chain rule, which proved to be trickier and
  1184      "[| NSDERIV f x :> D;  h: Infinitesimal;  h ~= #0 |]  \
  1184      "[| NSDERIV f x :> D;  h: Infinitesimal;  h ~= #0 |]  \
  1185 \     ==> (*f* f) (hypreal_of_real(x) + h) + -hypreal_of_real(f x) @= #0";    
  1185 \     ==> (*f* f) (hypreal_of_real(x) + h) + -hypreal_of_real(f x) @= #0";    
  1186 by (asm_full_simp_tac (simpset() addsimps 
  1186 by (asm_full_simp_tac (simpset() addsimps 
  1187     [mem_infmal_iff RS sym]) 1);
  1187     [mem_infmal_iff RS sym]) 1);
  1188 by (rtac Infinitesimal_ratio 1);
  1188 by (rtac Infinitesimal_ratio 1);
  1189 by (rtac inf_close_hypreal_of_real_HFinite 3);
  1189 by (rtac approx_hypreal_of_real_HFinite 3);
  1190 by Auto_tac;
  1190 by Auto_tac;
  1191 qed "NSDERIV_inf_close";
  1191 qed "NSDERIV_approx";
  1192 
  1192 
  1193 (*--------------------------------------------------------------- 
  1193 (*--------------------------------------------------------------- 
  1194    from one version of differentiability 
  1194    from one version of differentiability 
  1195  
  1195  
  1196                 f(x) - f(a)
  1196                 f(x) - f(a)
  1232  ------------------------------------------------------*)
  1232  ------------------------------------------------------*)
  1233 Goal "[| NSDERIV f (g x) :> Da; NSDERIV g x :> Db |] \
  1233 Goal "[| NSDERIV f (g x) :> Da; NSDERIV g x :> Db |] \
  1234 \     ==> NSDERIV (f o g) x :> Da * Db";
  1234 \     ==> NSDERIV (f o g) x :> Da * Db";
  1235 by (asm_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
  1235 by (asm_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
  1236     NSLIM_def,hypreal_of_real_zero,mem_infmal_iff RS sym]) 1 THEN Step_tac 1);
  1236     NSLIM_def,hypreal_of_real_zero,mem_infmal_iff RS sym]) 1 THEN Step_tac 1);
  1237 by (forw_inst_tac [("f","g")] NSDERIV_inf_close 1);
  1237 by (forw_inst_tac [("f","g")] NSDERIV_approx 1);
  1238 by (auto_tac (claset(),
  1238 by (auto_tac (claset(),
  1239               simpset() addsimps [starfun_lambda_cancel2, starfun_o RS sym]));
  1239               simpset() addsimps [starfun_lambda_cancel2, starfun_o RS sym]));
  1240 by (case_tac "(*f* g) (hypreal_of_real(x) + xa) = hypreal_of_real (g x)" 1);
  1240 by (case_tac "(*f* g) (hypreal_of_real(x) + xa) = hypreal_of_real (g x)" 1);
  1241 by (dres_inst_tac [("g","g")] NSDERIV_zero 1);
  1241 by (dres_inst_tac [("g","g")] NSDERIV_zero 1);
  1242 by (auto_tac (claset(),
  1242 by (auto_tac (claset(),
  1243     simpset() addsimps [hypreal_divide_def, hypreal_of_real_zero]));
  1243     simpset() addsimps [hypreal_divide_def, hypreal_of_real_zero]));
  1244 by (res_inst_tac [("z1","(*f* g) (hypreal_of_real(x) + xa) + -hypreal_of_real (g x)"),
  1244 by (res_inst_tac [("z1","(*f* g) (hypreal_of_real(x) + xa) + -hypreal_of_real (g x)"),
  1245     ("y1","inverse xa")] (lemma_chain RS ssubst) 1);
  1245     ("y1","inverse xa")] (lemma_chain RS ssubst) 1);
  1246 by (etac (hypreal_not_eq_minus_iff RS iffD1) 1);
  1246 by (etac (hypreal_not_eq_minus_iff RS iffD1) 1);
  1247 by (rtac inf_close_mult_hypreal_of_real 1);
  1247 by (rtac approx_mult_hypreal_of_real 1);
  1248 by (fold_tac [hypreal_divide_def]);
  1248 by (fold_tac [hypreal_divide_def]);
  1249 by (blast_tac (claset() addIs [NSDERIVD1,
  1249 by (blast_tac (claset() addIs [NSDERIVD1,
  1250     inf_close_minus_iff RS iffD2]) 1);
  1250     approx_minus_iff RS iffD2]) 1);
  1251 by (blast_tac (claset() addIs [NSDERIVD2]) 1);
  1251 by (blast_tac (claset() addIs [NSDERIVD2]) 1);
  1252 qed "NSDERIV_chain";
  1252 qed "NSDERIV_chain";
  1253 
  1253 
  1254 (* standard version *)
  1254 (* standard version *)
  1255 Goal "[| DERIV f (g x) :> Da; \
  1255 Goal "[| DERIV f (g x) :> Da; \
  1293 Goal "NSDERIV (op * c) x :> c";
  1293 Goal "NSDERIV (op * c) x :> c";
  1294 by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff]) 1);
  1294 by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff]) 1);
  1295 qed "NSDERIV_cmult_Id";
  1295 qed "NSDERIV_cmult_Id";
  1296 Addsimps [NSDERIV_cmult_Id];
  1296 Addsimps [NSDERIV_cmult_Id];
  1297 
  1297 
  1298 Goal "DERIV (%x. x ^ n) x :> real_of_nat n * (x ^ (n - 1))";
  1298 Goal "DERIV (%x. x ^ n) x :> real n * (x ^ (n - 1))";
  1299 by (induct_tac "n" 1);
  1299 by (induct_tac "n" 1);
  1300 by (dtac (DERIV_Id RS DERIV_mult) 2);
  1300 by (dtac (DERIV_Id RS DERIV_mult) 2);
  1301 by (auto_tac (claset(), 
  1301 by (auto_tac (claset(), 
  1302               simpset() addsimps [real_of_nat_Suc, real_add_mult_distrib]));
  1302               simpset() addsimps [real_of_nat_Suc, real_add_mult_distrib]));
  1303 by (case_tac "0 < n" 1);
  1303 by (case_tac "0 < n" 1);
  1305 by (auto_tac (claset(), 
  1305 by (auto_tac (claset(), 
  1306               simpset() addsimps [real_mult_assoc, real_add_commute]));
  1306               simpset() addsimps [real_mult_assoc, real_add_commute]));
  1307 qed "DERIV_pow";
  1307 qed "DERIV_pow";
  1308 
  1308 
  1309 (* NS version *)
  1309 (* NS version *)
  1310 Goal "NSDERIV (%x. x ^ n) x :> real_of_nat n * (x ^ (n - 1))";
  1310 Goal "NSDERIV (%x. x ^ n) x :> real n * (x ^ (n - 1))";
  1311 by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff, DERIV_pow]) 1);
  1311 by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff, DERIV_pow]) 1);
  1312 qed "NSDERIV_pow";
  1312 qed "NSDERIV_pow";
  1313 
  1313 
  1314 (*---------------------------------------------------------------
  1314 (*---------------------------------------------------------------
  1315                     Power of -1 
  1315                     Power of -1 
  1334 by (asm_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym,
  1334 by (asm_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym,
  1335                                       hypreal_add_mult_distrib2] 
  1335                                       hypreal_add_mult_distrib2] 
  1336          delsimps [hypreal_minus_mult_eq1 RS sym, 
  1336          delsimps [hypreal_minus_mult_eq1 RS sym, 
  1337                    hypreal_minus_mult_eq2 RS sym]) 1);
  1337                    hypreal_minus_mult_eq2 RS sym]) 1);
  1338 by (res_inst_tac [("y"," inverse(- hypreal_of_real x * hypreal_of_real x)")] 
  1338 by (res_inst_tac [("y"," inverse(- hypreal_of_real x * hypreal_of_real x)")] 
  1339                  inf_close_trans 1);
  1339                  approx_trans 1);
  1340 by (rtac inverse_add_Infinitesimal_inf_close2 1);
  1340 by (rtac inverse_add_Infinitesimal_approx2 1);
  1341 by (auto_tac (claset() addSDs [hypreal_of_real_HFinite_diff_Infinitesimal], 
  1341 by (auto_tac (claset() addSDs [hypreal_of_real_HFinite_diff_Infinitesimal], 
  1342          simpset() addsimps [hypreal_minus_inverse RS sym,
  1342          simpset() addsimps [hypreal_minus_inverse RS sym,
  1343                              HFinite_minus_iff]));
  1343                              HFinite_minus_iff]));
  1344 by (rtac Infinitesimal_HFinite_mult2 1); 
  1344 by (rtac Infinitesimal_HFinite_mult2 1); 
  1345 by Auto_tac;  
  1345 by Auto_tac;  
  1706 
  1706 
  1707 (*---------------------------------------------------------------------------*)
  1707 (*---------------------------------------------------------------------------*)
  1708 (* By bisection, function continuous on closed interval is bounded above     *)
  1708 (* By bisection, function continuous on closed interval is bounded above     *)
  1709 (*---------------------------------------------------------------------------*)
  1709 (*---------------------------------------------------------------------------*)
  1710 
  1710 
  1711 Goal "abs (real_of_nat x) = real_of_nat x";
  1711 Goal "abs (real x) = real (x::nat)";
  1712 by (auto_tac (claset() addIs [abs_eqI1],simpset()));
  1712 by (auto_tac (claset() addIs [abs_eqI1], simpset()));
  1713 qed "abs_real_of_nat_cancel";
  1713 qed "abs_real_of_nat_cancel";
  1714 Addsimps [abs_real_of_nat_cancel];
  1714 Addsimps [abs_real_of_nat_cancel];
  1715 
  1715 
  1716 Goal "~ abs(x) + 1r < x";
  1716 Goal "~ abs(x) + 1r < x";
  1717 by (rtac real_leD 1);
  1717 by (rtac real_leD 1);