The extension of a given similarity relation R between pairs
of symbols of a particular alphabet to terms built with such symbols
can be implemented at a very high abstract level by a set of fuzzy program
rules defining a predicate called sse. This predicate is defined for
incorporating “Similarity-based Strict Equality” into the new fuzzy logic
language FASILL (acronym of “Fuzzy Aggregators and Similarity Into
a Logic Language”) that we have recently developed in our research
group. FASILL aims to cope with implicit/explicit truth degree annotations,
a great variety of connectives and unification by similarity. In
this paper we show the benefits of using this sophisticated notion of
equality which is somehow inspired by the so-called “Strict Equality”
of functional and functional-logic languages with lazy semantics (e.g.:
Haskell and Curry respectively) and the “Similarity-based Equality”
of fuzzy logic languages using weak unification (Bousi∼Prolog, Likelog),
a notion beyond classic syntactic unification.
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
RuleML2015: Similarity-Based Strict Equality in a Fully Integrated Fuzzy Logic Language
1. Introduction The FASILL language SSE in FLOPER Conclusions
Similarity-based Strict Equality in a Fully
Integrated Fuzzy Logic Language
Pascual Juli´an-Iranzo Gin´es Moreno Carlos V´azquez
University of Castilla-La Mancha, Spain
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
2. Introduction The FASILL language SSE in FLOPER Conclusions
Outline
1 Introduction
Motivation
Some declarative equality models
2 The FASILL language
Fuzzy Logic Programming and FASILL
Similarity Relations
The Weak Unification Algorithm
Operational semantics
FASILL and FLOPER
3 SSE in FLOPER
Formal results
Implementation issues and operation
4 Conclusions
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
3. Introduction The FASILL language SSE in FLOPER Conclusions
Outline
1 Introduction
Motivation
Some declarative equality models
2 The FASILL language
Fuzzy Logic Programming and FASILL
Similarity Relations
The Weak Unification Algorithm
Operational semantics
FASILL and FLOPER
3 SSE in FLOPER
Formal results
Implementation issues and operation
4 Conclusions
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
4. Introduction The FASILL language SSE in FLOPER Conclusions
Motivation
Motivation and Aim of the work
1 FASILL (Fuzzy Aggregators and Similarity Into a Logic
Language) is a Fully Integrated Fuzzy Logic Language.
1 it copes with implicit/explicit truth degree annotations, a great
variety of connectives
2 and unification by similarity.
2 Unification by similarity produces answers which are
representatives of a family of responses.
3 To obtain all answers w.r.t. a representative may be a
problem.
4 Aim of the Work: In this work we show how the notion of
“Similarity-based Strict Equality” may help to solve this
problem.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
5. Introduction The FASILL language SSE in FLOPER Conclusions
Some declarative equality models
Some declarative equality models
Logic programming uses Syntactic equality =
Fuzzy logic programming Includes two main families:
Weighted
rules uses Syntactic equality =
Similarity uses Similarity-based equality ≈
Functional (logic) programming uses Strict equality == or (=:=)
Our aim ...
How to take advantage of the strict equality of functional and
functional logic programming in a Fully Integrated Fuzzy Logic
Language.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
6. Introduction The FASILL language SSE in FLOPER Conclusions
Outline
1 Introduction
Motivation
Some declarative equality models
2 The FASILL language
Fuzzy Logic Programming and FASILL
Similarity Relations
The Weak Unification Algorithm
Operational semantics
FASILL and FLOPER
3 SSE in FLOPER
Formal results
Implementation issues and operation
4 Conclusions
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
7. Introduction The FASILL language SSE in FLOPER Conclusions
Fuzzy Logic Programming and FASILL
Fuzzy Logic Programming and FASILL
Fuzzy Logic Programming = Logic Prog. + Fuzzy Logic
There is no a standard language. We have found two main
approaches:
1. SLD-resolution + weak unification
Likelog [Arcelli & Formato-99] Bousi∼Prolog [Juli´an &
Rubio-07]
2. FUZZY inference + syntactic unification
f-Prolog [Vojtas & Paul´ık-96] MALP [Medina et. al-01]
The FASILL language is conceived for fusing both worlds
FASILL = FUZZY inference + weak unification
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
8. Introduction The FASILL language SSE in FLOPER Conclusions
Fuzzy Logic Programming and FASILL
Fuzzy Aggregators and Similarity Into a Logic Language
• FASILL is a first order language containing: variables,
constants, functions, predicates, and ...
a great variety of connectives!!!
&1, &2, . . . , &k (conjunctions)
|1, |2, . . . , |l (disjunctions)
@1, @2, . . . , @n (aggregations)
• Instead of the crisp {true, false}, it uses any complete lattice
L, to model truth degrees and their associated fuzzy
connectives (for instance, [0, 1], ≤ ).
• It may include a similarity relation R if needed ...
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
9. Introduction The FASILL language SSE in FLOPER Conclusions
Similarity Relations
Similarity Relations
Similarity relations can be seen as an extension of the classical
notion of equivalence relation
A similarity relation R is a fuzzy binary relation on a given
domain U fulfilling these properties:
Reflexive R(x, x) = ⊤, ∀x ∈ U
Symmetric R(x, y) = R(y, x)∀x, y ∈ U
Transitive R(x, z) ≥ R(x, y) ∧ R(y, z) ∀x, y, z ∈ U
In classical Logic Programming different syntactic symbols
represent distinct information.
This restriction can be relaxed by introducing a similarity
relation R on the alphabet of a first order language.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
10. Introduction The FASILL language SSE in FLOPER Conclusions
Similarity Relations
Similarity Relations
A similarity relation R is coded with syntax:
Relation ::= Sim Relation | Sim
Sim ::= Idf [‘/’ Intn ] ‘∼’ Idg [‘/’ Intn ] ‘=’ r ‘.’
| ‘∼’ ‘tnorm’ ‘=’ tnorm ‘.’
Example
∼tnorm = godel.
elegant/1 ∼ vanguardist/1 = 0.6.
metro ∼ bus = 0.5.
bus ∼ taxi = 0.4.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
11. Introduction The FASILL language SSE in FLOPER Conclusions
Similarity Relations
Similarity Relations
Example (reflexive, symmetric, transitive closure)
elegant vanguardist metro bus taxi
elegant 1 0.6 0 0 0
vanguardist 0.6 1 0 0 0
metro 0 0 1 0.5 0.4
bus 0 0 0.5 1 0.4
taxi 0 0 0.4 0.4 1
R can be extended to terms by induction:
ˆR(x, x) = R(x, x) = ⊤, if x is a variable
ˆR(f (t1, . . . , tn), g(s1, . . . , sn)) = R(f , g) ∧ (
n
i=1
ˆR(ti , si ))
So, ˆR(elegant(taxi), vanguardist(metro)) = 0.6 ∧ 0.4, because
R(elegant, vanguardist) = 0.6 and R(taxi, metro) = 0.4.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
12. Introduction The FASILL language SSE in FLOPER Conclusions
The Weak Unification Algorithm
The Weak Unification Algorithm
FASILL inherits from Bousi∼Prolog a weak unification
algorithm based on similarity relations.
The weak unification algorithm:
{f (t1, . . . , tn) ≈ g(s1, . . . , sn)} weakly unifies iff R(f , g) > ⊥
and {t1 ≈ s1, . . . , tn ≈ sn)} weakly unifies.
Output: a weak mgu, which is a substitution plus an
approximation degree.
Note that it computes a representative of a class of wmgus.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
13. Introduction The FASILL language SSE in FLOPER Conclusions
The Weak Unification Algorithm
The Weak Unification Algorithm
Example (Find a wmgu for f (h(X)), k(Y )) and g(Z, j(Y )))
Assume R(f , g) = 0.8, R(j, k) = 0.3, . . .
Unification problem Weak Unifier Degree
{f (h(X)), k(Y )) ≈ g(Z, j(Y ))} {} 1
{h(X) ≈ Z, k(Y ) ≈ j(X)} {} 1 ∧ 0.8
{k(Y ) ≈ j(X)} {Z/h(X)} 0.8
{Y ≈ X} {Z/h(X)} 0.8 ∧ 0.3
{} {Z/h(X), Y /X} 0.3
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
14. Introduction The FASILL language SSE in FLOPER Conclusions
Operational semantics
Operational semantics
FASILL Operational semantics
Fuzzy inference (MALP) + weak unification (Bousi∼Prolog).
It is a backward-reasoning method which is modeled as a
state transition system where:
State: pair with form goal; substitution
Input (goal): for instance, good hotel(X); id
Output (fuzzy computed answer): final state of the form
truth degree; substitution
Transition relation: based on the following three rules
Successful steps (→SS ) Interpretive steps (→IS )
Failure steps (→FS )
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
15. Introduction The FASILL language SSE in FLOPER Conclusions
Operational semantics
Transition relation →SS
SUCCESSFUL STEP →SS
Q[A]; σ →SS (Q[A/&(B, r)])θ; σθ if
(1) A is the selected atom in Q,
(2) A′← B is a rule in the program P
(3) θ, r = wmgu({A′ ≈ A})
Example
Let p(a)← p(f(a)) be a rule, R(p, q) = 0.9, and &prod is the
t-norm used to propagate similarities
&godel(q(X), s(X)); id →SS
&godel(&prod(0.9, p(f(a))), s(a)); {X/a}
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
16. Introduction The FASILL language SSE in FLOPER Conclusions
Operational semantics
Transition relation →FS
FAILURE STEP →FS
Q[A]; σ →FS (Q[A/⊥]); σ if
(1) A is the selected atom in Q,
(2) There is no rule in P whose head weakly unifies with A
Example
This case is introduced to cope with (possible) unsuccessful
admissible derivations. For instance, with a program
p(a) ← 0.6
we have : @aver(1, p(b)); id →FS @aver(1, 0); id
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
17. Introduction The FASILL language SSE in FLOPER Conclusions
Operational semantics
Transition relation →IS
INTERPRETIVE STEP →IS
Q[@(r1, r2)]; σ →IS Q[@(r1,r2)/˙@(r1,r2)];σ
where ˙@ is the truth function of connective @ in the complete
lattice associated to the program P
Example
Since the truth function associated to &prod is the product
operator, then
&godel(&prod(0.9, 0.5), 0.7); {X/a} →IS
&godel(0.45, 0.7); {X/a}
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
18. Introduction The FASILL language SSE in FLOPER Conclusions
Operational semantics
FASILL syntax: an example program
~tnorm = godel.
elegant/1 ~ vanguardist/1 = 0.6.
bus ~ taxi = 0.4. metro ~ bus = 0.5.
vanguardist(hydropolis) <- 0.9.
elegant(ritz) <- 0.8.
close(hydropolis, taxi) <- 0.7.
good_hotel(X) <- @aver(elegant(X),
@very(close(X, metro)).
Connective definitions in the lattice [0, 1], ≤ :
@aver(x1, x2) (x1 + x2)/2 @very(x) x ∗ x
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
19. Introduction The FASILL language SSE in FLOPER Conclusions
FASILL and FLOPER
The Fuzzy Logic System FLOPER
Fuzzy LOgic Programming Environment for Research
(about 1000 Prolog clauses and DCG’s for parsing predicates)
http://dectau.uclm.es/floper/
Compiles FASILL code to Prolog code
Accepts different complete lattices
Includes advanced options for
Running goals
Draw derivation trees for debugging
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
20. Introduction The FASILL language SSE in FLOPER Conclusions
FASILL and FLOPER
Screenshot of FLOPER
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
21. Introduction The FASILL language SSE in FLOPER Conclusions
FASILL and FLOPER
http://dectau.uclm.es/floper/?q=sim
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
22. Introduction The FASILL language SSE in FLOPER Conclusions
Outline
1 Introduction
Motivation
Some declarative equality models
2 The FASILL language
Fuzzy Logic Programming and FASILL
Similarity Relations
The Weak Unification Algorithm
Operational semantics
FASILL and FLOPER
3 SSE in FLOPER
Formal results
Implementation issues and operation
4 Conclusions
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
23. Introduction The FASILL language SSE in FLOPER Conclusions
Formal results
Strict equality in Functional Programming
Strict Equality: The equation t1 == t2 on terms is satisfied
if t1 and t2 are reducible to the same ground constructor term.
Strict Equality is defined as a function which is strict in both
arguments. That is, to evaluate t1 == t2, t1 and t2 must be
evaluated first.
Definition
c == c → true
f (x1, . . . , xn) == f (y1, . . . , yn) → x1 == y1 ∧ . . . ∧ xn == yn
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
24. Introduction The FASILL language SSE in FLOPER Conclusions
Formal results
Strict equality in Functional Programming
Functional Programming languages have non-strict semantics
(lazy semantics). This is to deal with non-terminating
computations.
Problem: Strict Equality is not reflexive.
Let f x = x:(f x). Then, (f 0) == (f 0) loops.
Last problem it is not reproduced in our context.
We take inspiration of the form in which strict equality is defined
to give an implementation of the notion of similarity between
(ground) terms, ˆR.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
25. Introduction The FASILL language SSE in FLOPER Conclusions
Formal results
Extended similarity ˆR and strict equality
Definition ( ˆR for ground terms)
ˆR(c, c′) = R(c, c′)
ˆR(f (t1, . . . , tn), f ′(t′
1, . . . , t′
n)) =
R(f , f ′) & ˆR(t1, t′
1) & . . . & ˆR(tn, t′
n)
.
where & is a t-norm defined in the lattice L.
Translation of ˆR to FASILL: SSE rules
sse(c, c′) ← R(c, c′)
sse(f(t1, . . . , tn), f′(t′
1, . . . , t′
n)) ←
R(f, f′) & sse(t1, t′
1) & . . . & sse(tn, t′
n)
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
26. Introduction The FASILL language SSE in FLOPER Conclusions
Formal results
Formal results
Theorem
Let
t and t’ be two ground terms and x a variable,
L = (L, ≤) a complete lattice,
a program Π plus the SSE rules w.r.t. the similarity relation R.
ˆR(t, t′) = s ⇐⇒ sse(t, t’)→SS
∗ s, id
ˆR(t, t′) = s ⇐⇒ sse(t, x)→SS
∗ s, {x/t′}
ˆR(t, t′) = s ⇐⇒ sse(x, x’)→SS
∗ s, {x/t, x′/t′}
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
27. Introduction The FASILL language SSE in FLOPER Conclusions
Implementation issues and operation
How does SSE work?
Outline of the method
The user modelates a similarity relation into a (.sim) file.
FLOPER translates the (.sim) file to FASILL rules (sse/3).
The user makes use of sse/3 predicate in a FASILL program
(if he/she needs all answers).
Example (.sim file)
∼ tnorm = godel.
metro ∼ bus = 0.5. bus ∼ taxi = 0.4.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
28. Introduction The FASILL language SSE in FLOPER Conclusions
Implementation issues and operation
How does SSE work?
The set of similarity equations in the .sim file are parsed and
coded into FLOPER as facts: sim((A,nA),(B,nB),V)
sim((metro, 0), (bus, 0), 0.5).
sim((bus, 0), (taxi, 0), 0.4).
Then, FLOPER completes the relation
Example (reflexive, symmetric, transitive closure)
metro bus taxi
metro 1 0.5 0.4
bus 0.5 1 0.4
taxi 0.4 0.4 1
The resulting relation is modeled
by means of facts sim/3
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
29. Introduction The FASILL language SSE in FLOPER Conclusions
Implementation issues and operation
How does SSE work?
Last step: Translate Prolog sim/3 facts to FASILL sse/3
rules to be added to the program.
Example
sse(taxi,taxi)<-1. sse(taxi,bus)<-0.4.
sse(taxi,metro)<-0.4.
sse(bus,taxi)<-0.4. sse(bus,bus)<- 1.
sse(bus,metro)<-0.5.
sse(metro,taxi)<- 0.4. sse(metro,bus)<-0.5.
sse(metro,metro)<-1.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
30. Introduction The FASILL language SSE in FLOPER Conclusions
Implementation issues and operation
Example
Example
Let P be our running program:
vanguardist(hydropolis) <- 0.9.
elegant(ritz) <- 0.8.
close(hydropolis, taxi) <- 0.7.
good hotel(X) <- @aver(elegant(X), @very(close(X, metro)).
If we launch the goal ...
?- close(hydropolis, X)
<0.7, {X/taxi}> (only one answer!!)
which is a representative.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
31. Introduction The FASILL language SSE in FLOPER Conclusions
Implementation issues and operation
Example
Clearly, <0.4, {X/bus}> and <0.4, {X/metro}> are
computed answers too.
They can be obtained extending P with the corresponding
SSE rules.
Example
Let P be our program, including the SSE rules. The goal:
?- close(hydropolis,X) & sse(X,Y)
< 0.7, {Y/taxi,X/taxi} > < 0.4, {Y/bus,X/taxi} >
< 0.4, {Y/metro,X/taxi} > < 0.4, {Y/taxi,X/taxi} >
< 0.4, {Y/bus,X/taxi} > < 0.4, {Y/metro,X/taxi} >
< 0.4, {Y/taxi,X/taxi} > < 0.4, {Y/bus,X/taxi} >
< 0.4, {Y/metro,X/taxi} >
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
32. Introduction The FASILL language SSE in FLOPER Conclusions
Outline
1 Introduction
Motivation
Some declarative equality models
2 The FASILL language
Fuzzy Logic Programming and FASILL
Similarity Relations
The Weak Unification Algorithm
Operational semantics
FASILL and FLOPER
3 SSE in FLOPER
Formal results
Implementation issues and operation
4 Conclusions
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015
33. Introduction The FASILL language SSE in FLOPER Conclusions
Conclusions and future work
Inspired by the notions of strict equality, we have defined the
Similarity-based Strict Equality operator (SSE) for FASILL
and we have proven some formal properties.
As an application, we have proposed a static method to cope
with all answers to a problem. Our simple method consists in
the deployment of a SSE operator which is added to the
program at a high level.
However, the method is rather ad-hoc and it is pending its
nice introduction into the FLOPER system.
Also, we are working in order to eliminate the redundant
answers which may appear for certain goals.
SSE in a Fully Integrated Fuzzy Logic Lang.
RuleML 2015