Go to the first, previous, next, last section, table of contents.


Fuzzy Prolog

Author(s): Claudio Vaucheret, Sergio Guadarrama, Francisco Bueno.

Version: 1.10#6 (2004/8/7, 21:46:39 CEST)

Version of last change: 1.9#339 (2004/4/22, 7:49:9 CEST)

This package impements an extension of prolog to deal with uncertainty. We implement a fuzzy prolog that models interval-valued fuzzy logic. This approach is more general than other fuzzy prologs in two aspects:

  1. Truth values are sub-intervals on [0,1]. In fact, it could be a finite union of sub-intervals, as we will see below. Having a unique truth value is a particular case modeled with a unitary interval.
  2. Truth values are propagated through the rules by means of a set of aggregation operators. The definition of an aggregation operator is a generalization that subsumes conjunctive operators (triangular norms as min, prod, etc.), disjunctive operators (triangular co-norms as max, sum, etc.), average operators (averages as arithmetic average, cuasi-linear average, etc.) and hybrid operators (combinations of previous operators).

We add uncertainty using CLP(R) instead of implementing a new fuzzy resolution as other fuzzy prologs. In this way, we use the original inference mechanism of Prolog, and we use the constraints and its operations provided by CLP(R) to handle the concept of partial truth. We represent intervals as constrains over real numbers and aggregation operators as operations with constraints.

Each fuzzy predicate has an additional argument which represents its truth value. We use ":~" instead of ":-" to distinguish fuzzy clauses from prolog clauses. In fuzzy clauses, truth values are obtained via an aggregation operator. There is also some syntactic sugar for defining fuzzy predicates with certain membership functions, the fuzzy counterparts of crisp predicates, and the fuzzy negation of a fuzzy predicate.

Usage and interface (fuzzy)

Documentation on new declarations (fuzzy)

DECLARATION: aggr/1:

Usage: :- aggr(Name).

Documentation on exports (fuzzy)

PREDICATE: :#/2:

Usage: :#(Name, Decl)

PREDICATE: fuzzy_predicate/1:

Usage: fuzzy_predicate(Domain)

PREDICATE: fuzzy/1:

Usage: fuzzy(Name)

PREDICATE: fnot/1:

Usage: fnot(Name)

PREDICATE: :~/2:

Usage: :~(Head, Body)

PROPERTY: fuzzybody/1:

A clause body, optionally prefixed by the name of an aggregation operator. The agregators currently provided are listed under faggregator/1. By default, the aggregator used is min.

Usage: fuzzybody(B)

REGTYPE: faggregator/1:

The first three are, respectively, the T-norms: minimum, product, and Lukasiewicz's. The last three are their corresponding T-conorms. Aggregators can be defined by the user, see aggr/1.

faggregator(min).
faggregator(prod).
faggregator(luka).
faggregator(max).
faggregator(dprod).
faggregator(dluka).

Usage: faggregator(Aggr)

PREDICATE: =>/4:

Usage: =>(Aggr, A, B, Truth)

Other information (fuzzy)

An example program:

:- module(dicesum5,_,[fuzzy]).

% this example tries to measure which is the possibility
% that a couple of values, obtained throwing two loaded dice, sum 5. Let
% us suppose we only know that one die is loaded to obtain a small value
% and the other is loaded to obtain a large value. 
%
% the query is  ? sum(5,M)
%

small :# fuzzy_predicate([(1,1),(2,1),(3,0.7),(4,0.3),(5,0),(6,0)]).
large :# fuzzy_predicate([(1,0),(2,0),(3,0.3),(4,0.7),(5,1),(6,1)]).

die1(X,M) :~
        small(X,M).

die2(X,M) :~
        large(X,M).

two_dice(X,Y,M):~ prod
        die1(X,M1),
        die2(Y,M2).

sum(2,M) :~  
        two_dice(1,1,M1).

sum(5,M) :~ dprod
        two_dice(4,1,M1),
        two_dice(1,4,M2),
        two_dice(3,2,M3),
        two_dice(2,3,M4).

There are more examples in the subdirectory fuzzy/examples of the distribution.

Known bugs and planned improvements (fuzzy)


Go to the first, previous, next, last section, table of contents.