FUZZY MACHINE LEARNING FRAMEWORK
 
                                                     
by Dmitry A. Kazakov
(mailbox@dmitry-kazakov.de)
[Home]
    Fuzzy Control Language
an intuitionistic extension
with fuzzy graph-schemes version 1.0

Fuzzy machine learning framework downloading page [Download]


[TOC][Next]

1. Introduction

The Fuzzy Control Language (FCL) is a draft IEC 1131 standard for programmable controllers. IFCL is a version of FCL extended with the following goals in mind:

A program sample:

function_block Test
   var_input
      Light : Real [lux];
   end_var

   var_output
      Switch : Nominal (On, Off);
   end_var

   fuzzify Light
      term Dark     := (  100 lux, 1)( 1000 lux, 0);
      term Twilight := (  500 lux, 0)( 1000 lux, 1)(15000 lux, 1)(20000 lux, 0);
      term Bright   := (10000 lux, 0)(20000 lux, 1);
   end_fuzzify

   ruleblock Rules
     if Light is Dark then Switch is On;
     if Light is Bright then Switch is Off;
   end_ruleblock

end_function_block

[Back][TOC][Next]

2. Lexical elements

In this document the characters of the source code referred in syntax rules are printed in courier red. Syntax rules are expressed in Bacus-Naur forms (BNF) The operations of the forms are printed in courier bold. Literal elements are printed in bold red. Identifiers are put in angular brackets. The BNF operations are denoted as follows:

 ::=  -- definition
