equal
deleted
inserted
replaced
29 |
29 |
30 |
30 |
31 subsection {* Casting a nat power to an integer *} |
31 subsection {* Casting a nat power to an integer *} |
32 |
32 |
33 lemma zpow_int: "int (x^y) = (int x)^y" |
33 lemma zpow_int: "int (x^y) = (int x)^y" |
34 apply (induct_tac y) |
34 apply (induct y) |
35 apply (simp, simp add: zmult_int [THEN sym]) |
35 apply (simp, simp add: zmult_int [THEN sym]) |
36 done |
36 done |
37 |
37 |
38 subsection {* Even and odd are mutually exclusive *} |
38 subsection {* Even and odd are mutually exclusive *} |
39 |
39 |
88 "even ((x::int) - y) = ((even x & even y) | (odd x & odd y))" |
88 "even ((x::int) - y) = ((even x & even y) | (odd x & odd y))" |
89 by (simp only: diff_minus even_sum even_neg) |
89 by (simp only: diff_minus even_sum even_neg) |
90 |
90 |
91 lemma even_pow_gt_zero [rule_format]: |
91 lemma even_pow_gt_zero [rule_format]: |
92 "even (x::int) ==> 0 < n --> even (x^n)" |
92 "even (x::int) ==> 0 < n --> even (x^n)" |
93 apply (induct_tac n) |
93 apply (induct n) |
94 apply (auto simp add: even_product) |
94 apply (auto simp add: even_product) |
95 done |
95 done |
96 |
96 |
97 lemma odd_pow: "odd x ==> odd((x::int)^n)" |
97 lemma odd_pow: "odd x ==> odd((x::int)^n)" |
98 apply (induct_tac n) |
98 apply (induct n) |
99 apply (simp add: even_def) |
99 apply (simp add: even_def) |
100 apply (simp add: even_product) |
100 apply (simp add: even_product) |
101 done |
101 done |
102 |
102 |
103 lemma even_power: "even ((x::int)^n) = (even x & 0 < n)" |
103 lemma even_power: "even ((x::int)^n) = (even x & 0 < n)" |
235 subsection {* Powers of negative one *} |
235 subsection {* Powers of negative one *} |
236 |
236 |
237 lemma neg_one_even_odd_power: |
237 lemma neg_one_even_odd_power: |
238 "(even x --> (-1::'a::{number_ring,recpower})^x = 1) & |
238 "(even x --> (-1::'a::{number_ring,recpower})^x = 1) & |
239 (odd x --> (-1::'a)^x = -1)" |
239 (odd x --> (-1::'a)^x = -1)" |
240 apply (induct_tac x) |
240 apply (induct x) |
241 apply (simp, simp add: power_Suc) |
241 apply (simp, simp add: power_Suc) |
242 done |
242 done |
243 |
243 |
244 lemma neg_one_even_power [simp]: |
244 lemma neg_one_even_power [simp]: |
245 "even x ==> (-1::'a::{number_ring,recpower})^x = 1" |
245 "even x ==> (-1::'a::{number_ring,recpower})^x = 1" |