Rosen Ch1 Excerpt

81
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 Ta~pe~ Toronto

Transcript of Rosen Ch1 Excerpt

Page 1: Rosen Ch1 Excerpt

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 Ta~pe~ Toronto

Page 2: Rosen Ch1 Excerpt
Page 3: Rosen Ch1 Excerpt
Page 4: Rosen Ch1 Excerpt

Contents v

8.7 Planar Graphs

8.8 Graph Coloring

End-of-Chapter Material

9 Trees 631 0.1 Introduction to Trees

9.2 Applications of Trees

9.3 Tree Traversal

9.4 Spanning Trces

9.5 Minimum Spanning Trees

End-of-Chapter Material

10 Boolean Algebra 701 10.1 Boolean Functions

10.2 Representing Boolean Functions

10.3 Logic Gales

10.4 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~th No 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

Page 5: Rosen Ch1 Excerpt

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 mean- ing 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 mathemat- ical 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 ex- plain 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 func- tion 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

Page 6: Rosen Ch1 Excerpt

2 1 /The Foundations: Logic a n d Proof. Sets. and 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 logic- propositions. 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 .~ . -322 B.c.E.) Anstotle wss horn in Stargirui in northcrn Greece. His father wasthe personal physician of (he King of Macedonia. Because hi, lalhcr died whell Aristotle was young. Arislotle could not fullnw lhc custom of h>llowing his 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 n who 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 la tds 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.~..Aristotle was 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.Arir lol l r rnovcd t o Mylilenc and, at the invitatiou of King Philip of Macedonla. hc tulored Alexander, Philip'. son. who

Links 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 sc 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~,mpiliilions of scienlilic Pact% and systematic lreatiscs. The syalrmatic trcalises includcd works on logic, philosophy. psycholooy. physics, and n ~ t u r a l hisrury. 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.

Page 7: Rosen Ch1 Excerpt

1.1 Logic 3 '-2 1-3

:a1 3. .r + I = 2. 4. x + y = z .

las ter Sentences 1 and 2 arc not propositions because they are not declarative sentences. Sen-

of tences 3 and 4 arc no1 propositions because they are neither true nor false, since the

.he variables in these sentences have not been assigned values. Various ways to form propo- sitions from sentences of this type will be discussed in Section 1.3. 4

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. i f it is a true proposition and false, denoted by F, if it is a false proposition.

c- The area of logic that deals with propositions is called the propositional calculus not

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 Links 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.

4 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.''

~ x t r a and express [his in simplc English. father Examples 'oung. Solrrtior,: Thc ncgalion is rphan c. and "It is not the case (hat today is Friday." 'larn's r~oric. This negation can he more simply expressed hy rd too ?d for "Today is not Friday," novcd or n. who I ' King "It is not Friday today." 4

.istotle TrathTahle for 3 years Remark: Strictly speaking, sentences involving variahle times such as those in

encr in the Negation Ernmple 3 are not propositions unless a fixed time is assumed. The same holds for vari- xander able places unless a fixed place is assumed and for pronouns unless a particular person is an. He Proposition. assumed.

ienlific hnlogy, A truthtabledisplaystherelationships betweenthe truth valuesofpropositions.Truth

a vault tables are especially valuahle in the determination of the truth values of propositions . whcre 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 .

Page 8: Rosen Ch1 Excerpt

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~crion of 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 Fri- day 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 propo- sition 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 or is being used in ihe statement

"Students who hdvr taken calculus or computer science can take this clasr."

GEORGE BOOLE (1815-1864) G~.orge Bode, 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 u n fur leaching mathemalzcs. Boole-unratisiied with rerthooks ol'his day4cc idcd 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 1848 Boalr 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

Links he published T l ~ c Litws of 7horrgll1, his most famous work. I n this book Baole inlroduced whal is now called Boolcon o l ~ e h r a in 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 uc t from a

rainst~um.

Page 9: Rosen Ch1 Excerpt

TABLE 2 The Truth Table for the Conjunction of Two Propositions

T T T F F F F l F

TABLE 3 The Truth Table for the Disjunction of Two Propositions.

1.1 Logic 5 1-4

of the xition lat are logical

the The

in this tions p

vday is

is F r i ~ alse on

4

3pO- ition

io ways nhen at din the

England, , cducatc ticianr vi and soon ,satisfied ~g papers lions. the

symbolic . In 1854 at is now iiference i in 1855: eurnania, el from a

1-5

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

"Students who have taken calculus or computer science, hut not both,can enroll in this class."

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 or salad, but not both. Hmce, this is an exclusive. rather than an inclusive, or.

EXAMPLE 5 What is thc disjunction of the propositions p and q whcre p and q are the same propo- silions 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~iday or a rainy day (including rainy Fridays). It is only false on days that arc not Fridays when it also does not rain. 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

Extra 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 or 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 and9 are false and when both are true.

DEFINITION 4 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.

The truth table for the exclusive or of two propositions is displayed inFTable 4.

Page 10: Rosen Ch1 Excerpt

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 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

Asseawent 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 fol- lowing ways to express this implication:

"if p. then q" " p implies q" " p only if q"

Exsmples " p is sufficient for q" "a sufficient condition for q is p" "q whenever p"

"q when p" "q is necessary lor p" "a necessary condition for p is y" "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 of an implication is to think of an obli- gation 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.

Page 11: Rosen Ch1 Excerpt

1-6 I Similarly, consider a statement that a professor might make:

times

ariety ,e fol-

n obli- ing for

rmorc. person power

"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 hy- pothesis 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

"If today is Friday, then 2 + 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 no 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.

EXAMPLE 6 What is the value of the variable x aftcr the statement

i f 2 + 2 = 4 t h e n x : = x + I

if x = 0 before this statement is encountered? (The symbol := stands for assignment. The statement x := x + I means the assignment of the value of x + 1 to x.)

Solurion: Since 2 + 2 = 4 is true, the assignment statement x := x + 1 is executed. Hence,x has the value 0 + 1 = 1 after this statement is encountered. 4

Page 12: Rosen Ch1 Excerpt

8 1 /The Foundations: Logic and Proof, Sets, and Functions 1-8

CONVERSE, CONTRAPOSITIVE, AND INVERSE Thsre are some related im- plications 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 converse. q - p, nor the inverse. -p i -q, has thc same truth value as p -t q for 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 ~mplications in Examplr 7.

EXAMPLE 7 What are the contrapositive, thc converse. and the inverse of the implication

Extra "The home team wins whenever it is raining."'? 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~icotiditional and it is symbolically written by combining the symbols i and t. There are some other common ways to express p tr q:

Page 13: Rosen Ch1 Excerpt

1.1 Logic 9 1-8

m- rse on

Iue md the for Ise, ien :nt, rsc en t the

' 4.

I-!?

TABLE 6 The Truth Table for the Biconditional p tr q.

" 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 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."

4

S

true .the

S '

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

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 im- precision in natural language, we need to make an assumption whether a conditional statement in nalural language implicitly includes its converse. Becausc precision is es- sential in mathematics and in logic, we will always distinguish belwcen the conditional statcmrnt p -t q and the biconditional statement p tt q .

PRECEDENCE OF LOGICAL OPERATORS

We con construct compound propositions using the negation operator and the logical op- erators defined so far. We will generally use parentheses to specify the order in which log- ical 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).

Page 14: Rosen Ch1 Excerpt

luasaldsl s pue 'r .b la1 am.lelns!lled u~ uaql uaamlaq sah!lJauuos les!rio[ are!.~doldde aql uo ap!sap ol pue sued a~u2luas aql JU ~JBJ ~uasa~dalo~ sa[qc!Jen ~~uo!l!sodold acn 01 s! op ul:s am leqm 'dlal~:!.~dolddu a1oW Ou!sn uosl:al lo analuas aql azd~eue ol in am uaqm sn ~s!ssr! lou pinom s!ql 8u!op'Buo~m IOU S! s!ql q8noqllv 'd 'Kes 'alqe!lan ~l'uo!l!sodold alauts e Kq a3ualuas aql luasaidal 01 dldm!s s! ie~ lnjasn ]seal inq zsaldm!s a~. 'uo~ssa~dxa je318ol e olu~ ssualuas s!ql alelsue11 ol sdem KuI!~ ale a.lau :~rolinlo~

.:p[o slea.4 9[ ueq~ laplo aic nod ss>lun 11e1 1aaj p lapun ale nod J! Iaaeos J;)[~oI aq~ ap!l louues noh..

;uo!sssldxa [e~!8o[ e oiu! p~ielsue~l aq ssualuas qs!lBuz S!~I ue3 MOH 01 37dm3

b .(j- ? 3) t v

re pa~uasaldal aq ues asunluas stql'passa~dxa aq 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,<,, luasalda~ J pue 'J 'n 131 am 'relny~sed ul maql uaamlaq san!rJauuos les!iiol aepdolddc aql au!mlalap pue lied a3ualuas qJea lussolda.~ ol sa[qn!leA [euo!~!sodo~d ssn [I!M >M

'pea~sul '11 q~~m au!uoscal so Bu!uearn $I! Bu~zd~eus uaqm [njasn aq lou plnom s!q~ 'd SE

q3ns 'alqepea [euo!~!sodold aldu!s e iq a3ua)uas aql luasa~dal 01 alq!ssod s! I! q3noq1 -[v .uo!ssaldxa [es!a'ol e o~u! saualuas s!ql ale[suell 01 sKem Kunlu ole slau :uu?rn/o~

,;uemqsaq e IOU ale noK lo .~o[elu aJua!ss lalndmos F ale nod j! L[UO S~~UIBS 11101~ laulalul aqr ssame ues noA,,

juo!ssa~dra 1m!aol e olu! pals[suellaq asualuas qs!lPuz s!ql us:, MOH 6 37dI.WX3

'01 pUz 6 S?[~WFX~ lap!SUos 'uo!ssaldxa lesfol e oru! asualuas qs!lSuq ue Ou!~e[sunl~ 60 ssasnrd a111 alensnll! o~

'maql inoqr: uoseal 01 (5'1 uot~sas U! passnss!~ alp q?!r[m) asualajul jo salni asn ue3 am pue'maql a~e[nd!uem ucs am.sanleA qlnJll!aql se,d&exa au!mlalap (11 suo!ssaldxa les18o1 as?ql azdleue ue3 2m su~!ssasdxa le3!201 OIU! qs1lZu3 sr?x&

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! deu s!ql 1~111 ?I~N .it!n%!qcue aql sanomal suo!ssa~dxa [BSIZOI OIU! sa3ualu~ 8~!1e~sue~~~snon8!qme ualp s! (aOenPue1 uemnrl J~I[I~ 1113~2 ~UF) qs!law~ 'se[ns111ed u1 .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 aiau

------

S33N3W3S HSITDNB DNI&VISNV2I&

'ti pue ' t 'A 'v 'L siolelado le3!2ol aq] JO slanal asuapasaid J~I sie[ds!p alqe&.io~el~do (euo!~!puos!q aql .lano asuapa3ald seq ioll?~ado leuo!~!puos aql qSnoq11e 'anss! IE a! lol~lado ~eoo!~!puo~!q pue iolelado 1~uo!l!puos aql jo 1ap.10 aql

.A pue v 's~oleiado un!]sun[s!p pue uo!l~unjuos aql ueql ~3uapas~ld lamol a%eq t, pub: + slolel2do [~uo!l!puos!q pue puop!puos aq~ 1eq1 aln~ 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 [[!M JM 'J~~III~UIJ~ 01 II~JIJJ!~ aq detu a[nI s!q~ asnusag jn aauapamid -(J ,A 6) v d ueql~aq~el r A (b v d) sueam J A b d d 1eq1 os'101elado un!lsunls!p aq) saao a3uapasaldsayel lo~elado uo!~sunjuos aqlleql s! asuapasaldjo a(n11elauaJ laqlouv

Or-J suo!l~uud prre 'slag foord poe 3Qo~ :coo!lepuno& aqL / 1 01

Page 15: Rosen Ch1 Excerpt

1.1 Logic 11

i +

d v. ,hen 1 the ;the

opo- man s the d on from minc hare

I. Al- such

itead, e the escnt " and n can

n. The tional we try I is to

"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

Of coursc, thcre are other ways to represent the original sentence as a logical expres- sion, but the onc we havc used should meet our needs. 4

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.

EXAMPLE 11 Exprcss thc spccification "The automated reply cannot be sent wheri the file systcm is

~ x t r a full" wing logical connectivcs. Examples

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~ated reply 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, propo- sitional 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.

EXAMPLE 12 Detcrminc whether these system specifications are consistent:

"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."

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

Extra but p must bc false,q must be true. Because p + q is truc whcn p is false and q is true, Examples 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 the four possiblc assignments of truth values to p and q. 4

on the I EXAMPLE 13 Do the system specifications in Example 12 remain consistent if the spccification "The rcsent diagnostic message is not retransmitted" is added'?

Page 16: Rosen Ch1 Excerpt

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 -

Logical connectives are used extensively in searches of largc collections of information, Links such as indexes of Weh pages. Because these searches employ techniques from proposi-

tional logic, they are called Boolean searches. In Boolean searches, the connective AND is used to match records that contain hoth

Extra 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~ple 14 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 UNI- VERSITIES. 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 AND operator takes prece- dence 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 do not contain the word NEW. 4

LOGIC PUZZLES

Puzzles that can he solved using logical reasoning arc known as logicpuzzles. Solving logic

Links 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.

EXAMPLE 15 In [Sm7X] Smullyan posed many puzzles about an island that has two kinds of inhahi- tants, knights, who always tell the truth, and their opposites, knaves, who always lic. You

Extra encounter two people A and B. What are A and B i f A says " B is a knight" and B says "The two of us are opposite types"?

Page 17: Rosen Ch1 Excerpt

11th rch ~ d e ten est.

ues, ,ing ook this NI- 1 as tics CO :ce- tain rord Ncb ook arch ,o, it JOT and 4

ogic uter :s to shed

iabi- You says

1-13 1.1 Logic 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

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 (BORN 1919) Raymond Smullyan dropped ont of high school. He wanted to study what he was yeally interested in and not ~ landard high 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

Li* Mmkingbird; Forever Undecided; and The Riddle ofSchehero:ode:Amo:ini: Z,o~ic Pu::lri, Ancient and Modpm. 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

~ ~

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."

Page 18: Rosen Ch1 Excerpt

14 11 The 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 follows that both childrcn answer "Yes" the second time the question is asked. 7

LOGIC AND BIT OPERATIONS pppp~

(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

Links 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 aone and false by azero in the truth tables for the operators A , v ,and $. the tablesshown inTable 8for the corresponding bit operations are obtained. We will also use the notation OR. AND, and XOR for the operators v, A, and $ ,as 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.

DEFINITION 7 A birstringis a sequence of zero or more bitsThe length of this string is the number of bits in the string.

EXAMPLE 17 101010011 is a hit string of length nine. 7

We can extend bit operations to 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

Page 19: Rosen Ch1 Excerpt

1, 0 ~ n d

ian

dth

we

he). : o r

by w n ion

ing

~ n d

this

VD, bits

the OR, AND, a n d XOR of t h e corresponding bits in t h e t w o strings, respectively. We use

the 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 operat ions o n bit strings with Example 18.

EXAMPLE 18 Find t h e bitwise OR, bitwise AND, a n d bitwise .YOR of the bit strings 01 1011 0110 a n d

11 0001 1101. (Here , a n d throughout this book , bit strings will b e split in to blocks o f four

bits t o m a k e t h e m easier to read.)

Solution: T h e bitwise OR, bitwise AND. and bitwise XOR of these strings are obtained

by taking the OR, AND, and XOR of the corresponding bits, respectively. This gives us

11 1011 1111 httwt\e OR 01 0001 0100 h t t w t ~ e AND 10 1010 1011 hitwise XOR 4

Exercises I. Which of these sentences are propositions?Whal are 2. Which of these are propositions'? What a re the truth

the truth values of those that are propositions? values of those that are propositions?

a) Boston is the capital of Massachusetts. a) D o not pass go. b) What time is it? b) Miami is the capital of Florida. c) There a re n o black flies in Maine. c) ? + 3 = 5 . d) 5 + 7 = 10. d) 4 + x = 5 . e) x + 2 = 1 1 . 0 Answer this question. e ) x + l = 5 i f x = l . g) x + y = y + x for every pair of real numbers .t O x + ? = y + s i f x = r .

and y.

JOHN WILDERTUKEY (1915-2000) Tukey,horninNew Bedford,Massachusetts, was an 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 nLcy found statistical research to his liking and impressed several leading statisticians with his skills. In 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~tment at Princeton in

I.inks 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 Commit- tee. 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.

Page 20: Rosen Ch1 Excerpt

'eai~? (1 v h~) A (h v d) (J

aql u!uaae uaaq rou ahaq sraaq <[zzu5'j!X[uo put! (1- t h) A (_I- c 0) (a J! ale"! Zu!y!q 'l!eil aql auul~ ad!., ale sa!usq JI (J .rnh/id (p iL c h (1

-[!ell aql 1 ++ 6- (q bed (c Buol~ad!~ are sa!lJJq lnq'ajeq s! [!r?il aqluoBu!y!q ooual pua Bale oqi U! uaas uaaq IOU aAMq uuaq ilzz!~t) (q -uas qyXu~ uu SE suo!l!sodord asaqj 30 qnco ssaldxz

'eaie aq~ u! uaas uaaq IOU xeq .asmoo ~ql ssed noh : 1

sreaq dlzzp2 mq '[!en aql 8uole ad!] ale sa!riag (I: .uo~]eu!mcxa pug aql ss!u no* : b

'sa~yoauuos 'ny aql aAeq noh : d [r3!301 PUG 1 pue'b'd Yu!m suo!~!sodo~d asaql aJ!IA\

suo!l!sodord sqi aq .I pue '6 'd 111 .s .[!ell iq~ Xuolu ~d!, xu sa!Irag : 1

-%u!mous aq or 1~ 10, '[!ell aql uo ajess! Zu!y!~ : b

lua!oyjns pue dressooau s!Zu!zaaljmo[aq s! L! leqL (8 -vale aql U! uaas uaaq anaq smaq .([zz!19 : d

'Zu!zaal~ nofaq s! 1!3! Bu~mous IOU s! suo!l!audurd .ql aq PuE'b'd lal 'I1 i! rnq .8u!mous s! I! 10 Bu!zaoq molq laql!a y 11 (1

-[null ~ql uo v ue .~u!mous oslc s! 1!'8u!zaaq molaq s! I! 11 (a la8 nd lo yooq s!q~ u! as!xoxa .Osna op ~aqr!o .(q~oq lo) Xu!zaaq molaq lo Xu!mous 1aq11a SI 11 (p no I! dluo pue JI ssels s!q~ u! r ue la8 [TIM noh u .au!mous LOU s! I! PUE Su!zaaij mopq IOU s! 11 (3

'sse[o -a‘u!mous lou inq Bulzaaq nolaq $1 11 (q s1q1 u! v ue Su!iiaO 101 1~3!ogjns s! yooq s!ql u! .Bu!mous pue Bulzaag molaq s! 11 (e asroiaxa Daha Bu~op pue pug aql uo vue du!~r?t) (a 'sa~~roauuua

'SSFJJ S!ql U! [es!;lo{ pue h PUP d Xu!sn SUOJI!SO~OJ~ nsql v ue la2 noi 'ssalaqliaAau :yooq s!ql u! as!xaxo

.Smmous s! 11 : h Xlsna op i,uop noi inq .[vuy aql uo Q UP taS noh (p

.Zu!zaaq molsq s! 11 : d '1et1!1 aqi uo Q ue la4

01 nod 103 i~essasau st i!''sqo s!ql u! v UB taX o~ (J suu!~!a,dold aqi sq h pue d 121 .L .sse[o s!ql u! v ue la% nod pue 'qooq srql u! (6vd-)~b-(q bed@

aslsiaxs d~ana op nok '[eug 141 uo v ue 15% noh (q 'yooq s!q) u! as!o~ara

disna op )ou op no.< inq'sselo s!ql u! v uu ra4 noh (e .aoualuas qs!lBug uu se 'san!~sauuo~ suo!l!sodord punodum asaql30 qoea ssaldxg 'Lla~!l

le3!Bol pue 1 puc'h.il ;lu!sn suo~r!rodo~d ~sarll ~IUM -2ndsa.r ..'pa1uno3 uaaq aneq salon a~,, pun ..papp

.SSAP s!ql U! v UP la% n0.q : 1 -ap s! uo!loa[a au.. suo!i!sodoid aqi 5q h pue d la7 .g yooq stql u! asplans .ii?na op no,^ : h (h- A d) "'1- (q b- e (1 (2

mexa leuy aqi uo '.f ue la8 lluh d h- t (1I- (1 il c h- (a hi + d (p suop!sodold aql aq .I pue.6 'dla7 '01

mng lad ~a[!ru s9 raho lul .asualuas qs~la'uz~ uesc suo!l!sodoid punodcuos asaql -n!lp a~c noi'laqs!l Ou!paads e 128 no.< ranauaqM (8 30 qoea ssarrlxa 7lan!l,mdsal ,:a~oqa uql laau psrlods

.lnoq rad sapm sg lam ua~q aneq syieqs,, pus ,,pamo[le s! aroqs iasiarmaN

a.\!.rp rou op no. lnq 'laq,!l 8tr!pl"d? e la: no,r. (J aq) %u!uwlm~,. suo!~!sodo~J aql oq h pue d la1 'S '~ayo!~ Xu!paads e 4u!1134 (h v d) A il- (q b- v d- (8

lo) lua!~yjns s! inoq lad ra[!cu ~y lam Bu!n!ra (a h-d(a bvd(p .18q3!1 %u!p~3ds P la3 iou ll!n nod

uaql 'inoq isd sal!m g9 iano ah~rp lou op noi $1 (p 'aouai .Inoq lad sq!m -uas qs![a'ug ut. se suo!l!sodord asaql3o qsra ssa~dxx

59 lano ah!rp noi 1193!1 Xu!p~ads r? 128 l[!n nnh (J

.lays!] Bu!paads e 134 :iep!12 uo ~odyse! re[[op uo!gl!tu aql uom 1 : b

lou op nod Inqa.lnoq lad salp ~9 lano anpp noh (q 'qaam s!ql layo!] drailol e lqznoq 1 : d

xnoq lad sap ~g rono an!lp IOU op no,r. (n suo!i!rndold aqi aq b pue d la1 .b 'Sllrl!l3.7UUOJ iuuns pue loq s! au!eW u! lamtuns au (p

[e3!Xol pue h pue d Xu!sn suo!r!sodoid asaql al!lM 'C=I+Z (J

laya!l3u!paads e la4 noh: h iasra~ ma^ u! uo!lnllod ou s! arq (q ~noq lad sq!m 59 ra,\o an!lp noh : d ;(nps~nu s! depo~ (e

suo!l!sodo~d arll ail hpue il 127 '6 j.suo~i!sodoid asaql jo qoea 30 uo!loBau aql s! ruq~ '$

91 I sua!q~und pue 'was >ao~d pue ~@o? :sua!lepuno~ aqL { 1 91

Page 21: Rosen Ch1 Excerpt

1.1 Exercises 17

logical

I do not

over 65

ur. then

ient for

ot drive

are driv-

d logical

do every

exercisc bL

Jr you to

do every gel an A

(exercise A in this

11y if you r you get

d) It is not safe to hike on the trail. hut grizzly bears 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~iesnot be ripe alongthc trail and for grizzly bears not to havc been seen in the area.

i 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.

nr 1111 -. . -. . . d) 1 + 1 = 3 if and only if pigs can Ry. e) 0 > I if and only if 2 > 1.

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) I f I + I = 3, then God exists. CI I i 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 lmm Acme Motor Com-

pany,you get $2000 back in cash or a 2 % car loan.

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 sub-

scription fee. f) Gect~ng elected 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 com- mon ways to express implications provided in this section.) a) It snows whenever the wind blows f iomthe north-

east. 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 com- mon 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.

I , .

c) Dinner for two includes two items from column a) If it is hot o u t d c you buy an ice cream cone, and nd logical A or three itcms h u m column B. if you buy an ice cream cone it is hot outside.

d) School is closed if more than 2 feet of snow falls b) For you to win the contest it is necessary and sul- zzly bears or if the wind chill is below 1 0 0 . ficient that you have the only winning ticket.

16. Write each of these statementsin the formuif p , then c) You get plomoted only if you have connections. e area and q"in English. (Hint: Refertothelist olcommon ways and vou have conneclions onlv if vou eet nro- ripe along rn to express implications provided in this section.)

, moted.

a) It is necessary to wash the boss's car to get pro- d) If you walch television your mind will decay, and moted. conversely

b) Winds from the south imply a spring thaw. e) The trains run late on exactly those days when I c) A sufficient condition for the warranty t o be good take it.

Page 22: Rosen Ch1 Excerpt

18 1 /The Foundations: Logic and P~.oaf, Sets, and Functions

20. Writeeach of these propositionsin the fonn"p ifand a ) p + -q h) -p ++ q only if q"in English. C) ( P + Y ) V ( - P + Y )

a) For you to get an A in this course, it is nccassary d) l p -t 9 ) A (-11 + 4 ) and suffic~ent that you learn how to solve discrete e) ( P h V ) v I-P - 4) mathematics problems. f I-p * -q) - ( p ci q!

b) If you read the newspaper every day, you will be 28. Construct a truth table for each of these compound informed, and conversely propositions.

c) It rains if it is a weekcnd day, and it is a weekend d . ' .

a) ( p v q i ' i r b) I p V q j ~ r a) ~f lt rains c ) (11 A 4) V r d) ( / > A 4 l f i . r

d ) Youcan rce the wizard only ifthc wizardis not in. e) ( p v q) A -r f) (p I\ q ) v -, and the wizard is not in only if you can see him.

29. Construct a truth tahle for each of those compound 21. State thc converse, contrapositive, and inverse of propositions.

each of these implications. a ) P + (-q 'V r )

a) If it snows today, i will ski tomorrow. b) -p - (q + r i b) 1 w m e t o class whenrver there is going to be a r) (P + q ) '1 C-P +

d) ( p - q) A (-p + r ) c) A positive integer is a prime only if it has no divi- e) ( p h 4) Y (-4 - r j

sors other than I and ~tself. f ) I-p rr -4) ti (q e r j 22. Stale the converse, contraposilive. and inversc of Construct truth for ((,, + q ) + r , + s,

cach of these implications. 31. Construct a truth table for ( p t~ q) -+ ( r - f- r j . a ) If it snows tonight, then I will stay at home. 32. What is the value ofx after cachof these statement- is b) I go to the beach whenever it is a sunny summer encountered in a compuler program, if r = I before

thc statement is reached? c) Whrn 1 stay up latc, it is necessary that I sleep a ) i f 1 + 2 = ? t h e n x : = r + I

until noon. h) i f ( l + I = 3 ) O R ( 2 + 2 = 3 ) t h e n x : = x + I 23. Construct a truth table for each of these compound c) i f ( ? + 3 = 5 ) A N D ( 3 + 4 = 7 ) I h e n x : = r + l

propositions. d ) i f ( l t l = 2 ) X O R ( I + 2 = 3 ) t h e n r : = , r + I

a) I J A - P b) 11 v -P e) if .r c ? then x := r + I

