 Download Download Presentation Chapter 1: The Foundations: Logic and Proofs

# Chapter 1: The Foundations: Logic and Proofs

Télécharger la présentation ## Chapter 1: The Foundations: Logic and Proofs

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers 1.5 Rules of Inference 1.6 Introduction to Proofs 1.7 Proof Methods and Strategy

2. 1.1: Propositional Logic Propositions: A proposition is a declarative sentence (that is, a sentence that declares a fact) that is either true or false, but not both.

3. Example 1: All the following declarative sentences are propositions: Washington D.C., is the capital of the USA. 2. Toronto is the capital of Canada 3. 1+1=2. 4. 2+2=3.

4. Example 2: Consider the following sentences. Are they propositions? 1. What time is it? 2. Read this carefully. 3. x+1=2. 4. x+y=z

5. We use letters to denote propositional variables (or statement variables). T: the value of a proposition is true. F: the value of a proposition is false. The area of logic that deals with propositions is called the propositional calculus or propositional logic.

6. Let p and q are propositions: Definition 1: Negation (Not) Symbol: ¬ Statement:“it is not the case that p”. Example: P: I am going to town ¬P: It is not the case that I am going to town; I am not going to town; I ain’tgoin’.

7. Definition 2: Conjunction (And) Symbol: The conjunction pq is true when both p and q are true and is false otherwise. Example: P - ‘I am going to town’ Q - ‘It is going to rain’ PQ: ‘I am going to town and it is going to rain.’

8. t01_1_002.jpg

9. Definition 3: Disjunction (Or) Symbol: The disjunction pq is false when both p and q are false and is true otherwise. Example: P - ‘I am going to town’ Q - ‘It is going to rain’ P  Q: ‘I am going to town or it is going to rain.’

10. Definition 4: Exclusive OR Symbol: The exclusive or of p and q, denote pq, is true when exactly one of p and q is true and is false otherwise. Example: P - ‘I am going to town’ Q - ‘It is going to rain’ P  Q: ‘Either I am going to town or it is going to rain.’

11. Definition 5: Implication If…. Then…. Symbol: The conditional statement pq is false when p is true and q is false, and true P is called the hypothesis and q is called the conclusion. Example: P - ‘I am going to town’ Q - ‘It is going to rain’ P Q: ‘If I am going to town then it is going to rain.’

12. Equivalent Forms If P, then Q P implies Q If P, Q P only if Q P is a sufficient condition for Q Q if P Q whenever P Q is a necessary condition for P

13. Note: The implication is false only when P is true and Q is false! ‘If the moon is made of green cheese then I have more money than Bill Gates’ (?) ‘If the moon is made of green cheese then I’m on welfare’ (?) ‘If 1+1=3 then your grandma wears combat boots’ (?) ‘If I’m wealthy then the moon is not made of green cheese.’ (?) ‘If I’m not wealthy then the moon is not made of green cheese.’ (?)

14. More terminology QP is the CONVERSE of P  Q ¬ Q  ¬ P is the CONTRAPOSITIVE of P  Q ¬ P ¬ Qis the inverse of P  Q Example: Find the converse of the following statement: R: ‘Raining tomorrow is a sufficient condition for my not going to town.’

15. Procedure Step 1: Assign propositional variables to component propositions P: It will rain tomorrow Q: I will not go to town Step 2: Symbolize the assertion R: P  Q Step 3: Symbolize the converse Q  P Step 4: Convert the symbols back into words ‘If I don’t go to town then it will rain tomorrow’ Homework: Find inverse and contrapositive of statements above.

16. Definition 6: Biconditional ‘if and only if’, ‘iff’ Symbol: The biconditional statement pq is true when p and q have the same truth value, and is false otherwise. Biconditional statements are also called bi-implications. Example: P - ‘I am going to town’ Q - ‘It is going to rain’ P Q: ‘I am going to town if and only if it is going to rain.’

17. Translating English Breaking assertions into component propositions - look for the logical operators! Example: ‘If I go to Harry’s or go to the country I will not go shopping.’ P: I go to Harry’s Q: I go to the country R: I will go shopping If......P......or.....Q.....then....not.....R (P Q)  ¬ R

