+ All Categories
Home > Documents > Propositional Logic

Propositional Logic

Date post: 15-Mar-2016
Category:
Upload: reuben-simmons
View: 40 times
Download: 1 times
Share this document with a friend
Description:
Propositional Logic. Russell and Norvig Chapter 7. sensors. environment. ?. agent. actuators. Knowledge base. Knowledge-Based Agent. A simple knowledge-based agent. The agent must be able to: Represent states, actions, etc. Incorporate new percepts - PowerPoint PPT Presentation
Popular Tags:
52
Propositional Logic Propositional Logic Russell and Norvig Chapter 7
Transcript
Page 1: Propositional Logic

Propositional LogicPropositional Logic

Russell and NorvigChapter 7

Page 2: Propositional Logic

Knowledge-Based AgentKnowledge-Based Agent

environmentagent

?

sensors

actuators

Knowledge base

Page 3: Propositional Logic

A simple knowledge-based agent

The agent must be able to: Represent states, actions, etc. Incorporate new percepts Update internal representations of the world Deduce hidden properties of the world Deduce appropriate actions

Page 4: Propositional Logic

Types of KnowledgeTypes of Knowledge

Procedural, e.g.: functions Such knowledge can only be used in one way -- by executing it

Declarative, e.g.: constraints It can be used to perform many different sorts of inferences

Page 5: Propositional Logic

LogicLogicLogic is a declarative language to:

Assert sentences representing facts that hold in a world W (these sentences are given the value true)

Deduce the true/false values to sentences representing other aspects of W

Page 6: Propositional Logic

Wumpus World PEAS descriptionPerformance measure

gold +1000, death -1000 -1 per step, -10 for using the arrow

Environment Squares adjacent to wumpus are smelly Squares adjacent to pit are breezy Glitter iff gold is in the same square Shooting kills wumpus if you are facing it Shooting uses up the only arrow Grabbing picks up gold if in same square Releasing drops the gold in same square

Sensors: Stench, Breeze, Glitter, Bump, ScreamActuators: Left turn, Right turn, Forward, Grab, Release, Shoot

Page 7: Propositional Logic

Wumpus world characterization

Fully Observable No – only local perceptionDeterministic Yes – outcomes exactly specifiedEpisodic No – sequential at the level of actionsStatic Yes – Wumpus and Pits do not moveDiscrete YesSingle-agent? Yes – Wumpus is essentially a natural feature

Page 8: Propositional Logic

Exploring a wumpus world

Page 9: Propositional Logic

Exploring a wumpus world

Page 10: Propositional Logic

Exploring a wumpus world

Page 11: Propositional Logic

Exploring a wumpus world

Page 12: Propositional Logic

Exploring a wumpus world

Page 13: Propositional Logic

Exploring a wumpus world

Page 14: Propositional Logic

Exploring a wumpus world

Page 15: Propositional Logic

Exploring a wumpus world

Page 16: Propositional Logic

Logic in generalLogics are formal languages for representing information such that conclusions can be drawnSyntax defines the sentences in the languageSemantics define the "meaning" of sentences; i.e., define truth of a sentence in a

world

Page 17: Propositional Logic

Connection World-Connection World-RepresentationRepresentation

World WConceptualization

Facts about Whold

hold

Sentencesrepresent

Facts about W

represent

Sentencesentail

Page 18: Propositional Logic

Examples of LogicsExamples of Logics

Propositional calculus A B C First-order predicate calculus ( x)( y) Mother(y,x) Logic of Belief B(John,Father(Zeus,Cronus))

Page 19: Propositional Logic

ModelModel

A model of a sentence is an assignment of a truth value – true or false – to every atomic sentence such that the sentence evaluates to true.

Page 20: Propositional Logic

Model of a KBModel of a KB

Let KB be a set of sentences

A model m is a model of KB iff it is a model of all sentences in KB, that is, all sentences in KB are true in m.

Page 21: Propositional Logic

Satisfiability of a KBSatisfiability of a KBA KB is satisfiable iff it admits at least one model; otherwise it is unsatisfiable

KB1 = {P, QR} is satisfiable

KB2 = {PP} is satisfiable

