Navigation
  • Home
  • Fuzzy Logic Programs
  • Multi-Adjoint Lattices
  • Syntax
  • Procedural Semantics
  • Prolog Code Generation
  • How to Use FLOPER
    • Starting
    • Managing Projects
    • Loaging Fuzzy Programs
    • Using Lattices
    • Executing Scripts
    • Running Programs
    • Execution Tree
    • Declarative Traces
  • Bibliography
  • Downloads
Interesting Links
  • fuzzyXPath Project
  • FLUS Tool
  • DEC-Tau
  • Similarities in FLOPER
Home

SYNTAX of Multi-Adjoint Logic Programs

Roughly speaking, a multi-adjoint logic program can be seen as a set of rules each one annotated with a truth degree. In this section we explain the syntax of fuzzy programs accepted by FLOPER.

  • Firstly, the system accepts fuzzy-logic rules and declarations (pure Prolog code). Sentences appearing between '$' symbols represents pure Prolog code which does not need any translation process.

 

For instance (one declaration and two rules):

$agr_average(X,Y,Z,W):-W is (X+Y+Z)/3.$
p(Y) ←prod r(a) &luka 0.8 with 1.
q(X) with 0.5.

  • Rules have an atom on the head. The body is optional (rules without body are called 'facts'). Implications symbols connecting the body and the head of the rule, are labeled with an appropriated identifier (different implementations), or with a dash (-) when the concrete implementation of the implication is not relevant. Finally, one of the most important syntactic features of Multi-Adjunt Logic Programs is that each rule has its own truth degree. The truth degree can be ommited when it is equal to the Top value in the lattice.

    For instance:

    p(Y) ←prod r(a) &luka 0.8 with 1.       ----> rule with body
    p(Y) ← r(a) &luka 0.8 .       ----> rule with implication and truth degree ommited
    q(X) with 0.5.                        ----> fact (rule without body)

  • A body is a formula built from atoms, truth values and conjunctions (&i ), disjunctions ( |i ) and aggregations (@i).
    • A body can consist of an atom:

      p(X) ←luka r(a) with 0.5.

    • or a truth value:

      p(X) ←luka 0.8 with 0.5.

    • or one or more operations among them:

      p(X) ←luka r(a) &godel (0.7 @prod q(X,Y))with 1.

  •  Body's operators have any arity n > 0 and are expressed in a prefix way, except those binary ones which also admit a infix notation.
    • Example of a binary, infix operator :

      p(X) ←luka r(a) &godel 0.9 with 1.

    • Example of a 4-ary, prefix operator :

      p(X) ←luka &godel (q(X,Y),p(a),0.3,1) with 1.

  • Atoms have a pure Prolog notation, that is, a predicate symbol followed by its corresponding terms between parentheses. Terms are built with numbers, lists, variables, constants and function symbols. For instance:

    r(a, X).

    loop1(100, [a,b,c]).

    q(f(a)).

 

Now we show some examples of syntactically correct/incorrect fuzzy programs:

Example 1. Correct use of most of the syntactic features of the fuzzy language:

 

q(f(a),b) <prod 0.9 with 0.7.
p([e,3,ij],25) with 0.74.
e(Y,a) <luka |godel(r(Y),0.2,s(a),1) with 1.
$agr_average(X,Y,Z,W):-W is (X+Y+Z)/3.$
p(Y) <prod r(a) &luka (0.8 &godel r(Y)) with 0.8.

Example 2. Fuzzy program syntactically incorrect:

 

s(b) wit 0.9. %% --->It's 'with'
q(a,b) < r(X) with 0.7. %% --->lack implication's labels or dash
p(Y) <prod t(a) &luka |godel with 0.8. %%--> bad body
q(Y,a) <luka r(Y) with 0.8 %%--> lack end point