THE NATURE OF LOGIC INTRODUCTION In everyday life, reasoning proves different points. For example, to prove to a service provider that you had paid your bills on time, you can show the official receipt of payment. To prove to an airline that you have booked for a flight, you can show your online reservation or your ticket. Similarly, mathematics and computer science use mathematical logic or simply logic to prove the results. In particular, mathematical logic is used in mathematics to prove theorem. In computer science, logic is used to prove the results of computer algorithms or the correctness of a computer program. Logic is commonly known as the science of reasoning. Mathematical reasoning and arguments are based on the rules of logic. PROPOSITIONS AND RELATED CONCEPTS A proposition is any meaningful statement that is either true or false, but never both. Throughout this book, lowercase letters, such as a, b, c, .., p, q, rโฆ will be used to represent propositions. The truth value of a proposition is true, denoted by T or 1, if it is a true statement. The truth value of a false statement is F, or 0. Consider the following examples: a. b. c. d. e. f. Aidan loves Aimee. Batman is left-handed. Columbus discovered the Philippines. Dynamite is dangerous. Elephants have wings. Five is less than 10. All these statements are propositions. You can determine the truth or falsity of each statement. Consider the following: p. how are you? q. the square of an integer X. r. study your lessons everyday! These are not propositions. The first one is a not a proposition because it is a question. The second one is not a proposition because you cannot determine the truth value of the phrase, and the third one is not a proposition because it is a command. The negation of a proposition p, is the proposition not p. It is denoted by ~๐. The truth table of not p is given below. ๐ T F ~๐ F T COMPOUND PROPOSITIONS New propositions called compound propositions can be obtained from old ones by using propositional connectives or logical connectives or operators. The propositions that form compound propositions are called propositional variables. The truth table provides the truth value for the result applying the operation on each possible set of truth values for the operands. The essential point about assigning truth values to compound statements is that it allows youโ using logic aloneโ to judge the truth of a compound statement on the basis of your knowledge of the truth of its component parts. Logic does not help you determine the truth or falsity of the component statements but rather logic helps link these separate pieces of information together into a coherent whole. Let p and q be propositions. The conjunction of p and q, denoted by p ^ q, is the proposition, p and q. This proposition is defined to be true only when both p and q are true, and false, otherwise. The truth table of the disjunction of p or q is given in the following table: ๐ T T F F q p^q ๐ T T F F q ๐ T T F F q pโq T F T F F T T F T T F F T F F F The disjunction of p or q, denoted by p v q, is the proposition, p or q. This proposition is defined to be a false only when both p and q are false, and true, otherwise. The truth table of the disjunction of p or q is given in the following table: pvq T T F T T T F F The exclusive-or of p or q, denoted by p โ q is the proposition that is true when exactly one of p and q is true and is false otherwise. The truth table of the exclusive or p and q is given in the following table: The proposition p NAND q, written p|q is the proposition that is true when either p or q, or both are false and it is false when both p and q are true. The truth table of p|q is given in the following table: ๐ T T F F q p| q T F T F F T T T The proposition p NOR q, written p โ q is the proposition that is true when both p and q are false and it is false otherwise. The truth table of p โ q is given in the following table: ๐ T T F F q pโq T F T F F T T T Example 1 Construct the truth table of [~(๐^๐)] ๐ฃ ๐. Solution: ๐ T T T T F F F F ๐ T T F F T T F F ๐ T F T F T F T F ๐^๐ T T F F F F F F ~(๐^๐) F F T T T T T T [~(๐^๐)] ๐ ๐ T F T T T T T T Example 2 Construct a truth table for the statement (๐๐ )๐ฃ ~๐. Solution: ๐ T T T T F F F F ๐ T T F F T T F F ๐ T F T F T F T F ๐^๐ T T F F F F F F ~๐ F T F T F T F T (๐^๐)] ๐ ~๐ T T F T F T F T Example 3 Construct the following statements: ๐: 5 is an integer. ๐: โ3 is an integer. ๐: 2 divides 4. Construct the following statements and determine the truth values. 1. (2 divides 4 or 5 is an integer) and 2 divides 4. 2. (5 is an integer and โ3 is an integer) and 2 divides 4. Solution 1: the statement (2 divides 4 or 5 is an integer) and 2 divides 4 can be written in proportional form as (๐ v ๐) ^ ๐. Since ๐ is true, ๐ is false, and ๐ is true, the truth value is ๐ T ๐ F ๐ T (๐ v ๐) T (๐ v ๐) ^ ๐ T Solution 2: the statement (5 is an integer and โ3 is an integer) and 2 divides 4 can be written in propositional form as (~๐ ^ ๐ ) ^ ๐. Since ๐ is true, not ๐ is false , ๐ is false, and ๐ is true, the truth value is ๐ T ๐ F ๐ T ~๐ F (~๐^๐) F (~๐^๐) ^๐ F Example 4 Show that ๐^๐ = ๐^๐. Solution: construct the truth table. ๐ T T F F ๐ T F T F ๐^๐ T F F F ๐^๐ T F F F Since, they have the same truth values, they are equivalent. Example 5 Show that (๐^๐) v ๐ โก (๐ v ๐) ^ (๐ v ๐) Solution: Construct the truth table. ๐ T T T T F F F F ๐ T T F F T T F F Hence, (๐^๐) v ๐ ๐^๐ ๐v๐ T T T F T T T F T F F T T F T F F F T F T F F F ๐ โก (๐ v ๐) ^ (๐ v ๐) ๐v๐ T T T F T T T F Example 6 Show that ~(๐^๐) โข ๐^~๐. Solution: use the truth table to prove the claim. (๐^๐) v ๐ T T T F T F T F (๐v๐) ^ (๐v ๐) T T T F T F T F ๐ T T F F ~(๐ ส ๐) ~๐ ส ~๐ ๐ ~๐ ~๐ ๐ส๐ T F F T F F F F T F T F T T F F T F F T T F T T Since two lines in the truth tables are not equal, the claim is correct. โ โ CONDITIONAL STATEMENTS AND BICONDITIONAL STATEMENTS You may have encountered statements such as โif it rains, then our outing is cancelled,โ and โif I pass this course, then I will graduate next year.โ In mathematics, there are statements such as โif the sum of the digits in a number is divisible by 9, then the number is divisible by 9,โ and โif a triangle is isosceles, then the two sides are equal.โ Notice in the aforementioned examples, the statements are connected by โif..then.โ If p and q are two statements, โif p, then qโ is a statement called an implication, or a conditional statement, which is written as ๐ โ ๐; ๐ is called the hypothesis, or premise, or antecedent; and ๐ is called the conclusion or consequence. The statement ๐ โ ๐ is called a conditional statement because ๐ โ ๐ asserts that ๐ is true on the condition the ๐ holds. The truth table ๐ โ ๐ is given below. ๐ T T F F ๐ T F T F ๐โ๐ T F T T Notice that the statement ๐ โ ๐ is true when both ๐ and ๐ are true when ๐ is false, no matter what truth value ๐ has. Other ways to express a conditional statement are as follows: โif ๐, then ๐โ โ๐ only if ๐โ โ๐ is sufficient for ๐โ โ๐ whenever ๐โ โ๐ if ๐โ โ๐ when ๐โ โ๐ is necessary for ๐โ โ๐ follows from ๐โ You can form new conditional statements from the implication ๐ โ ๐. The proposition ๐ โ ๐ is called the converse of ๐ โ ๐. The contrapositive of ๐ โ ๐ is the proposition ~๐ โ ~๐. The statement ~๐ โ ~๐ is called the inverse of the implication ๐ โ ๐. Example 1 Consider the following statement โif 3 is not even integer, then the square root of 4 is even.โ Write the converse, inverse, and contrapositive of this implication. Solution: let ๐: 3 is not an even integer ๐: the square root of 4 is even The above statement can be expressed in propositional form as ๐ โ ๐. The converse is ๐ โ ๐. If the square root of 4 is even, then 3 is not an even integer. The inverse is ~๐ โ ~๐. In the context of the statement, it can be expressed as โif 3 is not even integer, then the square root of 4 is even.โ The contrapositive is ~๐ โ ~๐ which can be expressed in words as โif the square root of 4 is not an even integer, then 3 is an even integer.โ Another way to combine propositions that express that two propositions have the same truth value is by using biconditional statements or bi-implications. The biconditional statements ๐ โ ๐, (๐๐๐๐ ๐๐ ๐ ๐๐ ๐๐๐๐๐๐๐๐๐ฆ ๐๐๐ข๐๐ฃ๐๐๐๐๐ก ๐ก๐ ๐) is the proposition โ๐ ๐๐ ๐๐๐ ๐๐๐๐ฆ ๐๐ ๐. " The bi-implication ๐ โ ๐ can also be written as ๐ โก ๐. This statement is true when ๐ ๐๐๐ ๐ have the same truth values. The truth table is given below. ๐ T T F F ๐ T F T F ๐โ๐ T F F T Other ways to express ๐ โ ๐ are follows: โ๐ ๐๐ ๐๐๐๐๐ ๐ ๐๐๐ฆ ๐๐๐ ๐ ๐ข๐๐๐๐๐๐๐๐ก ๐๐๐ ๐" "๐๐ ๐ ๐๐๐ ๐ ๐๐๐ ๐๐๐๐ฃ๐๐๐ ๐๐๐ฆ" "๐ ๐๐ ๐" ๐๐ "๐ ๐๐ ๐๐๐๐ฆ ๐๐ ๐" Example 2 Determine if ๐ v (๐ ส ๐) and (๐ v ๐) ส (๐ v ๐) are logically equivalent. Solution: Construct a truth table and determine if they have the same truth table. ๐ T T T T F F F F ๐ T T F F T T F F ๐ T F T F T F T F ๐ส๐ T F F F T F F F ๐ v (๐ ส ๐) T T T T T F F F ๐v๐ T T T T T T F F ๐v ๐ T T T T T F T F (๐ v ๐) ส (๐ v ๐ T T T T T F F F Because the truth tables of ๐ v (๐ ส ๐) and (๐ v ๐) ส (๐ v ๐) agree, these compound propositions are logically equivalent. This is called the distributive law of disjunction over conjunction. Example 3 Show that ~(๐ ส ๐) โก ~๐ v ~๐. Solution: the truth table is given below. ๐ ๐ ๐ส๐ ~(๐ ส ๐) ~๐ ~๐ ~๐ v ~๐ T T T F F F F T F F T F T T F T F T T F T F F F T T T T From the truth table, ~(๐ ส ๐) ๐๐๐ ~๐ v ~๐ have the same truth values, hence they are logically equivalent. This form is called De Morganโs Law. TAUTOLOGIES, CONTRADICTIONS, AND CONTINGIES Compound propositions can be a tautology, a contradiction or an absurdity, or a contingency. A compound proposition is called a tautology if it is always true for all possible values of its propositional variables. A contradiction or absurdity is a propositional form which is always false for all possible values of its propositional variables. A propositional form which is neither a tautology nor a contradiction is called a contingency. Example Construct the truth table for the given propositions and determine whether the propositions is a tautology, contradiction, or contingency. a. b. c. d. e. (๐ ส ๐) โ (๐ โ ๐) ๐ โ ~(~๐) ๐ ส ~๐ (๐ ส ~๐) โ ๐ (๐ โ ๐) ส ( ๐ โ ๐) Solutions: a. (๐ ส ๐) โ (๐ โ ๐) ๐ ๐ ๐ส๐ ๐โ๐ (๐ ส ๐) โ (๐ โ ๐) T T T T T T F F F T F T F T T F F F T T Since the truth values of the propositions are all possible values of the variables ๐ ๐๐๐ ๐, it follows that the proposition is a tautology. b. ๐ โ ~(~๐) ๐ ~๐ ~(~๐) ๐ โ ~(~๐) T F T T F T F T Since the truth values of the propositions are all possible values of the variables ๐ , it follows that the proposition is a tautology. c. ๐ ส ~๐ ๐ ~๐ ๐ ส ~๐ T F F F T F Since the truth values of the propositions are all possible values of the variables ๐ , it follows that the proposition is a contradiction or absurdity. ๐. (๐ ส ~๐) โ ๐ (๐ ส ~๐) โ ๐ ๐ ๐ ~๐ ๐ ส ~๐ T T F F T T F F F T F T T F T F F T F T Since the truth values of the propositions are all possible values of the variables ๐ ๐๐๐ ๐, it follows that the proposition is a tautology. ๐. (๐ โ ๐) ส ( ๐ โ ๐) (๐ โ ๐) ส ( ๐ โ ๐) ๐ ๐ ๐โ๐ ๐โ๐ T T T T T T F F T F F T T F F F F T T T Since the truth values of the propositions are neither true nor false for all possible values of the variables ๐ ๐๐๐ ๐, it it follows that the proposition is a contingency. VALID ARGUMENTS Consider the following statements: If triangles ๐โ ๐๐๐ ๐โ are congruent, then ๐โ ๐๐๐ ๐โ are similar. Triangles ๐โ ๐๐๐ ๐โ are congruent. Therefore, ๐โ ๐๐๐ ๐โ are similar. This is an example of an argument. It consists of a sequence of statements called premises, followed by a final statements called the conclusion. In the aforementioned example, the statements โIf triangles ๐โ ๐๐๐ ๐โ are congruent, then ๐โ ๐๐๐ ๐โ are similarโ and โTriangles ๐โ ๐๐๐ ๐โ are congruentโ are the premises. The statement introduced by the word therefore is the conclusion. In a formal presentation of an argument, the symbol (โด) is placed before the conclusion to denote the word therefore. Example 1 If Glenn solved all the problem in the final exams correctly, then Glenn obtained a grade of 100. Glenn solved all the problems in the final correctly. Therefore, Glenn got a grade of 100. Example 2 If 20151 is divisible by 9, then 20151 is divisible by 3. If 20151 is divisible by 3, then the sum of the digits of 20151 is divisible by 3. Therefore, if 20151 is divisible by 9, then the sum of the digits of 20151 is divisible by 3. Example 3 If Xian studies, then he will pass the test. If Xian does not play internet games, then he will study. Xian did not pass the test. Therefore, Xian played internet games. Arguments are analysed by considering their forms. An argument is said to be valid if and only if the truth of the conclusion follows necessarily from the truth of its premises. That is, if of the premises (๐โ ^ ๐โ ^ ๐โ โฆ ^๐๐) โ conclusion ๐ is a tautology. Sometimes, an argument is written in the following form: ๐โ ๐โ โฎ ๐โ ๐๐ โด๐ One way to determine the validity of an argument is by constructing a truth table. Example 4 Construct a truth table for the given argument: If triangles ๐โ ๐๐๐ ๐โ are congruent, then ๐โ ๐๐๐ ๐โ are similar. Solution: Let ๐: triangles ๐โ ๐๐๐ ๐โ are congruent. ๐: triangles ๐โ ๐๐๐ ๐โ are similar. The argument can be written in the form: ๐ส๐ ๐ โด๐ Constructing the truth table yields the following: (๐ ส ๐) ส ๐ [(๐ ส ๐) ส ๐] โ ๐ ๐ ๐ ๐ส๐ T T T T T T F F F T F T F F T F F F F T The truth table shows that [(๐ ส ๐) ส ๐] โ ๐ is a tautology. Hence, the argument is valid. Example 5 Write the following argument in propositional form and determine if the argument is valid. If 20151 is divisible by 9, then 20151 is divisible by 3. If 20151 is divisible by 3, then the sum of the digits of 20151 is divisible by 3. Therefore, if 20151 is divisible by 9, then the sum of the digits of 20151 is divisible by 3. Solution: Let ๐: 20151 is divisible by 9. ๐: 20151 is divisible by 3. ๐: the sum of the digits of 20151 is divisible by 3. The argument can be written in propositional form as: ๐โ๐ ๐โ๐ โด๐โ๐ The truth table is shown below. ๐ ๐ ๐ ๐โ๐ ๐โ๐ T T T T F F F F T T F F T T F F T F T F T F T F T T F F T T T T The argument T F T T T F T T is valid. ๐โ๐ (๐ โ ๐)^ (๐ โ ๐) (๐ โ ๐)^ (๐ โ ๐) โ (๐ โ ๐) T F T F T T T T T F F F T F T T T T T T T T T T Example 6 Consider the following argument: ๐ โ (๐ v ~๐) ๐ โ (๐ ^ ๐) โด๐โ๐ Determine whether or not this argument is valid. Solution: ๐ ๐ T T T T F F F F T T F F T T F F {[๐ โ (๐ v ๐)] ^[๐(๐^๐)]} โ (๐ท โ ๐น) T F T T T T T F T T F T F T T F F T F T T F T T F T T F T F T F T F T F T T F T F T T F F F T T F F T T F T T F The truth table shows that even though there are several situations in which the premises and conclusions are all true, there are lines where the conjunction of the two premises are true, but the conclusions are false. Hence this argument is NOT valid. ๐ ~๐ ๐ v ~๐ ๐ส๐ ๐ โ (๐ v ~๐) ๐ โ (๐ ส ๐) Example 7 Verify that this argument is valid. ๐ ส (๐ v ๐) (๐ ส ๐) โ ๐ (๐ ส ๐) โ ๐ โด๐ Solution: Since there are 4 propositional variables in the argument, the truth table will have 16 lines. Let ๐ด = {[๐ ^ (๐ v ๐)]^[(๐^๐) โ ๐ ]^[(๐๐ ) โ ๐ ]} ๐ ๐ T T T T T T T F T F T F T T T F F F F T F F F T F T F T F F F F Since the last (๐^๐) โ ๐ (๐^๐) โ ๐ ๐ ๐ ๐จ ๐จโ๐ ๐^(๐ v ๐) T T T T T T T T F T F F F T F T T T T T T F T F T T F T T T T T T T T T F T T F F T F F T F T F T F F F T T F T T F F T T F T T T F T T F T T T F T T F T F F F T T F T F T F T T F T T F F T T F T F T F T T F T F F F T T F T column in the truth table is a tautology, hence, the argument is valid.