| author | wenzelm | 
| Sun, 06 Oct 2024 22:56:07 +0200 | |
| changeset 81124 | 6ce0c8d59f5a | 
| parent 80241 | 92a66f1df06e | 
| child 82338 | 1eb12389c499 | 
| 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 *) | 
| 72301 | 13 | definition\<^marker>\<open>tag important\<close> "moebius a b c d \<equiv> (\<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) | 
| 72301 | 36 | then have "0 < y * y" | 
| 37 | using assms mult_neg_neg by force | |
| 38 | with assms have "r * x / \<bar>r\<bar> < sqrt (x*x + y*y)" | |
| 39 | by (simp add: real_less_rsqrt power2_eq_square) | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 40 | then show ?thesis using assms Complex | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 41 | apply (simp add: cmod_def) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 42 | apply (rule power2_less_imp_less, auto) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 43 | 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 | 44 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 45 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 46 | |
| 61945 | 47 | 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 | 48 | 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 | 49 | by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 50 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 51 | lemma cmod_square_less_1_plus: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 52 | 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 | 53 | 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 | 54 | proof (cases "Im z = 0 \<or> Re z = 0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 55 | case True | 
| 68493 | 56 | with assms abs_square_less_1 show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 57 | 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 | 58 | next | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 59 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 60 | 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 | 61 | by (simp add: norm_power Im_power2) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 62 | qed | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 63 | |
| 70136 | 64 | 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 | 65 | |
| 80241 
92a66f1df06e
Simplification of sin, cos, exp of multiples of pi
 paulson <lp15@cam.ac.uk> parents: 
79857diff
changeset | 66 | lemma exp_npi_numeral: "exp (\<i> * pi * Num.numeral n) = (-1) ^ Num.numeral n" | 
| 
92a66f1df06e
Simplification of sin, cos, exp of multiples of pi
 paulson <lp15@cam.ac.uk> parents: 
79857diff
changeset | 67 | by (metis exp_of_nat2_mult exp_pi_i' of_nat_numeral) | 
| 
92a66f1df06e
Simplification of sin, cos, exp of multiples of pi
 paulson <lp15@cam.ac.uk> parents: 
79857diff
changeset | 68 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 69 | 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 | 70 | by simp | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 71 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 72 | 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 | 73 | by simp | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 74 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 75 | 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 | 76 | 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 | 77 | |
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 78 | lemma continuous_within_exp: | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 79 |   fixes z::"'a::{real_normed_field,banach}"
 | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 80 | shows "continuous (at z within s) exp" | 
| 78475 | 81 | by (simp add: continuous_at_imp_continuous_within) | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 82 | |
| 62381 
a6479cb85944
New and revised material for (multivariate) analysis
 paulson <lp15@cam.ac.uk> parents: 
62131diff
changeset | 83 | 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 | 84 | 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 | 85 | |
| 66480 
4b8d1df8933b
HOL-Analysis: Convergent FPS and infinite sums
 Manuel Eberl <eberlm@in.tum.de> parents: 
66466diff
changeset | 86 | lemma holomorphic_on_exp' [holomorphic_intros]: | 
| 
4b8d1df8933b
HOL-Analysis: Convergent FPS and infinite sums
 Manuel Eberl <eberlm@in.tum.de> parents: 
66466diff
changeset | 87 | "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 | 88 | 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 | 89 | |
| 77200 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 90 | lemma exp_analytic_on [analytic_intros]: | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 91 | assumes "f analytic_on A" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 92 | shows "(\<lambda>z. exp (f z)) analytic_on A" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 93 | by (metis analytic_on_holomorphic assms holomorphic_on_exp') | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 94 | |
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 95 | lemma | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 96 | assumes "\<And>w. w \<in> A \<Longrightarrow> exp (f w) = w" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 97 | assumes "f holomorphic_on A" "z \<in> A" "open A" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 98 | shows deriv_complex_logarithm: "deriv f z = 1 / z" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 99 | and has_field_derivative_complex_logarithm: "(f has_field_derivative 1 / z) (at z)" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 100 | proof - | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 101 | have [simp]: "z \<noteq> 0" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 102 | using assms(1)[of z] assms(3) by auto | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 103 | have deriv [derivative_intros]: "(f has_field_derivative deriv f z) (at z)" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 104 | using assms holomorphic_derivI by blast | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 105 | have "((\<lambda>w. w) has_field_derivative 1) (at z)" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 106 | by (intro derivative_intros) | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 107 | also have "?this \<longleftrightarrow> ((\<lambda>w. exp (f w)) has_field_derivative 1) (at z)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 108 | by (smt (verit, best) assms has_field_derivative_transform_within_open) | 
| 77200 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 109 | finally have "((\<lambda>w. exp (f w)) has_field_derivative 1) (at z)" . | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 110 | moreover have "((\<lambda>w. exp (f w)) has_field_derivative exp (f z) * deriv f z) (at z)" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 111 | by (rule derivative_eq_intros refl)+ | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 112 | ultimately have "exp (f z) * deriv f z = 1" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 113 | using DERIV_unique by blast | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 114 | with assms show "deriv f z = 1 / z" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 115 | by (simp add: field_simps) | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 116 | with deriv show "(f has_field_derivative 1 / z) (at z)" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 117 | by simp | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 118 | qed | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 119 | |
| 67968 | 120 | subsection\<open>Euler and de Moivre formulas\<close> | 
| 60420 | 121 | |
| 69597 | 122 | 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 | 123 | 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 | 124 | proof - | 
| 63589 | 125 | 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 | 126 | using sin_converges sums_mult by blast | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 127 | then show ?thesis | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 128 | by (simp add: scaleR_conv_of_real field_simps) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 129 | qed | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 130 | |
| 63589 | 131 | 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 | 132 | proof - | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 133 | have "(\<lambda>n. (cos_coeff n + \<i> * sin_coeff n) * z^n) = (\<lambda>n. (\<i> * z) ^ n /\<^sub>R (fact n))" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 134 | by (force simp: cos_coeff_def sin_coeff_def scaleR_conv_of_real field_simps elim!: evenE oddE) | 
| 76137 | 135 | also have "\<dots> sums (exp (\<i> * z))" | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 136 | by (rule exp_converges) | 
| 63589 | 137 | finally have "(\<lambda>n. (cos_coeff n + \<i> * sin_coeff n) * z^n) sums (exp (\<i> * z))" . | 
| 138 | 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 | 139 | 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 | 140 | by (simp add: field_simps scaleR_conv_of_real) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 141 | ultimately show ?thesis | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 142 | using sums_unique2 by blast | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 143 | qed | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 144 | |
| 70136 | 145 | corollary\<^marker>\<open>tag unimportant\<close> exp_minus_Euler: "exp(-(\<i> * z)) = cos(z) - \<i> * sin(z)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 146 | using exp_Euler [of "-z"] by simp | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 147 | |
| 63589 | 148 | 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 | 149 | by (simp add: exp_Euler exp_minus_Euler) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 150 | |
| 63589 | 151 | 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 | 152 | by (simp add: exp_Euler exp_minus_Euler) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 153 | |
| 63589 | 154 | 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 | 155 | by (simp add: exp_Euler exp_minus_Euler) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 156 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 157 | 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 | 158 | (of_real(cos(Im z)) + \<i> * of_real(sin(Im z)))" | 
| 78475 | 159 | by (simp add: Complex_eq cis.code exp_eq_polar) | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 160 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 161 | 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 | 162 | 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 | 163 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 164 | 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 | 165 | 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 | 166 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 167 | 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 | 168 | 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 | 169 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 170 | 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 | 171 | 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 | 172 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 173 | 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 | 174 | 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 | 175 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 176 | 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 | 177 | 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 | 178 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 179 | 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 | 180 | 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 | 181 | |
| 70136 | 182 | 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 | 183 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 184 | 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 | 185 | by (simp add: sin_of_real) | 
| 59862 | 186 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 187 | 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 | 188 | by (simp add: cos_of_real) | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 189 | |
| 63589 | 190 | 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 | 191 | 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 | 192 | |
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 193 | lemma exp_cnj: "cnj (exp z) = exp (cnj z)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 194 | by (simp add: cis_cnj exp_eq_polar) | 
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 195 | |
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 196 | lemma cnj_sin: "cnj(sin z) = sin(cnj z)" | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 197 | 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 | 198 | |
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 199 | lemma cnj_cos: "cnj(cos z) = cos(cnj z)" | 
| 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 200 | 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 | 201 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 202 | 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 | 203 | 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 | 204 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 205 | 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 | 206 | 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 | 207 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 208 | 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 | 209 | 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 | 210 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 211 | 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 | 212 | 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 | 213 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 214 | 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 | 215 | 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 | 216 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 217 | 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 | 218 | 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 | 219 | |
| 68721 | 220 | lemma holomorphic_on_sin' [holomorphic_intros]: | 
| 221 | assumes "f holomorphic_on A" | |
| 222 | shows "(\<lambda>x. sin (f x)) holomorphic_on A" | |
| 223 | using holomorphic_on_compose[OF assms holomorphic_on_sin] by (simp add: o_def) | |
| 224 | ||
| 225 | lemma holomorphic_on_cos' [holomorphic_intros]: | |
| 226 | assumes "f holomorphic_on A" | |
| 227 | shows "(\<lambda>x. cos (f x)) holomorphic_on A" | |
| 228 | using holomorphic_on_compose[OF assms holomorphic_on_cos] by (simp add: o_def) | |
| 229 | ||
| 79857 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 230 | lemma analytic_on_sin [analytic_intros]: "f analytic_on A \<Longrightarrow> (\<lambda>w. sin (f w)) analytic_on A" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 231 | and analytic_on_cos [analytic_intros]: "f analytic_on A \<Longrightarrow> (\<lambda>w. cos (f w)) analytic_on A" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 232 | and analytic_on_sinh [analytic_intros]: "f analytic_on A \<Longrightarrow> (\<lambda>w. sinh (f w)) analytic_on A" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 233 | and analytic_on_cosh [analytic_intros]: "f analytic_on A \<Longrightarrow> (\<lambda>w. cosh (f w)) analytic_on A" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 234 | unfolding sin_exp_eq cos_exp_eq sinh_def cosh_def | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 235 | by (auto intro!: analytic_intros) | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 236 | |
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 237 | lemma analytic_on_tan [analytic_intros]: | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 238 | "f analytic_on A \<Longrightarrow> (\<And>z. z \<in> A \<Longrightarrow> cos (f z) \<noteq> 0) \<Longrightarrow> (\<lambda>w. tan (f w)) analytic_on A" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 239 | and analytic_on_cot [analytic_intros]: | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 240 | "f analytic_on A \<Longrightarrow> (\<And>z. z \<in> A \<Longrightarrow> sin (f z) \<noteq> 0) \<Longrightarrow> (\<lambda>w. cot (f w)) analytic_on A" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 241 | and analytic_on_tanh [analytic_intros]: | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 242 | "f analytic_on A \<Longrightarrow> (\<And>z. z \<in> A \<Longrightarrow> cosh (f z) \<noteq> 0) \<Longrightarrow> (\<lambda>w. tanh (f w)) analytic_on A" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 243 | unfolding tan_def cot_def tanh_def by (auto intro!: analytic_intros) | 
| 77221 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 244 | |
| 70136 | 245 | 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 | 246 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 247 | lemma exp_Complex: "exp(Complex r t) = of_real(exp r) * Complex (cos t) (sin t)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 248 | using Complex_eq Euler complex.sel by presburger | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 249 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 250 | 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 | 251 | (is "?lhs = ?rhs") | 
| 68493 | 252 | proof | 
| 65274 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 253 | assume "exp z = 1" | 
| 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 254 | then have "Re z = 0" | 
| 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 255 | 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 | 256 | with \<open>?lhs\<close> show ?rhs | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 257 | by (metis Re_exp cos_one_2pi_int exp_zero mult.commute mult_1 of_int_mult of_int_numeral one_complex.simps(1)) | 
| 65274 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 258 | next | 
| 
db2de50de28e
Removed [simp] status for Complex_eq. Also tidied some proofs
 paulson <lp15@cam.ac.uk> parents: 
65064diff
changeset | 259 | assume ?rhs then show ?lhs | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 260 | 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 | 261 | 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 | 262 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 263 | |
| 63589 | 264 | 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 | 265 | (is "?lhs = ?rhs") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 266 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 267 | 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 | 268 | by (simp add: exp_diff) | 
| 76137 | 269 | also have "\<dots> \<longleftrightarrow> (Re w = Re z \<and> (\<exists>n::int. Im w - Im z = of_int (2 * n) * pi))" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 270 | by (simp add: exp_eq_1) | 
| 76137 | 271 | also have "\<dots> \<longleftrightarrow> ?rhs" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 272 | 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 | 273 | finally show ?thesis . | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 274 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 275 | |
| 61945 | 276 | 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 | 277 | by (auto simp: exp_eq abs_mult) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 278 | |
| 59862 | 279 | lemma exp_integer_2pi: | 
| 61070 | 280 | assumes "n \<in> \<int>" | 
| 63589 | 281 | shows "exp((2 * n * pi) * \<i>) = 1" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 282 | by (metis assms cis_conv_exp cis_multiple_2pi mult.assoc mult.commute) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 283 | |
| 64287 | 284 | lemma exp_plus_2pin [simp]: "exp (z + \<i> * (of_int n * (of_real pi * 2))) = exp z" | 
| 285 | by (simp add: exp_eq) | |
| 286 | ||
| 66466 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 287 | lemma exp_integer_2pi_plus1: | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 288 | assumes "n \<in> \<int>" | 
| 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 289 | shows "exp(((2 * n + 1) * pi) * \<i>) = - 1" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 290 | using exp_integer_2pi [OF assms] | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 291 | by (metis cis_conv_exp cis_mult cis_pi distrib_left mult.commute mult.right_neutral) | 
| 66466 
aec5d9c88d69
More lemmas for HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
66453diff
changeset | 292 | |
| 64287 | 293 | lemma inj_on_exp_pi: | 
| 294 | fixes z::complex shows "inj_on exp (ball z pi)" | |
| 295 | proof (clarsimp simp: inj_on_def exp_eq) | |
| 296 | fix y n | |
| 297 | assume "dist z (y + 2 * of_int n * of_real pi * \<i>) < pi" | |
| 298 | "dist z y < pi" | |
| 299 | then have "dist y (y + 2 * of_int n * of_real pi * \<i>) < pi+pi" | |
| 300 | using dist_commute_lessI dist_triangle_less_add by blast | |
| 301 | then have "norm (2 * of_int n * of_real pi * \<i>) < 2*pi" | |
| 302 | by (simp add: dist_norm) | |
| 303 | then show "n = 0" | |
| 304 | by (auto simp: norm_mult) | |
| 305 | qed | |
| 306 | ||
| 68585 | 307 | lemma cmod_add_squared: | 
| 308 | fixes r1 r2::real | |
| 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 "(cmod (?z1 + ?z2))\<^sup>2 = (?z1 + ?z2) * cnj (?z1 + ?z2)" | |
| 312 | by (rule complex_norm_square) | |
| 313 | also have "\<dots> = (?z1 * cnj ?z1 + ?z2 * cnj ?z2) + (?z1 * cnj ?z2 + cnj ?z1 * ?z2)" | |
| 314 | by (simp add: algebra_simps) | |
| 315 | also have "\<dots> = (norm ?z1)\<^sup>2 + (norm ?z2)\<^sup>2 + 2 * Re (?z1 * cnj ?z2)" | |
| 316 | unfolding complex_norm_square [symmetric] cnj_add_mult_eq_Re by simp | |
| 317 | also have "\<dots> = ?rhs" | |
| 318 | by (simp add: norm_mult) (simp add: exp_Euler complex_is_Real_iff [THEN iffD1] cos_diff algebra_simps) | |
| 319 | finally show ?thesis | |
| 320 | using of_real_eq_iff by blast | |
| 321 | qed | |
| 322 | ||
| 323 | lemma cmod_diff_squared: | |
| 324 | fixes r1 r2::real | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 325 | 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)" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 326 | using cmod_add_squared [of r1 _ "-r2"] by simp | 
| 68585 | 327 | |
| 328 | lemma polar_convergence: | |
| 329 | fixes R::real | |
| 330 | assumes "\<And>j. r j > 0" "R > 0" | |
| 331 | shows "((\<lambda>j. r j * exp (\<i> * \<theta> j)) \<longlonglongrightarrow> (R * exp (\<i> * \<Theta>))) \<longleftrightarrow> | |
| 332 | (r \<longlonglongrightarrow> R) \<and> (\<exists>k. (\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)" (is "(?z \<longlonglongrightarrow> ?Z) = ?rhs") | |
| 333 | proof | |
| 334 | assume L: "?z \<longlonglongrightarrow> ?Z" | |
| 335 | have rR: "r \<longlonglongrightarrow> R" | |
| 336 | using tendsto_norm [OF L] assms by (auto simp: norm_mult abs_of_pos) | |
| 337 | moreover obtain k where "(\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>" | |
| 338 | proof - | |
| 339 | have "cos (\<theta> j - \<Theta>) = ((r j)\<^sup>2 + R\<^sup>2 - (norm(?z j - ?Z))\<^sup>2) / (2 * R * r j)" for j | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 340 | using assms by (auto simp: cmod_diff_squared less_le) | 
| 68585 | 341 | 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))" | 
| 342 | by (intro L rR tendsto_intros) (use \<open>R > 0\<close> in force) | |
| 343 | 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 | 344 | using \<open>R > 0\<close> by (simp add: power2_eq_square field_split_simps) | 
| 68585 | 345 | ultimately have "(\<lambda>j. cos (\<theta> j - \<Theta>)) \<longlonglongrightarrow> 1" | 
| 346 | by auto | |
| 347 | then show ?thesis | |
| 348 | using that cos_diff_limit_1 by blast | |
| 349 | qed | |
| 350 | ultimately show ?rhs | |
| 351 | by metis | |
| 352 | next | |
| 353 | assume R: ?rhs | |
| 354 | show "?z \<longlonglongrightarrow> ?Z" | |
| 355 | proof (rule tendsto_mult) | |
| 356 | show "(\<lambda>x. complex_of_real (r x)) \<longlonglongrightarrow> of_real R" | |
| 357 | using R by (auto simp: tendsto_of_real_iff) | |
| 358 | obtain k where "(\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>" | |
| 359 | using R by metis | |
| 360 | then have "(\<lambda>j. complex_of_real (\<theta> j - of_int (k j) * (2 * pi))) \<longlonglongrightarrow> of_real \<Theta>" | |
| 361 | using tendsto_of_real_iff by force | |
| 362 | then have "(\<lambda>j. exp (\<i> * of_real (\<theta> j - of_int (k j) * (2 * pi)))) \<longlonglongrightarrow> exp (\<i> * \<Theta>)" | |
| 363 | using tendsto_mult [OF tendsto_const] isCont_exp isCont_tendsto_compose by blast | |
| 364 | moreover have "exp (\<i> * of_real (\<theta> j - of_int (k j) * (2 * pi))) = exp (\<i> * \<theta> j)" for j | |
| 365 | unfolding exp_eq | |
| 366 | by (rule_tac x="- k j" in exI) (auto simp: algebra_simps) | |
| 367 | ultimately show "(\<lambda>j. exp (\<i> * \<theta> j)) \<longlonglongrightarrow> exp (\<i> * \<Theta>)" | |
| 368 | by auto | |
| 369 | qed | |
| 370 | qed | |
| 371 | ||
| 59862 | 372 | lemma exp_i_ne_1: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 373 | assumes "0 < x" "x < 2*pi" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 374 | shows "exp(\<i> * of_real x) \<noteq> 1" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 375 | by (smt (verit) Im_i_times Re_complex_of_real assms exp_complex_eqI exp_zero zero_complex.sel(2)) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 376 | |
| 59862 | 377 | lemma sin_eq_0: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 378 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 379 | 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 | 380 | 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 | 381 | |
| 59862 | 382 | lemma cos_eq_0: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 383 | fixes z::complex | 
| 76137 | 384 | shows "cos z = 0 \<longleftrightarrow> (\<exists>n::int. z = complex_of_real(n * pi) + of_real pi/2)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 385 | 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 | 386 | by (simp add: sin_diff algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 387 | |
| 59862 | 388 | lemma cos_eq_1: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 389 | fixes z::complex | 
| 76137 | 390 | shows "cos z = 1 \<longleftrightarrow> (\<exists>n::int. z = complex_of_real(2 * n * pi))" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 391 | by (metis Re_complex_of_real cos_of_real cos_one_2pi_int cos_one_sin_zero mult.commute of_real_1 sin_eq_0) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 392 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 393 | lemma csin_eq_1: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 394 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 395 | 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 | 396 | 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 | 397 | by (simp add: cos_diff algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 398 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 399 | lemma csin_eq_minus1: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 400 | fixes z::complex | 
| 76137 | 401 | shows "sin z = -1 \<longleftrightarrow> (\<exists>n::int. z = complex_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 | 402 | (is "_ = ?rhs") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 403 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 404 | 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 | 405 | by (simp add: equation_minus_iff) | 
| 76137 | 406 | also have "\<dots> \<longleftrightarrow> (\<exists>n::int. z = - of_real(2 * n * pi) - of_real pi/2)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 407 | by (metis (mono_tags, lifting) add_uminus_conv_diff csin_eq_1 equation_minus_iff minus_add_distrib) | 
| 76137 | 408 | also have "\<dots> = ?rhs" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 409 | apply safe | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 410 | 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 | 411 | 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 | 412 | apply (simp_all add: algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 413 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 414 | finally show ?thesis . | 
| 59862 | 415 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 416 | |
| 59862 | 417 | lemma ccos_eq_minus1: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 418 | fixes z::complex | 
| 76137 | 419 | shows "cos z = -1 \<longleftrightarrow> (\<exists>n::int. z = complex_of_real(2 * n * pi) + pi)" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 420 | 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 | 421 | 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 | 422 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 423 | 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 | 424 | (is "_ = ?rhs") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 425 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 426 | 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 | 427 | by (metis of_real_1 one_complex.simps(1) real_sin_eq sin_of_real) | 
| 76137 | 428 | also have "\<dots> \<longleftrightarrow> (\<exists>n::int. x = of_real(2 * n * pi) + of_real pi/2)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 429 | by (metis csin_eq_1 Re_complex_of_real id_apply of_real_add of_real_divide of_real_eq_id of_real_numeral) | 
| 76137 | 430 | also have "\<dots> = ?rhs" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 431 | by (auto simp: algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 432 | finally show ?thesis . | 
| 59862 | 433 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 434 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 435 | 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 | 436 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 437 | 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 | 438 | by (metis Re_complex_of_real of_real_def scaleR_minus1_left sin_of_real) | 
| 76137 | 439 | also have "\<dots> \<longleftrightarrow> (\<exists>n::int. x = of_real(2 * n * pi) + 3/2*pi)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 440 | by (metis Re_complex_of_real csin_eq_minus1 id_apply of_real_add of_real_eq_id) | 
| 76137 | 441 | also have "\<dots> = ?rhs" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 442 | by (auto simp: algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 443 | finally show ?thesis . | 
| 59862 | 444 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 445 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 446 | 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 | 447 | (is "_ = ?rhs") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 448 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 449 | 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 | 450 | by (metis Re_complex_of_real of_real_def scaleR_minus1_left cos_of_real) | 
| 76137 | 451 | also have "\<dots> \<longleftrightarrow> (\<exists>n::int. x = of_real(2 * n * pi) + pi)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 452 | by (metis ccos_eq_minus1 id_apply of_real_add of_real_eq_id of_real_eq_iff) | 
| 76137 | 453 | also have "\<dots> = ?rhs" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 454 | by (auto simp: algebra_simps) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 455 | finally show ?thesis . | 
| 59862 | 456 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 457 | |
| 75494 | 458 | lemma cos_gt_neg1: | 
| 459 |   assumes "(t::real) \<in> {-pi<..<pi}"
 | |
| 460 | shows "cos t > -1" | |
| 77103 | 461 | using assms | 
| 462 | by simp (metis cos_minus cos_monotone_0_pi cos_monotone_minus_pi_0 cos_pi linorder_le_cases) | |
| 75494 | 463 | |
| 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 | 464 | lemma dist_exp_i_1: "norm(exp(\<i> * of_real t) - 1) = 2 * \<bar>sin(t / 2)\<bar>" | 
| 72301 | 465 | proof - | 
| 466 | have "sqrt (2 - cos t * 2) = 2 * \<bar>sin (t / 2)\<bar>" | |
| 467 | using cos_double_sin [of "t/2"] by (simp add: real_sqrt_mult) | |
| 468 | then show ?thesis | |
| 469 | by (simp add: exp_Euler cmod_def power2_diff sin_of_real cos_of_real algebra_simps) | |
| 470 | qed | |
| 471 | ||
| 472 | lemma sin_cx_2pi [simp]: "\<lbrakk>z = of_int m; even m\<rbrakk> \<Longrightarrow> sin (z * complex_of_real pi) = 0" | |
| 473 | by (simp add: sin_eq_0) | |
| 474 | ||
| 475 | lemma cos_cx_2pi [simp]: "\<lbrakk>z = of_int m; even m\<rbrakk> \<Longrightarrow> cos (z * complex_of_real pi) = 1" | |
| 476 | using cos_eq_1 by auto | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 477 | |
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 478 | lemma complex_sin_eq: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 479 | fixes w :: complex | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 480 | 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 | 481 | (is "?lhs = ?rhs") | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 482 | proof | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 483 | assume ?lhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 484 | then consider "sin ((w - z) / 2) = 0" | "cos ((w + z) / 2) = 0" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 485 | by (metis divide_eq_0_iff nonzero_eq_divide_eq right_minus_eq sin_diff_sin zero_neq_numeral) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 486 | then show ?rhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 487 | proof cases | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 488 | case 1 | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 489 | then show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 490 | 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 | 491 | next | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 492 | case 2 | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 493 | then show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 494 | 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 | 495 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 496 | next | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 497 | assume ?rhs | 
| 75494 | 498 | then consider n::int where "w = z + of_real (2 * of_int n * pi)" | 
| 72301 | 499 | | n::int where " w = -z + of_real ((2 * of_int n + 1) * pi)" | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 500 | using Ints_cases by blast | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 501 | then show ?lhs | 
| 72301 | 502 | proof cases | 
| 503 | case 1 | |
| 504 | then show ?thesis | |
| 505 | using Periodic_Fun.sin.plus_of_int [of z n] | |
| 506 | by (auto simp: algebra_simps) | |
| 507 | next | |
| 508 | case 2 | |
| 75494 | 509 | then show ?thesis | 
| 72301 | 510 | using Periodic_Fun.sin.plus_of_int [of "-z" "n"] | 
| 511 | apply (simp add: algebra_simps) | |
| 512 | by (metis add.commute add.inverse_inverse add_diff_cancel_left diff_add_cancel sin_plus_pi) | |
| 513 | qed | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 514 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 515 | |
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 516 | lemma complex_cos_eq: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 517 | fixes w :: complex | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 518 | 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 | 519 | (is "?lhs = ?rhs") | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 520 | proof | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 521 | assume ?lhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 522 | then consider "sin ((w + z) / 2) = 0" | "sin ((z - w) / 2) = 0" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 523 | by (metis mult_eq_0_iff cos_diff_cos right_minus_eq zero_neq_numeral) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 524 | then show ?rhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 525 | proof cases | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 526 | case 1 | 
| 72301 | 527 | then obtain n where "w + z = of_int n * (complex_of_real pi * 2)" | 
| 528 | by (auto simp: sin_eq_0 algebra_simps) | |
| 529 | then have "w = -z + of_real(2 * of_int n * pi)" | |
| 530 | by (auto simp: algebra_simps) | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 531 | then show ?thesis | 
| 72301 | 532 | using Ints_of_int by blast | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 533 | next | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 534 | case 2 | 
| 72301 | 535 | then obtain n where "z = w + of_int n * (complex_of_real pi * 2)" | 
| 536 | by (auto simp: sin_eq_0 algebra_simps) | |
| 537 | then have "w = z + complex_of_real (2 * of_int(-n) * pi)" | |
| 538 | by (auto simp: algebra_simps) | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 539 | then show ?thesis | 
| 72301 | 540 | using Ints_of_int by blast | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 541 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 542 | next | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 543 | assume ?rhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 544 | 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 | 545 | w = -z + of_real(2*n*pi)" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 546 | 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 | 547 | then show ?lhs | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 548 | 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 | 549 | apply (simp add: algebra_simps) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 550 | 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 | 551 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 552 | |
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 553 | lemma sin_eq: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 554 | "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 | 555 | using complex_sin_eq [of x y] | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 556 | 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 | 557 | |
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 558 | lemma cos_eq: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 559 | "cos x = cos y \<longleftrightarrow> (\<exists>n \<in> \<int>. x = y + 2*n*pi \<or> x = -y + 2*n*pi)" | 
| 78475 | 560 | using complex_cos_eq [of x y] unfolding cos_of_real | 
| 561 | by (metis Re_complex_of_real of_real_add of_real_minus) | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 562 | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 563 | lemma sinh_complex: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 564 | fixes z :: complex | 
| 63589 | 565 | 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 | 566 | 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 | 567 | |
| 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 | 568 | lemma sin_i_times: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 569 | fixes z :: complex | 
| 63589 | 570 | 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 | 571 | using sinh_complex by auto | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 572 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 573 | lemma sinh_real: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 574 | fixes x :: real | 
| 63589 | 575 | 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 | 576 | 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 | 577 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 578 | lemma cosh_complex: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 579 | fixes z :: complex | 
| 63589 | 580 | 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 | 581 | 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 | 582 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 583 | lemma cosh_real: | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 584 | fixes x :: real | 
| 63589 | 585 | 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 | 586 | 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 | 587 | |
| 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 | 588 | 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 | 589 | |
| 59862 | 590 | lemma norm_cos_squared: | 
| 72301 | 591 | "norm(cos z) ^ 2 = cos(Re z) ^ 2 + (exp(Im z) - inverse(exp(Im z))) ^ 2 / 4" | 
| 592 | proof (cases z) | |
| 593 | case (Complex x1 x2) | |
| 594 | then show ?thesis | |
| 595 | apply (simp only: cos_add cmod_power2 cos_of_real sin_of_real Complex_eq) | |
| 596 | apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide power_divide) | |
| 597 | apply (simp only: left_diff_distrib [symmetric] power_mult_distrib sin_squared_eq) | |
| 598 | apply (simp add: power2_eq_square field_split_simps) | |
| 599 | done | |
| 600 | qed | |
| 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 norm_sin_squared: | 
| 72301 | 603 | "norm(sin z) ^ 2 = (exp(2 * Im z) + inverse(exp(2 * Im z)) - 2 * cos(2 * Re z)) / 4" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 604 | using cos_double_sin [of "Re z"] | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 605 | apply (simp add: sin_cos_eq norm_cos_squared exp_minus mult.commute [of _ 2] exp_double) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 606 | apply (simp add: algebra_simps power2_eq_square) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 607 | done | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 608 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 609 | 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 | 610 | 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 | 611 | |
| 59862 | 612 | lemma norm_cos_le: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 613 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 614 | 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 | 615 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 616 | have "Im z \<le> cmod z" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 617 | using abs_Im_le_cmod abs_le_D1 by auto | 
| 72301 | 618 | then have "exp (- Im z) + exp (Im z) \<le> exp (cmod z) * 2" | 
| 619 | by (metis exp_uminus_Im add_mono exp_le_cancel_iff mult_2_right) | |
| 620 | then show ?thesis | |
| 621 | by (force simp add: cos_exp_eq norm_divide intro: order_trans [OF norm_triangle_ineq]) | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 622 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 623 | |
| 59862 | 624 | lemma norm_cos_plus1_le: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 625 | fixes z::complex | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 626 | shows "norm(1 + cos z) \<le> 2 * exp(norm z)" | 
| 78475 | 627 | by (metis mult_2 norm_cos_le norm_ge_zero norm_one norm_triangle_mono one_le_exp_iff) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 628 | |
| 67578 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 629 | 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 | 630 | 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 | 631 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 632 | 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 | 633 | 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 | 634 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 635 | 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 | 636 | 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 | 637 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 638 | 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 | 639 | by (simp add: sinh_conv_sin) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 640 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 641 | 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 | 642 | by (simp add: cosh_conv_cos) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 643 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 644 | 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 | 645 | 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 | 646 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 647 | lemma sinh_complex_eq_iff: | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 648 | "sinh (z :: complex) = sinh w \<longleftrightarrow> | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 649 | (\<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 | 650 | 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 | 651 | proof - | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 652 | 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 | 653 | by (simp add: sinh_conv_sin) | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 654 | also have "\<dots> \<longleftrightarrow> ?rhs" | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 655 | 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 | 656 | finally show ?thesis . | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 657 | qed | 
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 658 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 659 | |
| 70136 | 660 | 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 | 661 | |
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 662 | declare power_Suc [simp del] | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 663 | |
| 66252 | 664 | lemma Taylor_exp_field: | 
| 665 |   fixes z::"'a::{banach,real_normed_field}"
 | |
| 666 | shows "norm (exp z - (\<Sum>i\<le>n. z ^ i / fact i)) \<le> exp (norm z) * (norm z ^ Suc n) / fact n" | |
| 69529 | 667 | proof (rule field_Taylor[of _ n "\<lambda>k. exp" "exp (norm z)" 0 z, simplified]) | 
| 66252 | 668 | show "convex (closed_segment 0 z)" | 
| 669 | by (rule convex_closed_segment [of 0 z]) | |
| 670 | next | |
| 671 | fix k x | |
| 672 | assume "x \<in> closed_segment 0 z" "k \<le> n" | |
| 673 | show "(exp has_field_derivative exp x) (at x within closed_segment 0 z)" | |
| 674 | using DERIV_exp DERIV_subset by blast | |
| 675 | next | |
| 676 | fix x | |
| 677 | assume x: "x \<in> closed_segment 0 z" | |
| 678 | have "norm (exp x) \<le> exp (norm x)" | |
| 679 | by (rule norm_exp) | |
| 680 | also have "norm x \<le> norm z" | |
| 681 | using x by (auto simp: closed_segment_def intro!: mult_left_le_one_le) | |
| 682 | finally show "norm (exp x) \<le> exp (norm z)" | |
| 683 | by simp | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 684 | qed auto | 
| 66252 | 685 | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 686 | text \<open>For complex @{term z}, a tighter bound than in the previous result\<close>
 | 
| 59862 | 687 | lemma Taylor_exp: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 688 | "norm(exp z - (\<Sum>k\<le>n. z ^ k / (fact k))) \<le> exp\<bar>Re z\<bar> * (norm z) ^ (Suc n) / (fact n)" | 
| 69529 | 689 | 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 | 690 | show "convex (closed_segment 0 z)" | 
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 691 | 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 | 692 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 693 | fix k x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 694 | 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 | 695 | 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 | 696 | using DERIV_exp DERIV_subset by blast | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 697 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 698 | fix x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 699 | assume "x \<in> closed_segment 0 z" | 
| 72301 | 700 | then obtain u where u: "x = complex_of_real u * z" "0 \<le> u" "u \<le> 1" | 
| 701 | by (auto simp: closed_segment_def scaleR_conv_of_real) | |
| 702 | then have "u * Re z \<le> \<bar>Re z\<bar>" | |
| 703 | by (metis abs_ge_self abs_ge_zero mult.commute mult.right_neutral mult_mono) | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 704 | then show "Re x \<le> \<bar>Re z\<bar>" | 
| 72301 | 705 | by (simp add: u) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 706 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 707 | |
| 59862 | 708 | lemma | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 709 | assumes "0 \<le> u" "u \<le> 1" | 
| 59862 | 710 | 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 | 711 | 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 | 712 | proof - | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 713 | 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 | 714 | by simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 715 | 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 | 716 | proof (rule mono) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 717 | show "cmod (exp (\<i> * (u * z))) \<le> exp \<bar>Im z\<bar>" | 
| 72301 | 718 | using assms | 
| 719 | by (auto simp: abs_if mult_left_le_one_le not_less intro: order_trans [of _ 0]) | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 720 | show "cmod (exp (- (\<i> * (u * z)))) \<le> exp \<bar>Im z\<bar>" | 
| 72301 | 721 | using assms | 
| 722 | by (auto simp: abs_if mult_left_le_one_le mult_nonneg_nonpos intro: order_trans [of _ 0]) | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 723 | qed | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 724 | 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 | 725 | by (auto simp: scaleR_conv_of_real norm_mult norm_power sin_exp_eq norm_divide) | 
| 76137 | 726 | also have "\<dots> \<le> (cmod (exp (\<i> * (u * z))) + cmod (exp (- (\<i> * (u * z)))) ) / 2" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 727 | by (intro divide_right_mono norm_triangle_ineq4) simp | 
| 76137 | 728 | also have "\<dots> \<le> exp \<bar>Im z\<bar>" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 729 | by (rule *) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 730 | 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 | 731 | 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 | 732 | by (auto simp: scaleR_conv_of_real norm_mult norm_power cos_exp_eq norm_divide) | 
| 76137 | 733 | also have "\<dots> \<le> (cmod (exp (\<i> * (u * z))) + cmod (exp (- (\<i> * (u * z)))) ) / 2" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 734 | by (intro divide_right_mono norm_triangle_ineq) simp | 
| 76137 | 735 | also have "\<dots> \<le> exp \<bar>Im z\<bar>" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 736 | by (rule *) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 737 | 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 | 738 | qed | 
| 59862 | 739 | |
| 740 | lemma Taylor_sin: | |
| 741 | "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 | 742 | \<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 | 743 | proof - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 744 | 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 | 745 | by arith | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 746 | have *: "cmod (sin z - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 747 | (\<Sum>i\<le>n. (-1) ^ (i div 2) * (if even i then sin 0 else cos 0) * z ^ i / (fact i))) | 
| 59862 | 748 | \<le> exp \<bar>Im z\<bar> * cmod z ^ Suc n / (fact n)" | 
| 69529 | 749 | 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 | 750 | "\<lambda>k x. (-1)^(k div 2) * (if even k then sin x else cos x)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 751 | "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 | 752 | fix k x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 753 | 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 | 754 | (- 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 | 755 | (at x within closed_segment 0 z)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 756 | by (cases "even k") (intro derivative_eq_intros | simp add: power_Suc)+ | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 757 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 758 | fix x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 759 | assume "x \<in> closed_segment 0 z" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 760 | 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 | 761 | by (auto simp: closed_segment_def norm_mult norm_power cmod_sin_le_exp cmod_cos_le_exp) | 
| 59862 | 762 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 763 | 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 | 764 | = (-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 | 765 | 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 | 766 | show ?thesis | 
| 72301 | 767 | by (simp add: ** order_trans [OF _ *]) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 768 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 769 | |
| 59862 | 770 | lemma Taylor_cos: | 
| 771 | "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 | 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 (cos z - | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 777 | (\<Sum>i\<le>n. (-1) ^ (Suc i div 2) * (if even i then cos 0 else sin 0) * z ^ i / (fact i))) | 
| 59862 | 778 | \<le> exp \<bar>Im z\<bar> * cmod z ^ Suc n / (fact n)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 779 | proof (rule complex_Taylor [of "closed_segment 0 z" n | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 780 | "\<lambda>k x. (-1)^(Suc k div 2) * (if even k then cos x else sin x)" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 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 | 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 | 784 | 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 | 785 | (- 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 | 786 | (at x within closed_segment 0 z)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 787 | by (cases "even k") (intro derivative_eq_intros | simp add: power_Suc)+ | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 788 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 789 | fix x | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 790 | assume "x \<in> closed_segment 0 z" | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 791 | 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 | 792 | by (auto simp: closed_segment_def norm_mult norm_power cmod_sin_le_exp cmod_cos_le_exp) | 
| 59862 | 793 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 794 | 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 | 795 | = (-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 | 796 | 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 | 797 | show ?thesis | 
| 72301 | 798 | by (simp add: ** order_trans [OF _ *]) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 799 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 800 | |
| 60162 | 801 | declare power_Suc [simp] | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 802 | |
| 60420 | 803 | text\<open>32-bit Approximation to e\<close> | 
| 61945 | 804 | 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 | 805 | using Taylor_exp [of 1 14] exp_le | 
| 64267 | 806 | apply (simp add: sum_distrib_right in_Reals_norm Re_exp atMost_nat_numeral fact_numeral) | 
| 66611 | 807 | 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 | 808 | done | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 809 | |
| 65719 | 810 | 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 | 811 | using e_approx_32 | 
| 62390 | 812 | 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 | 813 | |
| 65719 | 814 | lemma ln_272_gt_1: "ln (272/100) > (1::real)" | 
| 815 | by (metis e_less_272 exp_less_cancel_iff exp_ln_iff less_trans ln_exp) | |
| 816 | ||
| 817 | 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 | 818 | lemma ln3_gt_1: "ln 3 > (1::real)" | 
| 65719 | 819 | 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 | 820 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 821 | 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 | 822 | |
| 70136 | 823 | 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 | 824 | 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 | 825 | |
| 70136 | 826 | 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 | 827 | 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 | 828 | |
| 68517 | 829 | lemma is_Arg_2pi_iff: "is_Arg z (r + of_int k * (2 * pi)) \<longleftrightarrow> is_Arg z r" | 
| 830 | by (simp add: algebra_simps is_Arg_def) | |
| 831 | ||
| 832 | lemma is_Arg_eqI: | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 833 | assumes "is_Arg z r" and "is_Arg z s" and "abs (r-s) < 2*pi" and "z \<noteq> 0" | 
| 68517 | 834 | shows "r = s" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 835 | using assms unfolding is_Arg_def | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 836 | by (metis Im_i_times Re_complex_of_real exp_complex_eqI mult_cancel_left mult_eq_0_iff) | 
| 68517 | 837 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 838 | text\<open>This function returns the angle of a complex number from its representation in polar coordinates. | 
| 69597 | 839 | 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 | 840 | But we have the same periodicity issue with logarithms, and it is usual to adopt the same interval | 
| 69566 | 841 | 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 | 842 | 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 | 843 | |
| 68493 | 844 | lemma Arg2pi_0 [simp]: "Arg2pi(0) = 0" | 
| 845 | by (simp add: Arg2pi_def) | |
| 846 | ||
| 847 | lemma Arg2pi_unique_lemma: | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 848 | assumes "is_Arg z t" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 849 | and "is_Arg z t'" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 850 | and "0 \<le> t" "t < 2*pi" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 851 | and "0 \<le> t'" "t' < 2*pi" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 852 | and "z \<noteq> 0" | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 853 | shows "t' = t" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 854 | using is_Arg_eqI assms by force | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 855 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 856 | 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 | 857 | proof (cases "z=0") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 858 | case True then show ?thesis | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 859 | 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 | 860 | next | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 861 | case False | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 862 | 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 | 863 | 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 | 864 | 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 | 865 | by blast | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 866 | then have z: "is_Arg z t" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 867 | unfolding is_Arg_def | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 868 | using t False ReIm | 
| 72301 | 869 | by (intro complex_eqI) (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 | 870 | show ?thesis | 
| 68493 | 871 | apply (simp add: Arg2pi_def False) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 872 | apply (rule theI [where a=t]) | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 873 | using t z False | 
| 68493 | 874 | apply (auto intro: Arg2pi_unique_lemma) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 875 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 876 | qed | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 877 | |
| 70136 | 878 | corollary\<^marker>\<open>tag unimportant\<close> | 
| 68493 | 879 | shows Arg2pi_ge_0: "0 \<le> Arg2pi z" | 
| 880 | and Arg2pi_lt_2pi: "Arg2pi z < 2*pi" | |
| 881 | 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 | 882 | using Arg2pi is_Arg_def by auto | 
| 68493 | 883 | |
| 884 | lemma complex_norm_eq_1_exp: "norm z = 1 \<longleftrightarrow> exp(\<i> * of_real (Arg2pi z)) = z" | |
| 885 | by (metis Arg2pi_eq cis_conv_exp mult.left_neutral norm_cis of_real_1) | |
| 886 | ||
| 887 | 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 | 888 | by (rule Arg2pi_unique_lemma [unfolded is_Arg_def, OF _ Arg2pi_eq]) (use Arg2pi [of z] in \<open>auto simp: norm_mult\<close>) | 
| 68493 | 889 | |
| 72301 | 890 | lemma cos_Arg2pi: "cmod z * cos (Arg2pi z) = Re z" and sin_Arg2pi: "cmod z * sin (Arg2pi z) = Im z" | 
| 891 | using Arg2pi_eq [of z] cis_conv_exp Re_rcis Im_rcis unfolding rcis_def by metis+ | |
| 892 | ||
| 893 | lemma Arg2pi_minus: | |
| 894 | assumes "z \<noteq> 0" shows "Arg2pi (-z) = (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi)" | |
| 895 | apply (rule Arg2pi_unique [of "norm z", OF complex_eqI]) | |
| 896 | using cos_Arg2pi sin_Arg2pi Arg2pi_ge_0 Arg2pi_lt_2pi [of z] assms | |
| 897 | by (auto simp: Re_exp Im_exp) | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 898 | |
| 68493 | 899 | lemma Arg2pi_times_of_real [simp]: | 
| 900 | assumes "0 < r" shows "Arg2pi (of_real r * z) = Arg2pi z" | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 901 | by (metis (no_types, lifting) Arg2pi Arg2pi_eq Arg2pi_unique assms mult.assoc | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 902 | mult_eq_0_iff mult_pos_pos of_real_mult zero_less_norm_iff) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 903 | |
| 68493 | 904 | lemma Arg2pi_times_of_real2 [simp]: "0 < r \<Longrightarrow> Arg2pi (z * of_real r) = Arg2pi z" | 
| 905 | by (metis Arg2pi_times_of_real mult.commute) | |
| 906 | ||
| 907 | lemma Arg2pi_divide_of_real [simp]: "0 < r \<Longrightarrow> Arg2pi (z / of_real r) = Arg2pi z" | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 908 | by (metis Arg2pi_times_of_real2 less_irrefl nonzero_eq_divide_eq of_real_eq_0_iff) | 
| 68493 | 909 | |
| 910 | 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 | 911 | proof (cases "z=0") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 912 | case False | 
| 68493 | 913 | have "0 \<le> Im z \<longleftrightarrow> 0 \<le> Im (of_real (cmod z) * exp (\<i> * complex_of_real (Arg2pi z)))" | 
| 914 | by (metis Arg2pi_eq) | |
| 76137 | 915 | also have "\<dots> = (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 | 916 | using False by (simp add: zero_le_mult_iff) | 
| 76137 | 917 | also have "\<dots> \<longleftrightarrow> Arg2pi z \<le> pi" | 
| 68493 | 918 | 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 | 919 | finally show ?thesis | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 920 | by blast | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 921 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 922 | |
| 68493 | 923 | lemma Arg2pi_lt_pi: "0 < Arg2pi z \<and> Arg2pi z < pi \<longleftrightarrow> 0 < Im z" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 924 | using Arg2pi_le_pi [of z] | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 925 | by (smt (verit, del_insts) Arg2pi_0 Arg2pi_le_pi Arg2pi_minus uminus_complex.simps(2) zero_complex.simps(2)) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 926 | |
| 68493 | 927 | 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 | 928 | proof (cases "z=0") | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 929 | case False | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 930 | then have "z \<in> \<real> \<and> 0 \<le> Re z \<longleftrightarrow> z \<in> \<real> \<and> 0 \<le> Re (exp (\<i> * complex_of_real (Arg2pi z)))" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 931 | by (metis cis.sel(1) cis_conv_exp cos_Arg2pi norm_ge_zero norm_le_zero_iff zero_le_mult_iff) | 
| 76137 | 932 | also have "\<dots> \<longleftrightarrow> Arg2pi z = 0" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 933 | proof - | 
| 68493 | 934 | have [simp]: "Arg2pi z = 0 \<Longrightarrow> z \<in> \<real>" | 
| 935 | using Arg2pi_eq [of z] by (auto simp: Reals_def) | |
| 936 | moreover have "\<lbrakk>z \<in> \<real>; 0 \<le> cos (Arg2pi z)\<rbrakk> \<Longrightarrow> Arg2pi z = 0" | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 937 | by (smt (verit, ccfv_SIG) Arg2pi_ge_0 Arg2pi_le_pi Arg2pi_lt_pi complex_is_Real_iff cos_pi) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 938 | ultimately show ?thesis | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 939 | by (auto simp: Re_exp) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 940 | qed | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 941 | finally show ?thesis | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 942 | by blast | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 943 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 944 | |
| 70136 | 945 | 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 | 946 | assumes "z \<notin> \<real>\<^sub>\<ge>\<^sub>0" | 
| 68493 | 947 | shows "Arg2pi z > 0" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 948 | 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 | 949 | unfolding nonneg_Reals_def by fastforce | 
| 68493 | 950 | |
| 951 | lemma Arg2pi_eq_pi: "Arg2pi z = pi \<longleftrightarrow> z \<in> \<real> \<and> Re z < 0" | |
| 75494 | 952 | using Arg2pi_le_pi [of z] Arg2pi_lt_pi [of z] Arg2pi_eq_0 [of z] Arg2pi_ge_0 [of z] | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 953 | by (fastforce simp: complex_is_Real_iff) | 
| 68493 | 954 | |
| 955 | lemma Arg2pi_eq_0_pi: "Arg2pi z = 0 \<or> Arg2pi z = pi \<longleftrightarrow> z \<in> \<real>" | |
| 956 | using Arg2pi_eq_0 Arg2pi_eq_pi not_le by auto | |
| 957 | ||
| 68517 | 958 | lemma Arg2pi_of_real: "Arg2pi (of_real r) = (if r<0 then pi else 0)" | 
| 959 | using Arg2pi_eq_0_pi Arg2pi_eq_pi by fastforce | |
| 960 | ||
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 961 | 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 | 962 | 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 | 963 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 964 | 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 | 965 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 966 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 967 | show ?thesis | 
| 68493 | 968 | 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 | 969 | 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 | 970 | 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 | 971 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 972 | |
| 68493 | 973 | lemma Arg2pi_eq_iff: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 974 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 975 | shows "Arg2pi w = Arg2pi z \<longleftrightarrow> (\<exists>x. 0 < x \<and> w = of_real x * z)" (is "?lhs = ?rhs") | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 976 | proof | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 977 | assume ?lhs | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 978 | then have "(cmod w) * (z / cmod z) = w" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 979 | by (metis Arg2pi_eq assms(2) mult_eq_0_iff nonzero_mult_div_cancel_left) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 980 | then show ?rhs | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 981 | by (metis assms divide_pos_pos of_real_divide times_divide_eq_left times_divide_eq_right zero_less_norm_iff) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 982 | qed auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 983 | |
| 68493 | 984 | lemma Arg2pi_inverse_eq_0: "Arg2pi(inverse z) = 0 \<longleftrightarrow> Arg2pi z = 0" | 
| 985 | by (metis Arg2pi_eq_0 Arg2pi_inverse inverse_inverse_eq) | |
| 986 | ||
| 987 | lemma Arg2pi_divide: | |
| 988 | assumes "w \<noteq> 0" "z \<noteq> 0" "Arg2pi w \<le> Arg2pi z" | |
| 989 | shows "Arg2pi(z / w) = Arg2pi z - Arg2pi w" | |
| 990 | apply (rule Arg2pi_unique [of "norm(z / w)"]) | |
| 991 | 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 | 992 | 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 | 993 | done | 
| 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 994 | |
| 68493 | 995 | lemma Arg2pi_le_div_sum: | 
| 996 | assumes "w \<noteq> 0" "z \<noteq> 0" "Arg2pi w \<le> Arg2pi z" | |
| 997 | shows "Arg2pi z = Arg2pi w + Arg2pi(z / w)" | |
| 998 | by (simp add: Arg2pi_divide assms) | |
| 999 | ||
| 1000 | lemma Arg2pi_le_div_sum_eq: | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1001 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 68493 | 1002 | shows "Arg2pi w \<le> Arg2pi z \<longleftrightarrow> Arg2pi z = Arg2pi w + Arg2pi(z / w)" | 
| 1003 | using assms by (auto simp: Arg2pi_ge_0 intro: Arg2pi_le_div_sum) | |
| 1004 | ||
| 1005 | lemma Arg2pi_diff: | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1006 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 68493 | 1007 | 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 | 1008 | 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 | 1009 | by (force simp add: Arg2pi_ge_0 Arg2pi_divide not_le split: if_split_asm) | 
| 68493 | 1010 | |
| 1011 | lemma Arg2pi_add: | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1012 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 68493 | 1013 | shows "Arg2pi w + Arg2pi z = (if Arg2pi w + Arg2pi z < 2*pi then Arg2pi(w * z) else Arg2pi(w * z) + 2*pi)" | 
| 76137 | 1014 | using assms Arg2pi_diff [of "w*z" z] Arg2pi_le_div_sum_eq [of z "w*z"] Arg2pi [of "w * z"] | 
| 1015 | by auto | |
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1016 | |
| 68493 | 1017 | lemma Arg2pi_times: | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1018 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 68493 | 1019 | shows "Arg2pi (w * z) = (if Arg2pi w + Arg2pi z < 2*pi then Arg2pi w + Arg2pi z | 
| 1020 | else (Arg2pi w + Arg2pi z) - 2*pi)" | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1021 | using Arg2pi_add [OF assms] by auto | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1022 | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1023 | lemma Arg2pi_cnj_eq_inverse: | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1024 | assumes "z \<noteq> 0" shows "Arg2pi (cnj z) = Arg2pi (inverse z)" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1025 | proof - | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1026 | have "\<exists>r>0. of_real r / z = cnj z" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1027 | by (metis assms complex_norm_square nonzero_mult_div_cancel_left zero_less_norm_iff zero_less_power) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1028 | then show ?thesis | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1029 | by (metis Arg2pi_times_of_real2 divide_inverse_commute) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1030 | qed | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1031 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1032 | lemma Arg2pi_cnj: "Arg2pi(cnj z) = (if z \<in> \<real> then Arg2pi z else 2*pi - Arg2pi z)" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1033 | by (metis Arg2pi_cnj_eq_inverse Arg2pi_inverse Reals_cnj_iff complex_cnj_zero) | 
| 59746 
ddae5727c5a9
new HOL Light material about exp, sin, cos
 paulson <lp15@cam.ac.uk> parents: 
59745diff
changeset | 1034 | |
| 68493 | 1035 | lemma Arg2pi_exp: "0 \<le> Im z \<Longrightarrow> Im z < 2*pi \<Longrightarrow> Arg2pi(exp z) = Im z" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1036 | by (simp add: Arg2pi_unique 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 | 1037 | |
| 
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 | 1038 | 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 | 1039 | 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 | 1040 | 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 | 1041 | |
| 61806 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1042 | 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 | 1043 | 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 | 1044 | 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 | 1045 | apply (simp add: norm_mult cmod_unit_one) | 
| 73932 
fd21b4a93043
added opaque_combs and renamed hide_lams to opaque_lifting
 desharna parents: 
72301diff
changeset | 1046 | by (metis (no_types, opaque_lifting) abs_le_D1 distrib_left mult.commute mult.left_commute mult_left_le) | 
| 61806 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1047 | qed | 
| 
d2e62ae01cd8
Cauchy's integral formula for circles.  Starting to fix eventually_mono.
 paulson <lp15@cam.ac.uk> parents: 
61762diff
changeset | 1048 | |
| 70136 | 1049 | 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 | 1050 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1051 | 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 | 1052 | 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 | 1053 | |
| 69508 | 1054 | 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 | 1055 | 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 | 1056 | 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 | 1057 | |
| 69508 | 1058 | 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 | 1059 | \<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 | 1060 | 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 | 1061 | |
| 69508 | 1062 | 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 | 1063 | 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 | 1064 | |
| 69508 | 1065 | 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 | 1066 | 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 | 1067 | |
| 69508 | 1068 | 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 | 1069 | 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 | 1070 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1071 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1072 | 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 | 1073 | |
| 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 | 1074 | 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 | 1075 | 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 | 1076 | |
| 70136 | 1077 | 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 | 1078 | 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 | 1079 | |
| 65585 
a043de9ad41e
Some fixes related to compactE_image
 paulson <lp15@cam.ac.uk> parents: 
65583diff
changeset | 1080 | 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 | 1081 | lemma | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1082 | 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 | 1083 | 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 | 1084 | 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 | 1085 | 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 | 1086 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1087 | 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 | 1088 | 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 | 1089 | 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 | 1090 | 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 | 1091 | using sincos_principal_value [of "\<psi>"] assms | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 1092 | 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 | 1093 | 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 | 1094 | 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 | 1095 | 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 | 1096 | 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 | 1097 | 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 | 1098 | 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 | 1099 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1100 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1101 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1102 | lemma Ln_exp [simp]: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1103 | 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 | 1104 | shows "ln(exp z) = z" | 
| 72301 | 1105 | proof (rule exp_complex_eqI) | 
| 1106 | show "\<bar>Im (ln (exp z)) - Im z\<bar> < 2 * pi" | |
| 1107 | using assms mpi_less_Im_Ln [of "exp z"] Im_Ln_le_pi [of "exp z"] by auto | |
| 1108 | qed auto | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1109 | |
| 70136 | 1110 | 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 | 1111 | |
| 
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 | 1112 | 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 | 1113 | 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 | 1114 | shows "ln(of_real z::complex) = of_real(ln z)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1115 | by (smt (verit) Im_complex_of_real Ln_exp assms exp_ln of_real_exp pi_ge_two) | 
| 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 | 1116 | |
| 70136 | 1117 | 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 | 1118 | 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 | 1119 | |
| 70136 | 1120 | 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 | 1121 | 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 | 1122 | |
| 61070 | 1123 | 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 | 1124 | 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 | 1125 | |
| 65719 | 1126 | lemma Ln_Reals_eq: "\<lbrakk>x \<in> \<real>; Re x > 0\<rbrakk> \<Longrightarrow> ln x = of_real (ln (Re x))" | 
| 1127 | using Ln_of_real by force | |
| 1128 | ||
| 65585 
a043de9ad41e
Some fixes related to compactE_image
 paulson <lp15@cam.ac.uk> parents: 
65583diff
changeset | 1129 | lemma Ln_1 [simp]: "ln 1 = (0::complex)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1130 | by (smt (verit, best) Ln_of_real ln_one of_real_0 of_real_1) | 
| 68493 | 1131 | |
| 65585 
a043de9ad41e
Some fixes related to compactE_image
 paulson <lp15@cam.ac.uk> parents: 
65583diff
changeset | 1132 | lemma Ln_eq_zero_iff [simp]: "x \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> ln x = 0 \<longleftrightarrow> x = 1" for x::complex | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1133 | by (metis (mono_tags, lifting) Ln_1 exp_Ln exp_zero nonpos_Reals_zero_I) | 
| 65585 
a043de9ad41e
Some fixes related to compactE_image
 paulson <lp15@cam.ac.uk> parents: 
65583diff
changeset | 1134 | |
| 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 | 1135 | 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 | 1136 | 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 | 1137 | |
| 
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 | 1138 | 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 | 1139 | |
| 
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 | 1140 | 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 | 1141 | 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 | 1142 | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1143 | 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 | 1144 | by (metis exp_Ln) | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1145 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1146 | 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 | 1147 | 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 | 1148 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1149 | lemma Re_Ln [simp]: "z \<noteq> 0 \<Longrightarrow> Re(Ln z) = ln(norm z)" | 
| 63092 | 1150 | 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 | 1151 | |
| 70136 | 1152 | 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 | 1153 | 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 | 1154 | 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 | 1155 | 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 | 1156 | |
| 70136 | 1157 | 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 | 1158 | 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 | 1159 | assumes "n \<noteq> 0" obtains w where "z = w ^ n" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1160 | by (metis assms exp_Ln exp_of_nat_mult nonzero_mult_div_cancel_left of_nat_eq_0_iff power_0_left times_divide_eq_right) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1161 | |
| 70136 | 1162 | 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 | 1163 | 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 | 1164 | 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 | 1165 | 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 | 1166 | 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 | 1167 | |
| 70136 | 1168 | 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 | 1169 | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1170 | lemma Im_Ln_less_pi: | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1171 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0"shows "Im (Ln z) < pi" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1172 | proof - | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1173 | have znz [simp]: "z \<noteq> 0" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1174 | using assms by auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1175 | with Im_Ln_le_pi [of z] show ?thesis | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1176 | by (smt (verit, best) Arg2pi_eq_0_pi Arg2pi_exp Ln_in_Reals assms complex_is_Real_iff complex_nonpos_Reals_iff exp_Ln pi_ge_two) | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1177 | qed | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1178 | |
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1179 | lemma has_field_derivative_Ln: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1180 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1181 | shows "(Ln has_field_derivative inverse(z)) (at z)" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1182 | proof - | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1183 | 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 | 1184 | using assms by auto | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1185 | then have "Im (Ln z) \<noteq> pi" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1186 | by (smt (verit, best) Arg2pi_eq_0_pi Arg2pi_exp Ln_in_Reals assms complex_is_Real_iff complex_nonpos_Reals_iff exp_Ln pi_ge_two) | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1187 |   let ?U = "{w. -pi < Im(w) \<and> Im(w) < pi}"
 | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1188 | have 1: "open ?U" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1189 | 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 | 1190 | have 2: "\<And>x. x \<in> ?U \<Longrightarrow> (exp has_derivative blinfun_apply(Blinfun ((*) (exp x)))) (at x)" | 
| 75494 | 1191 | by (simp add: bounded_linear_Blinfun_apply bounded_linear_mult_right has_field_derivative_imp_has_derivative) | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1192 | have 3: "continuous_on ?U (\<lambda>x. Blinfun ((*) (exp x)))" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1193 | unfolding blinfun_mult_right.abs_eq [symmetric] by (intro continuous_intros) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1194 | have 4: "Ln z \<in> ?U" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1195 | by (simp add: Im_Ln_less_pi assms mpi_less_Im_Ln) | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1196 | 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 | 1197 | 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 | 1198 | 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 | 1199 | and "Ln z \<in> U'" "open V" "z \<in> V" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1200 | and hom: "homeomorphism U' V exp g" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1201 | 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 | 1202 | 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 | 1203 | 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 | 1204 | using inverse_function_theorem [OF 1 2 3 4 5] | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1205 | 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 | 1206 | show "(Ln has_field_derivative inverse(z)) (at z)" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1207 | unfolding has_field_derivative_def | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1208 | proof (rule has_derivative_transform_within_open) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1209 | show g_eq_Ln: "g y = Ln y" if "y \<in> V" for y | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1210 | by (smt (verit, ccfv_threshold) Ln_exp hom homeomorphism_def imageI mem_Collect_eq sub subset_iff that) | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1211 | have "0 \<notin> V" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1212 | by (meson exp_not_eq_zero hom homeomorphism_def) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1213 | 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 | 1214 | by (metis exp_Ln g' g_eq_Ln) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1215 | then have g': "g' z = (\<lambda>x. x/z)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1216 | by (metis \<open>z \<in> V\<close> bij bij_inv_eq_iff exp_Ln g_eq_Ln nonzero_mult_div_cancel_left znz) | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1217 | show "(g has_derivative (*) (inverse z)) (at z)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1218 | using g [OF \<open>z \<in> V\<close>] g' by (simp add: divide_inverse_commute) | 
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 1219 | 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 | 1220 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1221 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1222 | 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 | 1223 | 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 | 1224 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1225 | 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 | 1226 | 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 | 1227 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1228 | 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 | 1229 | \<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 | 1230 | 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 | 1231 | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1232 | 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 | 1233 | 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 | 1234 | |
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
70196diff
changeset | 1235 | lemma isCont_Ln' [simp,continuous_intros]: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1236 | "\<lbrakk>isCont f z; f z \<notin> \<real>\<^sub>\<le>\<^sub>0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. Ln (f x)) z" | 
| 59862 | 1237 | by (blast intro: isCont_o2 [OF _ continuous_at_Ln]) | 
| 1238 | ||
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
70196diff
changeset | 1239 | 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 | 1240 | 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 | 1241 | |
| 67371 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1242 | 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 | 1243 | 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 | 1244 | |
| 68493 | 1245 | lemma continuous_on_Ln' [continuous_intros]: | 
| 67371 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1246 | "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 | 1247 | 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 | 1248 | |
| 73928 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 1249 | lemma holomorphic_on_Ln [holomorphic_intros]: "S \<inter> \<real>\<^sub>\<le>\<^sub>0 = {} \<Longrightarrow> Ln holomorphic_on S"
 | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 1250 | by (simp add: disjoint_iff 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 | 1251 | |
| 68721 | 1252 | lemma holomorphic_on_Ln' [holomorphic_intros]: | 
| 1253 | "(\<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" | |
| 1254 | using holomorphic_on_compose_gen[OF _ holomorphic_on_Ln, of f A "- \<real>\<^sub>\<le>\<^sub>0"] | |
| 1255 | by (auto simp: o_def) | |
| 1256 | ||
| 79857 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1257 | lemma analytic_on_ln [analytic_intros]: | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1258 |   assumes "f analytic_on A" "f ` A \<inter> \<real>\<^sub>\<le>\<^sub>0 = {}"
 | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1259 | shows "(\<lambda>w. ln (f w)) analytic_on A" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1260 | proof - | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1261 | have *: "ln analytic_on (-\<real>\<^sub>\<le>\<^sub>0)" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1262 | by (subst analytic_on_open) (auto intro!: holomorphic_intros) | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1263 | have "(ln \<circ> f) analytic_on A" | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1264 | by (rule analytic_on_compose_gen[OF assms(1) *]) (use assms(2) in auto) | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1265 | thus ?thesis | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1266 | by (simp add: o_def) | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1267 | qed | 
| 
819c28a7280f
New material by Wenda Li and Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
79670diff
changeset | 1268 | |
| 67371 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1269 | lemma tendsto_Ln [tendsto_intros]: | 
| 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1270 | 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 | 1271 | shows "((\<lambda>x. Ln (f x)) \<longlongrightarrow> Ln L) F" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1272 | by (simp add: assms isCont_tendsto_compose) | 
| 67371 
2d9cf74943e1
moved in some material from Euler-MacLaurin
 paulson <lp15@cam.ac.uk> parents: 
67278diff
changeset | 1273 | |
| 65719 | 1274 | lemma divide_ln_mono: | 
| 1275 | fixes x y::real | |
| 1276 | assumes "3 \<le> x" "x \<le> y" | |
| 1277 | shows "x / ln x \<le> y / ln y" | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1278 | proof - | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1279 | have "\<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 | 1280 | using \<open>3 \<le> x\<close> by (force intro!: derivative_eq_intros simp: field_simps power_eq_if) | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1281 | moreover | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1282 | have "x / ln x \<le> y / ln y" | 
| 65719 | 1283 | if "Re (y / Ln y) - Re (x / Ln x) = (Re (1 / Ln u) - Re (1 / (Ln u)\<^sup>2)) * (y - x)" | 
| 1284 | and x: "x \<le> u" "u \<le> y" for u | |
| 1285 | proof - | |
| 1286 | have eq: "y / ln y = (1 / ln u - 1 / (ln u)\<^sup>2) * (y - x) + x / ln x" | |
| 1287 | using that \<open>3 \<le> x\<close> by (auto simp: Ln_Reals_eq in_Reals_norm group_add_class.diff_eq_eq) | |
| 1288 | show ?thesis | |
| 1289 | using exp_le \<open>3 \<le> x\<close> x by (simp add: eq) (simp add: power_eq_if divide_simps ln_ge_iff) | |
| 1290 | qed | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1291 | ultimately show ?thesis | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1292 | using complex_mvt_line [of x y "\<lambda>z. z / Ln z" "\<lambda>z. 1/(Ln z) - 1/(Ln z)^2"] assms | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1293 | by (force simp add: closed_segment_Reals closed_segment_eq_real_ivl) | 
| 65719 | 1294 | qed | 
| 68493 | 1295 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1296 | theorem Ln_series: | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1297 | fixes z :: complex | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1298 | assumes "norm z < 1" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1299 | 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 | 1300 | proof - | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1301 | 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 | 1302 | have r: "conv_radius ?f = 1" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1303 | 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 | 1304 | (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 | 1305 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1306 | 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 | 1307 | proof (rule has_field_derivative_zero_constant) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1308 | 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 | 1309 | hence z: "norm z < 1" by simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1310 | 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 | 1311 | 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 | 1312 | 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 | 1313 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1314 | have "Re (-z) \<le> norm (-z)" by (rule complex_Re_le_cmod) | 
| 76137 | 1315 | also from z have "\<dots> < 1" by simp | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1316 | 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 | 1317 | 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 | 1318 | 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 | 1319 | 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 | 1320 | 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 | 1321 | (at z within ball 0 1)" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1322 | 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 | 1323 | 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 | 1324 | 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 | 1325 | 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 | 1326 | 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 | 1327 | 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 | 1328 | 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 | 1329 | 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 | 1330 | qed simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1331 | 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 | 1332 | 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 | 1333 | 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 | 1334 | 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 | 1335 | by (intro summable_in_conv_radius) simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1336 | ultimately show ?thesis by (simp add: sums_iff) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1337 | qed | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1338 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1339 | 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 | 1340 | by (drule Ln_series) (simp add: power_minus') | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1341 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1342 | lemma ln_series': | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1343 | fixes x::real | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1344 | assumes "\<bar>x\<bar> < 1" | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1345 | 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 | 1346 | proof - | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1347 | 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 | 1348 | by (intro Ln_series') simp_all | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1349 | 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 | 1350 | by (rule ext) simp | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1351 | also from assms have "ln (1 + complex_of_real x) = of_real (ln (1 + x))" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1352 | by (smt (verit) Ln_of_real of_real_1 of_real_add) | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1353 | 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 | 1354 | qed | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1355 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1356 | lemma Ln_approx_linear: | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1357 | fixes z :: complex | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1358 | assumes "norm z < 1" | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1359 | 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 | 1360 | proof - | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1361 | 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 | 1362 | 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 | 1363 | 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 | 1364 | 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 | 1365 | 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 | 1366 | 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 | 1367 | 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 | 1368 | 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 | 1369 | 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 | 1370 | by (simp add: sums_iff) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1371 | 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 | 1372 | 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 | 1373 | (auto simp: assms field_simps intro!: always_eventually) | 
| 75494 | 1374 | hence "norm (\<Sum>i. (-(z^2)) * inverse (of_nat (i+2)) * (-z)^i) | 
| 72301 | 1375 | \<le> (\<Sum>i. norm (-(z^2) * inverse (of_nat (i+2)) * (-z)^i))" | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1376 | by (intro summable_norm) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1377 | (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 | 1378 | 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 | 1379 | 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 | 1380 | hence "(\<Sum>i. norm (-(z^2) * inverse (of_nat (i+2)) * (-z)^i)) | 
| 72301 | 1381 | \<le> (\<Sum>i. norm (-(z^2) * (-z)^i))" | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1382 | using A assms | 
| 72301 | 1383 | unfolding norm_power norm_inverse norm_divide norm_mult | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1384 | apply (intro suminf_le summable_mult summable_geometric) | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1385 | 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 | 1386 | done | 
| 76137 | 1387 | also have "\<dots> = norm z^2 * (\<Sum>i. norm z^i)" using assms | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1388 | 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 | 1389 | 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 | 1390 | by (subst suminf_geometric) (simp_all add: divide_inverse) | 
| 76137 | 1391 | also have "norm z^2 * \<dots> = norm z^2 / (1 - norm z)" by (simp add: divide_inverse) | 
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1392 | finally show ?thesis . | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1393 | qed | 
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1394 | |
| 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 1395 | |
| 76722 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1396 | lemma norm_Ln_le: | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1397 | fixes z :: complex | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1398 | assumes "norm z < 1/2" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1399 | shows "norm (Ln(1+z)) \<le> 2 * norm z" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1400 | proof - | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1401 | have sums: "(\<lambda>n. - ((- z) ^ n) / of_nat n) sums ln (1 + z)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1402 | by (intro Ln_series') (use assms in auto) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1403 | have summable: "summable (\<lambda>n. norm (- ((- z) ^ n / of_nat n)))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1404 | using ln_series'[of "-norm z"] assms | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1405 | by (simp add: sums_iff summable_minus_iff norm_power norm_divide) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1406 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1407 | have "norm (ln (1 + z)) = norm (\<Sum>n. -((-z) ^ n / of_nat n))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1408 | using sums by (simp add: sums_iff) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1409 | also have "\<dots> \<le> (\<Sum>n. norm (-((-z) ^ n / of_nat n)))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1410 | using summable by (rule summable_norm) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1411 | also have "\<dots> = (\<Sum>n. norm (-((-z) ^ Suc n / of_nat (Suc n))))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1412 | using summable by (subst suminf_split_head) auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1413 | also have "\<dots> \<le> (\<Sum>n. norm z * (1 / 2) ^ n)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1414 | proof (rule suminf_le) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1415 | show "summable (\<lambda>n. norm z * (1 / 2) ^ n)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1416 | by (intro summable_mult summable_geometric) auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1417 | next | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1418 | show "summable (\<lambda>n. norm (- ((- z) ^ Suc n / of_nat (Suc n))))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1419 | using summable by (subst summable_Suc_iff) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1420 | next | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1421 | fix n | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1422 | have "norm (-((-z) ^ Suc n / of_nat (Suc n))) = norm z * (norm z ^ n / real (Suc n))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1423 | by (simp add: norm_power norm_divide norm_mult del: of_nat_Suc) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1424 | also have "\<dots> \<le> norm z * ((1 / 2) ^ n / 1)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1425 | using assms by (intro mult_left_mono frac_le power_mono) auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1426 | finally show "norm (- ((- z) ^ Suc n / of_nat (Suc n))) \<le> norm z * (1 / 2) ^ n" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1427 | by simp | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1428 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1429 | also have "\<dots> = norm z * (\<Sum>n. (1 / 2) ^ n)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1430 | by (subst suminf_mult) (auto intro: summable_geometric) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1431 | also have "(\<Sum>n. (1 / 2 :: real) ^ n) = 2" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1432 | using geometric_sums[of "1 / 2 :: real"] by (simp add: sums_iff) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1433 | finally show ?thesis | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1434 | by (simp add: mult_ac) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1435 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1436 | |
| 70136 | 1437 | 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 | 1438 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1439 | 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 | 1440 | 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 | 1441 | by simp | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1442 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1443 | 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 | 1444 | assumes "z \<noteq> 0" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1445 | 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 | 1446 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1447 |   { fix w
 | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1448 | assume "w = Ln z" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1449 | 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 | 1450 | 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 | 1451 | by auto | 
| 61945 | 1452 | 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 | 1453 | using cos_lt_zero_pi [of "- (Im w)"] cos_lt_zero_pi [of "(Im w)"] not_le | 
| 72301 | 1454 | by (auto simp: Re_exp zero_le_mult_iff abs_if intro: cos_ge_zero) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1455 | } | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1456 | 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 | 1457 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1458 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1459 | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1460 | lemma Re_Ln_pos_lt: | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1461 | assumes "z \<noteq> 0" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1462 | shows "\<bar>Im(Ln z)\<bar> < pi/2 \<longleftrightarrow> 0 < Re(z)" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1463 | using Re_Ln_pos_le assms | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1464 | by (smt (verit) Re_exp arccos_cos cos_minus cos_pi_half exp_Ln exp_gt_zero field_sum_of_halves mult_eq_0_iff) | 
| 72301 | 1465 | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1466 | 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 | 1467 | assumes "z \<noteq> 0" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1468 | 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 | 1469 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1470 |   { fix w
 | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1471 | assume "w = Ln z" | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1472 | 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 | 1473 | 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 | 1474 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1475 | then have "0 \<le> Im w \<and> Im w \<le> pi \<longleftrightarrow> 0 \<le> Im(exp w)" | 
| 72301 | 1476 | using sin_ge_zero [of "- (Im w)"] sin_ge_zero [of "abs(Im w)"] sin_zero_pi_iff [of "Im w"] | 
| 1477 | by (force simp: Im_exp zero_le_mult_iff sin_ge_zero) } | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1478 | 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 | 1479 | by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1480 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1481 | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1482 | lemma Im_Ln_pos_lt: | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1483 | assumes "z \<noteq> 0" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1484 | shows "0 < Im(Ln z) \<and> Im(Ln z) < pi \<longleftrightarrow> 0 < Im(z)" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1485 | using Im_Ln_pos_le [OF assms] assms | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1486 | by (smt (verit, best) Arg2pi_exp Arg2pi_lt_pi exp_Ln) | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1487 | |
| 61945 | 1488 | 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 | 1489 | 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 | 1490 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1491 | 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 | 1492 | 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 | 1493 | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1494 | 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 | 1495 | lemma Im_Ln_eq_0: "z \<noteq> 0 \<Longrightarrow> (Im(Ln z) = 0 \<longleftrightarrow> 0 < Re(z) \<and> Im(z) = 0)" | 
| 76137 | 1496 | using Im_Ln_pos_le Im_Ln_pos_lt Re_Ln_pos_lt by fastforce | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1497 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1498 | lemma Im_Ln_eq_pi: "z \<noteq> 0 \<Longrightarrow> (Im(Ln z) = pi \<longleftrightarrow> Re(z) < 0 \<and> Im(z) = 0)" | 
| 76137 | 1499 | using Im_Ln_eq_0 Im_Ln_pos_le Im_Ln_pos_lt complex.expand by fastforce | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1500 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1501 | |
| 70136 | 1502 | 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 | 1503 | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1504 | 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 | 1505 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1506 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1507 | show ?thesis | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1508 | by (smt (verit) False Im_Ln_less_pi Ln_exp assms cnj.sel(2) exp_Ln exp_cnj mpi_less_Im_Ln) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1509 | qed (use assms in auto) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1510 | |
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1511 | |
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1512 | 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 | 1513 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1514 | case False | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1515 | show ?thesis | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1516 | by (smt (verit) False Im_Ln_less_pi Ln_exp assms exp_Ln exp_minus mpi_less_Im_Ln uminus_complex.sel(2)) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1517 | 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 | 1518 | |
| 63589 | 1519 | lemma Ln_minus1 [simp]: "Ln(-1) = \<i> * pi" | 
| 72301 | 1520 | proof (rule exp_complex_eqI) | 
| 1521 | show "\<bar>Im (Ln (- 1)) - Im (\<i> * pi)\<bar> < 2 * pi" | |
| 1522 | using Im_Ln_le_pi [of "-1"] mpi_less_Im_Ln [of "-1"] by auto | |
| 1523 | qed auto | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1524 | |
| 63589 | 1525 | lemma Ln_ii [simp]: "Ln \<i> = \<i> * of_real pi/2" | 
| 1526 | 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 | 1527 | unfolding exp_Euler | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1528 | by simp | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1529 | |
| 63589 | 1530 | lemma Ln_minus_ii [simp]: "Ln(-\<i>) = - (\<i> * pi/2)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1531 | using Ln_inverse by fastforce | 
| 59751 
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 Ln_times: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1534 | 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 | 1535 | shows "Ln(w * z) = | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 1536 | (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 | 1537 | 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 | 1538 | 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 | 1539 | 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 | 1540 | 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 | 1541 | 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 | 1542 | |
| 70136 | 1543 | 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 | 1544 | "\<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 | 1545 | \<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 | 1546 | 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 | 1547 | |
| 70136 | 1548 | 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 | 1549 | "\<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 | 1550 | 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 | 1551 | 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 | 1552 | |
| 73928 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 1553 | corollary\<^marker>\<open>tag unimportant\<close> Ln_times_of_nat: | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 1554 | "\<lbrakk>r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(of_nat r * z :: complex) = ln (of_nat r) + Ln(z)" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 1555 | using Ln_times_of_real[of "of_nat r" z] by simp | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 1556 | |
| 70136 | 1557 | 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 | 1558 | "\<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 | 1559 | 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 | 1560 | |
| 70136 | 1561 | corollary\<^marker>\<open>tag unimportant\<close> Ln_divide_of_real: | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1562 | "\<lbrakk>r > 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> Ln(z / of_real r) = Ln(z) - ln r" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1563 | using Ln_times_of_real [of "inverse r" z] | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1564 | by (simp add: ln_inverse Ln_of_real mult.commute divide_inverse flip: of_real_inverse) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 1565 | |
| 70136 | 1566 | 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 | 1567 | fixes f :: "'a \<Rightarrow> complex" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1568 | 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 | 1569 | 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 | 1570 | using assms | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1571 | proof (induction A) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1572 | case (insert x A) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1573 | 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 | 1574 | by auto | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1575 | 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 | 1576 | 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 | 1577 | 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 | 1578 | by (auto simp: insert.hyps insert.prems) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1579 | 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 | 1580 | 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 | 1581 | qed auto | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1582 | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1583 | lemma Ln_minus: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1584 | assumes "z \<noteq> 0" | 
| 69508 | 1585 | shows "Ln(-z) = (if Im(z) \<le> 0 \<and> \<not>(Re(z) < 0 \<and> Im(z) = 0) | 
| 63589 | 1586 | then Ln(z) + \<i> * pi | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1587 | else Ln(z) - \<i> * pi)" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1588 | 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 | 1589 | Im_Ln_eq_pi [of z] Im_Ln_pos_lt [of z] | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1590 | by (intro Ln_unique) (auto simp: exp_add exp_diff) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1591 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1592 | lemma Ln_inverse_if: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1593 | assumes "z \<noteq> 0" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1594 | 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 | 1595 | proof (cases "z \<in> \<real>\<^sub>\<le>\<^sub>0") | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1596 | 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 | 1597 | 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 | 1598 | next | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1599 | case True | 
| 72301 | 1600 | then have z: "Im z = 0" "Re z < 0" "- z \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 1601 | using assms complex_eq_iff complex_nonpos_Reals_iff by auto | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1602 | 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 | 1603 | by simp | 
| 76137 | 1604 | also have "\<dots> = Ln (inverse (-z)) + \<i> * complex_of_real pi" | 
| 72301 | 1605 | using assms z by (simp add: Ln_minus divide_less_0_iff) | 
| 76137 | 1606 | also have "\<dots> = - Ln (- z) + \<i> * complex_of_real pi" | 
| 72301 | 1607 | using z Ln_inverse by presburger | 
| 76137 | 1608 | also have "\<dots> = - (Ln z) + \<i> * 2 * complex_of_real pi" | 
| 72301 | 1609 | using Ln_minus assms z by auto | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 1610 | 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 | 1611 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1612 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1613 | lemma Ln_times_ii: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 1614 | assumes "z \<noteq> 0" | 
| 63589 | 1615 | shows "Ln(\<i> * z) = (if 0 \<le> Re(z) | Im(z) < 0 | 
| 1616 | then Ln(z) + \<i> * of_real pi/2 | |
| 1617 | 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 | 1618 | 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 | 1619 | 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 | 1620 | 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 | 1621 | |
| 65587 
16a8991ab398
New material (and some tidying) purely in the Analysis directory
 paulson <lp15@cam.ac.uk> parents: 
65585diff
changeset | 1622 | lemma Ln_of_nat [simp]: "0 < n \<Longrightarrow> Ln (of_nat n) = of_real (ln (of_nat n))" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1623 | by (metis Ln_of_real of_nat_0_less_iff of_real_of_nat_eq) | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1624 | |
| 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 | 1625 | lemma Ln_of_nat_over_of_nat: | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1626 | assumes "m > 0" "n > 0" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1627 | 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 | 1628 | proof - | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1629 | have "of_nat m / of_nat n = (of_real (of_nat m / of_nat n) :: complex)" by simp | 
| 76137 | 1630 | also from assms have "Ln \<dots> = of_real (ln (of_nat m / of_nat n))" | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1631 | by (simp add: Ln_of_real[symmetric]) | 
| 76137 | 1632 | also from assms have "\<dots> = of_real (ln (of_nat m) - ln (of_nat n))" | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1633 | by (simp add: ln_div) | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1634 | finally show ?thesis . | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1635 | qed | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 1636 | |
| 76722 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1637 | lemma norm_Ln_times_le: | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1638 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1639 | shows "cmod (Ln(w * z)) \<le> cmod (Ln(w) + Ln(z))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1640 | proof (cases "- pi < Im(Ln w + Ln z) \<and> Im(Ln w + Ln z) \<le> pi") | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1641 | case True | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1642 | then show ?thesis | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1643 | by (simp add: Ln_times_simple assms) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1644 | next | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1645 | case False | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1646 | then show ?thesis | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1647 | by (smt (verit) Im_Ln_le_pi assms cmod_Im_le_iff exp_Ln exp_add ln_unique mpi_less_Im_Ln mult_eq_0_iff norm_exp_eq_Re) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1648 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1649 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1650 | corollary norm_Ln_prod_le: | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1651 | fixes f :: "'a \<Rightarrow> complex" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1652 | assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<noteq> 0" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1653 | shows "cmod (Ln (prod f A)) \<le> (\<Sum>x \<in> A. cmod (Ln (f x)))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1654 | using assms | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1655 | proof (induction A rule: infinite_finite_induct) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1656 | case (insert x A) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1657 | then show ?case | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1658 | by simp (smt (verit) norm_Ln_times_le norm_triangle_ineq prod_zero_iff) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1659 | qed auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1660 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1661 | lemma norm_Ln_exp_le: "norm (Ln (exp z)) \<le> norm z" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1662 | by (smt (verit) Im_Ln_le_pi Ln_exp Re_Ln cmod_Im_le_iff exp_not_eq_zero ln_exp mpi_less_Im_Ln norm_exp_eq_Re) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1663 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1664 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Uniform convergence and products\<close> | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1665 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1666 | (* TODO: could be generalised perhaps, but then one would have to do without the ln *) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1667 | lemma uniformly_convergent_on_prod_aux: | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1668 | fixes f :: "nat \<Rightarrow> complex \<Rightarrow> complex" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1669 | assumes norm_f: "\<And>n x. x \<in> A \<Longrightarrow> norm (f n x) < 1" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1670 | assumes cont: "\<And>n. continuous_on A (f n)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1671 | assumes conv: "uniformly_convergent_on A (\<lambda>N x. \<Sum>n<N. ln (1 + f n x))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1672 | assumes A: "compact A" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1673 | shows "uniformly_convergent_on A (\<lambda>N x. \<Prod>n<N. 1 + f n x)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1674 | proof - | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1675 | from conv obtain S where S: "uniform_limit A (\<lambda>N x. \<Sum>n<N. ln (1 + f n x)) S sequentially" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1676 | by (auto simp: uniformly_convergent_on_def) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1677 | have cont': "continuous_on A S" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1678 | proof (rule uniform_limit_theorem[OF _ S]) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1679 | have "f n x + 1 \<notin> \<real>\<^sub>\<le>\<^sub>0" if "x \<in> A" for n x | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1680 | proof | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1681 | assume "f n x + 1 \<in> \<real>\<^sub>\<le>\<^sub>0" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1682 | then obtain t where t: "t \<le> 0" "f n x = of_real (t - 1)" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1683 | by (metis add_diff_cancel nonpos_Reals_cases of_real_1 of_real_diff) | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1684 | moreover have "norm \<dots> \<ge> 1" | 
| 76722 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1685 | using t by (subst norm_of_real) auto | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1686 | ultimately show False | 
| 76722 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1687 | using norm_f[of x n] that by auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1688 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1689 | thus "\<forall>\<^sub>F n in sequentially. continuous_on A (\<lambda>x. \<Sum>n<n. Ln (1 + f n x))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1690 | by (auto intro!: always_eventually continuous_intros cont simp: add_ac) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1691 | qed auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1692 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1693 |   define B where "B = {x + y |x y. x \<in> S ` A \<and> y \<in> cball 0 1}"
 | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1694 | have "compact B" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1695 | unfolding B_def by (intro compact_sums compact_continuous_image cont' A) auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1696 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1697 | have "uniformly_convergent_on A (\<lambda>N x. exp ((\<Sum>n<N. ln (1 + f n x))))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1698 | using conv | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1699 | proof (rule uniformly_convergent_on_compose_uniformly_continuous_on) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1700 | show "closed B" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1701 | using \<open>compact B\<close> by (auto dest: compact_imp_closed) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1702 | show "uniformly_continuous_on B exp" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1703 | by (intro compact_uniformly_continuous continuous_intros \<open>compact B\<close>) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1704 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1705 | have "eventually (\<lambda>N. \<forall>x\<in>A. dist (\<Sum>n<N. Ln (1 + f n x)) (S x) < 1) sequentially" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1706 | using S unfolding uniform_limit_iff by simp | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1707 | thus "eventually (\<lambda>N. \<forall>x\<in>A. (\<Sum>n<N. Ln (1 + f n x)) \<in> B) sequentially" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1708 | proof eventually_elim | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1709 | case (elim N) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1710 | show "\<forall>x\<in>A. (\<Sum>n<N. Ln (1 + f n x)) \<in> B" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1711 | proof safe | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1712 | fix x assume x: "x \<in> A" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1713 | have "(\<Sum>n<N. Ln (1 + f n x)) = S x + ((\<Sum>n<N. Ln (1 + f n x)) - S x)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1714 | by auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1715 | moreover have "((\<Sum>n<N. Ln (1 + f n x)) - S x) \<in> ball 0 1" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1716 | using elim x by (auto simp: dist_norm norm_minus_commute) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1717 | ultimately show "(\<Sum>n<N. Ln (1 + f n x)) \<in> B" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1718 | unfolding B_def using x by fastforce | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1719 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1720 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1721 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1722 | also have "?this \<longleftrightarrow> uniformly_convergent_on A (\<lambda>N x. \<Prod>n<N. 1 + f n x)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1723 | proof (intro uniformly_convergent_cong refl always_eventually allI ballI) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1724 | fix N :: nat and x assume x: "x \<in> A" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1725 | have "exp (\<Sum>n<N. ln (1 + f n x)) = (\<Prod>n<N. exp (ln (1 + f n x)))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1726 | by (simp add: exp_sum) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1727 | also have "\<dots> = (\<Prod>n<N. 1 + f n x)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1728 | using norm_f[of x] x | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1729 | by (smt (verit, best) add.right_neutral add_diff_cancel exp_Ln norm_minus_commute norm_one prod.cong) | 
| 76722 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1730 | finally show "exp (\<Sum>n<N. ln (1 + f n x)) = (\<Prod>n<N. 1 + f n x)" . | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1731 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1732 | finally show ?thesis . | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1733 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1734 | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1735 | text \<open>Theorem 17.6 by Bak and Newman, Complex Analysis [roughly]\<close> | 
| 76722 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1736 | lemma uniformly_convergent_on_prod: | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1737 | fixes f :: "nat \<Rightarrow> complex \<Rightarrow> complex" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1738 | assumes cont: "\<And>n. continuous_on A (f n)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1739 | assumes A: "compact A" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1740 | assumes conv_sum: "uniformly_convergent_on A (\<lambda>N x. \<Sum>n<N. norm (f n x))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1741 | shows "uniformly_convergent_on A (\<lambda>N x. \<Prod>n<N. 1 + f n x)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1742 | proof - | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1743 | obtain M where M: "\<And>n x. n \<ge> M \<Longrightarrow> x \<in> A \<Longrightarrow> norm (f n x) < 1 / 2" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1744 | proof - | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1745 | from conv_sum have "uniformly_Cauchy_on A (\<lambda>N x. \<Sum>n<N. norm (f n x))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1746 | using uniformly_convergent_Cauchy by blast | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1747 | moreover have "(1 / 2 :: real) > 0" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1748 | by simp | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1749 | ultimately obtain M where M: | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1750 | "\<And>x m n. x \<in> A \<Longrightarrow> m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> dist (\<Sum>k<m. norm (f k x)) (\<Sum>k<n. norm (f k x)) < 1 / 2" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1751 | unfolding uniformly_Cauchy_on_def by fast | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1752 | show ?thesis | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1753 | proof (rule that[of M]) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1754 | fix n x assume nx: "n \<ge> M" "x \<in> A" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1755 | have "dist (\<Sum>k<Suc n. norm (f k x)) (\<Sum>k<n. norm (f k x)) < 1 / 2" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1756 | by (rule M) (use nx in auto) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1757 | also have "dist (\<Sum>k<Suc n. norm (f k x)) (\<Sum>k<n. norm (f k x)) = norm (f n x)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1758 | by (simp add: dist_norm) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1759 | finally show "norm (f n x) < 1 / 2" . | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1760 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1761 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1762 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1763 | have conv: "uniformly_convergent_on A (\<lambda>N x. \<Sum>n<N. ln (1 + f (n + M) x))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1764 | proof (rule uniformly_summable_comparison_test) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1765 | show "norm (ln (1 + f (n + M) x)) \<le> 2 * norm (f (n + M) x)" if "x \<in> A" for n x | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1766 | by (rule norm_Ln_le) (use M[of "n + M" x] that in auto) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1767 | have *: "filterlim (\<lambda>n. n + M) at_top at_top" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1768 | by (rule filterlim_add_const_nat_at_top) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1769 | have "uniformly_convergent_on A (\<lambda>N x. 2 * ((\<Sum>n<N+M. norm (f n x)) - (\<Sum>n<M. norm (f n x))))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1770 | by (intro uniformly_convergent_mult uniformly_convergent_minus | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1771 | uniformly_convergent_on_compose[OF conv_sum *] uniformly_convergent_on_const) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1772 | also have "(\<lambda>N x. 2 * ((\<Sum>n<N+M. norm (f n x)) - (\<Sum>n<M. norm (f n x)))) = | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1773 | (\<lambda>N x. \<Sum>n<N. 2 * norm (f (n + M) x))" (is "?lhs = ?rhs") | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1774 | proof (intro ext) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1775 | fix N x | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1776 |       have "(\<Sum>n<N+M. norm (f n x)) - (\<Sum>n<M. norm (f n x)) = (\<Sum>n\<in>{..<N+M}-{..<M}. norm (f n x))"
 | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1777 | by (subst sum_diff) auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1778 | also have "\<dots> = (\<Sum>n<N. norm (f (n + M) x))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1779 | by (intro sum.reindex_bij_witness[of _ "\<lambda>n. n + M" "\<lambda>n. n - M"]) auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1780 | finally show "?lhs N x = ?rhs N x" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1781 | by (simp add: sum_distrib_left) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1782 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1783 | finally show "uniformly_convergent_on A (\<lambda>N x. \<Sum>n<N. 2 * cmod (f (n + M) x))" . | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1784 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1785 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1786 | have conv': "uniformly_convergent_on A (\<lambda>N x. \<Prod>n<N. 1 + f (n + M) x)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1787 | proof (rule uniformly_convergent_on_prod_aux) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1788 | show "norm (f (n + M) x) < 1" if "x \<in> A" for n x | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1789 | using M[of "n + M" x] that by simp | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1790 | qed (use M assms conv in auto) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1791 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1792 | then obtain S where S: "uniform_limit A (\<lambda>N x. \<Prod>n<N. 1 + f (n + M) x) S sequentially" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1793 | by (auto simp: uniformly_convergent_on_def) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1794 | have cont': "continuous_on A S" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1795 | by (intro uniform_limit_theorem[OF _ S] always_eventually ballI allI continuous_intros cont) auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1796 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1797 | have "uniform_limit A (\<lambda>N x. (\<Prod>n<M. 1 + f n x) * (\<Prod>n<N. 1 + f (n + M) x)) (\<lambda>x. (\<Prod>n<M. 1 + f n x) * S x) sequentially" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1798 | proof (rule uniform_lim_mult[OF uniform_limit_const S]) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1799 | show "bounded (S ` A)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1800 | by (intro compact_imp_bounded compact_continuous_image A cont') | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1801 | show "bounded ((\<lambda>x. \<Prod>n<M. 1 + f n x) ` A)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1802 | by (intro compact_imp_bounded compact_continuous_image A continuous_intros cont) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1803 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1804 | hence "uniformly_convergent_on A (\<lambda>N x. (\<Prod>n<M. 1 + f n x) * (\<Prod>n<N. 1 + f (n + M) x))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1805 | by (auto simp: uniformly_convergent_on_def) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1806 | also have "(\<lambda>N x. (\<Prod>n<M. 1 + f n x) * (\<Prod>n<N. 1 + f (n + M) x)) = (\<lambda>N x. (\<Prod>n<M+N. 1 + f n x))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1807 | proof (intro ext) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1808 | fix N :: nat and x :: complex | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1809 |     have "(\<Prod>n<N. 1 + f (n + M) x) = (\<Prod>n\<in>{M..<M+N}. 1 + f n x)"
 | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1810 | by (intro prod.reindex_bij_witness[of _ "\<lambda>n. n - M" "\<lambda>n. n + M"]) auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1811 |     also have "(\<Prod>n<M. 1 + f n x) * \<dots> = (\<Prod>n\<in>{..<M}\<union>{M..<M+N}. 1 + f n x)"
 | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1812 | by (subst prod.union_disjoint) auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1813 |     also have "{..<M} \<union> {M..<M+N} = {..<M+N}"
 | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1814 | by auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1815 | finally show "(\<Prod>n<M. 1 + f n x) * (\<Prod>n<N. 1 + f (n + M) x) = (\<Prod>n<M+N. 1 + f n x)" . | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1816 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1817 | finally have "uniformly_convergent_on A (\<lambda>N x. \<Prod>n<M + N. 1 + f n x)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1818 | by simp | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1819 | hence "uniformly_convergent_on A (\<lambda>N x. \<Prod>n<M + (N - M). 1 + f n x)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1820 | by (rule uniformly_convergent_on_compose) (rule filterlim_minus_const_nat_at_top) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1821 | also have "?this \<longleftrightarrow> ?thesis" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1822 | proof (rule uniformly_convergent_cong) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1823 | show "eventually (\<lambda>x. \<forall>y\<in>A. (\<Prod>n<M + (x - M). 1 + f n y) = (\<Prod>n<x. 1 + f n y)) at_top" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1824 | using eventually_ge_at_top[of M] by eventually_elim auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1825 | qed auto | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1826 | finally show ?thesis . | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1827 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1828 | |
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1829 | lemma uniformly_convergent_on_prod': | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1830 | fixes f :: "nat \<Rightarrow> complex \<Rightarrow> complex" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1831 | assumes cont: "\<And>n. continuous_on A (f n)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1832 | assumes A: "compact A" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1833 | assumes conv_sum: "uniformly_convergent_on A (\<lambda>N x. \<Sum>n<N. norm (f n x - 1))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1834 | shows "uniformly_convergent_on A (\<lambda>N x. \<Prod>n<N. f n x)" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1835 | proof - | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1836 | have "uniformly_convergent_on A (\<lambda>N x. \<Prod>n<N. 1 + (f n x - 1))" | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1837 | by (rule uniformly_convergent_on_prod) (use assms in \<open>auto intro!: continuous_intros\<close>) | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1838 | thus ?thesis | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1839 | by simp | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1840 | qed | 
| 
b1d57dd345e1
First round of moving material from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
76137diff
changeset | 1841 | |
| 76724 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1842 | text\<open>Prop 17.6 of Bak and Newman, Complex Analysis, p. 243. | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1843 | Only this version is for the reals. Can the two proofs be consolidated?\<close> | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1844 | lemma uniformly_convergent_on_prod_real: | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1845 | fixes u :: "nat \<Rightarrow> real \<Rightarrow> real" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1846 | assumes contu: "\<And>k. continuous_on K (u k)" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1847 | and uconv: "uniformly_convergent_on K (\<lambda>n x. \<Sum>k<n. \<bar>u k x\<bar>)" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1848 | and K: "compact K" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1849 | shows "uniformly_convergent_on K (\<lambda>n x. \<Prod>k<n. 1 + u k x)" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1850 | proof - | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1851 | define f where "f \<equiv> \<lambda>k. complex_of_real \<circ> u k \<circ> Re" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1852 | define L where "L \<equiv> complex_of_real ` K" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1853 | have "compact L" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1854 | by (simp add: \<open>compact K\<close> L_def compact_continuous_image) | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1855 | have "Re ` complex_of_real ` X = X" for X | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1856 | by (auto simp: image_iff) | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1857 | with contu have contf: "\<And>k. continuous_on L (f k)" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1858 | unfolding f_def L_def by (intro continuous_intros) auto | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1859 | obtain S where S: "\<And>\<epsilon>. \<epsilon>>0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially. \<forall>x\<in>K. dist (\<Sum>k<n. \<bar>u k x\<bar>) (S x) < \<epsilon>" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1860 | using uconv unfolding uniformly_convergent_on_def uniform_limit_iff by presburger | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1861 | have "\<forall>\<^sub>F n in sequentially. \<forall>z\<in>L. dist (\<Sum>k<n. cmod (f k z)) ((of_real \<circ> S \<circ> Re) z) < \<epsilon>" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1862 | if "\<epsilon>>0" for \<epsilon> | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1863 | using S [OF that] by eventually_elim (simp add: L_def f_def) | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1864 | then have uconvf: "uniformly_convergent_on L (\<lambda>n z. \<Sum>k<n. norm (f k z))" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1865 | unfolding uniformly_convergent_on_def uniform_limit_iff by blast | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1866 | obtain P where P: "\<And>\<epsilon>. \<epsilon>>0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially. \<forall>z\<in>L. dist (\<Prod>k<n. 1 + f k z) (P z) < \<epsilon>" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1867 | using uniformly_convergent_on_prod [OF contf \<open>compact L\<close> uconvf] | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1868 | unfolding uniformly_convergent_on_def uniform_limit_iff by blast | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1869 | have \<section>: "\<bar>(\<Prod>k<n. 1 + u k x) - Re (P x)\<bar> \<le> cmod ((\<Prod>k<n. 1 + of_real (u k x)) - P x)" for n x | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1870 | proof - | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1871 | have "(\<Prod>k\<in>N. of_real (1 + u k x)) = (\<Prod>k\<in>N. 1 + of_real (u k x))" for N | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1872 | by force | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1873 | then show ?thesis | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1874 | by (metis Re_complex_of_real abs_Re_le_cmod minus_complex.sel(1) of_real_prod) | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1875 | qed | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1876 | have "\<forall>\<^sub>F n in sequentially. \<forall>x\<in>K. dist (\<Prod>k<n. 1 + u k x) ((Re \<circ> P \<circ> of_real) x) < \<epsilon>" | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1877 | if "\<epsilon>>0" for \<epsilon> | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1878 | using P [OF that] by eventually_elim (simp add: L_def f_def dist_norm le_less_trans [OF \<section>]) | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1879 | then show ?thesis | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1880 | unfolding uniformly_convergent_on_def uniform_limit_iff by blast | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1881 | qed | 
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1882 | |
| 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
76722diff
changeset | 1883 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1884 | 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 | 1885 | |
| 73885 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1886 | text\<open>Unlike in HOL Light, it's defined for the same interval as the complex logarithm: \<open>(-\<pi>,\<pi>]\<close>.\<close> | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1887 | |
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1888 | lemma Arg_eq_Im_Ln: | 
| 73924 | 1889 | assumes "z \<noteq> 0" shows "Arg z = Im (Ln z)" | 
| 73928 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 1890 | proof (rule cis_Arg_unique) | 
| 73885 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1891 | show "sgn z = cis (Im (Ln z))" | 
| 75494 | 1892 | by (metis assms exp_Ln exp_eq_polar nonzero_mult_div_cancel_left norm_eq_zero | 
| 73885 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1893 | norm_exp_eq_Re of_real_eq_0_iff sgn_eq) | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1894 | show "- pi < Im (Ln z)" | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1895 | by (simp add: assms mpi_less_Im_Ln) | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1896 | show "Im (Ln z) \<le> pi" | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1897 | by (simp add: Im_Ln_le_pi assms) | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1898 | qed | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1899 | |
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72301diff
changeset | 1900 | text \<open>The 1990s definition of argument coincides with the more recent one\<close> | 
| 73924 | 1901 | lemma\<^marker>\<open>tag important\<close> Arg_def: | 
| 1902 | shows "Arg z = (if z = 0 then 0 else Im (Ln z))" | |
| 1903 | by (simp add: Arg_eq_Im_Ln Arg_zero) | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1904 | |
| 73928 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 1905 | lemma Arg_of_real [simp]: "Arg (of_real r) = (if r<0 then pi else 0)" | 
| 68527 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1906 | by (simp add: Im_Ln_eq_pi Arg_def) | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1907 | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1908 | lemma mpi_less_Arg: "-pi < Arg z" and Arg_le_pi: "Arg z \<le> pi" | 
| 68527 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1909 | 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 | 1910 | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1911 | lemma Arg_eq: | 
| 68527 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1912 | assumes "z \<noteq> 0" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1913 | shows "z = of_real(norm z) * exp(\<i> * Arg z)" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1914 | using cis_conv_exp rcis_cmod_Arg rcis_def by force | 
| 68527 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1915 | |
| 68535 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1916 | 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 | 1917 | by (simp add: Arg_eq is_Arg_def) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 1918 | |
| 68527 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1919 | lemma Argument_exists: | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1920 |   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 | 1921 | 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 | 1922 | proof - | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1923 | let ?rp = "r - Arg z + pi" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1924 | 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 | 1925 | 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 | 1926 | 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 | 1927 | by (auto simp: k_def algebra_simps R) | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1928 | then show ?thesis | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1929 | 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 | 1930 | qed | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1931 | |
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1932 | lemma Argument_exists_unique: | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1933 |   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 | 1934 | 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 | 1935 | proof - | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1936 | 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 | 1937 | using Argument_exists [OF assms] . | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1938 | 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 | 1939 | using assms s by (auto simp: is_Arg_eqI) | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1940 | ultimately show thesis | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1941 | using that by blast | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1942 | qed | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1943 | |
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1944 | lemma Argument_Ex1: | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1945 |   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 | 1946 | 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 | 1947 | using Argument_exists_unique [OF assms] by metis | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1948 | |
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1949 | lemma Arg_divide: | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1950 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1951 | shows "is_Arg (z / w) (Arg z - Arg w)" | 
| 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68517diff
changeset | 1952 | 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 | 1953 | 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 | 1954 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1955 | lemma Arg_unique_lemma: | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1956 | assumes "is_Arg z t" "is_Arg z t'" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1957 | and "- pi < t" "t \<le> pi" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1958 | and "- pi < t'" "t' \<le> pi" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1959 | and "z \<noteq> 0" | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1960 | shows "t' = t" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1961 | using is_Arg_eqI assms by force | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1962 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1963 | lemma complex_norm_eq_1_exp_eq: "norm z = 1 \<longleftrightarrow> exp(\<i> * (Arg z)) = z" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1964 | by (metis Arg2pi_eq Arg_eq complex_norm_eq_1_exp norm_eq_zero norm_exp_i_times) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1965 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1966 | 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 | 1967 | 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 | 1968 | (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 | 1969 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1970 | lemma Arg_minus: | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1971 | assumes "z \<noteq> 0" | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1972 | 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 | 1973 | proof - | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1974 | 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 | 1975 | 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 | 1976 | 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 | 1977 | 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 | 1978 | show ?thesis | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1979 | using mpi_less_Arg [of z] Arg_le_pi [of z] assms | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 1980 | by (intro Arg_unique [of "norm z", OF complex_eqI]) (auto simp: Re_exp Im_exp) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1981 | qed | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1982 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 1983 | lemma Arg_1 [simp]: "Arg 1 = 0" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 1984 | by (rule Arg_unique[of 1]) auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 1985 | |
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 1986 | lemma Arg_numeral [simp]: "Arg (numeral n) = 0" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 1987 | by (rule Arg_unique[of "numeral n"]) auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 1988 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1989 | lemma Arg_times_of_real [simp]: | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1990 | assumes "0 < r" shows "Arg (of_real r * z) = Arg z" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1991 | using Arg_def Ln_times_of_real assms by auto | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1992 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1993 | 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 | 1994 | 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 | 1995 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1996 | lemma Arg_divide_of_real [simp]: "0 < r \<Longrightarrow> Arg (z / of_real r) = Arg z" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 1997 | by (metis Arg_times_of_real2 less_irrefl nonzero_eq_divide_eq of_real_eq_0_iff) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1998 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 1999 | 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 | 2000 | 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 | 2001 | by (simp add: Arg_def) | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2002 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2003 | text \<open>converse fails because the argument can equal $\pi$.\<close> | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2004 | lemma Arg_uminus: "Arg z < 0 \<Longrightarrow> Arg (-z) > 0" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2005 | by (smt (verit) Arg_bounded Arg_minus Complex.Arg_def) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2006 | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2007 | 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 | 2008 | 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 | 2009 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2010 | 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 | 2011 | 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 | 2012 | 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 | 2013 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2014 | lemma Arg_eq_0: "Arg z = 0 \<longleftrightarrow> z \<in> \<real> \<and> 0 \<le> Re z" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2015 | using Arg_def Im_Ln_eq_0 complex_eq_iff complex_is_Real_iff by auto | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2016 | |
| 70136 | 2017 | 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 | 2018 | 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 | 2019 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2020 | lemma Arg_eq_pi_iff: "Arg z = pi \<longleftrightarrow> z \<in> \<real> \<and> Re z < 0" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2021 | using Arg_eq_pi complex_is_Real_iff by blast | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2022 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2023 | 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 | 2024 | 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 | 2025 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2026 | 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 | 2027 | 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 | 2028 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2029 | 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 | 2030 | proof (cases "z \<in> \<real>") | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2031 | case False | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2032 | then show ?thesis | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2033 | by (simp add: Arg_def Ln_inverse complex_is_Real_iff complex_nonpos_Reals_iff) | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2034 | qed (use Arg_real Re_inverse in auto) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2035 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2036 | lemma Arg_eq_iff: | 
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2037 | assumes "w \<noteq> 0" "z \<noteq> 0" | 
| 72301 | 2038 | shows "Arg w = Arg z \<longleftrightarrow> (\<exists>x. 0 < x \<and> w = of_real x * z)" (is "?lhs = ?rhs") | 
| 2039 | proof | |
| 2040 | assume ?lhs | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2041 | then have "w = (cmod w / cmod z) * z" | 
| 72301 | 2042 | by (metis Arg_eq assms divide_divide_eq_right eq_divide_eq exp_not_eq_zero of_real_divide) | 
| 2043 | then show ?rhs | |
| 2044 | using assms divide_pos_pos zero_less_norm_iff by blast | |
| 2045 | qed auto | |
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2046 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2047 | 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 | 2048 | 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 | 2049 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2050 | lemma Arg_cnj_eq_inverse: "z\<noteq>0 \<Longrightarrow> Arg (cnj z) = Arg (inverse z)" | 
| 72301 | 2051 | using Arg2pi_cnj_eq_inverse Arg2pi_eq_iff Arg_eq_iff by auto | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2052 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2053 | 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 | 2054 | 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 | 2055 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2056 | lemma Arg_exp: "-pi < Im z \<Longrightarrow> Im z \<le> pi \<Longrightarrow> Arg(exp z) = Im z" | 
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2057 | by (simp add: Arg_eq_Im_Ln) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2058 | |
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2059 | lemma Arg_cis: "x \<in> {-pi<..pi} \<Longrightarrow> Arg (cis x) = x"
 | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2060 | unfolding cis_conv_exp by (subst Arg_exp) auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2061 | |
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2062 | lemma Arg_rcis: "x \<in> {-pi<..pi} \<Longrightarrow> r > 0 \<Longrightarrow> Arg (rcis r x) = x"
 | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2063 | unfolding rcis_def by (subst Arg_times_of_real) (auto simp: Arg_cis) | 
| 68499 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2064 | |
| 
d4312962161a
Rationalisation of complex transcendentals, esp the Arg function
 paulson <lp15@cam.ac.uk> parents: 
68493diff
changeset | 2065 | 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 | 2066 | 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 | 2067 | |
| 68517 | 2068 | lemma continuous_at_Arg: | 
| 2069 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" | |
| 2070 | shows "continuous (at z) Arg" | |
| 2071 | proof - | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2072 | have "(\<lambda>z. Im (Ln z)) \<midarrow>z\<rightarrow> Arg z" | 
| 68517 | 2073 | using Arg_def assms continuous_at by fastforce | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2074 | then show ?thesis | 
| 68517 | 2075 | unfolding continuous_at | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2076 | by (smt (verit, del_insts) Arg_eq_Im_Ln Lim_transform_away_at assms nonpos_Reals_zero_I) | 
| 68517 | 2077 | qed | 
| 2078 | ||
| 2079 | lemma continuous_within_Arg: "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> continuous (at z within S) Arg" | |
| 2080 | 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 | 2081 | |
| 77166 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2082 | lemma Arg_Re_pos: "\<bar>Arg z\<bar> < pi / 2 \<longleftrightarrow> Re z > 0 \<or> z = 0" | 
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2083 | using Arg_def Re_Ln_pos_lt by auto | 
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2084 | |
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2085 | lemma Arg_Re_nonneg: "\<bar>Arg z\<bar> \<le> pi / 2 \<longleftrightarrow> Re z \<ge> 0" | 
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2086 | using Re_Ln_pos_le[of z] by (cases "z = 0") (auto simp: Arg_eq_Im_Ln Arg_zero) | 
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2087 | |
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2088 | lemma Arg_times: | 
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2089 |   assumes "Arg z + Arg w \<in> {-pi<..pi}" "z \<noteq> 0" "w \<noteq> 0"
 | 
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2090 | shows "Arg (z * w) = Arg z + Arg w" | 
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2091 | using Arg_eq_Im_Ln Ln_times_simple assms by auto | 
| 
0fb350e7477b
More new material thanks to Manuel
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2092 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 2093 | 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 | 2094 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2095 | 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 | 2096 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2097 | 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 | 2098 | 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 | 2099 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2100 | lemma is_Arg_exp_diff_2pi: | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2101 | assumes "is_Arg (exp z) \<theta>" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2102 | 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 | 2103 | proof (intro exI is_Arg_eqI) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2104 | let ?k = "\<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor>" | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2105 | 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 | 2106 | 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 | 2107 | 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 | 2108 | 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 | 2109 | by (auto simp: algebra_simps abs_if) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2110 | qed (auto simp: is_Arg_exp_Im assms) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2111 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2112 | 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 | 2113 | 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 | 2114 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2115 | 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 | 2116 | using Arg_exp_diff_2pi [of z] | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2117 | 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 | 2118 | |
| 70136 | 2119 | 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 | 2120 | "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 | 2121 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2122 | 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 | 2123 | using unwinding_in_Ints [of z] | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2124 | unfolding unwinding_def Ints_def by force | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2125 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2126 | 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 | 2127 | by (simp add: unwinding) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2128 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2129 | lemma Ln_times_unwinding: | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2130 | "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 | 2131 | using unwinding_2pi by (simp add: exp_add) | 
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2132 | |
| 
4d09df93d1a2
The unwinding number is an integer.
 paulson <lp15@cam.ac.uk> parents: 
68527diff
changeset | 2133 | |
| 73928 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2134 | lemma arg_conv_arctan: | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2135 | assumes "Re z > 0" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2136 | shows "Arg z = arctan (Im z / Re z)" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2137 | proof (rule cis_Arg_unique) | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2138 | show "sgn z = cis (arctan (Im z / Re z))" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2139 | proof (rule complex_eqI) | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2140 | have "Re (cis (arctan (Im z / Re z))) = 1 / sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2)" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2141 | by (simp add: cos_arctan power_divide) | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2142 | also have "1 + Im z ^ 2 / Re z ^ 2 = norm z ^ 2 / Re z ^ 2" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2143 | using assms by (simp add: cmod_def field_simps) | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2144 | also have "1 / sqrt \<dots> = Re z / norm z" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2145 | using assms by (simp add: real_sqrt_divide) | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2146 | finally show "Re (sgn z) = Re (cis (arctan (Im z / Re z)))" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2147 | by simp | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2148 | next | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2149 | have "Im (cis (arctan (Im z / Re z))) = Im z / (Re z * sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2))" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2150 | by (simp add: sin_arctan field_simps) | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2151 | also have "1 + Im z ^ 2 / Re z ^ 2 = norm z ^ 2 / Re z ^ 2" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2152 | using assms by (simp add: cmod_def field_simps) | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2153 | also have "Im z / (Re z * sqrt \<dots>) = Im z / norm z" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2154 | using assms by (simp add: real_sqrt_divide) | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2155 | finally show "Im (sgn z) = Im (cis (arctan (Im z / Re z)))" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2156 | by simp | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2157 | qed | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2158 | next | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2159 | show "arctan (Im z / Re z) > -pi" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2160 | by (smt (verit, ccfv_SIG) arctan field_sum_of_halves) | 
| 73928 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2161 | next | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2162 | show "arctan (Im z / Re z) \<le> pi" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2163 | by (smt (verit, best) arctan field_sum_of_halves) | 
| 73928 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2164 | qed | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73924diff
changeset | 2165 | |
| 77089 | 2166 | |
| 2167 | subsection \<open>Characterisation of @{term "Im (Ln z)"} (Wenda Li)\<close>
 | |
| 2168 | ||
| 2169 | lemma Im_Ln_eq_pi_half: | |
| 2170 | "z \<noteq> 0 \<Longrightarrow> (Im(Ln z) = pi/2 \<longleftrightarrow> 0 < Im(z) \<and> Re(z) = 0)" | |
| 2171 | "z \<noteq> 0 \<Longrightarrow> (Im(Ln z) = -pi/2 \<longleftrightarrow> Im(z) < 0 \<and> Re(z) = 0)" | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2172 | using Im_Ln_pos_lt Im_Ln_pos_le Re_Ln_pos_le Re_Ln_pos_lt pi_ge_two by fastforce+ | 
| 77089 | 2173 | |
| 2174 | lemma Im_Ln_eq: | |
| 2175 | assumes "z\<noteq>0" | |
| 2176 | shows "Im (Ln z) = (if Re z\<noteq>0 then | |
| 2177 | if Re z>0 then | |
| 2178 | arctan (Im z/Re z) | |
| 2179 | else if Im z\<ge>0 then | |
| 2180 | arctan (Im z/Re z) + pi | |
| 2181 | else | |
| 2182 | arctan (Im z/Re z) - pi | |
| 2183 | else | |
| 2184 | if Im z>0 then pi/2 else -pi/2)" | |
| 2185 | proof - | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2186 | have eq_arctan_pos: "Im (Ln z) = arctan (Im z/Re z)" when "Re z>0" for z | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2187 | by (metis Arg_eq_Im_Ln arg_conv_arctan order_less_irrefl that zero_complex.simps(1)) | 
| 77089 | 2188 | have ?thesis when "Re z=0" | 
| 2189 | using Im_Ln_eq_pi_half[OF \<open>z\<noteq>0\<close>] that | |
| 2190 | using assms complex_eq_iff by auto | |
| 2191 | moreover have ?thesis when "Re z>0" | |
| 2192 | using eq_arctan_pos[OF that] that by auto | |
| 2193 | moreover have ?thesis when "Re z<0" "Im z\<ge>0" | |
| 2194 | proof - | |
| 2195 | have "Im (Ln (- z)) = arctan (Im (- z) / Re (- z))" | |
| 2196 | by (simp add: eq_arctan_pos that(1)) | |
| 2197 | moreover have "Ln (- z) = Ln z - \<i> * complex_of_real pi" | |
| 2198 | using Ln_minus assms that by fastforce | |
| 2199 | ultimately show ?thesis using that by auto | |
| 2200 | qed | |
| 2201 | moreover have ?thesis when "Re z<0" "Im z<0" | |
| 2202 | proof - | |
| 2203 | have "Im (Ln (- z)) = arctan (Im (- z) / Re (- z))" | |
| 2204 | by (simp add: eq_arctan_pos that(1)) | |
| 2205 | moreover have "Ln (- z) = Ln z + \<i> * complex_of_real pi" | |
| 2206 | using Ln_minus assms that by auto | |
| 2207 | ultimately show ?thesis using that by auto | |
| 2208 | qed | |
| 2209 | ultimately show ?thesis by linarith | |
| 2210 | qed | |
| 2211 | ||
| 70136 | 2212 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Relation between Ln and Arg2pi, and hence continuity of Arg2pi\<close> | 
| 68493 | 2213 | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2214 | lemma Arg2pi_Ln: "0 < Arg2pi z \<Longrightarrow> Arg2pi z = Im(Ln(-z)) + pi" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2215 | by (smt (verit, best) Arg2pi_0 Arg2pi_exp Arg2pi_minus Arg_exp Arg_minus Im_Ln_le_pi | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2216 | exp_Ln mpi_less_Im_Ln neg_equal_0_iff_equal) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2217 | |
| 68493 | 2218 | lemma continuous_at_Arg2pi: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2219 | assumes "z \<notin> \<real>\<^sub>\<ge>\<^sub>0" | 
| 68493 | 2220 | 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 | 2221 | proof - | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2222 | have "isCont (\<lambda>z. Im (Ln (- z)) + pi) z" | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2223 | by (rule Complex.isCont_Im isCont_Ln' continuous_intros | simp add: assms complex_is_Real_iff)+ | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2224 | moreover 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 | 2225 | using complex_nonneg_Reals_iff not_le by blast | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2226 | ultimately have "(\<lambda>z. Im (Ln (- z)) + pi) \<midarrow>z\<rightarrow> Arg2pi z" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2227 | by (simp add: Arg2pi_Ln Arg2pi_gt_0 assms continuous_within) | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2228 | then show ?thesis | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2229 | unfolding continuous_at | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2230 | by (metis (mono_tags, lifting) Arg2pi_Ln Arg2pi_gt_0 Compl_iff Lim_transform_within_open assms | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2231 | closed_nonneg_Reals_complex open_Compl) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2232 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2233 | |
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2234 | |
| 68493 | 2235 | text\<open>Relation between Arg2pi and arctangent in upper halfplane\<close> | 
| 2236 | 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 | 2237 | assumes "0 < Im z" | 
| 68493 | 2238 | 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 | 2239 | proof (cases "z = 0") | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2240 | case False | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2241 | show ?thesis | 
| 68493 | 2242 | proof (rule Arg2pi_unique [of "norm z"]) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2243 | show "(cmod z) * exp (\<i> * (pi / 2 - arctan (Re z / Im z))) = z" | 
| 72301 | 2244 | apply (rule complex_eqI) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2245 | using assms norm_complex_def [of z, symmetric] | 
| 72301 | 2246 | unfolding exp_Euler cos_diff sin_diff sin_of_real cos_of_real | 
| 2247 | by (simp_all add: field_simps real_sqrt_divide sin_arctan cos_arctan) | |
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2248 | 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 | 2249 | 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 | 2250 | |
| 68493 | 2251 | 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 | 2252 | assumes "0 \<le> Im z" "0 < Re z" | 
| 68493 | 2253 | shows "Arg2pi z = Im (Ln z)" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2254 | by (smt (verit, ccfv_SIG) Arg2pi_exp Im_Ln_pos_le assms exp_Ln pi_neq_zero zero_complex.simps(1)) | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2255 | |
| 68493 | 2256 | 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 | 2257 | assumes "z \<noteq> 0" | 
| 68493 | 2258 |     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 | 2259 | 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 | 2260 | case False then show ?thesis | 
| 68493 | 2261 | 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 | 2262 | next | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2263 | case True | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2264 | then have z: "z \<in> \<real>" "0 < Re z" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2265 | using assms by (auto simp: complex_nonneg_Reals_iff complex_is_Real_iff complex_neq_0) | 
| 68493 | 2266 | then have [simp]: "Arg2pi z = 0" "Im (Ln z) = 0" | 
| 2267 | 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 | 2268 | show ?thesis | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2269 | 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 | 2270 | fix e::real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2271 | assume "0 < e" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2272 | moreover have "continuous (at z) (\<lambda>x. Im (Ln x))" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2273 | 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 | 2274 | ultimately | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2275 | 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 | 2276 | 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 | 2277 |     { fix x
 | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2278 | 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 | 2279 | 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 | 2280 | 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 | 2281 | 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 | 2282 | using z by linarith | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2283 | } | 
| 68493 | 2284 | 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 | 2285 | apply (rule_tac x="min d (Re z / 2)" in exI) | 
| 72301 | 2286 | using z d by (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 | 2287 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2288 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2289 | |
| 68493 | 2290 | 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 | 2291 | unfolding continuous_on_eq_continuous_within | 
| 68493 | 2292 | by (metis DiffE Diff_subset continuous_within_subset continuous_within_upperhalf_Arg2pi insertCI) | 
| 2293 | ||
| 2294 | 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 | 2295 | assumes "0 \<le> s" "t \<le> 2*pi" | 
| 68493 | 2296 |     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 | 2297 | proof - | 
| 68493 | 2298 | have 1: "continuous_on (UNIV - \<real>\<^sub>\<ge>\<^sub>0) Arg2pi" | 
| 2299 | using continuous_at_Arg2pi continuous_at_imp_continuous_within | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2300 | by (auto simp: continuous_on_eq_continuous_within) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2301 | 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 | 2302 |   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 | 2303 | 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 | 2304 | by (metis greaterThan_def lessThan_def open_Int) | 
| 68493 | 2305 |   moreover have "{y. s < Arg2pi y} \<inter> {y. Arg2pi y < t} \<subseteq> - \<real>\<^sub>\<ge>\<^sub>0"
 | 
| 2306 | 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 | 2307 | 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 | 2308 |     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 | 2309 | by auto | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2310 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2311 | |
| 68493 | 2312 | 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 | 2313 | proof (cases "t < 0") | 
| 68493 | 2314 |   case True then have "{z. t < Arg2pi z} = UNIV"
 | 
| 2315 | 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 | 2316 | then show ?thesis | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2317 | by simp | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2318 | next | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2319 | case False then show ?thesis | 
| 68493 | 2320 | 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 | 2321 | by auto | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2322 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2323 | |
| 68493 | 2324 | lemma closed_Arg2pi2pi_le: "closed {z. Arg2pi z \<le> t}"
 | 
| 2325 | 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 | 2326 | 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 | 2327 | |
| 70136 | 2328 | 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 | 2329 | |
| 
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 | 2330 | 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 | 2331 | 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 | 2332 | |
| 
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 | 2333 | 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 | 2334 | 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 | 2335 | 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 | 2336 | |
| 77179 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77166diff
changeset | 2337 | lemma powr_nat': "(z :: complex) \<noteq> 0 \<or> n \<noteq> 0 \<Longrightarrow> z powr of_nat n = z ^ n" | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77166diff
changeset | 2338 | by (cases "z = 0") (auto simp: powr_nat) | 
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77221diff
changeset | 2339 | |
| 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 | 2340 | lemma norm_powr_real: "w \<in> \<real> \<Longrightarrow> 0 < Re w \<Longrightarrow> norm(w powr z) = exp(Re z * ln(Re w))" | 
| 72301 | 2341 | using Ln_Reals_eq norm_exp_eq_Re by (auto simp: Im_Ln_eq_0 powr_def norm_complex_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 | 2342 | |
| 77200 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 2343 | lemma norm_powr_real_powr': "w \<in> \<real> \<Longrightarrow> norm (z powr w) = norm z powr Re w" | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 2344 | by (auto simp: powr_def Reals_def) | 
| 
8f2e6186408f
Some more new material and some tidying of existing proofs
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 2345 | |
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2346 | 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 | 2347 | fixes x::complex shows "x \<noteq> 0 \<Longrightarrow> x powr (of_nat n) = x^n" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2348 | by (simp add: powr_nat') | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2349 | |
| 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2350 | lemma powr_complexnumeral [simp]: | 
| 74513 
67d87d224e00
A few new lemmas plus some refinements
 paulson <lp15@cam.ac.uk> parents: 
73933diff
changeset | 2351 | fixes x::complex shows "x powr (numeral n) = x ^ (numeral n)" | 
| 
67d87d224e00
A few new lemmas plus some refinements
 paulson <lp15@cam.ac.uk> parents: 
73933diff
changeset | 2352 | by (metis of_nat_numeral power_zero_numeral powr_nat) | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2353 | |
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2354 | lemma cnj_powr: | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2355 | assumes "Im a = 0 \<Longrightarrow> Re a \<ge> 0" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2356 | shows "cnj (a powr b) = cnj a powr cnj b" | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2357 | proof (cases "a = 0") | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2358 | case False | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2359 | 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 | 2360 | 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 | 2361 | qed simp | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2362 | |
| 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 | 2363 | lemma powr_real_real: | 
| 68281 | 2364 | assumes "w \<in> \<real>" "z \<in> \<real>" "0 < Re w" | 
| 2365 | shows "w powr z = exp(Re z * ln(Re w))" | |
| 2366 | proof - | |
| 2367 | have "w \<noteq> 0" | |
| 2368 | using assms by auto | |
| 2369 | with assms show ?thesis | |
| 2370 | by (simp add: powr_def Ln_Reals_eq of_real_exp) | |
| 2371 | 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 | 2372 | |
| 
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 | 2373 | 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 | 2374 | fixes x::real and y::real | 
| 63296 | 2375 | shows "0 \<le> x \<Longrightarrow> of_real x powr (of_real y::complex) = of_real (x powr y)" | 
| 2376 | 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 | 2377 | |
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2378 | 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 | 2379 | 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 | 2380 | 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 | 2381 | 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 | 2382 | 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 | 2383 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77221diff
changeset | 2384 | lemma complex_powr_of_int: "z \<noteq> 0 \<or> n \<noteq> 0 \<Longrightarrow> z powr of_int n = (z :: complex) powi n" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77221diff
changeset | 2385 | by (cases "z = 0 \<or> n = 0") | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77221diff
changeset | 2386 | (auto simp: power_int_def powr_minus powr_nat powr_of_int power_0_left power_inverse) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77221diff
changeset | 2387 | |
| 67135 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2388 | 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 | 2389 | by (metis of_real_Re powr_of_real) | 
| 65719 | 2390 | |
| 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 | 2391 | lemma norm_powr_real_mono: | 
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77221diff
changeset | 2392 | "\<lbrakk>w \<in> \<real>; 1 < Re w\<rbrakk> \<Longrightarrow> cmod(w powr z1) \<le> cmod(w powr z2) \<longleftrightarrow> Re z1 \<le> Re z2" | 
| 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 | 2393 | 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 | 2394 | |
| 
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 | 2395 | lemma powr_times_real: | 
| 79670 
f471e1715fc4
A small collection of new and useful facts, including the AM-GM inequality
 paulson <lp15@cam.ac.uk> parents: 
78890diff
changeset | 2396 | "\<lbrakk>x \<in> \<real>; y \<in> \<real>; 0 \<le> Re x; 0 \<le> Re y\<rbrakk> \<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 | 2397 | 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 | 2398 | |
| 65719 | 2399 | lemma Re_powr_le: "r \<in> \<real>\<^sub>\<ge>\<^sub>0 \<Longrightarrow> Re (r powr z) \<le> Re r powr Re z" | 
| 2400 | by (auto simp: powr_def nonneg_Reals_def order_trans [OF complex_Re_le_cmod]) | |
| 2401 | ||
| 2402 | lemma | |
| 2403 | fixes w::complex | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2404 | assumes "w \<in> \<real>\<^sub>\<ge>\<^sub>0" "z \<in> \<real>" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2405 | shows Reals_powr [simp]: "w powr z \<in> \<real>" and nonneg_Reals_powr [simp]: "w powr z \<in> \<real>\<^sub>\<ge>\<^sub>0" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2406 | using assms by (auto simp: nonneg_Reals_def Reals_def powr_of_real) | 
| 65719 | 2407 | |
| 79670 
f471e1715fc4
A small collection of new and useful facts, including the AM-GM inequality
 paulson <lp15@cam.ac.uk> parents: 
78890diff
changeset | 2408 | lemma exp_powr_complex: | 
| 
f471e1715fc4
A small collection of new and useful facts, including the AM-GM inequality
 paulson <lp15@cam.ac.uk> parents: 
78890diff
changeset | 2409 | fixes x::complex | 
| 
f471e1715fc4
A small collection of new and useful facts, including the AM-GM inequality
 paulson <lp15@cam.ac.uk> parents: 
78890diff
changeset | 2410 | assumes "-pi < Im(x)" "Im(x) \<le> pi" | 
| 
f471e1715fc4
A small collection of new and useful facts, including the AM-GM inequality
 paulson <lp15@cam.ac.uk> parents: 
78890diff
changeset | 2411 | shows "exp x powr y = exp (x*y)" | 
| 
f471e1715fc4
A small collection of new and useful facts, including the AM-GM inequality
 paulson <lp15@cam.ac.uk> parents: 
78890diff
changeset | 2412 | using assms by (simp add: powr_def mult.commute) | 
| 
f471e1715fc4
A small collection of new and useful facts, including the AM-GM inequality
 paulson <lp15@cam.ac.uk> parents: 
78890diff
changeset | 2413 | |
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2414 | lemma powr_neg_real_complex: | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2415 | fixes w::complex | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2416 | shows "(- of_real x) powr w = (-1) powr (of_real (sgn x) * w) * of_real x powr w" | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2417 | proof (cases "x = 0") | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2418 | assume x: "x \<noteq> 0" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2419 | hence "(-x) powr w = exp (w * ln (-of_real x))" by (simp add: powr_def) | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2420 | 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 | 2421 | by (simp add: Ln_minus Ln_of_real) | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2422 | also from x have "exp (w * \<dots>) = cis pi powr (of_real (sgn x) * w) * of_real x powr w" | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2423 | 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 | 2424 | also note cis_pi | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2425 | finally show ?thesis by simp | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2426 | qed simp_all | 
| 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2427 | |
| 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 | 2428 | lemma has_field_derivative_powr: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2429 | fixes z :: complex | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2430 | assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2431 | 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 | 2432 | proof (cases "z=0") | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2433 | case False | 
| 72301 | 2434 | then have \<section>: "exp (s * Ln z) * inverse z = exp ((s - 1) * Ln z)" | 
| 2435 | by (simp add: divide_complex_def exp_diff left_diff_distrib') | |
| 68281 | 2436 | show ?thesis | 
| 2437 | 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 | 2438 | proof (rule has_field_derivative_transform_within) | 
| 68281 | 2439 | show "((\<lambda>z. exp (s * Ln z)) has_field_derivative s * (if z = 0 then 0 else exp ((s - 1) * Ln z))) | 
| 2440 | (at z)" | |
| 72301 | 2441 | by (intro derivative_eq_intros | simp add: assms False \<section>)+ | 
| 68281 | 2442 | qed (use False in auto) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2443 | 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 | 2444 | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2445 | declare has_field_derivative_powr[THEN DERIV_chain2, derivative_intros] | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2446 | |
| 77324 | 2447 | (*Seemingly impossible to use DERIV_power_int without introducing the assumption z\<in>S*) | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2448 | lemma has_field_derivative_powr_of_int: | 
| 68493 | 2449 | fixes z :: complex | 
| 77324 | 2450 | assumes gderiv: "(g has_field_derivative gd) (at z within S)" and "g z \<noteq> 0" | 
| 72301 | 2451 | 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)" | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2452 | proof - | 
| 77324 | 2453 | obtain e where "e>0" and e_dist: "\<forall>y\<in>S. dist z y < e \<longrightarrow> g y \<noteq> 0" | 
| 2454 | using DERIV_continuous assms continuous_within_avoid gderiv by blast | |
| 2455 | define D where "D = of_int n * g z powr (of_int (n - 1)) * gd" | |
| 2456 | define E where "E = of_int n * g z powi (n - 1) * gd" | |
| 2457 | have "((\<lambda>z. g z powr of_int n) has_field_derivative D) (at z within S) | |
| 2458 | \<longleftrightarrow> ((\<lambda>z. g z powr of_int n) has_field_derivative E) (at z within S)" | |
| 2459 | using assms complex_powr_of_int D_def E_def by presburger | |
| 2460 | also have "\<dots> \<longleftrightarrow> ((\<lambda>z. g z powi n) has_field_derivative E) (at z within S)" | |
| 2461 | proof (rule has_field_derivative_cong_eventually) | |
| 2462 | show "\<forall>\<^sub>F x in at z within S. g x powr of_int n = g x powi n" | |
| 2463 | unfolding eventually_at by (metis \<open>0 < e\<close> complex_powr_of_int dist_commute e_dist) | |
| 2464 | qed (simp add: assms complex_powr_of_int) | |
| 2465 | also have "((\<lambda>z. g z powi n) has_field_derivative E) (at z within S)" | |
| 2466 | unfolding E_def using gderiv assms by (auto intro!: derivative_eq_intros) | |
| 2467 | finally show ?thesis | |
| 2468 | by (simp add: D_def) | |
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2469 | qed | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2470 | |
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2471 | lemma field_differentiable_powr_of_int: | 
| 68493 | 2472 | fixes z :: complex | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2473 | assumes "g field_differentiable (at z within S)" and "g z \<noteq> 0" | 
| 72301 | 2474 | shows "(\<lambda>z. g z powr of_int n) field_differentiable (at z within S)" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2475 | using has_field_derivative_powr_of_int assms field_differentiable_def by blast | 
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2476 | |
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67578diff
changeset | 2477 | lemma holomorphic_on_powr_of_int [holomorphic_intros]: | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2478 | assumes "f holomorphic_on S" and "\<And>z. z\<in>S \<Longrightarrow> f z \<noteq> 0" | 
| 72301 | 2479 | shows "(\<lambda>z. (f z) powr of_int n) holomorphic_on S" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2480 | using assms field_differentiable_powr_of_int holomorphic_on_def by auto | 
| 61524 
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
 eberlm parents: 
61518diff
changeset | 2481 | |
| 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 | 2482 | 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 | 2483 | "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 | 2484 | 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 | 2485 | |
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2486 | 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 | 2487 | 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 | 2488 | 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 | 2489 | 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 | 2490 | |
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65578diff
changeset | 2491 | lemma holomorphic_on_powr_right [holomorphic_intros]: | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2492 | assumes "f holomorphic_on S" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2493 | shows "(\<lambda>z. w powr (f z)) holomorphic_on S" | 
| 67268 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2494 | 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 | 2495 | 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 | 2496 | 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 | 2497 | 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 | 2498 | by (metis (full_types) DERIV_chain' has_field_derivative_powr_right) | 
| 68281 | 2499 | 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 | 2500 | |
| 
bdf25939a550
new/improved theories involving convergence; better pretty-printing for bounded quantifiers and sum/product
 paulson <lp15@cam.ac.uk> parents: 
67135diff
changeset | 2501 | lemma holomorphic_on_divide_gen [holomorphic_intros]: | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2502 | assumes "f holomorphic_on S" "g holomorphic_on S" and "\<And>z z'. \<lbrakk>z \<in> S; z' \<in> S\<rbrakk> \<Longrightarrow> g z = 0 \<longleftrightarrow> g z' = 0" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2503 | shows "(\<lambda>z. f z / g z) holomorphic_on S" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2504 | by (metis (no_types, lifting) assms division_ring_divide_zero holomorphic_on_divide holomorphic_transform) | 
| 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 | 2505 | |
| 
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 | 2506 | lemma norm_powr_real_powr: | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2507 | "w \<in> \<real> \<Longrightarrow> 0 \<le> Re w \<Longrightarrow> cmod (w powr z) = Re w powr Re z" | 
| 68281 | 2508 | 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 | 2509 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2510 | lemma tendsto_powr_complex: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2511 | fixes f g :: "_ \<Rightarrow> complex" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2512 | assumes a: "a \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2513 | 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 | 2514 | 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 | 2515 | proof - | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2516 | from a have [simp]: "a \<noteq> 0" by auto | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2517 | 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 | 2518 | by (auto intro!: tendsto_intros simp: powr_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2519 |   also {
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2520 | have "eventually (\<lambda>z. z \<noteq> 0) (nhds a)" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2521 | by (intro t1_space_nhds) simp_all | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2522 | 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 | 2523 | } | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2524 | 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 | 2525 | 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 | 2526 | finally show ?thesis . | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2527 | qed | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2528 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2529 | lemma tendsto_powr_complex_0: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2530 | fixes f g :: "'a \<Rightarrow> complex" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2531 | 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 | 2532 | shows "((\<lambda>z. f z powr g z) \<longlongrightarrow> 0) F" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2533 | proof (rule tendsto_norm_zero_cancel) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2534 | define h where | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2535 | "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 | 2536 |   {
 | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2537 | fix z :: 'a assume z: "f z \<noteq> 0" | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2538 | define c where "c = abs (Im (g z)) * pi" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2539 | 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 | 2540 | have "abs (Im (Ln (f z))) \<le> pi" by simp | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2541 | from mult_left_mono[OF this, of "abs (Im (g z))"] | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2542 | 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 | 2543 | 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 | 2544 | 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 | 2545 | } | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2546 | hence le: "norm (f z powr g z) \<le> h z" for z | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2547 | by (simp add: h_def) | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2548 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2549 |   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 | 2550 | by (rule tendsto_mono[OF _ g]) simp_all | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2551 |   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 | 2552 | 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 | 2553 |   moreover {
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2554 |     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 | 2555 | by (auto simp: filterlim_def) | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2556 |     hence "filterlim (\<lambda>x. norm (f x)) (principal {0<..}) (inf F (principal {z. f z \<noteq> 0}))"
 | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2557 | by (rule filterlim_mono) simp_all | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2558 | } | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2559 |   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 | 2560 | by (simp add: filterlim_inf at_within_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2561 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2562 |   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 | 2563 | 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 | 2564 | 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 | 2565 |   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 | 2566 | -\<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 | 2567 | 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 | 2568 | have C: "(h \<longlongrightarrow> 0) F" unfolding h_def | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2569 | 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 | 2570 | (insert B, auto simp: filterlim_uminus_at_bot algebra_simps) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2571 | 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 | 2572 | 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 | 2573 | qed | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2574 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2575 | lemma tendsto_powr_complex' [tendsto_intros]: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2576 | fixes f g :: "_ \<Rightarrow> complex" | 
| 68281 | 2577 | 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 | 2578 | shows "((\<lambda>z. f z powr g z) \<longlongrightarrow> a powr b) F" | 
| 68281 | 2579 | 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 | 2580 | |
| 67135 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2581 | 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 | 2582 | 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 | 2583 | 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 | 2584 | proof - | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2585 | 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 | 2586 | proof (rule Lim_transform_eventually) | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2587 | 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 | 2588 | by (auto simp: filterlim_at_top) | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2589 | 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 | 2590 | 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 | 2591 | 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 | 2592 | by (intro tendsto_neg_powr) | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2593 | qed | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2594 | 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 | 2595 | qed | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2596 | |
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2597 | 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 | 2598 | 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 | 2599 | shows "((\<lambda>x. of_nat (f x) powr s) \<longlongrightarrow> 0) F" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2600 | using tendsto_neg_powr_complex_of_real [of "real o f" F s] | 
| 67135 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2601 | proof - | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2602 | 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 | 2603 | 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 | 2604 | 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 | 2605 | thus ?thesis by simp | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2606 | qed | 
| 
1a94352812f4
Moved material from AFP to Analysis/Number_Theory
 Manuel Eberl <eberlm@in.tum.de> parents: 
66827diff
changeset | 2607 | |
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2608 | lemma continuous_powr_complex: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2609 | 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 | 2610 | shows "continuous F (\<lambda>z. f z powr g z :: complex)" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2611 | 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 | 2612 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2613 | lemma isCont_powr_complex [continuous_intros]: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2614 | 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 | 2615 | shows "isCont (\<lambda>z. f z powr g z :: complex) z" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2616 | 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 | 2617 | |
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2618 | lemma continuous_on_powr_complex [continuous_intros]: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2619 |   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 | 2620 | 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 | 2621 | assumes "continuous_on A f" "continuous_on A g" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2622 | shows "continuous_on A (\<lambda>z. f z powr g z)" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2623 | unfolding continuous_on_def | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2624 | proof | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2625 | fix z assume z: "z \<in> A" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2626 | 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 | 2627 | proof (cases "f z = 0") | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2628 | case False | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2629 | 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 | 2630 | with assms(3,4) z show ?thesis | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2631 | by (intro tendsto_powr_complex') | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2632 | (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 | 2633 | next | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2634 | case True | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2635 | with assms z show ?thesis | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2636 | by (auto intro!: tendsto_powr_complex_0 simp: continuous_on_def) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2637 | qed | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63092diff
changeset | 2638 | 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 | 2639 | |
| 70136 | 2640 | 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 | 2641 | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2642 | 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 | 2643 | fixes s::complex | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2644 | assumes "0 < Re s" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2645 | 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 | 2646 | 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 | 2647 | fix e::real | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2648 | assume e: "0 < e" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2649 | 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 | 2650 | 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 | 2651 | 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 | 2652 | 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 | 2653 | next | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2654 | fix x::real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2655 | 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 | 2656 | have "2 / (e * (Re s)\<^sup>2) > 0" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2657 | using e assms by simp | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2658 | with x have "x > 0" | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2659 | by linarith | 
| 68281 | 2660 | then have "x * 2 \<le> e * (x\<^sup>2 * (Re s)\<^sup>2)" | 
| 2661 | using e assms x by (auto simp: power2_eq_square field_simps) | |
| 76137 | 2662 | also have "\<dots> < e * (2 + (x * (Re s * 2) + x\<^sup>2 * (Re s)\<^sup>2))" | 
| 68281 | 2663 | using e assms \<open>x > 0\<close> | 
| 2664 | by (auto simp: power2_eq_square field_simps add_pos_pos) | |
| 2665 | finally show "0 < e * 2 + (e * Re s * 2 - 2) * x + e * (Re s)\<^sup>2 * x\<^sup>2" | |
| 2666 | 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 | 2667 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2668 | 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 | 2669 | 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 | 2670 | 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 | 2671 | using assms | 
| 69529 | 2672 | 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 | 2673 | 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 | 2674 | using e by (auto simp: field_simps) | 
| 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2675 | have "norm (Ln (of_nat n) / of_nat n powr s) < e" if "n \<ge> nat \<lceil>exp xo\<rceil>" for n | 
| 72301 | 2676 | proof - | 
| 2677 | have "ln (real n) \<ge> xo" | |
| 2678 | using that exp_gt_zero ln_ge_iff [of n] nat_ceiling_le_eq by fastforce | |
| 2679 | then show ?thesis | |
| 2680 | using e xo [of "ln n"] by (auto simp: norm_divide norm_powr_real field_split_simps) | |
| 2681 | qed | |
| 68493 | 2682 | 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 | 2683 | by blast | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2684 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2685 | |
| 61973 | 2686 | 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 | 2687 | 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 | 2688 | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2689 | 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 | 2690 | fixes s :: real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2691 | assumes "0 < s" | 
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77230diff
changeset | 2692 | shows "(\<lambda>n. ln (real n) / real n powr s) \<longlonglongrightarrow> 0" | 
| 72301 | 2693 | proof - | 
| 2694 | have "(\<lambda>n. ln (Suc n) / (Suc n) powr s) \<longlonglongrightarrow> 0" | |
| 2695 | using lim_Ln_over_power [of "of_real s", THEN filterlim_sequentially_Suc [THEN iffD2]] assms | |
| 2696 | by (simp add: lim_sequentially dist_norm Ln_Reals_eq norm_powr_real_powr norm_divide) | |
| 2697 | then show ?thesis | |
| 2698 | using filterlim_sequentially_Suc[of "\<lambda>n::nat. ln n / n powr s"] by auto | |
| 2699 | qed | |
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2700 | |
| 70724 | 2701 | lemma lim_ln_over_n [tendsto_intros]: "((\<lambda>n. ln(real_of_nat n) / of_nat n) \<longlongrightarrow> 0) sequentially" | 
| 72301 | 2702 | using lim_ln_over_power [of 1] by auto | 
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2703 | |
| 70724 | 2704 | lemma lim_log_over_n [tendsto_intros]: | 
| 2705 | "(\<lambda>n. log k n/n) \<longlonglongrightarrow> 0" | |
| 2706 | proof - | |
| 2707 | have *: "log k n/n = (1/ln k) * (ln n / n)" for n | |
| 2708 | unfolding log_def by auto | |
| 2709 | have "(\<lambda>n. (1/ln k) * (ln n / n)) \<longlonglongrightarrow> (1/ln k) * 0" | |
| 2710 | by (intro tendsto_intros) | |
| 2711 | then show ?thesis | |
| 2712 | unfolding * by auto | |
| 2713 | qed | |
| 2714 | ||
| 60150 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2715 | 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 | 2716 | assumes "0 < Re s" | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2717 | 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 | 2718 | 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 | 2719 | have "\<forall>n>0. 3 \<le> n \<longrightarrow> 1 \<le> ln (real_of_nat n)" | 
| 65719 | 2720 | using ln_272_gt_1 | 
| 2721 | 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 | 2722 | 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 | 2723 | 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 | 2724 | 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 | 2725 | 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 | 2726 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2727 | |
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2728 | 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 | 2729 | fixes s :: real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2730 | assumes "0 < s" | 
| 72301 | 2731 | 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 | 2732 | 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 | 2733 | apply (subst filterlim_sequentially_Suc [symmetric]) | 
| 72301 | 2734 | by (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 | 2735 | |
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2736 | lemma lim_1_over_Ln: "(\<lambda>n. 1 / Ln (complex_of_nat n)) \<longlonglongrightarrow> 0" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2737 | 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 | 2738 | fix r::real | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2739 | assume "0 < r" | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2740 | 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 | 2741 | by simp | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2742 | 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 | 2743 | 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 | 2744 | by auto | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2745 | then have "exp (inverse r) < of_nat n" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2746 | 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 | 2747 | 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 | 2748 | by (metis exp_gt_zero less_trans ln_exp ln_less_cancel_iff) | 
| 60420 | 2749 | 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 | 2750 | 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 | 2751 | 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 | 2752 | using neq0_conv by fastforce | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2753 | 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 | 2754 | using n \<open>0 < r\<close> | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2755 | 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 | 2756 | qed | 
| 
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
 paulson <lp15@cam.ac.uk> parents: 
60141diff
changeset | 2757 | |
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2758 | lemma lim_1_over_ln: "(\<lambda>n. 1 / ln (real n)) \<longlonglongrightarrow> 0" | 
| 63092 | 2759 | 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 | 2760 | apply (subst filterlim_sequentially_Suc [symmetric]) | 
| 72301 | 2761 | by (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 | 2762 | |
| 65719 | 2763 | lemma lim_ln1_over_ln: "(\<lambda>n. ln(Suc n) / ln n) \<longlonglongrightarrow> 1" | 
| 2764 | proof (rule Lim_transform_eventually) | |
| 2765 | have "(\<lambda>n. ln(1 + 1/n) / ln n) \<longlonglongrightarrow> 0" | |
| 2766 | proof (rule Lim_transform_bound) | |
| 2767 | show "(inverse o real) \<longlonglongrightarrow> 0" | |
| 70367 | 2768 | by (metis comp_def lim_inverse_n lim_explicit) | 
| 65719 | 2769 | show "\<forall>\<^sub>F n in sequentially. norm (ln (1 + 1 / n) / ln n) \<le> norm ((inverse \<circ> real) n)" | 
| 2770 | proof | |
| 2771 | fix n::nat | |
| 2772 | assume n: "3 \<le> n" | |
| 2773 | then have "ln 3 \<le> ln n" and ln0: "0 \<le> ln n" | |
| 2774 | by auto | |
| 2775 | 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 | 2776 | by (simp add: field_split_simps) | 
| 65719 | 2777 | moreover have "ln (1 + 1 / real n) \<le> 1/n" | 
| 2778 | by (simp add: ln_add_one_self_le_self) | |
| 2779 | ultimately have "ln (1 + 1 / real n) * (1 / ln n) \<le> (1/n) * 1" | |
| 2780 | by (intro mult_mono) (use n in auto) | |
| 2781 | then show "norm (ln (1 + 1 / n) / ln n) \<le> norm ((inverse \<circ> real) n)" | |
| 2782 | by (simp add: field_simps ln0) | |
| 2783 | qed | |
| 2784 | qed | |
| 2785 | then show "(\<lambda>n. 1 + ln(1 + 1/n) / ln n) \<longlonglongrightarrow> 1" | |
| 2786 | by (metis (full_types) add.right_neutral tendsto_add_const_iff) | |
| 2787 | 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 | 2788 | by (simp add: field_split_simps ln_div eventually_sequentiallyI [of 2]) | 
| 65719 | 2789 | qed | 
| 2790 | ||
| 2791 | lemma lim_ln_over_ln1: "(\<lambda>n. ln n / ln(Suc n)) \<longlonglongrightarrow> 1" | |
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2792 | using tendsto_inverse [OF lim_ln1_over_ln] by force | 
| 65719 | 2793 | |
| 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 | 2794 | |
| 70136 | 2795 | 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 | 2796 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2797 | lemma csqrt_exp_Ln: | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2798 | assumes "z \<noteq> 0" | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2799 | shows "csqrt z = exp(Ln z / 2)" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2800 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2801 | have "(exp (Ln z / 2))\<^sup>2 = (exp (Ln z))" | 
| 64240 | 2802 | by (metis exp_double nonzero_mult_div_cancel_left times_divide_eq_right zero_neq_numeral) | 
| 76137 | 2803 | also have "\<dots> = z" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2804 | 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 | 2805 | 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 | 2806 | by simp | 
| 76137 | 2807 | also have "\<dots> = exp (Ln z / 2)" | 
| 72301 | 2808 | apply (rule csqrt_square) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2809 | using cos_gt_zero_pi [of "(Im (Ln z) / 2)"] Im_Ln_le_pi mpi_less_Im_Ln assms | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2810 | by (fastforce simp: Re_exp Im_exp) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2811 | 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 | 2812 | by simp | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2813 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2814 | |
| 77221 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2815 | lemma csqrt_conv_powr: "csqrt z = z powr (1/2)" | 
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2816 | by (auto simp: csqrt_exp_Ln powr_def) | 
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2817 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2818 | lemma csqrt_mult: | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2819 |   assumes "Arg z + Arg w \<in> {-pi<..pi}"
 | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2820 | shows "csqrt (z * w) = csqrt z * csqrt w" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2821 | proof (cases "z = 0 \<or> w = 0") | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2822 | case False | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2823 | have "csqrt (z * w) = exp ((ln (z * w)) / 2)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2824 | using False by (intro csqrt_exp_Ln) auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2825 | also have "\<dots> = exp ((Ln z + Ln w) / 2)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2826 | using False assms by (subst Ln_times_simple) (auto simp: Arg_eq_Im_Ln) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2827 | also have "(Ln z + Ln w) / 2 = Ln z / 2 + Ln w / 2" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2828 | by (simp add: add_divide_distrib) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2829 | also have "exp \<dots> = csqrt z * csqrt w" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2830 | using False by (simp add: exp_add csqrt_exp_Ln) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2831 | finally show ?thesis . | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2832 | qed auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2833 | |
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2834 | lemma Arg_csqrt [simp]: "Arg (csqrt z) = Arg z / 2" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2835 | proof (cases "z = 0") | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2836 | case False | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2837 |   have "Im (Ln z) \<in> {-pi<..pi}"
 | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2838 | by (simp add: False Im_Ln_le_pi mpi_less_Im_Ln) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2839 |   also have "\<dots> \<subseteq> {-2*pi<..2*pi}"
 | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2840 | by auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2841 | finally show ?thesis | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2842 | using False by (auto simp: csqrt_exp_Ln Arg_exp Arg_eq_Im_Ln) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2843 | qed (auto simp: Arg_zero) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77103diff
changeset | 2844 | |
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2845 | lemma csqrt_inverse: | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2846 | "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> csqrt (inverse z) = inverse (csqrt z)" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2847 | by (metis Ln_inverse csqrt_eq_0 csqrt_exp_Ln divide_minus_left exp_minus | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2848 | inverse_nonzero_iff_nonzero) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2849 | |
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2850 | lemma cnj_csqrt: "z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> cnj(csqrt z) = csqrt(cnj z)" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2851 | by (metis cnj_Ln complex_cnj_divide complex_cnj_numeral complex_cnj_zero_iff csqrt_eq_0 csqrt_exp_Ln exp_cnj) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2852 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2853 | lemma has_field_derivative_csqrt: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2854 | 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 | 2855 | 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 | 2856 | proof - | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2857 | 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 | 2858 | using assms by auto | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2859 | then have *: "inverse z = inverse (2*z) * 2" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2860 | by (simp add: field_split_simps) | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2861 | have [simp]: "exp (Ln z / 2) * inverse z = inverse (csqrt z)" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2862 | 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 | 2863 | have "Im z = 0 \<Longrightarrow> 0 < Re z" | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2864 | using assms complex_nonpos_Reals_iff not_less by blast | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2865 | 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 | 2866 | by (force intro: derivative_eq_intros * simp add: assms) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2867 | 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 | 2868 | proof (rule has_field_derivative_transform_within) | 
| 68257 
e6e131577536
small tidy-up of Complex_Transcendental
 paulson <lp15@cam.ac.uk> parents: 
68255diff
changeset | 2869 | 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 | 2870 | 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 | 2871 | 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 | 2872 | qed | 
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2873 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2874 | 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 | 2875 | "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 | 2876 | 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 | 2877 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2878 | 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 | 2879 | "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 | 2880 | 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 | 2881 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2882 | lemma continuous_at_csqrt: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2883 | "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 | 2884 | 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 | 2885 | |
| 70136 | 2886 | corollary\<^marker>\<open>tag unimportant\<close> isCont_csqrt' [simp]: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2887 | "\<lbrakk>isCont f z; f z \<notin> \<real>\<^sub>\<le>\<^sub>0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. csqrt (f x)) z" | 
| 59862 | 2888 | by (blast intro: isCont_o2 [OF _ continuous_at_csqrt]) | 
| 2889 | ||
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2890 | lemma continuous_within_csqrt: | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2891 | "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 | 2892 | 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 | 2893 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2894 | lemma continuous_on_csqrt [continuous_intros]: | 
| 77221 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2895 | "continuous_on (-\<real>\<^sub>\<le>\<^sub>0) csqrt" | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2896 | 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 | 2897 | |
| 77221 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2898 | lemma holomorphic_on_csqrt [holomorphic_intros]: "csqrt holomorphic_on -\<real>\<^sub>\<le>\<^sub>0" | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2899 | by (simp add: field_differentiable_within_csqrt holomorphic_on_def) | 
| 77221 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2900 | |
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2901 | lemma holomorphic_on_csqrt' [holomorphic_intros]: | 
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2902 | "f holomorphic_on A \<Longrightarrow> (\<And>z. z \<in> A \<Longrightarrow> f z \<notin> \<real>\<^sub>\<le>\<^sub>0) \<Longrightarrow> (\<lambda>z. csqrt (f z)) holomorphic_on A" | 
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2903 | using holomorphic_on_compose_gen[OF _ holomorphic_on_csqrt, of f A] by (auto simp: o_def) | 
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2904 | |
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2905 | lemma analytic_on_csqrt [analytic_intros]: "csqrt analytic_on -\<real>\<^sub>\<le>\<^sub>0" | 
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2906 | using holomorphic_on_csqrt by (subst analytic_on_open) auto | 
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2907 | |
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2908 | lemma analytic_on_csqrt' [analytic_intros]: | 
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2909 | "f analytic_on A \<Longrightarrow> (\<And>z. z \<in> A \<Longrightarrow> f z \<notin> \<real>\<^sub>\<le>\<^sub>0) \<Longrightarrow> (\<lambda>z. csqrt (f z)) analytic_on A" | 
| 
0cdb384bf56a
More new theorems from the number theory development
 paulson <lp15@cam.ac.uk> parents: 
77200diff
changeset | 2910 | using analytic_on_compose_gen[OF _ analytic_on_csqrt, of f A] by (auto simp: o_def) | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2911 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2912 | 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 | 2913 | "closed s \<Longrightarrow> a \<notin> s ==> continuous (at a within s) f" | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2914 | using Compl_iff continuous_within_topological open_Compl by fastforce | 
| 59751 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2915 | |
| 
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
 paulson <lp15@cam.ac.uk> parents: 
59746diff
changeset | 2916 | 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 | 2917 |     "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 | 2918 | 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 | 2919 | case True | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2920 | then have [simp]: "Im z = 0" and 0: "Re z < 0 \<or> z = 0" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 2921 | using complex_nonpos_Reals_iff complex_eq_iff by force+ | 
| 72301 | 2922 | show ?thesis | 
| 2923 | using 0 | |
| 2924 | proof | |
| 2925 | assume "Re z < 0" | |
| 2926 | then show ?thesis | |
| 2927 | by (auto simp: continuous_within_closed_nontrivial [OF closed_Real_halfspace_Re_ge]) | |
| 2928 | next | |
| 2929 | assume "z = 0" | |
| 2930 | moreover | |
| 2931 | have "\<And>e. 0 < e | |
| 2932 |          \<Longrightarrow> \<forall>x'\<in>\<real> \<inter> {w. 0 \<le> Re w}. cmod x' < e^2 \<longrightarrow> cmod (csqrt x') < e"
 | |
| 2933 | by (auto simp: Reals_def real_less_lsqrt) | |
| 2934 | ultimately show ?thesis | |
| 2935 | using zero_less_power by (fastforce simp: continuous_within_eps_delta) | |
| 2936 | qed | |
| 2937 | qed (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 | 2938 | |
| 60420 | 2939 | subsection\<open>Complex arctangent\<close> | 
| 2940 | ||
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 2941 | 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 | 2942 | |
| 70136 | 2943 | 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 | 2944 | "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 | 2945 | |
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2946 | 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 | 2947 | 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 | 2948 | |
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2949 | lemma Ln_conv_Arctan: | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2950 | assumes "z \<noteq> -1" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2951 | 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 | 2952 | proof - | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2953 | 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 | 2954 | \<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 | 2955 | by (simp add: Arctan_def_moebius) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2956 | 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 | 2957 | 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 | 2958 | 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 | 2959 | 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 | 2960 | 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 | 2961 | qed | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 2962 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2963 | lemma Arctan_0 [simp]: "Arctan 0 = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2964 | by (simp add: Arctan_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2965 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2966 | 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 | 2967 | 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 | 2968 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2969 | 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 | 2970 | 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 | 2971 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2972 | lemma tan_Arctan: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2973 | assumes "z\<^sup>2 \<noteq> -1" | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2974 | shows [simp]: "tan(Arctan z) = z" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2975 | proof - | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2976 | obtain "1 + \<i>*z \<noteq> 0" "1 - \<i>*z \<noteq> 0" | 
| 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2977 | by (metis add_diff_cancel_left' assms diff_0 i_times_eq_iff mult_cancel_left2 power2_i power2_minus right_minus_eq) | 
| 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2978 | then show ?thesis | 
| 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2979 | by (simp add: Arctan_def tan_def sin_exp_eq cos_exp_eq exp_minus divide_simps | 
| 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 2980 | flip: csqrt_exp_Ln power2_eq_square) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2981 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2982 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2983 | lemma Arctan_tan [simp]: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2984 | assumes "\<bar>Re z\<bar> < pi/2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2985 | shows "Arctan(tan z) = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 2986 | proof - | 
| 72301 | 2987 | have "Ln ((1 - \<i> * tan z) / (1 + \<i> * tan z)) = 2 * z / \<i>" | 
| 2988 | proof (rule Ln_unique) | |
| 2989 | have ge_pi2: "\<And>n::int. \<bar>of_int (2*n + 1) * pi/2\<bar> \<ge> pi/2" | |
| 2990 | by (case_tac n rule: int_cases) (auto simp: abs_mult) | |
| 2991 | have "exp (\<i>*z)*exp (\<i>*z) = -1 \<longleftrightarrow> exp (2*\<i>*z) = -1" | |
| 2992 | by (metis distrib_right exp_add mult_2) | |
| 76137 | 2993 | also have "\<dots> \<longleftrightarrow> exp (2*\<i>*z) = exp (\<i>*pi)" | 
| 72301 | 2994 | using cis_conv_exp cis_pi by auto | 
| 76137 | 2995 | also have "\<dots> \<longleftrightarrow> exp (2*\<i>*z - \<i>*pi) = 1" | 
| 72301 | 2996 | by (metis (no_types) diff_add_cancel diff_minus_eq_add exp_add exp_minus_inverse mult.commute) | 
| 76137 | 2997 | also have "\<dots> \<longleftrightarrow> Re(\<i>*2*z - \<i>*pi) = 0 \<and> (\<exists>n::int. Im(\<i>*2*z - \<i>*pi) = of_int (2 * n) * pi)" | 
| 72301 | 2998 | by (simp add: exp_eq_1) | 
| 76137 | 2999 | also have "\<dots> \<longleftrightarrow> Im z = 0 \<and> (\<exists>n::int. 2 * Re z = of_int (2*n + 1) * pi)" | 
| 72301 | 3000 | by (simp add: algebra_simps) | 
| 76137 | 3001 | also have "\<dots> \<longleftrightarrow> False" | 
| 72301 | 3002 | using assms ge_pi2 | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 3003 | by (metis eq_divide_eq linorder_not_less mult.commute zero_neq_numeral) | 
| 72301 | 3004 | finally have "exp (\<i>*z)*exp (\<i>*z) + 1 \<noteq> 0" | 
| 3005 | by (auto simp: add.commute minus_unique) | |
| 3006 | then show "exp (2 * z / \<i>) = (1 - \<i> * tan z) / (1 + \<i> * tan z)" | |
| 3007 | apply (simp add: tan_def sin_exp_eq cos_exp_eq exp_minus divide_simps) | |
| 3008 | by (simp add: algebra_simps flip: power2_eq_square exp_double) | |
| 3009 | qed (use assms in auto) | |
| 3010 | then show ?thesis | |
| 3011 | by (auto simp: Arctan_def) | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3012 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3013 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3014 | lemma | 
| 61945 | 3015 | assumes "Re z = 0 \<Longrightarrow> \<bar>Im z\<bar> < 1" | 
| 3016 | 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 | 3017 | 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 | 3018 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3019 | have nz0: "1 + \<i>*z \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3020 | using assms | 
| 68493 | 3021 | by (metis abs_one add_diff_cancel_left' complex_i_mult_minus diff_0 i_squared imaginary_unit.simps | 
| 68281 | 3022 | less_asym neg_equal_iff_equal) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3023 | have "z \<noteq> -\<i>" using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3024 | by auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3025 | 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 | 3026 | 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 | 3027 | 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 | 3028 | 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 | 3029 | 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 | 3030 | using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3031 | 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 | 3032 | 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 | 3033 | 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 | 3034 | using nz1 nz2 by auto | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3035 | have "Im ((1 - \<i>*z) / (1 + \<i>*z)) = 0 \<Longrightarrow> 0 < Re ((1 - \<i>*z) / (1 + \<i>*z))" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3036 | by (simp add: Im_complex_div_lemma Re_complex_div_lemma assms cmod_eq_Im) | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3037 | 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 | 3038 | by (auto simp add: complex_nonpos_Reals_iff) | 
| 61945 | 3039 | 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 | 3040 | unfolding Arctan_def divide_complex_def | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3041 | using mpi_less_Im_Ln [OF nzi] | 
| 72301 | 3042 | by (auto simp: abs_if intro!: Im_Ln_less_pi * [unfolded divide_complex_def]) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3043 | 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 | 3044 | unfolding Arctan_def scaleR_conv_of_real | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3045 | apply (intro derivative_eq_intros | simp add: nz0 *)+ | 
| 72301 | 3046 | using nz1 zz | 
| 71633 | 3047 | apply (simp add: field_split_simps power2_eq_square) | 
| 68281 | 3048 | apply algebra | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3049 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3050 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3051 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3052 | 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 | 3053 | 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 | 3054 | 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 | 3055 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3056 | 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 | 3057 | "(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 | 3058 | 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 | 3059 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3060 | declare has_field_derivative_Arctan [derivative_intros] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3061 | 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 | 3062 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3063 | lemma continuous_at_Arctan: | 
| 61945 | 3064 | "(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 | 3065 | 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 | 3066 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3067 | lemma continuous_within_Arctan: | 
| 61945 | 3068 | "(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 | 3069 | 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 | 3070 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3071 | lemma continuous_on_Arctan [continuous_intros]: | 
| 61945 | 3072 | "(\<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 | 3073 | 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 | 3074 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3075 | lemma holomorphic_on_Arctan: | 
| 61945 | 3076 | "(\<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 | 3077 | 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 | 3078 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 3079 | theorem Arctan_series: | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3080 | assumes z: "norm (z :: complex) < 1" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3081 | 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 | 3082 | 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 | 3083 | 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 | 3084 | and "h z sums Arctan z" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3085 | proof - | 
| 63040 | 3086 | 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 | 3087 | 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 | 3088 | proof (cases "u = 0") | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 3089 | case False | 
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3090 | 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 | 3091 | 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 | 3092 | proof | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3093 | 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 | 3094 | have "ereal (norm (h u n) / norm (h u (Suc n))) = | 
| 68281 | 3095 | ereal (inverse (norm u)^2) * ereal (((2*Suc n+1) / (Suc n)) / | 
| 3096 | ((2*Suc n-1) / (Suc n)))" | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 3097 | 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 | 3098 | 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 | 3099 | 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 | 3100 | 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 | 3101 | 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 | 3102 | 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 | 3103 | 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 | 3104 | 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 | 3105 | qed | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3106 | 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 | 3107 | 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 | 3108 | 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 | 3109 | by (intro lim_imp_Liminf) simp_all | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 3110 | moreover from power_strict_mono[OF that, of 2] False have "inverse (norm u)^2 > 1" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 3111 | 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 | 3112 | ultimately have A: "liminf (\<lambda>n. ereal (cmod (h u n) / cmod (h u (Suc n)))) > 1" by simp | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 3113 | from False have "summable (h u)" | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3114 | 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 | 3115 | (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 | 3116 | 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 | 3117 | 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 | 3118 | 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 | 3119 | (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 | 3120 | qed (simp add: h_def) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3121 | |
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3122 | 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 | 3123 | 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 | 3124 | fix u :: complex assume "u \<in> ball 0 1" | 
| 71633 | 3125 | hence u: "norm u < 1" by (simp) | 
| 63040 | 3126 | 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 | 3127 | 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 | 3128 | 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 | 3129 | 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 | 3130 | 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 | 3131 | 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 | 3132 | 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 | 3133 | 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 | 3134 | 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 | 3135 | (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 | 3136 | 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 | 3137 | 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 | 3138 | 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 | 3139 | 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 | 3140 | 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 | 3141 | show "((\<lambda>u. Arctan u - G u) has_field_derivative 0) (at u within ball 0 1)" | 
| 68281 | 3142 | 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 | 3143 | qed simp_all | 
| 68281 | 3144 | then obtain c where c: "\<And>u. norm u < 1 \<Longrightarrow> Arctan u - G u = c" by auto | 
| 3145 | 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 | 3146 | 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 | 3147 | 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 | 3148 | 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 | 3149 | (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 | 3150 | qed | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3151 | |
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3152 | 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 | 3153 | theorem ln_series_quadratic: | 
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3154 | assumes x: "x > (0::real)" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61973diff
changeset | 3155 | 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 | 3156 | proof - | 
| 63040 | 3157 | 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 | 3158 | 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 | 3159 | 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 | 3160 | 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 | 3161 | 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 | 3162 | 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 | 3163 | 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 | 3164 | 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 | 3165 | 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 | 3166 | (\<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 | 3167 | 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 | 3168 | 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 | 3169 | 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 | 3170 | 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 | 3171 | 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 | 3172 | 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 | 3173 | 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 | 3174 | 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 | 3175 | 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 | 3176 | 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 | 3177 | 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 | 3178 | 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 | 3179 | 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 | 3180 | qed | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3181 | |
| 70136 | 3182 | 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 | 3183 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3184 | lemma Im_Arctan_of_real [simp]: "Im (Arctan (of_real x)) = 0" | 
| 68281 | 3185 | proof - | 
| 3186 | have ne: "1 + x\<^sup>2 \<noteq> 0" | |
| 3187 | by (metis power_one sum_power2_eq_zero_iff zero_neq_one) | |
| 72301 | 3188 | have ne1: "1 + \<i> * complex_of_real x \<noteq> 0" | 
| 75494 | 3189 | using Complex_eq complex_eq_cancel_iff2 by fastforce | 
| 68281 | 3190 | have "Re (Ln ((1 - \<i> * x) * inverse (1 + \<i> * x))) = 0" | 
| 3191 | apply (rule norm_exp_imaginary) | |
| 72301 | 3192 | using ne | 
| 3193 | apply (simp add: ne1 cmod_def) | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 3194 | apply (auto simp: field_split_simps) | 
| 68281 | 3195 | apply algebra | 
| 3196 | done | |
| 3197 | then show ?thesis | |
| 3198 | unfolding Arctan_def divide_complex_def by (simp add: complex_eq_iff) | |
| 3199 | qed | |
| 59870 
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_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 | 3202 | proof (rule arctan_unique) | 
| 72301 | 3203 | have "(1 - \<i> * x) / (1 + \<i> * x) \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 3204 | by (auto simp: Im_complex_div_lemma complex_nonpos_Reals_iff) | |
| 3205 | then show "- (pi / 2) < Re (Arctan (complex_of_real x))" | |
| 3206 | by (simp add: Arctan_def Im_Ln_less_pi) | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3207 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3208 | 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 | 3209 | 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 | 3210 | 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 | 3211 | using mpi_less_Im_Ln [OF *] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3212 | by (simp add: Arctan_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3213 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3214 | have "tan (Re (Arctan (of_real x))) = Re (tan (Arctan (of_real x)))" | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 3215 | by (metis Im_Arctan_of_real Re_complex_of_real complex_is_Real_iff of_real_Re tan_of_real) | 
| 76137 | 3216 | also have "\<dots> = x" | 
| 72301 | 3217 | proof - | 
| 3218 | have "(complex_of_real x)\<^sup>2 \<noteq> - 1" | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3219 | by (smt (verit, best) Im_complex_of_real imaginary_unit.sel(2) of_real_minus power2_eq_iff power2_i) | 
| 72301 | 3220 | then show ?thesis | 
| 3221 | by simp | |
| 3222 | qed | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3223 | 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 | 3224 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3225 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3226 | 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 | 3227 | 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 | 3228 | by (simp add: complex_eq_iff) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3229 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3230 | 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 | 3231 | 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 | 3232 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3233 | declare arctan_one [simp] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3234 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3235 | 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 | 3236 | by (metis arctan_less_iff arctan_one) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3237 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3238 | 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 | 3239 | 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 | 3240 | |
| 61945 | 3241 | 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 | 3242 | 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 | 3243 | |
| 61945 | 3244 | 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 | 3245 | 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 | 3246 | |
| 61945 | 3247 | 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 | 3248 | by (simp add: abs_if arctan_minus) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3249 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3250 | lemma arctan_add_raw: | 
| 61945 | 3251 | 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 | 3252 | 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 | 3253 | proof (rule arctan_unique [symmetric]) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3254 | 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 | 3255 | using assms by linarith+ | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3256 | show "tan (arctan x + arctan y) = (x + y) / (1 - x * y)" | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 3257 | using cos_gt_zero_pi [OF 12] by (simp add: arctan tan_add) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3258 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3259 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3260 | lemma arctan_inverse: | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3261 | "0 < x \<Longrightarrow>arctan(inverse x) = pi/2 - arctan x" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3262 | by (smt (verit, del_insts) arctan arctan_unique tan_cot zero_less_arctan_iff) | 
| 59870 
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 arctan_add_small: | 
| 61945 | 3265 | assumes "\<bar>x * y\<bar> < 1" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3266 | 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 | 3267 | proof (cases "x = 0 \<or> y = 0") | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3268 | case False | 
| 72301 | 3269 | with assms have "\<bar>x\<bar> < inverse \<bar>y\<bar>" | 
| 3270 | by (simp add: field_split_simps abs_mult) | |
| 3271 | with False have "\<bar>arctan x\<bar> < pi / 2 - \<bar>arctan y\<bar>" using assms | |
| 3272 | by (auto simp add: abs_arctan arctan_inverse [symmetric] arctan_less_iff) | |
| 3273 | then show ?thesis | |
| 3274 | by (intro arctan_add_raw) linarith | |
| 3275 | qed auto | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3276 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3277 | lemma abs_arctan_le: | 
| 61945 | 3278 | 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 | 3279 | proof - | 
| 68281 | 3280 | have 1: "\<And>x. x \<in> \<real> \<Longrightarrow> cmod (inverse (1 + x\<^sup>2)) \<le> 1" | 
| 3281 | by (simp add: norm_divide divide_simps in_Reals_norm complex_is_Real_iff power2_eq_square) | |
| 3282 | have "cmod (Arctan w - Arctan z) \<le> 1 * cmod (w-z)" if "w \<in> \<real>" "z \<in> \<real>" for w z | |
| 3283 | apply (rule field_differentiable_bound [OF convex_Reals, of Arctan _ 1]) | |
| 3284 | apply (rule has_field_derivative_at_within [OF has_field_derivative_Arctan]) | |
| 72301 | 3285 | using 1 that by (auto simp: Reals_def) | 
| 3286 | then have "cmod (Arctan (of_real x) - Arctan 0) \<le> 1 * cmod (of_real x - 0)" | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3287 | 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 | 3288 | then show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3289 | by (simp add: Arctan_of_real) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3290 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3291 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3292 | 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 | 3293 | 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 | 3294 | |
| 61945 | 3295 | 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 | 3296 | 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 | 3297 | |
| 63556 | 3298 | lemma arctan_bounds: | 
| 3299 | assumes "0 \<le> x" "x < 1" | |
| 3300 | shows arctan_lower_bound: | |
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 3301 | "(\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x" (is "(\<Sum>k<_. _ * ?a k) \<le> _") | 
| 63556 | 3302 | and arctan_upper_bound: | 
| 3303 | "arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))" | |
| 3304 | proof - | |
| 3305 | have tendsto_zero: "?a \<longlonglongrightarrow> 0" | |
| 68281 | 3306 | proof (rule tendsto_eq_rhs) | 
| 3307 | show "(\<lambda>k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \<longlonglongrightarrow> 0 * 0" | |
| 3308 | using assms | |
| 3309 | by (intro tendsto_mult real_tendsto_divide_at_top) | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3310 | (auto simp: filterlim_sequentially_iff_filterlim_real | 
| 63556 | 3311 | intro!: real_tendsto_divide_at_top tendsto_power_zero filterlim_real_sequentially | 
| 68281 | 3312 | tendsto_eq_intros filterlim_at_top_mult_tendsto_pos filterlim_tendsto_add_at_top) | 
| 3313 | qed simp | |
| 63556 | 3314 | have nonneg: "0 \<le> ?a n" for n | 
| 3315 | by (force intro!: divide_nonneg_nonneg mult_nonneg_nonneg zero_le_power assms) | |
| 3316 | 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 | 3317 | by (rule mult_mono[OF _ power_decreasing]) (auto simp: field_split_simps assms less_imp_le) | 
| 63556 | 3318 | from summable_Leibniz'(4)[of ?a, OF tendsto_zero nonneg le, of n] | 
| 3319 | summable_Leibniz'(2)[of ?a, OF tendsto_zero nonneg le, of n] | |
| 3320 | assms | |
| 3321 | show "(\<Sum>k<2*n. (- 1)^ k * ?a k) \<le> arctan x" "arctan x \<le> (\<Sum>k<2 * n + 1. (- 1)^ k * ?a k)" | |
| 3322 | by (auto simp: arctan_series) | |
| 3323 | qed | |
| 3324 | ||
| 70136 | 3325 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Bounds on pi using real arctangent\<close> | 
| 63556 | 3326 | |
| 3327 | lemma pi_machin: "pi = 16 * arctan (1 / 5) - 4 * arctan (1 / 239)" | |
| 68281 | 3328 | using machin by simp | 
| 63556 | 3329 | |
| 3330 | lemma pi_approx: "3.141592653588 \<le> pi" "pi \<le> 3.1415926535899" | |
| 3331 | unfolding pi_machin | |
| 3332 | using arctan_bounds[of "1/5" 4] | |
| 3333 | arctan_bounds[of "1/239" 4] | |
| 3334 | by (simp_all add: eval_nat_numeral) | |
| 68493 | 3335 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 3336 | 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 | 3337 | using pi_approx by simp | 
| 63556 | 3338 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3339 | |
| 60420 | 3340 | subsection\<open>Inverse Sine\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3341 | |
| 70136 | 3342 | 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 | 3343 | "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 | 3344 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3345 | 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 | 3346 | using power2_csqrt [of "1 - z\<^sup>2"] | 
| 77275 
386b1b33785c
New material due to Eberl on Formal Laurent Series
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 3347 | by (metis add.inverse_unique diff_0 diff_add_cancel mult.left_commute mult_minus1_right power2_i power2_minus power_mult_distrib zero_neq_one) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3348 | |
| 61945 | 3349 | 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 | 3350 | using Complex.cmod_power2 [of z, symmetric] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3351 | 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 | 3352 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3353 | 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 | 3354 | by (simp add: Arcsin_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3355 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3356 | 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 | 3357 | 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 | 3358 | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3359 | lemma one_minus_z2_notin_nonpos_Reals: | 
| 72301 | 3360 | assumes "Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1" | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3361 | shows "1 - z\<^sup>2 \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 72301 | 3362 | proof (cases "Im z = 0") | 
| 3363 | case True | |
| 3364 | with assms show ?thesis | |
| 3365 | by (simp add: complex_nonpos_Reals_iff flip: abs_square_less_1) | |
| 3366 | next | |
| 3367 | case False | |
| 3368 | have "\<not> (Im z)\<^sup>2 \<le> - 1" | |
| 3369 | using False power2_less_eq_zero_iff by fastforce | |
| 3370 | with False show ?thesis | |
| 3371 | by (auto simp add: complex_nonpos_Reals_iff Re_power2 Im_power2) | |
| 3372 | qed | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3373 | |
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3374 | lemma isCont_Arcsin_lemma: | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3375 | 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 | 3376 | shows False | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3377 | proof (cases "Im z = 0") | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3378 | case True | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3379 | then show ?thesis | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3380 | 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 | 3381 | next | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3382 | case False | 
| 68281 | 3383 | have leim: "(cmod (1 - z\<^sup>2) + (1 - Re (z\<^sup>2))) / 2 \<le> (Im z)\<^sup>2" | 
| 3384 | using le0 sqrt_le_D by fastforce | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3385 | 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 | 3386 | proof (clarsimp simp add: cmod_def) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3387 | 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 | 3388 | 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 | 3389 | by simp | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3390 | then show False using False | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3391 | by (simp add: power2_eq_square algebra_simps) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3392 | qed | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3393 | moreover have 2: "(Im z)\<^sup>2 = (1 + ((Im z)\<^sup>2 + cmod (1 - z\<^sup>2)) - (Re z)\<^sup>2) / 2" | 
| 68281 | 3394 | using leim cmod_power2 [of z] norm_triangle_ineq2 [of "z^2" 1] | 
| 3395 | 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 | 3396 | ultimately show False | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3397 | by (simp add: Re_power2 Im_power2 cmod_power2) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3398 | qed | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3399 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3400 | lemma isCont_Arcsin: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3401 | 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 | 3402 | shows "isCont Arcsin z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3403 | proof - | 
| 68281 | 3404 | 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 | 3405 | by (metis isCont_Arcsin_lemma assms complex_nonpos_Reals_iff) | 
| 68281 | 3406 | have 2: "1 - z\<^sup>2 \<notin> \<real>\<^sub>\<le>\<^sub>0" | 
| 3407 | 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 | 3408 | show ?thesis | 
| 68281 | 3409 | 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 | 3410 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3411 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3412 | lemma isCont_Arcsin' [simp]: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3413 | 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 | 3414 | 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 | 3415 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3416 | lemma sin_Arcsin [simp]: "sin(Arcsin z) = z" | 
| 60141 
833adf7db7d8
New material, mostly about limits. Consolidation.
 paulson <lp15@cam.ac.uk> parents: 
60020diff
changeset | 3417 | proof - | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3418 | 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 | 3419 | by (simp add: algebra_simps) \<comment> \<open>Cancelling a factor of 2\<close> | 
| 76137 | 3420 | moreover have "\<dots> \<longleftrightarrow> (\<i>*z) + csqrt (1 - z\<^sup>2) = 0" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3421 | 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 | 3422 | ultimately show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3423 | 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 | 3424 | apply (simp add: algebra_simps) | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3425 | apply (simp add: right_diff_distrib flip: power2_eq_square) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3426 | done | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3427 | qed | 
| 
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_eq_pihalf_lemma: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3430 | "\<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 | 3431 | 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 | 3432 | 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 | 3433 | by (metis cos_minus cos_pi_half) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3434 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3435 | lemma Re_less_pihalf_lemma: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3436 | assumes "\<bar>Re z\<bar> < pi / 2" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3437 | 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 | 3438 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3439 | have "0 < cos (Re z)" using assms | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3440 | using cos_gt_zero_pi by auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3441 | 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 | 3442 | 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 | 3443 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3444 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3445 | lemma Arcsin_sin: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3446 | 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 | 3447 | shows "Arcsin(sin z) = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3448 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3449 | 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 | 3450 | by (simp add: sin_exp_eq Arcsin_def exp_minus power_divide) | 
| 76137 | 3451 | also have "\<dots> = - (\<i> * Ln (csqrt (((exp (\<i>*z) + inverse (exp (\<i>*z)))/2)\<^sup>2) - (inverse (exp (\<i>*z)) - exp (\<i>*z)) / 2))" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3452 | by (simp add: field_simps power2_eq_square) | 
| 76137 | 3453 | also have "\<dots> = - (\<i> * Ln (((exp (\<i>*z) + inverse (exp (\<i>*z)))/2) - (inverse (exp (\<i>*z)) - exp (\<i>*z)) / 2))" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3454 | apply (subst csqrt_square) | 
| 72301 | 3455 | using assms Re_eq_pihalf_lemma Re_less_pihalf_lemma by auto | 
| 76137 | 3456 | also have "\<dots> = - (\<i> * Ln (exp (\<i>*z)))" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3457 | by (simp add: field_simps power2_eq_square) | 
| 76137 | 3458 | also have "\<dots> = z" | 
| 68281 | 3459 | 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 | 3460 | finally show ?thesis . | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3461 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3462 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3463 | lemma Arcsin_unique: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3464 | "\<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 | 3465 | by (metis Arcsin_sin) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3466 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3467 | lemma Arcsin_0 [simp]: "Arcsin 0 = 0" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3468 | by (simp add: Arcsin_unique) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3469 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3470 | lemma Arcsin_1 [simp]: "Arcsin 1 = pi/2" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3471 | using Arcsin_unique sin_of_real_pi_half by fastforce | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3472 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3473 | lemma Arcsin_minus_1 [simp]: "Arcsin(-1) = - (pi/2)" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3474 | by (simp add: Arcsin_unique) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3475 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3476 | lemma has_field_derivative_Arcsin: | 
| 68281 | 3477 | 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 | 3478 | shows "(Arcsin has_field_derivative inverse(cos(Arcsin z))) (at z)" | 
| 68493 | 3479 | proof - | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3480 | have "(sin (Arcsin z))\<^sup>2 \<noteq> 1" | 
| 68281 | 3481 | 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 | 3482 | then have "cos (Arcsin z) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3483 | 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 | 3484 | then show ?thesis | 
| 68281 | 3485 | 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 | 3486 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3487 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3488 | declare has_field_derivative_Arcsin [derivative_intros] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3489 | 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 | 3490 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3491 | 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 | 3492 | "(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 | 3493 | 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 | 3494 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3495 | 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 | 3496 | "(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 | 3497 | 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 | 3498 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3499 | lemma continuous_within_Arcsin: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3500 | "(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 | 3501 | 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 | 3502 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3503 | lemma continuous_on_Arcsin [continuous_intros]: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3504 | "(\<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 | 3505 | 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 | 3506 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3507 | 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 | 3508 | 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 | 3509 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3510 | |
| 60420 | 3511 | subsection\<open>Inverse Cosine\<close> | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3512 | |
| 70136 | 3513 | 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 | 3514 | "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 | 3515 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3516 | lemma Arccos_range_lemma: "\<bar>Re z\<bar> < 1 \<Longrightarrow> 0 < Im(z + \<i> * csqrt(1 - z\<^sup>2))" | 
| 68281 | 3517 | 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 | 3518 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3519 | lemma Arccos_body_lemma: "z + \<i> * csqrt(1 - z\<^sup>2) \<noteq> 0" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3520 | by (metis Arcsin_body_lemma complex_i_mult_minus diff_0 diff_eq_eq power2_minus) | 
| 59870 
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 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 | 3523 | by (simp add: Arccos_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3524 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3525 | 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 | 3526 | 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 | 3527 | |
| 60420 | 3528 | text\<open>A very tricky argument to find!\<close> | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3529 | lemma isCont_Arccos_lemma: | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3530 | 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 | 3531 | shows False | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3532 | proof (cases "Im z = 0") | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3533 | case True | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3534 | then show ?thesis | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3535 | 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 | 3536 | next | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3537 | case False | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3538 | 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 | 3539 | 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 | 3540 | by (simp add: Re_power2 algebra_simps) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3541 | 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 | 3542 | proof (clarsimp simp add: cmod_def) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3543 | 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 | 3544 | 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 | 3545 | by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3546 | then show False using False | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3547 | 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 | 3548 | qed | 
| 72301 | 3549 | moreover have "(Im z)\<^sup>2 = (1 + ((Im z)\<^sup>2 + cmod (1 - z\<^sup>2)) - (Re z)\<^sup>2) / 2" | 
| 3550 | using abs_Re_le_cmod [of "1-z\<^sup>2"] by (subst Imz) (simp add: Re_power2) | |
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3551 | ultimately show False | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3552 | by (simp add: cmod_power2) | 
| 59870 
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 | lemma isCont_Arccos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3556 | 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 | 3557 | shows "isCont Arccos z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3558 | proof - | 
| 62131 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3559 | 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 | 3560 | by (metis complex_nonpos_Reals_iff isCont_Arccos_lemma assms) | 
| 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 paulson parents: 
62087diff
changeset | 3561 | with assms show ?thesis | 
| 72301 | 3562 | unfolding Arccos_def | 
| 3563 | by (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 | 3564 | qed | 
| 
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 isCont_Arccos' [simp]: | 
| 72301 | 3567 | "isCont f z \<Longrightarrow> (Im (f z) = 0 \<Longrightarrow> \<bar>Re (f z)\<bar> < 1) \<Longrightarrow> isCont (\<lambda>x. Arccos (f x)) z" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3568 | 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 | 3569 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3570 | 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 | 3571 | proof - | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3572 | 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 | 3573 | by (simp add: algebra_simps) \<comment> \<open>Cancelling a factor of 2\<close> | 
| 76137 | 3574 | moreover have "\<dots> \<longleftrightarrow> z + \<i> * csqrt (1 - z\<^sup>2) = 0" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3575 | 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 | 3576 | ultimately show ?thesis | 
| 72301 | 3577 | by (simp add: cos_exp_eq Arccos_def Arccos_body_lemma exp_minus field_simps flip: power2_eq_square) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3578 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3579 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3580 | lemma Arccos_cos: | 
| 72301 | 3581 | assumes "0 < Re z \<and> Re z < pi \<or> | 
| 3582 | Re z = 0 \<and> 0 \<le> Im z \<or> | |
| 3583 | Re z = pi \<and> Im z \<le> 0" | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3584 | shows "Arccos(cos z) = z" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3585 | 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 | 3586 | 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 | 3587 | 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 | 3588 | 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 | 3589 | 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 | 3590 | 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 | 3591 | \<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 | 3592 | by (simp add: cos_exp_eq Arccos_def exp_minus power_divide) | 
| 76137 | 3593 | also have "\<dots> = - (\<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 | 3594 | \<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 | 3595 | apply (subst csqrt_square) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3596 | using assms Re_sin_pos [of z] Im_sin_nonneg [of z] Im_sin_nonneg2 [of z] | 
| 72301 | 3597 | by (auto simp: * Re_sin Im_sin) | 
| 76137 | 3598 | also have "\<dots> = - (\<i> * Ln (exp (\<i>*z)))" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3599 | by (simp add: field_simps power2_eq_square) | 
| 76137 | 3600 | also have "\<dots> = z" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3601 | using assms | 
| 72301 | 3602 | by (subst Complex_Transcendental.Ln_exp, auto) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3603 | finally show ?thesis . | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3604 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3605 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3606 | lemma Arccos_unique: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3607 | "\<lbrakk>cos z = w; | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3608 | 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 | 3609 | 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 | 3610 | 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 | 3611 | using Arccos_cos by blast | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3612 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3613 | lemma Arccos_0 [simp]: "Arccos 0 = pi/2" | 
| 68281 | 3614 | by (rule Arccos_unique) auto | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3615 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3616 | lemma Arccos_1 [simp]: "Arccos 1 = 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3617 | by (rule Arccos_unique) auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3618 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3619 | lemma Arccos_minus1: "Arccos(-1) = pi" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3620 | by (rule Arccos_unique) auto | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3621 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3622 | lemma has_field_derivative_Arccos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3623 | 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 | 3624 | 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 | 3625 | proof - | 
| 68281 | 3626 | have "x\<^sup>2 \<noteq> -1" for x::real | 
| 3627 | by (sos "((R<1 + (([~1] * A=0) + (R<1 * (R<1 * [x__]^2)))))") | |
| 3628 | with assms have "(cos (Arccos z))\<^sup>2 \<noteq> 1" | |
| 3629 | 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 | 3630 | then have "- sin (Arccos z) \<noteq> 0" | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3631 | 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 | 3632 | then have "(Arccos has_field_derivative inverse(- sin(Arccos z))) (at z)" | 
| 68281 | 3633 | by (rule has_field_derivative_inverse_basic [OF DERIV_cos _ _ open_ball [of z 1]]) | 
| 3634 | (auto intro: isCont_Arccos assms) | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3635 | then show ?thesis | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3636 | by simp | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3637 | qed | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3638 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3639 | declare has_field_derivative_Arcsin [derivative_intros] | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3640 | 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 | 3641 | |
| 62534 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3642 | 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 | 3643 | "(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 | 3644 | 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 | 3645 | |
| 
6855b348e828
complex_differentiable -> field_differentiable, etc. (making these theorems also available for type real)
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 3646 | 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 | 3647 | "(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 | 3648 | 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 | 3649 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3650 | lemma continuous_within_Arccos: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3651 | "(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 | 3652 | 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 | 3653 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3654 | lemma continuous_on_Arccos [continuous_intros]: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3655 | "(\<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 | 3656 | 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 | 3657 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3658 | 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 | 3659 | 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 | 3660 | |
| 70136 | 3661 | 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 | 3662 | |
| 61945 | 3663 | 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 | 3664 | unfolding Re_Arcsin | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3665 | 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 | 3666 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3667 | 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 | 3668 | unfolding Re_Arccos | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3669 | 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 | 3670 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3671 | 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 | 3672 | unfolding Re_Arccos | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3673 | 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 | 3674 | |
| 61945 | 3675 | 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 | 3676 | 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 | 3677 | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3678 | 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 | 3679 | proof - | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3680 | 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 | 3681 | using norm_cos_squared [of "Arccos w"] real_le_abs_sinh [of "Im (Arccos w)"] | 
| 72301 | 3682 | by (simp only: abs_le_square_iff) (simp add: field_split_simps) | 
| 76137 | 3683 | also have "\<dots> \<le> (cmod w)\<^sup>2" | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3684 | by (auto simp: cmod_power2) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3685 | 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 | 3686 | using abs_le_square_iff by force | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3687 | 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 | 3688 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3689 | 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 | 3690 | unfolding Re_Arcsin | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3691 | 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 | 3692 | |
| 61945 | 3693 | 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 | 3694 | 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 | 3695 | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3696 | lemma norm_Arccos_bounded: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3697 | fixes w :: complex | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3698 | shows "norm (Arccos w) \<le> pi + norm w" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3699 | proof - | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3700 | 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 | 3701 | 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 | 3702 | 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 | 3703 | 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 | 3704 | then have "cmod (Arccos w) \<le> pi + cmod (cos (Arccos w))" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3705 | by (smt (verit) Im_Arccos_bound Re_Arccos_bound cmod_le cos_Arccos) | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3706 | then show "cmod (Arccos w) \<le> pi + cmod w" | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3707 | by auto | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3708 | qed | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64593diff
changeset | 3709 | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3710 | |
| 70136 | 3711 | 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 | 3712 | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3713 | lemma cos_Arcsin_nonzero: "z\<^sup>2 \<noteq> 1 \<Longrightarrow>cos(Arcsin z) \<noteq> 0" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3714 | by (metis diff_0_right power_zero_numeral sin_Arcsin sin_squared_eq) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3715 | |
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3716 | lemma sin_Arccos_nonzero: "z\<^sup>2 \<noteq> 1 \<Longrightarrow>sin(Arccos z) \<noteq> 0" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3717 | by (metis add.right_neutral cos_Arccos power2_eq_square power_zero_numeral sin_cos_squared_add3) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3718 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3719 | lemma cos_sin_csqrt: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3720 | 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 | 3721 | shows "cos z = csqrt(1 - (sin z)\<^sup>2)" | 
| 72301 | 3722 | proof (rule csqrt_unique [THEN sym]) | 
| 3723 | show "(cos z)\<^sup>2 = 1 - (sin z)\<^sup>2" | |
| 3724 | by (simp add: cos_squared_eq) | |
| 3725 | qed (use assms in \<open>auto simp: Re_cos Im_cos add_pos_pos mult_le_0_iff zero_le_mult_iff\<close>) | |
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3726 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3727 | lemma sin_cos_csqrt: | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3728 | 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 | 3729 | shows "sin z = csqrt(1 - (cos z)\<^sup>2)" | 
| 72301 | 3730 | proof (rule csqrt_unique [THEN sym]) | 
| 3731 | show "(sin z)\<^sup>2 = 1 - (cos z)\<^sup>2" | |
| 3732 | by (simp add: sin_squared_eq) | |
| 3733 | qed (use assms in \<open>auto simp: Re_sin Im_sin add_pos_pos mult_le_0_iff zero_le_mult_iff\<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 Arcsin_Arccos_csqrt_pos: | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3736 | "(0 < Re z \<or> Re z = 0 \<and> 0 \<le> Im z) \<Longrightarrow> Arcsin z = Arccos(csqrt(1 - z\<^sup>2))" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3737 | 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 | 3738 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3739 | lemma Arccos_Arcsin_csqrt_pos: | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3740 | "(0 < Re z \<or> Re z = 0 \<and> 0 \<le> Im z) \<Longrightarrow> Arccos z = Arcsin(csqrt(1 - z\<^sup>2))" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3741 | 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 | 3742 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3743 | lemma sin_Arccos: | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3744 | "0 < Re z \<or> Re z = 0 \<and> 0 \<le> Im z \<Longrightarrow> sin(Arccos z) = csqrt(1 - z\<^sup>2)" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3745 | by (simp add: Arccos_Arcsin_csqrt_pos) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3746 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3747 | lemma cos_Arcsin: | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3748 | "0 < Re z \<or> Re z = 0 \<and> 0 \<le> Im z \<Longrightarrow> cos(Arcsin z) = csqrt(1 - z\<^sup>2)" | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3749 | by (simp add: Arcsin_Arccos_csqrt_pos) | 
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3750 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3751 | |
| 70136 | 3752 | 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 | 3753 | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3754 | lemma of_real_arcsin: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> of_real(arcsin x) = Arcsin(of_real x)" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3755 | by (smt (verit, best) Arcsin_sin Im_complex_of_real Re_complex_of_real arcsin sin_of_real) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3756 | |
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3757 | lemma Im_Arcsin_of_real: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> Im (Arcsin (of_real x)) = 0" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3758 | by (metis Im_complex_of_real of_real_arcsin) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3759 | |
| 70136 | 3760 | 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 | 3761 | 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 | 3762 | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3763 | lemma arcsin_eq_Re_Arcsin: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> arcsin x = Re (Arcsin (of_real x))" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3764 | by (metis Re_complex_of_real of_real_arcsin) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3765 | |
| 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3766 | |
| 70136 | 3767 | 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 | 3768 | |
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3769 | lemma of_real_arccos: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> of_real(arccos x) = Arccos(of_real x)" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3770 | by (smt (verit, del_insts) Arccos_unique Im_complex_of_real Re_complex_of_real arccos_lbound | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3771 | arccos_ubound cos_arccos_abs cos_of_real) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3772 | |
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3773 | lemma Im_Arccos_of_real: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> Im (Arccos (of_real x)) = 0" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3774 | by (metis Im_complex_of_real of_real_arccos) | 
| 59870 
68d6b6aa4450
HOL Light Libraries for complex Arctan, Arcsin, Arccos
 paulson <lp15@cam.ac.uk> parents: 
59862diff
changeset | 3775 | |
| 70136 | 3776 | 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>" | 
| 76819 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3777 | by (metis Im_Arccos_of_real complex_is_Real_iff of_real_Re) | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3778 | |
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3779 | lemma arccos_eq_Re_Arccos: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> arccos x = Re (Arccos (of_real x))" | 
| 
fc4ad2a2b6b1
reorganisation and simplification of theorems about transcendental functions
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 3780 | by (metis Re_complex_of_real of_real_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 | 3781 | |
| 70136 | 3782 | 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 | 3783 | |
| 
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 | 3784 | 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 | 3785 |     "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 | 3786 | 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 | 3787 |   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 | 3788 |         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 | 3789 | by (rule continuous_on_cong [OF refl]) (simp add: arcsin_eq_Re_Arcsin) | 
| 76137 | 3790 | also have "\<dots> = ?thesis" | 
| 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 | 3791 | 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 | 3792 | 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 | 3793 |     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 | 3794 | 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 | 3795 | 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 | 3796 | 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 | 3797 | |
| 
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 | 3798 | 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 | 3799 |     "continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arcsin"
 | 
| 77324 | 3800 | using closed_real_abs_le continuous_on_Arcsin_real continuous_on_eq_continuous_within | 
| 3801 | continuous_within_closed_nontrivial 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 | 3802 | |
| 
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 | 3803 | 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 | 3804 |     "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 | 3805 | 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 | 3806 |   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 | 3807 |         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 | 3808 | by (rule continuous_on_cong [OF refl]) (simp add: arccos_eq_Re_Arccos) | 
| 76137 | 3809 | also have "\<dots> = ?thesis" | 
| 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 | 3810 | 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 | 3811 | 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 | 3812 |     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 | 3813 | 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 | 3814 | 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 | 3815 | 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 | 3816 | |
| 
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 | 3817 | 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 | 3818 |     "continuous (at z within {w \<in> \<real>. \<bar>Re w\<bar> \<le> 1}) Arccos"
 | 
| 77324 | 3819 | using closed_real_abs_le continuous_on_Arccos_real continuous_on_eq_continuous_within | 
| 3820 | continuous_within_closed_nontrivial 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 | 3821 | |
| 67578 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3822 | 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 | 3823 | 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 | 3824 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3825 | 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 | 3826 | 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 | 3827 | |
| 
6a9a0f2bb9b4
Some lemmas about complex sinh/cosh/tanh
 Manuel Eberl <eberlm@in.tum.de> parents: 
67443diff
changeset | 3828 | 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 | 3829 | 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 | 3830 | |
| 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 | 3831 | |
| 60420 | 3832 | 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 | 3833 | |
| 69180 
922833cc6839
Tagged some theories in HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
68721diff
changeset | 3834 | 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 | 3835 | 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 | 3836 | 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 | 3837 | shows "exp(2 * of_real pi * \<i> * of_nat j / of_nat n)^n = 1" | 
| 76137 | 3838 | by (metis assms bot_nat_0.not_eq_extremum exp_divide_power_eq exp_of_nat2_mult exp_two_pi_i power_one) | 
| 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 | 3839 | |
| 
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 | 3840 | 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 | 3841 | 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 | 3842 | 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 | 3843 | 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 | 3844 | \<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 | 3845 | 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 | 3846 | 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 | 3847 | \<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 | 3848 | (\<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 | 3849 | (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 | 3850 | by (simp add: algebra_simps) | 
| 76137 | 3851 | also have "\<dots> \<longleftrightarrow> (\<exists>z::int. of_nat j = of_nat k + of_nat n * (of_int 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 | 3852 | by simp | 
| 76137 | 3853 | also have "\<dots> \<longleftrightarrow> (\<exists>z::int. of_nat j = of_nat k + of_nat n * z)" | 
| 73932 
fd21b4a93043
added opaque_combs and renamed hide_lams to opaque_lifting
 desharna parents: 
72301diff
changeset | 3854 | by (metis (mono_tags, opaque_lifting) of_int_add of_int_eq_iff of_int_mult of_int_of_nat_eq) | 
| 76137 | 3855 | also have "\<dots> \<longleftrightarrow> int j mod int n = int k mod int n" | 
| 64593 
50c715579715
reoriented congruence rules in non-explosive direction
 haftmann parents: 
64508diff
changeset | 3856 | by (auto simp: mod_eq_dvd_iff dvd_def algebra_simps) | 
| 76137 | 3857 | also have "\<dots> \<longleftrightarrow> j mod n = k mod 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 | 3858 | 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 | 3859 | 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 | 3860 | \<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 | 3861 | 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 | 3862 | show ?thesis | 
| 78475 | 3863 | using assms 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 | 3864 | 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 | 3865 | |
| 
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 | 3866 | 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 | 3867 | "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 | 3868 |               {..<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 | 3869 | 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 | 3870 | |
| 
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 | 3871 | 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 | 3872 | 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 | 3873 | 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 | 3874 | 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 | 3875 | 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 | 3876 | 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 | 3877 | 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 | 3878 | 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 | 3879 | 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 | 3880 | 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 | 3881 | 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 | 3882 | 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 | 3883 | 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 | 3884 | |
| 
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 | 3885 | lemma finite_complex_roots_unity_explicit: | 
| 77230 
2d26af072990
Some basis results about trigonometric functions
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 3886 |   "finite {exp(2 * of_real pi * \<i> * of_nat j / of_nat n) | j::nat. j < n}"
 | 
| 
2d26af072990
Some basis results about trigonometric functions
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 3887 | 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 | 3888 | |
| 
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 | 3889 | 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 | 3890 |      "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 | 3891 | 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 | 3892 | |
| 
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 | 3893 | 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 | 3894 | assumes "1 \<le> n" | 
| 72301 | 3895 |     shows "{z::complex. z^n = 1} = {exp(2 * of_real pi * \<i> * of_nat j / of_nat n) | j. j < 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 | 3896 | 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 | 3897 | 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 | 3898 | 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 | 3899 | 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 | 3900 | |
| 
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 | 3901 | 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 | 3902 | 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 | 3903 | |
| 
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 | 3904 | 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 | 3905 | "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 | 3906 | 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 | 3907 | 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 | 3908 | 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 | 3909 | |
| 59745 
390476a0ef13
new file for complex transcendental functions
 paulson <lp15@cam.ac.uk> parents: diff
changeset | 3910 | end |