SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
Labelled Variables in Logic Programming:
A First Prototype in tuProlog
Roberta Calegari, Enrico Denti, Andrea Omicini
{roberta.calegari, enrico.denti, andrea.omicini}@unibo.it
DISI
Alma Mater Studiorum—Universit`a di Bologna
Talk @ 14th Conference of the Italian Association for Artificial
Intelligence
University of Ferrara - 23rd September 2015
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 1 / 34
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 2 / 34
Scope & Goals
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 3 / 34
Scope & Goals
Context and Motivation
Explore models and technologies to face the challenges of pervasive system
complex distributed situated intelligent
From distributed intelligence towards distributed situated intelligence
situated (intelligent) component for pervasive (intelligent) systems
Logic Programming (LP) extensions for interacting with the environment
Prodromes of situated LP
Forms of control which generalises data-driven computation, e.g. CLP
[Jaffar and Lassez, 1987]
Ability to be domain-specific – e.g. CHR [Fruhwirth, 1998]
However they are designed against a landscape different from nowadays
pervasive systems.
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 4 / 34
Scope & Goals
Archeology
[Jaffar and Lassez, 1987] defines CLP as a merger of two declarative
paradigms: constraint solving and logic programming → capability for
reasoning in the specific finite domain of application
[Fruhwirth, 1998] introduces CHR as a high-level and declarative language
for implementing constraint solver. User-defined constraints led to
widely domain applications (constraint solving, type checking, natural
language processing, multi-agent systems,...)
[Neumerkel, 1990] presentes metastructures to extend syntactic
unification: data types whose (unification) semantics are specified by
user-defined predicates
[Holzbaur, 1992] introduces attributed variables as mechanism to support
of CLP languages, yet inside the LP context
[Gabbay, 1996] introduces Labelled Deductive System: general notion of
label and a new unifying methodology for logic
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 5 / 34
Scope & Goals
Goals
Aim
To devise out simple and expressive mechanisms enabling data-driven
and domain specific within a LP framework
To acquire information from any source of data (constraint store,
data base, sensors,...) → infer knowledge
Method
Investigating LP extension based on labelled variables
1 To define a labelled variables logic programming model where labels
are exploited to define computations in domain-specific contexts
2 To exploit labelled variables for enabling computations at a separate
level, while retaining the general coherence of the LP approach
3 To present a first prototype of Labelled tuProlog
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 6 / 34
Scope & Goals
Conceptual Architecture
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 7 / 34
The Labelled Variables Model in Logic Programming
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 8 / 34
The Labelled Variables Model in Logic Programming
The Labelled Variables Model in Logic Programming
Defined by:
a set of basic labels B, where b ∈ B is the generic basic label here
taking the form of a logic term, i.e. B ⊆ T ;
a set of labels L , where l ∈ L is a generic label defined as a set of
basic labels, i.e. l = {b1, .., bn};
a labelling association denoted as v, l that associates the label l to
the variable v.
Unification of two labelled variables
Represented by tuple (true/false, θ, label):
true/false represents if there is an answer
θ represents the most general substitution
label represents the new label associated to the unified variables
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 9 / 34
The Labelled Variables Model in Logic Programming Unification rules
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 10 / 34
The Labelled Variables Model in Logic Programming Unification rules
Unification Rules
Combining function
fL to synthesise a new label from two given ones. i.e. combine two
different labels:
fL : L xL → L
The function embeds the scenario-specific criterion for defining a new label
→ domain specific computation
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 11 / 34
The Labelled Variables Model in Logic Programming Examples
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 12 / 34
The Labelled Variables Model in Logic Programming Examples
Examples I
Arithmetic Inequalities 1/2
Basic labels are arithmetic intervals: b ∈ B takes one of the following
forms (where a3, a5 can also be −∞, while a4, a8 can also be +∞)
b = [a1, a2] = {x ∈ R| a1 ≤ x ≤ a2, a1, a2 ∈ R}
b = ]a3, a4[ = {x ∈ R| a3 < x < a4, a3, a4 ∈ R}
b = ]a5, a6] = {x ∈ R| a5 < x ≤ a6, a5, a6 ∈ R}
b = [a7, a8[ = {x ∈ R| a7 ≤ x < a8, a7, a8 ∈ R}
The combining function fL intersects intervals
Given l1 = {b11, ..b1n} and l2 = {b21, ..b2m}, the resulting label
defined as the union of all the possible intersections:
fL : (l1, l2) = fL({b11, ..b1n}, {b21, ..b2m}) =
{{(b11 ∩ b21) ∪ .. ∪ (b11 ∩ b2m)}, ..., {(b1n ∩ b21) ∪ .. ∪ (b1n ∩ b2m)}}
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 13 / 34
The Labelled Variables Model in Logic Programming Examples
Examples II
Arithmetic Inequalities 2/2
For instance, let X and Y two variables involved in two inequalities, with
the following constraints:
X{[3..5],[9..10]}
Y {[8..10]}
If these labels are eventually combined, the new label l3 obtained by
applying fL results:
l1 = {[3..5], [9..10]}
l2 = {[8..10]}
l3 = fL(l1, l2) = fL({[3..5], [9..10]}, [8..10]) =
= {([3..5] ∩ [8..10]) ∪ ([9..10] ∩ [8..10])} = [9..10]
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 14 / 34
The Labelled Variables Model in Logic Programming Examples
Examples III
RGB colour space 1/2
Basic labels assume the syntax of RGB triplet, so that
b = (r, g, b) = {r, g, b ∈ N| 0 ≤ r, g, b ≤ 255}
Label l ∈ L becomes the singleton
l = (r, g, b)
The combining function fL is supposed to blend colours according to
the specific application needs: computing the arithmetic mean of the
colour component labels
fL(l1, l2) = fL((r1, g1, b1), (r2, g2, b2)) =
r1 + r2
2
,
g1 + g2
2
,
b1 + b2
2
= l3
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 15 / 34
The Labelled Variables Model in Logic Programming Examples
Examples IV
RGB colour space 2/2
Let X represent a red object, Y a yellow one and Z a blue one:
X(255,0,0)
Y (255,255,0)
Z(0,0,255)
Combining X with Y according to the combine criterion embedded in fL
leads to:
l1 = (255, 0, 0) l2 = (255, 255, 0)
l3 = fL(l1, l2) = ((255, 0, 0), (255, 255, 0)) = (255, 128, 0) = l3
Combining X with Z, instead, would lead to a violet label
l4 = (128, 0, 128)
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 16 / 34
Prototype in tuProlog
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 17 / 34
Prototype in tuProlog System architecture
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 18 / 34
Prototype in tuProlog System architecture
System architecture
tuProlog Architecture
minimal Prolog virtual machine
available as a self-contained object
featuring a simple interface
dynamically linkable and dischargeable libraries of predicates
Labelled tuProlog extension
libraries of Prolog predicates
suitable Java methods
Extend the built-in unification by
user-definition semantics
↓
enabling data-driven & domain
specific computation
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 19 / 34
Prototype in tuProlog The language extension
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 20 / 34
Prototype in tuProlog The language extension
The language extension I
The Prolog language level
Variable/Label association — label associate(+Var, +Label )
to associate variable Var to label Label — as ◦/2 operator
Function fL — label generate(+Label1, +Label2, -Label3 )
to specify how to build a new label from two given ones
Label-interpreted terms — label interpret(+Label, +Term )
to enable terms to influence label computation, i.e. to be
interpreted in the labels world
success if Term can potentially be unified with Label in the
label world, fail otherwise – only if this check succeeds, the
labelled variable is actually unified with the term.
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 21 / 34
Prototype in tuProlog The language extension
The language extension II
The Java language level
Variable/Label association — Label
is a just a new property of the existing Variable class
Function fL — Label labelGenerate(Label l1, Label l2)
Java method to embed fL behaviour
Label-interpreted terms — boolean labelInterpret(Label l, Term t)
to enable terms to be interpreted in labels world
The abstract class LabelUnifier is provided for the user’s convenience:
to define a new Labelled Variable Model, the user can just extend it.
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 22 / 34
Case studies
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 23 / 34
Case studies Interval CLP
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 24 / 34
Case studies Interval CLP
Interval CLP
Variables are labelled with their admissible numeric interval—that is,
X◦[A,B] means that X can span over the range [A..B]
Unification succeeds if two numeric intervals overlap, in which case
the intersected interval is the newly-computed label.
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 25 / 34
Case studies Dress Selection
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 26 / 34
Case studies Dress Selection
Dress Selection Colour Constraints I
The goal is to select from the wardrobe all the shirts that respect
some given colour constraints: domain of labels → shirts and colours
shirt(Colour,Description ) represents a shirt with of colour
Colour (in RGB rgb(Red,Green,Blue )), described by
Description
Wardrobe content representation:
shirt(Argb(255,240,245)
, pink blouse).
shirt(Brgb(255,222,173)
, yellow tshirt).
shirt(Crgb(119,136,153)
, army tshirt).
shirt(Drgb(188,143,143)
, periwinkle blouse).
shirt(Ergb(255,245,238)
, cream blouse).
Two RGB colours are considered similar if their distance is below a
given threshold
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 27 / 34
Case studies Dress Selection
Dress Selection Colour Constraints II
fL function, checking if two given labels are to be considered similar:
fL(c1, c2) =
c2 if euclidean distance(c1, c2) ≤ threshold ∈ [0..100]
{} if euclidean distance(c1, c2) > threshold ∈ [0..100]
No constraints on target colour Target colour papaya
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 28 / 34
Conclusions & Further Work
Outline
1 Scope & Goals
2 The Labelled Variables Model in Logic Programming
Unification rules
Examples
3 Prototype in tuProlog
System architecture
The language extension
4 Case studies
Interval CLP
Dress Selection
5 Conclusions & Further Work
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 29 / 34
Conclusions & Further Work
Conclusions
We presented the new Labelled tuProlog
Our first step for making logic-based technologies fit the requirements
of nowadays pervasive system
Labelled tuProlog
Making it possible to spread intelligence via a light-weight Prolog engine
supporting domain-specific situated computations via labelled variables
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 30 / 34
Conclusions & Further Work
Further Work
Several extensions and further comparisons, in different directions, are
worth considering, we intend to:
formalise, with Labelled tuProlog, some well-known scenarios like
Constraints Logic Programming, Attributed Variable and Modal Logic
extend labelling to formulas → we believe the issue of applying labels
to formulas, as suggested by [Gabbay, 1996], can open the way to
more complex scenarios like fuzzy logic and stochastic computing
analyse and integrate other LP frameworks
explore and model, with Labelled tuProlog, domain specific
application (e.g. health-care, home-based devices, sensor networks,...)
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 31 / 34
Conclusions & Further Work
Thanks
Thank you for your attention
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 32 / 34
References
References I
Fruhwirth, T. (1998).
Theory and practice of constraint handling rules.
The Journal of Logic Programming, 37(13):95 – 138.
Gabbay, D. M. (1996).
Labelled Deductive Systems, Volume 1.
Clarendon Press, Oxford Logic Guides 33.
Holzbaur, C. (1992).
Metastructures vs. attributed variables in the context of extensible unification.
In Bruynooghe, M. and Wirsing, M., editors, Programming Language Implementation and
Logic Programming, volume 631 of LNCS, pages 260–268. Springer.
Jaffar, J. and Lassez, J.-L. (1987).
Constraint logic programming.
In Proceedings of the 14th ACM SIGACT-SIGPLAN Symposium on Principles of
Programming Languages, POPL ’87, pages 111–119, New York, NY, USA. ACM.
Neumerkel, U. (1990).
Extensible Unification by Metastructures.
In META90.
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 33 / 34
Labelled Variables in Logic Programming:
A First Prototype in tuProlog
Roberta Calegari, Enrico Denti, Andrea Omicini
{roberta.calegari, enrico.denti, andrea.omicini}@unibo.it
DISI
Alma Mater Studiorum—Universit`a di Bologna
Talk @ 14th Conference of the Italian Association for Artificial
Intelligence
University of Ferrara - 23rd September 2015
R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 34 / 34

