Fuzzy Answer Sets...

Post on 26-Sep-2020

1 views 0 download

transcript

Fuzzy Answer Sets Approximations

Mario Alviano1 and Rafael Peñaloza2

1Department of Mathematics and Computer ScienceUniversity of Calabria

2Center for Advancing Electronics DresdenDresden University of Technology

ICLP 2013Istanbul, 27 August 2013

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations

Outline

1 Introduction

2 Syntax and Semantics

3 Approximation OperatorsImmediate Consequence OperatorMinimal SatisfiabilityWell-founded Operator

4 Implementation and Experiment

5 Conclusion

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations

Introduction

Answer Set Programming (ASP)Overcomes a weakness of classical logic for KR:monotonicityNaturally handles reasoning by defaults, abductivereasoning, belief revisons, ...

ASP makes logic closer to the real world

However...Everything is either true or false in ASPASP is based on precise information

Can we always make these assumptions?

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 1 / 19

Introduction

Answer Set Programming (ASP)Overcomes a weakness of classical logic for KR:monotonicityNaturally handles reasoning by defaults, abductivereasoning, belief revisons, ...

ASP makes logic closer to the real world

However...Everything is either true or false in ASPASP is based on precise information

Can we always make these assumptions?

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 1 / 19

Is everything true or false? (1)

Barber of Seville paradoxIn the small town of Seville, all and only those men who do notshave themselves are shaved by the barber (who is a man).Who shaves the barber?

shaves(barber ,X )← not shaves(X ,X )shaves(X ,X )← not shaves(barber ,X )

Classical set theory can neither prove nor disprove that thebarber shaves himselfAn odd loop makes the program incoherent for ASPshaves(barber ,barber) is undefined according to thewell-founded semantics

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 2 / 19

Is everything true or false? (1)

Barber of Seville paradoxIn the small town of Seville, all and only those men who do notshave themselves are shaved by the barber (who is a man).Who shaves the barber?

shaves(barber ,barber)← not shaves(barber ,barber)shaves(barber ,barber)← not shaves(barber ,barber)

Classical set theory can neither prove nor disprove that thebarber shaves himselfAn odd loop makes the program incoherent for ASPshaves(barber ,barber) is undefined according to thewell-founded semantics

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 2 / 19

Is everything true or false? (2)

A F D G C H E I BHow many truth degrees?

Let’s associate false statements with white, and truestatements with blackUndefined statements can be associated to grayCan we model statements which are more likely to be falseor to be true?... and we can go on!

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 3 / 19

Is everything true or false? (2)

A F D G C H E I BHow many truth degrees?

Let’s associate false statements with white, and truestatements with blackUndefined statements can be associated to grayCan we model statements which are more likely to be falseor to be true?... and we can go on!

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 3 / 19

Is everything true or false? (2)

A F D G C H E I BHow many truth degrees?

Let’s associate false statements with white, and truestatements with blackUndefined statements can be associated to grayCan we model statements which are more likely to be falseor to be true?... and we can go on!

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 3 / 19

Is everything true or false? (2)

A F D G C H E I BHow many truth degrees?

Let’s associate false statements with white, and truestatements with blackUndefined statements can be associated to grayCan we model statements which are more likely to be falseor to be true?... and we can go on!

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 3 / 19

Is everything true or false? (2)

A F D G C H E I BHow many truth degrees?

Let’s associate false statements with white, and truestatements with blackUndefined statements can be associated to grayCan we model statements which are more likely to be falseor to be true?... and we can go on!

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 3 / 19

Only precise information?

When a person stops to be young and becomes old?

Compare it with the classical, crisp approach

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 4 / 19

How to Handle Vagueness?

Fuzzy logic interprets propositions with a truth degree in [0,1]

Classical (crisp) set vs. fuzzy set

Fuzzification

Fuzzy inference engine

Defuzzification

This work deals withthe engine part

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 5 / 19

Possible Application

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 6 / 19

