src/HOL/Relation.ML
author oheimb
Mon, 30 Mar 1998 21:05:25 +0200
changeset 4760 9cdbd5a1d25a
parent 4746 a5dcd7e4a37d
child 4830 bd73675adbed
permissions -rw-r--r--
added introduction and elimination rules for Univalent
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1454
diff changeset
     1
(*  Title:      Relation.ML
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
     2
    ID:         $Id$
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
     3
    Authors:    Lawrence C Paulson, Cambridge University Computer Laboratory
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
     4
    Copyright   1996  University of Cambridge
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
     5
*)
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
     6
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
     7
open Relation;
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
     8
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
     9
(** Identity relation **)
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    10
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    11
goalw thy [id_def] "(a,a) : id";  
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
    12
by (Blast_tac 1);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    13
qed "idI";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    14
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    15
val major::prems = goalw thy [id_def]
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    16
    "[| p: id;  !!x.[| p = (x,x) |] ==> P  \
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    17
\    |] ==>  P";  
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    18
by (rtac (major RS CollectE) 1);
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    19
by (etac exE 1);
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    20
by (eresolve_tac prems 1);
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    21
qed "idE";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    22
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    23
goalw thy [id_def] "(a,b):id = (a=b)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
    24
by (Blast_tac 1);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    25
qed "pair_in_id_conv";
1694
3452958f85a8 Added R_O_id and id_O_R
nipkow
parents: 1642
diff changeset
    26
Addsimps [pair_in_id_conv];
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    27
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    28
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    29
(** Composition of two relations **)
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    30
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    31
goalw thy [comp_def]
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
    32
    "!!r s. [| (a,b):s; (b,c):r |] ==> (a,c) : r O s";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
    33
by (Blast_tac 1);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    34
qed "compI";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    35
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    36
(*proof requires higher-level assumptions or a delaying of hyp_subst_tac*)
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    37
val prems = goalw thy [comp_def]
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    38
    "[| xz : r O s;  \
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    39
\       !!x y z. [| xz = (x,z);  (x,y):s;  (y,z):r |] ==> P \
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    40
\    |] ==> P";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    41
by (cut_facts_tac prems 1);
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
    42
by (REPEAT (eresolve_tac [CollectE, splitE, exE, conjE] 1 
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
    43
     ORELSE ares_tac prems 1));
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    44
qed "compE";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    45
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    46
val prems = goal thy
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    47
    "[| (a,c) : r O s;  \
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    48
\       !!y. [| (a,y):s;  (y,c):r |] ==> P \
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    49
\    |] ==> P";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    50
by (rtac compE 1);
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    51
by (REPEAT (ares_tac prems 1 ORELSE eresolve_tac [Pair_inject,ssubst] 1));
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    52
qed "compEpair";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    53
1754
852093aeb0ab Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents: 1694
diff changeset
    54
AddIs [compI, idI];
852093aeb0ab Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents: 1694
diff changeset
    55
AddSEs [compE, idE];
852093aeb0ab Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents: 1694
diff changeset
    56
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    57
goal thy "R O id = R";
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    58
by (Fast_tac 1);
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    59
qed "R_O_id";
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    60
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    61
goal thy "id O R = R";
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    62
by (Fast_tac 1);
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    63
qed "id_O_R";
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    64
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    65
Addsimps [R_O_id,id_O_R];
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    66
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    67
goal thy "!!r s. [| r'<=r; s'<=s |] ==> (r' O s') <= (r O s)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
    68
by (Blast_tac 1);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    69
qed "comp_mono";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    70
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    71
goal thy
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
    72
    "!!r s. [| s <= A Times B;  r <= B Times C |] ==> (r O s) <= A Times C";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
    73
by (Blast_tac 1);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    74
qed "comp_subset_Sigma";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    75
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    76
(** Natural deduction for trans(r) **)
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    77
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    78
val prems = goalw thy [trans_def]
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    79
    "(!! x y z. [| (x,y):r;  (y,z):r |] ==> (x,z):r) ==> trans(r)";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    80
by (REPEAT (ares_tac (prems@[allI,impI]) 1));
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    81
qed "transI";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    82
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
    83
goalw thy [trans_def]
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
    84
    "!!r. [| trans(r);  (a,b):r;  (b,c):r |] ==> (a,c):r";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
    85
by (Blast_tac 1);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    86
qed "transD";
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    87
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
    88
(** Natural deduction for r^-1 **)
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    89
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
    90
goalw thy [converse_def] "!!a b r. ((a,b): r^-1) = ((b,a):r)";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
    91
