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