author | lcp |
Fri, 12 Aug 1994 12:28:46 +0200 | |
changeset 515 | abcc438e7c27 |
parent 496 | 3fc829fa81d2 |
child 694 | c7d592f6312a |
permissions | -rw-r--r-- |
515 | 1 |
(* Title: ZF/ex/Rmap |
16
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 |
515 | 4 |
Copyright 1994 University of Cambridge |
16
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 |
Inductive definition of an operator to "map" a relation over a list |
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 |
|
515 | 9 |
open Rmap; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
10 |
|
515 | 11 |
goalw Rmap.thy rmap.defs "!!r s. r<=s ==> rmap(r) <= rmap(s)"; |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
12 |
by (rtac lfp_mono 1); |
515 | 13 |
by (REPEAT (rtac rmap.bnd_mono 1)); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
14 |
by (REPEAT (ares_tac ([Sigma_mono, list_mono, domain_mono, range_mono] @ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
15 |
basic_monos) 1)); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
16 |
val rmap_mono = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
17 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
18 |
val rmap_induct = standard |
515 | 19 |
(rmap.mutual_induct RS spec RS spec RSN (2,rev_mp)); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
20 |
|
515 | 21 |
val Nil_rmap_case = rmap.mk_cases list.con_defs "<Nil,zs> : rmap(r)" |
22 |
and Cons_rmap_case = rmap.mk_cases list.con_defs "<Cons(x,xs),zs> : rmap(r)"; |
|
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
23 |
|
515 | 24 |
val rmap_cs = ZF_cs addIs rmap.intrs |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
25 |
addSEs [Nil_rmap_case, Cons_rmap_case]; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
26 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
27 |
goal Rmap.thy "!!r. r <= A*B ==> rmap(r) <= list(A)*list(B)"; |
515 | 28 |
by (rtac (rmap.dom_subset RS subset_trans) 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
29 |
by (REPEAT (ares_tac [domain_rel_subset, range_rel_subset, |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
30 |
Sigma_mono, list_mono] 1)); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
31 |
val rmap_rel_type = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
32 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
33 |
goal Rmap.thy |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
34 |
"!!r. [| ALL x:A. EX y. <x,y>: r; xs: list(A) |] ==> \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
35 |
\ EX y. <xs, y> : rmap(r)"; |
515 | 36 |
by (etac list.induct 1); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
37 |
by (ALLGOALS (fast_tac rmap_cs)); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
38 |
val rmap_total = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
39 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
40 |
goal Rmap.thy |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
41 |
"!!r. [| ALL x y z. <x,y>: r --> <x,z>: r --> y=z; \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
42 |
\ <xs, ys> : rmap(r) |] ==> \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
43 |
\ ALL zs. <xs, zs> : rmap(r) --> ys=zs"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
44 |
by (etac rmap_induct 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
45 |
by (ALLGOALS (fast_tac rmap_cs)); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
46 |
val rmap_functional_lemma = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
47 |
val rmap_functional = standard (rmap_functional_lemma RS spec RS mp); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
48 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
49 |
(** If f is a function then rmap(f) behaves as expected. **) |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
50 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
51 |
goal Rmap.thy "!!f. f: A->B ==> rmap(f): list(A)->list(B)"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
52 |
by (etac PiE 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
53 |
by (rtac PiI 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
54 |
by (etac rmap_rel_type 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
55 |
by (rtac (rmap_total RS ex_ex1I) 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
56 |
by (assume_tac 2); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
57 |
by (fast_tac (ZF_cs addSEs [bspec RS ex1E]) 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
58 |
by (rtac rmap_functional 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
59 |
by (REPEAT (assume_tac 2)); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
60 |
by (fast_tac (ZF_cs addSEs [bspec RS ex1_equalsE]) 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
61 |
val rmap_fun_type = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
62 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
63 |
goalw Rmap.thy [apply_def] "rmap(f)`Nil = Nil"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
64 |
by (fast_tac (rmap_cs addIs [the_equality]) 1); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
65 |
val rmap_Nil = result(); |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
66 |
|
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
67 |
goal Rmap.thy "!!f. [| f: A->B; x: A; xs: list(A) |] ==> \ |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
68 |
\ rmap(f) ` Cons(x,xs) = Cons(f`x, rmap(f)`xs)"; |
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
69 |
by (rtac apply_equality 1); |
515 | 70 |
by (REPEAT (ares_tac ([apply_Pair, rmap_fun_type] @ rmap.intrs) 1)); |
16
0b033d50ca1c
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff
changeset
|
71 |
val rmap_Cons = result(); |