| | 485 | The domain of `$rel<X,Y>` consists of all finite sets R of ordered pairs (x,y) such that x is in X and y is in Y. |
| | 486 | |
| | 487 | {{{ |
| | 488 | <X,Y> $set<X> $rel_domain( $rel<X,Y> r ); // Returns the set of x in X such that (x,y) in r for at least one y in Y. |
| | 489 | <X,Y> $set<Y> $rel_range( $rel<X,Y> r ); // Returns the set of y in Y such that (x,y) in r for at least one x in X. |
| | 490 | <X,Y> $set<Y> $rel_getRelated( $rel<X,Y> r, X x); // Returns a $set<Y> B such that y in B iff (x,y) in r. |
| | 491 | <X,Y> $set<X> $rel_getRelated( $rel<X,Y> r, Y y); // Returns a $set<X> A such that x in A iff (x,y) in r. |
| | 492 | <X,Y> $rel<X,Y> $rel_complement( $rel<X,Y> r ); // Returns the relation c such that (x,y) in c iff (x,y) not in r. |
| | 493 | <X,Y> $rel<Y,X> $rel_converse( $rel<X,Y> r ); // Returns the relation r' such that (y,x) in r' iff (x,y) in r. |
| | 494 | <X> $rel<X,X> $rel_identity( $set<X> s ); // Returns the relation r such that (x,x) in r for every x in s. |
| | 495 | <X,Y,Z> $rel<X,Z> $rel_join( $rel<X,Y> r1, $rel<Y,Z> r2 ); // Returns the relation r3 such that (x,z) in r3 iff (x,y) in r1 and (y,z) in r2 for some element y of Y. |
| | 496 | <X> $rel<X,X> $rel_reflexiveClosure( $rel<X,X> r ); // Returns the reflexive closure of r. |
| | 497 | <X> $rel<X,X> $rel_transitiveClosure( $rel<X,X> r ); // Returns the transitive closure of r. |
| | 498 | // Operations "Inherited" from $set |
| | 499 | <X,Y> $bool $rel_contains( $rel<X,Y> r, X x, Y y ); // does r contain (x,y) as member? |
| | 500 | <X,Y> $bool $rel_containsAll( $rel<X,Y> r1, $rel<X,Y> r2 ); // is r2 a subset of r1? |
| | 501 | <X,Y> $rel<X,Y> $rel_add( $rel<X,Y> r, X x, Y y ); // result of adding (x,y) to r |
| | 502 | <X,Y> $rel<X,Y> $rel_union( $rel<X,Y> r1, $rel<X,Y> 2 ); // union of r1 and r2 |
| | 503 | <X,Y> $rel<X,Y> $rel_intersection( $rel<X,Y> r1, $rel<X,Y> r2 ); // intersection of r1 and r2 |
| | 504 | <X,Y> $rel<X,Y> $rel_difference( $rel<X,Y> r1, $rel<X,Y> r2 ); // elements of r1 not in r2 |
| | 505 | }}} |