• Keine Ergebnisse gefunden

Examples of Horn sentences

N/A
N/A
Protected

Academic year: 2022

Aktie "Examples of Horn sentences"

Copied!
13
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Logik f¨ ur Informatiker Logic for computer scientists

Till Mossakowski

WiSe 2013/14

(2)

Resolution

(3)

Recall: Conjunctive Normal Form (CNF)

For each propositional sentence, there is an equivalent sentence of form

1,1∨. . .∨ϕ1,m1)∧. . .∧(ϕn,1∨. . .∨ϕn,mn) (n≥1,mi ≥1) where theϕi,j are literals, i.e. atomic sentences or negations of atomic sentences.

Note thatn may be 1, e.g.A∨B is in CNF.

Note that themi may be 1, e.g.A as well asA∧B are in CNF.

A sentence in CNF is called aHorn sentence, if each disjunction of literals containsat most one positive literal.

(4)

Examples of Horn sentences

¬Home(claire)∧(¬Home(max)∨Happy(carl)) Home(claire)∧Home(max)∧ ¬Home(carl) Home(claire)∨ ¬Home(max)∨ ¬Home(carl)

Home(claire)∧Home(max)∧

(¬Home(max)∨ ¬Home(max))

(5)

Examples of non-Horn sentences

¬Home(claire)∧(Home(max)∨Happy(carl)) (Home(claire)∨Home(max)∨ ¬Happy(claire))

∧Happy(carl)

Home(claire)∨(Home(max)∨ ¬Home(carl))

(6)

Alternative notation for the conjuncts in Horn sentences

¬A1∨. . .∨ ¬An∨B ⇔ (A1∧. . .∧An)→B

¬A1∨. . .∨ ¬An ⇔ (A1∧. . .∧An)→ ⊥

B ⇔ > →B

⊥ ⇔ 2

Any Horn sentence is equivalent to a conjunction of conditional statements of the above four forms.

(7)

Satisfaction algorithm for Horn sentences

1 For any conjunct > →B, assign true toB.

2 If for some conjunct (A1∧. . .∧An)→B, you have assigned true to A1, . . . ,An then assign true toB.

3 Repeat step 2 as often as possible.

4 If there is some conjunct (A1∧. . .∧An)→ ⊥with true assigned to A1, . . . ,An, the Horn sentence is not satisfiable.

Otherwise, assigning false to the yet unassigned atomic sentences makes all the conditionals (and hence also the Horn sentence) true.

(8)

Correctness of the satisfaction algorithm

TheoremThe algorithm for the satisfiability of Horn sentences is correct, in that it classifies as tt-satisfiable exactly the tt-satisfiable Horn sentences.

(9)

Propositional Prolog

AncestorOf(a,b) :−MotherOf(a,b).

AncestorOf(b,c) :−MotherOf(b,c).

AncestorOf(a,b) :−FatherOf(a,b).

AncestorOf(b,c) :−FatherOf(b,c).

AncestorOf(a,c) :−AncestorOf(a,b),AncestorOf(b,c).

MotherOf(a,b). FatherOf(b,c). FatherOf(b,d).

To ask whether this database entailsB, Prolog adds⊥ ←B and runs the Horn algorithm. If the algorithm fails, Prolog answers

“yes”, otherwise “no”.

(10)

Clauses

Aclauseis a finite set of literals.

Examples:

C1 ={Small(a),Cube(a),BackOf(b,a)}

C2 ={Small(a),Cube(b)}

C3 =∅ ( also written 2)

Any setT of sentences in CNF can be replaced by an equivalent setS of clauses: each conjunct leads to a clause.

(11)

Resolution

A clauseR is a resolvent of clausesC1,C2 if there is an atomic sentenceA withA∈C1 and (¬A)∈C2, such that

R = (C1\ {A})∪(C2\ {¬A}).

Resolution algorithm: Given a set S of clauses, systematically add resolvents. If you add2 at some point, thenS is not satisfiable.

Otherwise (i.e. if no further resolution steps are possible and2has not been added), it is satisfiable.

(12)

Example

We start with the CNF sentence:

¬A∧(B∨C ∨B)∧(¬C ∨ ¬D)∧(A∨D)∧(¬B∨ ¬D) In Clause form:

{¬A}, {B,C}, {¬C,¬D}, {A,D}, {¬B,¬D}

Apply resolution:

{A,D} {¬A}

{D}

{B,C} {¬C,¬D}

{B,¬D} {¬B,¬D}

{¬D}

2

(13)

Soundness and completeness

TheoremResolution is sound and complete. That is, given a set S of clauses, it is possible to arrive at2by successive resolutions if and only ifS is not satisfiable.

This gives us an alternative sound and complete proof calculus by putting

T `S

iff with resolution, we can obtain2 from the clausal form of T ∪ {¬S}.

Referenzen

ÄHNLICHE DOKUMENTE

Accordingly, Addis Ababa's policies now aim to increasingly bind the security complex of the Horn of Africa together with Ethiopia as the hegemon.. For example, Ethiopia has

This sixth edition of the Transatlantic Security Symposium focused on two crucial African regions, namely the Sahel and the Horn of Africa, with a view to address the main

 The  bimodal  bilingual  brain:  fMRI   investigations  concerning  the  cortical  distribution  and  differentiation  of   signed  language  and

Otherwise, assigning false to the yet unassigned atomic sentences makes all the conditionals (and hence also the Horn sentence) true.... Correctness of the

My bathroom is a mess, he ruined my makeover photos and he plays the violin – badlyB. Read Bridget's complaints

3. Ziggy steals Bridget's phone and sends text messages... 4. Bridget is pleased when her old

My bathroom is a mess, he ruined my makeover photos and he plays the violin – badly. Read Bridget's complaints

1. Nick goes to a shop with no clothes on. Ziggy gets upset by Bridget's impersonation of her. Ziggy steals Bridget's phone and sends text messages. Bridget is pleased when her