Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Chapter 5: Section 5-1 Mathematical Logic D. S. Malik Creighton University, Omaha, NE D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 1 / 29 Mathematical Logic Intuitively, logic is the discipline that considers the methods of reasoning. It provides the rules and techniques for determining whether an argument is valid or not. In everyday life, we use reasoning to prove di¤erent points. For example, to prove to our parents that we passed an exam, we might show the test and the score. Similarly, in mathematics, mathematical logic (or logic) is used to prove results. To be speci…c, in mathematics, we use logic or logical reasoning to prove theorems. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 2 / 29 Statements (Proposition) De…nition A statement or a proposition is a declarative sentence that is either true or false, but not both. Example Consider the following sentences. (i) 4pis an integer. (ii) 5 is an integer. (iii) Washington, DC, is the capital of the USA. Each of these sentences is a declarative sentence. The sentence (i) is true, (ii) is not true, and (iii) is true. Hence, these are examples of statements. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 3 / 29 We use lowercase letters, with or without subscripts, such as p, q, and r , to denote sentences or statements. For example, we can write p : 4pis an integer. q : 5 is an integer. r : Washington, DC, is the capital of the U.S.A. Example Consider the following sentences: p : 5 is greater than 3. q : 7 is an even integer. Both p and q are declarative sentences. Thus, p and q are statements. Moreover, p is true and q is false. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 4 / 29 Example Consider the following sentences. p : Will you go? q : Shall we enjoy the lovely weather? Here the sentences p and q are not declarative sentences, so these are not statements. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 5 / 29 A statement is a declarative sentence that can be classi…ed as true or false, but not both. One of the values ‘truth’or ‘false’that is assigned to a statement is called its truth value. We abbreviate ‘truth’to T or 1 and ‘false’to F or 0. If a statement p is true, we say that the (logical) truth value of p is true and write p is T (or p is 1); otherwise, we say the (logical) truth value of p is false and write p is F (or p is 0). D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 6 / 29 Compound Statements Consider the following statements. 1 I will not go to the basketball game today. 2 I paid my bill in the morning and I went to the gym in the evening. 3 You can go to Chicago or you can go to Paris. 4 If I win the competition, then I will win the scholarship money. 5 Study hard and get good grades, or lose the scholarship. These are examples of compound statements. Moreover, not, and, or, and, if ... then are called logical connectives or simply connectives. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 7 / 29 Example (i) Consider the statement “4 is a prime number”. The negation of this statement is “4 is not a prime number”. Hence, “4 is not a prime number” is a compound statement. (iii) You can borrow the car and buy the groceries. This is a compound statement because it contains the connective and. (iv) If ABC is a right-angled triangle, then one of its angle is 90o . This is a compound statement because it contains the connective if ... then. (v) I invested in the Smith and Barney company. This is not a compound statement. The word and is part of the name of the company. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 8 / 29 Negation De…nition Let p be a statement. The negation of p, written obtained by negating the statement p. p, is the statement The truth value of p and p are opposite. The symbol s is called ‘not’. We read s p as ‘not p’. If p is a statement, then its negation is formed by writing “it is not the case that p”. For example, if p : 2 is positive, then s p : it is not the case that 2 is positive. Sometimes, s p is also written as follows: s p : 2 is not positive. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 9 / 29 By the de…nition of the negation of a statement p, the truth value of s p is opposite to the truth value of p, i.e., if p is T , then s p is F and if p is F , then s p is T . We record this in a table, called a truth table, as follows: p sp T F F T Example Consider the statement The Rockie Mountains are in Colorado. The negation of this statement is The Rockie Mountains are not in Colorado. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 10 / 29 Conjunction Consider the following statements: p : 2 is an even integer. q : 7 divides 14. Now consider the sentence r : 2 is an even integer and 7 divides 14. Because r is true, r is a statement. Such a statement r is called the conjunction of p and q. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 11 / 29 Conjunction De…nition Let p and q be statements. The conjunction of p and q, written p ^ q, is the statement formed by joining the statements p and q using the word ‘and’. The statement p ^ q is true if both p and q are true; otherwise p ^ q is false. The symbol ^ is called ‘and’. Let of p ^ q is given by: p T T F F p and q be statements. The truth table q T F T F p^q T F F F D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 12 / 29 Example (i) Let p : Washington, DC, is the capital of the USA and q : The USA is in North America. Then p ^ q is the statement: p ^ q : Washington, DC, is the capital of the USA and the USA is in North America. Notice that p ^ q is T . (ii) Let p : 2 divides 4 and q : 3 is greater than 5. Then p ^ q is the statement: p ^ q : 2 divides 4 and 3 is greater than 5. Because p is T and q is F , it follows that p ^ q is F . (iii) Let r : 2 divides 4 and s : 2 divides 6. Then r ^ s is the statement: r ^ s : 2 divides 4 and 2 divides 6. Because r is T and s is T , it follows that r ^ s is T . D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 13 / 29 Consider the statements, r : 2 divides 4 and s : 2 divides 6, in the previous example. The statement r ^ s is: r ^ s : 2 divides 4 and 2 divides 6. Sometimes, the statement r ^ s is written r ^ s : 2 divides both 4 and 6. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 14 / 29 Disjunction Given two statements p and q, we can form the statement ‘p or q’by putting the word ‘or’between the statements such that the statement p or q is true if at least one of the statements p or q is true. For example, suppose we have the statements: p : 2 is an integer. q : 3 is greater than 5. Then we can form the statement. r : 2 is an integer or 3 is greater than 5. Because p is T , it follows that r is true. The statement r is called the disjunction of p and q. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 15 / 29 Disjunction De…nition Let p and q be statements. The disjunction of p and q, written p _ q, is the statement formed by putting the statements p and q together using the word ‘or’. The truth value of the statement p _ q is T if at least one of the statements p or q is true. The symbol _ is called ‘or ’. For statements p and q, the truth table of p _ q is given by: p q p_q T T T T F T F T T F F F D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 16 / 29 Example Let p be the statement “You can pay me now” and q be the statement “You can pay me tomorrow with a 10% penalty”. Then p _ q is the statement: You can pay me now or you can pay me tomorrow with a 10% penalty. Example Let p : 22 + 33 is an even integer and q : 22 + 33 is an odd integer. Then p _ q : 22 + 33 is an even integer or 22 + 33 is an odd integer. Sometimes for better readability, we write p _ q as: p _ q : Either 22 + 33 is an even integer or 22 + 33 is an odd integer. or p _ q : 22 + 33 is an even integer or an odd integer. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 17 / 29 Implication In every day life, we encounter statements such as If it is cold, then I will wear a jacket. If I get a bonus, then I will buy a car. If I work, then I must pay taxes. Similarly, in mathematics, we frequently encounter statements such as: If ABC is a triangle, then \A + \B + \C = 1800 . If 49301 is divisible by 6, then 49301 is divisible by 3. In each of these statements, two statements are connected by If ... then to form a new statement. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 18 / 29 Implication De…nition Let p and q be two statements. Then ‘if p then q’is a statement called an implication or a condition, written p ! q. The statement p ! q can also be read as p implies q or p is su¢ cient for q or q if p or q whenever p. In the implication p ! q, p is called the hypothesis (or antecedent) and q is called the conclusion (or consequent). D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 19 / 29 Let us consider the following implication: If I pass Monday’s math test, then I will take you out for dinner. Let p represent the statement “I pass Monday’s math test” and q represent the statement “I will take you out for dinner.” Suppose p is true and q is true. Then because I told the truth, the statement p ! q is true. Suppose p is true but q is false. In this case, I lied. So the statement p ! q is false. Suppose p is false but q is true. In this case, even though I did not pass the test, but I still took you out for dinner. Note that I did not say anything about dinner and failing the test. Therefore, I did not lie. So the statement p ! q is true. Suppose p is false and q is false. In this case, I did not pass the test and I did not take you out for dinner. I cannot be held responsible for not taking you out for dinner because I promised to take you out for dinner only if I passed the test. Therefore, I did not lie. So the statement p ! q is true. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 20 / 29 The truth table of the implication p ! q is given by: p T T F F q T F T F p!q T F T T Example Let p be the statement “It rains today”, and q be the statement “The game will be postponed”. Then the statement p ! q is the statement If it rains today, then the game will be postponed. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 21 / 29 Evaluating Logical Expressions Consider the statements: p = 2 is an even integer q = 6 is a prime number Then the truth value of p is true (T ) and the truth value of q is false (F ). Now p, ( p ) _ q, p ! ( q ) are also statements. Suppose that we want to know the truth values of these statements. To …nd the truth value of these statements, we substitute the values of the variables p and q and then use the rules of evaluating the logical connectives. For example, p= Thus, the truth value of T = F. p is F . D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 22 / 29 Similarly, ( p) _ q = ( T ) _ F = F _ F, = F, because T =F and p!( q) = T ! ( F ) = T !T = T. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 23 / 29 To avoid the use of so many parentheses (and brackets) in a statement formula we adopt the following conventions: 1. We omit the outer pair of parentheses in a statement. For example, we write s p for (s p ). 2. If there is a statement of the form (s p ) ! (s q ), then we write it as s p ! s q. 3. Similarly, we write (s p ) _ (s q ) as s p _ s q, (s p ) ^ (s q ) as s p ^ s q, s (s p ) as s s p, and so on. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 24 / 29 Precedence of Logical Connectives (Operators) In a compound statement without parentheses that contains logical connectives, the logical connectives are evaluated in the following order, i.e., the precedence of logical connectives is: s ^ _ ! highest second highest third highest fourth highest D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 25 / 29 Example Let p be a true (T ) statement, q be a false (F ) statement, and r be a true (T ) statement. (i) p _ (s r ^ q ) = T _ (s T ^ F ) = T _ (F ^ F ) = T _F = T. (ii) (s p ^ q ) _ (s q _ r ) = = = = (s T ^ F ) _ (s F _ T ) (F ^ F ) _ (T _ T ) F _T T. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 26 / 29 Example Let p be a true (T ) statement, q be a false (F ) statement, and r be a true (T ) statement. (i) p !s r = T !s T = T !F = F. (ii) r ! (s p _ s q ) = = = = T ! (s T _ s F ) T ! (F _ T ) T !T T. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 27 / 29 Exercise: Write the negation of each of the following statements: (i) 2 is an odd integer; (ii) 7 + 5 > 13; (iii) p 7; (iv) I am taking the applied mathematics course. Solution: (i) 2 is not an odd integer; (ii) 7 + 5 13 (iii) p > 7; (iv) I am not taking the applied mathematics course. D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic 28 / 29 Exercise: Let p be true, q be false, and r be true. Find the truth value of the following statements. (i) p ^ (q _ r ) (ii) [(p _ q )^ r )] (iii) (p _ q ) ! ( q _ r ) Solution: (i) p ^ (q _ r ) = T ^ (F _ T ) = T ^ T = T (ii) [(p _ q )^ r ] = [(T _ F )^ T ] = [(T _ T ) ^ F ] = [T ^ F ] = F = T (iii) (p _ q ) ! ( q _ r ) = = T ! (T _ T ) = F !T = T (T _ F ) ! ( D. S. Malik Creighton University, Omaha, NEChapter () 5: Section 5-1 Mathematical Logic F _ T) 29 / 29