Possible solutiontop(X ,high)← top(X ,medium),

not bottom(X − 1,high).bottom(X ,high)← bottom(X ,medium),

not top(X + 1,high).sign(X , I)← top(X , I).sign(X , I)← bottom(X , I).

Possible Application

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 6 / 19

Possible solutiontop(X ,high)← top(X ,medium),

not bottom(X − 1,high).bottom(X ,high)← bottom(X ,medium),

not top(X + 1,high).sign(X , I)← top(X , I).sign(X , I)← bottom(X , I).

Contribution

Fuzzy inference engineMinimal satisfiability operatorFuzzy unfounded setsImplementation

Grounder (gringo)Solver: fuzzy answer sets (approximation) andwell-founded model

Experiment

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 7 / 19

Outline

1 Introduction

2 Syntax and Semantics

3 Approximation OperatorsImmediate Consequence OperatorMinimal SatisfiabilityWell-founded Operator

4 Implementation and Experiment

5 Conclusion

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations

Syntax and Semantics (1)

Normal FASP program: set of rules of the forma← b1 ⊗ · · · ⊗ bm ⊗ not bm+1 ⊗ · · · ⊗ not bn

Fuzzy atoms are either propositional atoms in a fixed set B ornumeric constants: a, b, speed , 0, 1, 0.5, 1/3, ...

Examplea← not bb ← a⊗ 0.8

⊗ : [0,1]× [0,1]→ [0,1] is a fixed t-norm, e.g.Gödel: x ⊗ y = min{x , y}Product: x ⊗ y = x · yŁukasiewicz: x ⊗ y = max{x + y − 1,0}

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 8 / 19

Syntax and Semantics (2)

Interpretation: I : B → [0,1]Numeric constant: I(c) = cNegative literal: I(not a) = 1− I(a)Conjunction: I(

⊗ki=1 li) =

⊗ki=1 I(li)

Model: I |= r if I(H(r)) ≥ I(B(r))Program Reduct: in P, replace each not b by I(not b)Fuzzy Answer Set: M |= P and there is no I ⊂ M s.t. I |= PM

Fuzzy Sets: Operations and Relations

I ⊆ J: I(a) ≤ J(a) for each a ∈ BI ⊂ J: I ⊆ J and I 6= JI ∩ J: a 7→ min{I(a), J(a)} for each a ∈ BI ∪ J: a 7→ max{I(a), J(a)} for each a ∈ BI \ J: a 7→ max{I(a)− J(a),0} for each a ∈ B

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 9 / 19

Outline

1 Introduction

2 Syntax and Semantics

3 Approximation OperatorsImmediate Consequence OperatorMinimal SatisfiabilityWell-founded Operator

4 Implementation and Experiment

5 Conclusion

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations

Goal: Compute Approximations

Start with the largest approximation (0,1)Lower bound: all propositions associated with 0Upper bound: all propositions associated with 1

Apply operators to restrict the approximationIncrease the lower boundDecrease the upper bound

All the answer sets must be between these bounds

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 10 / 19

Immediate Consequence Operator

DefinitionFor each a ∈ B, define

T UP (L) : a 7→ max{〈L,U〉 (r) | r ∈ P, H(r) = a}

For r : a← b1 ⊗ · · · ⊗ bm ⊗ not bm+1 ⊗ · · · ⊗ not bn

let 〈L,U〉 (r) := L(b1 ⊗ · · · ⊗ bm)⊗ U(not bm+1 ⊗ · · · ⊗ not bn)

Łukasiewicz t-norm: x ⊗ y = max{x + y − 1,0}a← b ⊗ not c L = {a 7→ 0 ,b 7→ 0.8, c 7→ 0.3}

U = {a 7→ 1 ,b 7→ 1 , c 7→ 0.3}T U

P (L) : a 7→ L(b)⊗U(not c) = max{0.8+(1−0.3)−1,0} = 0.5

Theorem

