45 by (simp add: deriv_def) |
45 by (simp add: deriv_def) |
46 |
46 |
47 lemma DERIV_const [simp]: "DERIV (\<lambda>x. k) x :> 0" |
47 lemma DERIV_const [simp]: "DERIV (\<lambda>x. k) x :> 0" |
48 by (simp add: deriv_def) |
48 by (simp add: deriv_def) |
49 |
49 |
50 lemma DERIV_Id [simp]: "DERIV (\<lambda>x. x) x :> 1" |
50 lemma DERIV_ident [simp]: "DERIV (\<lambda>x. x) x :> 1" |
51 by (simp add: deriv_def divide_self cong: LIM_cong) |
51 by (simp add: deriv_def divide_self cong: LIM_cong) |
52 |
52 |
53 lemma add_diff_add: |
53 lemma add_diff_add: |
54 fixes a b c d :: "'a::ab_group_add" |
54 fixes a b c d :: "'a::ab_group_add" |
55 shows "(a + c) - (b + d) = (a - b) + (c - d)" |
55 shows "(a + c) - (b + d) = (a - b) + (c - d)" |
75 proof (unfold isCont_iff) |
75 proof (unfold isCont_iff) |
76 assume "DERIV f x :> D" |
76 assume "DERIV f x :> D" |
77 hence "(\<lambda>h. (f(x+h) - f(x)) / h) -- 0 --> D" |
77 hence "(\<lambda>h. (f(x+h) - f(x)) / h) -- 0 --> D" |
78 by (rule DERIV_D) |
78 by (rule DERIV_D) |
79 hence "(\<lambda>h. (f(x+h) - f(x)) / h * h) -- 0 --> D * 0" |
79 hence "(\<lambda>h. (f(x+h) - f(x)) / h * h) -- 0 --> D * 0" |
80 by (intro LIM_mult LIM_self) |
80 by (intro LIM_mult LIM_ident) |
81 hence "(\<lambda>h. (f(x+h) - f(x)) * (h / h)) -- 0 --> 0" |
81 hence "(\<lambda>h. (f(x+h) - f(x)) * (h / h)) -- 0 --> 0" |
82 by simp |
82 by simp |
83 hence "(\<lambda>h. f(x+h) - f(x)) -- 0 --> 0" |
83 hence "(\<lambda>h. f(x+h) - f(x)) -- 0 --> 0" |
84 by (simp cong: LIM_cong add: divide_self) |
84 by (simp cong: LIM_cong add: divide_self) |
85 thus "(\<lambda>h. f(x+h)) -- 0 --> f(x)" |
85 thus "(\<lambda>h. f(x+h)) -- 0 --> f(x)" |
294 lemma DERIV_chain2: "[| DERIV f (g x) :> Da; DERIV g x :> Db |] ==> DERIV (%x. f (g x)) x :> Da * Db" |
294 lemma DERIV_chain2: "[| DERIV f (g x) :> Da; DERIV g x :> Db |] ==> DERIV (%x. f (g x)) x :> Da * Db" |
295 by (auto dest: DERIV_chain simp add: o_def) |
295 by (auto dest: DERIV_chain simp add: o_def) |
296 |
296 |
297 (*derivative of linear multiplication*) |
297 (*derivative of linear multiplication*) |
298 lemma DERIV_cmult_Id [simp]: "DERIV (op * c) x :> c" |
298 lemma DERIV_cmult_Id [simp]: "DERIV (op * c) x :> c" |
299 by (cut_tac c = c and x = x in DERIV_Id [THEN DERIV_cmult], simp) |
299 by (cut_tac c = c and x = x in DERIV_ident [THEN DERIV_cmult], simp) |
300 |
300 |
301 lemma DERIV_pow: "DERIV (%x. x ^ n) x :> real n * (x ^ (n - Suc 0))" |
301 lemma DERIV_pow: "DERIV (%x. x ^ n) x :> real n * (x ^ (n - Suc 0))" |
302 apply (cut_tac DERIV_power [OF DERIV_Id]) |
302 apply (cut_tac DERIV_power [OF DERIV_ident]) |
303 apply (simp add: real_scaleR_def real_of_nat_def) |
303 apply (simp add: real_scaleR_def real_of_nat_def) |
304 done |
304 done |
305 |
305 |
306 text{*Power of -1*} |
306 text{*Power of -1*} |
307 |
307 |
308 lemma DERIV_inverse: |
308 lemma DERIV_inverse: |
309 fixes x :: "'a::{real_normed_field,recpower}" |
309 fixes x :: "'a::{real_normed_field,recpower}" |
310 shows "x \<noteq> 0 ==> DERIV (%x. inverse(x)) x :> (-(inverse x ^ Suc (Suc 0)))" |
310 shows "x \<noteq> 0 ==> DERIV (%x. inverse(x)) x :> (-(inverse x ^ Suc (Suc 0)))" |
311 by (drule DERIV_inverse' [OF DERIV_Id]) (simp add: power_Suc) |
311 by (drule DERIV_inverse' [OF DERIV_ident]) (simp add: power_Suc) |
312 |
312 |
313 text{*Derivative of inverse*} |
313 text{*Derivative of inverse*} |
314 lemma DERIV_inverse_fun: |
314 lemma DERIV_inverse_fun: |
315 fixes x :: "'a::{real_normed_field,recpower}" |
315 fixes x :: "'a::{real_normed_field,recpower}" |
316 shows "[| DERIV f x :> d; f(x) \<noteq> 0 |] |
316 shows "[| DERIV f x :> d; f(x) \<noteq> 0 |] |
983 shows "\<exists>l z::real. a < z & z < b & DERIV f z :> l & |
983 shows "\<exists>l z::real. a < z & z < b & DERIV f z :> l & |
984 (f(b) - f(a) = (b-a) * l)" |
984 (f(b) - f(a) = (b-a) * l)" |
985 proof - |
985 proof - |
986 let ?F = "%x. f x - ((f b - f a) / (b-a)) * x" |
986 let ?F = "%x. f x - ((f b - f a) / (b-a)) * x" |
987 have contF: "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont ?F x" using con |
987 have contF: "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont ?F x" using con |
988 by (fast intro: isCont_diff isCont_const isCont_mult isCont_Id) |
988 by (fast intro: isCont_diff isCont_const isCont_mult isCont_ident) |
989 have difF: "\<forall>x. a < x \<and> x < b \<longrightarrow> ?F differentiable x" |
989 have difF: "\<forall>x. a < x \<and> x < b \<longrightarrow> ?F differentiable x" |
990 proof (clarify) |
990 proof (clarify) |
991 fix x::real |
991 fix x::real |
992 assume ax: "a < x" and xb: "x < b" |
992 assume ax: "a < x" and xb: "x < b" |
993 from differentiableD [OF dif [OF conjI [OF ax xb]]] |
993 from differentiableD [OF dif [OF conjI [OF ax xb]]] |