Cheating husbands and other stories A case study of ...dolev/pubs/cheating.pdf · A case study of...

10
DistributedComputing(1986)1 :167-176 YoramMoses receivedaB.Sc . in mathematicsfromtheHebrew University,Jerusalem,in1981, andaPh .D .incomputerscience from StanfordUniversityin 1986.Hewillbespendingthe 1985/6schoolyearasapost- doetoralfellowatMIT.Hisma- jorresearchinterestsaredistrib- utedsystems,artificialintelli- gence,andthemethodological foundationsofcomputerscience . DannyDolev receivedaB .Sc . inphysicsfromtheHebrewUni- versityJerusalemin1971,an M .Sc .inappliedmathematics fromtheWeizmannInstituteof Science,Israelin1973,anda Ph .D .incomputersciencefrom the Weizmann Institute of Sciencein1979 .Aftertwoyears asapost-doctoralfellowat Stanfordandayearasavisiting scientistatIBM,hejoinedthe HebrewUniversity,Jerusalem, in1982 .Hismajorresearchin- terestsaredistributedcomput- ing,reliabilityofdistributedsys- tems,andalgorithms. Abstract . Therelationshipbetweenknowledgeand actionisafundamentalone :aprocessorinacom- puternetwork(orarobotoraperson,forthat matter)shouldbaseitsactionsontheknowledge (orinformation)ithas .Oneofthemainusesof communicationispassingaroundinformationthat mayeventuallyberequiredbythereceiverinorder 4TheworkofthisauthorwassupportedinpartbyDARPA contractN00039-82-C-0250 n J Cheatinghusbandsandotherstories Acasestudyofknowledge,action,andcommunication YoramMoses 1 .2,4 , DannyDolev 2 ' 3 , andJosephY .Halpern 2 1 ComputerScienceDepartment,StanfordUniversity,Stanford,CA94305,USA 2 IBMAlmadenResearchCenter,650HarryRoad,SanJose,CA95120,USA sComputerScienceDepartment,TheHebrewUniversity,91904Jerusalem,Israel E__] ©Springer-Verlag1986 C7 JoeHalpern receivedaB .Sc .in mathematicsfromtheUniversity ofTorontoin1975,andaPh .D . inmathematicsfromHarvard Universityin1981 .Inbetween, hespenttwoyearsasthehead ofthemathematicsdepartment atBawkuSecondarySchool,in Ghana .Afterayearasavisiting scientistatMIT,hejoinedIBM in1982 .Hismajorresearchin- terests are reasoning about knowledge,distributedcomput- ing,andlogicsofprograms . todecideuponsubsequentactions .Understanding therelationshipbetweenknowledge,action,and communicationisfundamentaltothedesignof computernetworkprotocols,intelligentrobots, etc .Bylookingatanumberofvariantsofthe cheatinghusbands puzzle,weillustratethesubtle relationshipbetweenknowledge,communication, andactioninadistributedenvironment . Keywords : Commonknowledge -Cheatingwires - Distributedprotocols 1 Introduction Therelationshipbetweenknowledgeandactionis afundamentalone :aprocessorinacomputernet- work(orarobotoraperson,forthatmatter) shouldbaseitsactionsontheknowledge(orinfor- mation)ithas .Oneofthemainusesofcommuni- cationispassingaroundinformationthatmay eventuallyberequiredbythereceiverinorderto decideuponsubsequentactions .Understanding therelationshipbetweenknowledge,action,and communicationisfundamentaltothedesignof computernetworkprotocols,intelligentrobots, etc .

Transcript of Cheating husbands and other stories A case study of ...dolev/pubs/cheating.pdf · A case study of...

Distributed Computing (1986) 1 :167-176

Yoram Moses received a B.Sc .in mathematics from the HebrewUniversity, Jerusalem, in 1981,and a Ph .D. in computer sciencefrom Stanford University in1986. He will be spending the1985/6 school year as a post-doetoralfellow at MIT. His ma-jor research interests are distrib-uted systems, artificial intelli-gence, and the methodologicalfoundations of computer science .

Danny Dolev received a B .Sc .in physics from the Hebrew Uni-versity Jerusalem in 1971, anM.Sc. in applied mathematicsfrom the Weizmann Institute ofScience, Israel in 1973, and aPh.D. in computer science fromthe Weizmann Institute ofScience in 1979 . After two yearsas a post-doctoral fellow atStanford and a year as a visitingscientist at IBM, he joined theHebrew University, Jerusalem,in 1982 . His major research in-terests are distributed comput-ing, reliability of distributed sys-tems, and algorithms.

Abstract . The relationship between knowledge andaction is a fundamental one : a processor in a com-puter network (or a robot or a person, for thatmatter) should base its actions on the knowledge(or information) it has . One of the main uses ofcommunication is passing around information thatmay eventually be required by the receiver in order

4 The work of this author was supported in part by DARPAcontract N00039-82-C-0250

n

J

Cheating husbands and other storiesA case study of knowledge, action, and communication

Yoram Moses 1.2,4 , Danny Dolev 2 ' 3 , and Joseph Y. Halpern 21 Computer Science Department, Stanford University, Stanford, CA 94305, USA2 IBM Almaden Research Center, 650 Harry Road, San Jose, CA 95120, USAs Computer Science Department, The Hebrew University, 91904 Jerusalem, Israel

E__]

© Springer-Verlag 1986

C7

Joe Halpern received a B .Sc . inmathematics from the Universityof Toronto in 1975, and a Ph .D .in mathematics from HarvardUniversity in 1981 . In between,he spent two years as the headof the mathematics departmentat Bawku Secondary School, inGhana . After a year as a visitingscientist at MIT, he joined IBMin 1982 . His major research in-terests are reasoning aboutknowledge, distributed comput-ing, and logics of programs .

