I. BASICS OF PROPOSITIONAL LOGIC George Boole (1815-1864) developed logic as an abstract mathematical system consisting of propositions, operations (conjunction, disjunction, and negation), and rules for using the operations. The basic idea is that if simple propositions could be represented by precise symbols, the relation among the propositions could be associated as an algebraic equation. Therefore, certain types of reasoning are reduced to the manipulation of symbols. 1.1. Propositions A proposition is a declarative sentence that can be either true or false. It must be one or the other, and it cannot be both. An atomic proposition is the smallest statement or assertion that must be true or false. Letters P, Q, R, p, q, r,..., called the propositional variables, are usually used to denote the propositions, with the values of them either true (T) or false (F). Example 1.1.1. Identify if the following statements are propositions: P: 5 is a prime p: the book is about math A1: Obama was the President [4]: are you going out somewhere? r: 2+3 C : I am a liar. 1 Propositions: P: 5 is a prime p: the book is about math A1: Obama was the President Non- propositions: [4]: are you going out somewhere? r: 2+3 C : I am a liar. 1 1
C 1 can not have either T or F, though it looks like a proposition. It is called a paradox. Example 1.1.2. Identify if the following statements are propositions: p : Drilling for oil caused dinosaurs to become extinct. q : Look out! r : How far is it to the next town? P 1: x + 2 = 2x P 2 : x + 2 = 2x when x = 2 P 3: The Earth is further from the sun than Venus. P 4 : There is life on Mars. P 5 : 2 2 = 5. p is a proposition. q is not a proposition. r is not a proposition. P 1 is not a proposition. P 2 is a proposition. P 3 is a proposition. P4 is a proposition. P5is a proposition. 1.2. Logic Operators or Connectives The connectives for propositions are ~ : negation : and (conjunction) : or (disjunction) : implication : equivalence Propositional formulas are constructed from atomic propositions by using the connectives. 2
Example 1.2.1. Let p : q : t : Tomorrow is Saturday Tomorrow is sunny Tomorrow is a beach day Find ~ p : p q : ~ p ~ t : q t : ~ p : Tomorrow is not Saturday p q : Tomorrow is Saturday and sunny ~ p ~ t : Tomorrow is not Saturday or not a beach day q t : If tomorrow is sunny, then tomorrow is a beach day Example 1.2.2. If A it is hot and B it is sunny, state the meaning of each of following expresison in terms of A and B: 1.) AB 2.) ~ AB 3.) ~ A~ B 4.) ~ ~ A~ B 5.) AB 6.) ~ A B A ~ B 3
1.) AB it is hot and sunny 2.) ~ AB it is not hot but sunny 3.) ~ A~ B it is neither hot nor sunny ~ ~ A~ B it is not true that it is neither hot nor sunny 4.) 5.) AB it is hot or sunny ~ A B A ~ B it is either not hot and sunny or hot and not sunny 6.) Example 1.2.3. Let p It is raining q Mary is sick t Bob stayed up late last night r Paris is the capital of France s John is a loud-mouth Express each of the following statements in terms of the declarative sentences above: Negation: 1.) It isn t raining 2.) It is not the case that Mary isn t sick 3.) Paris is not a capital of France 4.) John is in no way a loud-mouth Conjunction: 5.) It is raining and Mary is sick 6.) Bob stayed up late last night and John is a loud-mouth 7.) Paris isn t the capital of France and It isn t raining 8.) John is a loud-mouth but Mary isn t sick 4
9.) It is not the case that it is raining and Mary is sick Disjunction: 10.) It is raining or Mary is sick 11.) Paris is the capital of France and it is raining or John is a loud-mouth 12.) Mary is sick or Mary isn t sick 13.) John is a loud-mouth or Mary is sick or it is raining 14.) It is not the case that Mary is sick or Bob stayed up late last night Mixed statements: 15.) It is raining but Mary is not sick 16.) Either it is not raining and Mary is sick or Paris is not the capital of France 17.) Neither it is raining nor Mary is sick 18.) It is not true that both it is raining and Mary is sick 1.) ~ p 2.) ~ (~ q ) 3.) ~ r 4.) ~ s 5.) p q 6.) t s 7.) ~ r ~ p 8.) s ~ q 9.) ~ p q 10.) p q 11.) r p s 12.) q ~ q 13.) ( s q) p 5
14.) ~ ( q t) 15.) p ~ q ~ p q ~ r 16.) 17.) ~ p ~ q 18.) ~ p q The well-formed formulas (wff) are obtained by using the construction rules: An atomic proposition is a wff. If is a wff, then so is ~. If and are wff, then so are,,, and. If is a wff, then so is. 1.3. Truth Tables A truth table shows whether a propositional formula is true or false for each possible truth assignment. Truth tables for the five basic connectives are: p F T ~ p T F p q p q p q p q p q F F F F T T F T F T T F T F F T F F T T T T T T Notice that the only case the implication p qis false is when p is true and q is false. If p is false, then the implication p qis true. 6
This is like to say the following statement is true: p: If horses have wings, then elephants can dance There are two possible truths tables for the implication p p q T 1( p q) T 2 ( p q) T 3 ( q ) T 4 qwhen p is false: Comments F F F T F T not sure for this case F T F F T T not sure for this case T F F F F F false for this case T T T T T T true for this case If T 1 is used, then p qwould have the same table as p q; If T2 is used, then p qwould have the same table as p q; If T3 is used, then p qwould have the same table as q. So, T4 is a reasonable choice. In the form of Boolean variables: p ~ p 1 0 0 1 p q p q p q p q p q 0 0 0 0 1 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 1 1 1 1.4. Identity Or Equivalence Two compound propositions p and q are logically equivalent if the columns in a truth table giving their truth values agree. The equivalence is written as p q. 7
A proposition is a tautology, if it is always true. Example: p ~ p. a contradiction, if it is always false. Example: p ~ p a satisfiable, if its truth table contains true at least once. Example: p q. a contingency, if it is neither a tautology nor a contradiction. Example: p Example 1.4.1. Prove Implication Identity p q ~ p q. p q p q ~ p ~ p q 0 0 1 1 1 0 1 1 1 1 1 0 0 0 0 1 1 1 0 1 Since the truth tables for p qand ~ p q are the same, then p q ~ p q. Example 1.4.2. Translate the following sentences into logic. a.) Only THS students can have IDT. b.) You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old. c.) You can access the info website from school only if you take AP Calculus or you are not a freshman. 8
a.). Let p : q : You are a THS student Students have IDT Then q p. That is, the statement is equivalent to The students who can have IDT are THS students. b.) Let p : q : r : Then You ride roller coaster You are under 4 feet You are older than 16 years old ( q ~ r) ~ p or p (~ q r). c.) Let a : c : f : You access info website You take AP Calculus You are a freshman Then a ( c ~ f ) or (~ c f ) ~ a. In mathematical term for proofs, this is often stated as if and only if, iff or necessary and sufficient conditions : Q P: P is necessary for Q, or P if Q P Q: P is sufficient for Q, or P only if Q P Q: P is necessary and sufficient for Q, or P is true iff Q is true For example, let p : q : I will take the exam I am not sick Then the sentence I will take the exam if and only if I am not sick. is p q. 9
Example 1.4.3. Equivalence Identity p q p q q p p q p q q p p q ( p q) ( q p) 0 0 1 1 1 1 0 1 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 1 The values for the p q and ( p q) ( q p) are the same. Example 1.4.4. Equivalence of Implication and its Contrapositive p q ~ q ~ p p q p q ~ q ~ p ~ q ~ p 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 Example 1.4.5. DeMorgan s Laws ~ ( p q) ~ p ~ q and ~ ( p q) ~ p ~ q p q ~ p ~ q p q p q ~ ( p q) ~ p ~ q ~ ( p q) ~ p ~ q 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 1 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 10
Example 1.4.6. Law of Syllogism or Transitivity It can also be written as p q q r pr p q ( q r) p r p q r p q q r ( p q) ( q r) p r (( p q) ( q r)) ( p r) 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1 Example 1.4.7. Exclusive OR (xor) of p and q, denoted as p q, is defined as p q p q 0 0 0 0 1 1 1 0 1 1 1 0 It means that p and q are different. Prove p q ( p q) ~ ( p q). 11
p q p q ~ ( p q) ( p q) ~ ( p q) p q 0 0 0 1 0 0 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 An argument, constructed from premises that are sets of two or more atomic propositions, yields another proposition known as the conclusion. Example 1.4.8. The following statements were from Lewis Carroll s puzzle. Draw the conclusion if the following statements are given: [ 1] All the dated letters in this room are written on blue paper. [ 2] None of them are in black ink, except those that are written in the 3 rd person. [ 3] I have not filed any of those that I can read. [ 4] None of those that are written on one sheet are undated. [ 5] All of those that are not crossed out are in black ink. [ 6] All of those that are written by Brown begin with Dear Sir. [ 7] All of those that are written on blue paper are filed. [ 8] None of those that are written on more than one sheet are crossed out. [ 9] None of those that begin with Dear sir are written in the 3 rd person. Conclusion: Rewrite the premises from the given information: P 1 P 2 P 3 P 4 P 5 P 6 the letter is a dated letter. the letter is written on blue paper. the letter is written in black ink. the letter is written in the 3 rd person. the letter is a readable letter. the letter is written on one sheet. 12
P 7 the sentences are crossed out. P 8 the letter is written by Mr. Brown. P 9 the letter is beginning with Dear Sir. P 10 the letter is filed. Then 1. P1 P2 premise [1] 2. P3 P4 premise [2] 3. P5 ~ P10 premise [3] 4. P6 P1 premise [4] 5. ~ P7 P3 premise [5] 6. P8 P9 premise [6] 7. P2 P10 premise [7] 8. ~ P6 ~ P7 premise [8] 9. P9 ~ P4 premise [9] 10. ~ P4 ~ P3 from 2., contrapositive 11. ~ P3 P7 from 5., contrapositive 12. P7 P6 from 7., contrapositive 13. ~ P10 P5 from 3., contrapositive Now cascading all the givens: 14. P8 P9 ~ P4 ~ P3 P7 P6 P1 P2 P10 ~ P5 Or simply P8 ~ P5 Conclusion: Mr. Brown s letters are unreadable. 13
II. PROOFS 2.1. Testing an Argument The following is the procedure to check if an argument is valid or not based on the premises -- the assumptions that presumably true: Identify the premises p 1, p 2,, pn, and the conclusion q c. Construct a true table for p1, p2,, pn q and p1 p2 pn qc., c If there is one line such that p p p q invalid. is false, then the argument is 1 2 n c Another way to think this is to look at some specific rows, called critical rows, where the premises p1, p2,, pn are all true: if the conclusion q c is false in one or more critical rows, then the argument is invalid. Otherwise, the argument is valid. In logic, the words true and valid have very different meanings: truth is about the premises making up an argument, and validity is about whether the conclusion follows from the premises. Example 2.1.1. Determine whether the arguments are valid: If I get into the THS Academic Research internship, then I don t go to regular classes. If I don t go to regular classes, then I will be well prepared for college. Therefore, if I get into the THS academic Research internship or I don t go to regular classes, I will be well prepared for college. p : I get into the THS Academic Research internship q: I don t go to regular classes r: I will be well prepared for college In the wff form: p q q r ------------------ p q r 14
Or argument can also be expressed as Construct the truth table: ( p q) ( q r) ( p q r) p q r p q ( p1 ) q r ( p2) p q p q r ( q c ) Notes 0 0 0 1 1 0 1 Critical 0 0 1 1 1 0 1 Critical 0 1 0 1 0 1 0 0 1 1 1 1 1 1 Critical 1 0 0 0 1 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 Critical Notice that all critical rows have a true conclusion and thus the argument is valid. Example 2.1.2. Determine whether the arguments are valid: Robbery was the motive for the crime only if the victim had money in his pockets. But robbery or vengeance was the motive for the crime. Therefore, vengeance must have been the motive for the crime. p : robbery was the motive for the crime q: the victim had money in his pockets r: vengeance was the motive for the crime In the wff form: p q p r ------------------ r Or the argument can be expressed as ( p q) ( p r) r. 15
The truth table is p q r p q ( p1 ) p r ( p2) r ( q c) Notes 0 0 0 1 0 0 0 0 1 1 1 1 Critical 0 1 0 1 0 0 0 1 1 1 1 1 Critical 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 1 1 0 Critical 1 1 1 1 1 1 Critical It is not a valid argument. 2.2. Valid Forms a.) Modus Ponens (affirm by affirming or the law of detachment) Modus Ponens can symbolically be expressed as p p q q which is equivalent to the argument statement: The truth table for the above statement is p q p q p q p q p q p p q p q F F T F T F T T F T T F F F T T T T T T 16
The conclusion is always true regardless the premises. That is, it is a tautology. Therefore, the argument is valid. Example 2.2.1. Determine whether the following argument is valid or invalid. If it s after midnight, then I must go to sleep. It is after midnight. -------------------------- I must go to sleep. Let p : It is after midnight q: I must go to sleep. Then [1] p q 1 st premise [2] p 2 nd premise ----------------- q MP The argument is valid. b.) Modus Tollens (deny by denying) ~ q p q ~ p c.) Disjunctive Syllogism ~ p p q q 17
d.) Generalization p pq e.) Specialization p q p If argument contains three or more premises, it will be necessary to take the conjunction of all of them. To avoid the inconvenience of writing long truth tables, some of the valid forms can be used to show an argument valid. To show that an argument is invalid, an assignment of truth values for components that makes all the premises true and the conclusion false. Example 2.2.2. Determine whether the following argument is valid or invalid. If tomorrow is Saturday and sunny, then it is a beach day. Tomorrow is Saturday. Tomorrow is not a beach day. -------------------------- Tomorrow must not be sunny. Let t Tomorrow is Saturday s Tomorrow is sunny b Tomorrow is a beach day then 1. t s b 1 st premise 2. t 2 nd premise 3. ~ b 3 rd premise ~ t s 1,3 Modus Tollens 4. 5. ~ s ~ t DeMorgan s Laws 6. ~s 2, 5, Disjunctive Syllogism 18
Example 2.2.3. Determine whether the following argument is valid or invalid. It is not sunny this afternoon and it is colder than yesterday. We will go swimming only if it is sunny. If we do not go swimming, then we will take a canoe trip. If we take a canoe trip, then we will be home by sunset. -------------------------- We will be home by sunset. p it is sunny this afternoon q it is colder than yesterday r we will go swimming s we will take a canoe trip t we will be home by sunset then 1. ~ p q 1 st premise 2. ~ p Simplification 3. r p 2 nd premise 4. ~ r 2,3, Modus tollens 5. ~ r s 3 rd premise 6. s 4, 5, Modus ponens 7. s t 4 th premise 8. t 6, 7, Modus ponens 19
III. FIRST-ORDER LOGIC 3.1. Predicate A constant or value is an object in a set called the domain or universe of discourse. A variable can denote any object in the universe of discourse. A predicate or propositional function is a function that a variable or a finite collection of variables can have. A predicate becomes a proposition when specific values are assigned to the variables. p( x1, x2,, x n ) is called a predicate of n variables or n arguments. A predicate can also become a proposition by quantification. In predicate logic, each predicate is given a name, which followed by the list of arguments. It involves quantities like some and all. Example 3.1.1. For an equation yx 1, the predicate for the equation is p( xy:, ) yx 1 p(1,2) is true and p(2,1) is false. Example 3.1.2. A student is a senior at THS. The predicate can be formed as s( x ) : x is a senior at THS If Matt is a senior at THS and Grace is a senior at CHS, then s(matt) is true and s(grace)is false. The predicate can also be formed as n( xy:, ) x is a senior at y In this case, n(matt,ths) is true, n(grace,chs) is true also. 3.2. Quantification The universal quantification of Pxis ( ) the proposition written in logical notation as: xp( x) : p( x) is true for all values x in the universe 20
or sometimes it can be written as x U, p( x) Where U is called the universe of discourse, the set from which the variables can take values. If 1 2 x { x, x,, x n } is the domain, then ( ) ( ) ( ) ( ) xp x p x1 p x2 p x n A counterexample for xp( x) is that there is a tu such that p( t) is false. The existential quantification of p( x) is the proposition written in logical notation as: xp( x) : There exists an element in the universe discourse such that p( x) is true. If 1 2 x { x, x,, x n } is the domain, then ( ) ( ) ( ) ( ) xp x p x1 p x2 p x n An assertion involving predicates is valid if it is true for every element in the universe of discourse. An assertion involving predicates is satisfiable if there is a universe and interpretation for which the assertion is true. Example 3.2.1. If the universe of discourse is U {1,2,3}, then xp( x) p(1) p(2) p(3) xp( x) p(1) p(2) p(3) Example 3.2.2. Assume U {1,2,3} and the predicate is p( x ) : x2 2x Then, what are the meanings of xp( x) and xp( x)? Decide if they are true or false. 21
xp( x) : For every x {1,2,3}, x2 2x. The proposition is false. xp( x) : There exists x{1,2,3} such that x2 2x. The proposition is true. Example 3.2.3. Assume the following predicates with U {All animals} F( x ) : S( x ) : T( x ) : x is a fox x is a sly x is trustworthy Quantify the following statements: a.) Everything is a fox. b.) All foxes are sly. c.) If any fox is sly, then it is not trustworthy. a.). xf( x). b.) x[f( x) S(x)] c.) x[f( x) S(x) ~ T(x)] ~ x[f(x) S(x) T(x)] 3.3. Multiple Quantifiers Example 3.3.1. Suppose P( x, y) is xy 1, the universe of discourse for x is the set of positive integers, and universe of discourse for y is all real numbers. Quantify a.) For every positive integer x and for every real number y, xy 1. b.) For every positive integer x, there exists a real number y such that for every positive integer x, xy 1. 22
c.) There exists a real number y such that, for every positive integer x, xy 1. a.) x yp( x, y), false. b.) x yp( x, y), true. c.) y xp( x, y), false. The order of quantifiers is important; they may not commute. For example, but xyp ( x, y) y xp( x, y) xyp( x, y) y xp( x, y) xyp ( x, y) y xp( x, y) The only cases in which commutativity holds are the cases in which both quantifies are the same. Example 3.3.2. P( x, y) is x is a citizen of y. Q( xyis, ) x lives y. The universe of discourse for x is the set of all people and the universe of discourse for y is the set of US states. Quantify the following statements: a.) All people who live in Florida are citizens of Florida. b.) Every state has a citizen who does not live in that state. a.) x[ Q( x,florida) P(x,Florida)] b.) yx[p(x, y) ~ Q(x, y)] 23
3.4. Arguments Universal Instantiation (UI ) xp( x) Pc () Example 3.4.1. Universe of discourse consists of all dogs, and Fido is a dog. All dogs are cuddly. Therefore, Fido is cuddly. Universal Generalization (UG) Pc () for an arbitrary c xp( x) This is often implicitly used in mathematical proofs. Existential Instantiation (EI) xp( x) Pc () for some element c Example 3.4.2. Universe of discourse consists of all students in the course. There is someone who got an A in the course. Let s call her a and say that a got an A. Existential Generalization (EG) Pc () for some element c xp( x) 24
Example 3.4.3. Universe of discourse consists of all students in the class. Michelle got an A in the class. Therefore, someone got an A in the class. Modus Ponens (MP) x[ P( x) Q( x)] Pa ( ) Qa ( ) Modus Tollens (MT) x[ P( x) Q( x)] ~ Q( a) ~ Pa ( ) Hypothetical Syllogism (HS) x[ P( x) Q( x)] x[q( x) R( x)] x[ P( x) R( x)] Example 3.4.4. a.) x[bird( x) fly( x)] bird( koko) fly( koko) b.) x[bird( x) fly( x)] ~ fly( koko) ~ bird( koko) 25
c.) x[bird( x) fly( x)] x[fly( x) has _ wings( x)] x[bird( x) has _ wings( x)] Example 3.4.5. Every man has two legs John Smith is a man Therefore, John Smith has two legs. Let U, the universe of discourse, be the people, and John Smith j U. And let M( x ): x is a man L( x ): x has two legs then 1. xm ( x) L( x) 2 nd premise 2. M(j) L(j) UI from (1) 3. M (j) 1 st premise 4. L (j) MP from (2) and (3) Example 3.4.6. (Lewis Carroll s puzzle) All babies are illogical Nobody is despised who can manage a crocodile Illogical persons are despised What is the consequence? Let U, the universe of discourse, be the people. And also let B( x ) : x is a baby M( x ) : x can manage a crocodile L( x ): x is logical D( x ) : x is despised then 26
1.. xb( x) ~ L(x) 2. xm( x) ~ D(x) 3. x ~ L( x) D(x) 4. xb( x) D(x) 5. xd( x) ~ M(x) 6. xb( x) ~ M(x) 1 st premise 2 nd premise 3 rd premise HS from (1) and (3) Contrapositive from (2) HS from (2) and (5) Conclusion: If a person can manage a crocodile, then the person is not a baby. Example 3.4.7. A student in this class has not read the book Everyone in this class passed the first exam Therefore, someone who passed the first exam has not read the book Let U, the universe of discourse, be the people in the class. And also let C( x ) : x is in this class B( x ) : x has read the book P( x ) : x has passed the first exam In the wff form: x C(x) ~ B( x) x C(x) Px ( ) ----------- x P(x) ~ B(x) Proof 1. xc(x) ~ B( x) 1 st premise 2. C(s) ~ B(s) EI from (1) 3. C(s) Simplification from (2) 4. xc(x) Px ( ) 2 nd premise 5. C(s) P(s) UI from (3) 27
6. P(s) MP from (3) and (5) 7. ~ Bs ( ) Simplification from (2) 8. P(s) ~ B(s) Conjunction of (6) and (7) 9.) xp(x) ~ B(x) EG from (8) 28