predicates {relations}R Documentation

Relation Predicates

Description

Predicate functions for testing for binary relations and endorelations, and special kinds thereof.

Usage

relation_is(x, predicate, ...)
relation_is_Euclidean(x, na.rm = FALSE)
relation_is_Ferrers(x, na.rm = FALSE)
relation_is_acyclic(x)
relation_is_antisymmetric(x, na.rm = FALSE)
relation_is_asymmetric(x, na.rm = FALSE)
relation_is_bijective(x)
relation_is_binary(x)
relation_is_complete(x, na.rm = FALSE)
relation_is_coreflexive(x, na.rm = FALSE)
relation_is_crisp(x, na.rm = FALSE)
relation_is_cyclic(x)
relation_is_endorelation(x)
relation_is_equivalence(x, na.rm = FALSE)
relation_is_functional(x)
relation_is_homogeneous(x)
relation_is_injective(x)
relation_is_interval_order(x, na.rm = FALSE)
relation_is_irreflexive(x, na.rm = FALSE)
relation_is_left_total(x)
relation_is_linear_order(x, na.rm = FALSE)
relation_is_match(x, na.rm = FALSE)
relation_is_negatively_transitive(x, na.rm = FALSE)
relation_is_partial_order(x, na.rm = FALSE)
relation_is_preference(x, na.rm = FALSE)
relation_is_preorder(x, na.rm = FALSE)
relation_is_quasiorder(x, na.rm = FALSE)
relation_is_quasitransitive(x, na.rm = FALSE)
relation_is_quaternary(x)
relation_is_reflexive(x, na.rm = FALSE)
relation_is_right_total(x)
relation_is_semiorder(x, na.rm = FALSE)
relation_is_semitransitive(x, na.rm = FALSE)
relation_is_strict_linear_order(x, na.rm = FALSE)
relation_is_strict_partial_order(x, na.rm = FALSE)
relation_is_strongly_complete(x, na.rm = FALSE)
relation_is_surjective(x)
relation_is_symmetric(x, na.rm = FALSE)
relation_is_ternary(x)
relation_is_tournament(x, na.rm = FALSE)
relation_is_transitive(x, na.rm = FALSE)
relation_is_trichotomous(x, na.rm = FALSE)
relation_is_weak_order(x, na.rm = FALSE)
relation_has_missings(x)

Arguments

x

an object inheriting from class relation.

na.rm

a logical indicating whether tuples with missing memberships are excluded in the predicate computations.

predicate

character vector matching one of the following (see details): "binary", "ternary", "quaternary", "left_total", "right_total", "surjective", "functional", "injective", "bijective", "endorelation", "homogeneous", "crisp", "complete", "match", "strongly_complete", "reflexive", "irreflexive", "coreflexive", "symmetric", "asymmetric", "antisymmetric", "transitive", "negatively_transitive", "quasitransitive", "Ferrers", "semitransitive", "trichotomous", "Euclidean", "equivalence", "weak_order", "preference", "preorder", "quasiorder", "partial_order", "linear_order", "strict_partial_order", "strict_linear_order", "tournament", "interval_order", "semiorder", "acyclic" "cyclic"

...

Additional arguments passed to the predicate functions (currently, only na.rm for most predicates).

Details

This help page documents the predicates currently available. Note that the preferred way is to use the meta-predicate function relation_is(x, "FOO") instead of the individual predicates relation_is_FOO(x) since the latter will become deprecated in future releases.

A binary relation is a relation with arity 2.

A relation RR on a set XX is called homogeneous iff D(R)=(X,,X)D(R) = (X, \dots, X).

An endorelation is a binary homogeneous relation.

For a crisp binary relation, let us write xRyx R y iff (x,y)(x, y) is contained in RR.

A crisp binary relation RR is called

left-total:

for all xx there is at least one yy such that xRyx R y.

right-total:

for all yy there is at least one xx such that xRyx R y.

functional:

for all xx there is at most one yy such that xRyx R y.

surjective:

the same as right-total.

injective:

for all yy there is at most one xx such that xRyx R y.

bijective:

left-total, right-total, functional and injective.

A crisp endorelation RR is called

reflexive:

xRxx R x for all xx.

irreflexive:

there is no xx such that xRxx R x.

coreflexive:

xRyx R y implies x=yx = y.

symmetric:

xRyx R y implies yRxy R x.

asymmetric:

xRyx R y implies that not yRxy R x.

antisymmetric:

xRyx R y and yRxy R x imply that x=yx = y.

transitive:

xRyx R y and yRzy R z imply that xRzx R z.

complete:

for all distinct xx and yy, xRyx R y or yRxy R x.

strongly complete:

for all xx and yy, xRyx R y or yRxy R x (i.e., complete and reflexive).

negatively transitive:

