-
(Similarity-based) Qualified Logic ProgrammingA General Overview
Carlos A. Romero-D́ıaz
Grupo de Programación DeclarativaDSIC - Universidad Complutense de Madrid, Spain
Università di Salerno (Italy)December 2008
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 1 / 1
-
Introduction
Motivation:I Work out an expressive framework for Constraint Funcional-Logic
Programming with uncertainty.I In particular, extend the multiparadigm language T OY with support
for uncertainty and maybe more.
Planning:I Two main phases to develop:
1 Framework for (Constraint) Logic Programming.2 Extend the previous framework with non-deterministic lazy functions
and constraints (that is, Constraint Functional-Logic Programming).
This talk is focused on the actual results of the first phase.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 2 / 1
-
Introduction
Motivation:I Work out an expressive framework for Constraint Funcional-Logic
Programming with uncertainty.I In particular, extend the multiparadigm language T OY with support
for uncertainty and maybe more.
Planning:I Two main phases to develop:
1 Framework for (Constraint) Logic Programming.2 Extend the previous framework with non-deterministic lazy functions
and constraints (that is, Constraint Functional-Logic Programming).
This talk is focused on the actual results of the first phase.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 2 / 1
-
Introduction (II): Starting the work
1 Search for fundamental works in the field to start our investigation:taken as base a seminal paper by van Emden based in a previous oneby Shapiro.
2 Revise the early proposal by van Emden (1986): Quantitative LogicProgramming and improve it in two ways:
I generalizing van Emden’s QLP to a generic scheme parametrized by aqualification domain D.
I generalizing van Emden’s results by providing stronger ones, both indeclarative semantics and goal solving.
Obtaining as result a basic QLP(D).3 Extending QLP(D) with characteristics of other related approaches as
similarity-based reasoning, and improving its expresiveness withthreshold constraints (annotations in the body of clauses).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 3 / 1
-
Introduction (II): Starting the work
1 Search for fundamental works in the field to start our investigation:taken as base a seminal paper by van Emden based in a previous oneby Shapiro.
2 Revise the early proposal by van Emden (1986): Quantitative LogicProgramming and improve it in two ways:
I generalizing van Emden’s QLP to a generic scheme parametrized by aqualification domain D.
I generalizing van Emden’s results by providing stronger ones, both indeclarative semantics and goal solving.
Obtaining as result a basic QLP(D).
3 Extending QLP(D) with characteristics of other related approaches assimilarity-based reasoning, and improving its expresiveness withthreshold constraints (annotations in the body of clauses).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 3 / 1
-
Introduction (II): Starting the work
1 Search for fundamental works in the field to start our investigation:taken as base a seminal paper by van Emden based in a previous oneby Shapiro.
2 Revise the early proposal by van Emden (1986): Quantitative LogicProgramming and improve it in two ways:
I generalizing van Emden’s QLP to a generic scheme parametrized by aqualification domain D.
I generalizing van Emden’s results by providing stronger ones, both indeclarative semantics and goal solving.
Obtaining as result a basic QLP(D).3 Extending QLP(D) with characteristics of other related approaches as
similarity-based reasoning, and improving its expresiveness withthreshold constraints (annotations in the body of clauses).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 3 / 1
-
Introduction (and III): Van Emden’s proposal
Van Emden considered Quantitative Logic Programs as sets of clausesof the form:
A← f − B1, . . . ,Bnfor which the certainty being propagated to a clause head was f × bwhere:
f - attenuation factor with f ∈ (0, 1]b - minimum of the certainty factors known for the body atoms
This approach led to:
- general results on model theoretic and fixpoint semantics (similar tothose for classical LP)
- procedure for computing the certainty factors in the least Herbrandmodel of a given program by an alpha-beta heruristic (only for groundatoms with finite search trees)
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 4 / 1
-
Introduction (and III): Van Emden’s proposal
Van Emden considered Quantitative Logic Programs as sets of clausesof the form:
A← f − B1, . . . ,Bnfor which the certainty being propagated to a clause head was f × bwhere:
f - attenuation factor with f ∈ (0, 1]b - minimum of the certainty factors known for the body atoms
This approach led to:
- general results on model theoretic and fixpoint semantics (similar tothose for classical LP)
- procedure for computing the certainty factors in the least Herbrandmodel of a given program by an alpha-beta heruristic (only for groundatoms with finite search trees)
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 4 / 1
-
Contents
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 5 / 1
-
Qualification Domains
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 6 / 1
-
Qualification Domains: Axioms
Structure D = 〈D,v,⊥,>, ◦〉 such that:- 〈D,v,⊥,>〉 is a lattice with extreme points ⊥ and > w.r.t. v.- ◦ : D × D → D, called attenuation operation, verifies:
(a) ◦ is associative, commutative and monotonic w.r.t. v.(b) ∀d ∈ D : d ◦ > = d .(c) ∀d ∈ D : d ◦ ⊥ = ⊥ .(d) ∀d , e ∈ D \ {⊥,>} : d ◦ e @ e .(e) ∀d , e1, e2 ∈ D : d ◦ (e1 u e2) = d ◦ e1 u d ◦ e2 .
We generalize van Emden’s QLP to QLP(D) where:- qualification values d ∈ D \ {⊥} instead of d ∈ (0, 1] .- the glb operator
dinstead of min .
- ◦ instead of × (product).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 7 / 1
-
Qualification Domains: Axioms
Structure D = 〈D,v,⊥,>, ◦〉 such that:- 〈D,v,⊥,>〉 is a lattice with extreme points ⊥ and > w.r.t. v.- ◦ : D × D → D, called attenuation operation, verifies:
(a) ◦ is associative, commutative and monotonic w.r.t. v.(b) ∀d ∈ D : d ◦ > = d .(c) ∀d ∈ D : d ◦ ⊥ = ⊥ .(d) ∀d , e ∈ D \ {⊥,>} : d ◦ e @ e .(e) ∀d , e1, e2 ∈ D : d ◦ (e1 u e2) = d ◦ e1 u d ◦ e2 .
We generalize van Emden’s QLP to QLP(D) where:- qualification values d ∈ D \ {⊥} instead of d ∈ (0, 1] .- the glb operator
dinstead of min .
- ◦ instead of × (product).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 7 / 1
-
Qualification Domains (and II): Instances
B = ({0, 1},≤, 0, 1,∧) (Classical Boolean Values).U = ([0, 1],≤, 0, 1,×) (van Emden’s Certainty Degrees).W = ([0,∞],≥,∞, 0,+) (Proof trees’ depths).
The cartesian product D = D1×D2 of two given qualificationdomains is always another qualification domain.
Note: U×W qualifies both certainties and proof trees’ depths.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 8 / 1
-
Qualified Logic Programming
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 9 / 1
-
Syntax: Programs
Program: set of qualified definite Horn clauses of the form
A←α− B1, . . . ,Bk
with α ∈ D \ {⊥}.
Example 1
a) Instance U :cruel(X)
-
Syntax (II): Program Example
Example 2
domestic(cat)
-
Syntax (II): Program Example
Example 2
domestic(cat)
-
Syntax (II): Program Example
Example 2
domestic(cat)
-
Syntax (II): Program Example
Example 2
domestic(cat)
-
Syntax (II): Program Example
Example 2
domestic(cat)#0.8
-
Syntax (II): Program Example
Example 2
domestic(cat)#0.8
-
Syntax (II): Program Example
Example 2
domestic(cat)#0.8
-
Syntax (and III): Interpretations and Models
- D-qualified atom: A ] d .- Open D-qualified atom: A ]W (W is intended to take values over
D \ {⊥}).
D-entailment relation: is defined as A ] d
-
Declarative Semantics: Qualified Horn Logic
Qualified Horn Logic over D: is defined as a deductive systemconsisting just of one inference rule QMP(D). If there is someinstance rule (A←α− B1, . . . ,Bk) ∈ [C ] for some C ∈ P andd v α ◦
d{d1, . . . , dk}, the following inference step is allowed:
B1 ] d1 · · · Bk ] dkA ] d
Least Herbrand model of P:
MP = {A ] d | P `QHL(D) A ] d}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 13 / 1
-
Declarative Semantics: Qualified Horn Logic
Qualified Horn Logic over D: is defined as a deductive systemconsisting just of one inference rule QMP(D). If there is someinstance rule (A←α− B1, . . . ,Bk) ∈ [C ] for some C ∈ P andd v α ◦
d{d1, . . . , dk}, the following inference step is allowed:
B1 ] d1 · · · Bk ] dkA ] d
Least Herbrand model of P:
MP = {A ] d | P `QHL(D) A ] d}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 13 / 1
-
Declarative Semantics (and II)
Example 3
cruel(X)
-
Goals
Initial goals:
· · · ,Ai ]Wi , · · · 8 � 8 · · · ,Wi w βi , · · ·
General goals:
· · · ,Ai ]Wi , · · · 8 σ 8 · · · ,W ′ = d ◦l{W ′m}, · · · , d ◦Wi w βi , · · ·
Solved goals:
8 σ 8 · · · ,W ′ = d ◦l{W ′m}, · · ·
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 15 / 1
-
Goals
Initial goals:
· · · ,Ai ]Wi , · · · 8 � 8 · · · ,Wi w βi , · · ·
General goals:
· · · ,Ai ]Wi , · · · 8 σ 8 · · · ,W ′ = d ◦l{W ′m}, · · · , d ◦Wi w βi , · · ·
Solved goals:
8 σ 8 · · · ,W ′ = d ◦l{W ′m}, · · ·
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 15 / 1
-
Goals
Initial goals:
· · · ,Ai ]Wi , · · · 8 � 8 · · · ,Wi w βi , · · ·
General goals:
· · · ,Ai ]Wi , · · · 8 σ 8 · · · ,W ′ = d ◦l{W ′m}, · · · , d ◦Wi w βi , · · ·
Solved goals:
8 σ 8 · · · ,W ′ = d ◦l{W ′m}, · · ·
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 15 / 1
-
QSLD Resolution
Resolution step:
· · · ,A ]W , · · · 8 σ 8 · · · , d ◦W w β, · · · C1,σ1
(· · · ,B1 ]W1, · · · ,Bk ]Wk , · · · )σ1 8 σσ1 8 · · · ,α ◦ d ◦W1 w β, · · · , α ◦ d ◦Wk w β, · · · ,W = α ◦
d{W1, . . . ,Wk}, · · ·
where C1 ≡ (H ←α− B1, . . . ,Bk) ∈ P and σ1 the m.g.u. (A,H).
Resolution computations:
G0 σ1 G1 σ2 · · · σn Gn ≡ σ1σ2 · · ·σn 8 ∆n
with G0 initial and Gn solved, and the computed answer (σ, µ) whereσ = σ1σ2 · · ·σn and µ(W ) computed according to ∆n.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 16 / 1
-
QSLD Resolution (and II)
Example 4
eats(X,Y)#W | {} | W >= 0.20 eats.2,{X7→mother(X’)}
eats(X’,Y)#W1 | {X 7→ mother(X’)} |W = 0.70 * min {W1},0.70 * W1 >= 0.20 eats.1,{X’7→eve}
animal(Y)#W2 | {X 7→ mother(eve)} |W = 0.70 * min {W1},W1 = 0.300.30 * 0.70 * W2 >= 0.20 animal,{Y7→bird}
| {X 7→ mother(eve), Y 7→ bird} |W = 0.70 * min {W1},W1 = 0.30W2 = 1.0
Computed answer: {X 7→ mother(eve),Y 7→ bird} 8 {W 7→ 0.21}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 17 / 1
-
QSLD Resolution (and II)
Example 4
eats(X,Y)#W | {} | W >= 0.20 eats.2,{X7→mother(X’)}eats(X’,Y)#W1 | {X 7→ mother(X’)} |
W = 0.70 * min {W1},0.70 * W1 >= 0.20 eats.1,{X’7→eve}
animal(Y)#W2 | {X 7→ mother(eve)} |W = 0.70 * min {W1},W1 = 0.300.30 * 0.70 * W2 >= 0.20 animal,{Y7→bird}
| {X 7→ mother(eve), Y 7→ bird} |W = 0.70 * min {W1},W1 = 0.30W2 = 1.0
Computed answer: {X 7→ mother(eve),Y 7→ bird} 8 {W 7→ 0.21}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 17 / 1
-
QSLD Resolution (and II)
Example 4
eats(X,Y)#W | {} | W >= 0.20 eats.2,{X7→mother(X’)}eats(X’,Y)#W1 | {X 7→ mother(X’)} |
W = 0.70 * min {W1},0.70 * W1 >= 0.20 eats.1,{X’7→eve}
animal(Y)#W2 | {X 7→ mother(eve)} |W = 0.70 * min {W1},W1 = 0.300.30 * 0.70 * W2 >= 0.20 animal,{Y7→bird}
| {X 7→ mother(eve), Y 7→ bird} |W = 0.70 * min {W1},W1 = 0.30W2 = 1.0
Computed answer: {X 7→ mother(eve),Y 7→ bird} 8 {W 7→ 0.21}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 17 / 1
-
QSLD Resolution (and II)
Example 4
eats(X,Y)#W | {} | W >= 0.20 eats.2,{X7→mother(X’)}eats(X’,Y)#W1 | {X 7→ mother(X’)} |
W = 0.70 * min {W1},0.70 * W1 >= 0.20 eats.1,{X’7→eve}
animal(Y)#W2 | {X 7→ mother(eve)} |W = 0.70 * min {W1},W1 = 0.300.30 * 0.70 * W2 >= 0.20 animal,{Y7→bird}
| {X 7→ mother(eve), Y 7→ bird} |W = 0.70 * min {W1},W1 = 0.30W2 = 1.0
Computed answer: {X 7→ mother(eve),Y 7→ bird} 8 {W 7→ 0.21}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 17 / 1
-
QSLD Resolution (and II)
Example 4
eats(X,Y)#W | {} | W >= 0.20 eats.2,{X7→mother(X’)}eats(X’,Y)#W1 | {X 7→ mother(X’)} |
W = 0.70 * min {W1},0.70 * W1 >= 0.20 eats.1,{X’7→eve}
animal(Y)#W2 | {X 7→ mother(eve)} |W = 0.70 * min {W1},W1 = 0.300.30 * 0.70 * W2 >= 0.20 animal,{Y7→bird}
| {X 7→ mother(eve), Y 7→ bird} |W = 0.70 * min {W1},W1 = 0.30W2 = 1.0
Computed answer: {X 7→ mother(eve),Y 7→ bird} 8 {W 7→ 0.21}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 17 / 1
-
Properties of QSLD Resolution
Definition of Solution: A pair of substitutions (θ, ρ) is called solutionof a goal G ≡ A 8 σ 8 ∆ iff:
(i) θ = σθ .(ii) ρ ∈ Sol(∆) .(iii) P `QHL(D) Aθ ]W ρ for every annotated atom in A.
Soundness: Assume G0 ∗ G and G = σ 8 ∆ solved. Let (σ, µ) be thecomputed answer to G . Then (σ, µ) is a solution of G0.
Strong Completeness: Assume a given solution (θ, ρ) for G0 and any fixedstrategy for choosing the selected atom at each resolutionstep. Then there is some computed answer (σ, µ) for G0which is a more general solution than (θ, ρ).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 18 / 1
-
Properties of QSLD Resolution
Definition of Solution: A pair of substitutions (θ, ρ) is called solutionof a goal G ≡ A 8 σ 8 ∆ iff:
(i) θ = σθ .(ii) ρ ∈ Sol(∆) .(iii) P `QHL(D) Aθ ]W ρ for every annotated atom in A.
Soundness: Assume G0 ∗ G and G = σ 8 ∆ solved. Let (σ, µ) be thecomputed answer to G . Then (σ, µ) is a solution of G0.
Strong Completeness: Assume a given solution (θ, ρ) for G0 and any fixedstrategy for choosing the selected atom at each resolutionstep. Then there is some computed answer (σ, µ) for G0which is a more general solution than (θ, ρ).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 18 / 1
-
Implementation: translating to T OY
Requirement CLP or CFLP system with support for CD constraints.
C ≡ a(t)←α− b1(s1), . . . , bk(sk)
C t ≡ a(t,D,W ,Beta) ← α ◦ D w Beta,b1(s1, α ◦ D,W1,Beta),...bk(sk , α ◦ D,Wk ,Beta),W = α ◦
d{W1, . . . ,Wk}
G ≡ a1(t1) ]W1, . . . , am(tm) ]Wm 8 W1 w β1, . . . ,Wm w βm
G t ≡ a1(t1,>,W1, β1), . . . , am(tm,>,Wm, βm)
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 19 / 1
-
Implementation: translating to T OY
Requirement CLP or CFLP system with support for CD constraints.
C ≡ a(t)←α− b1(s1), . . . , bk(sk)
C t ≡ a(t,D,W ,Beta) ← α ◦ D w Beta,b1(s1, α ◦ D,W1,Beta),...bk(sk , α ◦ D,Wk ,Beta),W = α ◦
d{W1, . . . ,Wk}
G ≡ a1(t1) ]W1, . . . , am(tm) ]Wm 8 W1 w β1, . . . ,Wm w βm
G t ≡ a1(t1,>,W1, β1), . . . , am(tm,>,Wm, βm)
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 19 / 1
-
Similarity-basedQualified Logic Programming
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 20 / 1
-
Similarity-based Reasoning
Motivation:I Incorporating similarity-based reasoning in QLP.I Defining a global scheme for programming with qualifications and
similarities.I Showing the possibility of reducing similarities to qualifications.
Results:1 Declarative semantics for a Similarity-based Qualified Logic
Programming (SQLP) scheme.2 A SQLP program transformation to an equivalent QLP program ⇒
Goal Solving Procedure for QLP can be reused.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 21 / 1
-
Similarity-based Reasoning
Motivation:I Incorporating similarity-based reasoning in QLP.I Defining a global scheme for programming with qualifications and
similarities.I Showing the possibility of reducing similarities to qualifications.
Results:1 Declarative semantics for a Similarity-based Qualified Logic
Programming (SQLP) scheme.2 A SQLP program transformation to an equivalent QLP program ⇒
Goal Solving Procedure for QLP can be reused.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 21 / 1
-
Similarity Relations
- Traditional approach in SLP: R : S × S → [0, 1] defined as ageneralization of classical equivalence relations.
- R(x , y) : similarity degree between x and y .- For instance: R(farm, domestic) = 0.3.
D-valued similarity relation over S :
R : S × S → D
s.t. the following hold:
(a) Reflexivity: R(x , y) = >.(b) Symmetry: R(x , y) = R(y , x).(c) Transitivity: R(x , z) w R(x , y) uR(y , z).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 22 / 1
-
Similarity Relations
- Traditional approach in SLP: R : S × S → [0, 1] defined as ageneralization of classical equivalence relations.
- R(x , y) : similarity degree between x and y .- For instance: R(farm, domestic) = 0.3.
D-valued similarity relation over S :
R : S × S → D
s.t. the following hold:
(a) Reflexivity: R(x , y) = >.(b) Symmetry: R(x , y) = R(y , x).(c) Transitivity: R(x , z) w R(x , y) uR(y , z).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 22 / 1
-
Admissible relation R over a set of symbols S
If S = Var ] CS ] PS , and:
I R restricted to Var : R(X ,X ) = > and R(X ,Y ) = ⊥ if X 6= Y .I R(x , y) 6= ⊥ ⇒
(a) x and y are the same variable, or(b) x , y ∈ CSn (for arity n ≥ 0), or(c) x , y ∈ PSn (for arity n ≥ 0).
Definition: Extension of R to act over terms.
R(X ,X ) = > and R(X , t) = R(t,X ) = ⊥ if X 6= t.R(c(tn), c ′(t ′m)) = ⊥ if n 6= m.R(c(tn), c ′(t ′n)) = R(c, c ′) uR(t1, t ′1) u . . . uR(tn, t ′n).
(Analogously for atoms and clauses).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 23 / 1
-
Admissible relation R over a set of symbols S
If S = Var ] CS ] PS , and:I R restricted to Var : R(X ,X ) = > and R(X ,Y ) = ⊥ if X 6= Y .
I R(x , y) 6= ⊥ ⇒(a) x and y are the same variable, or(b) x , y ∈ CSn (for arity n ≥ 0), or(c) x , y ∈ PSn (for arity n ≥ 0).
Definition: Extension of R to act over terms.
R(X ,X ) = > and R(X , t) = R(t,X ) = ⊥ if X 6= t.R(c(tn), c ′(t ′m)) = ⊥ if n 6= m.R(c(tn), c ′(t ′n)) = R(c, c ′) uR(t1, t ′1) u . . . uR(tn, t ′n).
(Analogously for atoms and clauses).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 23 / 1
-
Admissible relation R over a set of symbols S
If S = Var ] CS ] PS , and:I R restricted to Var : R(X ,X ) = > and R(X ,Y ) = ⊥ if X 6= Y .I R(x , y) 6= ⊥ ⇒
(a) x and y are the same variable, or(b) x , y ∈ CSn (for arity n ≥ 0), or(c) x , y ∈ PSn (for arity n ≥ 0).
Definition: Extension of R to act over terms.
R(X ,X ) = > and R(X , t) = R(t,X ) = ⊥ if X 6= t.R(c(tn), c ′(t ′m)) = ⊥ if n 6= m.R(c(tn), c ′(t ′n)) = R(c, c ′) uR(t1, t ′1) u . . . uR(tn, t ′n).
(Analogously for atoms and clauses).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 23 / 1
-
Admissible relation R over a set of symbols S
If S = Var ] CS ] PS , and:I R restricted to Var : R(X ,X ) = > and R(X ,Y ) = ⊥ if X 6= Y .I R(x , y) 6= ⊥ ⇒
(a) x and y are the same variable, or(b) x , y ∈ CSn (for arity n ≥ 0), or(c) x , y ∈ PSn (for arity n ≥ 0).
Definition: Extension of R to act over terms.R(X ,X ) = > and R(X , t) = R(t,X ) = ⊥ if X 6= t.
R(c(tn), c ′(t ′m)) = ⊥ if n 6= m.R(c(tn), c ′(t ′n)) = R(c, c ′) uR(t1, t ′1) u . . . uR(tn, t ′n).
(Analogously for atoms and clauses).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 23 / 1
-
Admissible relation R over a set of symbols S
If S = Var ] CS ] PS , and:I R restricted to Var : R(X ,X ) = > and R(X ,Y ) = ⊥ if X 6= Y .I R(x , y) 6= ⊥ ⇒
(a) x and y are the same variable, or(b) x , y ∈ CSn (for arity n ≥ 0), or(c) x , y ∈ PSn (for arity n ≥ 0).
Definition: Extension of R to act over terms.R(X ,X ) = > and R(X , t) = R(t,X ) = ⊥ if X 6= t.R(c(tn), c ′(t ′m)) = ⊥ if n 6= m.
R(c(tn), c ′(t ′n)) = R(c, c ′) uR(t1, t ′1) u . . . uR(tn, t ′n).
(Analogously for atoms and clauses).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 23 / 1
-
Admissible relation R over a set of symbols S
If S = Var ] CS ] PS , and:I R restricted to Var : R(X ,X ) = > and R(X ,Y ) = ⊥ if X 6= Y .I R(x , y) 6= ⊥ ⇒
(a) x and y are the same variable, or(b) x , y ∈ CSn (for arity n ≥ 0), or(c) x , y ∈ PSn (for arity n ≥ 0).
Definition: Extension of R to act over terms.R(X ,X ) = > and R(X , t) = R(t,X ) = ⊥ if X 6= t.R(c(tn), c ′(t ′m)) = ⊥ if n 6= m.R(c(tn), c ′(t ′n)) = R(c, c ′) uR(t1, t ′1) u . . . uR(tn, t ′n).
(Analogously for atoms and clauses).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 23 / 1
-
Similarity-based Qualified Logic Programming
Example 5
farm(cow)
-
Similarity-based Qualified Logic Programming
Example 5
farm(cow)
-
Similarity-based Qualified Logic Programming
Example 5
farm(cow)
-
Similarity-based Qualified Logic Programming
Example 5
farm(cow)
-
Similarity-based Qualified Logic Programming
Example 5
farm(cow)
-
Similarity-based Qualified Logic Programming
Example 5
farm(cow)
-
Similarity-based Qualified Logic Programming
Example 5
farm(cow)
-
SQLP Declarative Semantics
Similarity-based Qualified Horn Logic over (R,D): If there issome ((A←α− B1, . . . ,Bk), δ) ∈ [C ]R for some C ∈ P. Then, forany d ∈ D \ {⊥} s.t. d v α ◦
d{δ, d1, . . . , dk}:
B1 ] d1 · · · Bk ] dkA ] d
Least Herbrand model of P:
{A ] d | P `SQHL(R,D) A ] d}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 25 / 1
-
SQLP Declarative Semantics
Similarity-based Qualified Horn Logic over (R,D): If there issome ((A←α− B1, . . . ,Bk), δ) ∈ [C ]R for some C ∈ P. Then, forany d ∈ D \ {⊥} s.t. d v α ◦
d{δ, d1, . . . , dk}:
B1 ] d1 · · · Bk ] dkA ] d
Least Herbrand model of P:
{A ] d | P `SQHL(R,D) A ] d}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 25 / 1
-
Goal Solving in SQLP
Two possibilities:
(1) Change unification to similarity-based unification (done in some SLPworks).
(2) Reduce a SQLP program to an equivalent QLP one and solve there(some transformations from SLP to LP proposed by other authors).
We take possibility (2), so
SQLP(R,D) program
P =⇒QLP(D) program
SR(P)
Proving as main result that
P `SQHL(R,D) A ] d ⇐⇒ SR(P) `QHL(D) A ] d .
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 26 / 1
-
Goal Solving in SQLP
Two possibilities:
(1) Change unification to similarity-based unification (done in some SLPworks).
(2) Reduce a SQLP program to an equivalent QLP one and solve there(some transformations from SLP to LP proposed by other authors).
We take possibility (2), so
SQLP(R,D) program
P =⇒QLP(D) program
SR(P)
Proving as main result that
P `SQHL(R,D) A ] d ⇐⇒ SR(P) `QHL(D) A ] d .
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 26 / 1
-
Goal Solving in SQLP
Two possibilities:
(1) Change unification to similarity-based unification (done in some SLPworks).
(2) Reduce a SQLP program to an equivalent QLP one and solve there(some transformations from SLP to LP proposed by other authors).
We take possibility (2), so
SQLP(R,D) program
P =⇒QLP(D) program
SR(P)
Proving as main result that
P `SQHL(R,D) A ] d ⇐⇒ SR(P) `QHL(D) A ] d .
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 26 / 1
-
Reducing Similarities to Qualifications:A Program Transformation
SR(P) = PS ∪ P∼ ∪ Ppay
PS For every (H ←α− B) ∈ P and for each H ′ such that R(H`,H ′) 6= ⊥:
(H ′ ←α− payR(H`,H′),S`,B) ∈ PS
where (H`,S`) = lin(H).Linearization of clause heads is a novelty in our approach.
P∼ = {X ∼ X←>−}∪ {(c(Xn) ∼ c′(Yn)←>− payR(c,c′), Xn ∼ Yn) |c, c′ ∈ CSn, R(c, c′) 6= ⊥}.
Ppay = {payw ←w− | for each atom payw occurring in PS ∪ P∼}.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 27 / 1
-
Reducing Similarities to Qualifications:A Program Transformation
SR(P) = PS ∪ P∼ ∪ Ppay
PS For every (H ←α− B) ∈ P and for each H ′ such that R(H`,H ′) 6= ⊥:
(H ′ ←α− payR(H`,H′),S`,B) ∈ PS
where (H`,S`) = lin(H).Linearization of clause heads is a novelty in our approach.
P∼ = {X ∼ X←>−}∪ {(c(Xn) ∼ c′(Yn)←>− payR(c,c′), Xn ∼ Yn) |c, c′ ∈ CSn, R(c, c′) 6= ⊥}.
Ppay = {payw ←w− | for each atom payw occurring in PS ∪ P∼}.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 27 / 1
-
Why to linearize?
To let equal variables in the head atom take similar (and not only thesame) values:
Example 6
P ≡ p(X, X)←1.0−, R(c, d) = 0.7
We want to prove: p(c,c)#1.0 and p(d,d)#1.0,and also p(c,d)#0.7 and p(d,c)#0.7.
Definition: lin(H) = (H`, S`)
H` : linear version of H (now without repeated variables).
S` : set of similarity conditions X ∼ Xi (1 ≤ i ≤ n) between thevariables that replaced the n additional occurrences of the samevariable in H.
Example: lin(p(X, X)) = (p(X, X1), {X ∼ X1}).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 28 / 1
-
Why to linearize?
To let equal variables in the head atom take similar (and not only thesame) values:
Example 6
P ≡ p(X, X)←1.0−, R(c, d) = 0.7
We want to prove: p(c,c)#1.0 and p(d,d)#1.0,and also p(c,d)#0.7 and p(d,c)#0.7.
Definition: lin(H) = (H`, S`)
H` : linear version of H (now without repeated variables).
S` : set of similarity conditions X ∼ Xi (1 ≤ i ≤ n) between thevariables that replaced the n additional occurrences of the samevariable in H.
Example: lin(p(X, X)) = (p(X, X1), {X ∼ X1}).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 28 / 1
-
Why to linearize?
To let equal variables in the head atom take similar (and not only thesame) values:
Example 6
P ≡ p(X, X)←1.0−, R(c, d) = 0.7
We want to prove: p(c,c)#1.0 and p(d,d)#1.0,
and also p(c,d)#0.7 and p(d,c)#0.7.
Definition: lin(H) = (H`, S`)
H` : linear version of H (now without repeated variables).
S` : set of similarity conditions X ∼ Xi (1 ≤ i ≤ n) between thevariables that replaced the n additional occurrences of the samevariable in H.
Example: lin(p(X, X)) = (p(X, X1), {X ∼ X1}).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 28 / 1
-
Why to linearize?
To let equal variables in the head atom take similar (and not only thesame) values:
Example 6
P ≡ p(X, X)←1.0−, R(c, d) = 0.7
We want to prove: p(c,c)#1.0 and p(d,d)#1.0,and also p(c,d)#0.7 and p(d,c)#0.7.
Definition: lin(H) = (H`, S`)
H` : linear version of H (now without repeated variables).
S` : set of similarity conditions X ∼ Xi (1 ≤ i ≤ n) between thevariables that replaced the n additional occurrences of the samevariable in H.
Example: lin(p(X, X)) = (p(X, X1), {X ∼ X1}).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 28 / 1
-
Why to linearize?
To let equal variables in the head atom take similar (and not only thesame) values:
Example 6
P ≡ p(X, X)←1.0−, R(c, d) = 0.7
We want to prove: p(c,c)#1.0 and p(d,d)#1.0,and also p(c,d)#0.7 and p(d,c)#0.7.
Definition: lin(H) = (H`, S`)
H` : linear version of H (now without repeated variables).
S` : set of similarity conditions X ∼ Xi (1 ≤ i ≤ n) between thevariables that replaced the n additional occurrences of the samevariable in H.
Example: lin(p(X, X)) = (p(X, X1), {X ∼ X1}).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 28 / 1
-
Why to linearize?
To let equal variables in the head atom take similar (and not only thesame) values:
Example 6
P ≡ p(X, X)←1.0−, R(c, d) = 0.7
We want to prove: p(c,c)#1.0 and p(d,d)#1.0,and also p(c,d)#0.7 and p(d,c)#0.7.
Definition: lin(H) = (H`, S`)
H` : linear version of H (now without repeated variables).
S` : set of similarity conditions X ∼ Xi (1 ≤ i ≤ n) between thevariables that replaced the n additional occurrences of the samevariable in H.
Example: lin(p(X, X)) = (p(X, X1), {X ∼ X1}).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 28 / 1
-
Why to linearize?
To let equal variables in the head atom take similar (and not only thesame) values:
Example 6
P ≡ p(X, X)←1.0−, R(c, d) = 0.7
We want to prove: p(c,c)#1.0 and p(d,d)#1.0,and also p(c,d)#0.7 and p(d,c)#0.7.
Definition: lin(H) = (H`, S`)
H` : linear version of H (now without repeated variables).
S` : set of similarity conditions X ∼ Xi (1 ≤ i ≤ n) between thevariables that replaced the n additional occurrences of the samevariable in H.
Example: lin(p(X, X)) = (p(X, X1), {X ∼ X1}).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 28 / 1
-
Why to linearize?
To let equal variables in the head atom take similar (and not only thesame) values:
Example 6
P ≡ p(X, X)←1.0−, R(c, d) = 0.7
We want to prove: p(c,c)#1.0 and p(d,d)#1.0,and also p(c,d)#0.7 and p(d,c)#0.7.
Definition: lin(H) = (H`, S`)
H` : linear version of H (now without repeated variables).
S` : set of similarity conditions X ∼ Xi (1 ≤ i ≤ n) between thevariables that replaced the n additional occurrences of the samevariable in H.
Example: lin(p(X, X)) = (p(X, X1), {X ∼ X1}).
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 28 / 1
-
Reducing Similarities to Qualifications:A Program Transformation
SR(P) = PS ∪ P∼ ∪ Ppay
PS For every (H ←α− B) ∈ P and for each H ′ such that R(H`,H ′) 6= ⊥:
(H ′ ←α− payR(H`,H′),S`,B) ∈ PS
where (H`,S`) = lin(H).Linearization of clause heads is a novelty in our approach.
P∼ = {X ∼ X←>−}∪ {(c(Xn) ∼ c′(Yn)←>− payR(c,c′), Xn ∼ Yn) |c, c′ ∈ CSn, R(c, c′) 6= ⊥}.
Ppay = {payw ←w− | for each atom payw occurring in PS ∪ P∼}.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 29 / 1
-
Reducing Similarities to Qualifications:A Program Transformation
SR(P) = PS ∪ P∼ ∪ Ppay
PS For every (H ←α− B) ∈ P and for each H ′ such that R(H`,H ′) 6= ⊥:
(H ′ ←α− payR(H`,H′),S`,B) ∈ PS
where (H`,S`) = lin(H).Linearization of clause heads is a novelty in our approach.
P∼ = {X ∼ X←>−}∪ {(c(Xn) ∼ c′(Yn)←>− payR(c,c′), Xn ∼ Yn) |c, c′ ∈ CSn, R(c, c′) 6= ⊥}.
Ppay = {payw ←w− | for each atom payw occurring in PS ∪ P∼}.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 29 / 1
-
Reducing Similarities to Qualifications:A Program Transformation
SR(P) = PS ∪ P∼ ∪ Ppay
PS For every (H ←α− B) ∈ P and for each H ′ such that R(H`,H ′) 6= ⊥:
(H ′ ←α− payR(H`,H′),S`,B) ∈ PS
where (H`,S`) = lin(H).Linearization of clause heads is a novelty in our approach.
P∼ = {X ∼ X←>−}∪ {(c(Xn) ∼ c′(Yn)←>− payR(c,c′), Xn ∼ Yn) |c, c′ ∈ CSn, R(c, c′) 6= ⊥}.
Ppay = {payw ←w− | for each atom payw occurring in PS ∪ P∼}.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 29 / 1
-
Program transformation in action
Example 7: SQLP(R,U) programfarm(cow)
-
Program transformation in action
Example 7
* farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7
farm(cow)
-
Program transformation in action
Example 7: QLP(U) programfarm(cow)
-
Improving the semantics
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 31 / 1
-
Improving the semantics
Motivation:I Incorporating to QLP a simple treatement of negation.I Adding further expressivity to QLP with threshold constraints in clause
bodies.
Results:1 An adapted declarative semantics for a Qualified Logic Programming
with Bivalued Predicates (BQLP) scheme.2 Improved expressivity (from QLP) with a simple kind of negation and
threshold constraints in clause bodies.3 Sound and complete goal solving precedure (via QSLD(D) resolution).4 Easy implementation based on the existent QLP implementation.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 32 / 1
-
Improving the semantics
Motivation:I Incorporating to QLP a simple treatement of negation.I Adding further expressivity to QLP with threshold constraints in clause
bodies.
Results:1 An adapted declarative semantics for a Qualified Logic Programming
with Bivalued Predicates (BQLP) scheme.2 Improved expressivity (from QLP) with a simple kind of negation and
threshold constraints in clause bodies.3 Sound and complete goal solving precedure (via QSLD(D) resolution).4 Easy implementation based on the existent QLP implementation.
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 32 / 1
-
BQLP Program Example
Example 8
animal(bird)#tt
-
BQLP Program Example
Example 8
animal(bird)#tt
-
BQLP Program Example
Example 8
animal(bird)#tt
-
BQLP Program Example
Example 8
animal(bird)#tt
-
BQLP Program Example
Example 8
animal(bird)#(tt,1.0)
-
BQLP Program Example
Example 8
animal(bird)#(tt,1.0)
-
BQLP Program Example
Example 8
animal(bird)#(tt,1.0)
-
BQLP Program Example
Example 8
animal(bird)#(tt,1.0)
-
BQLP Program Example
Example 8
animal(bird)#(tt,1.0)
-
BQLP Declarative Semantics
Qualified Horn Logic over D: If there is some instance rule (A ] v←α− B1 ] (v1,w1), . . . , Bk ] (vk ,wk)) ∈ [C ] with C ∈ P, and somed1, . . . , dk ∈ D \ {⊥} such that di w? wi for all 1 ≤ i ≤ k , then thefollowing inference step is allowed for any d v α ◦
d{d1, . . . , dk}:
B1 ] (v1, d1) · · · Bk ] (vk , dk)A ] (v , d)
- d w? w ⇐⇒def w =? or w 6=? and d w w .
Least Herbrand model of P:
{A ] (v , d) | P `QHL(D) A ] (v , d)}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 34 / 1
-
BQLP Declarative Semantics
Qualified Horn Logic over D: If there is some instance rule (A ] v←α− B1 ] (v1,w1), . . . , Bk ] (vk ,wk)) ∈ [C ] with C ∈ P, and somed1, . . . , dk ∈ D \ {⊥} such that di w? wi for all 1 ≤ i ≤ k , then thefollowing inference step is allowed for any d v α ◦
d{d1, . . . , dk}:
B1 ] (v1, d1) · · · Bk ] (vk , dk)A ] (v , d)
- d w? w ⇐⇒def w =? or w 6=? and d w w .Least Herbrand model of P:
{A ] (v , d) | P `QHL(D) A ] (v , d)}
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 34 / 1
-
BQLP Declarative Semantics (and II)
Example 9
cruel(X)#ff
-
Ongoing & Future Work
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 36 / 1
-
Ongoing & Future Work
Ongoing Work1 Improvement of the actual prototype supporting threshold constraints
and making an extensive use of constraint solvers for qualificationconstraints managing.
2 Extension of QLP to a first-order Qualified Constraint Functional-LogicProgramming Language.
Future WorkI Goal Solving by Similarity-based QSLD and its implementation both via
a program transformation and similarity-based primitive unification.I Develop of methods and tools for defining complex similarity relations.I Search for new instances and interesting examples.
To think about:I Similarity between terms as if they were constants?I Even more general Qualification Domains without losing usefulness?
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 37 / 1
-
Ongoing & Future Work
Ongoing Work1 Improvement of the actual prototype supporting threshold constraints
and making an extensive use of constraint solvers for qualificationconstraints managing.
2 Extension of QLP to a first-order Qualified Constraint Functional-LogicProgramming Language.
Future WorkI Goal Solving by Similarity-based QSLD and its implementation both via
a program transformation and similarity-based primitive unification.I Develop of methods and tools for defining complex similarity relations.I Search for new instances and interesting examples.
To think about:I Similarity between terms as if they were constants?I Even more general Qualification Domains without losing usefulness?
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 37 / 1
-
Ongoing & Future Work
Ongoing Work1 Improvement of the actual prototype supporting threshold constraints
and making an extensive use of constraint solvers for qualificationconstraints managing.
2 Extension of QLP to a first-order Qualified Constraint Functional-LogicProgramming Language.
Future WorkI Goal Solving by Similarity-based QSLD and its implementation both via
a program transformation and similarity-based primitive unification.I Develop of methods and tools for defining complex similarity relations.I Search for new instances and interesting examples.
To think about:I Similarity between terms as if they were constants?I Even more general Qualification Domains without losing usefulness?
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 37 / 1
-
Thank you!
Carlos A. Romero-D́ıaz (GPD / UCM) Qualified Logic Programming December, 2008 38 / 1