32556
|
1 |
|
|
2 |
header {* Various examples for transfer procedure *}
|
|
3 |
|
|
4 |
theory Transfer_Ex
|
35685
|
5 |
imports Main
|
32556
|
6 |
begin
|
|
7 |
|
|
8 |
lemma ex1: "(x::nat) + y = y + x"
|
|
9 |
by auto
|
|
10 |
|
35685
|
11 |
lemma "(0\<Colon>int) \<le> (y\<Colon>int) \<Longrightarrow> (0\<Colon>int) \<le> (x\<Colon>int) \<Longrightarrow> x + y = y + x"
|
|
12 |
by (fact ex1 [transferred])
|
32556
|
13 |
|
|
14 |
lemma ex2: "(a::nat) div b * b + a mod b = a"
|
|
15 |
by (rule mod_div_equality)
|
|
16 |
|
35685
|
17 |
lemma "(0\<Colon>int) \<le> (b\<Colon>int) \<Longrightarrow> (0\<Colon>int) \<le> (a\<Colon>int) \<Longrightarrow> a div b * b + a mod b = a"
|
|
18 |
by (fact ex2 [transferred])
|
32556
|
19 |
|
|
20 |
lemma ex3: "ALL (x::nat). ALL y. EX z. z >= x + y"
|
|
21 |
by auto
|
|
22 |
|
35685
|
23 |
lemma "\<forall>x\<ge>0\<Colon>int. \<forall>y\<ge>0\<Colon>int. \<exists>xa\<ge>0\<Colon>int. x + y \<le> xa"
|
|
24 |
by (fact ex3 [transferred nat_int])
|
32556
|
25 |
|
|
26 |
lemma ex4: "(x::nat) >= y \<Longrightarrow> (x - y) + y = x"
|
|
27 |
by auto
|
|
28 |
|
35685
|
29 |
lemma "(0\<Colon>int) \<le> (x\<Colon>int) \<Longrightarrow> (0\<Colon>int) \<le> (y\<Colon>int) \<Longrightarrow> y \<le> x \<Longrightarrow> tsub x y + y = x"
|
|
30 |
by (fact ex4 [transferred])
|
32556
|
31 |
|
35685
|
32 |
lemma ex5: "(2::nat) * \<Sum>{..n} = n * (n + 1)"
|
32556
|
33 |
by (induct n rule: nat_induct, auto)
|
|
34 |
|
35685
|
35 |
lemma "(0\<Colon>int) \<le> (n\<Colon>int) \<Longrightarrow> (2\<Colon>int) * \<Sum>{0\<Colon>int..n} = n * (n + (1\<Colon>int))"
|
|
36 |
by (fact ex5 [transferred])
|
|
37 |
|
|
38 |
lemma "(0\<Colon>nat) \<le> (n\<Colon>nat) \<Longrightarrow> (2\<Colon>nat) * \<Sum>{0\<Colon>nat..n} = n * (n + (1\<Colon>nat))"
|
|
39 |
by (fact ex5 [transferred, transferred])
|
32556
|
40 |
|
|
41 |
theorem ex6: "0 <= (n::int) \<Longrightarrow> 2 * \<Sum>{0..n} = n * (n + 1)"
|
|
42 |
by (rule ex5 [transferred])
|
|
43 |
|
35685
|
44 |
lemma "(0\<Colon>nat) \<le> (n\<Colon>nat) \<Longrightarrow> (2\<Colon>nat) * \<Sum>{0\<Colon>nat..n} = n * (n + (1\<Colon>nat))"
|
|
45 |
by (fact ex6 [transferred])
|
32556
|
46 |
|
|
47 |
end |