C) ( P V - Y ) + Y d ) ( ~ ~ q ) + ( p , . , q ) 33. Find the bltwise OR, bitwisc AND, and hitwise .YOK e) 01 ~- q ) + (-Y + -PI of each of these pairs of hit strings. f (P - Y) + (Y + P) a) 101 1110. 0100001

24. Construct a truth table for cach of these compound h) 1 1 1 1 0000. I010 1010 c) 000lllO001. 1001001000 d) l l I l l l 1111, 0000000000

C) P @ ( P V Y ) d) t ~ l ~ q i + ~ p v q ) 34. Evaluate each of these rxprcssionc. C ) (q + -PI ++ (P e Y ) a ) 1 1 0 0 0 ~ (0 1011 '1 11011) f) ( P + Y ) @ ( P ~ - ~ ) b) 101111 A 10101)V01000

25. Construct a truth tahle for each of these compound c) (01010eE 1 1 0 1 l ) e o l 0 n 0 d) ( 1 1011 V01010) A ( 1 0001 V 1 1011)

a ) (P v q) A IP @ q) Fuzzy logic is used in artificial iu~rl l igmce. In fuzzy logic, b) ( P ~ ~ ) + ( P A Y ) a proposition has a truth value that is a number hetween c) ( P V Y ) ~ ( P A Y ) (1 and 1, inclusive. A proposition with a truth value of 0 d) l p * 4) iP (-11 ++ q ) is false and one with a truth value nf 1 is true. Truth val- e) (11 e q) e~ ( - I J -A -1.1 ucs that are hrrwecn O and I indicate varying degrees of f ) ( i ~ q j + ~ P @ - Y ) truth. For instance, thc truth value 0.8 can be assigned to

26. Constrnct n truth table for each of these compound 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.

35. The truth valuc of the negalion of a proposition in 0 l P @ q ) A (P~B-CI! fuzzy logic is I minus the truth value of the propo-

27. Construct a truth table for each of thrse compound sition. What are the truth values of the statements "Fred is not happy" and ".lohn is not happy"?

Page 23: Rosen Ch1 Excerpt

1-19 1.1 Exercises 19

36. The truth value of thc 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 proposi- tion?

"39. The nth statcmcnt in a list o f 100 statements is "Ex- actly n of the statements in this list are false."

a) What conclusions can you draw from these state- ments?

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, whodo 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 bar- becue 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 todeter- mine whether the cannibal always lies o r always tells the truth.

43. Express these sysLem specifications using the propo- sitions p "The message is scanncd for viruses" and q '.The rnessafe was scnt from an unknown system" to- sether 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 an unknown system i t is not scanncd for viruses."

44. Exprrss these system specifications using the propo- sitions pUThc uscr 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 sub- scription 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 sys- tem is in multiuser state if and only if it is operating normally. If the system is operating normally,the ker- nel is functioning.The kernel is not functioning or the systemisin interrupt modeifthesystemisnotinmul- tiuser state, then it is in intcrrupt mode. The syslem is not in interrupt mode."

46. Arc these system specifications consistent? "When- ever the systcm softwarc is being upgraded,userscan- not 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 i f i t 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 sys- tem 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 he 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?

Page 24: Rosen Ch1 Excerpt

20 1 /The Foundations: Logic and Proof, Sets, and Functions 1-20

Exercises 51-55 relate to inhahitants of the island of Vijayand Kevin are either both chattingor neither is. knights and knaves created by Smullyan, where knights If Heather is chatting, then so are Abby and Kevin. always tell the truth and knaves always lie.You encounter Explain your reasoning. two people,^ and B.Determine.ilpossible.what A and B 59. detective hasinterviewed fourwitnessestoacrime. are il they address you in the ways described. If you can- From the stories of the witursses the detective has not determine what these two people are, can you draw concluded that if the butler is telling the truth thenso any conclusions'? is the cook:thecookand thegardener cannot both be 51. A says " A t least one o l us is a knave" and B says telling the tiuth; the gardener and the handyman are

nothoth1ying:andif the handymanis tellingthe truth 52. A says "The two of us are both knights" and B says then thc cook is lying. For each of the four witnesses,

" A is a knave." can the detective determine whether that person is

53. A says "I am a knave or B is a knight" and B says telling the truth or lying? Explain your reasoning. 60. Four friends have been identified as suspects for an

54. Both A and B sayhI am a knight." unauthorized access into a computer systcm. They 55. A says "We are both knaues" and B says nothinp. have made statements t o the investigating authori-

Exercises 86-61 are puzzles that can he solved by trans- tics. Alicc said "Carlos did it." John said "I did not

lating statements into k~gical expressions and reasoning d o it." Carlos said "Diana did it."Diana said "Carlos

from these expressions using truth tables. lied when he said that I did i t . "

56. The police have three suspects lor the murdcr of a) If the authorities also know that exactly one of Mr. Cooper: Mr. Smith, Mr. Jones. and Mr. Williams. the fuur suspzcts is telling thc truth. who d ~ d it? Smith.bnes,and Williams each declare that they did Explain your reasoning. not kill Cooper. Smith also statcs that Cooper was a b) If the authorities also know lhat exactly one is friend of Jones and that H'illiams dislikcd him. .Jones lying, who did it'? Explain your reasoning. also that he did know Cooper and lhat he *61. Solve this famous logic puzzlc, attributed to Albert was out of town the day Cooper was killed. Williams Einstein, aud known as the zebra puzzle. Five mcn also states that he saw hoth Smith and Joues with with different nationalities and with diflerent jobs Cooper the day of the killing and that either Smith live in consecutive houses on a strret. Thcse houses or b n e s must have killed him. Can you determine are painted different colors. Thc men have different who the murderer was if pets and have different favoritc drinks. Determine a) one of the three men is guilty, thc two innocent who owns a zebra and whosc favorite drink is min-