Mais conteúdo relacionado

Mais procurados

GENERATING PYTHON CODE FROM OBJECT-Z SPECIFICATIONS
GENERATING PYTHON CODE FROM OBJECT-Z SPECIFICATIONSGENERATING PYTHON CODE FROM OBJECT-Z SPECIFICATIONS
GENERATING PYTHON CODE FROM OBJECT-Z SPECIFICATIONSijseajournal
 
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-IssueCodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-IssueDhaval Dalal
 
Learning R via Python…or the other way around
Learning R via Python…or the other way aroundLearning R via Python…or the other way around
Learning R via Python…or the other way aroundSid Xing
 
C# programming : Chapter One
C# programming : Chapter OneC# programming : Chapter One
C# programming : Chapter OneKhairi Aiman
 
Programming In C++
Programming In C++ Programming In C++
Programming In C++ shammi mehra
 
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)Deep Learning Italia
 
Implementation
ImplementationImplementation
Implementationadil raja
 
A Distributed Tableau Algorithm for Package-based Description Logics
A Distributed Tableau Algorithm for Package-based Description LogicsA Distributed Tableau Algorithm for Package-based Description Logics
A Distributed Tableau Algorithm for Package-based Description LogicsJie Bao
 
(Costless) Software Abstractions for Parallel Architectures
(Costless) Software Abstractions for Parallel Architectures(Costless) Software Abstractions for Parallel Architectures
(Costless) Software Abstractions for Parallel ArchitecturesJoel Falcou
 
