HW1-SOLUTIONS - CS2603 Applied Logic Homework 1 - Solution...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS2603 Applied Logic Homework 1 - Solution Problem: Buggy Software Strategy A key point is to recognize that you only have to select a program that can get you off the island. You don't have to find out which program you're talking to when you ask the question. Another key is to realize that at least one of the two other programs (the ones you don't ask) must be capable of sending a proper message, since two of the three are capable. So, you can insist on using one of the the other programs to send the message. If, by luck, you happen to ask the question of the buggy program, whose answers are meaningless, either of the others can send the message, so it doesn't matter which you choose. If, on the other hand, you ask the question of the defect-free program or the answer-inverted program, then one of the other programs is the buggy one, so the answer to the question has to steer you away from the buggy program. You have to rig the question so that a yes answer says to choose one of the other programs, and a no answer says to choose the other one. To put it more succinctly, any two of the programs includes at least one that sends messages correctly. Therefore, at least one (and maybe both) of the programs that you don't submit a question to will be able to send messages correctly. If both of those programs happen to be competent, it doesn't matter which one you choose, but in case only one of them is competent (which is the only other possibility), the question you ask must to allow you to identify the competent one. With that in mind, here is a question that will do the job: Question Ask the HelpMe program the following question: "Is Ayudame more likely to answer yes-or-no questions correctly than AideMoi?" Explanation * Case 1: HelpMe is the defect free program. In this case, Ayudame is either the buggy program or the one that always answers incorrectly, and HelpMe always answers questions correctly. If HelpMe answers "Yes", then Ayudame must be the buggy program because a program that sometimes answers correctly and sometimes incorrectly is correct more often than one that always answers incorrectly. That leaves the always-incorrect role for and AideMoi. So, it's safe to ask AideMoi to send a help message. On the other hand, if HelpMe answers "No", it's safe to ask Ayudame to send the message. * Case 2: HelpMe is the program that always answers yes-or-no questions incorrectly. In this case, Ayudame is either the buggy program or the defect free program. If HelpMe answers "Yes", then Ayudame must be the buggy program because a program that sometimes answers correctly and sometimes incorrectly is correct more often than one that always answers incorrectly, which makes "No" the correct answer and "Yes" the answer that HelpMe would give. That leaves the always-incorrect role for and AideMoi. So, it's safe to ask AideMoi to send a help message. On the other hand, if HelpMe answers "No", it's safe to ask Ayudame to send the message. Note that this is the same rule that we used in case 1 to select the message sender. * Case 3: HelpMe is the buggy program. In this case, it's safe to ask either Ayudame or AideMoi ito send the message, so the rule used in cases 1 and 2 will also work for case 3. * In summary, if HelpMe answers "Yes", ask AideMoi to send the help message. If "No", ask Ayudame. Bon voyage PS It is a misconception to assume that the buggy program answers questions randomly. It may well answer questions in a deterministic way, but not always correctly, and correct answers may be more common (or less common) than incorrect answers. In fact, it may answer all questions the same way. Maybe it answers "yes" all the time, for example. You just don't know. All you know is that you can't count on getting a correct answer from the buggy program, nor can you count on getting an incorrect answer. PPS It is a semantic stretch, at best, to call a question that has no correct answer a "yes-or-no question." Assumptions about the behavior of the programs when asked such questions are assumptions that must be added to the framework of the problem. Solutions that require added framework are less satisfying than solutions that don't. ...
View Full Document

Ask a homework question - tutors are online