to decide upon subsequent actions . Understandingthe relationship between knowledge, action, andcommunication is fundamental to the design ofcomputer network protocols, intelligent robots,etc. By looking at a number of variants of thecheating husbands puzzle, we illustrate the subtlerelationship between knowledge, communication,and action in a distributed environment .Key words : Common knowledge - Cheating wires- Distributed protocols

1 IntroductionThe relationship between knowledge and action isa fundamental one : a processor in a computer net-work (or a robot or a person, for that matter)should base its actions on the knowledge (or infor-mation) it has . One of the main uses of communi-cation is passing around information that mayeventually be required by the receiver in order todecide upon subsequent actions . Understandingthe relationship between knowledge, action, andcommunication is fundamental to the design ofcomputer network protocols, intelligent robots,etc .

1 6 8

Halpern and Moses (1984/86) show that thesuccess of certain cooperative actions in a distrib-uted environment may depend on the attainmentof various states of knowledge by the group ofagents involved . In particular, the state of commonknowledge, corresponding to "public informa-tion ", is of primary importance . A group has com-mon knowledge of a fact p, denoted Cp, if theyall know p, they all know that they all know p,they all know that they all know . . . and so on,ad infinitum . Halpern and Moses further show thatcommon knowledge is not attainable in manypractical systems . For each type of communicationchannel they present a corresponding approxima-tion of common knowledge that captures the stateof knowledge resulting from a broadcast usingsuch a channel .

The "cheating wives" puzzle, a well knownpuzzle from the folklore (cf . Gamow and Stern1958), has long been one of the primary examplesof the subtle interdependence between knowledgeand action. It involves an initial step in which aset of facts is announced publicly, thereby becom-ing common knowledge . In this paper we revealthe contents of recently discovered scrolls, alleged-ly written by the great scholar Josephine of thelost continent of Atlantis . These scrolls describehow modernizing the means of communication inAtlantis over the generations affected the resolu-tion of the recurring problem of unfaithful hus-bands there. A close analysis of her account pro-vides a better understanding of the issues involvedin the interaction between knowledge, action andcommunication . In particular, it illustrates how anagent that knows something about how other indi-viduals' actions are related to the facts they know,can obtain knowledge by observing the other indi-viduals' actions .

The original cheating husbands problem is in-troduced in Sect. 2 .' Section 3 describes what hap-pens when an asynchronous communication chan-nel is used to communicate the protocol to be fol-lowed . Section 4 involves different types of syn-chronous communication, and includes a discus-sion of the conditions under which a "cheatinghusbands "-like protocol can tolerate "faults" (dis-obedient wives) . Section 5 deals with ring-basedcommunication . Section 6 treats the question ofhow allowing wives to communicate a small

1 The cheating husbands puzzle is essentially the cheating wivespuzzle of Gamow and Stern (1958), and equivalent to the"muddy children" puzzle of Barwise (1981) and Halpernand Moses (1984) . Martin Gardner independently presentedthe puzzle in terms of "cheating husbands" in the thoroughlyamusing Gardner (1984)

Y. Moses et al . : Cheating husbands and other stories

amount of extra information allows a substantiallyfaster solution to the problem. Some conclusionsare presented in Sect. 7 .

2 The cheating husbands puzzleJosephine's account of the history of a major cityin Atlantis starts with the following incident :The queens of the matriarchal city-state of Mamajorca, on thecontinent of Atlantis, have a long record of opposing and ac-tively fighting the male infidelity problem . Ever since the tech-nologically-primitive days of queen Henrietta I, women in Ma-majorca have been required to be in perfect health and passan extensive logic and puzzle-solving exam before being allowedto take a husband . The queens of Mamajorca, however, werenot required to show such competence .

It has always been common knowledge among the womenof Mamajorca that their queens are truthful and that the wom-en are obedient to the queens. It was also common knowledgethat all women hear every shot fired in Mamajorca. QueenHenrietta I awoke one morning with a firm resolution to doaway with the male infidelity problem in Mamajorca . She sum-moned all of the women heads-of-households to the townsquare and read them the following statement :There are (one or more) unfaithful husbands in our community .Although none of you knew before this gathering whether yourown husband was faithful, each of you knows which of the otherhusbands are unfaithful. I forbid you to discuss the matter ofyour husband's fidelity with anyone . However, should you discov-er that your husband is unfaithful, you must shoot him on themidnight of the day you find out about it .Thirty nine silent nights went by, and on the fortieth night,shots were heard .

Josephine does not explicitly say how many un-faithful husbands were shot, how many unfaithfulhusbands were in Mamajorca at the time, howsome cheated wives learned of their husbands' infi-delity after thirty nine nights in which nothing hap-pened, or whether any more husbands were shoton later nights . The interested reader should stopat this point and try to answer these questionsbased on Josephine's account .

Let us consider the questions Josephine leavesunanswered . Since Henrietta I was truthful, theremust have been at least one unfaithful husbandin Mamajorca. How would events have evolvedif there was exactly one unfaithful husband? Hiswife, upon hearing the queen's statement, wouldhave concluded that her own husband was unfaith-ful, and would have shot him on the midnight ofthe first night . Clearly, there must have been morethan one unfaithful husband . (Recall that the wivesare all perfect logicians) .' If there had been exactly

2 The fact that the wives are perfect reasoners plays a crucialrole in all of the cases we treat . The nature of the situationchanges substantially if we relax this assumption, since wivesmust then reason about the logical capabilities of other wives .Some preliminary steps towards dealing with such a situation

Y. Moses et al . : Cheating husbands and other stories

two unfaithful husbands, then every cheated wifewould have initially known of exactly one unfaith-ful husband, and would have reasoned as follows" If the unfaithful husband I know of is the onlyunfaithful husband, then his wife will shoot himon the first night . " Therefore, neither one of thecheated wives would shoot on the first night . Onthe morning of the second day each cheated wifewould realize that the unfaithful husband she knewabout was not the only one, and that thereforeher own husband must be unfaithful . The unfaith-ful husbands would thus both be shot on the sec-ond night. In fact, similar reasoning is used bythe wives in general, and the following theorem,well known in the folklore, resolves our doubtsregarding Josephine's presentation of the facts :