HDR Defence - Software Abstractions for Parallel Architectures
HDR Defence - Software Abstractions for Parallel ArchitecturesHDR Defence - Software Abstractions for Parallel Architectures
HDR Defence - Software Abstractions for Parallel ArchitecturesJoel Falcou
 
4 4 Exponential And Logarithmic Equations
4 4 Exponential And Logarithmic Equations4 4 Exponential And Logarithmic Equations
4 4 Exponential And Logarithmic Equationssilvia
 
Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programmingHaris Bin Zahid
 

Mais procurados (20)

GENERATING PYTHON CODE FROM OBJECT-Z SPECIFICATIONS
GENERATING PYTHON CODE FROM OBJECT-Z SPECIFICATIONSGENERATING PYTHON CODE FROM OBJECT-Z SPECIFICATIONS
GENERATING PYTHON CODE FROM OBJECT-Z SPECIFICATIONS
 
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-IssueCodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
 
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
 
Learning R via Python…or the other way around
Learning R via Python…or the other way aroundLearning R via Python…or the other way around
Learning R via Python…or the other way around
 
Scoping
ScopingScoping
Scoping
 
C# programming : Chapter One
C# programming : Chapter OneC# programming : Chapter One
C# programming : Chapter One
 
Programming In C++
Programming In C++ Programming In C++
Programming In C++
 
