eric kao cs 157 computational logic autumn...

39
Inconsistency-tolerant logics Eric Kao CS 157 Computational Logic Autumn 2011

Upload: others

Post on 29-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Inconsistency-tolerant logics

Eric Kao

CS 157 Computational LogicAutumn 2011

Page 2: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

11/27/11 2

Inconsistent logical theories

● T1 = { p(a) , ¬p(a) }

● T 2 = { x(p(x)→q(x)) , p(a) , ¬q(a) }∀

● Definition: A theory T is inconsistent if T has no models (no interpretation satisfies T)

Page 3: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

11/27/11 3

Causes of inconsistency● Errors

● Contradiction within software documentation● Uncertainty and approximation● Delay in update● Semantic disagreement

● Price of a PS3 in the US vs. Canada● Fundamental disagreements

● Birth year of Julius Caesar: 200 BC vs. 202 BC● Fundamental inconsistency of the world

Page 4: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

11/27/11 4

Trivialization● Recall: T φ if and only if every model of T is a ⊨

model of φ. ● Upshot: if T has no models, then the condition

trivially holds for any sentence φ.● Classical logic does not distinguish between

inconsistent theories.● Exercise: prove q from the premises p,¬p, using the

Mendelson system.

Page 5: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

11/27/11 5

Problems with inconsistency● Wikipedia Mike plays Jack Bauer in 24⊨

● Microsoft knowledge base Steve Ballmer hates ⊨Windows

● Wikipedia GDP of the US is greater than GDP of ⊨Canada

● We would like to distinguish between different “sorts” of consequences

Page 6: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

11/27/11 6

Inconsistency-tolerant logics● How can we modify classical logic to avoid

trivialization?● Change the model theory

● e.g. many-valued logics● Change the proof theory

● Change the rules of inference● Change what constitutes a proof

– e.g. require that a proof must be self consistent

Page 7: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

11/27/11 7

Resolution and trivialization● Resolution method:

Show: p, ¬p ⊨ q● {p}, {¬p}, {¬q} derives the empty clause

● The resolution step itself does not explode● {p},{¬p} does not derive {¬q}

(using resolution steps)

Page 8: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

11/27/11 8

Quasi-classical logic● { p, ¬p } |~ q ?● { p, ¬p, q v r } |~ q ?● { p, ¬p, p v ¬p v q } |~ q ?● { p, ¬p, p v ¬p v q } |~ q v r ?● { p, ¬p, p v ¬p v q v r } |~ q v r ?● { p, ¬p, ¬p v q } |~ q ?

Page 9: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

11/27/11 9

Existential Entailment (Logic)● { p, ¬p } |~ q ?● { p, ¬p, q v r } |~ q ?● { p, ¬p, p v ¬p v q } |~ q ?● { p, ¬p, p v ¬p v q } |~ q v r ?● { p, ¬p, p v ¬p v q v r } |~ q v r ?● { p, ¬p, ¬p v q } |~ q ?

Page 10: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

11/27/11 10

QC using Set of Support● Using the Set of support strategy

● Choose {¬q} as the set of support● {p}, {¬p}, {¬q} does NOT derive the empty clause

Page 11: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Relational Calculus SyntaxEric Kao

Page 12: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Database, Queries● Database instance

A finite set of ground atoms● e.g., D = { p(a,a), p(b,c), q(a), r(a,d) }

● QueryA relational calculus formula● e.g., Q1 = p(a,b)

● e.g., Q2(x) = y p(x,y)∃

● e.g., Q3(x) = z y (¬p(x,y) r(y,z))∃ ∀ ∨

Eric Kao

Page 13: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Database semantics● D = { p(a,a), p(b,c), q(a), q(b) }● D p(a,a) ?⊨ yes● D ¬q(c) ?⊨ no● D x p(x,x) ?⊨ ∃ yes● D x (q(x)→ p(x,x))⊨ ∀ ? no● D x y (q(x)→ p(x,y)) ?⊨ ∀ ∃ yes

Page 14: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Database constraints● Constraint set

A finite, consistent set of relational calculus sentences

● e.g., C = { x (¬p(x,x) q(x)), ∀ ∨x q(x) } ∃

Eric Kao

Page 15: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Trivialization ● D = { p(a) , p(b) }

