- Recent Changes 新聞
- History 歷史
- Preferences 喜好
Discussion 討論
This is Chung-chieh Shan’s English blog. All posts are archived.
In the Communications of the ACM, David Lindley “defined an NP problem as one for which no polynomial-time solution is known”. Scott Aaronson, please call your office (two minutes into the podcast).
As Sigit’s cadre of systematic historians travel through branching time, they practice the art of curating library furniture. Thankfully, there is usually free surplus to acquire. To a systematic historian, every study carrel and reshelving cart, covered in residual fiberdust, announces its heritage in a loud, regulated voice: Was it made before or after the Geneva Convention? Did colonialism or socialism come first? Rocket launch or space elevator?
For the purpose of recovering phylogeny, the most useful features are the least consequential and least correlated: “junk events” such as the conclusion of wars, the exchange of promises, and the migration of bodies. That’s the real reason why systematic historians love diasporas. Like a junk gene, a junk event is copied and mutated by chance without much affecting the branching rate of a history, but like a borrowed word or a healed wound, it indelibly dents the design space of artifacts that a civilization will consider and consume in its future. Mostly, people prefer their artifacts to remind them of the past either head-on or not at all. To be sure, a junk event may well hurt or please many people, and in that sense they are consequential, but what we’re talking about is the fitness of a possibility, not of a person. The ideal junk event is one that “commutes” with all other events—one that does not affect their availability.
In neighborhoods of history where the study of systematics flourishes, the value of junk events is more widely recognized, which makes them unusable. Thus, systematic historians validate an ironic sort of uncertainty principle: they know the least about their own home, the surrounding possibilities closest to them. That’s what makes Sigit’s group so precious, its mere existence.

