9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10,...

29
9/18/2000 copyright Brian Williams 1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001

description

9/18/2000copyright Brian Williams3 Assignment Homework: Project proposal due Wed, October 17 th. Complete draft of lecture slides Wed, Oct. 17 th and pass to another team for feedback. Sign up for presentation time.

Transcript of 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10,...

Page 1: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 1

Propositional Logic

Brian C. Williams16.412J/6.834J October 10, 2001

Page 2: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 2

AssignmentsReadings:• Chapter 6 of AIMA• “Generating hard satisfiability problems” by Selman,

Mitchell and Levesque.• Optional Advanced:

• “Finding Hard Instances of the Satisfiability Problem: A Survey” by Cook and Mitchell.

Handout:• Guidelines for Project

Page 3: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 3

AssignmentHomework:• Project proposal due Wed, October 17th.• Complete draft of lecture slides Wed, Oct.

17th and pass to another team for feedback.

• Sign up for presentation time.

Page 4: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 4

Outline

• Why propositional inference?• Propositional logic• Satisfiability by enumeration• Summary

Page 5: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

5copyright Brian Williams9/18/2000

Monitors

Autonomous Agents: What is missing?

Command dispatchFault protectionAttitude control

Mission Goal Scenario

Self-commandingSelf-commandingSelf-diagnosingSelf-diagnosingSelf-repairingSelf-repairing

RECOVERY

PLANNIN

G

EXECUTION

Page 6: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 6

senseP(s)

WORLD

observations actions

AGENT Diagnostic Agent:

• Monitors & Diagnoses

• Repairs & Avoids

• Probes and Tests

Plant

act

Reasons about hidden state

Page 7: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 7

What is Fault Diagnosis?• Given a system with symptomatic behavior,

find diagnoses that eliminate symptoms.

6

6

12 SymptomM1

M2

M3

A1

A2

A

BCD

E

3

223

3

F

G

X

Y

Z

10

12

Constraint Suspension

Page 8: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

8copyright Brian Williams9/18/2000

AI Conventional Wisdom

• “[For reactive systems] proving theorems is out of the question” [Agre & Chapman 87]

Page 9: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 9

Propositional Satisfiability

In recent years, we’ve seen substantial progress in propositional reasoning and search methods.

Boolean satisfiability testing: 1990: 100 variables / 200 clauses (constraints) 1998: 10,000 - 100,000 vars / 10^6 clauses Novel applications: e.g. diagnosis, planning, software / circuit testing, machine learning, and protein folding

Page 10: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 10

Methodology for Fast Inference

Combinatorial Task Propositional Propositional

Logic Encoding Satisfiability Solver

Decode Results

Shift work to “encoding phase’’, use fast, off-the-shelf SAT solver and tools.

Page 11: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 11

Outline

• Why propositional inference?• Propositional logic• Satisfiability by enumeration• Summary

Page 12: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 12

Logic in General

• Logics• formal languages for representing information such

that conclusions can be drawn.

• Syntax • defines the sentences in the language.

• Semantics • define the “meaning” of sentences; • i.e., truth of a sentence in a world.

Page 13: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 13

Propositional Logic:Syntax• Proposition

• Statement that is true or false• (valve v1)• (= voltage high)

• Propositional sentence (S)• S ::= proposition |• (NOT S) |• (OR S1 ... Sn) |• (AND S1 ... Sn)

• Defined Constructs• (implies S1 S2) => ((not S1) OR S2)• (IFF S1 S2) => (AND (IMPLIES S1 S2)(IMPLIES S2 S1))• . . .

Page 14: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 14

Engine Example: propositional logic model(mode(E1) = ok implies (thrust(E1) = on exactly when flow(V1) = on and flow(V2) = on)) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown)

E1

V1 V2

Page 15: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 15

Propositional Logic: SemanticsA model assigns true/false to every proposition symbol P i

• A = True, B = False, C = False

Truth determined by applying boolean operators to model:• Not S is True iff S is False

• S1 and S2 is True iff S1 is True and S2 is True

• S1 or S2 is True iff S1 is True or S2 is True

• S1 implies S2 is True iff S1 is False or S2 is True

• S1 iff S2 is True iff S1 implies S2 is True or S2 implies S1 is True

Page 16: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 16

