src/HOL/Relation.thy
author paulson
Fri, 30 Aug 2002 16:42:45 +0200
changeset 13550 5a176b8dda84
parent 13343 3b2b18c58d80
child 13639 8ee6ea6627e1
permissions -rw-r--r--
removal of blast.overloaded
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
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    23
  fun_rel_comp :: "['a => 'b, ('b * 'c) set] => ('a => 'c) set"
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    24
  "fun_rel_comp f R == {g. ALL x. (f x, g x) : R}"
5978
fa2c2dd74f8c moved diag (diagonal relation) from Univ to Relation
paulson
parents: 5608
diff changeset
    25
11136
e34e7f6d9b57 moved inv_image to Relation
oheimb
parents: 10832
diff changeset
    26
  Image :: "[('a * 'b) set, 'a set] => 'b set"                (infixl "``" 90)
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    27
  "r `` s == {y. EX x:s. (x,y):r}"
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
  Id    :: "('a * 'a) set"  -- {* the identity relation *}
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    30
  "Id == {p. EX x. p = (x,x)}"
7912
0e42be14f136 tidied using modern infix form
paulson
parents: 7014
diff changeset
    31
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    32
  diag  :: "'a set => ('a * 'a) set"  -- {* diagonal: identity over a set *}
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    33
  "diag A == UN x:A. {(x,x)}"
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    34
11136
e34e7f6d9b57 moved inv_image to Relation
oheimb
parents: 10832
diff changeset
    35
  Domain :: "('a * 'b) set => 'a set"
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    36
  "Domain r == {x. EX y. (x,y):r}"
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
  Range  :: "('a * 'b) set => 'b set"
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    39
  "Range r == Domain(r^-1)"
5978
fa2c2dd74f8c moved diag (diagonal relation) from Univ to Relation
paulson
parents: 5608
diff changeset
    40
11136
e34e7f6d9b57 moved inv_image to Relation
oheimb
parents: 10832
diff changeset
    41
  Field :: "('a * 'a) set => 'a set"
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    42
  "Field r == Domain r Un Range r"
10786
04ee73606993 Field of a relation, and some Domain/Range rules
paulson
parents: 10358
diff changeset
    43
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    44
  refl   :: "['a set, ('a * 'a) set] => bool"  -- {* reflexivity over a set *}
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    45
  "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
    46
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    47
  sym    :: "('a * 'a) set => bool"  -- {* symmetry predicate *}
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    48
  "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
    49
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    50
  antisym:: "('a * 'a) set => bool"  -- {* antisymmetry predicate *}
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    51
  "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
    52
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    53
  trans  :: "('a * 'a) set => bool"  -- {* transitivity predicate *}
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    54
  "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
    55
11136
e34e7f6d9b57 moved inv_image to Relation
oheimb
parents: 10832
diff changeset
    56
  single_valued :: "('a * 'b) set => bool"
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    57
  "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
    58
11136
e34e7f6d9b57 moved inv_image to Relation
oheimb
parents: 10832
diff changeset
    59
  inv_image :: "('b * 'b) set => ('a => 'b) => ('a * 'a) set"
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    60
  "inv_image r f == {(x, y). (f x, f y) : r}"
11136
e34e7f6d9b57 moved inv_image to Relation
oheimb
parents: 10832
diff changeset
    61
6806
43c081a0858d new preficates refl, sym [from Integ/Equiv], antisym
paulson
parents: 5978
diff changeset
    62
syntax
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    63
  reflexive :: "('a * 'a) set => bool"  -- {* reflexivity over a type *}
6806
43c081a0858d new preficates refl, sym [from Integ/Equiv], antisym
paulson
parents: 5978
diff changeset
    64
translations
43c081a0858d new preficates refl, sym [from Integ/Equiv], antisym
paulson
parents: 5978
diff changeset
    65
  "reflexive" == "refl UNIV"
