| author | berghofe | 
| Fri, 16 Apr 2004 18:48:13 +0200 | |
| changeset 14600 | ba51bc239716 | 
| parent 13830 | 7f8c1b533e8b | 
| child 15131 | c69542757a4d | 
| permissions | -rw-r--r-- | 
| 10358 | 1  | 
(* Title: HOL/Relation.thy  | 
| 
1128
 
64b30e3cc6d4
Trancl is now based on Relation which used to be in Integ.
 
nipkow 
parents:  
diff
changeset
 | 
2  | 
ID: $Id$  | 
| 1983 | 3  | 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory  | 
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  | 
|
| 12905 | 7  | 
header {* Relations *}
 | 
8  | 
||
9  | 
theory Relation = Product_Type:  | 
|
| 
5978
 
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
 
paulson 
parents: 
5608 
diff
changeset
 | 
10  | 
|
| 12913 | 11  | 
subsection {* Definitions *}
 | 
12  | 
||
| 
5978
 
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
 
paulson 
parents: 
5608 
diff
changeset
 | 
13  | 
constdefs  | 
| 10358 | 14  | 
  converse :: "('a * 'b) set => ('b * 'a) set"    ("(_^-1)" [1000] 999)
 | 
15  | 
  "r^-1 == {(y, x). (x, y) : r}"
 | 
|
16  | 
syntax (xsymbols)  | 
|
| 12905 | 17  | 
  converse :: "('a * 'b) set => ('b * 'a) set"    ("(_\<inverse>)" [1000] 999)
 | 
| 7912 | 18  | 
|
| 10358 | 19  | 
constdefs  | 
| 12487 | 20  | 
  rel_comp  :: "[('b * 'c) set, ('a * 'b) set] => ('a * 'c) set"  (infixr "O" 60)
 | 
| 12913 | 21  | 
  "r O s == {(x,z). EX y. (x, y) : s & (y, z) : r}"
 | 
22  | 
||
| 11136 | 23  | 
  Image :: "[('a * 'b) set, 'a set] => 'b set"                (infixl "``" 90)
 | 
| 12913 | 24  | 
  "r `` s == {y. EX x:s. (x,y):r}"
 | 
| 7912 | 25  | 
|
| 12905 | 26  | 
  Id    :: "('a * 'a) set"  -- {* the identity relation *}
 | 
| 12913 | 27  | 
  "Id == {p. EX x. p = (x,x)}"
 | 
| 7912 | 28  | 
|
| 12905 | 29  | 
  diag  :: "'a set => ('a * 'a) set"  -- {* diagonal: identity over a set *}
 | 
| 13830 | 30  | 
  "diag A == \<Union>x\<in>A. {(x,x)}"
 | 
| 12913 | 31  | 
|
| 11136 | 32  | 
  Domain :: "('a * 'b) set => 'a set"
 | 
| 12913 | 33  | 
  "Domain r == {x. EX y. (x,y):r}"
 | 
| 
5978
 
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
 
paulson 
parents: 
5608 
diff
changeset
 | 
34  | 
|
| 11136 | 35  | 
  Range  :: "('a * 'b) set => 'b set"
 | 
| 12913 | 36  | 
"Range r == Domain(r^-1)"  | 
| 
5978
 
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
 
paulson 
parents: 
5608 
diff
changeset
 | 
37  | 
|
| 11136 | 38  | 
  Field :: "('a * 'a) set => 'a set"
 | 
| 13830 | 39  | 
"Field r == Domain r \<union> Range r"  | 
| 10786 | 40  | 
|
| 12905 | 41  | 
  refl   :: "['a set, ('a * 'a) set] => bool"  -- {* reflexivity over a set *}
 | 
| 12913 | 42  | 
"refl A r == r \<subseteq> A \<times> A & (ALL x: A. (x,x) : r)"  | 
| 
6806
 
43c081a0858d
new preficates refl, sym [from Integ/Equiv], antisym
 
paulson 
parents: 
5978 
diff
changeset
 | 
43  | 
|
| 12905 | 44  | 
  sym    :: "('a * 'a) set => bool"  -- {* symmetry predicate *}
 | 
| 12913 | 45  | 
"sym r == ALL x y. (x,y): r --> (y,x): r"  | 
| 
6806
 
43c081a0858d
new preficates refl, sym [from Integ/Equiv], antisym
 
paulson 
parents: 
5978 
diff
changeset
 | 
46  | 
|
| 12905 | 47  | 
  antisym:: "('a * 'a) set => bool"  -- {* antisymmetry predicate *}
 | 
| 12913 | 48  | 
"antisym r == ALL x y. (x,y):r --> (y,x):r --> x=y"  | 
| 
6806
 
43c081a0858d
new preficates refl, sym [from Integ/Equiv], antisym
 
paulson 
parents: 
5978 
diff
changeset
 | 
49  | 
|
| 12905 | 50  | 
  trans  :: "('a * 'a) set => bool"  -- {* transitivity predicate *}
 | 
| 12913 | 51  | 
"trans r == (ALL x y z. (x,y):r --> (y,z):r --> (x,z):r)"  | 
| 
5978
 
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
 
paulson 
parents: 
5608 
diff
changeset
 | 
52  | 
|
| 11136 | 53  | 
  single_valued :: "('a * 'b) set => bool"
 | 
| 12913 | 54  | 
"single_valued r == ALL x y. (x,y):r --> (ALL z. (x,z):r --> y=z)"  | 
| 
7014
 
11ee650edcd2
Added some definitions and theorems needed for the
 
berghofe 
parents: 
6806 
diff
changeset
 | 
55  | 
|
| 11136 | 56  | 
  inv_image :: "('b * 'b) set => ('a => 'b) => ('a * 'a) set"
 | 
| 12913 | 57  | 
  "inv_image r f == {(x, y). (f x, f y) : r}"
 | 
| 11136 | 58  | 
|
| 
6806
 
43c081a0858d
new preficates refl, sym [from Integ/Equiv], antisym
 
paulson 
parents: 
5978 
diff
changeset
 | 
59  | 
syntax  | 
| 12905 | 60  | 
  reflexive :: "('a * 'a) set => bool"  -- {* reflexivity over a type *}
 | 
| 
6806
 
43c081a0858d
new preficates refl, sym [from Integ/Equiv], antisym
 
paulson 
parents: 
5978 
diff
changeset
 | 
61  | 
translations  | 
| 
 
43c081a0858d
new preficates refl, sym [from Integ/Equiv], antisym
 
paulson 
parents: 
5978 
diff
changeset
 | 
62  | 
"reflexive" == "refl UNIV"  | 
| 
 
43c081a0858d
new preficates refl, sym [from Integ/Equiv], antisym
 
paulson 
parents: 
5978 
diff
changeset
 | 
63  | 
|
| 12905 | 64  | 
|
| 12913 | 65  | 
subsection {* The identity relation *}
 | 
| 12905 | 66  | 
|
67  | 
lemma IdI [intro]: "(a, a) : Id"  | 
|
68  | 
by (simp add: Id_def)  | 
|
69  | 
||
70  | 
lemma IdE [elim!]: "p : Id ==> (!!x. p = (x, x) ==> P) ==> P"  | 
|
71  | 
by (unfold Id_def) (rules elim: CollectE)  | 
|
72  | 
||
73  | 
lemma pair_in_Id_conv [iff]: "((a, b) : Id) = (a = b)"  | 
|
74  | 
by (unfold Id_def) blast  | 
|
75  | 
||
76  | 
lemma reflexive_Id: "reflexive Id"  | 
|
77  | 
by (simp add: refl_def)  | 
|
78  | 
||
79  | 
lemma antisym_Id: "antisym Id"  | 
|
80  | 
  -- {* A strange result, since @{text Id} is also symmetric. *}
 | 
|
81  | 
by (simp add: antisym_def)  | 
|
82  | 
||
83  | 
lemma trans_Id: "trans Id"  | 
|
84  | 
by (simp add: trans_def)  | 
|
85  | 
||
86  | 
||
| 12913 | 87  | 
subsection {* Diagonal: identity over a set *}
 | 
| 12905 | 88  | 
|
| 
13812
 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 
paulson 
parents: 
13639 
diff
changeset
 | 
89  | 
lemma diag_empty [simp]: "diag {} = {}"
 | 
| 
 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 
paulson 
parents: 
13639 
diff
changeset
 | 
90  | 
by (simp add: diag_def)  | 
| 
 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 
paulson 
parents: 
13639 
diff
changeset
 | 
91  | 
|
| 12905 | 92  | 
lemma diag_eqI: "a = b ==> a : A ==> (a, b) : diag A"  | 
93  | 
by (simp add: diag_def)  | 
|
94  | 
||
95  | 
lemma diagI [intro!]: "a : A ==> (a, a) : diag A"  | 
|
96  | 
by (rule diag_eqI) (rule refl)  | 
|
97  | 
||
98  | 
lemma diagE [elim!]:  | 
|
99  | 
"c : diag A ==> (!!x. x : A ==> c = (x, x) ==> P) ==> P"  | 
|
| 12913 | 100  | 
  -- {* The general elimination rule. *}
 | 
| 12905 | 101  | 
by (unfold diag_def) (rules elim!: UN_E singletonE)  | 
102  | 
||
103  | 
lemma diag_iff: "((x, y) : diag A) = (x = y & x : A)"  | 
|
104  | 
by blast  | 
|
105  | 
||
| 12913 | 106  | 
lemma diag_subset_Times: "diag A \<subseteq> A \<times> A"  | 
| 12905 | 107  | 
by blast  | 
108  | 
||
109  | 
||
110  | 
subsection {* Composition of two relations *}
 | 
|
111  | 
||
| 12913 | 112  | 
lemma rel_compI [intro]:  | 
| 12905 | 113  | 
"(a, b) : s ==> (b, c) : r ==> (a, c) : r O s"  | 
114  | 
by (unfold rel_comp_def) blast  | 
|
115  | 
||
| 12913 | 116  | 
lemma rel_compE [elim!]: "xz : r O s ==>  | 
| 12905 | 117  | 
(!!x y z. xz = (x, z) ==> (x, y) : s ==> (y, z) : r ==> P) ==> P"  | 
118  | 
by (unfold rel_comp_def) (rules elim!: CollectE splitE exE conjE)  | 
|
119  | 
||
120  | 
lemma rel_compEpair:  | 
|
121  | 
"(a, c) : r O s ==> (!!y. (a, y) : s ==> (y, c) : r ==> P) ==> P"  | 
|
122  | 
by (rules elim: rel_compE Pair_inject ssubst)  | 
|
123  | 
||
124  | 
lemma R_O_Id [simp]: "R O Id = R"  | 
|
125  | 
by fast  | 
|
126  | 
||
127  | 
lemma Id_O_R [simp]: "Id O R = R"  | 
|
128  | 
by fast  | 
|
129  | 
||
130  | 
lemma O_assoc: "(R O S) O T = R O (S O T)"  | 
|
131  | 
by blast  | 
|
132  | 
||
| 12913 | 133  | 
lemma trans_O_subset: "trans r ==> r O r \<subseteq> r"  | 
| 12905 | 134  | 
by (unfold trans_def) blast  | 
135  | 
||
| 12913 | 136  | 
lemma rel_comp_mono: "r' \<subseteq> r ==> s' \<subseteq> s ==> (r' O s') \<subseteq> (r O s)"  | 
| 12905 | 137  | 
by blast  | 
138  | 
||
139  | 
lemma rel_comp_subset_Sigma:  | 
|
| 12913 | 140  | 
"s \<subseteq> A \<times> B ==> r \<subseteq> B \<times> C ==> (r O s) \<subseteq> A \<times> C"  | 
| 12905 | 141  | 
by blast  | 
142  | 
||
| 12913 | 143  | 
|
144  | 
subsection {* Reflexivity *}
 | 
|
145  | 
||
146  | 
lemma reflI: "r \<subseteq> A \<times> A ==> (!!x. x : A ==> (x, x) : r) ==> refl A r"  | 
|
| 12905 | 147  | 
by (unfold refl_def) (rules intro!: ballI)  | 
148  | 
||
149  | 
lemma reflD: "refl A r ==> a : A ==> (a, a) : r"  | 
|
150  | 
by (unfold refl_def) blast  | 
|
151  | 
||
| 12913 | 152  | 
|
153  | 
subsection {* Antisymmetry *}
 | 
|
| 12905 | 154  | 
|
155  | 
lemma antisymI:  | 
|
156  | 
"(!!x y. (x, y) : r ==> (y, x) : r ==> x=y) ==> antisym r"  | 
|
157  | 
by (unfold antisym_def) rules  | 
|
158  | 
||
159  | 
lemma antisymD: "antisym r ==> (a, b) : r ==> (b, a) : r ==> a = b"  | 
|
160  | 
by (unfold antisym_def) rules  | 
|
161  | 
||
| 12913 | 162  | 
|
163  | 
subsection {* Transitivity *}
 | 
|
| 12905 | 164  | 
|
165  | 
lemma transI:  | 
|
166  | 
"(!!x y z. (x, y) : r ==> (y, z) : r ==> (x, z) : r) ==> trans r"  | 
|
167  | 
by (unfold trans_def) rules  | 
|
168  | 
||
169  | 
lemma transD: "trans r ==> (a, b) : r ==> (b, c) : r ==> (a, c) : r"  | 
|
170  | 
by (unfold trans_def) rules  | 
|
171  | 
||
172  | 
||
| 12913 | 173  | 
subsection {* Converse *}
 | 
174  | 
||
175  | 
lemma converse_iff [iff]: "((a,b): r^-1) = ((b,a) : r)"  | 
|
| 12905 | 176  | 
by (simp add: converse_def)  | 
177  | 
||
| 13343 | 178  | 
lemma converseI[sym]: "(a, b) : r ==> (b, a) : r^-1"  | 
| 12905 | 179  | 
by (simp add: converse_def)  | 
180  | 
||
| 13343 | 181  | 
lemma converseD[sym]: "(a,b) : r^-1 ==> (b, a) : r"  | 
| 12905 | 182  | 
by (simp add: converse_def)  | 
183  | 
||
184  | 
lemma converseE [elim!]:  | 
|
185  | 
"yx : r^-1 ==> (!!x y. yx = (y, x) ==> (x, y) : r ==> P) ==> P"  | 
|
| 12913 | 186  | 
    -- {* More general than @{text converseD}, as it ``splits'' the member of the relation. *}
 | 
| 12905 | 187  | 
by (unfold converse_def) (rules elim!: CollectE splitE bexE)  | 
188  | 
||
189  | 
lemma converse_converse [simp]: "(r^-1)^-1 = r"  | 
|
190  | 
by (unfold converse_def) blast  | 
|
191  | 
||
192  | 
lemma converse_rel_comp: "(r O s)^-1 = s^-1 O r^-1"  | 
|
193  | 
by blast  | 
|
194  | 
||
195  | 
lemma converse_Id [simp]: "Id^-1 = Id"  | 
|
196  | 
by blast  | 
|
197  | 
||
| 12913 | 198  | 
lemma converse_diag [simp]: "(diag A)^-1 = diag A"  | 
| 12905 | 199  | 
by blast  | 
200  | 
||
201  | 
lemma refl_converse: "refl A r ==> refl A (converse r)"  | 
|
202  | 
by (unfold refl_def) blast  | 
|
203  | 
||
204  | 
lemma antisym_converse: "antisym (converse r) = antisym r"  | 
|
205  | 
by (unfold antisym_def) blast  | 
|
206  | 
||
207  | 
lemma trans_converse: "trans (converse r) = trans r"  | 
|
208  | 
by (unfold trans_def) blast  | 
|
209  | 
||
| 12913 | 210  | 
|
| 12905 | 211  | 
subsection {* Domain *}
 | 
212  | 
||
213  | 
lemma Domain_iff: "(a : Domain r) = (EX y. (a, y) : r)"  | 
|
214  | 
by (unfold Domain_def) blast  | 
|
215  | 
||
216  | 
lemma DomainI [intro]: "(a, b) : r ==> a : Domain r"  | 
|
217  | 
by (rules intro!: iffD2 [OF Domain_iff])  | 
|
218  | 
||
219  | 
lemma DomainE [elim!]:  | 
|
220  | 
"a : Domain r ==> (!!y. (a, y) : r ==> P) ==> P"  | 
|
221  | 
by (rules dest!: iffD1 [OF Domain_iff])  | 
|
222  | 
||
223  | 
lemma Domain_empty [simp]: "Domain {} = {}"
 | 
|
224  | 
by blast  | 
|
225  | 
||
226  | 
lemma Domain_insert: "Domain (insert (a, b) r) = insert a (Domain r)"  | 
|
227  | 
by blast  | 
|
228  | 
||
229  | 
lemma Domain_Id [simp]: "Domain Id = UNIV"  | 
|
230  | 
by blast  | 
|
231  | 
||
232  | 
lemma Domain_diag [simp]: "Domain (diag A) = A"  | 
|
233  | 
by blast  | 
|
234  | 
||
| 13830 | 235  | 
lemma Domain_Un_eq: "Domain(A \<union> B) = Domain(A) \<union> Domain(B)"  | 
| 12905 | 236  | 
by blast  | 
237  | 
||
| 13830 | 238  | 
lemma Domain_Int_subset: "Domain(A \<inter> B) \<subseteq> Domain(A) \<inter> Domain(B)"  | 
| 12905 | 239  | 
by blast  | 
240  | 
||
| 12913 | 241  | 
lemma Domain_Diff_subset: "Domain(A) - Domain(B) \<subseteq> Domain(A - B)"  | 
| 12905 | 242  | 
by blast  | 
243  | 
||
| 13830 | 244  | 
lemma Domain_Union: "Domain (Union S) = (\<Union>A\<in>S. Domain A)"  | 
| 12905 | 245  | 
by blast  | 
246  | 
||
| 12913 | 247  | 
lemma Domain_mono: "r \<subseteq> s ==> Domain r \<subseteq> Domain s"  | 
| 12905 | 248  | 
by blast  | 
249  | 
||
250  | 
||
251  | 
subsection {* Range *}
 | 
|
252  | 
||
253  | 
lemma Range_iff: "(a : Range r) = (EX y. (y, a) : r)"  | 
|
254  | 
by (simp add: Domain_def Range_def)  | 
|
255  | 
||
256  | 
lemma RangeI [intro]: "(a, b) : r ==> b : Range r"  | 
|
257  | 
by (unfold Range_def) (rules intro!: converseI DomainI)  | 
|
258  | 
||
259  | 
lemma RangeE [elim!]: "b : Range r ==> (!!x. (x, b) : r ==> P) ==> P"  | 
|
260  | 
by (unfold Range_def) (rules elim!: DomainE dest!: converseD)  | 
|
261  | 
||
262  | 
lemma Range_empty [simp]: "Range {} = {}"
 | 
|
263  | 
by blast  | 
|
264  | 
||
265  | 
lemma Range_insert: "Range (insert (a, b) r) = insert b (Range r)"  | 
|
266  | 
by blast  | 
|
267  | 
||
268  | 
lemma Range_Id [simp]: "Range Id = UNIV"  | 
|
269  | 
by blast  | 
|
270  | 
||
271  | 
lemma Range_diag [simp]: "Range (diag A) = A"  | 
|
272  | 
by auto  | 
|
273  | 
||
| 13830 | 274  | 
lemma Range_Un_eq: "Range(A \<union> B) = Range(A) \<union> Range(B)"  | 
| 12905 | 275  | 
by blast  | 
276  | 
||
| 13830 | 277  | 
lemma Range_Int_subset: "Range(A \<inter> B) \<subseteq> Range(A) \<inter> Range(B)"  | 
| 12905 | 278  | 
by blast  | 
279  | 
||
| 12913 | 280  | 
lemma Range_Diff_subset: "Range(A) - Range(B) \<subseteq> Range(A - B)"  | 
| 12905 | 281  | 
by blast  | 
282  | 
||
| 13830 | 283  | 
lemma Range_Union: "Range (Union S) = (\<Union>A\<in>S. Range A)"  | 
| 12905 | 284  | 
by blast  | 
285  | 
||
286  | 
||
287  | 
subsection {* Image of a set under a relation *}
 | 
|
288  | 
||
| 12913 | 289  | 
lemma Image_iff: "(b : r``A) = (EX x:A. (x, b) : r)"  | 
| 12905 | 290  | 
by (simp add: Image_def)  | 
291  | 
||
| 12913 | 292  | 
lemma Image_singleton: "r``{a} = {b. (a, b) : r}"
 | 
| 12905 | 293  | 
by (simp add: Image_def)  | 
294  | 
||
| 12913 | 295  | 
lemma Image_singleton_iff [iff]: "(b : r``{a}) = ((a, b) : r)"
 | 
| 12905 | 296  | 
by (rule Image_iff [THEN trans]) simp  | 
297  | 
||
| 12913 | 298  | 
lemma ImageI [intro]: "(a, b) : r ==> a : A ==> b : r``A"  | 
| 12905 | 299  | 
by (unfold Image_def) blast  | 
300  | 
||
301  | 
lemma ImageE [elim!]:  | 
|
| 12913 | 302  | 
"b : r `` A ==> (!!x. (x, b) : r ==> x : A ==> P) ==> P"  | 
| 12905 | 303  | 
by (unfold Image_def) (rules elim!: CollectE bexE)  | 
304  | 
||
305  | 
lemma rev_ImageI: "a : A ==> (a, b) : r ==> b : r `` A"  | 
|
306  | 
  -- {* This version's more effective when we already have the required @{text a} *}
 | 
|
307  | 
by blast  | 
|
308  | 
||
309  | 
lemma Image_empty [simp]: "R``{} = {}"
 | 
|
310  | 
by blast  | 
|
311  | 
||
312  | 
lemma Image_Id [simp]: "Id `` A = A"  | 
|
313  | 
by blast  | 
|
314  | 
||
| 13830 | 315  | 
lemma Image_diag [simp]: "diag A `` B = A \<inter> B"  | 
316  | 
by blast  | 
|
317  | 
||
318  | 
lemma Image_Int_subset: "R `` (A \<inter> B) \<subseteq> R `` A \<inter> R `` B"  | 
|
| 12905 | 319  | 
by blast  | 
320  | 
||
| 13830 | 321  | 
lemma Image_Int_eq:  | 
322  | 
"single_valued (converse R) ==> R `` (A \<inter> B) = R `` A \<inter> R `` B"  | 
|
323  | 
by (simp add: single_valued_def, blast)  | 
|
| 12905 | 324  | 
|
| 13830 | 325  | 
lemma Image_Un: "R `` (A \<union> B) = R `` A \<union> R `` B"  | 
| 12905 | 326  | 
by blast  | 
327  | 
||
| 
13812
 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 
paulson 
parents: 
13639 
diff
changeset
 | 
328  | 
lemma Un_Image: "(R \<union> S) `` A = R `` A \<union> S `` A"  | 
| 
 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 
paulson 
parents: 
13639 
diff
changeset
 | 
329  | 
by blast  | 
| 
 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 
paulson 
parents: 
13639 
diff
changeset
 | 
330  | 
|
| 12913 | 331  | 
lemma Image_subset: "r \<subseteq> A \<times> B ==> r``C \<subseteq> B"  | 
| 12905 | 332  | 
by (rules intro!: subsetI elim!: ImageE dest!: subsetD SigmaD2)  | 
333  | 
||
| 13830 | 334  | 
lemma Image_eq_UN: "r``B = (\<Union>y\<in> B. r``{y})"
 | 
| 12905 | 335  | 
  -- {* NOT suitable for rewriting *}
 | 
336  | 
by blast  | 
|
337  | 
||
| 12913 | 338  | 
lemma Image_mono: "r' \<subseteq> r ==> A' \<subseteq> A ==> (r' `` A') \<subseteq> (r `` A)"  | 
| 12905 | 339  | 
by blast  | 
340  | 
||
| 13830 | 341  | 
lemma Image_UN: "(r `` (UNION A B)) = (\<Union>x\<in>A. r `` (B x))"  | 
342  | 
by blast  | 
|
343  | 
||
344  | 
lemma Image_INT_subset: "(r `` INTER A B) \<subseteq> (\<Inter>x\<in>A. r `` (B x))"  | 
|
| 12905 | 345  | 
by blast  | 
346  | 
||
| 13830 | 347  | 
text{*Converse inclusion requires some assumptions*}
 | 
348  | 
lemma Image_INT_eq:  | 
|
349  | 
     "[|single_valued (r\<inverse>); A\<noteq>{}|] ==> r `` INTER A B = (\<Inter>x\<in>A. r `` B x)"
 | 
|
350  | 
apply (rule equalityI)  | 
|
351  | 
apply (rule Image_INT_subset)  | 
|
352  | 
apply (simp add: single_valued_def, blast)  | 
|
353  | 
done  | 
|
| 12905 | 354  | 
|
| 12913 | 355  | 
lemma Image_subset_eq: "(r``A \<subseteq> B) = (A \<subseteq> - ((r^-1) `` (-B)))"  | 
| 12905 | 356  | 
by blast  | 
357  | 
||
358  | 
||
| 12913 | 359  | 
subsection {* Single valued relations *}
 | 
360  | 
||
361  | 
lemma single_valuedI:  | 
|
| 12905 | 362  | 
"ALL x y. (x,y):r --> (ALL z. (x,z):r --> y=z) ==> single_valued r"  | 
363  | 
by (unfold single_valued_def)  | 
|
364  | 
||
365  | 
lemma single_valuedD:  | 
|
366  | 
"single_valued r ==> (x, y) : r ==> (x, z) : r ==> y = z"  | 
|
367  | 
by (simp add: single_valued_def)  | 
|
368  | 
||
369  | 
||
370  | 
subsection {* Graphs given by @{text Collect} *}
 | 
|
371  | 
||
372  | 
lemma Domain_Collect_split [simp]: "Domain{(x,y). P x y} = {x. EX y. P x y}"
 | 
|
373  | 
by auto  | 
|
374  | 
||
375  | 
lemma Range_Collect_split [simp]: "Range{(x,y). P x y} = {y. EX x. P x y}"
 | 
|
376  | 
by auto  | 
|
377  | 
||
378  | 
lemma Image_Collect_split [simp]: "{(x,y). P x y} `` A = {y. EX x:A. P x y}"
 | 
|
379  | 
by auto  | 
|
380  | 
||
381  | 
||
| 12913 | 382  | 
subsection {* Inverse image *}
 | 
| 12905 | 383  | 
|
| 12913 | 384  | 
lemma trans_inv_image: "trans r ==> trans (inv_image r f)"  | 
| 12905 | 385  | 
apply (unfold trans_def inv_image_def)  | 
386  | 
apply (simp (no_asm))  | 
|
387  | 
apply blast  | 
|
388  | 
done  | 
|
389  | 
||
| 
1128
 
64b30e3cc6d4
Trancl is now based on Relation which used to be in Integ.
 
nipkow 
parents:  
diff
changeset
 | 
390  | 
end  |