869 apply (simp_all only: diffs_of_real scaleR_conv_of_real exp_fdiffs) |
869 apply (simp_all only: diffs_of_real scaleR_conv_of_real exp_fdiffs) |
870 apply (rule exp_converges [THEN sums_summable, unfolded scaleR_conv_of_real])+ |
870 apply (rule exp_converges [THEN sums_summable, unfolded scaleR_conv_of_real])+ |
871 apply (simp del: of_real_add) |
871 apply (simp del: of_real_add) |
872 done |
872 done |
873 |
873 |
874 lemma isCont_exp [simp]: "isCont exp x" |
874 lemma isCont_exp: "isCont exp x" |
875 by (rule DERIV_exp [THEN DERIV_isCont]) |
875 by (rule DERIV_exp [THEN DERIV_isCont]) |
|
876 |
|
877 lemma isCont_exp' [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. exp (f x)) a" |
|
878 by (rule isCont_o2 [OF _ isCont_exp]) |
|
879 |
|
880 lemma tendsto_exp [tendsto_intros]: |
|
881 "(f ---> a) F \<Longrightarrow> ((\<lambda>x. exp (f x)) ---> exp a) F" |
|
882 by (rule isCont_tendsto_compose [OF isCont_exp]) |
876 |
883 |
877 |
884 |
878 subsubsection {* Properties of the Exponential Function *} |
885 subsubsection {* Properties of the Exponential Function *} |
879 |
886 |
880 lemma powser_zero: |
887 lemma powser_zero: |
1269 apply (auto simp add: lemma_sin_minus cos_fdiffs2 [symmetric] minus_mult_left) |
1276 apply (auto simp add: lemma_sin_minus cos_fdiffs2 [symmetric] minus_mult_left) |
1270 apply (rule_tac K = "1 + \<bar>x\<bar>" in termdiffs) |
1277 apply (rule_tac K = "1 + \<bar>x\<bar>" in termdiffs) |
1271 apply (auto intro: sin_converges cos_converges sums_summable intro!: sums_minus [THEN sums_summable] simp add: cos_fdiffs sin_fdiffs diffs_minus) |
1278 apply (auto intro: sin_converges cos_converges sums_summable intro!: sums_minus [THEN sums_summable] simp add: cos_fdiffs sin_fdiffs diffs_minus) |
1272 done |
1279 done |
1273 |
1280 |
1274 lemma isCont_sin [simp]: "isCont sin x" |
1281 lemma isCont_sin: "isCont sin x" |
1275 by (rule DERIV_sin [THEN DERIV_isCont]) |
1282 by (rule DERIV_sin [THEN DERIV_isCont]) |
1276 |
1283 |
1277 lemma isCont_cos [simp]: "isCont cos x" |
1284 lemma isCont_cos: "isCont cos x" |
1278 by (rule DERIV_cos [THEN DERIV_isCont]) |
1285 by (rule DERIV_cos [THEN DERIV_isCont]) |
1279 |
1286 |
|
1287 lemma isCont_sin' [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. sin (f x)) a" |
|
1288 by (rule isCont_o2 [OF _ isCont_sin]) |
|
1289 |
|
1290 lemma isCont_cos' [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. cos (f x)) a" |
|
1291 by (rule isCont_o2 [OF _ isCont_cos]) |
|
1292 |
|
1293 lemma tendsto_sin [tendsto_intros]: |
|
1294 "(f ---> a) F \<Longrightarrow> ((\<lambda>x. sin (f x)) ---> sin a) F" |
|
1295 by (rule isCont_tendsto_compose [OF isCont_sin]) |
|
1296 |
|
1297 lemma tendsto_cos [tendsto_intros]: |
|
1298 "(f ---> a) F \<Longrightarrow> ((\<lambda>x. cos (f x)) ---> cos a) F" |
|
1299 by (rule isCont_tendsto_compose [OF isCont_cos]) |
1280 |
1300 |
1281 declare |
1301 declare |
1282 DERIV_exp[THEN DERIV_chain2, THEN DERIV_cong, DERIV_intros] |
1302 DERIV_exp[THEN DERIV_chain2, THEN DERIV_cong, DERIV_intros] |
1283 DERIV_ln_divide[THEN DERIV_chain2, THEN DERIV_cong, DERIV_intros] |
1303 DERIV_ln_divide[THEN DERIV_chain2, THEN DERIV_cong, DERIV_intros] |
1284 DERIV_sin[THEN DERIV_chain2, THEN DERIV_cong, DERIV_intros] |
1304 DERIV_sin[THEN DERIV_chain2, THEN DERIV_cong, DERIV_intros] |
1285 DERIV_cos[THEN DERIV_chain2, THEN DERIV_cong, DERIV_intros] |
1305 DERIV_cos[THEN DERIV_chain2, THEN DERIV_cong, DERIV_intros] |
1286 |
1306 |
1287 subsection {* Properties of Sine and Cosine *} |
1307 subsection {* Properties of Sine and Cosine *} |
1288 |
1308 |
1289 lemma sin_zero [simp]: "sin 0 = 0" |
1309 lemma sin_zero [simp]: "sin 0 = 0" |
1290 unfolding sin_def sin_coeff_def by (simp add: powser_zero) |
1310 unfolding sin_def sin_coeff_def by (simp add: powser_zero) |
1291 |
1311 |
1292 lemma cos_zero [simp]: "cos 0 = 1" |
1312 lemma cos_zero [simp]: "cos 0 = 1" |
1293 unfolding cos_def cos_coeff_def by (simp add: powser_zero) |
1313 unfolding cos_def cos_coeff_def by (simp add: powser_zero) |
1294 |
1314 |
1295 lemma lemma_DERIV_subst: "[| DERIV f x :> D; D = E |] ==> DERIV f x :> E" |
1315 lemma lemma_DERIV_subst: "[| DERIV f x :> D; D = E |] ==> DERIV f x :> E" |
1296 by (rule DERIV_cong) (* TODO: delete *) |
1316 by (rule DERIV_cong) (* TODO: delete *) |
1297 |
1317 |
1298 lemma sin_cos_squared_add [simp]: "(sin x)\<twosuperior> + (cos x)\<twosuperior> = 1" |
1318 lemma sin_cos_squared_add [simp]: "(sin x)\<twosuperior> + (cos x)\<twosuperior> = 1" |
1334 lemma cos_le_one [simp]: "cos x \<le> 1" |
1354 lemma cos_le_one [simp]: "cos x \<le> 1" |
1335 using abs_cos_le_one [of x] unfolding abs_le_iff by simp |
1355 using abs_cos_le_one [of x] unfolding abs_le_iff by simp |
1336 |
1356 |
1337 lemma DERIV_fun_pow: "DERIV g x :> m ==> |
1357 lemma DERIV_fun_pow: "DERIV g x :> m ==> |
1338 DERIV (%x. (g x) ^ n) x :> real n * (g x) ^ (n - 1) * m" |
1358 DERIV (%x. (g x) ^ n) x :> real n * (g x) ^ (n - 1) * m" |
1339 unfolding One_nat_def |
1359 by (auto intro!: DERIV_intros) |
1340 apply (rule DERIV_cong) |
|
1341 apply (rule_tac f = "(%x. x ^ n)" in DERIV_chain2) |
|
1342 apply (rule DERIV_pow, auto) |
|
1343 done |
|
1344 |
1360 |
1345 lemma DERIV_fun_exp: |
1361 lemma DERIV_fun_exp: |
1346 "DERIV g x :> m ==> DERIV (%x. exp(g x)) x :> exp(g x) * m" |
1362 "DERIV g x :> m ==> DERIV (%x. exp(g x)) x :> exp(g x) * m" |
1347 apply (rule DERIV_cong) |
1363 by (auto intro!: DERIV_intros) |
1348 apply (rule_tac f = exp in DERIV_chain2) |
|
1349 apply (rule DERIV_exp, auto) |
|
1350 done |
|
1351 |
1364 |
1352 lemma DERIV_fun_sin: |
1365 lemma DERIV_fun_sin: |
1353 "DERIV g x :> m ==> DERIV (%x. sin(g x)) x :> cos(g x) * m" |
1366 "DERIV g x :> m ==> DERIV (%x. sin(g x)) x :> cos(g x) * m" |
1354 apply (rule DERIV_cong) |
1367 by (auto intro!: DERIV_intros) |
1355 apply (rule_tac f = sin in DERIV_chain2) |
|
1356 apply (rule DERIV_sin, auto) |
|
1357 done |
|
1358 |
1368 |
1359 lemma DERIV_fun_cos: |
1369 lemma DERIV_fun_cos: |
1360 "DERIV g x :> m ==> DERIV (%x. cos(g x)) x :> -sin(g x) * m" |
1370 "DERIV g x :> m ==> DERIV (%x. cos(g x)) x :> -sin(g x) * m" |
1361 apply (rule DERIV_cong) |
1371 by (auto intro!: DERIV_intros) |
1362 apply (rule_tac f = cos in DERIV_chain2) |
|
1363 apply (rule DERIV_cos, auto) |
|
1364 done |
|
1365 |
1372 |
1366 lemma sin_cos_add_lemma: |
1373 lemma sin_cos_add_lemma: |
1367 "(sin (x + y) - (sin x * cos y + cos x * sin y)) ^ 2 + |
1374 "(sin (x + y) - (sin x * cos y + cos x * sin y)) ^ 2 + |
1368 (cos (x + y) - (cos x * cos y - sin x * sin y)) ^ 2 = 0" |
1375 (cos (x + y) - (cos x * cos y - sin x * sin y)) ^ 2 = 0" |
1369 (is "?f x = 0") |
1376 (is "?f x = 0") |
1483 apply (rule mult_strict_mono) |
1490 apply (rule mult_strict_mono) |
1484 apply (simp_all (no_asm_simp)) |
1491 apply (simp_all (no_asm_simp)) |
1485 done |
1492 done |
1486 |
1493 |
1487 lemma sin_gt_zero1: "[|0 < x; x < 2 |] ==> 0 < sin x" |
1494 lemma sin_gt_zero1: "[|0 < x; x < 2 |] ==> 0 < sin x" |
1488 by (auto intro: sin_gt_zero) |
1495 by (rule sin_gt_zero) |
1489 |
1496 |
1490 lemma cos_double_less_one: "[| 0 < x; x < 2 |] ==> cos (2 * x) < 1" |
1497 lemma cos_double_less_one: "[| 0 < x; x < 2 |] ==> cos (2 * x) < 1" |
1491 apply (cut_tac x = x in sin_gt_zero1) |
1498 apply (cut_tac x = x in sin_gt_zero) |
1492 apply (auto simp add: cos_squared_eq cos_double) |
1499 apply (auto simp add: cos_squared_eq cos_double) |
1493 done |
1500 done |
1494 |
1501 |
1495 lemma cos_paired: |
1502 lemma cos_paired: |
1496 "(%n. -1 ^ n /(real (fact (2 * n))) * x ^ (2 * n)) sums cos x" |
1503 "(%n. -1 ^ n /(real (fact (2 * n))) * x ^ (2 * n)) sums cos x" |
1886 from cos_monotone_0_pi'[OF this] show ?thesis unfolding minus_sin_cos_eq[symmetric] by auto |
1893 from cos_monotone_0_pi'[OF this] show ?thesis unfolding minus_sin_cos_eq[symmetric] by auto |
1887 qed |
1894 qed |
1888 |
1895 |
1889 subsection {* Tangent *} |
1896 subsection {* Tangent *} |
1890 |
1897 |
1891 definition |
1898 definition tan :: "real \<Rightarrow> real" where |
1892 tan :: "real => real" where |
1899 "tan = (\<lambda>x. sin x / cos x)" |
1893 "tan x = (sin x)/(cos x)" |
|
1894 |
1900 |
1895 lemma tan_zero [simp]: "tan 0 = 0" |
1901 lemma tan_zero [simp]: "tan 0 = 0" |
1896 by (simp add: tan_def) |
1902 by (simp add: tan_def) |
1897 |
1903 |
1898 lemma tan_pi [simp]: "tan pi = 0" |
1904 lemma tan_pi [simp]: "tan pi = 0" |
1899 by (simp add: tan_def) |
1905 by (simp add: tan_def) |
1900 |
1906 |
1901 lemma tan_npi [simp]: "tan (real (n::nat) * pi) = 0" |
1907 lemma tan_npi [simp]: "tan (real (n::nat) * pi) = 0" |
1902 by (simp add: tan_def) |
1908 by (simp add: tan_def) |
1903 |
1909 |
1904 lemma tan_minus [simp]: "tan (-x) = - tan x" |
1910 lemma tan_minus [simp]: "tan (-x) = - tan x" |
1905 by (simp add: tan_def minus_mult_left) |
1911 by (simp add: tan_def) |
1906 |
1912 |
1907 lemma tan_periodic [simp]: "tan (x + 2*pi) = tan x" |
1913 lemma tan_periodic [simp]: "tan (x + 2*pi) = tan x" |
1908 by (simp add: tan_def) |
1914 by (simp add: tan_def) |
1909 |
1915 |
1910 lemma lemma_tan_add1: |
1916 lemma lemma_tan_add1: |
1911 "[| cos x \<noteq> 0; cos y \<noteq> 0 |] |
1917 "\<lbrakk>cos x \<noteq> 0; cos y \<noteq> 0\<rbrakk> \<Longrightarrow> 1 - tan x * tan y = cos (x + y)/(cos x * cos y)" |
1912 ==> 1 - tan(x)*tan(y) = cos (x + y)/(cos x * cos y)" |
1918 by (simp add: tan_def cos_add field_simps) |
1913 apply (simp add: tan_def divide_inverse) |
|
1914 apply (auto simp del: inverse_mult_distrib |
|
1915 simp add: inverse_mult_distrib [symmetric] mult_ac) |
|
1916 apply (rule_tac c1 = "cos x * cos y" in real_mult_right_cancel [THEN subst]) |
|
1917 apply (auto simp del: inverse_mult_distrib |
|
1918 simp add: mult_assoc left_diff_distrib cos_add) |
|
1919 done |
|
1920 |
1919 |
1921 lemma add_tan_eq: |
1920 lemma add_tan_eq: |
1922 "[| cos x \<noteq> 0; cos y \<noteq> 0 |] |
1921 "\<lbrakk>cos x \<noteq> 0; cos y \<noteq> 0\<rbrakk> \<Longrightarrow> tan x + tan y = sin(x + y)/(cos x * cos y)" |
1923 ==> tan x + tan y = sin(x + y)/(cos x * cos y)" |
1922 by (simp add: tan_def sin_add field_simps) |
1924 apply (simp add: tan_def) |
|
1925 apply (rule_tac c1 = "cos x * cos y" in real_mult_right_cancel [THEN subst]) |
|
1926 apply (auto simp add: mult_assoc left_distrib) |
|
1927 apply (simp add: sin_add) |
|
1928 done |
|
1929 |
1923 |
1930 lemma tan_add: |
1924 lemma tan_add: |
1931 "[| cos x \<noteq> 0; cos y \<noteq> 0; cos (x + y) \<noteq> 0 |] |
1925 "[| cos x \<noteq> 0; cos y \<noteq> 0; cos (x + y) \<noteq> 0 |] |
1932 ==> tan(x + y) = (tan(x) + tan(y))/(1 - tan(x) * tan(y))" |
1926 ==> tan(x + y) = (tan(x) + tan(y))/(1 - tan(x) * tan(y))" |
1933 apply (simp (no_asm_simp) add: add_tan_eq lemma_tan_add1) |
1927 by (simp add: add_tan_eq lemma_tan_add1, simp add: tan_def) |
1934 apply (simp add: tan_def) |
|
1935 done |
|
1936 |
1928 |
1937 lemma tan_double: |
1929 lemma tan_double: |
1938 "[| cos x \<noteq> 0; cos (2 * x) \<noteq> 0 |] |
1930 "[| cos x \<noteq> 0; cos (2 * x) \<noteq> 0 |] |
1939 ==> tan (2 * x) = (2 * tan x)/(1 - (tan(x) ^ 2))" |
1931 ==> tan (2 * x) = (2 * tan x)/(1 - (tan(x) ^ 2))" |
1940 apply (insert tan_add [of x x]) |
1932 using tan_add [of x x] by (simp add: power2_eq_square) |
1941 apply (simp add: mult_2 [symmetric]) |
|
1942 apply (auto simp add: numeral_2_eq_2) |
|
1943 done |
|
1944 |
1933 |
1945 lemma tan_gt_zero: "[| 0 < x; x < pi/2 |] ==> 0 < tan x" |
1934 lemma tan_gt_zero: "[| 0 < x; x < pi/2 |] ==> 0 < tan x" |
1946 by (simp add: tan_def zero_less_divide_iff sin_gt_zero2 cos_gt_zero_pi) |
1935 by (simp add: tan_def zero_less_divide_iff sin_gt_zero2 cos_gt_zero_pi) |
1947 |
1936 |
1948 lemma tan_less_zero: |
1937 lemma tan_less_zero: |
1966 also have "\<dots> = sin (2 * x) / ((cos x) ^ 2 + cos (2*x) + (sin x)^2)" unfolding minus_cos_2x by auto |
1955 also have "\<dots> = sin (2 * x) / ((cos x) ^ 2 + cos (2*x) + (sin x)^2)" unfolding minus_cos_2x by auto |
1967 also have "\<dots> = sin (2 * x) / (cos (2*x) + 1)" by auto |
1956 also have "\<dots> = sin (2 * x) / (cos (2*x) + 1)" by auto |
1968 finally show ?thesis . |
1957 finally show ?thesis . |
1969 qed |
1958 qed |
1970 |
1959 |
1971 lemma lemma_DERIV_tan: |
1960 lemma DERIV_tan [simp]: "cos x \<noteq> 0 \<Longrightarrow> DERIV tan x :> inverse ((cos x)\<twosuperior>)" |
1972 "cos x \<noteq> 0 ==> DERIV (%x. sin(x)/cos(x)) x :> inverse((cos x)\<twosuperior>)" |
1961 unfolding tan_def |
1973 by (auto intro!: DERIV_intros simp add: field_simps numeral_2_eq_2) |
1962 by (auto intro!: DERIV_intros, simp add: divide_inverse power2_eq_square) |
1974 |
1963 |
1975 lemma DERIV_tan [simp]: "cos x \<noteq> 0 ==> DERIV tan x :> inverse((cos x)\<twosuperior>)" |
1964 lemma isCont_tan: "cos x \<noteq> 0 \<Longrightarrow> isCont tan x" |
1976 by (auto dest: lemma_DERIV_tan simp add: tan_def [symmetric]) |
1965 by (rule DERIV_tan [THEN DERIV_isCont]) |
1977 |
1966 |
1978 lemma isCont_tan [simp]: "cos x \<noteq> 0 ==> isCont tan x" |
1967 lemma isCont_tan' [simp]: |
1979 by (rule DERIV_tan [THEN DERIV_isCont]) |
1968 "\<lbrakk>isCont f a; cos (f a) \<noteq> 0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. tan (f x)) a" |
1980 |
1969 by (rule isCont_o2 [OF _ isCont_tan]) |
1981 lemma LIM_cos_div_sin [simp]: "(%x. cos(x)/sin(x)) -- pi/2 --> 0" |
1970 |
1982 apply (subgoal_tac "(\<lambda>x. cos x * inverse (sin x)) -- pi * inverse 2 --> 0*1") |
1971 lemma tendsto_tan [tendsto_intros]: |
1983 apply (simp add: divide_inverse [symmetric]) |
1972 "\<lbrakk>(f ---> a) F; cos a \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. tan (f x)) ---> tan a) F" |
1984 apply (rule LIM_mult) |
1973 by (rule isCont_tendsto_compose [OF isCont_tan]) |
1985 apply (rule_tac [2] inverse_1 [THEN subst]) |
1974 |
1986 apply (rule_tac [2] LIM_inverse) |
1975 lemma LIM_cos_div_sin: "(%x. cos(x)/sin(x)) -- pi/2 --> 0" |
1987 apply (simp_all add: divide_inverse [symmetric]) |
1976 by (rule LIM_cong_limit, (rule tendsto_intros)+, simp_all) |
1988 apply (simp_all only: isCont_def [symmetric] cos_pi_half [symmetric] sin_pi_half [symmetric]) |
|
1989 apply (blast intro!: DERIV_isCont DERIV_sin DERIV_cos)+ |
|
1990 done |
|
1991 |
1977 |
1992 lemma lemma_tan_total: "0 < y ==> \<exists>x. 0 < x & x < pi/2 & y < tan x" |
1978 lemma lemma_tan_total: "0 < y ==> \<exists>x. 0 < x & x < pi/2 & y < tan x" |
1993 apply (cut_tac LIM_cos_div_sin) |
1979 apply (cut_tac LIM_cos_div_sin) |
1994 apply (simp only: LIM_eq) |
1980 apply (simp only: LIM_eq) |
1995 apply (drule_tac x = "inverse y" in spec, safe, force) |
1981 apply (drule_tac x = "inverse y" in spec, safe, force) |