Discrete Mathematics and Its Applications Fifth Edition Kenneth H. Rosen AT&T Laboratories Boston Burr Ridge, IL Dubuque, IA Madison, WI New York San Franc~sco St. LOUIS Bangkok Bogota Caracas KuaIaLumpur Lisbon London Madrid MexicoC~ty Milan Montreal NewDelhi Santiago Seoul Singapore Sydney T a ~ p e ~Toronto Contents v 8.7 Planar Graphs 8.8 Graph Coloring End-of-Chapter Material 9 Trees 631 Introduction to Trees Applications of Trees Tree Traversal Spanning Trces 9.5 Minimum Spanning Trees End-of-Chapter Material 0.1 9.2 9.3 9.4 10 Boolean Algebra 701 10.1 10.2 10.3 10.4 Boolean Functions Representing Boolean Functions Logic Gales Minimization of Circuits End-of-Chapter Material 11 Modeling Computation 739 11.1 Languages and Grammars 11.2 Finite-State Machines with Output 11.3 Finite-State Machines w~thNo Output 11.4 Language Recognition 1 1.5 Turing Machines End-of-Chapter Material Appendixes A.1 Exponential and Logarithmic Function\ A.2 Pseudocode Suggested Readings B-1 Answers to Odd-Numbered Exercises S-1 Photo Credits C- l Index of Biographies 1-1 Index 1-2 The Foundations: Logic and Proof, Sets, and Functions his chapter reviews the foundations of discrete mathematics. Three important topics are covered: logic, sets, and functions. The rules of logic specify the meaning of mathematical statements For instance, these rules help us understand and reason with statements such as "There exists an integer that is not the sum of two squares," and "For every positive integer n the sum of the positive integers not exceeding n is n(n 1)/2." Logic is the basis of all mathematical reasoning, and it has practical applications to the design of computing machines, to system specifications, to artificial intelligence, to computer programming, to programming languages, and to other areas of computer science, as well as to many other fields of study. To understand mathematics, we must understand what makes up a correct mathematical argument, that is, a proof. Moreover, to learn mathematics, a person needs to actively construct mathematical arguments and not just read exposition. In this chapter, we explain what makes up a correct mathematical argument and introduce tools to construct these arguments. Proofs are important not only in mathematics, but also in many parts of computer science, including program verification, algorithm correctness, and system security. Furthermore, automated reasoning systems have been constructed that allow computers to construct their own proofs. Much of discrete mathematics is devoted to the study of discrete structures, which are used to represent discrete objects. Many important discrete structures are built using sets, which are collections of objects. Among the discrete structures built from sets are combinations, which are unordered collections of objects used extensively in counting; relations, which are sets of ordered pairs that represent relationships between objects; graphs, which consist of sets of vertices and of edges that connect vertices: and finite state machines, which are used to model computing machines. The concept of a function is extremely important in discrete mathematics. A function assigns to each element of a set precisely one element of a set. Useful structures such as sequences and strings are special types of functions. Functions play important roles throughout discrete mathematics. They are used to represent the computational complexity of algorithms, to studv the size of sets. to count objects of different kinds,and in a myriad of other ways. + INTRODUCTION Therulesoflogicgive precise meaningto mathematical statements.These rulesare used to distinguish between valid and invalid mathematical arguments. Since a major goal of this 1 2 1 /TheFoundations: Logic a n d Proof. Sets. a n d Functions 1-2 hookis to teach the readerhow tounderstand and how toconstruct correct mathematical arguments, we besin our study of discrete mathematics with an introduction to logic. In addition to its importance in understanding niathematical reasoning, logic has numerous applications in compulerscience.Thesc rules are used in the design of coniputer circuits; the construction of computer programs, the verification of thr correctness of programs, and in many other ways. We will discuss each of these applications in the upcoming chapters. PROPOSITIONS Our discussion begins with an inlroduction to the basic buildlng blocks of logicpropositions. A proposition is a declarative sentence that is either true or lalse. but not both. EXAMPLE 1 All the following declarative sentences nrr propositions. 1. Washington, D.C.. is the capital of the United States of America. 2. Toronto is the capilnl of Canada. 3. 1 + 1 = 2 . 4. 2 + 2 = 3 . Propositions 1 and 3 are true, whrrras 2 and 4 are false. 4 Some sentences lhat are not propositions are givcn in the next example. EXAMPLE 2 Consider the following sentences 1. What time is it? 2. Read this carefully ARISTOTLE (384 ~ . c . ~ . - 3 2 B.c.E.) 2 Anstotle wss horn in Stargirui in northcrn Greece. His father Links wasthe personal physician of (he King of Macedonia. Because hi, lalhcr died whell Aristotle was young. Arislotle could not fullnw lhc custom of h>llowinghis father's profession. .Ari\lotle hccame an u r p h ~ n at a young age when his mother 81%) rlisrl. His ~ u a r d i a nwho raised him taught hint poetry rhetoric. and Greek, At the agc of 17, his guardian sent him 11, Alhcns to further his education. Ariitotle joined P l a t d s Academy where for 20 years hc attended Plalo's lrctures. later presenting his own lectures on rhetoric. M e n Plaro died in 347 o.c.~..Aristotlewas not chosen l o suecced him hecause his views dilfercd too much fmm those of Plato. Ins1rad,Arictutlc loinrd the court 01 King Hermeas where hc remained lor three gmrs. and married the uiece of the King. \Vhen the Persians defeated t~rrmcas.Arirlollrrnovcd t o Mylilenc and, at the invitatiou of King Philip of Macedonla. hc tulored Alexander, Philip'. son. who latcr became Alrxandcr the Great. Artslotle tutored Alexander for five years and after thc dezlth of Kine Philip, he rcturned t o Athens .lnd sst up h ~ own \ school.callrll thc Lyceum. Aristotle's followers wcre called thc peripatetics. whlch rneans "to walk about," becauw Arislotle often walked amund as he discussed philosophical qur5tions. Aristutlr taught at the Lyceum for I3 years where helecturcd ro hisadvanccd students in i h r morning and gave popularlectuvr, t u a broad audience in the ruening. When Alexander the Great died in 323 s c F . a backlash against anything related to Alexandur led ro trumped-up chargcn of impiety against Arislotlc. Aristotle fled t o ('halcis to void prosecution. He only lived one year in Chalcis. dying of a stomdch ailment in 322 R I - k . Acistollr wrote three tjpes of works: thoec writtcn for a popular audience. c~,mpiliilionsof scienlilic Pact% and systematic lreatiscs. The syalrmatic trcalises includcd works on logic, philosophy. psycholooy. physics, and n ~ t u r a hisrury. l Aristotle's writings were prcscrved by a sludent and were hidden in a vanlt where a wealthy hook collector dirrovered them ahout 200 years latcr. They were takcn to Rome, wherc they were studied by scholars and issued in new rditions.preserving thcm fov porterily. '-2 1.1 Logic 3 1-3 3. .r :a1 4. las ter of .he Sentences 1 and 2 arc not propositions because they are not declarative sentences. Sentences 3 and 4 arc no1 propositions because they are neither true nor false, since the variables in these sentences have not been assigned values. Various ways to form propositions from sentences of this type will be discussed in Section 1.3. 4 cnot Links 4 + I = 2. x+y=z. Letters are used to denote propositions. just as letters are used to denote variables. The conventional letters used for this purpose are p, q , r, s,. . . . The truth value of a proposition is true, denotcd by T. if it is a true proposition and false, denoted by F, if it is a false proposition. The area of logic that deals with propositions is called the propositional calculus or propositional logic. It was first developed systematically by the Greek philosopher Aristotle more than 2300 years ap). Wcnow turn our attention tomethodsforproducingnewpropositions from those that we already have. These methods were discussed by the English mathematician George Boole in 1854 in his book The Lnws of Tliorrght. Many mathematical statements are constructed by combining one or more propositions. New propositions,called compound propositions, are formed from existing propositions using logical operators. DEFINITION 1 Let p be a proposition. The statement "It is not the case that p" is another proposition, called the negation of p. The negation of p is denoted by -p. The proposition - p is read "not p." EXAMPLE 3 Find the nezation of the proposition "Today is Friday.'' ~xtra father 'oung. rphan c. and 'larn's r~oric. rd too ?d for novcd Solrrtior,: Thc ncgalion is "It is not the case (hat today is Friday." This negation can he more simply expressed hy "Today is not Friday," or n. who I ' King .istotle 3 years encr in xander an. He ienlific hnlogy, a vault whcre . and express [his in simplc English. Examples "It is not Friday today." TrathTahle for the Negation Proposition. 4 Remark: Strictly speaking, sentences involving variahle times such as those in Ernmple 3 are not propositions unless a fixed time is assumed. The same holds for variable places unless a fixed place is assumed and for pronouns unless a particular person is assumed. A truthtabledisplaystherelationships betweenthe truth valuesofpropositions.Truth tables are especially valuahle in the determination of the truth values of propositions constructed from simpler propositions. Table I displays the two possible truth values of a proposition p and the corresponding truth values of its negation - p . 4 11 The FoundaLions: Logic and Proof; Sets, and Funct~ons 1 4 Thenegation of a proposition can also be considered the resull oL the operation of the negation operator on a proposition. The negation operator constructs a new proposition from a single existing proposition. We will now introduce the logical operators that are used to form new propositions from two or more existing propositions. These logical operators are also called connectives. DEFINITION 2 Lct p and q bc propositions. The proposition " p and q," denoted p A q. is the proposition that is true when both p and q are true and is false otherwke. The proposition p q ir called theconjui~crionof p and q The truth table for p A q is shown in Table 2. Note that there are four rows in this truth table, one row for each possible combination of truth values for the propositions p and q . EXAMPLE 4 Find the conjunction of the proposittons p and q where p is the proposition "Today is Friday" and q is the proposition "It is raining today." Solf~tiun:The conjunction of these propositions, p A q, is the pl.oposition "Today is Friday and it is raining today" This proposition is true on rainy Fridays and is false on any day that is not a Friday and on Fridays when it does not rain. 4 DEFINITION 3 Let p and q be propositions. The proposition " p or q," denoted p v q,is the proposition that is false when p and q are both false and true otherwise. The proposition p \/ q is called the disjunction ot p and q. The truth table for p ,i/ q is chown in Table 3. The use of the connective or in a disjunction corresponds to one of the t\ro ways the word or i b used in English, namely, in an inclusive way. 4 disjunction is true when at least one of the two propositions is true. For instance, the inclusive o r is being used in ihe statement "Students who hdvr taken calculus or computer science can take this clasr." Links GEORGE BOOLE (1815-1864) G~.orgeBode, lhc son of:, cobbler. was boln in Lincoln, England. in Norember I815 Because ofhis family's diffirull financial rhuation. Boole had to strugglc to cducale himsellwhilr rupporlinghis l'amily.Nevrrtheleas, hc became oneofthc mostimportant mathematicians of the lROOs. Although he considered a carrcr as a clelyyman. he dcclded inslead toguirlru tcschingund soon afterward opencd a school o i his own. In his p ~ r ~ a r a r i ufur n leaching mathemalzcs. Boole-unratisiied with rerthooks ol'his d a y 4 c c i d c d lo lead the wrlrks of thuglcal rnarhemalicians Whilc vcndine pnpcrs of thc great French mathematician Layranee. Boole madc discoveries in the calculus of variations. the branch of analysis dcaling with tinding rulvcs and surfoccs optmiring c c lnin parsmdters. In 1848Boalr publ~shcd~~ehIarhemoricolAnuIysi.sofLu~~c, the lirsl afhis contriburiuns tosymbolic logic. In 1x49 he was appointed pratcssor of rnathrrnsttcs at Queen's COIICQC in Cork. Ireland. In 1x54 he published T l ~ cLitws of 7horrgll1, his most famous work. I n this book Baole inlroduced whal is now called Boolcon o l ~ e h r ain his honor. Rocllc wrolc textbooks on difklential equalions and on diifclrncc equations that were used in Great Blitain until lhc end of the nineteenthcentury Buolc marricd in 1855. his wife wac the niecc oi the plofcssar of Greek at Queen's Coil~gc.In IHb3 Buole dicd lrom pneumonia. which he contracted as 3 result of keeping a leclulr: engagement even though he was soukine u c t from a rainst~um. 1-4 1-5 1.1 Logic 5 of the xition lat are logical TABLE 2 The Truth Table for the Conjunction of Two Propositions the The T T F T F F TABLE 3 The Truth Table for the Disjunction of Two Propositions. F l F in this tions p Herc, we mean that students who have taken both calculus and computer science can take the class, as well as thc students who have taken only one of the two subjects. On the other hand. we are using the exclusive or when we say vday is "Students who have taken calculus or computer science, hut not both,can enroll in this class." is F r i ~ alse on Herc, we mean that students who have taken both calculus and a computer science course cannot take the class. Only those who have taken exactly one of the two courses can take the class. Similarly, whrn a menu at a restaurant states,"Soup or salad comes with an entrie," the restaurant almost always means that customers can have either soup o r salad, but not both. Hmce, this is an exclusive. rather than an inclusive, or. 4 3pOition EXAMPLE 5 io ways nhen at din the What is thc disjunction of the propositions p and q whcre p and q are the same proposilions as in Example 4? Solurion: The disjunction of p and q , p V q , is the proposition "Today is Friday or it is raining today." This proposition is truc on any day that is either a F~idayor a rainy day (including rainy Fridays). It is only false on days that arc not Fridays when it also does not rain. 4 England, ,cducatc Extra ticianr vi and soon ,satisfied ~gpapers lions. the symbolic . In 1854 at is now iiference i in 1855: DEFINITION 4 As was previously remarked, the use of the connective or in a disjunction corresponds to one of the two ways the word or is used in English,namely, in an inclusive way. Thus, a disjunction is lrue when at least one of the two propositions in it is true. Sometimes, we use or in an exclusive sense. When the cnclusive or is used to connect the propositions p and q , the proposition " p o r q (but not both)" is obtained. This proposition is true when p is true and q isfalse,and when p i s false a n d 9 is true. It is false when both p a n d 9 are false and when both are true. Let p and q be propositions The exclusive or of p and q, denoted by p @ q, is the proposition that is true when exactly one of p and 9 is true and is false otherwise. eurnania, el from a The truth table for the exclusive or of two propositions is displayed inFTable4. 6 1 I The Foundations: Logic and Proof, Sets, and Functions 1-6 TABLE 4 The 'Ikuth Table for the Exclnsive Or of W o IMPLICATIONS We will discuss several other important ways in which propositions can he combined. DEFINITION 5 Asseawent Let p and q he propositions. The implication p -. q is the proposition that is false when p is true and q is false, and true otherwise. In this implication p is called the hypothesis (or antecedent or premise) and q is called the conclusion (or consequence). The truth table for theimplication p + y isshowninTahle5.Animplicationissometimes called a conditional statement. Because implications play such an essential role in mathematical reasoning. a variety of terminology is used to express p + q. You will encounter most if not all or the following ways to express this implication: "if p. then q" " p implies q" " p only if q" Exsmples " p is sufficient for q" "q when p" "a necessary condition for p is y" "a sufficient condition for q is p" "q whenever p" "q is necessary lor p" " q follows lrom p" The implication p + q is false only in the case that p i s true, but q is false. It is true when both p and q are true, and when p is false (nn matter what truth value q has). A useful way to understand the truth value o f an implication is to think of an obligation or a contract. For example, the pledge many politicians make when running for office is: "If I am clcctrd. then I will lower taxes." If the politician is rlccted, voters would expect this politician to lower taxes. Furthermore, if the politician is not elected, then voters will not have any expectation that this person willlower laxes,although the person may have sufficient influence tocause those in power to lower taxes. It is only when the politician is elected but does not lower taxes that voters can say that the politician has broken the campaign pledge. This last sccnario col~esponds to the case when p is true. but q is false in p + q. 1-6 I Similarly, consider a statement that a professor might make: "If you get 100% on the final, then you will get an A," If you managc to get a 100% on the final, then you would expect to receive an A. If you do not get 100% you may or may not receive a n A depending onother factors. However, if you d o get Ion%, but the professor does not give you an A , vou will feel cheated. Many people find it confusing that " p only if q" expresses the same thing as "if p then q."To rcmember this, note that "p only if q" says that 11 cannot be true when q is not truc. That is, the statement is false if p is true, but q is false. When p is false, q may be either true or false, because the statement says nothing about the truth value of q. A common error is for people to think that " q only if p" is a way of expressing p + q. However, these statements have different truth values when p and q have different truth values. The way we have defined implications is more general than the meaning attached to implications in the English language. For instance, the implication "If it is sunny today, then wc will go to the beach." is an implication used in normal language, slnce there is a relationship between the hypothesis and the conclusion. Further, this implication is considered valid unless it is indeed sunny today, but we do not go to the bcach. On the other hand, the implication "It today is Friday, then 2 + 3 -- 5." is truc from the definition of implication, since its conclusion is true. (The truth value of the hypothesis does not matter then.) The implication times "If today is Friday, then 2 ariety ,e fol- + 3 = 6." + is true every day cncrpt Friday,even though 2 3 = 6 is false. We would not use these last two implications in natural language (except perhaps in sarcasm), since there is n o relationship between the hypothesis and the conclusion in either implication. In mathematical reasoning we consider implications of a more general sort than we use in English. Tnc mathematical concept of an implication is independent of a cause-and-effcct relationship between hvpothesis and conclusion. Our definition of an implication specifies its truth valucs; it is not based on English usage. Tne if-then construction used in many programming languages is different from that used in logic. Most programming languages contain statements such as if p then S, where p is a proposition and S is a program segment (one or more statements to be executed). When execution of a program cncounters such a statement, S is executed if p is true, but S is not executed if p is false. as illustrated in Example 6. n obliing for EXAMPLE 6 What is the value of the variable x aftcr the statement if2+2=4thenx : = x + I rmorc. person power if x = 0 before this statement is encountered? (The symbol := stands for assignment. I means the assignment of the value of x 1 to x.) The statement x := x + + + Solurion: Since 2 2 = 4 is true, the assignment statement x := x Hence,x has the value 0 1 = 1 after this statement is encountered. + + 1 is executed. 4 8 1/The Foundations: Logic and Proof, Sets, and Functions 1-8 CONVERSE, CONTRAPOSITIVE, AND INVERSE Thsre are some related implications that can be formed from p + q . n e proposition q i p is called the converse of p i q . The contrapositive of p + q is the proposition -q -t - p . The proposition -p + -q is called the inverse of y q. The contrapositive, -q + -p. of an implication p q has the same truth value as p i q . To see this, note that the contrapositive is false only when - p is false and -q is true, that is, only when p is true and y is Calse. On the othcr hand. neither the p, nor the inverse. -p i -q, has thc same truth value as p -t q for converse. q all possible truth values of p and q. RI see this, note that when p i s true and q is false, the original implication is hlse, but the convcrse and the inversr arc both true. Whcn two compound propositions always have the same truth value we call them equivalent, so that an implication and itscontrapositive are equivalent.The converse and the invcrse of an implication arc also equivalent, as the rcader car1 verlfy. (We will study equivaler~t propositions in Scction 1.2.) One of the most common logical errors is lo assume that thc converse or the inverse of an implication is equivalent to this implication. We illustrate the use of ~mplicationsin Examplr 7. - - - EXAMPLE 7 What are the contrapositive, thc converse. and the inverse of the implication "The home team wins whenever it is raining."'? Extra Examples SuBtiun: Because'.q whenever p" is one of the ways to express the implication p + q , the original statement can be rrwrittcn as "If it is raining, then the home team wins.'. Conacquently. the contrepositive of this implicati(1n is "If tht. home team does not win, then it IS not raining." The convcrse is "It' the home team wins, then it is rainjng." The inversz is "If it is not raining. then the home team does not win." Only the contrapositive 1s equivalent to the original slatrmrnt. 4 Wc now introduce another way to combine propositions. DEFINITION 6 Let p and q be propositions. The biconditional p tt q is the proposition that is true whenp and q have the sarllc truth values, and is false othenvise. The truth table for p e q is shown in Table h. Note that ilic hiconditional p tt q is true precisely when both the implications p i q and q + p are true. Because of this, thc terminology " p if and only if q" is used for this t~icotiditionaland it is symbolically written by combining the symbols i and t. There are some other common ways to express p tr q: I-!? 1-8 1.1 Logic 9 mrse on TABLE 6 The Truth Table for the Biconditional p tr q. Iue md the for Ise, ien :nt, rsc en t the " p is necessary and sufficient for q" "ill, then q ,and conversely" "p if q". The last way of expressing the biconditional uses the abbreviation "iff" for "if and only if."Note that p tt q has exactly the same truth value as ( p -t q) A (q + p ) . EXAMPLE 8 ' 4. Let p be the statement "You can take the flight" and let q be the statement "You buy a ticket."Then p tt q is the statement Extra I Examples "You can take the flight if and only if you buy a ticket." This statemcnt is true if p and q arc cilher both true or both false, that is. if you buy a tickct and can take the flight or if you do not buy a ticket and you cannot take the flight. It is false when p and q have opposite truth values, that is, when you do not buy a ticket, but you can takc the flight (such as when you get a free trip) and when you buy a ticket and cannot take the flight (such as when the airline humps you). 4 4 The "if and only i f " construction used in biconditionals is rarely used in common language. Instead. biconditionals are olten expressed using an "if, then" or an "only if" construction. The other part of the "if and only if" is implicit. For example, consider the statement in Enelish "If you finish your meal, then you can have dessert." What is really meant is "You con have dessert if and only if you finish your meal."This last statement is logically equivalent to the two slaLements "If you finish your meal, then you can have dcsscrt" and "You can have dessert, only if you finish your meal." Because of this imprecision in natural language, we need to make an assumption whether a conditional statement in nalural language implicitly includes its converse. Becausc precision is essential in mathematics and in logic, we will always distinguish belwcen the conditional statcmrnt p -t q and the biconditional statement p tt q . S PRECEDENCE OF LOGICAL OPERATORS true .the S ' We con construct compound propositions using the negation operator and the logical operators defined s o far. We will generally use parentheses to specify the order in which logical operators in a compound proposition are to be applied. For instance, ( p v q ) A ( - r ) is the conjunction of p V q and - r . However, to reduce the number of parentheses, we specify that the negation operator is applied before all other logical operators.This means that -p A q is the conjunction of -p and q , namely, (-p) A q , not the negation of the conjunction of p and q.namely - ( p A q). luasaldsl s pue 'r .b la1 am.lelns!lled u~ u a q l uaamlaq sah!lJauuos les!rio[ are!.~doldde aql uo ap!sap ol pue sued a ~ u 2 l u a saql JU ~ J B J~ u a s a ~ d a sa[qc!Jen lo~ ~~uo!l!sodoldacn 01 s! op ul:s am leqm 'dlal~:!.~dolddua1oW Ou!sn uosl:al l o a n a l u a s aql azd~eueol in am uaqm sn ~s!ssr!lou pinom s!ql 8u!op'Buo~mI O U S! s!ql q8noqllv ' d 'Kes 'alqe!lan ~l'uo!l!sodoldalauts e Kq a3ualuas aql luasaidal 01dldm!s s! i e lnjasn ~ ]seal inq zsaldm!s a ~' u o. ~ s s a ~ d xje318ol a e o l u ~ssualuas s!ql alelsue11 ol sdem K u I ! ~ ale a . l a u : ~ r o l i n l o ~ .:p[o slea.4 9[ u e q ~laplo aic nod ss>lun 11e11aaj p lapun ale nod J! Iaaeos J;)[~oI a q ~ap!l louues noh.. ;uo!sssldxa [e~!8o[e oiu! p ~ i e l s u eaq ~ l ssualuas qs!lBuz b .(j- S ! ~ Iue3 MOH ? 3) t 01 3 7 d m 3 v re pa~uasaldalaq ues asunluas stql'passa~dxaaq ues uo!les![dm! ue Kem auo s! .,I! Kluo,. 2oq1 B~!II+J d[an!lsadsar ,,'uewqsaq e ale no,<,, pue .,'rolem asuaps .ialndmos e are noh., ,,'sndwes molj laulalul aql ssasse ues no,<,, l u a s a l d a ~J pue ' J 'n 131am 'relny~sedul maql uaamlaq san!rJauuos les!iiol a e p d o l d d c aql au!mlalap pue lied a3ualuas qJea lussolda.~ol sa[qn!leA [euo!~!sodo~dssn [I!M >M 'pea~sul'11 q ~ ~ au!uoscal m so Bu!uearn $I! Bu~zd~eus uaqm [njasn aq lou plnom s!q~' d SE q3ns 'alqepea [euo!~!sodold aldu!s e i q a3ua)uas aql l u a s a ~ d a 01 l alq!ssod s! I! q3noq1 - [ v .uo!ssaldxa [es!a'ol e o ~ u !saualuas s!ql ale[suell 01 sKem Kunlu ole s l a u :uu?rn/o~ aJua!ss lalndmos F ale nod j! L[UO S ,;uemqsaq e I O U ale noK l o .~o[elu aqr ssame ues noA,, ~ ~ U I B11101~ S laulalul juo!ssa~dra1m!aol e olu! pals[suellaq asualuas qs!lPuz s!ql us:, MOH 6 37dI.WX3 '01 pUz 6 S ? [ ~ W F Xlap!SUos ~ 'uo!ssaldxa lesfol e oru! asualuas qs!lSuq ue Ou!~e[sunl~ 60 ssasnrd a111alensnll! o~ 'maql inoqr: uoseal 01 (5'1 u o t ~ s a sU! passnss!~ alp q?!r[m) asualajul jo salni asn ue3 am pue'maql a~e[nd!uemucs am.sanleA qlnJll!aql au!mlalap (11 suo!ssaldxa les18o1as?ql azdleue ue3 2m su~!ssasdxale3!201 OIU! qs1lZu3 molj sasualuas pale[sueq aaeq am asuo'lahoaloIy -asualuas aql jo au!ueam papualu! aql uo paseq suo!~dmnsse alqeuosual JCI 12s e 8u!qew ahlonu! d e u s!ql 1~111? I ~ N .it!n%!qcue aql sanomal suo!ssa~dxa[BSIZOIOIU! s a 3 u a l u ~8 ~ ! 1 e ~ s u e ~ ~ ~ s n o n 8u!aqlmp es! (aOenPue1 uemnrl J ~ I [ 1113~2 I ~ ~ U Fqs!law~ ) 'se[ns111edu1 .sah!lsauuos 183!80[ pue salqe!leh [euo!l!s -odo.ld Bu!a[o.m! suo!sraldra olu! sasualuas qs!(%uz~ale[sue.il 01 suoseai duetu ?Ie a i a u se,d&exa sr?x& ------ S 3 3 N 3 W 3 S HSITDNB DNI&VISNV2I& 'ti pue ' t 'A 'v 'L siolelado le3!2ol aq] JO slanal asuapasaid a l q e & . i o ~ e l ~ d(euo!~!puos!q o aql .lano asuapa3ald seq ioll?~ado leuo!~!puos aql qSnoq11e 'anss! IE a! l o l ~ l a d o~eoo!~!puo~!q pue iolelado 1~uo!l!puos aql jo 1ap.10aql J ~ sie[ds!p I . A pue v 's~oleiadoun!]sun[s!p pue uo!l~unjuosaql ueql ~ 3 u a p a s ~lamol l d a%eqt,pub: + slolel2do [~uo!l!puos!q pue puop!puos a q ~1eq1 a l n ~paldasse ue s! 11 'Llleu!~ .18a[s S! s10le12do u(~!isun!uos PUB UO!IIU~[S!P aql 30 laplo aql leg1 os sasaqluased asn 01 anu!(uos [[!MJM ' J ~ ~ I I I ~ U01I IJ I~~ J I J J aq ! ~ detu a[nI s!q~asnusag - ( J ,A6 ) v d u e q l ~ a q ~re A l ( bv d) sueam J A b d d 1eq1os'101elado un!lsunls!p aq) saao a3uapasaldsayel l o ~ e l a d ouo!~sunjuosaqlleql s! asuapasaldjo a(n11elauaJ laqlouv suo!l~uudprre 'slag foord Or-J jn aauapamid poe 3 Q o ~:coo!lepuno& aqL / 1 01 1.1 Logic 11 "You can ride the roller coaster,""You are under 4 feet tall," and "You are older than 16 years old,"respectivcly. Then thc sentence can be translated to i + Of coursc, thcre are other ways to represent the original sentence as a logical expression, but the onc we havc used should meet our needs. 4 d v. ,hen 1 the ;the SYSTEM SPECIFICATIONS Translatins sentences in natural languagc (such as English) into logical expressions is an essential part of specifying both hardwarc and softwarc systcms. System and software cngincers take requirements in natural language and produce precise and unambiguous specifications that can he uscd as the basis for system development. Example I1 shows how propositional expressions can be used in this process. opoman s the d on from minc hare EXAMPLE 11 ~xtra Examples Exprcss thc spccification "The automated reply cannot be sent wheri the file systcm is full" wing logical connectivcs. Soliiiion: Orir way to translate this is to let p denote "The automated reply can he sent" and q denote "The file systcm is full." Thcn - p represents "It is not the case that the auton~atedreply can be sent," which can also be cxprcsscd as "The automated replv cannot be scni." Ccrnsequently, our specification can be represented by thc implication 4 +'P. 4 System specifications should not contain conflicting requirements. If thcy did thcrc would be no way to dcvclop asystcm that satisfies all specifications. Consequently, propositional exprcssions representing these specifications nccd to be consistent. m a 1 is, there must be an assignment of truth values to the variables in the exprcssions that makes all the expressions true. Alsuch itead, e the escnt " and n can I. EXAMPLE 12 "The diagnostic mcssagc is stored in the buffer or it is retransmitted." "The diagnostic message is not stwed in the buflcr." "If the diagnostic message is stored in the buffer, thcn it is retransmitted." Extra n. The tional we try I is to on the rcsent Detcrminc whether these system specifications are consistent: Examples I EXAMPLE 13 Solurion: To deterniine whether these specifications are consistent, we first express them using logical expressions. Let p denote "The diagnostic messagc is stored in the buffer" and let q denote "The diagnostic message is retransmitted."The specifications can then be written as p v q , - p . and p + 4 . An assignment of truth values that makes all three specifications true must have p false to make - p true. Since we want p V q to he true but p must bc false,q must be true. Because p + q is truc whcn p is false and q is true, we conclude that thcsc specifications are consistent since they are all truc when p is false and q is true. We could come to the samc conclusion by use of a truth table to examine 4 the four possiblc assignments of truth values to p and q. D o the system specifications in Example 12 remain consistent if the spccification "The diagnostic message is not retransmitted" is added'? 12 1/The Foundations: Logic and Proof, Sets, and Functions 1-12 Solurion: By the reasoning in Example 12, the three specifications from that example are true only in the case when p is false and q is true. However. this new specification is -q, which is false when q is true. Consequently, these four specifications arc inconsistent. 4 BOOLEAN SEARCHES - Links Extra Logical connectives are used extensively in searches of largc collections of information, such as indexes of Weh pages. Because these searches employ techniques from propositional logic, they are called Boolean searches. In Boolean searches, the connective AND is used to match records that contain hoth of two search tcrms, the connective OR is used to rnatch one or both of two search terms. and the connective NOT (sometimes written as AND NOT) is used to exclude a particular search term. Careful planning of how logical connectives are used is often required whcn Boolean searches are uscd to locate information of potential intercst. Exan~ple14 illustrates how Boolean searches are carried out. EXAMPLE 14 Web Page Searching. Most Weh search engines support Boolean searching techniques, which usually can help find Weh pages about particular suhjects. For instance, using Boolean searching to find Weh pages ahout universities in New Mexico, we can look for pages matching NEW AND MEXICO AND UNIVERSITIES. Thc results of this search will include those pages that contain the three words NEW, MEXICO, and UNIVERSITIES. This will include all of the pages of interest, tugcther with others such as a page about new universities in Mexico. Next, t ~ tind ) pages that deal with universities in New Mexico or Arizona, we can search for pages matching (NEW AND MEXICO OR ARIZONA) AND UNIVERSITIES. (Note: Here the A N D operator takes precedence over the OR operator.)The results of this search will include all pages that contain the word UNIVERSITIES and eithcr both the words NEW and MEXICO or the word ARIZONA. Again, pages besides those of interest will he listed. Finally. to find Web pages that deal with universities in Mexico (and not New Mexico), we might first look for pages matching MEXICOAND UNIVEKSITIES, hut since the results of this search will include pages ahout universities in New Mexico, as well as universities in Mexico, it might he hettcr to search for pages matching (MEXICO AND UNIVERSITIES) NOT NEW. The results of this search include pages that contain hoth the words MEXlCO and UNIVERSITIES hut d o not contain the word NEW. 4 LOGIC PUZZLES Links EXAMPLE 15 Extra Puzzles that can he solved using logical reasoning arc known as logicpuzzles. Solving logic puzzles is an excellent way to practice working with the rules of logic. Also. computer programs designed to carry out logical reasoning often use well-known logic puzzles to illustratc their capabilities. Many pcople enjoy solving logic puzzles, which arc published in hooks and periodicals as a recreational activity. We will discuss two logic puzzles here. We hegin with a puzzle that was originally posed hy Raymond Smullyan, a master of logic puzzles. who has published more than a dozen hooks containing challenging puzzles that involve logical reasoning. In [Sm7X] Smullyan posed many puzzles about an island that has two kinds of inhahitants, knights, who always tell the truth, and their opposites, knaves, who always lic. You encounter two people A and B. What are A and B if A says " B is a knight" and B says "The two of us are opposite types"? 1.1Logic 13 1-13 Solution: Let p and q be the statements that A is a knight and B is a knight, respectively, so that - p and -q are the statements that A is a knave and that B is a knavc,respectively. We first consider the possibility that A is a knight: this is the statement that p is true. If A is a knight, then he is telling the truth when he says that B is a knight, so that q is true, and A and B are the same type. However, if B is a knight, then B's statement that A and B arc of opposite types, the statement ( p A - q ) v ( - p A q ) , would have to be true, which it is not, because A and B are both knights. Consequently, we can conclude that A is not a knight, that is, that p is false. If A is a knave, then because everything a knave says is false, A's statement that B is a knight, that is, that q is true, is a lie, which means that q is false and B is also a knave. Furthermore,if B is a knave, then B's statement that A and B are opposite types is a lie, which is consistent with both A and B being knaves. We can conclude that both A and B are knaves. 4 11th rch ~de ten est. ues, ,ing ook this NI1 as tics CO :cetain rord Ncb ook arch ,o, it JOT and 4 ogic uter :s to shed We pose more of Smullyan's puzzles about knights and knaves in Exercises 51-55 at the end of this section. Next, we pose a puzzle known as the muddy children puzzle for the case of two children. EXAMPLE 16 A father tells his two children, a boy and a girl, to play in their backyard without gclting dirty. However,while playing, both childrenget mud on their foreheads. When thechildren slop playing, the father says "At least one of you has a muddy forehead," and then asks the children to answer "Ycs"or "No" Lo the qucstion:"Do you know whether you have a muddy forehead?"l%e father asks this question twice. What will the children answer each time this question is asked, assuming that a child can see whether his or her sibling has a muddy forehead, but cannot see his or her own forehead? Assume that both children are honest and that the children answer each question simultaneously. Solution: Let s be the statement that the son has a muddy forehead and let d be the statement that the daughter has a muddy forehead. When the father says that at least RAYMOND SMULLYAN (BORN1919) Raymond Smullyan dropped ont of high school. He wanted Li* to study what he was yeally interested in and not ~ l a n d a r dhigh school material. Aftcr jumping from one univrr.iity to [be ncxt, hc earned an undergraduate dcgrce in mathcmarics at the University of Chicago in 1955. He paid his college expcnscs by performing magic tricks at parties and clubs. He obtained a Ph.D. in logic in 1959 at Princeton, studying ondrr Alonro Church. After gradualing from Princeton, he taught mathematics and logic at Danmoulh College. Princeton University, Yeshiva University, and the City University of New York. Hc joined thc philosophy department at Indiana University in 1981 wheve hc is now an cmcntus professor. Smullyan has wvittrn many books on recreational logic and mathematics, including Snton, Canlor, and Infinity; Whot Is the Nome of r h i ~Book?; The L o d j or the Tiger?;Alice a: Pu::lelo,zd; To Mock a Mmkingbird; Forever Undecided; and The Riddle ofSchehero:ode:Amo:ini: Z,o~icPu::lri, Ancient and M o d p m . Because his logic puzzles are challenging, rnlertaining, and thoughl-provoking, he is considrrcd to be a modern-day Lewis Carroll. Smullyan has also written several books about thc application of deductive logic to chess, three collections of philosophical essays and aphorisms. and several advanced ~ iabiYou says ~ solve all mathrmalical problems. He is also particularly interested in explaining ideas from mathematical logic to the public. Smullyan is a talented musician and often plays piano with his wife. who ir a concerl-level pianist. Making telescopes is one of his hobbies. He is also interested in optics and stereo photography He states "I've never had a conflict brrwrrn teachine and research as some people do because when I'm teaching. I'm doing research." 14 11The Foundations:Logic and Proof, Sets, and Functions AND, and XOR. one of the two children has a muddy forehead he is stating that the disjunctions v d is true. Both children will answer "No" the first time the question is asked because each sees mud on the other child's forehead. That is, the son knows that d is true, but does not know whether s is true, and the daughter knows that s is true, hut does not know whether d is true. After the son has answered "No" to the first question, the daughter can determine that d must be true. This follows because when the first question is asked, the son knows that s V d is true, but cannot determine whether s is true. Using this information. the daughlcr canconclude that d must be true,for if 11 were false, the son could have reasoned that because s v d is true, then s must be true, and he would have answered "Yes" to the f i s t question. l%e son can reason in a similar way to determine that s must be true. It 7 follows that both childrcn answer "Yes" the second time the question is asked. LOGIC AND BIT OPERATIONS p p p p ~ Links DEFINITION 7 EXAMPLE 17 (zero) and 1 (one). R i s meaning of the word bit comes from binary digit, since zeros and ones are the digits used in binary representations of numbers.The well-known statistician JohnTukey introduced this terminology in 1946. A bit can be used to represent a truth value, since there are two truth values, namely, true and fabe.As is customarily done, we will use a 1 bit to represent true and a 0 bit to represent false. That is, 1 representsT(true), 0 represents F (false). A variable is called a Boolean variable if its value is either true o r false. Consequently. a Boolean variable can be represented using a bit. Computer bit operations correspond to the logical connectives. By replacing true by a o n e and false by azero in the truth tables for the operators A , v , a n d $. the tablesshown inTable 8 f o r the corresponding bit operations are obtained. We will also use the notation OR. AND, and XOR for the operators v, A , and $ , a s is done in various programming languages. Information is often represented using bit strings, which are sequences of zeros and ones. When this is done. operations on the bit strings can be used to manipulate this information. A birstringis a sequence of zero or more bitsThe length of this string is the number of bits in the string. 101010011 is a hit string of length nine. 7 We can extend bit operations t o bit strings. We define the bitwise OR, bitwise AND, and bitwise XOR of two strings of the same length to be the strings that have as their hits t h e OR, AND, a n d X O R of t h e corresponding bits i n t h e t w o strings, respectively. We use t h e symbols v, A, a n d @ t o represent t h e bitwise OR, bitwise AND, a n d bitwise XOR operations,respectively. We illustrate bitu.ise o p e r a t i o n s o n bit strings with E x a m p l e 18. EXAMPLE 18 Find t h e bitwise OR, bitwise AND, a n d bitwise .YOR of t h e bit strings 01 1011 0110 a n d 11 0001 1101. ( H e r e , a n d throughout this b o o k , bit strings will b e split i n t o blocks o f f o u r bits t o m a k e t h e m e a s i e r t o read.) Solution: T h e bitwise OR, bitwise AND. a n d bitwise XOR of t h e s e strings are o b t a i n e d b y t a k i n g t h e OR, AND, a n d XOR of t h e corresponding bits, respectively. T h i s gives u s 11 1011 1111 httwt\e O R 01 0001 0100 h t t w t ~ eAND 10 1010 1011 hitwise XOR 4 Exercises I. Which of these sentences are propositions?Whal a r e 1, 0 ~nd ian dth we values of those that a r e propositions? a) Boston is the capital of Massachusetts. a) c) d) e) D o not pass go. b) W h a t time is it? There a r e n o black flies in Maine. 4+x=5. x+l=5ifx=l. O x+?=y+sifx=r. b) Miami is the capital of Florida. c) ? + 3 = 5 . d) 5 + 7 = 10. e) x + 2 = 1 1 . + g) x y = y a n d y. he). : or by wn ion ing ~ n d this VD, bits 2. Which of these a r e propositions'? What a r e the truth the truth values of those that a r e propositions? I.inks 0 Answer this question. + x for every pair of real numbers .t JOHN WILDERTUKEY (1915-2000) Tukey,horninNew Bedford,Massachusetts, was a n only child. His FX'entS. both teachers,decided home schooling would hest develop his potential. His formal education began at Brown University, where he studied mathematics and chemistry He received a master's degree in chemistry frum Brown and continued his studies at Prineeron l!niversity. rhaneine his field of study from chemistry to mathematics. He received his Ph.D. from Princeton in 1939 for work in topology, when h? was appointed an instructor in mathemalies at Princeton. With the start of World War 11, he joined the Fire Control Research Office, where he began working in statistics n L c y found statistical research to his liking and impressed several leading statisticians with his skills. I n 1945. at the conelusion of the war,'TUkey returned to the mathematies department at Princelon as a professor of statistics, and he also took a position at AT&T Bell Laboratories Thkey founded the Statistics Depa~tmentat Princeton in 1966 and was its first chairman. Thkey made significant contvihutians ta many areas of statisties,including the analysis of variance. the estimation of spectra of time s?ri?s. inf?r?nc?s about the values of a set of parameters from a single experiment. and the philosophy of statistics. Hawcvcr. he is hest known for his invention, with 1. W. Coolry. nl the fast Fourier transform. Thkey contributed his insight and expertise hy serving on the President's Science Advisory Committee. He chaired several imporIan1 committees dealing with the environment, education. and chemicals and health. He also served on committees working on nucleardisarmament.Tukey received many awards, includingihe Nalional Medal of Science. HISTORICAL NOTE Thsrc were several other suggested words for a binary digit, including binif and bigir, that never were widely accepted. The adoption of the word bit may he due to its meaning as a common Enslish word. For an account of Tukey's coining of the word bit, see the April 19U4 issue of Annols qf the Hirrory ufCott!prrrittx. 'eai~? aql u!uaae uaaq rou ahaq sraaq <[zzu5'j!X[uo put! J! ale"! Zu!y!q 'l!eil aql a u u l ~ad!., ale sa!usq JI (J -[!ell aql B u o l ~ a d are ! ~ sa!lJJq lnq'ajeq s! [!r?il aqluoBu!y!q pua Bale oqi U! uaas uaaq I O U aAMq u u a q ilzz!~t) (q 'eaie a q u! ~ uaas uaaq IOU x e q sreaq dlzzp2 mq '[!en aql 8uole ad!] ale sa!riag (I: 'sa~yoauuos Yu!m suo!~!sodo~d asaql aJ!IA\ [r3!301 P U G 1 pue'b'd -vale aql .[!ell i q Xuolu ~ ~ d ! ,x u sa!Irag : 1 '[!ell aql uo ajess! Z u ! y ! ~: b uaas uaaq anaq smaq .([zz!19 : d suo!l!audurd .ql aq P u E ' b ' d l a l 'I1 U! -[null ~ q uo l v ue la8 n d l o yooq s!q~u! as!xoxa .Osna op ~aqr!o n o I! dluo pue J I ssels s!q~ u! r ue la8 [TIMn o h 'sse[o s1q1 u! v ue Su!iiaO 101 1~3!ogjnss! yooq s!ql u! asroiaxa Daha Bu~oppue p u g aql uo v u e du!~r?t) (a 'SSFJJ S!ql U! v ue la2 n o i 'ssalaqliaAau :yooq s!ql u! as!xaxo Xlsna op i,uop n o i inq .[vuy aql uo Q UP taS noh (p '1et1!1 aqi uo Q ue la4 01 nod 103 i~essasau st i!''sqo s!ql u! v U B taX o~ (J .sse[o s!ql u! v ue la%nod pue 'qooq srql u! aslsiaxs d ~ a n aop nok '[eug 141 uo v ue 15%n o h (q 'yooq s!q) u! as!o~ara disna op )ou op no.<inq'sselo s!ql u! v uu ra4 n o h (e 'san!~sauuo~ le3!Bol pue 1 puc'h.il ;lu!sn suo~r!rodo~d ~sarll~ I U M u .SSAP s!ql U! v UP la%n0.q : 1 yooq stql u! asplans .ii?na op no,^ : h mexa leuy aqi uo ue la8 l l u h d suop!sodold aql aq .I pue.6 'dla7 '01 '.f m n g lad ~a[!rus9 raho l u l -n!lp a ~ noi'laqs!l c Ou!paads e 128no.< ranauaqM (8 .lnoq rad sapm sg l a m a.\!.rp rou op n o . lnq 'laq,!l 8tr!pl"d? e la: no,r. (J ' ~ a y o !Xu!paads ~ e 4u!1134 lo) lua!~yjnss! inoq lad ra[!cu ~y l a m Bu!n!ra (a .18q3!1 %u!p~3dsP la3 iou ll!n nod uaql 'inoq i s d sal!m g9 iano a h ~ r plou o p noi $1 (p .Inoq lad sq!m 59 lano ah!rp n o i 1193!1 Xu!p~adsr? 128 l[!n n n h ( J .lays!] Bu!paads e 134 lou op nod Inqa.lnoqlad s a l p ~9 lano anpp n o h (q xnoq lad s a p ~g rono an!lp IOU op no,r. (n 'Sllrl!l3.7UUOJ [e3!Xol pue h pue d Xu!sn suo!r!sodoid asaql al!lM laya!l3u!paads e la4 n o h : h ~ n o lad q sq!m 59 ra,\o an!lp noh : d suo!l!sodo~d arll ail hpue il 127 '6 ( 1 v h ~ A )(h v d) (J (1- t h) A (_I- c 0) (a . r n h / i d (p i L c h (1 1 ++ 6- (q bed (c ooual -uas q y X u ~uu SE suo!l!sodord asaqj 30 qnco ssaldxz .asmoo ~ q ssed l noh : 1 .uo~]eu!mcxap u g aql ss!u no* : b 'ny aql aAeq noh : d suo!l!sodord sqi aq .I pue '6 'd 1 1 1 .s -%u!mousaq or 1~10, lua!oyjns pue dressooau s!Zu!zaaljmo[aq s! L! leqL (8 'Zu!zaal~nofaq s! 1!3! Bu~mousIOU s! i!rnq .8u!mous s! I! 10 Bu!zaoq m o l q laql!a y 11 (1 .~u!mousoslc s! 1!'8u!zaaq molaq s! I! 11 (a . ( q ~ o lo) q Xu!zaaq molaq l o Xu!mous 1aq11a SI 11 (p .au!mous LOU s! I! PUE Su!zaaij mopq IOU s! 11 (3 -a‘u!mous lou inq Bulzaaq nolaq $1 11 (q .Bu!mous pue Bulzaag molaq s! 11 (e 'sa~~roauuua [es!;lo{ pue h PUP d Xu!sn S U O J I ! S O ~ O J ~n s q l .Smmous s! 11 : h .Zu!zaaq molsq s! 11 : d suu!~!a,dold aqi sq h pue d 1 2 1 .L (6vd-)~b-(q b e d @ .aoualuas qs!lBug uu se suo!l!sodord punodum asaql30 qoea ssaldxg 'Lla~!l -2ndsa.r ..'pa1uno3 uaaq aneq salon a ~ ,pun , ..papp -ap s! uo!loa[a a u . . suo!i!sodoid aqi 5q h pue d l a 7 .g b- e (1 (2 hi + d (p h- t (1I- (1 (h- A d ) "'1il c h- (q (a .asualuas qs~la'uz~ uesc suo!l!sodoid punodcuos asaql 30 qoea ssarrlxa 7lan!l,mdsal ,:a~oqa uql laau psrlods u a ~ qaneq syieqs,, pus ,,pamo[le s! aroqs iasiarmaN aq) %u!uwlm~,.suo!~!sodo~Jaql oq h pue d l a 1 'S (h v d ) A il- (q h-d(a b- v d- (8 bvd(p 'aouai -uas qs![a'ug ut. se suo!l!sodord asaql3o qsra s s a ~ d x x :iep!12 uo ~odyse!re[[op uo!gl!tu aql uom 1 : b 'qaam s!ql layo!] drailol e lqznoq 1 : d suo!i!rndold aqi aq b pue d l a 1 .b iuuns pue loq s! au!eW u! lamtuns a u (p ' C = I + Z (J i a s r a ~ma^ u! uo!lnllod ou s! a r q (q ; ( n p s ~ n s! u d e p o ~(e j.suo~i!sodoid asaql jo qoea 30 uo!loBau aql s! r u q ~ '$ sua!q~und pue 91 I 'was > a o ~ dpue ~ @ o ?:sua!lepuno~a q L { 1 91 1.1Exercises 17 d) It is not safe to hike on the trail. hut grizzly bears logical I do not i over 65 ur. then + ient for ot drive nr . 1111 -. -... + d logical do every exercisc bL Jr you to do every gel an A (exercise A in this 11y if you r you get zzly bears e area and ripe along + d) 1 1 = 3 if and only if pigs can Ry. e) 0 > I if and only if 2 > 1. are driv- n d logical have not bccn seen in the area and the berries along the trail are ripe. e) For hiking on the trail to be safe. ~t is necessary but not sufficientthat ber~iesnotbe ripe alongthc trail and for grizzly bears not to havc been seen in the area. C) Hiking is not safe on the trail whenever grizzly bears have been sccn in the area and berries are ripe along the trail. 12. Determine whethcr these biconditionals arc true or falsc. a) 2 2 = 4 if and only if 1 I = 2. b) 1 + 1 = 2 if and only i f 2 + 3 = 4. c) It is winter if and only if it is not spring. summer. I rn 13. Determine whether each of these implications is true or false. a) If 1 + 1 = 2. thcn ? + 2 = 5 . b) If I + 1 = 3, then 2 + 2 = 4. c) If I + 1 = 3. then 2 + 2 = 5. d) I l pigs can fly, then I + 1 = 3. e) If I + I = 3, then God exists. CI Ii I + I = 3, then pigs can fly. p) If I + I = 2, then pigs can fly. b) 1 1 2 + 2 = 4 , t h e n l + 2 = 3 . 14. For each of rhese sentences. determine whether an inclusive or an exclusive or is intended. Explain your answer. a) Expclience with C++ or Java is lequired. b) Lunch includes snup or salad. c) To entcr the country you nccd a passport or a voter registration card. d) Publish or perish. 15. For each of thcse sentences, state what the sentence meansiftheorisaninclusivcor (that is,adisjunction) versus an exclusive or. Which of these meanings of or do you think is intended? a) To take discrete mathematics, you must have taken calculus or a course in computcr science. b) When you buy a newcar l m m Acme Motor Company,you get $2000 back in cash or a 2 % car loan. c) Dinner for two includes two items from column A or three itcms h u m column B. d) School is closed if more than 2 feet of snow falls or if the wind chill is below 1 0 0 . 16. Write each of these statementsin the formuif p , then q"in English. (Hint: Refertothelist olcommon ways to express implications provided in this section.) a) It is necessary to wash the boss's car to get promoted. b) Winds from the south imply a spring thaw. c) A sufficient condition for the warranty t o be good is that you bought the computer less than a year ago. d) Willy gets caught whenever he cheats. c) You can access the website only if you pay a subscription fee. f) Gect~ngelected follows from knowing the right people. g) Carol gets seasick whencver she is on a boat. 17. Write each o i these statements in the form "if p, then q" in English. (Hint: Refer to the list of common ways to express implications provided in this section.) a) It snows whenever the wind blows fiomthe northeast. b) The apple trees will bloom if i t stays warm for a week. c) That the Pistons win the championship implies that they beat the Lakers. d) It is necessary to walk 8 miles to get to the top of Long's Peak. c) To get tenure as a professox, it is sufficient to be world-famous. f) l i you drive more than 400 miles,you will need lo buy gasoline. g) Your guarantee is good only if you bought your C D player less than YO days ago. 18. Write each of these statements in the f o r n ~"if p. thcn q" in English. (Hint: Rcfer t o the list of common ways t o cxprrss implications provided in this . ~ section.) a) I will remcmber lo send you the address only if you send me an e-mail mcssage. b) To be a cilizcn oi this country, it is sufficient that you were born in the Unitcd Slates. c) If you kccp your textbook, it will bc a useful ref- ercnce in your future coulses. d) The Red Wings will win the Stanley Cup if their goalie plays well. e) That you get the job implies that you had the best credentials. f) The bcach erodes whenever lhero is a storm. g) I1 is necessary to have a valid password to log on to the server. 19. Write each of these propositions in the form"p if and onlv, if o"in . English. a) If it is hot o u t d c you buy an ice cream cone, and if you buy an ice cream cone it is hot outside. b) For you to win the contest it is necessary and sulficient that you have the only winning ticket. c) You get plomoted only if you have connections. and vou , have conneclions onlv if vou eet nromoted. d) If you walch television your mind will decay, and conversely e) The trains run late on exactly those days when I take it. 18 1 /The Foundations: Logic and P~.oaf,Sets, and Functions 20. Writeeach of these propositionsin the fonn"p ifand only if q"in English. a) For you to get an A in this course, it is nccassary and suffic~entthat you learn how to solve discrete mathematics problems. b) If you read the newspaper every day, you will be informed, and conversely c) It rains if it is a weekcnd day, and it is a weekend d a). ~f' lt. rains d ) Youcan rce the wizard only ifthc wizardis not in. and the wizard is not in only if you can see him. 21. State thc converse, contrapositive, and inverse of each of these implications. a) If it snows today, i will ski tomorrow. b) 1 w m e t o class whenrver there is going to be a c) A positive integer is a prime only if it has no divisors other than I and ~tself. 22. Stale the converse, contraposilive. and inversc of cach of these implications. h) -p ++ q a ) p + -q C) ( P + Y ) V ( - P + Y ) d) l p -t 9 ) A (-11 + 4 ) e) ( P h V ) v I-P 4) f I-p * -q) ( p ci q! 28. Construct a truth table for each of these compound propositions. a) ( p v q i ' i r b) I p V q j ~ r d) ( / > A 4 l f i . r c ) (11 A 4 ) V r e) ( p v q) A -r f) ( p I\ q ) v 29. Construct a truth tahle for each of those compound propositions. -- -, a) b) r) d) e) f) - (-q 'V r ) (q + r i ( P + q ) '1 C-P + (p q) A (-p + r ) ( p h 4 ) Y (-4 rj I-p rr -4) ti (q e r j P + -p - Construct truth for ((,, q) r, s, 31. Construct a truth table for ( p t~ q) -+ (rrj. 32. What is the value ofx after cachof these statement- is encountered in a compuler program, if r = I before thc statement is reached? + + + f- a ) If it snows tonight, then I will stay at home. b) I go to the beach whenever it is a sunny summer c) Whrn 1 stay up latc, it is necessary that I sleep until noon. 23. Construct a truth table for each of these compound propositions. a) IJA-P b) 11 v -P C) ( P V - Y ) + Y d)(~~q)+(p,.,q) e) 01 q ) + (-Y + -PI f (P Y) + (Y + P) 24. Construct a truth table for cach of these compound ~- a) i f 1 + 2 = ? t h e n x : = r + I h) i f ( l + I = 3 ) O R ( 2 + 2 = 3 ) t h e n x : = x + I c) i f ( ? + 3 = 5 ) A N D ( 3 + 4 = 7 ) I h e n x : = r + l d) i f ( l t l = 2 ) X O R ( I + 2 = 3 ) t h e n r : = , r + I e) if .r c ? then x := r + I 33. Find the bltwise OR, bitwisc AND, and hitwise .YOK of each of these pairs of hit strings. a) h) c) d) 101 1110. 0100001 1 1 1 1 0000. I010 1010 000lllO001. 1001001000 l l I l l l 1111, 0000000000 P@(PVY) d) t ~ l ~ q i + ~ p v q ) (q + -PI (P e Y ) f) ( P + Y ) @ ( P ~ - ~ ) 25. Construct a truth tahle for each of these compound 34. Evaluate each of these rxprcssionc. a ) 1 1 0 0 0 ~(0 1011 '1 11011) b) 101111 A 10101)V01000 c) (01010eE 1 1 0 1 l ) e o l 0 n 0 d) ( 1 1011 V01010) A ( 1 0001 V 1 1011) IP @ q) b) ( P ~ ~ ) + ( P A Y ) c) ( P V Y ) ~ ( P A Y ) d) l p * 4) iP (-11 ++ q ) e) (11 e q) e~ ( - I J -A -1.1 f) ( i ~ q j +~ P @ - Y ) 26. Constrnct n truth table for each of these compound Fuzzy logic is used in artificial iu~rlligmce.In fuzzy logic, a proposition has a truth value that is a number hetween (1 and 1,inclusive. A proposition with a truth value of 0 is false and one with a truth value nf 1 is true. Truth valucs that are hrrwecn O and I indicate varying degrees of truth. For instance, thc truth value 0.8 can be assigned to the statement "Frcd is happy." sincc Fred is happy most of the time,and the truth value 0.4 can he assigned lo the statement "John is happy," since John is happy slightly less than half the time. C) C) a ) (P v q) 0 ++ A l P @ q ) A (P~B-CI! 27. Construct a truth table for each of thrse compound 35. The truth valuc of the negalion of a proposition in fuzzy logic is I minus the truth value of the proposition. What are the truth values of the statements "Fred is not happy" and ".lohn is not happy"? 1.1 Exercises 19 1-19 36. The truth value ofthc conjunction oftwopropositions in fuzzy logic is the minimum of the truth values of the twopropositions. What arc thc truth values ol the slatements "Fred and John are happy" and "Neither Frcd nor John is happy"? 37. The truth value of the disjunction of two propositions in fuzzy logic is the maximum of the truth values of the two propositions. What are the truth values of the statcmcnts "Frcd is happy. or John is happy" and "Fred is not happy, or John is not happy"? *38. Is the assertion "This statcment is false" a proposition? "39. The nth statcmcnt in a list o f 100 statements is "Exactly n of the statements in this list are false." a) What conclusions can you draw from these statements? b) Answer part (a) if thc nth statcment is"A1 least ,I the statements in this list are false." C ) Answer part (b) assuming that the list contains 99 statcmcnts. 40. An ancienl Sicilian legend says that the barher in a remote town who can bc rcachcd only by traveling a dangerous mountain road shaves those people, and only those peoplc, w h o d o not shave themselves. Can there be such a barber? 41. Each inhabitant of a remotc village always tells the truth or always lies. A villager will only givc a "Ycs"or a"No" response to a question a tourist asks. Suppose you are a tourist visiting this arca and come to a fork in the road. O n e branch leads to the ruins you want to visit;thcothcr branch leads deep inlothe jung1e.A villager is standing at the fork in the road. What onc question can you ask the villager lo determine which branch to take'? 42. An explorer iscaptured by a groupofcannihals.There are two types of cannibals-those whoalways tell the truth and those who always 1ie.Thecannibals will barbecue thc cxplorcr unless he can delermine whether a particular cannibal always lies or always tells the truth. He is allowcd to ask the cannibal exactly one question. a) Explain why thc qucstion "Are you a liar?" does not work. b) Find a question that the cxplorcrcan use todetermine whether the cannibal always lies o r always tells the truth. 43. Express these sysLem specifications using the propositions p "The message is scanncd for viruses" and q '.The rnessafe was scnt from an unknown system" tosether with lofical connectives. a) "The niessase is scanned for viruses whenever the messafe was sent from an unknown system." b) "The message was scnt from an unknown system but it was not scanned for viruses." c) "It is necessary to scan the messaze for viruses whenever it was scnt from an unknown system." d) "When a message is not sent from a n unknown system i t is not scanncd for viruses." 44. Exprrss these system specifications using the propositions pUThcuscr cntcrs a validpassword,"q "Access is granted," and r "The user has paid the subscription fee" and logical conncctivcs. a) *'The user has paid the subscription fee, but does not cntcr a valid password." b) "Access is granted whenever lhe user has paid the subscription fee and enters a valid password." c) "Access is denied if the uscr has not paid the subscription fee." d) "If the user has not entered a valid password but has paid the subscription fee, then access is granted." 45. Arc these syslem specifications consistent? "The system is in multiuser state if and only if it is operating normally. If the system is operating normally,the kernel is functioning.The kernel is not functioning or the systemisin interrupt modeifthesystemisnotinmultiuser state, then it is in intcrrupt mode. The syslem is not in interrupt mode." 46. Arc these system specifications consistent? "Whenever the systcm softwarc is being upgraded,userscannot access the f l e system. If users can access the file system, then ihey can save new files. If users cannot save new files. then the system softwarc is not hcing upgraded." 47. Are these system specifications consistent? "The router can send packets to thc cdgc systcm only if it supports the new address space. For the router to support the new addrcss spacc it is necosary that the latest software release be installed. The router can send packets to thc cdge system il thc latest software relrase is installed.The router does not support the new addrcss space." 48. Are these systcm specifications consislent'? "If the tile system is not locked, then new messagcs will be queued. If the file system is not locked, then the system is functioning normally, and conversely. If new messages are not queued, then they will be sent lo the message huffer. If the filc systcnl is not locked, then new messages will be sent to the message buffer. New messages will not h e sent t o the message buffer.'' 49. What Boolean search would you use t o look for Web pages ahout beaches in New Jersey? What if you wanted to find Wcb pages about beaches on the isle of Jersey (in the English Channel)'? 50. What Boolean search would you use t o look for Web pages about hiking in West Virginia? What if you wanted to find Web pages about hiking in Virginia. hut not in Wcst Virginia? 20 1 /The Foundations: Logic and Proof, Sets, and Functions Exercises 51-55 relate to inhahitants of the island of knights and knaves created by Smullyan, where knights always tell the truth and knaves always lie.You encounter two people,^ and B.Determine.ilpossible.what A and B are il they address you in the ways described. If you cannot determine what these two people are, can you draw any conclusions'? 51. A says " A t least one o l us is a knave" and B says 52. A says "The two of us are both knights" and B says " A is a knave." 53. A says "I am a knave or B is a knight" and B says 54. Both A and B sayhI am a knight." 55. A says "We are both knaues" and B says nothinp. Exercises 86-61 are puzzles that can he solved by translating statements into k~gicalexpressions and reasoning from these expressions using truth tables. 56. The police have three suspects lor the murdcr of Mr. Cooper: Mr. Smith, Mr. Jones. and Mr. Williams. Smith.bnes,and Williams each declare that they did not kill Cooper. Smith also statcs that Cooper was a friend of Jones and that H'illiams dislikcd him. .Jones also that he did know Cooper and l h a t he was out of town the day Cooper was killed. Williams also states that he saw hoth Smith and Joues with Cooper the day of the killing and that either Smith or b n e s must have killed him. Can you determine who the murderer was if a) one of the three men is guilty, thc two innocent men ale telling the truth, but the statements of thc guilty man may or may not he true? b) innocent men do not lic'? 57. Stcve would like to determine the relative salaries of three coworkers using two facts. First, he knows that ifFredisnot the highest paidof thc three, then Janice is. Second, he knows that if Jauice is not the lowest paid, then Maggie is paid the most. Is i t possihle to determine thc relative salaries of Fred. Maggie. and Janice from what Steve knows? If so. who is paid the most and who the least? Explain your reasoning. 58. Five friends have access to a chat room. Is it possible to determine who is chatting if the following information is k m ~ w n ?Either Kcvin or Heather, o r both, are chatting. Either Randy ox Vijay, but not both. arc chatting. li Abby is chatting, so is Randy 1-20 Vijayand Kevin are either both chattingor neither is. If Heather is chatting, then so are Abby and Kevin. Explain your reasoning. 59. detective hasinterviewed fourwitnessestoacrime. From the stories of the witursses the detective has concluded that if the butler is telling the truth thenso is the cook:thecookand thegardener cannot both be telling the tiuth; the gardener and the handyman are nothoth1ying:andif the handymanis tellingthe truth then thc cook is lying. For each of the four witnesses, can the detective determine whether that person is telling the truth or lying? Explain your reasoning. 60. Four friends have been identified as suspects for an unauthorized access into a computer systcm. They have made statements t o the investigating authoritics. Alicc said "Carlos did it." John said "I did not d o it." Carlos said "Diana did it."Diana said "Carlos lied when he said that I did it." a) If the authorities also know that exactly one of the fuur suspzcts is telling thc truth. who d ~ it? d Explain your reasoning. b) If the authorities also know lhat exactly one is lying, who did it'? Explain your reasoning. *61. Solve this famous logic puzzlc, attributed to Albert Einstein, aud known as the zebra puzzle. Five mcn with different nationalities and with diflerent jobs live in consecutive houses on a strret. Thcse houses are painted different colors. Thc men have different pets and have different favoritc drinks. Determine who owns a zebra and whosc favorite drink is minera1 water (which is one of the favorite drinks) given these clues: The Englishman lives in the red house. The Spaniard owns a dog. The Japanese man is a painter.'rhe Italian drinks tea. The Norwegian lives iu the first house on the iclt. Thc preen house is on the right of the whitc one. The photographer hreeds snails.The diplomat lives in the yellow house. Milk is drunk in the middle house. The owncr of thc green house drinks coffreThe Norwegian's house is next l o the hlue onc.Theviolinist drinks orangejuice.The fox is in a house next to that of the physician.The horse is in a house next to that of the diplomat. (Hinr: Make a table where the rows represent the men and columns represent the color ol their houses, their jobs, their pets, and their favorite drinks and nse logical reasoning to determine thc correct entries in the table.) 6. Propositional Equivalences - - INTRODUCTION A n important typc of step used in a mathematical argument is the replacement of a statement with another statement with the same truth value. Because o f this, mcthods 1.2 Propositional Equivalences 21 that produce propo5itions with the same truth value as a given compound proposition are uscd extensively in the construction of mathematical argumcnts. We begin our discussion with a classification of compound propositions according to their possiblc truth values. DEFINITION 1 A compound proposition that is always true,no matter what the truth values of the propositions that occur in it, is called a tautology. A compound proposition that is always falseis called a contradiction. Finally,a proposition that is neither a tautology nor a contradiction is called a contingency. Tautologics and contradictions are often important in mathematical reasoning. The following example illustrates these types of propositions. EXAMPLE 1 We can construct examplcs of tautologies and contradictions using just one proposition. Consider the truth lablcs of p v - p and p A - p , shown in Table 1. S ~ n r ep v - p is always true. it is a tautology. Since p A - p is always false, it is a contradiction. 4 LOGICAL EQUIVALENCES :rt cn bs :cs :nt ne Demo DEFINITION 2 in^ en se. ;a /es on :ds <is :en t to lox e is .e a nns leir on- Compound propositions that have the same truth values in all possible cases arc called logically equivalent. We can also delinc this notion as follows. The propositions p and q are called logically equivalent if p tt q is a tautology. The notation p q denotes that p and q are logically equ~valent. -- = is not a logical connective since p = q is not a compound proposition, but rather is the statement that p * y is a tautology. The symbol + is sometimes uscd instead of = to denote logical equivalmce. Remark: The symbol Extra Ex-pLe~ One way to determine whether two propositionare equivalent is to use a truth table. In particular, thc propositions p and q are equivalent if and only if the columns giving their truth values agree. The following example illustrates this method. EXAMPLE 2 Show that - ( p v q ) and - p A -9 are log~callyequivalent. 7his equivalence is one of De Morgan? Inns for propositions, named after the English mathcmatician Augustus De Morgan, of the mid-nineteenth century. TABLE 1 Examples of a Tautology and a Contradiction. ~f a ods 22 1 /The Foundations: Logic and Proof, Sets, and Functions 1-22 TABLE 2 TruthTables tbr - ( p v q ) and - p A -q. Solurion: The truth tables to, these propositions are displayed inTahle 2. Since the truth values of the propusitions - ( p V q ) and - p r, -q agree for all possible con~blnationsof the truth values of p and q ,it lollows that - ( p v y) u j-p A 7 q ) is a taulology and that these propositions are logically equivalent. 4 EXAMPLE 3 Show that the propositions p - q and - p v q are logically equivalent. Solurion: Wc construct thc truth table for these propositions in Table 3. Since the truth 4 values of - p v q and p i q agree, these propositions are logically equivalent. EXAMPLE 4 Show that the propositions p V (q A r ) and ( p V q ) A ( p v This is the distributive law of disjunction over conjunction. r) arc logically cquivalent. Solrrtion: We construct the lrurh table lor these propositions inTahle 4. Since the truth values of p V ( q A r ) and ( p V q ) A ( p v r ) agree. these propositions are logically equivalent. 4 Remark: A truth table of a compound proposition involving three different propositions requires eight rows, one for each possible combination of truth values of the three propositions. In general, 2" rows are required if a compound proposition involves n propositions. Table 5 contains some important equivalences * In these equivalences.T denotes any proposition that is always Lrue and F denotes any proposition that is always false. We also display some useful equivalences for compound propositions involving impl~cationsand biconditionalsinTables6 and7,respectively.The reader isasked to verify the equivalences in Tables >7 in the exercises at the end of the section. "these idcnrities are a special case of identities that hold for any Boolean algebra. Compare them with sct idcntities inTable 1 in Sprtinn 1 7 and ~ i t h B o o l r a nidrnlitiesinTable5 in Section 10.1. 1.2 Propositional Equivalences 23 TABLE 4 A DemonstrationThat p v ( q Equivalent. P T T T T F F F F T F T F T q A r I p v ( ~ A r ) I pvq A (p I v r ) Are Logically pvr I ( p v q ) ~ ( p v r ) F T F V pl V . . . V p,,) = (-pl A - p 2 A . . . A -p,) and (Methods for proving these identities will be given in Section 3.3.) truth lcalll; 4 :m with T T F F T T F F -(PI ruth 4 ss any 'e also 1s and lences r and ( p v q ) The associative law tor disjunctionshows that the erpression p v q v r is well defined, in the sense that it does not matter whether we first take the disjunction of p and q and then the disjunction of p V q with r , o r if we first take the disjunction of q and r and then take the disjunclion of p and q v r . Similarly, the expression p A q A r is well defined. By extending this reasoning,it follows that pl v p 2 v . . . v p, and pl r . p2 A . . . A p, are well defined whenever pl, p 2 . . . . , p,, are propositions. Furthermore, note that D e Morgan's laws extend to ulh s of and 4 Iposlthree ves 11 I 9 A r) Links A U G U S T U S DE M O R G A N (18061871) Augustus Dr Morgan was born in India, where his fathsr was a colonel in the Indian army Dr Morgan's family moved to England when he was 7 months old. He attended private schools, where he developed a strong interest in mathematics in his early teens. D e Morgan studied at Triniry College, Cambridge, graduating in 1827. Although he considered entering medicine or law, he decided on a career in mathzmatics. He won a position at University College,London, in 1828. hut resigned when the collrgr dismissed a fellow professor without giving reasons. However, he resumed this position in 1836 wheu his successor died, staying there until 1866. De Morgan was a noted teacher who stressed principles over techniques. His students included many famous mathematicians, ineluding Ada Augusta.Countess of Lovelace, who was Charles Babhage's collaborator in his work on computing machines (see paps 25 far biographical notes on Ada Augusta). (De Morgan caurioned the cauntcss against studying too much mathematies, sinee it might i n t e ~ f e r with e her childbea~ingabilities!) Dr Morgan was a n rxrrrmrly prolific writer. He wrote more than LOW artieler for more than 1.5 periodicals. D e Morgan also wrarr rrxthooks on many subjects, including logic, probability, ealeulus, and algebra.1" 1838 he presented whal was perhaps the firstclea~erplanationof a n imporlant pmof technique known as mnthernoricul inducriun (discuiscd in Section 3.3 of this text), a tevm he coined. In the 1840s Dr Morgan made fundamental contributions lo the dcvelopmrnt ofsymbolic logic. He inventrdnotations chat helped him prove propositional equivalences, such as the laws that are named after him. In 1842 De Morpan presented what was perhaps the lirsl precirc definition of a limit and developed some tcsts for convergence ofinlinite series. D e Morpan was also interested in the history of mathematics and wrote biographies of Newron and Halley. In 1837 De Morgan married Sophia Frend, who wrore his biography in 1882. De Morgan's research, writing,and teaching lrftlitlle time for his family or social life. Nevertheless, hc was noted for his kindness, humor, and wide range of knowledge. 1.2 Propositional Equivalences 25 compound proposition. This technique is illustrated in Examples 5 and 6, where we also use the facl that i f p a n d q a r e logically equivalent a n d q a n d r a r e logically equivalent, t h e n p and r a r e logically equivalent (see Exercise 50). EXAMPLE 5 Show that - ( p V (-p A q ) ) and - p A -q a r e logically equivalent Solrrfion: W e could use a truth table t o show that thcse compound propositions a r e cquivalent. Instead, we will establish this equivalencc by developing a series of logical equivalcnces, using one of the equivalences in Table 5 a t a time, starting with - ( p V ( - p A q ) ) a n d cnding with - p A -q. W e have thc following equivalences. -p -(p V (-p A 4)) = -p -(-p A 4) A 1-(-p) V A -([I --pA(pV-q) = (-p A p) V (-p =Fv(-PA-q) = (-p A - 4 ) V F EE EXAMPLE 6 Consequently - ( p i/ Show that ( p A q ) i from the second D c Morgan's law from the first De Morgan'r lax, A -4) from thc double negation law from the second distributive law bincs - p A p = F from the commutative law for disjuncli<ln from the identity law for F - p A -y (-p A q ) ) a n d - p A -q a r e logically cquivalent. 4 ( p v q ) is a tautology Solrrfion: To show thal this statement is a tautology, we will use logical equivalences t o demonstrate thal iL is logically equivalent t o T. (Note:This could also bc done using a truth table.) (pA q) + ( p V q ) -- - ( p = (-p = (-p V 4)V ( pV q) -4) V ( p V q ) V p ) V (-4 A =TvT =T V '1) hy Example 3 by the first De hlorgan's law by the associative and commutative laws lor disjunction by Example 1 and the commulative law for disjunction by the domination law 4 A truth table can h e used t o determine whether a compound proposition is a tautology. This can bc done hy hand for aproposition with a s n ~ a l number l of variables,but when the number ol variables grows, this becomes impractical. For instance, there a r e 1"' 1,048,576 rows in the truth value tahlc for a proposition with 20 variables. Clearly. you nced a computer to help you determine, in this way, whether a compound proposition in - ADA AUGUSTA, COUNTESS OF LOVELACE (1815-1852) Ada Augusta was the only child from the marriage of the famous poct Lord Byron and Annabella Millbankc. who separated when Ada was 1 month old. She was raised by hcr mother. who encouraged her intrllrctual talcnts. She was taught by the mathematicians William Frend and Augustus Dc Morgan. In 1838 rhe married Lord King. later elevatcd to Earl t~1Luvelaee.To~~thrr they had thrcc childr?". Ada Augusl;l continued her mathmmticol studies after her marriage, assisting Charlss Babbage in his work on an early urmputingmaehinr.callcd the Analytic Engine.The most complete accounts of this machine are found in her writings. Attcr 1845 she and Babbagc worked toward the development of 3 system to predict horse races. Untortonalely, their system did not work well. leaving Ada heavily in debt at the time of her death.7he propramming language Ada is uamed in honor of the Countessol'Lovelace. 26 1 / T h e Foundations: Logic and Proof, Sets, and Functions 1-2fi 20 variables is a tautology. B u t w h e n t h e r c are IOOO variables, c a n e v e n a c o m p u t e r d c termine in a reasonable a m o u n t of time w h e t h e r a c o m p o u n d proposition is a tautology'! ( a n u m b e r with m o r e t h a n 300 decimal digits) possible Checking every o n e of the 2'"' combinations of truth values simply c a n n o t b e d o n e by a c o m p u t e r in e v e n trillions of years. F u r t h e r m o r e , n o o t h e r p r o c e d u r e s a r e k n o w n t h a t a c o m p u t e r c a n follow t o dctermine in a reasonable a m o u n t of t i m e w h e t h e r a c o m p o u n d proposition in such a large n u m b e r o l v a r i a b l c s is a tautology. We will study q u e s t i o n s such a s this in C h a p t e r 2, when we study the complexity of algorithms. Exercises 1. Use truth tahles t o verify thcsc equivalrnces. 2. 3. 4. 5. 6. 7. - a) ( P A q ) - Links lJ b) P+ ( ~ ~ 4 1 - - P 1 d) (P , q ) + ( p 4 q ) q + f ) - ( p -+ q ) -q 8. Show that t a c h of these implications is a Lautology by using truth tables. c P a ) p h T = p b ) 1, v E = 1, c) p r . F = F d) p v T s T e)p"/l=p 0 P"P-11 Show that -1-p) a n d p are logically equivalent. Use truth t:~hlest o verify the commutative laws a) p ' i q = q v p h) p ~ q ~ q r ~ U s e truth tahles to verify the associative laws a) ( p v y l v r = p ' v ( q v r ) h ) 11, A q ) A r /I 4 (q A r ) U s e o Lrnth tnhle t o verily the dislributivc law 1, A lq 'ir ) G ( p A q ) L ( p A I ) . Ube a truth table to verify t h e equivalence + p " q ) E - p V -q. Shnw that each of these implications is a tautology hy usinl: truth tahles. e 1 + + - - 9. 10. 11. 12. 13. a) [ - P A ( Pv q ) 1 + Y b ) l l p + q ) A (q 711 + ( P 4 r ! c) [ P A ( P 4)l + Y d ) [ ( P v q 1 A ( P + r ) A ( 4 + ')I + r Show that each implication in Exercise 7 is a tautology without usins truth tables. Show that each implication in Exercise 8 is a tautology wilhout using truth tahles. U s e truth tables t o verify t h e absorption l a w s s)pv(phq!=p b ) p ~ ( p v q ) = p Determine whether I - p A ( p + q ) ) + -q is a tau^ tology. Determine whether (-q . A ( p -+ y ) ) + -11 is a tau~ tology. HENRY MAURICE SHEFFER (1883-1961) Hcnry blauricc Shefler, hovn to Jcwirh parents in the western Ukraine. emigrated to the llnited Stales in I892 with his pancnts and six siblings. He studlcd at the Boston Latin School before cnlrriug Harvard. where hc crmpletcd his undergraduate degtee in IWS, his masrcc's in 1907.and his Ph.D in philosophy in 190X.Aftr~holding a posfdoctoval position at Harvard. Hcnvy travcled to Europe on a fellowship. Llpon returning lo the Unitcd States. hc brramr an academic nomad, spending one year cach at thc Univrrrilv of \Varhington. Cornell. thc University of Minnesota. the Uni\.ersit). of Missouri, and City Collcge in N e w Yolk. In 191b he rcturnrd lo Harverd as a faculty rncmbrr in the philosophy department. Hc remained at Harvard until his retirzment in 11J52. Sheffcr introduced what isnow known as the Shcffcr strokc in 1913:it bccamr acll knownonly after its use in the 1425 cdirlon of Whilrhcad and Russell's Principio h l i i l i ~ m o i i r oIn . this samc editinn Russell wrote that Sh?ffcr had invcnled a powcrful mcthod that could he used to simpl~fythe Principio. Because o l this w~mment.Shrlkr was something of a mvstery man to logicinns.espccially hecause Sheffcr. who publi~hedlittleinhiscareev,nrvcrpublishcd thedrtailsof thi\mcthr,d.ilnlydescrihingit in mimcooraphed notes and in a hricf published ahalract. Shcffcr was a dedicated teacher of mathematical lo@c.He liked his classcs to he small and did not like auditors. When strangers appeared in his classroom. Sheffer would order them to leave, even his collca~uesor dirtineuishcd wests vcritine Harunid. Shcffer was barely live fcet tall: hc was noted f t ~his r SheUer is also creditid with coining the term "Boolean algehl- the suhject of ~ h a p t c r10 of this trrt). Shcffer was hriefly married and lwed most ol his later life in small rooms at o hotel packed with his logic hooks and vasl liles of slips of paper he used to jot down his ideas. Unfortunalely,Shcffer suffered from sever? depression during the last twodeeades 01' his lif?. I 1.2 Exercises 27 degy? ible s of ,ter1rgc hen 14. Show that p cr y and ( p A q l \ (-p A -q) arc equivalent. 15. Show that ( p yl r and p (q r ) are not equivalent. 16. Show that p y and -q - p arc logically cqnivalent. 17. Show that - p y and 1, -q are logically equivalent. 18. Show that - ( p fE q) and 1, tr q are logically equivalent. 19. Show that - ( p tr y) and -11 tr i] are logically eqnivalent. 20. Show that (1, q) A ( p r ) and 1, + ( q A r ) are logically equivalent. 21. Show that ( p + r ) A ( q + i-) and ( p v y ) + r are logically equivalent. 22. Show that ( p + y) v ( p + r-) and p + (y v i-) arc loyically equivalent. 23. Show that ( p + r ) v (q + i-) and ( p A q ) + r are logically equivalent. 24. Show that -p (y r ) and q ( p v i-) are logically equivalent. 25. Show that p tt y and ( p + y) A (y + p) arc logically equivalent. 26. Show that p tr q and -1, tt -y are logically equivalent. 27. Show that - ( p tr y) and p tr -q arelogically equivalent. 28. Show that ( p v y) A ( - p v r ) + (q V r ) is a lantolOgY. 29. Show that ( p + y) A ( q + r ) + ( p + r ) is a tautology. The dual of a compound proposition that contains only thc logical operators v, A, and is the proposition obtained by replacing each v by A, each A by v, each T by F, and each F hy T . The dual of proposition s is denoted - - - - - - - - - -- - in the lied at 1905, (nard. 3 ,demic - L.. "y ... J 30. Find thc dual ol each 01 these propositions. 1<sota, i3cul ty y alter <ussell 31. 32. ecallse :r, who raphed **33. Aid not ven his far his lan<ly. neriti." IS text). (is layic :d from 34. 35. a) p A -(I A -r b) ( p A y A 1.1 r C) ( / l i i F ) A ( y \ , T I Show lhal (r'l' = s. Show that the logical cquivalcnces inTahle 5,except lor the double negation law. come in pairs, where each pair conlains propositions that are dualsof each other. Why are the duals 01 two cquivalent compr~und propositions also equivalent, where these compound proposilions contain only the operators A , ,/,and -? Find a compound proposition involving the prrlposi~ lions p. y. and r that is true when 1, and q are true and ,- is false, hut is false otherwise. (Hinr Use a c o n ~ junction oi each proposition or its ne~ation.) Find a compound proposition involving the propositions p. q.and r that is true wheneractly twoofp. q , and r are true and is false otherwise. (Hinr: Form a disjunction of conjunctions, Include a conjunction for each combination of values for which the proposilion is true. Each conjunction should include each of the three propositions or their negations.) 36, Suppose that a truth table in rr propositional variables is specified. Show that a compound proposition with this truth table can be formed by taking the disjunction of conjunctions of the variables or their negations, with one conjunction included for each comhination of values for which the compound proposition is true.The resultitig compound proposition is said lo he in disjunctive normal form. A collection 01 logical operators is called functionally complete if every compound proposition is logically eqnivalent Lo a componnd involving only these logical opcrators. 37. Show that - , A , and .i form a luncrionally complete collection of logical operiltorr. (Hinr: Use the fact that every proposition is logically equivalent to one in disjunctive normal form,as shown in Exercise 36.) *38, Show that and A form a functionally complete collection of logical operators. ( H i n t First use D e Morgan's law to show thar p 'iq is equivalent to -(-P A T1.J *39. Show that and .i form a functionally complete collection of logical opcrators. - - The following cxcrciscs involve the logical operators N A N D and N O R . The proposition p N A N D q is true when either I, or q,or hoth. are false: and it is false when both p and y are true. The proposition p N O R q is truc when bolh p and q are false. and it is take otherwise.The propositions p.h'AND y and p N O R q are dcnotcd by p I y and p L y , respectively. (The operators I and L are called the Sheffer stroke and the Peircearrow after H. M. Sheller and C. S. Peirce, respectively.) 40. Construct a truth table for the logical operator NAND. Show that p 1 y is logically equivalent to - ( p A q). Conslruct a truth table for the logical operator N O R . Show that p 1 q is logically equivalent to - ( p v q ) . In this exercise we will show that / $ Jis a functionally complete collection of logical operators. a) Show that p J. p i s logically equivalent to -p. b) Show that ( p J. y) 1 ( p J. y ) is logically equivalcnttopvq. c) Conclude from parts (a) and (b), and Exercise 39. that 11)is a functionally complete collection o l logical opcrators. *45. Find a proposition equivalent to p + y using only the logical operator $. 46. Show that (I] is a functionally complete collection of logical operators. 47. Show that p I q and q I p are equivalent. 41. 42, 43, 44. 28 1 / T h e Foundations: Logic and Proof, Sets, and Funutions 48. Showthatp 1 (q I r ) a n d ( p I y) I r arenorequivalent. so that the logical operator I is not associative. *49. How many different truth tables o f compound propositions are there that involve the propositions p q v - r v - 3 , -p v -q v -r, p v r v s, p L r v -s can he made simultaneously true by an assignment of truth values t o p, y, r , and s? A compound proposition is satisfiableif therc is an assignment of truth values to the variables in the proposition thar makes the compound proposition truc. 50. Show that i f 1,. q. and r are compound propositions such that /, and y are logically cquivalsnt and q and r arc logically equivalent, then p and r are logically 54. Which of thesc compound propositions are satisfi- able? a) ( p v q v - r ) A ( p L -y v -9) A ([I v -r v (-p v -q v -sl .? ( p v q v - a ) 51. The following sentence is taken from the specificaLion of a telephone system:"lf the directory database is opened. (hen the monitor is put in a closed stale. if the system is not in its initial state."This specification is hard to understand since it involves two implications. Find an cquivalent, easier-to-understand specification thar involvcs disjunctions and negations but not implieations. 52. How many of thc disjunctions p v -q, -p v y, q v r , q v -r, -y v -r can be made simultaneously truc by an assi~nmentof truth values to p. q.and r ? 53. How many of the disjunctions p ,/ -y v r . -p v v v v - 7 , --p v q v 7 . 7 , q v r ,i -r. - -4) A h) (-p'V -y v r ) A (-I> v q v - 5 ) f i ( p 'd-y V -91 A ( p ,\,y \, - r ) A ( p v -r v -.<I c) ( p V q V r-) A ( p v -y v -.s) A (y \* -r V .?I ? (-[, V V ') ? ('p V q V -s) A ( p 'V 7 q V - r ) A (-p v -y v i)n (-p V -r v 7 . 7 ) (-,,\* -r ,d 7.7) A ' 55. Expla~nhow an algorithm for determining whether a compound proposition is satisfiable can be urcd to determine whether a eompound proposition is a tautology. (Hirrr: Look at -p, where p is the proposition that ia being examined.) - - m. Predicates and Quantifiers INTRODUCTION - Statements involvinz variables, such as "x > 3," .'a = y + 3," and "x + ? = z," a r e often found in mathematical assertions and in computer programs. These statements a r c neither truc n o r false when the values of the variables a r e not specified. In this section we will discuss the ways that propositions can be produced f r o m such statements. T h e statement ''1 is greater than 3" hos t w o parts. T h e first part, the variable x , is the subject of thc statement. T h e second part-the predicate. "is greater t h a n ?"-refers to a property that the subject of the statement can have. We can denote the statement " x is greater than 3" by P ( x ) , where P denoles the predicate "is greater than 3"and x is thc variable. T h e statement P ( x ) is also said t o be the value of the propositional fundion P a t x . Once a value has been assipncd t o the variable x , thc statement P ( x ) hecomcs a proposition and has a truth value. Consider Example 1. EXAMPLE 1 Let P ( x ) denote t h e statement " x > 3." W h a ~a r e the truth values of P ( 4 ) a n d P ( 2 j ? Solution: We obtain t h e slatrment P ( 4 ) by setting x = 4 in the statement "x > 3." Hence, P ( 4 ) ,which is the statement "4 > 3." is true. However, P ( 2 ) .which is the statement "2 r 3," is false. W e can also have statements that involve more than one variable. For instance, consider the statement "x = ?. 3." We can denote this statement by Q ( x , y ) , where r; and y a r e variables and Q is the predicate. When values a r e assigned t o thc variables x a n d y, the statement Q ( x , y ) has a truth value. + 1-29 1.3 Predicates and Quantifiers 29 EXAMPLE 2 Exlne Ex1Mplea I.el Q ( I - , v) denote the stntcmcnt "x proposit~onsQ ( l 2 ) and Q(3, O)? -- y + 3.'' What are the truth values of the Solurion: To obtain Q(1.2). set x = I and y = 2 in the statement Q(x, y). Hence, Q(1. 2) is the stalement "I = 2 3," whlch is false. The statement Q ( 3 , 0) is the 4 proposii(ion "3 = 0 + 3.' which is true. + + Similarly, wc can lct R(x, y , z) denote the statement "x y = z." When values are assigned to the variables x , y,and z, this statement has a trulh value. EXAMPLE 3 What are the truth values of the propositions R ( l . 2 . 3) and R(O.O, I)? Sohriion: The proposition R(1, 2, 3) is obtained by settingx = 1,y = 2. and z = 3 in the statement R ( x , y, z ) . We see that R ( 1 . 2 . 3 ) is the statement "1 2 = 3," which is true. Also note that R(O.0, l ) , which is the statement "0 0 = 1," is false. 4 + ier to + In general, a statement involving t h e n variables x l , x2, . . . , x,, can be denoted by 1U- Ion A statement of the form P ( x 1 , x z , . . . ,x,,) is the value of the propositional function P at thc n-tuple ( X I , rz. . . . . x,,), and P is also called a predicate. CHARLES SANDERS PEIRCE (183!3-1914) M a w considcr Charles Pcirce the nlost orizinal - and , thc S to '+ is ;the 1s P es a 3." tate4 versatile intellscl lloln rhc llnilrd Slates; he war hovn in Camhridge,Massachusetts. His lather,Benjam~n Pcirce. was a ~ m f e s s o rof mathematics and natural philosophv . . at Havvard. Peirce a t t e n d 4 Harvard (1855-1859) and rccaivcd a Haward master of a, ts dcgree (1Rh7) and an adveuced dcgrce in chcmiatcy from the Lawrence Scientific School (lhh3). Hislathcr rncouraocd him to pursuz a career in scicnce, hut instead he chose to study logic and scientific methodolnjy l u 1861. Pcirce became an aidc in the LJnited Slorcs Coart S u ~ v c y .wilh thc goal of bettcr nudcrstandingscicntific merhodolopy. His srr\.isefor the Survey cxempted him from military servicc during the Civil War. While working for thc Survev, Peirce carried ont astronomical and gaodcsic work. He made fundarnmtnl conrribuliuns to the d c s i g n o f p e ~ ~ J u l u;~nd n ~ slo mappro~ect~ons,applyingnrwmathematical developmentsin the theory ofclliptic function%He was the first pelson to use the wavelength oflight a s a unit olmeasurerncnt R i ~ c e r o s elu the position ofAssistantforthe Survry,aposilion he held until he was forccd 1<1resign in l8')l wheu hedisagrrcd with [he direction taken hy the S u r v c y s n e ~adminislratiou. Although making his living from work in the physical sciznces. Peirce developed a hierarchy u l sriencer,airh nlathemarirs at the top rung, in which the melhodsolone science mold he adaptedlor uso by thosescieucrsunder it in the hierarchy. He was also the foundccof the American philosophical theory of pragmatism. Thc only academic position Peircr cvev held war as a lectuler in logic a1 Johns Ilopkinb Unlversily in Baltimore from 1879 to 1884.His mathematical work during this time iucluded contributions to logic. set lhror, abstract algehra. and the philosophy uf marhematics His work is still relevant toda); some 01 his work on loeic h;ts hzen recently. a .. n ~ l i c dta artificial i$%lcllircnce. Peirce believed that the sludy of mathemilticscould develop the mind'spowers of imaginalion,ahstracrion,andgeneralization. His divevse nrtiviriei aller r c t i r i n ~lmm the Surve, included writing lor newsnapers and jaulnals. conlrihutino tu . . scholarly dictionaries. translatic~gbcicnlilic papers guest lecturing. and textbook writhe. U n l o r t u n a t e l ~ the income Irom these pursuits was insufficient to protect him and his second wife from abject poverty He was ~ u p p o r t r din his later years by a fund created by his mdny admirers and adminislcr~dhy the philos<~pller William James, hts l~telongfriend. Although Peirce wrote and published vr~luminouslyin a rast raneeolsuhiects. heleft more than 1110.001)vapesolun~ublished manurcrivls. Because ofthe dilliculiv . of studying his unpublishid writingsrcholars have only recentlv started t o rlndevrtand some of his \nticd contrihurions. A group a1 peoplc is devatcd to making his wovk available over the Internet to hcing a hettev appreciation o ~ ~ e i r ~ e ~ s ~ c c o m ~ l i stoh m thep world nts 30 11 The Foundations: Logic and Proof, Sets, and Functions 1-30 Propositional functions occur in computer programs, as Example 4 demonstrates. EXAMPLE 4 Consider the statement ifx>Othenx:=x+l. When this statement is encountered in a program, the value of the variable x at that point in the execution of the program is inserted into P ( . r ) , which is "x > 0." If P ( I ) is true for this value of x , the assignment statement x := x I is executed, so the value of .r is increased by 1. If P ( x ) is false for this value of x , the assignment statement is not executed, so the value of x is not changed. 4 + QUANTIFIERS When all the variables in a propositional function are assigned values. the resulting statement becomes a proposition with a certain truth value. However, there is another important way, called quantification. to create a proposition from a propositional function. Two types of quantitication will be discussed here, namely, universal quantification and existential quantification. The area of logic that deals with predicates and quantifiers is called the predicate calculun THE UNIVERSAL QUANTIFIER Many mathematical statements assert that a property is true for all values of a variable in a particular domain, called the universe of discourse or the domain. Such a statement is expressed using a universal quantification. The universal quantification of a propositional function is the proposition that asserts that P ( . r ) is true for all values of x in the universe of discourse. The universe of discourse specifics the possible values of the variable x . DEFINITION 1 The universal quanrification of P ( x ) is the proposition " P ( x ) is true for all values of x in the universe of discourse." The notation V x P (.r) denotes the universal quantification of P ( x ) . Here V is called the universal quantifier. The proposition V x P ( x ) is read as "for all x P ( x ) " or "for every x P ( x ) . " Remark: It is best to avoid usingdfor any x" since it is often ambiguous as to whether "any" means "every" or "some." In some cases, "any" is unambiguous, such as when it is used in negatives, for example, "there is not an!, reason to avoid studying." We illustrate the use of the universal quantifier in Examples 5-10. EXAMPLE 5 + Let P ( x ) be the statement "x 1 > x." What is the truth value of the quantification V x P ( x ) , where the universe of discourse consists of all real numbers? 1.3 Predicates and Quantifiers 31 Extra Solr~tiorr:Sincc P ( x ) is true for all real numbers x , the quantification Examples VxP(.r) is true. EXAMPLE 6 lint rue lf x not 4 4 Let Q(x) bc t h c s t a t e m e n t " ~c 2,"What is the truth valueof thequantificationVxQ(x), where the universe of discourse consists of all real numbers? Solution: Q(x) is not true for every realnumher.x.since,for instance, Q(3) is lalsc.Thus V.v Q(.r) is false. x,-it ateimion. and IF is 4 When all the elements in the universe of discourse can be listed-say, a , , .rzl . . . , follows that the universal quantification V x P ( x ) is the same as the conjunction since this conjunction is true if and only if P(.rl), P(xz), . . . , P(x,,) are all true. EXAMPLE 7 at a 'erse ntifithat re of What is the truth value of V a P ( x ) , where P(.r) is the statement "x2 c 10" and the universe of discourse consists of the positive integers not exceeding 4? Solr~rion:The statement V x P ( x ) 1s the same as the conjunction P(1) A P(2) A P(3) A P(4), since the universe of discourse consists o l the integers 1 , 2 , 3 .and 3. Since P ( 4 ) . which is the statement "4' c 10." is false, it follows that V x P ( x ) is false. 4 EXAMPLE 8 What does the statement VxT(x) mean if T ( x ) is "x has two parents" and the univcrsc of discourse consists of all people? Solut~orr: The statement V.rT(x) means that for every person x , that person has two parents. This slalcmcnt can be expressed in English as "Every person has two parents." This statement is true (except for clones). 4 Specifying the universe of discourse is important when quantifiers are used.The truth valuc of a quantified statement often depends on which elements are in this universe of discourse, as Example 9 shows. tifier. ether n i t is II EXAMPLE 9 What is the truth value of v x ( x 2 > x ) if the universc of discourse consists of all real riumbers and what is its truth value if the universe of discourse consists of all integers? Solurion: Note that x 2 x if and only if x' x = x ( x - 1) ? 0. ~ o n s e ~ u e n t l y . > . r ~Iifandonly i f x 5 Oorx > ( . I t follows thatVx(x2 > x)isfalseif theuniverseofdiscourse consists of all real numbers (since thc inequality is false for all real numbers x with 0 c x c 1). Howcver.if the universe of discourse consists of the integers,v.x(.x2 3 x ) is 4 true, since there are no intepers .r with 0 c x c 1. To show that a statement of the form V.rP(x) is false, where P ( x ) IS a propositional function, we need only find one value of x in the universe of discourse for which P ( x ) is false. Such a value of x is called a counlerexample to the statement Vx P(.t). 32 1/The Foundations: Logic and Proof, Sets, and Fnnctions EXAMPLE 10 1-32 Suppose that P ( x ) is .'x2 > O."To show the statement V x P ( x ) is false where the universe of discourse consists of all integers, we give a counterexample. We see that .r = 0 is a counterexample since x2 = 0 when .r = 0 so that x' is not greater than 0 when x = 0. 4 Looking for counlerexarnples to universally quantified statements is an important activity in the study of mathematics, as wc will see in subsequent sections of this hook. THE EXISTENTIAL QUANTIFIER Many mathematical statemcnts asaert that there is an clement with a ccrtain property. Such statements are expressed using existential quantification. With existential quantification, we form a proposition that is true if and only if P ( x ) is true for at least one value of x in the universe of discourse. DEFINITION 2 The existential quantification of P ( x ) is the proposition "There exists an element x in the universe of discourse such that P ( x ) is true." We use the notation 3x P ( x ) for the cxistential quantification of P ( x ) . Here 3 is called the existential quantifier.The existential quantitication 3x P ( x ) ia read as "Thcre is an x such that P(.r)," "There is at least one x such that P ( x ) , " or "For some x P ( x ) . ' ' Wc illustrate the usc of the cxistential quantifier in Examples 11-13. EXAMPLE 11 Extra Examples EXAMPLE 12 Let P ( x ) denote (he statement "x > 3." What is the truth valuc of thc quantification 3 x P ( x ) . where the universe of discourse consists of all real nurnbcrs? Sol~~tion: Sinceh.r > 3"is truc-for of P ( x ) , which is 3 x P ( . r ) ,is truc. instance, whenx = 4-the existential quantification 4 + Lct Q ( . r ) denote the statement ".r = x 1 ."What is the truthvalue of the quantification 3 x Q ( x ) ,wherc the universe of discoursc consists of all real numbers? Sobrrion. Since Q(I) is false for every real number x. the existential quantification of Q c x ) ,which is 3x Q ( . r , ,is knlse. 4 When all clementa in the universe of discourse can bc listed-say. the existential quantification 3 x P ( x ) is the same as the disjunction X I , 12. ..., x,~- P(x1) V P(r2) V . . . V P(.r,,), since thisdisjunctionis trucif andonly if at least one of P ( x 1 ) . P ( A ~ ). ., . , P(.r.) is true. 1.3 Predicates and Quantifiers 33 mihat In 0 4 1 TABLE 1 Quantifiers. 1 Srofemenf When TmeP V.r P (.r 1 3.r P (.r ) P ( x ) is true for cvery x. Thcrc is an x for which P ( x ) is true. EXAMPLE 13 that :XIStruc 1 I When False? 1 There is an x for which P ( x ) is false. P ( x ) is false for every x. What is the truth value of 3 x P ( x ) where P ( x ) is the statement "x2 > 1 0 and the universe of discourse consists of the positive integers not cxcccding 47 Solution: Since the universe of discourse is (1, 2, 3,4], the proposition 3 x P ( x ) is the same as the disjunction Sincc P(4), which is the statement "4' > 10," is true, it follows that 3x P ( x ) is true. 4 Table 1 summarizes the meaning of the universal and the existential quantifiers, It is sometimes helpful to think in terms of looping and scarching when determining the truth value of a quantification. Suppose that there are n objects in the universe of discourse for thc variable x . To determine whether Vx P ( x ) is true, we can loop through all 12 values o f x to see if P ( x ) is always true. If we encounter a value x for which P ( x ) is false, then we have shown that Vx P ( x ) is false. Otherwisc,Vx P ( x ) is true.To see whether 3x P ( x ) is true, we loop through then values of x searching for a value for which P ( x ) is true. If wc lind onc, then 3.r P ( x ) is true. If we never find such an x , we have determined that 3 x P ( x ) is false. (Note that this searching procedure does not apply if there are infinitely many values in the universe o f discourse. However, it is still a useful way of thinking about the truth values of quantifications.) BINDING VARIABLES When a quantifier is used on the variable .r or when we assign a valuc to this variable, we say that this occurrence of the variablc is bound.An occurrence o f a variable that is not bound by a quantilicr or set equal to a particular value is said to he free. All the variables that occur in a propositional function must be bound to turn it into a proposition. This can be done using a combination of universal quantifiers,cxislential quantifiers.and value assignments. The part of a logical expression to which a quantifier is applied is called the scope of this quantifier. Consequently. a variable is free if i t is outsidc the scope of all quantifiers in the formula that spccifies this variable. cation cation 4 (cation ication 4 is true. EXAMPLE 14 x). In the statement 3 x Q ( x , thc variablc x is bound by the existential quantification 3.r. but the variable y is frce because it is not bound by a quantifier and n o value is assigned to this variable. In the statement 3 x ( P I x ) A Q ( x ) ) V VxR(x), all variables are bound. The scope of the first quantifier, 3.r. is the expression P ( x ) A Q ( x ) because 3 x is applied only to P ( x ) A Q(x), and not to the rest of the statement. Similarly, thc scope of the sccond quantifier,Vx,is the expression R(x).That is, the existential quantifier binds the variable x in P ( x ) A Q(.r) and the universal quantifier Vx binds the variable x in R(x). Observe 34 1 1 The Foundations:Logic and Proof,Sets,and Functions 1-34 that we could have written our statement using two different variables x and )I, as 3 x ( P ( x ) A Q ( x ) ) V VyR(y), because the scopes of thc two quantifiers do not overlap. ?he reader should be awarc that in conlnlon usage, the same Ictter is often ured t o represent variables bound by different quantifiers with scopes that do no1 overlap. 4 NEGATIONS We will often want to consider the negation of a quantified expression. For instance, consider the negation of the statement "Every student in the class has taken a course in calculus." This statemcnt is a universal quantification, namely. VxP(x), where P ( a ) is the statement "x has takcn a course in calculus." The negation of this statement is "lt is not thc case that every student in the class has taken a course in calculus."This is equivalent to "There is a studcnt in the class who has not taken a course in calculus."And this is simply the existential quantilication of the negation of the original propositional function, namely, 7his example illustrates the following equivalence: Extra Examples Suppose we wish t o negate an existential quantification. For instance, consider the proposition "There is a student in this class who has taken a course in calculus."This is the existential quantification where Q ( x ) is the statement "x has taken a course in calculus." The negation of this statement is the proposition "It is not the case that there is a student in this class who has taken a course in calculus."?his is equivalent to "Evrry student in this class has not taken calculus," which is just the universal quantification o[ the negation of tha original propositional function, or, phrased in the Ianguagc of quantifiers, This exanlple illustrates the equivalence -3xQ(x) = VX -Q(x). Negations of quantifiers arc summarized in Table 2 Remark: When the universe of discourse of a predicate P ( x ) consists of n elements, where n is a positive integer. the rules for ncgating quantified statements are exactly the same as D e Morgan's laws discussed in Section 1.2. This follows because -V.r P(.r) is the same as - ( P ( x l ) A P(x2) A . . . A P(x,,)), which is equivalent to - P ( x l ) V -P(xz) v . . V -P(x,,) by De Morgan's laws,and this is the same as 3 x - P ( x ) . Similarly,-3x P I X ) is the same as - ( P ( x l ) v P(x2) V . . . V P(x,,)), which hy De Morgan's laws is equivalent to -P(.r,) A - P ( x ~ ) A , . . A -P(x.),and this is the same asVx-P(x). We illustrate the negatlon of quantified statemcnts in Examplcs 15 and 16. 1-35 1.3 Predicates and Quantifiers 35 1 I TABLE 2 Negating Quantifiers. When Is Nenation True? When False? For every x , P(.r) is false. There is an x for which P ( x ) is true. P ( x ) is true for every x. There is an .r lor which P ( x ) is false. EXAMPLE 15 What are the negations of the statements "There is an honest politician" and "All Americans eat cheesehurgers"? this e in urse :inal Extra Examples :r the his is Sobition: Let H(.v) denote "x is honest."Then the statement "There is an honest politician" isrepresentedby 3.v H(x),where the universe of diseourse consistsof all politicians. The negation of this statement is -3xH(.r),u,hich is equivalent to Vx-H(x).This negation can be expressed as "Every politician is dishonest." (Noftzr In English the statement "All politicians are not honest" is ambiguous. In common usage this statement often means "Not all politicians are honest." Consequently, we do not use this statement to express this negation.) Let C ( x ) denote "x eats cheeseburgers." Then the statement "All Americans eat cheeseburgers" is represented by VxC(x). where the universe of discourse consists of all Americans. The negation of this statement is -VxC(.r), which is equivalent to 3x-C(x). This negation can he cxpressed in several different ways, including "Some American does not cat cheeseburgers" and "There is an American who does not eat cheeseburgers." 4 EXAMPLE 16 What are the negation5 of thc btatements v x ( x 2 > x ) and 3x(.r2 = 2)? ,t this s who as not riginal Solritior~:?hc negation of v x ( x 2 > x ) is the statement -v.r(x2 > x), which is equivalent to 3x-(.rL > x). This can be rewritten as 3x(x2 5 x ) The negation of 3.r(x2 = 2) is the statement -3xi.r' = 2), which is equivalent to Vx-(x2 = 2). This can be rewrittcn as v.T(.v' # 2). 'The truth values of these statements depend on the universe of discourse. 4 TRANSLATING FROM ENGLISH INTO LOGICAL EXPRESSIONS rments, ctl? the r) is the '(12) 3x P ( x ) uivalent " Translating sentences in English (or other natural languages) into logical expressions is a crucial task in mathematics, logic programming. artificial intelligence, soRware engineering,andmany other Jisciplincs. We heganstudying this topicinSection l.l,where we used propositions to express sentences in logical expressions. In that discussion;we purposely avoided sentences whose translations required predicates and quantifiers. 'Translating from English to logical exprcssions becomes even more complex when quantifiers are needed. Furthermore, therc can be many ways to translate a particular sentence. (As a consequence, there is no "cookbook" approaeh that can he followed step by step.) We will use somr examples to illustrate how to translate sentences from English into logical expressions. Tlie goal in this translation is to produce simple and useful logical expressions. In this section,userestrict ourselves to sentences that can be translated into logical 36 1I'l'he Foundations: Lugic and Proof, Sots, and Function- 136 expressionsusinga single quantifiertin the next section,we will look at more complicelcd srntcnccs that rcquire multiple quantifiers. EXAMPLE 17 Extra Examglee Express the statement "Every student in this class has studied calculus" using predicates and quantifiers. Solrrtiu,?: First,we rewrite the statement so that we can clearly identify the appropriate quantifiers to use. Doing m, we obtain: "For every student in this class, that student has studied calculus: Next, we introduce a variable x so that our statemcrll bccorncs "For ever)' student x in this class..r has studied calculus." Continuing, we introduce the predicate C ( x ) . which is the statement "x has studied calculus." Consequently,if the universe of discourse Tor1 consists of the students in the class, we can translate our btatcrncnt as VxC(x). However, there are other correct approaches; different universes of discourse and other predicates can be used. The approach we >electdcpcnds on the subssq~rentreasoning we want to carry out. For example, we may be interested in a wider group of people thanonly those in this class. If wechange the universe of di.scourse locorlsist of all pcople, we will need to express our statement as "For every person x,if personx is a student in this class then x has studiedcalculus." - If S(x) represents the statement that person x is in this class, we see that our statemenl can be expressed as V.r(S(x) C ( r ) ) .[Crrution! Our statement rnnnor be expressed asV.r(S(.r) A C i x ) ) since this statement says that all pcople are students in this class and have studied calculus!] Finally.when we are interested in the background of people in subjects besides calculus.we may prefer touse the two-variable quantifier Q ( x . y ) for thestatement'studt.nt .r hasaludiedsub.icct ?."Then wewould replace C i x ) by Q i x , calculus) in both approaches we have followed toobtain VxQ(x, calculus) or Vx(S(x) + Q(.r, calculus)). 4 In Example 17 we displayed difierent approaches for expressing the same statement usingpredicates andquantifiers. However,we should always adopt thc simpleat approach that is adequate for use in subsequent reasoning. EXAMPLE 18 Express the statements"Somestuder~tin thisclass hasvisitedh1exico"and"Every student in this class has visitcd either Canada or Mexico" using predicates and quantifiers. Sollrtion: The statement "Some student in this class has visited Mexico" means that "There is astudent in thisclass with the prr,perty that the studcnt has visitcd Mexico." We can introduce a variable x , so that our statement becomes "There is a student .r in this class having the property x has visited Mexico." We introduce the predicate M(x), which is thc statrrnrnt "x has visited Mexico." If the universe of discourse for x consists of thc students in this class, we can translate this first statement as 3.rM1,x). Howcver, if we are interested in people other than those in this class use look at the statement a little differently. Our ctatement can ha expressed as 1.3Predicates a n d Quantifiers 37 "-fiere is a person x having the properties that x is a student in this class and x has visited Mexico." cated I n thiscase,thr universe oldiscourse for the variablcx consists ofall people. We introduce the predicate S(x),"x is a student in this class." Our solution becomes 3 x ( S ( x ) A M ( x ) l since thc statement is that there is a person x who is a student in this class and who has visited Mexico. [Caulion! Our statement cannot be expressed as 3 x ( S ( x ) -t M ( x ) ) , which is true when there is someone not in the class.] Similarly, the second statement can he expressed as icates priate "For every x in this class,r has the property that .r has visited Mexico or x has visited Canada." (Note that we are assuming the inclusive,rather than the exclusive,oi. here.) We let C ( I ) be the statement "x has visited Canada." Following our earlier reasoning, we see that if the universe of discourse for x consists of the students in this class, this second statement can be cxpressed as Vx(C(x) V M ( x ) ) . However. if the universe of discourse for x consists of all people, our statement can be expressed as ed cale class. -se and 'easonpeople people, "For every pcrson x , if x is a student in this class, then x has visited Mexico or x has visited Canada." In this case, the statement can be expressed as V.r (S(x) + ( C ( x ) v M ( x ) ) ) lnsteadofusingthepredicatus M ( x ) and C ( x ) torepresent t h a t x hasvisitedMexico and a has visited Canada, respectively, we could use a two-place predicate V(x, ?I t o represent "x has visited country y." In this case, V(x, Mexico) and V(x, Canada) would hakc the same meaning as M ( x ) and C ( x ) and could replace them in our answers. If wc are working with many statements that involve people visiting diiiersnt countries, we might prefer lo use this two-variable approach. Otherwise, for simplicity, we would stick 4 with the one-variable predicates M ( x ) and C(x). ~tement pressed lass and :scalcuiudcnt r ,roaches 4 EXAMPLES FROM LEWIS CARROLL atement pproach Lewis Carroll (really C. L. Dodgson writing under a pseudonym), the author of Alirt. in Wondt,rlond, is also the author of several works on symbolic logic. His books contain many examples of reasoning using quantifiers. Examples 19 and 20 come from his book that CHARLES LUTWIDGE DODGSON (1832-1898) We know Charles Dodgson as 1,rwir Currollthe pseudonym he uscd in his writings on logic Dodgson, the son ol a clergyman, was t h e third oi I I Mexico." :o." If the e this first Links 3ok at the children.all oiwhomstuurrerl. Hewasuncumfortoblcin the company o i ~ d u l t s a n d i s s a i dtu havespoken withoutstuurringouly toyounggi~ls,manyofwho~n hcenlrrtaincd,corrcspondrdwith.and photugraphrd (often in ihc nude). Although attraclrd to young girls; hc was rxlremely puritanical and religious. His friendship with the three young douphlrrs of Dcan L.iddrl1 led t o his writing Alice in Wonderland, which brought him rnonc). and lame. Dodgson grodurrtcd frum O ~ i u r din 1854 and obtained his master o i nrls degree in 1857. Hc was appointed lceturrr in mathematics at Christ Church C o l l r g . Oxfurd, in 1855. H r was ordained in thc Church of England in 1861 but never practiced his ministry His wrilings include articles and books on gcomctry,drrrrnminants,and the mathcmnlics aitournamrnls and elections. ( H e also used the pseudonym Lewis Carroll lor his (many works on rccrralional logic.) 38 1 1 The Foundations: Logic and Proof, Sets, and Functions 138 Symbolic Logic;other examples from that book are given in the exercise set at the end of this section. These examples illustrate how quantifiers are used to express various types of statements. EXAMPLE 19 Considcr these statements. The first two are called premires and the third is called the ronclrrsion. The cntire set is called an nrgrrmert,. "All lions are fierce." "Some lions do not drink coffee." "Some tierce creaturcs do not drink coffee." (In Section 1.5 we will discuss the issue o f dcterminins whether the conclusion is a valid consequence of the premises. In this example, it is.) Let P ( . r ) . Q ( x ) , and R ( x ) be the statements "x is a lion;" "x is fierce," and "x drinks coffee." respectively. Assuming that the universe of discourse is the set of allcreatures,express the statements in the argument using quantifiers and P ( x ) , Q ( x ) , and R ( x ) . - Soblrion: We can express these statements as: Vx(P(x) Q(x)). 3 . r ( P ( x )A - R ( x ) ) . 3x(Q(x)A -R(x)). Notice that the second statement cannot be written as 3 x ( P ( x ) + - R ( x ) ) . The reason is that P ( s ) t - R ( x ) is true whenever x is not a lion, so that 3 x ( P ( x ) -. - R ( . r ) ) is true as long as there is at least one creature that is not a lion, even i f every lion drinks coffee. Similarly, thc third statement cannot be written as 3x(Q(x)+ -R(x)). EXAMPLE 20 4 Consider these statements. of which the first thrcc arc premises and the fourth is a valid conclusion. "All hummingbirds are richly colored." "No large birds live on honey." "Birds that do not live on honey are dull in color." "Hummingbirds are small." Let P ( x ) , Q ( x ) , R ( x ) , and S ( x ) hc thc statements " x is a humminghird," " x is large," "x lives on honcy."and .'.! is richly colored," respectively Assuming that the universc o l discourse is the set of all hirds, express thc statements in thc argument using quantifiers and P ( x ) , Q ( x ) . R(x).and S(x). Solrrtion: We can express the statements in the argument as V x ( P ( x )+ S i x ) ) . -3x(Q(x) A R(x)). Vx(-R(x) + -S(x)). V x ( P ( . r )+ - Q ( x ) ) . (Notc wc have assumed that "small" is the same as "not large" and that "dull in color" is the same as "not richly colored."To show that the fourth statement is a valid conclusion of thc first three, we need to use rulcs of inference that will b e discusscd in Section 1.5.) 4 1.3 Predicates and (luantifiers 39 LOGIC PROGRAMMING Links EXAMPLE 21 ialid :the that nent Consider a Prolog program given facts telling it the instructor of each class and in which classes students art. enrolled. The program uses these facts to answer queries concerning the professors who teach particular students. Such a program could use the predicates in.~tructr>r(p. r ) andmrolled(s, r ) to represent that professor p is the instructor of course c and that students is enrolled in course c, respectively. For example, the Prolog facts in such a program might includc: instructor(chan,math2731 instructor(patel,rr222) instructor(grossman,cs3@11 enrolled(kevin.math2731 enrolled(juana,ee2221 enrolled(juana.cs3011 enrolled (kiko.math2731 enrolled(kiko,cs3@1: 'ason x)) is Irinks I A n important type of programming language is designed t o reason using the rules of predicate logic. Prolog (from Programmingin Logic),developed in the 1970s bycomputer scientists workirig in the area ofartificial intelligence, is an rxample of such a language. Prolog programs include aset ofdeclarations consisting of two types of staternents,Prolog facts and Prolog rules. Prolog facts define predicates hy specifying the elemcnts that satisfy these predicates. Prolog rules are used to define new predicates using those already defined by Prolog facts. Example 21 illustrates these notions. (Lowercase letters have been used for entries because Prolog considers names beginning with an uppercase letter to be variables.) A new predicate teuchrs(p, s),representing that professor p teaches students, car1 be defined using the Prolog rule valid teaches (P,s ) : - instructor(P,C), enrolled(S,Cl large." :rse of ltifiers which means that tenches(p, s ) is true if there exists a class c such that professor p is the instructor of class c and student .P is enrolled in class c. (Note that a comma is used to represent a conjunction of predicates in Prolog. Similarly, a semicolon is used to represent a disjunction of predicates.) Prolog answers queries using the facts and rules 11is given. For example, using the facts and rules listed, the query produces thc response since the fact enrolled(kevin, math273) was provided as input. The query dull in a valid ssed in 4 produces the responsc kevin kiko 40 1 1 The Foundations: Logic and Proof, Sets, and Functions 140 To produce this response. Prolog determines all possible values of X f o r which enrolled(X, rnath273) has been included as a Prolog fact. Similarly, to find all the professors who are instructors in classes being taken by Juana, we use t h e query ? t e a c h e s (X,j u a n a ) This query returns pate1 4 grossman Exercises 1. Let P ( x ) denote thc statement "x i 4,"What are the truth values'? a ) P(O) b) P(4l C) P(6l 2. Let P ( x ) be thc statcmenl "the word x contains the letter a " What are (he truth values? a) P(orange) b) P(lernon) C) P(true) d ) P(falsc) 3. Let Q(x. ?) denote the statement "x is thc capital nf v." What are these truth values? a) Q(Dcnvrr,Colorndo) b) Q(Dclroi1,Michigan) C) Q(Massachusrlts,Boston) d) Q(New York,New York) 4. State the value of x after the statement if P i t i then x := I is executed, where P(1) is the stalemcnt "x > I," if the value of x when this stalcmcnt is reached is a).r=O. b) x = I . C) x = 2 . 5. Lzt P ( x ) be the statement " x spends rnorz than five hours every weekday in class," where the universe of discourse for x consists of all studenls. Express cach of these quantifications in English. a ) 3 ~ P ( r ) b)VxP(x) c) 31-P(rl d ) Vx-P(xl 6. Let N(x) be the staterncnt "I has visited North Dakota," where the universe o f discourse consists of the students in your school. Express each of thesz quantifications in E n ~ l i s h . b) Vl-Nix) c) -3.rNi.r) a) 3xN(x) d) 3x-N(x) e) - V N f) Vx-N(x) 7. Translate these statements into English, where C ( r ) is "x is a comedian" and F(x) is " x is funny" and thc universe of discourse consists of all people. F(x)) b) Vx(C(x) A F ( r ) ) a ) Vx(C(x) C) 3x(C(.rl 4 F(x)) d) 3x(C(x) A F ( x ) ) 8. Translate these statements into English, whcrc R(A) is") is a rahhitWandH(x) is"x hopssand theuniverse - of discourse consists of all animals. a) Vt(R(x) + H(x)) b) Vx(R(x) A H(x)) c R r + H i d) 3x(R(x) A H(x)) 9. Let P(.vl he the statement ".r can speak Russian"and Ict Q ( t i be the statement "r; knows the computer language C++." Express each of these sentences in terms of P ( r ) .Q(x), quantifiers, and logical connectives The universe of discourse for quantifiers consists o f all studcnts at your school. a ) There is a student at your school who can speak Russian and who knows C++. b) There is a student at your hchool who can speak Russiau hut who doesn't know C++. C) Every student at your school either can speak Russian or knows C++. d) No student at your szhool can speak Russian or knows C++. 10. L e l C ( x ) be the s t a t c r n e n t " ~hasacat,"let D(x) he the s t a t c m e n t " ~has adog."and let F(x) be thcstatement "1 has a ferret." Exprcss each of these statements in tcrrnsof C(x), U ( x ) .F(ri.quanlifiers,andlogicalconneclives. Let the universe of discourse consist of all students in your class. a ) A student in your class has a cat, a dog, and a ferret. b) All students in your class have a cat. a dog, o r a ferret. c) Some student in your class has a cat and a ferret. hut not a dog. d ) No student in your class has a cat, a dog. and a ferret. e) For each of the three animals, cats, dogs. and ferrets, there is a student in your class who has one of these animals as a pet. 11. Let P ( t 1 bet he statement"^ = x2."Ifthcuniverseof discourse consists of the intcgers, what are the truth values? a ) P(O) b) ~ ( 1 1 C) P(?) d)P(-1) e)3rP(rI f)VtP(ti I . ! p u ! ~qeads louues oqm looqss inok u! luapnls e s! a l a q l ( q .ueu~a!i\u! pan![ seq looqss inok u! ~ u a p n l sv (e 'salqe!.len om1 ql!m pue ?uo q1!m sa)ea!paJd au!sn Lq pue aslnoasrp jo asian!un aql au!li.~eni(q skew luaraJJ!p aalql u1 suo!s - s a ~ d x [ea!Xol a olu! smaualels asaql jo q ~ e a a ~ e [ s u 'SZ e~l ..i~nluasqla -!luami aq) u! u ~ o qsem [onqss ~ n o Au! a u o l a n ~(a ,.iddeq lou s! oqm looqas 1no.i u! uosiad e si a 1 a q 1 (p .a[aD~o~ou u pun a p h q e qloq sumo looqas 1noL u! auo ON (J '++3 pun sn[ns[es pa!pnls seq ssels inoli u! auoL1an3 ( q 'uels!qaqzn p a i ! s ~suq ~ [ooqss ~ n o ku! auoamos (n 'sa[qe!len om] qi!n pue a u o ql!n saies!pa.~ddu!sn Lq pue a s ~ n o s s ~30p aslan!un aqt 8u!A~enliq s A e lualaJJ!p ~ aalql u! suo!s - s a ~ d x les!Xol a OIU! sluamalels a s a q l ~ qsea o a l e [ s n e q .pz -1sajiad I O U s! auoamos l o pua!q inok s! lipoq.iiaha ION (1 .lsajlad s! pun pua!q 1nok 51 ?uoAlan3 (a 'laapad s! spuapj ~ n o lli o a u o ( p .wayad a l e spu?!~j~ n o k1 1 ~(J 'laapad s! a u o k a h a ION ( q .iaajiad s! auo ON (e 'S3A!13?UUOJ le3!407 pue 'slag!luenb 'saies!paid 4u!sn suo!ssa~d x a les!Xol olu! s l u a u s ) ~ ~~ ss a q jo i qsea a l e l s u e ~'EZ ~ 'q3!1 a q or luem IOU saop ssrls inoA u! ~ u a p n l sa u o ~(a .suo!~enhs s!]e~penb anlos ue3 s s e p ~ n o ku! sluapnls I I (p ~ 'm!ms louuea oqm ssep Jnoli u! u o s ~ a de s! a i a q l ( 2 .a!nou uZ!aroj e uags seq ssela ~ n o Lu! L p o q a u o s ( q .?uoqd re[n[[as u seq ssels ~ n o Lu! auoOa.%g (s 'aldoad 1le JO 1s!suo3 I! la1 'puosas pur? csels inoL u! sluapnls a q l j o ls!suos a s l n o ~ s jo ~ pasian!un aql lal'ls1!~'san!l~auuo3[e3!40[ pue 'slag!luenb 'Sal~3lpaldXu!sn suo!ssardx~ leJ!Xo[ olu! slualualels a s a q ~JO qaea s.iem om1 u! g l e l s u e x 'ZZ .Bn~tucu~~doid s!Bo[ u ! a s ~ n o ~ e u a q e ~ s e q s s e p ~ nloukaup!n l s o ~(a .a!.\om e u! ua?q seq s s e p 1no.i u! l u s p n ~ v s (p 'e!uJop[e3 u! uloq I O U SeM oqm s s e p 1noL u! uoslad us! a l a u (3 .klpua!~j s! ssep inok u! a u o ~ a n (j q . ! p u ! ~qeads ues ssvla inoli u! anoaluos (B -a[doad [le jo is!suo3 I! 1a['puo3as pur s s r p ~ u o u!i siuapnls a q l j o ]s!suos asInms!pJo aslan!un 241 la1 ' ~ ~ ~ ~ s a n ! l a a u[m!40[ uos pue 's~ag!luenb 's21u2!p?.1d Xupn suo!ssa~dxa le~!Xol olu! s i u a m a ~ e ~ a ssa q l j o q3ea sLem om1 u! arelsueu .IZ ( ( ~ ) d+ ( 0 > X ) ) ~ A V( ( 2 ) d - I X E (J ( ( x ) d V ( 0 Z 0 ) X E (P ((I)d + T I Ir!d>-~ (q # l-)IrA (J ( r ) d r t (6 .suo!lsun (uos puu'suor~sun~s~p'suo!~eXau Lluo au!sn p e s ~ s u ~ ' s i a y ! ~ -uvnb Xu!m i n o q l y sruama~elsasaql s s a ~ d x z' S~pue 1 1 - - 'S- jo slslsuoa ( x ) d uo!lsunJ leuo!l!s -odoid a q l l o asJnoas!p JO asJaA!un aql lcqr a s o d d n ~'OZ ' 1 ~ ) d - l..\~( ( x ) d (r!drA(P ( x I d . 1 . ~((g + (s # X))XA ( a (")drE- (J ( r ) d x E (e auo re1 -121 P U e pue ' 'suo!~aunjuoa puc'suo~~snnls!p'suo!leXau .iluo au!sn pealsu!'s~gg!l -uunh au!sn ~noql!msluamalels asaql s s a t d x ~s pue 'P'E';'[ s~aaalu!a q l j o sls!suoa ( x ) d uo!rsunj [euo~]!s o d o l d aql jo asmoss!p jo ssIan!un aql leg] a s o d d n ~'67 ('Id%- 6 (")d"E- (a ( r ) d - x A (p ( ~ ) d - I E (J ( X ) ~ X A(9 ( x ) ~ " E (R .suo!iuiiau pue'suo!~sun(uos'suo~~sun(s!p Xu~snsuo!l!sodnid asaql jo qsea ]no a l ! 'Z~ p ~u v 1.0 ' [ ' z s~aaaiu!aql JO s1s!suos ( r ) a uo!lJunJ [euo!l!s - o d o ~ daqr JO a s ~ n o s s l~opaslan!un aql ~ e q ai s o d d n ~.gl ( X l d x A - (J ('id-XE (J ( r ) d X E - (a ( r ) d ~ k A( q (A)d-'A(P (IJdXE In qeads asrahlnn gql leqi a s o d d n ~.LT qeads 'ruo!108au pue 'suo!~aunjuos~sno!~sunjs!p Xu!sn \uo!l!sodo~d asaql $0 qsea )no al!lfi 'p pne 'E '5 '1 ' 0 siaaalu! aq) jo sls!suos ( x ) d uo!l3unJ leuo!~!s -0doid a41 j0 asmo3s:p JO (X # ; I ) ~ A (P ( I - = z x ) ~ (- q~ + (1 2 z &A (J (Z = ;X)XE (R ' s i y t u n u leal [le jo sls!suos alqepen q3ea jo asinoss!p l o asJan!nn aql J! sluamale~sasaql jo qse2 l o anlen qln.11aql au!uJalaa '91 ( 0 > ;U)"E (P (Z = ,I1)uE ( q (U 2 ,ll)UA (3 llA (U (0 2 's~aXalu!lie jo sls!suos s2[qe!JeA [ILLOJ ~ S I ~ O J SJO ! ~asJan!un aql j! s m a u l a t e I s ? s ? q ~ ~qscajo o anlen qlnJ1 ?ql au!mJalaa 'ST (~IXZ)~A(P (;x= -uos 4auu U! sa: Jalnd pue . ;(X-))~~A (J (zr ?.!-)YE ( q ( I - = b x ) x (e ~ 5Jaq - u n u [eaJ [[e JO sls!suo~aslnosslp jo asJaA!nn . I ~ jI! s l u a u a ~ u ~ s a s a q ~ ~ o q a e a ~ o a n l e3qi n q?u!mialaa ~ni~ VT (1,= 1I)UE (3 (" 2 z")uA (P ( I , c I + U)VA ( e (UE = ~ Z ) " E(9 . S I ~ ~ . I IIle U !jo sls!suo3 asJno3s!plo asJan!un aqj J! s ~ u a w s ~ e ~ s a s aq3eaJo q l ~ o an[ehqlnll aq] au!mlalaa '£1 ( ~ ! G - X A (8 (x)o-rE 0 ( ~ l f i (a" ~ ( y ) o x E (P cl)a (J ( 1 - 1 0 (9 cola (e ;sanlen q l n q asaql a l e ~ e q m's~aXaiu![le J O s ~ s ~ s u oasinossrp s JO asIan -Tun aq] JI Z:.' < I x,. ~ u a m a l e ~ aql s aq ( r ) O l a 7 'ZI + 42 1 /The Foundations: Logic and Proof, Stls. arid Functions c) A studcnt in your school knows Java. Pnllog, and C++. d) Everyone in your class enjoysThai food. e) Someone in your class does not play hockey. 26. Trdns~ateeachoftheseslatementsinto~ogica~exprersions using predicates,quantifiers,and logical connectives. I a) Something is not in the correct placc. b) All tools arc in the c o r ~ c place t and arc in exccllent condition. c) Everything is in thecorrect place and in excellent condition. d ) Nothing is in thz correct place and is in excellent condition. e) O n e oi your tools is not in the correct placc, but it is in excellent condition. 27. Express each of these statements uhing Iugical opcrators.predicatcs. and quantifiers. 8) Some propositions arc tautologies. b) The negation o f a conlradiction is a tautology C ) Thedisjunction of twocontingenciescan he a tautology. d) The conjunction of two tautolog~esis a tautology. 28. Suppose thc universe o f discourse of the propositionalfunction P(x. y)consisti,ofpairsx and y.where x i s 1 , 2 , o r 3 a n d ? 1s l , ? , o r 3 . Write out thcseproposilions using disjunctions and conjunctions. - 8) 3 1 P ( x , 3) b) Vy P(1. ? ) d ) V.r P (.T , 2) c) 3y-PI?. ?) 29. Suppose that the universe of discourse of Q(x, y, z! consistsoftriples.t. ), :,wherex = 0, 1. o r 2 , ~= Oor I , and i = 0 or I. Write out these propositions using disjunctions and conjunctions. a) V?Qto.v.O) b) 3xQ(c. I. I ) c) 3i-QIO. 0. :) d) 3x-Q(x,O, I) 30. Express each of these statements using quantifiers. Then form the negation of thc statement so that no negation is to the left of a quantifier. Next, express the negation in simple Enplish. (Do not simply use the words "It is not the case that.") a) b) C) d) All dogs have fleas. There is a horse that can add. Every koala can climb. No monkey can speak French. e) There exists a pig that can swim and catch tish. 31. Express each of rhese statements using quantifiers. Then form thc negation of thc statcment.so that no negation is to the left of a quantifier. Next. cxprcss the n e g ~ t i o nin siniple English. (Do not sinlply use the words "It is not the case that.") a ) Some old dogs can learn new tricks. b) No rabbit knows calculus. 142 C) Every bird can fly. d ) There is no dog that can talk. e) There is no one in this class who knows French and Russian. 32. Express the negation of these using quantifiers, and then express the negation in English. s) Some clriverc do not obey the speed limit. b) All Swedish movies are serious. C) No onc can keep a secret. d) There is someone in this class who does not have a eood - attitude. 33. Find a countercxample, if possible, to thcce univerrally quantified statements, where the universe otdiscourse for all variables consists of all integers. a) V.t(x2 ? x ) Y.~-(.v = 1) b) Vz(x > 0 v x < 0) C) 34. Find n counterexample, if possible, lo thece universally quantified statements,wherc the uniwrseof discourse for all variables consists of all real numbers. b) V.r(x2 # 2 ) a) Vi(.r2 # X ) Y., 1J.r'> 0 ) 35. Express each of these statements using predicales and quantifiers. C) a) A passenger on an airline qualifies asan elite flyer if the passenger flies morc than 25,000 miles in a yraror takesmore than 25flightsduring that year. b) A m a n qualificsfor the marathon if his hcst previoustimeisless than 3 hours anda uumilnuualifies for the marathon if her best previous time is less than 3.5 hours. c) A studcnl rnust takc at lcast 60 course hours. or at least 35 coursc hours and writc a master's thesis, and receive a grade no lower than a B in all rcquired courscs. to rcceivc n master's degree. d) Thcre is a student who has taken more than 21 credit hours in a scmerter and received all Xs. Exerc~ses3 W 0 dral with the translalion hclaecn svstern specification and logical expressions involving quantifiers. 36. Translate these system specifications into English whcre the predicate S(r. ?) is "x is in state y" and whcre the universe o f discourse for x and y consists of all syslrnlr and all possiblc statcs, rcspactively. a) b) c) d) 3rS(x. open) V.r(S(.t. malfunctioning) v S(x. diagnostic)) j r S i x , open) v 3xS(x. diagnwlic) 3x-S(x, available) e ) Vr-S(r. working) 37. Translate these speclhcations into Engliah whcrc F(p1 is"Prin1er p is out ofscrvice," B ( p ) is'Printer I, is busy."L(,j) is"Printjobj is lost."and Q ( j ) is"Print job j is queued." a) 3p(FIj>)n B(p)) -. 3iL(.i) 1.3 Exercises 43 b) VPB(P) + 3if?(.i) C) 3 i i Q i i ) A U i ) ) ~PF(P) d) (VpRip) A V.iQ(i))+ 3 i L ( i ) 38. Express each of these system specifications rising predicates, quantifiers, and logical conncctivcs. a) When thelc is lcss than 30 megabytes free on the hard disk. a warning message is sent to all users. b) No dilcctolics in the file system can be opened and no files can be closed when system errors have been detected. c) The lile system cannot be backed up if there is a user currently logged on. d) Video on demand can be delivered when thereare at least 8 megabytes of memoly available and the connection speedisat least 56 kilobitspersecond. 39. Express each of these system specifications using predicatcs. quantificls, and logical connectives. a) At lcast onc mail message can be saved if there is a disk with more than 10 kilobytes of free space. b) Whcnevzr there is an active alert,all queued messages are transmitted. c) The diagnosticmonitor tracks thc status of all systems except the main console. d) Each participant on the conference call whom the host of the call did not put on a special list was 48. The r~otatiot~ 3!xP(1) denotes the proposition "There exists a nnique x such that P(x) is trne." + licatcs e flyer rs in n tyear. previialifies is less urs, or r's the3 in all ,ree. han 21 I Ks. cn sys5 quanEnglish 1,'' and :onsists iely. hilli.il a) Every user has access to an electronic mailbox. b) The system mailbox can he accessed by everyone in the group if the file system is locked. r) The firewall is in a diagnostic state only if the proxy server is in a diagnostic state. d) At lcast one router is lunctionine normally if the throughput is between 1UO kbps and 500 kbpsand the prosy server is not in dinenostic mode. - - 41. Delermine whelher V r ( P ( r ) C)(.r))and VrP(r1 VxQlx) havc thc same truth value. 42. Show that VrlPlx! .\ Q ( r i ) and VrP(r! .\ V r Q ( i ) have the samc truth valuc. 43. Show that 3xiPix) .J C)(.r)i and 3.1Pi.11 v 3xQ(x) have the same truth value. 44. Es~ablishthese logical equivalences, where A is a proposition no1 involving any qoantifiers. a) (VxPlx)) v A = V ~ i P l x )d A ) b) i3xPlx)j v A 3ciPixi v .A) 45. Establish these logical cquivalenccs. whcrc A is a proposilion not involving any quantifiers. a) IVx P l ~ c )/,) ,A where 'rinter p isUPrint a) b) C) d) ?instructor(chan,math273) ?instructor(patel,cs3011 ?enrolled!X,cs301j ?enrolled!kiko,Yl e) ? t e a c h e s ( g r o s s m a n ,Y l 52. Given Ihe Plolog facts in Example 21. what would Prolog return when given these queries? a) ? e n r o l l e d ( k e v i n , e e 2 2 2 ) b) ? e n r o l l e d i k i k o , m a t h 2 7 3 ) 40. Express cach of thcsc system specificalions using predicates, quantifiers. and logical conncctivcs. -- 1 If the universe of discourse consists of all integers. what are the truth values? x 1) a) ~ ! x ( > h) 3 ! r ( r 2= I ) c)3!x(x+3=2x) d)3!x(r=.x+l) 49. What are the truth values of these statements? a) 3!xP(x) i 3xP(x) b) VxP(x) i 3!xP(x) c) 3!x-Pix) + - v x P i ~ ) 50. Write out 3!xP(x), where the universe of discntirse consists of the integers 1,2, and 3, in terms of negations, conjunctions, and disjunctions. 51. Given the Prolog facts in Example 21, what would Prolog return given these queries'? = Vr(P(v) .A1 b) I ~ I P ~ I ) ~ ~ \ . A = ~ . I ~ P ( . V ) ~ \ . A I 46. Show t h n t V ~ P ( r ) v V r C ) ( . r ) a n d V r ( P ( . r ) v C ) ( r ) l a r e not logically equivalent. 47. Shnwthat3tP(r).\3rC)(r) and3r(P(.r).\C)(.ri)are not logically cquivalcnt. 53. Suppose that Prolog facts are used to define the predicates molher(M. Y ) and ,tarher(F. X), which represent that M is the mother of Y and F is the father of X.respcctivcly Give a Plologrule to define the predicale.,ihling(X, Y),whichrepresents that X and Yare siblings (that is, havc the samc mother and the same . , . tamer). 54. Suppose that Prolog facts are used to define the predicates mother(M. Y ) and fa/her(F, X), which represent that M is themothelof Y and F is the father of X, respcctively Give a Prolog rule to define the predicatc grandfarher(X. Y), which represents that X is the grandfather of Y. (Hint: You can write a disjunction in Prolog either by using a semicolon to separate predicates or by putting thcsc predicates on separate lincs.) Exercises 55-58 alc based on questions found in the book Syrnhr,lic Logic by Lewis Carroll. 55. Let P(x), Q(x),and R(x) be thestatements"xisaprofessor," "x is ignorant," and "x is vain." respectively. Express each of these statements using quantifiers; logical connectives; and P(x), Q(x), and R ( x ) , where the universe of discourse consists of all people. a) No professors are ignorant. b) All ignorant people are vain. C) No professors are vain. 44 11 The Foundations: Logic and Proof, Sets, and Functions d) Does (c) follow from (a) and (I,)? If not, is there a correct conclusion? 56. Let P(.r), Q(r). and R(1-i be the stalements " x is a isian exclear explanation,"".r is salislaclury," and " cuse," r e ~ p r c t i v ~ ISuppose y that the univcrse or discourse lor r consists of all English text. Express cach ol these statements using qu~ntitien,logical connectives, and P i r j , Q(x), and K(.I). a) All clcar explanations are satisCactory. b) Somc uxcusrs arc unsatislaclory. C) Some excuses are not clear explanations. * d) Does (c) lollow from (a) and (b)'! II nut, is thcrc a correct conclu<ion? 57. Let P(.I), Q(LI, R(r1, and S(.rl be thc statements -'r is a baby," "x is logical," " I is able t o mannge a crocodile." and " r is despised," respectively. Supposc that the universe of discourse consists of all people. Express each ol ihdnc statements using qnantlfiers; 144 logical connectives; and P(x), Q(.r), R(xi, and S O . a) Babies are illogical. b) Nobody is despised who can manage n crocodile. C) Illogical persons are despised. d) Babies cannot manage crocodiles. " e) Dues ( d ) lollow from (a). lb). and (c)? 11 not, is there a correct conclusion? 58. Let PIX).Qlr), R(*),and S(*j be the statements '.r is a duck,"-'.I is onc of m) poulrry,""~ ts an officer." and "x is willing to waltz,"respectively. Express each of these statements using quantitierr: logical conncctivcs;and Pi.r), Q ( r )Rir),and S i x ) . a) No ducks are willing to waltz. b) No officers ever drclinc t o waltz. C) All my poultry are ducks. d) My poultry arc not officers. * e) Dues (d) follow from (a). (h). and (c)? If not, is there a correct conclusion? Nested Quantifiers INTRODUCTION In Section 1.3 we defined the existential and uuiversal quantitiers and showcd how they can be used torepresenl n~alhematicalsmtements.We alsoexplained how they can be used to translate Fnglish sentences intological expressions. In this section u e will study nested qunntifiers.whichare quantifiers thatoccurwithin thescope oforherqui~l~tifiers,such asin the statement V r 3 y ( x t y = 0). Nestcd quantiliers commonly occur in tnathematics and computer science. Although ncstcd quautifiers can sometimes be diWcult t o understand, the rules we have already studied in Section 1.3 can help us use then]. TRANSLATING STATEMENTS INVOINING NESTED QUANTIFIERS Complicated expressions involving quantifiers arisc in many contexts. T o understand thcsc statements involving many quantifien, we need tounravel what t h e quantifiers and predicates that appear mean. This is illustrated in Example 1. EXAMPLE 1 Additional steps Aasumcthattheunivzrseofdi~courseforthevuriablesx and y consistsofallrealnumbers. Thc statement VxVy(x+v = v + x ) + + says that x y = ) x for all real numbers x and y. This is lhe commulalivc law for addition of real numbers. Likewise, thc staterncnt Vx3yix t y = 0 ) + Extra Examplcs says that for every real number x therc is a real number y such that x v = 0.This slates that every real numhcr has an additive inverse. Similarly, the statement VxVyVz(x + i?. + z) = (.r + y) + z ) is the associatibc law for addition o l r c a l numbers. 4 I 44 :). 1.4 Nested Quantifiers 45 EXAMPLE 2 Translate into English the statement VxV,y((x > 0 ) A (y < 0 ) + ( x y < 0)). iilc. where the universe of discourse for both variablcs consists of all real numbers. ~ tis, Sohrtion: This statcment says that for every realnumber x and for every real number y,if x > 0 and y c 0. then x y c 0. That is, this statement says that for real numbcrs x and y , i f x is positive and y is negative, then .ry is negative.This can be stated more succinctly as "The producl of a positivc real number and a negative real number is a negative real number." 4 s "X xr." 2ach nec- Expressions with nested quantifiers expressing statements in English can be quite complicated. The first step in translating such an expression is to write out what the quantifiers and predicates in the expression mean.The next step is to express this meaning in a simpler suntence. This process is illustrated in Examples 3 and 4. lot, is EXAMPLE 3 TransIate the statcment V x ( C ( x )v 3 y ( C ( y ) A F ( x , y ) ) ) - into English, where C ( x ) is " x has a computcr," F ( x , y ) is ".x and y are friends,"and the universe of discourse for both x and y consists of all students in your school. Solution: The slatement says that for evcry student x in your school x has a computer or there is a student y such that y has a computer and x and y are friends. In other words. 4 every student in your school has a computer or has a fricnd who has a computcr. r they e used nested :hasin c s and rstand. EXAMPLE 4 Translate the statcment 3 x V y V r ( ( F ( x ,y ) A F(x,z) A (y# z)) + -F(y,s)) into English, where F ( a , b ) means 11 and b nre friends arid the universe of discourse for x, v, and z consists of all students in your school. Solurion: We first cxamine the expression ( F ( x . y ) A F ( x , z ) A ( y # z ) ) + - F ( y , z). This expression says that if students r and y are friends.and students r and z are friends, and furtherniore. if y arid z are not the same student, then v and z are not friends. It follows that the original statement, whichis triply quantified,says that there is a student x such that for all students y and all students z other than y , if x and ): are friends and r and z are friends. then y and :are not friends. In other words, therc is a student none of 4 whose friends arc also friends with each other. srstand ers and umbers. TRANSLATING SENTENCES INTO LOGICAL EXPRESSIONS law for In Section 1.3 we showed how quantifiers can be uscd to translate sentences into logical cxprrssions. However, we avoided sentences whose translation into logical expressions required the use of nested quantifiers. Wc m)w address the translation of such sentences. xis states EXAMPLE 5 4 Express the statement "If a person is female and is a parent, then this person is someone's mother" as a logical exprcssion involving predicates,quantifiers with a univcrse of discourse consisting of all people, and logical connectives. I .a[qwa~ard .illensn S! uo!jnlos lsiy aql'dlluanbasuo3 .salqa!len aql Buoue sd!qsuo!]e[ai aql sa~nasqo iaqmauros J! 'weduos a l o u s! s!qj q8noqilv.,-n uo j uaqel seq m,, s! ( a ' j' m ) aiaqm ~ '(n*'j; I I ) ~ ~ E D A ~ E se passaldxa aq osle plnos luaualels a u ilaA!lsadsal 's?u!p!e [[e pue 'slq8!y aueldi!e Ire 'pliom aq) u! usluom aql Tie jo js!suos n pue ' j' m J ~ asinoss!p J jo sasian!un aq] aiaqm '((u'J)O v ( J ' ~ ) ~ ) J E D A " E se ~ u a m a ~aql e ~ ssaidxa s q ?q ( j ' m ) d 127 :UO!JII~OS ues a h ,;u uo lqBy e s! j , , aq ( u . j ) G pue , , j uayel s ~ (11.. uo lqa!y .;PIJOM aql u! auyi!e .iiana e uayei seq oqm ueuom e s! aJayL.. iuauaiels aqr ssa~dxaox siay!~uenba s n L$?dm3 (.oi:,eru e re jo iqlnoql aq ues i~ ,,iay!manb ssauanblun.. a y L . pue ~ A siay!luenb aqi Bu!sn passa.rdra aq ues leql sluamalejs u!ellas aiu!ssa~dxa~ opueqlloqs j e s! 'iaqjeJ :~ag!tuenbe dlleai jou s! ..iay!tuenb ssauanb!on,, aql'laAamoH 'c u o ~ ~ sjo a s8~ as!:,iaxz~ u! pauyap i,iay!)uenb ssauanb!un.. aql s! i~ alaqm '(d ' x ) g X i ~ xse~mamateis s!ql aj!im uos am leql a l o ~ ) '(((2 'X)g- t (d # 2))2A V (d ' x ) ~ ) ~ C E X A se passa~dx?aq ue3 luaualels 1eu!a!io inoillu?nb?suo3 .(((2 'x)g- # t (iZ))ZAv (X ' i ' ) g ) d ~ se paluasaidai aq ue:, p u a q lsaq auo dllsexa seq x leql luarualels aqj ,,'xjo pua!ij lsaq aql s! d,, luaualeis aql ~q 01 (d ' x ) g alexpald aql a:,npoilu! am U P ~ M'x jo p u a ~ i lsaq j aql lou s! 2 uaqi 'd u o s ~ s dtou s! 2 uosiad j! '2 uosiad d.~ana102 i e q ~'a.romiaqllnj 'pue 'x jo p u a q jsaq aq) s! oqm d uosiad e s! araql leql suearu pua!lj lsaq auo d~lsexaseq x leq) des 01 .aldoad l[e jo sls!sunJ aslno:,s!p jo asiaAyun aqt alaqn ,,(pua!ij lsaq auo d[pexa seq x u o s ~ a d )r ~ ,se, awes aql s! luaualels s!ql leql aas am 'lag!luenb leslan!un aql Bu!snpo~)u~ , , - p u a ! ~lsaq auo dpsexa seq x uosiad 'r unsiad d l a ~ aio.~,. se passaldxa aq ue:, ,,pua!q Iraq auo dlisexa seq auoi~a.\zJ,,r u a u a l e ~ sayL :UO!III~OS .sa~gsauuos~e:,!aol pue 'aldoad lie jn Bu!a!suos aslno:,s!p jo asr?.\!un e ql!m siay!luenb 'sa)e:,!pald Bu!.qo~u! uo!ssaldxa le:,!Sn[ e se ,,pua!q lsaq auo dllsexa seq auodlang,, luaualeis aqi ssaldxg g 3 7 d m 3 b .((d 'X)W t ( ( x ) d v ( X ) ~ ) ) . < E X A uo!snaldxa luale~!nba ue u!elqo ox ' ( x ) d v ( x ) d u! leadde lou saop d asnesaq ' t j q ~ q 01] iem arll IIe d~ a n o u ues aM ' ( ( I ' X ) W ~t E ((x)d v ( x ) ~ ) ) Y A sa paluasa~dal aq ue:, luamalels leu!B!lo ayL,,'.<jo Jaqlou aql s! I,, luasaidal o l ( d ' x ) pue ~ .,'maled e s! x,, luasaldal oi ( x ) d ,,'a[euaj s! x,, ~ u a s a l d a l o l(.i-)d sale:,!pald aq] asnpollu! aM .;d uoslad jo ~aqloruaql s! x uosmd leql qsns d uoslad e sis!xa aiaql uaql'lualed e s! x uoslad pue a l e u a j s! x uoslad j! 'x uoslad L a n a lo.^,, se passaldxa aq ues ,.iaqlou s,auo -awns s! uoslad s!ql uaq) 'lualed e s! pue a r e u a j s! uoslad e j ~ l u, a u a l e s ayL :un!inlos suoq~m J pue ' s l a ~ foold pue ~!aa?:suog-epmo~a u / I 9p 9Fr 1.4Nested Quantifiers 41 147 Mathematical statements expressed in English can be translated into logicalexpres. sions as Examples 8-10 show. me'son y." is a 7 be EXAMPLE 8 Translate the statement "The sum of two positive integers is positive" into a logicalexpression. Additional Steps Sol~aion:To translate this statement into a logical expression, we first rewrite it so that the implied quantifiers are shown: "For every two positive integers, the sum of these integers is positive."Next,we introduce the variablesx and y to obtain "For allpositivc integers x and y , x y is positive." Consequently, we can express this statement as + where the universe of discourse for both variables consists of all integers. :d as ersal best I 4 EXAMPLE 9 Translate the statement "Every real number except zero has a multiplicative inverse." Extra Exa*plcx F the on y. e the d can Solnrion: We first rewrite this as "For every real number x except zero. .r has a multiplicative inverse."We can rewrite this as "For every real number x , if x # 0. then there exists a real number v such that xy = 1,"This can be rewrilten as One example that you may he familiar with is theconcept of limit, which is important in calculus. EXAMPLE 10 (Calculus required) Express the definition of a limit using quantifiers. Solntiori: Recall that the definition of the statement eness ier" is at can ought 4 lim f (x) = L X '0 is: Foreveryrealnumbert > Othereexistsarealnumbe16 > Osuchthat 1 f (x) - LI c c whenever 0 c r - a ] c 6.Thisdefinition of a limitcan be phrased in termsolquantifiers by where the universe of discourse for the variables 6 and c consists of all positive real numbers and for x consists of all real numbers. This definition can also be expressed as world, when the universe of discourse for the variables c and 6 consists of all real nun~bers.rather than just the positive real numbers. 4 NEGATING NESTED QUANTIFIERS ewhat sually 4 Statements involvingnested quantifiers can be negated by successively applying the rules for negatlngstatements involving a single quantifier.This is illustrated in Examples 11-13. '3 2 1 7 - (x)j'I PUc 9 > Iu - XI > 0 leq) qsns x l a q l u n u [ear e sls!xa alaql'o < y laqlunu leal i l a ~ lo3 2 leql qsns 0 < 3 l a q l u n u p a r e S! a l a q l 7 laqlunu leal k a n a 101 l e q l sbes lualu.xets ise[ S!LU '13 2 17 - (y)Jlv 9 > '7 w a q m n u JC~I 1''- 4 > 0)XE O<?A0<3E7A sr: passaldxa aq ueJ ~ualualelss ! y ~'7# (x)J' "'xu~![ 11s 103 suealu ~s!xa IOU saop (x)j' I'+'LU!I lualualels aql asnesag dals lse1 aql o!'D- v d = ( O + d ) aJua[en!nba ~ aq) asn a m ' ( ~ ~ ~ - ( . ) , V ~ > ! D - X ~ > O ) X E O < ~ A O < ~ E = (3> (3 17-(x)j'l > 17- (*)/I +9> t 9 k-x\>OI-xEO<?AO< ID- i XI > ())XA-() 3EG < 9AO < 3E G ( ~ > ~ ~ - ( x ) J ] C ~ > I D - Y I > ~ ) X A O < ~ E - ~ < ~ E ~ (3 > 17-(').II t 9 > In- > O ) X A O < 9EO < 3A- sluaiualols lus[en(nba l o asuanbas s!ql 1snllsuos am 'suo!ssa~dxa pagguenb Buge%au 101 salnr a q l Ou!dldde d[an!ssassns '(3 > 1 7 + 9 > XI 10- > O ) A O < 9EO < 3AL ss passaldxa [ aql '01 aldmexx Su!sn b g .7 # (x)/' "-'LU![ aq ue3 7 # (I)j' " + r ~ ! IU~IU~I~IS '7 s1'.7qlunu Iual 11' 10) l c q l sueaiu p x a IOU saop (x) j' "'-'LU!~ l e q l i s s o l :uolrtilnS .ISLXS IOU saop ( a),! "-'ul![ l e q l l3ej aql ~ s a ~ d (11 r asalos!pald pue slay!luenb a s n ~13 7 d m 3 ,;au![~!e s!qi u o l o u s! lqS![l l a q l l o iqZ!y l o q l uayel i o u seq unulom '((0 :/)o- A ($ 'm)d-)j'~DErll,A 'J)a (4' .*n)d)-j',k,~~ln~ ((0 I\ v (/' ' m ) d ) . l E L ~ E m ~ = ((D'!)a ((0'j)av (/' ' [ I ~ ) ~ ) J E ~ A - ~ A :slualualels j o asuanbas s ! q l ~ oq x a 01 lualcn!nba s!lualualels l n o l e q l p u y am'dals lscl aql u1ME[ s , u e 8 l o ~a a Ou!ilddc b q pue slay!luenb anlssa3sns aprsu! uo!]e%au aql a A o u 01€.I uOuaa~)O 3[qsLLUolj S l u a l u ~ l ~ I S pay!lusnb Bu!lcBau I ~ J salnl aql Burdldde blan!ssa~~ns b g ".o u o ~qY!ye s! J.. s! (D :[)a PUP,,/ uayel seq m..s! (J ' m ) d aJaqmc((n v (,/ ' m ) d ) ~ ' E D A ~ Ese- passaldxaaq un3 lualualcis m o . a~ ~ d m e bx g~ .L aldluexz~l u o l j ,.pllom aql u! au!ll!e k a n a u o iq%!y c uaqel seq oqm ueluom r s!alau,,lualualels aql jouo!~eSauaql s! IuauIalelP S!~LI. :IIO!J~IOS :/)a scq oqm ui!mom e is!xa IOU P ;,O I[ M aql u! au!ll!e d ~ a n au o iq%!y e uaqel saop a i a u , , l e q l lualualels a q l ssaldxa 01 s ~ a y ! ~ u e nabs n ZI 3 7 d m 3 t ' ( 1 # d x ) , C ~ xsc~passaldra a q ueJ lualualels paleYau m o l e q l apnlau(ls am.1 # .Cx ye d[dlu!s aloLu passaldaa aq ues ( 1 = Xx)- a s u ! ~.([ = .CX)LXAXE 01 luale~!nba SF q g m .(I = . i x ) . C ~ - x ~01 luali?h!nba s! ( [ = i x ) X ~ x ~j c-q l p u g a M .s.ray!luenb aq] 11s ap!su! ( 1 = .CX).<E.XAL u! uo!leYau a q l anom ues am '€.I u o ! l ~ a s)o q q e u! ~ uan!% slualualels pay!luenb %u!le%aolo) sa(n.1 aql Bo!bldde i[aa!ssasans L a :rro!rti/oS z sa[dweq .~ay!]uenb e sapasa~duo!lc8au o u l e q l os ( 1 = . L Y ) ~ E X Alualualals aql j o uo!le%au aql ssardxa suo!punj ealra 11 3 7 d m 3 pun 'elas ' j o o q pun ~ ! a o 7:suo!$'epunoj aq& I 8~ 1.4 Nested Quantifiers 49 149 THE ORDER OF QUANTIFIERS - given 111 the lich is ply as I). 4 lo has Extra Examples EXAMPLE 14 Many mathematical statements involve multiple quantifications of pr(lpositiona1 functions involving morc than one variable. It is important to note that the order of the quantifiers is important, unless all the quantifiers are universal quantifiers o r all are existential quantifiers. These remarks are illustrated by Examples 1+16. In each of these examples the universe of discourse for each variable consists of all real numhers. Let P ( x . v ) be the statement "x tionVxV?-P(x. y)? + y = y +x." What is the truth value of the quantifica- Solrrrion: The quantification takcn nt con f3'and ntified ~tificrs valent V.rVvP(x, y) denotes the proposition "For all real numbers x and for all real numbers y,.r + y = y + x." Since P ( x , y) ia true for a11 real numbers x and y , the proposition VxVyP(x, y ) is true. 4 EXAMPLE 15 ~ t sthis , 4 + Let Q ( x . y) denote "x y = 0." What are the truth values of the quantifications 3 j V x Q ( x , y ) and Vx3y Q ( x , y)? Solutiorr: The quantification 3yV.rQ(x, y) denotes the proposition hers L. can be '.There is a real number y such that for every leal number x , Q(.r. y).' + N o matter what value of y is chosen, thcre is ( ~ n l yone value o l x for which x y = 0. Since there is no real number y such that .r y = 0 for all rcal numhers x , the statement 3yV1Q(x, ?.) is false. The quantification + uct this denotes the proposition "For every real numberx there is a real number )'such that Q ( x , y)." Given a real number x , there is a rcal number ? such that x Hence, the statement Vx3y Q j x , y) is true. > 0 such -a\ < 8 4 + y = 0; namely, y = x . 4 Example 15 illustrates that the order in which quantifiers appear makes a difference. The statements 3yVa P ( x , y) and Vx3yP(x. y) are not logically equivalent. The statement 3yVxP(x, y ) is true if and only if there is a y that makes P ( a , y ) true for every x . So, for this statement to be true, there must he a particular value of y for which P ( x . y ) is true regardless of the choice o f x . On the other hand,Vx3yP(x, y) is true if and only if for every valuc of .r there is a value of y for which P ( x , y) is true. So. for this statmmnt to be true,no matter which x you choose, there must be a value of y (possibly depending on the x you choose) for which P ( 1 . y) is true. In other words. in the second case y can depend on x , whereas in the firat case y is a constant independent of I. 1-50 50 1 /The Foundatrans: Logic and R o o f , Sets, and Functions - which P ( x . ? ) i s false. - From these observations, it follows that if $VxPix, y ) is true, then Vx3>'P(x, J ) must also he true. However, if V.r3yP(x, y j ir true.it is not necessary for 3 y V x P ( x , y) to be true. (See Supplementary Exercises 14 and 16 at the end o f this chapter.) THINKING OF QUANTIFICATION AS LOOPS In working with quantifiea t.~ o n s of more than one variahle,it is sometimes helpful to think in ternis of nested loops. ( 0 1 course, if there are irilinitely man) elements in the universe of discourse of some variable, we cannot actu;~llyloop through all values. Ne\crrheless. this way oI thinking is helpful in understanding nusted quantilicrs.) For example. to see whethcr VxV?P(r, y) is true, we loop through the values for x , and for each x we loop through the values for J. If we find that P ( x , J ) is truc for all valuesfor r and y. we have detcrmir~edthat VxVyP(x. y ) is true. If we ever hit a value .r for which we hit a vaIue ? lor which P(.r, y i is false. we have shown that V.rVyP(x, y ) is falsc. Sirnilarly. to determine whether V.r3yP(v. !.) is true. we loop through the values for x. For each .r we loop t h r o u ~ hthe v a l u c f u r y until we lind a ? for which P ( x , y) is truc. If fur all 1 we hit such a y. then Vx3y P(I. y ) is trur:if for some .r we never hit such a y, then Vx3y P ( x . y i is false. To see whether 3xVyP(x, y ) is true. we loop through the values for r until we find an .x for which P ( x . y) is always true when u'e loop through all values for y . Oncc we find such an x , wc know that 3 x V y P ( . ~y. ) is t r u c If we never hit such an x , then we know that 3xVyP(x, y ) is false. Finally. to see whethcr 3 . r 3 y P i x , y j is true. we loop through the values for a. where for uach .x we loop thrc,ugh the values for ? until we hit an x for which we hit ;I y for which P i r . y) is truc. The statement 3 x 3 ~ P ( . ry, ) is falsc only if we never hit an x for which we hit a y such that P ( x . y j is true. Table I summarizes the mcanings of thc different possible quantilicatiuns involving two variables. Quantifications of mc~rcthan two variables are also common, as Esamplc 16 illustrales. EXAMPLE 16 Let Q ( x . y, :) bethcstaternent".r+y = :." Whatarc the truthvaluesofthestatements VxV?3;Q(x. y , :j and 3zV.rVyQ(x. ?, :)? Suliiriutr: Suppose that x and y arc assigned values. Then, there exists a real numher such that .r y = z. Consequently, the quantification + VxVy3:Q(x, y , z ) , which is thc statement z 52 11 The Foundations: Logic and Proof Sets, and Functions e ) 3 ~ 3 : V y ( T ( x , ~ )u Ti:, I)) fJ VxVr3y(T(r, ?) * T ( i , y)) 8. Let Q(.;.y) be the statement "student x has bcen a contestan1 on quiz show y." Express each of these sentences in terms of Q(i, y ) , quantifiers, and logical connectives, where thc universe of discoursc for x consists of all students at your school and for y consists of all quiz shows on television. a) Therc is a student at your school who has k e n a contestant on a television quiz show. h) No student at your school has ever been acontestan1 on a television quiz show. c) There is a studcnt at your school who has been a contestant on JeopnrOy and on Whczrl of Forartre. d) Evcry televisionquizshuw has had astudent lrom your school as a contestant. e) At least two studentsfrom your school have bccn contestants on Jeopardy. 9. L~~ L ( . ~ , be [he statement ui loves ?,n where the universe o l discourse for both x and ? consists o l all people in the world. Use quantifiers to express each of these statements. a) Evcrybody loves Jerry. h) Everybody loves somebody. c) There is somebody whom everybody loves. d) Nobody lovcs everybod). e) Therc is somebody whom Lydia does not love. fJ There is somebody whom no onc loves. g) Thcre is exactly one person whom cverybody loves. h) There are exactly two pcople whom Lynn loves. i) Everyone loves himself o r herself j ) There is someonc who loves no one besidcs himsell or herscll 10. Let F(r, y ) he the statement "1 can fool y," whcre the universe o l discourse consists of all people in the world. llse quanlitiers to express each o f these statements. a) Evcrybody can lool Fred. h) Evelyn can fool everybody c) Everybody can fool somebody. d) There is no one who can fool evcryhody. e ) Everyone can be foolcd hy somebody. f) No one can fool both Fred and Jerry. g) Nancy can fool exactly two people. h) There is cxactly one person whom everybody can lool. i) No one can fool himself or hcrself. j ) Thereis someone who can loo1 exactly one person besidcs himself or herself 11. Let S(s)be the predicate "r is a student," F i x ) the predicate "x is a faculty member," and A i r . ? ) the predicate "s has asked .r a question." wherc the universe of discourse consists of all people associated I - 1-52 with your school. Use quantifiers to express each of these statements. a) Lois has askcd Professor Mlchaels a question. h) Evcly student has asked Professor Gross a ques- tio, c) Every faculty member has either asked Professor Miller a question or been asked a question by Professor Miller. d) Somc student has not asked any laculty member a question. e ) There is a faculty member who has never been asked a qucstion by a student. fJ Some student has asked every faculty member a question. g) There is a faculty member who has asked cvery other faculty member a question. h) Some student has never bcen asked a question by a faculty member. 12. Let I(.r) he the statement "r has an Internct conneclion" and Cis,?) be the statement "I and y have chatted over the Internet," wherc the universc o l discourse lor the variablesx and!; consistsofall students in your class. Use quantificrs to exprcss each of these statements. a) Jerry docs not have an Internet connection. h) Rachel has not chatted over the Internct with Chelsea. c) Jan and Sharon have nevcr chatted over the Internct. d) No one in thc class has chatted with Bob. e) Sanjay has chattcd with everyone except Joseph. 0 Someonc in your class does not have an Internet connection. g) No1 everyone in your class has an Interne1 connection. h) Exactly onc student in your class has an Internet conncction. i) Everyone exccpt one studcut in your class has an Internet connection. j) Evcryone in your class with an Internet conneclion has chatted ovcr the Internet with at least one other student in your class. k ) Someonc in your class hasan Internet connection but has not chatted with anyoneelse in your class. I) There are two students in your class who havenot chatted with each other o v a the Internct. nl) There is a student in your class who has chattcd with everyone in your class over the Internet. n) There arc at least two students in your class who have not chatted with the same person in your class. n) There are two students in the class who hetween them have chattcd with everyonc else in the class. 33. ~~t M(+, ?) he has sent an e.n,ai] messagev T(x. ?) bc " r has telephoned y," whcre the universe 'roleri3!u!mpe m a i d s 141 101 l d a ~ x ar u a ~ s i s aql uo lasn i r 2 z a j o plowssed aql smouq auo O N (a -q~om]au341 uo slu!odpua om] Alan? Bu!la~uuoasqled om1 ]sea[ le ale a l a u ( p 'paslru -01dmna uaaq lou seq IEql ssasold e S! ac-lql j! i [ u o puej! q x a r q l e q l ~ a a ~ uesleq) ap ms!ueqsam a u o iseat l e s! alaql qaealq dl!lnaas dcana log (a 'malsis aql uo lasn i ~ a n iaq was a8es -sam auo )sea[ l e su!eluns an!qale aqi lanauaqm pana!rlal a q uea Iasn k a n a jo s s x p p r [!em-a a q l (q 'uo!~!puos i[nej d ~ a n a Su!~np a[q!ssasse aq lsnm alosuoa auo i s ~ a [1v ( e hressa -Jauj!'san!lsauuos [es!%olpu1!srag!1uenb'sa1e3!pa1d Bu!sn suu!~esg!aads m a ~ s h sasaq] jo qsva ssaldxa .RI 'tanlas alomal i l a n a ml!uomieql s m ~ ~ sOM1 i s ipaer;l aie a r a q l ( p * 'uo!sua1r2 npa' e seq [In asoqm Sa)!sqam Yu!yrom s! 13~127aqi j! ~ [ Usuu!r!puoa O 1011a 118 Su!lnp unr ol sanu!moa leql s s a s o ~ dv s! a r a q l ( q .xoql!eru auo .<[laex?o] ssaaae seq lasn Oa,\g (e .iressasau $! ' s s n ~ ~ s a u u o1831401 s pue 's~ay!luenb 'salea!pa~d B u y suo!laay!3ads maisis asaql jo qsea ssaldxa .LI .roiem leq) ql!m i p n ~ jo s leed hia,\a u! ssep aql u! iuapnls e s! alaql teql qans l o l e u e s! a l a q l (a 'rolem aauaps ralndmoa u ro aromoqdos e 1aq1!a s! ssep aql u! luapnls i l a , \ z [p 'lo!unl e IOU JU[EUI sa!~emaqlem e laqpau E! oqm SSEP aq] U! luapnls e s~ a l a q l (3 -rolem aauaps r a ~ n d m o se SI ssep aql u! luapnls hra,\q (q . ~ o y u n l es! oqm ssels aq1 u! luapnls P s! a l a u (s . . . . -ap uaql pue slay!menb jo s m l a ~u! sluarua)els asaql jo q3ea ssardxq .lo!uas e s! oqm ~ o l e maauaps ialnd -moa 1 pue's~o!un! are oqm slojem aaua!3s ralndmoa ; ' s ~ o ~ u n l aoqm ~ e sloleru sa!lemaqlem ~ ' s a l o m o q d o s 2re oqm s ~ o k m aauaras ialndmo3 ? < I .'sa~omoqdosare oqmsrolem ssgemaqlem -,I 'uemqsaq e s!oqm~olem sa!lemaqiem 1su!eluoa ssels s3!lewaqlem alans!p v .91 .mdmea u o Bu!p[!nq i.la.\a jo moo^ auo IseaIle u! uaaq s e q s s e p s!ql u ! l u a p n ~ s i l a h a (8 .sndruea uo Su!pl!nq auo lseal l e jo moo^ k a n a u! uaaq svq oqm s s e p s!ql U! l u a p n ~ se s! a l a u o .sndmea uo au! -p[!nq i ~ a n u! a uaaq seq ssep s!ql u! luapmsdrana ( a .aJua!ss 1alndmo3 u! aslnoa auo ]sea[ l e uayel seq oqm ssep s!ql u! l u a p n ~ se s! a r a u ( p - x i n o s asua!ss ~ a l n d m o a auo ]sea[ lo uayel seq ssep 2141 U! luapnls .(ran3 (a .ralndmoa Teuos -lad a sumo oqm ssep s!q] u! l u a p n ~ se s! a l a u (q 'ss!lemaqlem aralsslp u! aslnos e spaau luapnls asua!ss 121ndmos i l a n a ( e -siuamalels asaql ssardxa 01 a[q!:!reh auo ueql alom ql!m sales!pald pue s~agliuenba s n .ST .dno18 reqs s u o iseq i r u! l u a p n ~ laqio s auo )sea[ le qllm palleqa seq sselss!q~u ! l u a p n l s i ~ a n a (8 'ssep s!ql u! luapnls laqln auo ipsexa st. umol amps 241 u! dn ma14 ssela s!q] u! luapnls a m o s (1 '10oqsc s1q1 UI s~uamlledapaqi l o auo dq palajjo aslnoa L I ~ -na uayel seq oqm ssals slqi u! iuapnls e S! a r a q l ( a .azenaue[ 4u!mrue~%old ~ u rsealie o pauleal aneq ssep s!ql ui sluapnls 1 1 (~p '!!eMeH pal!S!A lUU SUq Inq eyseTv pal!s!n seq sse[s 5141u! luapnls JWUS (a . ~ . ~ oamos d s siald ssep s!ql u! luapnls hrana (q '!Pu!H yeads ues oqm ssep s!qi u! luapnls e s! alaqL (e .sluamalels asaql ssaldxa 01 aTqe!leh auo ueql alom ~ I ! M sa)e3!pald pue sray!)uvnb a s n .pl .ssels a q u! ~ as[a auodlana pauoqd - a [ a ~10 01 a4essam [!em-a ue was aneq maql uaamlaq oqm sselalnoi u! sluapnls om] ale a l a u (u .luapnls isrq aql pauoqdala~seq luapnls puusas aql pue [!em-a iaqlo aql was seq ~ u a p n l s2uo 1cq1 qans ssep r n o i u! sluapnls owl lsea[ l e all? a l a q l (IU s s u p aql u! luapnls laqloue m o q l l c ~auoqda[al e pan!asal ro a4essam [!em-a ue pan!asal laql!a seq ssels aq] u! lu2pnls Alan3 (1 ' s s e l ~241 u! luapnls rrrqlo i u a i q paljes uaaq I O U svq oqm put? sscp aq] u! as[a auo.iue u o l j aBessam ~!vut-aue pa,\12s -a1 IOU seq oqw sse[a lnoh u! luapnls e s! alaqL (1 .aZersam [!em-a ue jlaslaq r n ]lasm!q luas seq oqm l u a p n ~ sI?s! a1aq;L (I 'sa4cssam [!em-a i?q)o qsea luasanuq oqm s s e l ~ i n ou!i sluapn~som]are alaqL (! .sse[s Inoh u! asla auodlana pauoqdalallo alessam (!em-a ue ~uasraq~!aseqoqm s s a p l n o i u ! 2 u o a m o s s ! a 1 a ~ (q .a4ess2m [!em-a ue ssap l n o i u! asla auoica -na I U ~ Sseq oqm ssep m o d u! luapnls e s! a r a u (8 .a4essam [!r!m-a ue m!q luas I n !,tvpauoqdapl ~ a q ~ seq ! a sse[s (nod u! a u o i l a n a (1 'eU!N pauoqda[al seq see12 l n o i u! rruo ON ( a - u a y 01 aaes -sam[!em-aueruasseqssep~noiu~~uapn~si~anq (p 'qeloqq molj a4ess?m [!em-a ue paA!aaal lanau seq asor (a .~P.IES pauoqda~~~ 10 ol a8essam [!em-a ue luas rahau seq a u a p v (q .oqo>~01 a2vssam [!em-a ue )"as lanau seq n o 4 3 ( e (yam uayn sau!ql dem aq] IOU st qqqm.pah!aa -a1 a l e luas alam ~ e q sa4cssam l [!em-a 11weq1 awns F V ) . S I U ~ ~ ~ asaql I P I Sl o qJe2 ssaldxa 01 slay!luenb as,] .sse~smod u! sluapnts [le jo sistsuo3 aslnoas!p jo r n o i ul U' oqm ssep 'lau~ pJllEq3 Sl 'la lou ?neq I 'ssep rno ~0!133UU ue seq ss x a q l J' sluapn -s!P JO aneq -uos 1 dq un! Lrana 'sa~eu! -pard a p a ~ a r dKfale!pamm! sloqmis uo!~e;iau [la l e q ~ os s~ualuare~s assql jo qJea jo suo!ieZau aql ssardx3 'ZE (P - ((8i'.)a (c ' x ) d ) d E . T 4 ( ( 2 ',( ' l ) g ? v ~ (iC ' x )J ) A E I A ( X . X ) ~ ~ E fiY (AS ' X ) ~ ~ E ( 2 ' , iZ ) L L A X E I A (3 X(qA (B .sa~ea!pald apaaaid Klale!pamm! s ~ o q m i suo!)e8au [is leqr os s~uamaleisasaql jo q3ea jo suo!ls8~uaqr ssaldx3 .I< ((2 ' d ' I ) / l i A ' .i ~, (2 '< ' ~ ) J ~ E Y A ) . < ' ~ (a ' ( ( X ' r ) S X A A l i ' l ) x l - ~ ) , < E - (P ( ( ' x ) ~ - r ~( Xv j a j , < ~ - - (J ( . i ' x ) d < i ~ x ~(q( , i ' x ) d r ~ X E(e~ -(s~n!~~auuoa [e3!901 Bu!nlonu! uo!ssardxa ue l o lay!iuenb e aptslno s! uo!l -e%auou ruqlos.s! 1eql) s a l e ~ ! p a ~u!~I!,c~([IIo d s~adde suo!1e8au l e q ~os sluamalels asaqi l o qsea al!lMax 'Of (,< ' r j d C ~ r &(J (C.r)dYE"A (p ( i ' r ) d i ~ (q x ~ (.< ' x l d a x (e ~ .SUO!PUII~UOJ pue suo!laun[s!p 8u!sn SO<I!I!S -odold asaql ]no a l ! ~ ~ \I 'Ot Z ' I s! i pue t r o ' ~ ' 1s! x alaqm'd pup r s~!ed~ O S I S ! S O ~(.i I ~ ' I ) J UO!IJU~~[I?UO!I asoddns '62 -!sodold aql 10 aslnms!P lo asJaA!un + (c/(.r' I) = Z)L-E,(AXA (f (1 = i - q v = X x ) , i ~ x(!~ ( $ = . < ~ , + x z v z = ~ z + x ) A E x E (q + ( [ = d + x j . i ~ x(% ~ ( 1 = ,ir + 0 # .C).iqx& (1 ((1 = i r ! i E e 0 # X ) X A ( a i r + X # d + x ) l ~ (p r ~ ( 0 = L x ) 0 , x ~(J (.i= Z r ) A ~ (B x ~ (; =i X ) ~ E X A(q slaqlunu [ear IP yo sls!suou a[qe!ren q x a jo asrnoas!p jo aslan!un aql J! sluamalrisasaqt ~oqaea~oanre~~q1nllaqlau!~ulaIaa '8Z + (z/(u w ) = ~ ) ~ E W A ? I A(! (i = w - u v P = w U ) U I E U E (q ( [ = w - u v p = U + U ) U < E ? ~ E(2 (9= r ~ + z " ) u (J~ (~s = ~ i"f+ (0 = (u' = UdU)U<AUE (p :. ''1 + i u ) u d ~ u(a~ + u),UEUA (3 (ur > ; t c ) u < ~ v(e~ (:ru u ) w ~ (q u ~ .sra2aju! 11" JO s1s1suoa salqelren ~ [ w o yasmoss!p yo asran!un aql y! s ~ u a m a mosaq~ ~ s jo qsnajoan1v?hqlnn aql a u ~ u r a l a a'LZ (a ' ~ j a i (!~ x ~ (.i ' r ) a . s ~ (q d~ (,( ' x ) ~ I - A . ( E (8 ( C ' ~ ) O ~ E0~ A( ~ ' I ' ) ~ ~ A E(a X E ( Z ' " ) a X E (P ( O ~ Z ~ (4 O ( I ' 1 1 6 (8 i,mnIeA qjnn aql ale leqms~a%alu! IIeyo qs!suoa salqe!ren q ~ o IOJ q aslnoJs!pjo asran!un aql31,;" x = A + x,, lualualels aql aq ( I ' , ) a 1 4 7 .9Z =X (2 -x j ~ ~ (pi ~ ((i > I-) s i (,i < ;r))dEXE x ( ( 0 < .(xi + ((0 > " )VO > r j l l h ~( q~ (= i,iX)a),X'E (e -sraquriu [ear Ile 30 sls!suoa sea qaea U! aslnoas!~jo aslan!un a u . I J ~ Jles!leuaqiem e sassaidxa l e q ~ ~ u a r uqu112u3 ~~e~s ue olu! suo!leoy!]uunh paisau asaqljo qsea alelsuerl 'SZ (0 # .<I v ( o # O ) . < A ~ A(P ((0 # .irj ei > > (10 < i - X) v ( ( 0 4 ) v ( 0 X ) ) ) ~ E X E(J ( 1 0 < L x) + ((0,. i j \ (0-: r j ) ) . i ~ I(q~ ( A = d + x ) , i ~ . t( ~ e 'slaqmnu [ C ~ I 11" jo sls!suos aseo qsea u~aslnoas!p jo aslan!un a u .jsej les!reruaqlem B sassa~duel s q ~ I U J U J ~ I R I P qa!14u~ ue o l u ~suo!leagr~uenbpaisau asaql jo qsea a l e p u e q .QZ mqmnu leal B S! 10q1loo1 alenbs e aneq IOU saop raqmnu [eal aa!ieZau V (p .nulor alenbs an!l!sod hIan3 (J oml ~llJex.75eq laqmnu Iaqmnu leal e JO aouar?g!f a u (q 'ah!]! '0132 S!J[~EI! PUB -sod s! sraqtunu leal a~!lelauom1 jo 13npold a u (e .sloleiado [ea!iema -rll~rnPIIR.S~A!~JUUOS 1e31801'slay!1uanb'sales!ps1d ~u!snslua~ualelsl e ~ ! l ~ t u a q l easaqljo m qaea s s a ~ d x a.EZ .sa~enhs aarql 10mns aql IOU st leqi la%alu!ah!l!sod e s! araql reql luawalels aql ssaidxaol s ~ o i e ~ a d o ~ u a ! ~ e t u a q ~ ~ m PUP 'sal\!laau~05les!iiol '~lay!luenb ' s ~ r ~ ~ ! p a ls d ( l 'ZZ ~a8a]u! i n o ~ ~ o s ~ r eanqblsp u n s aql s! ra5alu! a~!l!sodLraaa leql luamalels aql ssa~dxa01 srolerado ~ea!~emaq~em pue 'sa,qaauuo= 1n3!‘20(.~13g;1uenh ' s x ~ ~ ! p a rasn d .IZ .s~adalu!asaql l o sanlen alnlvsqe aql jo runs aqr pmsxa I O U saop s~alaru!o n l jo cuns aql jo anlen aln[osqe a u .an!le%au K~!iessa s a u lou s! sla%alu!an!lu%auom] jo asualajylp a u .~n!l!sod r! sra%a]u!an~ltsodom1 yo a4elane a u .an!l!sods! siaZalu! an!re#au omlyc i ~ n p o l da u (p (J (q (e sia8alu! 11" jo sls!suos asino3s!pp) aslanlun aql sraqn volala -do 1ea!1etuaqiempue'san!laauuou les18o['siay!1uenb 'sa,ea!pa~d Bu!sn s~uamarelsasaql yo qaea ssaldx3 'OZ .sanlen alnlosqe rlaqi yo lanpold a q s~! slaJalu~om1JO lanpold a q yo ~ anlen ainlosqe a u -mns l!aql jo alunbs aql or lenba l o ueql ral~a18s! sraBazu! o a 30 ~ sarenhs a q yo ~ tuns a u .an~l~sod 61!1essa -aau IOU s! s ~ a B a ~an!l!sod u! om1jo a ~ u a l d ~ a~ ! up .aa!le%aus! sralalu! an!)~8auOMI jo tuns a u (p (J (q (e -a),! lie 10 sls!sum asinoas!p jo as.lan!un aql aiaqm J ~es!So[pus la3 ~ 'siay!luenh pue ' s a ~ e ~ ! p w'5~oleradn -!ie~uaq~sm %u!sn siualualels asaql yo qaea ssaldx3 .61 (J :a-uo!lepunod srro!+und pue 's?aS'Joozd pun 11 ~9 f X ) a X E t ( X I d X E (3 ( ( ~ ) O X A A( x ) ~ x A ) - (q .s~ay!luenb kue %U!A~OAU! IOU uog!sodo~d e s! v alaqm 'v A ( x ) O r ~A ( x j d x ~ (e (.uo!laas s!q) u! gppue pp sasps3xzpue'E.I uo113a~u1 g p z p sasFalax3 '£'I uo!l3aS u! alqeL'z'1 uoyaaS u! y pue g salqeL ma13 33u3lehlnba le31801 a s n : I U I H ) .mi03 Iemlou x a u a ~ d u! s ~ u a m a l e ~as s a q ~ ind .gp, z .13e3 s!ql 30 J O O I ~e IOJ syse ~p aspsax3 .mloj [emsou x a u a ~ du! luamalels e 01 lua[eh!nba ST s~ay!luenb pue sah!13auuo3 1e3!2ol Xulsn 8 pue '1'salexpa~d'salqe -!let, l e u o ~ ! s o d o ~ dmoq pamloj ~uamalelsk a h 3 ' ( 1 ~ In330 1~ Ile lou op nay!luenb aql a3u1s) lou s1 ( x ) a x ~A ( x ) d x ~ sealaqm 'mloj 1em1ou x a u a ~ du! s! ( ( ( ) a v (' i x ) d )LAXE 'aldmexa ~ o d.s1ay1luenb ou Bu~n[onu! ale3!pa1d e s! ( ~ ~ , . . . x. )rd pue '~ay!luenb[es~an!unaql l o ~ay!luenb (e~luals!xaaq] iaql!a s1 'y ' ' ' ' 'Z '1 = !"a q3ea alaqm YqX'' ' ' r a ix[a . . ,-LX v ~ ) ~ ~ ~. zxza m.103 a q l j o s! I! 3! k1u0 pue j! ( 8 ~ d mioj ) lemiuu xauaid u! s! 1uama)els v (.( = x t .d = , X ) ~ A X A (e .s~a%alu! Ile jo sls!suoa sa[qe!leh [IE IOJ aslnoa -s!p 30 aslahrun aql a ~ a q m 'slnamalels pay!luenb klles -lah!un asaql 01 'alq!ssod j! 'aldmexa~alunoaE p u y .LE s n d m ~ uo a Xu!pl!nq h a h a jo moo.^ auo ispa[ 1e u! uaaq seq oqm ssep s!q) u! luapnls e s! a l a u (p '1ooq3s s!ql ie palajjo aslno3 s ~ ! ~ e u a q l e m k 3 h a uayel seqoqm sseps!ql u1luapnls e s! a l a u (3 .1a)nduo3 P uaas lahau seq oqm ssep s!ql U! luapnls e S! a l a u (q .s3!lemaqleu say![ ssep s!q] UI luapnls ksahx (e qs![Xux u! pue 's~ay!luenb B u y suo!~!sodo~dasaql jo suoge8au aql s s a ~ d x x'9~ 'uo3ea u!han ql!m a!hom e u! uaaq seq o q a u o a u o s q ~a! !~h o u ~u! u3aq seq so u o m a ulhax ql!m a!noue u! uaaq .saql!a seq s o l ~ 3!nomksanx e .sekelem -!H aql u! u!elunom k a n a paqm!(> seq auo ON .ekq17 ida3xa ppom aq] u! k ~ u n ko~~a n apa]!s!n seq auoamos '1ooq3s s!ql le sassep s3!1emaqlem om] klpexa uaye] s ~ ssep q s ~ qu!l luapnls k a n x ~ (p (3 (q (E (,:~eql as-3 aql IOU s! II,, SPJOM aql .cc;oa A ( x I ~ I C E X A asn L~dm!s IOU o a ) .qs!~4ua aldmrs u! uo!le8au aql 0) lua[en!nba s! ( x j a x ~ A I X ) ~ X A leql moqs (q ssa~dxa' i x a ~'~ay!]uenb e jo ljal ?q1 01 s! uo!le4au xcoa v ( x ) ~ ) ~ E x A ou leql os ~uamalelsa q l j o no!le8au aql m1o3 uayL 01 ~ua~en!nba s! l x j a x v~ I X ) ~ X A 1eq1 moqs (e .spt .s~ay!luenb2u!sn sluamalels asaql jo q3ea ssaidxz 'SE ('klpa1103 suo!)eay!luenb aq) au!qmo3 o l .yooq s!qljo uog3as k ~ a pasn s! L aIqe!len mau ayL) .)ualen!nba k[le3!Xol ale -ha u! a s y a x a auo ]sea[ le panlos seq luapnls ON (a ((.la A ( x ) ~ ) ~ APug ~ A( X ) a X A A ( r ) d X A leql MoqS 'bb* .anlen qlnll awes aql aneq (d 'x)d-XEXA 'xooq s!ql u! as!xaxa k a n a panlos seq luapnls a u o s (p pue ( L ' x ) d i ~ x ~ sluau?lels om1 aql p q l MoqS 'Ep 'ssep s!ql u! sluapnls ~ a q l oom] .slaqmnu p a l olazuou aq] (3 k113exa 01 [!em-a was seq ssep s!qi u! lu?pnls ON (3 .slaXalu! aq] (q .luapnls ~ a q l oauo kp3exa ql!m x a q m n u 1ea1 an!l!sod aql (e pa11eq3 seq oqm ssep s!ql u! luapnls e s! alayL (q 30 SIS!SUO~ saTqe .k~allo[aq] Bu!ke~d -pen a q l i o j assno3s!pjo aslan!un aqlj! (,h 5 X);(AXE sle[[op puesnoql auo ueql alum lsol seq auo ON (e luamalels a q l j o anIeh qlnll aql au!mlalaa .zp (,,'leql ?se3 aql IOU s! ]I,, SPIOM aql .slaqmnu leal ah!]!sod aq) (3 asn kldm!s lou o a ) .qs!l2ua a[dm!s u! uogeXau aql .s1a8aju! olazuou aql (q ssa~dxa,lxaN .~ay!luenb e $0 ]$a1 aql 01 s! uo!le8au 'naqmnu leal o ~ a z u o uaq) (e ou leq] os ~uamalelsaql jo uo!leXau aql mloj u a u .slay!luenb 8u!sn sluamalels asaq] 30 q3ea s s a ~ d x x. p ~ $0 sls!suo3 salqr? -!leh aq11oj aslno3s!p 30 aslagun aql J! ( 1 = X x ) i ~ x ~ ((2 'A ' x ) ~ L A Z EV (2 'A 'X)~ZA.(E)XA- (a luamalels aql jo a n p h qlnll aql au!uualaa i p (I.( ' x ) a i ~ x (X'xjd-,<ExE)~ v (p .slaqmnu leal ~ ouo!)!ppe j lano uo!)e3![d!)lnm ffd 'x)O A ' x ) ~ ) x A ~ A - (3 l o s m e ~ahpnq!la!p aql ssa~dxa01 s~ay!]uenb a s n .gp (X ' x ) d x ~ d ~ (q (X ' x ) ~ . < A x A - (e .slaqmnu leal $0uo!)e3qd!) .(san!l3auuo3 le3!80~ -1nmlojmel ah!]e!3osse aql s s a ~ d x a oslay11uenb l a s n .6~ Xu!n[onu! uo!ssa~dxa ue l o ~ay!luenbe ap!slno s! uo!] (id # , X ) ~ A X A (2 -eBauou 1eq1os's!leq~) sa]e3!pald u!q~!mk~uoleadde ( 0 0 1 > x - , ~ ) L E X A (q l C 1 1 = ~ I ~ (e EXA suoge2au ieql os nuama,els asaql jo q3ea al!lman 'EE .sia8a)u! [ ~ $0 e slsrsuo3 salqepeh [[e 103 aslnoa ( ( i ' x ) a A (2 ';( c ~ ) ~ ) (p ? ~ ~ ~ i ~ -s!pjo aslahrun aq1 a~aqm's~uama]els pay!]uenb Llles I ( x c ~ l a ( L ' X ) ~ ) ~ E X (2 E -lah!un asaql or 'a~q!ssod j! 'a[dmexa1aluno3 e p u g ( 'i x ) a X ~v x ~( 'i x ) d i ~ x(q~ ( 2 '. 'x) i JXA.<AZE (e - (X 2 . < X ) ~ A X A (2 ( X = z L ) . < (q ~ ~ ~ 56 1/The Foundations: Logic and Proof, Sets, and Functions I **47. Shuw how to transform an arbitrary statement to a statement in prenex normal form that is equivalent to the given statement. 48. A real number .r is called an upper bound of a set S of real numbers if r is greater thau or equal to every mcmher of S. The real number r is called the least upper bound of a set S of real numbers if r is an upper bound of S and r is less than or equal tn every upper bound nf S:if the least upper bound of a set S exisls,it is unique. a) Using quantifiers.express the fact that r is an upper hound of S. b) Using quantifiers, express lhe fact that r is the least upper hound of .S. *49. Express the quantification 3 ! x P i r ) using universal auantitications. existential ~uantitications.and loci" cal opera tors. The statement lim,,,, u,, = L means that for every positive real number c there is a positive integer N such that in,, - LI < c whenever n > N. 50. (Calculus required) Use quantifiers to express the ,a,, = L. statement that lim,,, 51. (Calculus required) Use quantifiers to express the statement that lim,,, a,, does not exist. 52. (Calculus required) Use quantifiers to express t h ~ s definition: A sequcnce lu,,) is a Cauchy sequence if for every real number c > 0 there exists a positivc integer N such that la,. - a,,(< c for every pair of positive integers rrr and n with rr1 > N and n > N. 53. (Calculus required) Use quantifiers and logical connectives to express this definition:A number L is the lilttit superior ofa sequence {a,,I if for evcry real number r > 0. a,, > L - c for infinitely many n and a,, > L + c for only finitely many n. I. Methods of Proof <* p p p p p p p p - INTRODUCTION Links Two important queslions that arise in the study of mathematics are: ( I ) When is a mathematical argument correct'! (2) What methods can be used to construct mathematical arguments? This section helps answer these questions hy describing various forms of correcl and incorrect mathematical arguments. A theorem is a statement that can be shown to be truc. (Theorems are sometimes called proposiriorrs fncts, or res~ilfs.)We demonstratc that a theorcnl is true with a sequence of statements that form an argument,called a pronf.Toconstruct pn)ofs,methods are necded to derive new statements from old oncs. The statements uacd in a proof can include axioms or postulates, which are the underlying assumptions about mathematical structures, the hypotheses of the theoren1 to be proved, and previously proved theorems. The rules ofinference,which are the means used to draw conclusionsfronl other asertions, tie together the stcps of a proof. In thissection rules of inference will be discussed.This will helpclarify what makesup a correct proof. Some common forms of incorrect reasoning, called fallacies, will also be descrihed. Then various methods commonly uscd to prove thcorems will be introduced. The term5 lemnra and curollary are used for certain types of theorems. A lemma (plural lemmas or lemmata) is a simplc theorcm used in thc proof of other theorems. Complicated proofs are usually easier to understand when they are proved using a series of lemmas, where each lemma is proved individually. A corollary is a proposition that can be established directly from a theorem that has been proved. A conjecture is a statemenl whosc truth value is unknown. When a proof of a conjecture is found, the conjecture becomes a theorem. Many times conjectures are shown to be false.so they are not theorems. I h e methods of proof discussed in this chapter are important not only because they are used to prove mathematical theorems, hut also for their many applications to computer science. These applicalions include verifying that computer progranis are correct, establishing that operating systems are secure, making inferences in the area of artificial 1.5 Methods of Proof 57 intelligence, showing that system specifications are consistent, and so nn. Consequently, understanding thc techniques used in proofs is essenti;~lboth in mathematics and in computer sciencc. osithat RULES OF INFERENCE We will now introduce rules of infercnce for propositional logic. These rules provide the justification of the steps used to show that a conclusion follows logically from a set of hvpotheses.The tautology ([)A ( p + q ) ) -+ q is the basis of therulc of inference called modus ponens, or the law of detaehment.'Ihis tautology is written in the following way: this ce if itive il. of 1. conthe turnand j Extra E:xample Using thisnototion,the hypothesesarewrittenin a columnand theconclusion helowa har. (The symbol :, denotes "therefore.") Modus ponens states that if hoth an implication and its hypothesis are known to he true. then the conclusion of this implication is true. EXAMPLE 1 Suppose that the implication "if it snows today, then we will go skiing" and its hypothesis, "it is snowing today," are true. Thcn, by modus ponens, it follows that thc conclusion of the implication,"wr will go skiing," is true. 4 EXAMPLE 2 Assume that the implication .'if n is greater than 3, thcn !I' is greater than 9" is true. Consequently, if n is sreater than 3, then, by modus ponens, it follows that n Z is greatcr than 9. 4 Tahle I lists some important rules of infcrcnce. The verifications of these rules of inference can be found as exercises in Section 1.2. Hcre are some examplcs of arguments using thcsr rules of infrrsnce. timcs a sethods d can atical rems. tions, :es up Iso he uced. ?mma brems. ; a se~sition ure is d , the ey are EXAMPLE 3 Sulufion: Let 1) he the proposition "It is below freezing now" and q the proposition "I1 is raining now."Thcn this argument is of the form .'. p v q 7his is an argument that uses the addition rule. EXAMPLE 4 4 State which rulc of inference is the basis of the following argument: "It is below freczins and raining now. Therefore, it is hclow freezing now." Solution: Let 1)be theproposition"1t is below freezinpnow."and let q he the proposition "It is raining now."This argument is of the form phq .'. p This argumcnt uses the simplification rule. EXAMPLE 5 e they I comJrrect, tificial State which rule of inference is the hasis of thc following argument: "It is below freezing now. Therefore, it is cither helow frccdnp or raining uow." State which rulc of inference is used in the argument: If it rains toda): thcn we will not havc a harhecue today. Lf we do not have a harhecue today. then we will havc a barbecue tomorrow. Therefore, if it rains today, then we will have a harbecue tomorrow. 1-58 58 1 /The Foundations: Logic and Proof, Sets, and Functions TABLE 1 Rules of lufereuce. Rule of Inference - Tautology - Name - a P .'. + (P Addition 4) V p vq ( P A Y) "P Simplification .'. p - P .'. p ((PI fi. A iql) + (PA4) Conjunction q - Moduu ponens 1-4 P - ,- 'l ,? (P + q )A (q [(p qi - :. p +r P '/ 4)1 " - p - r ) ] i( p L(P "Y) "'PI r) ‘ 4 .'. q [(P v q ) P"4 -pvr .'. 4 Hypothetical syllogism - Y 'P I Modus tollens A (-p v r)l Disjunctive syllog~sm - (q v r ) Rcsolutiori qY!-_L---Solurion: Let p be the proposition "It is raining today," let q he the propos~tion"We will not have a barbecue today," and lct r be thc proposition "We will have a barhecue tomorroa."Than this argument is of thc form P'cl q +r - :. p + r Hence, this argument is 3 hypothetical syllo,'"ism. 4 VALID ARGUMENTS .An argument form is callcd valid if whcnevcr all the hypotheses are true, the conclusion is also true. Conscquently, showing that q logically follows from the hypotheses P I , p l . . . . p,, is thc same as showing that the implication . ( P I ". p2 A ... A I),,) - y is true. When all propositions used in a valid argument are true, it lcads to a correct conclusion. H0wever.a valid argument can lead lo an incorrect conclusion ifone or more false propositions arc used within the argument. For example, 5 pue p sdals 8u!sn ms!8o[lKs l e ~ ! l a q l o d i ~ s!s>qlodi~ E PUe Z sdals 8u!sn ois!8o[[As l e J ! l > q l o d i ~ s!saqlodi~ 1d?ls 10 ~+1i!sodcsluo3 s!saqlodi~ uoseaa s t bs t r r t bL r t dd- t bb t d . .g ' ~ .p .E 'Z 1 ~J$S -uo!m[~uo:,pallsap a q l o l peal sasaqiodiq i n o leql smoqs w ~ oluawnX~~! j s ! ~ .s t b- s! uo!snl:,uo:, pal!sap 2 ' ~.S. + 1puc .J d-.b d a l e sasaqlodLq aql ua~.;paqsaqal8uyaajdnayem [[!M I.. uo!~!sodnid aq, s pue ~.'L[IFJ daals 01 08 IT!M I.. u o t l ~ s o d o ~aql d J ,,'me1801d aql 8u!1!1m qslug [I!MI., uo~l~sodosd aql h .:a8essam [!em-a ue 3ru puas noh,, uo!l!sodosd aql aq d :rro!~trlo,y - - ,;paqsaijai 8u!laaj dn aqr: [ I ! I uaql 'mel801d aql 8u!l!1m qs!uy IOU op I JI,, uo!snpuoa aql 01 pea1 ,.paqs214>1 au!qaaj dn axem II!M 1 uaql 'Lpea daals 01 0% I JI,, pue ,,'A~iead a a ~ s01 08 [I!M 1 uaqt 'asessam [!uru-a ue am puas IOU o p noL 11.. .,'mvi80id aql 8u!l!1m q s ~ u gIT!M I uaql .~8essam[!em-a ue aw puas noL 11,. sasaqlodAq aql leql moqs L 3~d-3 L pue 9 s d a l ~ 8upn suauod snpom srsaqlod~~ s pue p sdals 8u!sn suauod snpom s!s>qlod.i~ E pue zs d a l ~8u!sn suallol snpom s!saqlodL~ 1dais 8u!sn uo!le~y!ldm!~ s!saqlodAH uoseax 'smo[[OJSl? uo!snpuos pai!sap a q l o l peal sasaqiudAq sno leql moqs 01 luamn81e ue l ~ n ~ l s aM uo~ ' I Aldw!s s! uo!snpuo:, a U . 1 t s pue 's e 1- .d t I ' b v d- auro:,aq sasaqiodAq aq) uayL ..'lasuns Aq amoq aq ~I!M 2,q.. uo!~!sudo.[d~ q Il pue ,,'d!il aoue:, e axel [[!M aM.. uo!~!sodold aql s ,,'8u!ww!ms 08 11!.u ?,q.. uo!~!sodo.[daql J ,,'AepialsaK ueql lapro:, s! 11,. uo!l!sodo~d aq) b ,.'uoouialje s!ql .iuuns s! 11,. uo!l~sodosdaql aq d l a 7 : u o ! j ~ i l o ~ ,..lasuns Kq amoq aq TI!M aM.. uo!snlJuoJ aql 01 pea[ .,lasuns Lq amoq aq I[!M am uaq, 'd!s aoue:, e aqel am j ~ , pue , .:dl" aoueJ e aye] [I!" am uaqlS8u!urur!ms 08 IOU op am $I,, ,,'Kuuns s! I! j! A[uo 8u!urm1tns 08 [ [ I W aM.. ,,'ieplalsa.i ueql laplo:, s! I! pue uoousayr s!ql Auuns lou s! 11.. sasaq)odKq aq) I P ~ nI o q s .a3uaiaju!jo sa[nl Su!sn pazA[eue aq ue3 qs!18u3 u! sluamn8ie moq moqs osle saldmeua asaU.paieis A[~!~!ldxa dais qaea ~ ouoseai j aql q)!m'dals Kq dais paAe1dsrp ale sluamn8le jo sdals aql aiaqm 'saldmera Bu!mol[oj aqi .iq palellsnII! s! s ! ~ ' p ! l e s!~ luawn;iia ue leql moqs 01 papaau ualjo ale ?Juala#n! JO salni [elahas'sas!wald Auem a.re alaq] uaqM .asIej aq .il?m luamn8ie a q l ~ ouo!snIauo3 aql leql sueaw q ~ ~ q'luamnhe m aql u! pasn uaaq seq ,*$ c uo!l!sodoid aslej a q l . $ > a s n n x q 'asluj s! 1uamn8 -1e s!ql jo uo!snl3uo3 a41 'ianamoH .suauod snpom uo paseq wsoj ~ u a m n i i ~pay e ~e s! v,, g 3~d-3 sa,awexx erqx~ z 1-60 60 1 1 The Foundations: Logic and P m o f . Sets, and Functions RESOLUTION Ll* -- Computer programs have heen developed to automate the taskof reasoning and proving thenrems. Many of these programs make use of a rule of inference known as resolution. This rule of inference is based on the tautology ((p " q ) " (P' V')) -' ( 4 V'). (The verification that this is a tautology was addreased in Exercise 28 in Section 1.2.) The final disjunction in the resolution rule, q V r. is called ]he resolvent. When we let q = r in this tautology,we obtain (p V q ) /1 ( - p V q ) + q . Furthcrnlore,whcn wc let r = F, we obtain (p V q ) A (-p) + q (because q v F = q),which is the tautology o n which the rulc of disjunctivr. ayllogistn is bascd. EXAMPLE 8 Extra Use resolullon to show that llrr hypothcscs.'.Tusmine is skiing o r it is not snowing" and "It is snowing or Bart i? playing hockey" imply that "Jasmine is skiing or Bart is playing hockcy." .Fnhrril,n: Let p he the proposition "lt is snowing." q the proposition "Jasmine is ski- ing." and r the proposition "Bart i? playing hockey." We can represent the hypothcscs as [I v r , respectively. Using resolution, the proposition q 'd r,"Jasmine is ski4 ing or Bart is playing hockey,"fr~llows. -p v q and Resolution playa an important role in programming languages based o n the rules of logic, such as Prolog (wherc resolution rulcs for quantified statements arc applicd). Furthermore, it can be used t11 huild automatic theorcni proving systems. To construct proofs in propositional logic using resolution as the on11 rulc of inference, the hypotheses and theconclusion must be expressed as clauses,where aclauseis adisjunction of variables or negations of thcse variables. We can replace a statement in propositional logic that is not a clausc by one or morc equivalent statements that are clauses. For example, suppose we have a statement of the form p v (y A r).Becausc p v (q A r ) (p v q ) A (p V r ) , we can replacc thc single statement p v ( q A r ) by two statements p V q and p V r , each o l wlrich is a clausc. We can replace a statement of the form -(p v q ) by the two statements - p and -q because De Mc~rgan'slaw tclls us that -(p \ q ) = -p A -4. We can also rcplace an implication p + q with the equivalent disiunction -p V q . EXAMPLE 9 Show that the hypntheces ( p A q ) V r and r + ,v imply the conclusion p V s. Sol~rriun:We can rewrite the hypothesis Ip A q ) V r as two clauses, p v r and q v r . We can also replacer + s by the equivalent clause -r v s. Using the two clauscs p v r and -r v r , wc can use resolution to conelude p v s. 4 FALLACIES Links - Scvcral common fallacies arise in incnrrecl arguments. Thcsz fallacies resemble rules of inference but are based on contingcncics rather than tautologies. These are discussed here to show the distinction between correct and incorrect reasoning. The proposition [(p -t q ) A q ] + p is not a tautology. since it is false when p is false and q 1s true. However, there are many incorrect argumenrs that treat this as a tautology. This type i~lincorrectreasoning is ciillcd the fallacy of amrming the conclusion. 1.5 Methods of Proof 61 - EXAMPLE 10 Is the following argument valid? If you do cvcry problem in this hook, then you will learn discrete mathematics. You learned discrete mathematics. ving tion. Therefore, you did cvery problem in this book. Sollmtion: Lct p be the proposition "You did every problem in this book." Let q be thc proposition "You learned discrete mathematics." Then this argument is of the form: if p + q and q , then p . This is an example of an incorrect argument using the fallacy of affirming the conclusion. Indeed, it is possible for you to learn discrete mathematics in some way other than by doing every problem in this book. (You may learn discrete mathematics by reading, listening to lectures, doing some but not all the problems in this book, and so on.) 4 )The -r = F. vhich " and The proposition [ ( p + q ) A -pJ + -q is not a tautology, since it is false when p is false and q is true. Many incorrect arguments use this incorrectly as a rule of inference. This type oC incorrect reasoning is called the fallacy of denying the hypothesis. aying is ski:ses as is ski4 EXAMPLE 11 Let p and q be as in Example 10. If the implication p + q is true, and -p is true, is it correct to concludc that -q is true? In other words, is it correct to assume that you did not learn discrete mathematics if you did not do evely problem in the book, assuming that if you do every problem in this hook, then you will learn discrete mathematics? :rules plicd). nstruct ]theses riables :that is uppose p v r), p v r, the two -q.We vr.We v r and 4 Solrrtion: It is possible that you learned discretemathematicseven if you did not doevery problem in this book. This incorrect argument is of the form p + q and -p imply -q, which is an example of the fallacy of denying the hypothesis. 4 RULES OF INFERENCE FOR QUANTIFIED STATEMENTS We discussed rules of inference for propositions. We will now describe some important rules of inference for statcments involving quantifiers. These rules of inference are used extensively in mathematical arguments, often without being explicitly mentioned. Universal instantiation is the rule of inference used to conclude that P ( c ) is true, where c is a particular member oC the universe of discourse, given the premise VxP(x). Universal instantiation is used when we conclude from the statement "All women are wise" that "Lisa is wise," where Lisa is a member of the universe oC discourse of all women. Universal generalization is the rule of inference that states that Vx P ( x ) is true,given the premise that P ( c ) is true for all elements c in the universe of discourse. Universal generalization is used when we show that Vx P ( x ) is true by taking an arbitraly element c Crom the universe of discourse and showing that P ( c ) is true.The element c that we select must be an arbitrary, and not a specific, element of the universe of discourse. Universal generalization is used implicitly in many proofs in mathematics and is seldom mentioned explicitly. Existentialinstantiationis the rule that allowsus toconclude that there is an element c in the universe of discourse for which P ( c ) is true if we know that 3x P ( x ) is true. We cannot select an arbitrary value of c here, but rather it must be a c for which P ( c ) is true. Usually we have n o knowledge of what c is, only that it exists. Since it exists, we may give it a name (c) and continue our argument. 62 1 1 The Foundations: Logic and Proof, Sets, and Functions 1-62 TABLE 2 Rules of Inference for Quantified Statements. Rule of Inference VxP(x) :. P(c) P(c) for an arbitrary c :. YxP(X) 3x P(x) :. P ( c ) for some element c P ( c ) for some clement c :. 3 x P ( x ) Universal instantiation Universal generalization Existential instantiation Existential generalization Existential generalization is the rule of inference that is used to coriclude that 3x P ( x ) is true whenaparticularelemcntcwith P ( c ) true isknown.Thatis,ifweknowoneelement c in the universe of discourse for which P ( c ) is true, then we know that 3 x P ( r ) is true. We summarize these rules of infercnce inTahle 2. We will illustrate how one of these rules of inference for quantified statements is used in Example 12. EXAMPLE 12 ~xtra Show that the prcmises "Everyone in this discrete mathematics class has taken a course in computer science" and "Marla is a studcnt in this class" imply the conclusion "Marla has taken a course i n computer science.'' Solutiun: Let D(.r) denote "x is in this discretc mathematics class," and let C ( x ) denote + C(.r)) and D(Marla). The conclusion is C(Marla). The following steps can he used to establish the conclusion from the premises. ..x has taken a course in computer science." Then the premises are Vx( D ( x ) Step 1. V.x(D(x) + C ( x ) ) 2. D(Marla) + C(Marla) 3. D(Marla) 4. C(Marla) EXAMPLE 13 Reason Premise Universal instantiation from (1) Premise Modus ponens from (2) and (3) Show that the premises "A student i n !his class has not read the book." and "Everyone in this class passed the first cxam" iniply the conclusion "Someone who passed the first exam has not read thc hook." Sul~rrion:Let C ( x ) be ".r is in this class," B(x) be ".T has read the book," and P ( x ) bc "x passed the first exam."The premises arc 3 x ( C ( x ) A -B(x)) and Vx(C(x) + P ( x ) ) . The conclusion is 3 x ( P ( x ) A -B(x)). These steps can he used to establish the conclusion from the premises. Step 1. 3x(C(x) A -B(x)) 2. C ( a ) A -B(a) 3. C ( a ) 4. Vx(C(x) + P ( x ) ) Reason Prcmisc Existential instantiation from ( I ) Simplification from (2) Premise -63 1.5 Methods of Proof 63 Step 5. C ( a ) - P(a) 6. P ( a ) 7. -R(u) 8. P ( N )A - B ( a ) 9. 3 x ( P ( x ) A - B ( x ) ) Reason Universal instantiation from (4) Modus ponens from (3) and (5) Simplificat~onfrom ( 2 ) Conjunction from ( 6 ) and ( 7 ) Existential generalization from (8) Remark: Mathematical arguments often include steps where both a rule of inference for propositions and a rule of inference for quantifiers are used. For example.universa1 instantiation and modus ponens are often used together. When these rules of inference are combined, the hypothesis Vx( P ( x ) + Q ( x ) )and P ( c l . where c is a member of the univcrse of discourse, show that the conclusion Q ( c ) is true. Remark: Many theorems in mathematics state that a property holds for all elements rP(x) ement s true. f these Extra Examples course .'Marla in a particular sct, such as the set of integers or the set of real numbers. Although the precise statement of such theorcms needs to include a universal quantifier, the standard convention in mathematics is to omit it. For example, thc statement "If x > y , where x and y are positive real numbers, then x 2 > p"' really means "For all positive real numbers x and y, if x > y , then x 2 > y'." Furthermore, when theorems of this type are proved, the law of universal generalization is often used without explicit mention. The first step of the proof usually involves selecting a general element of the universe of discourse. Subsequent steps show that this element hasthe property in question. Universal gencralirat~onimplies that the theorcm holdsfor all members of the universe of discourse. In our subsequent dircussions, we will follow the usual conventions and not explicitly mention the use of universal quantification and universal generalization. However. you rhould always understand when this rulc of inference is being implicitly applied. denotc C(*)) METHODS OF PROVING THEOREMS Assesarnent veryone the first Proving theorems can be difficult. We need all the ammunition that is available to help us provc different results. We now introduce a battery of different proof methods. These methods should becomc part of your repertoire for proving theorems. Because many theorems are implications, the techniques for proving implications are important. Recall that p i q is true unless p i s true but q is false. Note that when the statement p + q is proved, it need only be shown that q is true if p is true; it is nor usually the case that q is proved to he true. The following discussion will give the most common techniques for proving implications. DIRECT PROOFS The implication p -r q can bc proved by showing that if p is true, then q must also be 1rue.This shows that the combination p true a n d q false never occurs. P ( r ) be P(1)). nclusion A proof of this kind is called a direct proof. To carry out such a proof, assume that p is true and use rules of inference and theorems already proved to show that q must also he Extra a m p DEFINITION 1 true. Before we give an example of a direct proof, we need a definition. The integer n is even if there exists an integer k such that n = 2k and it is odd if there exists a n integer k such that n = 2k 1 . (Note that an integer is either even or odd.) + 1-64 64 1 I The Foundations: Logic and Proof, Sets, and Functions EXAMPLE 14 Give a direct proof of the theorcn~"lfrr is an odd integer, then 11' is an odd integer." Solution: Assume that the hypothesis of this implication is true, namely, suppose that r? is odd. Thcn rt = 2k 1, uherc k is an intcger. It follows that 11' = (2X I ) = ~ 4kZ 4k 1 = 2(2kZ 2k) 1. Therefore, n2 is an odd integer (it is one more than 4 twice an integer). + + + + + + INDIRECT PROOFS Sincc the implication p 9 q isequivalent to its contrapositivc, Extra Examples EXAMPLE 15 ~ p the. iniplicat~onp i q can he pruved by showing that its contrapositive, is true. This related implication is usually proved directly, hut any proof technique can be used. An argument of this type is called an indirect proof. -q i -q i-p, Give an indirect proof of thc theorem "If 3n + 2 is odd, then n is odd." Solilriorl: Assume that the conclusion of this implication is false; namely, assume that n is cven. Then n = 2k for some integer k. It follows that 3n 2 = 3(2k) 2 = 6k 2 = 2(3k I ) , so 3rr 2 is even (since it is a multiple of 2) and therefore not odd. Because the negation of the conclusion of the implication impl~esthat the hypothcsisis false. the original ~mplicationis true. 4 + + + + + - VACUOUS AND TRIVIAL PROOFS S u p p o x that the hypothcsis p of an implicaq is false. Then the implication p i q is true, hecause the statement has the tion p f ~ l r mF i TorF i F.and henceis true. Consequently,if it can he shourn that p i s false, then a proof, called a vacuous proof, of the implication p i q can be given. Vacuous proofs are often used to establish special cases of theorems that state that an implication is true for all posirivc intcgcrs [i.e., a theorem of thc kind Vn P ( n ) where P ( n ) is a propositionel function]. Proof techniques for thcorems of this kind will be discussed in Section 3.3. EXAMPLE 16 Show that the proposition P ( 0 ) is true where P ( n ) is thepropositionalfunction"lfn > 1 , then n% n." Solrltion: Note that the proposition P ( 0 ) is the implication "If O > I, then 0' > 0." Since the hypothesis 0 > 1 is false, the implicat~onP ( 0 ) is automatically true. 4 ,0, is false is irrelevant to thc truth value of the implication, because an implication with a I'alse hypothesis is guaranteed to he true. Remark: The Fact lhat tha conclusion of this implication, 0' - Suppose that the conclusion q of an implication p i q is true. Then p q is true. sincc thc statement has the form T i T or F i T. which are true. Hence,if it can he q can be given. Trivial shown that q is true, then a proof, called a trivial proof, of [I proofs arc often important when special cases of theorems ;Ire proved (see the discussion of proof by cases) and in mathematical indualion. which is a proof technique discussed in Section 3.3. - EXAMPLE 17 Let P ( n ) he "Ifu and h are positive integers with u ? b, then a" ? h"." Show that the proposition P ( 0 ) is true. 1.5 Methods of Proof 65 Solutiorr: The proposition P ( 0 ) is "If o 2 b, then u0 2 bn:' Since a0 = b0 = I , the conclusion of P(OI is true. Hence, P ( 0 ) is true.This is an example of a trivial proof. Note 4 that the hypothesis. which is the statemcnt "a 2 b," was not needed in this proof Lse that I)' = re than 4 A LITTLE PROOF STRATEGY We have described both direct and indirect proofs )osilivc. ~ositive, y proof Extra Examplor e that 11 = 6k 101 odd. thesis is and wc have provided an example of how lhey are used. However, when confronted with an implication to provc. which method should you use? First,quickly evaluate whether a direct proof looks promising. Begin by expanding the definitions in the hypotheses.Then begin to reason using thcm, together with axioms and available theorems. If a direct proof does not seem to go anywhere, try thc same thing with an indirect proof. Recall that in an indirect proof you assume that the conclusion of the implication is false and use adirect proof t o show this implies that the hypothesis must he falsc. Sometimes when there is no obvious way to approach a direct proof, an indirect proof works nicely. We illustrate this strategy in Examplcs 18 and 19. BcCore we present our nexl exampi?. we need a definition. + DEFINITION 2 4 implicahas the I is Calse. Vacuous dication is a pro1 in Sec- EXAMPLE 18 The real number r is rarionnl if there exist integers p and q with q r = p / q . A real number that ir not rational is called irrational. # 0 such that Prove that thc sum of two rational numbcrs is rational. Solution: We first attempt a direct prooC. To begin, suppose that r and s are rational numbers. From the definition of a rational number, it follows that there are integers p andq.withq # 0,such t h a t r = p/q,and integers1 andu,withu # 0,suchthats = t l u . Can we use this information to show that r s is rational? The obvious nexl step is to add r = p / q and s -- t l u , to obtain + ' Becausc q 0 and u # 0,it follows that q u # 0. Consequently, we have exprcssed r s as the ratio of two integers, prr t qr and q u , where q u # 0. This means that r s is rational. Our attempt to find a direct proof succeeded. 4 + EXAMPLE 19 + Prove that if n is an integer and n2 is odd, then n is odd Solurion: We first attempt adirect proof. Suppose that n is an integer and n2 is odd.Thm. there exists an integer k such that n2 = 2k I. Can we usc this information to show that 11 is odd? There seems to be no obvious approach to show that n is odd because solving for r~ produces the equation n = f which is not terribly useful. Becausc this attempt to use a direct proof did not bear fruit, we next attempt an indirecl proof We take as our hypothesis the statement that n is not odd. Because every integer is odd or even, this means that n is even.This implies that there exists an integer k such that n = 2k. To prove the theorem, we need to show that this hypolhesis implies the conclusion that n2 is not odd, that is, that n' is even. Can we use the equation n = 2k t o achieve this? By squaring both sides of this equation, we obtain n2 = 4k2 = 2(2k2), which implies that n2 is also even since r r 2 = 2t, where I = 2k2. Our attempt to find an indirect proofsucceeded. 4 + q is true. it can bc n. Trivial lscussion liscussed that the m, 66 1/ Thp Foundations: Logic and Proof. Sets. and Functions 1-66 PROOFS BY CONTRADICTION There are other approaches we can use when neither a direct proof nor an indirect proof succecds. We now introduce several additional proof techniques. Suppose that a contradiction q can be found so that - p + q is true, that is,-p -r F is true. Then the proposition - p must he false. Consequently, p must be truc. This technique can be u3ed when a contradiction. such as r A -r, can be found so that it ia possible to show that the implict~tion- p -. ( r A -r! is true. 4 n argument of this type is called a proof by contradiction. We provide three examples of proof by contradiction. 'lhe first is an example of an application of the pigeonhole principle. a conibinatorial Lcchnique which we will cover in depth in Section 4 2. EXAMPLE 20 Extra Eaamptos EXAMPLE 21 Show that at least four of any 22 days must fall on the same day of the wcek. Solurion: Lct p be the proposition " A t least four of the 22 chosen days are the same day of the we~k."Supposethat - p is true.Then at most three of thz 22 daysare the same day of the week. Because there arc sevcu days of the wcck, this implies that at most 2 I days could havc been chosen since three is the most days chosen that could be a particular day of the week. This is a contradiction. 4 Provc that is irrational by giving a proof by contradiction. Solurion: Let 11 bc the proposition.'& is irrational.'.Supposc that - p is true. Then is rational. We will show that this leads to a contradiction. Under the assumption that = a / h , where o and b have no comis rational. there exist integers a and h with = a / b , m,hm both mon factors (so that the fraction a / / , is in lowcst lcrms). Sincc sides of this equation are squared. it follows thal ? = 02/b2. Hence, " " 2h- = a - . This means that aZ is even, implying that o is even. Furthcrmorc, since a is even, o = 2c for some integer c. n u s ?b2 = 4c2 , so h2 = 2 c2 . This means that b' is even. Hence,b must be even as well. = o/b. where a and h have no comIt has becn shown that - p implies that mon factors, and 2 divides o and h. This is a contradiction since wc havc shown that -p implies both r and -1- where r is thc statement that o and b arc intcgeri with nocommon factors. Hence, - p is false. so that p: " Ais irrational'' is true. 4 Anindirect proof of an implication can be rewritren as a proof by contradiction. In an indirectproof we show that p -r q is true by usinga direct proof to show that -11 + -p i.; true. That i s i n an indirect proof of p i q we assume that -q is true and show that - p must also bz true. To rewrite an indirect proof of p iq as a prooi by contradict~on, 1.5Methods of Proof 67 len ncliitional -P le. This hat it is nis type + le of an lover in ~ m day c %meday 21 days ular day 4 ' h e n -b ion that no comLen both I we suppose that both p and -q are truc. Then we use the steps from the direct proof of -q i - p to show that - p must also he true. This leads to the contradiction p A - p , complcting the proof by contradiction. Example 22 illustrates how an indirect proof of an implication can be rewritten as a proof by contradiction. EXAMPLE 22 4 on. In an ? + -F that - p adiction. + 2 is odd. then n is odd.' + Solnrion: We assume that 3n 2 is odd and that n is not odd,so that n is even. Following the same steps as in the solution of Examplr I5 (an indirect proof of this theorem), we can show that if n is evm, then 3n 2 is even. This contradicts thc assumption that 3n 2 is odd, completing the proof. 4 + + PROOF BY CASES To prove an implication of the form the tautology can be used as a rulr of infercnce.This shows that the original implication with a hypothesismade upof a disjunction of the propositions p ~ p?, , . . . p , can he provcd by proving q , i = 1 . 2 . . . . , n, individually. Such an argument is each uf the n implications 11; i called a proof by cases. Sometimes to prove lhat an implication p i q is true. it is con\.mient to use a disjunction 111 'J pl v . . . V p,, instead of p as the hypothesis of the implication. whcre p and 111 V p2 V . . . V p,, itre equivalent. Consider Example 23. . Extfa Examples EXAMPLE 23 no comthat - p common Give a proof by contradiction of the theorem "If 3n I Usc a proof by cases to show that . v v ( = 1x1g l . whcre x and y are real numbers. (Recall that r ( , the absolute value o l x , equals x when x >_ 0 and equals -x when x 5 0.) Sol~rrion: Let p be"* and!; arc rraInumbers"and letq be"x,;( = IxI/yI."Note that p is equivalent to pi v p: v p3 v p4, where pl is ''x > 0 A y > 0," pz is "x ? 0 A y c 0," p3 is "x < 0 A y > 0." and p4 is "x < 0 A ? c: 0." Hence, to show that p + q , we can show that pl + q , pz q , p3 -+ q,and p4 i q . (We have used these four cases because we can rcmove thc absolutt value signs by making the appropriate choice of signs within each case.) We see that pl + q because x y ? 0 when x >_ 0 and !; >_ 0, so lhat /xyl = xv = i*I!;l. To see that p: y , note that if .r ? 0 and !; c 0. then x y ( 0, so that lxy 1 = x y = x(-!;) = x l / , y .(Flere, because y c 0, we have l y = -!;.) To see tha! p; i q . we follow the same reasoning as the previous case with the roles of r and y reversed. To see that pj + q,note that when 1 c 0 and y c 0,it follows that x y > 0. Hence x ) . = x?. = (Ex)(-).) = J~iJyl.Thiscompletes the proof. 4 - - PROOFS OF EQUNALENCE Toprovc a theorem that is a biconditional, that is,one that 1s a statement of the form p t. q where p and q are propositions, the tautology can be uscd. That is, the proposition " p if and only if q" can be proved if both the implications "if p , then q " and "if q . then p" are proved. 68 1/The Foundations: Logic and Proof, Sets, and Functions EXAMPLE 24 Edra EmmP'es 1-68 Prove the theorem "The integer n is odd if and only if rzz is odd." Solutio~~: This theorem has the form "p if and only if q," where p is "11 is odd" and q is " n 2 is odd."To provc this theorem,we need to show that p --t q and q -r p are truc. We have already shown (in Example 14) that p -+ q is true and (in Example 19) that q -t p is true. q and q -' p are true, we have shown that the Since we have shown that both p 4 theorem is true. - Sometimes a theorem states that several propositions are equivalent. Such a theorem states that propositions pi, pz- pj, . . . , p, are equivalent.This can be written as PI "p z ' f . . . 3 ' Pn. which states that all n propositions have the same truth values,and consequently, that for all i and ,I with I 5 i 5 11 and 1 5 j 5 12, pi and p, are equivalcnt. One way to prove these mutually equivalent is to use the tautology [PI tf P2 "" . [(PI 'f ~ r 2 +> 1 -' Pl) (PZ + ~ 2 ) " ' A (P" -' ~111. This shows that if the implications p l + p2, p? + pj, . . . , p,, ip l can be shown to be true. then the propositions pl, pz. . . . p, a r r all equivalent. , j with 1 5 i 5 n This is much more efficient than proving that p, ip i for all i and 15,; s n . Whcn we prove that a group of statements are equivalent,we can establish any chain of implications wc choose as long as it is possible to work through the chain to go from any one o f these statements to any other statement. For example, we can show that pl, 1'2, and p3 are equivalent by showing that p l + p?.p l i p2.and p2 4 p~ . EXAMPLE 25 Show that these statements are equivalent: pl: n is an even integer. p?: n - 1 is an odd integer. pl: 1 t 2 is arr even integer. Solurion: We will show that these three statements are equivalent by showing that the iniplications p l + p:. pz -t pz, and p3 + p l are true. We use a direct proof to show that p l i p?.Suppose that n is even. Then n = 2k for some integer k. Consequently, 11 - 1 = 2k - I = 2(k - 1) I. This means that n - 1 is odd since it is of the form 2m I, where m is the integer k - 1 We also use a direct proof to show that pz + pl. Now suppose n - I is odd. Then 11 - I = 2k 1 for some integer k. Hence, n = 2k 2 so that n 2 = ( 2 k ?12 = 4k2 8k 4 = 2(2k2 4k 2 ) . This means that nZis twice thc intcger 2k' 4k 2 . and hence is even. To prove pr + p l , we use an indirect prooCThat is. we provc that if n is not even. then 11' is not even. This is the same as proving that if r l is odd, then n2 is odd, which we 4 have already done in Example 14. This completes the proof. + + + + + + + + + + + THEOREMS AND QUANTIFIERS - Many theorems are stated as propositions that involve quantifiers. A variety of methods are used to provc theorems that are quantifications. We will describe some of the most important of these here. 1.5 Methods of Prmf 69 t the 4 Extra Examples 1t for EXAMPLE 26 lrovc E X l S T E N C E P R O O F S Many theorems are assertions that objectsof a particular type exist. A theorem of this type is a proposition of the form 3 1 P(.I); where P is a predicate. A proof of a proposition of the form 3 x P ( x ) is called an existence proof. There are several ways toprove a theoremof this type. Sometimesan existence proof of 3.1 P ( x ) can be given by finding on element o such that P ( a ) is true. Such an existence proof is called constructive. It is also possiblc to give an existence proof that is nonconstructive; that is. we do not find an elcmcnt a such that P ( a ) is true, but rather prove that 3x P ( x ) is true in some other way. One common method of giving a nonconstructive existence proof is lo use proof hy contradiction and show thal the negation of the existential quantification implies a contradiction. Thc concept of a constructive existence proof is illustrated by Example 26. A Constructive EvistenceProof. Show that thercis apositiveinteger that can be written as thc sum of cubes of positive integers in two different ways. Solution: After considerable computation (such as a computcr search) we find that Becausc wc have displayed a positive integer that can be written as the sum of cubes in two diflcrent ways, we are done. 4 chain from at P I . EXAMPLE 27 A Nonconstructive Existence Proof. Show that there exist irrational numbers x and y such that xx is rational. JT Solution: By Examplc 21 we know that is irrational. Consider the number . If it is rational, we havc two irrational numbers x and y with x! rational, namely. .r = v'i and y = A . On the other hand i f f i 1s ~rrational,then we can let x = and a. - f i ~ f i f ~2 i~ at the = 2k IS that t even. ich we 4 ethods e most y=fisothatxY=(& ) = Z=2. This proof is an examplc of a nonconstructive existence proof because we have not found irrational numbcrs x and y such that xs is rational. Rather, we have shown that ,/i eithcr the pair x = A , y = or thc pair x = f i , y = erty, but we do not know which of these two pairs works! have the desired prop4 U N I Q U E N E S S P R O O F S Some theorems assert the existence of a unique element with a particular property. In other words, these theorems assert that there isexactly one element with this property. To prove a statement of this type we need to show that an element with this property exists and that no other element has this property. The two parts of a uniqueness proof are: Exi.?lence: We show that an element x with thc desired property exists. U ~ i u e s s : We show that if y # x , then y docs not have the desired property HISTORICAL NOTE The English mathcmatician G. H. Hard", when visitingthc ailing Indian prodig" Ranlanuianin ihc horpilal.remarked that 1729,the numbcrofthecab helook,wasratherdull. Ramanu,jan replied"No.il is a very in1ercstingnumbrr:il is the smallest number exprcssiblc as the sum ofcuhes in two different wa"s."(Scc theSupplrmenlary Exercises in Chapter3 forbiographies oIHardy and Ramanujan.) 70 1/Tho Foundations: Lngie and Proof. Sets, and Functions 1-70 Remark: Showing that there is a unique element x such that P ( x ) is the same as proving the statement 3 x ( P ( x ) A V y ( y EXAMPLE 28 Extra .Gaamples # x + -P(y))). Show that every integer has a unique additive inverse.That is.show that if p is an integer, then there exists a unique integer q such that p q = 0. + Sulution: If p is aninteger, we find that p + q = 0 when q = - p a n d q is also an integer. Consequently, there exists an integer q such that p q = 0. 'lb show that given the inlrger p, the intcgcr q with p y = 0 is unique. suppose that r is an integer with r # q such that p r = 0. Then p q = p r . By subtracti n g p from both sides of theequation,it follows thatq = r , which contradictsour assurnption that q # r . Consequently, there is a unique integer q such that p q .- 0. 4 + + + + + + xxta Eramples EXAMPLE 29 COUNTEREXAMPLES In Section 1.3 we mentioned that we can show that a statement of the form V x P ( x ) is false if we can find a counterexample, that is, an cxample x for which P ( x ) is falsc. When we arc prcscnted with a statement of the form V x P ( x ) . either which we believe to be false o r which has resisted all attempts to find a proot we look for a counterexample. We illustrate the hunt ior a counterexample in Example 29. Show that the statement "Every positive integer is the sum of the squares of three integers" is false. Solrrtior~:We can show that this statement is false if we can find a counterexample. That is, the statement is false if we can show that there is a particular integer that is not the sum of the squares of three integers. To look for a counterexample, we try to write 1'. successive positivc integers as a sum of three squares. We find that I = 0' + 0' 2 = 0' l 2 12, 3 = 1' l 2 - 12, 4 = 0' + 0' + 2', 5 = 0' + 1' + 2>, 6 = 1' + l 2 t 22, but we cannot find a way lo write 7 as the sum of three squares. To show that there are not three squares that add up to 7, we note that thc only possible squares we can use are those not exceeding 7, namely, 0. 1, and 4. Since n o three terms whcre each term is 0.1, or 4 add up to 7, it follows that 7 is a counterexample. We conclude that the statement "Every positive integer is the sum of the squares of three integers" is false. 4 + + Links EXAMPLE 30 + + A common error is to assume that one or more examples establish the truth of a statement. No matter how many examples there are where P ( x ) is true, the universal quantification V x P ( x ) may still be false. Consider Example 30. Is it true that every positive integer is the sun1 of 18 fourth powers o l integers'?That is,is the statement V n P ( n ) a theorem whcrc P ( n ) is the statement "n can he written as the sum of 18 fourth powers of integers" and the uni? -1 se of discourse consists of all positive integers? Solution: To determine whether n can be written as the sum of 18 fourth powers of integer-, we might begin by exam~ningwhether n is the sum of 18 fourth powers of integers for the smallest positive integers Because the fourth powers of integers are 0,l. 16.81, . . . , if we can select 18 terms from these numbers that add up t o n , then n is the sum of 18 fourth powers. We can show that all positive integers up to 78 can be written as 1.5 Methods of Proof 71 -71 the sum of 18 fourth powers. (The details are left to the reader.) However,if we decided this was enough checking, we would come to the wrong conclusion. It is not true that every positivc integer is the sum of 18 fourth powers because 79 is not the sum of 18 fourth powcrs (as the reader can verify). 4 nteger, MISTAKES IN PROOFS nteger. a stateample x dxP(.x), ,roof, we nple 29. There are many common errors made inconstructing mathematical proofs. We will briefly describe some of these here. Among the most common errors are mistakes in arithnletic and basic algebra. Even professional mathematicians make such errors, especially when working with complicated formulas. Whenever you use such computations you should check them as carefully as possible. (You should also review any troublesome aspects of basic algebra, especially before you study Section 3.3.) Each step of a mathenlatical proof needs to be correct and the conclusion needs to logically follow from the steps that precede it. Many mistakes result from the introduction of steps that do not logically follow from those that precede it. This is illustrated in Examples 31-33. EXAMPLE 31 What is wrong with this famous supposed "proof" that 1 = 2? " Proofi" We use these steps, where a and h a r e two equal positive integers lree inte- Step example. hat ia not to write 1 02 + 12, 5=12+ show that p a r e s we ,here each ie that the is false. 4 Soluiion: Every step is valid exccpt for one,step 5 where we divided both sides by a - b . The error is that a - b equals zero; division of both sides of an equation by the same quantity is valid as long as this quantity is not zero. 4 truth of a :universal Reason Given Multiply both sides of ( 1 ) by a Subtract b2 from both sides of ( 2 ) Factor both sides of (3) Divide both sides of ( 4 ) by a - b Replace a by b in ( 5 ) because a = b and simplify Divide both sides o f (6) by b EXAMPLE 32 What is wrong with this "proof"? "Theorem:" If n 2 is positive, then rz is positive. ;?That is, is itten as the all positive powers of powers of gers are 0 . 1 , h e n n is the ,e written a s I 1 "Proofi" Suppose that n' is positive. Because the implication "If n is posilive. then n' is positive" is true, we can conclude that n is positive. Solution: Let P ( n ) be "n is positive" and Q ( n ) be "n2 is positive."Then our hypothesis is Q ( n ) .The statement "If n is positive, then rz2 is positive" is the statement V n ( P ( n ) + Q ( n ) ) . From the hypothesis Q ( n ) and the statement V n ( P ( n ) + Q ( r z ) ) we cannot conclude P ( n ) , because we are not using a valid rule of inference. Instead, this is an example of the fallacy of affirming the conclusion. A counterexample is supplied by n = -1 for which n2 = I is positive, but rr is negative. 4
© Copyright 2024