Procedural programming
Procedural programmingProcedural programming
Procedural programming
 
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
 
Lecture 21 22
Lecture 21 22Lecture 21 22
Lecture 21 22
 
Introduction to c++ ppt
Introduction to c++ pptIntroduction to c++ ppt
Introduction to c++ ppt
 
Implementation
ImplementationImplementation
Implementation
 
A Distributed Tableau Algorithm for Package-based Description Logics
A Distributed Tableau Algorithm for Package-based Description LogicsA Distributed Tableau Algorithm for Package-based Description Logics
A Distributed Tableau Algorithm for Package-based Description Logics
 
(Costless) Software Abstractions for Parallel Architectures
(Costless) Software Abstractions for Parallel Architectures(Costless) Software Abstractions for Parallel Architectures
(Costless) Software Abstractions for Parallel Architectures
 
HDR Defence - Software Abstractions for Parallel Architectures
HDR Defence - Software Abstractions for Parallel ArchitecturesHDR Defence - Software Abstractions for Parallel Architectures
HDR Defence - Software Abstractions for Parallel Architectures
 
4 4 Exponential And Logarithmic Equations
4 4 Exponential And Logarithmic Equations4 4 Exponential And Logarithmic Equations
4 4 Exponential And Logarithmic Equations
 
Introduction to programing languages part 2
Introduction to programing languages   part 2Introduction to programing languages   part 2
Introduction to programing languages part 2
 
Introduction to programing languages part 3
Introduction to programing languages part 3Introduction to programing languages part 3
Introduction to programing languages part 3
 
Presentation1
Presentation1Presentation1
Presentation1
 
Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programming
 

Semelhante a Labelled Variables in Logic Programming: A First Prototipe in tuProlog

Coclustering Base Classification For Out Of Domain Documents
Coclustering Base Classification For Out Of Domain DocumentsCoclustering Base Classification For Out Of Domain Documents
Coclustering Base Classification For Out Of Domain Documentslau
 
How to Analyze the Results of LinearPrograms—Part 1 Prelimi.docx
How to Analyze the Results of LinearPrograms—Part 1 Prelimi.docxHow to Analyze the Results of LinearPrograms—Part 1 Prelimi.docx
How to Analyze the Results of LinearPrograms—Part 1 Prelimi.docxpooleavelina
 
Cs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer KeyCs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer Keyappasami
 
Pattern-Level Programming with Asteroid
Pattern-Level Programming with AsteroidPattern-Level Programming with Asteroid
Pattern-Level Programming with Asteroidijpla
 
A Program Transformation Technique To Support AOP Within C Template
A Program Transformation Technique To Support AOP Within C   TemplateA Program Transformation Technique To Support AOP Within C   Template
A Program Transformation Technique To Support AOP Within C TemplateCrystal Sanchez
 
SBML FOR OPTIMIZING DECISION SUPPORT'S TOOLS
SBML FOR OPTIMIZING DECISION SUPPORT'S TOOLS SBML FOR OPTIMIZING DECISION SUPPORT'S TOOLS
SBML FOR OPTIMIZING DECISION SUPPORT'S TOOLS cscpconf
 