43c081a0858d new preficates refl, sym [from Integ/Equiv], antisym
paulson
parents: 5978
diff changeset
    66
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    67
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    68
subsection {* The identity relation *}
12905
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 IdI [intro]: "(a, a) : Id"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    71
  by (simp add: Id_def)
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 IdE [elim!]: "p : Id ==> (!!x. p = (x, x) ==> P) ==> P"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    74
  by (unfold Id_def) (rules elim: CollectE)
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 pair_in_Id_conv [iff]: "((a, b) : Id) = (a = b)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    77
  by (unfold Id_def) blast
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 reflexive_Id: "reflexive Id"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    80
  by (simp add: refl_def)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    81
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    82
lemma antisym_Id: "antisym Id"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    83
  -- {* A strange result, since @{text Id} is also symmetric. *}
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    84
  by (simp add: antisym_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
lemma trans_Id: "trans Id"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    87
  by (simp add: trans_def)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    88
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    89
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
    90
subsection {* Diagonal: identity over a set *}
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
    91
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 {* Composition of function and relation *}
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   145
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   146
lemma fun_rel_comp_mono: "A \<subseteq> B ==> fun_rel_comp f A \<subseteq> fun_rel_comp f B"
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   147
  by (unfold fun_rel_comp_def) fast
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   148
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   149
lemma fun_rel_comp_unique:
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   150
  "ALL x. EX! y. (f x, y) : R ==> EX! g. g : fun_rel_comp f R"
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   151
  apply (unfold fun_rel_comp_def)
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   152
  apply (rule_tac a = "%x. THE y. (f x, y) : R" in ex1I)
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   153
  apply (fast dest!: theI')
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   154
  apply (fast intro: ext the1_equality [symmetric])
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   155
  done
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   156
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   157
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   158
subsection {* Reflexivity *}
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   159
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   160
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
   161
  by (unfold refl_def) (rules intro!: ballI)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   162
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   163
lemma reflD: "refl A r ==> a : A ==> (a, a) : r"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   164
  by (unfold refl_def) blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   165
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   166
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   167
subsection {* Antisymmetry *}
12905
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 antisymI:
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   170
  "(!!x y. (x, y) : r ==> (y, x) : r ==> x=y) ==> antisym r"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   171
  by (unfold antisym_def) rules
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   172
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   173
lemma antisymD: "antisym r ==> (a, b) : r ==> (b, a) : r ==> a = b"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   174
  by (unfold antisym_def) rules
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   175
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   176
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   177
subsection {* Transitivity *}
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   178
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   179
lemma transI:
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   180
  "(!!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
   181
  by (unfold trans_def) rules
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   182
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   183
lemma transD: "trans r ==> (a, b) : r ==> (b, c) : r ==> (a, c) : r"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   184
  by (unfold trans_def) rules
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   185
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   186
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   187
subsection {* Converse *}
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   188
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   189
lemma converse_iff [iff]: "((a,b): r^-1) = ((b,a) : r)"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   190
  by (simp add: converse_def)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   191
13343
3b2b18c58d80 *** empty log message ***
nipkow
parents: 12913
diff changeset
   192
lemma converseI[sym]: "(a, b) : r ==> (b, a) : r^-1"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   193
  by (simp add: converse_def)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   194
13343
3b2b18c58d80 *** empty log message ***
nipkow
parents: 12913
diff changeset
   195
lemma converseD[sym]: "(a,b) : r^-1 ==> (b, a) : r"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   196
  by (simp add: converse_def)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   197
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   198
lemma converseE [elim!]:
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   199
  "yx : r^-1 ==> (!!x y. yx = (y, x) ==> (x, y) : r ==> P) ==> P"
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   200
    -- {* 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
   201
  by (unfold converse_def) (rules elim!: CollectE splitE bexE)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   202
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   203
lemma converse_converse [simp]: "(r^-1)^-1 = r"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   204
  by (unfold converse_def) blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   205
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   206
lemma converse_rel_comp: "(r O s)^-1 = s^-1 O r^-1"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   207
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   208
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   209
lemma converse_Id [simp]: "Id^-1 = Id"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   210
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   211
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   212
lemma converse_diag [simp]: "(diag A)^-1 = diag A"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   213
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   214
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   215
lemma refl_converse: "refl A r ==> refl A (converse r)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   216
  by (unfold refl_def) blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   217
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   218
lemma antisym_converse: "antisym (converse r) = antisym r"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   219
  by (unfold antisym_def) blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   220
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   221
lemma trans_converse: "trans (converse r) = trans r"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   222
  by (unfold trans_def) blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   223
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   224
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   225
subsection {* Domain *}
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   226
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   227
lemma Domain_iff: "(a : Domain r) = (EX y. (a, y) : r)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   228
  by (unfold Domain_def) blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   229
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   230
lemma DomainI [intro]: "(a, b) : r ==> a : Domain r"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   231
  by (rules intro!: iffD2 [OF Domain_iff])
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   232
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   233
lemma DomainE [elim!]:
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   234
  "a : Domain r ==> (!!y. (a, y) : r ==> P) ==> P"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   235
  by (rules dest!: iffD1 [OF Domain_iff])
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   236
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   237
lemma Domain_empty [simp]: "Domain {} = {}"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   238
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   239
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   240
lemma Domain_insert: "Domain (insert (a, b) r) = insert a (Domain r)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   241
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   242
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   243
lemma Domain_Id [simp]: "Domain Id = UNIV"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   244
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   245
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   246
lemma Domain_diag [simp]: "Domain (diag A) = A"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   247
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   248
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   249
lemma Domain_Un_eq: "Domain(A Un B) = Domain(A) Un Domain(B)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   250
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   251
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   252
lemma Domain_Int_subset: "Domain(A Int B) \<subseteq> Domain(A) Int Domain(B)"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   253
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   254
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   255
lemma Domain_Diff_subset: "Domain(A) - Domain(B) \<subseteq> Domain(A - B)"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   256
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   257
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   258
lemma Domain_Union: "Domain (Union S) = (UN A:S. Domain A)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   259
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   260
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   261
lemma Domain_mono: "r \<subseteq> s ==> Domain r \<subseteq> Domain s"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   262
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   263
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   264
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   265
subsection {* Range *}
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   266
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   267
lemma Range_iff: "(a : Range r) = (EX y. (y, a) : r)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   268
  by (simp add: Domain_def Range_def)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   269
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   270
lemma RangeI [intro]: "(a, b) : r ==> b : Range r"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   271
  by (unfold Range_def) (rules intro!: converseI DomainI)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   272
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   273
lemma RangeE [elim!]: "b : Range r ==> (!!x. (x, b) : r ==> P) ==> P"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   274
  by (unfold Range_def) (rules elim!: DomainE dest!: converseD)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   275
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   276
lemma Range_empty [simp]: "Range {} = {}"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   277
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   278
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   279
lemma Range_insert: "Range (insert (a, b) r) = insert b (Range r)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   280
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   281
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   282
lemma Range_Id [simp]: "Range Id = UNIV"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   283
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   284
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   285
lemma Range_diag [simp]: "Range (diag A) = A"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   286
  by auto
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   287
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   288
lemma Range_Un_eq: "Range(A Un B) = Range(A) Un Range(B)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   289
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   290
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   291
lemma Range_Int_subset: "Range(A Int B) \<subseteq> Range(A) Int Range(B)"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   292
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   293
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   294
lemma Range_Diff_subset: "Range(A) - Range(B) \<subseteq> Range(A - B)"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   295
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   296
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   297
lemma Range_Union: "Range (Union S) = (UN A:S. Range A)"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   298
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   299
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   300
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   301
subsection {* Image of a set under a relation *}
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   302
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   303
lemma Image_iff: "(b : r``A) = (EX x:A. (x, b) : r)"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   304
  by (simp add: Image_def)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   305
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   306
lemma Image_singleton: "r``{a} = {b. (a, b) : r}"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   307
  by (simp add: Image_def)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   308
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   309
lemma Image_singleton_iff [iff]: "(b : r``{a}) = ((a, b) : r)"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   310
  by (rule Image_iff [THEN trans]) simp
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   311
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   312
lemma ImageI [intro]: "(a, b) : r ==> a : A ==> b : r``A"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   313
  by (unfold Image_def) blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   314
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   315
lemma ImageE [elim!]:
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   316
    "b : r `` A ==> (!!x. (x, b) : r ==> x : A ==> P) ==> P"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   317
  by (unfold Image_def) (rules elim!: CollectE bexE)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   318
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   319
lemma rev_ImageI: "a : A ==> (a, b) : r ==> b : r `` A"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   320
  -- {* This version's more effective when we already have the required @{text a} *}
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   321
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   322
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   323
lemma Image_empty [simp]: "R``{} = {}"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   324
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   325
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   326
lemma Image_Id [simp]: "Id `` A = A"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   327
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   328
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   329
lemma Image_diag [simp]: "diag A `` B = A Int B"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   330
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   331
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   332
lemma Image_Int_subset: "R `` (A Int B) \<subseteq> R `` A Int R `` B"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   333
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   334
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   335
lemma Image_Un: "R `` (A Un B) = R `` A Un R `` B"
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_subset: "r \<subseteq> A \<times> B ==> r``C \<subseteq> B"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   339
  by (rules intro!: subsetI elim!: ImageE dest!: subsetD SigmaD2)
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   340
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   341
lemma Image_eq_UN: "r``B = (UN y: B. r``{y})"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   342
  -- {* NOT suitable for rewriting *}
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   343
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   344
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   345
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
   346
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   347
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   348
lemma Image_UN: "(r `` (UNION A B)) = (UN x:A.(r `` (B x)))"
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   349
  by blast
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   350
12913
5ac498bffb6b fixed document;
wenzelm
parents: 12905
diff changeset
   351
lemma Image_INT_subset: "(r `` (INTER A B)) \<subseteq> (INT x:A.(r `` (B x)))"
12905
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   352
  -- {* Converse inclusion fails *}
bbbae3f359e6 Converted to new theory format.
berghofe
parents: 12487
diff changeset
   353
  by blast
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