Theorem 1. If there had been n unfaithful husbandsin Mamajorca at the time Henrietta I announcedher ruling, they would all have been shot on themidnight of the nth day .

Proof. The discussion above shows the claim forn = 1 . Assume that the claim holds for n = k . Thus,if there were k unfaithful husbands they wouldbe shot on the kt h night. We wish to show thatif there were n=k+1 unfaithful husbands theywould have been shot on the (k+ l)" night. As-sume therefore that there were k + 1 unfaithful hus-bands. Every cheated wife knows of exactly k un-faithful husbands. Because of the wives' logicalcompetence, they know that if there are exactlyk unfaithful husbands then those husbands will allbe shot on the kt h night. Before the kth night, acheated wife cannot determine that her husbandis unfaithful, and therefore no shots are fired inany of the first k nights . Since the kt h night is silent,every cheated wife concludes that there must bemore than k unfaithful husbands and that her ownhusband is unfaithful . The, unfaithful husbands areshot on the (k+ 1)'t night. The theorem followsby induction. 0

Notice the subtlety of the situation : On the firstday, immediately after the queen delivers her state-ment, a wife who knows of k unfaithful husbandsknows that every cheated wife knows of at leastk-1 unfaithful husbands, and knows that theirwives know of at least k-2 unfaithful husbands,

are presented in Konolige (1984), where he considers a ver-sion of the wise men puzzle - a well known puzzle that isa special case of the cheating husbands problem - whichhe calls the not-so-wise men puzzle, in which the knowersare not perfect logicians

169

and that their wives know of at least k-3 unfaith-ful husbands . . . . It follows that every wife thinksthat it is possible that a cheated wife thinks thatit is possible that a cheated wife thinks it is possi-ble . . . that a cheated wife knows of no unfaithfulhusbands other than her own . Thus, for all k> 1,it is not common knowledge that there are at leastk unfaithful husbands . The queen's statement,however, is common knowledge . This follows fromthe fact that the queen announced it publicly,thereby making it common knowledge that all ofthe wives heard her announcement . 3 It follows thatafter the queen speaks, it is common knowledgethat there is at least one unfaithful husband . Giventhe wives' famous logical capabilities, it is commonknowledge that if there is only one unfaithful hus-band then he will be shot on the first night . There-fore, once the first night is silent it becomes com-mon knowledge that there are at least two unfaith-ful husbands . Similarly, after k silent nights (butnot earlier!), it is common knowledge that thereare at least k+ 1 unfaithful husbands and thatevery wife knows of at least k unfaithful husbandsother than her own. So although a wife that knowsof k unfaithful husbands knows that there will beno shots before the kt h night, her state of knowl-edge changes following every silent night, eventhough there is no "communication" at all!

3 Asynchronous communicationJosephine's description of Mamajorca continueswith the following account :

Queen Henrietta I was highly regarded by her subjects for herwisdom in running the monarchy . She ordered her daughtersto continue her moral fight against male infidelity .

Her daughter, Henrietta II, succeeded her . In order to facil-itate communication with her subjects, Henrietta II installeda mail system from her court to all of the households in Mama-jorca . Her first letter to her subjects told them about the proper-ties of the new mail system : every letter she sends her subjectsis guaranteed to eventually reach each one of them . Thus, shewill not need to gather them in the town square for announce-ments any more. Eager to fulfill her mother's wish, HenriettaII's second letter to her subjects was an exact copy of hermother's original statement .

Henrietta II suffered great disgrace and died in despair.She ordered her daughters not to repeat her mistake .

Josephine suggests that despite the fact that Hen-rietta II gave the wives of Mamajorca exactly thesame instructions as her mother, her mother washonored, whereas she was disgraced . Again, Jose-phine refrains from explicitly stating why this hap-pened. Let us consider the possible outcomes of

3 For a discussion of this point, see Halpern and Moses (1984)

1 70

Henrietta II's action . Had there been exactly oneunfaithful husband at the time, his wife would haveshot him on the first night after receiving thequeen's letter, and the queen would have beensaved from disgrace . If there had been exactly twounfaithful husbands, however, each one of theirwives would know about the existence of one un-faithful husband, and that if the husband sheknows about is the only unfaithful one, then hiswife will shoot him on the day she receives theletter. Because the mail system is asynchronous,with messages only guaranteed to be deliveredeventually, neither wife would ever know that theother had already received the queen's letter .Thus, neither wife would know that her husbandis unfaithful : she would always consider it possi-ble that her own husband is . faithful and that thecheated wife she knows about has not shot yetbecause the queen's letter has yet to reach her .An immediate consequence of the above argumentis :

Theorem 2. If there is more than one unfaithful hus-band, and the original instructions are broadcastover an asynchronous channel, then no unfaithfulhusbands are shot . E

Because the letter is broadcast using an asyn-chronous channel, the queen's letter becomes even-tual common knowledge : once the queen sends it,every wife will eventually receive the letter, andwhen she does she'll know that all wives will even-tually receive the letter, and know . . . (cf. Halpernand Moses 1984) . However, at no time does a wifeknow that all other wives have received the letter .Thus, a wife can never determine whether the silentnights are a result of other wives' reaction to re-ceiving the letter or a result of the fact that theyhave yet to receive the letter . This property of asyn-chronous communication comes up in a similarfashion in the analysis of the Byzantine agreementproblem in asynchronous networks (cf. Fisheret al . 1983) . There, the asynchronous nature of thesystem prevents a processor from ever determiningwhether it has not received messages from anotherprocessor because the other processor did not sendany (and thus is faulty), or because the messagesare still on their way .