CONTEXT-AWARE CLUSTERING USING GLOVE AND K-MEANS
CONTEXT-AWARE CLUSTERING USING GLOVE AND K-MEANSCONTEXT-AWARE CLUSTERING USING GLOVE AND K-MEANS
CONTEXT-AWARE CLUSTERING USING GLOVE AND K-MEANSijseajournal
 
Abstracting Strings For Model Checking Of C Programs
Abstracting Strings For Model Checking Of C ProgramsAbstracting Strings For Model Checking Of C Programs
Abstracting Strings For Model Checking Of C ProgramsMartha Brown
 
LARGE LANGUAGE MODELS FOR CIPHERS
LARGE LANGUAGE MODELS FOR CIPHERSLARGE LANGUAGE MODELS FOR CIPHERS
LARGE LANGUAGE MODELS FOR CIPHERSgerogepatton
 
LARGE LANGUAGE MODELS FOR CIPHERS
LARGE LANGUAGE MODELS FOR CIPHERSLARGE LANGUAGE MODELS FOR CIPHERS
LARGE LANGUAGE MODELS FOR CIPHERSgerogepatton
 
Propagation of Policies in Rich Data Flows
Propagation of Policies in Rich Data FlowsPropagation of Policies in Rich Data Flows
Propagation of Policies in Rich Data FlowsEnrico Daga
 
Future Programming Language
Future Programming LanguageFuture Programming Language
Future Programming LanguageYLTO
 
Multi-label learning by extended multi-tier stacked ensemble method with labe...
Multi-label learning by extended multi-tier stacked ensemble method with labe...Multi-label learning by extended multi-tier stacked ensemble method with labe...
Multi-label learning by extended multi-tier stacked ensemble method with labe...IJECEIAES
 
A Validation of Object-Oriented Design Metrics as Quality Indicators
A Validation of Object-Oriented Design Metrics as Quality IndicatorsA Validation of Object-Oriented Design Metrics as Quality Indicators
A Validation of Object-Oriented Design Metrics as Quality Indicatorsvie_dels
 
Information extraction for Free Text
Information extraction for Free TextInformation extraction for Free Text
Information extraction for Free Textbutest
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory buildingClarkTony
 

Semelhante a Labelled Variables in Logic Programming: A First Prototipe in tuProlog (20)

Generics
GenericsGenerics
Generics
 
Coclustering Base Classification For Out Of Domain Documents
Coclustering Base Classification For Out Of Domain DocumentsCoclustering Base Classification For Out Of Domain Documents
Coclustering Base Classification For Out Of Domain Documents
 
How to Analyze the Results of LinearPrograms—Part 1 Prelimi.docx
How to Analyze the Results of LinearPrograms—Part 1 Prelimi.docxHow to Analyze the Results of LinearPrograms—Part 1 Prelimi.docx
How to Analyze the Results of LinearPrograms—Part 1 Prelimi.docx
 
Cs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer KeyCs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer Key
 
Pattern-Level Programming with Asteroid
Pattern-Level Programming with AsteroidPattern-Level Programming with Asteroid
Pattern-Level Programming with Asteroid
 
A Program Transformation Technique To Support AOP Within C Template
A Program Transformation Technique To Support AOP Within C   TemplateA Program Transformation Technique To Support AOP Within C   Template
A Program Transformation Technique To Support AOP Within C Template
 
SBML FOR OPTIMIZING DECISION SUPPORT'S TOOLS
SBML FOR OPTIMIZING DECISION SUPPORT'S TOOLS SBML FOR OPTIMIZING DECISION SUPPORT'S TOOLS
SBML FOR OPTIMIZING DECISION SUPPORT'S TOOLS
 
Slides chapters 28-32
Slides chapters 28-32Slides chapters 28-32
Slides chapters 28-32
 
Topicmodels
TopicmodelsTopicmodels
Topicmodels
 
CONTEXT-AWARE CLUSTERING USING GLOVE AND K-MEANS
CONTEXT-AWARE CLUSTERING USING GLOVE AND K-MEANSCONTEXT-AWARE CLUSTERING USING GLOVE AND K-MEANS
CONTEXT-AWARE CLUSTERING USING GLOVE AND K-MEANS
 
Abstracting Strings For Model Checking Of C Programs
Abstracting Strings For Model Checking Of C ProgramsAbstracting Strings For Model Checking Of C Programs
Abstracting Strings For Model Checking Of C Programs
 
LARGE LANGUAGE MODELS FOR CIPHERS
LARGE LANGUAGE MODELS FOR CIPHERSLARGE LANGUAGE MODELS FOR CIPHERS
LARGE LANGUAGE MODELS FOR CIPHERS
 