Constraints: { ¬p(a) ∨ ¬p(b) }● If D C has no models, then D C φ for any φ∪ ∪ ⊨

● But there is a very natural model to use: D● D p(a)⊨

● D p(c)⊭

● Some absurd conclusions remain● D p(a) p(b)⊨ ∧

● Julius Caesar was born in 200 BC and in 202 BC

Page 16: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Min-change Repairs● Given:

● D : database e.g.,{ p(a), p(b) }● Ω : set of constraints e.g.,{¬p(a) ∨ ¬p(b) }

● A repair is a database D* that is consistent with Ω.e.g., { p(a) }, { p(b) }, { }, { p(a), p(c) }, ...

● A minimal change repair is a repair that is minimally different from D.

minimal according to the relationship A ≤ B if and only if (A – D) (B – D) and (D – A) (D – B)⊆ ⊆

Eric Kao

Page 17: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Exercise ● Given:

● D : database e.g.,{ p(a), p(b) }● Ω : set of constraints e.g.,{¬p(a) ∨ ¬p(b) }

● Which are the minimal change repairs?● { p(a), p(b) }● { p(a) }● { p(b) }● { }● { p(a), p(c) }

Page 18: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Consistent query answers● CQA: answers that arise no matter how the

conflicts are resolved (in a minimal-change fashion) [ABC]

● D ⊨CQAΩ Q(t) iff

for all minimal-change repairs D* of D w.r.t. to Ω, D* Q(t)⊨

Eric Kao

Page 19: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

CQA

● p(a)? NO {p(b)}● p(b)? NO {p(a)}● p(a) p(b)? ∧ NO {p(b)}● p(a) p(b)? ∨ YES {p(a)}, {p(b)}

p(a)

p(b)Conflict

Constraint:¬p(a) ∨ ¬p(b)

Eric Kao

Page 20: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

More lenient semantics● In some situations, we would like to see

plausible though non-guaranteed answers● e.g., a student figuring out whom his office mates

might be● Possible answers from repairs: answers that

arise from some minimal-change repair

Eric Kao

Page 21: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Possible answers● Constraint: every person must be assigned a

desk● Data: Charles is missing a desk assignment● Minimal-change repairs:

{desk(Charles,desk1)}, {desk(Charles,desk2)}, {desk(Charles,desk3)}, …

● Possible answers:desk1, desk2, desk3, …

Eric Kao

Page 22: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Relax not repair● Instead of repairing a database to be

consistent with constraints, we can relax a database to be consistent with constraints.

Page 23: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Incomplete Database● An incomplete database is a theory K

– K consists of ground literals– Pos(K) ∩ Neg(K) = {}

● e.g., K = { p(a), q(a), ¬p(c), ¬q(b) }● Intuitively,

– Pos(K) gives the known true atoms– Neg(K) gives the known false atoms– The rest are unknown

● K ⊨d Q iff D⊨

dQ for all D Instances∈

d(K)

Eric Kao

Page 24: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Relaxations of a database● A relaxation of D w.r.t. Ω is an incomplete

database K, where ● Pos(K) ⊆ D ● Neg(K)∩D = ∅● K ⊭

d ¬Ω

● Let the set of relaxations of D w.r.t. to Ω be denoted Re

d(D,Ω)

Eric Kao

Page 25: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Example● D = {p(a),p(b)}● Ω = {¬p(a) ¬p(b)}∨

● d = {a,b,c}● Red(D,Ω) = {

{ p(a) , ¬p(c)}, {p(b) , ¬p(c)},{ p(a) }, {p(b)},{ p(c) }, { } }

Eric Kao

Page 26: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Answers with Consistent Support

● ACS: answers that are supported by a consistent relaxation of the database. [KG]

● D ⊨CSΩ Q(t) iff there exists

K ∈ Red(D,Ω) st K ⊨

d Q(t)

● Where d is the set of all objects mentioned in D,Q

Eric Kao

Page 27: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

ACS

● p(a)? YES {p(a)}● p(b)? YES {p(b)}● p(a) p(b)? ∧ NO● p(a) p(b)? ∨ YES {p(a)}

p(a)

p(b)Conflict

Constraint:¬p(a) ∨ ¬p(b)

Eric Kao

Page 28: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

More complex queries

● ∀x [q(x) → p(x,1)] ?● ACS: NO