KB3 = {P, P} is unsatisfiablevalid sentenceor tautology

Page 22: Propositional Logic

Logical EntailmentLogical Entailment

KB : set of sentences : arbitrary sentence KB entails – written KB – iff every model of KB is also a model of Alternatively, KB iff {KB,} is unsatisfiable KB is valid

Page 23: Propositional Logic

Inference RuleInference Rule

An inference rule {, } consists of 2 sentence patterns and called the conditions and one sentence pattern called the conclusion If and match two sentences of KB then the corresponding can be inferred according to the rule

Page 24: Propositional Logic

InferenceInference

I: Set of inference rules KB: Set of sentences Inference is the process of applying successive inference rules from I to KB, each rule adding its conclusion to KB

Page 25: Propositional Logic

Example: Modus PonensExample: Modus Ponens

From Battery-OK Bulbs-OK Headlights-Work Battery-OK Bulbs-OKInfer Headlights-Work

{ , }

{, }

Page 26: Propositional Logic

Connective symbol (implication)

Logical entailment

Inference

KB iff KB is valid

Page 27: Propositional Logic

SoundnessSoundness An inference rule is sound if it generates only entailed sentences All inference rules previously given are sound, e.g.:modus ponens: { , } The following rule: { , } is unsound, which does not mean it is useless (an inference rule for abduction, outside scope of this course)

Page 28: Propositional Logic

Is each of the following a sound inference rule?

{ , }

{ , }

Page 29: Propositional Logic

CompletenessCompleteness

A set of inference rules is complete if every entailed sentences can be obtained by applying some finite succession of these rulesModus ponens alone is not complete, e.g.:from A B and B, we cannot get A

Page 30: Propositional Logic

ProofProofThe proof of a sentence from a set of sentences KB is the derivation of by applying a series of sound inference rules

Page 31: Propositional Logic

ProofProofThe proof of a sentence from a set of sentences KB is the derivation of by applying a series of sound inference rules 1. Battery-OK Bulbs-OK Headlights-Work

2. Battery-OK Starter-OK Empty-Gas-Tank Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Headlights-Work5. Battery-OK6. Starter-OK 7. Empty-Gas-Tank 8. Car-OK 9. Battery-OK Starter-OK by 5,610. Battery-OK Starter-OK Empty-Gas-Tank by 9,711. Engine-Starts by 2,1012. Engine-Starts Flat-Tire by 3,813. Flat-Tire by 11,12

Page 32: Propositional Logic

Inference ProblemInference Problem Given: KB: a set of sentence : a sentence Answer: KB ?

Page 33: Propositional Logic

KB iff {KB,} is unsatisfiable

Deduction vs. Satisfiability Deduction vs. Satisfiability TestTest

Hence:• Deciding whether a set of

sentences entails another sentence, or not

• Testing whether a set of sentences is satisfiable, or not

are closely related problems

Page 34: Propositional Logic

Complementary LiteralsComplementary Literals

A literal is a either an atomic sentence or the negated atomic sentence, e.g.: P, P

Two literals are complementary if one is the negation of the other, e.g.: P and P

Page 35: Propositional Logic

Unit Resolution RuleUnit Resolution Rule

Given two sentences: L1 … Lp and M where Li,…, Lp and M are all literals, and M and Li are complementary literalsInfer: L1 … Li-1 Li+1 … Lp

Page 36: Propositional Logic

ExamplesExamplesFrom:

Engine-Starts Car-OKEngine-Starts

Infer:Car-OK From:

Engine-Starts Car-OKCar-OK

Infer: Engine-Starts

Modus ponens

Modus tollens

Engine-Starts Car-OK

Page 37: Propositional Logic

Shortcoming of Unit Shortcoming of Unit ResolutionResolution

From: Engine-Starts Flat-Tire Car-OK Engine-Starts Empty-Gas-Tank

we can infer nothing!

Page 38: Propositional Logic

Full Resolution RuleFull Resolution Rule

Given two clauses: L1 … Lp and M1 … Mq where Li and Mj are complementrary

Infer the clause: L1 … Li-1Li+1…LkM1 … Mj-1Mj+1…Mk

Page 39: Propositional Logic