Notice that even if all of the wives happenedto receive the queen's letter simultaneously, thiswould not help . The fact that a wife must alwaysconsider it possible that other wives have not yetreceived the queen's letter is sufficient to preventher from being able to figure out whether her ownhusband is unfaithful .

Y. Moses et al . : Cheating husbands and other stories

4 Synchronous communicationJosephine proceeds to describe the controversialactions that ensued :

Henrietta III succeeded her mother, Henrietta II . She decidedto upgrade the mail system that her mother had installed inorder to avoid her mother's problem . Thus, she improved themail system so that any letter sent by the queen was guaranteedto reach all of her subjects not later than one day after it wassent.

Henrietta III knew that unless her subjects were aware ofthe improvement in the mail system, she would repeat hermother's mistake . Thus, Henrietta III's first letter to her sub-jects announced the new advances in the mail delivery system,and her second one was an exact copy of Henrietta I's state-ment.

Henrietta III was considered a more effective monarch thanher mother, but she will always be remembered for the greatinjustice she brought upon Mamajorca. If only she had toldher subjects to wait a few days before shooting, however, shecould have attained her grandmother's fame!

A mail system that guarantees that every letter sentis delivered no more than b -1 days after it is sentis called weakly synchronous with bound b . If wecall the sending day the first day, then such a letteris delivered to all wives no later than on day b .Before we continue, we remark that in HenriettaIII's days no calendar had been established in Ma-majorca .Let Ep denote " everyone knows p ", andE"' +tp aePE(Emp), for m>0.

Notice that an easy proof by induction shows thatif there are n unfaithful husbands, and E" (" thequeen sent the letter") becomes true at some point,then at least one cheated wife will shoot her hus-band, and the first shot will be fired at most ndays after E" ("the queen sent the letter") firstholds. In our case, a letter sent by the queen isguaranteed to be delivered to all of the wives inless than b days . Thus, once the letter is sent itscontents become b-common knowledge : within bdays every wife receives the letter and knows thatwithin b days every wife will receive the letter andknow that within b days . . . every wife will knowthe contents of the letter (cf. Halpern and Moses1984/86) . Thus, kb days after the queen sends theletter, Ek ("the queen sent the letter") holds, soit is certain that at least one unfaithful husbandwill be eliminated .

Although Henrietta III was probably not famil-iar with the concept of b-common knowledge,apocryphal records indicate that she was able toprove the following proposition :

Proposition 3 . In the weakly synchronous case withthe bound on delivery being b, a wife that knows

Y. Moses et al . : Cheating husbands and other stories

of exactly k unfaithful husbands will know that herown husband is unfaithful once kb silent nights passafter the day she receives the queen's letter .

Proof. A wife knowing of k = 0 unfaithful hus-bands requires kb = 0 silent nights to conclude thather own husband is unfaithful. By the queen'sstatement, that wife does not know that her hus-band is unfaithful any earlier than that . Assumeinductively that a wife knowing of k unfaithfulhusbands requires kb silent nights to conclude thather own husband is unfaithful, and suppose Maryknows of k+ 1 unfaithful husbands . Mary knowsthat if her own husband is faithful, then everycheated wife knows of exactly k unfaithful hus-bands, and, by the induction hypothesis, will shoother husband on the following night should kb silentnights go by after the cheated wife receives theletter . For all Mary knows, it is initially possiblethat her husband is faithful, and the letter mayreach the first cheated wife to receive it b-1 daysafter Mary receives it . Thus, she must consider itpossible that no shots will be fired before the(k + 1)bt h night after she receives the queen's letter .However, should that night be silent, Mary willknow that her husband is unfaithful . The lemmafollows by induction. D

Thus, Henrietta III was guaranteed not to suf-fer her mother's disgrace . However, what shedidn't realize was that noisy nights might confusesome of the wives . Consider, for example, the fol-lowing scenario : The queen's letters are guaranteedto arrive in less than 2 days (i .e ., b=2), and Susanknows that Mary's husband is unfaithful. SupposeSusan receives the queen's letter on a Monday,and hears Mary shoot her own husband at mid-night on Tuesday night. Unfortunately, now Susanwill not be able to figure out whether or not herown husband is faithful. Susan does not knowwhether the queen originally sent the letter on Sun-day or on Monday, and thus considers it possiblethat Mary received the queen's letter on either Sun-day, Monday or Tuesday . In particular, Susanconsiders both of the following scenarios possible :

Mary received the letter on Tuesday and,knowing that Susan's husband is faithful, shother own husband on Tuesday night.

Mary received the letter on Sunday and, know-ing that Susan's husband is unfaithful, waitedto see if Susan would shoot her husband onSunday or Monday night . Since Susan did notshoot, on Tuesday Mary concluded that herown husband was unfaithful, and shot him .

171

Thus, Susan cannot determine whether her ownhusband is faithful based on Mary's actions . Fur-thermore, she will never obtain any more informa-tion on the subject and will remain in doubt forev-er .

We call the first day on which the queen's letteris delivered to a cheated wife the first significantday. Given Proposition 3, it is easy to see thatcheated wives that receive the queen's letter on thefirst significant day will be the first to shoot theirhusbands. Do any other cheated wives shoot theirhusbands?

Every wife has an interval of b - I days inwhich a noisy night would leave her in doubt re-garding her husband's fidelity . To see this, recallthat a wife knowing of, say, k > 0 unfaithful hus-bands does not initially know whether there arek or k+ 1 unfaithful husbands in all . Furthermore,for all she knows the first significant day may hap-pen anywhere between b -1 days before she re-ceives queen's letter and b-1 days after she re-ceives it . "If there are k unfaithful husbands," shereasons, "then at least one of them will be shoton the ((k-1)b+1 )` h night after the day his wifereceives the letter, that is, between the ((k - 2)b +2)nd and the kbth night after the day I receive theletter . If, however, there are k+ 1 unfaithful hus-bands, one of them will be shot between the ((k-1)b+2)nd and the (kb +1)st night after the day Ireceive the letter . " Thus, if the first shot occursbetween the ((k-1 )b + 2)nd and the kbth night afterthe day she receives the queen's letter, a wife initial-ly knowing of exactly k unfaithful husbands willbe left in doubt regarding her husband's fidelity .Since a cheated wife that receives the queen's letterafter the first significant day will hear a shot inher interval of uncertainty, we have