not xRyx R y and not yRzy R z imply that not xRzx R z.

Ferrers:

xRyx R y and zRwz R w imply xRwx R w or yRzy R z.

semitransitive:

xRyx R y and yRzy R z imply xRwx R w or wRzw R z.

quasitransitive:

xRyx R y and not yRxy R x and yRzy R z and not zRyz R y imply xRzx R z and not zRxz R x (i.e., the asymmetric part of RR is transitive).

trichotomous:

exactly one of xRyx R y, yRxy R x, or x=yx = y holds.

Euclidean:

xRyx R y and xRzx R z imply yRzy R z.

acyclic:

the transitive closure of R is antisymmetric.

cyclic:

R is not acyclic.

Some combinations of these basic properties have special names because of their widespread use:

preorder:

reflexive and transitive.

quasiorder:

the same as preorder.

equivalence:

a symmetric preorder (reflexive, symmetric, and transitive).

weak order:

a complete preorder (complete, reflexive, and transitive).

preference:

the same as weak order.

partial order:

an antisymmetric preorder (reflexive, antisymmetric, and transitive).

strict partial order:

irreflexive, antisymmetric, and transitive, or equivalently: asymmetric and transitive).

linear order:

a complete partial order.

strict linear order:

a complete strict partial order.

match:

strongly complete.

tournament:

complete and asymmetric.

interval order:

complete and Ferrers.

semiorder:

a semitransitive interval order.

If RR is a weak order (“(weak) preference relation”), I=I(R)I = I(R) defined by xIyx I y iff xRyx R y and yRxy R x is an equivalence, the indifference relation corresponding to RR.

There seem to be no commonly agreed definitions for order relations: e.g., Fishburn (1972) requires these to be irreflexive.

For a fuzzy binary relation RR, let R(x,y)R(x, y) denote the membership of (x,y)(x, y) in the relation. Write TT and SS for the fuzzy t-norm (intersection) and t-conorm (disjunction), respectively (min and max for the “standard” Zadeh family). Then generalizations of the above basic endorelation predicates are as follows.

reflexive:

R(x,x)=1R(x, x) = 1 for all xx.

irreflexive:

R(x,x)=0R(x, x) = 0 for all xx.

coreflexive:

R(x,y)>0R(x, y) > 0 implies x=yx = y.

symmetric:

R(x,y)=R(y,x)R(x, y) = R(y, x) for all xyx \ne y.

asymmetric:

T(R(x,y),R(y,x))=0T(R(x, y), R(y, x)) = 0 for all x,yx, y.

antisymmetric:

T(R(x,y),R(y,x))=0T(R(x, y), R(y, x)) = 0 for all xyx \ne y.

transitive:

T(R(x,y),R(y,z))R(x,z)T(R(x, y), R(y, z)) \le R(x, z) for all x,y,zx, y, z.

complete:

S(R(x,y),R(y,x))=1S(R(x, y), R(y, x)) = 1 for all xyx \ne y.

strongly complete:

S(R(x,y),R(y,x))=1S(R(x, y), R(y, x)) = 1 for all x,yx, y.

negatively transitive:

R(x,z)S(R(x,y),R(y,z))R(x, z) \le S(R(x, y), R(y, z)) for all x,y,zx, y, z.

Ferrers:

T(R(x,y),R(z,w))S(R(x,w),R(z,y))T(R(x, y), R(z, w)) \le S(R(x, w), R(z, y)) for all x,y,z,wx, y, z, w.

semitransitive:

T(R(x,w),R(w,y))S(R(x,z),R(z,y))T(R(x, w), R(w, y)) \le S(R(x, z), R(z, y)) for all x,y,z,wx, y, z, w.

The combined predicates are obtained by combining the basic predicates as for crisp endorelations (see above).

A relation has missings iff at least one cell in the incidence matrix is NA. In addition to relation_has_missings(), an is.na method for relations is available, returning a matrix of logicals corresponding to the incidences tested for missingness.

References

P. C. Fishburn (1972), Mathematics of decision theory. Methods and Models in the Social Sciences 3. Mouton: The Hague.

H. R. Varian (2002), Intermediate Microeconomics: A Modern Approach. 6th Edition. W. W. Norton & Company.

Examples

require("sets")
R <- relation(domain = c(1, 2, 3), graph = set(c(1, 2), c(2, 3)))
summary(R)

## Note the possible effects of NA-handling:
relation_incidence(R)
relation_is(R, "transitive") ## clearly FALSE

relation_incidence(R)[1, 2] <- NA
relation_incidence(R)
relation_is(R, "transitive") ## clearly NA

## The following gives TRUE, since NA gets replaced with 0:
relation_is(R, "transitive", na.rm = TRUE)

[Package relations version 0.6-13 Index]