men ale telling the truth, but the statements of era1 water (which is one of the favorite drinks) given thc guilty man may or may not he true? these clues: The Englishman lives in the red house.

b) innocent men do not lic'? The Spaniard owns a dog. The Japanese man is a 57. Stcve would like to determine the relative salaries of painter.'rhe Italian drinks tea. The Norwegian lives

three coworkers using two facts. First, he knows that iu the first house on the iclt. Thc preen house is on ifFredisnot the highest paidof thc three, then Janice the right of the whitc one. The photographer hreeds is. Second, he knows that if Jauice is not the lowest snails.The diplomat lives in the yellow house. Milk is paid, then Maggie is paid the most. Is i t possihle to drunk in the middle house. The owncr of thc green determine thc relative salaries of Fred. Maggie. and house drinks coffreThe Norwegian's house is next l o Janice from what Steve knows? If so. who is paid the the hlue onc.Theviolinist drinks orangejuice.The fox most and who the least? Explain your reasoning. is in a house next to that of the physician.The horse is

58. Five friends have access to a chat room. Is it pos- in a house next to that of the diplomat. (Hinr: Make a sible to determine who is chatting if the following table where the rows represent the men and columns information is km~wn? Either Kcvin or Heather, o r represent the color ol their houses, their jobs, their both, are chatting. Either Randy ox Vijay, but not pets, and their favorite drinks and nse logical reason- both. arc chatting. l i Abby is chatting, so is Randy ing 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 of this, mcthods

Page 25: Rosen Ch1 Excerpt

1.2 Propositional Equivalences 21

:rt cn bs :cs :nt ne in^ en se. ; a /es on :ds <is :en t to lox e is .e a nns leir on-

~f a ods

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 fol- lowing 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 e p v - p is always true. it is a tautology. Since p A - p is always false, it is a contradiction. 4

LOGICAL EQUIVALENCES

Compound propositions that have the same truth values in all possible cases arc called Demo logically equivalent. We can also delinc this notion as follows.

DEFINITION 2 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.

Remark: The symbol = 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.

Extra One way to determine whether two propositionare equivalent is to use a truth table. Ex-pLe~ 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~cally equivalent. 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.

Page 26: Rosen Ch1 Excerpt

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~blnations of 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 values of - p v q and p i q agree, these propositions are logically equivalent. 4

EXAMPLE 4 Show that the propositions p V (q A r ) and ( p V q) A ( p v r ) arc logically cquivalent. This is the distributive law of disjunction over conjunction.

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 proposi- tions 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~cations and 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 thBool ran idrnlitiesinTable5 in Section 10.1.

Page 27: Rosen Ch1 Excerpt

1.2 Propositional Equivalences 23

u lh s of and 4

ruth 4

truth lcalll;

4

Iposl- three ves 11

ss any 'e also 1s and lences

:m with

TABLE 4 A DemonstrationThat p v (q A r ) and ( p v q ) A ( p v r ) Are Logically Equivalent.

P 9 r I q A r I p v ( ~ A r ) I p v q I p v r I ( p v q ) ~ ( p v r )

T T T T T F T F T T F F F T T F T F F F T F F F

The associative law tor disjunctionshows that the erpression pvq 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, p2 . . . . , p,, are propositions. Furthermore, note that D e Morgan's laws extend to

-(PI V pl V . . . V p,,) = (-pl A -p2 A . . . A -p,)

and

(Methods for proving these identities will be given in Section 3.3.)

AUGUSTUS DE MORGAN (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).

Links (De Morgan caurioned the cauntcss against studying too much mathematies, sinee it might in te~fere with her childbea~ing abilities!)

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~erplanation of 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.

Page 28: Rosen Ch1 Excerpt
Page 29: Rosen Ch1 Excerpt

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 and q are logically equivalent and q a n d r a re 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 are logically equivalent

Solrrfion: W e could use a truth table t o show that thcse compound propositions a re 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 ) ) and cnding with - p A -q. W e have thc following equivalences.

- ( p V ( - p A 4 ) ) - p A -(-p A 4 ) from the second D c Morgan's law

= - p A 1-(-p) V -([I from the first De Morgan'r lax,

- - p A ( p V - q ) from thc double negation law

= ( -p A p) V ( -p A -4) from the second distributive law

= F v ( - P A - q ) bincs - p A p = F = (-p A -4) V F from the commutative law

for disjuncli<ln

EE - p A -y from the identity law for F

Consequently - ( p i / (-p A q ) ) and - p A -q are logically cquivalent. 4

EXAMPLE 6 Show that ( p A q ) i ( p v q ) is a tautology

Solrrfion: To show thal this statement is a tautology, we will use logical equivalences t o demonstrate thal i L is logically equivalent t o T. (Note:This could also bc done using a truth table.)

( p A q ) + ( p V q ) -- - ( p A 4 ) V ( p V q ) hy Example 3

= ( -p V -4 ) V ( p V q ) by the first De hlorgan's law

= ( -p V p ) V (-4 V ' 1 ) by the associative and commutative laws lor disjunction

= T v T by Example 1 and the commulative law for disjunction

= T by the domination law 4

A truth table can he used t o determine whether a compound proposition is a tautol- ogy. This can bc done hy hand for aproposition with a s n ~ a l l number of variables,but when the number ol variables grows, this becomes impractical. For instance, there a re 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.

Page 30: Rosen Ch1 Excerpt

26 1 /The Foundations: Logic and Proof, Sets, and Functions 1-2fi

20 variables is a tautology. Bu t when therc are IOOO variables, can even a computer dc -

termine in a reasonable amount of t ime whether a compound proposition is a tautology'!

Checking every o n e of the 2'"' ( a number with more than 300 decimal digits) possible combinations of truth values simply cannot b e d o n e by a compute r in even trillions of

years. Furthermore, n o o the r procedures a re known that a compute r can follow t o dcter-

mine in a reasonable amount of t ime whether a compound proposition in such a large number olvar iablcs is a tautology. We will study quest ions such as this in Chap te r 2, when

we study the complexity of algorithms.

Exercises 1. Use truth tahles t o verify thcsc equivalrnces.

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 - 1 1

2. Show that -1-p) a n d p are logically equivalent. 3. Use truth t:~hles to verify the commutative laws

a ) p ' i q = q v p h ) p ~ q ~ q r ~

4. Use 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 )

5. Use o Lrnth tnhle to verily the dislributivc law 1, A lq 'i r ) G ( p A q ) L ( p A I ) .

6 . Ube a truth table to verify the equivalence +p " q ) E - p V -q.

7. Shnw that each of these implications is a tautology hy usinl: truth tahles.

c P + P - 1 d ) ( P ,, q ) + ( p 4 q ) e 1 + q + f ) - ( p -+ q ) - -q

8. Show that tach of these implications is a Lautology by using truth tables.

a ) [ - P A ( P v 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

9. Show that each implication in Exercise 7 is a tautol- ogy without usins truth tables.

10. Show that each implication in Exercise 8 is a tautol- ogy wilhout using truth tahles.

11. Use truth tables to verify the absorption laws s ) p v ( p h q ! = p b ) p ~ ( p v q ) = p

12. Determine whether I -p A ( p + q ) ) + -q is a tau^ tology.

13. Determine whether (-q A ( p -+ y ) ) + -11 is a tau- . ~

a) ( P A q ) - lJ b ) P + ( ~ ~ 4 1 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 New Yolk. In 191b he rcturnrd lo Harverd as a faculty rncmbrr in the philosophy department. Hc remained at Harvard until his retirzment in 11J52. I

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~moi i ro . In this samc editinn Russell

Links wrote that Sh?ffcr had invcnled a powcrful mcthod that could he used to simpl~fy the Principio. Because o l this w~mment. Shrlkr was something of a mvstery man to logicinns.espccially hecause Sheffcr. who publi~hedlittlein hiscareev,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~ues or dirtineuishcd wests vcritine Harunid. Shcffer was barely live fcet tall: hc was noted f t ~ r his

SheUer is also creditid with coining the term "Boolean algehl- the suhject of ~ h a p t c r 10 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?.

Page 31: Rosen Ch1 Excerpt

de-

gy? ible s of ,ter- 1rgc hen

in the lied at 3 1905, (nard. ,demic 1<sota, i3cul ty

y alter <ussell ecallse :r, who raphed

Aid not ven his far his lan<ly. neriti." IS text). (is layic :d from

14. Show that p cr y and ( p A q l \ ( -p A -q) arc equiv- alent.

15. Show that ( p - y l - r and p - (q - r ) are not equivalent.

16. Show that p - y and -q - - p arc logically cqniv- alent.

17. Show that - p - y and 1, - -q are logically equiv- alent.

18. Show that - ( p fE q) and 1, tr q are logically equiva- lent.

19. Show that - ( p tr y) and -11 tr i] are logically eqniv- alent.

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 logi- cally equivalent.

25. Show that p tt y and ( p + y) A (y + p) arc logi- cally equivalent.

26. Show that p tr q and -1, tt -y are logically equiv- alent.

27. Show that - ( p tr y) and p tr -q arelogically equiv- alent.

28. Show that ( p v y) A ( - p v r ) + (q V r ) is a lantol-

OgY. 29. Show that ( p + y) A ( q + r ) + ( p + r ) is a tautol-

ogy. The dual of a compound proposition that contains only thc logical operators v, A, and - is the proposition ob- tained 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 L.. ... "y J

30. Find thc dual ol each 01 these propositions. a) p A -(I A -r b) ( p A y A 1.1 r

C) ( / l i i F ) A ( y \ , T I 31. Show lhal (r'l' = s. 32. 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.

**33. Why are the duals 01 two cquivalent compr~und propositions also equivalent, where these compound proposilions contain only the operators A , ,/,and -?

34. 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.)

35. Find a compound proposition involving the proposi- tions p. q.and r that is true wheneractly twoofp. q ,

1.2 Exercises 27

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 vari- ables is specified. Show that a compound proposi- tion 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 proposi- tion 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 com- plete collection of logical operators. (Hint First use De Morgan's law to show thar p 'i q is equivalent to -(-P A T 1 . 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 i t 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 i t 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 N A N D .

41. Show that p 1 y is logically equivalent to - ( p A q). 42, Conslruct a truth table for the logical operator N O R . 43, Show that p 1 q is logically equivalent to - ( p v q) . 44. In this exercise we will show that / $ J is 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 equiva-

l c n t t o p v q . 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.

Page 32: Rosen Ch1 Excerpt

28 1 /The Foundations: Logic and Proof, Sets, and Funutions

48. Showthatp 1 (q I r ) a n d ( p I y) I r arenorequivalent. q v - r v -3 , -p v -q v -r, p v r v s, p L r v -s so that the logical operator I is not associative. can he made simultaneously true by an assignment

*49. How many different truth tables o f compound propo- of truth values t o p, y, r , and s? sitions are there that involve the propositions p

A compound proposition is satisfiable if therc is an assign- ment of truth values to the variables in the proposition

50. Show that i f 1,. q. and r are compound propositions thar makes the compound proposition truc.

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? 51. The following sentence is taken from the specifica- a) ( p v q v - r ) A ( p L -y v -9) A ([I v -r v -4) A

Lion of a telephone system:"lf the directory database (-p v -q v -sl .? ( p v q v - a ) is opened. (hen the monitor is put in a closed stale. if h) (-p'V -y v r ) A (-I> v q v - 5 ) f i ( p 'd -y V -91 A the system is not in its initial state."This specification (-,, \* -r ,d 7.7) A ( p ,\, y \, - r ) A ( p v -r v -.<I is hard to understand since it involves two implica-

c) ( p V q V r - ) A ( p v -y v -.s) A (y \* -r V .?I ? tions. Find an cquivalent, easier-to-understand spec- (-[, V ' V ') ? ('p V q V -s) A ( p 'V 7 q V - r ) A

ification thar involvcs disjunctions and negations but (-p v -y v i) n (-p V -r v 7 . 7 )

not implieations. 52. How many of thc disjunctions p v -q, -p v y, q v r , 55. Expla~n how an algorithm for determining whether

q v -r, -y v -r can be made simultaneously truc by a compound proposition is satisfiable can be urcd to an assi~nment of truth values to p. q.and r ? determine whether a eompound proposition is a tau-

53. How many of the disjunctions p ,/ -y v r . -p v tology. (Hirrr: Look at -p, where p is the proposition - v - v - v - 7 , --p v q v 7 .7 , q v r ,i -r. that ia being examined.)

m. Predicates and Quantifiers

INTRODUCTION -

Statements involvinz variables, such as

"x > 3," .'a = y + 3," and " x + ? = z,"

are often found in mathematical assertions and in computer programs. These statements a rc neither truc nor false when the values of the variables a re not specified. In this section we will discuss the ways that propositions can be produced f rom such statements.

The statement ''1 is greater than 3" hos two parts. The first part, the variable x , is the subject of thc statement. The second part-the predicate. "is greater than ?"-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 the statement " x > 3." W h a ~ are the t ruth values of P ( 4 ) and P ( 2 j ?

Solution: We obtain the 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 state- ment "2 r 3," is false.

W e can also have statements that involve more than one variable. For instance, con- sider the statement "x = ?. + 3." We can denote this statement by Q ( x , y ) , where r; and y are variables and Q is the predicate. When values a re assigned t o thc variables x and y , the statement Q ( x , y ) has a truth value.

Page 33: Rosen Ch1 Excerpt

ier to

1U-

Ion

, thc S to '+ is ; the 1s P es a

3." tate-

4

1-29

EXAMPLE 2

Exlne Ex1Mplea

EXAMPLE 3

1.3 Predicates and Quantifiers 29

I.el Q ( I - , v) denote the stntcmcnt "x -- y + 3.'' What are the truth values of the proposit~ons Q ( l 2 ) and Q(3, O)?

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 proposii(ion "3 = 0 + 3.' which is true. 4

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.

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

In general, a statement involving then variables x l , x2, . . . , x,, can be denoted by

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 - versatile intellscl lloln rhc llnilrd Slates; he war hovn in Camhridge,Massachusetts. His lather,Benjam~n Pcirce. was a ~mfessor of 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 Su~vcy . wilh thc goal of bettcr nudcr- standingscicntific 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 dc s igno fpe~~Ju lun~s ;~nd lo mappro~ect~ons,applyingnrwmathematical developmentsin the theory ofclliptic function% He was the first pelson to use the wavelength oflight a sa unit olmeasurerncnt R i ~ c e r o s e lu the position ofAssistantforthe Survry,aposilion he held until he was forccd 1<1 resign 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 d ta artificial i$%lcllircnce. Peirce believed that the sludy of . .. mathemilticscould develop the mind'spowers of imaginalion,ahstracrion,and generalization. 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~g bcicnlilic papers guest lecturing. and textbook writhe. Unlor tunate l~ the income Irom these pursuits was insufficient to protect him and his second wife from abject poverty He was ~uppor t rd in his later years by a fund created by his mdny admirers and adminislcr~d hy the philos<~pller William James, hts l~telong friend. Although Peirce wrote and published vr~luminously in 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 s h m p n t s to the world

Page 34: Rosen Ch1 Excerpt

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

i f x > O t h e n x : = 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 state- ment becomes a proposition with a certain truth value. However, there is another im- portant 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 quantifi- cation. 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 i t 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?

Page 35: Rosen Ch1 Excerpt

1.3 Predicates and Quantifiers 31

lint rue lf x not 4

ate- im- ion. and IF is

at a 'erse ntifi- that

re of

tifier.

ether n i t is

Extra Solr~tiorr: Sincc P ( x ) is true for all real numbers x , the quantification Examples

VxP(.r)

is true. 4

EXAMPLE 6 Let Q(x) bc thcs t a t emen 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. 4

When all the elements in the universe of discourse can be listed-say, a,, .rzl . . . , x,-it follows that the universal quantification VxP(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 What is the truth value of VaP(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 VxP(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 VxP(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.

I I

EXAMPLE 9 What is the truth value of vx(x2 > 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 ~ > I- ifandonly i fx 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 true, since there are no intepers .r with 0 c x c 1. 4

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).

Page 36: Rosen Ch1 Excerpt

32 1 /The Foundations: Logic and Proof, Sets, and Fnnctions 1-32

EXAMPLE 10 Suppose that P ( x ) is .'x2 > O."To show the statement V x P ( x ) is false where the uni- verse 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 exis- tential 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 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?

Extra Examples

Sol~~t ion: Sinceh.r > 3"is truc-for instance, whenx = 4-the existential quantification of P ( x ) , which is 3 x P ( . r ) , is truc. 4

EXAMPLE 12 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. X I , 1 2 . . . . , x , ~ - the existential quantification 3 x P ( x ) is the same as the disjunction

P ( x 1 ) V P ( r 2 ) V . . . V P ( . r , , ) ,

since thisdisjunctionis trucif andonly if at least one of P ( x 1 ) . P ( A ~ ) , . . . , P(.r . ) is true.

Page 37: Rosen Ch1 Excerpt

1.3 Predicates and Quantifiers 33

mi- hat In 0 4

that :XIS- truc

cation

cation 4

(cation

ication 4

is true.

1 TABLE 1 Quantifiers. I 1 Srofemenf When TmeP 1 When False? 1

V.r P (.r 1 P ( x ) is true for cvery x. There is an x for which P ( x ) is false. 3.r P (.r ) Thcrc is an x for which P ( x ) is true. P ( x ) is false for every x.

EXAMPLE 13 What is the truth value of 3 x P ( x ) where P ( x ) is the statement "x2 > 1 0 and the uni- verse of discourse consists of the positive integers not cxcccding 47

Solution: Since the universe of discourse is (1, 2, 3,4], the proposition 3x 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 of 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 of 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.

EXAMPLE 14 In the statement 3 x Q ( x , 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 no 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 3x 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

Page 38: Rosen Ch1 Excerpt

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 3x (P(x ) A Q(x)) V VyR(y), because the scopes of thc two quantifiers do not over- lap. ?he reader should be awarc that in conlnlon usage, the same Ictter is often ured to represent variables bound by different quantifiers with scopes that do no1 overlap. 4

NEGATIONS

Extra Examples

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:

Suppose we wish to 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(xl ) 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 3x-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.

Page 39: Rosen Ch1 Excerpt

this e in urse :inal

:r the his is

,t this s who as not riginal

rments, ctl? the r) is the '(12) " 3x P ( x ) uivalent

1-35 1.3 Predicates and Quantifiers 35

1 TABLE 2 Negating Quantifiers. I When Is Nenation True? When False?

EXAMPLE 15 What are the negations of the statements "There is an honest politician" and "All Amer- icans eat cheesehurgers"?

For every x , P(.r) is false.

There is an .r lor which P(x) is false.

Sobition: Let H(.v) denote "x is honest."Then the statement "There is an honest politi- cian" 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 nega- tion 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.)

Extra Examples

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

There is an x for which P(x) is true.

P(x) is true for every x.

EXAMPLE 16 What are the negation5 of thc btatements vx(x2 > x ) and 3x(.r2 = 2)?

Solritior~: ?hc negation of vx(x2 > x) is the statement -v.r(x2 > x), which is equi- valent 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

Translating sentences in English (or other natural languages) into logical expressions is a crucial task in mathematics, logic programming. artificial intelligence, soRware engineer- ing,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 expres- sions. In this section,use restrict ourselves to sentences that can be translated into logical

Page 40: Rosen Ch1 Excerpt

36 1 I'l'he Foundations: Lugic and Proof, Sots, and Function- 1 3 6

expressionsusinga single quantifiertin the next section,we will look at more complicelcd srntcnccs that rcquire multiple quantifiers.

EXAMPLE 17 Express the statement "Every student in this class has studied calculus" using predicates and quantifiers.

Extra Examglee

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 cal- culus." 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 >elect dcpcnds on the subssq~rent reason- ing 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 Cix)) 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 calcu- lus.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 Qix , 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~t in 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

Page 41: Rosen Ch1 Excerpt

1.3 Predicates a n d Quantifiers 37

cated

icates

priate

ed cal- e class.

-se and 'eason- people people,

~tement pressed lass and

:scalcu- iudcnt r ,roaches

4

atement pproach

that

Mexico."

:o." If the e this first

3ok at the

Links

"-fiere is a person x having the properties that x is a student in this class and x has visited Mexico."

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 3x(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 3x(S(x) -t M(x)) , which is true when there is someone not in the class.]

Similarly, the second statement can he expressed as

"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 state- ment 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

"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 tha tx hasvisitedMexico and a has visited Canada, respectively, we could use a two-place predicate V(x, ?I to 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 with the one-variable predicates M(x) and C(x). 4

EXAMPLES FROM LEWIS CARROLL

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

CHARLES LUTWIDGE DODGSON (1832-1898) We know Charles Dodgson as 1,rwir Curroll- the pseudonym he uscd in his writings on logic Dodgson, the son ol a clergyman, was the third oi I I children.all oiwhomstuurrer l . Hewasuncumfortoblcin the company o i ~ d u l t s a n d i s s a i d tu havespoken withoutstuurringouly toyounggi~ls,manyofwho~n hcenlrrtaincd,corrcspondrd with.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 d in 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 ai tournamrnls and elections. ( H e also used the pseudonym Lewis Carroll lor his (many works on rccrralional logic.)

Page 42: Rosen Ch1 Excerpt

38 1 1 The Foundations: Logic and Proof, Sets, and Functions 1 3 8

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:

V x ( P ( x ) - Q ( x ) ) . 3 . r ( P ( x ) A - R ( x ) ) .

3 x ( 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

3 x ( Q ( x ) + - R ( x ) ) . 4

EXAMPLE 20 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 ) ) .

- 3 x ( Q ( x ) A R ( x ) ) . V x ( - 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 be discusscd in Section 1.5.) 4

Page 43: Rosen Ch1 Excerpt

ialid : t h e that

nent

'ason x)) is Irinks

I valid

large." :rse of ltifiers

dull in a valid ssed in

4

1.3 Predicates and (luantifiers 39

LOGIC PROGRAMMING

An important type of programming language is designed to reason using the rules of Links 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.

EXAMPLE 21 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:

(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

teaches (P, s ) : - instructor(P,C) , enrolled(S,Cl

which means that tenches(p, s ) is true i f 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 11 is 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

produces the responsc

kevin kiko

Page 44: Rosen Ch1 Excerpt

40 11 The Foundations: Logic and Proof, Sets, and Functions 1 4 0

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 pro- fessors who are instructors in classes being taken by Juana, we use t h e query

? teaches (X, j u a n a )

This query returns

pa te1 grossman 4

Exercises 1. Let P ( x ) denote thc statement "x i 4,"What are the of discourse consists of all animals.

truth values'? a) Vt(R(x) + H(x)) b) Vx(R(x) A H(x)) a ) P(O) b) P(4l C) P(6l c R r + H i d) 3x(R(x) A H(x))

2. Let P ( x ) be thc statcmenl "the word x contains the 9. Let P(.vl he the statement ".r can speak Russian"and letter a " What are (he truth values? Ict Q ( t i be the statement "r; knows the computer

a) P(orange) b) P(lernon) language C++." Express each of these sentences in

C) P(true) d ) P(falsc) terms of P(r) . Q(x), quantifiers, and logical connec- tives The universe of discourse for quantifiers con-

3. Let Q(x. ?) denote the statement "x is thc capital sists o f all studcnts at your school. nf v." What are these truth values?

a ) There is a student at your school who can speak a) Q(Dcnvrr,Colorndo) Russian and who knows C++. b) Q(Dclroi1,Michigan) b) There is a student at your hchool who can speak C) Q(Massachusrlts,Boston)

Russiau hut who doesn't know C++. d) Q(New York,New York)

C) Every student at your school either can speak 4. State the value of x after the statement if P i t i Russian or knows C++.

then x := I is executed, where P(1) is the stale- d) No student at your szhool can speak Russian or mcnt "x > I," if the value of x when this stalcmcnt knows C++. is reached is 10. Le lC(x) be the s ta tc rnen t"~ hasacat,"let D(x) he the a ) . r = O . b) x = I . C) x = 2 . s t a t c m e n t " ~ has adog."and let F(x) be thcstatement

5. Lzt P(x) be the statement " x spends rnorz than five "1 has a ferret." Exprcss each of these statements in hours every weekday in class," where the universe of tcrrnsof C(x), U ( x ) . F(ri.quanlifiers,andlogicalcon- discourse for x consists of all studenls. Express cach neclives. Let the universe of discourse consist of all of these quantifications in English. students in your class.

a ) 3 ~ P ( r ) b ) V x P ( x ) a ) A student in your class has a cat, a dog, and a fer- c) 31-P(rl d ) Vx-P(xl ret.

6. Let N(x) be the staterncnt "I has visited North b) All students in your class have a cat. a dog, o r a

Dakota," where the universe o f discourse consists of ferret.

the students in your school. Express each of thesz c) Some student in your class has a cat and a ferret.

quantifications in E n ~ l i s h . hut not a dog. d ) No student in your class has a cat, a dog. and a

