# HG changeset patch # User huffman # Date 1180645336 -7200 # Node ID 3004310c95b153298b63dc7e1b4240aa22b86c80 # Parent 40a760921d94a7f81412383725d1c422892af0f3 replace (- 1) with -1 diff -r 40a760921d94 -r 3004310c95b1 src/HOL/Hyperreal/HTranscendental.thy --- a/src/HOL/Hyperreal/HTranscendental.thy Thu May 31 22:23:50 2007 +0200 +++ b/src/HOL/Hyperreal/HTranscendental.thy Thu May 31 23:02:16 2007 +0200 @@ -421,7 +421,7 @@ lemma HFinite_sin [simp]: "sumhr (0, whn, %n. (if even(n) then 0 else - ((- 1) ^ ((n - 1) div 2))/(real (fact n))) * x ^ n) + (-1 ^ ((n - 1) div 2))/(real (fact n))) * x ^ n) \ HFinite" unfolding sumhr_app apply (simp only: star_zero_def starfun2_star_of) @@ -447,7 +447,7 @@ lemma HFinite_cos [simp]: "sumhr (0, whn, %n. (if even(n) then - ((- 1) ^ (n div 2))/(real (fact n)) else + (-1 ^ (n div 2))/(real (fact n)) else 0) * x ^ n) \ HFinite" unfolding sumhr_app apply (simp only: star_zero_def starfun2_star_of) diff -r 40a760921d94 -r 3004310c95b1 src/HOL/Hyperreal/MacLaurin.thy --- a/src/HOL/Hyperreal/MacLaurin.thy Thu May 31 22:23:50 2007 +0200 +++ b/src/HOL/Hyperreal/MacLaurin.thy Thu May 31 23:02:16 2007 +0200 @@ -243,7 +243,7 @@ (\m=0..t. abs t \ abs x & sin x = (\m=0..t. sin x = (\m=0..t. 0 < t & t < x & sin x = (\m=0..t. 0 < t & t \ x & sin x = (\m=0..m=0..<(Suc n). - (if even m then (- 1) ^ (m div 2)/(real (fact m)) else 0) * 0 ^ m) = 1" + (if even m then -1 ^ (m div 2)/(real (fact m)) else 0) * 0 ^ m) = 1" by (induct "n", auto) lemma Maclaurin_cos_expansion: "\t. abs t \ abs x & cos x = (\m=0..t. 0 < t & t < x & cos x = (\m=0..t. x < t & t < 0 & cos x = (\m=0..m=0..m=0.. inverse(real (fact n)) * \x\ ^ n" proof - have "!! x (y::real). x \ 1 \ 0 \ y \ x * y \ 1 * y" @@ -576,7 +576,7 @@ ?diff n t / real (fact n) * x ^ n" by fast have diff_m_0: "\m. ?diff m 0 = (if even m then 0 - else (- 1) ^ ((m - Suc 0) div 2))" + else -1 ^ ((m - Suc 0) div 2))" apply (subst even_even_mod_4_iff) apply (cut_tac m=m in mod_exhaust_less_4) apply (elim disjE, simp_all) diff -r 40a760921d94 -r 3004310c95b1 src/HOL/Hyperreal/Transcendental.thy --- a/src/HOL/Hyperreal/Transcendental.thy Thu May 31 22:23:50 2007 +0200 +++ b/src/HOL/Hyperreal/Transcendental.thy Thu May 31 23:02:16 2007 +0200 @@ -444,11 +444,11 @@ definition sin :: "real => real" where "sin x = (\n. (if even(n) then 0 else - ((- 1) ^ ((n - Suc 0) div 2))/(real (fact n))) * x ^ n)" + (-1 ^ ((n - Suc 0) div 2))/(real (fact n))) * x ^ n)" definition cos :: "real => real" where - "cos x = (\n. (if even(n) then ((- 1) ^ (n div 2))/(real (fact n)) + "cos x = (\n. (if even(n) then (-1 ^ (n div 2))/(real (fact n)) else 0) * x ^ n)" lemma summable_exp_generic: @@ -498,7 +498,7 @@ lemma summable_sin: "summable (%n. (if even n then 0 - else (- 1) ^ ((n - Suc 0) div 2)/(real (fact n))) * + else -1 ^ ((n - Suc 0) div 2)/(real (fact n))) * x ^ n)" apply (rule_tac g = "(%n. inverse (real (fact n)) * \x\ ^ n)" in summable_comparison_test) apply (rule_tac [2] summable_exp) @@ -509,7 +509,7 @@ lemma summable_cos: "summable (%n. (if even n then - (- 1) ^ (n div 2)/(real (fact n)) else 0) * x ^ n)" + -1 ^ (n div 2)/(real (fact n)) else 0) * x ^ n)" apply (rule_tac g = "(%n. inverse (real (fact n)) * \x\ ^ n)" in summable_comparison_test) apply (rule_tac [2] summable_exp) apply (rule_tac x = 0 in exI) @@ -518,12 +518,12 @@ lemma lemma_STAR_sin [simp]: "(if even n then 0 - else (- 1) ^ ((n - Suc 0) div 2)/(real (fact n))) * 0 ^ n = 0" + else -1 ^ ((n - Suc 0) div 2)/(real (fact n))) * 0 ^ n = 0" by (induct "n", auto) lemma lemma_STAR_cos [simp]: "0 < n --> - (- 1) ^ (n div 2)/(real (fact n)) * 0 ^ n = 0" + -1 ^ (n div 2)/(real (fact n)) * 0 ^ n = 0" by (induct "n", auto) lemma lemma_STAR_cos1 [simp]: @@ -532,7 +532,7 @@ by (induct "n", auto) lemma lemma_STAR_cos2 [simp]: - "(\n=1..n=1..n. - ((if even n then 0 - else (- 1) ^ ((n - Suc 0) div 2)/(real (fact n))) * x ^ n))" + else -1 ^ ((n - Suc 0) div 2)/(real (fact n))) * x ^ n))" by (auto intro!: sums_unique sums_minus sin_converges) lemma lemma_exp_ext: "exp = (\x. \n. x ^ n /# real (fact n))" @@ -622,13 +622,13 @@ lemma lemma_sin_ext: "sin = (%x. \n. (if even n then 0 - else (- 1) ^ ((n - Suc 0) div 2)/(real (fact n))) * + else -1 ^ ((n - Suc 0) div 2)/(real (fact n))) * x ^ n)" by (auto intro!: ext simp add: sin_def) lemma lemma_cos_ext: "cos = (%x. \n. - (if even n then (- 1) ^ (n div 2)/(real (fact n)) else 0) * + (if even n then -1 ^ (n div 2)/(real (fact n)) else 0) * x ^ n)" by (auto intro!: ext simp add: cos_def) @@ -1003,7 +1003,7 @@ lemma cos_zero [simp]: "cos 0 = 1" apply (simp add: cos_def) apply (rule sums_unique [symmetric]) -apply (cut_tac n = 1 and f = "(%n. (if even n then (- 1) ^ (n div 2) / (real (fact n)) else 0) * 0 ^ n)" in lemma_series_zero2) +apply (cut_tac n = 1 and f = "(%n. (if even n then -1 ^ (n div 2) / (real (fact n)) else 0) * 0 ^ n)" in lemma_series_zero2) apply auto done @@ -1243,12 +1243,12 @@ hence define pi.*} lemma sin_paired: - "(%n. (- 1) ^ n /(real (fact (2 * n + 1))) * x ^ (2 * n + 1)) + "(%n. -1 ^ n /(real (fact (2 * n + 1))) * x ^ (2 * n + 1)) sums sin x" proof - have "(\n. \k = n * 2.. 0 < sin x" apply (subgoal_tac "(\n. \k = n * 2..n. (- 1) ^ n / real (fact (2 * n + 1)) * x ^ (2 * n + 1))") + -1 ^ k / real (fact (2 * k + 1)) * x ^ (2 * k + 1)) + sums (\n. -1 ^ n / real (fact (2 * n + 1)) * x ^ (2 * n + 1))") prefer 2 apply (rule sin_paired [THEN sums_summable, THEN sums_group], simp) apply (rotate_tac 2) @@ -1312,10 +1312,10 @@ done lemma cos_paired: - "(%n. (- 1) ^ n /(real (fact (2 * n))) * x ^ (2 * n)) sums cos x" + "(%n. -1 ^ n /(real (fact (2 * n))) * x ^ (2 * n)) sums cos x" proof - have "(\n. \k = n * 2..n=0..< Suc(Suc(Suc 0)). - ((- 1) ^ n / (real(fact (2*n))) * 2 ^ (2*n))" + "\n=0..< Suc(Suc(Suc 0)). - (-1 ^ n / (real(fact (2*n))) * 2 ^ (2*n))" in order_less_trans) apply (simp (no_asm) add: fact_num_eq_if realpow_num_eq_if del: fact_Suc realpow_Suc) apply (simp (no_asm) add: mult_assoc del: setsum_op_ivl_Suc)