author paulson Wed, 08 May 2002 09:08:29 +0200 changeset 13116 baabb0fd2ccf parent 13115 0a6fbdedcde2 child 13117 0b233f430076
converted to Isar
 src/HOL/ex/Puzzle.thy file | annotate | diff | comparison | revisions
```--- a/src/HOL/ex/Puzzle.thy	Wed May 08 09:08:16 2002 +0200
+++ b/src/HOL/ex/Puzzle.thy	Wed May 08 09:08:29 2002 +0200
@@ -4,9 +4,45 @@

A question from "Bundeswettbewerb Mathematik"
+
+Proof due to Herbert Ehler
*)

-Puzzle = Main +
-consts f :: nat => nat
-rules  f_ax "f(f(n)) < f(Suc(n))"
+theory Puzzle = Main:
+
+consts f :: "nat => nat"
+
+axioms  f_ax [intro!]: "f(f(n)) < f(Suc(n))"
+
+
+lemma lemma0 [rule_format]: "\<forall>n. k=f(n) --> n <= f(n)"
+apply (induct_tac "k" rule: nat_less_induct)
+apply (rule allI)
+apply (rename_tac "i")
+apply (case_tac "i")
+ apply simp
+apply (blast intro!: Suc_leI intro: le_less_trans)
+done
+
+lemma lemma1: "n <= f(n)"
+by (blast intro: lemma0)
+
+lemma lemma2: "f(n) < f(Suc(n))"
+by (blast intro: le_less_trans lemma1)
+
+lemma f_mono [rule_format (no_asm)]: "m <= n --> f(m) <= f(n)"
+apply (induct_tac "n")
+ apply simp
+apply (rule impI)
+apply (erule le_SucE)
+ apply (cut_tac n = n in lemma2, auto)
+done
+
+lemma f_id: "f(n) = n"
+apply (rule order_antisym)
+apply (rule_tac [2] lemma1)
+apply (blast intro: leI dest: leD f_mono Suc_leI)
+done
+
end
+```