src/ZF/ex/Rmap.ML
author clasohm
Wed, 14 Dec 1994 11:41:49 +0100
changeset 782 200a16083201
parent 694 c7d592f6312a
child 1461 6bcb44e4d6e5
permissions -rw-r--r--
added bind_thm for theorems defined by "standard ..."
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
     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
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
     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
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
     9
open Rmap;
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    10
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    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
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    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));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 694
diff changeset
    16
qed "rmap_mono";
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    17
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 694
diff changeset
    18
bind_thm ("rmap_induct",
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 694
diff changeset
    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
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    21
val Nil_rmap_case = rmap.mk_cases list.con_defs "<Nil,zs> : rmap(r)"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    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
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    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
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    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));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 694
diff changeset
    31
qed "rmap_rel_type";
16
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
694
c7d592f6312a ZF/ex/Ramsey,Rmap,misc.ML: modified for new definition of Pi(A,B)
lcp
parents: 515
diff changeset
    34
    "!!r. A <= domain(r) ==> list(A) <= domain(rmap(r))";
c7d592f6312a ZF/ex/Ramsey,Rmap,misc.ML: modified for new definition of Pi(A,B)
lcp
parents: 515
diff changeset
    35
by (resolve_tac [subsetI] 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    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));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 694
diff changeset
    38
qed "rmap_total";
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    39
694
c7d592f6312a ZF/ex/Ramsey,Rmap,misc.ML: modified for new definition of Pi(A,B)
lcp
parents: 515
diff changeset
    40
goalw Rmap.thy [function_def] "!!r. function(r) ==> function(rmap(r))";
c7d592f6312a ZF/ex/Ramsey,Rmap,misc.ML: modified for new definition of Pi(A,B)
lcp
parents: 515
diff changeset
    41
by (rtac (impI RS allI RS allI) 1);
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    42
by (etac rmap_induct 1);
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    43
by (ALLGOALS (fast_tac rmap_cs));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 694
diff changeset
    44
qed "rmap_functional";
694
c7d592f6312a ZF/ex/Ramsey,Rmap,misc.ML: modified for new definition of Pi(A,B)
lcp
parents: 515
diff changeset
    45
16
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
(** 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
    48
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    49
goal Rmap.thy "!!f. f: A->B ==> rmap(f): list(A)->list(B)";
694
c7d592f6312a ZF/ex/Ramsey,Rmap,misc.ML: modified for new definition of Pi(A,B)
lcp
parents: 515
diff changeset
    50
by (asm_full_simp_tac 
c7d592f6312a ZF/ex/Ramsey,Rmap,misc.ML: modified for new definition of Pi(A,B)
lcp
parents: 515
diff changeset
    51
    (ZF_ss addsimps [Pi_iff, rmap_rel_type, rmap_functional, rmap_total]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 694
diff changeset
    52
qed "rmap_fun_type";
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    53
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    54
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
    55
by (fast_tac (rmap_cs addIs [the_equality]) 1);
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 694
diff changeset
    56
qed "rmap_Nil";
16
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    57
0b033d50ca1c ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
diff changeset
    58
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
    59
\                   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
    60
by (rtac apply_equality 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 496
diff changeset
    61
by (REPEAT (ares_tac ([apply_Pair, rmap_fun_type] @ rmap.intrs) 1));
782
200a16083201 added bind_thm for theorems defined by "standard ..."
clasohm
parents: 694
diff changeset
    62
qed "rmap_Cons";