FASILL getting-started

Logic programming has been widely used for problem solving and knowledge representation in the past. Nevertheless, traditional logic programming languages do not incorporate techniques or constructs to treat explicitly with uncertainty and approximated reasoning. To overcome this situation, during the last decades several fuzzy logic programming systems have been developed where the classical inference mechanism of SLD-Resolution has been replaced with a fuzzy variant able to handle partial truth and to reason with uncertainty. Most of these systems implement the fuzzy resolution principle introduced by Lee in [Fuzzy Logic and the Resolution Principle].

**FASILL** (acronym of *Fuzzy Aggregators and Similarity Into a Logic Language*) is a fuzzy logic programming language with
implicit/explicit truth degree annotations, a great variety of connectives and unification by similarity. FASILL integrates and
extends features coming from **MALP** (*Multi-Adjoint Logic Programming*, a fuzzy logic language with explicitly annotated rules)
and **Bousi∼Prolog** (which uses a weak unification algorithm and is well suited for flexible query answering). Hence, it properly manages
similarity and truth degrees in a single framework combining the expressive benefits of both languages.

A FASILL program is a tuple `<Π, R, L>`

where `Π`

is a set of rules, `R`

is a similarity relation between the elements of the signature
`Σ`

of `Π`

, and `L`

is a complete lattice.

A rule is a formula `A ← B`

, where `A`

is an atomic formula (usually called the head) and `B`

(which is called the body) is a
formula built from atomic formulas (`B`

, ..., _{1}`B`

), truth values of _{n}`L`

and conjunctions, disjunctions
and aggregations. Rules with an empty body are called facts. A goal is a body submitted as a query to the system. Variables in a rule are
assumed to be governed by universal quantifiers.

```
vanguardist(hydropolis) <- 0.9.
elegant(ritz) <- 0.8.
close(hydropolis, taxi) <- 0.7.
good_hotel(X) <- @aver(elegant(X), @very(close(X, metro))).
```

A complete lattice is a partially ordered set in which all subsets have both a supremum and an infimum.

All relevant components of each lattice can be encapsulated inside a Prolog file which must contain the definitions of a minimal set of predicates defining the set of valid elements (including special mentions to the "top" and "bottom" ones), the full or partial ordering established among them, as well as the repertoire of fuzzy connectives which can be used for their subsequent manipulation.

`member/1`

which is satisfied when being called with a parameter representing a valid truth degree.`members/1`

which returns in one go a list containing the whole set of truth degrees.`bot/1`

and`top/1`

answer with the top and bottom element of the lattice, respectively.`leq/2`

models the ordering relation among all the possible pairs of truth degrees, and it is only satisfied when it is invoked with two elements verifying that the first parameter is equal or smaller than the second one.Finally, given some fuzzy connectives of the form &

_{label1}(conjunction), |_{label2}(disjunction) or @_{label3}(aggregation) with arities n1, n2 and n3 respectively, we must provide clauses defining the connective predicates`and_label1/(n1+1)`

,`or_label2/(n2+1)`

and`agr_label3/(n3+1)`

, where the extra argument of each predicate is intended to contain the result achieved after the evaluation of the proper connective.

```
% Elements
member(X) :- number(X), 0 =< X, X =< 1.
members([0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0]).
% Distance
distance(X,Y,Z) :- Z is abs(Y-X).
% Ordering relation
leq(X,Y) :- X =< Y.
% Supremum and infimum
bot(0.0).
top(1.0).
% Binary operations
and_prod(X,Y,Z) :- Z is X*Y.
and_godel(X,Y,Z) :- Z is min(X,Y).
and_luka(X,Y,Z) :- Z is max(X+Y-1,0).
or_prod(X,Y,Z) :- U1 is X*Y, U2 is X+Y, Z is U2-U1.
or_godel(X,Y,Z) :- Z is max(X,Y).
or_luka(X,Y,Z) :- Z is min(X+Y,1).
% Aggregators
agr_aver(X,Y,Z) :- Z is (X+Y)/2.
agr_very(X,Y) :- Y is X*X.
% Default connectives
tnorm(godel).
tconorm(godel).
```

Given a domain `U`

and a lattice `L`

with a fixed t-norm, a similarity relation `R`

is a fuzzy binary relation on U fulfilling the reflexive,
symmetric and transitive properties.

FASILL takes a set of similarity equations `f/n ~ g/n = r`

, where `f`

and `g`

are propositional variables or constants and `r`

is an element of `L`

, and generates a valid similarity relation by applying the reflexive, symmetric and transitive closures over the initial scheme.

```
elegant/1 ~ vanguardist/1 = 0.6.
metro ~ bus = 0.5.
bus ~ taxi = 0.4.
~tnorm = godel.
```

You can download and install FASILL from here. Once installed, you can run the interactive console of FASILL by typing `fasill` on a terminal. `fasill>`

is the prompt of FASILL.

```
$ fasill
FASILL (pre-alfa): http://dectau.uclm.es/fasill/
Copyright (C) 2018 José Antonio Riaza Valverde
Released under the BSD-3 Clause license
fasill>
```

Now, you can execute FASILL goals or commands.

A command is a FASILL term preceded by the character (`:`

).

`:exit`

– exit FASILL.`:help`

– print this message.`:lattice(Path)`

– change lattice from file`Path`

.`:license`

– print license message.

By default, FASILL incorporates a set of predefined lattices, and loads the lattice `([0,1], ≤)`

into the environment.
You can change the current lattice with the command `:lattice(Path)`

. If `Path`

is a term of the form `library(Name)`

instead of a file path, FASILL finds in its predefined lattices:

`:lattice(library(real))`

– reals in the unit interval with logics of product, Gödel and Łukasiewicz.`:lattice(library(bool))`

– boolean values with classical operators.

You can directly run FASILL with a different lattice with the option `fasill -lat <lattice>`.

FASILL reads the input until the first break line, analyzes the term and runs the goal. After the first answer, you can press the key (`;`

)
to find the next answer, or any other to end the search.

```
fasill> consult('sample/program/good_hotel.fpl').
< 1.0, {} > .
fasill> consult_sim('sample/sim/good_hotel.sim.pl').
< 1.0, {} > .
fasill> good_hotel(X).
< 0.38, {X/hydropolis} > ;
< 0.4, {X/ritz} > ;
fasill>
```