Top Banner
Reasoning Algorithms in Propositional Logic Examination will be a take-home exam; confirmation coming as soon as signed course evaluation is received in registrar’s office
24

Reasoning Algorithms in Propositional Logic

Feb 05, 2016

Download

Documents

Qamar

Reasoning Algorithms in Propositional Logic. Examination will be a take-home exam; confirmation coming as soon as signed course evaluation is received in registrar’s office. Knowledge representation and reasoning. Propositions, general knowledge, facts, KB, model -> big truth table. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Reasoning Algorithms in Propositional Logic

Reasoning Algorithmsin Propositional Logic

Examination will be a take-home exam;confirmation coming as soon as signed course

evaluation is received in registrar’s office

Page 2: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 2

Knowledge representationand reasoning

Propositions, general knowledge, facts, KB, model-> big truth table

Propositions KB: general knowledge & facts

t t f t f t f f f t t t t t t t t t t t t t t t t t t t t t t t t t t t t model

The reasoning problems:

1. Find t/f assignment(s) model(s) where KB is true

2. Answering questions “entailed” by KB

Page 3: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 3

Approaches to reasoning

N propositions to satisfy KB1. Search through 2N rows of truth table:

goal-based search, fitness is truth of KB (SAT)

2. Use inference: restrict attention to relevant propositions (assumes many models satisfy the KB and many propositions might be “don’t care”)

Page 4: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 4

Approaches to Reasoning:strategies

1. Searcha) Depth-first exhaustive search from start

state of ‘empty’ truth tableb) Hill-climbing from random start state of

true-false assignments

2. Inferencea) Forward chaining from KB to queryb) Backward chaining from query into KB

Page 5: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 5

Propositional satisfiability Problem (SAT)

Definition (Hoos & Stutzle, 2005)“Given a propositional formula F, the

problem is to decide whether or not F is satisfiable.”

F = KB (facts + general knowledge)

Page 6: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 6

Propositional satisfiability Problem (SAT)

State: a vector of truth values for the n propositions

State space: 2n nodesGoal state(s): KB is true (a model)e.g., n = 5, {P1,P2,P3,P4,P5}

t t f t f f t f t f

t t t t f

t - f

t - f

KB = (P1P2) (P2P1)

(P1 P2 P3)

(P2P1) (P4P3)

(P5P3) etc.

1 b)

Page 7: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 7

Propositional satisfiability Problem (SAT)

TT-ENTAILS is depth-first search, exhaustive, incremental Improvement in efficiency by pruning: DPLL –

p.221 early termination pure symbol heuristic unit clause heuristic

WALKSAT: complete state algorithm – reduce number of false clauses by flipping propositions

true<->false

Page 8: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 8

Propositional satisfiability Problem (SAT)

Answers a question: Is a sentence a true in the KB?i.e., is the sentence true in all models of the KB which

are true? OR is (KBa) true?

t t t t f

t t t

f

t

KB = (P1P2) (P2P1)

(P1 P2 P3)

(P2P1) (P4P3)

(P5P3) etc.

Question: (P1P5) ?

1 a)

Page 9: Reasoning Algorithms in Propositional Logic

at root – no truth values assigned

KB, α both true?

KB false

P both true and false

1 a)

Page 10: Reasoning Algorithms in Propositional Logic

t t t t f

t t t

f

t

KB = (P1P2) (P2P1)

(P1 P2 P3)

(P2P1) (P4P3)

(P5P3) etc.

Question: (P1P5) ?

Propositions KB

P1 P2 P3 P4 P5 (P1P2)(P2P1)(P1P2P3)(P2P1)(P4P3)(P5P3) (P1P5)

Question

t t t t t t tt f t t t

t t t t f t tt f t t t

f f f f f t ft t f t t

… … … …

KB Q

t

t

t

TT-ENTAILS returns true if KB Q is true for all cases;

i.e., there is no row with KB true and Q false

TT-ENTAILS1 a)

Page 11: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 11

Variations on TT-ENTAILS

For efficiency: (see p.221) Early termination (pruning) Pure symbol heuristic Unit clause heuristic

Page 12: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 12

Propositional satisfiability Problem (SAT)

WALKSAT, p.223 (complete state search)Checks satisfiabilityi.e., are there models of the KB which are true?

t t f t f f t f t f

t t t t f

t - f

t - f

KB = (P1P2) (P2P1)

(P1 P2 P3)

(P2P1) (P4P3)

(P5P3) etc.

Question: KB satisfiable?1 b)

Page 13: Reasoning Algorithms in Propositional Logic

1 b)

Page 14: Reasoning Algorithms in Propositional Logic

t t f t f f t f t f

t t t t f

t - f

t - f

KB = (P1P2) (P2P1)

(P1 P2 P3)

(P2P1) (P4P3)

(P5P3) etc.

Question: KB satisfiable?

f t f t frandom Satisfied? truey

flip t/f of random proposition in clause

flip t/f of proposition in clause that

minimizes number of false clauses

Probability p

pick random false clause

Give up? falsey

WALKSAT

1 b)

Page 15: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 15

WALKSAT performance

Not guaranteed to find solution(not exhaustive like TT-ENTAILS)

More effective in practice thanTT-ENTAILS, even with efficiencyheuristics (DPLL)

1 b)

Page 16: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 16

Approaches to reasoning

N propositions to satisfy KB1. Search through 2N rows of truth table:

goal-based search, fitness is truth of KB (SAT)

2. Use inference: restrict attention to relevant propositions (assumes many models satisfy the KB and many propositions might be “don’t care”)

Page 17: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 17

Inference rule: Resolution

elimination of complementary literals from sentences in CNF

(~W \/ ~Q \/ T) Λ (W \/ P) (~Q \/ T \/ P)

inference by resolution is Sound – only infers true statements Complete – anything entailed is derivable

Part of KB

New proposition

Page 18: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 18

Resolution: Example (P11 \/ P22 \/ P13) ~P11

~P22

resolve (P11 \/ P22 \/ P13), ~P11

(P22 \/ P13) resolve (P22 \/ P13), ~P22

P13

(from Wumpus world)

Part of KB

Page 19: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 19

Resolution algorithm

goal-directed proof by contradiction to prove P

assume ~P add ~P to KB resolve in KB till resulting sentence is

1. in KB (therefore P is false)2. empty (therefore ~P is contradictory so P is

true)

Page 20: Reasoning Algorithms in Propositional Logic

Figure 7.12 p.216

α leads to

contradition

therefore

α is true

α is consistent

with KB so

α is false

Page 21: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 21

Horn clause inference method compromise representation that is

human-readable basic of logic programming (Prolog) uses modus ponens, not resolution like CNF but restricted to only one

positive proposition(~W \/ ~Q \/ ~S \/ T)

=> ~(W Λ Q Λ S) \/ T => (W Λ Q Λ S) T

2 a)

Page 22: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 22

Forward chaining inference with Horn clauses

algorithm to determine if a particular proposition is true

O(n) in size of KB!! p. 219, Fig 7.14

2 a)

Page 23: Reasoning Algorithms in Propositional Logic

Figure 7.14 p.219

Reasoning by FORWARD chaining

•From the known data “forward” to unknown

•Doesn’t need goal – self-directed agent

2 a)

Page 24: Reasoning Algorithms in Propositional Logic

D Goforth - COSC 4117, fall 2006 24

Reasoning by BACKWARD chaining

Goal-directed reasoning – question answering agent

Backward (KB, Q) //answer query Q If Q true in KB, return true For each Horn clause (P=>Q) in KB,

If Backward (KB, P), return true Return false

2 b)