The fixpoint T UP ⇑0 is reached after a linear number of iterations,

measured on the number of atoms appearing in P.

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 11 / 19

Immediate Consequence Operator

DefinitionFor each a ∈ B, define

T UP (L) : a 7→ max{〈L,U〉 (r) | r ∈ P, H(r) = a}

For r : a← b1 ⊗ · · · ⊗ bm ⊗ not bm+1 ⊗ · · · ⊗ not bn

let 〈L,U〉 (r) := L(b1 ⊗ · · · ⊗ bm)⊗ U(not bm+1 ⊗ · · · ⊗ not bn)

Łukasiewicz t-norm: x ⊗ y = max{x + y − 1,0}a← b ⊗ not c L = {a 7→ 0 ,b 7→ 0.8, c 7→ 0.3}

U = {a 7→ 1 ,b 7→ 1 , c 7→ 0.3}T U

P (L) : a 7→ L(b)⊗U(not c) = max{0.8+(1−0.3)−1,0} = 0.5

Theorem

The fixpoint T UP ⇑0 is reached after a linear number of iterations,

measured on the number of atoms appearing in P.

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 11 / 19

Minimal Satisfiability (1)

DefinitionFor each a ∈ B, define

SUP (L) : a 7→ inf{I(a) | I |= P ∧ L ⊆ I ⊆ U}

Theorem

If M |= P and L ⊆ M ⊆ U then SUP (L) ⊆ M ⊆ U.

How to compute this operator?For the Łukasiewicz t-norm, rewrite each

a← b1 ⊗ · · · ⊗ bm ⊗ not bm+1 ⊗ · · · ⊗ not bninto

a ≥ b1 + · · ·+ bm − bm+1 − · · · − bn + 1−mand solve a system of linear inequalities.

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 12 / 19

Minimal Satisfiability (1)

DefinitionFor each a ∈ B, define

SUP (L) : a 7→ inf{I(a) | I |= P ∧ L ⊆ I ⊆ U}

Theorem

If M |= P and L ⊆ M ⊆ U then SUP (L) ⊆ M ⊆ U.

How to compute this operator?For the Łukasiewicz t-norm, rewrite each

a← b1 ⊗ · · · ⊗ bm ⊗ not bm+1 ⊗ · · · ⊗ not bninto

a ≥ b1 + · · ·+ bm − bm+1 − · · · − bn + 1−mand solve a system of linear inequalities.

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 12 / 19

Minimal Satisfiability (2)

Examplea← not bb ← a⊗0.8

min as.t. a ≥ 1− b

b ≥ a + 0.8− 10 ≤ a,b ≤ 1

S1P(0) : a 7→ 0.6

min bs.t. a ≥ 1− b

b ≥ a + 0.8− 10 ≤ a,b ≤ 1

S1P(0) : b 7→ 0.4

TheoremThe minimal satisfiability operator is computable in polynomialtime for programs over the Łukasiewicz t-norm.

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 13 / 19

Fuzzy Unfounded Sets (1)

DefinitionA fuzzy unfounded set X for P w.r.t. (L,U) satisfies[U ∩ (1 \ X )](H(r)) >= 〈U ∩ (1 \ X ),L〉 (r)

for each r ∈ P such that X (H(r)) > 0.

Fuzzy unfounded sets evidence lack of (acyclic) support.

Łukasiewicz t-norm: x ⊗ y = max{x + y − 1,0}a← b ⊗ bb ← ab ← 0.9⊗ not cc ← 0.9⊗ not b

Unfounded sets for (0,1):X1 = {a 7→ 0 ,b 7→ 0 , c 7→ 0 }X2 = {a 7→ 0 ,b 7→ 0 , c 7→ 0.1}X3 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0 }X4 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0.1}

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 14 / 19

Fuzzy Unfounded Sets (1)

DefinitionA fuzzy unfounded set X for P w.r.t. (L,U) satisfies[U ∩ (1 \ X )](H(r)) >= 〈U ∩ (1 \ X ),L〉 (r)

