src/HOL/Complex/CLim.ML
changeset 14335 9c0b5e081037
parent 14334 6137d24eef79
child 14348 744c868ee0b7
equal deleted inserted replaced
14334:6137d24eef79 14335:9c0b5e081037
     3     Copyright   : 2001 University of Edinburgh
     3     Copyright   : 2001 University of Edinburgh
     4     Description : A first theory of limits, continuity and 
     4     Description : A first theory of limits, continuity and 
     5                   differentiation for complex functions
     5                   differentiation for complex functions
     6 *)
     6 *)
     7 
     7 
     8 (*------------------------------------------------------------------------------------*)
     8 (*-----------------------------------------------------------------------*)
     9 (* Limit of complex to complex function                                               *)
     9 (* Limit of complex to complex function                                               *)
    10 (*------------------------------------------------------------------------------------*)
    10 (*-----------------------------------------------------------------------*)
    11 
    11 
    12 Goalw [NSCLIM_def,NSCRLIM_def] 
    12 Goalw [NSCLIM_def,NSCRLIM_def] 
    13    "f -- a --NSC> L ==> (%x. Re(f x)) -- a --NSCR> Re(L)";
    13    "f -- a --NSC> L ==> (%x. Re(f x)) -- a --NSCR> Re(L)";
    14 by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1);
    14 by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1);
    15 by (auto_tac (claset(),simpset() addsimps [starfunC_approx_Re_Im_iff,
    15 by (auto_tac (claset(),simpset() addsimps [starfunC_approx_Re_Im_iff,
   104 
   104 
   105 Goal "(f -- x --C> L) = (f -- x --NSC> L)";
   105 Goal "(f -- x --C> L) = (f -- x --NSC> L)";
   106 by (blast_tac (claset() addIs [CLIM_NSCLIM,NSCLIM_CLIM]) 1);
   106 by (blast_tac (claset() addIs [CLIM_NSCLIM,NSCLIM_CLIM]) 1);
   107 qed "CLIM_NSCLIM_iff";
   107 qed "CLIM_NSCLIM_iff";
   108 
   108 
   109 (*------------------------------------------------------------------------------------*)
   109 (*-----------------------------------------------------------------------*)
   110 (* Limit of complex to real function                                                  *)
   110 (* Limit of complex to real function                                                  *)
   111 (*------------------------------------------------------------------------------------*)
   111 (*-----------------------------------------------------------------------*)
   112 
   112 
   113 Goalw [CRLIM_def,NSCRLIM_def,capprox_def] 
   113 Goalw [CRLIM_def,NSCRLIM_def,capprox_def] 
   114       "f -- x --CR> L ==> f -- x --NSCR> L";
   114       "f -- x --CR> L ==> f -- x --NSCR> L";
   115 by Auto_tac;
   115 by Auto_tac;
   116 by (res_inst_tac [("z","xa")] eq_Abs_hcomplex 1);
   116 by (res_inst_tac [("z","xa")] eq_Abs_hcomplex 1);
   407 by (auto_tac (claset(),simpset() addsimps [CLIM_NSCLIM_iff,CRLIM_NSCRLIM_iff,
   407 by (auto_tac (claset(),simpset() addsimps [CLIM_NSCLIM_iff,CRLIM_NSCRLIM_iff,
   408     NSCLIM_NSCRLIM_Re_Im_iff]));
   408     NSCLIM_NSCRLIM_Re_Im_iff]));
   409 qed "CLIM_CRLIM_Re_Im_iff";
   409 qed "CLIM_CRLIM_Re_Im_iff";
   410 
   410 
   411 
   411 
   412 (*------------------------------------------------------------------------------------*)
   412 (*-----------------------------------------------------------------------*)
   413 (* Continuity                                                                         *)
   413 (* Continuity                                                                         *)
   414 (*------------------------------------------------------------------------------------*)
   414 (*-----------------------------------------------------------------------*)
   415 
   415 
   416 Goalw [isNSContc_def] 
   416 Goalw [isNSContc_def] 
   417       "[| isNSContc f a; y @c= hcomplex_of_complex a |] \
   417       "[| isNSContc f a; y @c= hcomplex_of_complex a |] \
   418 \           ==> ( *fc* f) y @c= hcomplex_of_complex (f a)";
   418 \           ==> ( *fc* f) y @c= hcomplex_of_complex (f a)";
   419 by (Blast_tac 1);
   419 by (Blast_tac 1);
   550 by (Simp_tac 1);
   550 by (Simp_tac 1);
   551 qed "isNSContc_const";
   551 qed "isNSContc_const";
   552 Addsimps [isNSContc_const];
   552 Addsimps [isNSContc_const];
   553 
   553 
   554 
   554 
   555 (*------------------------------------------------------------------------------------*)
   555 (*-----------------------------------------------------------------------*)
   556 (* functions from complex to reals                                                    *)
   556 (* functions from complex to reals                                                    *)
   557 (* -----------------------------------------------------------------------------------*)
   557 (* ----------------------------------------------------------------------*)
   558 
   558 
   559 Goalw [isNSContCR_def] 
   559 Goalw [isNSContCR_def] 
   560       "[| isNSContCR f a; y @c= hcomplex_of_complex a |] \
   560       "[| isNSContCR f a; y @c= hcomplex_of_complex a |] \
   561 \           ==> ( *fcR* f) y @= hypreal_of_real (f a)";
   561 \           ==> ( *fcR* f) y @= hypreal_of_real (f a)";
   562 by (Blast_tac 1);
   562 by (Blast_tac 1);
   617 Goalw [isContc_def,isContCR_def] 
   617 Goalw [isContc_def,isContCR_def] 
   618   "isContc f a ==> isContCR (%x. Im (f x)) a";
   618   "isContc f a ==> isContCR (%x. Im (f x)) a";
   619 by (etac CLIM_CRLIM_Im 1);
   619 by (etac CLIM_CRLIM_Im 1);
   620 qed "isContc_isContCR_Im"; 
   620 qed "isContc_isContCR_Im"; 
   621 
   621 
   622 (*------------------------------------------------------------------------------------*)
   622 (*-----------------------------------------------------------------------*)
   623 (* Derivatives                                                                        *)
   623 (* Derivatives                                                                        *)
   624 (*------------------------------------------------------------------------------------*)
   624 (*-----------------------------------------------------------------------*)
   625 
   625 
   626 Goalw [cderiv_def] 
   626 Goalw [cderiv_def] 
   627       "(CDERIV f x :> D) = ((%h. (f(x + h) - f(x))/h) -- 0 --C> D)";
   627       "(CDERIV f x :> D) = ((%h. (f(x + h) - f(x))/h) -- 0 --C> D)";
   628 by (Blast_tac 1);        
   628 by (Blast_tac 1);        
   629 qed "CDERIV_iff";
   629 qed "CDERIV_iff";
   659                        addDs [capprox_trans3],
   659                        addDs [capprox_trans3],
   660               simpset()));
   660               simpset()));
   661 qed "NSCDeriv_unique";
   661 qed "NSCDeriv_unique";
   662 
   662 
   663 
   663 
   664 (*------------------------------------------------------------------------------------*)
   664 (*-----------------------------------------------------------------------*)
   665 (* Differentiability                                                                  *)
   665 (* Differentiability                                                                  *)
   666 (*------------------------------------------------------------------------------------*)
   666 (*-----------------------------------------------------------------------*)
   667 
   667 
   668 Goalw [cdifferentiable_def] 
   668 Goalw [cdifferentiable_def] 
   669       "f cdifferentiable x ==> EX D. CDERIV f x :> D";
   669       "f cdifferentiable x ==> EX D. CDERIV f x :> D";
   670 by (assume_tac 1);
   670 by (assume_tac 1);
   671 qed "cdifferentiableD";
   671 qed "cdifferentiableD";
   684       "NSCDERIV f x :> D ==> f NSCdifferentiable x";
   684       "NSCDERIV f x :> D ==> f NSCdifferentiable x";
   685 by (Blast_tac 1);
   685 by (Blast_tac 1);
   686 qed "NSCdifferentiableI";
   686 qed "NSCdifferentiableI";
   687 
   687 
   688 
   688 
   689 (*------------------------------------------------------------------------------------*)
   689 (*-----------------------------------------------------------------------*)
   690 (* Alternative definition for differentiability                                       *)
   690 (* Alternative definition for differentiability                                       *)
   691 (*------------------------------------------------------------------------------------*)
   691 (*-----------------------------------------------------------------------*)
   692 
   692 
   693 Goalw [CLIM_def] 
   693 Goalw [CLIM_def] 
   694  "((%h. (f(a + h) - f(a))/h) -- 0 --C> D) = \
   694  "((%h. (f(a + h) - f(a))/h) -- 0 --C> D) = \
   695 \ ((%x. (f(x) - f(a)) / (x - a)) -- a --C> D)";
   695 \ ((%x. (f(x) - f(a)) / (x - a)) -- a --C> D)";
   696 by (Step_tac 1);
   696 by (Step_tac 1);
   708 \         ((%z. (f(z) - f(x)) / (z - x)) -- x --C> D)";
   708 \         ((%z. (f(z) - f(x)) / (z - x)) -- x --C> D)";
   709 by (simp_tac (simpset() addsimps [CDERIV_CLIM_iff]) 1);
   709 by (simp_tac (simpset() addsimps [CDERIV_CLIM_iff]) 1);
   710 qed "CDERIV_iff2";
   710 qed "CDERIV_iff2";
   711 
   711 
   712 
   712 
   713 (*------------------------------------------------------------------------------------*)
   713 (*-----------------------------------------------------------------------*)
   714 (* Equivalence of NS and standard defs of differentiation                             *)
   714 (* Equivalence of NS and standard defs of differentiation                             *)
   715 (*------------------------------------------------------------------------------------*)
   715 (*-----------------------------------------------------------------------*)
   716 
   716 
   717 (*** first equivalence ***)
   717 (*** first equivalence ***)
   718 Goalw [nscderiv_def,NSCLIM_def] 
   718 Goalw [nscderiv_def,NSCLIM_def] 
   719       "(NSCDERIV f x :> D) = ((%h. (f(x + h) - f(x))/h) -- 0 --NSC> D)";
   719       "(NSCDERIV f x :> D) = ((%h. (f(x + h) - f(x))/h) -- 0 --NSC> D)";
   720 by Auto_tac;
   720 by Auto_tac;
   765 Goal "CDERIV f x :> D ==> isContc f x";
   765 Goal "CDERIV f x :> D ==> isContc f x";
   766 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_CDERIV_iff RS sym, 
   766 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_CDERIV_iff RS sym, 
   767     isNSContc_isContc_iff RS sym,NSCDERIV_isNSContc]) 1);
   767     isNSContc_isContc_iff RS sym,NSCDERIV_isNSContc]) 1);
   768 qed "CDERIV_isContc";
   768 qed "CDERIV_isContc";
   769 
   769 
   770 (*------------------------------------------------------------------------------------*)
   770 (*-----------------------------------------------------------------------*)
   771 (* Differentiation rules for combinations of functions follow from clear,             *)
   771 (* Differentiation rules for combinations of functions follow from clear,             *)
   772 (* straightforard, algebraic manipulations                                            *)
   772 (* straightforard, algebraic manipulations                                            *)
   773 (*------------------------------------------------------------------------------------*)
   773 (*-----------------------------------------------------------------------*)
   774 
   774 
   775 (* use simple constant nslimit theorem *)
   775 (* use simple constant nslimit theorem *)
   776 Goal "(NSCDERIV (%x. k) x :> 0)";
   776 Goal "(NSCDERIV (%x. k) x :> 0)";
   777 by (simp_tac (simpset() addsimps [NSCDERIV_NSCLIM_iff]) 1);
   777 by (simp_tac (simpset() addsimps [NSCDERIV_NSCLIM_iff]) 1);
   778 qed "NSCDERIV_const";
   778 qed "NSCDERIV_const";
   789            NSCLIM_def]) 1 THEN REPEAT(Step_tac 1));
   789            NSCLIM_def]) 1 THEN REPEAT(Step_tac 1));
   790 by (auto_tac (claset(),
   790 by (auto_tac (claset(),
   791        simpset() addsimps [hcomplex_add_divide_distrib,hcomplex_diff_def]));
   791        simpset() addsimps [hcomplex_add_divide_distrib,hcomplex_diff_def]));
   792 by (dres_inst_tac [("b","hcomplex_of_complex Da"),
   792 by (dres_inst_tac [("b","hcomplex_of_complex Da"),
   793                    ("d","hcomplex_of_complex Db")] capprox_add 1);
   793                    ("d","hcomplex_of_complex Db")] capprox_add 1);
   794 by (auto_tac (claset(), simpset() addsimps hcomplex_add_ac));
   794 by (auto_tac (claset(), simpset() addsimps add_ac));
   795 qed "NSCDERIV_add";
   795 qed "NSCDERIV_add";
   796 
   796 
   797 Goal "[| CDERIV f x :> Da; CDERIV g x :> Db |] \
   797 Goal "[| CDERIV f x :> Da; CDERIV g x :> Db |] \
   798 \     ==> CDERIV (%x. f x + g x) x :> Da + Db";
   798 \     ==> CDERIV (%x. f x + g x) x :> Da + Db";
   799 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_add,
   799 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_add,
   801 qed "CDERIV_add";
   801 qed "CDERIV_add";
   802 
   802 
   803 (*** lemmas for multiplication ***)
   803 (*** lemmas for multiplication ***)
   804 
   804 
   805 Goal "((a::hcomplex)*b) - (c*d) = (b*(a - c)) + (c*(b - d))";
   805 Goal "((a::hcomplex)*b) - (c*d) = (b*(a - c)) + (c*(b - d))";
   806 by (simp_tac (simpset() addsimps [hcomplex_diff_mult_distrib2]) 1);
   806 by (simp_tac (simpset() addsimps [right_diff_distrib]) 1);
   807 val lemma_nscderiv1 = result();
   807 val lemma_nscderiv1 = result();
   808 
   808 
   809 Goal "[| (x + y) / z = hcomplex_of_complex D + yb; z ~= 0; \
   809 Goal "[| (x + y) / z = hcomplex_of_complex D + yb; z ~= 0; \
   810 \        z : CInfinitesimal; yb : CInfinitesimal |] \
   810 \        z : CInfinitesimal; yb : CInfinitesimal |] \
   811 \     ==> x + y @c= 0";
   811 \     ==> x + y @c= 0";
   831 		  addsimps [times_divide_eq_right RS sym]));
   831 		  addsimps [times_divide_eq_right RS sym]));
   832 by (rewtac hcomplex_diff_def);
   832 by (rewtac hcomplex_diff_def);
   833 by (dres_inst_tac [("D","Db")] lemma_nscderiv2 1);
   833 by (dres_inst_tac [("D","Db")] lemma_nscderiv2 1);
   834 by (dtac (capprox_minus_iff RS iffD2 RS (bex_CInfinitesimal_iff2 RS iffD2)) 4);
   834 by (dtac (capprox_minus_iff RS iffD2 RS (bex_CInfinitesimal_iff2 RS iffD2)) 4);
   835 by (auto_tac (claset() addSIs [capprox_add_mono1],
   835 by (auto_tac (claset() addSIs [capprox_add_mono1],
   836       simpset() addsimps [hcomplex_add_mult_distrib, hcomplex_add_mult_distrib2, 
   836       simpset() addsimps [hcomplex_add_mult_distrib, right_distrib, 
   837 			  hcomplex_mult_commute, hcomplex_add_assoc]));
   837 			  hcomplex_mult_commute, hcomplex_add_assoc]));
   838 by (res_inst_tac [("w1","hcomplex_of_complex Db * hcomplex_of_complex (f x)")]
   838 by (res_inst_tac [("w1","hcomplex_of_complex Db * hcomplex_of_complex (f x)")]
   839     (hcomplex_add_commute RS subst) 1);
   839     (hcomplex_add_commute RS subst) 1);
   840 by (auto_tac (claset() addSIs [CInfinitesimal_add_capprox_self2 RS capprox_sym,
   840 by (auto_tac (claset() addSIs [CInfinitesimal_add_capprox_self2 RS capprox_sym,
   841 			       CInfinitesimal_add, CInfinitesimal_mult,
   841 			       CInfinitesimal_add, CInfinitesimal_mult,
   853 Goal "NSCDERIV f x :> D ==> NSCDERIV (%x. c * f x) x :> c*D";
   853 Goal "NSCDERIV f x :> D ==> NSCDERIV (%x. c * f x) x :> c*D";
   854 by (asm_full_simp_tac 
   854 by (asm_full_simp_tac 
   855     (simpset() addsimps [complex_times_divide1_eq RS sym, NSCDERIV_NSCLIM_iff,
   855     (simpset() addsimps [complex_times_divide1_eq RS sym, NSCDERIV_NSCLIM_iff,
   856                          complex_minus_mult_eq2, complex_add_mult_distrib2 RS sym,
   856                          complex_minus_mult_eq2, complex_add_mult_distrib2 RS sym,
   857                          complex_diff_def] 
   857                          complex_diff_def] 
   858              delsimps [complex_times_divide1_eq, complex_minus_mult_eq2 RS sym]) 1);
   858              delsimps [complex_times_divide1_eq, complex_minus_mult_eq2 RS sym]
       
   859              delsimps [times_divide_eq_right, minus_mult_right RS sym]
       
   860 
       
   861 ) 1);
   859 by (etac (NSCLIM_const RS NSCLIM_mult) 1);
   862 by (etac (NSCLIM_const RS NSCLIM_mult) 1);
   860 qed "NSCDERIV_cmult";
   863 qed "NSCDERIV_cmult";
   861 
   864 
   862 Goal "CDERIV f x :> D ==> CDERIV (%x. c * f x) x :> c*D";
   865 Goal "CDERIV f x :> D ==> CDERIV (%x. c * f x) x :> c*D";
   863 by (auto_tac (claset(),simpset() addsimps [NSCDERIV_cmult,NSCDERIV_CDERIV_iff
   866 by (auto_tac (claset(),simpset() addsimps [NSCDERIV_cmult,NSCDERIV_CDERIV_iff
   866 
   869 
   867 Goal "NSCDERIV f x :> D ==> NSCDERIV (%x. -(f x)) x :> -D";
   870 Goal "NSCDERIV f x :> D ==> NSCDERIV (%x. -(f x)) x :> -D";
   868 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_NSCLIM_iff,complex_diff_def]) 1);
   871 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_NSCLIM_iff,complex_diff_def]) 1);
   869 by (res_inst_tac [("t","f x")] (complex_minus_minus RS subst) 1);
   872 by (res_inst_tac [("t","f x")] (complex_minus_minus RS subst) 1);
   870 by (asm_simp_tac (simpset() addsimps [complex_minus_add_distrib RS sym] 
   873 by (asm_simp_tac (simpset() addsimps [complex_minus_add_distrib RS sym] 
   871                    delsimps [complex_minus_add_distrib, complex_minus_minus]) 1);
   874                    delsimps [complex_minus_add_distrib, complex_minus_minus]
       
   875                    delsimps [minus_add_distrib, minus_minus]
       
   876 
       
   877 ) 1);
   872 by (etac NSCLIM_minus 1);
   878 by (etac NSCLIM_minus 1);
   873 qed "NSCDERIV_minus";
   879 qed "NSCDERIV_minus";
   874 
   880 
   875 Goal "CDERIV f x :> D ==> CDERIV (%x. -(f x)) x :> -D";
   881 Goal "CDERIV f x :> D ==> CDERIV (%x. -(f x)) x :> -D";
   876 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_minus,NSCDERIV_CDERIV_iff RS sym]) 1);
   882 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_minus,NSCDERIV_CDERIV_iff RS sym]) 1);
   993 Goal "[| CDERIV f (g x) :> Da; CDERIV g x :> Db |] \
   999 Goal "[| CDERIV f (g x) :> Da; CDERIV g x :> Db |] \
   994 \     ==> CDERIV (%x. f (g x)) x :> Da * Db";
  1000 \     ==> CDERIV (%x. f (g x)) x :> Da * Db";
   995 by (auto_tac (claset() addDs [CDERIV_chain], simpset() addsimps [o_def]));
  1001 by (auto_tac (claset() addDs [CDERIV_chain], simpset() addsimps [o_def]));
   996 qed "CDERIV_chain2";
  1002 qed "CDERIV_chain2";
   997 
  1003 
   998 (*------------------------------------------------------------------------------------*)
  1004 (*-----------------------------------------------------------------------*)
   999 (* Differentiation of natural number powers                                           *)
  1005 (* Differentiation of natural number powers                                           *)
  1000 (*------------------------------------------------------------------------------------*)
  1006 (*-----------------------------------------------------------------------*)
  1001 
  1007 
  1002 Goal "NSCDERIV (%x. x) x :> 1";
  1008 Goal "NSCDERIV (%x. x) x :> 1";
  1003 by (auto_tac (claset(),
  1009 by (auto_tac (claset(),
  1004      simpset() addsimps [NSCDERIV_NSCLIM_iff,NSCLIM_def]));
  1010      simpset() addsimps [NSCDERIV_NSCLIM_iff,NSCLIM_def]));
  1005 qed "NSCDERIV_Id";
  1011 qed "NSCDERIV_Id";
  1027 Goal "CDERIV (%x. x ^ n) x :> (complex_of_real (real n)) * (x ^ (n - 1))";
  1033 Goal "CDERIV (%x. x ^ n) x :> (complex_of_real (real n)) * (x ^ (n - 1))";
  1028 by (induct_tac "n" 1);
  1034 by (induct_tac "n" 1);
  1029 by (dtac (CDERIV_Id RS CDERIV_mult) 2);
  1035 by (dtac (CDERIV_Id RS CDERIV_mult) 2);
  1030 by (auto_tac (claset(), 
  1036 by (auto_tac (claset(), 
  1031               simpset() addsimps [complex_of_real_add RS sym,
  1037               simpset() addsimps [complex_of_real_add RS sym,
  1032               complex_add_mult_distrib,real_of_nat_Suc] delsimps [complex_of_real_add]));
  1038                         complex_add_mult_distrib,real_of_nat_Suc] 
       
  1039                  delsimps [complex_of_real_add]));
  1033 by (case_tac "n" 1);
  1040 by (case_tac "n" 1);
  1034 by (auto_tac (claset(), 
  1041 by (auto_tac (claset(), 
  1035               simpset() addsimps [complex_mult_assoc, complex_add_commute]));
  1042               simpset() addsimps [complex_mult_assoc, complex_add_commute]));
  1036 by (auto_tac (claset(),simpset() addsimps [complex_mult_commute]));
  1043 by (auto_tac (claset(),simpset() addsimps [complex_mult_commute]));
  1037 qed "CDERIV_pow";
  1044 qed "CDERIV_pow";
  1060 by (rtac ballI 1 THEN Asm_full_simp_tac 1 THEN Step_tac 1);
  1067 by (rtac ballI 1 THEN Asm_full_simp_tac 1 THEN Step_tac 1);
  1061 by (forward_tac [CInfinitesimal_add_not_zero] 1);
  1068 by (forward_tac [CInfinitesimal_add_not_zero] 1);
  1062 by (asm_full_simp_tac (simpset() addsimps [hcomplex_add_commute,numeral_2_eq_2]) 2); 
  1069 by (asm_full_simp_tac (simpset() addsimps [hcomplex_add_commute,numeral_2_eq_2]) 2); 
  1063 by (auto_tac (claset(),
  1070 by (auto_tac (claset(),
  1064      simpset() addsimps [starfunC_inverse_inverse,hcomplex_diff_def] 
  1071      simpset() addsimps [starfunC_inverse_inverse,hcomplex_diff_def] 
  1065                delsimps [minus_mult_right RS sym, minus_mult_left RS sym,
  1072                delsimps [minus_mult_left RS sym, minus_mult_right RS sym]));
  1066                          hcomplex_minus_mult_eq1 RS sym,
       
  1067                          hcomplex_minus_mult_eq2 RS sym]));
       
  1068 by (asm_simp_tac
  1073 by (asm_simp_tac
  1069      (simpset() addsimps [inverse_add,
  1074      (simpset() addsimps [inverse_add,
  1070           inverse_mult_distrib RS sym, hcomplex_minus_inverse RS sym] 
  1075           inverse_mult_distrib RS sym, inverse_minus_eq RS sym] 
  1071           @ hcomplex_add_ac @ hcomplex_mult_ac 
  1076           @ add_ac @ mult_ac 
  1072        delsimps [inverse_minus_eq,
  1077        delsimps [inverse_minus_eq,
  1073 		 inverse_mult_distrib, minus_mult_right RS sym, minus_mult_left RS sym,
  1078 		 inverse_mult_distrib, minus_mult_right RS sym, minus_mult_left RS sym] ) 1);
  1074                          hcomplex_minus_mult_eq1 RS sym,
  1079 by (asm_simp_tac (HOL_ss addsimps [mult_assoc RS sym, right_distrib]) 1);
  1075                  hcomplex_minus_mult_eq2 RS sym] ) 1);
       
  1076 by (asm_simp_tac (HOL_ss addsimps [hcomplex_mult_assoc RS sym,
       
  1077                                       hcomplex_add_mult_distrib2]) 1);
       
  1078 by (res_inst_tac [("y"," inverse(- hcomplex_of_complex x * hcomplex_of_complex x)")] 
  1080 by (res_inst_tac [("y"," inverse(- hcomplex_of_complex x * hcomplex_of_complex x)")] 
  1079                  capprox_trans 1);
  1081                  capprox_trans 1);
  1080 by (rtac inverse_add_CInfinitesimal_capprox2 1);
  1082 by (rtac inverse_add_CInfinitesimal_capprox2 1);
  1081 by (auto_tac (claset() addSDs [hcomplex_of_complex_CFinite_diff_CInfinitesimal] addIs [CFinite_mult], 
  1083 by (auto_tac (claset() addSDs [hcomplex_of_complex_CFinite_diff_CInfinitesimal] addIs [CFinite_mult], 
  1082          simpset() addsimps [hcomplex_minus_inverse RS sym]));
  1084          simpset() addsimps [inverse_minus_eq RS sym]));
  1083 by (rtac CInfinitesimal_CFinite_mult2 1); 
  1085 by (rtac CInfinitesimal_CFinite_mult2 1); 
  1084 by Auto_tac;  
  1086 by Auto_tac;  
  1085 qed "NSCDERIV_inverse";
  1087 qed "NSCDERIV_inverse";
  1086 
  1088 
  1087 Goal "x ~= 0 ==> CDERIV (%x. inverse(x)) x :> (-(inverse x ^ 2))";
  1089 Goal "x ~= 0 ==> CDERIV (%x. inverse(x)) x :> (-(inverse x ^ 2))";
  1088 by (asm_simp_tac (simpset() addsimps [NSCDERIV_inverse,
  1090 by (asm_simp_tac (simpset() addsimps [NSCDERIV_inverse,
  1089          NSCDERIV_CDERIV_iff RS sym] delsimps [complexpow_Suc]) 1);
  1091          NSCDERIV_CDERIV_iff RS sym] delsimps [complexpow_Suc]) 1);
  1090 qed "CDERIV_inverse";
  1092 qed "CDERIV_inverse";
  1091 
  1093 
  1092 
  1094 
  1093 (*------------------------------------------------------------------------------------*)
  1095 (*-----------------------------------------------------------------------*)
  1094 (* Derivative of inverse                                                              *)
  1096 (* Derivative of inverse                                                              *)
  1095 (*------------------------------------------------------------------------------------*)
  1097 (*-----------------------------------------------------------------------*)
  1096 
  1098 
  1097 Goal "[| CDERIV f x :> d; f(x) ~= 0 |] \
  1099 Goal "[| CDERIV f x :> d; f(x) ~= 0 |] \
  1098 \     ==> CDERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))";
  1100 \     ==> CDERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))";
  1099 by (rtac (complex_mult_commute RS subst) 1);
  1101 by (rtac (complex_mult_commute RS subst) 1);
  1100 by (asm_simp_tac (simpset() addsimps [complex_minus_mult_eq1,
  1102 by (asm_simp_tac (simpset() addsimps [complex_minus_mult_eq1,
  1101     complexpow_inverse] delsimps [complexpow_Suc, 
  1103     complexpow_inverse] delsimps [complexpow_Suc, minus_mult_left RS sym,
  1102     complex_minus_mult_eq1 RS sym]) 1);
  1104 complex_minus_mult_eq1 RS sym]) 1);
  1103 by (fold_goals_tac [o_def]);
  1105 by (fold_goals_tac [o_def]);
  1104 by (blast_tac (claset() addSIs [CDERIV_chain,CDERIV_inverse]) 1);
  1106 by (blast_tac (claset() addSIs [CDERIV_chain,CDERIV_inverse]) 1);
  1105 qed "CDERIV_inverse_fun";
  1107 qed "CDERIV_inverse_fun";
  1106 
  1108 
  1107 Goal "[| NSCDERIV f x :> d; f(x) ~= 0 |] \
  1109 Goal "[| NSCDERIV f x :> d; f(x) ~= 0 |] \
  1108 \     ==> NSCDERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))";
  1110 \     ==> NSCDERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))";
  1109 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_CDERIV_iff,
  1111 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_CDERIV_iff,
  1110             CDERIV_inverse_fun] delsimps [complexpow_Suc]) 1);
  1112             CDERIV_inverse_fun] delsimps [complexpow_Suc]) 1);
  1111 qed "NSCDERIV_inverse_fun";
  1113 qed "NSCDERIV_inverse_fun";
  1112 
  1114 
  1113 (*------------------------------------------------------------------------------------*)
  1115 (*-----------------------------------------------------------------------*)
  1114 (* Derivative of quotient                                                             *)
  1116 (* Derivative of quotient                                                             *)
  1115 (*------------------------------------------------------------------------------------*)
  1117 (*-----------------------------------------------------------------------*)
  1116 
  1118 
  1117 
  1119 
  1118 Goal "x ~= (0::complex) \\<Longrightarrow> (x * inverse(x) ^ 2) = inverse x";
  1120 Goal "x ~= (0::complex) \\<Longrightarrow> (x * inverse(x) ^ 2) = inverse x";
  1119 by (auto_tac (claset(),simpset() addsimps [numeral_2_eq_2]));
  1121 by (auto_tac (claset(),simpset() addsimps [numeral_2_eq_2]));
  1120 qed "lemma_complex_mult_inverse_squared";
  1122 qed "lemma_complex_mult_inverse_squared";
  1127 by (dtac CDERIV_mult 2);
  1129 by (dtac CDERIV_mult 2);
  1128 by (REPEAT(assume_tac 1));
  1130 by (REPEAT(assume_tac 1));
  1129 by (asm_full_simp_tac
  1131 by (asm_full_simp_tac
  1130     (simpset() addsimps [complex_divide_def, complex_add_mult_distrib2,
  1132     (simpset() addsimps [complex_divide_def, complex_add_mult_distrib2,
  1131                          complexpow_inverse,complex_minus_mult_eq1] @ complex_mult_ac 
  1133                          complexpow_inverse,complex_minus_mult_eq1] @ complex_mult_ac 
  1132        delsimps [complexpow_Suc, complex_minus_mult_eq1 RS sym,
  1134        delsimps [complexpow_Suc, minus_mult_right RS sym, minus_mult_left RS sym]) 1);
  1133                  complex_minus_mult_eq2 RS sym]) 1);
       
  1134 qed "CDERIV_quotient";
  1135 qed "CDERIV_quotient";
  1135 
  1136 
  1136 Goal "[| NSCDERIV f x :> d; NSCDERIV g x :> e; g(x) ~= 0 |] \
  1137 Goal "[| NSCDERIV f x :> d; NSCDERIV g x :> e; g(x) ~= 0 |] \
  1137 \      ==> NSCDERIV (%y. f(y) / (g y)) x :> (d*g(x) - (e*f(x))) / (g(x) ^ 2)";
  1138 \      ==> NSCDERIV (%y. f(y) / (g y)) x :> (d*g(x) - (e*f(x))) / (g(x) ^ 2)";
  1138 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_CDERIV_iff,
  1139 by (asm_full_simp_tac (simpset() addsimps [NSCDERIV_CDERIV_iff,
  1139             CDERIV_quotient] delsimps [complexpow_Suc]) 1);
  1140             CDERIV_quotient] delsimps [complexpow_Suc]) 1);
  1140 qed "NSCDERIV_quotient";
  1141 qed "NSCDERIV_quotient";
  1141  
  1142  
  1142 
  1143 
  1143 (*------------------------------------------------------------------------------------*)
  1144 (*-----------------------------------------------------------------------*)
  1144 (* Caratheodory formulation of derivative at a point: standard proof                  *)
  1145 (* Caratheodory formulation of derivative at a point: standard proof                  *)
  1145 (*------------------------------------------------------------------------------------*)
  1146 (*-----------------------------------------------------------------------*)
  1146 
  1147 
  1147 
  1148 
  1148 Goalw [CLIM_def] 
  1149 Goalw [CLIM_def] 
  1149       "[| ALL x. x ~= a --> (f x = g x) |] \
  1150       "[| ALL x. x ~= a --> (f x = g x) |] \
  1150 \           ==> (f -- a --C> l) = (g -- a --C> l)";
  1151 \           ==> (f -- a --C> l) = (g -- a --C> l)";