[] -- optional element
| -- alternation
{} -- required element
(* -- this is a literal element

[Back][TOC][Next]

2.1. Character set

An IFCL program is written using the Unicode character set (see Unicode Transformation Format). The characters space (SP), tabulation (HT), line tabulation (VT), carriage return (CR), line feed (LF), and form feed (FF) are considered blank. Line end is determined by the operating system.

All lexical elements except for string and character literals are case-insensitive. The case is defined by the categories letter, upper case (Lu) and letter, lower case (Li) in the file UnicodeData.txt.

Any IFCL program can be written using only the code positions 0..127 corresponding to ASCII code.

[Back][TOC][Next]

2.2. Comments

There are two types of comments. Comments starting with (* continue until first appearance of *). Nested appearances of (* are not recognized. Comments starting with -- continue to the end of the source line they appear. Examples of comments:

-- This comment continues to the line end
(* Comments like this may
span across several lines *)

[Back][TOC][Next]

2.3. Literals

2.3.1. Integer literals

Integer literals have the syntax:

<integer>  ::=  <decimal-integer> | <based-integer>
<decimal-integer> ::= <decimal-numeral>[<exponent>]
<based-integer> ::= <base>#<based-numeral>#[<exponent>]
<decimal-numeral> ::= <decimal-digit>[[_]<decimal-numeral>]
<decimal-digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<exponent> ::= E [<sign>]<decimal-numeral>
<sign> ::= + | -
<based-numeral> ::= <based-digit>[[_]<based-numeral>]
<based-digit> ::= <decimal-digit> | A | B | C | D | E | F
<base> ::= <decimal-numeral>

Within an integer literal underline (_) can be used to separate digits for better readability. Underline is not allowed to follow another underline start or end a numeral. <base> shall denote a number 2..16. When exponent appears it must be non-negative. No blank characters or comments are allowed in an integer literal. Examples of legal integer literals:

123    Decimal number 12310
1A6#FF# Hexadecimal number 1A616=42210
2#100_000_000# Binary  number 1000000002=25610
1e6 Decimal number 100000010

Integer literals are overloaded. They have either the type Integer or the type Truth_Value. In the latter case the only valid values are 0, which represents logical false, and 1 which does logical true.

2.3.2. Real literals

Real literals have the syntax:

<real>  ::=  <decimal-real> | <based-real>
<decimal-real> ::= <decimal-numeral>.<decimal-numeral>[<exponent>]
<based-real> ::= <base>#<based-numeral>.<based-numeral>#[<exponent>]

No blank characters or comments are allowed in a real literal. Examples of legal real literals:

123.0    Decimal number 123.010
1E-1 Decimal number 0.110
2#111.111#E2 Binary  number 11111.12=31.510

Real literals are overloaded. They have either the type Real or the type Truth_Value. In the latter case the only valid values are ones from the interval [0,1]. The value 0.0 represent logical false. The value 1.0 represents logical true.

2.3.3. Dimensioned literals

Dimensioned literals have the syntax:

<dimensioned-real>  ::=  [<integer> | <real>] <dimension>
<dimension> ::= Dimension specification

When a value appear it must be separated from the dimension by at least one blank character or comment when the dimension begins with a <letter>. The dimension syntax is described in Measures_UTF8_Edit.Get_Unit. Examples of legal dimensioned literals:

5 m    5 meter
14.01°C 287.16 K (14.01 Celsius degree)
0.123 μPa 0.123E-6 Pa
foot 0.3048000 meter

Dimensioned literals have the type Real.

2.3.4. Truth values

Intutionistic truth literals have the syntax:

<intuitionistic-truth-value>  ::=  [<possibility>:<necessity>] | |  
<possibility> ::= <real> | <integer>
<necessity> ::= <real> | <integer>

Here <possibility> and <necessity> shall be numbers in the range [0,1]. Blank characters and comments may surround the brackets ([]) and colon (:). (the Unicode code point 22A416) represents fully contradictory truth value. (the Unicode code point 22A516) represents fully uncertain truth value. Examples of legal intuitionistic truth values:

[1:1]    True
[0:0] False
[0.9:0.5] Possibility is 0.9, necessity is 0.5 
[1:0] Uncertain
Same as above
[0:1] Contradictory
  Same as above

Intuitionistic truth value literals have the type Intuitionistic_Truth_Value.

2.3.5. String and character literals

String and character literals have the syntax:

<character>  ::=  ''' | '<non-quotation-mark>'
<string> ::= "<string-body>" | ""
<string-body> ::= {"" | <non-quotation-mark>} [<string-body>]
<non-quotation-mark> ::= Any Unicode code position except "

Within string literal quotation marks are doubled. Examples of legal character and string literals:

'''    Character '
"abcd" String abcd
"""" String "
"" Empty string

[Back][TOC][Next]

2.4. Identifiers

Identifiers start with a <letter> and can contain digits and underline character:

<identifier>  ::=  {<decimal-digit> | <letter>}[_]<identifier>
<letter> ::= The Unicode character in the categories uppercase or lowercase letters

In the above specification of <letter> the categories letter, upper case (Lu) and letter, lower case (Li) are determined by the file UnicodeData.txt. Identifiers are case insensitive.

Identifiers can refer predicate variables and domain values of nominal and linguistic set predicate variables.


[Back][TOC][Next]

3. Types

The language objects are subdivided into:

[Back][TOC][Next]

3.1. Types of constants

The language defines the following types of constants:

Types of constants Example Description
Numeric types   Numeric types with the operations +, -, *, / etc
       Integer 123 Integer values
Real 14.01°C Dimensioned real values
String types   Characters and strings
  Character 'x' Character values
String "abdcd" String values
Lattice types   Types with the operations and, or, xor, not 
  Fuzzy lattice types   Lattices with the law of excluded middle on any measurable subset
       Logical   Logical values
       Truth_Value 0.5 Fuzzy truth values from [0,1]
Sets   Fuzzy subsets
  Singletons   Fuzzy singleton sets
     Integer_Singleton (5,1) Integer singleton
Real_Singleton (5.2 m, 0.5) Dimensioned real singleton
Ranges   Range subsets
  Integer_Range 1..20 Integer range
Real_Range 1 m..20 m Dimensioned real range
Subsets   Free subsets
  Integer_Set 1..3 ⋃ 7 Integer subset
Real_Set (5,0)(7,1)[kPa] Dimensioned real subset
Domain_Subset low..high Fuzzy subset of the domain set of a variable
Intuitionistic lattice types   Lattices with no law of excluded middle
  Logical   Intuitionistic logical values
  Intuitionistic_Truth_Value [1:0.5] Intuitionistic truth values from [0,1]×[0,1]
Sets   Intuitionistic subsets
  Intuitionistic_Domain_Subset low^[1:0.5] ⋃ high Intuitionistic subset of the domain set of a variable

[Back][TOC][Next]

3.2. Types of predicate variables

Predicate variables are subdivided into input predicate variables, those for which values are known from the rules base, and the output predicate variables estimated from the values of the input ones and the rules. Further predicate variables are separated according to the type of the domain set:

Types of predicate variables Description
Nominal predicate variables The predicate variables with a non-numeric discrete domain
      Enumeration predicate variables The domain set consists of nominal values specified by identifiers
Numeric predicate variables The predicate variables with a numeric domain
  Discrete numeric predicate variables The predicate variables with a discrete numeric domain
     Integer predicate variables The domain set consists of a finite range of integer numbers
Continuous numeric predicate variables The predicate variables with a continuous numeric domain
  Float predicate variables The domain set consists of a finite set of intervals overlapping in the end points
Linguistic set predicate variables The domain set consists of a finite set of linguistic variables

3.2.1. Declaration of predicate variables

Predicate variables are declared in one or more declaration blocks:

<input-variables-block>  ::=  var_input <variable-declarations-list> end_var
<output-variables-block>  ::=  var_output <variable-declarations-list> end_var
<variable-declarations-list> ::= <variable-declaration>[<variable-declarations-list>]
<variable-declaration> ::= <identifier>:<variable-type-definition>;
<variable-type-definition> ::= { <nominal-variable>
| <integer-variable>
| <float-variable>
| <linguistic-set-variable>
}  

Each variable has a unique name specified by the <identifier>, which is followed by colon (:), declaration of the type and finished by semicolon (;). 

3.2.2. Nominal predicate variables

A nominal variable has the domain specified as a set of identifiers:

<nominal-variable>  ::=  nominal (<nominal-domain>)
<nominal-domain>  ::=  <identifier>[,<nominal-domain>]

Example of a nominal variable declaration:

Color : nominal (Red, Green, Blue);

3.2.3. Integer variables

An integer variable has the domain consisting of a range of integer numbers:

<integer-variable>  ::=  integer <integer-range>

Here <integer-range> is an expression resolving to a range of integer numbers. The following is an example of a valid integer variable declaration:

Dozen : integer 1..1+11;    Range 1 to 12

3.2.4. Float variables

A float variable's domain consists of dimensioned intervals. Intervals intersect in their end points. 

<float-variable>  ::=  float [[<dimension>]] <cardinality> range <float-range>

Here <dimension> specifies the measurement units of the domain values. <cardinality> is an expression resolving to positive integer number that specifies the number of intervals the domain set consists of. <float-range> is the domain set. It shall resolve to a range of real numbers. When the result is dimensionless the range bounds are assumed to be specified in the units of the variable dimension. Otherwise the dimension specified shall be compatible with one of the variable. The following are examples of a valid declarations:

Temperature : float [°C] 10 range -10..120;

The variable Temperature is measured in °C, it has the domain set -10°C..120°C split into 10 intervals.

Velocity : float [m/s] 5 range 0..20 [mph];

The variable Velocity is measured in m/s, it has the domain set 0..8.938888 m/s in 5 intervals.

3.2.5. Linguistic set variables

A linguistic set variable has a dimensioned domain represented by a set of linguistic terms. Each linguistic term, also called linguistic variable, is a fuzzy subset of the domain.

<linguistic-set-variable>  ::=  real [[<dimension>]]

<dimension> specifies the measurement units of the domain values. Examples of valid linguistic set variables declarations:

Angle : real;
Power : real [W];

The terms of an input linguistic set variable are declared in a fuzzify block:

<fuzzify-block>  ::=  fuzzify <identifier>
   <linguistic-set>
end_fuzzify
<linguistic-set> ::= <linguistic-term>; [<linguistic-set>]
<linguistic-term> ::= term <identifier> := <domain-set>

Here <identifier> following the keyword fuzzify is the name of the input linguistic set variable being which linguistic terms are being defined. Only one block is allowed per variable. <identifier> following the keyword term specifies the name of the term. This name can appear where a variable subset is expected. <domain-set> shall resolve either to a real subset or to a real value. The given dimension shall be compatible with one of the variable. The following example illustrates definition of the linguistic terms for the variable T declared as:

T : real [°C];

Linguistic terms:

fuzzify T
   term Chill := (-10,1)(-4,0); -- °C is assumed
   term Cold  := ( 11,1)(17,0) [°C];
   term Tepid := ( 3, 0)( 8,1)(21,1)(28,0) [°C];
   term Warm  := ( 15,0)(21,1)(29,1)(35,0) [°C];
end_fuzzify

The terms of an output: linguistic set variable are declared in a defuzzify block:

<defuzzify-block>  ::=  defuzzify <identifier>
        <output-linguistic-set>
end_defuzzify
<output-linguistic-set> ::= { <linguistic-term>
| method : <defuzzify-method>
| default := <domain-value>
| accu : <method>
} [<output-linguistic-set>]
<defuzzify-method> ::= { coa | cog | cogs | lm | rm }

Here <identifier> following the keyword defuzzify is the name of the output linguistic set variable. Only one block is allowed per variable. <identifier> following the keyword term specifies the name of the term. This name can appear where a variable subset is expected. <domain-set> shall resolve either to a real subset or to a real value. When it is dimensionless, it is assumed to be specified in the dimension units of the variable. Otherwise the dimension give shall be compatible with one of the variable. <defuzzify-method> specifies the defuzzification method to be applied. It may appear only once:

The default value is introduced by the keyword default. It is used when the defuzzification fails. The value can be specified either as an expression resolved to a real value. The value when dimensionless assumes the dimension of the variable. The keyword nc (no change) indicates that defuzzification fault should not change the value. The optional accumulation method specification is defined by <method>. The only legal value is max, because all others are incompatible with the possibility theory. The following example illustrates definition of the linguistic terms for the variable Power declared above:

defuzzify Power  
   term Low  := (-100.0, 1)(10.0, 0); W is assumed
   term Zero := 0 W;     Singleton value
   term Safe_Range := 1..2 [hp]; Converted to W as necessary
   term High := (800, 0)(2000, 0)[W];
   method : COG; Using Center of Gravity
   default := 0 W; What to do when defuzzification fails
end_defuzzify

[Back][TOC][Next]

3.3. Types of predicates

<predicate> is an expression involving a predicate variable and a constant using a set-theoretic or comparison operations. The following is an example of a predicate:

Power is in Safe_Range

Predicates form a lattice. They can be further combined using the operations and, , not, ¬, or, , xor and also appear in order brackets (). Other methods are infeasible in the possibility theory:

<predicate-expression> ::=
         {   <predicate>
  | <predicate-expression>{ and | or | xor | | }<predicate-expression>
  | { not | ¬ }<predicate-expression>
  | (<predicate-expression>)
  }  

The following example represents a <predicate-expression>:

Power is in Safe_Range and Power < 200 W

[Back][TOC][Next]

4. Operations

The language defines prefix, dyadic, postfix and bracket operations. The operations are executed from left to the right and associated according to their precedence. Operations with higher precedence take their operands first.

[Back][TOC][Next]

4.1. Prefix operations

Prefix operations appear before the operand. They are:

Operation Precedence Code
point
Description
+x 6   Unary plus
-x 6   Unary minus
abs x 6   Absolute value
not x 6   Logical not and set-complement
¬x 6 00AC16 Logical not
not in x 6   Set-complement, allowed only after the dyadic operation is

Unary + and - cannot appear after the following operations without brackets: +, -, abs, *, /, **.  For example the following expressions are illegal:

2++2    Illegal, must be     2+(+2)
5.0**-2 Illegal, must be 5.0**(-2)
- -3.0 Illegal, must be -(-3.0)

Unary abs cannot appear before **.  For example the following expression is illegal:

abs(-2)**2    Should be disambiguated as     (abs (-2))**2
  or as abs ((-2)**2)

Unary not in may appear only after is in the expressions like:

Pressure is not in 1..200 [Pa]

Which is an equivalent to:

not (Pressure in 1..200 [Pa])

[Back][TOC][Next]

4.2. Dyadic operations

Dyadic operations have two operands and appear between them. The following table lists the dyadic operations and their precedence:

Operation Precedence Code
point
Description
x and y 0   Logical and or set intersection
x y 0 22C016 Logical and
x or y 0   Logical or or set union, the operands must be elements or sets
x y 0 22C116 Logical or
x xor y 0   Logical xor or set difference, equivalent to (x and not(y)) or (not(x) and y)
x in y 1   Subset test operands can be elements, sets, one of them can be a variable
x is y 1   Equivalent to x in y
x is in y 1   Equivalent to x in y
x not in y 1   Equivalent to both not(x in y)
x y 1 228616 Subset test, equivalent to x in y, with x is required to be a set or a variable
x y 1 228716 Equivalent to yx
x y 1 228816 Equivalent to not(xy)
x y 1 228916 Equivalent to not(yx)
x y 1 220816 Member test, equivalent to x in y, with x is required to be an element or a variable
x y 1 220B16 Equivalent to yx
x y 1 220916 Equivalent to not(xy)
x y 1 220C16 Equivalent to not(yx)
x = y 1   Equality
x /= y 1   Equivalent to not(x=y)
x y 1 226016 Equivalent to not(x=y)
x < y 1   Less
x <= y 1   Less or equal
x y 1 226416 Less or equal
x > y 1   Greater
x >= y 1   Greater or equal
x y 1 226516 Greater or equal
x y 2 22C216 Set intersection, the operands can be sets or elements
x y 2 22C316 Set union, the operands can be sets or elements
x .. y 3   Range
x ^ y 3   Membership association (α-cut)
x + y 4   Addition
x - y 4   Subtraction
x & y 4   Concatenation
x * y 7   Multiplication
x / y 7   Division
x ** y 8   Exponentiation
x . y 11   Component

The lattice operations like and and or cannot be associated without brackets. For example, the following expression is illegal and must be disambiguated:

Power is Low and Power is High or Power is Zero

The following table illustrates legal and illegal associations of the lattice operations:

  and or xor
and   +      +      -     -    - + +
⋀  + + - - -   +      +   
or  - -   +      +   - + +
⋁  - - + + - + +
xor  - - - - + + +
⋂  + + + + + + +
⋃  + + + + + +  +  

The rule is that two operations of different semantics may not be associated when their results and operands are of the same type. The rationale is that the results of different associations shall be either same or else the expression can be disambiguated using the types of operands.

The operation ** cannot be associated without brackets. For example the following expression is illegal:

2**2**3    Should be disambiguated as     (2**2)**3
  or as 2**(2**3)

[Back][TOC][Next]

4.3. Postfix operations

Postfix operations appear after the operand:

Operation Precedence Description
x<power> 8 Power operation

Power is a superscript integer with the syntax:

<power>  ::=  <superscript-decimal-integer>
<superscript-decimal-integer> ::= [<superscript-sign>]<superscript-decimal-numeral>
<superscript-decimal-numeral> ::= <superscript-decimal-digit>[<superscript-decimal-numeral>]
<superscript-decimal-digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<superscript-sign> ::= + | -

The power operation cannot be associated without brackets. For example the following expression is illegal:

22 3    Should be disambiguated as     (22)3
  or as 2**23

[Back][TOC][Next]

4.4. Brackets

Operation Precedence Example Description
(x) - (5+1)*2 Ordering brackets 
(x,y) - (5,1) Singleton composition
x(y,z) 8 (1,0)(1,1)(10,1)(10,0) Membership function composition
x [y] 3 (2.0,0)(4.0,1)(5.0,0)[°C] Scaling
[x,y] - [1,20] Interval, range composition

[Back][TOC][Next]

4.5. Numeric operations

Numeric operations are applied to the operands of constant numeric types.

4.5.1. Arithmetical numeric operations

The numeric arithmetical operations are prefix +, -, abs, dyadic +, -,*, /, **, postfix <power>.

An unary arithmetical operation (+, -, abs, <power>) yields the result of the same type as the operand. A dimensioned operand can be exponentiated only if it is not shifted (20°C is shifted.) Examples of unary operations:

5 m2  – 5 square meters
abs (-4)  – 4
23  – 8

A dyadic arithmetical operation yields an integer (Integer) result if both operands are integers. Otherwise the result is of real (Real) type. Dimensioned operands must have compatible types. Shifted dimensioned constants can be multiplied and divided only by dimensionless constants. The second operand of ** shall be dimensionless. Further if the first operand has a dimension, it cannot be shifted and the second operand must be a non-negative integer (Integer).

4.5.2. Relational numeric operations

Relational operations =, /=, , >, <, <=, , >=, are defined for all numeric types and yield a value of Truth_Value. When one operand is of real (Real) type, another is automatically converted to the same type. The dimensions of the operands after necessary conversions must be compatible. Examples of numeric relational operations:

5 m2 = 5 yd2  –  0 of Truth_Value: 5 square meters is not equal to 5 square yards
10 > 1  –  1 of Truth_Value

4.5.3. Numeric membership tests

The membership tests operations are in, is, is in, , , not in with the left operand of a numeric type and the operations , with the right operand of a  numeric type. The operations in, is, is in, are equivalent. The operations not in, are equivalent and xy is identical to yx. The operation xy is identical to yx. The operation xy is identical to yx. The non-numeric operand is a set type. Operands are converted as follows:

After types conversion the numeric operand should have the same type and compatible dimension as the domain set of the set operand. The result of a membership operation is of Intuitionistic_Truth_Value. The examples of membership tests:

5 in [1,6]  –  [1:1]
1..5∋2  –  same as above
6.0 not in (6.0,1)  –  [0:0]
6.0 m in (6,0)(6,1)(6,0)[m]  –  [1:0]

4.5.4. Singleton composition

Round brackets () with two items compose a singleton. The first item is of numeric type, it identifies the domain set value. The second item is of Truth_Value. The singleton type is determined by the numeric type. Integer produces Integer_Singleton. Real does Real_Singleton. Examples of singletons:

(5,1)  –  Integer_Singleton, the value 5 with the truth value 1
(0.5 m, 0.5)  –  Real_Singleton, the value 0.5 meter with the truth value 0.5

4.5.5. Numeric interval composition

Square brackets [] with two items and the operation ellipsis .. compose a range (or equivalently an interval). The first item / operand is the lower bound of the range. The second item / operand is the upper bound. When one item / operand is of  real (Real) type, another is converted to the same type as necessary. After necessary conversions, the lower bound must be less or equal than the upper bound. The dimensions of bounds must be compatible. The result type is determined by the types of the bounds after applying necessary conversions. Integer bounds produce a result of Integer_Range. Real bounds do a result of Real_Range. Examples of ranges:

[1, 20]  –  Integer_Range range from 1 to 20
1..20  –  Same as above
[1 m, 20 m]  –  Real_Range 1..20 meter
1 m..20 m  –  Same as above

4.5.6. Scaled numeric values

A numeric value in square brackets [] specified after a numeric multiplies the operand before the brackets. Shifted dimensioned operand can be multiplied and divided only by a dimensionless one. The result has Real. Examples of scaling numeric constants:

1 [2]  –  2 (of Real)
2.0 [°C]  –  2 Celsius degree
1 m [1/s]  –  1 m/s

[Back][TOC][Next]

4.6. Logical operations

Logical operations are and, , not, ¬, or, , xor applied to the operands of logical types Truth_Value and Intuitionistic_Truth_Value. The result of logical not, ¬ has the same type as the operand. For the dyadic operations and, , or, , xor if one operand has the type Intuitionistic_Truth_Value, then another is converted to the same type. The result a dyadic logical operation is same as the type of the operands after necessary conversions applied. Examples of logical operations:

1 and 0.6  –  0.6 of Truth_Value
1 and [1:0.6]  –  Intuitionistic_Truth_Value with the possibility 1 and the necessity 0.6
[0.3:0.6] or [0.7:0.0]  –  Intuitionistic_Truth_Value with the possibility 0.7 and the necessity 0.6
not [1:0.6]  –  Intuitionistic_Truth_Value with the possibility 0.4 and the necessity 0

[Back][TOC][Next]

4.7. Set operations

Set operations are applied to the operands representing sets:

4.7.1. Lattice set-operations

Lattice operations and, , not, ¬, or, , xor when applied to sets produce a set.

The result of not has the type determined by the operand's type:

For the dyadic operations and, , or, , xor the following types conversions are automatically applied:

Dimensions of the operands of  and, , or, , xor shall be compatible. The result of an operation is the type of the operands after necessary conversions. Examples of lattice operations:

1..5 and 2..4  –  Integer set containing 2, 3, 4 (the type is Integer_Set)
not (2, 1)  –  Integer set containing all integer values except 2 (the type is Integer_Set)
1..5 and (1.0, 0.5)  –  Real set containing 1 with the truth level 0.5 (the type is Real_Set)
high or low  –  Fuzzy domain subset containing the linguistic variables high and low (the type Domain_Subset)
high or low^[1.0:0]  –  Intuitionistic domain subset containing the linguistic variables high and low with the possibility 1 and the linguistic variable high with the necessity 1 (the type Intuitionistic_Domain_Subset)

4.7.2. Relational operations on sets

Relational operations =, /=, are defined for all set types and yield a value of Intuitionistic_Truth_Value. Sets equality x = y is defined as x in y and y in x. Inequality x /= y is defined as not(x=y). Thus both are commutative. The operands are automatically converted as described for the operations and, or, xor. Dimensions of the operands must be compatible. Examples of relational operations:

1..5 = [0.5, 1]  –  [1:0] (uncertain)
1..5 /= 10..11  –  [1:1] (true)

4.7.3. Membership operations

The membership tests operations are in, is, is in, , , not in with the left operand of a numeric type and the operations , with the right operand of a  numeric type. For detailed description see numeric membership tests.

4.7.4. Subset test operations

Subset relation operations are in, is, is in, , , , , not in.  The operations in, is, is in, are equivalent. The operations , not in are equivalent and xy is identical to not(xy). The operation xy is identical to yx. The operation xy is identical to yx. Example of subset operations:

2..3 ⊆ 1..5  –  [1:1] (true)

4.7.5. Membership function composition

The ternary operation x(y,z) composes a fuzzy set by specifying its membership function per point. The operands in brackets shall compose a singleton. The singleton specifies the rightmost point of the membership function. The first operand shall denote a set of either of the following types:

The following type conversions are applied to the operands:

The result of the operation has the type of the left operand after necessary conversions. The dimensions of the left operand and the singleton shall be compatible. Further, the singleton operand shall specify the membership function for a point greater or equal to the rightmost point in the left operand. The membership function of the result is extrapolated to the right using the truth value specified. When the left operand is a singleton, then the truth value it specifies is extrapolated to the left. It is allowed to specify several values of the membership function in one point. In which case the result is intuitionistic in these points. Examples of membership composition:

(1 m,0)(5 m,1)(10 m,0)  –   Triangular real set (the type is Real_Set)
(1,0)(1,1)(10,1)(10,0)  –   Rectangular membership function (the type Integer_Set)
(1.1,0.6)(1.1,0.2)(1.1,1)(1.1,0.3)  –   Pulse membership function constant 0.6 left of 1.1 and 0.3 right of 1.1. In 1.1 it goes down to 0.2 and up to 1 (the type is Real_Set)

4.7.6. α-cut operation

The dyadic operation ^ yields α-cut of a set. The left operand is of one of the set types. The right operand is a truth value of either Truth_Value or Intuitionistic_Truth_Value. The left operand is automatically converted:

The result of the operation has the type of the left operand after necessary conversions. Examples of α-cuts:

Power is (low^0.5 or High)  –   Here the linguistic variable low is cut at the level of 0.5. The result is of Domain_Subset, to which the linguistic variable high is added.
Power is 1..20[W]^[1:0.5]  –   The value has rectangular membership functions for possibility and necessity. The possibility rectangle has the level 1. The necessity one does 0.5

4.7.7. Scaled set values

A numeric value in square brackets [] specified after an operand of set type multiplies the elements of the set. The set operand may have one of the following types:

The following type conversions are applied to the set operand:

The result of the operation has the type of the left operand after necessary conversions. Shifted dimensioned operand can be multiplied and divided only by a dimensionless one. The result of scaling has the type of the set operand. Examples of scaling set constants:

1..2 [m]  –  1 m .. 2 m (of Real_Range)
(2.0,0)(4.0,1)(5.0,0)[°C]  –  A triangular set of Celsius degree (of Real_Range)

[Back][TOC][Next]

4.8. String operations

String operations are defined on the types Character and String.

4.8.1. Concatenation

The operation & takes two operands of either Character or String and yields a String result. Example of using concatenation:

'a' & "bcde"  –  String abcde

4.8.2. Relational string operations

Relational operations =, /=, , >, <, <=, , >=, are defined on operands of Character and String types. They yield a value of Truth_Value type. When one operand is of real (Real) type, another is automatically converted to the same type. The dimensions of the operands after necessary conversions must be compatible. Examples of numeric relational operations:

'b' > ""  –  1 of Truth_Value
"abc" > "abcdef"  –  1 of Truth_Value

[Back][TOC][Next]

4.9. Predicate operations

Predicate operations are applied to predicates and predicate variables.

4.9.1. Relational operations

The relational operations on predicate variables are =, /=, , >, <, <=, , >=, , in, is, is in, , , , , , , , , not in. One of the operands shall be a predicate variable. Other operand depends on the operation:

The non-variable operand is automatically converted as follows:

After necessary conversions the domain set of the non-variable operand and its dimension shall match one of the variable. The result of a relational operation is a predicate. The equality  = and the inequality /=, are commutative.

The inequality /=, is defined through equality as not(x=y).

Examples of predicates:

Power is low  –  The variable Power is contained in the linguistic variable low
Zero in Power  –  Power contains the linguistic variable Zero
Power >= 10 W  –  Power is contained in ]10 W ,∞ W[
10 W <= Power  –  Same as above
Power = 0 W  –  Power is 0 W (It is contained in [0 W,0 W])
Power = Zero  –  Power contains and is contained in Zero

4.9.2. Lattice operations

Lattice operations and, , or, , xor, not, ¬ when applied to predicate produce a predicate. Examples of lattice operations on predicates:

not (Power is low)  –  Equivalent to Power is not contained in low
Power is high and Pressure >= 1 kPa

The operation not, ¬ when applied to a predicate variable produces its complement. Examples of predicate variable complements:

(not Power) is low  –  Power is contained in low
Zero is not Power  –  Zero is not contained in Power, i.e. it is contained in Power

 Because the law of excluded middle does not hold, a realization of variable does not necessarily defines one of its complement.

4.9.3. Name qualification operation

The component operation . is applied to the identifiers to specify a qualified name. The left identifier is a predicate variable. The right identifier is the domain value. Example of a qualified name:

Power.Low  –  Low of Power

[Back][TOC][Next]

5. Program structure

An IFCL program consists of a function block which has the following syntax:

<IFCL-program>  ::=  function_block <identifier> <program-body> end_function_block
<program-body> ::= <program-block> [<program-body>]
<program-block> ::= { <input-variables-block>
| <output-variables-block>
| <fuzzify-block>
| <defuzzify-block>
| <rules-block>
}

The program has the name specified by an <identifier> following the keyword function_block. It ends with the keyword end_function_block. The program consists of a number of <program-block> items. The following is an example of a valid program:

function_block Test
   var_input
      Distance : real [m];
      Angle    : real [°];
      I        : integer 1..20; (* Integer variable range 1..20 *)
      Color    : nominal (red, blue, white);
      T        : real [°C];
      V        : float [°C] 10 range 1..2*10;
   end_var

   var_output
      Power : Real [W];
      Valve : Real;
   end_var

   fuzzify T
      term Chill := (-10,1)(-4,0); -- °C is assumed
      term Cold  := ( 11,1)(17,0) [°C];
      term Tepid := ( 3,0)( 8,1)(21,1)(28,0) [°C];
      term Warm  := ( 15,0)(21,1)(29,1)(35,0) [°C];
      term Hot   := ( 25,0)(28,1) [°C];
   end_fuzzify

   defuzzify Valve
      term Open   := 1;
      term Closed := 0;
      default     := 0;
      method      : CoA;
   end_defuzzify

   fuzzify Distance
      term too_far := (-5,1)( 0,0);
      term zero    := (-5,0)( 0,1)( 5,0);
      term close   := ( 0,0)( 5,1)(10,0);
      term medium  := ( 5,0)(10,1)(22,0);
      term far     := (10,0)(22,1);
   end_fuzzify

   fuzzify Angle
      term neg_big   := (-50,1)(-5,0);
      term neg_small := (-50,0)(-5,1)( 0,0);
      term zero      := ( -5,0)( 0,1)( 5,0);
      term pos_small := ( 0,0)( 5,1)(50,0);
      term pos_big   := ( 5,0)(50,1);
   end_fuzzify

   defuzzify Power
      term neg_high   := -27;
      term neg_medium := -12;
      term zero       := 0;
      term pos_medium := 12;
      term pos_high   := 27;
      accu            : MAX;
      method          : CoGS;
      default         := 0;
   end_defuzzify

   ruleblock Rules
      and : MIN;
      if T is cold then Valve is closed;
   end_ruleblock

   ruleblock No1
      and : MIN;
      rule 1: if distance is far    and angle is zero      then power is pos_medium;
      rule 2: if distance is far    and angle is neg_small then power is pos_high;
      rule 3: if distance is far    and angle is neg_big   then power is pos_medium;
      rule 4: if distance is medium and angle is neg_small then power is neg_medium;
      rule 5: if distance is close  and angle is pos_small then power is pos_medium;
      rule 6: if distance is zero   and angle is zero      then power is zero;
   end_ruleblock

end_function_block

[Back][TOC][Next]

5.1. Rules definition

<rules-block>  ::=  rule_block <identifier> <rules-block-body> end_rule_block
<rules-block-body> ::= <rule>; [<rules-block-body>]
<rule> ::= { <accumulation-method>
| <activation-method>
| <intersection-method>
| <production-rule>
| <union-method>
}
<accumulation-method> ::= accu : <method>
<activation-method> ::= act : <method>
<intersection-method> ::= and : <method>
<union-method> ::= or : <method>
<method> ::= { asum | bdif | bsum | max | min | prod }

The only allowed methods for <accumulation-method> and <union-method> is max. The only allowed method for activation-method and intersection-method is min. Other methods are infeasible in the possibility theory.

<production-rule>  ::=  [rule <rule-number>:] if <antecedent> then <consequent>
<rule-number> ::= <integer>
<antecedent> ::= <predicate-expression>
<consequent> ::= <predicate-expression>

When <rule-number> is specified in a rule block all production rules of the block shall be numbered. The numbers may not repeat and shall compose a contiguous range beginning at 1. When the rules block has numbered rules, when stored in a training set these numbers are the numbers of the training examples in the set.


[Back][TOC]

6. Table of Contents

1. Introduction
2. Lexical elements
    2.1. Character set
    2.2. Comments
    2.3. Literals
       2.3.1. Integer literals
       2.3.2. Real literals
       2.3.3. Dimensioned literals
       2.3.4. Truth values
       2.3.5. String and character literals
    2.4. Identifiers
3. Types
    3.1. Types of constants
    3.2. Types of predicate variables
       3.2.1. Declaration of predicate variables
       3.2.2. Nominal predicate variables
       3.2.3. Integer variables
       3.2.4. Float variables
       3.2.5. Linguistic set variables
    3.3. Types of predicates
4. Operations
    4.1. Prefix operations
    4.2. Dyadic operations
    4.3. Postfix operations
    4.4. Brackets
    4.5. Numeric operations
       4.5.1. Arithmetical numeric operations
       4.5.2. Relational numeric operations
       4.5.3. Numeric membership tests
       4.5.4. Singleton composition
       4.5.5. Numeric interval composition
       4.5.6. Scaled numeric values
    4.6. Logical operations
    4.7. Set operations
       4.7.1. Lattice set-operations
       4.7.2. Relational operations on sets
       4.7.3. Membership operations
       4.7.4. Subset test operations
       4.7.5. Membership function composition
       4.7.6. α-cut operation
       4.7.7. Scaled set values
    4.8. String operations
       4.8.1. Concatenation
       4.8.2. Relational string operations
    4.9. Predicate operations
       4.9.1. Relational operations
       4.9.2. Lattice operations
       4.9.3. Name qualification operation
5. Program structure
    5.1. Rules definition
6. Table of contents