author | nipkow |
Sun, 29 Jan 1995 14:02:17 +0100 | |
changeset 204 | 21c405b4039f |
parent 194 | b93cc55cb7ab |
permissions | -rw-r--r-- |
106 | 1 |
(* Title: Substitutions/AList.ML |
0 | 2 |
Author: Martin Coen, Cambridge University Computer Laboratory |
3 |
Copyright 1993 University of Cambridge |
|
4 |
||
106 | 5 |
For AList.thy. |
0 | 6 |
*) |
7 |
||
8 |
open AList; |
|
9 |
||
10 |
val al_rews = |
|
194
b93cc55cb7ab
small updates because datatype list is now used. In particular Nil -> []
nipkow
parents:
171
diff
changeset
|
11 |
let fun mk_thm s = prove_goalw AList.thy [alist_rec_def,assoc_def] s |
b93cc55cb7ab
small updates because datatype list is now used. In particular Nil -> []
nipkow
parents:
171
diff
changeset
|
12 |
(fn _ => [simp_tac list_ss 1]) |
0 | 13 |
in map mk_thm |
194
b93cc55cb7ab
small updates because datatype list is now used. In particular Nil -> []
nipkow
parents:
171
diff
changeset
|
14 |
["alist_rec([],c,d) = c", |
48
21291189b51e
changed "." to "$" and Cons to infix "#" to eliminate ambiguity
clasohm
parents:
0
diff
changeset
|
15 |
"alist_rec(<a,b>#al,c,d) = d(a,b,al,alist_rec(al,c,d))", |
194
b93cc55cb7ab
small updates because datatype list is now used. In particular Nil -> []
nipkow
parents:
171
diff
changeset
|
16 |
"assoc(v,d,[]) = d", |
48
21291189b51e
changed "." to "$" and Cons to infix "#" to eliminate ambiguity
clasohm
parents:
0
diff
changeset
|
17 |
"assoc(v,d,<a,b>#al) = if(v=a,b,assoc(v,d,al))"] end; |
0 | 18 |
|
19 |
val prems = goal AList.thy |
|
194
b93cc55cb7ab
small updates because datatype list is now used. In particular Nil -> []
nipkow
parents:
171
diff
changeset
|
20 |
"[| P([]); \ |
48
21291189b51e
changed "." to "$" and Cons to infix "#" to eliminate ambiguity
clasohm
parents:
0
diff
changeset
|
21 |
\ !!x y xs. P(xs) ==> P(<x,y>#xs) |] ==> P(l)"; |
194
b93cc55cb7ab
small updates because datatype list is now used. In particular Nil -> []
nipkow
parents:
171
diff
changeset
|
22 |
by (list.induct_tac "l" 1); |
0 | 23 |
by (resolve_tac prems 1); |
24 |
by (rtac PairE 1); |
|
25 |
by (etac ssubst 1); |
|
26 |
by (resolve_tac prems 1); |
|
27 |
by (assume_tac 1); |
|
171 | 28 |
qed "alist_induct"; |
0 | 29 |
|
30 |
(*Perform induction on xs. *) |
|
31 |
fun alist_ind_tac a M = |
|
32 |
EVERY [res_inst_tac [("l",a)] alist_induct M, |
|
33 |
rename_last_tac a ["1"] (M+1)]; |