Theorem 4. Using weakly synchronous broadcast,cheated wives that receive the queen's letter on thefirst significant day shoot their husbands ((n-1)bdays after the first significant day, where n is thenumber of unfaithful husbands) . All other cheatedwives remain forever in doubt about their husbands'fidelity . D

How could Henrietta III have changed the in-structions slightly and avoided the problem? Jose-phine seems to suggest that this could have beendone by requiring a cheated wife to wait a fewdays after learning of her husband's infidelity, be-fore shooting him . First notice that the wives' rea-soning is slowed down considerably if the shootinghappens only after a delay

1 72

Proposition 5 . In a weakly synchronous mail systemwith bound b, if every wife is required to wait ddays from the day she discovers her husband's infi-delity before shooting him, then a wife that knowsof exactly k unfaithful husbands will know that herown husband is unfaithful once k(b + d) silent nightspass from the day she receives the queen's letter(and, as long as all preceding nights are silent, noearlier!) .

Proof. Analogous to the proof of Proposition 3 .For k=0 the statement is trivially true . Assumeinductively that it holds for k and that Mary knowsof k+ 1 unfaithful husbands . Mary knows that ifthere are exactly k+1 unfaithful husbands, thenevery cheated wife knows of k unfaithful husbands .Thus, a cheated wife that receives the queen's letteron the first significant day (i .e., at least as earlyas any other cheated wife) will know that her hus-band is unfaithful once k(b + d) silent nights passfrom the day she receives the letter . Ordinarily shewould wish to shoot on the (k(b + d) + 1)s' night,but since she must delay d days, she will shoother husband on the (k(b+d)+d+1)St night afterreceiving the letter . Since Mary must consider itpossible that the first significant day occurs asmany as b -1 days after she receives the letter,Mary will know that her own husband is unfaithfulonce k(b+d)+d+1+b-1=(k+1)(b+d) silentnights pass and no earlier . The lemma follows byinduction . El

Josephine's claim is confirmed by the followingtheorem

Theorem 6. If the delay is sufficiently long, moreprecisely if d>-b-1, then all cheated wives shoottheir husbands and no wife remains in doubt .

Proof. We use Proposition 5 in a fashion similarto that in which Theorem 4 uses Proposition 3 .First, some notation is needed . Let F be the firstsignificant day, let D be the day Mary receivesthe letter, and let S be the day preceding the nightof the first shot . Notice that the proof of Proposi-tion 5 implies that if n >-1 is the number of unfaith-ful husbands, then S=F+(n-1)(b+d)+d+1 .Assume that Mary knows of exactly k > 1 unfaith-ful husbands . Initially, as far as Mary is concerned,there are two possibilities :- Mary's own husband is faithful . In this case

Mary knows that D - (b -1) < F< D + (b -1) .(Notice that Mary must consider the whole in-terval possible .) Since the number of unfaithfulhusbands is k, it follows that S=F+(k-1)(b+

d)+d+1 . Substituting h for D+(k-1)(b+d)+d+1, Mary has :h-(b-1)<S<h+(b-1) .

Mary's own husband is unfaithful . In this caseMary knows that D-(b-1)<F<D . (We musthave F< D, since otherwise, the first cheatedwife to receive a letter does so after Mary does,contradicting the assumption that Mary's hus-band is unfaithful.) Also, S=F+k(b+d)+d+1, because there are k+ I unfaithful husbands .Substituting h as above, Mary hash+(d+1)<S<h+(b+d) .

Therefore, ifd+ 1 > b -1 (i .e ., d >- b -1), then Marycan distinguish these possibilities (given that sheknows S, h, b, and d), and thus is guaranteed tobe able to determine whether her husband is un-faithful . It is easy to present scenarios that showthat no smaller delay suffices . One such scenariois the example following Proposition 3 above .There b=2 and d=0=b-2 . El

Josephine remarks

. . . Of course, the shrewd residents of the Wisegal district ofMamajorca avoided any eventual doubts by bribing the mail-person .

We assume that the social attitude towards bribesin Mamajorca was quite different from the attitudetowards infidelity. Consequently, (it was commonknowledge that) bribery would be kept a secretbetween a bribing wife and her mailperson. It isalso known that delivering mail was not an accept-able profession for the wives of Mamajorca . Thus,it was common knowledge that no wife knew ofa wife that bribed the mailperson . Given these cir-cumstances, the following proposition clarifies Jo-sephine's statement :

Proposition 7 . In the weakly synchronous case, awife that bribes the mailperson into telling her whenthe queen had originally sent the letter, does eventu-ally know whether her own husband is faithful .

Proof. Let the bound on delivery be b . Using Prop-osition 3, it is easy to show by a straightforwardinduction that if there are k unfaithful husbandsthen the first shot occurs between the((k-I)b+1 )St night and the kbth night after thequeen sends the letter . Thus, a wife that knowsof k unfaithful husbands and bribes her mailper-son, knows that her husband is unfaithful if noshot is heard on or before the kb" night, andknows that he is faithful otherwise. The crucial

Y. Moses et al . : Cheating husbands and other stories

Y. Moses et al . : Cheating husbands and other stories

point is that a wife that bribes her mailpersonknows which night is the kbth night, and thus even-tually knows whether her husband is faithful . D

