author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Fri, 30 Jan 2015 13:11:39 +0000 | |
changeset 58 | 1769b702d4dc |
parent 46 | 79336e47e14d |
child 81 | 7ac7782a7318 |
permissions | -rw-r--r-- |
46
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
theory Pr |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
imports Main "~~/src/HOL/Number_Theory/Primes" "~~/src/HOL/Real" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
begin |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
lemma |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
fixes a b::nat |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
shows "(a + b) ^ 2 = a ^ 2 + 2 * a * b + b ^ 2" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
apply(simp add: power2_sum) |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
done |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
lemma |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
fixes a b c::"real" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
assumes eq: "a * c \<le> b * c" and ineq: "b < a" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
shows "c \<le> 0" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
proof - |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
{ |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
17 |
assume "0 < c" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
18 |
then have "b * c < a * c" using ineq by(auto) |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
19 |
then have "False" using eq by auto |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
20 |
} then show "c \<le> 0" by (auto simp add: not_le[symmetric]) |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
21 |
qed |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
22 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
24 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
25 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
26 |
lemma "n > 1 \<Longrightarrow> \<not>(prime (2 * n))" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
27 |
by (metis One_nat_def Suc_leI less_Suc0 not_le numeral_eq_one_iff prime_product semiring_norm(85)) |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
28 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
29 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
30 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
31 |
lemma |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
32 |
fixes n::"nat" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
33 |
assumes a: "n > 1" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
34 |
and b: "\<not>(prime n)" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
35 |
shows "\<not>(prime ((2 ^ n) - 1))" |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
36 |
using a b |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
37 |
apply(induct n) |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
38 |
apply(simp) |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
39 |
apply(simp) |
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
40 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
41 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
42 |
|
79336e47e14d
added Pr theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
43 |
end |