400 lecture nte #1 [Ch 2, 3] Lgic and Prfs 1.1 Prpsitins (Prpsitinal Lgic) A prpsitin is a statement that can be either true (T) r false (F), (but nt bth). "The earth is flat." -- F "March has 31 days." -- T "Time flies like fruit flies." -- Nt a prpsitin (it s a metaphr) "Take CSC 400." -- Nt a prpsitin (it s a cmmand) Ntatin: Lwer case letters are ften used t represent prpsitins. p: "The earth is flat." q: "March has 31 days." Cnnectives (r peratrs) Cnnectives are symbls that cmbine prpsitins. Prpsitins separated by cnnectives make a cmpund prpsitin. Basic cnnectives: 1. "p and q" is the cnjunctin, nted "p q". e.g. "The earth is flat and March has 31 days." 2. "p r q" is the disjunctin, nted "p q". e.g. "The earth is flat r March has 31 days." NOTE: The meaning f r here is inclusive, that is, if ne is true, the truth f the ther can be either true r false (i.e., nt necessarily false). Fr example, "I will buy a car, r I will take a vacatin." 3. "nt p" is the negatin, nted " " (r " p" r ~p ). e.g. "The earth is nt flat." r "It is nt the case where the earth is flat." Precedence and assciativity f cnnectives nt has the highest precedence, then and, then r. and and r assciate t the left -- grup tw prpsitins frm the left Parentheses are smetimes placed t frce the rder. p q r means (p ( q)) r p q r means p (( q) r) means ( p) q)
means (p q) Truth Values & Truth Tables Truth values f cnnectives (and, r, nt) p q p q p p q p q p q p q p p T F F T Exclusive-Or ( ) The regular Or ( ) is inclusive it is true if either literal is true, r BOTH literals are true. Anther, mre strict Or, is Exclusive-Or, dented. It is true strictly when EITHER literal is true, nt bth. The truth table is: p q p q p q Truth value f a cmpund prpsitin Suppse p, r are true and q is false. Evaluate the fllwing prpsitins. (p q) ( p) q) p q r Truth table lists truth values fr ALL pssible assignments f true/false p q (p q) T T T F F T F F p q ( p) q) T T T F F T F F
p q r p q r Tautlgies and Cntradictins A tautlgy is a statement that is always true regardless f the truth values f the individual statements. A cntradictin a statement that is always false regardless f the truth values f the individual statements. Example: p r p (tautlgy) and p and p (cntradictin) p p p p p 1.2 Cnditinal Prpsitins and Lgical Equivalence Cnditinal Prpsitins Cnditinal peratr if: "if p then q" is the cnditinal prpsitin, nted "p q". p is called the hypthesis r antecedent. q is called the cnclusin r cnsequent. Example: p : "I am rich." q : "I buy a car." p q : "If I were rich, then I buy a car." (r If I am rich, I wuld buy a car. )
Truth table fr p q p q Precedence and assciativity f if, then, then, then assciates t the left Parenthesize the fllwing statements a) p q r b) p q p r Necessary and sufficient cnditins The cnclusin expresses a necessary cnditin. The hypthesis expresses a sufficient cnditin. Cmpund statements invlving a. Suppse p, r are true and q is false. Evaluate the fllwing prpsitins. (p q) ( p) q) (p q) r Truth table fr (p q) r p q r (p q) r
Cnverse, Inverse and Cntrapsitive f a cnditinal statement Fr a cnditinal statement p q, 1. cnverse is q p. 2. inverse is ( p) ( q). 3. cntrapsitive is ( q) ( p). Sme prperties: a. Cnverse (q p) is nt lgically equivalent t the riginal cnditinal statement p q. b. Inverse (q p) is nt lgically equivalent t the riginal cnditinal statement p q. c. Cntrapsitive (( q) ( p)) is lgically equivalent t p q. p q p q cnverse q p inverse ( p) ( q). cntrapsitive ( q) ( p) T F F F T T Bicnditinal prpsitins -- "If and nly if" When bth p q and q p (cnverse) are true, it is said that "p if and nly if q", dented p q. p q p q Lgical Equivalence Tw statements P and Q are lgically equivalent, dented P Q, when truth values in ALL rws in the truth tables are the same. Example: ~ --- SUPER IMPORTANT!!! p q p q p q T T T F F T F F
DeMrgan's Laws Lgical equivalence fr. Prf by truth table (fr (p q) and p q) p q (p q) p q 1.3 Quantifiers (Predicate Lgic) Prpsitinal Functin Prpsitins are NOT flexible -- n 'variables' in a statement. Fr example, p1: "January has 31 days." -- true p2: "February has 31 days." -- false p3: "March has 31 days." -- true p4..., etc. A prpsitinal functin is a (lgic) statement with variables. Definitin: Let P(x) be a statement invlving a variable x, and let D be the set f values fr x. If fr each x D, P(x) is a prpsitin then P(x) is a prpsitinal functin with respect t D. D is called the dmain f discurse. Example: P(x): "The x th mnth f a year has 31 days", where x is an integer 1 <= x <= 12. The variable x in a prpsitinal functin P(x) is called a free variable. NOTE (t be revised later): A prpsitinal functin is NOT a prpsitin -- it des nt have T/F value by itself. T/F is btained nly after we plug in specific value f x. Example abve: P(1) -- true P(2) -- false, etc. Quantified Statements Sme prpsitinal functins are quantified statements. "Fr every x, P(x)" -- universally quantified "Fr sme x, P(x)" -- existentially quantified
1. Universally Quantified Statements ( Definitin: Let P(x) be a prpsitinal functin ver D. The statement "fr every x in D, P(x)" is said t be a universally quantified statement, nted. Different wrding f statements "Fr every x, P(x)" "Fr each x, P(x)" "Fr all x, P(x)" Example: P(x): "Fr every real number x, x 2 >= 0" Truth value f true -- if fr every x in D, P(x) is true. false -- if there is at least ne x in D fr which P(x) is false -- a cunterexample. 2. Existentially Quantified Statements ( Definitin: Let P(x) be a prpsitinal functin ver D. The statement "fr sme x in D, P(x)" is said t be an existentially quantified statement, nted. Different wrding f statements "Fr sme x, P(x)" "Fr at least ne x, P(x)" "There exists x such that P(x)" Example: "There exists a real number x such that x 2 = 2." Truth value f true -- if there is at least ne x in D fr which P(x) is true. false -- if fr all x in D, P(x) is false. 3. Quantified Statements as Prpsitins The variable x in a quantified statement, xp(x) r xp(x), is called a bund variable. A quantified statement has a truth value -- althugh it is a prpsitinal functin. NOTE (revised): A prpsitinal functin with FREE variables is NOT a prpsitin. A prpsitinal functin with BOUND variables (i.e., quantified statements) is a prpsitin. 4. Generalized DeMrgan's Laws Lgical equivalency fr negated quantified statements (xp(x) It is nt the case that, fr all x, P(x) is true x P(x) There exists x fr which P(x) is false.
(xp(x) It is nt the case that there exists x fr which P(x) is true. x P(x) Fr all x, P(x) is false. 5. Prving Quantified Statements 1. Prving a universally quantified statement x P(x) True -- by shwing P(x) is true fr ALL x. IMPORTANT NOTE: Yu can NOT just plug in a few values f x and cnclude the statement is true. Yu must pick a generic particular (but arbitrary chsen) value (x) and generalize. False -- by shwing a cunterexample x in D fr which P(x) is false (i.e., x P(x) Prve r disprve: a. The sum f any tw even integers is even. i. Prf: Suppse m and n are even integers. We must shw that m + n is even. By definitin f even, m = 2*r and n = 2*s fr sme integers r and s. Then, ii. m + n = 2*r + 2*s... by substitutin = 2(r + s)... by factring iii. Let k = r + s. Then, k is an integer because it is a sum f integers. Hence, iv. m + n = 2*k, where k is an integer. It fllws by definitin f even that m + n is even. b. Fr all real number x, x 2-1 > 0. i. Prf: The statement is false. A cunterexample is x = 0. Here, 0 is a real number, but 0 2-1 = -1 <= 0 [NOTE: the negatin f x 2-1 > 0 is x 2-1 <= 0]. c. Fr all real number x, if x > 1, then x 2-1 > 0. d. 2. Prving an existentially quantified statement x P(x) True -- by shwing there exists at least ne x in D such that P(x) is true. False -- by shwing fr all x, P(x) is false (i.e., x Px Prve r disprve a. Fr sme real number x, x > 5 and x < 10 b. Fr sme real number x, x > 5 and x < 4
Multiple Quantifiers and Variables Statement with tw quantifiers and variables Negatins Derive equivalent frms by applying DeMrgan's law several times. e.g. Negatin Prve r disprve: a. x.y. x 2 + 2y > 4 b. x.y. x 2 + 2y > 4 c. x.y. x 2 + 2y > 4 d. x.y. x 2 + 2y > 4 e. x.y. if x < y, then x 2 + 2y > 4 f. x.y. if x < y, then x 2 + 2y > 4 g. x.y. if x < y, then x 2 + 2y > 4 h. x.y. if x < y, then x 2 + 2y > 4