a) 3xN(x) b) Vl-Nix) c) -3.rNi.r) ferret. d) 3x-N(x) e) - V N f) Vx-N(x) e) For each of the three animals, cats, dogs. and fer-

7. Translate these statements into English, where C ( r ) rets, there is a student in your class who has one is "x is a comedian" and F(x) is " x is funny" and thc of these animals as a pet. universe of discourse consists of all people. 11. Let P ( t 1 bet he statement"^ = x2."Ifthcuniverseof a ) Vx(C(x) - F(x)) b) Vx(C(x) A F ( r ) ) discourse consists of the intcgers, what are the truth C) 3x(C(.rl 4 F(x)) d) 3x(C(x) A F(x) ) values?

8. Translate these statements into English, whcrc R(A) a ) P(O) b ) ~ ( 1 1 C) P(?) is") is a rahhitWand H(x) is"x hopssand theuniverse d)P(-1) e ) 3 r P ( r I f ) V t P ( t i

Page 45: Rosen Ch1 Excerpt

.!pu!~ qeads louues oqm looqss inok u! luapnls e s! alaql (q

.ueu~a!i\ u! pan![ seq looqss inok u! ~uapnls v (e I 'salqe!.len om1 ql!m

pue ?uo q1!m sa)ea!paJd au!sn Lq pue aslnoasrp jo asian!un aql au!li.~en i(q skew luaraJJ!p aalql u1 suo!s -sa~dxa [ea!Xol olu! smaualels asaql jo q~eaa~e[sue~l 'SZ

..i~nluas qla -!luami aq) u! u~oq sem [onqss ~noA u! auolan~ (a ,.iddeq lou s! oqm looqas 1no.i u! uosiad e si a1aq1 (p

.a[aD~o~ou u pun aphq e qloq sumo looqas 1noL u! auo ON (J

'++3 pun sn[ns[es pa!pnls seq ssels inoli u! auoL1an3 (q 'uels!qaqzn pai!s~~ suq [ooqss ~nok u! auoamos (n

'sa[qe!len om] qi!n pue auo ql!n saies!pa.~d du!sn Lq pue as~noss~p 30 aslan!un aqt 8u!A~en liq sAe~ lualaJJ!p aalql u! suo!s -sa~dxa les!Xol OIU! sluamalels asaql~o qsea ale[sneq .pz

-1sajiad IOU s! auoamos lo pua!q inok s! lipoq.iiaha ION (1

.lsajlad s! pun pua!q 1nok 51 ?uoAlan3 (a 'laapad s! spuapj ~noli lo auo (p

.wayad ale spu?!~j ~nok 11~ (J 'laapad s! auokaha ION (q

.iaajiad s! auo ON (e

'S3A!13?UUOJ

le3!407 pue 'slag!luenb 'saies!paid 4u!sn suo!ssa~d xa les!Xol olu! sluaus)~~s ~saqi jo qsea alelsue~~ 'EZ

'q3!1 aq or luem IOU saop ssrls inoA u! ~uapnls auo~ (a

.suo!~enhs s!]e~penb anlos ue3 ssep ~nok u! sluapnls II~ (p 'm!ms louuea oqm ssep Jnoli u! uos~ad e s! aiaql (2

.a!nou uZ!aroj e uags seq ssela ~noL u! Lpoqauos (q .?uoqd re[n[[as u seq ssels ~noL u! auoOa.%g (s

'aldoad 1le JO 1s!suo3 I! la1 'puosas pur? csels inoL u! sluapnls aqljo ls!suos aslno~s~p jo asian!un aql lal'ls1!~'san!l~auuo3 [e3!40[ pue 'slag!luenb 'Sal~3lpald Xu!sn suo!ssardx~ leJ!Xo[ olu! slualualels asaq~ JO qaea s.iem om1 u! glelsuex 'ZZ

.Bn~tucu~~doid s!Bo[ u!as~no~euaqe~seqssep~noku! luapnlso~ (a

.a!.\om e u! ua?q seq ssep 1no.i u! luspn~s v (p 'e!uJop[e3 u!

uloq IOU SeM oqm ssep 1noL u! uoslad us! alau (3 .klpua!~j s! ssep inok u! auo~anj (q

.!pu!~ qeads ues ssvla inoli u! anoaluos (B

-a[doad [le jo is!suo3 I! 1a['puo3as pur ssrp ~uoi u! siuapnls aqljo ]s!suos asInms!pJo aslan!un 241 la1 '~~~~san!laauuos [m!40[ pue 's~ag!luenb 's21u2!p?.1d Xupn suo!ssa~dxa le~!Xol olu! siuama~e~s asaqljo q3ea sLem om1 u! arelsueu .IZ

((~)d + (0 > X))~AV ((2)d-IXE (J

((x)d V (0 Z 0)XE (P

((I)d + IT # l-)IrA (J Ir!d>-~ (q (r)drt (6

.suo!lsun (uos puu'suor~sun~s~p'suo!~eXau Lluo au!sn pes~su~'siay!~ -uvnb Xu!m inoqly sruama~els asaql ssa~dxz~ 'S pue ' 1 1 - - 'S- jo slslsuoa (x)d uo!lsunJ leuo!l!s -odoid aqllo asJnoas!p JO asJaA!un aql lcqr asoddn~ 'OZ

1~)d-l~ ..\ ((x)d + (s # X))XA (a (r!drA- (P (")drE- (J

(xId.1.~ ((g (r)dxE (e

'suo!~aunjuoa puc'suo~~snnls!p'suo!leXau .iluo au!sn pealsu!'s~gg!l -uunh au!sn ~noql!m sluamalels asaql ssatdx~ s pue 'P'E';'[ s~aaalu! aqljo sls!suoa (x)d uo!rsunj [euo~]!s odold aql jo asmoss!p jo ssIan!un aql leg] asoddn~ '67

('Id%- 6 (")d"E- (a (r)d-xA (p (~)d-IE (J (X)~XA (9 (x)~"E (R

.suo!iuiiau pue'suo!~sun(uos'suo~~sun(s!p Xu~sn suo!l!sodnid asaql jo qsea ]no al!~~ 'Z puv 1.0 '['z s~aaaiu! aql JO s1s!suos (r)a uo!lJunJ [euo!l!s -odo~d aqr JO as~noss~p lo aslan!un aql ~eqi asoddn~ .gl

(XldxA- (J (r)dXE- (a (A)d-'A(P ('id-XE (J (r)d~kA (q (IJdXE In

'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 asrahlnn gql leqi asoddn~ .LT

(X # ;I)~A (P (1 2 z + &A (J (I- = zx)~-~ (q (Z = ;X)XE (R

'siytunu leal [le jo sls!suos alqepen q3ea jo asinoss!p lo asJan!nn aql J! sluamale~s asaql jo qse2 lo anlen qln.11 aql au!uJalaa '91

(0 > ;U)"E (P (U 2 ,ll)UA (3

(Z = ,I1)uE (q (0 2 llA (U

's~aXalu! lie jo sls!suos s2[qe!JeA [ILLOJ ~SI~OJS!~ JO asJan!un aql j! smaulateIs?s?q~~o qscajo anlen qlnJ1 ?ql au!mJalaa 'ST

(~IXZ)~A(P (;x= ;(X-))~~A (J

(zr ?.!-)YE (q (I- = bx)x~ (e

5Jaq -unu [eaJ [[e JO sls!suo~ aslnosslp jo asJaA!nn .I~I j!

sluaua~u~sasaq~~oqaea~oanlenq~ni~ 3qi ?u!mialaa VT

(" 2 z")uA (P (1,- = 1I)UE (3

(UE = ~Z)"E (9 (I, c I + U)VA (e

.SI~~.IIU! Ile jo sls!suo3 asJno3s!plo asJan!un aqj J! s~uaws~e~sasaql~o q3eaJo an[ehqlnll aq] au!mlalaa '£1

(~!G-XA (8 (x)o-rE 0 (~lfi"~ (a (y)oxE (P

cl)a (J (1-10 (9 cola (e

;sanlen qlnq asaql ale ~eqm 's~aXaiu! [le JO s~s~suos asinossrp JO asIan -Tun aq] JI .:'Z < I + x,. ~uamale~s aql aq (r)O la7 'ZI

auo re1

-121 PU

e pue '

qeads

qeads

-uos ! 4auu U! sa: Jalnd pue ..

Page 46: Rosen Ch1 Excerpt

42 1 /The Foundations: Logic and Proof, Stls. arid Functions 1 4 2

c) A studcnt in your school knows Java. Pnllog, and C) Every bird can fly. C++. d ) There is no dog that can talk.

d) Everyone in your class enjoysThai food. e) There is no one in this class who knows French e) Someone in your class does not play hockey. and Russian.

26. Trdns~ateeachoftheseslatementsinto~ogica~exprer- 32. Express the negation of these using sions using predicates,quantifiers,and logical connec- quantifiers, and then express the negation in English. tives.

s) Some clriverc do not obey the speed limit. a) Something is not in the correct placc. b) All Swedish movies are serious. b) All tools arc in the c o r ~ c t place and arc in exccl- C) No onc can keep a secret.

lent condition. d) There is someone in this class who does not have c) Everything is in thecorrect place and in excellent a eood attitude. -

condition. 33. Find a countercxample, if possible, to thcce univer- d ) Nothing is in thz correct place and is in excellent rally quantified statements, where the universe otdis-

condition. course for all variables consists of all integers. e) One oi your tools is not in the correct placc, but

it is in excellent condition. a) V.t(x2 ? x ) b) Vz(x > 0 v x < 0)

27. Express each of these statements uhing Iugical opcr- ators.predicatcs. and quantifiers.

8) Some propositions arc tautologies. b) The negation o f a conlradiction is a tautology

I C ) Thedisjunction of twocontingenciescan he a tau-

tology. d) The conjunction of two tautolog~es is a tautology.

28. Suppose thc universe o f discourse of the proposi- tionalfunction P(x. y)consisti,ofpairsx and y.where x i s 1 , 2 , o r 3 a n d ? 1s l , ? ,o r3 . Write out thcsepropo- silions using disjunctions and conjunctions.

8) 3 1 P ( x , 3) b) Vy P(1. ?) c) 3y-PI?. ?) d ) V.r - P (.T , 2)

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) All dogs have fleas. b) There is a horse that can add. C) Every koala can climb. d) 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 neg~t ion in 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.

C) Y.~-(.v = 1)

34. Find n counterexample, if possible, lo thece univer- sally quantified statements,wherc the uniwrseof dis- course for all variables consists of all real numbers.

a) Vi(.r2 # X ) b) V.r(x2 # 2 ) C) Y., 1J.r' > 0)

35. Express each of these statements using predicales and quantifiers.

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 previ- oustimeisless 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 the- sis, 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~ses 3W0 dral with the translalion hclaecn svs- tern specification and logical expressions involving quan- tifiers. 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) 3rS(x. open) b) V.r(S(.t. malfunctioning) v S(x. diagnostic)) c) j rS ix , open) v 3xS(x. diagnwlic) d) 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"Print jobj is lost."and Q ( j ) is"Print job j is queued."

a) 3p(FIj>) n B(p)) -. 3iL(.i)

Page 47: Rosen Ch1 Excerpt

licatcs

e flyer rs in n tyear. previ- ialifies is less

urs, or r's the- 3 in all ,ree. han 21 I Ks.

cn sys- 5 quan-

English 1,'' and :onsists iely.

1 where 'rinter p isUPrint

b) VPB(P) + 3if?(.i) C) 3 i i Q i i ) A U i ) ) + ~ P F ( P ) d) (VpRip) A V.iQ(i)) + 3 iL( 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 mes- sages are transmitted.

c) The diagnosticmonitor tracks thc status of all sys- tems 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 hilli.il

40. Express cach of thcsc system specificalions using predicates, quantifiers. and logical conncctivcs.

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 Vr(P(r ) - C)(.r)) and VrP(r1 - VxQlx) havc thc same truth value. 42. Show that VrlPlx! .\ Q(r i ) and VrP(r! .\ VrQ( 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~ablish these 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 Pl~c)) /, ,A = Vr(P(v) .A1 b) I ~ I P ~ I ) ~ ~ \ . A = ~ . I ~ P ( . V ) ~ \ . A I

46. Show thntV~P(r)vVrC)( . r )andVr(P(. r )vC)(r ) lare not logically equivalent.

47. Shnwthat3tP(r) . \3rC)(r) and3r(P(.r).\C)(.ri) are not logically cquivalcnt.

1.3 Exercises 43

48. The r~otatiot~ 3!xP(1) denotes the proposition

"There exists a nnique x such that P(x) is trne."

If the universe of discourse consists of all integers. what are the truth values? a) ~ ! x ( x > 1) h) 3 ! r ( r2 = 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 nega- tions, conjunctions, and disjunctions.

51. Given the Prolog facts in Example 21, what would Prolog return given these queries'?

a) ?instructor(chan,math273) b) ?instructor(patel,cs3011 C) ? e n r o l l e d ! X , c s 3 0 1 j d) ? e n r o l l e d ! k i k o , Y l e) ? t e a c h e s (g ros sman , 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 )

53. Suppose that Prolog facts are used to define the pred- icates molher(M. Y ) and ,tarher(F. X), which repre- sent that M is the mother of Y and F is the father of X.respcctivcly Give a Plologrule to define the pred- icale.,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 pred- icates mother(M. Y ) and fa/her(F, X), which repre- sent that M is themothelof Y and F is the father of X, respcctively Give a Prolog rule to define the pred- icatc grandfarher(X. Y), which represents that X is the grandfather of Y. (Hint: You can write a disjunc- tion 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"xisapro- fessor," "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.

Page 48: Rosen Ch1 Excerpt

44 11 The Foundations: Logic and Proof, Sets, and Functions 1 4 4

d) Does (c) follow from (a) and (I,)? If not, is there logical connectives; and P(x), Q(.r), R(xi, and S O . a correct conclusion? a) Babies are illogical.

56. Let P(.r), Q(r). and R(1-i be the stalements " x is a b) Nobody is despised who can manage n crocodile. clear explanation,"".r is salislaclury," and "i is an ex- C) Illogical persons are despised. cuse," r e~p rc t i v~ Iy Suppose that the univcrse or dis- d) Babies cannot manage crocodiles. course lor r consists of all English text. Express cach " e) Dues (d) lollow from (a). lb). and (c)? 11 not, is ol these statements using qu~nti t ien, logical connec- there a correct conclusion? tives, and P i r j , Q(x), and K(.I). 58. Let PIX). Qlr) , R(*),and S(*j be the statements ' . r a) All clcar explanations are satisCactory. is a duck,"-'.I is onc of m) poulrry,""~ ts an officer." b) Somc uxcusrs arc unsatislaclory. and "x is willing to waltz,"respectively. Express each C) Some excuses are not clear explanations. of these statements using quantitierr: logical conncc-

* d) Does (c) lollow from (a) and (b)'! II nut, is thcrc tivcs;and Pi.r), Q(r) Rir),and Six) . a correct conclu<ion? a) No ducks are willing to waltz.

57. Let P(.I), Q(LI, R(r1, and S(.rl be thc statements b) No officers ever drclinc to waltz. -'r is a baby," "x is logical," "I is able to mannge a C) All my poultry are ducks. crocodile." and " r is despised," respectively. Supposc d) My poultry arc not officers. that the universe of discourse consists of all people. * e) Dues (d) follow from (a). (h). and (c)? If not, is Express each ol ihdnc statements using qnantlfiers; 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~alhematical smtements.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 Vr3y(x t y = 0). Nestcd quantiliers commonly occur in tnathematics and computer science. Although ncstcd quautifiers can sometimes be diWcult to 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. To understand thcsc statements involving many quantifien, we need tounravel what the quantifiers and predicates that appear mean. This is illustrated in Example 1.

EXAMPLE 1 Aasumcthattheunivzrseofdi~courseforthe vuriablesx and y consistsofallrealnumbers. Thc statement

Additional steps 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)

says that for every real number x therc is a real number y such that x + v = 0.This slates

Extra that every real numhcr has an additive inverse. Similarly, the statement Examplcs

VxVyVz(x + i?. + z) = ( .r + y) + z ) is the associatibc law for addition o l r ca l numbers. 4

Page 49: Rosen Ch1 Excerpt

4 4

:). I EXAMPLE 2 Translate into English the statement

1.4 Nested Quantifiers 45

iilc.

~ t , is

s " X

xr." 2ach nec-

lot, is

-

r they e used nested :has in cs and rstand.

- srstand ers and

umbers.

law for

xis states

4

VxV,y( (x > 0 ) A (y < 0 ) + ( x y < 0)).

where the universe of discourse for both variablcs consists of all real numbers.

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

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.

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. every student in your school has a computer or has a fricnd who has a computcr. 4

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 whose friends arc also friends with each other. 4 I

TRANSLATING SENTENCES INTO LOGICAL EXPRESSIONS

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.

EXAMPLE 5 Express the statement "If a person is female and is a parent, then this person is some- one's mother" as a logical exprcssion involving predicates,quantifiers with a univcrse of discourse consisting of all people, and logical connectives.

Page 50: Rosen Ch1 Excerpt

.a[qwa~ard .illensn S! uo!jnlos lsiy aql'dlluanbasuo3 .salqa!len aql Buoue sd!qsuo!]e[ai aql sa~nasqo iaqmauros J! 'weduos alou s! s!qj q8noqilv.,-n uo j uaqel seq m,, s! (a 'j 'm)~ aiaqm

'(n *j ';II)~~EDA~E

se passaldxa aq osle plnos luaualels au 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~J asinoss!p jo sasian!un aq] aiaqm

'((u'J)O v (J '~)~)JEDA"E

se ~uama~e~s aql ssaidxa ues ah ,;u uo lqBy e s! j,, aq (u .j)G pue ,,j uayel s~q (11.. ?q (j 'm)d 127 :UO!JII~OS

.;PIJOM aql u! auyi!e .iiana uo lqa!y e uayei seq oqm ueuom e s! aJayL.. iuauaiels aqr ssa~dxa ox siay!~uenb asn L $?dm3

(.oi:,eru e re jo iqlnoql aq ues i~ ,,iay!manb ssauanblun.. ayL.~ pue A siay!luenb aqi Bu!sn passa.rdra aq ues leql sluamalejs u!ellas aiu!ssa~dxa ~oj pueqlloqs e s! 'iaqjeJ :~ag!tuenb e dlleai jou s! ..iay!tuenb ssauanb!on,, aql'laAamoH 'c uo~~sas jo 8~ as!:,iaxz~ u! pauyap i,iay!)uenb ssauanb!un.. aql s! i~ alaqm '(d 'x)gXi~x~ se mamateis s!ql aj!im uos am leql alo~)

'(((2 'X)g- t (d # 2))2A V (d 'x)~)~CEXA

se passa~dx? aq ue3 luaualels 1eu!a!io inoillu?nb?suo3

.(((2 'x)g- t (i # Z))ZA v (X 'i')g)d~

se paluasaidai aq ue:, puaq 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 UP~M 'x jo pua~ij lsaq aql lou s! 2 uaqi 'd uos~sd tou s! 2 uosiad j! '2 uosiad d.~ana 102 ieq~ 'a.romiaqllnj 'pue 'x jo puaq jsaq aq) s! oqm d uosiad e s! araql leql suearu pua!lj lsaq auo d~lsexa seq 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 uos~ad) r~,, se awes aql s! luaualels s!ql leql aas am 'lag!luenb leslan!un aql Bu!snpo~)u~ ,,-pua!~ lsaq auo dpsexa seq x uosiad 'r unsiad dla~a io.~,. se passaldxa aq ue:, ,,pua!q Iraq auo dlisexa seq auoi~a.\zJ,, ruauale~s ayL :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 37dm3

b .((d 'X)W t ((x)d v (X)~)).<EXA

uo!snaldxa luale~!nba ue u!elqo ox '(x)d v (x)d u! leadde lou saop d asnesaq 'tjq ~q] 01 iem arll IIe d~ anou ues aM

'((I 'X)W~E t ((x)d v (x)~))YA

sa paluasa~dal aq ue:, luamalels leu!B!lo ayL,,'.< jo Jaqlou aql s! I,, luasaidal ol (d 'x)~ pue .,'maled e s! x,, luasaldal oi (x)d ,,'a[euaj s! x,, ~uasaldalol (.i-)d sale:,!pald aq] asnpollu! aM .;d uoslad jo ~aqloru aql s! x uosmd leql qsns d uoslad e sis!xa aiaql uaql'lualed e s! x uoslad pue aleuaj s! x uoslad j! 'x uoslad Lana lo.^,, se passaldxa aq ues ,.iaqlou s,auo -awns s! uoslad s!ql uaq) 'lualed e s! pue areuaj s! uoslad e j~, luauales ayL :un!inlos

9Fr suoq~m J pue 'sla~ foold pue ~!aa? :suog-epmo~ au /I 9p

Page 51: Rosen Ch1 Excerpt

me- 'son y." is a

7 be

:d as ersal best

F the on y. e the d can

eness ier" is at can ought

4

world,

ewhat sually

4

1 4 7 1.4 Nested Quantifiers 41

Mathematical statements expressed in English can be translated into logicalexpres. sions as Examples 8-10 show.

EXAMPLE 8 Translate the statement "The sum of two positive integers is positive" into a logicalex- pression.

Additional Sol~aion: To translate this statement into a logical expression, we first rewrite it so that the Steps 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. 4

I EXAMPLE 9 Translate the statement "Every real number except zero has a multiplicative inverse."

Extra Solnrion: We first rewrite this as "For every real number x except zero. .r has a multi- Exa*plcx plicative 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

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

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

Statements involvingnested quantifiers can be negated by successively applying the rules for negatlngstatements involving a single quantifier.This is illustrated in Examples 11-13.

Page 52: Rosen Ch1 Excerpt

'3 2 17 - (x)j'I PUc 9 > Iu - XI > 0 leq) qsns x laqlunu [ear e sls!xa alaql'o < y laqlunu leal ila~2 lo3 leql qsns 0 < 3 laqlunu par e S! alaql 7 laqlunu leal kana 101 leql sbes lualu.xets ise[ S!LU

'13 2 17 - (y)Jl v 9 > 1''- 4 > 0)XE O<?A0<3E7A

sr: passaldxa aq ueJ ~ualualels s!y~ '7 # (x)J' "'xu~![ '7 waqmnu JC~I 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 am

'(~~~-(.),V~>!D-X~>O)XEO<~AO<~E=

(3> 17-(x)j'l +9> k-x\>OI-xEO<?AO< 3EG

(3 > 17- (*)/I t 9 i ID- XI > ())XA-() < 9AO < 3E G

(~>~~-(x)J]C~>ID-YI>~)XAO<~E-~<~E~

(3 > 17-(').II t 9 > In- > O)XAO < 9EO < 3A-

sluaiualols lus[en(nba lo asuanbas s!ql 1snllsuos am 'suo!ssa~dxa pagguenb Buge%au 101 salnr aql Ou!dldde d[an!ssassns

'(3 > 17 + 9 > 10- XI > O)AO < 9EO < 3AL

ss passaldxa aq ue3 7 # (I) j' "+r~![ IU~IU~I~IS aql '01 aldmexx Su!sn bg .7 # (x)/' "-'LU![ '7 s1'.7qlunu Iual 11' 10) lcql sueaiu pxa IOU saop (x) j' "'-'LU!~ leql iss ol :uolrtilnS

.ISLXS IOU saop ( a),! "-'ul![ leql l3ej aql ~sa~dra (11 salos!pald pue slay!luenb asn ~1 37dm3 ,;au![~!e s!qi uo lou s! lqS![l laqllo iqZ!y loql uayel iou seq unulom

'((0 :/)o- A ($ 'm)d-)j'~DErll,A

((0 'J)a \I (4' .*n)d)-j',k,~~ln~

((D'!)a v (/' 'm)d).lEL~Em~ = ((0'j)a v (/' '[I~)~)JE~A-~A :slualualels jo asuanbas s!ql~o qxa 01

lualcn!nba s!lualualels lno leql puy am'dals lscl aql u1 ME[ s,ue8lo~ aa Ou!ilddc bq pue slay!luenb anlssa3sns aprsu! uo!]e%au aql aAou 01 €.I uOuaa~)O 3[qsLLUolj Slualu~l~IS pay!lusnb Bu!lcBau I~J salnl aql Burdldde blan!ssa~~ns bg ".o uo ~qY!y e s! J.. s! (D :[)a PUP,,/ uayel seq m..s! (J 'm)d aJaqmc((n :/)a v (,/ 'm)d) ~'EDA~E- se passaldxaaq un3 lualualcis mo.~ a~dmex~ bg .L aldluexz~ luolj ,.pllom aql u! au!ll!e kana uo iq%!y c uaqel seq oqm ueluom r s!alau,,lualualels aql jouo!~eSau aql s! IuauIalelP S!~LI. :IIO!J~IOS

,;P[IOM aql u! au!ll!e d~ana uo iq%!y e uaqel scq oqm ui!mom e is!xa IOU saop aiau,, leql lualualels aql ssaldxa 01 s~ay!~uenb asn ZI 37dm3 t '(1 # dx),C~x~ sc passaldra aq ueJ lualualels paleYau mo leql apnlau(ls am.1 # .Cx ye d[dlu!s aloLu passaldaa aq ues (1 = Xx)- asu!~ .([ = .CX)LXAXE 01 luale~!nba SF qgm .(I = .ix).C~-x~ 01 luali?h!nba s! ([ = ix)X~x~- jcql pug aM .s.ray!luenb aq] 11s ap!su! (1 = .CX).<E.XAL u! uo!leYau aql anom ues am '€.I uo!l~as )o z qqe~ u! uan!% slualualels pay!luenb %u!le%ao lo) sa(n.1 aql Bo!bldde i[aa!ssasans La :rro!rti/oS

sa[dweq ealra

.~ay!]uenb e sapasa~d uo!lc8au ou leql os (1 = .LY)~EXA lualualals aql jo uo!le%au aql ssardxa 11 37dm3

suo!punj pun 'elas 'jooq pun ~!ao7 :suo!$'epunoj aq& I 8~

Page 53: Rosen Ch1 Excerpt

given 111 the lich is ply as I). 4

lo has

takcn nt con f3'and ntified ~tificrs valent

~ t s , this 4

hers L. can be

uct this

> 0 such - a \ < 8

4

1 4 9 1.4 Nested Quantifiers 49

THE ORDER OF QUANTIFIERS --

Many mathematical statements involve multiple quantifications of pr(lpositiona1 func-

Extra tions involving morc than one variable. It is important to note that the order of the Examples quantifiers is important, unless all the quantifiers are universal quantifiers or all are ex-

istential 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.

EXAMPLE 14 Let P ( x . v ) be the statement "x + y = y +x." What is the truth value of the quantifica- tionVxV?-P(x. y)?

Solrrrion: The quantification

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 Let Q(x. y) denote "x + y = 0." What are the truth values of the quantifications 3 jVxQ(x , y ) and Vx3y Q(x, y)?

Solutiorr: The quantification

3yV.rQ(x, y)

denotes the proposition

'.There is a real number y such that for every leal number x , Q(.r. y). '

No matter what value of y is chosen, thcre is (~nly one 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

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 + y = 0; namely, y = x . Hence, the statement Vx3y Q j x , y) is true. 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 state- ment 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.

Page 54: Rosen Ch1 Excerpt

50 1 /The Foundatrans: Logic and R o o f , Sets, and Functions 1-50

---

which P(x . ?) is 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 3yVxP(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 quantifie a 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;~lly loop 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~ed that 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 ~ h the va luc fu ry 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 ruc If we never hit such an x , then we know that 3xVyP(x, y ) is false.

Finally. to see whethcr 3 . r3yPix, 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 ( . r , y ) 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~rc than two variables are also common, as Esamplc 16 illus- trales.

EXAMPLE 16 Let Q(x. y, :) bethcstaternent".r+y = :." Whatarc the truthvaluesofthestatements VxV?3;Q(x. y , :j and 3zV.rVyQ(x. ?, :)?

Page 55: Rosen Ch1 Excerpt

Suliiriutr: Suppose that x and y arc assigned values. Then, there exists a real numher z such that .r + y = z. Consequently, the quantification

VxVy3:Q(x , y , z ) ,

which is thc statement

Page 56: Rosen Ch1 Excerpt

I

52 11 The Foundations: Logic and Proof Sets, and Functions 1-52

e ) 3~3:Vy(T(x,~) u Ti:, I)) with your school. Use quantifiers to express each of fJ VxVr3y(T(r, ?) * T( i , y)) these statements.

8. Let Q(.;.y) be the statement "student x has bcen a a) Lois has askcd Professor Mlchaels a question. contestan1 on quiz show y." Express each of these h) Evcly student has asked Professor Gross a ques- sentences in terms of Q(i, y ) , quantifiers, and logi- t i o , cal connectives, where thc universe of discoursc for x c) Every faculty member has either asked Profes- consists of all students at your school and for y con- sor Miller a question or been asked a question by sists of all quiz shows on television. Professor Miller.

a) Therc is a student at your school who has k e n a d) Somc student has not asked any laculty member

contestant on a television quiz show. a question.

h) No student at your school has ever been acontes- e ) There is a faculty member who has never been

tan1 on a television quiz show. asked a qucstion by a student.

c) There is a studcnt at your school who has been a fJ Some student has asked every faculty member a

contestant on JeopnrOy and on Whczrl of Forartre. question.

d) Evcry televisionquizshuw has had astudent lrom g) There is a faculty member who has asked cvery

your school as a contestant. other faculty member a question.

e) At least two studentsfrom your school have bccn h) Some student has never bcen asked a question by

contestants on Jeopardy. a faculty member.

9. L~~ L ( . ~ , be [he statement ui loves ?,n where the 12. Let I(.r) he the statement "r has an Internct con-

universe o l discourse for both x and ? consists o l all neclion" and Cis,?) be the statement "I and y have

people in the world. Use quantifiers to express each chatted over the Internet," wherc the universc o l dis-

of these statements. course lor the variablesx and!; consistsofall students in your class. Use quantificrs to exprcss each of these

a) Evcrybody loves Jerry. statements. h) Everybody loves somebody. c) There is somebody whom everybody loves. a) Jerry docs not have an Internet connection.

d) Nobody lovcs everybod). h) Rachel has not chatted over the Internct with

e) Therc is somebody whom Lydia does not love. Chelsea.

fJ There is somebody whom no onc loves. c) Jan and Sharon have nevcr chatted over the In-

g) Thcre is exactly one person whom cverybody ternct.

loves. d) No one in thc class has chatted with Bob. h) There are exactly two pcople whom Lynn loves. e) Sanjay has chattcd with everyone except Joseph.

