| author | wenzelm | 
| Sat, 04 Apr 2020 20:06:15 +0200 | |
| changeset 71687 | f17be1db8381 | 
| parent 71633 | 07bec530f02e | 
| child 72301 | c5d1a01d2d6c | 
| permissions | -rw-r--r-- | 
| 60420 | 1 | section \<open>Complex Transcendental Functions\<close> | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 2 | |
| 61711 
21d7910d6816
Theory of homotopic paths (from HOL Light), plus comments and minor refinements
 paulson <lp15@cam.ac.uk> parents: 
61694diff
changeset | 3 | text\<open>By John Harrison et al. Ported from HOL Light by L C Paulson (2015)\<close> | 
| 
21d7910d6816
Theory of homotopic paths (from HOL Light), plus comments and minor refinements
 paulson <lp15@cam.ac.uk> parents: 
61694diff
changeset | 4 | |
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 5 | theory Complex_Transcendental | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 6 | imports | 
| 70196 
b7ef9090feed
Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 7 | Complex_Analysis_Basics Summation_Tests "HOL-Library.Periodic_Fun" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 8 | begin | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 9 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 10 | subsection\<open>Möbius transformations\<close> | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 11 | |
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 12 | (* TODO: Figure out what to do with Möbius transformations *) | 
| 70136 | 13 | definition\<^marker>\<open>tag important\<close> "moebius a b c d = (\<lambda>z. (a*z+b) / (c*z+d :: 'a :: field))" | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 14 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 15 | theorem moebius_inverse: | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 16 | assumes "a * d \<noteq> b * c" "c * z + d \<noteq> 0" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 17 | shows "moebius d (-b) (-c) a (moebius a b c d z) = z" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 18 | proof - | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 19 | from assms have "(-c) * moebius a b c d z + a \<noteq> 0" unfolding moebius_def | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 20 | by (simp add: field_simps) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 21 | with assms show ?thesis | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 22 | unfolding moebius_def by (simp add: moebius_def divide_simps) (simp add: algebra_simps)? | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 23 | qed | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 24 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 25 | lemma moebius_inverse': | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 26 | assumes "a * d \<noteq> b * c" "c * z - a \<noteq> 0" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 27 | shows "moebius a b c d (moebius d (-b) (-c) a z) = z" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 28 | using assms moebius_inverse[of d a "-b" "-c" z] | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 29 | by (auto simp: algebra_simps) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 30 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 31 | lemma cmod_add_real_less: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 32 | assumes "Im z \<noteq> 0" "r\<noteq>0" | 
| 61945 | 33 | shows "cmod (z + r) < cmod z + \<bar>r\<bar>" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 34 | proof (cases z) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 35 | case (Complex x y) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 36 | have "r * x / \<bar>r\<bar> < sqrt (x*x + y*y)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 37 | apply (rule real_less_rsqrt) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 38 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 39 | apply (simp add: Complex power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 40 | using not_real_square_gt_zero by blast | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 41 | then show ?thesis using assms Complex | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 42 | apply (simp add: cmod_def) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 43 | apply (rule power2_less_imp_less, auto) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 44 | apply (simp add: power2_eq_square field_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 45 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 46 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 47 | |
| 61945 | 48 | lemma cmod_diff_real_less: "Im z \<noteq> 0 \<Longrightarrow> x\<noteq>0 \<Longrightarrow> cmod (z - x) < cmod z + \<bar>x\<bar>" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 49 | using cmod_add_real_less [of z "-x"] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 50 | by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 51 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 52 | lemma cmod_square_less_1_plus: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 53 | assumes "Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 54 | shows "(cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 55 | proof (cases "Im z = 0 \<or> Re z = 0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 56 | case True | 
| 68493 | 57 | with assms abs_square_less_1 show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 58 | by (force simp add: Re_power2 Im_power2 cmod_def) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 59 | next | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 60 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 61 | with cmod_diff_real_less [of "1 - z\<^sup>2" "1"] show ?thesis | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 62 | by (simp add: norm_power Im_power2) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 63 | qed | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 64 | |
| 70136 | 65 | subsection\<^marker>\<open>tag unimportant\<close>\<open>The Exponential Function\<close> | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 66 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 67 | lemma norm_exp_i_times [simp]: "norm (exp(\<i> * of_real y)) = 1" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 68 | by simp | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 69 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 70 | lemma norm_exp_imaginary: "norm(exp z) = 1 \<Longrightarrow> Re z = 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 71 | by simp | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 72 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 73 | lemma field_differentiable_within_exp: "exp field_differentiable (at z within s)" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 74 | using DERIV_exp field_differentiable_at_within field_differentiable_def by blast | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 75 | |
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 76 | lemma continuous_within_exp: | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 77 |   fixes z::"'a::{real_normed_field,banach}"
 | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 78 | shows "continuous (at z within s) exp" | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 79 | by (simp add: continuous_at_imp_continuous_within) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 80 | |
| 62381 
a6479cb85944
New and revised material for (multivariate) analysis
 paulson <lp15@cam.ac.uk> parents: 
62131diff
changeset | 81 | lemma holomorphic_on_exp [holomorphic_intros]: "exp holomorphic_on s" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 82 | by (simp add: field_differentiable_within_exp holomorphic_on_def) | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 83 | |
| 66480 
4b8d1df8933b
HOL-Analysis: Convergent FPS and infinite sums
 Manuel Eberl <eberlm@in.tum.de> parents: 
66466diff
changeset | 84 | lemma holomorphic_on_exp' [holomorphic_intros]: | 
| 
4b8d1df8933b
HOL-Analysis: Convergent FPS and infinite sums
 Manuel Eberl <eberlm@in.tum.de> parents: 
66466diff
changeset | 85 | "f holomorphic_on s \<Longrightarrow> (\<lambda>x. exp (f x)) holomorphic_on s" | 
| 
4b8d1df8933b
HOL-Analysis: Convergent FPS and infinite sums
 Manuel Eberl <eberlm@in.tum.de> parents: 
66466diff
changeset | 86 | using holomorphic_on_compose[OF _ holomorphic_on_exp] by (simp add: o_def) | 
| 
4b8d1df8933b
HOL-Analysis: Convergent FPS and infinite sums
 Manuel Eberl <eberlm@in.tum.de> parents: 
66466diff
changeset | 87 | |
| 67968 | 88 | subsection\<open>Euler and de Moivre formulas\<close> | 
| 60420 | 89 | |
| 69597 | 90 | text\<open>The sine series times \<^term>\<open>i\<close>\<close> | 
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 91 | lemma sin_i_eq: "(\<lambda>n. (\<i> * sin_coeff n) * z^n) sums (\<i> * sin z)" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 92 | proof - | 
| 63589 | 93 | have "(\<lambda>n. \<i> * sin_coeff n *\<^sub>R z^n) sums (\<i> * sin z)" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 94 | using sin_converges sums_mult by blast | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 95 | then show ?thesis | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 96 | by (simp add: scaleR_conv_of_real field_simps) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 97 | qed | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 98 | |
| 63589 | 99 | theorem exp_Euler: "exp(\<i> * z) = cos(z) + \<i> * sin(z)" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 100 | proof - | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 101 | have "(\<lambda>n. (cos_coeff n + \<i> * sin_coeff n) * z^n) = (\<lambda>n. (\<i> * z) ^ n /\<^sub>R (fact n))" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 102 | proof | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 103 | fix n | 
| 63589 | 104 | show "(cos_coeff n + \<i> * sin_coeff n) * z^n = (\<i> * z) ^ n /\<^sub>R (fact n)" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 105 | by (auto simp: cos_coeff_def sin_coeff_def scaleR_conv_of_real field_simps elim!: evenE oddE) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 106 | qed | 
| 63589 | 107 | also have "... sums (exp (\<i> * z))" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 108 | by (rule exp_converges) | 
| 63589 | 109 | finally have "(\<lambda>n. (cos_coeff n + \<i> * sin_coeff n) * z^n) sums (exp (\<i> * z))" . | 
| 110 | moreover have "(\<lambda>n. (cos_coeff n + \<i> * sin_coeff n) * z^n) sums (cos z + \<i> * sin z)" | |
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 111 | using sums_add [OF cos_converges [of z] sin_i_eq [of z]] | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 112 | by (simp add: field_simps scaleR_conv_of_real) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 113 | ultimately show ?thesis | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 114 | using sums_unique2 by blast | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 115 | qed | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 116 | |
| 70136 | 117 | corollary\<^marker>\<open>tag unimportant\<close> exp_minus_Euler: "exp(-(\<i> * z)) = cos(z) - \<i> * sin(z)" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 118 | using exp_Euler [of "-z"] | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 119 | by simp | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 120 | |
| 63589 | 121 | lemma sin_exp_eq: "sin z = (exp(\<i> * z) - exp(-(\<i> * z))) / (2*\<i>)" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 122 | by (simp add: exp_Euler exp_minus_Euler) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 123 | |
| 63589 | 124 | lemma sin_exp_eq': "sin z = \<i> * (exp(-(\<i> * z)) - exp(\<i> * z)) / 2" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 125 | by (simp add: exp_Euler exp_minus_Euler) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 126 | |
| 63589 | 127 | lemma cos_exp_eq: "cos z = (exp(\<i> * z) + exp(-(\<i> * z))) / 2" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 128 | by (simp add: exp_Euler exp_minus_Euler) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 129 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 130 | theorem Euler: "exp(z) = of_real(exp(Re z)) * | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 131 | (of_real(cos(Im z)) + \<i> * of_real(sin(Im z)))" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 132 | by (cases z) (simp add: exp_add exp_Euler cos_of_real exp_of_real sin_of_real Complex_eq) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 133 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 134 | lemma Re_sin: "Re(sin z) = sin(Re z) * (exp(Im z) + exp(-(Im z))) / 2" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 135 | by (simp add: sin_exp_eq field_simps Re_divide Im_exp) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 136 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 137 | lemma Im_sin: "Im(sin z) = cos(Re z) * (exp(Im z) - exp(-(Im z))) / 2" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 138 | by (simp add: sin_exp_eq field_simps Im_divide Re_exp) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 139 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 140 | lemma Re_cos: "Re(cos z) = cos(Re z) * (exp(Im z) + exp(-(Im z))) / 2" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 141 | by (simp add: cos_exp_eq field_simps Re_divide Re_exp) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 142 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 143 | lemma Im_cos: "Im(cos z) = sin(Re z) * (exp(-(Im z)) - exp(Im z)) / 2" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 144 | by (simp add: cos_exp_eq field_simps Im_divide Im_exp) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 145 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 146 | lemma Re_sin_pos: "0 < Re z \<Longrightarrow> Re z < pi \<Longrightarrow> Re (sin z) > 0" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 147 | by (auto simp: Re_sin Im_sin add_pos_pos sin_gt_zero) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 148 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 149 | lemma Im_sin_nonneg: "Re z = 0 \<Longrightarrow> 0 \<le> Im z \<Longrightarrow> 0 \<le> Im (sin z)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 150 | by (simp add: Re_sin Im_sin algebra_simps) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 151 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 152 | lemma Im_sin_nonneg2: "Re z = pi \<Longrightarrow> Im z \<le> 0 \<Longrightarrow> 0 \<le> Im (sin z)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 153 | by (simp add: Re_sin Im_sin algebra_simps) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 154 | |
| 70136 | 155 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Relationships between real and complex trigonometric and hyperbolic functions\<close> | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 156 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 157 | lemma real_sin_eq [simp]: "Re(sin(of_real x)) = sin x" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 158 | by (simp add: sin_of_real) | 
| 59862 | 159 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 160 | lemma real_cos_eq [simp]: "Re(cos(of_real x)) = cos x" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 161 | by (simp add: cos_of_real) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 162 | |
| 63589 | 163 | lemma DeMoivre: "(cos z + \<i> * sin z) ^ n = cos(n * z) + \<i> * sin(n * z)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 164 | by (metis exp_Euler [symmetric] exp_of_nat_mult mult.left_commute) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 165 | |
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 166 | lemma exp_cnj: "cnj (exp z) = exp (cnj z)" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 167 | proof - | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 168 | have "(\<lambda>n. cnj (z ^ n /\<^sub>R (fact n))) = (\<lambda>n. (cnj z)^n /\<^sub>R (fact n))" | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 169 | by auto | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 170 | also have "... sums (exp (cnj z))" | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 171 | by (rule exp_converges) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 172 | finally have "(\<lambda>n. cnj (z ^ n /\<^sub>R (fact n))) sums (exp (cnj z))" . | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 173 | moreover have "(\<lambda>n. cnj (z ^ n /\<^sub>R (fact n))) sums (cnj (exp z))" | 
| 59862 | 174 | by (metis exp_converges sums_cnj) | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 175 | ultimately show ?thesis | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 176 | using sums_unique2 | 
| 59862 | 177 | by blast | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 178 | qed | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 179 | |
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 180 | lemma cnj_sin: "cnj(sin z) = sin(cnj z)" | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 181 | by (simp add: sin_exp_eq exp_cnj field_simps) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 182 | |
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 183 | lemma cnj_cos: "cnj(cos z) = cos(cnj z)" | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 184 | by (simp add: cos_exp_eq exp_cnj field_simps) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 185 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 186 | lemma field_differentiable_at_sin: "sin field_differentiable at z" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 187 | using DERIV_sin field_differentiable_def by blast | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 188 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 189 | lemma field_differentiable_within_sin: "sin field_differentiable (at z within S)" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 190 | by (simp add: field_differentiable_at_sin field_differentiable_at_within) | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 191 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 192 | lemma field_differentiable_at_cos: "cos field_differentiable at z" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 193 | using DERIV_cos field_differentiable_def by blast | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 194 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 195 | lemma field_differentiable_within_cos: "cos field_differentiable (at z within S)" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 196 | by (simp add: field_differentiable_at_cos field_differentiable_at_within) | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 197 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 198 | lemma holomorphic_on_sin: "sin holomorphic_on S" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 199 | by (simp add: field_differentiable_within_sin holomorphic_on_def) | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 200 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 201 | lemma holomorphic_on_cos: "cos holomorphic_on S" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 202 | by (simp add: field_differentiable_within_cos holomorphic_on_def) | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 203 | |
| 68721 | 204 | lemma holomorphic_on_sin' [holomorphic_intros]: | 
| 205 | assumes "f holomorphic_on A" | |
| 206 | shows "(\<lambda>x. sin (f x)) holomorphic_on A" | |
| 207 | using holomorphic_on_compose[OF assms holomorphic_on_sin] by (simp add: o_def) | |
| 208 | ||
| 209 | lemma holomorphic_on_cos' [holomorphic_intros]: | |
| 210 | assumes "f holomorphic_on A" | |
| 211 | shows "(\<lambda>x. cos (f x)) holomorphic_on A" | |
| 212 | using holomorphic_on_compose[OF assms holomorphic_on_cos] by (simp add: o_def) | |
| 213 | ||
| 70136 | 214 | subsection\<^marker>\<open>tag unimportant\<close>\<open>More on the Polar Representation of Complex Numbers\<close> | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 215 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 216 | lemma exp_Complex: "exp(Complex r t) = of_real(exp r) * Complex (cos t) (sin t)" | 
| 65274 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 217 | by (simp add: Complex_eq exp_add exp_Euler exp_of_real sin_of_real cos_of_real) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 218 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 219 | lemma exp_eq_1: "exp z = 1 \<longleftrightarrow> Re(z) = 0 \<and> (\<exists>n::int. Im(z) = of_int (2 * n) * pi)" | 
| 65274 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 220 | (is "?lhs = ?rhs") | 
| 68493 | 221 | proof | 
| 65274 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 222 | assume "exp z = 1" | 
| 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 223 | then have "Re z = 0" | 
| 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 224 | by (metis exp_eq_one_iff norm_exp_eq_Re norm_one) | 
| 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 225 | with \<open>?lhs\<close> show ?rhs | 
| 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 226 | by (metis Re_exp complex_Re_of_int cos_one_2pi_int exp_zero mult.commute mult_numeral_1 numeral_One of_int_mult of_int_numeral) | 
| 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 227 | next | 
| 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 228 | assume ?rhs then show ?lhs | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 229 | using Im_exp Re_exp complex_eq_iff | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 230 | by (simp add: cos_one_2pi_int cos_one_sin_zero mult.commute) | 
| 65274 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 231 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 232 | |
| 63589 | 233 | lemma exp_eq: "exp w = exp z \<longleftrightarrow> (\<exists>n::int. w = z + (of_int (2 * n) * pi) * \<i>)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 234 | (is "?lhs = ?rhs") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 235 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 236 | have "exp w = exp z \<longleftrightarrow> exp (w-z) = 1" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 237 | by (simp add: exp_diff) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 238 | also have "... \<longleftrightarrow> (Re w = Re z \<and> (\<exists>n::int. Im w - Im z = of_int (2 * n) * pi))" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 239 | by (simp add: exp_eq_1) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 240 | also have "... \<longleftrightarrow> ?rhs" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 241 | by (auto simp: algebra_simps intro!: complex_eqI) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 242 | finally show ?thesis . | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 243 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 244 | |
| 61945 | 245 | lemma exp_complex_eqI: "\<bar>Im w - Im z\<bar> < 2*pi \<Longrightarrow> exp w = exp z \<Longrightarrow> w = z" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 246 | by (auto simp: exp_eq abs_mult) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 247 | |
| 59862 | 248 | lemma exp_integer_2pi: | 
| 61070 | 249 | assumes "n \<in> \<int>" | 
| 63589 | 250 | shows "exp((2 * n * pi) * \<i>) = 1" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 251 | proof - | 
| 63589 | 252 | have "exp((2 * n * pi) * \<i>) = exp 0" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 253 | using assms unfolding Ints_def exp_eq by auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 254 | also have "... = 1" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 255 | by simp | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 256 | finally show ?thesis . | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 257 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 258 | |
| 64287 | 259 | lemma exp_plus_2pin [simp]: "exp (z + \<i> * (of_int n * (of_real pi * 2))) = exp z" | 
| 260 | by (simp add: exp_eq) | |
| 261 | ||
| 66466 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 262 | lemma exp_integer_2pi_plus1: | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 263 | assumes "n \<in> \<int>" | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 264 | shows "exp(((2 * n + 1) * pi) * \<i>) = - 1" | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 265 | proof - | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 266 | from assms obtain n' where [simp]: "n = of_int n'" | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 267 | by (auto simp: Ints_def) | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 268 | have "exp(((2 * n + 1) * pi) * \<i>) = exp (pi * \<i>)" | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 269 | using assms by (subst exp_eq) (auto intro!: exI[of _ n'] simp: algebra_simps) | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 270 | also have "... = - 1" | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 271 | by simp | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 272 | finally show ?thesis . | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 273 | qed | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 274 | |
| 64287 | 275 | lemma inj_on_exp_pi: | 
| 276 | fixes z::complex shows "inj_on exp (ball z pi)" | |
| 277 | proof (clarsimp simp: inj_on_def exp_eq) | |
| 278 | fix y n | |
| 279 | assume "dist z (y + 2 * of_int n * of_real pi * \<i>) < pi" | |
| 280 | "dist z y < pi" | |
| 281 | then have "dist y (y + 2 * of_int n * of_real pi * \<i>) < pi+pi" | |
| 282 | using dist_commute_lessI dist_triangle_less_add by blast | |
| 283 | then have "norm (2 * of_int n * of_real pi * \<i>) < 2*pi" | |
| 284 | by (simp add: dist_norm) | |
| 285 | then show "n = 0" | |
| 286 | by (auto simp: norm_mult) | |
| 287 | qed | |
| 288 | ||
| 68585 | 289 | lemma cmod_add_squared: | 
| 290 | fixes r1 r2::real | |
| 291 | assumes "r1 \<ge> 0" "r2 \<ge> 0" | |
| 292 | shows "(cmod (r1 * exp (\<i> * \<theta>1) + r2 * exp (\<i> * \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)" (is "(cmod (?z1 + ?z2))\<^sup>2 = ?rhs") | |
| 293 | proof - | |
| 294 | have "(cmod (?z1 + ?z2))\<^sup>2 = (?z1 + ?z2) * cnj (?z1 + ?z2)" | |
| 295 | by (rule complex_norm_square) | |
| 296 | also have "\<dots> = (?z1 * cnj ?z1 + ?z2 * cnj ?z2) + (?z1 * cnj ?z2 + cnj ?z1 * ?z2)" | |
| 297 | by (simp add: algebra_simps) | |
| 298 | also have "\<dots> = (norm ?z1)\<^sup>2 + (norm ?z2)\<^sup>2 + 2 * Re (?z1 * cnj ?z2)" | |
| 299 | unfolding complex_norm_square [symmetric] cnj_add_mult_eq_Re by simp | |
| 300 | also have "\<dots> = ?rhs" | |
| 301 | by (simp add: norm_mult) (simp add: exp_Euler complex_is_Real_iff [THEN iffD1] cos_diff algebra_simps) | |
| 302 | finally show ?thesis | |
| 303 | using of_real_eq_iff by blast | |
| 304 | qed | |
| 305 | ||
| 306 | lemma cmod_diff_squared: | |
| 307 | fixes r1 r2::real | |
| 308 | assumes "r1 \<ge> 0" "r2 \<ge> 0" | |
| 309 | shows "(cmod (r1 * exp (\<i> * \<theta>1) - r2 * exp (\<i> * \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2*r1*r2*cos (\<theta>1 - \<theta>2)" (is "(cmod (?z1 - ?z2))\<^sup>2 = ?rhs") | |
| 310 | proof - | |
| 311 | have "exp (\<i> * (\<theta>2 + pi)) = - exp (\<i> * \<theta>2)" | |
| 312 | by (simp add: exp_Euler cos_plus_pi sin_plus_pi) | |
| 313 | then have "(cmod (?z1 - ?z2))\<^sup>2 = cmod (?z1 + r2 * exp (\<i> * (\<theta>2 + pi))) ^2" | |
| 314 | by simp | |
| 315 | also have "\<dots> = r1\<^sup>2 + r2\<^sup>2 + 2*r1*r2*cos (\<theta>1 - (\<theta>2 + pi))" | |
| 316 | using assms cmod_add_squared by blast | |
| 317 | also have "\<dots> = ?rhs" | |
| 318 | by (simp add: add.commute diff_add_eq_diff_diff_swap) | |
| 319 | finally show ?thesis . | |
| 320 | qed | |
| 321 | ||
| 322 | lemma polar_convergence: | |
| 323 | fixes R::real | |
| 324 | assumes "\<And>j. r j > 0" "R > 0" | |
| 325 | shows "((\<lambda>j. r j * exp (\<i> * \<theta> j)) \<longlonglongrightarrow> (R * exp (\<i> * \<Theta>))) \<longleftrightarrow> | |
| 326 | (r \<longlonglongrightarrow> R) \<and> (\<exists>k. (\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)" (is "(?z \<longlonglongrightarrow> ?Z) = ?rhs") | |
| 327 | proof | |
| 328 | assume L: "?z \<longlonglongrightarrow> ?Z" | |
| 329 | have rR: "r \<longlonglongrightarrow> R" | |
| 330 | using tendsto_norm [OF L] assms by (auto simp: norm_mult abs_of_pos) | |
| 331 | moreover obtain k where "(\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>" | |
| 332 | proof - | |
| 333 | have "cos (\<theta> j - \<Theta>) = ((r j)\<^sup>2 + R\<^sup>2 - (norm(?z j - ?Z))\<^sup>2) / (2 * R * r j)" for j | |
| 334 | apply (subst cmod_diff_squared) | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 335 | using assms by (auto simp: field_split_simps less_le) | 
| 68585 | 336 | moreover have "(\<lambda>j. ((r j)\<^sup>2 + R\<^sup>2 - (norm(?z j - ?Z))\<^sup>2) / (2 * R * r j)) \<longlonglongrightarrow> ((R\<^sup>2 + R\<^sup>2 - (norm(?Z - ?Z))\<^sup>2) / (2 * R * R))" | 
| 337 | by (intro L rR tendsto_intros) (use \<open>R > 0\<close> in force) | |
| 338 | moreover have "((R\<^sup>2 + R\<^sup>2 - (norm(?Z - ?Z))\<^sup>2) / (2 * R * R)) = 1" | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 339 | using \<open>R > 0\<close> by (simp add: power2_eq_square field_split_simps) | 
| 68585 | 340 | ultimately have "(\<lambda>j. cos (\<theta> j - \<Theta>)) \<longlonglongrightarrow> 1" | 
| 341 | by auto | |
| 342 | then show ?thesis | |
| 343 | using that cos_diff_limit_1 by blast | |
| 344 | qed | |
| 345 | ultimately show ?rhs | |
| 346 | by metis | |
| 347 | next | |
| 348 | assume R: ?rhs | |
| 349 | show "?z \<longlonglongrightarrow> ?Z" | |
| 350 | proof (rule tendsto_mult) | |
| 351 | show "(\<lambda>x. complex_of_real (r x)) \<longlonglongrightarrow> of_real R" | |
| 352 | using R by (auto simp: tendsto_of_real_iff) | |
| 353 | obtain k where "(\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>" | |
| 354 | using R by metis | |
| 355 | then have "(\<lambda>j. complex_of_real (\<theta> j - of_int (k j) * (2 * pi))) \<longlonglongrightarrow> of_real \<Theta>" | |
| 356 | using tendsto_of_real_iff by force | |
| 357 | then have "(\<lambda>j. exp (\<i> * of_real (\<theta> j - of_int (k j) * (2 * pi)))) \<longlonglongrightarrow> exp (\<i> * \<Theta>)" | |
| 358 | using tendsto_mult [OF tendsto_const] isCont_exp isCont_tendsto_compose by blast | |
| 359 | moreover have "exp (\<i> * of_real (\<theta> j - of_int (k j) * (2 * pi))) = exp (\<i> * \<theta> j)" for j | |
| 360 | unfolding exp_eq | |
| 361 | by (rule_tac x="- k j" in exI) (auto simp: algebra_simps) | |
| 362 | ultimately show "(\<lambda>j. exp (\<i> * \<theta> j)) \<longlonglongrightarrow> exp (\<i> * \<Theta>)" | |
| 363 | by auto | |
| 364 | qed | |
| 365 | qed | |
| 366 | ||
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 367 | lemma sin_cos_eq_iff: "sin y = sin x \<and> cos y = cos x \<longleftrightarrow> (\<exists>n::int. y = x + 2 * pi * n)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 368 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 369 |   { assume "sin y = sin x" "cos y = cos x"
 | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 370 | then have "cos (y-x) = 1" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 371 | using cos_add [of y "-x"] by simp | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 372 | then have "\<exists>n::int. y-x = 2 * pi * n" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 373 | using cos_one_2pi_int by auto } | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 374 | then show ?thesis | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 375 | apply (auto simp: sin_add cos_add) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 376 | apply (metis add.commute diff_add_cancel) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 377 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 378 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 379 | |
| 59862 | 380 | lemma exp_i_ne_1: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 381 | assumes "0 < x" "x < 2*pi" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 382 | shows "exp(\<i> * of_real x) \<noteq> 1" | 
| 59862 | 383 | proof | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 384 | assume "exp (\<i> * of_real x) = 1" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 385 | then have "exp (\<i> * of_real x) = exp 0" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 386 | by simp | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 387 | then obtain n where "\<i> * of_real x = (of_int (2 * n) * pi) * \<i>" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 388 | by (simp only: Ints_def exp_eq) auto | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 389 | then have "of_real x = (of_int (2 * n) * pi)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 390 | by (metis complex_i_not_zero mult.commute mult_cancel_left of_real_eq_iff real_scaleR_def scaleR_conv_of_real) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 391 | then have "x = (of_int (2 * n) * pi)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 392 | by simp | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 393 | then show False using assms | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 394 | by (cases n) (auto simp: zero_less_mult_iff mult_less_0_iff) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 395 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 396 | |
| 59862 | 397 | lemma sin_eq_0: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 398 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 399 | shows "sin z = 0 \<longleftrightarrow> (\<exists>n::int. z = of_real(n * pi))" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 400 | by (simp add: sin_exp_eq exp_eq) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 401 | |
| 59862 | 402 | lemma cos_eq_0: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 403 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 404 | shows "cos z = 0 \<longleftrightarrow> (\<exists>n::int. z = of_real(n * pi) + of_real pi/2)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 405 | using sin_eq_0 [of "z - of_real pi/2"] | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 406 | by (simp add: sin_diff algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 407 | |
| 59862 | 408 | lemma cos_eq_1: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 409 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 410 | shows "cos z = 1 \<longleftrightarrow> (\<exists>n::int. z = of_real(2 * n * pi))" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 411 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 412 | have "cos z = cos (2*(z/2))" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 413 | by simp | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 414 | also have "... = 1 - 2 * sin (z/2) ^ 2" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 415 | by (simp only: cos_double_sin) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 416 | finally have [simp]: "cos z = 1 \<longleftrightarrow> sin (z/2) = 0" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 417 | by simp | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 418 | show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 419 | by (auto simp: sin_eq_0) | 
| 59862 | 420 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 421 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 422 | lemma csin_eq_1: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 423 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 424 | shows "sin z = 1 \<longleftrightarrow> (\<exists>n::int. z = of_real(2 * n * pi) + of_real pi/2)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 425 | using cos_eq_1 [of "z - of_real pi/2"] | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 426 | by (simp add: cos_diff algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 427 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 428 | lemma csin_eq_minus1: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 429 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 430 | shows "sin z = -1 \<longleftrightarrow> (\<exists>n::int. z = of_real(2 * n * pi) + 3/2*pi)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 431 | (is "_ = ?rhs") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 432 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 433 | have "sin z = -1 \<longleftrightarrow> sin (-z) = 1" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 434 | by (simp add: equation_minus_iff) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 435 | also have "... \<longleftrightarrow> (\<exists>n::int. -z = of_real(2 * n * pi) + of_real pi/2)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 436 | by (simp only: csin_eq_1) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 437 | also have "... \<longleftrightarrow> (\<exists>n::int. z = - of_real(2 * n * pi) - of_real pi/2)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 438 | apply (rule iff_exI) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 439 | by (metis (no_types) is_num_normalize(8) minus_minus of_real_def real_vector.scale_minus_left uminus_add_conv_diff) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 440 | also have "... = ?rhs" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 441 | apply safe | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 442 | apply (rule_tac [2] x="-(x+1)" in exI) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 443 | apply (rule_tac x="-(x+1)" in exI) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 444 | apply (simp_all add: algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 445 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 446 | finally show ?thesis . | 
| 59862 | 447 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 448 | |
| 59862 | 449 | lemma ccos_eq_minus1: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 450 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 451 | shows "cos z = -1 \<longleftrightarrow> (\<exists>n::int. z = of_real(2 * n * pi) + pi)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 452 | using csin_eq_1 [of "z - of_real pi/2"] | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 453 | by (simp add: sin_diff algebra_simps equation_minus_iff) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 454 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 455 | lemma sin_eq_1: "sin x = 1 \<longleftrightarrow> (\<exists>n::int. x = (2 * n + 1 / 2) * pi)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 456 | (is "_ = ?rhs") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 457 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 458 | have "sin x = 1 \<longleftrightarrow> sin (complex_of_real x) = 1" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 459 | by (metis of_real_1 one_complex.simps(1) real_sin_eq sin_of_real) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 460 | also have "... \<longleftrightarrow> (\<exists>n::int. complex_of_real x = of_real(2 * n * pi) + of_real pi/2)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 461 | by (simp only: csin_eq_1) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 462 | also have "... \<longleftrightarrow> (\<exists>n::int. x = of_real(2 * n * pi) + of_real pi/2)" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 463 | by (rule iff_exI) (auto simp: algebra_simps intro: injD [OF inj_of_real [where 'a = complex]]) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 464 | also have "... = ?rhs" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 465 | by (auto simp: algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 466 | finally show ?thesis . | 
| 59862 | 467 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 468 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 469 | lemma sin_eq_minus1: "sin x = -1 \<longleftrightarrow> (\<exists>n::int. x = (2*n + 3/2) * pi)" (is "_ = ?rhs") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 470 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 471 | have "sin x = -1 \<longleftrightarrow> sin (complex_of_real x) = -1" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 472 | by (metis Re_complex_of_real of_real_def scaleR_minus1_left sin_of_real) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 473 | also have "... \<longleftrightarrow> (\<exists>n::int. complex_of_real x = of_real(2 * n * pi) + 3/2*pi)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 474 | by (simp only: csin_eq_minus1) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 475 | also have "... \<longleftrightarrow> (\<exists>n::int. x = of_real(2 * n * pi) + 3/2*pi)" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 476 | by (rule iff_exI) (auto simp: algebra_simps intro: injD [OF inj_of_real [where 'a = complex]]) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 477 | also have "... = ?rhs" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 478 | by (auto simp: algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 479 | finally show ?thesis . | 
| 59862 | 480 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 481 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 482 | lemma cos_eq_minus1: "cos x = -1 \<longleftrightarrow> (\<exists>n::int. x = (2*n + 1) * pi)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 483 | (is "_ = ?rhs") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 484 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 485 | have "cos x = -1 \<longleftrightarrow> cos (complex_of_real x) = -1" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 486 | by (metis Re_complex_of_real of_real_def scaleR_minus1_left cos_of_real) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 487 | also have "... \<longleftrightarrow> (\<exists>n::int. complex_of_real x = of_real(2 * n * pi) + pi)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 488 | by (simp only: ccos_eq_minus1) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 489 | also have "... \<longleftrightarrow> (\<exists>n::int. x = of_real(2 * n * pi) + pi)" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 490 | by (rule iff_exI) (auto simp: algebra_simps intro: injD [OF inj_of_real [where 'a = complex]]) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 491 | also have "... = ?rhs" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 492 | by (auto simp: algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 493 | finally show ?thesis . | 
| 59862 | 494 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 495 | |
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 496 | lemma dist_exp_i_1: "norm(exp(\<i> * of_real t) - 1) = 2 * \<bar>sin(t / 2)\<bar>" | 
| 59862 | 497 | apply (simp add: exp_Euler cmod_def power2_diff sin_of_real cos_of_real algebra_simps) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 498 | using cos_double_sin [of "t/2"] | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 499 | apply (simp add: real_sqrt_mult) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 500 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 501 | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 502 | |
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 503 | lemma complex_sin_eq: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 504 | fixes w :: complex | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 505 | shows "sin w = sin z \<longleftrightarrow> (\<exists>n \<in> \<int>. w = z + of_real(2*n*pi) \<or> w = -z + of_real((2*n + 1)*pi))" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 506 | (is "?lhs = ?rhs") | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 507 | proof | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 508 | assume ?lhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 509 | then have "sin w - sin z = 0" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 510 | by (auto simp: algebra_simps) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 511 | then have "sin ((w - z) / 2)*cos ((w + z) / 2) = 0" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 512 | by (auto simp: sin_diff_sin) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 513 | then consider "sin ((w - z) / 2) = 0" | "cos ((w + z) / 2) = 0" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 514 | using mult_eq_0_iff by blast | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 515 | then show ?rhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 516 | proof cases | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 517 | case 1 | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 518 | then show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 519 | by (simp add: sin_eq_0 algebra_simps) (metis Ints_of_int of_real_of_int_eq) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 520 | next | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 521 | case 2 | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 522 | then show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 523 | by (simp add: cos_eq_0 algebra_simps) (metis Ints_of_int of_real_of_int_eq) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 524 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 525 | next | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 526 | assume ?rhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 527 | then obtain n::int where w: "w = z + of_real (2* of_int n*pi) \<or> | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 528 | w = -z + of_real ((2* of_int n + 1)*pi)" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 529 | using Ints_cases by blast | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 530 | then show ?lhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 531 | using Periodic_Fun.sin.plus_of_int [of z n] | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 532 | apply (auto simp: algebra_simps) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 533 | by (metis (no_types, hide_lams) add_diff_cancel_left add_diff_cancel_left' add_minus_cancel | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 534 | mult.commute sin.plus_of_int sin_minus sin_plus_pi) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 535 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 536 | |
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 537 | lemma complex_cos_eq: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 538 | fixes w :: complex | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 539 | shows "cos w = cos z \<longleftrightarrow> (\<exists>n \<in> \<int>. w = z + of_real(2*n*pi) \<or> w = -z + of_real(2*n*pi))" | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 540 | (is "?lhs = ?rhs") | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 541 | proof | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 542 | assume ?lhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 543 | then have "cos w - cos z = 0" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 544 | by (auto simp: algebra_simps) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 545 | then have "sin ((w + z) / 2) * sin ((z - w) / 2) = 0" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 546 | by (auto simp: cos_diff_cos) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 547 | then consider "sin ((w + z) / 2) = 0" | "sin ((z - w) / 2) = 0" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 548 | using mult_eq_0_iff by blast | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 549 | then show ?rhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 550 | proof cases | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 551 | case 1 | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 552 | then show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 553 | apply (simp add: sin_eq_0 algebra_simps) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 554 | by (metis Ints_of_int of_real_of_int_eq) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 555 | next | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 556 | case 2 | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 557 | then show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 558 | apply (clarsimp simp: sin_eq_0 algebra_simps) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 559 | by (metis Ints_of_int add_minus_cancel distrib_right mult_of_int_commute mult_zero_right of_int_0 of_int_add of_real_of_int_eq) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 560 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 561 | next | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 562 | assume ?rhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 563 | then obtain n::int where w: "w = z + of_real (2* of_int n*pi) \<or> | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 564 | w = -z + of_real(2*n*pi)" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 565 | using Ints_cases by (metis of_int_mult of_int_numeral) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 566 | then show ?lhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 567 | using Periodic_Fun.cos.plus_of_int [of z n] | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 568 | apply (simp add: algebra_simps) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 569 | by (metis cos.plus_of_int cos_minus minus_add_cancel mult.commute) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 570 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 571 | |
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 572 | lemma sin_eq: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 573 | "sin x = sin y \<longleftrightarrow> (\<exists>n \<in> \<int>. x = y + 2*n*pi \<or> x = -y + (2*n + 1)*pi)" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 574 | using complex_sin_eq [of x y] | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 575 | by (simp only: sin_of_real Re_complex_of_real of_real_add [symmetric] of_real_minus [symmetric] of_real_mult [symmetric] of_real_eq_iff) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 576 | |
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 577 | lemma cos_eq: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 578 | "cos x = cos y \<longleftrightarrow> (\<exists>n \<in> \<int>. x = y + 2*n*pi \<or> x = -y + 2*n*pi)" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 579 | using complex_cos_eq [of x y] | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 580 | by (simp only: cos_of_real Re_complex_of_real of_real_add [symmetric] of_real_minus [symmetric] of_real_mult [symmetric] of_real_eq_iff) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 581 | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 582 | lemma sinh_complex: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 583 | fixes z :: complex | 
| 63589 | 584 | shows "(exp z - inverse (exp z)) / 2 = -\<i> * sin(\<i> * z)" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 585 | by (simp add: sin_exp_eq field_split_simps exp_minus) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 586 | |
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 587 | lemma sin_i_times: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 588 | fixes z :: complex | 
| 63589 | 589 | shows "sin(\<i> * z) = \<i> * ((exp z - inverse (exp z)) / 2)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 590 | using sinh_complex by auto | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 591 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 592 | lemma sinh_real: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 593 | fixes x :: real | 
| 63589 | 594 | shows "of_real((exp x - inverse (exp x)) / 2) = -\<i> * sin(\<i> * of_real x)" | 
| 65274 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 595 | by (simp add: exp_of_real sin_i_times) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 596 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 597 | lemma cosh_complex: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 598 | fixes z :: complex | 
| 63589 | 599 | shows "(exp z + inverse (exp z)) / 2 = cos(\<i> * z)" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 600 | by (simp add: cos_exp_eq field_split_simps exp_minus exp_of_real) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 601 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 602 | lemma cosh_real: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 603 | fixes x :: real | 
| 63589 | 604 | shows "of_real((exp x + inverse (exp x)) / 2) = cos(\<i> * of_real x)" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 605 | by (simp add: cos_exp_eq field_split_simps exp_minus exp_of_real) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 606 | |
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 607 | lemmas cos_i_times = cosh_complex [symmetric] | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 608 | |
| 59862 | 609 | lemma norm_cos_squared: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 610 | "norm(cos z) ^ 2 = cos(Re z) ^ 2 + (exp(Im z) - inverse(exp(Im z))) ^ 2 / 4" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 611 | apply (cases z) | 
| 65274 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 612 | apply (simp add: cos_add cmod_power2 cos_of_real sin_of_real Complex_eq) | 
| 61694 
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
 paulson <lp15@cam.ac.uk> parents: 
61649diff
changeset | 613 | apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide power_divide) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 614 | apply (simp only: left_diff_distrib [symmetric] power_mult_distrib sin_squared_eq) | 
| 71633 | 615 | apply (simp add: power2_eq_square field_split_simps) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 616 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 617 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 618 | lemma norm_sin_squared: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 619 | "norm(sin z) ^ 2 = (exp(2 * Im z) + inverse(exp(2 * Im z)) - 2 * cos(2 * Re z)) / 4" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 620 | apply (cases z) | 
| 65274 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 621 | apply (simp add: sin_add cmod_power2 cos_of_real sin_of_real cos_double_cos exp_double Complex_eq) | 
| 61694 
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
 paulson <lp15@cam.ac.uk> parents: 
61649diff
changeset | 622 | apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide power_divide) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 623 | apply (simp only: left_diff_distrib [symmetric] power_mult_distrib cos_squared_eq) | 
| 71633 | 624 | apply (simp add: power2_eq_square field_split_simps) | 
| 59862 | 625 | done | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 626 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 627 | lemma exp_uminus_Im: "exp (- Im z) \<le> exp (cmod z)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 628 | using abs_Im_le_cmod linear order_trans by fastforce | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 629 | |
| 59862 | 630 | lemma norm_cos_le: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 631 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 632 | shows "norm(cos z) \<le> exp(norm z)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 633 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 634 | have "Im z \<le> cmod z" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 635 | using abs_Im_le_cmod abs_le_D1 by auto | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 636 | with exp_uminus_Im show ?thesis | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 637 | apply (simp add: cos_exp_eq norm_divide) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 638 | apply (rule order_trans [OF norm_triangle_ineq], simp) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 639 | apply (metis add_mono exp_le_cancel_iff mult_2_right) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 640 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 641 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 642 | |
| 59862 | 643 | lemma norm_cos_plus1_le: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 644 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 645 | shows "norm(1 + cos z) \<le> 2 * exp(norm z)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 646 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 647 | have mono: "\<And>u w z::real. (1 \<le> w | 1 \<le> z) \<Longrightarrow> (w \<le> u & z \<le> u) \<Longrightarrow> 2 + w + z \<le> 4 * u" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 648 | by arith | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 649 | have *: "Im z \<le> cmod z" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 650 | using abs_Im_le_cmod abs_le_D1 by auto | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 651 | have triangle3: "\<And>x y z. norm(x + y + z) \<le> norm(x) + norm(y) + norm(z)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 652 | by (simp add: norm_add_rule_thm) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 653 | have "norm(1 + cos z) = cmod (1 + (exp (\<i> * z) + exp (- (\<i> * z))) / 2)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 654 | by (simp add: cos_exp_eq) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 655 | also have "... = cmod ((2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 656 | by (simp add: field_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 657 | also have "... = cmod (2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 658 | by (simp add: norm_divide) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 659 | finally show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 660 | by (metis exp_eq_one_iff exp_le_cancel_iff mult_2 norm_cos_le norm_ge_zero norm_one norm_triangle_mono) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 661 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 662 | |
| 67578 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 663 | lemma sinh_conv_sin: "sinh z = -\<i> * sin (\<i>*z)" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 664 | by (simp add: sinh_field_def sin_i_times exp_minus) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 665 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 666 | lemma cosh_conv_cos: "cosh z = cos (\<i>*z)" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 667 | by (simp add: cosh_field_def cos_i_times exp_minus) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 668 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 669 | lemma tanh_conv_tan: "tanh z = -\<i> * tan (\<i>*z)" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 670 | by (simp add: tanh_def sinh_conv_sin cosh_conv_cos tan_def) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 671 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 672 | lemma sin_conv_sinh: "sin z = -\<i> * sinh (\<i>*z)" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 673 | by (simp add: sinh_conv_sin) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 674 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 675 | lemma cos_conv_cosh: "cos z = cosh (\<i>*z)" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 676 | by (simp add: cosh_conv_cos) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 677 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 678 | lemma tan_conv_tanh: "tan z = -\<i> * tanh (\<i>*z)" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 679 | by (simp add: tan_def sin_conv_sinh cos_conv_cosh tanh_def) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 680 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 681 | lemma sinh_complex_eq_iff: | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 682 | "sinh (z :: complex) = sinh w \<longleftrightarrow> | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 683 | (\<exists>n\<in>\<int>. z = w - 2 * \<i> * of_real n * of_real pi \<or> | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 684 | z = -(2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)" (is "_ = ?rhs") | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 685 | proof - | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 686 | have "sinh z = sinh w \<longleftrightarrow> sin (\<i> * z) = sin (\<i> * w)" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 687 | by (simp add: sinh_conv_sin) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 688 | also have "\<dots> \<longleftrightarrow> ?rhs" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 689 | by (subst complex_sin_eq) (force simp: field_simps complex_eq_iff) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 690 | finally show ?thesis . | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 691 | qed | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 692 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 693 | |
| 70136 | 694 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Taylor series for complex exponential, sine and cosine\<close> | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 695 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 696 | declare power_Suc [simp del] | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 697 | |
| 66252 | 698 | lemma Taylor_exp_field: | 
| 699 |   fixes z::"'a::{banach,real_normed_field}"
 | |
| 700 | shows "norm (exp z - (\<Sum>i\<le>n. z ^ i / fact i)) \<le> exp (norm z) * (norm z ^ Suc n) / fact n" | |
| 69529 | 701 | proof (rule field_Taylor[of _ n "\<lambda>k. exp" "exp (norm z)" 0 z, simplified]) | 
| 66252 | 702 | show "convex (closed_segment 0 z)" | 
| 703 | by (rule convex_closed_segment [of 0 z]) | |
| 704 | next | |
| 705 | fix k x | |
| 706 | assume "x \<in> closed_segment 0 z" "k \<le> n" | |
| 707 | show "(exp has_field_derivative exp x) (at x within closed_segment 0 z)" | |
| 708 | using DERIV_exp DERIV_subset by blast | |
| 709 | next | |
| 710 | fix x | |
| 711 | assume x: "x \<in> closed_segment 0 z" | |
| 712 | have "norm (exp x) \<le> exp (norm x)" | |
| 713 | by (rule norm_exp) | |
| 714 | also have "norm x \<le> norm z" | |
| 715 | using x by (auto simp: closed_segment_def intro!: mult_left_le_one_le) | |
| 716 | finally show "norm (exp x) \<le> exp (norm z)" | |
| 717 | by simp | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 718 | qed auto | 
| 66252 | 719 | |
| 59862 | 720 | lemma Taylor_exp: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 721 | "norm(exp z - (\<Sum>k\<le>n. z ^ k / (fact k))) \<le> exp\<bar>Re z\<bar> * (norm z) ^ (Suc n) / (fact n)" | 
| 69529 | 722 | proof (rule complex_Taylor [of _ n "\<lambda>k. exp" "exp\<bar>Re z\<bar>" 0 z, simplified]) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 723 | show "convex (closed_segment 0 z)" | 
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 724 | by (rule convex_closed_segment [of 0 z]) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 725 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 726 | fix k x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 727 | assume "x \<in> closed_segment 0 z" "k \<le> n" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 728 | show "(exp has_field_derivative exp x) (at x within closed_segment 0 z)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 729 | using DERIV_exp DERIV_subset by blast | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 730 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 731 | fix x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 732 | assume "x \<in> closed_segment 0 z" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 733 | then show "Re x \<le> \<bar>Re z\<bar>" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 734 | apply (clarsimp simp: closed_segment_def scaleR_conv_of_real) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 735 | by (meson abs_ge_self abs_ge_zero linear mult_left_le_one_le mult_nonneg_nonpos order_trans) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 736 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 737 | |
| 59862 | 738 | lemma | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 739 | assumes "0 \<le> u" "u \<le> 1" | 
| 59862 | 740 | shows cmod_sin_le_exp: "cmod (sin (u *\<^sub>R z)) \<le> exp \<bar>Im z\<bar>" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 741 | and cmod_cos_le_exp: "cmod (cos (u *\<^sub>R z)) \<le> exp \<bar>Im z\<bar>" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 742 | proof - | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 743 | have mono: "\<And>u w z::real. w \<le> u \<Longrightarrow> z \<le> u \<Longrightarrow> (w + z)/2 \<le> u" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 744 | by simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 745 | have *: "(cmod (exp (\<i> * (u * z))) + cmod (exp (- (\<i> * (u * z)))) ) / 2 \<le> exp \<bar>Im z\<bar>" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 746 | proof (rule mono) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 747 | show "cmod (exp (\<i> * (u * z))) \<le> exp \<bar>Im z\<bar>" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 748 | apply (simp add: abs_if mult_left_le_one_le assms not_less) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 749 | by (meson assms(1) mult_nonneg_nonneg neg_le_0_iff_le order_trans) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 750 | show "cmod (exp (- (\<i> * (u * z)))) \<le> exp \<bar>Im z\<bar>" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 751 | apply (simp add: abs_if mult_left_le_one_le assms) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 752 | by (meson \<open>0 \<le> u\<close> less_eq_real_def mult_nonneg_nonpos neg_0_le_iff_le order_trans) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 753 | qed | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 754 | have "cmod (sin (u *\<^sub>R z)) = cmod (exp (\<i> * (u * z)) - exp (- (\<i> * (u * z)))) / 2" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 755 | by (auto simp: scaleR_conv_of_real norm_mult norm_power sin_exp_eq norm_divide) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 756 | also have "... \<le> (cmod (exp (\<i> * (u * z))) + cmod (exp (- (\<i> * (u * z)))) ) / 2" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 757 | by (intro divide_right_mono norm_triangle_ineq4) simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 758 | also have "... \<le> exp \<bar>Im z\<bar>" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 759 | by (rule *) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 760 | finally show "cmod (sin (u *\<^sub>R z)) \<le> exp \<bar>Im z\<bar>" . | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 761 | have "cmod (cos (u *\<^sub>R z)) = cmod (exp (\<i> * (u * z)) + exp (- (\<i> * (u * z)))) / 2" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 762 | by (auto simp: scaleR_conv_of_real norm_mult norm_power cos_exp_eq norm_divide) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 763 | also have "... \<le> (cmod (exp (\<i> * (u * z))) + cmod (exp (- (\<i> * (u * z)))) ) / 2" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 764 | by (intro divide_right_mono norm_triangle_ineq) simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 765 | also have "... \<le> exp \<bar>Im z\<bar>" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 766 | by (rule *) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 767 | finally show "cmod (cos (u *\<^sub>R z)) \<le> exp \<bar>Im z\<bar>" . | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 768 | qed | 
| 59862 | 769 | |
| 770 | lemma Taylor_sin: | |
| 771 | "norm(sin z - (\<Sum>k\<le>n. complex_of_real (sin_coeff k) * z ^ k)) | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 772 | \<le> exp\<bar>Im z\<bar> * (norm z) ^ (Suc n) / (fact n)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 773 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 774 | have mono: "\<And>u w z::real. w \<le> u \<Longrightarrow> z \<le> u \<Longrightarrow> w + z \<le> u*2" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 775 | by arith | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 776 | have *: "cmod (sin z - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 777 | (\<Sum>i\<le>n. (-1) ^ (i div 2) * (if even i then sin 0 else cos 0) * z ^ i / (fact i))) | 
| 59862 | 778 | \<le> exp \<bar>Im z\<bar> * cmod z ^ Suc n / (fact n)" | 
| 69529 | 779 | proof (rule complex_Taylor [of "closed_segment 0 z" n | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 780 | "\<lambda>k x. (-1)^(k div 2) * (if even k then sin x else cos x)" | 
| 60162 | 781 | "exp\<bar>Im z\<bar>" 0 z, simplified]) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 782 | fix k x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 783 | show "((\<lambda>x. (- 1) ^ (k div 2) * (if even k then sin x else cos x)) has_field_derivative | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 784 | (- 1) ^ (Suc k div 2) * (if odd k then sin x else cos x)) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 785 | (at x within closed_segment 0 z)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 786 | apply (auto simp: power_Suc) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 787 | apply (intro derivative_eq_intros | simp)+ | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 788 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 789 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 790 | fix x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 791 | assume "x \<in> closed_segment 0 z" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 792 | then show "cmod ((- 1) ^ (Suc n div 2) * (if odd n then sin x else cos x)) \<le> exp \<bar>Im z\<bar>" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 793 | by (auto simp: closed_segment_def norm_mult norm_power cmod_sin_le_exp cmod_cos_le_exp) | 
| 59862 | 794 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 795 | have **: "\<And>k. complex_of_real (sin_coeff k) * z ^ k | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 796 | = (-1)^(k div 2) * (if even k then sin 0 else cos 0) * z^k / of_nat (fact k)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 797 | by (auto simp: sin_coeff_def elim!: oddE) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 798 | show ?thesis | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 799 | apply (rule order_trans [OF _ *]) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 800 | apply (simp add: **) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 801 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 802 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 803 | |
| 59862 | 804 | lemma Taylor_cos: | 
| 805 | "norm(cos z - (\<Sum>k\<le>n. complex_of_real (cos_coeff k) * z ^ k)) | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 806 | \<le> exp\<bar>Im z\<bar> * (norm z) ^ Suc n / (fact n)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 807 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 808 | have mono: "\<And>u w z::real. w \<le> u \<Longrightarrow> z \<le> u \<Longrightarrow> w + z \<le> u*2" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 809 | by arith | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 810 | have *: "cmod (cos z - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 811 | (\<Sum>i\<le>n. (-1) ^ (Suc i div 2) * (if even i then cos 0 else sin 0) * z ^ i / (fact i))) | 
| 59862 | 812 | \<le> exp \<bar>Im z\<bar> * cmod z ^ Suc n / (fact n)" | 
| 69529 | 813 | proof (rule complex_Taylor [of "closed_segment 0 z" n "\<lambda>k x. (-1)^(Suc k div 2) * (if even k then cos x else sin x)" "exp\<bar>Im z\<bar>" 0 z, | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 814 | simplified]) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 815 | fix k x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 816 | assume "x \<in> closed_segment 0 z" "k \<le> n" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 817 | show "((\<lambda>x. (- 1) ^ (Suc k div 2) * (if even k then cos x else sin x)) has_field_derivative | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 818 | (- 1) ^ Suc (k div 2) * (if odd k then cos x else sin x)) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 819 | (at x within closed_segment 0 z)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 820 | apply (auto simp: power_Suc) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 821 | apply (intro derivative_eq_intros | simp)+ | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 822 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 823 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 824 | fix x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 825 | assume "x \<in> closed_segment 0 z" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 826 | then show "cmod ((- 1) ^ Suc (n div 2) * (if odd n then cos x else sin x)) \<le> exp \<bar>Im z\<bar>" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 827 | by (auto simp: closed_segment_def norm_mult norm_power cmod_sin_le_exp cmod_cos_le_exp) | 
| 59862 | 828 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 829 | have **: "\<And>k. complex_of_real (cos_coeff k) * z ^ k | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 830 | = (-1)^(Suc k div 2) * (if even k then cos 0 else sin 0) * z^k / of_nat (fact k)" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 831 | by (auto simp: cos_coeff_def elim!: evenE) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 832 | show ?thesis | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 833 | apply (rule order_trans [OF _ *]) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 834 | apply (simp add: **) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 835 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 836 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 837 | |
| 60162 | 838 | declare power_Suc [simp] | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 839 | |
| 60420 | 840 | text\<open>32-bit Approximation to e\<close> | 
| 61945 | 841 | lemma e_approx_32: "\<bar>exp(1) - 5837465777 / 2147483648\<bar> \<le> (inverse(2 ^ 32)::real)" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 842 | using Taylor_exp [of 1 14] exp_le | 
| 64267 | 843 | apply (simp add: sum_distrib_right in_Reals_norm Re_exp atMost_nat_numeral fact_numeral) | 
| 66611 | 844 | apply (simp only: pos_le_divide_eq [symmetric]) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 845 | done | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 846 | |
| 65719 | 847 | lemma e_less_272: "exp 1 < (272/100::real)" | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 848 | using e_approx_32 | 
| 62390 | 849 | by (simp add: abs_if split: if_split_asm) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 850 | |
| 65719 | 851 | lemma ln_272_gt_1: "ln (272/100) > (1::real)" | 
| 852 | by (metis e_less_272 exp_less_cancel_iff exp_ln_iff less_trans ln_exp) | |
| 853 | ||
| 854 | text\<open>Apparently redundant. But many arguments involve integers.\<close> | |
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 855 | lemma ln3_gt_1: "ln 3 > (1::real)" | 
| 65719 | 856 | by (simp add: less_trans [OF ln_272_gt_1]) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 857 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 858 | subsection\<open>The argument of a complex number (HOL Light version)\<close> | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 859 | |
| 70136 | 860 | definition\<^marker>\<open>tag important\<close> is_Arg :: "[complex,real] \<Rightarrow> bool" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 861 | where "is_Arg z r \<equiv> z = of_real(norm z) * exp(\<i> * of_real r)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 862 | |
| 70136 | 863 | definition\<^marker>\<open>tag important\<close> Arg2pi :: "complex \<Rightarrow> real" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 864 | where "Arg2pi z \<equiv> if z = 0 then 0 else THE t. 0 \<le> t \<and> t < 2*pi \<and> is_Arg z t" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 865 | |
| 68517 | 866 | lemma is_Arg_2pi_iff: "is_Arg z (r + of_int k * (2 * pi)) \<longleftrightarrow> is_Arg z r" | 
| 867 | by (simp add: algebra_simps is_Arg_def) | |
| 868 | ||
| 869 | lemma is_Arg_eqI: | |
| 870 | assumes r: "is_Arg z r" and s: "is_Arg z s" and rs: "abs (r-s) < 2*pi" and "z \<noteq> 0" | |
| 871 | shows "r = s" | |
| 872 | proof - | |
| 873 | have zr: "z = (cmod z) * exp (\<i> * r)" and zs: "z = (cmod z) * exp (\<i> * s)" | |
| 874 | using r s by (auto simp: is_Arg_def) | |
| 875 | with \<open>z \<noteq> 0\<close> have eq: "exp (\<i> * r) = exp (\<i> * s)" | |
| 70196 
b7ef9090feed
Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 876 | by (metis mult_eq_0_iff mult_left_cancel) | 
| 68517 | 877 | have "\<i> * r = \<i> * s" | 
| 878 | by (rule exp_complex_eqI) (use rs in \<open>auto simp: eq exp_complex_eqI\<close>) | |
| 879 | then show ?thesis | |
| 880 | by simp | |
| 881 | qed | |
| 882 | ||
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 883 | text\<open>This function returns the angle of a complex number from its representation in polar coordinates. | 
| 69597 | 884 | Due to periodicity, its range is arbitrary. \<^term>\<open>Arg2pi\<close> follows HOL Light in adopting the interval \<open>[0,2\<pi>)\<close>. | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 885 | But we have the same periodicity issue with logarithms, and it is usual to adopt the same interval | 
| 69566 | 886 | for the complex logarithm and argument functions. Further on down, we shall define both functions for the interval \<open>(-\<pi>,\<pi>]\<close>. | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 887 | The present version is provided for compatibility.\<close> | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 888 | |
| 68493 | 889 | lemma Arg2pi_0 [simp]: "Arg2pi(0) = 0" | 
| 890 | by (simp add: Arg2pi_def) | |
| 891 | ||
| 892 | lemma Arg2pi_unique_lemma: | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 893 | assumes z: "is_Arg z t" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 894 | and z': "is_Arg z t'" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 895 | and t: "0 \<le> t" "t < 2*pi" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 896 | and t': "0 \<le> t'" "t' < 2*pi" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 897 | and nz: "z \<noteq> 0" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 898 | shows "t' = t" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 899 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 900 | have [dest]: "\<And>x y z::real. x\<ge>0 \<Longrightarrow> x+y < z \<Longrightarrow> y<z" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 901 | by arith | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 902 | have "of_real (cmod z) * exp (\<i> * of_real t') = of_real (cmod z) * exp (\<i> * of_real t)" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 903 | by (metis z z' is_Arg_def) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 904 | then have "exp (\<i> * of_real t') = exp (\<i> * of_real t)" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 905 | by (metis nz mult_left_cancel mult_zero_left z is_Arg_def) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 906 | then have "sin t' = sin t \<and> cos t' = cos t" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 907 | apply (simp add: exp_Euler sin_of_real cos_of_real) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 908 | by (metis Complex_eq complex.sel) | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 909 | then obtain n::int where n: "t' = t + 2 * n * pi" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 910 | by (auto simp: sin_cos_eq_iff) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 911 | then have "n=0" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 912 | by (cases n) (use t t' in \<open>auto simp: mult_less_0_iff algebra_simps\<close>) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 913 | then show "t' = t" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 914 | by (simp add: n) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 915 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 916 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 917 | lemma Arg2pi: "0 \<le> Arg2pi z \<and> Arg2pi z < 2*pi \<and> is_Arg z (Arg2pi z)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 918 | proof (cases "z=0") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 919 | case True then show ?thesis | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 920 | by (simp add: Arg2pi_def is_Arg_def) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 921 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 922 | case False | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 923 | obtain t where t: "0 \<le> t" "t < 2*pi" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 924 | and ReIm: "Re z / cmod z = cos t" "Im z / cmod z = sin t" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 925 | using sincos_total_2pi [OF complex_unit_circle [OF False]] | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 926 | by blast | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 927 | have z: "is_Arg z t" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 928 | unfolding is_Arg_def | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 929 | apply (rule complex_eqI) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 930 | using t False ReIm | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 931 | apply (auto simp: exp_Euler sin_of_real cos_of_real field_split_simps) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 932 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 933 | show ?thesis | 
| 68493 | 934 | apply (simp add: Arg2pi_def False) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 935 | apply (rule theI [where a=t]) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 936 | using t z False | 
| 68493 | 937 | apply (auto intro: Arg2pi_unique_lemma) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 938 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 939 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 940 | |
| 70136 | 941 | corollary\<^marker>\<open>tag unimportant\<close> | 
| 68493 | 942 | shows Arg2pi_ge_0: "0 \<le> Arg2pi z" | 
| 943 | and Arg2pi_lt_2pi: "Arg2pi z < 2*pi" | |
| 944 | and Arg2pi_eq: "z = of_real(norm z) * exp(\<i> * of_real(Arg2pi z))" | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 945 | using Arg2pi is_Arg_def by auto | 
| 68493 | 946 | |
| 947 | lemma complex_norm_eq_1_exp: "norm z = 1 \<longleftrightarrow> exp(\<i> * of_real (Arg2pi z)) = z" | |
| 948 | by (metis Arg2pi_eq cis_conv_exp mult.left_neutral norm_cis of_real_1) | |
| 949 | ||
| 950 | lemma Arg2pi_unique: "\<lbrakk>of_real r * exp(\<i> * of_real a) = z; 0 < r; 0 \<le> a; a < 2*pi\<rbrakk> \<Longrightarrow> Arg2pi z = a" | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 951 | by (rule Arg2pi_unique_lemma [unfolded is_Arg_def, OF _ Arg2pi_eq]) (use Arg2pi [of z] in \<open>auto simp: norm_mult\<close>) | 
| 68493 | 952 | |
| 953 | lemma Arg2pi_minus: "z \<noteq> 0 \<Longrightarrow> Arg2pi (-z) = (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi)" | |
| 954 | apply (rule Arg2pi_unique [of "norm z"]) | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 955 | apply (rule complex_eqI) | 
| 68493 | 956 | using Arg2pi_ge_0 [of z] Arg2pi_eq [of z] Arg2pi_lt_2pi [of z] | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 957 | apply (auto simp: Re_exp Im_exp cos_diff sin_diff cis_conv_exp [symmetric]) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 958 | apply (metis Re_rcis Im_rcis rcis_def)+ | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 959 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 960 | |
| 68493 | 961 | lemma Arg2pi_times_of_real [simp]: | 
| 962 | assumes "0 < r" shows "Arg2pi (of_real r * z) = Arg2pi z" | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 963 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 964 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 965 | show ?thesis | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 966 | by (rule Arg2pi_unique [of "r * norm z"]) (use Arg2pi False assms is_Arg_def in auto) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 967 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 968 | |
| 68493 | 969 | lemma Arg2pi_times_of_real2 [simp]: "0 < r \<Longrightarrow> Arg2pi (z * of_real r) = Arg2pi z" | 
| 970 | by (metis Arg2pi_times_of_real mult.commute) | |
| 971 | ||
| 972 | lemma Arg2pi_divide_of_real [simp]: "0 < r \<Longrightarrow> Arg2pi (z / of_real r) = Arg2pi z" | |
| 973 | by (metis Arg2pi_times_of_real2 less_numeral_extra(3) nonzero_eq_divide_eq of_real_eq_0_iff) | |
| 974 | ||
| 975 | lemma Arg2pi_le_pi: "Arg2pi z \<le> pi \<longleftrightarrow> 0 \<le> Im z" | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 976 | proof (cases "z=0") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 977 | case False | 
| 68493 | 978 | have "0 \<le> Im z \<longleftrightarrow> 0 \<le> Im (of_real (cmod z) * exp (\<i> * complex_of_real (Arg2pi z)))" | 
| 979 | by (metis Arg2pi_eq) | |
| 980 | also have "... = (0 \<le> Im (exp (\<i> * complex_of_real (Arg2pi z))))" | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 981 | using False by (simp add: zero_le_mult_iff) | 
| 68493 | 982 | also have "... \<longleftrightarrow> Arg2pi z \<le> pi" | 
| 983 | by (simp add: Im_exp) (metis Arg2pi_ge_0 Arg2pi_lt_2pi sin_lt_zero sin_ge_zero not_le) | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 984 | finally show ?thesis | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 985 | by blast | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 986 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 987 | |
| 68493 | 988 | lemma Arg2pi_lt_pi: "0 < Arg2pi z \<and> Arg2pi z < pi \<longleftrightarrow> 0 < Im z" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 989 | proof (cases "z=0") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 990 | case False | 
| 68493 | 991 | have "0 < Im z \<longleftrightarrow> 0 < Im (of_real (cmod z) * exp (\<i> * complex_of_real (Arg2pi z)))" | 
| 992 | by (metis Arg2pi_eq) | |
| 993 | also have "... = (0 < Im (exp (\<i> * complex_of_real (Arg2pi z))))" | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 994 | using False by (simp add: zero_less_mult_iff) | 
| 68493 | 995 | also have "... \<longleftrightarrow> 0 < Arg2pi z \<and> Arg2pi z < pi" | 
| 996 | using Arg2pi_ge_0 Arg2pi_lt_2pi sin_le_zero sin_gt_zero | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 997 | apply (auto simp: Im_exp) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 998 | using le_less apply fastforce | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 999 | using not_le by blast | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1000 | finally show ?thesis | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1001 | by blast | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1002 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1003 | |
| 68493 | 1004 | lemma Arg2pi_eq_0: "Arg2pi z = 0 \<longleftrightarrow> z \<in> \<real> \<and> 0 \<le> Re z" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1005 | proof (cases "z=0") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1006 | case False | 
| 68493 | 1007 | have "z \<in> \<real> \<and> 0 \<le> Re z \<longleftrightarrow> z \<in> \<real> \<and> 0 \<le> Re (of_real (cmod z) * exp (\<i> * complex_of_real (Arg2pi z)))" | 
| 1008 | by (metis Arg2pi_eq) | |
| 1009 | also have "... \<longleftrightarrow> z \<in> \<real> \<and> 0 \<le> Re (exp (\<i> * complex_of_real (Arg2pi z)))" | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1010 | using False by (simp add: zero_le_mult_iff) | 
| 68493 | 1011 | also have "... \<longleftrightarrow> Arg2pi z = 0" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1012 | proof - | 
| 68493 | 1013 | have [simp]: "Arg2pi z = 0 \<Longrightarrow> z \<in> \<real>" | 
| 1014 | using Arg2pi_eq [of z] by (auto simp: Reals_def) | |
| 1015 | moreover have "\<lbrakk>z \<in> \<real>; 0 \<le> cos (Arg2pi z)\<rbrakk> \<Longrightarrow> Arg2pi z = 0" | |
| 1016 | by (metis Arg2pi_lt_pi Arg2pi_ge_0 Arg2pi_le_pi cos_pi complex_is_Real_iff leD less_linear less_minus_one_simps(2) minus_minus neg_less_eq_nonneg order_refl) | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1017 | ultimately show ?thesis | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1018 | by (auto simp: Re_exp) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1019 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1020 | finally show ?thesis | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1021 | by blast | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1022 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1023 | |
| 70136 | 1024 | corollary\<^marker>\<open>tag unimportant\<close> Arg2pi_gt_0: | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1025 | assumes "z \<notin> \<real>\<^sub>\<ge>\<^sub>0" | 
| 68493 | 1026 | shows "Arg2pi z > 0" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1027 | using Arg2pi_eq_0 Arg2pi_ge_0 assms dual_order.strict_iff_order | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1028 | unfolding nonneg_Reals_def by fastforce | 
| 68493 | 1029 | |
| 1030 | lemma Arg2pi_eq_pi: "Arg2pi z = pi \<longleftrightarrow> z \<in> \<real> \<and> Re z < 0" | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1031 | using Arg2pi_le_pi [of z] Arg2pi_lt_pi [of z] Arg2pi_eq_0 [of z] Arg2pi_ge_0 [of z] | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1032 | by (fastforce simp: complex_is_Real_iff) | 
| 68493 | 1033 | |
| 1034 | lemma Arg2pi_eq_0_pi: "Arg2pi z = 0 \<or> Arg2pi z = pi \<longleftrightarrow> z \<in> \<real>" | |
| 1035 | using Arg2pi_eq_0 Arg2pi_eq_pi not_le by auto | |
| 1036 | ||
| 68517 | 1037 | lemma Arg2pi_of_real: "Arg2pi (of_real r) = (if r<0 then pi else 0)" | 
| 1038 | using Arg2pi_eq_0_pi Arg2pi_eq_pi by fastforce | |
| 1039 | ||
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1040 | lemma Arg2pi_real: "z \<in> \<real> \<Longrightarrow> Arg2pi z = (if 0 \<le> Re z then 0 else pi)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1041 | using Arg2pi_eq_0 Arg2pi_eq_0_pi by auto | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1042 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1043 | lemma Arg2pi_inverse: "Arg2pi(inverse z) = (if z \<in> \<real> then Arg2pi z else 2*pi - Arg2pi z)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1044 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1045 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1046 | show ?thesis | 
| 68493 | 1047 | apply (rule Arg2pi_unique [of "inverse (norm z)"]) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1048 | using Arg2pi_eq False Arg2pi_ge_0 [of z] Arg2pi_lt_2pi [of z] Arg2pi_eq_0 [of z] | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1049 | by (auto simp: Arg2pi_real in_Reals_norm exp_diff field_simps) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1050 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1051 | |
| 68493 | 1052 | lemma Arg2pi_eq_iff: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1053 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 68493 | 1054 | shows "Arg2pi w = Arg2pi z \<longleftrightarrow> (\<exists>x. 0 < x & w = of_real x * z)" | 
| 1055 | using assms Arg2pi_eq [of z] Arg2pi_eq [of w] | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1056 | apply auto | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1057 | apply (rule_tac x="norm w / norm z" in exI) | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 1058 | apply (simp add: field_split_simps) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1059 | by (metis mult.commute mult.left_commute) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1060 | |
| 68493 | 1061 | lemma Arg2pi_inverse_eq_0: "Arg2pi(inverse z) = 0 \<longleftrightarrow> Arg2pi z = 0" | 
| 1062 | by (metis Arg2pi_eq_0 Arg2pi_inverse inverse_inverse_eq) | |
| 1063 | ||
| 1064 | lemma Arg2pi_divide: | |
| 1065 | assumes "w \<noteq> 0" "z \<noteq> 0" "Arg2pi w \<le> Arg2pi z" | |
| 1066 | shows "Arg2pi(z / w) = Arg2pi z - Arg2pi w" | |
| 1067 | apply (rule Arg2pi_unique [of "norm(z / w)"]) | |
| 1068 | using assms Arg2pi_eq Arg2pi_ge_0 [of w] Arg2pi_lt_2pi [of z] | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1069 | apply (auto simp: exp_diff norm_divide field_simps) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1070 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1071 | |
| 68493 | 1072 | lemma Arg2pi_le_div_sum: | 
| 1073 | assumes "w \<noteq> 0" "z \<noteq> 0" "Arg2pi w \<le> Arg2pi z" | |
| 1074 | shows "Arg2pi z = Arg2pi w + Arg2pi(z / w)" | |
| 1075 | by (simp add: Arg2pi_divide assms) | |
| 1076 | ||
| 1077 | lemma Arg2pi_le_div_sum_eq: | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1078 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 68493 | 1079 | shows "Arg2pi w \<le> Arg2pi z \<longleftrightarrow> Arg2pi z = Arg2pi w + Arg2pi(z / w)" | 
| 1080 | using assms by (auto simp: Arg2pi_ge_0 intro: Arg2pi_le_div_sum) | |
| 1081 | ||
| 1082 | lemma Arg2pi_diff: | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1083 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 68493 | 1084 | shows "Arg2pi w - Arg2pi z = (if Arg2pi z \<le> Arg2pi w then Arg2pi(w / z) else Arg2pi(w/z) - 2*pi)" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1085 | using assms Arg2pi_divide Arg2pi_inverse [of "w/z"] Arg2pi_eq_0_pi | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1086 | by (force simp add: Arg2pi_ge_0 Arg2pi_divide not_le split: if_split_asm) | 
| 68493 | 1087 | |
| 1088 | lemma Arg2pi_add: | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1089 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 68493 | 1090 | shows "Arg2pi w + Arg2pi z = (if Arg2pi w + Arg2pi z < 2*pi then Arg2pi(w * z) else Arg2pi(w * z) + 2*pi)" | 
| 1091 | using assms Arg2pi_diff [of "w*z" z] Arg2pi_le_div_sum_eq [of z "w*z"] | |
| 1092 | apply (auto simp: Arg2pi_ge_0 Arg2pi_divide not_le) | |
| 1093 | apply (metis Arg2pi_lt_2pi add.commute) | |
| 1094 | apply (metis (no_types) Arg2pi add.commute diff_0 diff_add_cancel diff_less_eq diff_minus_eq_add not_less) | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1095 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1096 | |
| 68493 | 1097 | lemma Arg2pi_times: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1098 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 68493 | 1099 | shows "Arg2pi (w * z) = (if Arg2pi w + Arg2pi z < 2*pi then Arg2pi w + Arg2pi z | 
| 1100 | else (Arg2pi w + Arg2pi z) - 2*pi)" | |
| 1101 | using Arg2pi_add [OF assms] | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1102 | by auto | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1103 | |
| 68493 | 1104 | lemma Arg2pi_cnj_eq_inverse: "z\<noteq>0 \<Longrightarrow> Arg2pi (cnj z) = Arg2pi (inverse z)" | 
| 71633 | 1105 | apply (simp add: Arg2pi_eq_iff field_split_simps complex_norm_square [symmetric]) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1106 | by (metis of_real_power zero_less_norm_iff zero_less_power) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1107 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1108 | lemma Arg2pi_cnj: "Arg2pi(cnj z) = (if z \<in> \<real> then Arg2pi z else 2*pi - Arg2pi z)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1109 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1110 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1111 | then show ?thesis | 
| 68493 | 1112 | by (simp add: Arg2pi_cnj_eq_inverse Arg2pi_inverse) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1113 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1114 | |
| 68493 | 1115 | lemma Arg2pi_exp: "0 \<le> Im z \<Longrightarrow> Im z < 2*pi \<Longrightarrow> Arg2pi(exp z) = Im z" | 
| 1116 | by (rule Arg2pi_unique [of "exp(Re z)"]) (auto simp: exp_eq_polar) | |
| 61762 
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
 paulson <lp15@cam.ac.uk> parents: 
61711diff
changeset | 1117 | |
| 
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
 paulson <lp15@cam.ac.uk> parents: 
61711diff
changeset | 1118 | lemma complex_split_polar: | 
| 
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
 paulson <lp15@cam.ac.uk> parents: 
61711diff
changeset | 1119 | obtains r a::real where "z = complex_of_real r * (cos a + \<i> * sin a)" "0 \<le> r" "0 \<le> a" "a < 2*pi" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1120 | using Arg2pi cis.ctr cis_conv_exp unfolding Complex_eq is_Arg_def by fastforce | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1121 | |
| 61806 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1122 | lemma Re_Im_le_cmod: "Im w * sin \<phi> + Re w * cos \<phi> \<le> cmod w" | 
| 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1123 | proof (cases w rule: complex_split_polar) | 
| 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1124 | case (1 r a) with sin_cos_le1 [of a \<phi>] show ?thesis | 
| 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1125 | apply (simp add: norm_mult cmod_unit_one) | 
| 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1126 | by (metis (no_types, hide_lams) abs_le_D1 distrib_left mult.commute mult.left_commute mult_left_le) | 
| 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1127 | qed | 
| 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1128 | |
| 70136 | 1129 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Analytic properties of tangent function\<close> | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1130 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1131 | lemma cnj_tan: "cnj(tan z) = tan(cnj z)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1132 | by (simp add: cnj_cos cnj_sin tan_def) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1133 | |
| 69508 | 1134 | lemma field_differentiable_at_tan: "cos z \<noteq> 0 \<Longrightarrow> tan field_differentiable at z" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1135 | unfolding field_differentiable_def | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1136 | using DERIV_tan by blast | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1137 | |
| 69508 | 1138 | lemma field_differentiable_within_tan: "cos z \<noteq> 0 | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1139 | \<Longrightarrow> tan field_differentiable (at z within s)" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1140 | using field_differentiable_at_tan field_differentiable_at_within by blast | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1141 | |
| 69508 | 1142 | lemma continuous_within_tan: "cos z \<noteq> 0 \<Longrightarrow> continuous (at z within s) tan" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1143 | using continuous_at_imp_continuous_within isCont_tan by blast | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1144 | |
| 69508 | 1145 | lemma continuous_on_tan [continuous_intros]: "(\<And>z. z \<in> s \<Longrightarrow> cos z \<noteq> 0) \<Longrightarrow> continuous_on s tan" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1146 | by (simp add: continuous_at_imp_continuous_on) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1147 | |
| 69508 | 1148 | lemma holomorphic_on_tan: "(\<And>z. z \<in> s \<Longrightarrow> cos z \<noteq> 0) \<Longrightarrow> tan holomorphic_on s" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1149 | by (simp add: field_differentiable_within_tan holomorphic_on_def) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1150 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1151 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1152 | subsection\<open>The principal branch of the Complex logarithm\<close> | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1153 | |
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1154 | instantiation complex :: ln | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1155 | begin | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 1156 | |
| 70136 | 1157 | definition\<^marker>\<open>tag important\<close> ln_complex :: "complex \<Rightarrow> complex" | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1158 | where "ln_complex \<equiv> \<lambda>z. THE w. exp w = z & -pi < Im(w) & Im(w) \<le> pi" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1159 | |
| 65585 
a043de9ad41e
Some fixes related to compactE_image
 paulson <lp15@cam.ac.uk> parents: 
65583diff
changeset | 1160 | text\<open>NOTE: within this scope, the constant Ln is not yet available!\<close> | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1161 | lemma | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1162 | assumes "z \<noteq> 0" | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1163 | shows exp_Ln [simp]: "exp(ln z) = z" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1164 | and mpi_less_Im_Ln: "-pi < Im(ln z)" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1165 | and Im_Ln_le_pi: "Im(ln z) \<le> pi" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1166 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1167 | obtain \<psi> where z: "z / (cmod z) = Complex (cos \<psi>) (sin \<psi>)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1168 | using complex_unimodular_polar [of "z / (norm z)"] assms | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 1169 | by (auto simp: norm_divide field_split_simps) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1170 | obtain \<phi> where \<phi>: "- pi < \<phi>" "\<phi> \<le> pi" "sin \<phi> = sin \<psi>" "cos \<phi> = cos \<psi>" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1171 | using sincos_principal_value [of "\<psi>"] assms | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 1172 | by (auto simp: norm_divide field_split_simps) | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1173 | have "exp(ln z) = z & -pi < Im(ln z) & Im(ln z) \<le> pi" unfolding ln_complex_def | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1174 | apply (rule theI [where a = "Complex (ln(norm z)) \<phi>"]) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1175 | using z assms \<phi> | 
| 61762 
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
 paulson <lp15@cam.ac.uk> parents: 
61711diff
changeset | 1176 | apply (auto simp: field_simps exp_complex_eqI exp_eq_polar cis.code) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1177 | done | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1178 | then show "exp(ln z) = z" "-pi < Im(ln z)" "Im(ln z) \<le> pi" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1179 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1180 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1181 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1182 | lemma Ln_exp [simp]: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1183 | assumes "-pi < Im(z)" "Im(z) \<le> pi" | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1184 | shows "ln(exp z) = z" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1185 | apply (rule exp_complex_eqI) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1186 | using assms mpi_less_Im_Ln [of "exp z"] Im_Ln_le_pi [of "exp z"] | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1187 | apply auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1188 | done | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1189 | |
| 70136 | 1190 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Relation to Real Logarithm\<close> | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1191 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1192 | lemma Ln_of_real: | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1193 | assumes "0 < z" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1194 | shows "ln(of_real z::complex) = of_real(ln z)" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1195 | proof - | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1196 | have "ln(of_real (exp (ln z))::complex) = ln (exp (of_real (ln z)))" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1197 | by (simp add: exp_of_real) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1198 | also have "... = of_real(ln z)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1199 | using assms by (subst Ln_exp) auto | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1200 | finally show ?thesis | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1201 | using assms by simp | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1202 | qed | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1203 | |
| 70136 | 1204 | corollary\<^marker>\<open>tag unimportant\<close> Ln_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> Re z > 0 \<Longrightarrow> ln z \<in> \<real>" | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1205 | by (auto simp: Ln_of_real elim: Reals_cases) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1206 | |
| 70136 | 1207 | corollary\<^marker>\<open>tag unimportant\<close> Im_Ln_of_real [simp]: "r > 0 \<Longrightarrow> Im (ln (of_real r)) = 0" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1208 | by (simp add: Ln_of_real) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1209 | |
| 61070 | 1210 | lemma cmod_Ln_Reals [simp]: "z \<in> \<real> \<Longrightarrow> 0 < Re z \<Longrightarrow> cmod (ln z) = norm (ln (Re z))" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1211 | using Ln_of_real by force | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1212 | |
| 65719 | 1213 | lemma Ln_Reals_eq: "\<lbrakk>x \<in> \<real>; Re x > 0\<rbrakk> \<Longrightarrow> ln x = of_real (ln (Re x))" | 
| 1214 | using Ln_of_real by force | |
| 1215 | ||
| 65585 
a043de9ad41e
Some fixes related to compactE_image
 paulson <lp15@cam.ac.uk> parents: 
65583diff
changeset | 1216 | lemma Ln_1 [simp]: "ln 1 = (0::complex)" | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1217 | proof - | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1218 | have "ln (exp 0) = (0::complex)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1219 | by (simp add: del: exp_zero) | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1220 | then show ?thesis | 
| 68493 | 1221 | by simp | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1222 | qed | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1223 | |
| 68493 | 1224 | |
| 65585 
a043de9ad41e
Some fixes related to compactE_image
 paulson <lp15@cam.ac.uk> parents: 
65583diff
changeset | 1225 | lemma Ln_eq_zero_iff [simp]: "x \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> ln x = 0 \<longleftrightarrow> x = 1" for x::complex | 
| 
a043de9ad41e
Some fixes related to compactE_image
 paulson <lp15@cam.ac.uk> parents: 
65583diff
changeset | 1226 | by auto (metis exp_Ln exp_zero nonpos_Reals_zero_I) | 
| 
a043de9ad41e
Some fixes related to compactE_image
 paulson <lp15@cam.ac.uk> parents: 
65583diff
changeset | 1227 | |
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1228 | instance | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1229 | by intro_classes (rule ln_complex_def Ln_1) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1230 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1231 | end | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1232 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1233 | abbreviation Ln :: "complex \<Rightarrow> complex" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1234 | where "Ln \<equiv> ln" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 1235 | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1236 | lemma Ln_eq_iff: "w \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> (Ln w = Ln z \<longleftrightarrow> w = z)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1237 | by (metis exp_Ln) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1238 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1239 | lemma Ln_unique: "exp(z) = w \<Longrightarrow> -pi < Im(z) \<Longrightarrow> Im(z) \<le> pi \<Longrightarrow> Ln w = z" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1240 | using Ln_exp by blast | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1241 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1242 | lemma Re_Ln [simp]: "z \<noteq> 0 \<Longrightarrow> Re(Ln z) = ln(norm z)" | 
| 63092 | 1243 | by (metis exp_Ln ln_exp norm_exp_eq_Re) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1244 | |
| 70136 | 1245 | corollary\<^marker>\<open>tag unimportant\<close> ln_cmod_le: | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1246 | assumes z: "z \<noteq> 0" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1247 | shows "ln (cmod z) \<le> cmod (Ln z)" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1248 | using norm_exp [of "Ln z", simplified exp_Ln [OF z]] | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1249 | by (metis Re_Ln complex_Re_le_cmod z) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1250 | |
| 70136 | 1251 | proposition\<^marker>\<open>tag unimportant\<close> exists_complex_root: | 
| 62843 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62534diff
changeset | 1252 | fixes z :: complex | 
| 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62534diff
changeset | 1253 | assumes "n \<noteq> 0" obtains w where "z = w ^ n" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1254 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1255 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1256 | then show ?thesis | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1257 | by (rule_tac w = "exp(Ln z / n)" in that) (simp add: assms exp_of_nat_mult [symmetric]) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1258 | qed (use assms in auto) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1259 | |
| 70136 | 1260 | corollary\<^marker>\<open>tag unimportant\<close> exists_complex_root_nonzero: | 
| 62843 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62534diff
changeset | 1261 | fixes z::complex | 
| 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62534diff
changeset | 1262 | assumes "z \<noteq> 0" "n \<noteq> 0" | 
| 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62534diff
changeset | 1263 | obtains w where "w \<noteq> 0" "z = w ^ n" | 
| 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62534diff
changeset | 1264 | by (metis exists_complex_root [of n z] assms power_0_left) | 
| 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62534diff
changeset | 1265 | |
| 70136 | 1266 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Derivative of Ln away from the branch cut\<close> | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1267 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1268 | lemma | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1269 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1270 | shows has_field_derivative_Ln: "(Ln has_field_derivative inverse(z)) (at z)" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1271 | and Im_Ln_less_pi: "Im (Ln z) < pi" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1272 | proof - | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1273 | have znz [simp]: "z \<noteq> 0" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1274 | using assms by auto | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1275 | then have "Im (Ln z) \<noteq> pi" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1276 | by (metis (no_types) Im_exp Ln_in_Reals assms complex_nonpos_Reals_iff complex_is_Real_iff exp_Ln mult_zero_right not_less pi_neq_zero sin_pi znz) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1277 | then show *: "Im (Ln z) < pi" using assms Im_Ln_le_pi | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1278 | by (simp add: le_neq_trans) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1279 |   let ?U = "{w. -pi < Im(w) \<and> Im(w) < pi}"
 | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1280 | have 1: "open ?U" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1281 | by (simp add: open_Collect_conj open_halfspace_Im_gt open_halfspace_Im_lt) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1282 | have 2: "\<And>x. x \<in> ?U \<Longrightarrow> (exp has_derivative blinfun_apply(Blinfun ((*) (exp x)))) (at x)" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1283 | apply (simp add: bounded_linear_Blinfun_apply bounded_linear_mult_right) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1284 | using DERIV_exp has_field_derivative_def by blast | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1285 | have 3: "continuous_on ?U (\<lambda>x. Blinfun ((*) (exp x)))" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1286 | unfolding blinfun_mult_right.abs_eq [symmetric] by (intro continuous_intros) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1287 | have 4: "Ln z \<in> ?U" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1288 | by (auto simp: mpi_less_Im_Ln *) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1289 | have 5: "Blinfun ((*) (inverse z)) o\<^sub>L Blinfun ((*) (exp (Ln z))) = id_blinfun" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1290 | by (rule blinfun_eqI) (simp add: bounded_linear_mult_right bounded_linear_Blinfun_apply) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1291 | obtain U' V g g' where "open U'" and sub: "U' \<subseteq> ?U" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1292 | and "Ln z \<in> U'" "open V" "z \<in> V" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1293 | and hom: "homeomorphism U' V exp g" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1294 | and g: "\<And>y. y \<in> V \<Longrightarrow> (g has_derivative (g' y)) (at y)" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1295 | and g': "\<And>y. y \<in> V \<Longrightarrow> g' y = inv ((*) (exp (g y)))" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1296 | and bij: "\<And>y. y \<in> V \<Longrightarrow> bij ((*) (exp (g y)))" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1297 | using inverse_function_theorem [OF 1 2 3 4 5] | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1298 | by (simp add: bounded_linear_Blinfun_apply bounded_linear_mult_right) blast | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1299 | show "(Ln has_field_derivative inverse(z)) (at z)" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1300 | unfolding has_field_derivative_def | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1301 | proof (rule has_derivative_transform_within_open) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1302 | show g_eq_Ln: "g y = Ln y" if "y \<in> V" for y | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1303 | proof - | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1304 | obtain x where "y = exp x" "x \<in> U'" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1305 | using hom homeomorphism_image1 that \<open>y \<in> V\<close> by blast | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1306 | then show ?thesis | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1307 | using sub hom homeomorphism_apply1 by fastforce | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1308 | qed | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1309 | have "0 \<notin> V" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1310 | by (meson exp_not_eq_zero hom homeomorphism_def) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1311 | then have "\<And>y. y \<in> V \<Longrightarrow> g' y = inv ((*) y)" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1312 | by (metis exp_Ln g' g_eq_Ln) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1313 | then have g': "g' z = (\<lambda>x. x/z)" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1314 | by (metis (no_types, hide_lams) bij \<open>z \<in> V\<close> bij_inv_eq_iff exp_Ln g_eq_Ln nonzero_mult_div_cancel_left znz) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1315 | show "(g has_derivative (*) (inverse z)) (at z)" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1316 | using g [OF \<open>z \<in> V\<close>] g' | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1317 | by (simp add: \<open>z \<in> V\<close> field_class.field_divide_inverse has_derivative_imp_has_field_derivative has_field_derivative_imp_has_derivative) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1318 | qed (auto simp: \<open>z \<in> V\<close> \<open>open V\<close>) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1319 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1320 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1321 | declare has_field_derivative_Ln [derivative_intros] | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1322 | declare has_field_derivative_Ln [THEN DERIV_chain2, derivative_intros] | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1323 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1324 | lemma field_differentiable_at_Ln: "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln field_differentiable at z" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1325 | using field_differentiable_def has_field_derivative_Ln by blast | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1326 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1327 | lemma field_differentiable_within_Ln: "z \<notin> \<real>\<^sub>\<le>\<^sub>0 | 
| 67371 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1328 | \<Longrightarrow> Ln field_differentiable (at z within S)" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1329 | using field_differentiable_at_Ln field_differentiable_within_subset by blast | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1330 | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1331 | lemma continuous_at_Ln: "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> continuous (at z) Ln" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1332 | by (simp add: field_differentiable_imp_continuous_at field_differentiable_within_Ln) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1333 | |
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
70196diff
changeset | 1334 | lemma isCont_Ln' [simp,continuous_intros]: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1335 | "\<lbrakk>isCont f z; f z \<notin> \<real>\<^sub>\<le>\<^sub>0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. Ln (f x)) z" | 
| 59862 | 1336 | by (blast intro: isCont_o2 [OF _ continuous_at_Ln]) | 
| 1337 | ||
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
70196diff
changeset | 1338 | lemma continuous_within_Ln [continuous_intros]: "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> continuous (at z within S) Ln" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1339 | using continuous_at_Ln continuous_at_imp_continuous_within by blast | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1340 | |
| 67371 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1341 | lemma continuous_on_Ln [continuous_intros]: "(\<And>z. z \<in> S \<Longrightarrow> z \<notin> \<real>\<^sub>\<le>\<^sub>0) \<Longrightarrow> continuous_on S Ln" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1342 | by (simp add: continuous_at_imp_continuous_on continuous_within_Ln) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1343 | |
| 68493 | 1344 | lemma continuous_on_Ln' [continuous_intros]: | 
| 67371 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1345 | "continuous_on S f \<Longrightarrow> (\<And>z. z \<in> S \<Longrightarrow> f z \<notin> \<real>\<^sub>\<le>\<^sub>0) \<Longrightarrow> continuous_on S (\<lambda>x. Ln (f x))" | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1346 | by (rule continuous_on_compose2[OF continuous_on_Ln, of "UNIV - nonpos_Reals" S f]) auto | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1347 | |
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1348 | lemma holomorphic_on_Ln [holomorphic_intros]: "(\<And>z. z \<in> S \<Longrightarrow> z \<notin> \<real>\<^sub>\<le>\<^sub>0) \<Longrightarrow> Ln holomorphic_on S" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1349 | by (simp add: field_differentiable_within_Ln holomorphic_on_def) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1350 | |
| 68721 | 1351 | lemma holomorphic_on_Ln' [holomorphic_intros]: | 
| 1352 | "(\<And>z. z \<in> A \<Longrightarrow> f z \<notin> \<real>\<^sub>\<le>\<^sub>0) \<Longrightarrow> f holomorphic_on A \<Longrightarrow> (\<lambda>z. Ln (f z)) holomorphic_on A" | |
| 1353 | using holomorphic_on_compose_gen[OF _ holomorphic_on_Ln, of f A "- \<real>\<^sub>\<le>\<^sub>0"] | |
| 1354 | by (auto simp: o_def) | |
| 1355 | ||
| 67371 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1356 | lemma tendsto_Ln [tendsto_intros]: | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1357 | fixes L F | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1358 | assumes "(f \<longlongrightarrow> L) F" "L \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1359 | shows "((\<lambda>x. Ln (f x)) \<longlongrightarrow> Ln L) F" | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1360 | proof - | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1361 | have "nhds L \<ge> filtermap f F" | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1362 | using assms(1) by (simp add: filterlim_def) | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1363 | moreover have "\<forall>\<^sub>F y in nhds L. y \<in> - \<real>\<^sub>\<le>\<^sub>0" | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1364 | using eventually_nhds_in_open[of "- \<real>\<^sub>\<le>\<^sub>0" L] assms by (auto simp: open_Compl) | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1365 | ultimately have "\<forall>\<^sub>F y in filtermap f F. y \<in> - \<real>\<^sub>\<le>\<^sub>0" by (rule filter_leD) | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1366 | moreover have "continuous_on (-\<real>\<^sub>\<le>\<^sub>0) Ln" by (rule continuous_on_Ln) auto | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1367 | ultimately show ?thesis using continuous_on_tendsto_compose[of "- \<real>\<^sub>\<le>\<^sub>0" Ln f L F] assms | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1368 | by (simp add: eventually_filtermap) | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1369 | qed | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1370 | |
| 65719 | 1371 | lemma divide_ln_mono: | 
| 1372 | fixes x y::real | |
| 1373 | assumes "3 \<le> x" "x \<le> y" | |
| 1374 | shows "x / ln x \<le> y / ln y" | |
| 1375 | proof (rule exE [OF complex_mvt_line [of x y "\<lambda>z. z / Ln z" "\<lambda>z. 1/(Ln z) - 1/(Ln z)^2"]]; | |
| 1376 | clarsimp simp add: closed_segment_Reals closed_segment_eq_real_ivl assms) | |
| 1377 | show "\<And>u. \<lbrakk>x \<le> u; u \<le> y\<rbrakk> \<Longrightarrow> ((\<lambda>z. z / Ln z) has_field_derivative 1 / Ln u - 1 / (Ln u)\<^sup>2) (at u)" | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1378 | using \<open>3 \<le> x\<close> by (force intro!: derivative_eq_intros simp: field_simps power_eq_if) | 
| 65719 | 1379 | show "x / ln x \<le> y / ln y" | 
| 1380 | if "Re (y / Ln y) - Re (x / Ln x) = (Re (1 / Ln u) - Re (1 / (Ln u)\<^sup>2)) * (y - x)" | |
| 1381 | and x: "x \<le> u" "u \<le> y" for u | |
| 1382 | proof - | |
| 1383 | have eq: "y / ln y = (1 / ln u - 1 / (ln u)\<^sup>2) * (y - x) + x / ln x" | |
| 1384 | using that \<open>3 \<le> x\<close> by (auto simp: Ln_Reals_eq in_Reals_norm group_add_class.diff_eq_eq) | |
| 1385 | show ?thesis | |
| 1386 | using exp_le \<open>3 \<le> x\<close> x by (simp add: eq) (simp add: power_eq_if divide_simps ln_ge_iff) | |
| 1387 | qed | |
| 1388 | qed | |
| 68493 | 1389 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1390 | theorem Ln_series: | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1391 | fixes z :: complex | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1392 | assumes "norm z < 1" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1393 | shows "(\<lambda>n. (-1)^Suc n / of_nat n * z^n) sums ln (1 + z)" (is "(\<lambda>n. ?f n * z^n) sums _") | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1394 | proof - | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1395 | let ?F = "\<lambda>z. \<Sum>n. ?f n * z^n" and ?F' = "\<lambda>z. \<Sum>n. diffs ?f n * z^n" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1396 | have r: "conv_radius ?f = 1" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1397 | by (intro conv_radius_ratio_limit_nonzero[of _ 1]) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1398 | (simp_all add: norm_divide LIMSEQ_Suc_n_over_n del: of_nat_Suc) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1399 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1400 | have "\<exists>c. \<forall>z\<in>ball 0 1. ln (1 + z) - ?F z = c" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1401 | proof (rule has_field_derivative_zero_constant) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1402 | fix z :: complex assume z': "z \<in> ball 0 1" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1403 | hence z: "norm z < 1" by simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1404 | define t :: complex where "t = of_real (1 + norm z) / 2" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1405 | from z have t: "norm z < norm t" "norm t < 1" unfolding t_def | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1406 | by (simp_all add: field_simps norm_divide del: of_real_add) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1407 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1408 | have "Re (-z) \<le> norm (-z)" by (rule complex_Re_le_cmod) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1409 | also from z have "... < 1" by simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1410 | finally have "((\<lambda>z. ln (1 + z)) has_field_derivative inverse (1+z)) (at z)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1411 | by (auto intro!: derivative_eq_intros simp: complex_nonpos_Reals_iff) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1412 | moreover have "(?F has_field_derivative ?F' z) (at z)" using t r | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1413 | by (intro termdiffs_strong[of _ t] summable_in_conv_radius) simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1414 | ultimately have "((\<lambda>z. ln (1 + z) - ?F z) has_field_derivative (inverse (1 + z) - ?F' z)) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1415 | (at z within ball 0 1)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1416 | by (intro derivative_intros) (simp_all add: at_within_open[OF z']) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1417 | also have "(\<lambda>n. of_nat n * ?f n * z ^ (n - Suc 0)) sums ?F' z" using t r | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1418 | by (intro diffs_equiv termdiff_converges[OF t(1)] summable_in_conv_radius) simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1419 | from sums_split_initial_segment[OF this, of 1] | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1420 | have "(\<lambda>i. (-z) ^ i) sums ?F' z" by (simp add: power_minus[of z] del: of_nat_Suc) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1421 | hence "?F' z = inverse (1 + z)" using z by (simp add: sums_iff suminf_geometric divide_inverse) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1422 | also have "inverse (1 + z) - inverse (1 + z) = 0" by simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1423 | finally show "((\<lambda>z. ln (1 + z) - ?F z) has_field_derivative 0) (at z within ball 0 1)" . | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1424 | qed simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1425 | then obtain c where c: "\<And>z. z \<in> ball 0 1 \<Longrightarrow> ln (1 + z) - ?F z = c" by blast | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1426 | from c[of 0] have "c = 0" by (simp only: powser_zero) simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1427 | with c[of z] assms have "ln (1 + z) = ?F z" by simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1428 | moreover have "summable (\<lambda>n. ?f n * z^n)" using assms r | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1429 | by (intro summable_in_conv_radius) simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1430 | ultimately show ?thesis by (simp add: sums_iff) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1431 | qed | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1432 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1433 | lemma Ln_series': "cmod z < 1 \<Longrightarrow> (\<lambda>n. - ((-z)^n) / of_nat n) sums ln (1 + z)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1434 | by (drule Ln_series) (simp add: power_minus') | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1435 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1436 | lemma ln_series': | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1437 | assumes "abs (x::real) < 1" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1438 | shows "(\<lambda>n. - ((-x)^n) / of_nat n) sums ln (1 + x)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1439 | proof - | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1440 | from assms have "(\<lambda>n. - ((-of_real x)^n) / of_nat n) sums ln (1 + complex_of_real x)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1441 | by (intro Ln_series') simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1442 | also have "(\<lambda>n. - ((-of_real x)^n) / of_nat n) = (\<lambda>n. complex_of_real (- ((-x)^n) / of_nat n))" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1443 | by (rule ext) simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1444 | also from assms have "ln (1 + complex_of_real x) = of_real (ln (1 + x))" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1445 | by (subst Ln_of_real [symmetric]) simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1446 | finally show ?thesis by (subst (asm) sums_of_real_iff) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1447 | qed | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1448 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1449 | lemma Ln_approx_linear: | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1450 | fixes z :: complex | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1451 | assumes "norm z < 1" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1452 | shows "norm (ln (1 + z) - z) \<le> norm z^2 / (1 - norm z)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1453 | proof - | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1454 | let ?f = "\<lambda>n. (-1)^Suc n / of_nat n" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1455 | from assms have "(\<lambda>n. ?f n * z^n) sums ln (1 + z)" using Ln_series by simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1456 | moreover have "(\<lambda>n. (if n = 1 then 1 else 0) * z^n) sums z" using powser_sums_if[of 1] by simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1457 | ultimately have "(\<lambda>n. (?f n - (if n = 1 then 1 else 0)) * z^n) sums (ln (1 + z) - z)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1458 | by (subst left_diff_distrib, intro sums_diff) simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1459 | from sums_split_initial_segment[OF this, of "Suc 1"] | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1460 | have "(\<lambda>i. (-(z^2)) * inverse (2 + of_nat i) * (- z)^i) sums (Ln (1 + z) - z)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1461 | by (simp add: power2_eq_square mult_ac power_minus[of z] divide_inverse) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1462 | hence "(Ln (1 + z) - z) = (\<Sum>i. (-(z^2)) * inverse (of_nat (i+2)) * (-z)^i)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1463 | by (simp add: sums_iff) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1464 | also have A: "summable (\<lambda>n. norm z^2 * (inverse (real_of_nat (Suc (Suc n))) * cmod z ^ n))" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1465 | by (rule summable_mult, rule summable_comparison_test_ev[OF _ summable_geometric[of "norm z"]]) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1466 | (auto simp: assms field_simps intro!: always_eventually) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1467 | hence "norm (\<Sum>i. (-(z^2)) * inverse (of_nat (i+2)) * (-z)^i) \<le> | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1468 | (\<Sum>i. norm (-(z^2) * inverse (of_nat (i+2)) * (-z)^i))" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1469 | by (intro summable_norm) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1470 | (auto simp: norm_power norm_inverse norm_mult mult_ac simp del: of_nat_add of_nat_Suc) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1471 | also have "norm ((-z)^2 * (-z)^i) * inverse (of_nat (i+2)) \<le> norm ((-z)^2 * (-z)^i) * 1" for i | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 1472 | by (intro mult_left_mono) (simp_all add: field_split_simps) | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1473 | hence "(\<Sum>i. norm (-(z^2) * inverse (of_nat (i+2)) * (-z)^i)) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1474 | \<le> (\<Sum>i. norm (-(z^2) * (-z)^i))" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1475 | using A assms | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1476 | apply (simp_all only: norm_power norm_inverse norm_divide norm_mult) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1477 | apply (intro suminf_le summable_mult summable_geometric) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1478 | apply (auto simp: norm_power field_simps simp del: of_nat_add of_nat_Suc) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1479 | done | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1480 | also have "... = norm z^2 * (\<Sum>i. norm z^i)" using assms | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1481 | by (subst suminf_mult [symmetric]) (auto intro!: summable_geometric simp: norm_mult norm_power) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1482 | also have "(\<Sum>i. norm z^i) = inverse (1 - norm z)" using assms | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1483 | by (subst suminf_geometric) (simp_all add: divide_inverse) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1484 | also have "norm z^2 * ... = norm z^2 / (1 - norm z)" by (simp add: divide_inverse) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1485 | finally show ?thesis . | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1486 | qed | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1487 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1488 | |
| 70136 | 1489 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Quadrant-type results for Ln\<close> | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1490 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1491 | lemma cos_lt_zero_pi: "pi/2 < x \<Longrightarrow> x < 3*pi/2 \<Longrightarrow> cos x < 0" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1492 | using cos_minus_pi cos_gt_zero_pi [of "x-pi"] | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1493 | by simp | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1494 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1495 | lemma Re_Ln_pos_lt: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1496 | assumes "z \<noteq> 0" | 
| 61945 | 1497 | shows "\<bar>Im(Ln z)\<bar> < pi/2 \<longleftrightarrow> 0 < Re(z)" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1498 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1499 |   { fix w
 | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1500 | assume "w = Ln z" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1501 | then have w: "Im w \<le> pi" "- pi < Im w" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1502 | using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1503 | by auto | 
| 61945 | 1504 | then have "\<bar>Im w\<bar> < pi/2 \<longleftrightarrow> 0 < Re(exp w)" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1505 | using cos_lt_zero_pi [of "-(Im w)"] cos_lt_zero_pi [of "(Im w)"] | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1506 | apply (auto simp: Re_exp zero_less_mult_iff cos_gt_zero_pi abs_if split: if_split_asm) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1507 | apply (metis cos_minus cos_pi_half divide_minus_left less_irrefl linorder_neqE_linordered_idom nonzero_mult_div_cancel_right zero_neq_numeral)+ | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1508 | done | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1509 | } | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1510 | then show ?thesis using assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1511 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1512 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1513 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1514 | lemma Re_Ln_pos_le: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1515 | assumes "z \<noteq> 0" | 
| 61945 | 1516 | shows "\<bar>Im(Ln z)\<bar> \<le> pi/2 \<longleftrightarrow> 0 \<le> Re(z)" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1517 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1518 |   { fix w
 | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1519 | assume "w = Ln z" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1520 | then have w: "Im w \<le> pi" "- pi < Im w" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1521 | using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1522 | by auto | 
| 61945 | 1523 | then have "\<bar>Im w\<bar> \<le> pi/2 \<longleftrightarrow> 0 \<le> Re(exp w)" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1524 | apply (auto simp: Re_exp zero_le_mult_iff cos_ge_zero) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1525 | using cos_lt_zero_pi [of "- (Im w)"] cos_lt_zero_pi [of "(Im w)"] not_le | 
| 62390 | 1526 | apply (auto simp: abs_if split: if_split_asm) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1527 | done | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1528 | } | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1529 | then show ?thesis using assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1530 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1531 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1532 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1533 | lemma Im_Ln_pos_lt: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1534 | assumes "z \<noteq> 0" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1535 | shows "0 < Im(Ln z) \<and> Im(Ln z) < pi \<longleftrightarrow> 0 < Im(z)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1536 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1537 |   { fix w
 | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1538 | assume "w = Ln z" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1539 | then have w: "Im w \<le> pi" "- pi < Im w" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1540 | using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1541 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1542 | then have "0 < Im w \<and> Im w < pi \<longleftrightarrow> 0 < Im(exp w)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1543 | using sin_gt_zero [of "- (Im w)"] sin_gt_zero [of "(Im w)"] | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1544 | apply (simp add: Im_exp zero_less_mult_iff) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1545 | using less_linear apply fastforce | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1546 | done | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1547 | } | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1548 | then show ?thesis using assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1549 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1550 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1551 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1552 | lemma Im_Ln_pos_le: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1553 | assumes "z \<noteq> 0" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1554 | shows "0 \<le> Im(Ln z) \<and> Im(Ln z) \<le> pi \<longleftrightarrow> 0 \<le> Im(z)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1555 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1556 |   { fix w
 | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1557 | assume "w = Ln z" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1558 | then have w: "Im w \<le> pi" "- pi < Im w" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1559 | using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1560 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1561 | then have "0 \<le> Im w \<and> Im w \<le> pi \<longleftrightarrow> 0 \<le> Im(exp w)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1562 | using sin_ge_zero [of "- (Im w)"] sin_ge_zero [of "(Im w)"] | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1563 | apply (auto simp: Im_exp zero_le_mult_iff sin_ge_zero) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1564 | apply (metis not_le not_less_iff_gr_or_eq pi_not_less_zero sin_eq_0_pi) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1565 | done } | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1566 | then show ?thesis using assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1567 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1568 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1569 | |
| 61945 | 1570 | lemma Re_Ln_pos_lt_imp: "0 < Re(z) \<Longrightarrow> \<bar>Im(Ln z)\<bar> < pi/2" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1571 | by (metis Re_Ln_pos_lt less_irrefl zero_complex.simps(1)) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1572 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1573 | lemma Im_Ln_pos_lt_imp: "0 < Im(z) \<Longrightarrow> 0 < Im(Ln z) \<and> Im(Ln z) < pi" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1574 | by (metis Im_Ln_pos_lt not_le order_refl zero_complex.simps(2)) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1575 | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1576 | text\<open>A reference to the set of positive real numbers\<close> | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1577 | lemma Im_Ln_eq_0: "z \<noteq> 0 \<Longrightarrow> (Im(Ln z) = 0 \<longleftrightarrow> 0 < Re(z) \<and> Im(z) = 0)" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1578 | by (metis Im_complex_of_real Im_exp Ln_in_Reals Re_Ln_pos_lt Re_Ln_pos_lt_imp | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1579 | Re_complex_of_real complex_is_Real_iff exp_Ln exp_of_real pi_gt_zero) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1580 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1581 | lemma Im_Ln_eq_pi: "z \<noteq> 0 \<Longrightarrow> (Im(Ln z) = pi \<longleftrightarrow> Re(z) < 0 \<and> Im(z) = 0)" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1582 | by (metis Im_Ln_eq_0 Im_Ln_pos_le Im_Ln_pos_lt add.left_neutral complex_eq less_eq_real_def | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1583 | mult_zero_right not_less_iff_gr_or_eq pi_ge_zero pi_neq_zero rcis_zero_arg rcis_zero_mod) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1584 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1585 | |
| 70136 | 1586 | subsection\<^marker>\<open>tag unimportant\<close>\<open>More Properties of Ln\<close> | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1587 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1588 | lemma cnj_Ln: assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" shows "cnj(Ln z) = Ln(cnj z)" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1589 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1590 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1591 | show ?thesis | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1592 | proof (rule exp_complex_eqI) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1593 | have "\<bar>Im (cnj (Ln z)) - Im (Ln (cnj z))\<bar> \<le> \<bar>Im (cnj (Ln z))\<bar> + \<bar>Im (Ln (cnj z))\<bar>" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1594 | by (rule abs_triangle_ineq4) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1595 | also have "... < pi + pi" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1596 | proof - | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1597 | have "\<bar>Im (cnj (Ln z))\<bar> < pi" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1598 | by (simp add: False Im_Ln_less_pi abs_if assms minus_less_iff mpi_less_Im_Ln) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1599 | moreover have "\<bar>Im (Ln (cnj z))\<bar> \<le> pi" | 
| 68493 | 1600 | by (meson abs_le_iff complex_cnj_zero_iff less_eq_real_def minus_less_iff False Im_Ln_le_pi mpi_less_Im_Ln) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1601 | ultimately show ?thesis | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1602 | by simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1603 | qed | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1604 | finally show "\<bar>Im (cnj (Ln z)) - Im (Ln (cnj z))\<bar> < 2 * pi" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1605 | by simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1606 | show "exp (cnj (Ln z)) = exp (Ln (cnj z))" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1607 | by (metis False complex_cnj_zero_iff exp_Ln exp_cnj) | 
| 68493 | 1608 | qed | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1609 | qed (use assms in auto) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1610 | |
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1611 | |
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1612 | lemma Ln_inverse: assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" shows "Ln(inverse z) = -(Ln z)" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1613 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1614 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1615 | show ?thesis | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1616 | proof (rule exp_complex_eqI) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1617 | have "\<bar>Im (Ln (inverse z)) - Im (- Ln z)\<bar> \<le> \<bar>Im (Ln (inverse z))\<bar> + \<bar>Im (- Ln z)\<bar>" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1618 | by (rule abs_triangle_ineq4) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1619 | also have "... < pi + pi" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1620 | proof - | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1621 | have "\<bar>Im (Ln (inverse z))\<bar> < pi" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1622 | by (simp add: False Im_Ln_less_pi abs_if assms minus_less_iff mpi_less_Im_Ln) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1623 | moreover have "\<bar>Im (- Ln z)\<bar> \<le> pi" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1624 | using False Im_Ln_le_pi mpi_less_Im_Ln by fastforce | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1625 | ultimately show ?thesis | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1626 | by simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1627 | qed | 
| 68493 | 1628 | finally show "\<bar>Im (Ln (inverse z)) - Im (- Ln z)\<bar> < 2 * pi" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1629 | by simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1630 | show "exp (Ln (inverse z)) = exp (- Ln z)" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1631 | by (simp add: False exp_minus) | 
| 68493 | 1632 | qed | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1633 | qed (use assms in auto) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1634 | |
| 63589 | 1635 | lemma Ln_minus1 [simp]: "Ln(-1) = \<i> * pi" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1636 | apply (rule exp_complex_eqI) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1637 | using Im_Ln_le_pi [of "-1"] mpi_less_Im_Ln [of "-1"] cis_conv_exp cis_pi | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1638 | apply (auto simp: abs_if) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1639 | done | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1640 | |
| 63589 | 1641 | lemma Ln_ii [simp]: "Ln \<i> = \<i> * of_real pi/2" | 
| 1642 | using Ln_exp [of "\<i> * (of_real pi/2)"] | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1643 | unfolding exp_Euler | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1644 | by simp | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1645 | |
| 63589 | 1646 | lemma Ln_minus_ii [simp]: "Ln(-\<i>) = - (\<i> * pi/2)" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1647 | proof - | 
| 63589 | 1648 | have "Ln(-\<i>) = Ln(inverse \<i>)" by simp | 
| 1649 | also have "... = - (Ln \<i>)" using Ln_inverse by blast | |
| 1650 | also have "... = - (\<i> * pi/2)" by simp | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1651 | finally show ?thesis . | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1652 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1653 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1654 | lemma Ln_times: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1655 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1656 | shows "Ln(w * z) = | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1657 | (if Im(Ln w + Ln z) \<le> -pi then (Ln(w) + Ln(z)) + \<i> * of_real(2*pi) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1658 | else if Im(Ln w + Ln z) > pi then (Ln(w) + Ln(z)) - \<i> * of_real(2*pi) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1659 | else Ln(w) + Ln(z))" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1660 | using pi_ge_zero Im_Ln_le_pi [of w] Im_Ln_le_pi [of z] | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1661 | using assms mpi_less_Im_Ln [of w] mpi_less_Im_Ln [of z] | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1662 | by (auto simp: exp_add exp_diff sin_double cos_double exp_Euler intro!: Ln_unique) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1663 | |
| 70136 | 1664 | corollary\<^marker>\<open>tag unimportant\<close> Ln_times_simple: | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1665 | "\<lbrakk>w \<noteq> 0; z \<noteq> 0; -pi < Im(Ln w) + Im(Ln z); Im(Ln w) + Im(Ln z) \<le> pi\<rbrakk> | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1666 | \<Longrightarrow> Ln(w * z) = Ln(w) + Ln(z)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1667 | by (simp add: Ln_times) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1668 | |
| 70136 | 1669 | corollary\<^marker>\<open>tag unimportant\<close> Ln_times_of_real: | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1670 | "\<lbrakk>r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(of_real r * z) = ln r + Ln(z)" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1671 | using mpi_less_Im_Ln Im_Ln_le_pi | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1672 | by (force simp: Ln_times) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1673 | |
| 70136 | 1674 | corollary\<^marker>\<open>tag unimportant\<close> Ln_times_Reals: | 
| 68535 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1675 | "\<lbrakk>r \<in> Reals; Re r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(r * z) = ln (Re r) + Ln(z)" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1676 | using Ln_Reals_eq Ln_times_of_real by fastforce | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1677 | |
| 70136 | 1678 | corollary\<^marker>\<open>tag unimportant\<close> Ln_divide_of_real: | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1679 | "\<lbrakk>r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(z / of_real r) = Ln(z) - ln r" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1680 | using Ln_times_of_real [of "inverse r" z] | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 1681 | by (simp add: ln_inverse Ln_of_real mult.commute divide_inverse of_real_inverse [symmetric] | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1682 | del: of_real_inverse) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1683 | |
| 70136 | 1684 | corollary\<^marker>\<open>tag unimportant\<close> Ln_prod: | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1685 | fixes f :: "'a \<Rightarrow> complex" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1686 | assumes "finite A" "\<And>x. x \<in> A \<Longrightarrow> f x \<noteq> 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1687 | shows "\<exists>n. Ln (prod f A) = (\<Sum>x \<in> A. Ln (f x) + (of_int (n x) * (2 * pi)) * \<i>)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1688 | using assms | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1689 | proof (induction A) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1690 | case (insert x A) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1691 | then obtain n where n: "Ln (prod f A) = (\<Sum>x\<in>A. Ln (f x) + of_real (of_int (n x) * (2 * pi)) * \<i>)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1692 | by auto | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1693 | define D where "D \<equiv> Im (Ln (f x)) + Im (Ln (prod f A))" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1694 | define q::int where "q \<equiv> (if D \<le> -pi then 1 else if D > pi then -1 else 0)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1695 | have "prod f A \<noteq> 0" "f x \<noteq> 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1696 | by (auto simp: insert.hyps insert.prems) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1697 | with insert.hyps pi_ge_zero show ?case | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1698 | by (rule_tac x="n(x:=q)" in exI) (force simp: Ln_times q_def D_def n intro!: sum.cong) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1699 | qed auto | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1700 | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1701 | lemma Ln_minus: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1702 | assumes "z \<noteq> 0" | 
| 69508 | 1703 | shows "Ln(-z) = (if Im(z) \<le> 0 \<and> \<not>(Re(z) < 0 \<and> Im(z) = 0) | 
| 63589 | 1704 | then Ln(z) + \<i> * pi | 
| 1705 | else Ln(z) - \<i> * pi)" (is "_ = ?rhs") | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1706 | using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1707 | Im_Ln_eq_pi [of z] Im_Ln_pos_lt [of z] | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1708 | by (fastforce simp: exp_add exp_diff exp_Euler intro!: Ln_unique) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1709 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1710 | lemma Ln_inverse_if: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1711 | assumes "z \<noteq> 0" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1712 | shows "Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then -(Ln z) + \<i> * 2 * complex_of_real pi else -(Ln z))" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1713 | proof (cases "z \<in> \<real>\<^sub>\<le>\<^sub>0") | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1714 | case False then show ?thesis | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1715 | by (simp add: Ln_inverse) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1716 | next | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1717 | case True | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1718 | then have z: "Im z = 0" "Re z < 0" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1719 | using assms | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1720 | apply (auto simp: complex_nonpos_Reals_iff) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1721 | by (metis complex_is_Real_iff le_imp_less_or_eq of_real_0 of_real_Re) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1722 | have "Ln(inverse z) = Ln(- (inverse (-z)))" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1723 | by simp | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1724 | also have "... = Ln (inverse (-z)) + \<i> * complex_of_real pi" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1725 | using assms z | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1726 | apply (simp add: Ln_minus) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1727 | apply (simp add: field_simps) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1728 | done | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1729 | also have "... = - Ln (- z) + \<i> * complex_of_real pi" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1730 | apply (subst Ln_inverse) | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1731 | using z by (auto simp add: complex_nonneg_Reals_iff) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1732 | also have "... = - (Ln z) + \<i> * 2 * complex_of_real pi" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1733 | by (subst Ln_minus) (use assms z in auto) | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1734 | finally show ?thesis by (simp add: True) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1735 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1736 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1737 | lemma Ln_times_ii: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1738 | assumes "z \<noteq> 0" | 
| 63589 | 1739 | shows "Ln(\<i> * z) = (if 0 \<le> Re(z) | Im(z) < 0 | 
| 1740 | then Ln(z) + \<i> * of_real pi/2 | |
| 1741 | else Ln(z) - \<i> * of_real(3 * pi/2))" | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1742 | using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1743 | Im_Ln_eq_pi [of z] Im_Ln_pos_lt [of z] Re_Ln_pos_le [of z] | 
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1744 | by (simp add: Ln_times) auto | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1745 | |
| 65587 
16a8991ab398
New material (and some tidying) purely in the Analysis directory
 paulson <lp15@cam.ac.uk> parents: 
65585diff
changeset | 1746 | lemma Ln_of_nat [simp]: "0 < n \<Longrightarrow> Ln (of_nat n) = of_real (ln (of_nat n))" | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1747 | by (subst of_real_of_nat_eq[symmetric], subst Ln_of_real[symmetric]) simp_all | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1748 | |
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 1749 | lemma Ln_of_nat_over_of_nat: | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1750 | assumes "m > 0" "n > 0" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1751 | shows "Ln (of_nat m / of_nat n) = of_real (ln (of_nat m) - ln (of_nat n))" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1752 | proof - | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1753 | have "of_nat m / of_nat n = (of_real (of_nat m / of_nat n) :: complex)" by simp | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1754 | also from assms have "Ln ... = of_real (ln (of_nat m / of_nat n))" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1755 | by (simp add: Ln_of_real[symmetric]) | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1756 | also from assms have "... = of_real (ln (of_nat m) - ln (of_nat n))" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1757 | by (simp add: ln_div) | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1758 | finally show ?thesis . | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1759 | qed | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1760 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1761 | subsection\<open>The Argument of a Complex Number\<close> | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1762 | |
| 69566 | 1763 | text\<open>Finally: it's is defined for the same interval as the complex logarithm: \<open>(-\<pi>,\<pi>]\<close>.\<close> | 
| 68535 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1764 | |
| 70136 | 1765 | definition\<^marker>\<open>tag important\<close> Arg :: "complex \<Rightarrow> real" where "Arg z \<equiv> (if z = 0 then 0 else Im (Ln z))" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1766 | |
| 68527 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1767 | lemma Arg_of_real: "Arg (of_real r) = (if r<0 then pi else 0)" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1768 | by (simp add: Im_Ln_eq_pi Arg_def) | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1769 | |
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1770 | lemma mpi_less_Arg: "-pi < Arg z" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1771 | and Arg_le_pi: "Arg z \<le> pi" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1772 | by (auto simp: Arg_def mpi_less_Im_Ln Im_Ln_le_pi) | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1773 | |
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1774 | lemma | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1775 | assumes "z \<noteq> 0" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1776 | shows Arg_eq: "z = of_real(norm z) * exp(\<i> * Arg z)" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1777 | using assms exp_Ln exp_eq_polar | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1778 | by (auto simp: Arg_def) | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1779 | |
| 68535 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1780 | lemma is_Arg_Arg: "z \<noteq> 0 \<Longrightarrow> is_Arg z (Arg z)" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1781 | by (simp add: Arg_eq is_Arg_def) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1782 | |
| 68527 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1783 | lemma Argument_exists: | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1784 |   assumes "z \<noteq> 0" and R: "R = {r-pi<..r+pi}"
 | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1785 | obtains s where "is_Arg z s" "s\<in>R" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1786 | proof - | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1787 | let ?rp = "r - Arg z + pi" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1788 | define k where "k \<equiv> \<lfloor>?rp / (2 * pi)\<rfloor>" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1789 | have "(Arg z + of_int k * (2 * pi)) \<in> R" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1790 | using floor_divide_lower [of "2*pi" ?rp] floor_divide_upper [of "2*pi" ?rp] | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1791 | by (auto simp: k_def algebra_simps R) | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1792 | then show ?thesis | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1793 | using Arg_eq \<open>z \<noteq> 0\<close> is_Arg_2pi_iff is_Arg_def that by blast | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1794 | qed | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1795 | |
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1796 | lemma Argument_exists_unique: | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1797 |   assumes "z \<noteq> 0" and R: "R = {r-pi<..r+pi}"
 | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1798 | obtains s where "is_Arg z s" "s\<in>R" "\<And>t. \<lbrakk>is_Arg z t; t\<in>R\<rbrakk> \<Longrightarrow> s=t" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1799 | proof - | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1800 | obtain s where s: "is_Arg z s" "s\<in>R" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1801 | using Argument_exists [OF assms] . | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1802 | moreover have "\<And>t. \<lbrakk>is_Arg z t; t\<in>R\<rbrakk> \<Longrightarrow> s=t" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1803 | using assms s by (auto simp: is_Arg_eqI) | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1804 | ultimately show thesis | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1805 | using that by blast | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1806 | qed | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1807 | |
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1808 | lemma Argument_Ex1: | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1809 |   assumes "z \<noteq> 0" and R: "R = {r-pi<..r+pi}"
 | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1810 | shows "\<exists>!s. is_Arg z s \<and> s \<in> R" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1811 | using Argument_exists_unique [OF assms] by metis | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1812 | |
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1813 | lemma Arg_divide: | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1814 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1815 | shows "is_Arg (z / w) (Arg z - Arg w)" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1816 | using Arg_eq [of z] Arg_eq [of w] Arg_eq [of "norm(z / w)"] assms | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1817 | by (auto simp: is_Arg_def norm_divide field_simps exp_diff Arg_of_real) | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1818 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1819 | lemma Arg_unique_lemma: | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1820 | assumes z: "is_Arg z t" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1821 | and z': "is_Arg z t'" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1822 | and t: "- pi < t" "t \<le> pi" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1823 | and t': "- pi < t'" "t' \<le> pi" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1824 | and nz: "z \<noteq> 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1825 | shows "t' = t" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1826 | using Arg2pi_unique_lemma [of "- (inverse z)"] | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1827 | proof - | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1828 | have "pi - t' = pi - t" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1829 | proof (rule Arg2pi_unique_lemma [of "- (inverse z)"]) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1830 | have "- (inverse z) = - (inverse (of_real(norm z) * exp(\<i> * t)))" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1831 | by (metis is_Arg_def z) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1832 | also have "... = (cmod (- inverse z)) * exp (\<i> * (pi - t))" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1833 | by (auto simp: field_simps exp_diff norm_divide) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1834 | finally show "is_Arg (- inverse z) (pi - t)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1835 | unfolding is_Arg_def . | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1836 | have "- (inverse z) = - (inverse (of_real(norm z) * exp(\<i> * t')))" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1837 | by (metis is_Arg_def z') | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1838 | also have "... = (cmod (- inverse z)) * exp (\<i> * (pi - t'))" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1839 | by (auto simp: field_simps exp_diff norm_divide) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1840 | finally show "is_Arg (- inverse z) (pi - t')" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1841 | unfolding is_Arg_def . | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1842 | qed (use assms in auto) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1843 | then show ?thesis | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1844 | by simp | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1845 | qed | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1846 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1847 | lemma complex_norm_eq_1_exp_eq: "norm z = 1 \<longleftrightarrow> exp(\<i> * (Arg z)) = z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1848 | by (metis Arg_eq exp_not_eq_zero exp_zero mult.left_neutral norm_zero of_real_1 norm_exp_i_times) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1849 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1850 | lemma Arg_unique: "\<lbrakk>of_real r * exp(\<i> * a) = z; 0 < r; -pi < a; a \<le> pi\<rbrakk> \<Longrightarrow> Arg z = a" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1851 | by (rule Arg_unique_lemma [unfolded is_Arg_def, OF _ Arg_eq]) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1852 | (use mpi_less_Arg Arg_le_pi in \<open>auto simp: norm_mult\<close>) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1853 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1854 | lemma Arg_minus: | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1855 | assumes "z \<noteq> 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1856 | shows "Arg (-z) = (if Arg z \<le> 0 then Arg z + pi else Arg z - pi)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1857 | proof - | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1858 | have [simp]: "cmod z * cos (Arg z) = Re z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1859 | using assms Arg_eq [of z] by (metis Re_exp exp_Ln norm_exp_eq_Re Arg_def) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1860 | have [simp]: "cmod z * sin (Arg z) = Im z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1861 | using assms Arg_eq [of z] by (metis Im_exp exp_Ln norm_exp_eq_Re Arg_def) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1862 | show ?thesis | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1863 | apply (rule Arg_unique [of "norm z"]) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1864 | apply (rule complex_eqI) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1865 | using mpi_less_Arg [of z] Arg_le_pi [of z] assms | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1866 | apply (auto simp: Re_exp Im_exp cos_diff sin_diff cis_conv_exp [symmetric]) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1867 | done | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1868 | qed | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1869 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1870 | lemma Arg_times_of_real [simp]: | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1871 | assumes "0 < r" shows "Arg (of_real r * z) = Arg z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1872 | proof (cases "z=0") | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1873 | case True | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1874 | then show ?thesis | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1875 | by (simp add: Arg_def) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1876 | next | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1877 | case False | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1878 | with Arg_eq assms show ?thesis | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1879 | by (auto simp: mpi_less_Arg Arg_le_pi intro!: Arg_unique [of "r * norm z"]) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1880 | qed | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1881 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1882 | lemma Arg_times_of_real2 [simp]: "0 < r \<Longrightarrow> Arg (z * of_real r) = Arg z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1883 | by (metis Arg_times_of_real mult.commute) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1884 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1885 | lemma Arg_divide_of_real [simp]: "0 < r \<Longrightarrow> Arg (z / of_real r) = Arg z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1886 | by (metis Arg_times_of_real2 less_numeral_extra(3) nonzero_eq_divide_eq of_real_eq_0_iff) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1887 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1888 | lemma Arg_less_0: "0 \<le> Arg z \<longleftrightarrow> 0 \<le> Im z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1889 | using Im_Ln_le_pi Im_Ln_pos_le | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1890 | by (simp add: Arg_def) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1891 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1892 | lemma Arg_eq_pi: "Arg z = pi \<longleftrightarrow> Re z < 0 \<and> Im z = 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1893 | by (auto simp: Arg_def Im_Ln_eq_pi) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1894 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1895 | lemma Arg_lt_pi: "0 < Arg z \<and> Arg z < pi \<longleftrightarrow> 0 < Im z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1896 | using Arg_less_0 [of z] Im_Ln_pos_lt | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1897 | by (auto simp: order.order_iff_strict Arg_def) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1898 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1899 | lemma Arg_eq_0: "Arg z = 0 \<longleftrightarrow> z \<in> \<real> \<and> 0 \<le> Re z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1900 | using complex_is_Real_iff | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1901 | by (simp add: Arg_def Im_Ln_eq_0) (metis less_eq_real_def of_real_Re of_real_def scale_zero_left) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1902 | |
| 70136 | 1903 | corollary\<^marker>\<open>tag unimportant\<close> Arg_ne_0: assumes "z \<notin> \<real>\<^sub>\<ge>\<^sub>0" shows "Arg z \<noteq> 0" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1904 | using assms by (auto simp: nonneg_Reals_def Arg_eq_0) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1905 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1906 | lemma Arg_eq_pi_iff: "Arg z = pi \<longleftrightarrow> z \<in> \<real> \<and> Re z < 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1907 | proof (cases "z=0") | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1908 | case False | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1909 | then show ?thesis | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1910 | using Arg_eq_0 [of "-z"] Arg_eq_pi complex_is_Real_iff by blast | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1911 | qed (simp add: Arg_def) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1912 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1913 | lemma Arg_eq_0_pi: "Arg z = 0 \<or> Arg z = pi \<longleftrightarrow> z \<in> \<real>" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1914 | using Arg_eq_pi_iff Arg_eq_0 by force | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1915 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1916 | lemma Arg_real: "z \<in> \<real> \<Longrightarrow> Arg z = (if 0 \<le> Re z then 0 else pi)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1917 | using Arg_eq_0 Arg_eq_0_pi by auto | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1918 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1919 | lemma Arg_inverse: "Arg(inverse z) = (if z \<in> \<real> then Arg z else - Arg z)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1920 | proof (cases "z \<in> \<real>") | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1921 | case True | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1922 | then show ?thesis | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1923 | by simp (metis Arg2pi_inverse Arg2pi_real Arg_real Reals_inverse) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1924 | next | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1925 | case False | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1926 | then have "Arg z < pi" "z \<noteq> 0" | 
| 68527 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1927 | using Arg_eq_0_pi Arg_le_pi by (auto simp: less_eq_real_def) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1928 | then show ?thesis | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1929 | apply (simp add: False) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1930 | apply (rule Arg_unique [of "inverse (norm z)"]) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1931 | using False mpi_less_Arg [of z] Arg_eq [of z] | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1932 | apply (auto simp: exp_minus field_simps) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1933 | done | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1934 | qed | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1935 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1936 | lemma Arg_eq_iff: | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1937 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1938 | shows "Arg w = Arg z \<longleftrightarrow> (\<exists>x. 0 < x \<and> w = of_real x * z)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1939 | using assms Arg_eq [of z] Arg_eq [of w] | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1940 | apply auto | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1941 | apply (rule_tac x="norm w / norm z" in exI) | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 1942 | apply (simp add: field_split_simps) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1943 | by (metis mult.commute mult.left_commute) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1944 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1945 | lemma Arg_inverse_eq_0: "Arg(inverse z) = 0 \<longleftrightarrow> Arg z = 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1946 | by (metis Arg_eq_0 Arg_inverse inverse_inverse_eq) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1947 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1948 | lemma Arg_cnj_eq_inverse: "z\<noteq>0 \<Longrightarrow> Arg (cnj z) = Arg (inverse z)" | 
| 71633 | 1949 | apply (simp add: Arg_eq_iff field_split_simps complex_norm_square [symmetric]) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1950 | by (metis of_real_power zero_less_norm_iff zero_less_power) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1951 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1952 | lemma Arg_cnj: "Arg(cnj z) = (if z \<in> \<real> then Arg z else - Arg z)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1953 | by (metis Arg_cnj_eq_inverse Arg_inverse Reals_0 complex_cnj_zero) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1954 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1955 | lemma Arg_exp: "-pi < Im z \<Longrightarrow> Im z \<le> pi \<Longrightarrow> Arg(exp z) = Im z" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1956 | by (rule Arg_unique [of "exp(Re z)"]) (auto simp: exp_eq_polar) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1957 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1958 | lemma Ln_Arg: "z\<noteq>0 \<Longrightarrow> Ln(z) = ln(norm z) + \<i> * Arg(z)" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1959 | by (metis Arg_def Re_Ln complex_eq) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1960 | |
| 68517 | 1961 | lemma continuous_at_Arg: | 
| 1962 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" | |
| 1963 | shows "continuous (at z) Arg" | |
| 1964 | proof - | |
| 1965 | have [simp]: "(\<lambda>z. Im (Ln z)) \<midarrow>z\<rightarrow> Arg z" | |
| 1966 | using Arg_def assms continuous_at by fastforce | |
| 1967 | show ?thesis | |
| 1968 | unfolding continuous_at | |
| 1969 | proof (rule Lim_transform_within_open) | |
| 1970 | show "\<And>w. \<lbrakk>w \<in> - \<real>\<^sub>\<le>\<^sub>0; w \<noteq> z\<rbrakk> \<Longrightarrow> Im (Ln w) = Arg w" | |
| 1971 | by (metis Arg_def Compl_iff nonpos_Reals_zero_I) | |
| 1972 | qed (use assms in auto) | |
| 1973 | qed | |
| 1974 | ||
| 1975 | lemma continuous_within_Arg: "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> continuous (at z within S) Arg" | |
| 1976 | using continuous_at_Arg continuous_at_imp_continuous_within by blast | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1977 | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1978 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1979 | subsection\<open>The Unwinding Number and the Ln product Formula\<close> | 
| 68535 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1980 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1981 | text\<open>Note that in this special case the unwinding number is -1, 0 or 1. But it's always an integer.\<close> | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1982 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1983 | lemma is_Arg_exp_Im: "is_Arg (exp z) (Im z)" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1984 | using exp_eq_polar is_Arg_def norm_exp_eq_Re by auto | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1985 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1986 | lemma is_Arg_exp_diff_2pi: | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1987 | assumes "is_Arg (exp z) \<theta>" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1988 | shows "\<exists>k. Im z - of_int k * (2 * pi) = \<theta>" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1989 | proof (intro exI is_Arg_eqI) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1990 | let ?k = "\<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor>" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1991 | show "is_Arg (exp z) (Im z - real_of_int ?k * (2 * pi))" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1992 | by (metis diff_add_cancel is_Arg_2pi_iff is_Arg_exp_Im) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1993 | show "\<bar>Im z - real_of_int ?k * (2 * pi) - \<theta>\<bar> < 2 * pi" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1994 | using floor_divide_upper [of "2*pi" "Im z - \<theta>"] floor_divide_lower [of "2*pi" "Im z - \<theta>"] | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1995 | by (auto simp: algebra_simps abs_if) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1996 | qed (auto simp: is_Arg_exp_Im assms) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1997 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1998 | lemma Arg_exp_diff_2pi: "\<exists>k. Im z - of_int k * (2 * pi) = Arg (exp z)" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1999 | using is_Arg_exp_diff_2pi [OF is_Arg_Arg] by auto | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2000 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2001 | lemma unwinding_in_Ints: "(z - Ln(exp z)) / (of_real(2*pi) * \<i>) \<in> \<int>" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2002 | using Arg_exp_diff_2pi [of z] | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2003 | by (force simp: Ints_def image_def field_simps Arg_def intro!: complex_eqI) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2004 | |
| 70136 | 2005 | definition\<^marker>\<open>tag important\<close> unwinding :: "complex \<Rightarrow> int" where | 
| 68535 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2006 | "unwinding z \<equiv> THE k. of_int k = (z - Ln(exp z)) / (of_real(2*pi) * \<i>)" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2007 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2008 | lemma unwinding: "of_int (unwinding z) = (z - Ln(exp z)) / (of_real(2*pi) * \<i>)" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2009 | using unwinding_in_Ints [of z] | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2010 | unfolding unwinding_def Ints_def by force | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2011 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2012 | lemma unwinding_2pi: "(2*pi) * \<i> * unwinding(z) = z - Ln(exp z)" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2013 | by (simp add: unwinding) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2014 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2015 | lemma Ln_times_unwinding: | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2016 | "w \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> Ln(w * z) = Ln(w) + Ln(z) - (2*pi) * \<i> * unwinding(Ln w + Ln z)" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2017 | using unwinding_2pi by (simp add: exp_add) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2018 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2019 | |
| 70136 | 2020 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Relation between Ln and Arg2pi, and hence continuity of Arg2pi\<close> | 
| 68493 | 2021 | |
| 2022 | lemma Arg2pi_Ln: | |
| 2023 | assumes "0 < Arg2pi z" shows "Arg2pi z = Im(Ln(-z)) + pi" | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2024 | proof (cases "z = 0") | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2025 | case True | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2026 | with assms show ?thesis | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2027 | by simp | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2028 | next | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2029 | case False | 
| 68493 | 2030 | then have "z / of_real(norm z) = exp(\<i> * of_real(Arg2pi z))" | 
| 2031 | using Arg2pi [of z] | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2032 | by (metis is_Arg_def abs_norm_cancel nonzero_mult_div_cancel_left norm_of_real zero_less_norm_iff) | 
| 68493 | 2033 | then have "- z / of_real(norm z) = exp (\<i> * (of_real (Arg2pi z) - pi))" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2034 | using cis_conv_exp cis_pi | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2035 | by (auto simp: exp_diff algebra_simps) | 
| 68493 | 2036 | then have "ln (- z / of_real(norm z)) = ln (exp (\<i> * (of_real (Arg2pi z) - pi)))" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2037 | by simp | 
| 68493 | 2038 | also have "... = \<i> * (of_real(Arg2pi z) - pi)" | 
| 2039 | using Arg2pi [of z] assms pi_not_less_zero | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2040 | by auto | 
| 68493 | 2041 | finally have "Arg2pi z = Im (Ln (- z / of_real (cmod z))) + pi" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2042 | by simp | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2043 | also have "... = Im (Ln (-z) - ln (cmod z)) + pi" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2044 | by (metis diff_0_right minus_diff_eq zero_less_norm_iff Ln_divide_of_real False) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2045 | also have "... = Im (Ln (-z)) + pi" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2046 | by simp | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2047 | finally show ?thesis . | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2048 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2049 | |
| 68493 | 2050 | lemma continuous_at_Arg2pi: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2051 | assumes "z \<notin> \<real>\<^sub>\<ge>\<^sub>0" | 
| 68493 | 2052 | shows "continuous (at z) Arg2pi" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2053 | proof - | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2054 | have *: "isCont (\<lambda>z. Im (Ln (- z)) + pi) z" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2055 | by (rule Complex.isCont_Im isCont_Ln' continuous_intros | simp add: assms complex_is_Real_iff)+ | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2056 | have [simp]: "Im x \<noteq> 0 \<Longrightarrow> Im (Ln (- x)) + pi = Arg2pi x" for x | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2057 | using Arg2pi_Ln by (simp add: Arg2pi_gt_0 complex_nonneg_Reals_iff) | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2058 | consider "Re z < 0" | "Im z \<noteq> 0" using assms | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2059 | using complex_nonneg_Reals_iff not_le by blast | 
| 68493 | 2060 | then have [simp]: "(\<lambda>z. Im (Ln (- z)) + pi) \<midarrow>z\<rightarrow> Arg2pi z" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2061 | using "*" by (simp add: Arg2pi_Ln Arg2pi_gt_0 assms continuous_within) | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2062 | show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2063 | unfolding continuous_at | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2064 | proof (rule Lim_transform_within_open) | 
| 68493 | 2065 | show "\<And>x. \<lbrakk>x \<in> - \<real>\<^sub>\<ge>\<^sub>0; x \<noteq> z\<rbrakk> \<Longrightarrow> Im (Ln (- x)) + pi = Arg2pi x" | 
| 2066 | by (auto simp add: Arg2pi_Ln [OF Arg2pi_gt_0] complex_nonneg_Reals_iff) | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2067 | qed (use assms in auto) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2068 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2069 | |
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2070 | |
| 68493 | 2071 | text\<open>Relation between Arg2pi and arctangent in upper halfplane\<close> | 
| 2072 | lemma Arg2pi_arctan_upperhalf: | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2073 | assumes "0 < Im z" | 
| 68493 | 2074 | shows "Arg2pi z = pi/2 - arctan(Re z / Im z)" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2075 | proof (cases "z = 0") | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2076 | case False | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2077 | show ?thesis | 
| 68493 | 2078 | proof (rule Arg2pi_unique [of "norm z"]) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2079 | show "(cmod z) * exp (\<i> * (pi / 2 - arctan (Re z / Im z))) = z" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2080 | apply (auto simp: exp_Euler cos_diff sin_diff) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2081 | using assms norm_complex_def [of z, symmetric] | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2082 | apply (simp add: sin_of_real cos_of_real sin_arctan cos_arctan field_simps real_sqrt_divide) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2083 | apply (metis complex_eq) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2084 | done | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2085 | qed (use False arctan [of "Re z / Im z"] in auto) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2086 | qed (use assms in auto) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2087 | |
| 68493 | 2088 | lemma Arg2pi_eq_Im_Ln: | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2089 | assumes "0 \<le> Im z" "0 < Re z" | 
| 68493 | 2090 | shows "Arg2pi z = Im (Ln z)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2091 | proof (cases "Im z = 0") | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2092 | case True then show ?thesis | 
| 68493 | 2093 | using Arg2pi_eq_0 Ln_in_Reals assms(2) complex_is_Real_iff by auto | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2094 | next | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2095 | case False | 
| 68493 | 2096 | then have *: "Arg2pi z > 0" | 
| 2097 | using Arg2pi_gt_0 complex_is_Real_iff by blast | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2098 | then have "z \<noteq> 0" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2099 | by auto | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2100 | with * assms False show ?thesis | 
| 68493 | 2101 | by (subst Arg2pi_Ln) (auto simp: Ln_minus) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2102 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2103 | |
| 68493 | 2104 | lemma continuous_within_upperhalf_Arg2pi: | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2105 | assumes "z \<noteq> 0" | 
| 68493 | 2106 |     shows "continuous (at z within {z. 0 \<le> Im z}) Arg2pi"
 | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2107 | proof (cases "z \<in> \<real>\<^sub>\<ge>\<^sub>0") | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2108 | case False then show ?thesis | 
| 68493 | 2109 | using continuous_at_Arg2pi continuous_at_imp_continuous_within by auto | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2110 | next | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2111 | case True | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2112 | then have z: "z \<in> \<real>" "0 < Re z" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2113 | using assms by (auto simp: complex_nonneg_Reals_iff complex_is_Real_iff complex_neq_0) | 
| 68493 | 2114 | then have [simp]: "Arg2pi z = 0" "Im (Ln z) = 0" | 
| 2115 | by (auto simp: Arg2pi_eq_0 Im_Ln_eq_0 assms complex_is_Real_iff) | |
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2116 | show ?thesis | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2117 | proof (clarsimp simp add: continuous_within Lim_within dist_norm) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2118 | fix e::real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2119 | assume "0 < e" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2120 | moreover have "continuous (at z) (\<lambda>x. Im (Ln x))" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2121 | using z by (simp add: continuous_at_Ln complex_nonpos_Reals_iff) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2122 | ultimately | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2123 | obtain d where d: "d>0" "\<And>x. x \<noteq> z \<Longrightarrow> cmod (x - z) < d \<Longrightarrow> \<bar>Im (Ln x)\<bar> < e" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2124 | by (auto simp: continuous_within Lim_within dist_norm) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2125 |     { fix x
 | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2126 | assume "cmod (x - z) < Re z / 2" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2127 | then have "\<bar>Re x - Re z\<bar> < Re z / 2" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2128 | by (metis le_less_trans abs_Re_le_cmod minus_complex.simps(1)) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2129 | then have "0 < Re x" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2130 | using z by linarith | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2131 | } | 
| 68493 | 2132 | then show "\<exists>d>0. \<forall>x. 0 \<le> Im x \<longrightarrow> x \<noteq> z \<and> cmod (x - z) < d \<longrightarrow> \<bar>Arg2pi x\<bar> < e" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2133 | apply (rule_tac x="min d (Re z / 2)" in exI) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2134 | using z d | 
| 68493 | 2135 | apply (auto simp: Arg2pi_eq_Im_Ln) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2136 | done | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2137 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2138 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2139 | |
| 68493 | 2140 | lemma continuous_on_upperhalf_Arg2pi: "continuous_on ({z. 0 \<le> Im z} - {0}) Arg2pi"
 | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2141 | unfolding continuous_on_eq_continuous_within | 
| 68493 | 2142 | by (metis DiffE Diff_subset continuous_within_subset continuous_within_upperhalf_Arg2pi insertCI) | 
| 2143 | ||
| 2144 | lemma open_Arg2pi2pi_less_Int: | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2145 | assumes "0 \<le> s" "t \<le> 2*pi" | 
| 68493 | 2146 |     shows "open ({y. s < Arg2pi y} \<inter> {y. Arg2pi y < t})"
 | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2147 | proof - | 
| 68493 | 2148 | have 1: "continuous_on (UNIV - \<real>\<^sub>\<ge>\<^sub>0) Arg2pi" | 
| 2149 | using continuous_at_Arg2pi continuous_at_imp_continuous_within | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2150 | by (auto simp: continuous_on_eq_continuous_within) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2151 | have 2: "open (UNIV - \<real>\<^sub>\<ge>\<^sub>0 :: complex set)" by (simp add: open_Diff) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2152 |   have "open ({z. s < z} \<inter> {z. z < t})"
 | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2153 | using open_lessThan [of t] open_greaterThan [of s] | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2154 | by (metis greaterThan_def lessThan_def open_Int) | 
| 68493 | 2155 |   moreover have "{y. s < Arg2pi y} \<inter> {y. Arg2pi y < t} \<subseteq> - \<real>\<^sub>\<ge>\<^sub>0"
 | 
| 2156 | using assms by (auto simp: Arg2pi_real complex_nonneg_Reals_iff complex_is_Real_iff) | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2157 | ultimately show ?thesis | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2158 |     using continuous_imp_open_vimage [OF 1 2, of  "{z. Re z > s} \<inter> {z. Re z < t}"]
 | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2159 | by auto | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2160 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2161 | |
| 68493 | 2162 | lemma open_Arg2pi2pi_gt: "open {z. t < Arg2pi z}"
 | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2163 | proof (cases "t < 0") | 
| 68493 | 2164 |   case True then have "{z. t < Arg2pi z} = UNIV"
 | 
| 2165 | using Arg2pi_ge_0 less_le_trans by auto | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2166 | then show ?thesis | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2167 | by simp | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2168 | next | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2169 | case False then show ?thesis | 
| 68493 | 2170 | using open_Arg2pi2pi_less_Int [of t "2*pi"] Arg2pi_lt_2pi | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2171 | by auto | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2172 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2173 | |
| 68493 | 2174 | lemma closed_Arg2pi2pi_le: "closed {z. Arg2pi z \<le> t}"
 | 
| 2175 | using open_Arg2pi2pi_gt [of t] | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2176 | by (simp add: closed_def Set.Collect_neg_eq [symmetric] not_le) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2177 | |
| 70136 | 2178 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Complex Powers\<close> | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2179 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2180 | lemma powr_to_1 [simp]: "z powr 1 = (z::complex)" | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 2181 | by (simp add: powr_def) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2182 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2183 | lemma powr_nat: | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2184 | fixes n::nat and z::complex shows "z powr n = (if z = 0 then 0 else z^n)" | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 2185 | by (simp add: exp_of_nat_mult powr_def) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2186 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2187 | lemma norm_powr_real: "w \<in> \<real> \<Longrightarrow> 0 < Re w \<Longrightarrow> norm(w powr z) = exp(Re z * ln(Re w))" | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 2188 | apply (simp add: powr_def) | 
| 68281 | 2189 | using Im_Ln_eq_0 complex_is_Real_iff norm_complex_def by auto | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2190 | |
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2191 | lemma powr_complexpow [simp]: | 
| 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2192 | fixes x::complex shows "x \<noteq> 0 \<Longrightarrow> x powr (of_nat n) = x^n" | 
| 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2193 | by (induct n) (auto simp: ac_simps powr_add) | 
| 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2194 | |
| 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2195 | lemma powr_complexnumeral [simp]: | 
| 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2196 | fixes x::complex shows "x \<noteq> 0 \<Longrightarrow> x powr (numeral n) = x ^ (numeral n)" | 
| 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2197 | by (metis of_nat_numeral powr_complexpow) | 
| 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2198 | |
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2199 | lemma cnj_powr: | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2200 | assumes "Im a = 0 \<Longrightarrow> Re a \<ge> 0" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2201 | shows "cnj (a powr b) = cnj a powr cnj b" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2202 | proof (cases "a = 0") | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2203 | case False | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2204 | with assms have "a \<notin> \<real>\<^sub>\<le>\<^sub>0" by (auto simp: complex_eq_iff complex_nonpos_Reals_iff) | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2205 | with False show ?thesis by (simp add: powr_def exp_cnj cnj_Ln) | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2206 | qed simp | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2207 | |
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2208 | lemma powr_real_real: | 
| 68281 | 2209 | assumes "w \<in> \<real>" "z \<in> \<real>" "0 < Re w" | 
| 2210 | shows "w powr z = exp(Re z * ln(Re w))" | |
| 2211 | proof - | |
| 2212 | have "w \<noteq> 0" | |
| 2213 | using assms by auto | |
| 2214 | with assms show ?thesis | |
| 2215 | by (simp add: powr_def Ln_Reals_eq of_real_exp) | |
| 2216 | qed | |
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2217 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2218 | lemma powr_of_real: | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 2219 | fixes x::real and y::real | 
| 63296 | 2220 | shows "0 \<le> x \<Longrightarrow> of_real x powr (of_real y::complex) = of_real (x powr y)" | 
| 2221 | by (simp_all add: powr_def exp_eq_polar) | |
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2222 | |
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2223 | lemma powr_of_int: | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2224 | fixes z::complex and n::int | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2225 | assumes "z\<noteq>(0::complex)" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2226 | shows "z powr of_int n = (if n\<ge>0 then z^nat n else inverse (z^nat (-n)))" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2227 | by (metis assms not_le of_int_of_nat powr_complexpow powr_minus) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2228 | |
| 67135 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2229 | lemma powr_Reals_eq: "\<lbrakk>x \<in> \<real>; y \<in> \<real>; Re x \<ge> 0\<rbrakk> \<Longrightarrow> x powr y = of_real (Re x powr Re y)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2230 | by (metis of_real_Re powr_of_real) | 
| 65719 | 2231 | |
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2232 | lemma norm_powr_real_mono: | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 2233 | "\<lbrakk>w \<in> \<real>; 1 < Re w\<rbrakk> | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 2234 | \<Longrightarrow> cmod(w powr z1) \<le> cmod(w powr z2) \<longleftrightarrow> Re z1 \<le> Re z2" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 2235 | by (auto simp: powr_def algebra_simps Reals_def Ln_of_real) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2236 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2237 | lemma powr_times_real: | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2238 | "\<lbrakk>x \<in> \<real>; y \<in> \<real>; 0 \<le> Re x; 0 \<le> Re y\<rbrakk> | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2239 | \<Longrightarrow> (x * y) powr z = x powr z * y powr z" | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 2240 | by (auto simp: Reals_def powr_def Ln_times exp_add algebra_simps less_eq_real_def Ln_of_real) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2241 | |
| 65719 | 2242 | lemma Re_powr_le: "r \<in> \<real>\<^sub>\<ge>\<^sub>0 \<Longrightarrow> Re (r powr z) \<le> Re r powr Re z" | 
| 2243 | by (auto simp: powr_def nonneg_Reals_def order_trans [OF complex_Re_le_cmod]) | |
| 2244 | ||
| 2245 | lemma | |
| 2246 | fixes w::complex | |
| 2247 | shows Reals_powr [simp]: "\<lbrakk>w \<in> \<real>\<^sub>\<ge>\<^sub>0; z \<in> \<real>\<rbrakk> \<Longrightarrow> w powr z \<in> \<real>" | |
| 2248 | and nonneg_Reals_powr [simp]: "\<lbrakk>w \<in> \<real>\<^sub>\<ge>\<^sub>0; z \<in> \<real>\<rbrakk> \<Longrightarrow> w powr z \<in> \<real>\<^sub>\<ge>\<^sub>0" | |
| 2249 | by (auto simp: nonneg_Reals_def Reals_def powr_of_real) | |
| 2250 | ||
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2251 | lemma powr_neg_real_complex: | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2252 | shows "(- of_real x) powr a = (-1) powr (of_real (sgn x) * a) * of_real x powr (a :: complex)" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2253 | proof (cases "x = 0") | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2254 | assume x: "x \<noteq> 0" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2255 | hence "(-x) powr a = exp (a * ln (-of_real x))" by (simp add: powr_def) | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2256 | also from x have "ln (-of_real x) = Ln (of_real x) + of_real (sgn x) * pi * \<i>" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2257 | by (simp add: Ln_minus Ln_of_real) | 
| 63092 | 2258 | also from x have "exp (a * ...) = cis pi powr (of_real (sgn x) * a) * of_real x powr a" | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2259 | by (simp add: powr_def exp_add algebra_simps Ln_of_real cis_conv_exp) | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2260 | also note cis_pi | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2261 | finally show ?thesis by simp | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2262 | qed simp_all | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2263 | |
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2264 | lemma has_field_derivative_powr: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2265 | fixes z :: complex | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2266 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2267 | shows "((\<lambda>z. z powr s) has_field_derivative (s * z powr (s - 1))) (at z)" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2268 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2269 | case False | 
| 68281 | 2270 | show ?thesis | 
| 2271 | unfolding powr_def | |
| 71029 
934e0044e94b
Moved or deleted some out of place material, also eliminating obsolete naming conventions
 paulson <lp15@cam.ac.uk> parents: 
71001diff
changeset | 2272 | proof (rule has_field_derivative_transform_within) | 
| 68281 | 2273 | show "((\<lambda>z. exp (s * Ln z)) has_field_derivative s * (if z = 0 then 0 else exp ((s - 1) * Ln z))) | 
| 2274 | (at z)" | |
| 2275 | apply (intro derivative_eq_intros | simp add: assms)+ | |
| 2276 | by (simp add: False divide_complex_def exp_diff left_diff_distrib') | |
| 2277 | qed (use False in auto) | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2278 | qed (use assms in auto) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2279 | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2280 | declare has_field_derivative_powr[THEN DERIV_chain2, derivative_intros] | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2281 | |
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2282 | lemma has_field_derivative_powr_of_int: | 
| 68493 | 2283 | fixes z :: complex | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2284 | assumes gderiv:"(g has_field_derivative gd) (at z within s)" and "g z\<noteq>0" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2285 | shows "((\<lambda>z. g z powr of_int n) has_field_derivative (n * g z powr (of_int n - 1) * gd)) (at z within s)" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2286 | proof - | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2287 | define dd where "dd = of_int n * g z powr (of_int (n - 1)) * gd" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2288 | obtain e where "e>0" and e_dist:"\<forall>y\<in>s. dist z y < e \<longrightarrow> g y \<noteq> 0" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2289 | using DERIV_continuous[OF gderiv,THEN continuous_within_avoid] \<open>g z\<noteq>0\<close> by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2290 | have ?thesis when "n\<ge>0" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2291 | proof - | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2292 | define dd' where "dd' = of_int n * g z ^ (nat n - 1) * gd" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2293 | have "dd=dd'" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2294 | proof (cases "n=0") | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2295 | case False | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2296 | then have "n-1 \<ge>0" using \<open>n\<ge>0\<close> by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2297 | then have "g z powr (of_int (n - 1)) = g z ^ (nat n - 1)" | 
| 68493 | 2298 | using powr_of_int[OF \<open>g z\<noteq>0\<close>,of "n-1"] by (simp add: nat_diff_distrib') | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2299 | then show ?thesis unfolding dd_def dd'_def by simp | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2300 | qed (simp add:dd_def dd'_def) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2301 | then have "((\<lambda>z. g z powr of_int n) has_field_derivative dd) (at z within s) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2302 | \<longleftrightarrow> ((\<lambda>z. g z powr of_int n) has_field_derivative dd') (at z within s)" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2303 | by simp | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2304 | also have "... \<longleftrightarrow> ((\<lambda>z. g z ^ nat n) has_field_derivative dd') (at z within s)" | 
| 68281 | 2305 | proof (rule has_field_derivative_cong_eventually) | 
| 2306 | show "\<forall>\<^sub>F x in at z within s. g x powr of_int n = g x ^ nat n" | |
| 2307 | unfolding eventually_at | |
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2308 | apply (rule exI[where x=e]) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2309 | using powr_of_int that \<open>e>0\<close> e_dist by (simp add: dist_commute) | 
| 68281 | 2310 | qed (use powr_of_int \<open>g z\<noteq>0\<close> that in simp) | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2311 | also have "..." unfolding dd'_def using gderiv that | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2312 | by (auto intro!: derivative_eq_intros) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2313 | finally have "((\<lambda>z. g z powr of_int n) has_field_derivative dd) (at z within s)" . | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2314 | then show ?thesis unfolding dd_def by simp | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2315 | qed | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2316 | moreover have ?thesis when "n<0" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2317 | proof - | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2318 | define dd' where "dd' = of_int n / g z ^ (nat (1 - n)) * gd" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2319 | have "dd=dd'" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2320 | proof - | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2321 | have "g z powr of_int (n - 1) = inverse (g z ^ nat (1-n))" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2322 | using powr_of_int[OF \<open>g z\<noteq>0\<close>,of "n-1"] that by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2323 | then show ?thesis | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2324 | unfolding dd_def dd'_def by (simp add: divide_inverse) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2325 | qed | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2326 | then have "((\<lambda>z. g z powr of_int n) has_field_derivative dd) (at z within s) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2327 | \<longleftrightarrow> ((\<lambda>z. g z powr of_int n) has_field_derivative dd') (at z within s)" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2328 | by simp | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2329 | also have "... \<longleftrightarrow> ((\<lambda>z. inverse (g z ^ nat (-n))) has_field_derivative dd') (at z within s)" | 
| 68281 | 2330 | proof (rule has_field_derivative_cong_eventually) | 
| 2331 | show "\<forall>\<^sub>F x in at z within s. g x powr of_int n = inverse (g x ^ nat (- n))" | |
| 2332 | unfolding eventually_at | |
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2333 | apply (rule exI[where x=e]) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2334 | using powr_of_int that \<open>e>0\<close> e_dist by (simp add: dist_commute) | 
| 68281 | 2335 | qed (use powr_of_int \<open>g z\<noteq>0\<close> that in simp) | 
| 2336 | also have "..." | |
| 2337 | proof - | |
| 2338 | have "nat (- n) + nat (1 - n) - Suc 0 = nat (- n) + nat (- n)" | |
| 2339 | by auto | |
| 2340 | then show ?thesis | |
| 2341 | unfolding dd'_def using gderiv that \<open>g z\<noteq>0\<close> | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2342 | by (auto intro!: derivative_eq_intros simp add:field_split_simps power_add[symmetric]) | 
| 68281 | 2343 | qed | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2344 | finally have "((\<lambda>z. g z powr of_int n) has_field_derivative dd) (at z within s)" . | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2345 | then show ?thesis unfolding dd_def by simp | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2346 | qed | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2347 | ultimately show ?thesis by force | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2348 | qed | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2349 | |
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2350 | lemma field_differentiable_powr_of_int: | 
| 68493 | 2351 | fixes z :: complex | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2352 | assumes gderiv:"g field_differentiable (at z within s)" and "g z\<noteq>0" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2353 | shows "(\<lambda>z. g z powr of_int n) field_differentiable (at z within s)" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2354 | using has_field_derivative_powr_of_int assms(2) field_differentiable_def gderiv by blast | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2355 | |
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2356 | lemma holomorphic_on_powr_of_int [holomorphic_intros]: | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2357 | assumes "f holomorphic_on s" "\<forall>z\<in>s. f z\<noteq>0" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2358 | shows "(\<lambda>z. (f z) powr of_int n) holomorphic_on s" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2359 | proof (cases "n\<ge>0") | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2360 | case True | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2361 | then have "?thesis \<longleftrightarrow> (\<lambda>z. (f z) ^ nat n) holomorphic_on s" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2362 | apply (rule_tac holomorphic_cong) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2363 | using assms(2) by (auto simp add:powr_of_int) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2364 | moreover have "(\<lambda>z. (f z) ^ nat n) holomorphic_on s" | 
| 68493 | 2365 | using assms(1) by (auto intro:holomorphic_intros) | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2366 | ultimately show ?thesis by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2367 | next | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2368 | case False | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2369 | then have "?thesis \<longleftrightarrow> (\<lambda>z. inverse (f z) ^ nat (-n)) holomorphic_on s" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2370 | apply (rule_tac holomorphic_cong) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2371 | using assms(2) by (auto simp add:powr_of_int power_inverse) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2372 | moreover have "(\<lambda>z. inverse (f z) ^ nat (-n)) holomorphic_on s" | 
| 68493 | 2373 | using assms by (auto intro!:holomorphic_intros) | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2374 | ultimately show ?thesis by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2375 | qed | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2376 | |
| 65578 
e4997c181cce
New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
 paulson <lp15@cam.ac.uk> parents: 
65274diff
changeset | 2377 | lemma has_field_derivative_powr_right [derivative_intros]: | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2378 | "w \<noteq> 0 \<Longrightarrow> ((\<lambda>z. w powr z) has_field_derivative Ln w * w powr z) (at z)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2379 | unfolding powr_def by (intro derivative_eq_intros | simp)+ | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2380 | |
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2381 | lemma field_differentiable_powr_right [derivative_intros]: | 
| 62533 
bc25f3916a99
new material to Blochj's theorem, as well as supporting lemmas
 paulson <lp15@cam.ac.uk> parents: 
62393diff
changeset | 2382 | fixes w::complex | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2383 | shows "w \<noteq> 0 \<Longrightarrow> (\<lambda>z. w powr z) field_differentiable (at z)" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2384 | using field_differentiable_def has_field_derivative_powr_right by blast | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2385 | |
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2386 | lemma holomorphic_on_powr_right [holomorphic_intros]: | 
| 67268 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2387 | assumes "f holomorphic_on s" | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2388 | shows "(\<lambda>z. w powr (f z)) holomorphic_on s" | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2389 | proof (cases "w = 0") | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2390 | case False | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2391 | with assms show ?thesis | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2392 | unfolding holomorphic_on_def field_differentiable_def | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2393 | by (metis (full_types) DERIV_chain' has_field_derivative_powr_right) | 
| 68281 | 2394 | qed simp | 
| 67268 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2395 | |
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2396 | lemma holomorphic_on_divide_gen [holomorphic_intros]: | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2397 | assumes f: "f holomorphic_on s" and g: "g holomorphic_on s" and 0: "\<And>z z'. \<lbrakk>z \<in> s; z' \<in> s\<rbrakk> \<Longrightarrow> g z = 0 \<longleftrightarrow> g z' = 0" | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2398 | shows "(\<lambda>z. f z / g z) holomorphic_on s" | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2399 | proof (cases "\<exists>z\<in>s. g z = 0") | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2400 | case True | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2401 | with 0 have "g z = 0" if "z \<in> s" for z | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2402 | using that by blast | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2403 | then show ?thesis | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2404 | using g holomorphic_transform by auto | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2405 | next | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2406 | case False | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2407 | with 0 have "g z \<noteq> 0" if "z \<in> s" for z | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2408 | using that by blast | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2409 | with holomorphic_on_divide show ?thesis | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2410 | using f g by blast | 
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2411 | qed | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2412 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2413 | lemma norm_powr_real_powr: | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2414 | "w \<in> \<real> \<Longrightarrow> 0 \<le> Re w \<Longrightarrow> cmod (w powr z) = Re w powr Re z" | 
| 68281 | 2415 | by (metis dual_order.order_iff_strict norm_powr_real norm_zero of_real_0 of_real_Re powr_def) | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2416 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2417 | lemma tendsto_powr_complex: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2418 | fixes f g :: "_ \<Rightarrow> complex" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2419 | assumes a: "a \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2420 | assumes f: "(f \<longlongrightarrow> a) F" and g: "(g \<longlongrightarrow> b) F" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2421 | shows "((\<lambda>z. f z powr g z) \<longlongrightarrow> a powr b) F" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2422 | proof - | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2423 | from a have [simp]: "a \<noteq> 0" by auto | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2424 | from f g a have "((\<lambda>z. exp (g z * ln (f z))) \<longlongrightarrow> a powr b) F" (is ?P) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2425 | by (auto intro!: tendsto_intros simp: powr_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2426 |   also {
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2427 | have "eventually (\<lambda>z. z \<noteq> 0) (nhds a)" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2428 | by (intro t1_space_nhds) simp_all | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2429 | with f have "eventually (\<lambda>z. f z \<noteq> 0) F" using filterlim_iff by blast | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2430 | } | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2431 | hence "?P \<longleftrightarrow> ((\<lambda>z. f z powr g z) \<longlongrightarrow> a powr b) F" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2432 | by (intro tendsto_cong refl) (simp_all add: powr_def mult_ac) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2433 | finally show ?thesis . | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2434 | qed | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2435 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2436 | lemma tendsto_powr_complex_0: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2437 | fixes f g :: "'a \<Rightarrow> complex" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2438 | assumes f: "(f \<longlongrightarrow> 0) F" and g: "(g \<longlongrightarrow> b) F" and b: "Re b > 0" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2439 | shows "((\<lambda>z. f z powr g z) \<longlongrightarrow> 0) F" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2440 | proof (rule tendsto_norm_zero_cancel) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2441 | define h where | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2442 | "h = (\<lambda>z. if f z = 0 then 0 else exp (Re (g z) * ln (cmod (f z)) + abs (Im (g z)) * pi))" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2443 |   {
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2444 | fix z :: 'a assume z: "f z \<noteq> 0" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2445 | define c where "c = abs (Im (g z)) * pi" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2446 | from mpi_less_Im_Ln[OF z] Im_Ln_le_pi[OF z] | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2447 | have "abs (Im (Ln (f z))) \<le> pi" by simp | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2448 | from mult_left_mono[OF this, of "abs (Im (g z))"] | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2449 | have "abs (Im (g z) * Im (ln (f z))) \<le> c" by (simp add: abs_mult c_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2450 | hence "-Im (g z) * Im (ln (f z)) \<le> c" by simp | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2451 | hence "norm (f z powr g z) \<le> h z" by (simp add: powr_def field_simps h_def c_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2452 | } | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2453 | hence le: "norm (f z powr g z) \<le> h z" for z by (cases "f x = 0") (simp_all add: h_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2454 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2455 |   have g': "(g \<longlongrightarrow> b) (inf F (principal {z. f z \<noteq> 0}))"
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2456 | by (rule tendsto_mono[OF _ g]) simp_all | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2457 |   have "((\<lambda>x. norm (f x)) \<longlongrightarrow> 0) (inf F (principal {z. f z \<noteq> 0}))"
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2458 | by (subst tendsto_norm_zero_iff, rule tendsto_mono[OF _ f]) simp_all | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2459 |   moreover {
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2460 |     have "filterlim (\<lambda>x. norm (f x)) (principal {0<..}) (principal {z. f z \<noteq> 0})"
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2461 | by (auto simp: filterlim_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2462 |     hence "filterlim (\<lambda>x. norm (f x)) (principal {0<..})
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2463 |              (inf F (principal {z. f z \<noteq> 0}))"
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2464 | by (rule filterlim_mono) simp_all | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2465 | } | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2466 |   ultimately have norm: "filterlim (\<lambda>x. norm (f x)) (at_right 0) (inf F (principal {z. f z \<noteq> 0}))"
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2467 | by (simp add: filterlim_inf at_within_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2468 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2469 |   have A: "LIM x inf F (principal {z. f z \<noteq> 0}). Re (g x) * -ln (cmod (f x)) :> at_top"
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2470 | by (rule filterlim_tendsto_pos_mult_at_top tendsto_intros g' b | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2471 | filterlim_compose[OF filterlim_uminus_at_top_at_bot] filterlim_compose[OF ln_at_0] norm)+ | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2472 |   have B: "LIM x inf F (principal {z. f z \<noteq> 0}).
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2473 | -\<bar>Im (g x)\<bar> * pi + -(Re (g x) * ln (cmod (f x))) :> at_top" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2474 | by (rule filterlim_tendsto_add_at_top tendsto_intros g')+ (insert A, simp_all) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2475 | have C: "(h \<longlongrightarrow> 0) F" unfolding h_def | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2476 | by (intro filterlim_If tendsto_const filterlim_compose[OF exp_at_bot]) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2477 | (insert B, auto simp: filterlim_uminus_at_bot algebra_simps) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2478 | show "((\<lambda>x. norm (f x powr g x)) \<longlongrightarrow> 0) F" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2479 | by (rule Lim_null_comparison[OF always_eventually C]) (insert le, auto) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2480 | qed | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2481 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2482 | lemma tendsto_powr_complex' [tendsto_intros]: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2483 | fixes f g :: "_ \<Rightarrow> complex" | 
| 68281 | 2484 | assumes "a \<notin> \<real>\<^sub>\<le>\<^sub>0 \<or> (a = 0 \<and> Re b > 0)" and "(f \<longlongrightarrow> a) F" "(g \<longlongrightarrow> b) F" | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2485 | shows "((\<lambda>z. f z powr g z) \<longlongrightarrow> a powr b) F" | 
| 68281 | 2486 | using assms tendsto_powr_complex tendsto_powr_complex_0 by fastforce | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2487 | |
| 67135 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2488 | lemma tendsto_neg_powr_complex_of_real: | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2489 | assumes "filterlim f at_top F" and "Re s < 0" | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2490 | shows "((\<lambda>x. complex_of_real (f x) powr s) \<longlongrightarrow> 0) F" | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2491 | proof - | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2492 | have "((\<lambda>x. norm (complex_of_real (f x) powr s)) \<longlongrightarrow> 0) F" | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2493 | proof (rule Lim_transform_eventually) | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2494 | from assms(1) have "eventually (\<lambda>x. f x \<ge> 0) F" | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2495 | by (auto simp: filterlim_at_top) | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2496 | thus "eventually (\<lambda>x. f x powr Re s = norm (of_real (f x) powr s)) F" | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2497 | by eventually_elim (simp add: norm_powr_real_powr) | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2498 | from assms show "((\<lambda>x. f x powr Re s) \<longlongrightarrow> 0) F" | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2499 | by (intro tendsto_neg_powr) | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2500 | qed | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2501 | thus ?thesis by (simp add: tendsto_norm_zero_iff) | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2502 | qed | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2503 | |
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2504 | lemma tendsto_neg_powr_complex_of_nat: | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2505 | assumes "filterlim f at_top F" and "Re s < 0" | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2506 | shows "((\<lambda>x. of_nat (f x) powr s) \<longlongrightarrow> 0) F" | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2507 | proof - | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2508 | have "((\<lambda>x. of_real (real (f x)) powr s) \<longlongrightarrow> 0) F" using assms(2) | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2509 | by (intro filterlim_compose[OF _ tendsto_neg_powr_complex_of_real] | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2510 | filterlim_compose[OF _ assms(1)] filterlim_real_sequentially filterlim_ident) auto | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2511 | thus ?thesis by simp | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2512 | qed | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2513 | |
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2514 | lemma continuous_powr_complex: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2515 | assumes "f (netlimit F) \<notin> \<real>\<^sub>\<le>\<^sub>0" "continuous F f" "continuous F g" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2516 | shows "continuous F (\<lambda>z. f z powr g z :: complex)" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2517 | using assms unfolding continuous_def by (intro tendsto_powr_complex) simp_all | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2518 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2519 | lemma isCont_powr_complex [continuous_intros]: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2520 | assumes "f z \<notin> \<real>\<^sub>\<le>\<^sub>0" "isCont f z" "isCont g z" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2521 | shows "isCont (\<lambda>z. f z powr g z :: complex) z" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2522 | using assms unfolding isCont_def by (intro tendsto_powr_complex) simp_all | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2523 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2524 | lemma continuous_on_powr_complex [continuous_intros]: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2525 |   assumes "A \<subseteq> {z. Re (f z) \<ge> 0 \<or> Im (f z) \<noteq> 0}"
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2526 | assumes "\<And>z. z \<in> A \<Longrightarrow> f z = 0 \<Longrightarrow> Re (g z) > 0" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2527 | assumes "continuous_on A f" "continuous_on A g" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2528 | shows "continuous_on A (\<lambda>z. f z powr g z)" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2529 | unfolding continuous_on_def | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2530 | proof | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2531 | fix z assume z: "z \<in> A" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2532 | show "((\<lambda>z. f z powr g z) \<longlongrightarrow> f z powr g z) (at z within A)" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2533 | proof (cases "f z = 0") | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2534 | case False | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2535 | from assms(1,2) z have "Re (f z) \<ge> 0 \<or> Im (f z) \<noteq> 0" "f z = 0 \<longrightarrow> Re (g z) > 0" by auto | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2536 | with assms(3,4) z show ?thesis | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2537 | by (intro tendsto_powr_complex') | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2538 | (auto elim!: nonpos_Reals_cases simp: complex_eq_iff continuous_on_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2539 | next | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2540 | case True | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2541 | with assms z show ?thesis | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2542 | by (auto intro!: tendsto_powr_complex_0 simp: continuous_on_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2543 | qed | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2544 | qed | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2545 | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2546 | |
| 70136 | 2547 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Some Limits involving Logarithms\<close> | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2548 | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2549 | lemma lim_Ln_over_power: | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2550 | fixes s::complex | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2551 | assumes "0 < Re s" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2552 | shows "(\<lambda>n. Ln (of_nat n) / of_nat n powr s) \<longlonglongrightarrow> 0" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2553 | proof (simp add: lim_sequentially dist_norm, clarify) | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2554 | fix e::real | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2555 | assume e: "0 < e" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2556 | have "\<exists>xo>0. \<forall>x\<ge>xo. 0 < e * 2 + (e * Re s * 2 - 2) * x + e * (Re s)\<^sup>2 * x\<^sup>2" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2557 | proof (rule_tac x="2/(e * (Re s)\<^sup>2)" in exI, safe) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2558 | show "0 < 2 / (e * (Re s)\<^sup>2)" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2559 | using e assms by (simp add: field_simps) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2560 | next | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2561 | fix x::real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2562 | assume x: "2 / (e * (Re s)\<^sup>2) \<le> x" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2563 | have "2 / (e * (Re s)\<^sup>2) > 0" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2564 | using e assms by simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2565 | with x have "x > 0" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2566 | by linarith | 
| 68281 | 2567 | then have "x * 2 \<le> e * (x\<^sup>2 * (Re s)\<^sup>2)" | 
| 2568 | using e assms x by (auto simp: power2_eq_square field_simps) | |
| 2569 | also have "... < e * (2 + (x * (Re s * 2) + x\<^sup>2 * (Re s)\<^sup>2))" | |
| 2570 | using e assms \<open>x > 0\<close> | |
| 2571 | by (auto simp: power2_eq_square field_simps add_pos_pos) | |
| 2572 | finally show "0 < e * 2 + (e * Re s * 2 - 2) * x + e * (Re s)\<^sup>2 * x\<^sup>2" | |
| 2573 | by (auto simp: algebra_simps) | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2574 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2575 | then have "\<exists>xo>0. \<forall>x\<ge>xo. x / e < 1 + (Re s * x) + (1/2) * (Re s * x)^2" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2576 | using e by (simp add: field_simps) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2577 | then have "\<exists>xo>0. \<forall>x\<ge>xo. x / e < exp (Re s * x)" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2578 | using assms | 
| 69529 | 2579 | by (force intro: less_le_trans [OF _ exp_lower_Taylor_quadratic]) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2580 | then obtain xo where "xo > 0" and xo: "\<And>x. x \<ge> xo \<Longrightarrow> x < e * exp (Re s * x)" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2581 | using e by (auto simp: field_simps) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2582 | have "norm (Ln (of_nat n) / of_nat n powr s) < e" if "n \<ge> nat \<lceil>exp xo\<rceil>" for n | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2583 | using e xo [of "ln n"] that | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2584 | apply (auto simp: norm_divide norm_powr_real field_split_simps) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2585 | apply (metis exp_less_mono exp_ln not_le of_nat_0_less_iff) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2586 | done | 
| 68493 | 2587 | then show "\<exists>no. \<forall>n\<ge>no. norm (Ln (of_nat n) / of_nat n powr s) < e" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2588 | by blast | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2589 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2590 | |
| 61973 | 2591 | lemma lim_Ln_over_n: "((\<lambda>n. Ln(of_nat n) / of_nat n) \<longlongrightarrow> 0) sequentially" | 
| 65587 
16a8991ab398
New material (and some tidying) purely in the Analysis directory
 paulson <lp15@cam.ac.uk> parents: 
65585diff
changeset | 2592 | using lim_Ln_over_power [of 1] by simp | 
| 
16a8991ab398
New material (and some tidying) purely in the Analysis directory
 paulson <lp15@cam.ac.uk> parents: 
65585diff
changeset | 2593 | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2594 | lemma lim_ln_over_power: | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2595 | fixes s :: real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2596 | assumes "0 < s" | 
| 61973 | 2597 | shows "((\<lambda>n. ln n / (n powr s)) \<longlongrightarrow> 0) sequentially" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2598 | using lim_Ln_over_power [of "of_real s", THEN filterlim_sequentially_Suc [THEN iffD2]] assms | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2599 | apply (subst filterlim_sequentially_Suc [symmetric]) | 
| 68281 | 2600 | apply (simp add: lim_sequentially dist_norm Ln_Reals_eq norm_powr_real_powr norm_divide) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2601 | done | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2602 | |
| 70724 | 2603 | lemma lim_ln_over_n [tendsto_intros]: "((\<lambda>n. ln(real_of_nat n) / of_nat n) \<longlongrightarrow> 0) sequentially" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2604 | using lim_ln_over_power [of 1, THEN filterlim_sequentially_Suc [THEN iffD2]] | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2605 | apply (subst filterlim_sequentially_Suc [symmetric]) | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2606 | apply (simp add: lim_sequentially dist_norm) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2607 | done | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2608 | |
| 70724 | 2609 | lemma lim_log_over_n [tendsto_intros]: | 
| 2610 | "(\<lambda>n. log k n/n) \<longlonglongrightarrow> 0" | |
| 2611 | proof - | |
| 2612 | have *: "log k n/n = (1/ln k) * (ln n / n)" for n | |
| 2613 | unfolding log_def by auto | |
| 2614 | have "(\<lambda>n. (1/ln k) * (ln n / n)) \<longlonglongrightarrow> (1/ln k) * 0" | |
| 2615 | by (intro tendsto_intros) | |
| 2616 | then show ?thesis | |
| 2617 | unfolding * by auto | |
| 2618 | qed | |
| 2619 | ||
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2620 | lemma lim_1_over_complex_power: | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2621 | assumes "0 < Re s" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2622 | shows "(\<lambda>n. 1 / of_nat n powr s) \<longlonglongrightarrow> 0" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2623 | proof (rule Lim_null_comparison) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2624 | have "\<forall>n>0. 3 \<le> n \<longrightarrow> 1 \<le> ln (real_of_nat n)" | 
| 65719 | 2625 | using ln_272_gt_1 | 
| 2626 | by (force intro: order_trans [of _ "ln (272/100)"]) | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2627 | then show "\<forall>\<^sub>F x in sequentially. cmod (1 / of_nat x powr s) \<le> cmod (Ln (of_nat x) / of_nat x powr s)" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2628 | by (auto simp: norm_divide field_split_simps eventually_sequentially) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2629 | show "(\<lambda>n. cmod (Ln (of_nat n) / of_nat n powr s)) \<longlonglongrightarrow> 0" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2630 | using lim_Ln_over_power [OF assms] by (metis tendsto_norm_zero_iff) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2631 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2632 | |
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2633 | lemma lim_1_over_real_power: | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2634 | fixes s :: real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2635 | assumes "0 < s" | 
| 61973 | 2636 | shows "((\<lambda>n. 1 / (of_nat n powr s)) \<longlongrightarrow> 0) sequentially" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2637 | using lim_1_over_complex_power [of "of_real s", THEN filterlim_sequentially_Suc [THEN iffD2]] assms | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2638 | apply (subst filterlim_sequentially_Suc [symmetric]) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2639 | apply (simp add: lim_sequentially dist_norm) | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2640 | apply (simp add: Ln_Reals_eq norm_powr_real_powr norm_divide) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2641 | done | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2642 | |
| 61973 | 2643 | lemma lim_1_over_Ln: "((\<lambda>n. 1 / Ln(of_nat n)) \<longlongrightarrow> 0) sequentially" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2644 | proof (clarsimp simp add: lim_sequentially dist_norm norm_divide field_split_simps) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2645 | fix r::real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2646 | assume "0 < r" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2647 | have ir: "inverse (exp (inverse r)) > 0" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2648 | by simp | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2649 | obtain n where n: "1 < of_nat n * inverse (exp (inverse r))" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2650 | using ex_less_of_nat_mult [of _ 1, OF ir] | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2651 | by auto | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2652 | then have "exp (inverse r) < of_nat n" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2653 | by (simp add: field_split_simps) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2654 | then have "ln (exp (inverse r)) < ln (of_nat n)" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2655 | by (metis exp_gt_zero less_trans ln_exp ln_less_cancel_iff) | 
| 60420 | 2656 | with \<open>0 < r\<close> have "1 < r * ln (real_of_nat n)" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2657 | by (simp add: field_simps) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2658 | moreover have "n > 0" using n | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2659 | using neq0_conv by fastforce | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2660 | ultimately show "\<exists>no. \<forall>k. Ln (of_nat k) \<noteq> 0 \<longrightarrow> no \<le> k \<longrightarrow> 1 < r * cmod (Ln (of_nat k))" | 
| 60420 | 2661 | using n \<open>0 < r\<close> | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2662 | by (rule_tac x=n in exI) (force simp: field_split_simps intro: less_le_trans) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2663 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2664 | |
| 61973 | 2665 | lemma lim_1_over_ln: "((\<lambda>n. 1 / ln(real_of_nat n)) \<longlongrightarrow> 0) sequentially" | 
| 63092 | 2666 | using lim_1_over_Ln [THEN filterlim_sequentially_Suc [THEN iffD2]] | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2667 | apply (subst filterlim_sequentially_Suc [symmetric]) | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2668 | apply (simp add: lim_sequentially dist_norm) | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2669 | apply (simp add: Ln_Reals_eq norm_powr_real_powr norm_divide) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2670 | done | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2671 | |
| 65719 | 2672 | lemma lim_ln1_over_ln: "(\<lambda>n. ln(Suc n) / ln n) \<longlonglongrightarrow> 1" | 
| 2673 | proof (rule Lim_transform_eventually) | |
| 2674 | have "(\<lambda>n. ln(1 + 1/n) / ln n) \<longlonglongrightarrow> 0" | |
| 2675 | proof (rule Lim_transform_bound) | |
| 2676 | show "(inverse o real) \<longlonglongrightarrow> 0" | |
| 70367 | 2677 | by (metis comp_def lim_inverse_n lim_explicit) | 
| 65719 | 2678 | show "\<forall>\<^sub>F n in sequentially. norm (ln (1 + 1 / n) / ln n) \<le> norm ((inverse \<circ> real) n)" | 
| 2679 | proof | |
| 2680 | fix n::nat | |
| 2681 | assume n: "3 \<le> n" | |
| 2682 | then have "ln 3 \<le> ln n" and ln0: "0 \<le> ln n" | |
| 2683 | by auto | |
| 2684 | with ln3_gt_1 have "1/ ln n \<le> 1" | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2685 | by (simp add: field_split_simps) | 
| 65719 | 2686 | moreover have "ln (1 + 1 / real n) \<le> 1/n" | 
| 2687 | by (simp add: ln_add_one_self_le_self) | |
| 2688 | ultimately have "ln (1 + 1 / real n) * (1 / ln n) \<le> (1/n) * 1" | |
| 2689 | by (intro mult_mono) (use n in auto) | |
| 2690 | then show "norm (ln (1 + 1 / n) / ln n) \<le> norm ((inverse \<circ> real) n)" | |
| 2691 | by (simp add: field_simps ln0) | |
| 2692 | qed | |
| 2693 | qed | |
| 2694 | then show "(\<lambda>n. 1 + ln(1 + 1/n) / ln n) \<longlonglongrightarrow> 1" | |
| 2695 | by (metis (full_types) add.right_neutral tendsto_add_const_iff) | |
| 2696 | show "\<forall>\<^sub>F k in sequentially. 1 + ln (1 + 1 / k) / ln k = ln(Suc k) / ln k" | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2697 | by (simp add: field_split_simps ln_div eventually_sequentiallyI [of 2]) | 
| 65719 | 2698 | qed | 
| 2699 | ||
| 2700 | lemma lim_ln_over_ln1: "(\<lambda>n. ln n / ln(Suc n)) \<longlonglongrightarrow> 1" | |
| 2701 | proof - | |
| 2702 | have "(\<lambda>n. inverse (ln(Suc n) / ln n)) \<longlonglongrightarrow> inverse 1" | |
| 2703 | by (rule tendsto_inverse [OF lim_ln1_over_ln]) auto | |
| 2704 | then show ?thesis | |
| 2705 | by simp | |
| 2706 | qed | |
| 2707 | ||
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 2708 | |
| 70136 | 2709 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Relation between Square Root and exp/ln, hence its derivative\<close> | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2710 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2711 | lemma csqrt_exp_Ln: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2712 | assumes "z \<noteq> 0" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2713 | shows "csqrt z = exp(Ln(z) / 2)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2714 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2715 | have "(exp (Ln z / 2))\<^sup>2 = (exp (Ln z))" | 
| 64240 | 2716 | by (metis exp_double nonzero_mult_div_cancel_left times_divide_eq_right zero_neq_numeral) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2717 | also have "... = z" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2718 | using assms exp_Ln by blast | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2719 | finally have "csqrt z = csqrt ((exp (Ln z / 2))\<^sup>2)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2720 | by simp | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2721 | also have "... = exp (Ln z / 2)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2722 | apply (subst csqrt_square) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2723 | using cos_gt_zero_pi [of "(Im (Ln z) / 2)"] Im_Ln_le_pi mpi_less_Im_Ln assms | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2724 | apply (auto simp: Re_exp Im_exp zero_less_mult_iff zero_le_mult_iff, fastforce+) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2725 | done | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2726 | finally show ?thesis using assms csqrt_square | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2727 | by simp | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2728 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2729 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2730 | lemma csqrt_inverse: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2731 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2732 | shows "csqrt (inverse z) = inverse (csqrt z)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2733 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2734 | case False | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2735 | then show ?thesis | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2736 | using assms csqrt_exp_Ln Ln_inverse exp_minus | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2737 | by (simp add: csqrt_exp_Ln Ln_inverse exp_minus) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2738 | qed auto | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2739 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2740 | lemma cnj_csqrt: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2741 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2742 | shows "cnj(csqrt z) = csqrt(cnj z)" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2743 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2744 | case False | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2745 | then show ?thesis | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2746 | by (simp add: assms cnj_Ln csqrt_exp_Ln exp_cnj) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2747 | qed auto | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2748 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2749 | lemma has_field_derivative_csqrt: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2750 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2751 | shows "(csqrt has_field_derivative inverse(2 * csqrt z)) (at z)" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2752 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2753 | have z: "z \<noteq> 0" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2754 | using assms by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2755 | then have *: "inverse z = inverse (2*z) * 2" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2756 | by (simp add: field_split_simps) | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2757 | have [simp]: "exp (Ln z / 2) * inverse z = inverse (csqrt z)" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2758 | by (simp add: z field_simps csqrt_exp_Ln [symmetric]) (metis power2_csqrt power2_eq_square) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2759 | have "Im z = 0 \<Longrightarrow> 0 < Re z" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2760 | using assms complex_nonpos_Reals_iff not_less by blast | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2761 | with z have "((\<lambda>z. exp (Ln z / 2)) has_field_derivative inverse (2 * csqrt z)) (at z)" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2762 | by (force intro: derivative_eq_intros * simp add: assms) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2763 | then show ?thesis | 
| 71029 
934e0044e94b
Moved or deleted some out of place material, also eliminating obsolete naming conventions
 paulson <lp15@cam.ac.uk> parents: 
71001diff
changeset | 2764 | proof (rule has_field_derivative_transform_within) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2765 | show "\<And>x. dist x z < cmod z \<Longrightarrow> exp (Ln x / 2) = csqrt x" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2766 | by (metis csqrt_exp_Ln dist_0_norm less_irrefl) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2767 | qed (use z in auto) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2768 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2769 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2770 | lemma field_differentiable_at_csqrt: | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2771 | "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> csqrt field_differentiable at z" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2772 | using field_differentiable_def has_field_derivative_csqrt by blast | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2773 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2774 | lemma field_differentiable_within_csqrt: | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2775 | "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> csqrt field_differentiable (at z within s)" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2776 | using field_differentiable_at_csqrt field_differentiable_within_subset by blast | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2777 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2778 | lemma continuous_at_csqrt: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2779 | "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> continuous (at z) csqrt" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2780 | by (simp add: field_differentiable_within_csqrt field_differentiable_imp_continuous_at) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2781 | |
| 70136 | 2782 | corollary\<^marker>\<open>tag unimportant\<close> isCont_csqrt' [simp]: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2783 | "\<lbrakk>isCont f z; f z \<notin> \<real>\<^sub>\<le>\<^sub>0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. csqrt (f x)) z" | 
| 59862 | 2784 | by (blast intro: isCont_o2 [OF _ continuous_at_csqrt]) | 
| 2785 | ||
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2786 | lemma continuous_within_csqrt: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2787 | "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> continuous (at z within s) csqrt" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2788 | by (simp add: field_differentiable_imp_continuous_at field_differentiable_within_csqrt) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2789 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2790 | lemma continuous_on_csqrt [continuous_intros]: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2791 | "(\<And>z. z \<in> s \<Longrightarrow> z \<notin> \<real>\<^sub>\<le>\<^sub>0) \<Longrightarrow> continuous_on s csqrt" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2792 | by (simp add: continuous_at_imp_continuous_on continuous_within_csqrt) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2793 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2794 | lemma holomorphic_on_csqrt: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2795 | "(\<And>z. z \<in> s \<Longrightarrow> z \<notin> \<real>\<^sub>\<le>\<^sub>0) \<Longrightarrow> csqrt holomorphic_on s" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2796 | by (simp add: field_differentiable_within_csqrt holomorphic_on_def) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2797 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2798 | lemma continuous_within_closed_nontrivial: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2799 | "closed s \<Longrightarrow> a \<notin> s ==> continuous (at a within s) f" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2800 | using open_Compl | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2801 | by (force simp add: continuous_def eventually_at_topological filterlim_iff open_Collect_neg) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2802 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2803 | lemma continuous_within_csqrt_posreal: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2804 |     "continuous (at z within (\<real> \<inter> {w. 0 \<le> Re(w)})) csqrt"
 | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2805 | proof (cases "z \<in> \<real>\<^sub>\<le>\<^sub>0") | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2806 | case True | 
| 68281 | 2807 | have *: "\<And>e. \<lbrakk>0 < e\<rbrakk> | 
| 2808 |          \<Longrightarrow> \<forall>x'\<in>\<real> \<inter> {w. 0 \<le> Re w}. cmod x' < e^2 \<longrightarrow> cmod (csqrt x') < e"
 | |
| 2809 | by (auto simp: Reals_def real_less_lsqrt) | |
| 2810 | have "Im z = 0" "Re z < 0 \<or> z = 0" | |
| 2811 | using True cnj.code complex_cnj_zero_iff by (auto simp: Complex_eq complex_nonpos_Reals_iff) fastforce | |
| 2812 | with * show ?thesis | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2813 | apply (auto simp: continuous_within_closed_nontrivial [OF closed_Real_halfspace_Re_ge]) | 
| 68281 | 2814 | apply (auto simp: continuous_within_eps_delta) | 
| 2815 | using zero_less_power by blast | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2816 | next | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2817 | case False | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2818 | then show ?thesis by (blast intro: continuous_within_csqrt) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2819 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2820 | |
| 60420 | 2821 | subsection\<open>Complex arctangent\<close> | 
| 2822 | ||
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2823 | text\<open>The branch cut gives standard bounds in the real case.\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2824 | |
| 70136 | 2825 | definition\<^marker>\<open>tag important\<close> Arctan :: "complex \<Rightarrow> complex" where | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2826 | "Arctan \<equiv> \<lambda>z. (\<i>/2) * Ln((1 - \<i>*z) / (1 + \<i>*z))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2827 | |
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2828 | lemma Arctan_def_moebius: "Arctan z = \<i>/2 * Ln (moebius (-\<i>) 1 \<i> 1 z)" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2829 | by (simp add: Arctan_def moebius_def add_ac) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2830 | |
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2831 | lemma Ln_conv_Arctan: | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2832 | assumes "z \<noteq> -1" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2833 | shows "Ln z = -2*\<i> * Arctan (moebius 1 (- 1) (- \<i>) (- \<i>) z)" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2834 | proof - | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2835 | have "Arctan (moebius 1 (- 1) (- \<i>) (- \<i>) z) = | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2836 | \<i>/2 * Ln (moebius (- \<i>) 1 \<i> 1 (moebius 1 (- 1) (- \<i>) (- \<i>) z))" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2837 | by (simp add: Arctan_def_moebius) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2838 | also from assms have "\<i> * z \<noteq> \<i> * (-1)" by (subst mult_left_cancel) simp | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2839 | hence "\<i> * z - -\<i> \<noteq> 0" by (simp add: eq_neg_iff_add_eq_0) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2840 | from moebius_inverse'[OF _ this, of 1 1] | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2841 | have "moebius (- \<i>) 1 \<i> 1 (moebius 1 (- 1) (- \<i>) (- \<i>) z) = z" by simp | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2842 | finally show ?thesis by (simp add: field_simps) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2843 | qed | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2844 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2845 | lemma Arctan_0 [simp]: "Arctan 0 = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2846 | by (simp add: Arctan_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2847 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2848 | lemma Im_complex_div_lemma: "Im((1 - \<i>*z) / (1 + \<i>*z)) = 0 \<longleftrightarrow> Re z = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2849 | by (auto simp: Im_complex_div_eq_0 algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2850 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2851 | lemma Re_complex_div_lemma: "0 < Re((1 - \<i>*z) / (1 + \<i>*z)) \<longleftrightarrow> norm z < 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2852 | by (simp add: Re_complex_div_gt_0 algebra_simps cmod_def power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2853 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2854 | lemma tan_Arctan: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2855 | assumes "z\<^sup>2 \<noteq> -1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2856 | shows [simp]:"tan(Arctan z) = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2857 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2858 | have "1 + \<i>*z \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2859 | by (metis assms complex_i_mult_minus i_squared minus_unique power2_eq_square power2_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2860 | moreover | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2861 | have "1 - \<i>*z \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2862 | by (metis assms complex_i_mult_minus i_squared power2_eq_square power2_minus right_minus_eq) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2863 | ultimately | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2864 | show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2865 | by (simp add: Arctan_def tan_def sin_exp_eq cos_exp_eq exp_minus csqrt_exp_Ln [symmetric] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2866 | divide_simps power2_eq_square [symmetric]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2867 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2868 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2869 | lemma Arctan_tan [simp]: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2870 | assumes "\<bar>Re z\<bar> < pi/2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2871 | shows "Arctan(tan z) = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2872 | proof - | 
| 61945 | 2873 | have ge_pi2: "\<And>n::int. \<bar>of_int (2*n + 1) * pi/2\<bar> \<ge> pi/2" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2874 | by (case_tac n rule: int_cases) (auto simp: abs_mult) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2875 | have "exp (\<i>*z)*exp (\<i>*z) = -1 \<longleftrightarrow> exp (2*\<i>*z) = -1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2876 | by (metis distrib_right exp_add mult_2) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2877 | also have "... \<longleftrightarrow> exp (2*\<i>*z) = exp (\<i>*pi)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2878 | using cis_conv_exp cis_pi by auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2879 | also have "... \<longleftrightarrow> exp (2*\<i>*z - \<i>*pi) = 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2880 | by (metis (no_types) diff_add_cancel diff_minus_eq_add exp_add exp_minus_inverse mult.commute) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2881 | also have "... \<longleftrightarrow> Re(\<i>*2*z - \<i>*pi) = 0 \<and> (\<exists>n::int. Im(\<i>*2*z - \<i>*pi) = of_int (2 * n) * pi)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2882 | by (simp add: exp_eq_1) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2883 | also have "... \<longleftrightarrow> Im z = 0 \<and> (\<exists>n::int. 2 * Re z = of_int (2*n + 1) * pi)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2884 | by (simp add: algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2885 | also have "... \<longleftrightarrow> False" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2886 | using assms ge_pi2 | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2887 | apply (auto simp: algebra_simps) | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61524diff
changeset | 2888 | by (metis abs_mult_pos not_less of_nat_less_0_iff of_nat_numeral) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2889 | finally have *: "exp (\<i>*z)*exp (\<i>*z) + 1 \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2890 | by (auto simp: add.commute minus_unique) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2891 | show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2892 | using assms * | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2893 | apply (simp add: Arctan_def tan_def sin_exp_eq cos_exp_eq exp_minus divide_simps | 
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 2894 | i_times_eq_iff power2_eq_square [symmetric]) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2895 | apply (rule Ln_unique) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2896 | apply (auto simp: divide_simps exp_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2897 | apply (simp add: algebra_simps exp_double [symmetric]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2898 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2899 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2900 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2901 | lemma | 
| 61945 | 2902 | assumes "Re z = 0 \<Longrightarrow> \<bar>Im z\<bar> < 1" | 
| 2903 | shows Re_Arctan_bounds: "\<bar>Re(Arctan z)\<bar> < pi/2" | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2904 | and has_field_derivative_Arctan: "(Arctan has_field_derivative inverse(1 + z\<^sup>2)) (at z)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2905 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2906 | have nz0: "1 + \<i>*z \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2907 | using assms | 
| 68493 | 2908 | by (metis abs_one add_diff_cancel_left' complex_i_mult_minus diff_0 i_squared imaginary_unit.simps | 
| 68281 | 2909 | less_asym neg_equal_iff_equal) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2910 | have "z \<noteq> -\<i>" using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2911 | by auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2912 | then have zz: "1 + z * z \<noteq> 0" | 
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 2913 | by (metis abs_one assms i_squared imaginary_unit.simps less_irrefl minus_unique square_eq_iff) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2914 | have nz1: "1 - \<i>*z \<noteq> 0" | 
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 2915 | using assms by (force simp add: i_times_eq_iff) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2916 | have nz2: "inverse (1 + \<i>*z) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2917 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2918 | by (metis Im_complex_div_lemma Re_complex_div_lemma cmod_eq_Im divide_complex_def | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2919 | less_irrefl mult_zero_right zero_complex.simps(1) zero_complex.simps(2)) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2920 | have nzi: "((1 - \<i>*z) * inverse (1 + \<i>*z)) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2921 | using nz1 nz2 by auto | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2922 | have "Im ((1 - \<i>*z) / (1 + \<i>*z)) = 0 \<Longrightarrow> 0 < Re ((1 - \<i>*z) / (1 + \<i>*z))" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2923 | apply (simp add: divide_complex_def) | 
| 62390 | 2924 | apply (simp add: divide_simps split: if_split_asm) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2925 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2926 | apply (auto simp: algebra_simps abs_square_less_1 [unfolded power2_eq_square]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2927 | done | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2928 | then have *: "((1 - \<i>*z) / (1 + \<i>*z)) \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2929 | by (auto simp add: complex_nonpos_Reals_iff) | 
| 61945 | 2930 | show "\<bar>Re(Arctan z)\<bar> < pi/2" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2931 | unfolding Arctan_def divide_complex_def | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2932 | using mpi_less_Im_Ln [OF nzi] | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2933 | apply (auto simp: abs_if intro!: Im_Ln_less_pi * [unfolded divide_complex_def]) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2934 | done | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2935 | show "(Arctan has_field_derivative inverse(1 + z\<^sup>2)) (at z)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2936 | unfolding Arctan_def scaleR_conv_of_real | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2937 | apply (intro derivative_eq_intros | simp add: nz0 *)+ | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2938 | using nz0 nz1 zz | 
| 71633 | 2939 | apply (simp add: field_split_simps power2_eq_square) | 
| 68281 | 2940 | apply algebra | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2941 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2942 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2943 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2944 | lemma field_differentiable_at_Arctan: "(Re z = 0 \<Longrightarrow> \<bar>Im z\<bar> < 1) \<Longrightarrow> Arctan field_differentiable at z" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2945 | using has_field_derivative_Arctan | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2946 | by (auto simp: field_differentiable_def) | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2947 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2948 | lemma field_differentiable_within_Arctan: | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2949 | "(Re z = 0 \<Longrightarrow> \<bar>Im z\<bar> < 1) \<Longrightarrow> Arctan field_differentiable (at z within s)" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2950 | using field_differentiable_at_Arctan field_differentiable_at_within by blast | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2951 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2952 | declare has_field_derivative_Arctan [derivative_intros] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2953 | declare has_field_derivative_Arctan [THEN DERIV_chain2, derivative_intros] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2954 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2955 | lemma continuous_at_Arctan: | 
| 61945 | 2956 | "(Re z = 0 \<Longrightarrow> \<bar>Im z\<bar> < 1) \<Longrightarrow> continuous (at z) Arctan" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2957 | by (simp add: field_differentiable_imp_continuous_at field_differentiable_within_Arctan) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2958 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2959 | lemma continuous_within_Arctan: | 
| 61945 | 2960 | "(Re z = 0 \<Longrightarrow> \<bar>Im z\<bar> < 1) \<Longrightarrow> continuous (at z within s) Arctan" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2961 | using continuous_at_Arctan continuous_at_imp_continuous_within by blast | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2962 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2963 | lemma continuous_on_Arctan [continuous_intros]: | 
| 61945 | 2964 | "(\<And>z. z \<in> s \<Longrightarrow> Re z = 0 \<Longrightarrow> \<bar>Im z\<bar> < 1) \<Longrightarrow> continuous_on s Arctan" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2965 | by (auto simp: continuous_at_imp_continuous_on continuous_within_Arctan) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2966 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2967 | lemma holomorphic_on_Arctan: | 
| 61945 | 2968 | "(\<And>z. z \<in> s \<Longrightarrow> Re z = 0 \<Longrightarrow> \<bar>Im z\<bar> < 1) \<Longrightarrow> Arctan holomorphic_on s" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2969 | by (simp add: field_differentiable_within_Arctan holomorphic_on_def) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2970 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 2971 | theorem Arctan_series: | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2972 | assumes z: "norm (z :: complex) < 1" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2973 | defines "g \<equiv> \<lambda>n. if odd n then -\<i>*\<i>^n / n else 0" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2974 | defines "h \<equiv> \<lambda>z n. (-1)^n / of_nat (2*n+1) * (z::complex)^(2*n+1)" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2975 | shows "(\<lambda>n. g n * z^n) sums Arctan z" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2976 | and "h z sums Arctan z" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2977 | proof - | 
| 63040 | 2978 | define G where [abs_def]: "G z = (\<Sum>n. g n * z^n)" for z | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2979 | have summable: "summable (\<lambda>n. g n * u^n)" if "norm u < 1" for u | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2980 | proof (cases "u = 0") | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2981 | assume u: "u \<noteq> 0" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2982 | have "(\<lambda>n. ereal (norm (h u n) / norm (h u (Suc n)))) = (\<lambda>n. ereal (inverse (norm u)^2) * | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2983 | ereal ((2 + inverse (real (Suc n))) / (2 - inverse (real (Suc n)))))" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2984 | proof | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2985 | fix n | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2986 | have "ereal (norm (h u n) / norm (h u (Suc n))) = | 
| 68281 | 2987 | ereal (inverse (norm u)^2) * ereal (((2*Suc n+1) / (Suc n)) / | 
| 2988 | ((2*Suc n-1) / (Suc n)))" | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2989 | by (simp add: h_def norm_mult norm_power norm_divide field_split_simps | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2990 | power2_eq_square eval_nat_numeral del: of_nat_add of_nat_Suc) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2991 | also have "of_nat (2*Suc n+1) / of_nat (Suc n) = (2::real) + inverse (real (Suc n))" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2992 | by (auto simp: field_split_simps simp del: of_nat_Suc) simp_all? | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2993 | also have "of_nat (2*Suc n-1) / of_nat (Suc n) = (2::real) - inverse (real (Suc n))" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2994 | by (auto simp: field_split_simps simp del: of_nat_Suc) simp_all? | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2995 | finally show "ereal (norm (h u n) / norm (h u (Suc n))) = ereal (inverse (norm u)^2) * | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2996 | ereal ((2 + inverse (real (Suc n))) / (2 - inverse (real (Suc n))))" . | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2997 | qed | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2998 | also have "\<dots> \<longlonglongrightarrow> ereal (inverse (norm u)^2) * ereal ((2 + 0) / (2 - 0))" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2999 | by (intro tendsto_intros LIMSEQ_inverse_real_of_nat) simp_all | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3000 | finally have "liminf (\<lambda>n. ereal (cmod (h u n) / cmod (h u (Suc n)))) = inverse (norm u)^2" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3001 | by (intro lim_imp_Liminf) simp_all | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3002 | moreover from power_strict_mono[OF that, of 2] u have "inverse (norm u)^2 > 1" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 3003 | by (simp add: field_split_simps) | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3004 | ultimately have A: "liminf (\<lambda>n. ereal (cmod (h u n) / cmod (h u (Suc n)))) > 1" by simp | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3005 | from u have "summable (h u)" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3006 | by (intro summable_norm_cancel[OF ratio_test_convergence[OF _ A]]) | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3007 | (auto simp: h_def norm_divide norm_mult norm_power simp del: of_nat_Suc | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3008 | intro!: mult_pos_pos divide_pos_pos always_eventually) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3009 | thus "summable (\<lambda>n. g n * u^n)" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3010 | by (subst summable_mono_reindex[of "\<lambda>n. 2*n+1", symmetric]) | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66252diff
changeset | 3011 | (auto simp: power_mult strict_mono_def g_def h_def elim!: oddE) | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3012 | qed (simp add: h_def) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3013 | |
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3014 | have "\<exists>c. \<forall>u\<in>ball 0 1. Arctan u - G u = c" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3015 | proof (rule has_field_derivative_zero_constant) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3016 | fix u :: complex assume "u \<in> ball 0 1" | 
| 71633 | 3017 | hence u: "norm u < 1" by (simp) | 
| 63040 | 3018 | define K where "K = (norm u + 1) / 2" | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3019 | from u and abs_Im_le_cmod[of u] have Im_u: "\<bar>Im u\<bar> < 1" by linarith | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3020 | from u have K: "0 \<le> K" "norm u < K" "K < 1" by (simp_all add: K_def) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3021 | hence "(G has_field_derivative (\<Sum>n. diffs g n * u ^ n)) (at u)" unfolding G_def | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3022 | by (intro termdiffs_strong[of _ "of_real K"] summable) simp_all | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3023 | also have "(\<lambda>n. diffs g n * u^n) = (\<lambda>n. if even n then (\<i>*u)^n else 0)" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3024 | by (intro ext) (simp_all del: of_nat_Suc add: g_def diffs_def power_mult_distrib) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3025 | also have "suminf \<dots> = (\<Sum>n. (-(u^2))^n)" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3026 | by (subst suminf_mono_reindex[of "\<lambda>n. 2*n", symmetric]) | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66252diff
changeset | 3027 | (auto elim!: evenE simp: strict_mono_def power_mult power_mult_distrib) | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3028 | also from u have "norm u^2 < 1^2" by (intro power_strict_mono) simp_all | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3029 | hence "(\<Sum>n. (-(u^2))^n) = inverse (1 + u^2)" | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3030 | by (subst suminf_geometric) (simp_all add: norm_power inverse_eq_divide) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3031 | finally have "(G has_field_derivative inverse (1 + u\<^sup>2)) (at u)" . | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3032 | from DERIV_diff[OF has_field_derivative_Arctan this] Im_u u | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3033 | show "((\<lambda>u. Arctan u - G u) has_field_derivative 0) (at u within ball 0 1)" | 
| 68281 | 3034 | by (simp_all add: at_within_open[OF _ open_ball]) | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3035 | qed simp_all | 
| 68281 | 3036 | then obtain c where c: "\<And>u. norm u < 1 \<Longrightarrow> Arctan u - G u = c" by auto | 
| 3037 | from this[of 0] have "c = 0" by (simp add: G_def g_def) | |
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3038 | with c z have "Arctan z = G z" by simp | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3039 | with summable[OF z] show "(\<lambda>n. g n * z^n) sums Arctan z" unfolding G_def by (simp add: sums_iff) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3040 | thus "h z sums Arctan z" by (subst (asm) sums_mono_reindex[of "\<lambda>n. 2*n+1", symmetric]) | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66252diff
changeset | 3041 | (auto elim!: oddE simp: strict_mono_def power_mult g_def h_def) | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3042 | qed | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3043 | |
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3044 | text \<open>A quickly-converging series for the logarithm, based on the arctangent.\<close> | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 3045 | theorem ln_series_quadratic: | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3046 | assumes x: "x > (0::real)" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3047 | shows "(\<lambda>n. (2*((x - 1) / (x + 1)) ^ (2*n+1) / of_nat (2*n+1))) sums ln x" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3048 | proof - | 
| 63040 | 3049 | define y :: complex where "y = of_real ((x-1)/(x+1))" | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3050 | from x have x': "complex_of_real x \<noteq> of_real (-1)" by (subst of_real_eq_iff) auto | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3051 | from x have "\<bar>x - 1\<bar> < \<bar>x + 1\<bar>" by linarith | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3052 | hence "norm (complex_of_real (x - 1) / complex_of_real (x + 1)) < 1" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3053 | by (simp add: norm_divide del: of_real_add of_real_diff) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3054 | hence "norm (\<i> * y) < 1" unfolding y_def by (subst norm_mult) simp | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3055 | hence "(\<lambda>n. (-2*\<i>) * ((-1)^n / of_nat (2*n+1) * (\<i>*y)^(2*n+1))) sums ((-2*\<i>) * Arctan (\<i>*y))" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3056 | by (intro Arctan_series sums_mult) simp_all | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3057 | also have "(\<lambda>n. (-2*\<i>) * ((-1)^n / of_nat (2*n+1) * (\<i>*y)^(2*n+1))) = | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3058 | (\<lambda>n. (-2*\<i>) * ((-1)^n * (\<i>*y*(-y\<^sup>2)^n)/of_nat (2*n+1)))" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3059 | by (intro ext) (simp_all add: power_mult power_mult_distrib) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3060 | also have "\<dots> = (\<lambda>n. 2*y* ((-1) * (-y\<^sup>2))^n/of_nat (2*n+1))" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3061 | by (intro ext, subst power_mult_distrib) (simp add: algebra_simps power_mult) | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3062 | also have "\<dots> = (\<lambda>n. 2*y^(2*n+1) / of_nat (2*n+1))" | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3063 | by (subst power_add, subst power_mult) (simp add: mult_ac) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3064 | also have "\<dots> = (\<lambda>n. of_real (2*((x-1)/(x+1))^(2*n+1) / of_nat (2*n+1)))" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3065 | by (intro ext) (simp add: y_def) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3066 | also have "\<i> * y = (of_real x - 1) / (-\<i> * (of_real x + 1))" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3067 | by (subst divide_divide_eq_left [symmetric]) (simp add: y_def) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3068 | also have "\<dots> = moebius 1 (-1) (-\<i>) (-\<i>) (of_real x)" by (simp add: moebius_def algebra_simps) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3069 | also from x' have "-2*\<i>*Arctan \<dots> = Ln (of_real x)" by (intro Ln_conv_Arctan [symmetric]) simp_all | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3070 | also from x have "\<dots> = ln x" by (rule Ln_of_real) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3071 | finally show ?thesis by (subst (asm) sums_of_real_iff) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3072 | qed | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3073 | |
| 70136 | 3074 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Real arctangent\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3075 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3076 | lemma Im_Arctan_of_real [simp]: "Im (Arctan (of_real x)) = 0" | 
| 68281 | 3077 | proof - | 
| 3078 | have ne: "1 + x\<^sup>2 \<noteq> 0" | |
| 3079 | by (metis power_one sum_power2_eq_zero_iff zero_neq_one) | |
| 3080 | have "Re (Ln ((1 - \<i> * x) * inverse (1 + \<i> * x))) = 0" | |
| 3081 | apply (rule norm_exp_imaginary) | |
| 3082 | apply (subst exp_Ln) | |
| 3083 | using ne apply (simp_all add: cmod_def complex_eq_iff) | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 3084 | apply (auto simp: field_split_simps) | 
| 68281 | 3085 | apply algebra | 
| 3086 | done | |
| 3087 | then show ?thesis | |
| 3088 | unfolding Arctan_def divide_complex_def by (simp add: complex_eq_iff) | |
| 3089 | qed | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3090 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3091 | lemma arctan_eq_Re_Arctan: "arctan x = Re (Arctan (of_real x))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3092 | proof (rule arctan_unique) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3093 | show "- (pi / 2) < Re (Arctan (complex_of_real x))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3094 | apply (simp add: Arctan_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3095 | apply (rule Im_Ln_less_pi) | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3096 | apply (auto simp: Im_complex_div_lemma complex_nonpos_Reals_iff) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3097 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3098 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3099 | have *: " (1 - \<i>*x) / (1 + \<i>*x) \<noteq> 0" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 3100 | by (simp add: field_split_simps) ( simp add: complex_eq_iff) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3101 | show "Re (Arctan (complex_of_real x)) < pi / 2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3102 | using mpi_less_Im_Ln [OF *] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3103 | by (simp add: Arctan_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3104 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3105 | have "tan (Re (Arctan (of_real x))) = Re (tan (Arctan (of_real x)))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3106 | apply (auto simp: tan_def Complex.Re_divide Re_sin Re_cos Im_sin Im_cos) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3107 | apply (simp add: field_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3108 | by (simp add: power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3109 | also have "... = x" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3110 | apply (subst tan_Arctan, auto) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3111 | by (metis diff_0_right minus_diff_eq mult_zero_left not_le of_real_1 of_real_eq_iff of_real_minus of_real_power power2_eq_square real_minus_mult_self_le zero_less_one) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3112 | finally show "tan (Re (Arctan (complex_of_real x))) = x" . | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3113 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3114 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3115 | lemma Arctan_of_real: "Arctan (of_real x) = of_real (arctan x)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3116 | unfolding arctan_eq_Re_Arctan divide_complex_def | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3117 | by (simp add: complex_eq_iff) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3118 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3119 | lemma Arctan_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> Arctan z \<in> \<real>" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3120 | by (metis Reals_cases Reals_of_real Arctan_of_real) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3121 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3122 | declare arctan_one [simp] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3123 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3124 | lemma arctan_less_pi4_pos: "x < 1 \<Longrightarrow> arctan x < pi/4" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3125 | by (metis arctan_less_iff arctan_one) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3126 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3127 | lemma arctan_less_pi4_neg: "-1 < x \<Longrightarrow> -(pi/4) < arctan x" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3128 | by (metis arctan_less_iff arctan_minus arctan_one) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3129 | |
| 61945 | 3130 | lemma arctan_less_pi4: "\<bar>x\<bar> < 1 \<Longrightarrow> \<bar>arctan x\<bar> < pi/4" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3131 | by (metis abs_less_iff arctan_less_pi4_pos arctan_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3132 | |
| 61945 | 3133 | lemma arctan_le_pi4: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>arctan x\<bar> \<le> pi/4" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3134 | by (metis abs_le_iff arctan_le_iff arctan_minus arctan_one) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3135 | |
| 61945 | 3136 | lemma abs_arctan: "\<bar>arctan x\<bar> = arctan \<bar>x\<bar>" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3137 | by (simp add: abs_if arctan_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3138 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3139 | lemma arctan_add_raw: | 
| 61945 | 3140 | assumes "\<bar>arctan x + arctan y\<bar> < pi/2" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3141 | shows "arctan x + arctan y = arctan((x + y) / (1 - x * y))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3142 | proof (rule arctan_unique [symmetric]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3143 | show 12: "- (pi / 2) < arctan x + arctan y" "arctan x + arctan y < pi / 2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3144 | using assms by linarith+ | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3145 | show "tan (arctan x + arctan y) = (x + y) / (1 - x * y)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3146 | using cos_gt_zero_pi [OF 12] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3147 | by (simp add: arctan tan_add) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3148 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3149 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3150 | lemma arctan_inverse: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3151 | assumes "0 < x" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3152 | shows "arctan(inverse x) = pi/2 - arctan x" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3153 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3154 | have "arctan(inverse x) = arctan(inverse(tan(arctan x)))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3155 | by (simp add: arctan) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3156 | also have "... = arctan (tan (pi / 2 - arctan x))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3157 | by (simp add: tan_cot) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3158 | also have "... = pi/2 - arctan x" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3159 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3160 | have "0 < pi - arctan x" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3161 | using arctan_ubound [of x] pi_gt_zero by linarith | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3162 | with assms show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3163 | by (simp add: Transcendental.arctan_tan) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3164 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3165 | finally show ?thesis . | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3166 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3167 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3168 | lemma arctan_add_small: | 
| 61945 | 3169 | assumes "\<bar>x * y\<bar> < 1" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3170 | shows "(arctan x + arctan y = arctan((x + y) / (1 - x * y)))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3171 | proof (cases "x = 0 \<or> y = 0") | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3172 | case True then show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3173 | by auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3174 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3175 | case False | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3176 | then have *: "\<bar>arctan x\<bar> < pi / 2 - \<bar>arctan y\<bar>" using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3177 | apply (auto simp add: abs_arctan arctan_inverse [symmetric] arctan_less_iff) | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 3178 | apply (simp add: field_split_simps abs_mult) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3179 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3180 | show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3181 | apply (rule arctan_add_raw) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3182 | using * by linarith | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3183 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3184 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3185 | lemma abs_arctan_le: | 
| 61945 | 3186 | fixes x::real shows "\<bar>arctan x\<bar> \<le> \<bar>x\<bar>" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3187 | proof - | 
| 68281 | 3188 | have 1: "\<And>x. x \<in> \<real> \<Longrightarrow> cmod (inverse (1 + x\<^sup>2)) \<le> 1" | 
| 3189 | by (simp add: norm_divide divide_simps in_Reals_norm complex_is_Real_iff power2_eq_square) | |
| 3190 | have "cmod (Arctan w - Arctan z) \<le> 1 * cmod (w-z)" if "w \<in> \<real>" "z \<in> \<real>" for w z | |
| 3191 | apply (rule field_differentiable_bound [OF convex_Reals, of Arctan _ 1]) | |
| 3192 | apply (rule has_field_derivative_at_within [OF has_field_derivative_Arctan]) | |
| 3193 | using 1 that apply (auto simp: Reals_def) | |
| 3194 | done | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3195 | then have "cmod (Arctan (of_real x) - Arctan 0) \<le> 1 * cmod (of_real x -0)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3196 | using Reals_0 Reals_of_real by blast | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3197 | then show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3198 | by (simp add: Arctan_of_real) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3199 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3200 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3201 | lemma arctan_le_self: "0 \<le> x \<Longrightarrow> arctan x \<le> x" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3202 | by (metis abs_arctan_le abs_of_nonneg zero_le_arctan_iff) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3203 | |
| 61945 | 3204 | lemma abs_tan_ge: "\<bar>x\<bar> < pi/2 \<Longrightarrow> \<bar>x\<bar> \<le> \<bar>tan x\<bar>" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3205 | by (metis abs_arctan_le abs_less_iff arctan_tan minus_less_iff) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3206 | |
| 63556 | 3207 | lemma arctan_bounds: | 
| 3208 | assumes "0 \<le> x" "x < 1" | |
| 3209 | shows arctan_lower_bound: | |
| 3210 | "(\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x" | |
| 3211 | (is "(\<Sum>k<_. (- 1)^ k * ?a k) \<le> _") | |
| 3212 | and arctan_upper_bound: | |
| 3213 | "arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))" | |
| 3214 | proof - | |
| 3215 | have tendsto_zero: "?a \<longlonglongrightarrow> 0" | |
| 68281 | 3216 | proof (rule tendsto_eq_rhs) | 
| 3217 | show "(\<lambda>k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \<longlonglongrightarrow> 0 * 0" | |
| 3218 | using assms | |
| 3219 | by (intro tendsto_mult real_tendsto_divide_at_top) | |
| 63556 | 3220 | (auto simp: filterlim_real_sequentially filterlim_sequentially_iff_filterlim_real | 
| 3221 | intro!: real_tendsto_divide_at_top tendsto_power_zero filterlim_real_sequentially | |
| 68281 | 3222 | tendsto_eq_intros filterlim_at_top_mult_tendsto_pos filterlim_tendsto_add_at_top) | 
| 3223 | qed simp | |
| 63556 | 3224 | have nonneg: "0 \<le> ?a n" for n | 
| 3225 | by (force intro!: divide_nonneg_nonneg mult_nonneg_nonneg zero_le_power assms) | |
| 3226 | have le: "?a (Suc n) \<le> ?a n" for n | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 3227 | by (rule mult_mono[OF _ power_decreasing]) (auto simp: field_split_simps assms less_imp_le) | 
| 63556 | 3228 | from summable_Leibniz'(4)[of ?a, OF tendsto_zero nonneg le, of n] | 
| 3229 | summable_Leibniz'(2)[of ?a, OF tendsto_zero nonneg le, of n] | |
| 3230 | assms | |
| 3231 | show "(\<Sum>k<2*n. (- 1)^ k * ?a k) \<le> arctan x" "arctan x \<le> (\<Sum>k<2 * n + 1. (- 1)^ k * ?a k)" | |
| 3232 | by (auto simp: arctan_series) | |
| 3233 | qed | |
| 3234 | ||
| 70136 | 3235 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Bounds on pi using real arctangent\<close> | 
| 63556 | 3236 | |
| 3237 | lemma pi_machin: "pi = 16 * arctan (1 / 5) - 4 * arctan (1 / 239)" | |
| 68281 | 3238 | using machin by simp | 
| 63556 | 3239 | |
| 3240 | lemma pi_approx: "3.141592653588 \<le> pi" "pi \<le> 3.1415926535899" | |
| 3241 | unfolding pi_machin | |
| 3242 | using arctan_bounds[of "1/5" 4] | |
| 3243 | arctan_bounds[of "1/239" 4] | |
| 3244 | by (simp_all add: eval_nat_numeral) | |
| 68493 | 3245 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 3246 | lemma pi_gt3: "pi > 3" | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 3247 | using pi_approx by simp | 
| 63556 | 3248 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3249 | |
| 60420 | 3250 | subsection\<open>Inverse Sine\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3251 | |
| 70136 | 3252 | definition\<^marker>\<open>tag important\<close> Arcsin :: "complex \<Rightarrow> complex" where | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3253 | "Arcsin \<equiv> \<lambda>z. -\<i> * Ln(\<i> * z + csqrt(1 - z\<^sup>2))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3254 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3255 | lemma Arcsin_body_lemma: "\<i> * z + csqrt(1 - z\<^sup>2) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3256 | using power2_csqrt [of "1 - z\<^sup>2"] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3257 | apply auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3258 | by (metis complex_i_mult_minus diff_add_cancel diff_minus_eq_add diff_self mult.assoc mult.left_commute numeral_One power2_csqrt power2_eq_square zero_neq_numeral) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3259 | |
| 61945 | 3260 | lemma Arcsin_range_lemma: "\<bar>Re z\<bar> < 1 \<Longrightarrow> 0 < Re(\<i> * z + csqrt(1 - z\<^sup>2))" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3261 | using Complex.cmod_power2 [of z, symmetric] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3262 | by (simp add: real_less_rsqrt algebra_simps Re_power2 cmod_square_less_1_plus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3263 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3264 | lemma Re_Arcsin: "Re(Arcsin z) = Im (Ln (\<i> * z + csqrt(1 - z\<^sup>2)))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3265 | by (simp add: Arcsin_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3266 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3267 | lemma Im_Arcsin: "Im(Arcsin z) = - ln (cmod (\<i> * z + csqrt (1 - z\<^sup>2)))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3268 | by (simp add: Arcsin_def Arcsin_body_lemma) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3269 | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3270 | lemma one_minus_z2_notin_nonpos_Reals: | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3271 | assumes "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1)" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3272 | shows "1 - z\<^sup>2 \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 68281 | 3273 | using assms | 
| 3274 | apply (auto simp: complex_nonpos_Reals_iff Re_power2 Im_power2) | |
| 3275 | using power2_less_0 [of "Im z"] apply force | |
| 3276 | using abs_square_less_1 not_le by blast | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3277 | |
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3278 | lemma isCont_Arcsin_lemma: | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3279 | assumes le0: "Re (\<i> * z + csqrt (1 - z\<^sup>2)) \<le> 0" and "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1)" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3280 | shows False | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3281 | proof (cases "Im z = 0") | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3282 | case True | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3283 | then show ?thesis | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3284 | using assms by (fastforce simp: cmod_def abs_square_less_1 [symmetric]) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3285 | next | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3286 | case False | 
| 68281 | 3287 | have leim: "(cmod (1 - z\<^sup>2) + (1 - Re (z\<^sup>2))) / 2 \<le> (Im z)\<^sup>2" | 
| 3288 | using le0 sqrt_le_D by fastforce | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3289 | have neq: "(cmod z)\<^sup>2 \<noteq> 1 + cmod (1 - z\<^sup>2)" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3290 | proof (clarsimp simp add: cmod_def) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3291 | assume "(Re z)\<^sup>2 + (Im z)\<^sup>2 = 1 + sqrt ((1 - Re (z\<^sup>2))\<^sup>2 + (Im (z\<^sup>2))\<^sup>2)" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3292 | then have "((Re z)\<^sup>2 + (Im z)\<^sup>2 - 1)\<^sup>2 = ((1 - Re (z\<^sup>2))\<^sup>2 + (Im (z\<^sup>2))\<^sup>2)" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3293 | by simp | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3294 | then show False using False | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3295 | by (simp add: power2_eq_square algebra_simps) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3296 | qed | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3297 | moreover have 2: "(Im z)\<^sup>2 = (1 + ((Im z)\<^sup>2 + cmod (1 - z\<^sup>2)) - (Re z)\<^sup>2) / 2" | 
| 68281 | 3298 | using leim cmod_power2 [of z] norm_triangle_ineq2 [of "z^2" 1] | 
| 3299 | by (simp add: norm_power Re_power2 norm_minus_commute [of 1]) | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3300 | ultimately show False | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3301 | by (simp add: Re_power2 Im_power2 cmod_power2) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3302 | qed | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3303 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3304 | lemma isCont_Arcsin: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3305 | assumes "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3306 | shows "isCont Arcsin z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3307 | proof - | 
| 68281 | 3308 | have 1: "\<i> * z + csqrt (1 - z\<^sup>2) \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3309 | by (metis isCont_Arcsin_lemma assms complex_nonpos_Reals_iff) | 
| 68281 | 3310 | have 2: "1 - z\<^sup>2 \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 3311 | by (simp add: one_minus_z2_notin_nonpos_Reals assms) | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3312 | show ?thesis | 
| 68281 | 3313 | using assms unfolding Arcsin_def by (intro isCont_Ln' isCont_csqrt' continuous_intros 1 2) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3314 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3315 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3316 | lemma isCont_Arcsin' [simp]: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3317 | shows "isCont f z \<Longrightarrow> (Im (f z) = 0 \<Longrightarrow> \<bar>Re (f z)\<bar> < 1) \<Longrightarrow> isCont (\<lambda>x. Arcsin (f x)) z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3318 | by (blast intro: isCont_o2 [OF _ isCont_Arcsin]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3319 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3320 | lemma sin_Arcsin [simp]: "sin(Arcsin z) = z" | 
| 60141 
833adf7db7d8
New material, mostly about limits. Consolidation.
 paulson <lp15@cam.ac.uk> parents: 
60020diff
changeset | 3321 | proof - | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3322 | have "\<i>*z*2 + csqrt (1 - z\<^sup>2)*2 = 0 \<longleftrightarrow> (\<i>*z)*2 + csqrt (1 - z\<^sup>2)*2 = 0" | 
| 67443 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 wenzelm parents: 
67371diff
changeset | 3323 | by (simp add: algebra_simps) \<comment> \<open>Cancelling a factor of 2\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3324 | moreover have "... \<longleftrightarrow> (\<i>*z) + csqrt (1 - z\<^sup>2) = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3325 | by (metis Arcsin_body_lemma distrib_right no_zero_divisors zero_neq_numeral) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3326 | ultimately show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3327 | apply (simp add: sin_exp_eq Arcsin_def Arcsin_body_lemma exp_minus divide_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3328 | apply (simp add: algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3329 | apply (simp add: power2_eq_square [symmetric] algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3330 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3331 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3332 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3333 | lemma Re_eq_pihalf_lemma: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3334 | "\<bar>Re z\<bar> = pi/2 \<Longrightarrow> Im z = 0 \<Longrightarrow> | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3335 | Re ((exp (\<i>*z) + inverse (exp (\<i>*z))) / 2) = 0 \<and> 0 \<le> Im ((exp (\<i>*z) + inverse (exp (\<i>*z))) / 2)" | 
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 3336 | apply (simp add: cos_i_times [symmetric] Re_cos Im_cos abs_if del: eq_divide_eq_numeral1) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3337 | by (metis cos_minus cos_pi_half) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3338 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3339 | lemma Re_less_pihalf_lemma: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3340 | assumes "\<bar>Re z\<bar> < pi / 2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3341 | shows "0 < Re ((exp (\<i>*z) + inverse (exp (\<i>*z))) / 2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3342 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3343 | have "0 < cos (Re z)" using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3344 | using cos_gt_zero_pi by auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3345 | then show ?thesis | 
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 3346 | by (simp add: cos_i_times [symmetric] Re_cos Im_cos add_pos_pos) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3347 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3348 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3349 | lemma Arcsin_sin: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3350 | assumes "\<bar>Re z\<bar> < pi/2 \<or> (\<bar>Re z\<bar> = pi/2 \<and> Im z = 0)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3351 | shows "Arcsin(sin z) = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3352 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3353 | have "Arcsin(sin z) = - (\<i> * Ln (csqrt (1 - (\<i> * (exp (\<i>*z) - inverse (exp (\<i>*z))))\<^sup>2 / 4) - (inverse (exp (\<i>*z)) - exp (\<i>*z)) / 2))" | 
| 61694 
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
 paulson <lp15@cam.ac.uk> parents: 
61649diff
changeset | 3354 | by (simp add: sin_exp_eq Arcsin_def exp_minus power_divide) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3355 | also have "... = - (\<i> * Ln (csqrt (((exp (\<i>*z) + inverse (exp (\<i>*z)))/2)\<^sup>2) - (inverse (exp (\<i>*z)) - exp (\<i>*z)) / 2))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3356 | by (simp add: field_simps power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3357 | also have "... = - (\<i> * Ln (((exp (\<i>*z) + inverse (exp (\<i>*z)))/2) - (inverse (exp (\<i>*z)) - exp (\<i>*z)) / 2))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3358 | apply (subst csqrt_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3359 | using assms Re_eq_pihalf_lemma Re_less_pihalf_lemma | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3360 | apply auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3361 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3362 | also have "... = - (\<i> * Ln (exp (\<i>*z)))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3363 | by (simp add: field_simps power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3364 | also have "... = z" | 
| 68281 | 3365 | using assms by (auto simp: abs_if simp del: eq_divide_eq_numeral1 split: if_split_asm) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3366 | finally show ?thesis . | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3367 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3368 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3369 | lemma Arcsin_unique: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3370 | "\<lbrakk>sin z = w; \<bar>Re z\<bar> < pi/2 \<or> (\<bar>Re z\<bar> = pi/2 \<and> Im z = 0)\<rbrakk> \<Longrightarrow> Arcsin w = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3371 | by (metis Arcsin_sin) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3372 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3373 | lemma Arcsin_0 [simp]: "Arcsin 0 = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3374 | by (metis Arcsin_sin norm_zero pi_half_gt_zero real_norm_def sin_zero zero_complex.simps(1)) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3375 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3376 | lemma Arcsin_1 [simp]: "Arcsin 1 = pi/2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3377 | by (metis Arcsin_sin Im_complex_of_real Re_complex_of_real numeral_One of_real_numeral pi_half_ge_zero real_sqrt_abs real_sqrt_pow2 real_sqrt_power sin_of_real sin_pi_half) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3378 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3379 | lemma Arcsin_minus_1 [simp]: "Arcsin(-1) = - (pi/2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3380 | by (metis Arcsin_1 Arcsin_sin Im_complex_of_real Re_complex_of_real abs_of_nonneg of_real_minus pi_half_ge_zero power2_minus real_sqrt_abs sin_Arcsin sin_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3381 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3382 | lemma has_field_derivative_Arcsin: | 
| 68281 | 3383 | assumes "Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3384 | shows "(Arcsin has_field_derivative inverse(cos(Arcsin z))) (at z)" | 
| 68493 | 3385 | proof - | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3386 | have "(sin (Arcsin z))\<^sup>2 \<noteq> 1" | 
| 68281 | 3387 | using assms one_minus_z2_notin_nonpos_Reals by force | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3388 | then have "cos (Arcsin z) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3389 | by (metis diff_0_right power_zero_numeral sin_squared_eq) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3390 | then show ?thesis | 
| 68281 | 3391 | by (rule has_field_derivative_inverse_basic [OF DERIV_sin _ _ open_ball [of z 1]]) (auto intro: isCont_Arcsin assms) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3392 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3393 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3394 | declare has_field_derivative_Arcsin [derivative_intros] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3395 | declare has_field_derivative_Arcsin [THEN DERIV_chain2, derivative_intros] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3396 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3397 | lemma field_differentiable_at_Arcsin: | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3398 | "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> Arcsin field_differentiable at z" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3399 | using field_differentiable_def has_field_derivative_Arcsin by blast | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3400 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3401 | lemma field_differentiable_within_Arcsin: | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3402 | "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> Arcsin field_differentiable (at z within s)" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3403 | using field_differentiable_at_Arcsin field_differentiable_within_subset by blast | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3404 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3405 | lemma continuous_within_Arcsin: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3406 | "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> continuous (at z within s) Arcsin" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3407 | using continuous_at_imp_continuous_within isCont_Arcsin by blast | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3408 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3409 | lemma continuous_on_Arcsin [continuous_intros]: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3410 | "(\<And>z. z \<in> s \<Longrightarrow> Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> continuous_on s Arcsin" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3411 | by (simp add: continuous_at_imp_continuous_on) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3412 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3413 | lemma holomorphic_on_Arcsin: "(\<And>z. z \<in> s \<Longrightarrow> Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> Arcsin holomorphic_on s" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3414 | by (simp add: field_differentiable_within_Arcsin holomorphic_on_def) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3415 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3416 | |
| 60420 | 3417 | subsection\<open>Inverse Cosine\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3418 | |
| 70136 | 3419 | definition\<^marker>\<open>tag important\<close> Arccos :: "complex \<Rightarrow> complex" where | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3420 | "Arccos \<equiv> \<lambda>z. -\<i> * Ln(z + \<i> * csqrt(1 - z\<^sup>2))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3421 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3422 | lemma Arccos_range_lemma: "\<bar>Re z\<bar> < 1 \<Longrightarrow> 0 < Im(z + \<i> * csqrt(1 - z\<^sup>2))" | 
| 68281 | 3423 | using Arcsin_range_lemma [of "-z"] by simp | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3424 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3425 | lemma Arccos_body_lemma: "z + \<i> * csqrt(1 - z\<^sup>2) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3426 | using Arcsin_body_lemma [of z] | 
| 68281 | 3427 | by (metis Arcsin_body_lemma complex_i_mult_minus diff_minus_eq_add power2_minus right_minus_eq) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3428 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3429 | lemma Re_Arccos: "Re(Arccos z) = Im (Ln (z + \<i> * csqrt(1 - z\<^sup>2)))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3430 | by (simp add: Arccos_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3431 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3432 | lemma Im_Arccos: "Im(Arccos z) = - ln (cmod (z + \<i> * csqrt (1 - z\<^sup>2)))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3433 | by (simp add: Arccos_def Arccos_body_lemma) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3434 | |
| 60420 | 3435 | text\<open>A very tricky argument to find!\<close> | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3436 | lemma isCont_Arccos_lemma: | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3437 | assumes eq0: "Im (z + \<i> * csqrt (1 - z\<^sup>2)) = 0" and "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1)" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3438 | shows False | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3439 | proof (cases "Im z = 0") | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3440 | case True | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3441 | then show ?thesis | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3442 | using assms by (fastforce simp add: cmod_def abs_square_less_1 [symmetric]) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3443 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3444 | case False | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3445 | have Imz: "Im z = - sqrt ((1 + ((Im z)\<^sup>2 + cmod (1 - z\<^sup>2)) - (Re z)\<^sup>2) / 2)" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3446 | using eq0 abs_Re_le_cmod [of "1-z\<^sup>2"] | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3447 | by (simp add: Re_power2 algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3448 | have "(cmod z)\<^sup>2 - 1 \<noteq> cmod (1 - z\<^sup>2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3449 | proof (clarsimp simp add: cmod_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3450 | assume "(Re z)\<^sup>2 + (Im z)\<^sup>2 - 1 = sqrt ((1 - Re (z\<^sup>2))\<^sup>2 + (Im (z\<^sup>2))\<^sup>2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3451 | then have "((Re z)\<^sup>2 + (Im z)\<^sup>2 - 1)\<^sup>2 = ((1 - Re (z\<^sup>2))\<^sup>2 + (Im (z\<^sup>2))\<^sup>2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3452 | by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3453 | then show False using False | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3454 | by (simp add: power2_eq_square algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3455 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3456 | moreover have "(Im z)\<^sup>2 = ((1 + ((Im z)\<^sup>2 + cmod (1 - z\<^sup>2)) - (Re z)\<^sup>2) / 2)" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3457 | apply (subst Imz) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3458 | using abs_Re_le_cmod [of "1-z\<^sup>2"] | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3459 | apply (simp add: Re_power2) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3460 | done | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3461 | ultimately show False | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3462 | by (simp add: cmod_power2) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3463 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3464 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3465 | lemma isCont_Arccos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3466 | assumes "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3467 | shows "isCont Arccos z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3468 | proof - | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3469 | have "z + \<i> * csqrt (1 - z\<^sup>2) \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3470 | by (metis complex_nonpos_Reals_iff isCont_Arccos_lemma assms) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3471 | with assms show ?thesis | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3472 | apply (simp add: Arccos_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3473 | apply (rule isCont_Ln' isCont_csqrt' continuous_intros)+ | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3474 | apply (simp_all add: one_minus_z2_notin_nonpos_Reals assms) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3475 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3476 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3477 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3478 | lemma isCont_Arccos' [simp]: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3479 | shows "isCont f z \<Longrightarrow> (Im (f z) = 0 \<Longrightarrow> \<bar>Re (f z)\<bar> < 1) \<Longrightarrow> isCont (\<lambda>x. Arccos (f x)) z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3480 | by (blast intro: isCont_o2 [OF _ isCont_Arccos]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3481 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3482 | lemma cos_Arccos [simp]: "cos(Arccos z) = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3483 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3484 | have "z*2 + \<i> * (2 * csqrt (1 - z\<^sup>2)) = 0 \<longleftrightarrow> z*2 + \<i> * csqrt (1 - z\<^sup>2)*2 = 0" | 
| 67443 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 wenzelm parents: 
67371diff
changeset | 3485 | by (simp add: algebra_simps) \<comment> \<open>Cancelling a factor of 2\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3486 | moreover have "... \<longleftrightarrow> z + \<i> * csqrt (1 - z\<^sup>2) = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3487 | by (metis distrib_right mult_eq_0_iff zero_neq_numeral) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3488 | ultimately show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3489 | apply (simp add: cos_exp_eq Arccos_def Arccos_body_lemma exp_minus field_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3490 | apply (simp add: power2_eq_square [symmetric]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3491 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3492 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3493 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3494 | lemma Arccos_cos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3495 | assumes "0 < Re z & Re z < pi \<or> | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3496 | Re z = 0 & 0 \<le> Im z \<or> | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3497 | Re z = pi & Im z \<le> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3498 | shows "Arccos(cos z) = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3499 | proof - | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3500 | have *: "((\<i> - (exp (\<i> * z))\<^sup>2 * \<i>) / (2 * exp (\<i> * z))) = sin z" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3501 | by (simp add: sin_exp_eq exp_minus field_simps power2_eq_square) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3502 | have "1 - (exp (\<i> * z) + inverse (exp (\<i> * z)))\<^sup>2 / 4 = ((\<i> - (exp (\<i> * z))\<^sup>2 * \<i>) / (2 * exp (\<i> * z)))\<^sup>2" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3503 | by (simp add: field_simps power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3504 | then have "Arccos(cos z) = - (\<i> * Ln ((exp (\<i> * z) + inverse (exp (\<i> * z))) / 2 + | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3505 | \<i> * csqrt (((\<i> - (exp (\<i> * z))\<^sup>2 * \<i>) / (2 * exp (\<i> * z)))\<^sup>2)))" | 
| 61694 
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
 paulson <lp15@cam.ac.uk> parents: 
61649diff
changeset | 3506 | by (simp add: cos_exp_eq Arccos_def exp_minus power_divide) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3507 | also have "... = - (\<i> * Ln ((exp (\<i> * z) + inverse (exp (\<i> * z))) / 2 + | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3508 | \<i> * ((\<i> - (exp (\<i> * z))\<^sup>2 * \<i>) / (2 * exp (\<i> * z)))))" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3509 | apply (subst csqrt_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3510 | using assms Re_sin_pos [of z] Im_sin_nonneg [of z] Im_sin_nonneg2 [of z] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3511 | apply (auto simp: * Re_sin Im_sin) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3512 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3513 | also have "... = - (\<i> * Ln (exp (\<i>*z)))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3514 | by (simp add: field_simps power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3515 | also have "... = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3516 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3517 | apply (subst Complex_Transcendental.Ln_exp, auto) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3518 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3519 | finally show ?thesis . | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3520 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3521 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3522 | lemma Arccos_unique: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3523 | "\<lbrakk>cos z = w; | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3524 | 0 < Re z \<and> Re z < pi \<or> | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3525 | Re z = 0 \<and> 0 \<le> Im z \<or> | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3526 | Re z = pi \<and> Im z \<le> 0\<rbrakk> \<Longrightarrow> Arccos w = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3527 | using Arccos_cos by blast | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3528 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3529 | lemma Arccos_0 [simp]: "Arccos 0 = pi/2" | 
| 68281 | 3530 | by (rule Arccos_unique) auto | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3531 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3532 | lemma Arccos_1 [simp]: "Arccos 1 = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3533 | by (rule Arccos_unique) auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3534 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3535 | lemma Arccos_minus1: "Arccos(-1) = pi" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3536 | by (rule Arccos_unique) auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3537 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3538 | lemma has_field_derivative_Arccos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3539 | assumes "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3540 | shows "(Arccos has_field_derivative - inverse(sin(Arccos z))) (at z)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3541 | proof - | 
| 68281 | 3542 | have "x\<^sup>2 \<noteq> -1" for x::real | 
| 3543 | by (sos "((R<1 + (([~1] * A=0) + (R<1 * (R<1 * [x__]^2)))))") | |
| 3544 | with assms have "(cos (Arccos z))\<^sup>2 \<noteq> 1" | |
| 3545 | by (auto simp: complex_eq_iff Re_power2 Im_power2 abs_square_eq_1) | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3546 | then have "- sin (Arccos z) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3547 | by (metis cos_squared_eq diff_0_right mult_zero_left neg_0_equal_iff_equal power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3548 | then have "(Arccos has_field_derivative inverse(- sin(Arccos z))) (at z)" | 
| 68281 | 3549 | by (rule has_field_derivative_inverse_basic [OF DERIV_cos _ _ open_ball [of z 1]]) | 
| 3550 | (auto intro: isCont_Arccos assms) | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3551 | then show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3552 | by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3553 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3554 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3555 | declare has_field_derivative_Arcsin [derivative_intros] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3556 | declare has_field_derivative_Arcsin [THEN DERIV_chain2, derivative_intros] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3557 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3558 | lemma field_differentiable_at_Arccos: | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3559 | "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> Arccos field_differentiable at z" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3560 | using field_differentiable_def has_field_derivative_Arccos by blast | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3561 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3562 | lemma field_differentiable_within_Arccos: | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3563 | "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> Arccos field_differentiable (at z within s)" | 
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3564 | using field_differentiable_at_Arccos field_differentiable_within_subset by blast | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3565 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3566 | lemma continuous_within_Arccos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3567 | "(Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> continuous (at z within s) Arccos" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3568 | using continuous_at_imp_continuous_within isCont_Arccos by blast | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3569 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3570 | lemma continuous_on_Arccos [continuous_intros]: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3571 | "(\<And>z. z \<in> s \<Longrightarrow> Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> continuous_on s Arccos" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3572 | by (simp add: continuous_at_imp_continuous_on) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3573 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3574 | lemma holomorphic_on_Arccos: "(\<And>z. z \<in> s \<Longrightarrow> Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1) \<Longrightarrow> Arccos holomorphic_on s" | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3575 | by (simp add: field_differentiable_within_Arccos holomorphic_on_def) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3576 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3577 | |
| 70136 | 3578 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Upper and Lower Bounds for Inverse Sine and Cosine\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3579 | |
| 61945 | 3580 | lemma Arcsin_bounds: "\<bar>Re z\<bar> < 1 \<Longrightarrow> \<bar>Re(Arcsin z)\<bar> < pi/2" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3581 | unfolding Re_Arcsin | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3582 | by (blast intro: Re_Ln_pos_lt_imp Arcsin_range_lemma) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3583 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3584 | lemma Arccos_bounds: "\<bar>Re z\<bar> < 1 \<Longrightarrow> 0 < Re(Arccos z) \<and> Re(Arccos z) < pi" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3585 | unfolding Re_Arccos | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3586 | by (blast intro!: Im_Ln_pos_lt_imp Arccos_range_lemma) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3587 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3588 | lemma Re_Arccos_bounds: "-pi < Re(Arccos z) \<and> Re(Arccos z) \<le> pi" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3589 | unfolding Re_Arccos | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3590 | by (blast intro!: mpi_less_Im_Ln Im_Ln_le_pi Arccos_body_lemma) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3591 | |
| 61945 | 3592 | lemma Re_Arccos_bound: "\<bar>Re(Arccos z)\<bar> \<le> pi" | 
| 61649 
268d88ec9087
Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
 paulson <lp15@cam.ac.uk> parents: 
61610diff
changeset | 3593 | by (meson Re_Arccos_bounds abs_le_iff less_eq_real_def minus_less_iff) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3594 | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3595 | lemma Im_Arccos_bound: "\<bar>Im (Arccos w)\<bar> \<le> cmod w" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3596 | proof - | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3597 | have "(Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3598 | using norm_cos_squared [of "Arccos w"] real_le_abs_sinh [of "Im (Arccos w)"] | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3599 | apply (simp only: abs_le_square_iff) | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 3600 | apply (simp add: field_split_simps) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3601 | done | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3602 | also have "... \<le> (cmod w)\<^sup>2" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3603 | by (auto simp: cmod_power2) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3604 | finally show ?thesis | 
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 3605 | using abs_le_square_iff by force | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3606 | qed | 
| 65064 
a4abec71279a
Renamed ii to imaginary_unit in order to free up ii as a variable name.  Also replaced some legacy def commands
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 3607 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3608 | lemma Re_Arcsin_bounds: "-pi < Re(Arcsin z) & Re(Arcsin z) \<le> pi" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3609 | unfolding Re_Arcsin | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3610 | by (blast intro!: mpi_less_Im_Ln Im_Ln_le_pi Arcsin_body_lemma) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3611 | |
| 61945 | 3612 | lemma Re_Arcsin_bound: "\<bar>Re(Arcsin z)\<bar> \<le> pi" | 
| 61649 
268d88ec9087
Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
 paulson <lp15@cam.ac.uk> parents: 
61610diff
changeset | 3613 | by (meson Re_Arcsin_bounds abs_le_iff less_eq_real_def minus_less_iff) | 
| 61762 
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
 paulson <lp15@cam.ac.uk> parents: 
61711diff
changeset | 3614 | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3615 | lemma norm_Arccos_bounded: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3616 | fixes w :: complex | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3617 | shows "norm (Arccos w) \<le> pi + norm w" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3618 | proof - | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3619 | have Re: "(Re (Arccos w))\<^sup>2 \<le> pi\<^sup>2" "(Im (Arccos w))\<^sup>2 \<le> (cmod w)\<^sup>2" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3620 | using Re_Arccos_bound [of w] Im_Arccos_bound [of w] abs_le_square_iff by force+ | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3621 | have "Arccos w \<bullet> Arccos w \<le> pi\<^sup>2 + (cmod w)\<^sup>2" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3622 | using Re by (simp add: dot_square_norm cmod_power2 [of "Arccos w"]) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3623 | then have "cmod (Arccos w) \<le> pi + cmod (cos (Arccos w))" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3624 | apply (simp add: norm_le_square) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3625 | by (metis dot_square_norm norm_ge_zero norm_le_square pi_ge_zero triangle_lemma) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3626 | then show "cmod (Arccos w) \<le> pi + cmod w" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3627 | by auto | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3628 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3629 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3630 | |
| 70136 | 3631 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Interrelations between Arcsin and Arccos\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3632 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3633 | lemma cos_Arcsin_nonzero: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3634 | assumes "z\<^sup>2 \<noteq> 1" shows "cos(Arcsin z) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3635 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3636 | have eq: "(\<i> * z * (csqrt (1 - z\<^sup>2)))\<^sup>2 = z\<^sup>2 * (z\<^sup>2 - 1)" | 
| 71633 | 3637 | by (simp add: algebra_simps) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3638 | have "\<i> * z * (csqrt (1 - z\<^sup>2)) \<noteq> z\<^sup>2 - 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3639 | proof | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3640 | assume "\<i> * z * (csqrt (1 - z\<^sup>2)) = z\<^sup>2 - 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3641 | then have "(\<i> * z * (csqrt (1 - z\<^sup>2)))\<^sup>2 = (z\<^sup>2 - 1)\<^sup>2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3642 | by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3643 | then have "z\<^sup>2 * (z\<^sup>2 - 1) = (z\<^sup>2 - 1)*(z\<^sup>2 - 1)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3644 | using eq power2_eq_square by auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3645 | then show False | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3646 | using assms by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3647 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3648 | then have "1 + \<i> * z * (csqrt (1 - z * z)) \<noteq> z\<^sup>2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3649 | by (metis add_minus_cancel power2_eq_square uminus_add_conv_diff) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3650 | then have "2*(1 + \<i> * z * (csqrt (1 - z * z))) \<noteq> 2*z\<^sup>2" (*FIXME cancel_numeral_factor*) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3651 | by (metis mult_cancel_left zero_neq_numeral) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3652 | then have "(\<i> * z + csqrt (1 - z\<^sup>2))\<^sup>2 \<noteq> -1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3653 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3654 | apply (auto simp: power2_sum) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3655 | apply (simp add: power2_eq_square algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3656 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3657 | then show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3658 | apply (simp add: cos_exp_eq Arcsin_def exp_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3659 | apply (simp add: divide_simps Arcsin_body_lemma) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3660 | apply (metis add.commute minus_unique power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3661 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3662 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3663 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3664 | lemma sin_Arccos_nonzero: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3665 | assumes "z\<^sup>2 \<noteq> 1" shows "sin(Arccos z) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3666 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3667 | have eq: "(\<i> * z * (csqrt (1 - z\<^sup>2)))\<^sup>2 = -(z\<^sup>2) * (1 - z\<^sup>2)" | 
| 71633 | 3668 | by (simp add: algebra_simps) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3669 | have "\<i> * z * (csqrt (1 - z\<^sup>2)) \<noteq> 1 - z\<^sup>2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3670 | proof | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3671 | assume "\<i> * z * (csqrt (1 - z\<^sup>2)) = 1 - z\<^sup>2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3672 | then have "(\<i> * z * (csqrt (1 - z\<^sup>2)))\<^sup>2 = (1 - z\<^sup>2)\<^sup>2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3673 | by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3674 | then have "-(z\<^sup>2) * (1 - z\<^sup>2) = (1 - z\<^sup>2)*(1 - z\<^sup>2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3675 | using eq power2_eq_square by auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3676 | then have "-(z\<^sup>2) = (1 - z\<^sup>2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3677 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3678 | by (metis add.commute add.right_neutral diff_add_cancel mult_right_cancel) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3679 | then show False | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3680 | using assms by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3681 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3682 | then have "z\<^sup>2 + \<i> * z * (csqrt (1 - z\<^sup>2)) \<noteq> 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3683 | by (simp add: algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3684 | then have "2*(z\<^sup>2 + \<i> * z * (csqrt (1 - z\<^sup>2))) \<noteq> 2*1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3685 | by (metis mult_cancel_left2 zero_neq_numeral) (*FIXME cancel_numeral_factor*) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3686 | then have "(z + \<i> * csqrt (1 - z\<^sup>2))\<^sup>2 \<noteq> 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3687 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3688 | apply (auto simp: Power.comm_semiring_1_class.power2_sum power_mult_distrib) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3689 | apply (simp add: power2_eq_square algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3690 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3691 | then show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3692 | apply (simp add: sin_exp_eq Arccos_def exp_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3693 | apply (simp add: divide_simps Arccos_body_lemma) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3694 | apply (simp add: power2_eq_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3695 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3696 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3697 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3698 | lemma cos_sin_csqrt: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3699 | assumes "0 < cos(Re z) \<or> cos(Re z) = 0 \<and> Im z * sin(Re z) \<le> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3700 | shows "cos z = csqrt(1 - (sin z)\<^sup>2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3701 | apply (rule csqrt_unique [THEN sym]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3702 | apply (simp add: cos_squared_eq) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3703 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3704 | apply (auto simp: Re_cos Im_cos add_pos_pos mult_le_0_iff zero_le_mult_iff) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3705 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3706 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3707 | lemma sin_cos_csqrt: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3708 | assumes "0 < sin(Re z) \<or> sin(Re z) = 0 \<and> 0 \<le> Im z * cos(Re z)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3709 | shows "sin z = csqrt(1 - (cos z)\<^sup>2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3710 | apply (rule csqrt_unique [THEN sym]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3711 | apply (simp add: sin_squared_eq) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3712 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3713 | apply (auto simp: Re_sin Im_sin add_pos_pos mult_le_0_iff zero_le_mult_iff) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3714 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3715 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3716 | lemma Arcsin_Arccos_csqrt_pos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3717 | "(0 < Re z | Re z = 0 & 0 \<le> Im z) \<Longrightarrow> Arcsin z = Arccos(csqrt(1 - z\<^sup>2))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3718 | by (simp add: Arcsin_def Arccos_def Complex.csqrt_square add.commute) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3719 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3720 | lemma Arccos_Arcsin_csqrt_pos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3721 | "(0 < Re z | Re z = 0 & 0 \<le> Im z) \<Longrightarrow> Arccos z = Arcsin(csqrt(1 - z\<^sup>2))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3722 | by (simp add: Arcsin_def Arccos_def Complex.csqrt_square add.commute) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3723 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3724 | lemma sin_Arccos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3725 | "0 < Re z | Re z = 0 & 0 \<le> Im z \<Longrightarrow> sin(Arccos z) = csqrt(1 - z\<^sup>2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3726 | by (simp add: Arccos_Arcsin_csqrt_pos) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3727 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3728 | lemma cos_Arcsin: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3729 | "0 < Re z | Re z = 0 & 0 \<le> Im z \<Longrightarrow> cos(Arcsin z) = csqrt(1 - z\<^sup>2)" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3730 | by (simp add: Arcsin_Arccos_csqrt_pos) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3731 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3732 | |
| 70136 | 3733 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Relationship with Arcsin on the Real Numbers\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3734 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3735 | lemma Im_Arcsin_of_real: | 
| 61945 | 3736 | assumes "\<bar>x\<bar> \<le> 1" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3737 | shows "Im (Arcsin (of_real x)) = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3738 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3739 | have "csqrt (1 - (of_real x)\<^sup>2) = (if x^2 \<le> 1 then sqrt (1 - x^2) else \<i> * sqrt (x^2 - 1))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3740 | by (simp add: of_real_sqrt del: csqrt_of_real_nonneg) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3741 | then have "cmod (\<i> * of_real x + csqrt (1 - (of_real x)\<^sup>2))^2 = 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3742 | using assms abs_square_le_1 | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3743 | by (force simp add: Complex.cmod_power2) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3744 | then have "cmod (\<i> * of_real x + csqrt (1 - (of_real x)\<^sup>2)) = 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3745 | by (simp add: norm_complex_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3746 | then show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3747 | by (simp add: Im_Arcsin exp_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3748 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3749 | |
| 70136 | 3750 | corollary\<^marker>\<open>tag unimportant\<close> Arcsin_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> \<bar>Re z\<bar> \<le> 1 \<Longrightarrow> Arcsin z \<in> \<real>" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3751 | by (metis Im_Arcsin_of_real Re_complex_of_real Reals_cases complex_is_Real_iff) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3752 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3753 | lemma arcsin_eq_Re_Arcsin: | 
| 61945 | 3754 | assumes "\<bar>x\<bar> \<le> 1" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3755 | shows "arcsin x = Re (Arcsin (of_real x))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3756 | unfolding arcsin_def | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3757 | proof (rule the_equality, safe) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3758 | show "- (pi / 2) \<le> Re (Arcsin (complex_of_real x))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3759 | using Re_Ln_pos_le [OF Arcsin_body_lemma, of "of_real x"] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3760 | by (auto simp: Complex.in_Reals_norm Re_Arcsin) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3761 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3762 | show "Re (Arcsin (complex_of_real x)) \<le> pi / 2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3763 | using Re_Ln_pos_le [OF Arcsin_body_lemma, of "of_real x"] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3764 | by (auto simp: Complex.in_Reals_norm Re_Arcsin) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3765 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3766 | show "sin (Re (Arcsin (complex_of_real x))) = x" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3767 | using Re_sin [of "Arcsin (of_real x)"] Arcsin_body_lemma [of "of_real x"] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3768 | by (simp add: Im_Arcsin_of_real assms) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3769 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3770 | fix x' | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3771 | assume "- (pi / 2) \<le> x'" "x' \<le> pi / 2" "x = sin x'" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3772 | then show "x' = Re (Arcsin (complex_of_real (sin x')))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3773 | apply (simp add: sin_of_real [symmetric]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3774 | apply (subst Arcsin_sin) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3775 | apply (auto simp: ) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3776 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3777 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3778 | |
| 61945 | 3779 | lemma of_real_arcsin: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> of_real(arcsin x) = Arcsin(of_real x)" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3780 | by (metis Im_Arcsin_of_real add.right_neutral arcsin_eq_Re_Arcsin complex_eq mult_zero_right of_real_0) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3781 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3782 | |
| 70136 | 3783 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Relationship with Arccos on the Real Numbers\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3784 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3785 | lemma Im_Arccos_of_real: | 
| 61945 | 3786 | assumes "\<bar>x\<bar> \<le> 1" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3787 | shows "Im (Arccos (of_real x)) = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3788 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3789 | have "csqrt (1 - (of_real x)\<^sup>2) = (if x^2 \<le> 1 then sqrt (1 - x^2) else \<i> * sqrt (x^2 - 1))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3790 | by (simp add: of_real_sqrt del: csqrt_of_real_nonneg) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3791 | then have "cmod (of_real x + \<i> * csqrt (1 - (of_real x)\<^sup>2))^2 = 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3792 | using assms abs_square_le_1 | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3793 | by (force simp add: Complex.cmod_power2) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3794 | then have "cmod (of_real x + \<i> * csqrt (1 - (of_real x)\<^sup>2)) = 1" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3795 | by (simp add: norm_complex_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3796 | then show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3797 | by (simp add: Im_Arccos exp_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3798 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3799 | |
| 70136 | 3800 | corollary\<^marker>\<open>tag unimportant\<close> Arccos_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> \<bar>Re z\<bar> \<le> 1 \<Longrightarrow> Arccos z \<in> \<real>" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3801 | by (metis Im_Arccos_of_real Re_complex_of_real Reals_cases complex_is_Real_iff) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3802 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3803 | lemma arccos_eq_Re_Arccos: | 
| 61945 | 3804 | assumes "\<bar>x\<bar> \<le> 1" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3805 | shows "arccos x = Re (Arccos (of_real x))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3806 | unfolding arccos_def | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3807 | proof (rule the_equality, safe) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3808 | show "0 \<le> Re (Arccos (complex_of_real x))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3809 | using Im_Ln_pos_le [OF Arccos_body_lemma, of "of_real x"] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3810 | by (auto simp: Complex.in_Reals_norm Re_Arccos) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3811 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3812 | show "Re (Arccos (complex_of_real x)) \<le> pi" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3813 | using Im_Ln_pos_le [OF Arccos_body_lemma, of "of_real x"] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3814 | by (auto simp: Complex.in_Reals_norm Re_Arccos) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3815 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3816 | show "cos (Re (Arccos (complex_of_real x))) = x" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3817 | using Re_cos [of "Arccos (of_real x)"] Arccos_body_lemma [of "of_real x"] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3818 | by (simp add: Im_Arccos_of_real assms) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3819 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3820 | fix x' | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3821 | assume "0 \<le> x'" "x' \<le> pi" "x = cos x'" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3822 | then show "x' = Re (Arccos (complex_of_real (cos x')))" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3823 | apply (simp add: cos_of_real [symmetric]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3824 | apply (subst Arccos_cos) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3825 | apply (auto simp: ) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3826 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3827 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3828 | |
| 61945 | 3829 | lemma of_real_arccos: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> of_real(arccos x) = Arccos(of_real x)" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3830 | by (metis Im_Arccos_of_real add.right_neutral arccos_eq_Re_Arccos complex_eq mult_zero_right of_real_0) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 3831 | |
| 70136 | 3832 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Some interrelationships among the real inverse trig functions\<close> | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3833 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3834 | lemma arccos_arctan: | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3835 | assumes "-1 < x" "x < 1" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3836 | shows "arccos x = pi/2 - arctan(x / sqrt(1 - x\<^sup>2))" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3837 | proof - | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3838 | have "arctan(x / sqrt(1 - x\<^sup>2)) - (pi/2 - arccos x) = 0" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3839 | proof (rule sin_eq_0_pi) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3840 | show "- pi < arctan (x / sqrt (1 - x\<^sup>2)) - (pi / 2 - arccos x)" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3841 | using arctan_lbound [of "x / sqrt(1 - x\<^sup>2)"] arccos_bounded [of x] assms | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3842 | by (simp add: algebra_simps) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3843 | next | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3844 | show "arctan (x / sqrt (1 - x\<^sup>2)) - (pi / 2 - arccos x) < pi" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3845 | using arctan_ubound [of "x / sqrt(1 - x\<^sup>2)"] arccos_bounded [of x] assms | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3846 | by (simp add: algebra_simps) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3847 | next | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3848 | show "sin (arctan (x / sqrt (1 - x\<^sup>2)) - (pi / 2 - arccos x)) = 0" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3849 | using assms | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3850 | by (simp add: algebra_simps sin_diff cos_add sin_arccos sin_arctan cos_arctan | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3851 | power2_eq_square square_eq_1_iff) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3852 | qed | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3853 | then show ?thesis | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3854 | by simp | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3855 | qed | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3856 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3857 | lemma arcsin_plus_arccos: | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3858 | assumes "-1 \<le> x" "x \<le> 1" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3859 | shows "arcsin x + arccos x = pi/2" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3860 | proof - | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3861 | have "arcsin x = pi/2 - arccos x" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3862 | apply (rule sin_inj_pi) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3863 | using assms arcsin [OF assms] arccos [OF assms] | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3864 | apply (auto simp: algebra_simps sin_diff) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3865 | done | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3866 | then show ?thesis | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3867 | by (simp add: algebra_simps) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3868 | qed | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3869 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3870 | lemma arcsin_arccos_eq: "-1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arcsin x = pi/2 - arccos x" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3871 | using arcsin_plus_arccos by force | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3872 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3873 | lemma arccos_arcsin_eq: "-1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arccos x = pi/2 - arcsin x" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3874 | using arcsin_plus_arccos by force | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3875 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3876 | lemma arcsin_arctan: "-1 < x \<Longrightarrow> x < 1 \<Longrightarrow> arcsin x = arctan(x / sqrt(1 - x\<^sup>2))" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3877 | by (simp add: arccos_arctan arcsin_arccos_eq) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3878 | |
| 60162 | 3879 | lemma csqrt_1_diff_eq: "csqrt (1 - (of_real x)\<^sup>2) = (if x^2 \<le> 1 then sqrt (1 - x^2) else \<i> * sqrt (x^2 - 1))" | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3880 | by ( simp add: of_real_sqrt del: csqrt_of_real_nonneg) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3881 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3882 | lemma arcsin_arccos_sqrt_pos: "0 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arcsin x = arccos(sqrt(1 - x\<^sup>2))" | 
| 61762 
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
 paulson <lp15@cam.ac.uk> parents: 
61711diff
changeset | 3883 | apply (simp add: abs_square_le_1 arcsin_eq_Re_Arcsin arccos_eq_Re_Arccos) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3884 | apply (subst Arcsin_Arccos_csqrt_pos) | 
| 60162 | 3885 | apply (auto simp: power_le_one csqrt_1_diff_eq) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3886 | done | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3887 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3888 | lemma arcsin_arccos_sqrt_neg: "-1 \<le> x \<Longrightarrow> x \<le> 0 \<Longrightarrow> arcsin x = -arccos(sqrt(1 - x\<^sup>2))" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3889 | using arcsin_arccos_sqrt_pos [of "-x"] | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3890 | by (simp add: arcsin_minus) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3891 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3892 | lemma arccos_arcsin_sqrt_pos: "0 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arccos x = arcsin(sqrt(1 - x\<^sup>2))" | 
| 61762 
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
 paulson <lp15@cam.ac.uk> parents: 
61711diff
changeset | 3893 | apply (simp add: abs_square_le_1 arcsin_eq_Re_Arcsin arccos_eq_Re_Arccos) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3894 | apply (subst Arccos_Arcsin_csqrt_pos) | 
| 60162 | 3895 | apply (auto simp: power_le_one csqrt_1_diff_eq) | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3896 | done | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3897 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3898 | lemma arccos_arcsin_sqrt_neg: "-1 \<le> x \<Longrightarrow> x \<le> 0 \<Longrightarrow> arccos x = pi - arcsin(sqrt(1 - x\<^sup>2))" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3899 | using arccos_arcsin_sqrt_pos [of "-x"] | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3900 | by (simp add: arccos_minus) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3901 | |
| 70136 | 3902 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Continuity results for arcsin and arccos\<close> | 
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3903 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3904 | lemma continuous_on_Arcsin_real [continuous_intros]: | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3905 |     "continuous_on {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} Arcsin"
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3906 | proof - | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3907 |   have "continuous_on {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} (\<lambda>x. complex_of_real (arcsin (Re x))) =
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3908 |         continuous_on {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} (\<lambda>x. complex_of_real (Re (Arcsin (of_real (Re x)))))"
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3909 | by (rule continuous_on_cong [OF refl]) (simp add: arcsin_eq_Re_Arcsin) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3910 | also have "... = ?thesis" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3911 | by (rule continuous_on_cong [OF refl]) simp | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3912 | finally show ?thesis | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3913 |     using continuous_on_arcsin [OF continuous_on_Re [OF continuous_on_id], of "{w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}"]
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3914 | continuous_on_of_real | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3915 | by fastforce | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3916 | qed | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3917 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3918 | lemma continuous_within_Arcsin_real: | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3919 |     "continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arcsin"
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3920 | proof (cases "z \<in> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}")
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3921 | case True then show ?thesis | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3922 | using continuous_on_Arcsin_real continuous_on_eq_continuous_within | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3923 | by blast | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3924 | next | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3925 | case False | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3926 | with closed_real_abs_le [of 1] show ?thesis | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3927 | by (rule continuous_within_closed_nontrivial) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3928 | qed | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3929 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3930 | lemma continuous_on_Arccos_real: | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3931 |     "continuous_on {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} Arccos"
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3932 | proof - | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3933 |   have "continuous_on {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} (\<lambda>x. complex_of_real (arccos (Re x))) =
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3934 |         continuous_on {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1} (\<lambda>x. complex_of_real (Re (Arccos (of_real (Re x)))))"
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3935 | by (rule continuous_on_cong [OF refl]) (simp add: arccos_eq_Re_Arccos) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3936 | also have "... = ?thesis" | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3937 | by (rule continuous_on_cong [OF refl]) simp | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3938 | finally show ?thesis | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3939 |     using continuous_on_arccos [OF continuous_on_Re [OF continuous_on_id], of "{w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}"]
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3940 | continuous_on_of_real | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3941 | by fastforce | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3942 | qed | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3943 | |
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3944 | lemma continuous_within_Arccos_real: | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3945 |     "continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos"
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3946 | proof (cases "z \<in> {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}")
 | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3947 | case True then show ?thesis | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3948 | using continuous_on_Arccos_real continuous_on_eq_continuous_within | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3949 | by blast | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3950 | next | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3951 | case False | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3952 | with closed_real_abs_le [of 1] show ?thesis | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3953 | by (rule continuous_within_closed_nontrivial) | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3954 | qed | 
| 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3955 | |
| 67578 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3956 | lemma sinh_ln_complex: "x \<noteq> 0 \<Longrightarrow> sinh (ln x :: complex) = (x - inverse x) / 2" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3957 | by (simp add: sinh_def exp_minus scaleR_conv_of_real exp_of_real) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3958 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3959 | lemma cosh_ln_complex: "x \<noteq> 0 \<Longrightarrow> cosh (ln x :: complex) = (x + inverse x) / 2" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3960 | by (simp add: cosh_def exp_minus scaleR_conv_of_real) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3961 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3962 | lemma tanh_ln_complex: "x \<noteq> 0 \<Longrightarrow> tanh (ln x :: complex) = (x ^ 2 - 1) / (x ^ 2 + 1)" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3963 | by (simp add: tanh_def sinh_ln_complex cosh_ln_complex divide_simps power2_eq_square) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3964 | |
| 60017 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 paulson <lp15@cam.ac.uk> parents: 
59870diff
changeset | 3965 | |
| 60420 | 3966 | subsection\<open>Roots of unity\<close> | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3967 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 3968 | theorem complex_root_unity: | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3969 | fixes j::nat | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3970 | assumes "n \<noteq> 0" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3971 | shows "exp(2 * of_real pi * \<i> * of_nat j / of_nat n)^n = 1" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3972 | proof - | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3973 | have *: "of_nat j * (complex_of_real pi * 2) = complex_of_real (2 * real j * pi)" | 
| 71633 | 3974 | by (simp) | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3975 | then show ?thesis | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3976 | apply (simp add: exp_of_nat_mult [symmetric] mult_ac exp_Euler) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3977 | apply (simp only: * cos_of_real sin_of_real) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3978 | apply (simp add: ) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3979 | done | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3980 | qed | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3981 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3982 | lemma complex_root_unity_eq: | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3983 | fixes j::nat and k::nat | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3984 | assumes "1 \<le> n" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3985 | shows "(exp(2 * of_real pi * \<i> * of_nat j / of_nat n) = exp(2 * of_real pi * \<i> * of_nat k / of_nat n) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3986 | \<longleftrightarrow> j mod n = k mod n)" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3987 | proof - | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3988 | have "(\<exists>z::int. \<i> * (of_nat j * (of_real pi * 2)) = | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3989 | \<i> * (of_nat k * (of_real pi * 2)) + \<i> * (of_int z * (of_nat n * (of_real pi * 2)))) \<longleftrightarrow> | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3990 | (\<exists>z::int. of_nat j * (\<i> * (of_real pi * 2)) = | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3991 | (of_nat k + of_nat n * of_int z) * (\<i> * (of_real pi * 2)))" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3992 | by (simp add: algebra_simps) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3993 | also have "... \<longleftrightarrow> (\<exists>z::int. of_nat j = of_nat k + of_nat n * (of_int z :: complex))" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3994 | by simp | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3995 | also have "... \<longleftrightarrow> (\<exists>z::int. of_nat j = of_nat k + of_nat n * z)" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3996 | apply (rule HOL.iff_exI) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3997 | apply (auto simp: ) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3998 | using of_int_eq_iff apply fastforce | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 3999 | by (metis of_int_add of_int_mult of_int_of_nat_eq) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4000 | also have "... \<longleftrightarrow> int j mod int n = int k mod int n" | 
| 64593 
50c715579715
reoriented congruence rules in non-explosive direction
 haftmann parents: 
64508diff
changeset | 4001 | by (auto simp: mod_eq_dvd_iff dvd_def algebra_simps) | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4002 | also have "... \<longleftrightarrow> j mod n = k mod n" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4003 | by (metis of_nat_eq_iff zmod_int) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4004 | finally have "(\<exists>z. \<i> * (of_nat j * (of_real pi * 2)) = | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4005 | \<i> * (of_nat k * (of_real pi * 2)) + \<i> * (of_int z * (of_nat n * (of_real pi * 2)))) \<longleftrightarrow> j mod n = k mod n" . | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4006 | note * = this | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4007 | show ?thesis | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4008 | using assms | 
| 71633 | 4009 | by (simp add: exp_eq field_split_simps *) | 
| 60020 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4010 | qed | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4011 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4012 | corollary bij_betw_roots_unity: | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4013 | "bij_betw (\<lambda>j. exp(2 * of_real pi * \<i> * of_nat j / of_nat n)) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4014 |               {..<n}  {exp(2 * of_real pi * \<i> * of_nat j / of_nat n) | j. j < n}"
 | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4015 | by (auto simp: bij_betw_def inj_on_def complex_root_unity_eq) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4016 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4017 | lemma complex_root_unity_eq_1: | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4018 | fixes j::nat and k::nat | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4019 | assumes "1 \<le> n" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4020 | shows "exp(2 * of_real pi * \<i> * of_nat j / of_nat n) = 1 \<longleftrightarrow> n dvd j" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4021 | proof - | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4022 | have "1 = exp(2 * of_real pi * \<i> * (of_nat n / of_nat n))" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4023 | using assms by simp | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4024 | then have "exp(2 * of_real pi * \<i> * (of_nat j / of_nat n)) = 1 \<longleftrightarrow> j mod n = n mod n" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4025 | using complex_root_unity_eq [of n j n] assms | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4026 | by simp | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4027 | then show ?thesis | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4028 | by auto | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4029 | qed | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4030 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4031 | lemma finite_complex_roots_unity_explicit: | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4032 |      "finite {exp(2 * of_real pi * \<i> * of_nat j / of_nat n) | j::nat. j < n}"
 | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4033 | by simp | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4034 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4035 | lemma card_complex_roots_unity_explicit: | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4036 |      "card {exp(2 * of_real pi * \<i> * of_nat j / of_nat n) | j::nat. j < n} = n"
 | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4037 | by (simp add: Finite_Set.bij_betw_same_card [OF bij_betw_roots_unity, symmetric]) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4038 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4039 | lemma complex_roots_unity: | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4040 | assumes "1 \<le> n" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4041 |     shows "{z::complex. z^n = 1} = {exp(2 * of_real pi * \<i> * of_nat j / of_nat n) | j::nat. j < n}"
 | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4042 | apply (rule Finite_Set.card_seteq [symmetric]) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4043 | using assms | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4044 | apply (auto simp: card_complex_roots_unity_explicit finite_roots_unity complex_root_unity card_roots_unity) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4045 | done | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4046 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4047 | lemma card_complex_roots_unity: "1 \<le> n \<Longrightarrow> card {z::complex. z^n = 1} = n"
 | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4048 | by (simp add: card_complex_roots_unity_explicit complex_roots_unity) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4049 | |
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4050 | lemma complex_not_root_unity: | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4051 | "1 \<le> n \<Longrightarrow> \<exists>u::complex. norm u = 1 \<and> u^n \<noteq> 1" | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4052 | apply (rule_tac x="exp (of_real pi * \<i> * of_real (1 / n))" in exI) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4053 | apply (auto simp: Re_complex_div_eq_0 exp_of_nat_mult [symmetric] mult_ac exp_Euler) | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4054 | done | 
| 
065ecea354d0
Complex roots of unity. Better definition of ln for complex numbers. Used [code del] to stop code generation for powr.
 paulson <lp15@cam.ac.uk> parents: 
60017diff
changeset | 4055 | |
| 71184 
d62fdaafdafc
renamed Analysis/Winding_Numbers to Winding_Numbers_2; reorganised Analysis/Cauchy_Integral_Theorem by splitting it into Contour_Integration, Winding_Numbers,Cauchy_Integral_Theorem and Cauchy_Integral_Formula.
 Wenda Li <wl302@cam.ac.uk> parents: 
71029diff
changeset | 4056 | |
| 
d62fdaafdafc
renamed Analysis/Winding_Numbers to Winding_Numbers_2; reorganised Analysis/Cauchy_Integral_Theorem by splitting it into Contour_Integration, Winding_Numbers,Cauchy_Integral_Theorem and Cauchy_Integral_Formula.
 Wenda Li <wl302@cam.ac.uk> parents: 
71029diff
changeset | 4057 | |
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 4058 | end |