tag:blogger.com,1999:blog-8288194986820249216.post1060775868224528633..comments2024-03-22T05:09:17.789-07:00Comments on Abstract Heresies: FollowupJoe Marshallhttp://www.blogger.com/profile/03233353484280456977noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-8288194986820249216.post-83401234363684075222010-03-03T14:09:42.676-08:002010-03-03T14:09:42.676-08:00Student C is the closest to being correct, but ......Student C is the closest to being correct, but ...<br /><br />First, we should determine whether we are talking about an operational meaning or a purely denotational meaning. The most straightforward type of operational meaning would be the sequence of evaluation steps, which allows divergent calculations to have an intuitive meaning. With denotational semantics the student's answer has to account for the inputs causing divergence in some other way.<br /><br />One problem with Student C's answer is the artificial limiting of the inputs to positive integers, since the code is non-divergent for any numerical input. <br /><br />One non-problem with Student C's answer is circularity - the mathematical definition of factorial is not operational but declarative: the factoral function is the function on non-negative integers satisfying the equation (n+1)!=(n+1) * n! and the initial condition 0!=1, assuming there exists a unique solution to these constraints.Onnie Lynn Winebargerhttps://www.blogger.com/profile/12976045264997191013noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-16096916984521312962010-03-03T07:11:26.905-08:002010-03-03T07:11:26.905-08:00They are all right. And wrong. "Meaning&quo...They are all right. And wrong. "Meaning" depends on the context and the context was not specified.Unknownhttps://www.blogger.com/profile/17713021536347849514noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-9294680100935160112010-03-02T10:00:57.005-08:002010-03-02T10:00:57.005-08:00I would say to Student A: The purpose of languages...I would say to Student A: The purpose of languages, computer and otherwise, is to communicate. By listening to me speak you are reading my mind, and so far you have been accurate, if obstinate. Apply the same faculty to this written program.<br /><br />I would say to Student B: Hm. I drew the distinction in the wrong place. I should have said "The question was about what the meaning of the FACTORIAL program is, not what the meaning of the FACTORIAL program does when further invoked."<br /><br />For example, we can say, if we want, that <br />((lambda (x) (+ x x)) 1) means 2<br />((lambda (x) (+ x x)) 2) means 4<br />((lambda (x) (+ x x)) 3) means 6<br />((lambda (x) (+ x x)) 4) means 8<br />((lambda (x) (+ x x)) 3/2) means 3<br />((lambda (x) (+ x x)) 1+2i) means 2+4i<br />but that is not the same as saying that<br />(lambda (x) (+ x x)) means "The doubling function".Alexeyhttps://www.blogger.com/profile/11095629814500390449noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-17474795477443690932010-03-02T09:12:10.014-08:002010-03-02T09:12:10.014-08:00It surprises me that Student A was able to honestl...It surprises me that Student A was able to honestly answer the question the way he did: he must have presumed that his brain had correctly interpreted the lecturer's question about the code, over the alternative that he is a brain in a vat presided over by a Matrix Overlord who wants him to learn about programming.<br /><br />Student A could, in theory, use the same process of doubting the regularity of the lower level of operation to answer any question -- be it about programming, everyday conversation, biology or visual arts. This means that the answer does not yield any information other than a retro skepticism about the nature of reality. An answer that is completely correct yet yields no information about the question itself is not an adequate answer.<br /><br />Student B is the most right, in the sense that he at least got nothing wrong in his reasoning about the program. Still, Student B is meant to be a programmer and not a calculator. A programmer, when examining code, has to demonstrate some understanding about what the program does, what it is meant to do and how the reality lines up with those expectations.<br /><br />Student C, presuming your code is R5RS scheme, is wrong. Factorials of negative numbers are undefined, as the operation results in division by zero. Yet (factorial -2) => 1, (factorial -1) => 1, (factorial 0) => 1. The code is something that resembles the factorial function, of course, but to not seek dis-confirmation between the definition of factorial and his mind's view about what the code does is a flaw much deeper than Student B's unthinking calculation. At least Student B had no particular ends in mind and thus was served only by his ignorance of what a factorial is, Student C took his preconceptions and ran with them.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-82543396138637324152010-03-02T08:29:15.037-08:002010-03-02T08:29:15.037-08:00Haven't you been trying all along to point out...Haven't you been trying all along to point out that the "students" are related to compilers, and that the compiler needs to know if things are redefined before it can compile them?sstchttps://www.blogger.com/profile/00821202515283762603noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-20803391058528745792010-03-02T04:04:10.889-08:002010-03-02T04:04:10.889-08:00Student A seems to admit at least that the author ...Student A seems to admit at least that the author had a meaning in mind when they wrote the program. There is a specification of the language Scheme that - in case predefined operators and procedures are not redefined - gives this program unambiguous semantics, and it is safe to assume that these are the intended semantics. If not, we would expect that redefinitions would be specifically mentioned and hinted at, due to the fact that under normal circumstances it's highly unlikely that somebody indeed redefines them. This is very similar to the case of normal daily conversations, where we also usually do not expect speakers to silently redefine English words and grammar rules. Of course, we are talking here only about social norms, but not anything that can be enforced, so there is a potential grey area here where silent redefinitions are possible. However, it's more than safe to assume under normal circumstances that this doesn't occur without explicit mention.<br /><br />Student B doesn't seem to understand that the meaning of a program is in terms of all possible inputs, not just a few random ones.<br /><br />Student C understands that there is a distinction between the program and the mathematical function it implements. So student C is actually right.Pascal Costanzahttps://www.blogger.com/profile/04512975624438301971noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-9291853735840205202010-03-01T17:30:58.405-08:002010-03-01T17:30:58.405-08:00Sorry - I must have made an error writing the abov...Sorry - I must have made an error writing the above post. I meant to introduce a bug in FACTORIAL by changing the less-than to a greater-than, to illustrate my point.mquanderhttps://www.blogger.com/profile/04628649386002008189noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-58988607585948544562010-03-01T17:29:41.812-08:002010-03-01T17:29:41.812-08:00It seems to me that student C is right completely....It seems to me that student C is right completely. In fact, I would say this stronger thing.<br /><br />Suppose FACTORIAL read like this instead:<br /><br />(define (factorial x)<br /> (if (<b><</b> x 2)<br /> 1<br /> (* x (factorial (- x 1)))))<br /><br />Even with a huge bug that removes any mathematical similarity between FACTORIAL and <i>factorial</i>, I would hold that this program *still* means <i>factorial</i>.<br /><br />Why? Because we know with a high degree of confidence that a human mind designed this program to implement the mathematical function <i>factorial</i> (because of clues like the name and the single very human error.) As a result, we can say that the flipped comparison is a bug, and we can correct the author, since he didn't write what he meant!<br /><br />In practice, this is what everyone has to do with programs all the time. If you're reading someone's program and trying to fix something without the benefit of a big formal spec, you've got to get inside their head (or speak with them) and understand what their program meant to them, because that meaning is going to inform how the program is being used, and making the program conform to that meaning is probably your priority.mquanderhttps://www.blogger.com/profile/04628649386002008189noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-85981245786395920612010-03-01T13:16:40.303-08:002010-03-01T13:16:40.303-08:00Student A replies: “How should I know? I can't...<i>Student A replies: “How should I know? I can't read minds!</i><br /><br />Then he's either socially inept or a smartass. If knowing what answer someone is after required mindreading skills, we would all be great mindreaders. We usually know what answer someone is after, despite the ambiguity of his question.Confusionhttps://www.blogger.com/profile/08370228073178175995noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-61238142358257319722010-03-01T13:05:55.722-08:002010-03-01T13:05:55.722-08:00I think all 3 students are (rightly) confused abou...I think all 3 students are (rightly) confused about the question: a _program_ doesn't have semantics; a language has semantics, then a program is written in that language. Each student is exploring a different facet of an undefined language semantics, given a program, a reference implementation and an intuition.<br /><br />Student B's point is closest to the "expected" answer, but missing a qualifier: from a denotational perspective, "(+ 2 3)" means "5", assuming that (+), 2, 3, 5 and the function application operation of the language are all mapped straightforwardly to their corresponding mathematical objects.Sharkeyhttps://www.blogger.com/profile/04175556830248883005noreply@blogger.com