i) Everyone loves himself o r herself 0 Someonc in your class does not have an Internet

j ) There is someonc who loves no one besidcs him- connection.

sell or herscll g) No1 everyone in your class has an Interne1 con- nection.

10. Let F(r, y ) he the statement "1 can fool y," whcre h) Exactly onc student in your class has an Internet the universe o l discourse consists of all people in the

conncction. world. llse quanlitiers to express each of these state-

i) Everyone exccpt one studcut in your class has an ments. Internet connection. a) Evcrybody can lool Fred. j) Evcryone in your class with an Internet connec- h) Evelyn can fool everybody lion has chatted ovcr the Internet with at least c) Everybody can fool somebody. one other student in your class. d) There is no one who can fool evcryhody. k ) Someonc in your class hasan Internet connection e ) Everyone can be foolcd hy somebody. but has not chatted with anyoneelse in your class. f) No one can fool both Fred and Jerry. I) There are two students in your class who havenot g) Nancy can fool exactly two people. chatted with each other o v a the Internct. h) There is cxactly one person whom everybody can nl) There is a student in your class who has chattcd

lool. with everyone in your class over the Internet. i) No one can fool himself or hcrself. n) There arc at least two students in your class who j ) Thereis someone who can loo1 exactly one person have not chatted with the same person in your

