{"id":84965,"date":"2019-08-07T16:15:21","date_gmt":"2019-08-07T16:15:21","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=84965"},"modified":"2021-05-03T14:13:52","modified_gmt":"2021-05-03T14:13:52","slug":"yes-and-no-questions-are-not-so-simple","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/databases\/theory-and-design\/yes-and-no-questions-are-not-so-simple\/","title":{"rendered":"Yes and No Questions Are Not So Simple"},"content":{"rendered":"<aside>\n<p><strong>Yes! We Have No Bananas<\/strong><\/p>\n<p><em>Song by Frank Silver and Irving Cohn<\/em><\/p>\n<p>There&#8217;s a fruit store on our street <br \/>\nIt&#8217;s run by a Greek. <br \/>\nAnd he keeps good things to eat <br \/>\nBut you should hear him speak! <br \/>\nWhen you ask him anything, he never answers &#8220;no&#8221;. <br \/>\nHe just &#8220;yes \u2013 es\u201d you to death, and as he takes your dough <br \/>\nHe tells you <br \/>\n&#8220;Yes, we have no bananas <br \/>\nWe have-a no bananas today. <br \/>\nWe&#8217;ve string beans and hon-ions <br \/>\nCab-bah-ges, and scallions, <br \/>\nAnd all sorts of fruit and say <br \/>\nWe have an old fashioned to-mah-to <br \/>\nLong Island po-tah-to <br \/>\nBut yes, we have no bananas. <br \/>\nWe have no bananas today.&#8221;<\/p>\n<\/aside>\n<p>Several years ago, I wrote an article complaining about using <a href=\"https:\/\/www.red-gate.com\/simple-talk\/sql\/t-sql-programming\/bit-of-a-problem\/\">bit flags in SQL<\/a>. But one of the underlying problems has to do with language in answering simple yes\/no questions. The first problem is that a question can be worded in a positive or negative fashion. For example, \u201cdo you have bananas?\u201d is a positive question and \u201cdon\u2019t you have any bananas?\u201d is a negative wording.<\/p>\n<p>In English, we always answer the question as if it was worded positively, instead of the way it\u2019s written. Not everybody in the world does this. There\u2019s a novelty song entitled \u201c<a href=\"https:\/\/en.wikipedia.org\/wiki\/Yes!_We_Have_No_Bananas\">Ye<\/a><a id=\"post-84965-_Hlt15986192\"><\/a><a id=\"post-84965-_Hlt15986193\"><\/a><a href=\"https:\/\/en.wikipedia.org\/wiki\/Yes!_We_Have_No_Bananas\">s, we have no bananas<\/a>\u201d which was popular in the early 1920s. It is supposedly based on a real incident when the songwriter heard a fruit stand owner answering a question. It sounded so funny to his English-speaking ears that he wrote a song about it.<\/p>\n<p>Linguists define a five-way system of designing responses with a word or other linguistic device.<\/p>\n<ol>\n<li>Two-form languages: yes and no. This is how English and most European languages work today. If there are bananas at the fruit stand, then the answer is \u201cyes\u201d, no matter how the question was worded.<\/li>\n<li>Three-form languages: yes (to a positive question), yes (to a negative question) and no. Scandinavian languages have this construct for negatively phrased questions.\n<p>For example, let\u2019s assume that we do have bananas. The question \u201cdo you have bananas?\u201d would be answered, \u201cJa\u201d, while the question \u201chaven\u2019t you any bananas?\u201d would be answered \u201cJo\u201d instead. If bananas do not exist, then both questions are answered \u201cNej\u201d instead.<\/li>\n<li>Four-form languages: yea, yes, nay, no. This is an extension of the three-form language, but it includes a way of handling the cases of a negative or positive question and no bananas. This is the way that early modern English worked. The changes in simplification of English over the centuries is a good topic in itself, but it doesn\u2019t have anything to do with data.<\/li>\n<li>Agreement languages: there are no words like yes and no, so you have to use a word, phrase or grammatical construction. In Japanese, you say \u201cThat is correct\u201d (hai) versus \u201cThat is incorrect\u201d (Iie) instead. This difference led to some problems with diplomats before World War II, negotiating surrender and war crimes trials at the end of World War II.<\/li>\n<li>Echo languages: no general words for yes or no, only positive or negative echo statements. You repeat the question back as a statement. Latin and Mandarin fall in this category. The advantage of this form is there\u2019s no confusion as to what you\u2019re affirming or denying.<\/li>\n<\/ol>\n<p>In the real world, cultures are another huge problem. Some cultures don\u2019t like to refuse anything to another person, so when they say \u201cyes\u201d, what they mean is \u201cI heard you\u201d and it has nothing to do with whether they agree or disagree with your statement. A horrible example of this mindset is watching some people install software in which they never answer \u201cno\u201d to an installation question. They are like dogs that have learned to shake hands, but they have no idea what they agree to when they do it.<\/p>\n<p>And we haven\u2019t even gotten the problem of people wanting \u201cyes\/no\u201d answers to questions that are not \u201cyes\/no\u201d questions! Yes, I have been listening to some of the Democratic Party candidate debates. You really can\u2019t say \u201cyes\u201d or \u201cno\u201d to a question like \u201cHow does your health care plan work?\u201d when asked by the moderator.<\/p>\n<p>Finally, some languages put the negation in the verb form as opposed to a particle marker or separate word of some kind. In these languages, to do something and to not do something are both parts of the same verb.<\/p>\n<h2>Boolean Functions<\/h2>\n<p>Boolean functions should be familiar to the readers. Their input parameters are zeros and ones, and they return either a zero or one. This how we define logic circuits in computers. But the truth is that this is a more general tool; you can think of them as a series of yes\/no questions that eventually return a yes or no output. If you\u2019ve ever gone through a loan application or other questionnaire, you have seen a less \u201ccomputer science-y\u201d use of this tool.<\/p>\n<p>Mathematicians talk about various properties of a Boolean function. The sensitivity of a Boolean function roughly measures the likelihood that flipping a single input bit will alter the output bit. Not all inputs carry equal weight. For example, if I tell my loan officer \u201cMy salary is over $500,000 per year\u201d, then will I qualify for my loan, even though it\u2019s a complete lie. The loan application is sensitive to that one question. But if I need to lie on seven or eight questions to get my loan, then the function is not as sensitive. Before you think this was a simple problem, it has stood for almost 30 years. Google \u201cSensitivity Conjecture of Nisan and Szegedy\u201d, if you like to read math papers.<\/p>\n<p>Sensitivity is usually one of the easiest complexity measures to compute, but it\u2019s far from the only illuminating measure. For instance, instead of handing you a paper application, the loan application program could have started with a single question and then used your answer to determine what question to ask next. This is a decision tree. The largest number of questions the bank would ever need to ask before reaching a loan decision is the Boolean function\u2019s query complexity.<\/p>\n<p>This query complexity measure arises in a host of settings \u2014 for instance, a doctor might want to use as few tests as possible before reaching a diagnosis, or a machine learning expert might want an algorithm to examine as few features of an object as possible before classifying it. Low query complexity is usually a good thing, but it is not always possible.<\/p>\n<p>There\u2019s a whole bunch of theorems and algorithms for putting a Boolean expression into <a href=\"https:\/\/en.wikipedia.org\/wiki\/Conjunctive_normal_form\">Conjunctive Normal Form<\/a> (CNF) or <a href=\"https:\/\/en.wikipedia.org\/wiki\/Disjunctive_normal_form\">Disjunctive Normal Form<\/a> (DNF). In English, this means we join things with ANDs or with Ors. By putting Boolean expressions in one of these canonical forms, we can do calculations to look for properties much more easily. It\u2019s also always possible to get a Boolean expression into one of these canonical forms.<\/p>\n<p>Over the years, computer scientists have developed many ways to measure a given Boolean function. Each measure captures a different aspect of how the information in the input string determines the output bit. Each measure provides a unique window into the structure of the Boolean function. Yet computer scientists have found that nearly all these measures fit into a unified framework so that the value of any one of them is a rough gauge for the value of the others. Only one complexity measure that didn\u2019t seem to fit in was sensitivity.<\/p>\n<p>Now Hao Huang, a mathematician at Emory University, has proved the sensitivity conjecture with an ingenious but elementary two-page argument about the combinatorics of points on cubes. This just happened on 2019-07-01! This is pretty recent, and I don\u2019t expect to use it in any applications immediately. But I do expect to see that it\u2019s going to get incorporated into query optimizers in the next year or two.<\/p>\n<p>Other measures involve looking for the simplest way to write the Boolean function as a mathematical expression (query optimization and re-writing) or calculating how many answers the banker would have to show a boss to prove they had made the right loan decision. There\u2019s even a quantum physics version of query complexity in which the banker can ask a \u201csuperposition\u201d of several questions at the same time. Figuring out how this measure relates to other complexity measures has helped researchers understand the limitations of quantum algorithms.<\/p>\n<h2>The Moral to The Story<\/h2>\n<p>There are a few quick morals to this article:<\/p>\n<ul>\n<li>It\u2019s hard to ask a good clear question when you\u2019re looking for data.<\/li>\n<li>It\u2019s hard to give a good clear answer to a question, even when it seems simple.<\/li>\n<li>Complicated, complex questions will have complicated, complex solutions by their nature.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Joe Celko explains why questions requiring yes or no answers are more complicated than you might realize in both spoken language and computing.&hellip;<\/p>\n","protected":false},"author":96214,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[30,143539],"tags":[],"coauthors":[6781],"class_list":["post-84965","post","type-post","status-publish","format-standard","hentry","category-opinion-pieces","category-theory-and-design"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/84965","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/96214"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=84965"}],"version-history":[{"count":13,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/84965\/revisions"}],"predecessor-version":[{"id":84978,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/84965\/revisions\/84978"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=84965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=84965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=84965"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=84965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}