FASILL getting-started

Getting Started

What is FASILL?

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.

Programs

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.

Rules

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 (B1, ..., Bn), truth values of 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))).

Complete lattices

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.

% 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).

Similarity relations

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.

Interactive console

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.

Commands

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

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:

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

Goals

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>