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