Math 0413 Appendix A.0 Logic Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another. This type of logic is called propositional. Definition statement). A sentence with truth value (True/False, T/F) is called a proposition (or a Types of mathematical operations: Nullary. It has no arguments. Unary. It has one argument. Arithmetic examples: a, 1/a. Binary. It has two arguments. Arithmetic examples: a + b, a b, a b, a b, a b. Ternary. It has three arguments. n-ary. It has n arguments. Many mathematical operations can be treated as functions of the corresponding number of arguments. For example, in Arithmetic the addition a + b, being a binary operation, can be defined as a function of two arguments (variables) f(a, b) = a + b. In logic arguments of a function are propositions. The domain of the function is finite and made of all possible combinations of truth values (T and F) of corresponding propositions. It is discrete and finite. The range of a function is either T, or F, or both T and F. The range is also discrete and finite. Because domain and range both are finite the total number of possible functions has to be finite. The following examples explain the concept. Example 1. Consider a proposition P. We want to define the set of all functions of P. The proposition P has two truth values T and F. The list of all possible truth values is T and F. So, the domain of a function is a set of two values. Each function has to be defined at these two values. For example, two possible functions are f 1 (T ) = T, f 1 (F ) = T and f 2 (T ) = T, f 2 (F ) = F. These functions are different since f 1 (F ) f 2 (T ). What is the total number of functions of P? For each of two truth values in the domain there are two truth values in the range. The total number of combinations is 2 2 = 4. Therefore, there are four different functions of one argument P. The following table lists all of them 1
P f 1 f 2 f 3 f 4 T T T F F F T F T F Example 2. Consider two propositions P and Q and all functions f(p, Q). Each of propositions has two truth values T and F. The list of all possible combinations (pairs) of truth values for P and Q is (T,T), (T,F), (F,T), and (F,F). So, the domain of a function of P and Q is a set of four pairs of truth values. Each function has to be defined at these pairs. For each of four pairs in the domain there are two values in the range. The total number of possible combinations is 2 4 = 16. Therefore, there are sixteen different functions of two arguments P and Q. Example 3. Consider three propositions P, Q, and R and all functions f(p, Q, R). Each of propositions has two truth values T and F. The list of all possible combinations (triplets) of truth values is (T,T,T), (T,T,F), (T,F,T), (T,F,F), (F,T,T), (F,T,F), (F,F,T), and (T,F,F). So, the domain of a function is a set of eight triplets. For each of eight values in the domain there are two values in the range. The total number of possible combinations is 2 8 = 256. Therefore, there are 256 different functions of three propositions. Now let s analyze types of operations in terms of functions. Unary Unary operation is a function of one proposition P. As it was shown above there are four such functions. Let s look at their table again and emphasize a nontrivial function: P f 1 f 2 f 3 f 4 T T T F F F T F T F The functions f 1 and f 4 are constant (f 1 = T, f 4 = F ) and hence trivial. The function f 2 is also trivial since f 2 (P ) = P. The only nontrivial function of one argument is f 3 and hence it is special. In logic it is called negation and denoted by P (or P ). Please remember this function. 2
Binary It is defined on the four pairs of truth values of two proposition P and Q. Those pairs are (T, T ), (T, F ), (F, T ), and (F, F ). Therefore, the domain of a function contains four points. For each point a function can attain two values either T or F. Hence the total number of all possible binary functions is 2 4 = 16. Here is the table of them: P Q f 1 f 2 f 3 f 4 f 5 f 6 f 7 f 8 T T T T T T T T T T T F T T T T F F F F F T T T F F T T F F F F T F T F T F T F P Q f 9 f 10 f 11 f 12 f 13 f 14 f 15 f 16 T T F F F F F F F F T F T T T T F F F F F T T T F F T T F F F F T F T F T F T F The functions f 9 f 16 are negations of the functions f 1 f 8 and can be removed (f 16 is negation to f 1, f 15 is negation to f 2, and etc.) The function f 1 = T is constant, f 4 = P, f 6 = Q. The only nontrivial functions are f 2, f 3, f 5, f 7, and f 8, and they have special names and notations that have to be remembered: f 8 is called logic AND (conjunction) and denoted by P Q f 2 is called logic OR (disjunction) and denoted by P Q f 5 is called conditional (implication) and denoted by P Q f 7 is called biconditional (double implication) and denoted by P Q We omitted f 3 which is another conditional Q P because it is similar to f 5. Sometimes f 10 is called exclusive OR and denoted by P Q. We are not going to use it here since it is just a negation of f 7. A conditional proposition can be expressed as If P then Q, where P is called a hypothesis and Q is called a conclusion. 3
Ternary It contains three propositions and its domain is made of 2 3 = 8 triplets of truth values of the propositions. The total number of all possible ternary functions is 2 8 = 256. This number is huge and there is no way to list and remember them all. So, this way is not productive. A productive way is to represent a ternary function as a combination of unary and binary functions. The same is true for any function with the number of arguments greater than three. That is why in logic we do not define operations with the number of arguments greater than two. Although functions of three and more arguments are under consideration. Logic operations and their truth tables A table which is similar to the previous tables and representing one logic operation is called a truth table for the logic operation. Below are truth tables for one unary and all four binary logic operations that have to be memorized Truth table for P : P P T F F T Truth table for P Q: P Q P Q T T T T F F F T F F F F Truth table for P Q: P Q P Q T T T T F T F T T F F F 4
Truth table for P Q: P Q P Q T T T T F F F T T F F T Truth table for P Q: P Q P Q T T T T F F F T F F F T Compound propositions Binary logic operations are called connectives. A proposition made of several propositions and containing unary and binary operations is called a compound proposition or a formula. Primitive propositions that do not contain unary or binary operations are called atoms. Order of operations In compound propositions the following order of operations is applied: Negation Logic AND precedes logic OR In other cases use parentheses to specify the order of operations. Example. P Q R is not the same as P (Q R) or (P Q) R. Example. Find the truth table for the compound proposition P Q 5
P Q P P Q T T F T T F F F F T T T F F T T Equivalent propositions Two propositions are equivalent if their truth tables are the same. Example. Show that P Q is equivalent to P Q. The truth table for P Q is P Q P Q T T T T F F F T T F F T which equals to truth table P Q in the previous example. Hence these two propositions are equivalent. Alternative solution: Construct the truth table for the compound proposition ( P Q) (P Q) and show that its last column contains only T values. Example. By constructing truth tables prove De Morgan s Law ( (P Q)) ( P Q), where the sign means equivalence. Truth table: P Q P Q (P Q) P Q P Q T T T F F F F T F T F F T F F T T F T F F F F F T T T T The fourth and seventh columns are equivalent. Hence, De Morgan s Law is true. Alternative solution: Construct the truth table for the compound proposition ( (P Q)) ( P Q) and show that its last column contains only T values. 6
Definition [1] A compound proposition that is true regardless of the truth values of its atoms is called a tautology. Example. By constructing truth table show that the proposition (P Q) P is a tautology. Truth table: P Q P Q (P Q) P T T T T T F F T F T F T F F F T The last column contains true values only. Hence, the proposition (P Q) P is a tautology. Example. Show that the proposition (P Q) (P Q) is a tautology. Truth table: P Q Q P Q P Q (P Q) (P Q) T T F F T T T F T T T T F T F F F T F F T F T T The last column has true values. Hence, the proposition (P Q)) (P Q) is a tautology. Definition [1] A compound proposition that is false regardless of the truth values of its atoms is called a contradiction. Example. Show that the proposition (P Q) ( P ) is a contradiction. Truth table: P Q P Q P (P Q) ( P ) T T T F F T F F F F F T F T F F F F T F 7
The last column contains false values only. contradiction. Hence, the proposition (P Q) ( P ) is a Definition [1] A conditional proposition that is not tautological is called a fallacy. Example. Show that the proposition (P Q) ( P ) is a fallacy. Truth table: P Q Q P Q P (P Q) ( P ) T T F F F T T F T T F F F T F F T T F F T F T T The last column does not contain true values only. Hence, the conditional proposition (P Q) ( P ) is a fallacy. Definition [1] of inference. A conditional or biconditional proposition that is a tautology is called a rule Example. Show that the proposition ((P Q) P ) Q is a rule of inference. The proposition is conditional. We need to show that it is a tautology. Truth table: P Q P Q P (P Q) P ((P Q) P ) Q T T T F F T T F T F F T F T T T T T F F F T F T The last column contains true values only. Hence, the proposition ((P Q) P ) Q is a tautology and it is a rule of inference. 8
Rules of inference Double negation: ( A) A Simplification: A B A Addition: A A B Disjunctive syllogism: ((A B) A) B Reductio ad absurdum: (( A B) ( A B)) A Modus ponens: (A (A B)) B Modus tollens: ( B (A B)) A Contrapositive: (A B) ( B A) Deduction principle: ((A B) C) (A (B C)) Hypothetical syllogism: ((A B) (B C) (A C) Case analysis: ((A B) (A C) (B C)) C Distributivity: (A (B C)) (A B) (A C), (A (B C)) (A B) (A C) DeMorgan s laws: (A B) A B, (A B) A B Some fallacies: (A (A B)) B, (B (A B)) A, ( A (A B)) B Definition [1] A theorem is a proposition of the form If H 1, H 2,..., H n then C where each H i, i = 1, 2,..., n is a proposition called hypothesis and C is a proposition called conclusion. Definition [1] A proof of the theorem If H 1, H 2,..., H n then C is a finite sequence P 1,..., P k of propositions with P k = C, and such that each of P i is either a hypothesis, or the conclusion of the rules of inference which has as hypothesis one or more of the previous propositions. If the theorem If H 1, H 2,..., H n then C is true we write H 1, H 2,..., H n C 9
Definition [1] Types of proofs Let If H 1, H 2,..., H n then C be a theorem. There are several types of proofs Direct proof: H 1, H 2,..., H n C is proved. Proof by contrapositive: Proof by contradiction: C (H 1 H 2 H n ) is proved. H 1, H 2,..., H n, C D is proved, where D is a contradiction. If the hypothesis is of the form (H 1,..., H n ) (K 1,..., K m ) then we also have proof by exhaustion: H 1,..., H n C and K 1,..., K m C are proved. Definition An algebra (or algebraic structure) is a set A of its elements together with their values and a collection of operations on A that operate on values of elements of A. A propositional logic is a simplest possible nontrivial algebra. Its simplicity comes from the fact that each element (proposition) has only two values and there are no n-ary operations for n 3. First-order logic [1] In mathematics we typically encounter more complicated sentences that depend on variables and whose truth value depends on the value of the variables. To handle such statements we need to consider an extension of propositional logic, called first-order logic. Definition A predicate, also called open statement, is a sentence with one or more variables such that when the variable is replaced by a value from a specified domain, also called universe of discourse, the resulting sentence is a statement in propositional logic (i.e. unambiguously true or false). To be able to create statements in propositional logic from predicates we need to expand the lexicon of propositional logic by adding the following quantifiers: for for some, there exists... such that..., for for all. is called the existential quantifier, and is called the universal quantifier. A proposition in first-order logic is made of propositions in propositional logic, predicates, and quantifiers. 10
Negation of propositions There are several simple negations that should be memorized: ( P ) = P (P Q) = P Q (P Q) = P Q (P Q) = P Q ( x P (x)) = x P (x) ( x P (x)) = x P (x) For example the last proposition is read as the negation of for all x P (x) is true is the same as there exists x for which P (x) is false. Example Negate the statement: ε > 0 M N such that n M x n x < ε. ε > 0 such that M N n M x n x > ε. Example. Theorem. There is no rational square root of 2. In the statement of the theorem rational means a rational number of the form m n where m and n are integer numbers with no common factors. To prove the theorem we restate its statement in the form of hypotheses and conclusion. Our first try is Theorem. If r 2 = 2 then r m n Our second try is where m and n are integer numbers with no common factors. Theorem. If r 2 = 2 and m and n are integer numbers with no common factors then r m n. The last form of the theorem has hypotheses and a conclusion. Let s write them down: Hypothesis 1, H 1 : r 2 = 2. Hypothesis 2, H 2 : Conclusion, C: r m n. In terms of logic the theorem is Theorem. H 1 H 2 C. m and n are integer numbers with no common factors. We will prove it by contrapositive: C (H 1 H 2 ) is proved 11
Applying the negation to the right side we obtain C H 1 H 2 In other words, we have to prove the following Theorem. IF r = m n THEN r2 2 OR m and n are integer numbers with common factors. Proof : r = m n r2 = m2 n 2. 1. r 2 2 and the theorem is proven. OR 2. r 2 = 2. We have two cases: In this case we have m2 n 2 = 2 m2 = 2n 2 m is even. Indeed, if m is odd then m 2 also must be odd and cannot be equal 2n 2 which is even. So, m = 2k for some integer number k. Then (2k) 2 = 2n 2, 4k 2 = 2n 2, 2k 2 = n 2 and n must be even, i.e. n = 2l for some integer number l. The last means that m and n have a common factor 2. The theorem is proven. References [1] Bogdan Ion Math 0413 lecture notes. 12