src/HOL/Relation.thy
author wenzelm
Fri, 26 Oct 2001 23:58:21 +0200
changeset 11952 b10f1e8862f4
parent 11136 e34e7f6d9b57
child 12487 bbd564190c9b
permissions -rw-r--r--
* Pure: method 'atomize' presents local goal premises as object-level statements (atomic meta-level propositions); setup controlled via rewrite rules declarations of 'atomize' attribute; example application: 'induct' method with proper rule statements in improper proof *scripts*;

(*  Title:      HOL/Relation.thy
    ID:         $Id$
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
    Copyright   1996  University of Cambridge
*)

Relation = Product_Type +

constdefs
  converse :: "('a * 'b) set => ('b * 'a) set"    ("(_^-1)" [1000] 999)
  "r^-1 == {(y, x). (x, y) : r}"
syntax (xsymbols)
  converse :: "('a * 'b) set => ('b * 'a) set"    ("(_\\<inverse>)" [1000] 999)

constdefs
  comp  :: "[('b * 'c) set, ('a * 'b) set] => ('a * 'c) set"  (infixr "O" 60)
    "r O s == {(x,z). ? y. (x,y):s & (y,z):r}"

  Image :: "[('a * 'b) set, 'a set] => 'b set"                (infixl "``" 90)
    "r `` s == {y. ? x:s. (x,y):r}"

  Id    :: "('a * 'a) set"                            (*the identity relation*)
    "Id == {p. ? x. p = (x,x)}"

  diag  :: "'a set => ('a * 'a) set"          (*diagonal: identity over a set*)
    "diag(A) == UN x:A. {(x,x)}"
  
  Domain :: "('a * 'b) set => 'a set"
    "Domain(r) == {x. ? y. (x,y):r}"

  Range  :: "('a * 'b) set => 'b set"
    "Range(r) == Domain(r^-1)"

  Field :: "('a * 'a) set => 'a set"
    "Field r == Domain r Un Range r"

  refl   :: "['a set, ('a * 'a) set] => bool" (*reflexivity over a set*)
    "refl A r == r <= A <*> A & (ALL x: A. (x,x) : r)"

  sym    :: "('a * 'a) set => bool"             (*symmetry predicate*)
    "sym(r) == ALL x y. (x,y): r --> (y,x): r"

  antisym:: "('a * 'a) set => bool"          (*antisymmetry predicate*)
    "antisym(r) == ALL x y. (x,y):r --> (y,x):r --> x=y"

  trans  :: "('a * 'a) set => bool"          (*transitivity predicate*)
    "trans(r) == (!x y z. (x,y):r --> (y,z):r --> (x,z):r)"

  single_valued :: "('a * 'b) set => bool"
    "single_valued r == !x y. (x,y):r --> (!z. (x,z):r --> y=z)"

  fun_rel_comp :: "['a => 'b, ('b * 'c) set] => ('a => 'c) set"
    "fun_rel_comp f R == {g. !x. (f x, g x) : R}"

  inv_image :: "('b * 'b) set => ('a => 'b) => ('a * 'a) set"
    "inv_image r f == {(x,y). (f(x), f(y)) : r}"

syntax
  reflexive :: "('a * 'a) set => bool"       (*reflexivity over a type*)
translations
  "reflexive" == "refl UNIV"

end