18. Constructing a truth table one column for each propositional variable one for the compound proposition count in binary n propositional variables = 2nrows Construct the truth table for (P  ¬ Q)  (PQ) HW: Construct the truth table for (P Q)  ¬ R

19. t01_1_008.jpg

20. What is the real meaning of ¬ PQ ? a) (¬ P) Q b) ¬ (PQ) What is the real meaning of PQR ? a) (PQ)R b) P(QR) What is the real meaning of P  QR ? a) (P  Q)R b) P  (QR)

21. Logic and Bit Operations Example 20 Find the bitwise OR, bitwise AND, and bitwise XOR of the bit strings 01 1011 0110 and 11 0001 1101.

22. Logic Puzzles Example 18: There are two kind of inhabitants, knights, who always tell the truth, and their opposites, knaves, who always lie. You encounter two people A and B. What are A and B if A says “B is a knight” and B says “The two of us are opposite type”?

23. Inverse • Converse • Contrapositive Terms Proposition Negation Conjection Disjunction Exclusive OR Implication

24. Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers 1.5 Rules of Inference 1.6 Introduction to Proofs 1.7 Proof Methods and Strategy

25. 1.2: Propositional Equivalences Definition: Tautology: A compound proposition that is always true. Contradiction: A compound proposition that is always false. Contingency: A compound proposition that is neither a tautology nor a contradiction.

26. Logical Equivalences Compound propositions that have the same truth values in all possible cases are called logically equivalent. Definition: The compound propositions p and q are called logically equivalent if pq is a tautology. Denote pq.

27. Logical Equivalences One way to determine whether two compound propositions are equivalent is to use a truth table. Symbol: PQ

28. Logical Equivalences • Prove the De Morgan’s Laws.

29. Logical Equivalences • HW: Prove the other one (De Morgan’s Laws).

30. Logical Equivalences Example: Show that pq and ¬pq are logically equivalent. HW: example 4 of page 23

31. Logical Equivalences t01_2_006.jpg

32. Logical Equivalences

33. Logical Equivalences

34. Logical Equivalences Example 5: Use De Morgan’s laws to express the negations of “Miguel has a cellphone and he has a laptop computer”. Example 5: Use De Morgan’s laws to express the negations of “Heather will go to the concert or Steve will go to the concert”.

35. Logical Equivalences • Example 6: Show that ¬(pq) and p ¬q are logically equivalent. • Example 7: Show that ¬(p(¬p  q)) and ¬p  ¬q are logically equivalent by developing a series of logical equivalences. • Example 8: Show that (p  q) (pq) is a tautology.

36. Terms • Tautology • Contradiction • Contingency • Logical Equivalence • De Morgan’s Laws • Commutative Law • Associative Law • Distributive Law

37. Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers 1.5 Rules of Inference 1.6 Introduction to Proofs 1.7 Proof Methods and Strategy

38. Predicates Predicate: A generalization of propositions ; A propositions which contain variables • Predicates become propositions once every variable is bound- by • assigning it a value from the Universe of Discourse U or • quantifying it P. 1

39. Examples: Let U = Z, the integers = {. . . -2, -1, 0 , 1, 2, . . .} P(x): x > 0 is the predicate. It has no truth value until the variable x is bound. Examples of propositions where x is assigned a value: P(-3) (?, true or false); P(0)(?); (c) P(3)(?). The collection of integers for which P(x) is true are the positive integers. P(y) ν ¬ P(0) is not a proposition. The variable y has not been bound. However, P(3) ν ¬ P(0) is a proposition which is true. Predicates P. 1

40. Example: Let R be the three-variable predicate R(x, y, z): x + y = z Find the truth value of R(2, -1, 5), R(3, 4, 7), R(x, 3, z) Predicates P. 1

41. Quantifiers: Universal • P(x) is true for every x in the universe of discourse. • Notation: universal quantifier ∀xP(x) • ‘For all x, P(x)’, ‘For every x, P(x)’ • The variable x is bound by the universal quantifier producing a proposition. • An element for which P(x) is false is called a counterexample of ∀xP(x). • Example: U={1,2,3} ∀xP(x) P(1) ΛP(2) ΛP(3) P. 1

42. Quantifiers: Universal • Example 8: Let P(x) be the statement “x+1>x.” What is the truth value of the quantification ∀ xP(x) where the domain consists of all real number. • HW: P36, example 13 P. 1