The language we call BousiProlog (BPL for short) is an extension of the standard Prolog language
with a similarity relation defined on a syntactic domain.
Therefore, the syntax of the extended language is easy. It is mainly the Prolog
syntax but enriched with a built-in symbol ``~~
'' used for describing
similarity relations by means of similarity equations of the form:
<alphabet symbol> ~~ <alphabet symbol> = <degree>meaning that two constants, n-ary function symbols or n-ary predicate symbols are similar with a certain degree.
A BPL program is mainly a sequence of Prolog facts and rules followed by a sequence of similarity equations.
As an example, this BPL program fragment specify features and preferences on books stored in a data base. The preferences are specified by means of similarity equations:
% FACTS adventures(treasure_island). adventures(the_call_of_the_wild). mystery(the_murders_in_the_rue_morgue). horror(dracula). science_fiction(the_city_and_the_stars). science_fiction(the_martian_chronicles). % RULES good(X) :- interesting(X). % SIMILARITY EQUATIONS adventures ~~ mystery = 0.5 adventures ~~ science_fiction = 0.8 adventures ~~ interesting = 0.9 mystery ~~ horror = 0.9 mystery ~~ science_fiction = 0.5 science_fiction ~~ horror = 0.5
BousiProlog implements a weak unification operator, also denoted
by ``'', which is the fuzzy counterpart of the
syntactical unification operator ``='' of standard Prolog.
It can be used, in the source language, to construct expressions
like ``Term1 ~~ Term2 =:= Degree
'' which is interpreted as
follows: The expression is true if Term1 and Term2
are unifiable by similarity with approximation degree AD equal to Degree.
In general, we can construct expressions ``Term1 ~~ Term2 <op> Degree
''
where ``<op>'' is a comparison arithmetic operator or the symbol ``=''.
In the last case, the construction ``Term1 ~~ Term2 = Degree
'' success if
Term1 and Term2 are weak unifiable with approximation degree
Degree.
These expressions may be introduced in a query as well as in the
body of a clause.