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, |
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, |
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); |
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)"; |