1 / 89

# 159.302 LECTURE

159.302 LECTURE. 1. Propositional Logic Syntax. Source: MIT OpenCourseWare. What is a logic?. A formal language. Propositional Logic. What is a logic?. A formal language. Propositional Logic. Syntax – what expressions are legal. What is a logic?. A formal language. Télécharger la présentation ## 159.302 LECTURE

E N D

### Presentation Transcript

1. 159.302LECTURE 1 Propositional Logic Syntax Source: MIT OpenCourseWare

2. What is a logic? A formal language Propositional Logic

3. What is a logic? A formal language Propositional Logic • Syntax – what expressions are legal

4. What is a logic? A formal language Propositional Logic • Syntax – what expressions are legal • Semantics – what legal expressions mean

5. What is a logic? A formal language Propositional Logic • Syntax – what expressions are legal • Semantics – what legal expressions mean • ProofSystem – a way of manipulating syntactic expressions to get other syntactic expressions (which will tell us something new)

6. What is a logic? A formal language Propositional Logic • Syntax – what expressions are legal • Semantics – what legal expressions mean • ProofSystem – a way of manipulating syntactic expressions to get other syntactic expressions (which will tell us something new) Why proofs? • Two kinds of inferences an agent might want to make:

7. What is a logic? A formal language Propositional Logic • Syntax – what expressions are legal • Semantics – what legal expressions mean • ProofSystem – a way of manipulating syntactic expressions to get other sytactic expressions (which will tell us something new) Why proofs? • Two kinds of inferences an agent might want to make: • Multiplepercepts => conclusions about the world

8. What is a logic? A formal language Propositional Logic • Syntax – what expressions are legal • Semantics – what legal expressions mean • ProofSystem – a way of manipulating syntactic expressions to get other sytactic expressions (which will tell us something new) Why proofs? • Two kinds of inferences an agent might want to make: • Multiplepercepts => conclusions about the world • Currentstate & operator => properties of next state

9. Syntax: what you’re allowed to write Propositional Logic • for( thing t=fizz; t == fuzz; t++ ){…}

10. Syntax: what you’re allowed to write Propositional Logic • for(thing t=fizz; t == fuzz; t++){…} • Colorless green ideas sleep furiously.

11. Syntax: what you’re allowed to write Propositional Logic • for(thing t=fizz; t == fuzz; t++){…} • Colorless green ideas sleep furiously. Sentences (wwfs: well-formed formulas)

12. Syntax: what you’re allowed to write Propositional Logic • for(thing t=fizz; t == fuzz; t++){…} • Colorless green ideas sleep furiously. Sentences (wwfs: well-formed formulas) • true and false are sentences

13. Syntax: what you’re allowed to write Propositional Logic • for(thing t=fizz; t == fuzz; t++){…} • Colorless green ideas sleep furiously. Sentences (wwfs: well-formed formulas) • true and false are sentences • Propositional variables are sentences: P, Q, R, Z

14. Syntax: what you’re allowed to write Propositional Logic • for(thing t=fizz; t == fuzz; t++){…} • Colorless green ideas sleep furiously. Sentences (wwfs: well-formed formulas) • true and false are sentences • Propositional variables are sentences: P, Q, R, Z • If φ and ψ are sentences, then so are

15. Syntax: what you’re allowed to write Propositional Logic • for(thing t=fizz; t == fuzz; t++){…} • Colorless green ideas sleep furiously. Sentences (wwfs: well-formed formulas) • true and false are sentences • Propositional variables are sentences: P, Q, R, Z • If φ and ψ are sentences, then so are • Nothing else is a sentence

16. Precedence

17. 159.302LECTURE 2 Propositional Logic Semantics Source: MIT OpenCourseWare

18. Semantics • Meaning of a sentence is truth value {t, f} Propositional Logic

19. Semantics • Meaning of a sentence is truth value {t, f} Propositional Logic • Interpretation is an assignment of truth values to the propositional variables holds( , i) [Sentence is t in interpretation i]

20. Semantics • Meaning of a sentence is truth value {t, f} Propositional Logic • Interpretation is an assignment of truth values to the propositional variables holds( , i) [Sentece is t in interpretation i] fails( , i) [Sentence is f in interpretation i]

