VIEWS: 1 PAGES: 48 POSTED ON: 7/26/2013 Public Domain
R. Johnsonbaugh, Discrete Mathematics 5th edition, 2001 Chapter 1 Logic and proofs Logic p Logic = the study of correct reasoning p Use of logic n In mathematics: p to prove theorems n In computer science: p to prove that programs do what they are supposed to do Section 1.1 Propositions p A proposition is a statement or sentence that can be determined to be either true or false. p Examples: n “John is a programmer" is a proposition n “I wish I were wise” is not a proposition Connectives If p and q are propositions, new compound propositions can be formed by using connectives p Most common connectives: n Conjunction AND. Symbol ^ n Inclusive disjunction OR Symbol v n Exclusive disjunction OR Symbol v n Negation Symbol ~ n Implication Symbol ® n Double implication Symbol « Truth table of conjunction p The truth values of compound propositions can be described by truth tables. p Truth table of conjunction p q p^q T T T T F F F T F F F F p p ^ q is true only when both p and q are true. Example p Let p = “Tigers are wild animals” p Let q = “Chicago is the capital of Illinois” p p ^ q = "Tigers are wild animals and Chicago is the capital of Illinois" p p ^ q is false. Why? Truth table of disjunction q The truth table of (inclusive) disjunction is p q pvq T T T T F T F T T F F F q p Ú q is false only when both p and q are false q Example: p = "John is a programmer", q = "Mary is a lawyer" q p v q = "John is a programmer or Mary is a lawyer" Exclusive disjunction p “Either p or q” (but not both), in symbols p Ú q p q pvq T T F T F T F T T F F F q p Ú q is true only when p is true and q is false, or p is false and q is true. q Example: p = "John is programmer, q = "Mary is a lawyer" q p v q = "Either John is a programmer or Mary is a lawyer" Negation p Negation of p: in symbols ~p p ~p T F F T p ~p is false when p is true, ~p is true when p is false n Example: p = "John is a programmer" n ~p = "It is not true that John is a programmer" More compound statements p Let p, q, r be simple statements p We can form other compound statements, such as n (pÚq)^r n pÚ(q^r) n (~p)Ú(~q) n (pÚq)^(~r) n and many others… Example: truth table of (pÚq)^r p q r (p Ú q) ^ r T T T T T T F F T F T T T F F F F T T T F T F F F F T F F F F F 1.2 Conditional propositions and logical equivalence p A conditional proposition is of the form “If p then q” p In symbols: p ® q p Example: n p = " John is a programmer" n q = " Mary is a lawyer " n p ® q = “If John is a programmer then Mary is a lawyer" Truth table of p ® q p q p®q T T T T F F F T T F F T q p ® q is true when both p and q are true or when p is false Hypothesis and conclusion p In a conditional proposition p ® q, p is called the antecedent or hypothesis q is called the consequent or conclusion q If "p then q" is considered logically the same as "p only if q" Necessary and sufficient p A necessary condition is expressed by the conclusion. p A sufficient condition is expressed by the hypothesis. n Example: If John is a programmer then Mary is a lawyer" n Necessary condition: “Mary is a lawyer” n Sufficient condition: “John is a programmer” Logical equivalence q Two propositions are said to be logically equivalent if their truth tables are identical. p q ~p Ú q p®q T T T T T F F F F T T T F F T T q Example: ~p Ú q is logically equivalent to p ® q Converse p The converse of p ® q is q ® p p q p®q q®p T T T T T F F T F T T F F F T T These two propositions are not logically equivalent Contrapositive p The contrapositive of the proposition p ® q is ~q ® ~p. p q p®q ~q ® ~p T T T T T F F F F T T T F F T T They are logically equivalent. Double implication p The double implication “p if and only if q” is defined in symbols as p « q p q p«q (p ® q) ^ (q ® p) T T T T T F F F F T F F F F T T p « q is logically equivalent to (p ® q)^(q ® p) Tautology p A proposition is a tautology if its truth table contains only true values for every case n Example: p ® p v q p q p®pvq T T T T F T F T T F F T Contradiction p A proposition is a tautology if its truth table contains only false values for every case n Example: p ^ ~p p p ^ (~p) T F F F De Morgan’s laws for logic p The following pairs of propositions are logically equivalent: n ~ (p Ú q) and (~p)^(~q) n ~ (p ^ q) and (~p) Ú (~q) 1.3 Quantifiers p A propositional function P(x) is a statement involving a variable x p For example: n P(x): 2x is an even integer p x is an element of a set D n For example, x is an element of the set of integers p D is called the domain of P(x) Domain of a propositional function p In the propositional function P(x): “2x is an even integer”, the domain D of P(x) must be defined, for instance D = {integers}. p D is the set where the x's come from. For every and for some p Most statements in mathematics and computer science use terms such as for every and for some. p For example: n For every triangle T, the sum of the angles of T is 180 degrees. n For every integer n, n is less than p, for some prime number p. Universal quantifier p One can write P(x) for every x in a domain D n In symbols: "x P(x) p " is called the universal quantifier Truth of as propositional function p The statement "x P(x) is n True if P(x) is true for every x Î D n False if P(x) is not true for some x Î D p Example: Let P(n) be the propositional function n2 + 2n is an odd integer "n Î D = {all integers} p P(n) is true only when n is an odd integer, false if n is an even integer. Existential quantifier p For some x Î D, P(x) is true if there exists an element x in the domain D for which P(x) is true. In symbols: $x, P(x) p The symbol $ is called the existential quantifier. Counterexample p The universal statement "x P(x) is false if $x Î D such that P(x) is false. p The value x that makes P(x) false is called a counterexample to the statement "x P(x). n Example: P(x) = "every x is a prime number", for every integer x. n But if x = 4 (an integer) this x is not a primer number. Then 4 is a counterexample to P(x) being true. Generalized De Morgan’s laws for Logic p If P(x) is a propositional function, then each pair of propositions in a) and b) below have the same truth values: a) ~("x P(x)) and $x: ~P(x) "It is not true that for every x, P(x) holds" is equivalent to "There exists an x for which P(x) is not true" b) ~($x P(x)) and "x: ~P(x) "It is not true that there exists an x for which P(x) is true" is equivalent to "For all x, P(x) is not true" Summary of propositional logic p In order to prove the p In order to prove the universally quantified universally quantified statement "x P(x) is statement "x P(x) is true false n It is not enough to n It is enough to exhibit show P(x) true for some x Î D for which some x Î D P(x) is false n You must show P(x) is n This x is called the true for every x Î D counterexample to the statement "x P(x) is true 1.4 Proofs p A mathematical system consists of n Undefined terms n Definitions n Axioms Undefined terms p Undefined terms are the basic building blocks of a mathematical system. These are words that are accepted as starting concepts of a mathematical system. n Example: in Euclidean geometry we have undefined terms such as p Point p Line Definitions p A definition is a proposition constructed from undefined terms and previously accepted concepts in order to create a new concept. n Example. In Euclidean geometry the following are definitions: n Two triangles are congruent if their vertices can be paired so that the corresponding sides are equal and so are the corresponding angles. n Two angles are supplementary if the sum of their measures is 180 degrees. Axioms p An axiom is a proposition accepted as true without proof within the mathematical system. p There are many examples of axioms in mathematics: n Example: In Euclidean geometry the following are axioms p Given two distinct points, there is exactly one line that contains them. p Given a line and a point not on the line, there is exactly one line through the point which is parallel to the line. Theorems p A theorem is a proposition of the form p ® q which must be shown to be true by a sequence of logical steps that assume that p is true, and use definitions, axioms and previously proven theorems. Lemmas and corollaries p A lemma is a small theorem which is used to prove a bigger theorem. p A corollary is a theorem that can be proven to be a logical consequence of another theorem. n Example from Euclidean geometry: "If the three sides of a triangle have equal length, then its angles also have equal measure." Types of proof p A proof is a logical argument that consists of a series of steps using propositions in such a way that the truth of the theorem is established. p Direct proof: p ® q n A direct method of attack that assumes the truth of proposition p, axioms and proven theorems so that the truth of proposition q is obtained. Indirect proof q Themethod of proof by contradiction of a theorem p ® q consists of the following steps: 1. Assume p is true and q is false 2. Show that ~p is also true. 3. Then we have that p ^ (~p) is true. 4. But this is impossible, since the statement p ^ (~p) is always false. There is a contradiction! 5. So, q cannot be false and therefore it is true. q OR: show that the contrapositive (~q)®(~p) is true. q Since (~q) ® (~p) is logically equivalent to p ® q, then the theorem is proved. Valid arguments p Deductive reasoning: the process of reaching a conclusion q from a sequence of propositions p1, p2, …, pn. p The propositions p1, p2, …, pn are called premises or hypothesis. p The proposition q that is logically obtained through the process is called the conclusion. Rules of inference (1) 1. Law of detachment or 2. Modus tollens modus ponens n p®q n p®q n ~q n p n Therefore, ~p n Therefore, q Rules of inference (2) 3. Rule of Addition n p 5. Rule of conjunction n Therefore, p Ú q n p n q 4. Rule of simplification n Therefore, p ^ q n p^q n Therefore, p Rules of inference (3) 6. Rule of hypothetical syllogism np®q nq®r n Therefore, p ® r 7. Rule of disjunctive syllogism npÚq n ~p n Therefore, q Rules of inference for quantified statements 1. Universal instantiation 3. Existential instantiation n " xÎD, P(x) n $ x Î D, P(x) n dÎD n Therefore P(d) for some n Therefore P(d) d ÎD 2. Universal generalization 4. Existential generalization n P(d) for any d Î D n P(d) for some d ÎD n Therefore "x, P(x) n Therefore $ x, P(x) 1.5 Resolution proofs p Due to J. A. Robinson (1965) p A clause is a compound statement with terms separated by “or”, and each term is a single variable or the negation of a single variable n Example: p Ú q Ú (~r) is a clause (p ^ q) Ú r Ú (~s) is not a clause p Hypothesis and conclusion are written as clauses p Only one rule: n pÚq n ~p Ú r n Therefore, q Ú r 1.6 Mathematical induction p Useful for proving statements of the form " n Î A S(n) where N is the set of positive integers or natural numbers, A is an infinite subset of N S(n) is a propositional function Mathematical Induction: strong form q Suppose we want to show that for each positive integer n the statement S(n) is either true or false. n 1. Verify that S(1) is true. n 2. Let n be an arbitrary positive integer. Let i be a positive integer such that i < n. n 3. Show that S(i) true implies that S(i+1) is true, i.e. show S(i) ® S(i+1). n 4. Then conclude that S(n) is true for all positive integers n. Mathematical induction: terminology p Basis step: Verify that S(1) is true. p Inductive step: Assume S(i) is true. Prove S(i) ® S(i+1). p Conclusion: Therefore S(n) is true for all positive integers n.