Streamlined it a bit.
--- a/src/HOL/ex/Puzzle.ML Fri Nov 12 18:16:48 1999 +0100
+++ b/src/HOL/ex/Puzzle.ML Mon Nov 15 09:41:06 1999 +0100
@@ -10,22 +10,18 @@
AddSIs [Puzzle.f_ax];
-(*specialized form of induction needed below*)
-val prems = goal Nat.thy "[| P(0); !!n. P(Suc(n)) |] ==> !n. P(n)";
-by (EVERY1 [rtac (nat_induct RS allI), resolve_tac prems, resolve_tac prems]);
-qed "nat_exh";
-
Goal "! n. k=f(n) --> n <= f(n)";
by (res_inst_tac [("n","k")] less_induct 1);
-by (rtac nat_exh 1);
-by (Simp_tac 1);
+by (rtac allI 1);
+by (rename_tac "i" 1);
+by (exhaust_tac "i" 1);
+ by (Asm_simp_tac 1);
by (rtac impI 1);
by (rtac classical 1);
by (dtac not_leE 1);
-by (subgoal_tac "f(na) <= f(f(na))" 1);
-by (Blast_tac 2);
-by (rtac Suc_leI 1);
-by (blast_tac (claset() addSDs [spec] addIs [le_less_trans]) 1);
+by (subgoal_tac "f(nat) <= f(f(nat))" 1);
+ by (Blast_tac 2);
+by (blast_tac (claset() addSDs [spec] addIs [Suc_leI,le_less_trans]) 1);
val lemma = result() RS spec RS mp;
Goal "n <= f(n)";
@@ -36,26 +32,18 @@
by (blast_tac (claset() addIs [le_less_trans, lemma1]) 1);
qed "lemma2";
-val prems = Goal "(!!n. f(n) <= f(Suc(n))) ==> m<n --> f(m) <= f(n)";
-by (res_inst_tac[("n","n")]nat_induct 1);
-by (Simp_tac 1);
-by (simp_tac (simpset() addsimps [less_Suc_eq]) 1);
-by (blast_tac (claset() addIs (le_trans::prems)) 1);
-qed_spec_mp "mono_lemma1";
-
-val [p1,p2] = goal Puzzle.thy
- "[| !! n. f(n)<=f(Suc(n)); m<=n |] ==> f(m) <= f(n)";
-by (rtac (p2 RS le_imp_less_or_eq RS disjE) 1);
-by (etac (p1 RS mono_lemma1) 1);
-by (Fast_tac 1);
-qed "mono_lemma";
-
-val prems = goal Puzzle.thy "m <= n ==> f(m) <= f(n)";
-by (fast_tac (claset() addIs [mono_lemma,less_imp_le,lemma2]@prems) 1);
-qed "f_mono";
+Goal "m <= n --> f(m) <= f(n)";
+by (induct_tac "n" 1);
+ by (Simp_tac 1);
+by (rtac impI 1);
+by (etac le_SucE 1);
+ by(cut_inst_tac [("n","n")]lemma2 1);
+ by(arith_tac 1);
+by(Asm_simp_tac 1);
+qed_spec_mp "f_mono";
Goal "f(n) = n";
by (rtac order_antisym 1);
by (rtac lemma1 2);
-by (fast_tac (claset() addIs [Puzzle.f_ax,leI] addDs [leD,f_mono,Suc_leI]) 1);
-result();
+by (fast_tac (claset() addIs [leI] addDs [leD,f_mono,Suc_leI]) 1);
+qed "f_id";
--- a/src/HOL/ex/Puzzle.thy Fri Nov 12 18:16:48 1999 +0100
+++ b/src/HOL/ex/Puzzle.thy Mon Nov 15 09:41:06 1999 +0100
@@ -6,7 +6,7 @@
A question from "Bundeswettbewerb Mathematik"
*)
-Puzzle = Nat +
+Puzzle = Main +
consts f :: nat => nat
rules f_ax "f(f(n)) < f(Suc(n))"
end