Learn R Programming

lfl (version 1.3)

algebra: Algebra for Fuzzy Sets

Description

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

Usage

## a t-norm from concatenated arguments:
goedel.tnorm(..., na.rm=FALSE)
lukas.tnorm(..., na.rm=FALSE)
goguen.tnorm(..., na.rm=FALSE)

## a t-norm in a parallel (element-wise) manner: pgoedel.tnorm(..., na.rm=FALSE) plukas.tnorm(..., na.rm=FALSE) pgoguen.tnorm(..., na.rm=FALSE)

## a t-conorm from concatenated arguments: goedel.tconorm(..., na.rm=FALSE) lukas.tconorm(..., na.rm=FALSE) goguen.tconorm(..., na.rm=FALSE)

## a t-conorm in a parallel (element-wise) manner: pgoedel.tconorm(..., na.rm=FALSE) plukas.tconorm(..., na.rm=FALSE) pgoguen.tconorm(..., na.rm=FALSE)

## compute a residuum (implication) goedel.residuum(x, y) lukas.residuum(x, y) goguen.residuum(x, y)

## compute a bi-residuum (equivalence) goedel.biresiduum(x, y) lukas.biresiduum(x, y) goguen.biresiduum(x, y)

## compute a negation invol.neg(x) strict.neg(x)

## algebra-related functions algebra(name, stdneg=FALSE, ...) is.algebra(a)

Arguments

...
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, thes

na.rm
whether to ignore NA values: TRUE means that NA's are ignored, i.e. the computation is performed as if such values were not present in the arguments; FALSE means that the NA's in arguments are taken into considera
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.
name
The name of the algebra to be created. Must be one of: "goedel", "lukasiewicz", "goguen" (or an unambiguous abbreviation).
stdneg
If TRUE the use of a "standard" negation (i.e. involutive negation) is forced. Otherwise, the appropriate negation is used in the algebra (e.g. strict negation in Goedel and Goguen algebra and involutive negation in Lukasiewic
a
An object to be checked if it 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.

    Parallel 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. parallel, 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" (negation), "t" (t-norm), "pt" (parallel, i.e. element-wise, t-norm), "c" (t-conorm), "pc" (parallel t-conorm), "r" (residuum), and "b" (bi-residuum).

eqn

$[0, 1]$

deqn

$$B(a, b) = T(R(a, b), R(b, a)).$$

code

algebra

itemize

  • "goedel":

item

  • "goguen":
  • "lukasiewicz":

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 a parallel manner (element-wisely). 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, exept that they compute triangular conorms (t-conorms). pgoedel.tconorm, plukas.tconorm, and pgoguen.tconorm are their parallel (i.e. 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.

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

Let $a$, $b$ be values from the interval $[0, 1]$. Here are mathematical definitions of the realized functions:

  • 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 \le b$ and $b$ otherwise; Goguen residuum (implication): $1$ if $a \le b$ and $b/a$ otherwise; Lukasiewicz residuum (standard Lukasiewicz implication): $1$ if $a \le b$ and $1-a+b$ otherwise; Involutive negation: $1-x$; Strict negation: $1$ if $x=0$ and $0$ otherwise.

Examples

Run this code
# direct and parallel 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)

    # handling of missing values
    goedel.tnorm(c(0.3, 0, NA), na.rm=TRUE)    # 0
    goedel.tnorm(c(0.3, 0.7, NA), na.rm=TRUE)  # 0.3

    goedel.tnorm(c(0.3, 0, NA), na.rm=FALSE)   # 0
    goedel.tnorm(c(0.3, 0.7, NA), na.rm=FALSE) # NA

    goedel.tconorm(c(0.3, 1, NA), na.rm=TRUE)    # 1
    goedel.tconorm(c(0.3, 0.7, NA), na.rm=TRUE)  # 0.7

    goedel.tconorm(c(0.3, 1, NA), na.rm=FALSE)   # 1
    goedel.tconorm(c(0.3, 0.7, NA), na.rm=FALSE) # NA

    # algebras
    x <- runif(10)
    y <- runif(10)
    a <- algebra('goedel')
    a$n(x)     # negation
    a$t(x, y)  # t-norm
    a$pt(x, y) # parallel t-norm
    a$c(x, y)  # t-conorm
    a$pc(x, y) # parallel t-conorm
    a$r(x, y)  # residuum
    a$b(x, y)  # bi-residuum

    is.algebra(a) # TRUE

Run the code above in your browser using DataLab