for each r ∈ P such that X (H(r)) > 0.

Fuzzy unfounded sets evidence lack of (acyclic) support.

Łukasiewicz t-norm: x ⊗ y = max{x + y − 1,0}a← b ⊗ bb ← ab ← 0.9⊗ not cc ← 0.9⊗ not b

Unfounded sets for (0,1):X1 = {a 7→ 0 ,b 7→ 0 , c 7→ 0 }X2 = {a 7→ 0 ,b 7→ 0 , c 7→ 0.1}X3 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0 }X4 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0.1}

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 14 / 19

Fuzzy Unfounded Sets (1)

DefinitionA fuzzy unfounded set X for P w.r.t. (L,U) satisfies[U ∩ (1 \ X )](H(r)) >= 〈U ∩ (1 \ X ),L〉 (r)

for each r ∈ P such that X (H(r)) > 0.

Fuzzy unfounded sets evidence lack of (acyclic) support.

Łukasiewicz t-norm: x ⊗ y = max{x + y − 1,0}a← b ⊗ bb ← ab ← 0.9⊗ not cc ← 0.9⊗ not b

Unfounded sets for (0,1):X1 = {a 7→ 0 ,b 7→ 0 , c 7→ 0 }X2 = {a 7→ 0 ,b 7→ 0 , c 7→ 0.1}X3 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0 }X4 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0.1}

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 14 / 19

Fuzzy Unfounded Sets (1)

DefinitionA fuzzy unfounded set X for P w.r.t. (L,U) satisfies[U ∩ (1 \ X )](H(r)) >= 〈U ∩ (1 \ X ),L〉 (r)

for each r ∈ P such that X (H(r)) > 0.

Fuzzy unfounded sets evidence lack of (acyclic) support.

Łukasiewicz t-norm: x ⊗ y = max{x + y − 1,0}a← b ⊗ bb ← ab ← 0.9⊗ not cc ← 0.9⊗ not b

Unfounded sets for (0,1):X1 = {a 7→ 0 ,b 7→ 0 , c 7→ 0 }X2 = {a 7→ 0 ,b 7→ 0 , c 7→ 0.1}X3 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0 }X4 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0.1}

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 14 / 19

Fuzzy Unfounded Sets (1)

DefinitionA fuzzy unfounded set X for P w.r.t. (L,U) satisfies[U ∩ (1 \ X )](H(r)) >= 〈U ∩ (1 \ X ),L〉 (r)

for each r ∈ P such that X (H(r)) > 0.

Fuzzy unfounded sets evidence lack of (acyclic) support.

Łukasiewicz t-norm: x ⊗ y = max{x + y − 1,0}a← b ⊗ bb ← ab ← 0.9⊗ not cc ← 0.9⊗ not b

Unfounded sets for (0,1):X1 = {a 7→ 0 ,b 7→ 0 , c 7→ 0 }X2 = {a 7→ 0 ,b 7→ 0 , c 7→ 0.1}X3 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0 }X4 = {a 7→ 0.2,b 7→ 0.1, c 7→ 0.1}

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 14 / 19

Fuzzy Unfounded Sets (2)

LemmaThe union of two (fuzzy) unfounded sets is an unfounded set.

Let GUSL,UP denote the greatest fuzzy unfounded set.

Theorem

M is a fuzzy answer set of a program P iff GUSM,MP = 1 \M.

TheoremFor programs without numeric constants and crisp sets, fuzzyunfounded sets are the unfounded sets by Van Gelder et al.[1991].

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 15 / 19

Fuzzy Unfounded Sets (2)

LemmaThe union of two (fuzzy) unfounded sets is an unfounded set.

Let GUSL,UP denote the greatest fuzzy unfounded set.

Theorem

M is a fuzzy answer set of a program P iff GUSM,MP = 1 \M.

TheoremFor programs without numeric constants and crisp sets, fuzzyunfounded sets are the unfounded sets by Van Gelder et al.[1991].

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 15 / 19