Entailment and ModelsGiven knowledge base KB, and sentence

KB entails iff is true in all models where KB is true

Example KB = “Giants won”, “Reds won” = “Either the Giants won or the Reds won”

Page 17: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 17

Models and Entailment• m is a model of sentence if is true given m.• M() denotes the set of all models of sentence

Entailment• KB entails iff M(KB) subset M()

M()

M(KB)

Page 18: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 18

Outline

• Why propositional inference?• Propositional logic• Satisfiability by enumeration• Summary

Page 19: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 19

Propositional Inference: Enumeration Method

KB = (A or C) and (B or not C) = A or BDoes KB entail ?

A B C A or C B or not C KB

False False False

False False True

False True False

False True True

True False False

True False True

True True False

True True True

Page 20: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 20

Propositional Inference: Enumeration Method

KB = (A or C) and (B or not C) = A or BDoes KB entail ?

A B C A or C B or not C KB

False False False False True False False

False False True True False False False

False True False False True False True

False True True True True True True

True False False True True True True

True False True True False False True

True True False True True True True

True True True True True True True

Page 21: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 21

Propositional Satisfiability by Enumeration• Assign true or false to an

unassigned proposition.• Backtrack as soon as a

clause is violated.

Example:• C1: Not A or B• C2: Not C or A• C3: Not B or C

AF T

BF T

CF T

CF T

BF T

C CF TF T

Page 22: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 22

Backtrack Search ProcedureBT(phi,A) Input: A cnf theory phi, an assignment A to propositions in

phiOutput: A decision of whether phi is satisfiable.1. If a clause is violated return(false);2. Else if all propositions are assigned return(true);3. Else Q = some unassigned proposition in phi;4. Return (BT(phi, A[Q = True]) or 5. BT(phi, A[Q = False])

Page 23: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 23

Validity and Satisfiability• A sentence is valid if it is true in all models.• A sentence is satisfiable if it is true in some model.• A sentence is unsatisfiable if it is true in no model.

• Validity connects to entailment by the Deduction Theorem:KB entails iff “KB implies ” is valid

• Satisfiability connects to entailment by Reductio Ad Absurdum:KB entails iff “KB and not ” is unsatisfiable.

Page 24: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 24

Types of Logic• Logics are characterized by their primitives• Ontological commitment: – what exists?

• facts, objects, time, beliefs

• Epistemological commitment: - states of knowledge?• True, false, unknown …

Language Ontological Commitment

Epistemological Commitment

Propositional Logic facts True/false/unknownFirst-order Logic Facts,objects,relations True/false/unknown

Temporal logic Facts,objects,relations,times

True/false/unknown

Probability theory facts Degree of belief 0…1Fuzzy logic Degree of truth Degree of belief 0…1

Page 25: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 26

Outline

• Why propositional inference?• Propositional logic• Satisfiability by enumeration• Summary

Page 26: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 27

SummaryLogical agents apply inference to a knowledge base to derive new

information and make decisions.Basic concepts in logic• Syntax: formal structure of sentences.• Semantics: truth of sentence wrt models.• Entailment: necessary truth of a sentence given another.• Inference: deriving sentences from others.• Soundness: derivations produce only entailed sentences.• Completeness: derivations can produce all entailed sentences.• Enumeration method is sound and complete for propositional logic.

Page 27: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 28

Models and Truth• A model assigns true/false to every proposition symbol

• The truth of a sentence wrt a model. is determined by applying boolean operators (and, or, not) to the model.

• A sentence is valid if it is true in all models.• A sentence is satisfiable if it is true in some model.• A sentence is unsatisfiable if it is true in no model.

Page 28: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 29

Propositional Satisfiability by Depth First Search• Assign true or false to an

unassigned proposition.• Backtrack as soon as a

clause is violated.• Satisfiable if assignment

is complete.

Example:• C1: Not A or B• C2: Not C or A• C3: Not B or C

AF T

BF T

CF T

CF T

BF T

C CF TF T

Page 29: 9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams 16.412J/6.834J October 10, 2001.

9/18/2000 copyright Brian Williams 30

EntailmentKB entails

iff is true in all models where KB is true.

Proving Entailment:• KB entails iff (KB implies ) is valid• KB entails iff (KB and not ) is unsatisfiable.

M()

M(KB)