21. Semantic Rules holds(true, i) for all i Propositional Logic

22. Semantic Rules holds(true, i) for all i Propositional Logic fails(false, i) for all i

23. Semantic Rules holds(true, i) for all i Propositional Logic fails(false, i) for all i holds( , i) if and only if fails( , i)(negation)

24. Semantic Rules holds(true, i) for all i Propositional Logic fails(false, i) for all i holds( , i) if and only if fails( , i)(negation) holds( , i) iff holds( ,i) and holds( , i)(conjunction)

25. Semantic Rules holds(true, i) for all i Propositional Logic fails(false, i) for all i holds( , i) if and only if fails( , i)(negation) holds( , i) iff holds( ,i) and holds( , i)(conjunction) holds( , i) iff holds( ,i) or holds( , i)(disjunction)

26. Semantic Rules holds(true, i) for all i Propositional Logic fails(false, i) for all i holds( , i) if and only if fails( , i)(negation) holds( , i) iff holds( ,i) and holds( , i)(conjunction) holds( , i) iff holds( ,i) or holds( , i)(disjunction) holds( P, i) iff i(P) = t fails( P, i) iff i(P) = f

27. Some important shorthand (antecedent consequent) Propositional Logic

28. Some important shorthand (antecedent consequent) Propositional Logic

29. Some important shorthand (antecedent consequent) Propositional Logic

30. Some important shorthand (antecedent consequent) Propositional Logic Note that implication is not “causality”, if P is f then is t Implication doesn't mean "is related" in any kind of real-world way

31. Terminology A sentence is valid iff its truth value is t in all interpretations Propositional Logic A sentence is satisfiable iff its truth value is t in at least one interpretation A sentence is unsatisfiable iff its truth value is f in all interpretations All are finitely decidable.

32. Examples contrapositive

33. Examples contrapositive

34. Examples contrapositive

35. Examples contrapositive

36. Examples contrapositive

37. Related to constraint satisfaction • Given a sentence S, try to find an interpretation i such that holds(S,i) Satisfiability • Analogous to finding an assignment of values to variables such that the constraints hold

38. Related to constraint satisfaction • Given a sentence S, try to find an interpretation i such that holds(S,i) Satisfiability • Analogous to finding an assignment of values to variables such that the constraints hold • Brute force method: enumerate all interpretations and check

39. Related to constraint satisfaction • Given a sentence S, try to find an interpretation i such that holds(S,i) Satisfiability • Analogous to finding an assignment of values to variables such that the constraints hold • Brute force method: enumerate all interpretations and check • Better methods: Heuristic search Constraint propagation Stochastic search

40. Scheduling nurses to work in a hospital • propositional variables represent for example, that Pat is working on Tuesday at 2pm Satisfiability Problems • constraints on the schedule are represented using logical expressions over the variables • Finding bugs in software • propositional variables represent state of the program • use logic to describe how the program works and to assert there is a bug • if the sentence is satisfiable, you’ve found the bug!

41. 159.302LECTURE 3 Propositional Logic Proof Source: MIT OpenCourseWare

42. Imagine we knew that: • If today is sunny, then Tomas will be happy A Good lecture? • If Tomas is happy, the lecture will be good • Today is sunny Should we conclude that the lecture will be good?

43. Checking Interpretations Good lecture!

45. A knowledge base (KB) entails a sentence S iff every interpretation that makes KB true also makes S true Entailment

46. enumerate all interpretations • select those in which all elements of KB are true Computing Entailment • check to see if S is true in all of those interpretations

47. enumerate all interpretations • select those in which all elements of KB are true Computing Entailment • check to see if S is true in all of those interpretations • Way too many interpretations, in general!!

48. A proof is a way to test whether a KB entails a sentence, without enumerating all possible interpretations Entailment and Proof

49. A proof is a sequence of sentences • First ones are premises (KB) Proof • Then, you can write down on the next line the result of applying an inference rule to previous lines • When S is on a line, you have provedS from KB • If inference rules are sound, then any S you can prove from KB is entailed by KB • If inference rules are complete, then any S that is entailed by KBcan be proven from KB

50. Some inference rules: Natural Deduction Modus ponens

More Related