Josephine continues with the reign of HenriettaIV :Henrietta IV, who succeeded her mother as queen, concludedthat the lack of a calendar was the reason behind the injusticeof her mother's scheme . She summoned the women of Mama-jorca to the town square and announced the initiation of acalendar beginning that day . "From this day on," she said,"the mail system will be strongly synchronous : every letter sentfrom the queen will bear the mailing date, and will be guaran-teed to be delivered to all of her subjects within less than bdays." At a later date, Henrietta IV sent her subjects a letterbearing the mailing date, and containing an exact copy of Hen-rietta I's original instructions . A thousand silent nights fol-lowed, and on the thousand and first day, Henrietta IV decidedto send another letter . She had finally realized that as a resultof Henrietta III's great injustice, the wives of Mamajorca lostmuch of their faith in the monarchy and its orders . It wasstill common knowledge that the queens were truthful, andthe vast majority of her subjects were obedient, but it was nolonger clear that all wives would obey the queen's orders . Hen-rietta IV's letter contained one line : "There is at least one obe-dient wife whose husband is unfaithful ."

Henrietta IV's wisdom was greatly appreciated throughoutAtlantis, and her success restored her subjects' faith in the mon-archy .

Let us see why the obedient wives could not figureout whether their husbands were faithful beforereceiving Henrietta's second letter

Proposition 8. In the strongly synchronous case, ifthere is exactly one cheated wife, and she is disobe-dient, then all of the other wives are in danger ofshooting their husbands on the second night .

Clearly, if the other wives had not suspectedthat the cheated wife might be disobedient, all ofthe faithful husbands would have been shot,whereas the unfaithful' husband would have sur-vived! Notice that once this is a possibility, evenif all wives are in fact obedient they cannot shoot .To see this, consider the case in which there areexactly two cheated wives . On the second day eachcheated wife cannot determine whether the firstnight was silent because her own husband is un-faithful or because the other cheated wife was dis-obedient . Thus, no shots are fired on the secondnight. Similarly, no shots will be fired on any laternights. It is now easy to show by induction thatsuch is the case if there are k cheated wives, forall k > 1 . So how did the queen's second letter help?

Theorem 9 . In the strongly synchronous case, if itis common knowledge that there is at least one obe-dient cheated wife, then all obedient cheated wiveswill shoot their husbands .

173

Proof. The argument here is very similar to thatof Theorem 1, with a slight twist . If there is onlyone unfaithful husband, then his wife is the onlycheated wife . Since there is at least one obedientcheated wife, she must be obedient, and thereforewill shoot her husband on the day she receivesthe second letter . If there are exactly k=2 cheatedwives, then each obedient cheated wife reasons asfollows : " If my husband is faithful then thecheated wife I know of must be obedient", andtherefore will shoot her husband when she receivesthe letter, at most b -1 days after the queen sentit (on day b at the latest) . Thus, if no shots arefired by day b + 1, an obedient cheated wife knowsthat her own husband is unfaithful, and shootsher husband on that night . Assume inductivelythat if there are exactly k >- 2 unfaithful husbandsthen all obedient cheated wives shoot their hus-bands on the (b + k-1)st night . If there are exactlyk+ 1 unfaithful husbands, then each obedientcheated wife knows of k unfaithful husbands, andknows that if her own husband is faithful thenat least one unfaithful husband will be shot onthe (b + k-1)st night. Thus, once that night is si-lent, she knows that (even though she might bethe only obedient cheated wife) her husband is un-faithful, and shoots him on the (b+(k+1)-1)stnight. The theorem follows by induction . D

Observe the difference between the bribed datescase, described in Proposition 7, and the stronglysynchronous case of Theorem 9 . If all of the wivesbribed the mailperson, then all of the unfaithfulhusbands would be shot, and no wife would remainin doubt regarding her husband's fidelity . How-ever, it takes (n -1)b + 1 days to eliminate n >- 2cheating husbands . Before the end of the processthe wives would not necessarily know that justicewould be done, and at the end it would not beknown whether any wife remains in doubt regard-ing her own husband's fidelity . In the strongly syn-chronous case, it takes b + n - 1 nights to eliminaten >- 2 unfaithful husbands, and it is commonknowledge that justice is done . The difference be-tween the two cases can be best understood bynoting that in the first case every wife knew onwhat day the queen sent the letter, but no wifeknew that others knew, whereas in the stronglysynchronous case the day on which the queen sentthe letter was common knowledge .

5 Ring-based communicationJosephine describes the outcome of a similar ap-proach to the male infidelity problem in the neigh-

1 7 4

boring city-state of Mamaringa, in which thehouseholds were arranged in a ring :The queens of the neighboring matriarchal city-state of Mama-ringa commonly adopted customs and rules from Mamajorca .Thus, Mamaringa was similar to Mamajorca in all respects,except that its households were built in a ring around the greatMt. Rouge. The location of each household in the ring wascommon knowledge, as was the fact that mail was deliveredin clockwise order around the ring .

The queens of Mamaringa tried to eliminate the infideltiyproblem by sending Henrietta I's letter once around the ring,using the state-of-the-art mail system in every generation . Noneof the queens of Mamaringa suffered the disgrace of Henriet-ta II, and none attained the honor of Henrietta IV . They willall be forever remembered as cruel and unjust queens .

The queens of Mamaringa probably hoped thatthe extra knowledge of the order in which lettersare delivered would be helpful in justly eliminatingall unfaithful husbands . However, the asymmetryintroduced by this knowledge makes a big differ-ence, as the following theorem shows

Theorem 10(a) In asynchronous delivery around a ring, the last

cheated wife to receive the letter will shoot herhusband. All others will not.

(b) In weakly synchronous delivery around a ring,some cheated wives will shoot their husbands,but some might not .

(c) In strongly synchronous delivery around a ring,some cheated wives will shoot their husbands,but some might not .

