FuzzyLisp

by Luis Agüelles
Researcher, PHEDES Lab
arguelles314 -at- gmail -dot- com


Glossary of FuzzyLisp Functions

This page alphabetically shows all the functions that build up FuzzyLisp. For every function the information is structured as follows:

•    Name of the function: Gives the name of the function.
•    Explanation: Explains how the function works and what the function returns.
•    Syntax: Offers the syntax of the function, that is, its name and all its required arguments.
•    FuzzyLisp representation: either FLSSR (FuzzyLisp Standard Set Representation) or FLDSR (FuzzyLisp Discrete Set Representation)
•    Example: Shows a practical example that helps to put the function in context.
•    Source code number: Gives the source code number in X-Y format, where X is the number of the chapter and Y is the number of the code inside the chapter for quickly locating the source code in the book "A Practical Introduction to Fuzzy Logic Using LISP".


fl-3dmesh
Explanation: This function creates an ASCII output file in comma-separated values format (CSV) where every line adopts the following structure: xi, yi, zi. Both xi, yi are input crisp values from the universes of discourse of their respective linguistic variables from a Fuzzy Rule Based System (FRBS). On the other hand, zi is the inferred value from every possible pair (xi, yi). The output file is in fact a discretized geometrical 3D mesh.
Syntax: (fl-3d-dmesh namefile set-of-rules nx ny)
•    namefile: file name for storing the output data on the computer’s hard disk.
•    set-of-rules: The complete set of expert rules of a FRBS expressed in list format.
•    nx: Resolution of the 3D mesh over the x-axis.
•    ny: Resolution of the 3D mesh over the y-axis.
FuzzyLisp representation: FLSSR
Example(s): (fl-3d-mesh “air-conditioner-controller.csv” rules-controller 20 20) →  Writing 3Dmesh ...  3Dmesh written to file
Source code number: 7-13.
Note: The FuzzyLisp function (fl-3d-dmesh) is suited to deal with FRBS where input linguistic variables are composed by fuzzy sets with discrete membership functions (FLDSR)