by (Simp_tac 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
    92
qed "converse_iff";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
    93
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
    94
AddIffs [converse_iff];
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
    95
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
    96
goalw thy [converse_def] "!!a b r. (a,b):r ==> (b,a): r^-1";
1264
3eb91524b938 added local simpsets; removed IOA from 'make test'
clasohm
parents: 1128
diff changeset
    97
by (Simp_tac 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
    98
qed "converseI";
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
    99
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   100
goalw thy [converse_def] "!!a b r. (a,b) : r^-1 ==> (b,a) : r";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   101
by (Blast_tac 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   102
qed "converseD";
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   103
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   104
(*More general than converseD, as it "splits" the member of the relation*)
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   105
qed_goalw "converseE" thy [converse_def]
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   106
    "[| yx : r^-1;  \
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   107
\       !!x y. [| yx=(y,x);  (x,y):r |] ==> P \
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   108
\    |] ==> P"
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   109
 (fn [major,minor]=>
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   110
  [ (rtac (major RS CollectE) 1),
1454
d0266c81a85e Streamlined defs in Relation and added new intro/elim rules to do with
nipkow
parents: 1264
diff changeset
   111
    (REPEAT (eresolve_tac [splitE, bexE,exE, conjE, minor] 1)),
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   112
    (assume_tac 1) ]);
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   113
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   114
AddSEs [converseE];
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   115
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   116
goalw thy [converse_def] "(r^-1)^-1 = r";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   117
by (Blast_tac 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   118
qed "converse_converse";
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   119
Addsimps [converse_converse];
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2891
diff changeset
   120
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   121
goal thy "(r O s)^-1 = s^-1 O r^-1";
4423
a129b817b58a expandshort;
wenzelm
parents: 4089
diff changeset
   122
by (Blast_tac 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   123
qed "converse_comp";
1605
248e1e125ca0 added converse_converse
nipkow
parents: 1552
diff changeset
   124
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   125
goal thy "id^-1 = id";
4644
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   126
by (Blast_tac 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   127
qed "converse_id";
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   128
Addsimps [converse_id];
4644
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   129
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   130
(** Domain **)
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   131
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   132
qed_goalw "Domain_iff" thy [Domain_def]
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   133
    "a: Domain(r) = (EX y. (a,y): r)"
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   134
 (fn _=> [ (Blast_tac 1) ]);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   135
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   136
qed_goal "DomainI" thy "!!a b r. (a,b): r ==> a: Domain(r)"
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   137
 (fn _ => [ (etac (exI RS (Domain_iff RS iffD2)) 1) ]);
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   138
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   139
qed_goal "DomainE" thy
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   140
    "[| a : Domain(r);  !!y. (a,y): r ==> P |] ==> P"
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   141
 (fn prems=>
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   142
  [ (rtac (Domain_iff RS iffD1 RS exE) 1),
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   143
    (REPEAT (ares_tac prems 1)) ]);
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   144
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
   145
AddIs  [DomainI];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
   146
AddSEs [DomainE];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
   147
4644
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   148
goal thy "Domain id = UNIV";
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   149
by (Blast_tac 1);
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   150
qed "Domain_id";
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   151
Addsimps [Domain_id];
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   152
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   153
(** Range **)
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   154
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   155
qed_goalw "RangeI" thy [Range_def] "!!a b r.(a,b): r ==> b : Range(r)"
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   156
 (fn _ => [ (etac (converseI RS DomainI) 1) ]);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   157
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   158
qed_goalw "RangeE" thy [Range_def]
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   159
    "[| b : Range(r);  !!x. (x,b): r ==> P |] ==> P"
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   160
 (fn major::prems=>
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   161
  [ (rtac (major RS DomainE) 1),
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   162
    (resolve_tac prems 1),
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4733
diff changeset
   163
    (etac converseD 1) ]);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   164
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
   165
AddIs  [RangeI];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
   166
AddSEs [RangeE];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
   167
4644
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   168
goal thy "Range id = UNIV";
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   169
by (Blast_tac 1);
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   170
qed "Range_id";
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   171
Addsimps [Range_id];
ecf8f17f6fe0 New laws for id
paulson
parents: 4601
diff changeset
   172
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   173
(*** Image of a set under a relation ***)
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   174
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   175
qed_goalw "Image_iff" thy [Image_def]
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   176
    "b : r^^A = (? x:A. (x,b):r)"
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   177
 (fn _ => [ Blast_tac 1 ]);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   178
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   179
qed_goalw "Image_singleton" thy [Image_def]
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   180
    "r^^{a} = {b. (a,b):r}"
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   181
 (fn _ => [ Blast_tac 1 ]);
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   182
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   183
qed_goal "Image_singleton_iff" thy
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   184
    "(b : r^^{a}) = ((a,b):r)"
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   185
 (fn _ => [ rtac (Image_iff RS trans) 1,
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   186
            Blast_tac 1 ]);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   187
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   188
AddIffs [Image_singleton_iff];
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   189
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   190
qed_goalw "ImageI" thy [Image_def]
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   191
    "!!a b r. [| (a,b): r;  a:A |] ==> b : r^^A"
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   192
 (fn _ => [ (Blast_tac 1)]);
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   193
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   194
qed_goalw "ImageE" thy [Image_def]
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   195
    "[| b: r^^A;  !!x.[| (x,b): r;  x:A |] ==> P |] ==> P"
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   196
 (fn major::prems=>
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   197
  [ (rtac (major RS CollectE) 1),
3718
d78cf498a88c Minor tidying to use Clarify_tac, etc.
paulson
parents: 3439
diff changeset
   198
    (Clarify_tac 1),
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   199
    (rtac (hd prems) 1),
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   200
    (REPEAT (etac bexE 1 ORELSE ares_tac prems 1)) ]);
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   201
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
   202
AddIs  [ImageI];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
   203
AddSEs [ImageE];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1842
diff changeset
   204
4593
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   205
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   206
qed_goal "Image_empty" thy
4593
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   207
    "R^^{} = {}"
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   208
 (fn _ => [ Blast_tac 1 ]);
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   209
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   210
Addsimps [Image_empty];
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   211
4601
87fc0d44b837 New theorem Image_id
paulson
parents: 4593
diff changeset
   212
goal thy "id ^^ A = A";
87fc0d44b837 New theorem Image_id
paulson
parents: 4593
diff changeset
   213
by (Blast_tac 1);
87fc0d44b837 New theorem Image_id
paulson
parents: 4593
diff changeset
   214
qed "Image_id";
87fc0d44b837 New theorem Image_id
paulson
parents: 4593
diff changeset
   215
87fc0d44b837 New theorem Image_id
paulson
parents: 4593
diff changeset
   216
Addsimps [Image_id];
87fc0d44b837 New theorem Image_id
paulson
parents: 4593
diff changeset
   217
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   218
qed_goal "Image_Int_subset" thy
4593
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   219
    "R ^^ (A Int B) <= R ^^ A Int R ^^ B"
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   220
 (fn _ => [ Blast_tac 1 ]);
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   221
4733
2c984ac036f5 New theorem Image_eq_UN; deleted the silly vimage_inverse_Image
paulson
parents: 4673
diff changeset
   222
qed_goal "Image_Un" thy "R ^^ (A Un B) = R ^^ A Un R ^^ B"
4593
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   223
 (fn _ => [ Blast_tac 1 ]);
6fc8f224655f Three new facts about Image
paulson
parents: 4423
diff changeset
   224
4733
2c984ac036f5 New theorem Image_eq_UN; deleted the silly vimage_inverse_Image
paulson
parents: 4673
diff changeset
   225
qed_goal "Image_subset" thy "!!A B r. r <= A Times B ==> r^^C <= B"
1128
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   226
 (fn _ =>
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   227
  [ (rtac subsetI 1),
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   228
    (REPEAT (eresolve_tac [asm_rl, ImageE, subsetD RS SigmaD2] 1)) ]);
64b30e3cc6d4 Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff changeset
   229
4733
2c984ac036f5 New theorem Image_eq_UN; deleted the silly vimage_inverse_Image
paulson
parents: 4673
diff changeset
   230
(*NOT suitable for rewriting*)
2c984ac036f5 New theorem Image_eq_UN; deleted the silly vimage_inverse_Image
paulson
parents: 4673
diff changeset
   231
goal thy "r^^B = (UN y: B. r^^{y})";
4673
59d80bacee62 New theorems; tidied
paulson
parents: 4650
diff changeset
   232
by (Blast_tac 1);
4733
2c984ac036f5 New theorem Image_eq_UN; deleted the silly vimage_inverse_Image
paulson
parents: 4673
diff changeset
   233
qed "Image_eq_UN";
4760
9cdbd5a1d25a added introduction and elimination rules for Univalent
oheimb
parents: 4746
diff changeset
   234
9cdbd5a1d25a added introduction and elimination rules for Univalent
oheimb
parents: 4746
diff changeset
   235
9cdbd5a1d25a added introduction and elimination rules for Univalent
oheimb
parents: 4746
diff changeset
   236
section "Univalent";
9cdbd5a1d25a added introduction and elimination rules for Univalent
oheimb
parents: 4746
diff changeset
   237
9cdbd5a1d25a added introduction and elimination rules for Univalent
oheimb
parents: 4746
diff changeset
   238
qed_goalw "UnivalentI" Relation.thy [Univalent_def] 
9cdbd5a1d25a added introduction and elimination rules for Univalent
oheimb
parents: 4746
diff changeset
   239
   "!!r. !x y. (x,y):r --> (!z. (x,z):r --> y=z) ==> Univalent r" (K [atac 1]);
9cdbd5a1d25a added introduction and elimination rules for Univalent
oheimb
parents: 4746
diff changeset
   240
9cdbd5a1d25a added introduction and elimination rules for Univalent
oheimb
parents: 4746
diff changeset
   241
qed_goalw "UnivalentD" Relation.thy [Univalent_def] 
9cdbd5a1d25a added introduction and elimination rules for Univalent
oheimb
parents: 4746
diff changeset
   242
	"!!r. [| Univalent r; (x,y):r; (x,z):r|] ==> y=z" (K [Auto_tac]);