Proof. (a) We prove by induction that in the asyn-chronous case a cheated wife knowing of k cheatedwives that are all notified before her, and knowingthat no cheated wives will be notified after her,will shoot her husband k nights after she receivesthe queen's letter (and no earlier) . For k=0 theclaim is trivial . Assume inductively that the claimholds for k and that Mary is a cheated wife thatknows of k cheated wives in the ring before her,and none after her . Thus, once she receives theletter she knows that the last of k cheated wivesshe knows of has received the letter no later thanthe same day Mary did . Thus, if Mary's husbandis faithful then the last cheated wife she knowsof will shoot her own husband no later than knights after Mary received the letter . Once thatfails to happen, Mary shoots her own husbandon the (k + 1)St night after receiving the letter . Theclaim follows by induction . To see that no othercheated wife shoots her husband, notice that be-cause of the asynchronous nature of delivery, awife knowing of a cheated wife later in the ringdoes not know when that cheated wife will receive

Y. Moses et al. : Cheating husbands and other stories

the letter, and thus cannot deduce from the nighton which a later wife shoots that her own husbandis unfaithful (although in some cases she will beable to deduce that her own husband is faithful) .(b) The proof of Proposition 3 can be used to showthat some unfaithful husbands will be shot in thiscase. We need to show that injustive might occur,i .e ., that some unfaithful husbands might bespared. Consider the following scenario : the boundon delivery is b=2. Mary knows of only onecheated wife, Susan, who lives farther down thering than Mary . Mary receives the letter on Sundayand hears Susan shoot her husband on Monday .Mary cannot distinguish between the followingpossibilities- Susan received the letter on Sunday, and know-

ing that Mary's husband was unfaithful, shewaited to hear if Mary would shoot on Sundaynight. Since Mary didn't, Susan discovered thather own husband was unfaithful, and shot himMonday night .Susan received the letter on Monday, andknowing that Mary's husband was faithful, dis-covered that her own husband was unfaithfuland shot him that night .

Thus, Mary does not know whether her husbandis unfaithful in the above scenario, and does notshoot her husband . If her husband is in fact un-faithful, this constitutes a case of injustice .(c) The proof of Proposition 3 again ensures usthat some husbands will be shot . To show thata case of injustice can arise with strongly synchro-nous delivery around a ring, consider the situationdescribed in (b) above, with Sunday being the offi-cial sending date of the letter. Mary still considersboth of the above scenarios possible, and Mary'shusband is spared. Thus, if Mary's husband is un-faithful, a case of injustice occurs . 0

Notice that in the asynchronous case knowingthe order of delivery does help a cheated wife (inthis case only the last cheated wife) discover thather husband is unfaithful . In this case the extraknowledge can be considered "helpful" . However,more surprising is the fact that the wives' knowingthe order of delivery allows an unjust solution inthe strongly synchronous case, where none existedwithout such knowledge ! Thus, by introducing anasymmetry in the wives' reasoning, this extraknowledge has a negative effect on the solution .

6 Quick eliminationQueen Margaret opened a new era in Mammajorca . She madethe mail system an express mail system : All letters sent fromher court were guaranteed to be delivered to all of her subjects

Y. Moses et al . : Cheating husbands and other stories

on the day they were sent . Her first letter notified her subjectsabout the great advance in their communication capabilities .Margaret was an impatient queen . She knew that using hermail system she could successfully execute Henrietta I's instruc-tions . However, knowing that there were many unfaithful hus-bands in Mamajorca, and not wanting to wait very long forthem to be eliminated, she decided to look for a faster wayto solve the problem . She did so by giving her subjects instruc-tions that allowed wives to shoot into the air at midnight . Mar-garet's scheme was very successful ; the unfaithful husbandswere eliminated from Mamajorca in just a few days .

Notice that in Henrietta I's solution, n unfaithfulhusbands are eliminated on the nth night followingthe queen's announcement. Margaret sought a so-lution that would requre waiting fewer than O(n)nights. Given that shooting in the air at midnightis allowed, what is the minimal number of nightsin which the unfaithful husbands can be elimi-nated? Margaret's problem can be restated as fol-lows : Given a distributed system in which the pro-cessors share a memory consisting of a single tog-gle bit, each processor has a value, and it is knownthat the values are at most one apart, how manyrounds of communication are needed for the pro-cessors with the minimal value to know it? El Ga-mal and Orlitsky (1984) have treated similar ques-tions independently in a more general setting . Thefollowing theorem answers this question in Mar-garet's case

Theorem 11 . There is a protocol that allows shootingin the air in which the cheating husbands are allshot by the third night . That is the best possible .

Proof. Let us first show that a protocol in whicha wife's actions depend only on the number ofunfaithful husbands she initially knows of and theactual run of the protocol must require at leastthree nights . Such a protocol P can be viewed asa set of protocols P(k), k >_ 0, each specifying howa wife initially knowing of exactly k unfaithful hus-bands should act . If for some k>_1 both P(k-1)and P(k+ 1) do not prescribe any shooting on thefirst night, then clearly P(k) must require at leastthree nights, since a wife knowing of k unfaithfulhusbands cannot know whether her own husbandis faithful after the first night . If P(k') includesshooting in the air on the first night for somek' >_ 1, then P(k') must require at least three nightswhen there are k' + 1 unfaithful husbands . A wifeknowing of exactly k' unfaithful husbands shootsin the air on the first night, and cannot determinewhether her own husband is unfaithful before thesecond night. Thus, for all k>_1, one of P(k),P(k+1), or P(k+2) must require at least threenights .

175

The following protocol solves the problem inthree nights :(a) A wife knowing of ko unfaithful husbands,

with ko - 0 (mod 3), fires her gun at mid-night on the first night . If ko = 0 she shootsher husband, otherwise she shoots in the air .

(b0) If there was no shot on the first night, thena wife knowing of k1 unfaithful husbands,with k1 -1 (mod 3) should shoot her hus-band on the second night .