ExampleExample

From:Engine-Starts Flat-Tire Car-OKEngine-Starts Empty-Gas-Tank

Infer:Empty-Gas-Tank Flat-Tire Car-OK

Page 40: Propositional Logic

ExampleExample

From:P Q ( P Q)Q R ( Q R)

Infer: P R ( P R)

Page 41: Propositional Logic

Not All Inferences are Not All Inferences are Useful! Useful!

From:Engine-Starts Flat-Tire Car-OKEngine-Starts Flat-Tire

Infer: Flat-Tire Flat-Tire Car-OK

Page 42: Propositional Logic

Not All Inferences are Not All Inferences are Useful!Useful!

From:Engine-Starts Flat-Tire Car-OKEngine-Starts Flat-Tire

Infer: Flat-Tire Flat-Tire Car-OK

tautology

Page 43: Propositional Logic

Not All Inferences are Not All Inferences are Useful!Useful!

From:Engine-Starts Flat-Tire Car-OKEngine-Starts Flat-Tire

Infer: Flat-Tire Flat-Tire Car-OK True

tautology

Page 44: Propositional Logic

ExampleExample1. Battery-OK Bulbs-OK Headlights-Work2. Battery-OK Starter-OK Empty-Gas-Tank Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Headlights-Work5. Battery-OK6. Starter-OK 7. Empty-Gas-Tank 8. Car-OK 9. Flat-Tire

We want to show Flat-Tire, given clauses 1-8. Using resolution, we can showthat clauses 1-8 along with clause 9 deduce an empty clause.

Can you trace the resolution steps?

Page 45: Propositional Logic

Sentence Sentence Clause Form Clause FormExample:

(A B) (C D)

1. Eliminate (A B) (C D)2. Reduce scope of (A B) (C D)3. Distribute over

(A (C D)) (B (C D))(A C) (A D) (B C) (B D)

Set of clauses:{A C , A D , B C , B D}

Page 46: Propositional Logic

Resolution Refutation Resolution Refutation AlgorithmAlgorithm

RESOLUTION-REFUTATION(KB)clauses set of clauses obtained from KB and new {}Repeat:

For each C, C’ in clauses dores RESOLVE(C,C’)If res contains the empty clause then return yesnew new U resIf new clauses then return noclauses clauses U new

Page 47: Propositional Logic

Efficient Propositional Inference

Two families of efficient algorithms for propositional inference:

Complete backtracking search algorithmsDPLL algorithm (Davis, Putnam, Logemann, Loveland)Incomplete local search algorithms

WalkSAT algorithm

Page 48: Propositional Logic

The DPLL algorithmDetermine if an input propositional logic sentence (in CNF) is satisfiable.

Improvements over truth table enumeration:1. Early termination

A clause is true if any literal is true.A sentence is false if any clause is false.

2. Pure symbol heuristicPure symbol: always appears with the same "sign" in all clauses. e.g., In the three clauses (A B), (B C), (C A), A and B are

pure, C is impure. Make a pure symbol literal true.

3. Unit clause heuristicUnit clause: only one literal in the clauseThe only literal in a unit clause must be true.

Page 49: Propositional Logic

Horn ClausesHorn Clause

A clause with at most one positive literal. KB: A Horn clause with one positive literal which can be written as α1 … αn β

Query: A Horn clause without positive literal α1 … αn I.e. ( α1 … αn )

Horn clause logic is the basis for Logic Programming

Page 50: Propositional Logic

Forward chaining for Horn Clauses

Idea: fire any rule whose premises are satisfied in the KB,

add its conclusion to the KB, until query is found

Page 51: Propositional Logic

Backward chaining for Horn Clasues

Idea: work backwards from the query q:to prove q by BC,

check if q is known already, orprove by BC all premises of some rule concluding q

Avoid loops: check if new subgoal is already on the goal stack

Avoid repeated work: check if new subgoal1. has already been proved true, or2. has already failed3.

Page 52: Propositional Logic

SummarySummary Propositional Logic Model of a KB Logical entailment Inference rules Resolution rule Clause form of a set of sentences Resolution refutation algorithm DPLL algorithm Horn clauses


Recommended