63 qed "LIM_add_minus"; |
63 qed "LIM_add_minus"; |
64 |
64 |
65 (*---------------------------------------------- |
65 (*---------------------------------------------- |
66 LIM_zero |
66 LIM_zero |
67 ----------------------------------------------*) |
67 ----------------------------------------------*) |
68 Goal "f -- a --> l ==> (%x. f(x) + -l) -- a --> #0"; |
68 Goal "f -- a --> l ==> (%x. f(x) + -l) -- a --> Numeral0"; |
69 by (res_inst_tac [("z1","l")] (rename_numerals (real_add_minus RS subst)) 1); |
69 by (res_inst_tac [("z1","l")] (rename_numerals (real_add_minus RS subst)) 1); |
70 by (rtac LIM_add_minus 1 THEN Auto_tac); |
70 by (rtac LIM_add_minus 1 THEN Auto_tac); |
71 qed "LIM_zero"; |
71 qed "LIM_zero"; |
72 |
72 |
73 (*-------------------------- |
73 (*-------------------------- |
74 Limit not zero |
74 Limit not zero |
75 --------------------------*) |
75 --------------------------*) |
76 Goalw [LIM_def] "k \\<noteq> #0 ==> ~ ((%x. k) -- x --> #0)"; |
76 Goalw [LIM_def] "k \\<noteq> Numeral0 ==> ~ ((%x. k) -- x --> Numeral0)"; |
77 by (res_inst_tac [("R1.0","k"),("R2.0","#0")] real_linear_less2 1); |
77 by (res_inst_tac [("R1.0","k"),("R2.0","Numeral0")] real_linear_less2 1); |
78 by (auto_tac (claset(), simpset() addsimps [real_abs_def])); |
78 by (auto_tac (claset(), simpset() addsimps [real_abs_def])); |
79 by (res_inst_tac [("x","-k")] exI 1); |
79 by (res_inst_tac [("x","-k")] exI 1); |
80 by (res_inst_tac [("x","k")] exI 2); |
80 by (res_inst_tac [("x","k")] exI 2); |
81 by Auto_tac; |
81 by Auto_tac; |
82 by (ALLGOALS(dres_inst_tac [("y","s")] real_dense)); |
82 by (ALLGOALS(dres_inst_tac [("y","s")] real_dense)); |
83 by Safe_tac; |
83 by Safe_tac; |
84 by (ALLGOALS(res_inst_tac [("x","r + x")] exI)); |
84 by (ALLGOALS(res_inst_tac [("x","r + x")] exI)); |
85 by Auto_tac; |
85 by Auto_tac; |
86 qed "LIM_not_zero"; |
86 qed "LIM_not_zero"; |
87 |
87 |
88 (* [| k \\<noteq> #0; (%x. k) -- x --> #0 |] ==> R *) |
88 (* [| k \\<noteq> Numeral0; (%x. k) -- x --> Numeral0 |] ==> R *) |
89 bind_thm("LIM_not_zeroE", LIM_not_zero RS notE); |
89 bind_thm("LIM_not_zeroE", LIM_not_zero RS notE); |
90 |
90 |
91 Goal "(%x. k) -- x --> L ==> k = L"; |
91 Goal "(%x. k) -- x --> L ==> k = L"; |
92 by (rtac ccontr 1); |
92 by (rtac ccontr 1); |
93 by (dtac LIM_zero 1); |
93 by (dtac LIM_zero 1); |
179 |
179 |
180 (*--------------------------------------------------------------------- |
180 (*--------------------------------------------------------------------- |
181 Limit: NS definition ==> standard definition |
181 Limit: NS definition ==> standard definition |
182 ---------------------------------------------------------------------*) |
182 ---------------------------------------------------------------------*) |
183 |
183 |
184 Goal "\\<forall>s. #0 < s --> (\\<exists>xa. xa \\<noteq> x & \ |
184 Goal "\\<forall>s. Numeral0 < s --> (\\<exists>xa. xa \\<noteq> x & \ |
185 \ abs (xa + - x) < s & r \\<le> abs (f xa + -L)) \ |
185 \ abs (xa + - x) < s & r \\<le> abs (f xa + -L)) \ |
186 \ ==> \\<forall>n::nat. \\<exists>xa. xa \\<noteq> x & \ |
186 \ ==> \\<forall>n::nat. \\<exists>xa. xa \\<noteq> x & \ |
187 \ abs(xa + -x) < inverse(real(Suc n)) & r \\<le> abs(f xa + -L)"; |
187 \ abs(xa + -x) < inverse(real(Suc n)) & r \\<le> abs(f xa + -L)"; |
188 by (Clarify_tac 1); |
188 by (Clarify_tac 1); |
189 by (cut_inst_tac [("n1","n")] |
189 by (cut_inst_tac [("n1","n")] |
190 (real_of_nat_Suc_gt_zero RS rename_numerals real_inverse_gt_zero) 1); |
190 (real_of_nat_Suc_gt_zero RS rename_numerals real_inverse_gt_zero) 1); |
191 by Auto_tac; |
191 by Auto_tac; |
192 val lemma_LIM = result(); |
192 val lemma_LIM = result(); |
193 |
193 |
194 Goal "\\<forall>s. #0 < s --> (\\<exists>xa. xa \\<noteq> x & \ |
194 Goal "\\<forall>s. Numeral0 < s --> (\\<exists>xa. xa \\<noteq> x & \ |
195 \ abs (xa + - x) < s & r \\<le> abs (f xa + -L)) \ |
195 \ abs (xa + - x) < s & r \\<le> abs (f xa + -L)) \ |
196 \ ==> \\<exists>X. \\<forall>n::nat. X n \\<noteq> x & \ |
196 \ ==> \\<exists>X. \\<forall>n::nat. X n \\<noteq> x & \ |
197 \ abs(X n + -x) < inverse(real(Suc n)) & r \\<le> abs(f (X n) + -L)"; |
197 \ abs(X n + -x) < inverse(real(Suc n)) & r \\<le> abs(f (X n) + -L)"; |
198 by (dtac lemma_LIM 1); |
198 by (dtac lemma_LIM 1); |
199 by (dtac choice 1); |
199 by (dtac choice 1); |
318 |
318 |
319 (*----------------------------- |
319 (*----------------------------- |
320 NSLIM_inverse |
320 NSLIM_inverse |
321 -----------------------------*) |
321 -----------------------------*) |
322 Goalw [NSLIM_def] |
322 Goalw [NSLIM_def] |
323 "[| f -- a --NS> L; L \\<noteq> #0 |] \ |
323 "[| f -- a --NS> L; L \\<noteq> Numeral0 |] \ |
324 \ ==> (%x. inverse(f(x))) -- a --NS> (inverse L)"; |
324 \ ==> (%x. inverse(f(x))) -- a --NS> (inverse L)"; |
325 by (Clarify_tac 1); |
325 by (Clarify_tac 1); |
326 by (dtac spec 1); |
326 by (dtac spec 1); |
327 by (auto_tac (claset(), |
327 by (auto_tac (claset(), |
328 simpset() addsimps [hypreal_of_real_approx_inverse])); |
328 simpset() addsimps [hypreal_of_real_approx_inverse])); |
329 qed "NSLIM_inverse"; |
329 qed "NSLIM_inverse"; |
330 |
330 |
331 Goal "[| f -- a --> L; \ |
331 Goal "[| f -- a --> L; \ |
332 \ L \\<noteq> #0 |] ==> (%x. inverse(f(x))) -- a --> (inverse L)"; |
332 \ L \\<noteq> Numeral0 |] ==> (%x. inverse(f(x))) -- a --> (inverse L)"; |
333 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_inverse]) 1); |
333 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_inverse]) 1); |
334 qed "LIM_inverse"; |
334 qed "LIM_inverse"; |
335 |
335 |
336 (*------------------------------ |
336 (*------------------------------ |
337 NSLIM_zero |
337 NSLIM_zero |
338 ------------------------------*) |
338 ------------------------------*) |
339 Goal "f -- a --NS> l ==> (%x. f(x) + -l) -- a --NS> #0"; |
339 Goal "f -- a --NS> l ==> (%x. f(x) + -l) -- a --NS> Numeral0"; |
340 by (res_inst_tac [("z1","l")] (rename_numerals (real_add_minus RS subst)) 1); |
340 by (res_inst_tac [("z1","l")] (rename_numerals (real_add_minus RS subst)) 1); |
341 by (rtac NSLIM_add_minus 1 THEN Auto_tac); |
341 by (rtac NSLIM_add_minus 1 THEN Auto_tac); |
342 qed "NSLIM_zero"; |
342 qed "NSLIM_zero"; |
343 |
343 |
344 Goal "f -- a --> l ==> (%x. f(x) + -l) -- a --> #0"; |
344 Goal "f -- a --> l ==> (%x. f(x) + -l) -- a --> Numeral0"; |
345 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_zero]) 1); |
345 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_zero]) 1); |
346 qed "LIM_zero2"; |
346 qed "LIM_zero2"; |
347 |
347 |
348 Goal "(%x. f(x) - l) -- x --NS> #0 ==> f -- x --NS> l"; |
348 Goal "(%x. f(x) - l) -- x --NS> Numeral0 ==> f -- x --NS> l"; |
349 by (dres_inst_tac [("g","%x. l"),("m","l")] NSLIM_add 1); |
349 by (dres_inst_tac [("g","%x. l"),("m","l")] NSLIM_add 1); |
350 by (auto_tac (claset(),simpset() addsimps [real_diff_def, real_add_assoc])); |
350 by (auto_tac (claset(),simpset() addsimps [real_diff_def, real_add_assoc])); |
351 qed "NSLIM_zero_cancel"; |
351 qed "NSLIM_zero_cancel"; |
352 |
352 |
353 Goal "(%x. f(x) - l) -- x --> #0 ==> f -- x --> l"; |
353 Goal "(%x. f(x) - l) -- x --> Numeral0 ==> f -- x --> l"; |
354 by (dres_inst_tac [("g","%x. l"),("m","l")] LIM_add 1); |
354 by (dres_inst_tac [("g","%x. l"),("m","l")] LIM_add 1); |
355 by (auto_tac (claset(),simpset() addsimps [real_diff_def, real_add_assoc])); |
355 by (auto_tac (claset(),simpset() addsimps [real_diff_def, real_add_assoc])); |
356 qed "LIM_zero_cancel"; |
356 qed "LIM_zero_cancel"; |
357 |
357 |
358 |
358 |
359 (*-------------------------- |
359 (*-------------------------- |
360 NSLIM_not_zero |
360 NSLIM_not_zero |
361 --------------------------*) |
361 --------------------------*) |
362 Goalw [NSLIM_def] "k \\<noteq> #0 ==> ~ ((%x. k) -- x --NS> #0)"; |
362 Goalw [NSLIM_def] "k \\<noteq> Numeral0 ==> ~ ((%x. k) -- x --NS> Numeral0)"; |
363 by Auto_tac; |
363 by Auto_tac; |
364 by (res_inst_tac [("x","hypreal_of_real x + epsilon")] exI 1); |
364 by (res_inst_tac [("x","hypreal_of_real x + epsilon")] exI 1); |
365 by (auto_tac (claset() addIs [Infinitesimal_add_approx_self RS approx_sym], |
365 by (auto_tac (claset() addIs [Infinitesimal_add_approx_self RS approx_sym], |
366 simpset() addsimps [rename_numerals hypreal_epsilon_not_zero])); |
366 simpset() addsimps [rename_numerals hypreal_epsilon_not_zero])); |
367 qed "NSLIM_not_zero"; |
367 qed "NSLIM_not_zero"; |
368 |
368 |
369 (* [| k \\<noteq> #0; (%x. k) -- x --NS> #0 |] ==> R *) |
369 (* [| k \\<noteq> Numeral0; (%x. k) -- x --NS> Numeral0 |] ==> R *) |
370 bind_thm("NSLIM_not_zeroE", NSLIM_not_zero RS notE); |
370 bind_thm("NSLIM_not_zeroE", NSLIM_not_zero RS notE); |
371 |
371 |
372 Goal "k \\<noteq> #0 ==> ~ ((%x. k) -- x --> #0)"; |
372 Goal "k \\<noteq> Numeral0 ==> ~ ((%x. k) -- x --> Numeral0)"; |
373 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_not_zero]) 1); |
373 by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_not_zero]) 1); |
374 qed "LIM_not_zero2"; |
374 qed "LIM_not_zero2"; |
375 |
375 |
376 (*------------------------------------- |
376 (*------------------------------------- |
377 NSLIM of constant function |
377 NSLIM of constant function |
514 by (auto_tac (claset(), |
514 by (auto_tac (claset(), |
515 simpset() addsimps [starfun, hypreal_of_real_def, hypreal_minus, |
515 simpset() addsimps [starfun, hypreal_of_real_def, hypreal_minus, |
516 hypreal_add, real_add_assoc, approx_refl, hypreal_zero_def])); |
516 hypreal_add, real_add_assoc, approx_refl, hypreal_zero_def])); |
517 qed "NSLIM_h_iff"; |
517 qed "NSLIM_h_iff"; |
518 |
518 |
519 Goal "(f -- a --NS> f a) = ((%h. f(a + h)) -- #0 --NS> f a)"; |
519 Goal "(f -- a --NS> f a) = ((%h. f(a + h)) -- Numeral0 --NS> f a)"; |
520 by (rtac NSLIM_h_iff 1); |
520 by (rtac NSLIM_h_iff 1); |
521 qed "NSLIM_isCont_iff"; |
521 qed "NSLIM_isCont_iff"; |
522 |
522 |
523 Goal "(f -- a --> f a) = ((%h. f(a + h)) -- #0 --> f(a))"; |
523 Goal "(f -- a --> f a) = ((%h. f(a + h)) -- Numeral0 --> f(a))"; |
524 by (simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_isCont_iff]) 1); |
524 by (simp_tac (simpset() addsimps [LIM_NSLIM_iff, NSLIM_isCont_iff]) 1); |
525 qed "LIM_isCont_iff"; |
525 qed "LIM_isCont_iff"; |
526 |
526 |
527 Goalw [isCont_def] "(isCont f x) = ((%h. f(x + h)) -- #0 --> f(x))"; |
527 Goalw [isCont_def] "(isCont f x) = ((%h. f(x + h)) -- Numeral0 --> f(x))"; |
528 by (simp_tac (simpset() addsimps [LIM_isCont_iff]) 1); |
528 by (simp_tac (simpset() addsimps [LIM_isCont_iff]) 1); |
529 qed "isCont_iff"; |
529 qed "isCont_iff"; |
530 |
530 |
531 (*-------------------------------------------------------------------------- |
531 (*-------------------------------------------------------------------------- |
532 Immediate application of nonstandard criterion for continuity can offer |
532 Immediate application of nonstandard criterion for continuity can offer |
688 by (thin_tac "\\<forall>x y. abs (x + - y) < s --> abs (f x + - f y) < u" 1); |
688 by (thin_tac "\\<forall>x y. abs (x + - y) < s --> abs (f x + - f y) < u" 1); |
689 by (dtac FreeUltrafilterNat_all 1); |
689 by (dtac FreeUltrafilterNat_all 1); |
690 by (Ultra_tac 1); |
690 by (Ultra_tac 1); |
691 qed "isUCont_isNSUCont"; |
691 qed "isUCont_isNSUCont"; |
692 |
692 |
693 Goal "\\<forall>s. #0 < s --> (\\<exists>z y. abs (z + - y) < s & r \\<le> abs (f z + -f y)) \ |
693 Goal "\\<forall>s. Numeral0 < s --> (\\<exists>z y. abs (z + - y) < s & r \\<le> abs (f z + -f y)) \ |
694 \ ==> \\<forall>n::nat. \\<exists>z y. \ |
694 \ ==> \\<forall>n::nat. \\<exists>z y. \ |
695 \ abs(z + -y) < inverse(real(Suc n)) & \ |
695 \ abs(z + -y) < inverse(real(Suc n)) & \ |
696 \ r \\<le> abs(f z + -f y)"; |
696 \ r \\<le> abs(f z + -f y)"; |
697 by (Clarify_tac 1); |
697 by (Clarify_tac 1); |
698 by (cut_inst_tac [("n1","n")] |
698 by (cut_inst_tac [("n1","n")] |
699 (real_of_nat_Suc_gt_zero RS rename_numerals real_inverse_gt_zero) 1); |
699 (real_of_nat_Suc_gt_zero RS rename_numerals real_inverse_gt_zero) 1); |
700 by Auto_tac; |
700 by Auto_tac; |
701 val lemma_LIMu = result(); |
701 val lemma_LIMu = result(); |
702 |
702 |
703 Goal "\\<forall>s. #0 < s --> (\\<exists>z y. abs (z + - y) < s & r \\<le> abs (f z + -f y)) \ |
703 Goal "\\<forall>s. Numeral0 < s --> (\\<exists>z y. abs (z + - y) < s & r \\<le> abs (f z + -f y)) \ |
704 \ ==> \\<exists>X Y. \\<forall>n::nat. \ |
704 \ ==> \\<exists>X Y. \\<forall>n::nat. \ |
705 \ abs(X n + -(Y n)) < inverse(real(Suc n)) & \ |
705 \ abs(X n + -(Y n)) < inverse(real(Suc n)) & \ |
706 \ r \\<le> abs(f (X n) + -f (Y n))"; |
706 \ r \\<le> abs(f (X n) + -f (Y n))"; |
707 by (dtac lemma_LIMu 1); |
707 by (dtac lemma_LIMu 1); |
708 by (dtac choice 1); |
708 by (dtac choice 1); |
1141 delsimps [hypreal_times_divide1_eq]) 1); |
1141 delsimps [hypreal_times_divide1_eq]) 1); |
1142 by (auto_tac (claset(), |
1142 by (auto_tac (claset(), |
1143 simpset() addsimps [hypreal_add_mult_distrib])); |
1143 simpset() addsimps [hypreal_add_mult_distrib])); |
1144 qed "increment_thm"; |
1144 qed "increment_thm"; |
1145 |
1145 |
1146 Goal "[| NSDERIV f x :> D; h \\<approx> #0; h \\<noteq> #0 |] \ |
1146 Goal "[| NSDERIV f x :> D; h \\<approx> Numeral0; h \\<noteq> Numeral0 |] \ |
1147 \ ==> \\<exists>e \\<in> Infinitesimal. increment f x h = \ |
1147 \ ==> \\<exists>e \\<in> Infinitesimal. increment f x h = \ |
1148 \ hypreal_of_real(D)*h + e*h"; |
1148 \ hypreal_of_real(D)*h + e*h"; |
1149 by (blast_tac (claset() addSDs [mem_infmal_iff RS iffD2] |
1149 by (blast_tac (claset() addSDs [mem_infmal_iff RS iffD2] |
1150 addSIs [increment_thm]) 1); |
1150 addSIs [increment_thm]) 1); |
1151 qed "increment_thm2"; |
1151 qed "increment_thm2"; |
1152 |
1152 |
1153 Goal "[| NSDERIV f x :> D; h \\<approx> #0; h \\<noteq> #0 |] \ |
1153 Goal "[| NSDERIV f x :> D; h \\<approx> Numeral0; h \\<noteq> Numeral0 |] \ |
1154 \ ==> increment f x h \\<approx> #0"; |
1154 \ ==> increment f x h \\<approx> Numeral0"; |
1155 by (dtac increment_thm2 1 THEN auto_tac (claset() addSIs |
1155 by (dtac increment_thm2 1 THEN auto_tac (claset() addSIs |
1156 [Infinitesimal_HFinite_mult2,HFinite_add],simpset() addsimps |
1156 [Infinitesimal_HFinite_mult2,HFinite_add],simpset() addsimps |
1157 [hypreal_add_mult_distrib RS sym,mem_infmal_iff RS sym])); |
1157 [hypreal_add_mult_distrib RS sym,mem_infmal_iff RS sym])); |
1158 by (etac (Infinitesimal_subset_HFinite RS subsetD) 1); |
1158 by (etac (Infinitesimal_subset_HFinite RS subsetD) 1); |
1159 qed "increment_approx_zero"; |
1159 qed "increment_approx_zero"; |
1264 qed "DERIV_chain2"; |
1264 qed "DERIV_chain2"; |
1265 |
1265 |
1266 (*------------------------------------------------------------------ |
1266 (*------------------------------------------------------------------ |
1267 Differentiation of natural number powers |
1267 Differentiation of natural number powers |
1268 ------------------------------------------------------------------*) |
1268 ------------------------------------------------------------------*) |
1269 Goal "NSDERIV (%x. x) x :> #1"; |
1269 Goal "NSDERIV (%x. x) x :> Numeral1"; |
1270 by (auto_tac (claset(), |
1270 by (auto_tac (claset(), |
1271 simpset() addsimps [NSDERIV_NSLIM_iff, |
1271 simpset() addsimps [NSDERIV_NSLIM_iff, |
1272 NSLIM_def ,starfun_Id, hypreal_of_real_zero, |
1272 NSLIM_def ,starfun_Id, hypreal_of_real_zero, |
1273 hypreal_of_real_one])); |
1273 hypreal_of_real_one])); |
1274 qed "NSDERIV_Id"; |
1274 qed "NSDERIV_Id"; |
1275 Addsimps [NSDERIV_Id]; |
1275 Addsimps [NSDERIV_Id]; |
1276 |
1276 |
1277 (*derivative of the identity function*) |
1277 (*derivative of the identity function*) |
1278 Goal "DERIV (%x. x) x :> #1"; |
1278 Goal "DERIV (%x. x) x :> Numeral1"; |
1279 by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff RS sym]) 1); |
1279 by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff RS sym]) 1); |
1280 qed "DERIV_Id"; |
1280 qed "DERIV_Id"; |
1281 Addsimps [DERIV_Id]; |
1281 Addsimps [DERIV_Id]; |
1282 |
1282 |
1283 bind_thm ("isCont_Id", DERIV_Id RS DERIV_isCont); |
1283 bind_thm ("isCont_Id", DERIV_Id RS DERIV_isCont); |
1304 by (auto_tac (claset(), |
1304 by (auto_tac (claset(), |
1305 simpset() addsimps [real_mult_assoc, real_add_commute])); |
1305 simpset() addsimps [real_mult_assoc, real_add_commute])); |
1306 qed "DERIV_pow"; |
1306 qed "DERIV_pow"; |
1307 |
1307 |
1308 (* NS version *) |
1308 (* NS version *) |
1309 Goal "NSDERIV (%x. x ^ n) x :> real n * (x ^ (n - 1'))"; |
1309 Goal "NSDERIV (%x. x ^ n) x :> real n * (x ^ (n - Suc 0))"; |
1310 by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff, DERIV_pow]) 1); |
1310 by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff, DERIV_pow]) 1); |
1311 qed "NSDERIV_pow"; |
1311 qed "NSDERIV_pow"; |
1312 |
1312 |
1313 (*--------------------------------------------------------------- |
1313 (*--------------------------------------------------------------- |
1314 Power of -1 |
1314 Power of -1 |
1315 ---------------------------------------------------------------*) |
1315 ---------------------------------------------------------------*) |
1316 |
1316 |
1317 (*Can't get rid of x \\<noteq> #0 because it isn't continuous at zero*) |
1317 (*Can't get rid of x \\<noteq> Numeral0 because it isn't continuous at zero*) |
1318 Goalw [nsderiv_def] |
1318 Goalw [nsderiv_def] |
1319 "x \\<noteq> #0 ==> NSDERIV (%x. inverse(x)) x :> (- (inverse x ^ 2))"; |
1319 "x \\<noteq> Numeral0 ==> NSDERIV (%x. inverse(x)) x :> (- (inverse x ^ Suc (Suc 0)))"; |
1320 by (rtac ballI 1 THEN Asm_full_simp_tac 1 THEN Step_tac 1); |
1320 by (rtac ballI 1 THEN Asm_full_simp_tac 1 THEN Step_tac 1); |
1321 by (forward_tac [Infinitesimal_add_not_zero] 1); |
1321 by (forward_tac [Infinitesimal_add_not_zero] 1); |
1322 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 2); |
1322 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 2); |
1323 by (auto_tac (claset(), |
1323 by (auto_tac (claset(), |
1324 simpset() addsimps [starfun_inverse_inverse, realpow_two] |
1324 simpset() addsimps [starfun_inverse_inverse, realpow_two] |
1343 by (rtac Infinitesimal_HFinite_mult2 1); |
1343 by (rtac Infinitesimal_HFinite_mult2 1); |
1344 by Auto_tac; |
1344 by Auto_tac; |
1345 qed "NSDERIV_inverse"; |
1345 qed "NSDERIV_inverse"; |
1346 |
1346 |
1347 |
1347 |
1348 Goal "x \\<noteq> #0 ==> DERIV (%x. inverse(x)) x :> (-(inverse x ^ 2))"; |
1348 Goal "x \\<noteq> Numeral0 ==> DERIV (%x. inverse(x)) x :> (-(inverse x ^ Suc (Suc 0)))"; |
1349 by (asm_simp_tac (simpset() addsimps [NSDERIV_inverse, |
1349 by (asm_simp_tac (simpset() addsimps [NSDERIV_inverse, |
1350 NSDERIV_DERIV_iff RS sym] delsimps [realpow_Suc]) 1); |
1350 NSDERIV_DERIV_iff RS sym] delsimps [realpow_Suc]) 1); |
1351 qed "DERIV_inverse"; |
1351 qed "DERIV_inverse"; |
1352 |
1352 |
1353 (*-------------------------------------------------------------- |
1353 (*-------------------------------------------------------------- |
1354 Derivative of inverse |
1354 Derivative of inverse |
1355 -------------------------------------------------------------*) |
1355 -------------------------------------------------------------*) |
1356 Goal "[| DERIV f x :> d; f(x) \\<noteq> #0 |] \ |
1356 Goal "[| DERIV f x :> d; f(x) \\<noteq> Numeral0 |] \ |
1357 \ ==> DERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))"; |
1357 \ ==> DERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ Suc (Suc 0))))"; |
1358 by (rtac (real_mult_commute RS subst) 1); |
1358 by (rtac (real_mult_commute RS subst) 1); |
1359 by (asm_simp_tac (simpset() addsimps [real_minus_mult_eq1, |
1359 by (asm_simp_tac (simpset() addsimps [real_minus_mult_eq1, |
1360 realpow_inverse] delsimps [realpow_Suc, |
1360 realpow_inverse] delsimps [realpow_Suc, |
1361 real_minus_mult_eq1 RS sym]) 1); |
1361 real_minus_mult_eq1 RS sym]) 1); |
1362 by (fold_goals_tac [o_def]); |
1362 by (fold_goals_tac [o_def]); |
1363 by (blast_tac (claset() addSIs [DERIV_chain,DERIV_inverse]) 1); |
1363 by (blast_tac (claset() addSIs [DERIV_chain,DERIV_inverse]) 1); |
1364 qed "DERIV_inverse_fun"; |
1364 qed "DERIV_inverse_fun"; |
1365 |
1365 |
1366 Goal "[| NSDERIV f x :> d; f(x) \\<noteq> #0 |] \ |
1366 Goal "[| NSDERIV f x :> d; f(x) \\<noteq> Numeral0 |] \ |
1367 \ ==> NSDERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))"; |
1367 \ ==> NSDERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ Suc (Suc 0))))"; |
1368 by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff, |
1368 by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff, |
1369 DERIV_inverse_fun] delsimps [realpow_Suc]) 1); |
1369 DERIV_inverse_fun] delsimps [realpow_Suc]) 1); |
1370 qed "NSDERIV_inverse_fun"; |
1370 qed "NSDERIV_inverse_fun"; |
1371 |
1371 |
1372 (*-------------------------------------------------------------- |
1372 (*-------------------------------------------------------------- |
1373 Derivative of quotient |
1373 Derivative of quotient |
1374 -------------------------------------------------------------*) |
1374 -------------------------------------------------------------*) |
1375 Goal "[| DERIV f x :> d; DERIV g x :> e; g(x) \\<noteq> #0 |] \ |
1375 Goal "[| DERIV f x :> d; DERIV g x :> e; g(x) \\<noteq> Numeral0 |] \ |
1376 \ ==> DERIV (%y. f(y) / (g y)) x :> (d*g(x) + -(e*f(x))) / (g(x) ^ 2)"; |
1376 \ ==> DERIV (%y. f(y) / (g y)) x :> (d*g(x) + -(e*f(x))) / (g(x) ^ Suc (Suc 0))"; |
1377 by (dres_inst_tac [("f","g")] DERIV_inverse_fun 1); |
1377 by (dres_inst_tac [("f","g")] DERIV_inverse_fun 1); |
1378 by (dtac DERIV_mult 2); |
1378 by (dtac DERIV_mult 2); |
1379 by (REPEAT(assume_tac 1)); |
1379 by (REPEAT(assume_tac 1)); |
1380 by (asm_full_simp_tac |
1380 by (asm_full_simp_tac |
1381 (simpset() addsimps [real_divide_def, real_add_mult_distrib2, |
1381 (simpset() addsimps [real_divide_def, real_add_mult_distrib2, |
1382 realpow_inverse,real_minus_mult_eq1] @ real_mult_ac |
1382 realpow_inverse,real_minus_mult_eq1] @ real_mult_ac |
1383 delsimps [realpow_Suc, real_minus_mult_eq1 RS sym, |
1383 delsimps [realpow_Suc, real_minus_mult_eq1 RS sym, |
1384 real_minus_mult_eq2 RS sym]) 1); |
1384 real_minus_mult_eq2 RS sym]) 1); |
1385 qed "DERIV_quotient"; |
1385 qed "DERIV_quotient"; |
1386 |
1386 |
1387 Goal "[| NSDERIV f x :> d; DERIV g x :> e; g(x) \\<noteq> #0 |] \ |
1387 Goal "[| NSDERIV f x :> d; DERIV g x :> e; g(x) \\<noteq> Numeral0 |] \ |
1388 \ ==> NSDERIV (%y. f(y) / (g y)) x :> (d*g(x) \ |
1388 \ ==> NSDERIV (%y. f(y) / (g y)) x :> (d*g(x) \ |
1389 \ + -(e*f(x))) / (g(x) ^ 2)"; |
1389 \ + -(e*f(x))) / (g(x) ^ Suc (Suc 0))"; |
1390 by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff, |
1390 by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff, |
1391 DERIV_quotient] delsimps [realpow_Suc]) 1); |
1391 DERIV_quotient] delsimps [realpow_Suc]) 1); |
1392 qed "NSDERIV_quotient"; |
1392 qed "NSDERIV_quotient"; |
1393 |
1393 |
1394 (* ------------------------------------------------------------------------ *) |
1394 (* ------------------------------------------------------------------------ *) |
1542 by (induct_tac "n" 1); |
1542 by (induct_tac "n" 1); |
1543 by (auto_tac (claset(), |
1543 by (auto_tac (claset(), |
1544 simpset() addsimps [Bolzano_bisect_le, Let_def, split_def])); |
1544 simpset() addsimps [Bolzano_bisect_le, Let_def, split_def])); |
1545 qed "Bolzano_bisect_Suc_le_snd"; |
1545 qed "Bolzano_bisect_Suc_le_snd"; |
1546 |
1546 |
1547 Goal "((x::real) = y / (#2 * z)) = (#2 * x = y/z)"; |
1547 Goal "((x::real) = y / (# 2 * z)) = (# 2 * x = y/z)"; |
1548 by Auto_tac; |
1548 by Auto_tac; |
1549 by (dres_inst_tac [("f","%u. (#1/#2)*u")] arg_cong 1); |
1549 by (dres_inst_tac [("f","%u. (Numeral1/# 2)*u")] arg_cong 1); |
1550 by Auto_tac; |
1550 by Auto_tac; |
1551 qed "eq_divide_2_times_iff"; |
1551 qed "eq_divide_2_times_iff"; |
1552 |
1552 |
1553 Goal "a \\<le> b ==> \ |
1553 Goal "a \\<le> b ==> \ |
1554 \ snd(Bolzano_bisect P a b n) - fst(Bolzano_bisect P a b n) = \ |
1554 \ snd(Bolzano_bisect P a b n) - fst(Bolzano_bisect P a b n) = \ |
1555 \ (b-a) / (#2 ^ n)"; |
1555 \ (b-a) / (# 2 ^ n)"; |
1556 by (induct_tac "n" 1); |
1556 by (induct_tac "n" 1); |
1557 by (auto_tac (claset(), |
1557 by (auto_tac (claset(), |
1558 simpset() addsimps [eq_divide_2_times_iff, real_add_divide_distrib, |
1558 simpset() addsimps [eq_divide_2_times_iff, real_add_divide_distrib, |
1559 Let_def, split_def])); |
1559 Let_def, split_def])); |
1560 by (auto_tac (claset(), |
1560 by (auto_tac (claset(), |
1602 by (dtac not_P_Bolzano_bisect' 1); |
1602 by (dtac not_P_Bolzano_bisect' 1); |
1603 by (REPEAT (assume_tac 1)); |
1603 by (REPEAT (assume_tac 1)); |
1604 by (rename_tac "l" 1); |
1604 by (rename_tac "l" 1); |
1605 by (dres_inst_tac [("x","l")] spec 1 THEN Clarify_tac 1); |
1605 by (dres_inst_tac [("x","l")] spec 1 THEN Clarify_tac 1); |
1606 by (rewtac LIMSEQ_def); |
1606 by (rewtac LIMSEQ_def); |
1607 by (dres_inst_tac [("P", "%r. #0<r --> ?Q r"), ("x","d/#2")] spec 1); |
1607 by (dres_inst_tac [("P", "%r. Numeral0<r --> ?Q r"), ("x","d/# 2")] spec 1); |
1608 by (dres_inst_tac [("P", "%r. #0<r --> ?Q r"), ("x","d/#2")] spec 1); |
1608 by (dres_inst_tac [("P", "%r. Numeral0<r --> ?Q r"), ("x","d/# 2")] spec 1); |
1609 by (dtac real_less_half_sum 1); |
1609 by (dtac real_less_half_sum 1); |
1610 by Safe_tac; |
1610 by Safe_tac; |
1611 (*linear arithmetic bug if we just use Asm_simp_tac*) |
1611 (*linear arithmetic bug if we just use Asm_simp_tac*) |
1612 by (ALLGOALS Asm_full_simp_tac); |
1612 by (ALLGOALS Asm_full_simp_tac); |
1613 by (dres_inst_tac [("x","fst(Bolzano_bisect P a b (no + noa))")] spec 1); |
1613 by (dres_inst_tac [("x","fst(Bolzano_bisect P a b (no + noa))")] spec 1); |
1652 by (Blast_tac 2); |
1652 by (Blast_tac 2); |
1653 by (asm_full_simp_tac (simpset() addsimps [isCont_iff,LIM_def]) 1); |
1653 by (asm_full_simp_tac (simpset() addsimps [isCont_iff,LIM_def]) 1); |
1654 by (rtac ccontr 1); |
1654 by (rtac ccontr 1); |
1655 by (subgoal_tac "a \\<le> x & x \\<le> b" 1); |
1655 by (subgoal_tac "a \\<le> x & x \\<le> b" 1); |
1656 by (Asm_full_simp_tac 2); |
1656 by (Asm_full_simp_tac 2); |
1657 by (dres_inst_tac [("P", "%d. #0<d --> ?P d"),("x","#1")] spec 2); |
1657 by (dres_inst_tac [("P", "%d. Numeral0<d --> ?P d"),("x","Numeral1")] spec 2); |
1658 by (Step_tac 2); |
1658 by (Step_tac 2); |
1659 by (Asm_full_simp_tac 2); |
1659 by (Asm_full_simp_tac 2); |
1660 by (Asm_full_simp_tac 2); |
1660 by (Asm_full_simp_tac 2); |
1661 by (REPEAT(blast_tac (claset() addIs [order_trans]) 2)); |
1661 by (REPEAT(blast_tac (claset() addIs [order_trans]) 2)); |
1662 by (REPEAT(dres_inst_tac [("x","x")] spec 1)); |
1662 by (REPEAT(dres_inst_tac [("x","x")] spec 1)); |
1663 by (Asm_full_simp_tac 1); |
1663 by (Asm_full_simp_tac 1); |
1664 by (dres_inst_tac [("P", "%r. ?P r --> (\\<exists>s. #0<s & ?Q r s)"), |
1664 by (dres_inst_tac [("P", "%r. ?P r --> (\\<exists>s. Numeral0<s & ?Q r s)"), |
1665 ("x","abs(y - f x)")] spec 1); |
1665 ("x","abs(y - f x)")] spec 1); |
1666 by Safe_tac; |
1666 by Safe_tac; |
1667 by (asm_full_simp_tac (simpset() addsimps []) 1); |
1667 by (asm_full_simp_tac (simpset() addsimps []) 1); |
1668 by (dres_inst_tac [("x","s")] spec 1); |
1668 by (dres_inst_tac [("x","s")] spec 1); |
1669 by (Clarify_tac 1); |
1669 by (Clarify_tac 1); |
1736 by (res_inst_tac [("x","M")] exI 1); |
1736 by (res_inst_tac [("x","M")] exI 1); |
1737 by (Clarify_tac 1); |
1737 by (Clarify_tac 1); |
1738 by (cut_inst_tac [("x","xb"),("y","xa")] linorder_linear 1); |
1738 by (cut_inst_tac [("x","xb"),("y","xa")] linorder_linear 1); |
1739 by (Force_tac 1); |
1739 by (Force_tac 1); |
1740 by (case_tac "a \\<le> x & x \\<le> b" 1); |
1740 by (case_tac "a \\<le> x & x \\<le> b" 1); |
1741 by (res_inst_tac [("x","#1")] exI 2); |
1741 by (res_inst_tac [("x","Numeral1")] exI 2); |
1742 by (Force_tac 2); |
1742 by (Force_tac 2); |
1743 by (asm_full_simp_tac (simpset() addsimps [LIM_def,isCont_iff]) 1); |
1743 by (asm_full_simp_tac (simpset() addsimps [LIM_def,isCont_iff]) 1); |
1744 by (dres_inst_tac [("x","x")] spec 1 THEN Auto_tac); |
1744 by (dres_inst_tac [("x","x")] spec 1 THEN Auto_tac); |
1745 by (thin_tac "\\<forall>M. \\<exists>x. a \\<le> x & x \\<le> b & ~ f x \\<le> M" 1); |
1745 by (thin_tac "\\<forall>M. \\<exists>x. a \\<le> x & x \\<le> b & ~ f x \\<le> M" 1); |
1746 by (dres_inst_tac [("x","#1")] spec 1); |
1746 by (dres_inst_tac [("x","Numeral1")] spec 1); |
1747 by Auto_tac; |
1747 by Auto_tac; |
1748 by (res_inst_tac [("x","s")] exI 1 THEN Clarify_tac 1); |
1748 by (res_inst_tac [("x","s")] exI 1 THEN Clarify_tac 1); |
1749 by (res_inst_tac [("x","abs(f x) + #1")] exI 1 THEN Clarify_tac 1); |
1749 by (res_inst_tac [("x","abs(f x) + Numeral1")] exI 1 THEN Clarify_tac 1); |
1750 by (dres_inst_tac [("x","xa - x")] spec 1 THEN Safe_tac); |
1750 by (dres_inst_tac [("x","xa - x")] spec 1 THEN Safe_tac); |
1751 by (arith_tac 1); |
1751 by (arith_tac 1); |
1752 by (arith_tac 1); |
1752 by (arith_tac 1); |
1753 by (asm_full_simp_tac (simpset() addsimps [abs_ge_self]) 1); |
1753 by (asm_full_simp_tac (simpset() addsimps [abs_ge_self]) 1); |
1754 by (arith_tac 1); |
1754 by (arith_tac 1); |
1801 by (Blast_tac 2); |
1801 by (Blast_tac 2); |
1802 by (subgoal_tac |
1802 by (subgoal_tac |
1803 "\\<exists>k. \\<forall>x. a \\<le> x & x \\<le> b --> (%x. inverse(M - (f x))) x \\<le> k" 1); |
1803 "\\<exists>k. \\<forall>x. a \\<le> x & x \\<le> b --> (%x. inverse(M - (f x))) x \\<le> k" 1); |
1804 by (rtac isCont_bounded 2); |
1804 by (rtac isCont_bounded 2); |
1805 by Safe_tac; |
1805 by Safe_tac; |
1806 by (subgoal_tac "\\<forall>x. a \\<le> x & x \\<le> b --> #0 < inverse(M - f(x))" 1); |
1806 by (subgoal_tac "\\<forall>x. a \\<le> x & x \\<le> b --> Numeral0 < inverse(M - f(x))" 1); |
1807 by (Asm_full_simp_tac 1); |
1807 by (Asm_full_simp_tac 1); |
1808 by Safe_tac; |
1808 by Safe_tac; |
1809 by (asm_full_simp_tac (simpset() addsimps [real_less_diff_eq]) 2); |
1809 by (asm_full_simp_tac (simpset() addsimps [real_less_diff_eq]) 2); |
1810 by (subgoal_tac |
1810 by (subgoal_tac |
1811 "\\<forall>x. a \\<le> x & x \\<le> b --> (%x. inverse(M - (f x))) x < (k + #1)" 1); |
1811 "\\<forall>x. a \\<le> x & x \\<le> b --> (%x. inverse(M - (f x))) x < (k + Numeral1)" 1); |
1812 by Safe_tac; |
1812 by Safe_tac; |
1813 by (res_inst_tac [("y","k")] order_le_less_trans 2); |
1813 by (res_inst_tac [("y","k")] order_le_less_trans 2); |
1814 by (asm_full_simp_tac (simpset() addsimps [real_zero_less_one]) 3); |
1814 by (asm_full_simp_tac (simpset() addsimps [real_zero_less_one]) 3); |
1815 by (Asm_full_simp_tac 2); |
1815 by (Asm_full_simp_tac 2); |
1816 by (subgoal_tac "\\<forall>x. a \\<le> x & x \\<le> b --> \ |
1816 by (subgoal_tac "\\<forall>x. a \\<le> x & x \\<le> b --> \ |
1817 \ inverse(k + #1) < inverse((%x. inverse(M - (f x))) x)" 1); |
1817 \ inverse(k + Numeral1) < inverse((%x. inverse(M - (f x))) x)" 1); |
1818 by Safe_tac; |
1818 by Safe_tac; |
1819 by (rtac real_inverse_less_swap 2); |
1819 by (rtac real_inverse_less_swap 2); |
1820 by (ALLGOALS Asm_full_simp_tac); |
1820 by (ALLGOALS Asm_full_simp_tac); |
1821 by (dres_inst_tac [("P", "%N. N<M --> ?Q N"), |
1821 by (dres_inst_tac [("P", "%N. N<M --> ?Q N"), |
1822 ("x","M - inverse(k + #1)")] spec 1); |
1822 ("x","M - inverse(k + Numeral1)")] spec 1); |
1823 by (Step_tac 1 THEN dtac real_leI 1); |
1823 by (Step_tac 1 THEN dtac real_leI 1); |
1824 by (dtac (real_le_diff_eq RS iffD1) 1); |
1824 by (dtac (real_le_diff_eq RS iffD1) 1); |
1825 by (REPEAT(dres_inst_tac [("x","a")] spec 1)); |
1825 by (REPEAT(dres_inst_tac [("x","a")] spec 1)); |
1826 by (Asm_full_simp_tac 1); |
1826 by (Asm_full_simp_tac 1); |
1827 by (asm_full_simp_tac |
1827 by (asm_full_simp_tac |
1877 (*----------------------------------------------------------------------------*) |
1877 (*----------------------------------------------------------------------------*) |
1878 (* If f'(x) > 0 then x is locally strictly increasing at the right *) |
1878 (* If f'(x) > 0 then x is locally strictly increasing at the right *) |
1879 (*----------------------------------------------------------------------------*) |
1879 (*----------------------------------------------------------------------------*) |
1880 |
1880 |
1881 Goalw [deriv_def,LIM_def] |
1881 Goalw [deriv_def,LIM_def] |
1882 "[| DERIV f x :> l; #0 < l |] ==> \ |
1882 "[| DERIV f x :> l; Numeral0 < l |] ==> \ |
1883 \ \\<exists>d. #0 < d & (\\<forall>h. #0 < h & h < d --> f(x) < f(x + h))"; |
1883 \ \\<exists>d. Numeral0 < d & (\\<forall>h. Numeral0 < h & h < d --> f(x) < f(x + h))"; |
1884 by (dtac spec 1 THEN Auto_tac); |
1884 by (dtac spec 1 THEN Auto_tac); |
1885 by (res_inst_tac [("x","s")] exI 1 THEN Auto_tac); |
1885 by (res_inst_tac [("x","s")] exI 1 THEN Auto_tac); |
1886 by (subgoal_tac "#0 < l*h" 1); |
1886 by (subgoal_tac "Numeral0 < l*h" 1); |
1887 by (asm_full_simp_tac (simpset() addsimps [real_0_less_mult_iff]) 2); |
1887 by (asm_full_simp_tac (simpset() addsimps [real_0_less_mult_iff]) 2); |
1888 by (dres_inst_tac [("x","h")] spec 1); |
1888 by (dres_inst_tac [("x","h")] spec 1); |
1889 by (asm_full_simp_tac |
1889 by (asm_full_simp_tac |
1890 (simpset() addsimps [real_abs_def, real_inverse_eq_divide, |
1890 (simpset() addsimps [real_abs_def, real_inverse_eq_divide, |
1891 pos_real_le_divide_eq, pos_real_less_divide_eq] |
1891 pos_real_le_divide_eq, pos_real_less_divide_eq] |
1892 addsplits [split_if_asm]) 1); |
1892 addsplits [split_if_asm]) 1); |
1893 qed "DERIV_left_inc"; |
1893 qed "DERIV_left_inc"; |
1894 |
1894 |
1895 Goalw [deriv_def,LIM_def] |
1895 Goalw [deriv_def,LIM_def] |
1896 "[| DERIV f x :> l; l < #0 |] ==> \ |
1896 "[| DERIV f x :> l; l < Numeral0 |] ==> \ |
1897 \ \\<exists>d. #0 < d & (\\<forall>h. #0 < h & h < d --> f(x) < f(x - h))"; |
1897 \ \\<exists>d. Numeral0 < d & (\\<forall>h. Numeral0 < h & h < d --> f(x) < f(x - h))"; |
1898 by (dres_inst_tac [("x","-l")] spec 1 THEN Auto_tac); |
1898 by (dres_inst_tac [("x","-l")] spec 1 THEN Auto_tac); |
1899 by (res_inst_tac [("x","s")] exI 1 THEN Auto_tac); |
1899 by (res_inst_tac [("x","s")] exI 1 THEN Auto_tac); |
1900 by (subgoal_tac "l*h < #0" 1); |
1900 by (subgoal_tac "l*h < Numeral0" 1); |
1901 by (asm_full_simp_tac (simpset() addsimps [real_mult_less_0_iff]) 2); |
1901 by (asm_full_simp_tac (simpset() addsimps [real_mult_less_0_iff]) 2); |
1902 by (dres_inst_tac [("x","-h")] spec 1); |
1902 by (dres_inst_tac [("x","-h")] spec 1); |
1903 by (asm_full_simp_tac |
1903 by (asm_full_simp_tac |
1904 (simpset() addsimps [real_abs_def, real_inverse_eq_divide, |
1904 (simpset() addsimps [real_abs_def, real_inverse_eq_divide, |
1905 pos_real_less_divide_eq, |
1905 pos_real_less_divide_eq, |
1906 symmetric real_diff_def] |
1906 symmetric real_diff_def] |
1907 addsplits [split_if_asm]) 1); |
1907 addsplits [split_if_asm]) 1); |
1908 by (subgoal_tac "#0 < (f (x - h) - f x)/h" 1); |
1908 by (subgoal_tac "Numeral0 < (f (x - h) - f x)/h" 1); |
1909 by (arith_tac 2); |
1909 by (arith_tac 2); |
1910 by (asm_full_simp_tac |
1910 by (asm_full_simp_tac |
1911 (simpset() addsimps [pos_real_less_divide_eq]) 1); |
1911 (simpset() addsimps [pos_real_less_divide_eq]) 1); |
1912 qed "DERIV_left_dec"; |
1912 qed "DERIV_left_dec"; |
1913 |
1913 |
1914 |
1914 |
1915 Goal "[| DERIV f x :> l; \ |
1915 Goal "[| DERIV f x :> l; \ |
1916 \ \\<exists>d. #0 < d & (\\<forall>y. abs(x - y) < d --> f(y) \\<le> f(x)) |] \ |
1916 \ \\<exists>d. Numeral0 < d & (\\<forall>y. abs(x - y) < d --> f(y) \\<le> f(x)) |] \ |
1917 \ ==> l = #0"; |
1917 \ ==> l = Numeral0"; |
1918 by (res_inst_tac [("R1.0","l"),("R2.0","#0")] real_linear_less2 1); |
1918 by (res_inst_tac [("R1.0","l"),("R2.0","Numeral0")] real_linear_less2 1); |
1919 by Safe_tac; |
1919 by Safe_tac; |
1920 by (dtac DERIV_left_dec 1); |
1920 by (dtac DERIV_left_dec 1); |
1921 by (dtac DERIV_left_inc 3); |
1921 by (dtac DERIV_left_inc 3); |
1922 by Safe_tac; |
1922 by Safe_tac; |
1923 by (dres_inst_tac [("d1.0","d"),("d2.0","da")] real_lbound_gt_zero 1); |
1923 by (dres_inst_tac [("d1.0","d"),("d2.0","da")] real_lbound_gt_zero 1); |
1931 (*----------------------------------------------------------------------------*) |
1931 (*----------------------------------------------------------------------------*) |
1932 (* Similar theorem for a local minimum *) |
1932 (* Similar theorem for a local minimum *) |
1933 (*----------------------------------------------------------------------------*) |
1933 (*----------------------------------------------------------------------------*) |
1934 |
1934 |
1935 Goal "[| DERIV f x :> l; \ |
1935 Goal "[| DERIV f x :> l; \ |
1936 \ \\<exists>d::real. #0 < d & (\\<forall>y. abs(x - y) < d --> f(x) \\<le> f(y)) |] \ |
1936 \ \\<exists>d::real. Numeral0 < d & (\\<forall>y. abs(x - y) < d --> f(x) \\<le> f(y)) |] \ |
1937 \ ==> l = #0"; |
1937 \ ==> l = Numeral0"; |
1938 by (dtac (DERIV_minus RS DERIV_local_max) 1); |
1938 by (dtac (DERIV_minus RS DERIV_local_max) 1); |
1939 by Auto_tac; |
1939 by Auto_tac; |
1940 qed "DERIV_local_min"; |
1940 qed "DERIV_local_min"; |
1941 |
1941 |
1942 (*----------------------------------------------------------------------------*) |
1942 (*----------------------------------------------------------------------------*) |
1943 (* In particular if a function is locally flat *) |
1943 (* In particular if a function is locally flat *) |
1944 (*----------------------------------------------------------------------------*) |
1944 (*----------------------------------------------------------------------------*) |
1945 |
1945 |
1946 Goal "[| DERIV f x :> l; \ |
1946 Goal "[| DERIV f x :> l; \ |
1947 \ \\<exists>d. #0 < d & (\\<forall>y. abs(x - y) < d --> f(x) = f(y)) |] \ |
1947 \ \\<exists>d. Numeral0 < d & (\\<forall>y. abs(x - y) < d --> f(x) = f(y)) |] \ |
1948 \ ==> l = #0"; |
1948 \ ==> l = Numeral0"; |
1949 by (auto_tac (claset() addSDs [DERIV_local_max],simpset())); |
1949 by (auto_tac (claset() addSDs [DERIV_local_max],simpset())); |
1950 qed "DERIV_local_const"; |
1950 qed "DERIV_local_const"; |
1951 |
1951 |
1952 (*----------------------------------------------------------------------------*) |
1952 (*----------------------------------------------------------------------------*) |
1953 (* Lemma about introducing open ball in open interval *) |
1953 (* Lemma about introducing open ball in open interval *) |
1954 (*----------------------------------------------------------------------------*) |
1954 (*----------------------------------------------------------------------------*) |
1955 |
1955 |
1956 Goal "[| a < x; x < b |] ==> \ |
1956 Goal "[| a < x; x < b |] ==> \ |
1957 \ \\<exists>d::real. #0 < d & (\\<forall>y. abs(x - y) < d --> a < y & y < b)"; |
1957 \ \\<exists>d::real. Numeral0 < d & (\\<forall>y. abs(x - y) < d --> a < y & y < b)"; |
1958 by (simp_tac (simpset() addsimps [abs_interval_iff]) 1); |
1958 by (simp_tac (simpset() addsimps [abs_interval_iff]) 1); |
1959 by (cut_inst_tac [("x","x - a"),("y","b - x")] linorder_linear 1); |
1959 by (cut_inst_tac [("x","x - a"),("y","b - x")] linorder_linear 1); |
1960 by Safe_tac; |
1960 by Safe_tac; |
1961 by (res_inst_tac [("x","x - a")] exI 1); |
1961 by (res_inst_tac [("x","x - a")] exI 1); |
1962 by (res_inst_tac [("x","b - x")] exI 2); |
1962 by (res_inst_tac [("x","b - x")] exI 2); |
1963 by Auto_tac; |
1963 by Auto_tac; |
1964 by (auto_tac (claset(),simpset() addsimps [real_less_diff_eq])); |
1964 by (auto_tac (claset(),simpset() addsimps [real_less_diff_eq])); |
1965 qed "lemma_interval_lt"; |
1965 qed "lemma_interval_lt"; |
1966 |
1966 |
1967 Goal "[| a < x; x < b |] ==> \ |
1967 Goal "[| a < x; x < b |] ==> \ |
1968 \ \\<exists>d::real. #0 < d & (\\<forall>y. abs(x - y) < d --> a \\<le> y & y \\<le> b)"; |
1968 \ \\<exists>d::real. Numeral0 < d & (\\<forall>y. abs(x - y) < d --> a \\<le> y & y \\<le> b)"; |
1969 by (dtac lemma_interval_lt 1); |
1969 by (dtac lemma_interval_lt 1); |
1970 by Auto_tac; |
1970 by Auto_tac; |
1971 by (auto_tac (claset() addSIs [exI] ,simpset())); |
1971 by (auto_tac (claset() addSIs [exI] ,simpset())); |
1972 qed "lemma_interval"; |
1972 qed "lemma_interval"; |
1973 |
1973 |
1974 (*----------------------------------------------------------------------- |
1974 (*----------------------------------------------------------------------- |
1975 Rolle's Theorem |
1975 Rolle's Theorem |
1976 If f is defined and continuous on the finite closed interval [a,b] |
1976 If f is defined and continuous on the finite closed interval [a,b] |
1977 and differentiable a least on the open interval (a,b), and f(a) = f(b), |
1977 and differentiable a least on the open interval (a,b), and f(a) = f(b), |
1978 then x0 \\<in> (a,b) such that f'(x0) = #0 |
1978 then x0 \\<in> (a,b) such that f'(x0) = Numeral0 |
1979 ----------------------------------------------------------------------*) |
1979 ----------------------------------------------------------------------*) |
1980 |
1980 |
1981 Goal "[| a < b; f(a) = f(b); \ |
1981 Goal "[| a < b; f(a) = f(b); \ |
1982 \ \\<forall>x. a \\<le> x & x \\<le> b --> isCont f x; \ |
1982 \ \\<forall>x. a \\<le> x & x \\<le> b --> isCont f x; \ |
1983 \ \\<forall>x. a < x & x < b --> f differentiable x \ |
1983 \ \\<forall>x. a < x & x < b --> f differentiable x \ |
1984 \ |] ==> \\<exists>z. a < z & z < b & DERIV f z :> #0"; |
1984 \ |] ==> \\<exists>z. a < z & z < b & DERIV f z :> Numeral0"; |
1985 by (ftac (order_less_imp_le RS isCont_eq_Ub) 1); |
1985 by (ftac (order_less_imp_le RS isCont_eq_Ub) 1); |
1986 by (EVERY1[assume_tac,Step_tac]); |
1986 by (EVERY1[assume_tac,Step_tac]); |
1987 by (ftac (order_less_imp_le RS isCont_eq_Lb) 1); |
1987 by (ftac (order_less_imp_le RS isCont_eq_Lb) 1); |
1988 by (EVERY1[assume_tac,Step_tac]); |
1988 by (EVERY1[assume_tac,Step_tac]); |
1989 by (case_tac "a < x & x < b" 1 THEN etac conjE 1); |
1989 by (case_tac "a < x & x < b" 1 THEN etac conjE 1); |
1990 by (Asm_full_simp_tac 2); |
1990 by (Asm_full_simp_tac 2); |
1991 by (forw_inst_tac [("a","a"),("x","x")] lemma_interval 1); |
1991 by (forw_inst_tac [("a","a"),("x","x")] lemma_interval 1); |
1992 by (EVERY1[assume_tac,etac exE]); |
1992 by (EVERY1[assume_tac,etac exE]); |
1993 by (res_inst_tac [("x","x")] exI 1 THEN Asm_full_simp_tac 1); |
1993 by (res_inst_tac [("x","x")] exI 1 THEN Asm_full_simp_tac 1); |
1994 by (subgoal_tac "(\\<exists>l. DERIV f x :> l) & \ |
1994 by (subgoal_tac "(\\<exists>l. DERIV f x :> l) & \ |
1995 \ (\\<exists>d. #0 < d & (\\<forall>y. abs(x - y) < d --> f(y) \\<le> f(x)))" 1); |
1995 \ (\\<exists>d. Numeral0 < d & (\\<forall>y. abs(x - y) < d --> f(y) \\<le> f(x)))" 1); |
1996 by (Clarify_tac 1 THEN rtac conjI 2); |
1996 by (Clarify_tac 1 THEN rtac conjI 2); |
1997 by (blast_tac (claset() addIs [differentiableD]) 2); |
1997 by (blast_tac (claset() addIs [differentiableD]) 2); |
1998 by (Blast_tac 2); |
1998 by (Blast_tac 2); |
1999 by (ftac DERIV_local_max 1); |
1999 by (ftac DERIV_local_max 1); |
2000 by (EVERY1[Blast_tac,Blast_tac]); |
2000 by (EVERY1[Blast_tac,Blast_tac]); |
2028 by (res_inst_tac [("x","r")] exI 1 THEN Asm_full_simp_tac 1); |
2028 by (res_inst_tac [("x","r")] exI 1 THEN Asm_full_simp_tac 1); |
2029 by (etac conjE 1); |
2029 by (etac conjE 1); |
2030 by (forw_inst_tac [("a","a"),("x","r")] lemma_interval 1); |
2030 by (forw_inst_tac [("a","a"),("x","r")] lemma_interval 1); |
2031 by (EVERY1[assume_tac, etac exE]); |
2031 by (EVERY1[assume_tac, etac exE]); |
2032 by (subgoal_tac "(\\<exists>l. DERIV f r :> l) & \ |
2032 by (subgoal_tac "(\\<exists>l. DERIV f r :> l) & \ |
2033 \ (\\<exists>d. #0 < d & (\\<forall>y. abs(r - y) < d --> f(r) = f(y)))" 1); |
2033 \ (\\<exists>d. Numeral0 < d & (\\<forall>y. abs(r - y) < d --> f(r) = f(y)))" 1); |
2034 by (Clarify_tac 1 THEN rtac conjI 2); |
2034 by (Clarify_tac 1 THEN rtac conjI 2); |
2035 by (blast_tac (claset() addIs [differentiableD]) 2); |
2035 by (blast_tac (claset() addIs [differentiableD]) 2); |
2036 by (EVERY1[ftac DERIV_local_const, Blast_tac, Blast_tac]); |
2036 by (EVERY1[ftac DERIV_local_const, Blast_tac, Blast_tac]); |
2037 by (res_inst_tac [("x","d")] exI 1); |
2037 by (res_inst_tac [("x","d")] exI 1); |
2038 by (EVERY1[rtac conjI, Blast_tac, rtac allI, rtac impI]); |
2038 by (EVERY1[rtac conjI, Blast_tac, rtac allI, rtac impI]); |
2096 (* Theorem that function is constant if its derivative is 0 over an interval. *) |
2096 (* Theorem that function is constant if its derivative is 0 over an interval. *) |
2097 (*----------------------------------------------------------------------------*) |
2097 (*----------------------------------------------------------------------------*) |
2098 |
2098 |
2099 Goal "[| a < b; \ |
2099 Goal "[| a < b; \ |
2100 \ \\<forall>x. a \\<le> x & x \\<le> b --> isCont f x; \ |
2100 \ \\<forall>x. a \\<le> x & x \\<le> b --> isCont f x; \ |
2101 \ \\<forall>x. a < x & x < b --> DERIV f x :> #0 |] \ |
2101 \ \\<forall>x. a < x & x < b --> DERIV f x :> Numeral0 |] \ |
2102 \ ==> (f b = f a)"; |
2102 \ ==> (f b = f a)"; |
2103 by (dtac MVT 1 THEN assume_tac 1); |
2103 by (dtac MVT 1 THEN assume_tac 1); |
2104 by (blast_tac (claset() addIs [differentiableI]) 1); |
2104 by (blast_tac (claset() addIs [differentiableI]) 1); |
2105 by (auto_tac (claset() addSDs [DERIV_unique],simpset() |
2105 by (auto_tac (claset() addSDs [DERIV_unique],simpset() |
2106 addsimps [real_diff_eq_eq])); |
2106 addsimps [real_diff_eq_eq])); |
2107 qed "DERIV_isconst_end"; |
2107 qed "DERIV_isconst_end"; |
2108 |
2108 |
2109 Goal "[| a < b; \ |
2109 Goal "[| a < b; \ |
2110 \ \\<forall>x. a \\<le> x & x \\<le> b --> isCont f x; \ |
2110 \ \\<forall>x. a \\<le> x & x \\<le> b --> isCont f x; \ |
2111 \ \\<forall>x. a < x & x < b --> DERIV f x :> #0 |] \ |
2111 \ \\<forall>x. a < x & x < b --> DERIV f x :> Numeral0 |] \ |
2112 \ ==> \\<forall>x. a \\<le> x & x \\<le> b --> f x = f a"; |
2112 \ ==> \\<forall>x. a \\<le> x & x \\<le> b --> f x = f a"; |
2113 by Safe_tac; |
2113 by Safe_tac; |
2114 by (dres_inst_tac [("x","a")] order_le_imp_less_or_eq 1); |
2114 by (dres_inst_tac [("x","a")] order_le_imp_less_or_eq 1); |
2115 by Safe_tac; |
2115 by Safe_tac; |
2116 by (dres_inst_tac [("b","x")] DERIV_isconst_end 1); |
2116 by (dres_inst_tac [("b","x")] DERIV_isconst_end 1); |
2117 by Auto_tac; |
2117 by Auto_tac; |
2118 qed "DERIV_isconst1"; |
2118 qed "DERIV_isconst1"; |
2119 |
2119 |
2120 Goal "[| a < b; \ |
2120 Goal "[| a < b; \ |
2121 \ \\<forall>x. a \\<le> x & x \\<le> b --> isCont f x; \ |
2121 \ \\<forall>x. a \\<le> x & x \\<le> b --> isCont f x; \ |
2122 \ \\<forall>x. a < x & x < b --> DERIV f x :> #0; \ |
2122 \ \\<forall>x. a < x & x < b --> DERIV f x :> Numeral0; \ |
2123 \ a \\<le> x; x \\<le> b |] \ |
2123 \ a \\<le> x; x \\<le> b |] \ |
2124 \ ==> f x = f a"; |
2124 \ ==> f x = f a"; |
2125 by (blast_tac (claset() addDs [DERIV_isconst1]) 1); |
2125 by (blast_tac (claset() addDs [DERIV_isconst1]) 1); |
2126 qed "DERIV_isconst2"; |
2126 qed "DERIV_isconst2"; |
2127 |
2127 |
2128 Goal "\\<forall>x. DERIV f x :> #0 ==> f(x) = f(y)"; |
2128 Goal "\\<forall>x. DERIV f x :> Numeral0 ==> f(x) = f(y)"; |
2129 by (res_inst_tac [("R1.0","x"),("R2.0","y")] real_linear_less2 1); |
2129 by (res_inst_tac [("R1.0","x"),("R2.0","y")] real_linear_less2 1); |
2130 by (rtac sym 1); |
2130 by (rtac sym 1); |
2131 by (auto_tac (claset() addIs [DERIV_isCont,DERIV_isconst_end],simpset())); |
2131 by (auto_tac (claset() addIs [DERIV_isCont,DERIV_isconst_end],simpset())); |
2132 qed "DERIV_isconst_all"; |
2132 qed "DERIV_isconst_all"; |
2133 |
2133 |
2146 by (res_inst_tac [("c1","b - a")] (real_mult_right_cancel RS iffD1) 1); |
2146 by (res_inst_tac [("c1","b - a")] (real_mult_right_cancel RS iffD1) 1); |
2147 by (auto_tac (claset() addSDs [DERIV_const_ratio_const], |
2147 by (auto_tac (claset() addSDs [DERIV_const_ratio_const], |
2148 simpset() addsimps [real_mult_assoc])); |
2148 simpset() addsimps [real_mult_assoc])); |
2149 qed "DERIV_const_ratio_const2"; |
2149 qed "DERIV_const_ratio_const2"; |
2150 |
2150 |
2151 Goal "((a + b) /#2 - a) = (b - a)/(#2::real)"; |
2151 Goal "((a + b) /# 2 - a) = (b - a)/(# 2::real)"; |
2152 by Auto_tac; |
2152 by Auto_tac; |
2153 qed "real_average_minus_first"; |
2153 qed "real_average_minus_first"; |
2154 Addsimps [real_average_minus_first]; |
2154 Addsimps [real_average_minus_first]; |
2155 |
2155 |
2156 Goal "((b + a)/#2 - a) = (b - a)/(#2::real)"; |
2156 Goal "((b + a)/# 2 - a) = (b - a)/(# 2::real)"; |
2157 by Auto_tac; |
2157 by Auto_tac; |
2158 qed "real_average_minus_second"; |
2158 qed "real_average_minus_second"; |
2159 Addsimps [real_average_minus_second]; |
2159 Addsimps [real_average_minus_second]; |
2160 |
2160 |
2161 |
2161 |
2162 (* Gallileo's "trick": average velocity = av. of end velocities *) |
2162 (* Gallileo's "trick": average velocity = av. of end velocities *) |
2163 Goal "[|a \\<noteq> (b::real); \\<forall>x. DERIV v x :> k|] \ |
2163 Goal "[|a \\<noteq> (b::real); \\<forall>x. DERIV v x :> k|] \ |
2164 \ ==> v((a + b)/#2) = (v a + v b)/#2"; |
2164 \ ==> v((a + b)/# 2) = (v a + v b)/# 2"; |
2165 by (res_inst_tac [("R1.0","a"),("R2.0","b")] real_linear_less2 1); |
2165 by (res_inst_tac [("R1.0","a"),("R2.0","b")] real_linear_less2 1); |
2166 by Auto_tac; |
2166 by Auto_tac; |
2167 by (ftac DERIV_const_ratio_const2 1 THEN assume_tac 1); |
2167 by (ftac DERIV_const_ratio_const2 1 THEN assume_tac 1); |
2168 by (ftac DERIV_const_ratio_const2 2 THEN assume_tac 2); |
2168 by (ftac DERIV_const_ratio_const2 2 THEN assume_tac 2); |
2169 by (dtac real_less_half_sum 1); |
2169 by (dtac real_less_half_sum 1); |
2219 |
2219 |
2220 (* ------------------------------------------------------------------------ *) |
2220 (* ------------------------------------------------------------------------ *) |
2221 (* Similar version for lower bound *) |
2221 (* Similar version for lower bound *) |
2222 (* ------------------------------------------------------------------------ *) |
2222 (* ------------------------------------------------------------------------ *) |
2223 |
2223 |
2224 Goal "[|#0 < d; \\<forall>z. abs(z - x) \\<le> d --> g(f z) = z; \ |
2224 Goal "[|Numeral0 < d; \\<forall>z. abs(z - x) \\<le> d --> g(f z) = z; \ |
2225 \ \\<forall>z. abs(z - x) \\<le> d --> isCont f z |] \ |
2225 \ \\<forall>z. abs(z - x) \\<le> d --> isCont f z |] \ |
2226 \ ==> ~(\\<forall>z. abs(z - x) \\<le> d --> f(x) \\<le> f(z))"; |
2226 \ ==> ~(\\<forall>z. abs(z - x) \\<le> d --> f(x) \\<le> f(z))"; |
2227 by (auto_tac (claset() addSDs [(asm_full_simplify (simpset()) |
2227 by (auto_tac (claset() addSDs [(asm_full_simplify (simpset()) |
2228 (read_instantiate [("f","%x. - f x"),("g","%y. g(-y)"),("x","x"),("d","d")] |
2228 (read_instantiate [("f","%x. - f x"),("g","%y. g(-y)"),("x","x"),("d","d")] |
2229 lemma_isCont_inj))],simpset() addsimps [isCont_minus])); |
2229 lemma_isCont_inj))],simpset() addsimps [isCont_minus])); |