(b1) If there was a shot on the first night, thena wife knowing of k2 unfaithful husbands,with k2 -2 (mod 3) should shoot her hus-band on the second night .

(c00) If both first nights were silent then all wivesshoot their husbands on the third night .

(c10) If there was a shot on the first night, andno shots on the second night, then the firstnight shooters shoot their husbands on thethird night (if he is still alive) .

Let us briefly check that this protocol is cor-rect ; i .e ., we now show that if there is at leastone unfaithful husband, then all unfaithful hus-bands are shot, and no faithful husbands are shot .We first consider the case where there is at leastone faithful husband. Thus, if n = k + 1 is thenumber of unfaithful husbands, then some wivesknow of k+1 unfaithful husbands, and some ofk. If k-2 (mod 3), then the wives whose husbandsare faithful will shoot in the air on the first night .The cheated wives will shoot their husbands onthe second night according to step (b1) . If k=0then the cheated wife will shoot her husband onthe first night and no other shooting occurs . Ifk-0 (mod 3) and k>O, then the cheated wivesshoot in the air on the first night, the other wivesare silent on the second night, and by (c10) thecheated wives shoot their husbands on the thirdnight . If k-1 (mod 3) then the first night is silent,and the cheated wives shoot their husbands on thesecond night by (b0) . We now need to show thatif all wives are cheated then the husbands are shot .This is simple, since in all cases a wife that hearsno shots other than on nights she shoots ends upshooting her husband (check!) . 0

Notice that Margaret could have appended theabove protocol to Henrietta I's letter ; using it, acheated wife always shoots her husband on themidnight of the day she discovers his infidelity .In fact, a slightly more elaborate lower bound ar-gument of a similar flavor shows that it is the onlyprotocol Mary could have appended to Henriet-ta I's letter that is guaranteed to terminate in threenights. We remark that by slightly changing steps

1 76

(a) and (c10) in the above protocol it is possibleto obtain a protocol that works correctly even ifthere are no unfaithful husbands . (Of course, inthe modified protocol a wife knowing of no un-faithful husband will not shoot her husband onthe first night, and thus such a protocol cannotbe appended to Henrietta I's letter .) Details areleft to the reader .

7 ConclusionsThe cheating husbands problem is one in whichcommunication, knowledge, and action interact insubtle ways . We have presented a case analysis ofvariants of this problem given different communi-cation mediums and different degrees of clock syn-chronization . This problem demonstrates how sen-sitive the success of an operation can be to theknown properties of the communication medium .It also shows how knowledge can be obtained inindirect ways by observing the actions of elementsin the system, once we know something about howtheir actions are related to the facts they know .In fact, as we see in the bribery of the mailpersonin Proposition 7, obtaining knowledge about thedelivery times of a single letter can in some casesdramatically improve a wife's capability to act .The queens' instructions in all cases can be viewedas knowledge-based protocols in the sense of Hal-pern and Fagin (1985), since the actions that awife is required to take depend on her knowledge .The basic high-level "knowledge-based" protocolthat the wives follow is :

Do not discuss the matter of your husband's fidelity with anyone .However, should you discover that your husband is unfaithful,you must shoot him on the midnight of the day you find outabout it .

Consider a scenario in which the queen's letterreaches all of the wives on the day it is sent . Theactual way in which the above protocol will becarried out ("implemented") will depend on theknown properties of the mail system. As our analy-sis shows, the elimination of the n + 1 unfaithfulhusbands may take n + b nights, it may take nbnights, and it might never happen at all, dependingon whether the mail system is commonly known

Y. Moses et al . : Cheating husbands and other stories

to be strongly synchronous, weakly synchronous,or asynchronous, and the order of message deliveryis unknown . Thus, the execution of the protocoland its success depend not only on what reallyhappens (in this case, all letters being deliveredon the same day) ; they also crucially depend onthe wives' state of knowledge of what happens .

Another interesting point that arises here isthat knowledge can in some cases be harmful . Theresults of Theorem 10 show that running the sameknowledge-based protocol in a situation where thewives initially have strictly more knowledge canresult in 'a less desirable outcome . The ignorancepresent in the delivery of a message that is broad-cast in a strongly synchronous mail system whenthe order of delivery is unknown gives rise to statesof knowledge that allow the wives to perform ac-tions that they cannot perform in the ring, wherethe order of delivery is known .

Acknowledgements . We would like to thank Martin Gardner,Bengt Jonsson, Don Knuth, and Moshe Vardi for insightfulcomments on earlier versions . The interesting case of Theorem10(c) was suggested by the audience at a talk delivered in TelAviv University .

ReferencesBarwise J (1981) Scenes and other situations . J Philosophy,

vol LXXVIII, pp369-397El Gamal A, Orlitsky A (1984) Interactive data compression .

Proceedings of the 25th Annual Symposium on Founda-tions of Computer Science, pp 100-108

Fischer MJ, Lynch NA, Paterson MS (1983) Impossibility ofdistributed consensus with one faulty process . Proceedingsof the 2nd ACM Symposium on the Principles of DatabaseSystems

Gardner M (1984) Puzzles from other worlds, VintageGamow G, Stern M (1958) Forty unfaithful wives, Puzzle

Math. The Viking Press, New York, pp 20-23Halpern JY, Fagin R (1985) A formal model of knowledge,

communication, and action in a distributed system : prelimi-nary version . Proceedings of the 4th ACM Symposium onthe Principles of Distributed Computing, pp 224-236

Halpern JY, Moses Y (1984/86) Knowledge and commonknowledge in a distributed environment . Proceedings of the3rd ACM Symposium on the Principles of Distributed Com-puting, pp 50-61 . Revised as IBM research report RJ 4421,January 1986

Konolige K (1984) Belief and incompleteness . SRI ArtificialIntelligence Note 319, SRI International, Menlo Park, Cali-fornia