author | huffman |
Wed, 22 Jun 2011 13:45:32 -0700 | |
changeset 43525 | 8f28a91ea135 |
parent 41792 | ff3cb0c418b7 |
child 44278 | 1220ecb81e8f |
permissions | -rw-r--r-- |
10358 | 1 |
(* Title: HOL/Relation.thy |
1983 | 2 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 |
Copyright 1996 University of Cambridge |
|
1128
64b30e3cc6d4
Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff
changeset
|
4 |
*) |
64b30e3cc6d4
Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff
changeset
|
5 |
|
12905 | 6 |
header {* Relations *} |
7 |
||
15131 | 8 |
theory Relation |
32850 | 9 |
imports Datatype Finite_Set |
15131 | 10 |
begin |
5978
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
paulson
parents:
5608
diff
changeset
|
11 |
|
12913 | 12 |
subsection {* Definitions *} |
13 |
||
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19363
diff
changeset
|
14 |
definition |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
15 |
converse :: "('a * 'b) set => ('b * 'a) set" |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
16 |
("(_^-1)" [1000] 999) where |
10358 | 17 |
"r^-1 == {(y, x). (x, y) : r}" |
7912 | 18 |
|
21210 | 19 |
notation (xsymbols) |
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19363
diff
changeset
|
20 |
converse ("(_\<inverse>)" [1000] 999) |
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19363
diff
changeset
|
21 |
|
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19363
diff
changeset
|
22 |
definition |
32235
8f9b8d14fc9f
"more standard" argument order of relation composition (op O)
krauss
parents:
31011
diff
changeset
|
23 |
rel_comp :: "[('a * 'b) set, ('b * 'c) set] => ('a * 'c) set" |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
24 |
(infixr "O" 75) where |
32235
8f9b8d14fc9f
"more standard" argument order of relation composition (op O)
krauss
parents:
31011
diff
changeset
|
25 |
"r O s == {(x,z). EX y. (x, y) : r & (y, z) : s}" |
12913 | 26 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
27 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
28 |
Image :: "[('a * 'b) set, 'a set] => 'b set" |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
29 |
(infixl "``" 90) where |
12913 | 30 |
"r `` s == {y. EX x:s. (x,y):r}" |
7912 | 31 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
32 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
33 |
Id :: "('a * 'a) set" where -- {* the identity relation *} |
12913 | 34 |
"Id == {p. EX x. p = (x,x)}" |
7912 | 35 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
36 |
definition |
30198 | 37 |
Id_on :: "'a set => ('a * 'a) set" where -- {* diagonal: identity over a set *} |
38 |
"Id_on A == \<Union>x\<in>A. {(x,x)}" |
|
12913 | 39 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
40 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
41 |
Domain :: "('a * 'b) set => 'a set" where |
12913 | 42 |
"Domain r == {x. EX y. (x,y):r}" |
5978
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
paulson
parents:
5608
diff
changeset
|
43 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
44 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
45 |
Range :: "('a * 'b) set => 'b set" where |
12913 | 46 |
"Range r == Domain(r^-1)" |
5978
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
paulson
parents:
5608
diff
changeset
|
47 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
48 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
49 |
Field :: "('a * 'a) set => 'a set" where |
13830 | 50 |
"Field r == Domain r \<union> Range r" |
10786 | 51 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
52 |
definition |
30198 | 53 |
refl_on :: "['a set, ('a * 'a) set] => bool" where -- {* reflexivity over a set *} |
54 |
"refl_on 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
|
55 |
|
26297 | 56 |
abbreviation |
30198 | 57 |
refl :: "('a * 'a) set => bool" where -- {* reflexivity over a type *} |
58 |
"refl == refl_on UNIV" |
|
26297 | 59 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
60 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
61 |
sym :: "('a * 'a) set => bool" where -- {* symmetry predicate *} |
12913 | 62 |
"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
|
63 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
64 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
65 |
antisym :: "('a * 'a) set => bool" where -- {* antisymmetry predicate *} |
12913 | 66 |
"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
|
67 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
68 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
69 |
trans :: "('a * 'a) set => bool" where -- {* transitivity predicate *} |
12913 | 70 |
"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
|
71 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
72 |
definition |
29859
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
73 |
irrefl :: "('a * 'a) set => bool" where |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
74 |
"irrefl r \<equiv> \<forall>x. (x,x) \<notin> r" |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
75 |
|
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
76 |
definition |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
77 |
total_on :: "'a set => ('a * 'a) set => bool" where |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
78 |
"total_on A r \<equiv> \<forall>x\<in>A.\<forall>y\<in>A. x\<noteq>y \<longrightarrow> (x,y)\<in>r \<or> (y,x)\<in>r" |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
79 |
|
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
80 |
abbreviation "total \<equiv> total_on UNIV" |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
81 |
|
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
82 |
definition |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
83 |
single_valued :: "('a * 'b) set => bool" where |
12913 | 84 |
"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
|
85 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
86 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
87 |
inv_image :: "('b * 'b) set => ('a => 'b) => ('a * 'a) set" where |
12913 | 88 |
"inv_image r f == {(x, y). (f x, f y) : r}" |
11136 | 89 |
|
12905 | 90 |
|
12913 | 91 |
subsection {* The identity relation *} |
12905 | 92 |
|
93 |
lemma IdI [intro]: "(a, a) : Id" |
|
26271 | 94 |
by (simp add: Id_def) |
12905 | 95 |
|
96 |
lemma IdE [elim!]: "p : Id ==> (!!x. p = (x, x) ==> P) ==> P" |
|
26271 | 97 |
by (unfold Id_def) (iprover elim: CollectE) |
12905 | 98 |
|
99 |
lemma pair_in_Id_conv [iff]: "((a, b) : Id) = (a = b)" |
|
26271 | 100 |
by (unfold Id_def) blast |
12905 | 101 |
|
30198 | 102 |
lemma refl_Id: "refl Id" |
103 |
by (simp add: refl_on_def) |
|
12905 | 104 |
|
105 |
lemma antisym_Id: "antisym Id" |
|
106 |
-- {* A strange result, since @{text Id} is also symmetric. *} |
|
26271 | 107 |
by (simp add: antisym_def) |
12905 | 108 |
|
19228 | 109 |
lemma sym_Id: "sym Id" |
26271 | 110 |
by (simp add: sym_def) |
19228 | 111 |
|
12905 | 112 |
lemma trans_Id: "trans Id" |
26271 | 113 |
by (simp add: trans_def) |
12905 | 114 |
|
115 |
||
12913 | 116 |
subsection {* Diagonal: identity over a set *} |
12905 | 117 |
|
30198 | 118 |
lemma Id_on_empty [simp]: "Id_on {} = {}" |
119 |
by (simp add: Id_on_def) |
|
13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13639
diff
changeset
|
120 |
|
30198 | 121 |
lemma Id_on_eqI: "a = b ==> a : A ==> (a, b) : Id_on A" |
122 |
by (simp add: Id_on_def) |
|
12905 | 123 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
33218
diff
changeset
|
124 |
lemma Id_onI [intro!,no_atp]: "a : A ==> (a, a) : Id_on A" |
30198 | 125 |
by (rule Id_on_eqI) (rule refl) |
12905 | 126 |
|
30198 | 127 |
lemma Id_onE [elim!]: |
128 |
"c : Id_on A ==> (!!x. x : A ==> c = (x, x) ==> P) ==> P" |
|
12913 | 129 |
-- {* The general elimination rule. *} |
30198 | 130 |
by (unfold Id_on_def) (iprover elim!: UN_E singletonE) |
12905 | 131 |
|
30198 | 132 |
lemma Id_on_iff: "((x, y) : Id_on A) = (x = y & x : A)" |
26271 | 133 |
by blast |
12905 | 134 |
|
41792
ff3cb0c418b7
renamed "nitpick\_def" to "nitpick_unfold" to reflect its new semantics
blanchet
parents:
41056
diff
changeset
|
135 |
lemma Id_on_def' [nitpick_unfold, code]: |
40923
be80c93ac0a2
adding a nice definition of Id_on for quickcheck and nitpick
bulwahn
parents:
36772
diff
changeset
|
136 |
"(Id_on (A :: 'a => bool)) = (%(x, y). x = y \<and> A x)" |
be80c93ac0a2
adding a nice definition of Id_on for quickcheck and nitpick
bulwahn
parents:
36772
diff
changeset
|
137 |
by (auto simp add: fun_eq_iff |
be80c93ac0a2
adding a nice definition of Id_on for quickcheck and nitpick
bulwahn
parents:
36772
diff
changeset
|
138 |
elim: Id_onE[unfolded mem_def] intro: Id_onI[unfolded mem_def]) |
be80c93ac0a2
adding a nice definition of Id_on for quickcheck and nitpick
bulwahn
parents:
36772
diff
changeset
|
139 |
|
30198 | 140 |
lemma Id_on_subset_Times: "Id_on A \<subseteq> A \<times> A" |
26271 | 141 |
by blast |
12905 | 142 |
|
143 |
||
144 |
subsection {* Composition of two relations *} |
|
145 |
||
12913 | 146 |
lemma rel_compI [intro]: |
32235
8f9b8d14fc9f
"more standard" argument order of relation composition (op O)
krauss
parents:
31011
diff
changeset
|
147 |
"(a, b) : r ==> (b, c) : s ==> (a, c) : r O s" |
26271 | 148 |
by (unfold rel_comp_def) blast |
12905 | 149 |
|
12913 | 150 |
lemma rel_compE [elim!]: "xz : r O s ==> |
32235
8f9b8d14fc9f
"more standard" argument order of relation composition (op O)
krauss
parents:
31011
diff
changeset
|
151 |
(!!x y z. xz = (x, z) ==> (x, y) : r ==> (y, z) : s ==> P) ==> P" |
26271 | 152 |
by (unfold rel_comp_def) (iprover elim!: CollectE splitE exE conjE) |
12905 | 153 |
|
154 |
lemma rel_compEpair: |
|
32235
8f9b8d14fc9f
"more standard" argument order of relation composition (op O)
krauss
parents:
31011
diff
changeset
|
155 |
"(a, c) : r O s ==> (!!y. (a, y) : r ==> (y, c) : s ==> P) ==> P" |
26271 | 156 |
by (iprover elim: rel_compE Pair_inject ssubst) |
12905 | 157 |
|
158 |
lemma R_O_Id [simp]: "R O Id = R" |
|
26271 | 159 |
by fast |
12905 | 160 |
|
161 |
lemma Id_O_R [simp]: "Id O R = R" |
|
26271 | 162 |
by fast |
12905 | 163 |
|
23185 | 164 |
lemma rel_comp_empty1[simp]: "{} O R = {}" |
26271 | 165 |
by blast |
23185 | 166 |
|
167 |
lemma rel_comp_empty2[simp]: "R O {} = {}" |
|
26271 | 168 |
by blast |
23185 | 169 |
|
12905 | 170 |
lemma O_assoc: "(R O S) O T = R O (S O T)" |
26271 | 171 |
by blast |
12905 | 172 |
|
12913 | 173 |
lemma trans_O_subset: "trans r ==> r O r \<subseteq> r" |
26271 | 174 |
by (unfold trans_def) blast |
12905 | 175 |
|
12913 | 176 |
lemma rel_comp_mono: "r' \<subseteq> r ==> s' \<subseteq> s ==> (r' O s') \<subseteq> (r O s)" |
26271 | 177 |
by blast |
12905 | 178 |
|
179 |
lemma rel_comp_subset_Sigma: |
|
32235
8f9b8d14fc9f
"more standard" argument order of relation composition (op O)
krauss
parents:
31011
diff
changeset
|
180 |
"r \<subseteq> A \<times> B ==> s \<subseteq> B \<times> C ==> (r O s) \<subseteq> A \<times> C" |
26271 | 181 |
by blast |
12905 | 182 |
|
28008
f945f8d9ad4d
added distributivity of relation composition over union [simp]
krauss
parents:
26297
diff
changeset
|
183 |
lemma rel_comp_distrib[simp]: "R O (S \<union> T) = (R O S) \<union> (R O T)" |
f945f8d9ad4d
added distributivity of relation composition over union [simp]
krauss
parents:
26297
diff
changeset
|
184 |
by auto |
f945f8d9ad4d
added distributivity of relation composition over union [simp]
krauss
parents:
26297
diff
changeset
|
185 |
|
f945f8d9ad4d
added distributivity of relation composition over union [simp]
krauss
parents:
26297
diff
changeset
|
186 |
lemma rel_comp_distrib2[simp]: "(S \<union> T) O R = (S O R) \<union> (T O R)" |
f945f8d9ad4d
added distributivity of relation composition over union [simp]
krauss
parents:
26297
diff
changeset
|
187 |
by auto |
f945f8d9ad4d
added distributivity of relation composition over union [simp]
krauss
parents:
26297
diff
changeset
|
188 |
|
36772 | 189 |
lemma rel_comp_UNION_distrib: "s O UNION I r = UNION I (%i. s O r i)" |
190 |
by auto |
|
191 |
||
192 |
lemma rel_comp_UNION_distrib2: "UNION I r O s = UNION I (%i. r i O s)" |
|
193 |
by auto |
|
194 |
||
12913 | 195 |
|
196 |
subsection {* Reflexivity *} |
|
197 |
||
30198 | 198 |
lemma refl_onI: "r \<subseteq> A \<times> A ==> (!!x. x : A ==> (x, x) : r) ==> refl_on A r" |
199 |
by (unfold refl_on_def) (iprover intro!: ballI) |
|
12905 | 200 |
|
30198 | 201 |
lemma refl_onD: "refl_on A r ==> a : A ==> (a, a) : r" |
202 |
by (unfold refl_on_def) blast |
|
12905 | 203 |
|
30198 | 204 |
lemma refl_onD1: "refl_on A r ==> (x, y) : r ==> x : A" |
205 |
by (unfold refl_on_def) blast |
|
19228 | 206 |
|
30198 | 207 |
lemma refl_onD2: "refl_on A r ==> (x, y) : r ==> y : A" |
208 |
by (unfold refl_on_def) blast |
|
19228 | 209 |
|
30198 | 210 |
lemma refl_on_Int: "refl_on A r ==> refl_on B s ==> refl_on (A \<inter> B) (r \<inter> s)" |
211 |
by (unfold refl_on_def) blast |
|
19228 | 212 |
|
30198 | 213 |
lemma refl_on_Un: "refl_on A r ==> refl_on B s ==> refl_on (A \<union> B) (r \<union> s)" |
214 |
by (unfold refl_on_def) blast |
|
19228 | 215 |
|
30198 | 216 |
lemma refl_on_INTER: |
217 |
"ALL x:S. refl_on (A x) (r x) ==> refl_on (INTER S A) (INTER S r)" |
|
218 |
by (unfold refl_on_def) fast |
|
19228 | 219 |
|
30198 | 220 |
lemma refl_on_UNION: |
221 |
"ALL x:S. refl_on (A x) (r x) \<Longrightarrow> refl_on (UNION S A) (UNION S r)" |
|
222 |
by (unfold refl_on_def) blast |
|
19228 | 223 |
|
30198 | 224 |
lemma refl_on_empty[simp]: "refl_on {} {}" |
225 |
by(simp add:refl_on_def) |
|
26297 | 226 |
|
30198 | 227 |
lemma refl_on_Id_on: "refl_on A (Id_on A)" |
228 |
by (rule refl_onI [OF Id_on_subset_Times Id_onI]) |
|
19228 | 229 |
|
41792
ff3cb0c418b7
renamed "nitpick\_def" to "nitpick_unfold" to reflect its new semantics
blanchet
parents:
41056
diff
changeset
|
230 |
lemma refl_on_def' [nitpick_unfold, code]: |
41056
dcec9bc71ee9
adding a definition for refl_on which is friendly for quickcheck and nitpick
bulwahn
parents:
40923
diff
changeset
|
231 |
"refl_on A r = ((\<forall>(x, y) \<in> r. x : A \<and> y : A) \<and> (\<forall>x \<in> A. (x, x) : r))" |
dcec9bc71ee9
adding a definition for refl_on which is friendly for quickcheck and nitpick
bulwahn
parents:
40923
diff
changeset
|
232 |
by (auto intro: refl_onI dest: refl_onD refl_onD1 refl_onD2) |
12913 | 233 |
|
234 |
subsection {* Antisymmetry *} |
|
12905 | 235 |
|
236 |
lemma antisymI: |
|
237 |
"(!!x y. (x, y) : r ==> (y, x) : r ==> x=y) ==> antisym r" |
|
26271 | 238 |
by (unfold antisym_def) iprover |
12905 | 239 |
|
240 |
lemma antisymD: "antisym r ==> (a, b) : r ==> (b, a) : r ==> a = b" |
|
26271 | 241 |
by (unfold antisym_def) iprover |
12905 | 242 |
|
19228 | 243 |
lemma antisym_subset: "r \<subseteq> s ==> antisym s ==> antisym r" |
26271 | 244 |
by (unfold antisym_def) blast |
12913 | 245 |
|
19228 | 246 |
lemma antisym_empty [simp]: "antisym {}" |
26271 | 247 |
by (unfold antisym_def) blast |
19228 | 248 |
|
30198 | 249 |
lemma antisym_Id_on [simp]: "antisym (Id_on A)" |
26271 | 250 |
by (unfold antisym_def) blast |
19228 | 251 |
|
252 |
||
253 |
subsection {* Symmetry *} |
|
254 |
||
255 |
lemma symI: "(!!a b. (a, b) : r ==> (b, a) : r) ==> sym r" |
|
26271 | 256 |
by (unfold sym_def) iprover |
15177 | 257 |
|
258 |
lemma symD: "sym r ==> (a, b) : r ==> (b, a) : r" |
|
26271 | 259 |
by (unfold sym_def, blast) |
12905 | 260 |
|
19228 | 261 |
lemma sym_Int: "sym r ==> sym s ==> sym (r \<inter> s)" |
26271 | 262 |
by (fast intro: symI dest: symD) |
19228 | 263 |
|
264 |
lemma sym_Un: "sym r ==> sym s ==> sym (r \<union> s)" |
|
26271 | 265 |
by (fast intro: symI dest: symD) |
19228 | 266 |
|
267 |
lemma sym_INTER: "ALL x:S. sym (r x) ==> sym (INTER S r)" |
|
26271 | 268 |
by (fast intro: symI dest: symD) |
19228 | 269 |
|
270 |
lemma sym_UNION: "ALL x:S. sym (r x) ==> sym (UNION S r)" |
|
26271 | 271 |
by (fast intro: symI dest: symD) |
19228 | 272 |
|
30198 | 273 |
lemma sym_Id_on [simp]: "sym (Id_on A)" |
26271 | 274 |
by (rule symI) clarify |
19228 | 275 |
|
276 |
||
277 |
subsection {* Transitivity *} |
|
278 |
||
12905 | 279 |
lemma transI: |
280 |
"(!!x y z. (x, y) : r ==> (y, z) : r ==> (x, z) : r) ==> trans r" |
|
26271 | 281 |
by (unfold trans_def) iprover |
12905 | 282 |
|
283 |
lemma transD: "trans r ==> (a, b) : r ==> (b, c) : r ==> (a, c) : r" |
|
26271 | 284 |
by (unfold trans_def) iprover |
12905 | 285 |
|
19228 | 286 |
lemma trans_Int: "trans r ==> trans s ==> trans (r \<inter> s)" |
26271 | 287 |
by (fast intro: transI elim: transD) |
19228 | 288 |
|
289 |
lemma trans_INTER: "ALL x:S. trans (r x) ==> trans (INTER S r)" |
|
26271 | 290 |
by (fast intro: transI elim: transD) |
19228 | 291 |
|
30198 | 292 |
lemma trans_Id_on [simp]: "trans (Id_on A)" |
26271 | 293 |
by (fast intro: transI elim: transD) |
19228 | 294 |
|
29859
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
295 |
lemma trans_diff_Id: " trans r \<Longrightarrow> antisym r \<Longrightarrow> trans (r-Id)" |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
296 |
unfolding antisym_def trans_def by blast |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
297 |
|
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
298 |
subsection {* Irreflexivity *} |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
299 |
|
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
300 |
lemma irrefl_diff_Id[simp]: "irrefl(r-Id)" |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
301 |
by(simp add:irrefl_def) |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
302 |
|
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
303 |
subsection {* Totality *} |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
304 |
|
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
305 |
lemma total_on_empty[simp]: "total_on {} r" |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
306 |
by(simp add:total_on_def) |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
307 |
|
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
308 |
lemma total_on_diff_Id[simp]: "total_on A (r-Id) = total_on A r" |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
309 |
by(simp add: total_on_def) |
12905 | 310 |
|
12913 | 311 |
subsection {* Converse *} |
312 |
||
313 |
lemma converse_iff [iff]: "((a,b): r^-1) = ((b,a) : r)" |
|
26271 | 314 |
by (simp add: converse_def) |
12905 | 315 |
|
13343 | 316 |
lemma converseI[sym]: "(a, b) : r ==> (b, a) : r^-1" |
26271 | 317 |
by (simp add: converse_def) |
12905 | 318 |
|
13343 | 319 |
lemma converseD[sym]: "(a,b) : r^-1 ==> (b, a) : r" |
26271 | 320 |
by (simp add: converse_def) |
12905 | 321 |
|
322 |
lemma converseE [elim!]: |
|
323 |
"yx : r^-1 ==> (!!x y. yx = (y, x) ==> (x, y) : r ==> P) ==> P" |
|
12913 | 324 |
-- {* More general than @{text converseD}, as it ``splits'' the member of the relation. *} |
26271 | 325 |
by (unfold converse_def) (iprover elim!: CollectE splitE bexE) |
12905 | 326 |
|
327 |
lemma converse_converse [simp]: "(r^-1)^-1 = r" |
|
26271 | 328 |
by (unfold converse_def) blast |
12905 | 329 |
|
330 |
lemma converse_rel_comp: "(r O s)^-1 = s^-1 O r^-1" |
|
26271 | 331 |
by blast |
12905 | 332 |
|
19228 | 333 |
lemma converse_Int: "(r \<inter> s)^-1 = r^-1 \<inter> s^-1" |
26271 | 334 |
by blast |
19228 | 335 |
|
336 |
lemma converse_Un: "(r \<union> s)^-1 = r^-1 \<union> s^-1" |
|
26271 | 337 |
by blast |
19228 | 338 |
|
339 |
lemma converse_INTER: "(INTER S r)^-1 = (INT x:S. (r x)^-1)" |
|
26271 | 340 |
by fast |
19228 | 341 |
|
342 |
lemma converse_UNION: "(UNION S r)^-1 = (UN x:S. (r x)^-1)" |
|
26271 | 343 |
by blast |
19228 | 344 |
|
12905 | 345 |
lemma converse_Id [simp]: "Id^-1 = Id" |
26271 | 346 |
by blast |
12905 | 347 |
|
30198 | 348 |
lemma converse_Id_on [simp]: "(Id_on A)^-1 = Id_on A" |
26271 | 349 |
by blast |
12905 | 350 |
|
30198 | 351 |
lemma refl_on_converse [simp]: "refl_on A (converse r) = refl_on A r" |
352 |
by (unfold refl_on_def) auto |
|
12905 | 353 |
|
19228 | 354 |
lemma sym_converse [simp]: "sym (converse r) = sym r" |
26271 | 355 |
by (unfold sym_def) blast |
19228 | 356 |
|
357 |
lemma antisym_converse [simp]: "antisym (converse r) = antisym r" |
|
26271 | 358 |
by (unfold antisym_def) blast |
12905 | 359 |
|
19228 | 360 |
lemma trans_converse [simp]: "trans (converse r) = trans r" |
26271 | 361 |
by (unfold trans_def) blast |
12905 | 362 |
|
19228 | 363 |
lemma sym_conv_converse_eq: "sym r = (r^-1 = r)" |
26271 | 364 |
by (unfold sym_def) fast |
19228 | 365 |
|
366 |
lemma sym_Un_converse: "sym (r \<union> r^-1)" |
|
26271 | 367 |
by (unfold sym_def) blast |
19228 | 368 |
|
369 |
lemma sym_Int_converse: "sym (r \<inter> r^-1)" |
|
26271 | 370 |
by (unfold sym_def) blast |
19228 | 371 |
|
29859
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
372 |
lemma total_on_converse[simp]: "total_on A (r^-1) = total_on A r" |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
373 |
by (auto simp: total_on_def) |
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset
|
374 |
|
12913 | 375 |
|
12905 | 376 |
subsection {* Domain *} |
377 |
||
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
33218
diff
changeset
|
378 |
declare Domain_def [no_atp] |
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23709
diff
changeset
|
379 |
|
12905 | 380 |
lemma Domain_iff: "(a : Domain r) = (EX y. (a, y) : r)" |
26271 | 381 |
by (unfold Domain_def) blast |
12905 | 382 |
|
383 |
lemma DomainI [intro]: "(a, b) : r ==> a : Domain r" |
|
26271 | 384 |
by (iprover intro!: iffD2 [OF Domain_iff]) |
12905 | 385 |
|
386 |
lemma DomainE [elim!]: |
|
387 |
"a : Domain r ==> (!!y. (a, y) : r ==> P) ==> P" |
|
26271 | 388 |
by (iprover dest!: iffD1 [OF Domain_iff]) |
12905 | 389 |
|
390 |
lemma Domain_empty [simp]: "Domain {} = {}" |
|
26271 | 391 |
by blast |
12905 | 392 |
|
32876 | 393 |
lemma Domain_empty_iff: "Domain r = {} \<longleftrightarrow> r = {}" |
394 |
by auto |
|
395 |
||
12905 | 396 |
lemma Domain_insert: "Domain (insert (a, b) r) = insert a (Domain r)" |
26271 | 397 |
by blast |
12905 | 398 |
|
399 |
lemma Domain_Id [simp]: "Domain Id = UNIV" |
|
26271 | 400 |
by blast |
12905 | 401 |
|
30198 | 402 |
lemma Domain_Id_on [simp]: "Domain (Id_on A) = A" |
26271 | 403 |
by blast |
12905 | 404 |
|
13830 | 405 |
lemma Domain_Un_eq: "Domain(A \<union> B) = Domain(A) \<union> Domain(B)" |
26271 | 406 |
by blast |
12905 | 407 |
|
13830 | 408 |
lemma Domain_Int_subset: "Domain(A \<inter> B) \<subseteq> Domain(A) \<inter> Domain(B)" |
26271 | 409 |
by blast |
12905 | 410 |
|
12913 | 411 |
lemma Domain_Diff_subset: "Domain(A) - Domain(B) \<subseteq> Domain(A - B)" |
26271 | 412 |
by blast |
12905 | 413 |
|
13830 | 414 |
lemma Domain_Union: "Domain (Union S) = (\<Union>A\<in>S. Domain A)" |
26271 | 415 |
by blast |
416 |
||
417 |
lemma Domain_converse[simp]: "Domain(r^-1) = Range r" |
|
418 |
by(auto simp:Range_def) |
|
12905 | 419 |
|
12913 | 420 |
lemma Domain_mono: "r \<subseteq> s ==> Domain r \<subseteq> Domain s" |
26271 | 421 |
by blast |
12905 | 422 |
|
36729 | 423 |
lemma fst_eq_Domain: "fst ` R = Domain R" |
26271 | 424 |
by (auto intro!:image_eqI) |
22172 | 425 |
|
29609 | 426 |
lemma Domain_dprod [simp]: "Domain (dprod r s) = uprod (Domain r) (Domain s)" |
427 |
by auto |
|
428 |
||
429 |
lemma Domain_dsum [simp]: "Domain (dsum r s) = usum (Domain r) (Domain s)" |
|
430 |
by auto |
|
431 |
||
12905 | 432 |
|
433 |
subsection {* Range *} |
|
434 |
||
435 |
lemma Range_iff: "(a : Range r) = (EX y. (y, a) : r)" |
|
26271 | 436 |
by (simp add: Domain_def Range_def) |
12905 | 437 |
|
438 |
lemma RangeI [intro]: "(a, b) : r ==> b : Range r" |
|
26271 | 439 |
by (unfold Range_def) (iprover intro!: converseI DomainI) |
12905 | 440 |
|
441 |
lemma RangeE [elim!]: "b : Range r ==> (!!x. (x, b) : r ==> P) ==> P" |
|
26271 | 442 |
by (unfold Range_def) (iprover elim!: DomainE dest!: converseD) |
12905 | 443 |
|
444 |
lemma Range_empty [simp]: "Range {} = {}" |
|
26271 | 445 |
by blast |
12905 | 446 |
|
32876 | 447 |
lemma Range_empty_iff: "Range r = {} \<longleftrightarrow> r = {}" |
448 |
by auto |
|
449 |
||
12905 | 450 |
lemma Range_insert: "Range (insert (a, b) r) = insert b (Range r)" |
26271 | 451 |
by blast |
12905 | 452 |
|
453 |
lemma Range_Id [simp]: "Range Id = UNIV" |
|
26271 | 454 |
by blast |
12905 | 455 |
|
30198 | 456 |
lemma Range_Id_on [simp]: "Range (Id_on A) = A" |
26271 | 457 |
by auto |
12905 | 458 |
|
13830 | 459 |
lemma Range_Un_eq: "Range(A \<union> B) = Range(A) \<union> Range(B)" |
26271 | 460 |
by blast |
12905 | 461 |
|
13830 | 462 |
lemma Range_Int_subset: "Range(A \<inter> B) \<subseteq> Range(A) \<inter> Range(B)" |
26271 | 463 |
by blast |
12905 | 464 |
|
12913 | 465 |
lemma Range_Diff_subset: "Range(A) - Range(B) \<subseteq> Range(A - B)" |
26271 | 466 |
by blast |
12905 | 467 |
|
13830 | 468 |
lemma Range_Union: "Range (Union S) = (\<Union>A\<in>S. Range A)" |
26271 | 469 |
by blast |
470 |
||
471 |
lemma Range_converse[simp]: "Range(r^-1) = Domain r" |
|
472 |
by blast |
|
12905 | 473 |
|
36729 | 474 |
lemma snd_eq_Range: "snd ` R = Range R" |
26271 | 475 |
by (auto intro!:image_eqI) |
476 |
||
477 |
||
478 |
subsection {* Field *} |
|
479 |
||
480 |
lemma mono_Field: "r \<subseteq> s \<Longrightarrow> Field r \<subseteq> Field s" |
|
481 |
by(auto simp:Field_def Domain_def Range_def) |
|
482 |
||
483 |
lemma Field_empty[simp]: "Field {} = {}" |
|
484 |
by(auto simp:Field_def) |
|
485 |
||
486 |
lemma Field_insert[simp]: "Field (insert (a,b) r) = {a,b} \<union> Field r" |
|
487 |
by(auto simp:Field_def) |
|
488 |
||
489 |
lemma Field_Un[simp]: "Field (r \<union> s) = Field r \<union> Field s" |
|
490 |
by(auto simp:Field_def) |
|
491 |
||
492 |
lemma Field_Union[simp]: "Field (\<Union>R) = \<Union>(Field ` R)" |
|
493 |
by(auto simp:Field_def) |
|
494 |
||
495 |
lemma Field_converse[simp]: "Field(r^-1) = Field r" |
|
496 |
by(auto simp:Field_def) |
|
22172 | 497 |
|
12905 | 498 |
|
499 |
subsection {* Image of a set under a relation *} |
|
500 |
||
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
33218
diff
changeset
|
501 |
declare Image_def [no_atp] |
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23709
diff
changeset
|
502 |
|
12913 | 503 |
lemma Image_iff: "(b : r``A) = (EX x:A. (x, b) : r)" |
26271 | 504 |
by (simp add: Image_def) |
12905 | 505 |
|
12913 | 506 |
lemma Image_singleton: "r``{a} = {b. (a, b) : r}" |
26271 | 507 |
by (simp add: Image_def) |
12905 | 508 |
|
12913 | 509 |
lemma Image_singleton_iff [iff]: "(b : r``{a}) = ((a, b) : r)" |
26271 | 510 |
by (rule Image_iff [THEN trans]) simp |
12905 | 511 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
33218
diff
changeset
|
512 |
lemma ImageI [intro,no_atp]: "(a, b) : r ==> a : A ==> b : r``A" |
26271 | 513 |
by (unfold Image_def) blast |
12905 | 514 |
|
515 |
lemma ImageE [elim!]: |
|
12913 | 516 |
"b : r `` A ==> (!!x. (x, b) : r ==> x : A ==> P) ==> P" |
26271 | 517 |
by (unfold Image_def) (iprover elim!: CollectE bexE) |
12905 | 518 |
|
519 |
lemma rev_ImageI: "a : A ==> (a, b) : r ==> b : r `` A" |
|
520 |
-- {* This version's more effective when we already have the required @{text a} *} |
|
26271 | 521 |
by blast |
12905 | 522 |
|
523 |
lemma Image_empty [simp]: "R``{} = {}" |
|
26271 | 524 |
by blast |
12905 | 525 |
|
526 |
lemma Image_Id [simp]: "Id `` A = A" |
|
26271 | 527 |
by blast |
12905 | 528 |
|
30198 | 529 |
lemma Image_Id_on [simp]: "Id_on A `` B = A \<inter> B" |
26271 | 530 |
by blast |
13830 | 531 |
|
532 |
lemma Image_Int_subset: "R `` (A \<inter> B) \<subseteq> R `` A \<inter> R `` B" |
|
26271 | 533 |
by blast |
12905 | 534 |
|
13830 | 535 |
lemma Image_Int_eq: |
536 |
"single_valued (converse R) ==> R `` (A \<inter> B) = R `` A \<inter> R `` B" |
|
26271 | 537 |
by (simp add: single_valued_def, blast) |
12905 | 538 |
|
13830 | 539 |
lemma Image_Un: "R `` (A \<union> B) = R `` A \<union> R `` B" |
26271 | 540 |
by blast |
12905 | 541 |
|
13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13639
diff
changeset
|
542 |
lemma Un_Image: "(R \<union> S) `` A = R `` A \<union> S `` A" |
26271 | 543 |
by blast |
13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13639
diff
changeset
|
544 |
|
12913 | 545 |
lemma Image_subset: "r \<subseteq> A \<times> B ==> r``C \<subseteq> B" |
26271 | 546 |
by (iprover intro!: subsetI elim!: ImageE dest!: subsetD SigmaD2) |
12905 | 547 |
|
13830 | 548 |
lemma Image_eq_UN: "r``B = (\<Union>y\<in> B. r``{y})" |
12905 | 549 |
-- {* NOT suitable for rewriting *} |
26271 | 550 |
by blast |
12905 | 551 |
|
12913 | 552 |
lemma Image_mono: "r' \<subseteq> r ==> A' \<subseteq> A ==> (r' `` A') \<subseteq> (r `` A)" |
26271 | 553 |
by blast |
12905 | 554 |
|
13830 | 555 |
lemma Image_UN: "(r `` (UNION A B)) = (\<Union>x\<in>A. r `` (B x))" |
26271 | 556 |
by blast |
13830 | 557 |
|
558 |
lemma Image_INT_subset: "(r `` INTER A B) \<subseteq> (\<Inter>x\<in>A. r `` (B x))" |
|
26271 | 559 |
by blast |
12905 | 560 |
|
13830 | 561 |
text{*Converse inclusion requires some assumptions*} |
562 |
lemma Image_INT_eq: |
|
563 |
"[|single_valued (r\<inverse>); A\<noteq>{}|] ==> r `` INTER A B = (\<Inter>x\<in>A. r `` B x)" |
|
564 |
apply (rule equalityI) |
|
565 |
apply (rule Image_INT_subset) |
|
566 |
apply (simp add: single_valued_def, blast) |
|
567 |
done |
|
12905 | 568 |
|
12913 | 569 |
lemma Image_subset_eq: "(r``A \<subseteq> B) = (A \<subseteq> - ((r^-1) `` (-B)))" |
26271 | 570 |
by blast |
12905 | 571 |
|
572 |
||
12913 | 573 |
subsection {* Single valued relations *} |
574 |
||
575 |
lemma single_valuedI: |
|
12905 | 576 |
"ALL x y. (x,y):r --> (ALL z. (x,z):r --> y=z) ==> single_valued r" |
26271 | 577 |
by (unfold single_valued_def) |
12905 | 578 |
|
579 |
lemma single_valuedD: |
|
580 |
"single_valued r ==> (x, y) : r ==> (x, z) : r ==> y = z" |
|
26271 | 581 |
by (simp add: single_valued_def) |
12905 | 582 |
|
19228 | 583 |
lemma single_valued_rel_comp: |
584 |
"single_valued r ==> single_valued s ==> single_valued (r O s)" |
|
26271 | 585 |
by (unfold single_valued_def) blast |
19228 | 586 |
|
587 |
lemma single_valued_subset: |
|
588 |
"r \<subseteq> s ==> single_valued s ==> single_valued r" |
|
26271 | 589 |
by (unfold single_valued_def) blast |
19228 | 590 |
|
591 |
lemma single_valued_Id [simp]: "single_valued Id" |
|
26271 | 592 |
by (unfold single_valued_def) blast |
19228 | 593 |
|
30198 | 594 |
lemma single_valued_Id_on [simp]: "single_valued (Id_on A)" |
26271 | 595 |
by (unfold single_valued_def) blast |
19228 | 596 |
|
12905 | 597 |
|
598 |
subsection {* Graphs given by @{text Collect} *} |
|
599 |
||
600 |
lemma Domain_Collect_split [simp]: "Domain{(x,y). P x y} = {x. EX y. P x y}" |
|
26271 | 601 |
by auto |
12905 | 602 |
|
603 |
lemma Range_Collect_split [simp]: "Range{(x,y). P x y} = {y. EX x. P x y}" |
|
26271 | 604 |
by auto |
12905 | 605 |
|
606 |
lemma Image_Collect_split [simp]: "{(x,y). P x y} `` A = {y. EX x:A. P x y}" |
|
26271 | 607 |
by auto |
12905 | 608 |
|
609 |
||
12913 | 610 |
subsection {* Inverse image *} |
12905 | 611 |
|
19228 | 612 |
lemma sym_inv_image: "sym r ==> sym (inv_image r f)" |
26271 | 613 |
by (unfold sym_def inv_image_def) blast |
19228 | 614 |
|
12913 | 615 |
lemma trans_inv_image: "trans r ==> trans (inv_image r f)" |
12905 | 616 |
apply (unfold trans_def inv_image_def) |
617 |
apply (simp (no_asm)) |
|
618 |
apply blast |
|
619 |
done |
|
620 |
||
32463
3a0a65ca2261
moved lemma Wellfounded.in_inv_image to Relation.thy
krauss
parents:
32235
diff
changeset
|
621 |
lemma in_inv_image[simp]: "((x,y) : inv_image r f) = ((f x, f y) : r)" |
3a0a65ca2261
moved lemma Wellfounded.in_inv_image to Relation.thy
krauss
parents:
32235
diff
changeset
|
622 |
by (auto simp:inv_image_def) |
3a0a65ca2261
moved lemma Wellfounded.in_inv_image to Relation.thy
krauss
parents:
32235
diff
changeset
|
623 |
|
33218 | 624 |
lemma converse_inv_image[simp]: "(inv_image R f)^-1 = inv_image (R^-1) f" |
625 |
unfolding inv_image_def converse_def by auto |
|
626 |
||
23709 | 627 |
|
29609 | 628 |
subsection {* Finiteness *} |
629 |
||
630 |
lemma finite_converse [iff]: "finite (r^-1) = finite r" |
|
631 |
apply (subgoal_tac "r^-1 = (%(x,y). (y,x))`r") |
|
632 |
apply simp |
|
633 |
apply (rule iffI) |
|
634 |
apply (erule finite_imageD [unfolded inj_on_def]) |
|
635 |
apply (simp split add: split_split) |
|
636 |
apply (erule finite_imageI) |
|
637 |
apply (simp add: converse_def image_def, auto) |
|
638 |
apply (rule bexI) |
|
639 |
prefer 2 apply assumption |
|
640 |
apply simp |
|
641 |
done |
|
642 |
||
32876 | 643 |
lemma finite_Domain: "finite r ==> finite (Domain r)" |
644 |
by (induct set: finite) (auto simp add: Domain_insert) |
|
645 |
||
646 |
lemma finite_Range: "finite r ==> finite (Range r)" |
|
647 |
by (induct set: finite) (auto simp add: Range_insert) |
|
29609 | 648 |
|
649 |
lemma finite_Field: "finite r ==> finite (Field r)" |
|
650 |
-- {* A finite relation has a finite field (@{text "= domain \<union> range"}. *} |
|
651 |
apply (induct set: finite) |
|
652 |
apply (auto simp add: Field_def Domain_insert Range_insert) |
|
653 |
done |
|
654 |
||
655 |
||
36728
ae397b810c8b
rule subrelI (for nice Isar proofs of relation inequalities)
krauss
parents:
35828
diff
changeset
|
656 |
subsection {* Miscellaneous *} |
ae397b810c8b
rule subrelI (for nice Isar proofs of relation inequalities)
krauss
parents:
35828
diff
changeset
|
657 |
|
ae397b810c8b
rule subrelI (for nice Isar proofs of relation inequalities)
krauss
parents:
35828
diff
changeset
|
658 |
text {* Version of @{thm[source] lfp_induct} for binary relations *} |
23709 | 659 |
|
660 |
lemmas lfp_induct2 = |
|
661 |
lfp_induct_set [of "(a, b)", split_format (complete)] |
|
662 |
||
36728
ae397b810c8b
rule subrelI (for nice Isar proofs of relation inequalities)
krauss
parents:
35828
diff
changeset
|
663 |
text {* Version of @{thm[source] subsetI} for binary relations *} |
ae397b810c8b
rule subrelI (for nice Isar proofs of relation inequalities)
krauss
parents:
35828
diff
changeset
|
664 |
|
ae397b810c8b
rule subrelI (for nice Isar proofs of relation inequalities)
krauss
parents:
35828
diff
changeset
|
665 |
lemma subrelI: "(\<And>x y. (x, y) \<in> r \<Longrightarrow> (x, y) \<in> s) \<Longrightarrow> r \<subseteq> s" |
ae397b810c8b
rule subrelI (for nice Isar proofs of relation inequalities)
krauss
parents:
35828
diff
changeset
|
666 |
by auto |
ae397b810c8b
rule subrelI (for nice Isar proofs of relation inequalities)
krauss
parents:
35828
diff
changeset
|
667 |
|
1128
64b30e3cc6d4
Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff
changeset
|
668 |
end |