fl-alpha-cut
Explanation: (fl-alpha-cut) scans a trapezoidal or triangular membership function from left to right and returns the obtained alpha-cut alpha as a list, including the name of the original fuzzy set.
Syntax: (fl-alpha-cut fset alpha)
•    fset: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    alpha: a real number representing the horizontal line y = alpha for obtaining an alpha-cut. It is required that α ∈ [0,1].
FuzzyLisp representation: FLSSR
Example(s): (fl-alpha-cut '(B1 7 10 12 15) 0.7) → (B1 9.1 12.9)
Source code number: 6-4.


fl-belongs?
Explanation: (fl-belongs?) returns true if a crisp value x defined on the real axis belongs to the fuzzy set fset, else returns nil.
Syntax: (fl-belongs? fset x)
•    fset: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    x : a real number.
FuzzyLisp representation: FLSSR
Example(s): (fl-belongs ‘(medium 10.0 20.0 30.0 40.0) 23.0) → true; (fl-belongs ‘(medium 10.0 20.0 30.0 40.0) 3.0) → nil
Source code number: 6-1.


fl-belongs2?
Explanation: (fl-belongs2?) is a sort of mix of the functions (fl-belongs?) and (fl-set-membership?). If the crisp value x is contained in the support of fset it returns the membership degree of x to fset, otherwise, it returns nil.
Syntax: (fl-belongs2? fset x)
•    fset: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    x: a real number.
FuzzyLisp representation: FLSSR
Example(s): After assigning, e.g., (setq S ‘(medium 10 20 30 40)), then (fl-belongs2? S 22) → (medium 1), (fl-belongs2? S 100) → nil
Source code number: 6-3.


fl-db-new-field
Explanation: This function creates a new field in a CSV format database. The new field contains the fuzzified values from an already existing numerical field. The fuzzification is obtained by means of a given fuzzy set.
Syntax: (fl-db-new-field lst sharp-field fz-field fset mode)
•    lst: list containing an entire database.
•    sharp-field: a string representing the name of a numerical field in the database.
•    fz-field: a string for naming the new field to create.
•    fset: a list representing a fuzzy set, either in a FuzzyLisp standard set representation or in a discrete set representation.
•    mode: an integer. A value of 1 means that fset has a FLSSR. A value of 2 means a FLDSR.
FuzzyLisp representation: FLSSR/ FLDSR
Example(s): assuming the fuzzy set BM defined by (setq BM '(bright-magnitude -1 -1 3 5)) and that all the rest of function parameters have been correctly initialized, the function call (setq messier (fl-db-new-field messier "Magnitude" "fz-magnitude" BM 1)) creates a new field named “fz-magnitude” where all the numerical values from the field “Magnitude” have been fuzzified by the fuzzy set BM.
Source code number: 6-26.


fl-def-set
Explanation: (fl-def-set) defines and creates a fuzzy set by means of two alpha-cuts a-cut1, a-cut2. The returned fuzzy set has either a triangular or trapezoidal membership function.
Syntax: (fl-def-set name a-cut1 a-cut2)
•    name: symbol for associating a name to the resulting fuzzy set.
•    a-cut1: first alpha-cut expressed by a list in the following format (extreme-left extreme-right alpha-cut-value).
•    a-cut2: second alpha-cut with the same format as a-cut1. It is required that a-cut1 < a-cut2.
FuzzyLisp representation: FLSSR
Example(s): (fl-def-set 'young '(15.0 35.0 0) '(25.0 25.0 1.0)) → (young 15 25 25 35)
Source code number: 6-5a.


fl-defuzzify-rules
Explanation: This function takes as input the list obtained from either (fl-dtranslate-all-rules) or (fl-dtranslate-all-rules) and then converts that fuzzy information into a crisp numerical value.
Syntax: (fl-defuzzify-rules translated-rules)
•    translated-rules: list representing the output of either (fl-dtranslate-all-rules) or (fl-dtranslate-all-rules)
FuzzyLisp representation: FLSSR/ FLDSR
Example(s): (fl-defuzzify-rules (fl-translate-all-rules rules-controller 22 0.25)) →  -60
Source code number: 7-11.


fl-discretize
Explanation: (fl-discretize) takes a fuzzy set with triangular or trapezoidal characteristic function and discretizes it with a resolution given by steps. In other words, it transforms a FuzzyLisp Standard Set Representation into a FuzzyLisp Discrete Set Representation.
Syntax: (fl-discretize fset steps)
•    fset: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    steps: an integer representing the resolution of the discretization process.
FuzzyLisp representation: FLSSR → FLDSR
Example(s): (fl-discretize '(B1 7 10 12 15) 4) → (B1 (7 0) (7.75 0.25) (8.5 0.5) (9.25 0.75) (10 1) (10.5 1) (11 1) (11.5 1) (12 1) (12.75 0.75) (13.5 0.5) (14.25 0.25) (15 0))
Source code number: 6-6.


fl-discretize-fx
Explanation: This function discretizes any continuous function y = f(x) in n steps between x = a and x = b.
Syntax: (fl-discretize-fx name fx steps a b)
•    name: Symbol for associating a name to the function’s resulting fuzzy set.
•    fx: mathematical continuous function to discretize, expressed in Lisp format as a list.
•    steps: Integer value for expressing the required resolution in the discretization process.
•    a: starting point for discretization. Real value.
•    b: ending point for discretization. Real value.
FuzzyLisp representation: FLDSR
Example(s): After defining a bell-shaped continuous function to the symbol f by means of the expression (setq f ‘(div (add 1.0 (cos (mul 2.0 pi (sub x 2.0)))) 2.0)), then, e.g.: (setq dBell (fl-discretize-fx 'Bell f 10 1.5 2.5)) → (Bell (1.5 0) (1.6 0.09549150283) (1.7 0.3454915028) (1.8 0.6545084972) (1.9 0.9045084972) (2 1) (2.1 0.9045084972) (2.2 0.6545084972) (2.3 0.345491502) (2.4 0.09549150283) (2.5 0))
Source code number: 6-8.


fl-dlv-membership2?
Explanation: This function returns as a list all the membership degrees of a crisp value x to every fuzzy set contained in a linguistic variable. All the fuzzy sets from the linguistic variable have a discrete characteristic function.
Syntax: (fl-dlv-membership2? lv x)
•    lv: a list representing a linguistic variable composed by discrete fuzzy sets.
•    x: a real number.
FuzzyLisp representation: FLDSR
Example(s): assuming the linguistic variable lv-age-bells has been adequately initialized, then the function call (fl-dlv-membership2? lv-age-bells 23) produces the following output: ((Young 0.1302642245) (Young+ 0.5478879113) (Mature 0) (Mature+ 0) (Old 0))
Source code number: 6-25.


fl-dset-hedge
Explanation: This function applies a fuzzy hedge (linguistic modifier) to a fuzzy set.
Syntax: (fl-dset-hedge dset hedge)
•    dset: a list representing a discrete fuzzy set.
•    hedge: a Lisp symbol, either VERY or FAIRLY.
FuzzyLisp representation: FLDSR
Example(s): (fl-dset-hedge (fl-discretize '(A1 7 10 12 15) 4) 'VERY) → (A1 (7 0) (7.75 0.0625) (8.5 0.25) (9.25 0.5625) (10 1) (10.5 1) (11 1) (11.5 1) (12 1) (12.75 0.5625) (13.5 0.25) (14.25 0.0625) (15 0))
Source code number: 7-7.


fl-dset-membership?
Explanation: (fl-dset-membership?) returns the interpolated membership degree of a crisp value x defined on the real axis to the discrete fuzzy set fset. In practical terms the difference with the function (fl-set-membership?) is based on the type of used representation for fuzzy sets. (fl-dset-membership?) is used for FLDSR, while (fl-set-membership?) is used for FLSSR.
Syntax: (fl-dset-membership? dfset x)
•    dfset: a list representing a fuzzy set with a discrete membership function.
•    x: a real number.
FuzzyLisp representation: FLDSR
Example(s): After assigning, e.g., (setq dA (fl-discretize '(B1 7 10 12 15) 4)), then (fl-dset-membership? dA 8.2) → (B1 0.4)
Source code number: 6-7a.


fl-dtruth-value-fuzzy-implication-p-q?
Explanation: This function returns the truth-value of a compound fuzzy implication p → q.
Syntax: (fl-dtruth-value-fuzzy-implication-p-q? P Q x y )
•    P: a list representing a discrete fuzzy set associated to the predicate of a fuzzy proposition p.
•    Q: a list representing a discrete fuzzy set associated to the predicate of a fuzzy proposition q.
•    x: a real number for expressing the subject of a fuzzy proposition p.
•    y: a real number for expressing the subject of a fuzzy proposition q.
FuzzyLisp representation: FLDSR
Example(s): ): assuming the fuzzy set P defined by (setq P (fl-discretize '(old 50 90 90 90) 4)) and another fuzzy set Q defined by (setq Q (fl-discretize '(young 0 0 15 30) 4)), the fuzzy implication “if John is old then Eva is young” when John is 55 years old and Eva is 18 can be represented by the function call (fl-dtruth-value-implication-p-q? P Q 55 18) → 1.
Source code number: 7-6b.


fl-dtruth-value-negation-p?
Explanation: This function returns the truth-value of the negation of a fuzzy proposition.
Syntax: (fl-dtruth-value-negation-p?P x)
•    P: a list representing a discrete fuzzy set associated to the predicate of a fuzzy proposition p.
•    x: a real number for expressing the subject of a fuzzy proposition p.
FuzzyLisp representation: FLDSR
Example(s): assuming the fuzzy set P defined by (setq Q (fl-discretize '(young 0 0 15 30) 4)), the fuzzy proposition “Eva is not young” when Eva is 18 years old can be represented by the function call (fl-dtruth-value-negation-p? Q 18) → 0.2
Source code number: 7-5b.


fl-dtruth-value-p-and-q?
Explanation: This function returns the truth-value of a compound fuzzy proposition containing the logical connective “and”.
Syntax: (fl-dtruth-value-p-and-q?P Q x y )
•    P: a list representing a discrete fuzzy set associated to the predicate of a fuzzy proposition p.
•    Q: a list representing a discrete fuzzy set associated to the predicate of a fuzzy proposition q.
•    x: a real number for expressing the subject of a fuzzy proposition p.
•    y: a real number for expressing the subject of a fuzzy proposition q.
FuzzyLisp representation: FLDSR
Example(s): assuming the fuzzy set P defined by (setq P (fl-discretize '(old 50 90 90 90) 4)) and another fuzzy set Q defined by (setq Q (fl-discretize '(young 0 0 15 30) 4)), the fuzzy compound proposition “John is old and Eva is young” when John is 55 years old and Eva is 18 can be represented by the function call (fl-dtruth-value-p-and-q? P Q 55 18) → 0.125
Source code number: 7-3b.


fl-dtruth-value-p-or-q?
Explanation: This function returns the truth-value of a compound fuzzy proposition containing the logical connective “or”.
Syntax: (fl-dtruth-value-p-or-q?P Q x y )
•    P: a list representing a discrete fuzzy set associated to the predicate of a fuzzy proposition p.
•    Q: a list representing a discrete fuzzy set associated to the predicate of a fuzzy proposition q.
•    x: a real number for expressing the subject of a fuzzy proposition p.
•    y: a real number for expressing the subject of a fuzzy proposition q.
FuzzyLisp representation: FLDSR
Example(s): assuming the fuzzy set P defined by (setq P (fl-discretize '(old 50 90 90 90) 4)) and another fuzzy set Q defined by (setq Q (fl-discretize '(young 0 0 15 30) 4)), the fuzzy compound proposition “John is old or Eva is young” when John is 55 years old and Eva is 18 can be represented by the function call (fl-dtruth-value-p-or-q? P Q 55 18) → 0.8
Source code number: 7-4b.

fl-expand-contract-set
Explanation: This function expands or contracts a fuzzy set. The returned fuzzy set is still placed over its original position, but its support and nucleus are expanded or contracted accordingly.
Syntax: (fl-expand-contract-set fset k)
•    fset: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    k: a real number.
FuzzyLisp representation: FLSSR
Example(s): (fl-expand-contract-set '(a 0 1 1 2) 2.0) → (a -1 1 1 3), (fl-expand-contract-set '(a -1 1 1 3) 0.5) → (a 0 1 1 2)
Source code number: 6-18.


fl-fuzzy-add
Explanation: Returns a fuzzy number as the result of adding two fuzzy numbers A, B.
Syntax: (fl-fuzzy-add name A B)
•    name: a symbol for associating a name to the function’s resulting fuzzy number.
•    A: first fuzzy number to add.
•    B: second fuzzy number to add.
FuzzyLisp representation: FLSSR
Example(s): After defining two fuzzy numbers, e.g., (setq A ‘(around-2 1.75 2 2 2.25)) and (setq B ‘(around-5 4.8 5 5 5.2)), then (fl-fuzzy-add 'A+B A B) → (A+B 6.55 7 7 7.45)
Source code number: 6-13a.


fl-fuzzy-add-sets
Explanation: This function returns a fuzzy number as the result of adding all the fuzzy numbers contained in a set of fuzzy numbers.
Syntax: (fl-fuzzy-add-sets fsets name)
•    fsets: A list containing all the fuzzy numbers to add.
•    name: a symbol for associating a name to the function’s resulting fuzzy number.
FuzzyLisp representation: FLSSR
Example(s): After creating several fuzzy numbers, e.g., (setq F1 ‘(set1 -2 0 0 2)), (setq F2 ‘(set2 3 5 5 7)), (setq F3 ‘(set3 6 7 7 8)), (setq F4 ‘(set4 7 9 11 12)), (setq F5 ‘(set5 8 10 10 12)), then (setq Fsets '(F1 F2 F3 F4 F5)), and finally: (setq SFs (fl-fuzzy-add-sets Fsets 'Sum-of-Fs)) → (Sum-of-Fs 22 31 33 41)
Source code number: 6-19.


fl-fuzzy-average
Explanation: This function returns a fuzzy number as the average of n fuzzy numbers contained in a set of fuzzy numbers.
Syntax: (fl-fuzzy-average fsets name)
•    fsets: A list containing all the fuzzy numbers to average.
•    name: a symbol for associating a name to the function’s resulting fuzzy number.
FuzzyLisp representation: FLSSR
Example(s): (fl-fuzzy-average Fsets 'Average) → (Average 4.4 6.2 6.6 8.2). See the assignments for building Fsets in the entry for the function (fl-fuzzy-add-sets).
Source code number: 6-20.


fl-fuzzy-div
Explanation: This function returns a fuzzy number as the result of dividing two fuzzy numbers A, B. A and B are represented by triangular or trapezoidal shaped membership functions. The resulting fuzzy number A/B is represented by means of a discrete characteristic function.
Syntax: (fl-fuzzy-div name A B n)
•    name: a symbol for associating a name to the function’s resulting fuzzy number.
•    A: first fuzzy number involved in the A/B division process.
•    B: second fuzzy number involved in the A/B division process.
•    n: integer for expressing the resolution of the process.
FuzzyLisp representation: FLSSR → FLDSR
Example(s): After defining two fuzzy numbers, e.g., (setq A ‘(around-2 1.75 2 2 2.25)) and (setq B ‘(around-5 4.8 5 5 5.2)), then (fl-fuzzy-div 'B/A B A 5) → (B/A (2.133333333 0) (2.2 0.2) (2.269767442 0.4) (2.342857143 0.6) (2.419512195 0.8) (2.5 1) (2.584615385 0.8) (2.673684211 0.6) (2.767567568 0.4) (2.866666667 0.2) (2.971428571 0))
Source code number: 6-15.


fl-fuzzy-factor
Explanation: This function takes a fuzzy number A and then multiplies it by a crisp number k, returning the fuzzy number k.A. In practical terms when k >1 it performs a multiplication and when k <1 it performs a division by k.
Syntax: (fl-fuzzy-factor fset k)
•    fset: a list representing a fuzzy number with a continuous membership function, either a triangle or a trapezium (fuzzy interval).
•    K: a real number.
FuzzyLisp representation: FLSSR
Example(s): After defining a fuzzy number, e.g., (setq A ‘(A1 -2 3 3 8)), then (fl-fuzzy-factor A 3) → (A1 -6 9 9 24), and (fl-fuzzy-factor A 0.25) → (A1 -0.5 0.75 0.75 2)
Source code number: 6-16.


fl-fuzzy-mult
Explanation: Returns a fuzzy number as the result of multiplying two fuzzy numbers A, B. A and B are represented by triangular or trapezoidal shaped membership functions. The resulting fuzzy number A.B is represented by means of a discrete characteristic function.
Syntax: (fl-fuzzy-mult name A B n)
•    name: a symbol for associating a name to the function’s resulting fuzzy number.
•    A: first fuzzy number to multiply.
•    B: second fuzzy number to multiply.
•    n: integer for expressing the resolution of the process.
FuzzyLisp representation: FLSSR → FLDSR
Example(s): After defining two fuzzy numbers, e.g., (setq A ‘(around-2 1.75 2 2 2.25)) and (setq B ‘(around-5 4.8 5 5 5.2)), then (fl-fuzzy-mult 'AxB  A B 5) → (AxB (8.4 0) (8.712 0.2) (9.028 0.4) (9.348 0.6) (9.672 0.8) (10 1) (10.332 0.8) (10.668 0.6) (11.008 0.4) (11.352 0.2) (11.7 0))
Source code number: 6-14.


fl-fuzzy-shift
Explanation: This function shifts (moves horizontally) a fuzzy set towards left or right over the real axis X by an amount given by a real value x, returning the shifted fuzzy set.
Syntax: (fl-fuzzy-shift fset x)
•    fset: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    x: a real number.
FuzzyLisp representation: FLSSR
Example(s): (fl-fuzzy-shift '(young-plus 15.0 25.0 35.0 45.0) 5.0) → (young-plus 20 30 40 50)
Source code number: 6-17.


fl-fuzzy-sub
Explanation: Returns a fuzzy number as the result of subtracting two fuzzy numbers A, B.
Syntax: (fl-fuzzy-sub name A B)
•    name: a symbol for associating a name to the function’s resulting fuzzy number.
•    A: first fuzzy number involved in the A-B subtraction process.
•    B: second fuzzy number involved in the A-B subtraction process.
FuzzyLisp representation: FLSSR
Example(s): After defining two fuzzy numbers, e.g., (setq A ‘(around-2 1.75 2 2 2.25)) and (setq B ‘(around-5 4.8 5 5 5.2)), then (fl-fuzzy-sub 'A-B A B) → (A-B -3.45 -3 -3 -2.55)
Source code number: 6-13b.


fl-inference
Explanation: This function is an automatic call to the functions (fl-translate-all-rules) and (fl-defuzzify-rules) in a sort of black box that directly transforms two input crisp values entering a Fuzzy Rule Based System (FRBS) into a resulting crisp value.
Syntax: (fl-inference x y)
•    x: first crisp input numerical value to the FRBS.
•    y: second crisp input numerical value to the FRBS
FuzzyLisp representation: FLSSR
Example(s): (fl-inference rules-controller 22 0.25) → -60
Source code number: 7-12.
Note: The FuzzyLisp function (fl-dinference) is suited to deal with FRBS where input linguistic variables are composed by fuzzy sets with discrete membership functions (FLDSR)


fl-int-div
Explanation: Returns a list representing the division of two intervals.
Syntax: (fl-intv-div x1 x2 x3 x4)
•    x1, x2: real numbers expressing the left and right extremes of an interval [x1, x2].
•    x3, x4: real numbers expressing the left and right extremes of an interval [x3, x4].
FuzzyLisp representation: n/a
Example(s): (fl-intv-div 2 4 1 3) → (0.6666666667 4)
Source code number: 6-12d.


fl-intv-add
Explanation: Returns a list representing the addition of two intervals.
Syntax: (fl-intv-add x1 x2 x3 x4)
•    x1, x2: real numbers expressing the left and right extremes of an interval [x1, x2].
•    x3, x4: real numbers expressing the left and right extremes of an interval [x3, x4].
FuzzyLisp representation: n/a
Example(s): (fl-intv-add 2 4 1 3) → (3 7)
Source code number: 6-12a.


fl-intv-mult
Explanation: Returns a list representing the multiplication of two intervals.
Syntax: (fl-intv-mult x1 x2 x3 x4)
•    x1, x2: real numbers expressing the left and right extremes of an interval [x1, x2].
•    x3, x4: real numbers expressing the left and right extremes of an interval [x3, x4].
FuzzyLisp representation: n/a
Example(s): (fl-intv-mult 2 4 1 3) → (2 12)
Source code number: 6-12c.


fl-intv-sub
Explanation: Returns a list representing the subtraction of two intervals.
Syntax: (fl-int-sub x1 x2 x3 x4)
•    x1, x2: real numbers expressing the left and right extremes of an interval [x1, x2].
•    x3, x4: real numbers expressing the left and right extremes of an interval [x3, x4].
FuzzyLisp representation: n/a
Example(s): (fl-intv-sub 2 4 1 3) → (-1 3)
Source code number: 6-12b.


fl-list-sets
Explanation: This function prints all the fuzzy sets belonging to a linguistic variable at the Lisp console.
Syntax: (fl-list-sets lv)
•    lv: a list representing a linguistic variable.
FuzzyLisp representation: FLSSR
Example(s): assuming the linguistic variable lv-age has been adequately initialized, then the function call (fl-list-sets lv-age) produces the following output:
: (young 0 0 15 30)
: (young-plus 15 30 30 45)
: (mature 30 45 45 60)
: (mature-plus 45 60 60 75)
: (old 60 75 90 90)
Source code number: 6-22.


fl-lv-membership?
Explanation: This function prints all the membership degrees of a crisp value x to every fuzzy set contained in a linguistic variable at the Lisp console.
Syntax: (fl-lv-membership? lv x)
•    lv: a list representing a linguistic variable.
•    x: a real number.
FuzzyLisp representation: FLSSR
Example(s): (fl-lv-membership? lv-age 32) produces the following output:
: (young 0)
: (young-plus 0.8666666667)
: (mature 0.1333333333)
: (mature-plus 0)
: (old 0)
Source code number: 6-23.


fl-lv-membership2?
Explanation: This function returns as a list all the membership degrees of a crisp value x to every fuzzy set contained in a linguistic variable.
Syntax: (fl-lv-membership2? lv x)
•    lv: a list representing a linguistic variable.
•    x: a real number.
FuzzyLisp representation: FLSSR
Example(s): (fl-lv-membership2? lv-age 32) →  ((young 0) (young-plus 0.8666666667) (mature 0.1333333333) (mature-plus 0) (old 0))
Source code number: 6-24.


fl-set-complement-membership?
Explanation: This function returns the membership degree of a crisp value x to the complementary set of fset.
Syntax: (fl-set-complement-membership? fset x)
•    fset: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    x: a real number.
FuzzyLisp representation: FLSSR
Example(s): (fl-set-complement-membership? '(B1 7 10 12 15) 9) → (B1 0.3333333333)
Source code number: 6-9.


fl-set-intersect-membership?
Explanation: (fl-set-intersect-membership?) returns the membership degree of the crisp value x to the intersection of fuzzy sets fset1 and fset2.
Syntax: (fl-set-intersect-membership?name fset1 fset2 x)
•    name: a symbol for associating a name to the function’s resulting list.
•    fset1: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    fset2: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    x: a real number.
FuzzyLisp representation: FLSSR
Example(s): After defining two fuzzy sets A and B e.g.: (setq A ‘(Triangle 0 5 5 10)) and (setq B ‘(Trapezium 5 10 15 20)), then: (fl-set-intersect-membership? 'AintB A B 8) →  (AintB 0.4)
Source code number: 6-11.


fl-set-membership?
Explanation: (fl-set-membership?) returns the membership degree of a crisp value x defined on the real axis to the fuzzy set fset.
Syntax: (fl-set-membership? fset x)
•    fset: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    x: a real number.
FuzzyLisp representation: FLSSR
Example(s): (fl-set-membership? ‘(young 12 20 28 36) 24) → 1; (fl-set-membership? ‘(young 12 20 28 36) 54) → 0
Source code number: 6-2.


fl-set-union-membership?
Explanation: (fl-set-union-membership?) returns the membership degree of the crisp value x to the union of fuzzy sets fset1 and fset2.
Syntax: (fl-set-union-membership? name fset1 fset2 x)
•    name: a symbol for associating a name to the function’s resulting list.
•    fset1: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    fset2: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    x: a real number.
FuzzyLisp representation: FLSSR
Example(s): After defining two fuzzy sets A and B e.g.: (setq A ‘(Triangle 0 5 5 10)) and (setq B ‘(Trapezium 5 10 15 20)), then: (fl-set-union-membership? 'AuB A B 7.5) →  (AuB 0.5)
Source code number: 6-10.


fl-simple-defuzification
Explanation: This function takes a fuzzy number and produces a crisp number for it with a simple algorithm.
Syntax: (fl-simple-defuzzification fset mode)
•    fset: a list representing a fuzzy set with a continuous membership function, either a triangle or a trapezium.
•    mode: an integer value from 1 to 4. This parameter gives increasing weight to the nucleus in the process of defuzzification.
FuzzyLisp representation: FLSSR
Example(s): (fl-simple-defuzzification '(q 0 1 1 5) 1) → 2; (fl-simple-defuzzification '(q 0 1 1 5) 4) → 1.375
Source code number: 6-21.


fl-translate-all-rules
Explanation: This function evaluates all the fuzzy rules contained in the knowledge database of a Fuzzy Rule Based System (FRBS), calling iteratively to the function (fl-translate-rule).
Syntax: (fl-translate-all-rules set-of-rules x y)
•    set-of-rules: The complete set of expert rules of a FRBS expressed in list format.
•    x: first crisp input numerical value to the FRBS.
•    y: second crisp input numerical value to the FRBS
FuzzyLisp representation: FLSSR
Example(s): (fl-translate-all-rules rules-controller 22 0.25) → ((0 0 0 0) (0 0 0 0) (0 1 0 0) (0 0 0 0) (0 0 0 0) (0 1 0 0) (0.8 0 0 0) (0.8 0 0 0) (0.8 1 0.8 -40) (0.2 0 0 0) (0.2 0 0 0) (0.2 1 0.2 -20) (0 0 0 -0) (0 0 0 0) (0 1 0 0))
Source code number: 7-10.
Note: The FuzzyLisp function (fl-dtranslate-all-rules) is suited to deal with FRBS where input linguistic variables are composed by fuzzy sets with discrete membership functions (FLDSR)


fl-translate-rule
Explanation: This function takes an expert rule at a time from a Fuzzy Rule Based System (FRBS), performs the adequate inferences and translates the rule into membership degrees, that is, into numerical values.
Syntax: (fl-translate-rule header rule x y)
•    header: first sublist from the body of rules in the FRBS where the enumeration of the used linguistic variables is expressed.
•    rule: rule to translate from the FRBS in its adequate list format.
•    x: first crisp input numerical value to the FRBS.
•    y: second crisp input numerical value to the FRBS
FuzzyLisp representation: FLSSR
Example(s): (fl-translate-rule (first rules-controller) (nth 9 rules-controller) 22 0.25) →  (0.8 1 0.8 -40)
Source code number: 7-9.
Note: The FuzzyLisp function (fl-dtranslate-rule) is suited to deal with FRBS where input linguistic variables are composed by fuzzy sets with discrete membership functions (FLDSR)


fl-truth-value-fuzzy-implication-p-q?
Explanation: This function returns the truth-value of a compound fuzzy implication
p → q.
Syntax: (fl-truth-value-fuzzy-implication-p-q? P Q x y )
•    P: a list representing a fuzzy set associated to the predicate of a fuzzy proposition p.
•    Q: a list representing a fuzzy set associated to the predicate of a fuzzy proposition q.
•    x: a real number for expressing the subject of a fuzzy proposition p.
•    y: a real number for expressing the subject of a fuzzy proposition q.
FuzzyLisp representation: FLSSR
Example(s): assuming the fuzzy set P defined by (setq P ‘(old 50 90 90 90)) and another fuzzy set Q defined by (setq Q ‘(young 0 0 15 30)), the fuzzy compound proposition “John is old or Eva is young” when John is 55 years old and Eva is 18 can be represented by the function call (fl-truth-value-implication-p-q? P Q 55 18) → 1. When John is 90 years old and Eva is 30, then (fl-truth-value-implication-p-q? P Q 90 30) → 0
Source code number: 7-6.


fl-truth-value-negation-p?
Explanation: This function returns the truth-value of the negation of a fuzzy proposition.
Syntax: (fl-truth-value-negation-p?P x)
•    P: a list representing a fuzzy set associated to the predicate of a fuzzy proposition p.
•    x: a real number for expressing the subject of a fuzzy proposition p.
FuzzyLisp representation: FLSSR
Example(s): assuming the fuzzy set P defined by (setq P ‘(old 50 90 90 90)), the fuzzy proposition “John is not old” when John is 55 years can be represented by the function call (fl-truth-value-negation-p? P 55) → 0.875
Source code number: 7-5.


fl-truth-value-p-and-q?
Explanation: This function returns the truth-value of a compound fuzzy proposition containing the logical connective “and”.
Syntax: (fl-truth-value-p-and-q?P Q x y )
•    P: a list representing a fuzzy set associated to the predicate of a fuzzy proposition p.
•    Q: a list representing a fuzzy set associated to the predicate of a fuzzy proposition q.
•    x: a real number for expressing the subject of a fuzzy proposition p.
•    y: a real number for expressing the subject of a fuzzy proposition q.
FuzzyLisp representation: FLSSR
Example(s): assuming the fuzzy set P defined by (setq P ‘(old 50 90 90 90)) and another fuzzy set Q defined by (setq Q ‘(young 0 0 15 30)), the fuzzy compound proposition “John is old and Eva is young” when John is 55 years old and Eva is 18 can be represented by the function call (fl-truth-value-p-and-q? P Q 55 18) → 0.125
Source code number: 7-3.


fl-truth-value-p-or-q?
Explanation: This function returns the truth-value of a compound fuzzy proposition containing the logical connective “or”.
Syntax: (fl-truth-value-p-or-q?P Q x y )
•    P: a list representing a fuzzy set associated to the predicate of a fuzzy proposition p.
•    Q: a list representing a fuzzy set associated to the predicate of a fuzzy proposition q.
•    x: a real number for expressing the subject of a fuzzy proposition p.
•    y: a real number for expressing the subject of a fuzzy proposition q.
FuzzyLisp representation: FLSSR
Example(s): assuming the fuzzy set P defined by (setq P ‘(old 50 90 90 90)) and another fuzzy set Q defined by (setq Q ‘(young 0 0 15 30)), the fuzzy compound proposition “John is old or Eva is young” when John is 55 years old and Eva is 18 can be represented by the function call (fl-truth-value-p-or-q? P Q 55 18) → 0.8
Source code number: 7-4.
 


Return Home Page