pa 1b 1c 2d 3

qab

Constraint:∀xyz (¬p(x,z)∨¬p(y,z) x=y)∨

Eric Kao

Page 29: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Data Complexity● Both ACS and CQA are NP-Hard problems [KG]

[CM] ● Reduction from monotone 3-SAT

● ACS is tractable for * * queries∃ ∀ †. [KG]● CQA is tractable for

● ∀* queries† [KG]● Some subclasses of * queries∃ † [ABC, CM, FM]

† with suitable restrictions on the class of constraints

Eric Kao

Page 30: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Query rewriting● How can we use existing database

infrastructure to support these query semantics?

● Solution: Query rewriting● Algorithm ACS-Rewrite[Q,Ω]

Rewrite Q ( * *) into Q' so that evaluating Q' on a ∃ ∀standard DBMS gives ACS answers to Q. [KG]

● Similar rewriting algorithms have been devised for CQA [ABC, CM, FM, KG]

Eric Kao

Page 31: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

ACS: Ground conjunctive queries● Q = p(a,1) p(a,2)∧

● C = { ¬p(a,1) ¬p(a,2) }∨

● Q contradicts C. ● Answer: NO● Rewrite:

Q' = False

Eric Kao

Page 32: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

ACS: Ground conjunctive queries● Q = p(a,1) p(a,2)∧

● C = { x y z (¬p(x,y) ¬p(x,z) y = z) }∀ ∨ ∨

● Q contradicts C. ● Answer: NO● Rewrite:

Q' = False

Eric Kao

Page 33: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

ACS: qf conjunctive queries● Q(x,y,z) = p(x,y) p(x,z)∧

● C = { x y z (¬p(x,y) ¬p(x,z) y = z) }∀ ∨ ∨

● Q(x,y,z) is consistent w.r.t. C if and only if y = z

● Rewrite: Q' = Q(x,y,z) (y = z)∧

Eric Kao

Page 34: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

ACS: * queries∀

● Q = x,y (¬q(x,y) ¬r(x,y))∀ ∨

● C ={ q(a,b) }

● ¬q(x,y) ¬r(x,y)∨ q(a,b)

¬r(a,b)

● Rewrite:Q' = Q ¬r(a,b)∧

Eric Kao

Page 35: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

ACS: * queries∀

● Q = x,y (¬q(x,y) ¬r(x,y))∀ ∨

● C ={ x q(x,x) }∀

● ¬q(x,y) ¬r(x,y)∨ q(x,x)

¬r(x,x)

● Rewrite:Q' = Q x ¬r(x,x)∧∀

Eric Kao

Page 36: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Summary● inconsistencies are unavoidable (In many

applications)● Classical logic is trivialized● Modify classical logic to tolerate inconsistencies● Two inconsistency-tolerance Logics in the

special case of databases● Answers that all min-change repairs agreed on● Answers supported by a consistent relaxation

Page 37: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

General case● Ideas looked at in the database case also

useful in tolerating inconsistency in general deduction

● Anthony Hunter. “Paraconsistent Logics”Handbook of Defeasible Reasoning and Uncertainty Management Systems: Reasoning with actual and potential contradictions[link] (especially section 2.4 and 6)

Page 38: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

Ongoing work● Identify other tractable classes● Recursive queries and aggregates● Other answer semantics

● preferentially-defeasible data?● coarser granularity?● Semantics that consider history?

Eric Kao

Page 39: Eric Kao CS 157 Computational Logic Autumn 2011logic.stanford.edu/classes/cs157/2011/lectures/lecture17.pdf · 11/27/11 3 Causes of inconsistency Errors Contradiction within software

References

[ABC] M. Arenas, L. Bertossi, and J. Chomicki. Consistent query answers in inconsistent databases. Symposium on principles of database systems, Pages 68–79, 1999.[CM] J. Chomicki and J. Marcinkowski. Minimal-change integrity maintenance using tuple deletions. Inf. Comput.,197(1-2):90–121, 2005.[FM] A. Fuxman and R. J. Miller. First-order query rewriting for inconsistent databases. J. Comput. Syst. Sci., 73(4):610–635, 2007.[KG] E. Kao and M. Genesereth. Answers with consistent support – complexity and rewriting. Working paper, 2010.

Eric Kao