src/HOL/Relation.thy
author oheimb
Thu Feb 15 16:00:40 2001 +0100 (2001-02-15)
changeset 11136 e34e7f6d9b57
parent 10832 e33b47e4246d
child 12487 bbd564190c9b
permissions -rw-r--r--
moved inv_image to Relation
wenzelm@10358
     1
(*  Title:      HOL/Relation.thy
nipkow@1128
     2
    ID:         $Id$
paulson@1983
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@1983
     4
    Copyright   1996  University of Cambridge
nipkow@1128
     5
*)
nipkow@1128
     6
nipkow@10212
     7
Relation = Product_Type +
paulson@5978
     8
paulson@5978
     9
constdefs
wenzelm@10358
    10
  converse :: "('a * 'b) set => ('b * 'a) set"    ("(_^-1)" [1000] 999)
wenzelm@10358
    11
  "r^-1 == {(y, x). (x, y) : r}"
wenzelm@10358
    12
syntax (xsymbols)
wenzelm@10358
    13
  converse :: "('a * 'b) set => ('b * 'a) set"    ("(_\\<inverse>)" [1000] 999)
paulson@7912
    14
wenzelm@10358
    15
constdefs
oheimb@11136
    16
  comp  :: "[('b * 'c) set, ('a * 'b) set] => ('a * 'c) set"  (infixr "O" 60)
paulson@7912
    17
    "r O s == {(x,z). ? y. (x,y):s & (y,z):r}"
paulson@5978
    18
oheimb@11136
    19
  Image :: "[('a * 'b) set, 'a set] => 'b set"                (infixl "``" 90)
nipkow@10832
    20
    "r `` s == {y. ? x:s. (x,y):r}"
paulson@7912
    21
oheimb@11136
    22
  Id    :: "('a * 'a) set"                            (*the identity relation*)
paulson@7912
    23
    "Id == {p. ? x. p = (x,x)}"
paulson@7912
    24
oheimb@11136
    25
  diag  :: "'a set => ('a * 'a) set"          (*diagonal: identity over a set*)
paulson@5978
    26
    "diag(A) == UN x:A. {(x,x)}"
paulson@5978
    27
  
oheimb@11136
    28
  Domain :: "('a * 'b) set => 'a set"
paulson@5978
    29
    "Domain(r) == {x. ? y. (x,y):r}"
paulson@5978
    30
oheimb@11136
    31
  Range  :: "('a * 'b) set => 'b set"
paulson@5978
    32
    "Range(r) == Domain(r^-1)"
paulson@5978
    33
oheimb@11136
    34
  Field :: "('a * 'a) set => 'a set"
paulson@10786
    35
    "Field r == Domain r Un Range r"
paulson@10786
    36
oheimb@11136
    37
  refl   :: "['a set, ('a * 'a) set] => bool" (*reflexivity over a set*)
nipkow@8703
    38
    "refl A r == r <= A <*> A & (ALL x: A. (x,x) : r)"
paulson@6806
    39
oheimb@11136
    40
  sym    :: "('a * 'a) set => bool"             (*symmetry predicate*)
paulson@6806
    41
    "sym(r) == ALL x y. (x,y): r --> (y,x): r"
paulson@6806
    42
oheimb@11136
    43
  antisym:: "('a * 'a) set => bool"          (*antisymmetry predicate*)
paulson@6806
    44
    "antisym(r) == ALL x y. (x,y):r --> (y,x):r --> x=y"
paulson@6806
    45
oheimb@11136
    46
  trans  :: "('a * 'a) set => bool"          (*transitivity predicate*)
paulson@5978
    47
    "trans(r) == (!x y z. (x,y):r --> (y,z):r --> (x,z):r)"
paulson@5978
    48
oheimb@11136
    49
  single_valued :: "('a * 'b) set => bool"
nipkow@10797
    50
    "single_valued r == !x y. (x,y):r --> (!z. (x,z):r --> y=z)"
paulson@5978
    51
berghofe@7014
    52
  fun_rel_comp :: "['a => 'b, ('b * 'c) set] => ('a => 'c) set"
berghofe@7014
    53
    "fun_rel_comp f R == {g. !x. (f x, g x) : R}"
berghofe@7014
    54
oheimb@11136
    55
  inv_image :: "('b * 'b) set => ('a => 'b) => ('a * 'a) set"
oheimb@11136
    56
    "inv_image r f == {(x,y). (f(x), f(y)) : r}"
oheimb@11136
    57
paulson@6806
    58
syntax
oheimb@11136
    59
  reflexive :: "('a * 'a) set => bool"       (*reflexivity over a type*)
paulson@6806
    60
translations
paulson@6806
    61
  "reflexive" == "refl UNIV"
paulson@6806
    62
nipkow@1128
    63
end