LARGE LANGUAGE MODELS FOR CIPHERS
LARGE LANGUAGE MODELS FOR CIPHERSLARGE LANGUAGE MODELS FOR CIPHERS
LARGE LANGUAGE MODELS FOR CIPHERS
 
Propagation of Policies in Rich Data Flows
Propagation of Policies in Rich Data FlowsPropagation of Policies in Rich Data Flows
Propagation of Policies in Rich Data Flows
 
Future Programming Language
Future Programming LanguageFuture Programming Language
Future Programming Language
 
Multi-label learning by extended multi-tier stacked ensemble method with labe...
Multi-label learning by extended multi-tier stacked ensemble method with labe...Multi-label learning by extended multi-tier stacked ensemble method with labe...
Multi-label learning by extended multi-tier stacked ensemble method with labe...
 
CommitBERT.pdf
CommitBERT.pdfCommitBERT.pdf
CommitBERT.pdf
 
A Validation of Object-Oriented Design Metrics as Quality Indicators
A Validation of Object-Oriented Design Metrics as Quality IndicatorsA Validation of Object-Oriented Design Metrics as Quality Indicators
A Validation of Object-Oriented Design Metrics as Quality Indicators
 
Information extraction for Free Text
Information extraction for Free TextInformation extraction for Free Text
Information extraction for Free Text
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory building
 

Último

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 

Último (20)

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 

