CmSc 175 Discrete Mathematics A. Propositional Logic 1. Statements (Propositions ): Statements are sentences that claim certain things. Can be either true or false, but not both. Propositional logic deals with propositions Propositional constants: T true; F - false Propositional variables can have T or F value. Atomic propositions: they cannot be further subdivided e.g. The sun is shining Compound propositions: Not atomic, contain at least one logical connective The sun is shining and the sky is blue 2. Basic logical connectives: AND, OR, NOT Truth Tables a. Negation (NOT, ~, ) P ~P ------------------ T F F T ~P is true if and only if P is false b. Conjunction (AND, Λ) P Q P Λ Q ------------------------ T T T T F F F T F F F F P Λ Q is true iff both P and Q are true. In all other cases P Λ Q is false c. Inclusive or (OR, V) P Q P V Q ------------------------ T T T T F T F T T F F F P V Q is true iff P is true or Q is true or both are true. P V Q is false iff both P and Q are false 1
d. Conditional, known also as implication ( ) P Q P Q ------------------------ T T T T F F F T T F F T The implication P Q is false iff P is true however Q is false. In all other cases the implication is true Logical equivalences Commutative laws P v Q Q v P P ^ Q Q ^ P Associative laws (P v Q) v R P v (Q v R) Distributive laws: Identity (P ^ Q) ^ R P ^v (Q ^ R) (P v Q) ^ (P v R) P v (Q ^ R) (P ^ Q) v (P ^ R) P ^ (Q v R) P v F P, P ^ T P Negation P v ~P T (excluded middle) P ^ ~P F Double negation ~(~P) P Idempotent laws P v P P De Morgan's Laws Universal bound laws (Domination) Absorption Laws P ^ P P ~(P v Q) ~P ^ ~Q ~(P ^ Q) ~P v ~Q P v T T P ^ F F (contradiction) P v (P ^ Q) P, P ^ (P v Q) P Negation of T and F ~T F, ~F T 2
3. Conditionals P Q False only when P = T and Q = F True for all other values of P and Q Representing the conditional by means of disjunction P Q P V Q Rewrite P V Q as a conditional: ~P Q If the book is not in the library then it is in the bookstore. Negation of conditional statements ~(P Q) = ~( ~ P V Q) = P Λ ~Q Example: If the book is not in the library then it is in the bookstore. Negation: The book is not in the library and it is not in the bookstore. Comments: P Q means: if P is true then Q is also true. The negation is: P is true, however Q is false. The negation of a conditional statement is a conjunction, not another if-then statement Which expressions when negated will result in conditional statements? Answer: conjunctions. Why? - the negation of a conjunction is a disjunction (De Morgan laws) Any disjunction is equivalent to an if-then statement. P Q Converse: Q P (Change position) Inverse: ~P ~Q (Change sign) Contrapositive: ~Q ~P (Change both position and sign) The conditional is equivalent to its contrapositive. The inverse is equivalent to the converse. 3
Necessary and sufficient conditions P Q P is a sufficient condition for Q Q is a necessary condition for P P only if Q : P Q P unless Q : Q P 4. Syllogisms (Patterns of arguments, inference rules) 4.1. Modus Ponens and Modus Tollens Modus ponens (method of affirming) (1) If P then Q (2) P Therefore (3) Q Example: If it is Sunday we go fishing. It is Sunday Therefore we go fishing Modus Tollens (method of denying) (1) If P then Q (2) ~Q Therefore (3) ~P Example: If it is Sunday we go fishing. We do not go fishing Therefore it is not Sunday Examples of invalid arguments: Inverse error If it is Sunday we go fishing It is not Sunday Therefore we do not go fishing Converse error If it is Sunday we go fishing We go fishing Therefore it is Sunday 4.2. Disjunctive syllogism Therefore (1) P V Q (2) ~P (3) Q 4
Example: During the weekend we either go fishing or we play cards This weekend we did not go fishing Therefore, this weekend we were playing cards 4.3. Hypothetical syllogism Therefore (1) P Q (2) Q R (3) P R Example: If we win the game we will get much money. If we have money we will go on a trip to China. Therefore, if we win the game we will go on a trip to China Inference rules A B, A, therefore B A B, ~B, therefore ~A Modus ponens Modus tollens A, therefore A V B Disjunctive addition A, B, therefore A Λ B Conjunctive addition A Λ B, therefore A A Λ B, therefore B A V B, ~A, therefore B Conjunctive simplification Disjunctive syllogism A V B, ~B, therefore A A B, B C, therefore A C Hypothetical syllogism A V B, A R, B R, therefore R Dilemma, proof by division into cases A B, ~A B, therefore B ~P F, therefore P Law of contradiction A B, therefore A B, B A Equivalence elimination A B, B A, therefore A B Equivalence introduction A, ~A, therefore B Inconsistency law 5
B. Predicate logic General: Predicates describe properties and relations. A predicate is a sentence that contains a finite number of variables and becomes a statement when specific values are substituted for the variables. Predicates may have one or more variables, e.g. student(x), mother(x,y) QUANTIFIERS IN PREDICATE LOGIC A. Universally quantified statements "for all, "all" denoted by the symbol: a. general form: x D, P(x) all objects in the set D have the property P e.g. x humans, has_two_legs(x) b. If - then form x, D(x) P(x) all objects that have the property D have also the property P e.g. x, human(x) has_two_legs (x) note: objects in set D have property D c. compound statements The predicate P(x) may be a compound expression, e.g. odd(x) V even(x) as in the statement: x, integer(x) odd(x) V even(x) x, human(x) has_two_legs (x) has_two_arms(x) Example: x, prime_number(x) integer(x) Meaning: (1) Prime numbers are integers. (2) If a number is a prime number then it is an integer. (3) All prime numbers are integers (4) Any prime number is an integer 6
B. Existentially quantified statements Existential quantifier:, "there exists" (there is, we can find, there is at least one, for some, for at least one) a. general form: x D, P(x) There exists an object in the set D with the property P b. represented as a conjunction: x, D(x) Λ P(x) There is an objects that has the property D and the property P c. compound statements The predicate P(x) may be a compound expression, e.g. odd(x) V even(x) as in the statement: x, odd(x) V even(x) C. Negation of quantifiers 1. Negation of universally quantified statements: ~( x P(x)), x є D is equivalent to: x (~P(x)), x є D ~( x, D(x) P(x)) x,~(d(x) P(x)) x, D(x) ~ P(x) Important to remember: 1. The negation of "for all" is "there is" 2. The negation of an implication is a conjunction, (obtained by applying the laws of De Morgan to negate the implication, represented as a disjunction) 2. Negation of existentially quantified statements: ~( x P(x)), x є D is equivalent to: x (~ P(x)), x є D ~( x, D(x) P(x)) x, D(x) P(x) Example: There are perfect people: x, person(x) perfect(x) Nobody is perfect: ~( x person(x) perfect(x)) x, ~( person(x) perfect(x)) x, person(x) ~perfect(x) The statement: "It is not true that there is an x with the property P" is equivalent to: "No x in D has the property P" or "All x in D have the property ~P." 7
To negate a quantified expression do the following: 1. change the quantifier 2. negate the predicate expression that follows the quantifier. It is preferred to include the domain in the predicate expression using an appropriate predicate: All horses fly: x (horse (x) fly(x)) Some horses fly: x (horse(x) Λ fly(x)) No horses fly: x (horse (x) ~ fly(x)) C. Mathematical Induction Inductive base: Show that P(1) or P(0) is true Inductive step: Prove that P(k) P(k+1) is true Example: Let S(n) = 1 + 3 + 5 +. (2n 1) Prove by mathematical induction the statement P(n): S(n) = n 2, n = 1, 2, 3, 1. Base step: Show P(1) is true P(1) : S(1) = 1 2 = 1 By the definition of S(n), S(1) = (2*1 1) = 1. Therefore P(1) is true 2. Inductive step: Show that P(k) P(k+1) is true P(k) : S(k) = k 2, P(k+1): S(k+1) = (k+1) 2 Assume that P(k) is true, show that P(k+1) is true, i.e. show that S(k+1) = (k+1) 2 S(k+1) = S(k) + (2(k+1) 1) = k 2 + (2k+1) = (k+1) 2 Therefore P(k+1) is true, therefore P(k) P(k+1) is true By the principle of mathematical induction, S(n) = n 2 for all n = 1, 2, 3, 8