besidcs himself or herself class.

11. Let S(s) be the predicate "r is a student," F i x ) the n) There are two students in the class who hetween predicate "x is a faculty member," and Air .? ) the them have chattcd with everyonc else in the class. predicate "s has asked .r a question." wherc the uni- 33. ~~t M(+, ?) he has sent an e.n,ai] messagev verse of discourse consists of all people associated T(x. ?) bc " r has telephoned y," whcre the universe

-

Page 57: Rosen Ch1 Excerpt

'roleri3!u!mpe maids 141 101 lda~xa rua~sis aql uo lasn ir2zajo plowssed aql smouq auo ON (a

-q~om]au 341 uo slu!odpua om] Alan? Bu!la~uuoa sqled om1 ]sea[ le ale alau (p

'paslru -01dmna uaaq lou seq IEql ssasold e S! ac-lql j! i[uo puej! qxarq leql~aa~ap uesleq) ms!ueqsam auo iseat le s! alaql qaealq dl!lnaas dcana log (a

'malsis aql uo lasn i~ana iq was a8es -sam auo )sea[ le su!eluns an!qale aqi lanauaqm pana!rlal aq uea Iasn kana jo ssxppr [!em-a aql (q

'uo!~!puos i[nej d~ana Su!~np a[q!ssasse aq lsnm alosuoa auo is~a[ 1v (e

hressa -Jauj!'san!lsauuos [es!%ol pu1!srag!1uenb'sa1e3!pa1d Bu!sn suu!~esg!aads ma~shs asaq] jo qsva ssaldxa .RI

'tanlas alomal ilana ml!uomieql sm~~sis OM1 ipaer;l aie araql (p *

'uo!sua1r2 npa' e seq [In asoqm Sa)!sqam

Yu!yrom s! 13~127 aqi j! ~[UO suu!r!puoa 1011a 118 Su!lnp unr ol sanu!moa leql ssaso~d v s! araql (q

.xoql!eru auo .<[laex? o] ssaaae seq lasn Oa,\g (e .iressasau

$! 'ssn~~sauuos 1831401 pue 's~ay!luenb 'salea!pa~d Buy suo!laay!3ads maisis asaql jo qsea ssaldxa .LI

.roiem leq) ql!m ipn~s jo leed hia,\a u! ssep aql u! iuapnls e s! alaql teql qans loleu e s! alaql (a

'rolem aauaps ralndmoa u ro aromoqdos e 1aq1!a s! ssep aql u! luapnls ila,\z [p

'lo!unl e IOU JU[EUI sa!~emaqlem e laqpau E! oqm SSEP aq] U! luapnls e s~ alaql (3

-rolem aauaps ra~ndmos e SI ssep aql u! luapnls hra,\q (q

.~oyunle s! oqm ssels aq1 u! luapnls P s! alau (s

. . . . -ap uaql pue slay!menb jo smla~ u! sluarua)els asaql jo q3ea ssardxq .lo!uas e s! oqm ~olem aauaps ialnd -moa 1 pue's~o!un! are oqm slojem aaua!3s ralndmoa ;'s~o~unla~e oqm sloleru sa!lemaqlem ~'salomoqdos 2re oqm s~okm aauaras ialndmo3 <I 'sa~omoqdos are ?. oqmsrolem ssgemaqlem -,I 'uemqsaq e s!oqm~olem sa!lemaqiem 1 su!eluoa ssels s3!lewaqlem alans!p v .91

.mdmea uo Bu!p[!nq i.la.\a jo moo^

auo IseaIle u! uaaq seqssep s!ql u!luapn~silaha (8 .sndruea uo Su!pl!nq auo lseal le jo moo^ kana

u! uaaq svq oqm ssep s!ql U! luapn~s e s! alau o .sndmea uo au!

-p[!nq i~ana u! uaaq seq ssep s!ql u! luapmsdrana (a .aJua!ss 1alndmo3 u! aslnoa auo ]sea[

le uayel seq oqm ssep s!ql u! luapn~s e s! arau (p -xinos asua!ss ~alndmoa

auo ]sea[ lo uayel seq ssep 2141 U! luapnls .(ran3 (a .ralndmoa Teuos

-lad a sumo oqm ssep s!q] u! luapn~s e s! alau (q

'ss!lemaqlem aralsslp u! aslnos e spaau luapnls asua!ss 121ndmos ilana (e

-siuamalels asaql ssardxa 01 a[q!:!reh auo ueql alom ql!m sales!pald pue s~agliuenb asn .ST

.dno18 reqs suo iseq ir u! luapn~s laqio auo )sea[ le qllm palleqa seq sselss!q~ u!luapnlsi~ana (8

'ssep s!ql u! luapnls laqln auo ipsexa st. umol amps 241 u! dn ma14 ssela s!q] u! luapnls amos (1

'10oqsc s1q1 UI s~uamlledap aqi lo auo dq palajjo aslnoa LI~ -na uayel seq oqm ssals slqi u! iuapnls e S! araql (a

.azenaue[ 4u!mrue~%old ~uo rsealie pauleal aneq ssep s!ql ui sluapnls 11~ (p

'!!eMeH pal!S!A lUU SUq Inq eyseTv pal!s!n seq sse[s 5141 u! luapnls JWUS (a

.~.~ods amos 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 asn .pl .ssels aq~ u! as[a auodlana pauoqd

-a[a~ 10 01 a4essam [!em-a ue was aneq maql uaamlaq oqm sselalnoi u! sluapnls om] ale alau (u .luapnls isrq aql pauoqdala~ seq luapnls puusas

aql pue [!em-a iaqlo aql was seq ~uapnls 2uo 1cq1 qans ssep rnoi u! sluapnls owl lsea[ le all? alaql (IU

ssup aql u! luapnls laqloue moq llc~ auoqda[al e pan!asal ro a4essam [!em-a ue pan!asal laql!a seq ssels aq] u! lu2pnls Alan3 (1

'ssel~ 241 u! luapnls rrrqlo iua iq paljes uaaq IOU svq oqm put? sscp aq] u! as[a auo.iue uolj aBessam ~!vut-a ue pa,\12s -a1 IOU seq oqw sse[a lnoh u! luapnls e s! alaqL (1

.aZersam [!em-a ue jlaslaq rn ]lasm!q luas seq oqm luapn~s I? s! a1aq;L (I

'sa4cssam [!em-a i?q)o qsea luasanuq oqm ssel~inoi u! sluapn~som] are alaqL (!

.sse[s Inoh u! asla auodlana pauoqdalallo alessam (!em-a ue ~uasraq~!aseqoqm ssaplnoiu! 2uoamoss!a1a~ (q

.a4ess2m [!em-a ue ssap lnoi u! asla auoica -na IU~S seq oqm ssep mod u! luapnls e s! arau (8

.a4essam [!r!m-a ue m!q luas In !,tv pauoqdapl ~aq~!a seq sse[s (nod u! auoilana (1

'eU!N pauoqda[al seq see12 lnoi u! rruo ON (a -uay 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 auapv (q .oqo>~ 01 a2vssam [!em-a ue )"as lanau seq no43 (e

(yam uayn sau!ql dem aq] IOU st qqqm.pah!aa -a1 ale luas alam ~eql sa4cssam [!em-a 11weq1 awns FV) .SIU~~~IPIS asaql lo qJe2 ssaldxa 01 slay!luenb as,] .sse~s mod u! sluapnts [le jo sistsuo3 aslnoas!p jo

rnoi ul U' oqm ssep

'lau~al pJllEq3 Sl

'la lou ?neq I

'ssep rno ~0!133UU(

ue seq ss

xaql J' sluapn -s!P JO aneq -uos 1.

dq un!

Lrana

Page 58: Rosen Ch1 Excerpt

'sa~eu! ((0 < .(xi + ((0 > " )VO > rjllh~~ (q -pard apa~ard Kfale!pamm! sloqmis uo!~e;iau [la leq~ (i = ,iX)a),X'E (e os s~ualuare~s assql jo qJea jo suo!ieZau aql ssardx3 'ZE -sraquriu [ear

((8i'.)a - (c 'x)d)dE.T4 (P Ile 30 sls!suoa sea qaea U! aslnoas!~ jo aslan!un au ((2 ',( 'l)g?~ v (iC 'x) J)AEIA (3 .IJ~J les!leuaqiem e sassaidxa leq~~uaru~~e~s qu112u3

(X.X)~~EYA fi (S'X)~~EXA (q ue olu! suo!leoy!]uunh paisau asaqljo qsea alelsuerl 'SZ (2 ',i Z)LLAXEIA (B

((0 # .irj ei (0 # .<I v (o # O).<A~A (P .sa~ea!pald (10 < i - X) v ((0 > 4) v (0 > X)))~EXE (J

apaaaid Klale!pamm! s~oqmis uo!)e8au [is leqr os (10 < L x) + ((0 , .ij \ (0 -: rj)).i~I~ (q s~uamaleis asaql jo q3ea jo suo!ls8~u aqr ssaldx3 .I< (A = d+ x),i~.t~ (e

((2 'd'I)/liA'.~ i, (2 '< '~)J~EYA).<'~' (a 'slaqmnu [C~I ((X'r)SXA A li'l)xl-~),<E- (P 11" jo sls!suos aseo qsea u~ aslnoas!p jo aslan!un au

(('x)~-r~v (Xjaj,<~-- (J .jsej les!reruaqlem B sassa~due lsq~ IUJUJ~IRIP qa!14u~ (.i'x)d<i~x~- (q (,i'x)dr~XE~ (e ue olu~ suo!leagr~uenb paisau asaql jo qsea alepueq .QZ

-(s~n!~~auuoa [e3!901 mqmnu leal B S! 10q1 loo1 Bu!nlonu! uo!ssardxa ue lo lay!iuenb e aptslno s! uo!l alenbs e aneq IOU saop raqmnu [eal aa!ieZau V (p -e%au ou ruqlos.s! 1eql) sale~!pa~d u!~I!,c~([IIo s~adde .nulor alenbs suo!1e8au leq~ os sluamalels asaqi lo qsea al!lMax 'Of oml ~llJex.7 5eq laqmnu an!l!sod hIan3 (J

(C.r)d YE"A (p (,< 'rjdC~r& (J '0132 S!J[~EI! PUB Iaqmnu leal e JO aouar?g!f au (q (i'r)di~x~ (q (.< 'xldax~ (e 'ah!]!

.SUO!PUII~UOJ pue suo!laun[s!p 8u!sn SO<I!I!S -sod s! sraqtunu leal a~!lelau om1 jo 13npold au (e -odold asaql ]no al!~~\'t IOZ'I s! i pue t ro'~'1 s! x .sloleiado [ea!iema alaqm'd pup r s~!ed ~OSIS!SO~I~ (.i 'I)J UO!IJU~~[I?UO!I -rll~rn PIIR.S~A!~JUUOS 1e31801'slay!1uanb'sales!ps1d -!sodold aql 10 aslnms!P lo asJaA!un asoddns '62 ~u!sn slua~ualels le~!l~tuaqlem asaqljo qaea ssa~dxa .EZ

(c/(.r' + I) = Z)L-E,(AXA (f .sa~enhs (1 = i - q v = X + x),i~x~ (! aarql 10 mns aql IOU st leqi la%alu! ah!l!sod e s! araql

($=.<~,+xzvz=~z+x)AExE (q reql luawalels aql ssaidxaol s~oie~ado~ua!~etuaq~~m ([ = d+ xj.i~x~ (% PUP 'sal\!laau~05 les!iiol '~lay!luenb 's~r~~!pald as(l 'ZZ

(1 = ,ir + 0 # .C).iqx& (1 ~a8a]u! ((1 = ir!iE e 0 # X)XA (a ino~~os~renbs aqlp uns aql s! ra5alu! a~!l!sodLraaa

ir+ X # d+ x)l~r~ (p (0 = Lx)0,x~ (J leql luamalels aql ssa~dxa 01 srolerado ~ea!~emaq~em (;i = X)~EXA (q (.i = Zr)A~x~ (B pue 'sa,qaauuo= 1n3!‘20(.~13g;1uenh 'sx~~!pard asn .IZ

slaqlunu [ear IP yo .s~adalu! asaql lo sls!suou a[qe!ren qxa jo asrnoas!p jo aslan!un aql J! sanlen alnlvsqe aql jo runs aqr pmsxa IOU saop sluamalrisasaqt ~oqaea~oanre~~q1nllaqlau!~ulaIaa '8Z s~alaru! onl jo cuns aql jo anlen aln[osqe au (p

(z/(u + w) = ~)~EWA?IA (! .an!le%au K~!iessa (i = w - u v P = w + U)UIEUE (q sau lou s! sla%alu! an!lu%au om] jo asualajylp au (J ([=w-uvp= U+U)U<E?~E (2 .~n!l!sod r! sra%a]u! an~ltsod om1 yo a4elane au (q

(9= r~+z")u~~~ (J (s= i"f+ iu)ud~u~ (a .an!l!sods! siaZalu! an!re#au omlyc i~npold au (e (u' = UdU)U<AUE (p (0 = ''1 + u),UEUA (3 sia8alu! (:ru :. u)w~u~ (q (ur > ;tc)u<~v~ (e 11" jo sls!suos asino3s!pp) aslanlun aql sraqn volala

.sra2aju! 11" JO -do 1ea!1etuaqiem pue'san!laauuou les18o['siay!1uenb s1s1suoa salqelren ~[woy asmoss!p yo asran!un aql y! 'sa,ea!pa~d Bu!sn s~uamarels asaql yo qaea ssaldx3 'OZ s~uamam~s osaq~ jo qsnajoan1v?hqlnn aql au~uralaa 'LZ .sanlen alnlosqe rlaqi yo lanpold aq~ s!

(a '~jai~x~ (! slaJalu~ om1 JO lanpold aq~ yo anlen ainlosqe au (p (.i 'r)a.s~d~ (q -mns l!aql jo alunbs aql or lenba lo ueql (,( 'x)~I-A.(E (8 ral~a18 s! sraBazu! oa~ 30 sarenhs aq~ yo tuns au (J

(C'~)O~E~A 0 (~'I')~~AEXE (a (Z'")aXE (P .an~l~sod 61!1essa (O~Z~O (4 (I '116 (8 -aau IOU s! s~aBa~u! an!l!sod om1 jo a~uald~~!p au (q

i,mnIeA qjnn aql ale leqms~a%alu! .aa!le%au s! sralalu! an!)~8au OMI jo tuns au (e IIeyo qs!suoa salqe!ren q~oq IOJ aslnoJs!pjo asran!un aql31,;" x = A + x,, lualualels aql aq (I ',)a 147 .9Z -a),! lie 10 sls!sum asinoas!p jo as.lan!un aql aiaqm

(2 = X - xj~~i~x~ (p 'siay!luenh pue 'sa~e~!pwJ '5~oleradn ~es!So[ pus la3 ((i > I-) si (,i < ;r))dEXE (J -!ie~uaq~sm %u!sn siualualels asaql yo qaea ssaldx3 .61

srro!+und pue 's?aS 'Joozd pun :a-uo!lepunod 11 ~9

Page 59: Rosen Ch1 Excerpt

fX)aXE t (XIdXE (3 ((~)OXAA (x)~xA)- (q

.s~ay!luenb kue %U!A~OAU! IOU

uog!sodo~d e s! v alaqm 'v A (x)Or~ A (xjdx~ (e (.uo!laas s!q) u! gppue pp sasps3xzpue'E.I uo113a~ u1 gpzp sasFalax3 '£'I uo!l3aS u! z alqeL'z'1 uoyaaS u! y pue g salqeL ma13 33u3lehlnba le31801 asn :IUIH)

.mi03 Iemlou xaua~d u! s~uamale~s asaq~ ind .gp,

.13e3 s!ql 30 JOOI~ e IOJ syse ~p aspsax3 .mloj [emsou xaua~d u! luamalels e 01 lua[eh!nba ST s~ay!luenb pue sah!13auuo3 1e3!2ol Xulsn 8 pue '1 'salexpa~d 'salqe -!let, leuo~!sodo~d moq pamloj ~uamalels kah3

'(1~1~ In330 Ile lou op nay!luenb aql a3u1s) lou s1 (x)ax~ A (x)dx~ sealaqm 'mloj 1em1ou xaua~d u! s! ((()a v (i 'x)d )LAXE 'aldmexa ~od .s1ay1luenb ou Bu~n[onu! ale3!pa1d e s! (~~,....r x)d pue '~ay!luenb [es~an!un aql lo ~ay!luenb (e~luals!xa aq] iaql!a s1 'y ' ' ' ' 'Z '1 = ! "a q3ea alaqm

LX v~)~~~ra.. . zxza ix[a YqX' ' ' ' ,-

m.103 aqljo s! I! 3! k1u0 pue j! (8~d) mioj lemiuu xauaid u! s! 1uama)els v

.cc;oa A (xI~ICEXA 0) lua[en!nba s! (xjax~ A IX)~XA leql moqs (q

xcoa v (x)~)~ExA 01 ~ua~en!nba s! lxjax~ v IX)~XA 1eq1 moqs (e .spt

('klpa1103 suo!)eay!luenb aq) au!qmo3 ol pasn s! L aIqe!len mau ayL) .)ualen!nba k[le3!Xol ale ((.la A (x)~)~A~A Pug (X)aXA A (r)dXA leql MoqS 'bb*

.anlen qlnll awes aql aneq (d 'x)d-XEXA pue (L 'x)di~x~- sluau?lels om1 aql pql MoqS 'Ep

.slaqmnu pal olazuou aq] (3 .slaXalu! aq] (q

xaqmnu 1ea1 an!l!sod aql (e

30 SIS!SUO~ saTqe -pen aqlioj assno3s!pjo aslan!un aqlj! (,h 5 X);(AXE

luamalels aqljo anIeh qlnll aql au!mlalaa .zp .slaqmnu leal ah!]!sod aq) (3

.s1a8aju! olazuou aql (q 'naqmnu leal o~azuou aq) (e

$0 sls!suo3 salqr? -!leh aq11oj aslno3s!p 30 aslagun aql J! (1 = Xx)i~x~ luamalels aql jo anph qlnll aql au!uualaa ip

.slaqmnu leal ~oj uo!)!ppe lano uo!)e3![d!)lnm lo sme~ ahpnq!la!p aql ssa~dxa 01 s~ay!]uenb asn .gp

.slaqmnu leal $0 uo!)e3qd!) -1nmlojmel ah!]e!3osse aql ssa~dxaol slay11uenb asn .6~

(id # ,X)~AXA (2 (001 > x - ,~)LEXA (q lC11 = ~I~EXA (e .sia8a)u! [~e $0 slsrsuo3 salqepeh [[e 103 aslnoa

-s!pjo aslahrun aq1 a~aqm's~uama]els pay!]uenb Llles -lah!un asaql or 'a~q!ssod j! 'a[dmexa1aluno3 e pug

(X 2 .<X)~AXA (2 (X = zL).<~~~ (q

(.( = x t .d = ,X)~AXA (e

.s~a%alu! Ile jo sls!suoa sa[qe!leh [IE IOJ aslnoa -s!p 30 aslahrun aql a~aqm 'slnamalels pay!luenb klles -lah!un asaql 01 'alq!ssod j! 'aldmexa~alunoa E puy .LE

sndm~a uo Xu!pl!nq haha jo moo.^ auo ispa[ 1e u! uaaq seq oqm ssep s!q) u! luapnls e s! alau (p

'1ooq3s s!ql ie palajjo aslno3 s~!~euaqlem k3ha uayel seqoqm sseps!ql u1luapnls e s! alau (3

.1a)nduo3 P

uaas lahau seq oqm ssep s!ql U! luapnls e S! alau (q .s3!lemaqleu say![ ssep s!q] UI luapnls ksahx (e

qs![Xux u! pue 's~ay!luenb Buy suo!~!sodo~d asaql jo suoge8au aql ssa~dxx '9~

'uo3ea u!han ql!m a!hom e u! uaaq seq oq~ auoauosq~!~ a!hou~ u! u3aq seq so uoma ulhax ql!m a!noue u! uaaq .saql!a seq sol~e 3!nomksanx (p

.sekelem -!H aql u! u!elunom kana paqm!(> seq auo ON (3

.ekq17 ida3xa ppom aq] u! k~uno~ k~ana pa]!s!n seq auoamos (q

'1ooq3s s!ql le sassep s3!1emaqlem om] klpexa uaye] s~q ssep s~ql u! luapnls kanx (E

(,:~eql as-3 aql IOU s! II,, SPJOM aql asn L~dm!s IOU oa) .qs!~4ua aldmrs u! uo!le8au aql ssa~dxa 'ixa~ '~ay!]uenb e jo ljal ?q1 01 s! uo!le4au ou leql os ~uamalels aqljo no!le8au aql m1o3 uayL .s~ay!luenb 2u!sn sluamalels asaql jo q3ea ssaidxz 'SE

.yooq s!qljo uog3as k~a -ha u! asyaxa auo ]sea[ le panlos seq luapnls ON (a

'xooq s!ql u! as!xaxa kana panlos seq luapnls auos (p

'ssep s!ql u! sluapnls ~aqlo om] k113exa 01 [!em-a was seq ssep s!qi u! lu?pnls ON (3

.luapnls ~aqlo auo kp3exa ql!m pa11eq3 seq oqm ssep s!ql u! luapnls e s! alayL (q

.k~allo[ aq] Bu!ke~d sle[[op puesnoql auo ueql alum lsol seq auo ON (e

(,,'leql ?se3 aql IOU s! ]I,, SPIOM aql asn kldm!s lou oa) .qs!l2ua a[dm!s u! uogeXau aql ssa~dxa ,lxaN .~ay!luenb e $0 ]$a1 aql 01 s! uo!le8au ou leq] os ~uamalels aql jo uo!leXau aql mloj uau .slay!luenb 8u!sn sluamalels asaq] 30 q3ea ssa~dxx .p~

((2 'A 'x)~LAZE V (2 'A 'X)~ZA.(E)XA- (a (I.( 'x)ai~x~v (X'xjd-,<ExE)- (p

ffd 'x)O A 'x)~)xA~A- (3 (X 'x)dx~d~- (q (X 'x)~.<AxA- (e

.(san!l3auuo3 le3!80~ Xu!n[onu! uo!ssa~dxa ue lo ~ay!luenb e ap!slno s! uo!] -eBauou 1eq1 os's!leq~) sa]e3!pald u!q~!mk~uoleadde suoge2au ieql os nuama,els asaql jo q3ea al!lman 'EE

((i 'x)a A (2 ';( c~)~)?~~~i~ (p I(xc~la - (L 'X)~)~EXE (2 (i 'x)aX~x~ v (i 'x)di~x~ (q

(2 '.i 'x) JXA.<AZE (e

Page 60: Rosen Ch1 Excerpt

56 1 /The Foundations: Logic and Proof, Sets, and Functions

**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

I upper bound of a set S of real numbers if r is an up- per 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 up- per 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-

The statement lim,,,, u,, = L means that for every posi- tive 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 statement that lim,, ,, a,, = L.

51. (Calculus required) Use quantifiers to express the statement that lim,,, a,, does not exist.

52. (Calculus required) Use quantifiers to express th~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 con- nectives to express this definition:A number L is the lilttit superior ofa sequence {a,, I if for evcry real num- ber r > 0. a,, > L - c for infinitely many n and

"

cal opera tors. a,, > L + c for only finitely many n.

<* I. Methods of Proof pppppp-pp-

INTRODUCTION

Two important queslions that arise in the study of mathematics are: ( I) When is a math- ematical 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 se- quence of statements that form an argument,called a pronf.Toconstruct pn)ofs,methods

Links 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 se- ries 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 com- puter science. These applicalions include verifying that computer progranis are correct, establishing that operating systems are secure, making inferences in the area of artificial

Page 61: Rosen Ch1 Excerpt

1.5 Methods of Proof 57

osi- that

this ce if itive il. of 1 .

con- j the turn- and

timcs a se- thods d can atical rems. tions,

:es up Iso he uced. ?mma brems. ; a se- ~sition ure is d , the ey are

e they I com- Jrrect, tificial

intelligence, showing that system specifications are consistent, and so nn. Consequently, understanding thc techniques used in proofs is essenti;~l both in mathematics and in com- puter sciencc.

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:

Using thisnototion,the hypothesesarewrittenin a columnand theconclusion helowa har. (The symbol :, denotes "therefore.") Modus ponens states that if hoth an implication

Extra E:xample 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 nZ 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.

EXAMPLE 3 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."

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. 4

EXAMPLE 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 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.

Page 62: Rosen Ch1 Excerpt

58 1 /The Foundations: Logic and Proof, Sets, and Functions 1-58

TABLE 1 Rules of lufereuce. - -

Rule of Inference Tautology N a m e a -

P + ( P V 4 ) Addition .'. p v q

( P A Y ) " P Simplification .'. p - -

P ( ( P I A i q l ) + ( P A 4 ) Conjunction

.'. p f i . q -

Moduu ponens

1-4 ,? ( P + 4)1 " - p Modus tollens

P - 'l [ ( p q ) A ( q - r ) ] i ( p 4 r ) Hypothetical syllogism q i ,- --

:. p + r -

P '/ Y L ( P " Y ) " ' P I ‘ 4 Disjunctive syllog~sm

'P .'. q -

P " 4 [ ( P v q ) A ( -p v r)l - (q v r ) Rcsolutiori - p v r

I .'. 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 conclu- sion 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,

Page 63: Rosen Ch1 Excerpt

5 pue p sdals 8u!sn ms!8o[lKs le~!laqlodi~ s t b- .g s!s>qlodi~ str'~

E PUe Z sdals 8u!sn ois!8o[[As leJ!l>qlodi~ r t bL .p s!saqlodi~ r t d- .E

1 d?ls 10 ~+1i!sodcsluo3 d- t b- 'Z s!saqlodi~ btd.1

uoseaa ~J$S

-uo!m[~uo:, pallsap aqlol peal sasaqiodiq ino leql smoqs w~oj luawnX~~! s!~ .s t b- s! uo!snl:,uo:, pal!sap 2'~. .S + 1 puc

.J - d-.b - dale sasaqlodLq aql ua~.;paqsaqal8uyaajdnayem [[!M I.. uo!~!sodnid aq, s pue ~.'L[IFJ daals 01 08 IT!M I.. uotl~sodo~d aql J ,,'me1801d aql 8u!1!1m qslug [I!M I., 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~iea daa~s 01 08 [I!M 1 uaqt 'asessam [!uru-a ue am puas IOU op noL 11.. .,'mvi80id aql 8u!l!1m qs~ug IT!M I uaql .~8essam [!em-a ue aw puas noL 11,. sasaqlodAq aql leql moqs L 3~d-3

L pue 9 sdal~ 8upn suauod snpom srsaqlod~~

s pue p sdals 8u!sn suauod snpom s!s>qlod.i~

E pue z sdal~ 8u!sn suallol snpom s!saqlodL~

1 dais 8u!sn uo!le~y!ldm!~ s!saqlodAH

uoseax

'smo[[OJ Sl?

uo!snpuos pai!sap aqlol peal sasaqiudAq sno leql moqs 01 luamn81e ue l~n~lsuo~ aM 'I Aldw!s s! uo!snpuo:, aU.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 ~ql I pue ,,'d!il aoue:, e axel [[!M

aM.. uo!~!sodold aql s ,,'8u!ww!ms 08 11!.u ?,q.. uo!~!sodo.[d aql J ,,'AepialsaK ueql lapro:, s! 11,. uo!l!sodo~d aq) b ,.'uoouialje s!ql .iuuns s! 11,. uo!l~sodosd aql aq d la7 :uo!j~ilo~

,..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 [[IW aM.. ,,'ieplalsa.i ueql laplo:, s! I! pue uoousayr s!ql Auuns lou s! 11.. sasaq)odKq aq) IP~I noqs g 3~d-3

.a3uaiaju!jo sa[nl Su!sn pazA[eue aq ue3 qs!18u3 u! sluamn8ie moq moqs osle saldmeua asaU.paieis A[~!~!ldxa dais qaea ~oj uoseai aql q)!m'dals Kq dais paAe1dsrp ale sluamn8le jo sdals aql aiaqm 'saldmera Bu!mol[oj aqi .iq palellsnII! s! s!~'p!le~ s! luawn;iia ue leql sa,awexx moqs 01 papaau ualjo ale ?Juala#n! JO salni [elahas'sas!wald Auem a.re alaq] uaqM erqx~

.asIej aq .il?m luamn8ie aql~o uo!snIauo3 aql leql sueaw q~~qm 'luamnhe aql u! pasn uaaq seq ,*$ c v,, uo!l!sodoid aslej aql.$ > z asnnxq 'asluj s! 1uamn8 -1e s!ql jo uo!snl3uo3 a41 'ianamoH .suauod snpom uo paseq wsoj ~uamnii~a pye~ e s!

Page 64: Rosen Ch1 Excerpt

60 1 1 The Foundations: Logic and P m o f . Sets, and Functions 1-60

RESOLUTION --

Computer programs have heen developed to automate the taskof reasoning and proving Ll* 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 on which the rulc of disjunctivr. ayllogistn is bascd.

EXAMPLE 8 Use resolullon to show that llrr hypothcscs.'.Tusmine is skiing or it is not snowing" and "It is snowing or Bart i? playing hockey" imply that "Jasmine is skiing or Bart is playing

Extra 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 -p v q and [I v r , respectively. Using resolution, the proposition q 'd r,"Jasmine is ski- ing or Bart is playing hockey,"fr~llows. 4

Resolution playa an important role in programming languages based on 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's law 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 -

Scvcral common fallacies arise in incnrrecl arguments. Thcsz fallacies resemble rules of Links 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~lincorrect reasoning is ciillcd the fallacy of amrming the conclusion.

Page 65: Rosen Ch1 Excerpt

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 ving

learned discrete mathematics. 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

)The - p + q and q, then p . This is an example of an incorrect argument using the fallacy - r of affirming the conclusion. Indeed, it is possible for you to learn discrete mathematics = F. in some way other than by doing every problem in this book. (You may learn discrete vhich mathematics by reading, listening to lectures, doing some but not all the problems in this

book, and so on.) 4

" and The proposition [ ( p + q ) A -pJ + -q is not a tautology, since it is false when p aying 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.

is ski- :ses as EXAMPLE 11 Let p and q be as in Example 10. If the implication p + q is true, and -p is true, is it

is ski- correct to concludc that -q is true? In other words, is it correct to assume that you did 4 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). Solrrtion: It is possible that you learned discretemathematicseven if you did not doevery

nstruct problem in this book. This incorrect argument is of the form p + q and -p imply -q,

]theses which is an example of the fallacy of denying the hypothesis. 4 riables :that is uppose RULES OF INFERENCE FOR QUANTIFIED STATEMENTS p v r ) , p v r , We discussed rules of inference for propositions. We will now describe some important

the two rules of inference for statcments involving quantifiers. These rules of inference are used -q.We 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

v r . W e women. v r and Universal generalization is the rule of inference that states that Vx P ( x ) is true,given

4 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 no knowledge of what c is, only that it exists. Since it exists, we may give it a name (c) and continue our argument.

Page 66: Rosen Ch1 Excerpt

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) Universal instantiation

:. P(c)

P(c) for an arbitrary c Universal generalization

:. YxP(X)

3x P ( x ) Existential instantiation :. P(c ) for some element c

P(c ) for some clement c Existential generalization

:. 3 x P ( x )

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 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.''

~ x t r a Solutiun: Let D(.r) denote "x is in this discretc mathematics class," and let C(x) denote ..x has taken a course in computer science." Then the premises are Vx( D(x) + C(.r)) and D(Marla). The conclusion is C(Marla).

The following steps can he used to establish the conclusion from the premises.

Step Reason 1. V.x(D(x) + C ( x ) ) Premise 2. D(Marla) + C(Marla) Universal instantiation from (1) 3. D(Marla) Premise 4. C(Marla) Modus ponens from (2) and (3)

EXAMPLE 13 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 3x(C(x) A -B(x)) and Vx(C(x) + P(x)) . The conclusion is 3x (P(x ) A -B(x)). These steps can he used to establish the conclusion from the premises.

Step Reason 1. 3x(C(x) A -B(x)) Prcmisc 2. C(a ) A -B(a) Existential instantiation from ( I ) 3. C(a ) Simplification from (2) 4. Vx(C(x) + P(x)) Premise

Page 67: Rosen Ch1 Excerpt

r P ( x ) ement s true. f these

course .'Marla

denotc C ( * ) )

veryone the first

P ( r ) be P ( 1 ) ) .

nclusion

-63 1.5 Methods of Proof 63

Step Reason

5. C ( a ) - P ( a ) Universal instantiation from (4) 6 . P ( a ) Modus ponens from (3) and (5) 7 . - R ( u ) Simplificat~on from ( 2 ) 8. P ( N ) A - B ( a ) Conjunction from ( 6 ) and ( 7 ) 9. 3 x ( P ( x ) A - B ( x ) ) 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 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

Extra Examples 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~on implies 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.

METHODS OF PROVING THEOREMS

Proving theorems can be difficult. We need all the ammunition that is available to help Assesarnent

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 andq false never occurs. 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 true.

Before we give an example of a direct proof, we need a definition.

DEFINITION 1 The integer n is even if there exists an integer k such that n = 2k and it is odd if there exists an integer k such that n = 2k + 1 . (Note that an integer is either even or odd.)

Page 68: Rosen Ch1 Excerpt

64 1 I The Foundations: Logic and Proof, Sets, and Functions 1-64

EXAMPLE 14 Give a direct proof of the theorcn~"lf r r 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 twice an integer). 4

INDIRECT PROOFS Sincc the implication p 9 q isequivalent to its contrapositivc, Extra -q i ~ p . the iniplicat~on p i q can he pruved by showing that its contrapositive, Examples

-q i -p, 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.

EXAMPLE 15 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~es that the hypothcsisis false. the original ~mplication is true. 4

VACUOUS AND TRIVIAL PROOFS Suppox that the hypothcsis p of an implica- tion p - q is false. Then the implication p i q is true, hecause the statement has the f ~ l r m F i T o r F 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 pro- positionel function]. Proof techniques for thcorems of this kind will be discussed in Sec- tion 3.3.

EXAMPLE 16 Show that the proposition P (0 ) is true where P (n ) is thepropositionalfunction"lf n > 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~on P(0) is automatically true. 4

Remark: The Fact lhat tha conclusion of this implication, 0' , 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.

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 shown that q is true, then a proof, called a trivial proof, of [I - q can be given. Trivial 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.

Page 69: Rosen Ch1 Excerpt

1.5 Methods of Proof 65

Lse that I ) ' =

re than 4

)osilivc. ~ositive, y proof

e that 11 = 6k + 101 odd. thesis is

4

implica- has the

I is Calse. Vacuous dication is a pro- 1 in Sec-

q is true. it can bc n. Trivial lscussion liscussed

that the

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 that the hypothesis. which is the statemcnt "a 2 b," was not needed in this proof 4

A LITTLE PROOF STRATEGY We have described both direct and indirect proofs 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 to 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

Extra strategy in Examplcs 18 and 19. Examplor

BcCore we present our nexl exampi?. we need a definition.

DEFINITION 2 The real number r is rarionnl if there exist integers p and q with q # 0 such that r = p / q . A real number that ir not rational is called irrational.

EXAMPLE 18 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 that 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 qu , 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 m, 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 to 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

Page 70: Rosen Ch1 Excerpt

66 1 / Thp Foundations: Logic and Proof. Sets. and Functions 1-66

PROOFS BY CONTRADICTION There are other approaches we can use when nei- ther 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 Show that at least four of any 22 days must fall on the same day of the wcek.

Extra Solurion: Lct p be the proposition "At least four of the 22 chosen days are the same day

Eaamptos of the we~k."Suppose that - 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

EXAMPLE 21 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

is rational. there exist integers a and h with = a / h , where o and b have no com- mon factors (so that the fraction a / / , is in lowcst lcrms). Sincc = a /b , m,hm both 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

2 ?b2 = 4c ,

so

2 2 h = 2 c .

This means that b' is even. Hence,b must be even as well. It has becn shown that - p implies that = o/b. where a and h have no com-

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: "A is 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 in 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 i q as a prooi by contradict~on,

Page 71: Rosen Ch1 Excerpt

1.5 Methods of Proof 67

len ncl- iitional

-P +

le. This hat it is nis type

le of an lover in

~ m c day ' I %me day 21 days ular day

4

hen -b ion that no com- Len both

no com- that - p common

4

on. In an

? + - F that - p adiction. 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 Give a proof by contradiction of the theorem "If 3n + 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 hypoth- esismade upof a disjunction of the propositions p ~ , p?, . . . . p , can he provcd by proving each uf the n implications 11; i q , i = 1 .2 . . . . , n, individually. Such an argument is

Extfa called a proof by cases. Sometimes to prove lhat an implication p i q is true. it is Examples 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.

EXAMPLE 23 Usc a proof by cases to show that . v v ( = 1x1 g 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 xy ? 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 xy ( 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 xy > 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.

Page 72: Rosen Ch1 Excerpt

68 1 /The Foundations: Logic and Proof, Sets, and Functions 1-68

EXAMPLE 24 Prove the theorem "The integer n is odd if and only if r z z is odd."

Solutio~~: This theorem has the form "p if and only if q," where p is " 1 1 is odd" and q is "n2 is odd."To provc this theorem,we need to show that p --t q and q -r p are truc.

Edra We have already shown (in Example 14) that p -+ q is true and (in Example 19) EmmP'es that q -t p is true.

Since we have shown that both p - q and q -' p are true, we have shown that the theorem is true. 4

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 " " . 'f ~ r 2 1 +> [(PI -' Pl) (PZ + ~ 2 ) " ' A (P" -' ~111.

This shows that if the implications pl + p2, p? + pj, . . . , p,, i pl can be shown to be true. then the propositions pl, pz. . . . . p, arr all equivalent.

This is much more efficient than proving that p, i p i for all i , j with 1 5 i 5 n 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 pl + 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 + pl 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 = (2k + ?12 = 4k2 + 8k + 4 = 2(2k2 + 4k + 2 ) . This means that nZ is 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 have already done in Example 14. This completes the proof. 4

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.

Page 73: Rosen Ch1 Excerpt

1.5 Methods of Prmf 69

t the 4

1t for lrovc

chain from at P I .

at the

= 2k IS that

t even. ich we

4

ethods e most

EXlSTENCE 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

Extra implies a contradiction. Thc concept of a constructive existence proof is illustrated by Examples Example 26.

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

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 = a . v'i and y = A . On the other hand i f f i 1s ~rrational, then we can let x = and

f i ~ f i f i ~ ~2 y = f i s o t h a t x Y = ( & ) = - - 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 = have the desired prop- erty, but we do not know which of these two pairs works! 4

UNIQUENESS 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.)

Page 74: Rosen Ch1 Excerpt

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 Vy(y # x + - P ( y ) ) ) .

EXAMPLE 28 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 andq is also an integer. Extra

.Gaamples 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 subtract- ingp from both sides of theequation,it follows thatq = r , which contradictsour assurnp- tion that q # r . Consequently, there is a unique integer q such that p + q .- 0. 4

COUNTEREXAMPLES In Section 1.3 we mentioned that we can show that a state- ment 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 ) .

xxta Eramples either which we believe to be false or which has resisted all attempts to find a proot we

look for a counterexample. We illustrate the hunt ior a counterexample in Example 29.

EXAMPLE 29 Show that the statement "Every positive integer is the sum of the squares of three inte- gers" 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 successive positivc integers as a sum of three squares. We find that I = 0' + 0' + 1'. 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

A common error is to assume that one or more examples establish the truth of a

Links 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.

EXAMPLE 30 Is it true that every positive integer is the sun1 of 18 fourth powers o l integers'? That is,is the statement VnP(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~ning whether 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

Page 75: Rosen Ch1 Excerpt

nteger,

nteger.

a state- ample x d x P ( . x ) , ,roof, we nple 29.

lree inte-

example. hat ia not

to write 1 02 + 12, 5 = 1 2 + show that p a r e s we ,here each ie that the is false. 4

truth of a : universal

;?That is, is itten as the all positive

I powers of 1 powers of gers are 0 . 1 , hen n is the ,e written as

-71 1.5 Methods of Proof 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

MISTAKES IN PROOFS

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

Step 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 of (6) by b

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

EXAMPLE 32 What is wrong with this "proof"?

"Theorem:" If n 2 is positive, then rz is positive.

"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

Page 76: Rosen Ch1 Excerpt
Page 77: Rosen Ch1 Excerpt
Page 78: Rosen Ch1 Excerpt
Page 79: Rosen Ch1 Excerpt
Page 80: Rosen Ch1 Excerpt
Page 81: Rosen Ch1 Excerpt