src/HOL/Relation.thy
author berghofe
Fri Jul 16 12:09:48 1999 +0200 (1999-07-16)
changeset 7014 11ee650edcd2
parent 6806 43c081a0858d
child 7912 0e42be14f136
permissions -rw-r--r--
Added some definitions and theorems needed for the
construction of datatypes involving function types.
clasohm@1475
     1
(*  Title:      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@1128
     7
Relation = Prod +
paulson@5978
     8
nipkow@1128
     9
consts
berghofe@7014
    10
  O            :: "[('b * 'c)set, ('a * 'b)set] => ('a * 'c)set" (infixr 60)
berghofe@7014
    11
  converse     :: "('a*'b) set => ('b*'a) set"     ("(_^-1)" [1000] 999)
berghofe@7014
    12
  "^^"         :: "[('a*'b) set,'a set] => 'b set" (infixl 90)
paulson@5978
    13
  
nipkow@1128
    14
defs
berghofe@7014
    15
  comp_def         "r O s == {(x,z). ? y. (x,y):s & (y,z):r}"
berghofe@7014
    16
  converse_def     "r^-1 == {(y,x). (x,y):r}"
berghofe@7014
    17
  Image_def        "r ^^ s == {y. ? x:s. (x,y):r}"
paulson@5978
    18
  
paulson@5978
    19
constdefs
paulson@6806
    20
  Id     :: "('a * 'a)set"                 (*the identity relation*)
paulson@5978
    21
      "Id == {p. ? x. p = (x,x)}"
paulson@5978
    22
paulson@5978
    23
  diag   :: "'a set => ('a * 'a)set"
paulson@5978
    24
    "diag(A) == UN x:A. {(x,x)}"
paulson@5978
    25
  
paulson@6806
    26
  Domain :: "('a*'b) set => 'a set"
paulson@5978
    27
    "Domain(r) == {x. ? y. (x,y):r}"
paulson@5978
    28
paulson@6806
    29
  Range  :: "('a*'b) set => 'b set"
paulson@5978
    30
    "Range(r) == Domain(r^-1)"
paulson@5978
    31
paulson@6806
    32
  refl   :: "['a set, ('a*'a) set] => bool" (*reflexivity over a set*)
paulson@6806
    33
    "refl A r == r <= A Times A & (ALL x: A. (x,x) : r)"
paulson@6806
    34
paulson@6806
    35
  sym    :: "('a*'a) set=>bool"             (*symmetry predicate*)
paulson@6806
    36
    "sym(r) == ALL x y. (x,y): r --> (y,x): r"
paulson@6806
    37
paulson@6806
    38
  antisym:: "('a * 'a)set => bool"          (*antisymmetry predicate*)
paulson@6806
    39
    "antisym(r) == ALL x y. (x,y):r --> (y,x):r --> x=y"
paulson@6806
    40
paulson@6806
    41
  trans  :: "('a * 'a)set => bool"          (*transitivity predicate*)
paulson@5978
    42
    "trans(r) == (!x y z. (x,y):r --> (y,z):r --> (x,z):r)"
paulson@5978
    43
paulson@6806
    44
  Univalent :: "('a * 'b)set => bool"
paulson@5978
    45
    "Univalent r == !x y. (x,y):r --> (!z. (x,z):r --> y=z)"
paulson@5978
    46
berghofe@7014
    47
  fun_rel_comp :: "['a => 'b, ('b * 'c) set] => ('a => 'c) set"
berghofe@7014
    48
    "fun_rel_comp f R == {g. !x. (f x, g x) : R}"
berghofe@7014
    49
paulson@6806
    50
syntax
paulson@6806
    51
  reflexive :: "('a * 'a)set => bool"       (*reflexivity over a type*)
paulson@6806
    52
paulson@6806
    53
translations
paulson@6806
    54
  "reflexive" == "refl UNIV"
paulson@6806
    55
nipkow@1128
    56
end