Labelled Variables in Logic Programming: A First Prototipe in tuProlog

  • 1. Labelled Variables in Logic Programming: A First Prototype in tuProlog Roberta Calegari, Enrico Denti, Andrea Omicini {roberta.calegari, enrico.denti, andrea.omicini}@unibo.it DISI Alma Mater Studiorum—Universit`a di Bologna Talk @ 14th Conference of the Italian Association for Artificial Intelligence University of Ferrara - 23rd September 2015 R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 1 / 34
  • 2. Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 2 / 34
  • 3. Scope & Goals Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 3 / 34
  • 4. Scope & Goals Context and Motivation Explore models and technologies to face the challenges of pervasive system complex distributed situated intelligent From distributed intelligence towards distributed situated intelligence situated (intelligent) component for pervasive (intelligent) systems Logic Programming (LP) extensions for interacting with the environment Prodromes of situated LP Forms of control which generalises data-driven computation, e.g. CLP [Jaffar and Lassez, 1987] Ability to be domain-specific – e.g. CHR [Fruhwirth, 1998] However they are designed against a landscape different from nowadays pervasive systems. R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 4 / 34
  • 5. Scope & Goals Archeology [Jaffar and Lassez, 1987] defines CLP as a merger of two declarative paradigms: constraint solving and logic programming → capability for reasoning in the specific finite domain of application [Fruhwirth, 1998] introduces CHR as a high-level and declarative language for implementing constraint solver. User-defined constraints led to widely domain applications (constraint solving, type checking, natural language processing, multi-agent systems,...) [Neumerkel, 1990] presentes metastructures to extend syntactic unification: data types whose (unification) semantics are specified by user-defined predicates [Holzbaur, 1992] introduces attributed variables as mechanism to support of CLP languages, yet inside the LP context [Gabbay, 1996] introduces Labelled Deductive System: general notion of label and a new unifying methodology for logic R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 5 / 34
  • 6. Scope & Goals Goals Aim To devise out simple and expressive mechanisms enabling data-driven and domain specific within a LP framework To acquire information from any source of data (constraint store, data base, sensors,...) → infer knowledge Method Investigating LP extension based on labelled variables 1 To define a labelled variables logic programming model where labels are exploited to define computations in domain-specific contexts 2 To exploit labelled variables for enabling computations at a separate level, while retaining the general coherence of the LP approach 3 To present a first prototype of Labelled tuProlog R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 6 / 34
  • 7. Scope & Goals Conceptual Architecture R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 7 / 34
  • 8. The Labelled Variables Model in Logic Programming Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 8 / 34
  • 9. The Labelled Variables Model in Logic Programming The Labelled Variables Model in Logic Programming Defined by: a set of basic labels B, where b ∈ B is the generic basic label here taking the form of a logic term, i.e. B ⊆ T ; a set of labels L , where l ∈ L is a generic label defined as a set of basic labels, i.e. l = {b1, .., bn}; a labelling association denoted as v, l that associates the label l to the variable v. Unification of two labelled variables Represented by tuple (true/false, θ, label): true/false represents if there is an answer θ represents the most general substitution label represents the new label associated to the unified variables R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 9 / 34
  • 10. The Labelled Variables Model in Logic Programming Unification rules Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 10 / 34
  • 11. The Labelled Variables Model in Logic Programming Unification rules Unification Rules Combining function fL to synthesise a new label from two given ones. i.e. combine two different labels: fL : L xL → L The function embeds the scenario-specific criterion for defining a new label → domain specific computation R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 11 / 34
  • 12. The Labelled Variables Model in Logic Programming Examples Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 12 / 34
  • 13. The Labelled Variables Model in Logic Programming Examples Examples I Arithmetic Inequalities 1/2 Basic labels are arithmetic intervals: b ∈ B takes one of the following forms (where a3, a5 can also be −∞, while a4, a8 can also be +∞) b = [a1, a2] = {x ∈ R| a1 ≤ x ≤ a2, a1, a2 ∈ R} b = ]a3, a4[ = {x ∈ R| a3 < x < a4, a3, a4 ∈ R} b = ]a5, a6] = {x ∈ R| a5 < x ≤ a6, a5, a6 ∈ R} b = [a7, a8[ = {x ∈ R| a7 ≤ x < a8, a7, a8 ∈ R} The combining function fL intersects intervals Given l1 = {b11, ..b1n} and l2 = {b21, ..b2m}, the resulting label defined as the union of all the possible intersections: fL : (l1, l2) = fL({b11, ..b1n}, {b21, ..b2m}) = {{(b11 ∩ b21) ∪ .. ∪ (b11 ∩ b2m)}, ..., {(b1n ∩ b21) ∪ .. ∪ (b1n ∩ b2m)}} R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 13 / 34
  • 14. The Labelled Variables Model in Logic Programming Examples Examples II Arithmetic Inequalities 2/2 For instance, let X and Y two variables involved in two inequalities, with the following constraints: X{[3..5],[9..10]} Y {[8..10]} If these labels are eventually combined, the new label l3 obtained by applying fL results: l1 = {[3..5], [9..10]} l2 = {[8..10]} l3 = fL(l1, l2) = fL({[3..5], [9..10]}, [8..10]) = = {([3..5] ∩ [8..10]) ∪ ([9..10] ∩ [8..10])} = [9..10] R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 14 / 34
  • 15. The Labelled Variables Model in Logic Programming Examples Examples III RGB colour space 1/2 Basic labels assume the syntax of RGB triplet, so that b = (r, g, b) = {r, g, b ∈ N| 0 ≤ r, g, b ≤ 255} Label l ∈ L becomes the singleton l = (r, g, b) The combining function fL is supposed to blend colours according to the specific application needs: computing the arithmetic mean of the colour component labels fL(l1, l2) = fL((r1, g1, b1), (r2, g2, b2)) = r1 + r2 2 , g1 + g2 2 , b1 + b2 2 = l3 R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 15 / 34
  • 16. The Labelled Variables Model in Logic Programming Examples Examples IV RGB colour space 2/2 Let X represent a red object, Y a yellow one and Z a blue one: X(255,0,0) Y (255,255,0) Z(0,0,255) Combining X with Y according to the combine criterion embedded in fL leads to: l1 = (255, 0, 0) l2 = (255, 255, 0) l3 = fL(l1, l2) = ((255, 0, 0), (255, 255, 0)) = (255, 128, 0) = l3 Combining X with Z, instead, would lead to a violet label l4 = (128, 0, 128) R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 16 / 34
  • 17. Prototype in tuProlog Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 17 / 34
  • 18. Prototype in tuProlog System architecture Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 18 / 34
  • 19. Prototype in tuProlog System architecture System architecture tuProlog Architecture minimal Prolog virtual machine available as a self-contained object featuring a simple interface dynamically linkable and dischargeable libraries of predicates Labelled tuProlog extension libraries of Prolog predicates suitable Java methods Extend the built-in unification by user-definition semantics ↓ enabling data-driven & domain specific computation R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 19 / 34
  • 20. Prototype in tuProlog The language extension Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 20 / 34
  • 21. Prototype in tuProlog The language extension The language extension I The Prolog language level Variable/Label association — label associate(+Var, +Label ) to associate variable Var to label Label — as ◦/2 operator Function fL — label generate(+Label1, +Label2, -Label3 ) to specify how to build a new label from two given ones Label-interpreted terms — label interpret(+Label, +Term ) to enable terms to influence label computation, i.e. to be interpreted in the labels world success if Term can potentially be unified with Label in the label world, fail otherwise – only if this check succeeds, the labelled variable is actually unified with the term. R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 21 / 34
  • 22. Prototype in tuProlog The language extension The language extension II The Java language level Variable/Label association — Label is a just a new property of the existing Variable class Function fL — Label labelGenerate(Label l1, Label l2) Java method to embed fL behaviour Label-interpreted terms — boolean labelInterpret(Label l, Term t) to enable terms to be interpreted in labels world The abstract class LabelUnifier is provided for the user’s convenience: to define a new Labelled Variable Model, the user can just extend it. R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 22 / 34
  • 23. Case studies Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 23 / 34
  • 24. Case studies Interval CLP Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 24 / 34
  • 25. Case studies Interval CLP Interval CLP Variables are labelled with their admissible numeric interval—that is, X◦[A,B] means that X can span over the range [A..B] Unification succeeds if two numeric intervals overlap, in which case the intersected interval is the newly-computed label. R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 25 / 34
  • 26. Case studies Dress Selection Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 26 / 34
  • 27. Case studies Dress Selection Dress Selection Colour Constraints I The goal is to select from the wardrobe all the shirts that respect some given colour constraints: domain of labels → shirts and colours shirt(Colour,Description ) represents a shirt with of colour Colour (in RGB rgb(Red,Green,Blue )), described by Description Wardrobe content representation: shirt(Argb(255,240,245) , pink blouse). shirt(Brgb(255,222,173) , yellow tshirt). shirt(Crgb(119,136,153) , army tshirt). shirt(Drgb(188,143,143) , periwinkle blouse). shirt(Ergb(255,245,238) , cream blouse). Two RGB colours are considered similar if their distance is below a given threshold R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 27 / 34
  • 28. Case studies Dress Selection Dress Selection Colour Constraints II fL function, checking if two given labels are to be considered similar: fL(c1, c2) = c2 if euclidean distance(c1, c2) ≤ threshold ∈ [0..100] {} if euclidean distance(c1, c2) > threshold ∈ [0..100] No constraints on target colour Target colour papaya R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 28 / 34
  • 29. Conclusions & Further Work Outline 1 Scope & Goals 2 The Labelled Variables Model in Logic Programming Unification rules Examples 3 Prototype in tuProlog System architecture The language extension 4 Case studies Interval CLP Dress Selection 5 Conclusions & Further Work R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 29 / 34
  • 30. Conclusions & Further Work Conclusions We presented the new Labelled tuProlog Our first step for making logic-based technologies fit the requirements of nowadays pervasive system Labelled tuProlog Making it possible to spread intelligence via a light-weight Prolog engine supporting domain-specific situated computations via labelled variables R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 30 / 34
  • 31. Conclusions & Further Work Further Work Several extensions and further comparisons, in different directions, are worth considering, we intend to: formalise, with Labelled tuProlog, some well-known scenarios like Constraints Logic Programming, Attributed Variable and Modal Logic extend labelling to formulas → we believe the issue of applying labels to formulas, as suggested by [Gabbay, 1996], can open the way to more complex scenarios like fuzzy logic and stochastic computing analyse and integrate other LP frameworks explore and model, with Labelled tuProlog, domain specific application (e.g. health-care, home-based devices, sensor networks,...) R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 31 / 34
  • 32. Conclusions & Further Work Thanks Thank you for your attention R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 32 / 34
  • 33. References References I Fruhwirth, T. (1998). Theory and practice of constraint handling rules. The Journal of Logic Programming, 37(13):95 – 138. Gabbay, D. M. (1996). Labelled Deductive Systems, Volume 1. Clarendon Press, Oxford Logic Guides 33. Holzbaur, C. (1992). Metastructures vs. attributed variables in the context of extensible unification. In Bruynooghe, M. and Wirsing, M., editors, Programming Language Implementation and Logic Programming, volume 631 of LNCS, pages 260–268. Springer. Jaffar, J. and Lassez, J.-L. (1987). Constraint logic programming. In Proceedings of the 14th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, POPL ’87, pages 111–119, New York, NY, USA. ACM. Neumerkel, U. (1990). Extensible Unification by Metastructures. In META90. R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 33 / 34
  • 34. Labelled Variables in Logic Programming: A First Prototype in tuProlog Roberta Calegari, Enrico Denti, Andrea Omicini {roberta.calegari, enrico.denti, andrea.omicini}@unibo.it DISI Alma Mater Studiorum—Universit`a di Bologna Talk @ 14th Conference of the Italian Association for Artificial Intelligence University of Ferrara - 23rd September 2015 R. C., E. D., A. O. (DISI, Alma Mater) Labelled Variables LP AI*IA-DC, 23/9/2015 34 / 34