author | wenzelm |
Sat, 15 Apr 2000 15:00:57 +0200 | |
changeset 8717 | 20c42415c07d |
parent 477 | 53fc8ad84b33 |
permissions | -rw-r--r-- |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
1 |
(* Title: ZF/ex/primrec |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
2 |
ID: $Id$ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
4 |
Copyright 1993 University of Cambridge |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
5 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
6 |
Primitive Recursive Functions |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
7 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
8 |
Proof adopted from |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
9 |
Nora Szasz, |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
10 |
A Machine Checked Proof that Ackermann's Function is not Primitive Recursive, |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
11 |
In: Huet & Plotkin, eds., Logical Environments (CUP, 1993), 317-338. |
71
729fe026c5f3
sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents:
56
diff
changeset
|
12 |
|
729fe026c5f3
sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents:
56
diff
changeset
|
13 |
See also E. Mendelson, Introduction to Mathematical Logic. |
729fe026c5f3
sample datatype defs now use datatype_intrs, datatype_elims
lcp
parents:
56
diff
changeset
|
14 |
(Van Nostrand, 1964), page 250, exercise 11. |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
15 |
*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
16 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
17 |
open Primrec0; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
18 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
19 |
val pr0_typechecks = |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
20 |
nat_typechecks @ List.intrs @ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
21 |
[lam_type, list_case_type, drop_type, map_type, apply_type, rec_type]; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
22 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
23 |
(** Useful special cases of evaluation ***) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
24 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
25 |
val pr0_ss = arith_ss |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
26 |
addsimps List.case_eqns |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
27 |
addsimps [list_rec_Nil, list_rec_Cons, |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
28 |
drop_0, drop_Nil, drop_succ_Cons, |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
29 |
map_Nil, map_Cons] |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
30 |
setsolver (type_auto_tac pr0_typechecks); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
31 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
32 |
goalw Primrec0.thy [SC_def] |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
33 |
"!!x l. [| x:nat; l: list(nat) |] ==> SC ` (Cons(x,l)) = succ(x)"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
34 |
by (asm_simp_tac pr0_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
35 |
val SC = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
36 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
37 |
goalw Primrec0.thy [CONST_def] |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
38 |
"!!l. [| l: list(nat) |] ==> CONST(k) ` l = k"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
39 |
by (asm_simp_tac pr0_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
40 |
val CONST = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
41 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
42 |
goalw Primrec0.thy [PROJ_def] |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
43 |
"!!l. [| x: nat; l: list(nat) |] ==> PROJ(0) ` (Cons(x,l)) = x"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
44 |
by (asm_simp_tac pr0_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
45 |
val PROJ_0 = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
46 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
47 |
goalw Primrec0.thy [COMP_def] |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
48 |
"!!l. [| l: list(nat) |] ==> COMP(g,[f]) ` l = g` [f`l]"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
49 |
by (asm_simp_tac pr0_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
50 |
val COMP_1 = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
51 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
52 |
goalw Primrec0.thy [PREC_def] |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
53 |
"!!l. l: list(nat) ==> PREC(f,g) ` (Cons(0,l)) = f`l"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
54 |
by (asm_simp_tac pr0_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
55 |
val PREC_0 = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
56 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
57 |
goalw Primrec0.thy [PREC_def] |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
58 |
"!!l. [| x:nat; l: list(nat) |] ==> \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
59 |
\ PREC(f,g) ` (Cons(succ(x),l)) = \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
60 |
\ g ` Cons(PREC(f,g)`(Cons(x,l)), Cons(x,l))"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
61 |
by (asm_simp_tac pr0_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
62 |
val PREC_succ = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
63 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
64 |
(*** Inductive definition of the PR functions ***) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
65 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
66 |
structure Primrec = Inductive_Fun |
279 | 67 |
(val thy = Primrec0.thy |
477 | 68 |
val thy_name = "Primrec" |
279 | 69 |
val rec_doms = [("primrec", "list(nat)->nat")] |
70 |
val sintrs = |
|
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
71 |
["SC : primrec", |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
72 |
"k: nat ==> CONST(k) : primrec", |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
73 |
"i: nat ==> PROJ(i) : primrec", |
279 | 74 |
"[| g: primrec; fs: list(primrec) |] ==> COMP(g,fs): primrec", |
75 |
"[| f: primrec; g: primrec |] ==> PREC(f,g): primrec"] |
|
76 |
val monos = [list_mono] |
|
77 |
val con_defs = [SC_def,CONST_def,PROJ_def,COMP_def,PREC_def] |
|
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
78 |
val type_intrs = pr0_typechecks |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
79 |
val type_elims = []); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
80 |
|
279 | 81 |
|
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
82 |
(* c: primrec ==> c: list(nat) -> nat *) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
83 |
val primrec_into_fun = Primrec.dom_subset RS subsetD; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
84 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
85 |
val pr_ss = pr0_ss |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
86 |
setsolver (type_auto_tac ([primrec_into_fun] @ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
87 |
pr0_typechecks @ Primrec.intrs)); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
88 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
89 |
goalw Primrec.thy [ACK_def] "!!i. i:nat ==> ACK(i): primrec"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
90 |
by (etac nat_induct 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
91 |
by (ALLGOALS (asm_simp_tac pr_ss)); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
92 |
val ACK_in_primrec = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
93 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
94 |
val ack_typechecks = |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
95 |
[ACK_in_primrec, primrec_into_fun RS apply_type, |
434 | 96 |
add_type, list_add_type, nat_into_Ord] @ |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
97 |
nat_typechecks @ List.intrs @ Primrec.intrs; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
98 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
99 |
(*strict typechecking for the Ackermann proof; instantiates no vars*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
100 |
fun tc_tac rls = |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
101 |
REPEAT |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
102 |
(SOMEGOAL (test_assume_tac ORELSE' match_tac (rls @ ack_typechecks))); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
103 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
104 |
goal Primrec.thy "!!i j. [| i:nat; j:nat |] ==> ack(i,j): nat"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
105 |
by (tc_tac []); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
106 |
val ack_type = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
107 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
108 |
(** Ackermann's function cases **) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
109 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
110 |
(*PROPERTY A 1*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
111 |
goalw Primrec0.thy [ACK_def] "!!j. j:nat ==> ack(0,j) = succ(j)"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
112 |
by (asm_simp_tac (pr0_ss addsimps [SC]) 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
113 |
val ack_0 = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
114 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
115 |
(*PROPERTY A 2*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
116 |
goalw Primrec0.thy [ACK_def] "ack(succ(i), 0) = ack(i,1)"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
117 |
by (asm_simp_tac (pr0_ss addsimps [CONST,PREC_0]) 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
118 |
val ack_succ_0 = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
119 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
120 |
(*PROPERTY A 3*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
121 |
(*Could be proved in Primrec0, like the previous two cases, but using |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
122 |
primrec_into_fun makes type-checking easier!*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
123 |
goalw Primrec.thy [ACK_def] |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
124 |
"!!i j. [| i:nat; j:nat |] ==> \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
125 |
\ ack(succ(i), succ(j)) = ack(i, ack(succ(i), j))"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
126 |
by (asm_simp_tac (pr_ss addsimps [CONST,PREC_succ,COMP_1,PROJ_0]) 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
127 |
val ack_succ_succ = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
128 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
129 |
val ack_ss = |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
130 |
pr_ss addsimps [ack_0, ack_succ_0, ack_succ_succ, |
434 | 131 |
ack_type, nat_into_Ord]; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
132 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
133 |
(*PROPERTY A 4*) |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
134 |
goal Primrec.thy "!!i. i:nat ==> ALL j:nat. j < ack(i,j)"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
135 |
by (etac nat_induct 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
136 |
by (asm_simp_tac ack_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
137 |
by (rtac ballI 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
138 |
by (eres_inst_tac [("n","j")] nat_induct 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
139 |
by (DO_GOAL [rtac (nat_0I RS nat_0_le RS lt_trans), |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
140 |
asm_simp_tac ack_ss] 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
141 |
by (DO_GOAL [etac (succ_leI RS lt_trans1), |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
142 |
asm_simp_tac ack_ss] 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
143 |
val lt_ack2_lemma = result(); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
144 |
val lt_ack2 = standard (lt_ack2_lemma RS bspec); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
145 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
146 |
(*PROPERTY A 5-, the single-step lemma*) |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
147 |
goal Primrec.thy "!!i j. [| i:nat; j:nat |] ==> ack(i,j) < ack(i, succ(j))"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
148 |
by (etac nat_induct 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
149 |
by (ALLGOALS (asm_simp_tac (ack_ss addsimps [lt_ack2]))); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
150 |
val ack_lt_ack_succ2 = result(); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
151 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
152 |
(*PROPERTY A 5, monotonicity for < *) |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
153 |
goal Primrec.thy "!!i j k. [| j<k; i:nat; k:nat |] ==> ack(i,j) < ack(i,k)"; |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
154 |
by (forward_tac [lt_nat_in_nat] 1 THEN assume_tac 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
155 |
by (etac succ_lt_induct 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
156 |
by (assume_tac 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
157 |
by (rtac lt_trans 2); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
158 |
by (REPEAT (ares_tac ([ack_lt_ack_succ2, ack_type] @ pr0_typechecks) 1)); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
159 |
val ack_lt_mono2 = result(); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
160 |
|
56 | 161 |
(*PROPERTY A 5', monotonicity for le *) |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
162 |
goal Primrec.thy |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
163 |
"!!i j k. [| j le k; i: nat; k:nat |] ==> ack(i,j) le ack(i,k)"; |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
164 |
by (res_inst_tac [("f", "%j.ack(i,j)")] Ord_lt_mono_imp_le_mono 1); |
434 | 165 |
by (REPEAT (ares_tac [ack_lt_mono2, ack_type RS nat_into_Ord] 1)); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
166 |
val ack_le_mono2 = result(); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
167 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
168 |
(*PROPERTY A 6*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
169 |
goal Primrec.thy |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
170 |
"!!i j. [| i:nat; j:nat |] ==> ack(i, succ(j)) le ack(succ(i), j)"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
171 |
by (nat_ind_tac "j" [] 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
172 |
by (ALLGOALS (asm_simp_tac ack_ss)); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
173 |
by (rtac ack_le_mono2 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
174 |
by (rtac (lt_ack2 RS succ_leI RS le_trans) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
175 |
by (REPEAT (ares_tac (ack_typechecks) 1)); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
176 |
val ack2_le_ack1 = result(); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
177 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
178 |
(*PROPERTY A 7-, the single-step lemma*) |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
179 |
goal Primrec.thy "!!i j. [| i:nat; j:nat |] ==> ack(i,j) < ack(succ(i),j)"; |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
180 |
by (rtac (ack_lt_mono2 RS lt_trans2) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
181 |
by (rtac ack2_le_ack1 4); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
182 |
by (REPEAT (ares_tac ([nat_le_refl, ack_type] @ pr0_typechecks) 1)); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
183 |
val ack_lt_ack_succ1 = result(); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
184 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
185 |
(*PROPERTY A 7, monotonicity for < *) |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
186 |
goal Primrec.thy "!!i j k. [| i<j; j:nat; k:nat |] ==> ack(i,k) < ack(j,k)"; |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
187 |
by (forward_tac [lt_nat_in_nat] 1 THEN assume_tac 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
188 |
by (etac succ_lt_induct 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
189 |
by (assume_tac 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
190 |
by (rtac lt_trans 2); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
191 |
by (REPEAT (ares_tac ([ack_lt_ack_succ1, ack_type] @ pr0_typechecks) 1)); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
192 |
val ack_lt_mono1 = result(); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
193 |
|
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
194 |
(*PROPERTY A 7', monotonicity for le *) |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
195 |
goal Primrec.thy |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
196 |
"!!i j k. [| i le j; j:nat; k:nat |] ==> ack(i,k) le ack(j,k)"; |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
197 |
by (res_inst_tac [("f", "%j.ack(j,k)")] Ord_lt_mono_imp_le_mono 1); |
434 | 198 |
by (REPEAT (ares_tac [ack_lt_mono1, ack_type RS nat_into_Ord] 1)); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
199 |
val ack_le_mono1 = result(); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
200 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
201 |
(*PROPERTY A 8*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
202 |
goal Primrec.thy "!!j. j:nat ==> ack(1,j) = succ(succ(j))"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
203 |
by (etac nat_induct 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
204 |
by (ALLGOALS (asm_simp_tac ack_ss)); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
205 |
val ack_1 = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
206 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
207 |
(*PROPERTY A 9*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
208 |
goal Primrec.thy "!!j. j:nat ==> ack(succ(1),j) = succ(succ(succ(j#+j)))"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
209 |
by (etac nat_induct 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
210 |
by (ALLGOALS (asm_simp_tac (ack_ss addsimps [ack_1, add_succ_right]))); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
211 |
val ack_2 = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
212 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
213 |
(*PROPERTY A 10*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
214 |
goal Primrec.thy |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
215 |
"!!i1 i2 j. [| i1:nat; i2:nat; j:nat |] ==> \ |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
216 |
\ ack(i1, ack(i2,j)) < ack(succ(succ(i1#+i2)), j)"; |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
217 |
by (rtac (ack2_le_ack1 RSN (2,lt_trans2)) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
218 |
by (asm_simp_tac ack_ss 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
219 |
by (rtac (add_le_self RS ack_le_mono1 RS lt_trans1) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
220 |
by (rtac (add_le_self2 RS ack_lt_mono1 RS ack_lt_mono2) 5); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
221 |
by (tc_tac []); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
222 |
val ack_nest_bound = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
223 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
224 |
(*PROPERTY A 11*) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
225 |
goal Primrec.thy |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
226 |
"!!i1 i2 j. [| i1:nat; i2:nat; j:nat |] ==> \ |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
227 |
\ ack(i1,j) #+ ack(i2,j) < ack(succ(succ(succ(succ(i1#+i2)))), j)"; |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
228 |
by (res_inst_tac [("j", "ack(succ(1), ack(i1 #+ i2, j))")] lt_trans 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
229 |
by (asm_simp_tac (ack_ss addsimps [ack_2]) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
230 |
by (rtac (ack_nest_bound RS lt_trans2) 2); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
231 |
by (asm_simp_tac ack_ss 5); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
232 |
by (rtac (add_le_mono RS leI RS leI) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
233 |
by (REPEAT (ares_tac ([add_le_self, add_le_self2, ack_le_mono1] @ |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
234 |
ack_typechecks) 1)); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
235 |
val ack_add_bound = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
236 |
|
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
237 |
(*PROPERTY A 12. Article uses existential quantifier but the ALF proof |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
238 |
used k#+4. Quantified version must be nested EX k'. ALL i,j... *) |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
239 |
goal Primrec.thy |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
240 |
"!!i j k. [| i < ack(k,j); j:nat; k:nat |] ==> \ |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
241 |
\ i#+j < ack(succ(succ(succ(succ(k)))), j)"; |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
242 |
by (res_inst_tac [("j", "ack(k,j) #+ ack(0,j)")] lt_trans 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
243 |
by (rtac (ack_add_bound RS lt_trans2) 2); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
244 |
by (asm_simp_tac (ack_ss addsimps [add_0_right]) 5); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
245 |
by (REPEAT (ares_tac ([add_lt_mono, lt_ack2] @ ack_typechecks) 1)); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
246 |
val ack_add_bound2 = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
247 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
248 |
(*** MAIN RESULT ***) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
249 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
250 |
val ack2_ss = |
434 | 251 |
ack_ss addsimps [list_add_Nil, list_add_Cons, list_add_type, nat_into_Ord]; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
252 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
253 |
goalw Primrec.thy [SC_def] |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
254 |
"!!l. l: list(nat) ==> SC ` l < ack(1, list_add(l))"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
255 |
by (etac List.elim 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
256 |
by (asm_simp_tac (ack2_ss addsimps [succ_iff]) 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
257 |
by (asm_simp_tac (ack2_ss addsimps [ack_1, add_le_self]) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
258 |
val SC_case = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
259 |
|
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
260 |
(*PROPERTY A 4'? Extra lemma needed for CONST case, constant functions*) |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
261 |
goal Primrec.thy "!!j. [| i:nat; j:nat |] ==> i < ack(i,j)"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
262 |
by (etac nat_induct 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
263 |
by (asm_simp_tac (ack_ss addsimps [nat_0_le]) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
264 |
by (etac ([succ_leI, ack_lt_ack_succ1] MRS lt_trans1) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
265 |
by (tc_tac []); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
266 |
val lt_ack1 = result(); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
267 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
268 |
goalw Primrec.thy [CONST_def] |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
269 |
"!!l. [| l: list(nat); k: nat |] ==> CONST(k) ` l < ack(k, list_add(l))"; |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
270 |
by (asm_simp_tac (ack2_ss addsimps [lt_ack1]) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
271 |
val CONST_case = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
272 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
273 |
goalw Primrec.thy [PROJ_def] |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
274 |
"!!l. l: list(nat) ==> ALL i:nat. PROJ(i) ` l < ack(0, list_add(l))"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
275 |
by (asm_simp_tac ack2_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
276 |
by (etac List.induct 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
277 |
by (asm_simp_tac (ack2_ss addsimps [nat_0_le]) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
278 |
by (asm_simp_tac ack2_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
279 |
by (rtac ballI 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
280 |
by (eres_inst_tac [("n","x")] natE 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
281 |
by (asm_simp_tac (ack2_ss addsimps [add_le_self]) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
282 |
by (asm_simp_tac ack2_ss 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
283 |
by (etac (bspec RS lt_trans2) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
284 |
by (rtac (add_le_self2 RS succ_leI) 2); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
285 |
by (tc_tac []); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
286 |
val PROJ_case_lemma = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
287 |
val PROJ_case = PROJ_case_lemma RS bspec; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
288 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
289 |
(** COMP case **) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
290 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
291 |
goal Primrec.thy |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
292 |
"!!fs. fs : list({f: primrec . \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
293 |
\ EX kf:nat. ALL l:list(nat). \ |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
294 |
\ f`l < ack(kf, list_add(l))}) \ |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
295 |
\ ==> EX k:nat. ALL l: list(nat). \ |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
296 |
\ list_add(map(%f. f ` l, fs)) < ack(k, list_add(l))"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
297 |
by (etac List.induct 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
298 |
by (DO_GOAL [res_inst_tac [("x","0")] bexI, |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
299 |
asm_simp_tac (ack2_ss addsimps [lt_ack1, nat_0_le]), |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
300 |
resolve_tac nat_typechecks] 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
301 |
by (safe_tac ZF_cs); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
302 |
by (asm_simp_tac ack2_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
303 |
by (rtac (ballI RS bexI) 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
304 |
by (rtac (add_lt_mono RS lt_trans) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
305 |
by (REPEAT (FIRSTGOAL (etac bspec))); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
306 |
by (rtac ack_add_bound 5); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
307 |
by (tc_tac []); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
308 |
val COMP_map_lemma = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
309 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
310 |
goalw Primrec.thy [COMP_def] |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
311 |
"!!g. [| g: primrec; kg: nat; \ |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
312 |
\ ALL l:list(nat). g`l < ack(kg, list_add(l)); \ |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
313 |
\ fs : list({f: primrec . \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
314 |
\ EX kf:nat. ALL l:list(nat). \ |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
315 |
\ f`l < ack(kf, list_add(l))}) \ |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
316 |
\ |] ==> EX k:nat. ALL l: list(nat). COMP(g,fs)`l < ack(k, list_add(l))"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
317 |
by (asm_simp_tac ZF_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
318 |
by (forward_tac [list_CollectD] 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
319 |
by (etac (COMP_map_lemma RS bexE) 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
320 |
by (rtac (ballI RS bexI) 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
321 |
by (etac (bspec RS lt_trans) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
322 |
by (rtac lt_trans 2); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
323 |
by (rtac ack_nest_bound 3); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
324 |
by (etac (bspec RS ack_lt_mono2) 2); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
325 |
by (tc_tac [map_type]); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
326 |
val COMP_case = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
327 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
328 |
(** PREC case **) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
329 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
330 |
goalw Primrec.thy [PREC_def] |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
331 |
"!!f g. [| ALL l:list(nat). f`l #+ list_add(l) < ack(kf, list_add(l)); \ |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
332 |
\ ALL l:list(nat). g`l #+ list_add(l) < ack(kg, list_add(l)); \ |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
333 |
\ f: primrec; kf: nat; \ |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
334 |
\ g: primrec; kg: nat; \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
335 |
\ l: list(nat) \ |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
336 |
\ |] ==> PREC(f,g)`l #+ list_add(l) < ack(succ(kf#+kg), list_add(l))"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
337 |
by (etac List.elim 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
338 |
by (asm_simp_tac (ack2_ss addsimps [[nat_le_refl, lt_ack2] MRS lt_trans]) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
339 |
by (asm_simp_tac ack2_ss 1); |
128 | 340 |
by (etac ssubst 1); (*get rid of the needless assumption*) |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
341 |
by (eres_inst_tac [("n","a")] nat_induct 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
342 |
(*base case*) |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
343 |
by (DO_GOAL [asm_simp_tac ack2_ss, rtac lt_trans, etac bspec, |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
344 |
assume_tac, rtac (add_le_self RS ack_lt_mono1), |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
345 |
REPEAT o ares_tac (ack_typechecks)] 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
346 |
(*ind step*) |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
347 |
by (asm_simp_tac (ack2_ss addsimps [add_succ_right]) 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
348 |
by (rtac (succ_leI RS lt_trans1) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
349 |
by (res_inst_tac [("j", "g ` ?ll #+ ?mm")] lt_trans1 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
350 |
by (etac bspec 2); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
351 |
by (rtac (nat_le_refl RS add_le_mono) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
352 |
by (tc_tac []); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
353 |
by (asm_simp_tac (ack2_ss addsimps [add_le_self2]) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
354 |
(*final part of the simplification*) |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
355 |
by (asm_simp_tac ack2_ss 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
356 |
by (rtac (add_le_self2 RS ack_le_mono1 RS lt_trans1) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
357 |
by (etac ack_lt_mono2 5); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
358 |
by (tc_tac []); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
359 |
val PREC_case_lemma = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
360 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
361 |
goal Primrec.thy |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
362 |
"!!f g. [| f: primrec; kf: nat; \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
363 |
\ g: primrec; kg: nat; \ |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
364 |
\ ALL l:list(nat). f`l < ack(kf, list_add(l)); \ |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
365 |
\ ALL l:list(nat). g`l < ack(kg, list_add(l)) \ |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
366 |
\ |] ==> EX k:nat. ALL l: list(nat). \ |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
367 |
\ PREC(f,g)`l< ack(k, list_add(l))"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
368 |
by (rtac (ballI RS bexI) 1); |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
369 |
by (rtac ([add_le_self, PREC_case_lemma] MRS lt_trans1) 1); |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
370 |
by (REPEAT |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
371 |
(SOMEGOAL |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
372 |
(FIRST' [test_assume_tac, |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
373 |
match_tac (ack_typechecks), |
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
374 |
rtac (ack_add_bound2 RS ballI) THEN' etac bspec]))); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
375 |
val PREC_case = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
376 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
377 |
goal Primrec.thy |
29
4ec9b266ccd1
Modification of examples for the new operators, < and le.
lcp
parents:
16
diff
changeset
|
378 |
"!!f. f:primrec ==> EX k:nat. ALL l:list(nat). f`l < ack(k, list_add(l))"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
379 |
by (etac Primrec.induct 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
380 |
by (safe_tac ZF_cs); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
381 |
by (DEPTH_SOLVE |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
382 |
(ares_tac ([SC_case, CONST_case, PROJ_case, COMP_case, PREC_case, |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
383 |
bexI, ballI] @ nat_typechecks) 1)); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
384 |
val ack_bounds_primrec = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
385 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
386 |
goal Primrec.thy |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
387 |
"~ (lam l:list(nat). list_case(0, %x xs. ack(x,x), l)) : primrec"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
388 |
by (rtac notI 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
389 |
by (etac (ack_bounds_primrec RS bexE) 1); |
438 | 390 |
by (rtac lt_irrefl 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
391 |
by (dres_inst_tac [("x", "[x]")] bspec 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
392 |
by (asm_simp_tac ack2_ss 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
393 |
by (asm_full_simp_tac (ack2_ss addsimps [add_0_right]) 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
394 |
val ack_not_primrec = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
395 |