author | wenzelm |
Sun, 28 Jan 2007 23:29:14 +0100 | |
changeset 22200 | d4797b506752 |
parent 21404 | eb85850d3eb7 |
child 22390 | 378f34b1e380 |
permissions | -rw-r--r-- |
21263 | 1 |
(* Title: HOL/Library/Parity.thy |
21256 | 2 |
ID: $Id$ |
3 |
Author: Jeremy Avigad |
|
4 |
*) |
|
5 |
||
6 |
header {* Even and Odd for int and nat *} |
|
7 |
||
8 |
theory Parity |
|
9 |
imports Main |
|
10 |
begin |
|
11 |
||
12 |
axclass even_odd < type |
|
13 |
||
14 |
consts |
|
15 |
even :: "'a::even_odd => bool" |
|
16 |
||
17 |
instance int :: even_odd .. |
|
18 |
instance nat :: even_odd .. |
|
19 |
||
20 |
defs (overloaded) |
|
21 |
even_def: "even (x::int) == x mod 2 = 0" |
|
22 |
even_nat_def: "even (x::nat) == even (int x)" |
|
23 |
||
24 |
abbreviation |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21263
diff
changeset
|
25 |
odd :: "'a::even_odd => bool" where |
21256 | 26 |
"odd x == \<not> even x" |
27 |
||
28 |
||
29 |
subsection {* Even and odd are mutually exclusive *} |
|
30 |
||
21263 | 31 |
lemma int_pos_lt_two_imp_zero_or_one: |
21256 | 32 |
"0 <= x ==> (x::int) < 2 ==> x = 0 | x = 1" |
33 |
by auto |
|
34 |
||
35 |
lemma neq_one_mod_two [simp]: "((x::int) mod 2 ~= 0) = (x mod 2 = 1)" |
|
21263 | 36 |
proof - |
37 |
have "x mod 2 = 0 | x mod 2 = 1" |
|
38 |
by (rule int_pos_lt_two_imp_zero_or_one) auto |
|
39 |
then show ?thesis by force |
|
40 |
qed |
|
41 |
||
21256 | 42 |
|
43 |
subsection {* Behavior under integer arithmetic operations *} |
|
44 |
||
45 |
lemma even_times_anything: "even (x::int) ==> even (x * y)" |
|
46 |
by (simp add: even_def zmod_zmult1_eq') |
|
47 |
||
48 |
lemma anything_times_even: "even (y::int) ==> even (x * y)" |
|
49 |
by (simp add: even_def zmod_zmult1_eq) |
|
50 |
||
51 |
lemma odd_times_odd: "odd (x::int) ==> odd y ==> odd (x * y)" |
|
52 |
by (simp add: even_def zmod_zmult1_eq) |
|
53 |
||
54 |
lemma even_product: "even((x::int) * y) = (even x | even y)" |
|
21263 | 55 |
apply (auto simp add: even_times_anything anything_times_even) |
21256 | 56 |
apply (rule ccontr) |
57 |
apply (auto simp add: odd_times_odd) |
|
58 |
done |
|
59 |
||
60 |
lemma even_plus_even: "even (x::int) ==> even y ==> even (x + y)" |
|
61 |
by (simp add: even_def zmod_zadd1_eq) |
|
62 |
||
63 |
lemma even_plus_odd: "even (x::int) ==> odd y ==> odd (x + y)" |
|
64 |
by (simp add: even_def zmod_zadd1_eq) |
|
65 |
||
66 |
lemma odd_plus_even: "odd (x::int) ==> even y ==> odd (x + y)" |
|
67 |
by (simp add: even_def zmod_zadd1_eq) |
|
68 |
||
69 |
lemma odd_plus_odd: "odd (x::int) ==> odd y ==> even (x + y)" |
|
70 |
by (simp add: even_def zmod_zadd1_eq) |
|
71 |
||
72 |
lemma even_sum: "even ((x::int) + y) = ((even x & even y) | (odd x & odd y))" |
|
73 |
apply (auto intro: even_plus_even odd_plus_odd) |
|
74 |
apply (rule ccontr, simp add: even_plus_odd) |
|
75 |
apply (rule ccontr, simp add: odd_plus_even) |
|
76 |
done |
|
77 |
||
78 |
lemma even_neg: "even (-(x::int)) = even x" |
|
79 |
by (auto simp add: even_def zmod_zminus1_eq_if) |
|
80 |
||
21263 | 81 |
lemma even_difference: |
82 |
"even ((x::int) - y) = ((even x & even y) | (odd x & odd y))" |
|
21256 | 83 |
by (simp only: diff_minus even_sum even_neg) |
84 |
||
21263 | 85 |
lemma even_pow_gt_zero: |
86 |
"even (x::int) ==> 0 < n ==> even (x^n)" |
|
87 |
by (induct n) (auto simp add: even_product) |
|
21256 | 88 |
|
89 |
lemma odd_pow: "odd x ==> odd((x::int)^n)" |
|
90 |
apply (induct n) |
|
21263 | 91 |
apply (simp add: even_def) |
21256 | 92 |
apply (simp add: even_product) |
93 |
done |
|
94 |
||
95 |
lemma even_power: "even ((x::int)^n) = (even x & 0 < n)" |
|
21263 | 96 |
apply (auto simp add: even_pow_gt_zero) |
21256 | 97 |
apply (erule contrapos_pp, erule odd_pow) |
98 |
apply (erule contrapos_pp, simp add: even_def) |
|
99 |
done |
|
100 |
||
101 |
lemma even_zero: "even (0::int)" |
|
102 |
by (simp add: even_def) |
|
103 |
||
104 |
lemma odd_one: "odd (1::int)" |
|
105 |
by (simp add: even_def) |
|
106 |
||
21263 | 107 |
lemmas even_odd_simps [simp] = even_def[of "number_of v",standard] even_zero |
21256 | 108 |
odd_one even_product even_sum even_neg even_difference even_power |
109 |
||
110 |
||
111 |
subsection {* Equivalent definitions *} |
|
112 |
||
21263 | 113 |
lemma two_times_even_div_two: "even (x::int) ==> 2 * (x div 2) = x" |
21256 | 114 |
by (auto simp add: even_def) |
115 |
||
21263 | 116 |
lemma two_times_odd_div_two_plus_one: "odd (x::int) ==> |
21256 | 117 |
2 * (x div 2) + 1 = x" |
21263 | 118 |
apply (insert zmod_zdiv_equality [of x 2, symmetric]) |
119 |
apply (simp add: even_def) |
|
120 |
done |
|
21256 | 121 |
|
122 |
lemma even_equiv_def: "even (x::int) = (EX y. x = 2 * y)" |
|
123 |
apply auto |
|
124 |
apply (rule exI) |
|
21263 | 125 |
apply (erule two_times_even_div_two [symmetric]) |
126 |
done |
|
21256 | 127 |
|
128 |
lemma odd_equiv_def: "odd (x::int) = (EX y. x = 2 * y + 1)" |
|
129 |
apply auto |
|
130 |
apply (rule exI) |
|
21263 | 131 |
apply (erule two_times_odd_div_two_plus_one [symmetric]) |
132 |
done |
|
21256 | 133 |
|
134 |
||
135 |
subsection {* even and odd for nats *} |
|
136 |
||
137 |
lemma pos_int_even_equiv_nat_even: "0 \<le> x ==> even x = even (nat x)" |
|
138 |
by (simp add: even_nat_def) |
|
139 |
||
140 |
lemma even_nat_product: "even((x::nat) * y) = (even x | even y)" |
|
141 |
by (simp add: even_nat_def int_mult) |
|
142 |
||
21263 | 143 |
lemma even_nat_sum: "even ((x::nat) + y) = |
21256 | 144 |
((even x & even y) | (odd x & odd y))" |
145 |
by (unfold even_nat_def, simp) |
|
146 |
||
21263 | 147 |
lemma even_nat_difference: |
21256 | 148 |
"even ((x::nat) - y) = (x < y | (even x & even y) | (odd x & odd y))" |
21263 | 149 |
apply (auto simp add: even_nat_def zdiff_int [symmetric]) |
150 |
apply (case_tac "x < y", auto simp add: zdiff_int [symmetric]) |
|
151 |
apply (case_tac "x < y", auto simp add: zdiff_int [symmetric]) |
|
21256 | 152 |
done |
153 |
||
154 |
lemma even_nat_Suc: "even (Suc x) = odd x" |
|
155 |
by (simp add: even_nat_def) |
|
156 |
||
157 |
lemma even_nat_power: "even ((x::nat)^y) = (even x & 0 < y)" |
|
158 |
by (simp add: even_nat_def int_power) |
|
159 |
||
160 |
lemma even_nat_zero: "even (0::nat)" |
|
161 |
by (simp add: even_nat_def) |
|
162 |
||
21263 | 163 |
lemmas even_odd_nat_simps [simp] = even_nat_def[of "number_of v",standard] |
21256 | 164 |
even_nat_zero even_nat_Suc even_nat_product even_nat_sum even_nat_power |
165 |
||
166 |
||
167 |
subsection {* Equivalent definitions *} |
|
168 |
||
21263 | 169 |
lemma nat_lt_two_imp_zero_or_one: "(x::nat) < Suc (Suc 0) ==> |
21256 | 170 |
x = 0 | x = Suc 0" |
171 |
by auto |
|
172 |
||
173 |
lemma even_nat_mod_two_eq_zero: "even (x::nat) ==> x mod (Suc (Suc 0)) = 0" |
|
21263 | 174 |
apply (insert mod_div_equality [of x "Suc (Suc 0)", symmetric]) |
21256 | 175 |
apply (drule subst, assumption) |
176 |
apply (subgoal_tac "x mod Suc (Suc 0) = 0 | x mod Suc (Suc 0) = Suc 0") |
|
177 |
apply force |
|
178 |
apply (subgoal_tac "0 < Suc (Suc 0)") |
|
179 |
apply (frule mod_less_divisor [of "Suc (Suc 0)" x]) |
|
180 |
apply (erule nat_lt_two_imp_zero_or_one, auto) |
|
181 |
done |
|
182 |
||
183 |
lemma odd_nat_mod_two_eq_one: "odd (x::nat) ==> x mod (Suc (Suc 0)) = Suc 0" |
|
21263 | 184 |
apply (insert mod_div_equality [of x "Suc (Suc 0)", symmetric]) |
21256 | 185 |
apply (drule subst, assumption) |
186 |
apply (subgoal_tac "x mod Suc (Suc 0) = 0 | x mod Suc (Suc 0) = Suc 0") |
|
21263 | 187 |
apply force |
21256 | 188 |
apply (subgoal_tac "0 < Suc (Suc 0)") |
189 |
apply (frule mod_less_divisor [of "Suc (Suc 0)" x]) |
|
190 |
apply (erule nat_lt_two_imp_zero_or_one, auto) |
|
191 |
done |
|
192 |
||
21263 | 193 |
lemma even_nat_equiv_def: "even (x::nat) = (x mod Suc (Suc 0) = 0)" |
21256 | 194 |
apply (rule iffI) |
195 |
apply (erule even_nat_mod_two_eq_zero) |
|
196 |
apply (insert odd_nat_mod_two_eq_one [of x], auto) |
|
197 |
done |
|
198 |
||
199 |
lemma odd_nat_equiv_def: "odd (x::nat) = (x mod Suc (Suc 0) = Suc 0)" |
|
200 |
apply (auto simp add: even_nat_equiv_def) |
|
201 |
apply (subgoal_tac "x mod (Suc (Suc 0)) < Suc (Suc 0)") |
|
202 |
apply (frule nat_lt_two_imp_zero_or_one, auto) |
|
203 |
done |
|
204 |
||
21263 | 205 |
lemma even_nat_div_two_times_two: "even (x::nat) ==> |
21256 | 206 |
Suc (Suc 0) * (x div Suc (Suc 0)) = x" |
21263 | 207 |
apply (insert mod_div_equality [of x "Suc (Suc 0)", symmetric]) |
21256 | 208 |
apply (drule even_nat_mod_two_eq_zero, simp) |
209 |
done |
|
210 |
||
21263 | 211 |
lemma odd_nat_div_two_times_two_plus_one: "odd (x::nat) ==> |
212 |
Suc( Suc (Suc 0) * (x div Suc (Suc 0))) = x" |
|
213 |
apply (insert mod_div_equality [of x "Suc (Suc 0)", symmetric]) |
|
21256 | 214 |
apply (drule odd_nat_mod_two_eq_one, simp) |
215 |
done |
|
216 |
||
217 |
lemma even_nat_equiv_def2: "even (x::nat) = (EX y. x = Suc (Suc 0) * y)" |
|
218 |
apply (rule iffI, rule exI) |
|
21263 | 219 |
apply (erule even_nat_div_two_times_two [symmetric], auto) |
21256 | 220 |
done |
221 |
||
222 |
lemma odd_nat_equiv_def2: "odd (x::nat) = (EX y. x = Suc(Suc (Suc 0) * y))" |
|
223 |
apply (rule iffI, rule exI) |
|
21263 | 224 |
apply (erule odd_nat_div_two_times_two_plus_one [symmetric], auto) |
21256 | 225 |
done |
226 |
||
227 |
subsection {* Parity and powers *} |
|
228 |
||
21263 | 229 |
lemma minus_one_even_odd_power: |
230 |
"(even x --> (- 1::'a::{comm_ring_1,recpower})^x = 1) & |
|
21256 | 231 |
(odd x --> (- 1::'a)^x = - 1)" |
232 |
apply (induct x) |
|
233 |
apply (rule conjI) |
|
234 |
apply simp |
|
235 |
apply (insert even_nat_zero, blast) |
|
236 |
apply (simp add: power_Suc) |
|
21263 | 237 |
done |
21256 | 238 |
|
239 |
lemma minus_one_even_power [simp]: |
|
21263 | 240 |
"even x ==> (- 1::'a::{comm_ring_1,recpower})^x = 1" |
241 |
using minus_one_even_odd_power by blast |
|
21256 | 242 |
|
243 |
lemma minus_one_odd_power [simp]: |
|
21263 | 244 |
"odd x ==> (- 1::'a::{comm_ring_1,recpower})^x = - 1" |
245 |
using minus_one_even_odd_power by blast |
|
21256 | 246 |
|
247 |
lemma neg_one_even_odd_power: |
|
21263 | 248 |
"(even x --> (-1::'a::{number_ring,recpower})^x = 1) & |
21256 | 249 |
(odd x --> (-1::'a)^x = -1)" |
250 |
apply (induct x) |
|
251 |
apply (simp, simp add: power_Suc) |
|
252 |
done |
|
253 |
||
254 |
lemma neg_one_even_power [simp]: |
|
21263 | 255 |
"even x ==> (-1::'a::{number_ring,recpower})^x = 1" |
256 |
using neg_one_even_odd_power by blast |
|
21256 | 257 |
|
258 |
lemma neg_one_odd_power [simp]: |
|
21263 | 259 |
"odd x ==> (-1::'a::{number_ring,recpower})^x = -1" |
260 |
using neg_one_even_odd_power by blast |
|
21256 | 261 |
|
262 |
lemma neg_power_if: |
|
21263 | 263 |
"(-x::'a::{comm_ring_1,recpower}) ^ n = |
21256 | 264 |
(if even n then (x ^ n) else -(x ^ n))" |
21263 | 265 |
apply (induct n) |
266 |
apply (simp_all split: split_if_asm add: power_Suc) |
|
267 |
done |
|
21256 | 268 |
|
21263 | 269 |
lemma zero_le_even_power: "even n ==> |
21256 | 270 |
0 <= (x::'a::{recpower,ordered_ring_strict}) ^ n" |
271 |
apply (simp add: even_nat_equiv_def2) |
|
272 |
apply (erule exE) |
|
273 |
apply (erule ssubst) |
|
274 |
apply (subst power_add) |
|
275 |
apply (rule zero_le_square) |
|
276 |
done |
|
277 |
||
21263 | 278 |
lemma zero_le_odd_power: "odd n ==> |
21256 | 279 |
(0 <= (x::'a::{recpower,ordered_idom}) ^ n) = (0 <= x)" |
280 |
apply (simp add: odd_nat_equiv_def2) |
|
281 |
apply (erule exE) |
|
282 |
apply (erule ssubst) |
|
283 |
apply (subst power_Suc) |
|
284 |
apply (subst power_add) |
|
285 |
apply (subst zero_le_mult_iff) |
|
286 |
apply auto |
|
287 |
apply (subgoal_tac "x = 0 & 0 < y") |
|
288 |
apply (erule conjE, assumption) |
|
21263 | 289 |
apply (subst power_eq_0_iff [symmetric]) |
21256 | 290 |
apply (subgoal_tac "0 <= x^y * x^y") |
291 |
apply simp |
|
292 |
apply (rule zero_le_square)+ |
|
21263 | 293 |
done |
21256 | 294 |
|
21263 | 295 |
lemma zero_le_power_eq: "(0 <= (x::'a::{recpower,ordered_idom}) ^ n) = |
21256 | 296 |
(even n | (odd n & 0 <= x))" |
297 |
apply auto |
|
21263 | 298 |
apply (subst zero_le_odd_power [symmetric]) |
21256 | 299 |
apply assumption+ |
300 |
apply (erule zero_le_even_power) |
|
21263 | 301 |
apply (subst zero_le_odd_power) |
21256 | 302 |
apply assumption+ |
21263 | 303 |
done |
21256 | 304 |
|
21263 | 305 |
lemma zero_less_power_eq: "(0 < (x::'a::{recpower,ordered_idom}) ^ n) = |
21256 | 306 |
(n = 0 | (even n & x ~= 0) | (odd n & 0 < x))" |
307 |
apply (rule iffI) |
|
308 |
apply clarsimp |
|
309 |
apply (rule conjI) |
|
310 |
apply clarsimp |
|
311 |
apply (rule ccontr) |
|
312 |
apply (subgoal_tac "~ (0 <= x^n)") |
|
313 |
apply simp |
|
314 |
apply (subst zero_le_odd_power) |
|
21263 | 315 |
apply assumption |
21256 | 316 |
apply simp |
317 |
apply (rule notI) |
|
318 |
apply (simp add: power_0_left) |
|
319 |
apply (rule notI) |
|
320 |
apply (simp add: power_0_left) |
|
321 |
apply auto |
|
322 |
apply (subgoal_tac "0 <= x^n") |
|
323 |
apply (frule order_le_imp_less_or_eq) |
|
324 |
apply simp |
|
325 |
apply (erule zero_le_even_power) |
|
326 |
apply (subgoal_tac "0 <= x^n") |
|
327 |
apply (frule order_le_imp_less_or_eq) |
|
328 |
apply auto |
|
329 |
apply (subst zero_le_odd_power) |
|
330 |
apply assumption |
|
331 |
apply (erule order_less_imp_le) |
|
21263 | 332 |
done |
21256 | 333 |
|
334 |
lemma power_less_zero_eq: "((x::'a::{recpower,ordered_idom}) ^ n < 0) = |
|
21263 | 335 |
(odd n & x < 0)" |
336 |
apply (subst linorder_not_le [symmetric])+ |
|
21256 | 337 |
apply (subst zero_le_power_eq) |
338 |
apply auto |
|
21263 | 339 |
done |
21256 | 340 |
|
341 |
lemma power_le_zero_eq: "((x::'a::{recpower,ordered_idom}) ^ n <= 0) = |
|
342 |
(n ~= 0 & ((odd n & x <= 0) | (even n & x = 0)))" |
|
21263 | 343 |
apply (subst linorder_not_less [symmetric])+ |
21256 | 344 |
apply (subst zero_less_power_eq) |
345 |
apply auto |
|
21263 | 346 |
done |
21256 | 347 |
|
21263 | 348 |
lemma power_even_abs: "even n ==> |
21256 | 349 |
(abs (x::'a::{recpower,ordered_idom}))^n = x^n" |
21263 | 350 |
apply (subst power_abs [symmetric]) |
21256 | 351 |
apply (simp add: zero_le_even_power) |
21263 | 352 |
done |
21256 | 353 |
|
354 |
lemma zero_less_power_nat_eq: "(0 < (x::nat) ^ n) = (n = 0 | 0 < x)" |
|
21263 | 355 |
by (induct n) auto |
21256 | 356 |
|
21263 | 357 |
lemma power_minus_even [simp]: "even n ==> |
21256 | 358 |
(- x)^n = (x^n::'a::{recpower,comm_ring_1})" |
359 |
apply (subst power_minus) |
|
360 |
apply simp |
|
21263 | 361 |
done |
21256 | 362 |
|
21263 | 363 |
lemma power_minus_odd [simp]: "odd n ==> |
21256 | 364 |
(- x)^n = - (x^n::'a::{recpower,comm_ring_1})" |
365 |
apply (subst power_minus) |
|
366 |
apply simp |
|
21263 | 367 |
done |
21256 | 368 |
|
21263 | 369 |
|
370 |
text {* Simplify, when the exponent is a numeral *} |
|
21256 | 371 |
|
372 |
lemmas power_0_left_number_of = power_0_left [of "number_of w", standard] |
|
373 |
declare power_0_left_number_of [simp] |
|
374 |
||
21263 | 375 |
lemmas zero_le_power_eq_number_of [simp] = |
21256 | 376 |
zero_le_power_eq [of _ "number_of w", standard] |
377 |
||
21263 | 378 |
lemmas zero_less_power_eq_number_of [simp] = |
21256 | 379 |
zero_less_power_eq [of _ "number_of w", standard] |
380 |
||
21263 | 381 |
lemmas power_le_zero_eq_number_of [simp] = |
21256 | 382 |
power_le_zero_eq [of _ "number_of w", standard] |
383 |
||
21263 | 384 |
lemmas power_less_zero_eq_number_of [simp] = |
21256 | 385 |
power_less_zero_eq [of _ "number_of w", standard] |
386 |
||
21263 | 387 |
lemmas zero_less_power_nat_eq_number_of [simp] = |
21256 | 388 |
zero_less_power_nat_eq [of _ "number_of w", standard] |
389 |
||
21263 | 390 |
lemmas power_eq_0_iff_number_of [simp] = power_eq_0_iff [of _ "number_of w", standard] |
21256 | 391 |
|
21263 | 392 |
lemmas power_even_abs_number_of [simp] = power_even_abs [of "number_of w" _, standard] |
21256 | 393 |
|
394 |
||
395 |
subsection {* An Equivalence for @{term [source] "0 \<le> a^n"} *} |
|
396 |
||
397 |
lemma even_power_le_0_imp_0: |
|
21263 | 398 |
"a ^ (2*k) \<le> (0::'a::{ordered_idom,recpower}) ==> a=0" |
399 |
by (induct k) (auto simp add: zero_le_mult_iff mult_le_0_iff power_Suc) |
|
21256 | 400 |
|
401 |
lemma zero_le_power_iff: |
|
21263 | 402 |
"(0 \<le> a^n) = (0 \<le> (a::'a::{ordered_idom,recpower}) | even n)" |
21256 | 403 |
proof cases |
404 |
assume even: "even n" |
|
405 |
then obtain k where "n = 2*k" |
|
406 |
by (auto simp add: even_nat_equiv_def2 numeral_2_eq_2) |
|
21263 | 407 |
thus ?thesis by (simp add: zero_le_even_power even) |
21256 | 408 |
next |
409 |
assume odd: "odd n" |
|
410 |
then obtain k where "n = Suc(2*k)" |
|
411 |
by (auto simp add: odd_nat_equiv_def2 numeral_2_eq_2) |
|
412 |
thus ?thesis |
|
21263 | 413 |
by (auto simp add: power_Suc zero_le_mult_iff zero_le_even_power |
414 |
dest!: even_power_le_0_imp_0) |
|
415 |
qed |
|
416 |
||
21256 | 417 |
|
418 |
subsection {* Miscellaneous *} |
|
419 |
||
420 |
lemma even_plus_one_div_two: "even (x::int) ==> (x + 1) div 2 = x div 2" |
|
421 |
apply (subst zdiv_zadd1_eq) |
|
422 |
apply (simp add: even_def) |
|
423 |
done |
|
424 |
||
425 |
lemma odd_plus_one_div_two: "odd (x::int) ==> (x + 1) div 2 = x div 2 + 1" |
|
426 |
apply (subst zdiv_zadd1_eq) |
|
427 |
apply (simp add: even_def) |
|
428 |
done |
|
429 |
||
21263 | 430 |
lemma div_Suc: "Suc a div c = a div c + Suc 0 div c + |
21256 | 431 |
(a mod c + Suc 0 mod c) div c" |
432 |
apply (subgoal_tac "Suc a = a + Suc 0") |
|
433 |
apply (erule ssubst) |
|
434 |
apply (rule div_add1_eq, simp) |
|
435 |
done |
|
436 |
||
21263 | 437 |
lemma even_nat_plus_one_div_two: "even (x::nat) ==> |
438 |
(Suc x) div Suc (Suc 0) = x div Suc (Suc 0)" |
|
21256 | 439 |
apply (subst div_Suc) |
440 |
apply (simp add: even_nat_equiv_def) |
|
441 |
done |
|
442 |
||
21263 | 443 |
lemma odd_nat_plus_one_div_two: "odd (x::nat) ==> |
21256 | 444 |
(Suc x) div Suc (Suc 0) = Suc (x div Suc (Suc 0))" |
445 |
apply (subst div_Suc) |
|
446 |
apply (simp add: odd_nat_equiv_def) |
|
447 |
done |
|
448 |
||
449 |
end |