Well-founded Operator

WP(L,U) :=(

T UP (L),1 \ RL,U

P ⇓1)

where for every a ∈ B, defineRL,U

P (X ) : a 7→ min{X (a),1−max{〈U ∩ (1 \ X ),L〉 (r) | r ∈ P, H(r) = a}}

TheoremThe fixpoint of WP gives the well-founded semantics byDamásio and Pereira [2001].

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 16 / 19

Outline

1 Introduction

2 Syntax and Semantics

3 Approximation OperatorsImmediate Consequence OperatorMinimal SatisfiabilityWell-founded Operator

4 Implementation and Experiment

5 Conclusion

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations

Implementation

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 17 / 19

FASP program Grounder gringo Numeric format

fasp

UpperBoundIncrease UpperBoundDecrease LowerBoundIncrease

MinimalSatisfiability

Bilevel solverYALMIP+Octave

Fuzzy answer setor approximation

https://github.com/alviano/fasp.git

Implementation

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 17 / 19

FASP program Grounder gringo Numeric format

fasp

UpperBoundIncrease UpperBoundDecrease LowerBoundIncrease

MinimalSatisfiability

Bilevel solverYALMIP+Octave

Fuzzy answer setor approximation

https://github.com/alviano/fasp.git

Example

a← not bb ← a⊗0.8

min a− a′ + b − b′

s.t. 0 ≤ a,b ≤ 1min a + bs.t. a′ ≥ 1− b

b′ ≥ a′ + 0.8− 10 ≤ a′,b′ ≤ 1

Experiment

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 18 / 19

Tested Timeouts Average execution time? Averageinstances Unopt. Opt. Unopt. Optimized perc. gain?

Graph Coloring 60 34 0 247.44 34.45 (2.68) 76.43%Hamiltonian Path 40 33 9 120.51 6.41 (0.02) 81.49%

Stratified 90 10 0 190.07 1.80 (0.02) 96.71%Odd Cycle 90 33 0 186.94 1.95 (0.03) 97.18%

? Computed on the instances solved by both the approaches.

Outline

1 Introduction

2 Syntax and Semantics

3 Approximation OperatorsImmediate Consequence OperatorMinimal SatisfiabilityWell-founded Operator

4 Implementation and Experiment

5 Conclusion

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations

Conclusion

Approximations provide a sensitive performance gainStill the bilevel approach seems to be too slow

Future WorkMore complex structures in the body (disjunction)

Compile into uninterpreted function symbols in gringoUse a pre-processor in fasp

How to deal with a choice operator?Completion approach by Janssen et al. [2012]Conflict analysis and learning?

Thank you!

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 19 / 19

Conclusion

Approximations provide a sensitive performance gainStill the bilevel approach seems to be too slow

Future WorkMore complex structures in the body (disjunction)

Compile into uninterpreted function symbols in gringoUse a pre-processor in fasp

How to deal with a choice operator?Completion approach by Janssen et al. [2012]Conflict analysis and learning?

Thank you!

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations 19 / 19

Bibliography

Carlos Viegas Damásio and Luís Moniz Pereira. Antitonic logic programs. InProceedings of the 6th International Conference on Logic Programming andNonmonotonic Reasoning, LPNMR’01, pages 379–392, London, UK, UK, 2001.Springer-Verlag. ISBN 3-540-42593-4.

Jeroen Janssen, Dirk Vermeir, Steven Schockaert, and Martine De Cock. Reducingfuzzy answer set programming to model finding in fuzzy logics. Theory and Practiceof Logic Programming, 12(6):811–842, 2012.

Allen Van Gelder, Kenneth A. Ross, and John S. Schlipf. The Well-Founded Semanticsfor General Logic Programs. Journal of the ACM, 38(3):620–650, 1991.

Mario Alviano and Rafael Peñaloza Fuzzy Answer Sets Approximations