Closure and reduction of (g)sets.

```
# S3 method for set
closure(x, operation = c("union", "intersection"), ...)
binary_closure(x, operation = c("union", "intersection"))
# S3 method for set
reduction(x, operation = c("union", "intersection"), ...)
binary_reduction(x, operation = c("union", "intersection"))
```

x

For `binary_closure`

and `binary_reduction`

: a
binary matrix. A set of (g)sets otherwise.

operation

The set operation under which the closure or reduction shall be computed.

…

Currently not used.

An object of same type than `x`

.

The closure of a set \(S\) under some operation \(OP\) contains all elements of \(S\), and the results of \(OP\) applied to all element pairs of \(S\).

The reduction of a set \(S\) under some operation \(OP\) is the minimal subset of \(S\) having the same closure than \(S\) under \(OP\).

Note that the closure and reduction methods for sets
are currently only implemented for sets of *(g)sets* (families)
and will give an error for other cases.

`binary_closure`

and `binary_reduction`

interface efficient C code for computing
closures and reductions of binary patterns.
They are used by the
high-level methods if `x`

contains only objects of class `sets`

.

# NOT RUN { ## ordinary set s <- set(set(1),set(2),set(3)) (cl <- closure(s)) (re <- reduction(cl)) stopifnot(s == re) (cl <- closure(s, "intersection")) (re <- reduction(cl, "intersection")) stopifnot(s == re) ## multi set s <- set(gset(1,1),gset(2,2),gset(3,3)) (cl <- closure(s)) (re <- reduction(cl)) stopifnot(s == re) ## fuzzy set s <- set(gset(1,1/3),gset(2,2/3),gset(3,3/3)) (cl <- closure(s)) (re <- reduction(cl)) stopifnot(s == re) ## fuzzy multiset s <- set(gset(1,list(set(1,0.8))), gset(2, list(gset(1,3))), gset(3,0.3)) (cl <- closure(s)) (re <- reduction(cl)) stopifnot(s == re) # }