author | paulson |
Fri, 29 Oct 2004 15:16:02 +0200 | |
changeset 15270 | 8b3f707a78a7 |
parent 14126 | 28824746d046 |
child 16417 | 9bc16273c2d4 |
permissions | -rw-r--r-- |
2222 | 1 |
(* Title: HOL/ex/Puzzle.thy |
969 | 2 |
ID: $Id$ |
1476 | 3 |
Author: Tobias Nipkow |
969 | 4 |
Copyright 1993 TU Muenchen |
5 |
||
2222 | 6 |
A question from "Bundeswettbewerb Mathematik" |
13116 | 7 |
|
8 |
Proof due to Herbert Ehler |
|
969 | 9 |
*) |
10 |
||
13116 | 11 |
theory Puzzle = Main: |
12 |
||
13 |
consts f :: "nat => nat" |
|
14 |
||
14126
28824746d046
Tidying and replacement of some axioms by specifications
paulson
parents:
13116
diff
changeset
|
15 |
specification (f) |
28824746d046
Tidying and replacement of some axioms by specifications
paulson
parents:
13116
diff
changeset
|
16 |
f_ax [intro!]: "f(f(n)) < f(Suc(n))" |
28824746d046
Tidying and replacement of some axioms by specifications
paulson
parents:
13116
diff
changeset
|
17 |
by (rule exI [of _ id], simp) |
13116 | 18 |
|
19 |
||
20 |
lemma lemma0 [rule_format]: "\<forall>n. k=f(n) --> n <= f(n)" |
|
21 |
apply (induct_tac "k" rule: nat_less_induct) |
|
22 |
apply (rule allI) |
|
23 |
apply (rename_tac "i") |
|
24 |
apply (case_tac "i") |
|
25 |
apply simp |
|
26 |
apply (blast intro!: Suc_leI intro: le_less_trans) |
|
27 |
done |
|
28 |
||
29 |
lemma lemma1: "n <= f(n)" |
|
30 |
by (blast intro: lemma0) |
|
31 |
||
32 |
lemma lemma2: "f(n) < f(Suc(n))" |
|
33 |
by (blast intro: le_less_trans lemma1) |
|
34 |
||
35 |
lemma f_mono [rule_format (no_asm)]: "m <= n --> f(m) <= f(n)" |
|
36 |
apply (induct_tac "n") |
|
37 |
apply simp |
|
38 |
apply (rule impI) |
|
39 |
apply (erule le_SucE) |
|
40 |
apply (cut_tac n = n in lemma2, auto) |
|
41 |
done |
|
42 |
||
43 |
lemma f_id: "f(n) = n" |
|
44 |
apply (rule order_antisym) |
|
45 |
apply (rule_tac [2] lemma1) |
|
46 |
apply (blast intro: leI dest: leD f_mono Suc_leI) |
|
47 |
done |
|
48 |
||
969 | 49 |
end |
13116 | 50 |