cs2100 discrete mathematics
play

CS2100: Discrete Mathematics Propositional Logic John Augustine - PDF document

CS2100: Discrete Mathematics Propositional Logic John Augustine CS2100 (Odd 2012): Propositional Logic Why Logic? Logic is a science of the necessary laws of thought, without which no employment of the understanding and the reason takes


  1. CS2100: Discrete Mathematics Propositional Logic John Augustine CS2100 (Odd 2012): Propositional Logic

  2. Why Logic? Logic is a science of the necessary laws of thought, without which no employment of the understanding and the reason takes place. (Immanuel Kant, 1785) Logic is the glue for mathematics. It helps us put together correct arguments that “prove” our claims. Mathematics can be thought of as the “logical consequence” of a few basic premises. But why logic or mathematics for CSE? We need to give guarantees that our programs and computer systems work correctly. CS2100 (Odd 2012): Propositional Logic 1

  3. Let’s argue An assertion is a statement that you claim to be true. But why should I believe you? An argument is a sequence of statements aimed at demonstrating the truth of an assertion. The last assertion is called the conclusion. The preceding assertions are called premises. Each premise is either • a statement that we agree is true, or, • a statement that follows from preceding premises. CS2100 (Odd 2012): Propositional Logic 2

  4. Example 1. S1: If the program syntax is incorrect or there is a division by zero, then the computer will display an error message. S2: The computer does not display an error message. S3: Therefore, the program syntax is correct and there is no division by zero. What are the premises and what is the conclusion? Is the argument correct? If so, why? If not, why not? Example 2. S1: If x < − 2 or if x > 2 , then x 2 > 4 . S2: x 2 ≤ 4 . S3: Therefore, x > − 2 and if x < 2 . CS2100 (Odd 2012): Propositional Logic 3

  5. Form and Content To a careful observer, there is some “fundamental” similarity between Examples 1 and 2. Let’s explore that similarity carefully. Let’s assign letters to each component statement in Example 1. p : the program syntax is incorrect q : there is a division by zero r : the computer will display an error message Now Example 1 becomes If p or q , then r . It is not r Therefore, p and q . Notice that this skeleton or form of our argument is not dependent on the content added in Example 1. In fact, Example 2 follows the same form, but with different content. CS2100 (Odd 2012): Propositional Logic 4

  6. Proposition A statement or a proposition is a declarative sentence that is either true or false, but not both. — Each proposition is denoted by a variable — It can be true (denoted T ) or false (denoted F ) The negation of p is “it is not the case that p .” — The negation of a proposition p is denoted ¬ p A compound proposition or compound statement is obtained by combining two or more propositions. CS2100 (Odd 2012): Propositional Logic 5

  7. The conjunction of p and q is “p and q.” — It is denoted p ∧ q . Table 1: Truth Table for p ∧ q p ∧ q p q T T T T F F F T F F F F The disjunction of p and q is “p or q.” — It is denoted p ∨ q . Table 2: Truth Table for p ∨ q p ∨ q p q T T T T F T F T T F F F CS2100 (Odd 2012): Propositional Logic 6

  8. The exclusive nor of p and q is true if exactly one of p or q is true. — It is denoted by p ⊕ q . Table 3: Truth Table for p ⊕ q p ⊕ q p q T T F T F T F T T F F F CS2100 (Odd 2012): Propositional Logic 7

  9. Conditional Statement The conditional statement p → q if the proposition “if p , then q .” It is false when p is true and q is false; otherwise it is true. In p → q , p is called the — hypothesis or — antecedent or — premise and q is called the conclusion. Its Propositional form is ¬ p ∨ q . Table 4: Truth Table for p → q ¬ p p → q ¬ p ∨ q p q T T F T T T F F F F F T T T T F F T T T CS2100 (Odd 2012): Propositional Logic 8

  10. Consider p → q . It can be stated in many ways in English. E.g., “If p , then q ” or “if p , q ” p implies q p only if q p is sufficient for q q is a necessary condition for p q unless ¬ p When the hypothesis is false, the conditional statement is said to be vacuously true. Why is it true? Why not false? CS2100 (Odd 2012): Propositional Logic 9

  11. Converse: q → p Contrapositive: ¬ q → ¬ p Inverse: ¬ p → ¬ q . Question. Which of the above is true if p → q ? A biconditional statement p ↔ q is the proposition “ p if and only if q .” Table 5: Truth Table for p ⊕ q p ↔ q p q T T T T F F F T F F F T CS2100 (Odd 2012): Propositional Logic 10

  12. Evaluating Propositional Form Exercise 3. Can you denote the exclusive or operator ⊕ using only ∧ , ∨ , and ¬ ? Exercise 4. Can you construct the truth table for ( p ∧ q ) ∨ ¬ p ? Operator Precedence must be observed to avoid ambiguity. 1. Negation ¬ 2. Logical And ∧ 3. Logical Or ∨ 4. Conditional → 5. Bi-conditional ↔ CS2100 (Odd 2012): Propositional Logic 11

  13. Logical Equivalence A compound proposition is a — a tautology if it is always true — a contradiction if it is always false — a contingency if it is neither. Table 6: Truth Table illustrating a tautology and a contradiction. ¬ p p ∨ ¬ p p ∧ ¬ p p T F T F F T T F The compound propositions p and q are logically equivalent if p ↔ q is a tautology. It is denoted by p ≡ q . CS2100 (Odd 2012): Propositional Logic 12

  14. Testing Logical Equivalence 1. Construct truth table for both p and q . 2. If all corresponding truth values for p and q are the same, then p ≡ q . Otherwise, p �≡ q . Example 5. Is ¬ ( p ∧ q ) ≡ ¬ p ∧ ¬ q ? Table 7: Truth Table illustrating ¬ ( p ∧ q ) �≡ ¬ p ∧ ¬ q . ¬ ( p ∧ q ) ¬ p ¬ q p ∧ q ¬ p ∧ ¬ q p q T T F F T F F T F F T F T � = F F T T F F T � = F F F T T F T T CS2100 (Odd 2012): Propositional Logic 13

  15. Well-known Logical Equivalences Commutative Laws: (i) p ∧ q ≡ q ∧ p and (ii) p ∨ q ≡ q ∨ p Associative Laws: (i) p ∧ ( q ∧ r ) ≡ ( p ∧ q ) ∧ r and (ii) with ∨ Distributive Laws: (i) p ∧ ( q ∨ r ) ≡ ( p ∧ q ) ∨ ( p ∧ r ) and (ii) p ∨ ( q ∧ r ) ≡ ( p ∨ q ) ∧ ( p ∨ r ) Identity Laws: (i) p ∧ T ≡ p and (ii) p ∨ F ≡ p . Negation Law: (i) p ∨ ¬ p ≡ T Double Negation Law: ¬ ( ¬ p ) ≡ p Idempotent Laws: (i) p ∧ p ≡ p and (ii) p ∨ p ≡ p De Morgan’s Laws: (i) ¬ ( p ∧ q ) ≡ ¬ p ∨ ¬ q and (ii) ¬ ( p ∨ q ) ≡ ¬ p ∧ ¬ q Universal Bounds Laws: (i) p ∨ T ≡ T and (ii) p ∧ F ≡ F Absorption Laws: (i) p ∨ ( p ∧ q ) ≡ p and (ii) p ∧ ( p ∨ q ) ≡ p CS2100 (Odd 2012): Propositional Logic 14

  16. Exercise 6. Write the negation of the following. 1. It was hot and it was humid. 2. Ram is wet from the rain or he just completed his daily jog. Exercise 7. Simplify the following compound proposition ¬ ( ¬ p ∧ q ) ∧ ( p ∨ q ) . CS2100 (Odd 2012): Propositional Logic 15

  17. Lets Argue Again Recall that an argument is a sequence of statements or propositions. An argument form is a sequence of propositional forms. You can think of the argument form as the skeleton of an argument. When an argument form is fleshed in with propositions (i.e., actual statements that can be either true or false), you get an argument. The last proposition is called the conclusion. The other propositions are called premises. A argument form is valid if for every truth assignment that renders all premises to be true, the conclusion is also true. An argument is valid if its argument form is valid. Counterintuitive Note: A valid argument does not necessarily imply that the conclusion is true. The make matters worse, an invalid argument could end with a true conclusion. CS2100 (Odd 2012): Propositional Logic 16

  18. Example 8. The following is an argument. S1: If the network is congested, then your message will be lost. S2: Your message was lost. Conclusion: The network is congested. The argument form of the above argument is: S1 : p → q S2 : q Conclusion : p Is the above example of an argument valid? No! When we set p to be false and q to be true, all the premises are true, but the conclusion is false. CS2100 (Odd 2012): Propositional Logic 17

  19. Rules of Inference Any valid argument form is a rule of inference, but we will highlight a few “named” rules of inference. Modus Ponens or Method of Affirming. p → q p ∴ q Modus Tollens or Method of Denying. p → q ¬ q ∴ ¬ p Generalization. p ∴ p ∨ q CS2100 (Odd 2012): Propositional Logic 18

  20. Specialization. p ∧ q ∴ p Elimination. p ∨ q ¬ q ∴ p Transitivity. p → q q → r ∴ p → r CS2100 (Odd 2012): Propositional Logic 19

  21. Conjunction. p q ∴ p ∧ q Resolution Principle. p ∨ q � = p ∨ r ∴ q ∨ r CS2100 (Odd 2012): Propositional Logic 20

  22. Common Fallacies Fallacies are errors in reasoning. Converse Error or Fallacy of Affirming the Consequent. p → q q ∴ p Inverse Error or Fallacy of Denying the Hypothesis. p → q ¬ p ∴ ¬ q Begging the Question or Circular Reasoning. Using the conclusion to prove the conclusion. Ambiguous Premises. Jumping to a Conclusion. CS2100 (Odd 2012): Propositional Logic 21

  23. Hypothesis Testing When we seek to solve problems using logic, we can postulate a hypothesis and see if it leads to a contradiction. If it does lead to a contradiction, we can assume that our hypothesis is false. “Postulating a hypothesis” is just a fancy phrase for setting the truth value of a proposition. CS2100 (Odd 2012): Propositional Logic 22

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend