# algebra: Algebra for Fuzzy Sets In beerda/lfl: Linguistic Fuzzy Logic

## Description

Compute triangular norms (t-norms), triangular conorms (t-conorms), residua, bi-residua, and negations.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43``` ```algebra(name, stdneg = FALSE, ...) is.algebra(a) goedel.tnorm(...) lukas.tnorm(...) goguen.tnorm(...) pgoedel.tnorm(...) plukas.tnorm(...) pgoguen.tnorm(...) goedel.tconorm(...) lukas.tconorm(...) goguen.tconorm(...) pgoedel.tconorm(...) plukas.tconorm(...) pgoguen.tconorm(...) goedel.residuum(x, y) lukas.residuum(x, y) goguen.residuum(x, y) goedel.biresiduum(x, y) lukas.biresiduum(x, y) goguen.biresiduum(x, y) invol.neg(x) strict.neg(x) ```

## Arguments

 `name` The name of the algebra to be created. Must be one of: "goedel", "lukasiewicz", "goguen" (or an unambiguous abbreviation). `stdneg` (Deprecated.) `TRUE` if to force the use of a "standard" negation (i.e. involutive negation). Otherwise, the appropriate negation is used in the algebra (e.g. strict negation in Goedel and Goguen algebra and involutive negation in Lukasiewicz algebra). `...` For t-norms and t-conorms, these arguments are numeric vectors of values to compute t-norms or t-conorms from. Values outside the [0,1] interval cause an error. NA values are also permitted. For the `algebra()` function, these arguments are passed to the factory functions that create the algebra. (Currently unused.) `a` An object to be checked if it is a valid algebra (i.e. a list returned by the `algebra` function). `x` Numeric vector of values to compute a residuum or bi-residuum from. Values outside the [0,1] interval cause an error. NA values are also permitted. `y` Numeric vector of values to compute a residuum or bi-residuum from. Values outside the [0,1] interval cause an error. NA values are also permitted.

## Details

`goedel.tnorm`, `lukas.tnorm`, and `goguen.tnorm` compute the Goedel, Lukasiewicz, and Goguen triangular norm (t-norm) from all values in the arguments. If the arguments are vectors they are combined together firstly so that a numeric vector of length 1 is returned.

`pgoedel.tnorm`, `plukas.tnorm`, and `pgoguen.tnorm` compute the same t-norms, but in an element-wise manner. I.e. the values with indices 1 of all arguments are used to compute the t-norm, then the second values (while recycling the vectors if they do not have the same size) so that the result is a vector of values.

`goedel.tconorm`, `lukas.tconorm`, `goguen.tconorm`, are similar to the previously mentioned functions, except that they compute triangular conorms (t-conorms). `pgoedel.tconorm`, `plukas.tconorm`, and `pgoguen.tconorm` are their element-wise alternatives.

`goedel.residuum`, `lukas.residuum`, and `goguen.residuum` compute residua (i.e. implications) and `goedel.biresiduum`, `lukas.biresiduum`, and `goguen.biresiduum` compute bi-residua. Residua and bi-residua are computed in an element-wise manner, for each corresponding pair of values in `x` and `y` arguments.

`invol.neg` and `strict.neg` compute the involutive and strict negation, respectively.

Let a, b be values from the interval [0, 1]. The realized functions can be defined as follows:

• Goedel t-norm: min{a, b};

• Goguen t-norm: ab;

• Lukasiewicz t-norm: max{0, a+b-1};

• Goedel t-conorm: max{a, b};

• Goguen t-conorm: a+b-ab;

• Lukasiewicz t-conorm: min{1, a+b};

• Goedel residuum (standard Goedel implication): 1 if a ≤ b and b otherwise;

• Goguen residuum (implication): 1 if a ≤ b and b/a otherwise;

• Lukasiewicz residuum (standard Lukasiewicz implication): 1 if a ≤ b and 1-a+b otherwise;

• Involutive negation: 1-x;

• Strict negation: 1 if x=0 and 0 otherwise.

Bi-residuum B is derived from residuum R as follows:

B(a, b) = inf(R(a, b), R(b, a)),

where inf is the operation of infimum, which for all three algebras corresponds to the min operation.

The arguments have to be numbers from the interval [0, 1]. Values outside that range cause an error. NaN values are treated as NAs.

If some argument is NA or NaN, the result is NA. For other handling of missing values, see algebraNA.

Selection of a t-norm may serve as a basis for definition of other operations. From the t-norm, the operation of a residual implication may be defined, which in turn allows the definition of a residual negation. If the residual negation is not involutive, the involutive negation is often added as a new operation and together with the t-norm can be used to define the t-conorm. Therefore, the `algebra` function returns a named list of operations derived from the selected Goedel, Goguen, or Lukasiewicz t-norm. Concretely:

• `algebra("goedel")`: returns the strict negation as the residual negation, the involutive negation, and also the Goedel t-norm, t-conorm, residuum, and bi-residuum;

• `algebra("goguen")`: returns the strict negation as the residual negation, the involutive negation, and also the Goguen t-norm, t-conorm, residuum, and bi-residuum;

• `algebra("lukasiewicz")`: returns involutive negation as both residual and involutive negation, and also the Lukasiewicz t-norm, t-conorm, residuum, and bi-residuum.

Moreover, `algebra` returns the supremum and infimum functions computed as maximum and minimum, respectively.

`is.algebra` tests whether the given `a` argument is a valid algebra, i.e. a list returned by the `algebra` function.

## Value

Functions for t-norms and t-conorms (such as `goedel.tnorm`) return a numeric vector of size 1 that is the result of the appropriate t-norm or t-conorm applied on all values of all arguments.

Element-wise versions of t-norms and t-conorms (such as `pgoedel.tnorm`) return a vector of results after applying the appropriate t-norm or t-conorm on argument in an element-wise (i.e. by indices) way. The resulting vector is of length of the longest argument (shorter arguments are recycled).

Residua and bi-residua functions return a numeric vector of length of the longest argument (shorter argument is recycled).

`strict.neg` and `invol.neg` compute negations and return a numeric vector of the same size as the argument `x`.

`algebra` returns a list of functions of the requested algebra: `"n"` (residual negation), `"ni"` (involutive negation), `"t"` (t-norm), `"pt"` (element-wise t-norm), `"c"` (t-conorm), `"pc"` (element-wise t-conorm), `"r"` (residuum), `"b"` (bi-residuum), `"s"` (supremum), `"ps"` (element-wise supremum), `"i"` (infimum), and `"pi"` (element-wise infimum).

For Lukasiewicz algebra, the elements `"n"` and `"ni"` are the same, i.e. the `invol.neg` function. For Goedel and Goguen algebra, `"n"` (the residual negation) equals `strict.neg` and `"ni"` (the involutive negation) equals `invol.neg`.

`"s"`, `"ps"`, `"i"`, `"pi"` are the same for each type of algebra: `goedel.conorm`, `pgoedel.conorm`, `goedel.tnorm`, and `pgoedel.tnorm`.

Michal Burda

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ``` # direct and element-wise version of functions goedel.tnorm(c(0.3, 0.2, 0.5), c(0.8, 0.1, 0.5)) # 0.1 pgoedel.tnorm(c(0.3, 0.2, 0.5), c(0.8, 0.1, 0.5)) # c(0.3, 0.1, 0.5) # algebras x <- runif(10) y <- runif(10) a <- algebra('goedel') a\$n(x) # residual negation a\$ni(x) # involutive negation a\$t(x, y) # t-norm a\$pt(x, y) # element-wise t-norm a\$c(x, y) # t-conorm a\$pc(x, y) # element-wise t-conorm a\$r(x, y) # residuum a\$b(x, y) # bi-residuum a\$s(x, y) # supremum a\$ps(x, y) # element-wise supremum a\$i(x, y) # infimum a\$pi(x, y) # element-wise infimum is.algebra(a) # TRUE ```

beerda/lfl documentation built on Oct. 17, 2020, 8:57 p.m.