這是什麼雕像、誰的雕像?西元 2005 年 6 月見於法蘭克福總站屋頂。
What is this sculpture; who are this sculpture? Seen in June 2005 above Frankfurt main station.
(Translated to English from zonble’s promptbook in Mandarin. Those readers with a background in Asia will recognize the story as an Asian take on Star Wars as well as a Star Wars take on Asia.)
Dear Lukie:
It’s time to let you know.
Son, I’m not sure if you recall—in your teenage rebellion several years ago, before you mastered the Force, you kids blew up the Empire’s most important military facility at that time.
You probably still remember the thrill of conquest as your young self swiftly destroyed the giant enemy core. As if a classmate never paid you any attention, then one day you scored with her—eventually a forgettable experience, but not for a while. Your father was young once, and knows the need for bragging rights among buddies.
You might have wondered. As a Force wannabe who could only receive calls from other Jedi Knights—calls that perhaps you mistook as gut feelings stirred by the Force—how could you have blown up the Death Star with Molotov cocktails and a bunch of X-Wing fighters, or “X-Wees” as they were universally disparaged? How could a military facility that was indestructible by all accounts have crumbled in your hands? But when you dived into the heart of the Death Star in your X-Wee, you might have been surprised, behind the pretty facade—that is what Father wants to tell you about.
The Death Star would have been blown up, sooner or later. More precisely, it had to be blown up.
The day after you kids blew up the Death Star, the Emperor was to send a henchman to certify its construction before acceptance.
As you know, since its dawn, the Empire had been pouring in tremendous resources seized from the galactic population into the Death Star’s construction. Of course, this crucial military project was top secret in the Empire, from the design blueprints to the firepower statistics. Naturally, the Imperial budget of the Death Star was the top secret of top secrets.
As for how much of that budget was actually spent on construction, it was the top secret of top secrets of top secrets.
Few were privy to this secret. First, the Imperial commander in charge of the construction. Second, the building contractors—though they were all killed shortly before construction came to a close, they and their planet turned into milky, starry dust by the Death Star’s very first shot (exhausting the facility’s firepower, as it were). The commander in charge presented it to the Emperor as secrecy maintenance. It was true: the mere existence of the contractors threatened a leak. The Emperor thus sentenced the whole planet to some made-up crime, as was Imperial business as usual—naturally, the secret that was maintained was not the secret the Emperor had in mind.
When the Death Star blew up, the only witnesses on it were those blindly loyal clones, completely out to lunch (look, even robots fall in love, but have you seen clones fall in love?), who also all died. Who could doubt the truth? After the destruction, the Empire allowed no doubts, and any doubts would have found no corroboration. After all, the Death Star was a military facility, and all military facilities are subject to attrition.
Still, others knew, and they were the dearest to you. Your sister Leia knew. You might now realize why, as you kids wandered from system to system in the last several years, wherever and whenever the Millennium Falcon docked, Leia always told you first to visit the local financial institution for an account.
There was also your Uncle Obi-Wan. I’m really sorry what I did to this old friend, but I had no choice. Sigh!
Speaking of Leia, I shouldn’t have relied on her. When I gave her the designs of the Death Star, I told her especially to stay on the down low, to enlist you only, but she was still so unsure of herself as to ask Obi-Wan for help, and so inept at hiding her plot that my cunning old friend saw right through her. I tried so hard to call her back, oh did I try. Damn that Obi-Wan—think of it, twenty years! After twenty years out of touch, the first thing this old friend contacts me for at this crucial juncture was to blackmail me for hush money!
Despicable Obi-Wan! It was him who created this gulf of misunderstanding between you and me, father and son. Did he tell you that your father had perished under Darth Vader’s lightsaber? He made you think you had no father, made it unthinkable who your father really was. That’s why you thought my guys looking for you were the Empire hunting you down. The true reason, besides the money under your name, that Father looked for you, after twenty years of humiliation, after calling you with the Force to finish off the biggest money-laundering scheme of the Galaxy, was of course to enjoy the loot with a loving family, in another galaxy, unfettered.
It turns out, Obi-Wan had it all planned. I took care of him, but he passed the news and you to that greedy old fart Yoda! Did Yoda then lure you with his magic while pretending to shoo you away? Did he then tell you that you were not skilled enough with the Force to leave him? —When will you be skilled enough for him? When he gets your account information, of course!
Your sister, on the other hand, went from inept to dishonest. I don’t know if she fell under that wicked Yoda’s magic too, but after the Emperor stopped investigating the done deal, she tried to leave Father behind. Does she think she can outwit Yoda the old fox? Do you think they are just old fencing fogies spewing nonsense about the Force? Do I have to remind you of the Jedi Council of the Republic, of how much Yoda and Obi-Wan embezzled from classified clone-army accounts?
Son, were you also influenced by them to think that the Republic was progressive, glorious, wonderful? For them, of course it was—I couldn’t believe it when the Emperor first told me—they each took a cut! As I kept trying to teach you, to convey to you, don’t let them fool you with the Force. Yes, the Force is good to have, but could it protect your right hand? No, just as it could not protect my body back then. But with enough dataries (or other currency; dataries are not worth much these days), you can buy a new right hand. Do you really think the Jedi Knights kept the Galaxy running during the Republic with just that measly Force?
But you were young; you didn’t listen to me. Oh well; I was never good with words. Though I did tell you: You don’t know the power of the dark side.
Father is not telling you all this to reminisce, but to help you deal with some new developments in the Dynasty.
First, the Emperor recently ordered a second Death Star built. He hand-picked the contractors and sent a separate team of inspectors on-site. The Emperor believes in two things: the Death-Star technology he got in the Clone Wars, and that practice is the only criterion of truth. Once a second Death Star is finished, any difference between it and the one you blew up would call into question the construction of the first Death Star, and thus Father’s fate.
Second, the Emperor just sent his Royal Guards after you, so watch out: the Imperial soldiers you are about to encounter are not my guys looking for you, even though you might mistake both as the Empire going after you as the chosen Rebel leader.
The real reason the Emperor wants you is that you are an eyewitness. Everyone perished with the Death Star, except Father, on whom the Emperor’s shock-and-awe mind-control techniques are ineffective, but I don’t know about you. If the Emperor were to pry his purple lightning into your visual memory for a full-scan query that reenacts the workmanship of the Death Star, then Father would be in real trouble. In the worst case, Father might have to fight the Emperor to death. Even a Jedi Knight at my level faces the Emperor with uncertainty—the thought, as I enjoy a majestic view of stars large and small from this observation deck, brings a chill to my spine.
Son, it is through this window that I followed your life journey from afar over the years. Even your mother would be pleased, I think. But it is also through this window that I see in you more and more of myself.
And of the Emperor.
I have no idea how you’ll turn out.
The Emperor and I were both poor kids from the countryside. Our childhoods were miserable—of course, the Siths were probably more miserable in those days. I bet neither Obi-Wan nor Yoda told you that Sith and sex are cognates. The Siths had to bribe Jedi Knights for sex, and the Jedi Council derided the Siths as evil, only because the Siths thought all day long about sex in that environment. That’s why, when the Emperor couldn’t get any in those days, he resolved to become a power monger and eliminate corruption. He believed that totalitarianism was the least corrupt form of government.
He really went overboard, and I can understand why you kids turned anti-establishment. Where did the Emperor get the idea for his Edict on Sex? Maybe fidelity is worth legislating, but a minimum of five times a day? What got it into his head that this kind of sex would earn him loyalty and admiration from his subjects? Strangely enough, it did win some people over. I have no clue why.
It was this jealousy, this hate, that led the Emperor to me, a young Knight unvested in the status quo, shunned by the old boy’s club of corrupt Jedis. He got what he wanted from me—my aversion to Jedi nepotism, my help, almost my sex. After I sent y’all off, my lightsaber sliced through the other Jedi Knights like butter, even though I got my training on the grounds of the Jedi Academy and my milk through the nipples of the Jedi Council. If anything, it was that training, that milk, that made me hate all the world’s injustice, all the guys’ corruption, and what’s more—why couldn’t I get in?
I was yellow with greed. I was greedier than them all!
I wanted numbers that Obi-Wan and Yoda couldn’t imagine for their lives!
You grew up the same way, in the wastelands of Tatooine. Blame Father if you want, but how could I appear to be weak when you were still in the cradle? I know you don’t always love your uncle and aunt either. They knew Father was a Jedi Knight. They thought I was keeping enormous corruption proceeds all to myself, sharing nothing with my family but the burden of raising my son, so it was understandable that they disavowed me as their older brother. In reality, I had no proceeds to keep to myself, much less to share. On the other hand, don’t blame them now that I’ve made it. If they were still around, well, neither a borrower nor a lender be, and we’re not really brothers anyway.
Poor kid, we all used to be poor, but what now? It’s up to you.
Do you want to be rich? Or dead?
At the beginning, Leia let you join the Rebels just to finish laundering the Death Star money, not to lead a bunch of poor kids hoping to strike it rich in a role-playing game. I don’t know what Yoda and Leia have been giving you to smoke, that you think a circus can overthrow an empire, but they’ve kept you completely in the dark. They start these fights only to keep you around and get rid of me on the side, because I am the only one left who knows about this dirty money and where it came from in the Universe.
Yoda hasn’t bothered me directly, actually. I guess Obi-Wan’s fate showed him.
If you keep fighting against the Empire and, the Force forbid, fall into the hands of the Emperor, then even setting your life aside, you should keep in mind the hordes of cash in your four billion accounts throughout the Galaxy (as for which accounts, you need to check your own books), and in six billion accounts under Leia’s name. What’s more likely is if, as you lead the Rebels, they get to your accounts. Neither you nor I know what would happen then—revolts always come with casualties, don’t they?
Another possibility, son, is that you are a true Skywalker, not ruined by Jedi Knights as a child like your tragic father was—though I don’t know how they affected you more recently. Then you would hate corruption to your bones, especially when you find out that Tatooine was dirt poor precisely because the Death Star broke people’s backs with taxes, taxes that fell into the pockets of people like your father—strictly speaking, pockets of you currently, though you’re not yet sure which pockets.
By the way, you might all despise the Emperor for your poverty, but he’s actually quite thrifty in private, wearing nothing but a threadbare robe. You may not know that the Emperor’s frugality branding helped with his coup to some extent.
Anyway, your jealousy and ability may steer you in the footsteps of the Emperor. You might just overcome the grim dangers around you one day and even overthrow the Empire with your Force and charisma. You might just clear away, as the morning sun clears away a pea-soup fog, the world of us old people—of course, the chance is minuscule—and be chosen to lead the Galaxy.
Then what?
What new order do you want to bring to the Galaxy? Do you want to return to a republic? Or establish a second empire?
Republic or empire, the name of the game is corruption; the Galaxy will not change its course just for you. The only issue is whether you want corruption to occur among the select few, or among the select fewer; whether you want tacit corruption practiced by a privileged class, or invisible corruption practiced under everyone’s nose; whether you want people like Obi-Wan and Yoda to be corrupt under your rule, or people like your father to be corrupt. All heroes become corrupt, or rather, all heroes become heroes in order to descend finally into corruption.
In the Republic, some people were happy and some people were unhappy; Obi-Wan and Yoda were happy, whereas people like the Emperor and me were unhappy. Same thing with the Empire: some people are happy and some unhappy. If the Empire were overthrown, you kids might be happy, but another group would be unhappy, just like when the coup replaced the Republic by the Empire, making some people unhappy but others happy. It’s always the same, some happy and some unhappy. The only possible difference is—is it others who are happy, or is it you, but do you really know what makes you happy? You might think now that a republic would make you happy, but that’s just because you have not experienced a republic. I have. Republic or empire, I’m not happy.
—Do people really know what makes them happy? Sometimes people are happy because others are happy, or unhappy because others are unhappy. But sometimes people are unhappy because others are happy, or happy because others are unhappy.
There’s another way. We can evade our pursuers and head to another galaxy to create an unprecedented society, a truly pure galaxy. On every star—green stars, red stars, black stars, gold stars, stars of all colors and stripes, we will be a united galaxy of Skywalker clones. Son, if you wish, they can all be Luke Skywalker clones. Yes, we can. We’ve got the dough.
Please contact me ASAP. The situation is tight. Stay away from the Emperor. Beware your friends. Beware those you think are mentors. Beware those you think are family.
I know it’s not like you ever believed I was your father, but I must still remind you, when push comes to shove, don’t even trust me. But I hope you trust me a bit right now. After your mother passed away, everything I did was for you and Leia. It is also at great peril that I send this letter to you, even authenticating it with my red lightsaber—but I actually don’t think I can trust Leia nowadays.
To close, I must still bless you as usual, however ridiculous the blessing sounds coming out of my mouth. It’s looking more and more as if I doubted the Force. —Until now, all species in the Galaxy believed that I command a mighty Force, to the point where even I thought so, and it was indeed handy for a while. However, after losing one confidant after another, I don’t even find the Force trustworthy anymore.
What I mean is this. In the past, even though I doubted the Force had two sides, I did grant that each individual’s Force is limited. What matters is how the Force admits the individual to something bigger, even if the real point is that something bigger. But what I now doubt is, does the Force even deserve its name? Even if you’ve got the Force, and even if you’ve got that something bigger, yet…
I’m at a loss for words.
Recently I’ve been thinking a lot about something Yoda used to say—never mind how nasty he is with money—he retold an ancient prophecy, that someone will bring balance between the light side and the dark side of the Force, namely me. I’ve always thought the old man was talking rubbish, simply because nobody actually knew what balance means for the Force, or how to achieve it, I bet not even Yoda himself.
I actually barely remembered what Yoda said, but now that I’m reminded, I want to forget again. In the time since I used the Force to call you to blow up the Death Star, facing this observation window, I seem to have figured out, bit by bit, what it means to restore balance to the Force. I’m not sure—but maybe to restore balance is to eliminate the Force from the Galaxy. Of course, as we both know, that is impossible. We both have been immersed in the Force, inflamed by the Force, imbued with the Force senseless. We both know that the Force is there, will always be there.
The next best thing may be for the whole Galaxy to forget the Force. Well, with an Imperial officer like me and a Rebel leader like you, the Galaxy can hardly forget Jedi Knights or the Force. Moving on to the third best thing, we can make a wish in lieu of reality. People like Yoda and Obi-Wan cannot be the Chosen One, then, not because they fence badly or their strength is impure or their conduct is immoral, but because they’ve never had the wish, they don’t want to forget the Force, they even pose as tutors of the Force. Perhaps the true meaning of the prophecy, I’m thinking, is that I will be the first Jedi Knight to want to forget the Force, the first time a Jedi Knight has carried such a wish in the epic yet elusive pages of history—though this interpretation is still incredible.
I really want to forget. I want to forget the Force.
It probably won’t affect the Galaxy, but I have such a wish. To forget the Force.
I want no Force but to bless you. The phrase dooms me to ridicule as I said, snaring me firmly in an awkward loss for words. Oh Galaxy, how I curse you! I can attack you, damage you, ignite you, trample you, but in the end I am at a loss for words to you. Oh son, I departed you then pursued you, abandoned you yet recollected you, but in the end I am at a loss for words to you.
Sigh!
May the Force be with you,
Father
P.S. I looked into the company you’ve been keeping, which worries me.
I think you should stay out of Han Solo and Chewbacca’s relationship. They got the Millennium Falcon in the first place to elope from their legally assigned partners under the Edict on Sex. I know what you’re thinking; young Skywalkers tend to be fascinated with exotic furry creatures. When I was a kid, I was quite taken by a certain long-eared species. They were naturals at viscous fluids and balloons. But son, I don’t want you to be disappointed when the time comes. Really, muscular does not mean big. Besides, you don’t want to attract the vigilance of hidden enemies around you.
If you really need to, ask R2D2. D2 used to be with me, and I’ll tell you this: when it comes to Skywalkers, it’s still the vacuum cleaners that know our bodies best. If you wipe off the video Leia taped, you’ll find other holograms from when I was a kid. Maybe it’s too old-fashioned for you, but you can try and splice Chewbacca in too. If you need anything else, C3PO is also good.
In any case, great works call for great caution. If you still can’t control yourself, just cut it off. You know lightsabers; it won’t hurt long. Put it in a box and hang it on your chest for daily motivation. Once it’s all over, you can always pay to have a new one made.
Chatting with Andres Löh, I wondered: Is the following pointed-set monad useful, besides for analyzing focus in natural language (Rooth 1985, 1996)?
data Pointed a = Pointed a [a] deriving (Eq, Ord, Show, Read) toList (Pointed x xs) = x:xs instance Monad Pointed where return x = Pointed x [] Pointed x xs >>= k = Pointed y (ys ++ (xs >>= toList.k)) where Pointed y ys = k x
Here is an example of use:
*Main> Pointed 3 [4] >>= \x -> Pointed x [x*10,x*20] Pointed 3 [30,60,4,40,80]
Ok, I know, I should put it on Hackage. Is there a corresponding monad transformer?
Rooth, Mats. 1985. Association with focus. Ph.D. thesis, Department of Linguistics, University of Massachusetts.
Rooth, Mats. 1996. Focus. In The handbook of contemporary semantic theory, ed. Shalom Lappin, 271–297. Oxford: Blackwell.
This is something I should have done ages ago, I know, but what isn’t? I finally got around to reading some classic papers about what names and variables mean in opaque contexts (such as quotation and belief):
-
Quine, Willard Van Orman. 1956. Quantifiers and propositional attitudes. Journal of Philosophy 53(5):177–187.
-
Kaplan, David. 1968. Quantifying in. Synthese 19(1–2).
-
Kaplan, David. 1989. Demonstratives: An essay on the semantics, logic, metaphysics, and epistemology of demonstratives and other indexicals. In Themes from Kaplan, ed. Joseph Almog, John Perry, and Howard Wettstein, chap. 17, 481–563. New York: Oxford University Press.
It’s a shame that people working on embedding of natural languages and embedding of programming languages don’t talk more to each other. (It doesn’t help that these great reads are not terribly easy to access online—email me for a copy.) If you care about topics like multilanguage interoperability, denotational/extensional vs operational/intensional semantics, values and constant expressions that evaluate to them(selves), polymorphic lift, and cross-stage persistence, then these papers are definitely worth your time. (And vice versa: philosophy of language can benefit from computational thinking too; I name two equally classic papers below.)
For example, Kaplan (1989:497) distinguishes literal expressions
(directly referential terms such as (quote 3)
in Scheme) from other expressions that evaluates to the same value
in all circumstances (definite descriptions such as
(if (snow-is-slight) (sqrt 9) (- (* 2 2) 1))):
The propositional component need not choose its designatum from those offered by a passing circumstance; it has already secured its designatum before the encounter with the circumstance.
He goes on to note that this distinction tends to be exposed by syntax but masked by semantics (or in finally tagless terms, exposed when the representation of terms is polymorphic in their interpreters):
When we think in terms of possible world semantics this fundamental distinction becomes subliminal. This is because the style of the semantical rules obscures the distinction and makes it appear that directly referential terms differ from ordinary definite descriptions only in that the propositional component in the former case must be a constant function of circumstances. In actual fact, the referent, in a circumstance, of a directly referential term is simply independent of the circumstance and is no more a function (constant or otherwise) of circumstance, than my action is a function of your desires when I decide to do it whether you like it or not. The distinction that is obscured by the style of possible world semantics is dramatized by the structured propositions picture. That is part of the reason why I like it.
Quine and Kaplan both worry about what goes wrong when you can’t find an expression that evaluates to a given value, or when the only expression you find is an unspeakable mental structure, or when you find two expressions that evaluate to the same value but they are not observationally equivalent. (The same worries concern André Aciman, by the way. The evening rain in Århus reminds me of the Taipei where I presumably used to imagine I lived. But I digress.)
If you think philosophy is dry to read, well, these papers serve up counterexamples on page after page. Quine (1956:179) writes of lion-hunting, presidential candidates, and spy intrigue:
There is a certain man in a brown hat whom Ralph has glimpsed several times under questionable circumstances on which we need not enter here; suffice it to say that Ralph suspects he is a spy. Also there is a gray-haired man, vaguely known to Ralph as rather a pillar of the community, whom Ralph is not aware of having seen except once at the beach. Now Ralph does not know it, but the men are one and the same. Can we say of this man that Ralph believes him to be a spy?
Responding, Kaplan (1968) suggests “taking advantage of Ralph’s belief that all members of the C.P.U.S.A. are spies”, then discusses spy pictures:
Let me recite just a few of the familiar facts of portraiture. First, not all pictures of a person resemble that person. Of two recent pictures taken of me, one resembles Steve Allen and the other resembles nothing on earth. Secondly, not all pictures which resemble a person are of that person. It is obvious that a picture of one twin will, if it resembles the twin it is of, also resemble the other twin. … Of course, if photographs did not frequently, indeed usually, resemble their subjects, they could not serve many of the purposes for which we use them. Still, on occasion, things can and do go awry, and a bad photograph of one is yet a photograph of one.
… A police artist’s reconstruction of Santa Claus, based on a careful reading of the poem The Night Before Christmas, is not a picture of anyone no matter how many people make themselves up so that it exactly resembles them, and no matter whether the artist regards the poem as fact or fiction. …
In addition to the link with reality provided by the relation of resemblance the descriptive content of a picture determines its vividness. A faded picture showing the back of a man wearing a cloak and lurking in shadow will lack vividness. A clear picture, head on, full length, life size, showing fingerprints, etc. would be counted highly vivid. What is counted as vivid may to some extent depend on special interests. To the clothier, nude portraits may be lacking in detail, while to the foot fetishist a picture showing only the left big toe may leap from the canvas.
I wish I could write like that. I wish I could overcome the habits of terseness and Anglo-Saxon monosyllabary that page limits on conference papers and grant proposals have long instilled in me. I wish I would not revise my luck away should the monkey in me rediscover Landin’s passion—“This discussion of i reveals the possibility that primitives might be sensationally nonalgorithmic”—or Reynolds’s irony—“Definitional interpreters often achieve clarity by sacrificing all semblance of efficiency.”
- Landin, Peter J. 1966. The next 700 programming languages. Communications of the ACM 9(3):157–166. [abstract]
A family of unimplemented computing languages is described that is intended to span differences of application area by a unified framework. This framework dictates the rules about the uses of user-coined names, and the conventions about characterizing functional relationships. Within this framework the design of a specific language splits into two independent parts. One is the choice of written appearances of programs (or more generally, their physical representation). The other is the choice of the abstract entities (such as numbers, character-strings, lists of them, functional relations among them) that can be referred to in the language.
The system is biased towards “expressions” rather than “statements.” It includes a nonprocedural (purely functional) subsystem that aims to expand the class of users’ needs that can be met by a single print-instruction, without sacrificing the important properties that make conventional right-hand-side expressions easy to construct and understand.
- Reynolds, John C. 1972. Definitional interpreters for higher-order programming languages. In Proceedings of the ACM national conference, vol. 2, 717–740. New York: ACM Press. Reprinted in Higher-Order and Symbolic Computation 11(4): 363–397. [abstract]
Higher-order programming languages (i.e., languages in which procedures or labels can occur as values) are usually defined by interpreters which are themselves written in a programming language based on the lambda calculus (i.e., an applicative language such as pure LISP). Examples include McCarthy’s definition of LISP, Landin’s SECD machine, the Vienna definition of PL/I, Reynolds’ definitions of GEDANKEN, and recent unpublished work by L. Morris and C. Wadsworth. Such definitions can be classified according to whether the interpreter contains higher-order functions, and whether the order of application (i.e., call-by-value versus call-by-name) in the defined language depends upon the order of application in the defining language. As an example, we consider the definition of a simple applicative programming language by means of an interpreter written in a similar language. Definitions in each of the above classifications are derived from one another by informal but constructive methods. The treatment of imperative features such as jumps and assignment is also discussed.
These two papers are standard references in computer science for embedding and defining one language in another. Nowadays it’s fashionable to call the embedded language a domain-specific language (DSL). Surely Ralph’s mind qualifies as a specific domain.
(Incidentally, some things never change: after Landin presented his paper, the audience spent half a page discussing whitespace in his programming language.)
Solving the nice puzzle below, I found it easier to define a stream coinductively than to define a function from natural numbers inductively.
You’re standing in front of a 100 story building with two identical bowling balls. You’ve been tasked with testing the bowling balls’ resilience. The building has a stairwell with a window at each story from which you can (conveniently) drop bowling balls.
To test the bowling balls you need to find the first floor at which they break. It might be the 100th floor or it might be the 50th floor, but if it breaks somewhere in the middle you know it will break at every floor above.
Devise an algorithm which guarantees you’ll find the first floor at which one of your bowling balls will break. You’re graded on your algorithm’s worst-case running time.
“Running time” here means the number of times we drop a ball.
Before testing begins, all we know is that the answer is somewhere between the bottom of the building and the top. There are 101 possibilities in all, because maybe the balls are so strong that even dropping them from the 100th floor doesn’t break them, or maybe the balls are so weak that even dropping them from the first floor breaks them. At any time during testing, the set of possible answers remaining a contiguous set of floors: the lower bound is established by a drop that did not break the ball, and the upper bound by a drop that did break the ball.
Let c(n) denote the minimum worst−case running time, starting with 2 balls and n possible answers (so we want to calculate c(101)). We can stop once we know the answer, so c(1) = 0. If n > 1, suppose that we next drop a ball from the i-th possible floor from the top. (It only makes sense for i to be between 2 and n, inclusive, because if i < 2 then we already know the ball would break, and if i > n then we already know the ball would not break.) If the ball doesn’t break, then we have narrowed the answer down to i − 1 possibilities, so we have only c(i − 1) drops to go. If the ball does break, then we have narrowed the answer down to n − i + 1 possibilities, but we have only 1 ball left, so we’d better be careful and test the remaining floors from bottom to top, which takes n − i drops. To sum up, we have
c(1) = 0
c(n) = 1 + min2≤i≤n max { c(i − 1), n − i } if n > 1.
A nice way to calculate c(101) in Haskell is to define
a stream of numbers count, such that
count!!n-1 is
c(n).
count :: [Int] count = 0 : [ 1 + minimum (zipWith max counts [0..]) | counts <- inits' count ]
Look ma, no indices! The list [0..] above
enumerates all possible values of
n − i. This definition uses an
auxiliary function inits', which is equivalent to
map reverse .
tail . inits but
produces a result with more sharing.
inits' :: [a] -> [ [a] ] inits' = f [] where f accum [] = [] f accum (x:xs) = accum' : f accum' xs where accum' = x:accum
(The first clause defining f is not really
necessary for our purpose, because the list count
never ends.)
Let’s try it out.
*Main> take 101 count [0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10,10,10,10,10,10,10,10,10,10, 11,11,11,11,11,11,11,11,11,11,11, 12,12,12,12,12,12,12,12,12,12,12,12, 13,13,13,13,13,13,13,13,13,13,13,13,13, 14,14,14,14,14,14,14,14,14]
So the best we can do is
indeed 14 drops. What about general n? Note that
1 appears once, 2 appears twice,
3 appears thrice, and so on in the list above. It’s
not hard to see (and to prove by induction on n) that
the pattern continues, so c(n) is the least such
that 1 + … + c(n) ≥
n − 1.
*Main> and $ take 10000 $ zipWith (==) count $ [ ceiling ((-1 + sqrt (8 * n - 7)) / 2) | n <- [1..] ] True
Thus, indeed
c(n) = ⌈(−1 + √(8n−7))/2⌉.
坐了這麼多年的飛機,我已經有點不清楚到底去過哪些機場了。以後恐怕越來越享受不到航空旅遊的樂趣了。 After so many years of flying, I am no longer sure exactly which airports I have been to. I’m afraid the joys of air travel will be scarcer in the future.
要是能把去過的火車站也畫成地圖就太好了,不過想必很難。 It would be great if I could also draw a map of all the train stations I have been to. It’s pretty difficult though.
Chief Justice Roberts delivered the opinion of the Court.
There is an exponential relationship between radius length and surface area (Area = π r²). Increasing the radius of the shutdown zone from 200 to 2,200 yards would accordingly expand the surface area of the shutdown zone by a factor of over 100 (from 125,664 square yards to 15,205,308 square yards).
Well, it’s all O(1) anyway when it comes to the Supreme Court. James Grimmelmann, please call your office.
(Via The New York Times.)
For people like me, who enjoys studying computation and cognition from each other’s perspectives, two academic job openings have appeared this year that resemble the great job that I am lucky to have. The Carleton position is in cognitive science, whereas the Chicago position focuses on computational linguistics. The deadlines are in this month, unlike the typical opening in pure computer science in North American academia.

