An Algorithmic Lucidity

a blog

July 2012

Lies and Delusion

One day, two philosophers were dining in a restaurant. "There's no such thing as lying," said the first philosopher to his companion. "Anytime someone speaks falsehood, it must be the case that they are merely deluded, or that part of them is, for the love of truth is so essential to the nature of agency that the very notion of deception is repugnant to it."

"On the contrary, there's no such thing as delusion," said the second philosopher. "Anytime someone thinks falsehood, it must be the case that they are merely lying, or that part of them is, for the perception of truth is so essential to the nature of agency that the very notion of misapprehension is repugnant to it."

A waitress, overhearing this exchange, found that she did not want to restrain herself. "You're both lying!" she shouted at the philosophers. "Stop lying!"

An Idea for a Psychology Experiment

Let me know if someone's actually done this.

Experiment: Use undergraduate schoolstudents as test subjects. Give each subject a shuffled deck of playing cards and ask them to sort it by suit and rank as quickly as possible. Time how long each subject takes to complete the task.

Prediction: A minority of computer science students will markedly outperform everyone else.

The Morality of Ringing a Bell

"Synthia, I want your opinion on something," said Quiana.

"You will have it."

"Is it wrong to enjoy ringing a bell?"

"Pardon me?" said Synthia.

"I said," said Quiana, "is it wrong to enjoy ringing a bell?"

"I heard you the first time," said Synthia irritably, "but I presume the question is prompted by some context you have not yet told me, a context I would need to know to provide you with the best answer I can give."

"There's a fast-food place near the campus," Quiana explained, "and next to the door, there's a bell that you can ring by pulling a cord, and a sign that says, 'If Your Visit Was Swell, Ring the Bell.'"

"And I suppose you're telling me that you go to this restaurant solely for the purpose of getting to ring the bell?"

"Maybe not solely, but yes! I can't think of any other situation where it would be socially acceptable to ring a bell in public. But here, the sign asks you to do it, and that makes it okay." She frowned. "Except," she added, "I even ring it on the occasions that my visit isn't swell."

"In your defense," said Synthia, "the sign doesn't suggest that you shouldn't. Otherwise it would have said, "Ring the bell if and only if your visit was swell."

"That's nice of you to say, but you know as well as me that interpreting the the English language if as a material conditional is at least problematic, especially given that there's no special reason to expect that the sign-writer understood propositional logic."

"True. But why would it be wrong to enjoy ringing the bell?—you must have a reason to suspect as much, or you wouldn't be asking the question. Is it that you don't want to reward the restaurant for ruthlessly exploiting your love of bells?"

"No, just the opposite! I'm worried that I'm being exploitative! The bell has a clearly-defined purpose: to let the employees know that your visit was swell."

"I think they'd prefer a tip."

"Of course. But the managers didn't give them a tipjar; they put out a bell, and I'm using the bell for spurious purposes! Isn't that wrong?"

"Quiana, I don't know why you bother asking me about your moral dilemmas; you know I don't have the kind of respect for Authority and Society that you do. I could walk you through costs and benefits: benefits to you of ringing the bell, possible costs to other diners who don't want their meal interrupted by a bell, mild appreciation of your apparent appreciation on the part of the employees, benefits to the restaurant owner for patronizing their business—but none of these observations will help you, because your morality isn't about facts that can be observed or computed from things that can be observed. Your morality is based on finding the 'correct' interpretation of verbal rules you read or heard. But if there isn't a uniquely preferable interpretation, if the words fail to capture the structure of reality, you get an unresolvable dilemma."

"And that's the reason you can't answer my question?"

"No, that was my answer."

The Problem With My Friend Who Has This Problem

Dear reader, I have this ... friend, who has this problem, and I wanted to ask—

What do you mean, Who is he? You wouldn't know ... her, and—

You must realize that I'm already aware that it's a standard trope for someone to say "I Have This Friend" when they're really talking about themselves, and given that I know it's already a standard trope, I would never be so obvious as to actually do it! Therefore you must truthfully conclude that I really am talking about a—

Okay, that's a good point. No, I didn't consider the fact that that reasoning can't possibly be sound because if it were, then people would use it as an excuse to falsely claim that they were speaking about a friend rather than themselves, thereby contradicting the assumption that the reasoning is—

Well, we could try to calculate the probability that I really am talking about a friend conditional on your epistemic state and taking into account the game-theoretic considerations just mentioned, but that could take all night, so will you just listen to my transparent lies for fuck's sake?

Thank you. So I have this friend, who has this problem, which is that there's a not-infrequently-occurring scenario in which she has trouble doing stuff, which is this: she feels morally obligated to make progress on some work she owes someone else, but she also wants to make progress on her own personal projects. She thinks she ought to work on the thing she owes someone before she works on her own stuff, but doesn't feel motivated to work on the thing for someone else, and she doesn't feel like she's earned the right to work on her own stuff, so she just ends up doing nothing instead. (Or not literally "nothing"; she looks at mildly informative articles and mildly amusing captioned images on the internet. But that should be considered a ground state which might as well be called nothing.) And so the day becomes a double tragedy: not only has she failed her sacred duties to someone else, she's also failed her sacred duties to herself, and for what? Tech news emphemera? Keeping up with all the comments on her favorite community blog? An adorable animated Graphics Interchange Format file of Rainbow Dash jumping on a bed? Not worth it!

Of course the right thing to do would be to efficiently work on the project she owes someone for a reasonable amount of time, and then work on her own project, but if my friend knew how to "just" do the right thing regardless of psychological state, then this problem wouldn't exist (and I wouldn't waste your time telling you about a problem that doesn't even exist on behalf of my friend who also doesn't ex—uh, doesn't ex–pect me to annoy you with problems that—unlike my friend—don't exist). To say that she should "just use willpower" isn't necessarily wrong, but it needs to be made more specific for the use of my poor friend, or an easier-to-use (although morally or pragmatically inferior) strategy is needed.

So I recommended to my friend that when she notices herself in this situation, maybe she should just start working on her personal stuff that moment, with the quiet hope that the psychological momentum of doing something, anything, can be carried over to fulfilling her obligations to others later in the day. Again, it's not the right thing to do, but surely it's better than what she lets happen now. It is written that the perfect is the enemy of the good, with the implied moral being that we should side with the merely good. I would prefer to say that the perfect is the enemy of the good, and while we would hope for the perfect to mercilessly annihilate all its enemies, sometimes you have to temporarily ally with a stronger enemy (in this case, the good) in order to vanquish an even greater foe (in this case, evil). But for humans at least, it amounts to the same thing.

Did I say the Right Thing?

A "Knock, Knock" Joke

This one is a classic that I love to repeat; stop me if you've heard it before. Knock, knock.

"Who's there?"

Truly repentant are those.

"Truly repentant are those who?"

Truly repentant are those who, when the temptation to sin is repeated, refrain from sinning!

Training Your Very Own Turtle to Draw the Boundary of the Mandelbrot Set

Dear reader, I don't think I've ever told you how much I love the Python standard library, but I do. When they say "Batteries included," they may not mean it in the sense of "a device that produces electricity by a chemical reaction between two substances," but they do mean it in the sense of "an array of similar things," where the similar things are great libraries. If you need a CSV reader, it's there. If you need fixed-point decimal arithmetic, it's there. But although perhaps it should not have surprised me, never has my joy and appreciation been greater than the fateful moment when I learned that the standard library itself contains a module for

TURTLE GRAPHICS

Yes, turtle graphics! In case you had a deprived childhood, I should explain: the idea is that you have a cursor on the screen (the turtle), and you can type, say,

FORWARD 10

and then the turtle will move forward ten units, drawing a line as it goes. And then you can say, like,

RIGHT 60

and the turtle will rotate 60 degrees clockwise. What a glorious introduction to the idea of computing: the user has her very own turtle to command, in effect becoming a godlike master of turtle existence with power limited only by her imagination and the bounds on thought itself! Isn't that truly outrageous (truly, truly, truly outrageous)?!

No it's not, you say? Well, fair enough. It is only to be expected that we should grow jaded with small miracles as we gain experience, and maybe I should stop doing that thing where I pretend to be more enthusiastic about geeky things than I actually am in some pathetic and misguided attempt to signal intelligence and curiosity.

But in any case, as long as we have turtles, we might as well have them do something vaguely amusing. Like, let's say, drawing the edge of the Mandelbrot set? Sure, okay. Let's do it.

One thing you have to know about turtles is—well, it's probably not very polite to say this, but it needs to be said—they're not very bright. You can't just say, "Oh, turtle friend!—would you please be a dear and draw the boundary of the Mandelbrot set for me?" because they'd never figure out how to do that on their own. You've got to give them very specific instructions.

The other thing you have to know about turtles is that they don't speak English; you have to tell them what to do in their native language. Our particular turtle happens to speak Python.

Now we should be ready to proceed, except ... well, we've all seen the famous pictures of the Mandelbrot set, but how is it defined, anyway? Well, as the great Jonathan Coulton sings (slightly edited):

Just [let zee be zero] in the complex plane, Let zee-one be zee-squared plus cee, Zee-two is zee-one squared plus cee, Zee-three is zee-two squared plus cee, and so on. If the series of zees will always stay Close to cee and never trend away, That point is in the Mandelbrot set.

That is, we pick a number \(c\) in ℂ, iterate \(z_{n+1} = z_n^2 + c\) starting from zero, and if the \(z_n\) diverge off to infinity, then that particular \(c\) is not in the Mandelbrot set.

Let's start writing instructions for our turtle. First, we'll summon the turtle. Also, let's tell her to look up instructions on how to compute the argument of a complex number—don't ask me how, but I have a feeling we're going to need that later:

import turtle
from cmath import phase

Now, it turns out (claims Wikipedia, and I believe it), that if the absolute value of one of our \(z_n\)'s ever exceeds two, then that sequence will diverge. This seems like a useful fact, so let's tell our turtle how to calculate how many iterations it will take for the sequence associated with a particular c to exceed two, and if it doesn't do so within some given number of iterations, then to tell us that:

def z_n_escape_time(c, n):
    z = 0
    for i in range(n):
        z = z**2 + c
        if abs(z) > 2:
            return i
    return False

To approximate the boundary of the Mandelbrot set, we'll tell the turtle to consider a grid of reasonably-finely-spaced points, and to consider a point to be on the boundary if the number of iterations it takes for the sequence for that point to exceed two is in some given range. We'll also tell her to sort those points by their argument, because that seems like a somewhat-reasonable order to visit them in:

def mandelbrot_edge(resolution, iterations, edge):
    points = []
    x_coordinates = [-2+i*(3/resolution) for i in range(int(resolution*1.5))]
    y_coordinates = [1-j*(2/resolution) for j in range(resolution)]
    for x in x_coordinates:
        for y in y_coordinates:
            if z_n_escape_time(complex(x,y), iterations) in edge:
                points.append((x,y))
    points = sorted(points, key=lambda p: phase(complex(p[0],p[1])))
    return points

Then (choosing some reasonable-looking numbers as specific parameters for our earlier instructions) we tell our turtle to visit all those points, drawing along the way:

def draw_boundary(protagonist, boundary_points, speed):
    protagonist.speed(speed)
    protagonist.penup()
    protagonist.setheading(protagonist.towards(boundary_points[0][0],boundary_points[0][1]))
    protagonist.forward(protagonist.distance(boundary_points[0][0],boundary_points[0][1]))
    protagonist.pendown()
    for p in boundary_points[1:]:
        protagonist.setheading(protagonist.towards(p[0],p[1]))
        protagonist.forward(protagonist.distance(p[0],p[1]))

def main():
    setting = turtle.Screen()
    protagonist = turtle.RawTurtle(setting)
    protagonist.shape("turtle")
    points = [(190*p[0],190*p[1]) for p in mandelbrot_edge(300, 500, list(range(60,500)))]
    draw_boundary(protagonist, points, 10)
    setting.mainloop()

if __name__ == "__main__":
    main()

And we get this:

our heroine's valiant attempt to draw the boundary of the mandelbrot set

Okay, so it's not perfect. But give the turtle a little credit, maybe? She tried. We tried. And if that's not good enough—and, well, I guess it clearly is not good enough—then I can only beg for forbearance on the part of any powers that could save us from our imminent self-destruction, we wretched and miserable creatures that are good enough to try but not good enough to succeed.

Trying to Buy a Lamp

Dear reader, I had wanted to tell you an anecdote about a recent incident in which I considered myself to have been outrageously mistreated, but it occurred to me that you probably would not find the story at all worthy of note. In fact, I fear you would be quite likely to think less of me for complaining in such a melodramatic fashion about something which the prevailing norms of our Society consider quite ordinary and proper. And what authority do I have to insist that it's Society that is in the wrong, and not I?

So I won't tell you. Instead, let me tell you a completely unrelated anecdote about my analogue in an alternate universe not entirely unlike our own. You see, recently, my alternate-universe analogue wanted to buy a table lamp, so he went—or let us say in a manner of speaking that I went—to a store to purchase one.

In the showroom, I found a lamp I liked, flagged down a salesman, and said to him, "I'd like to buy this lamp."

"Have you previously purchased a side table from us before?" he said.

"No," I said, somewhat puzzled by the seemingly irrelevant question.

"Well, you can't buy a lamp unless you already have a table to put it on," said the salesman in a tone of polite condescension.

"Oh, I certainly agree that it simply wouldn't do to get a lamp without having a table to put it on," I said, "but you see, I already have a table."

"So you did buy a table from us."

"No," I said.

"So you don't have a table."

"No, I do have a table," I said.

"So where did you buy it?" he asked.

"I'm actually an amateur craftsperson," I explained, "I have a table which I built myself."

The salesman showed no sign of having failed to hear me, but he showed no sign of having understood me, either. "The table is a prerequisite for the lamp; you have to buy a table before you can buy a lamp," he said.

I sighed. "Okay," I said in resignation, "in that case, I would like to buy a table and a lamp."

"No, no," he said. "That's not how prerequisites work; you can't buy a table and a lamp in the same transaction."

I didn't understand how it could make any substantive difference whether I paid in one transaction or two, but I perceived that objecting as much would be a waste of time, so I asked, "When can I get this lamp by?"

"Well, we only offer table lamps in the fall, so ..." he paused for a moment, "September 2013."

I said, "May I please speak to your manager?"

"Well, you can try talking to the guy in charge of lamps," said the salesman, "but he's probably not going to tell you anything different."

It soon transpired that the person responsible for the lamps wasn't in that day. I got his email address and sent him a letter asking if I could please buy a lamp, attaching photographs of my table as evidence that I was in fact qualified to buy a lamp.

I did not receive a reply.

Not from him, anyway. A couple of weeks later, I did receive an email from the CEO of the company, which I excerpt below, verbatim:

From: SF State CEO Alternate Universe Robert A. Corrigan <ceo@sfsu.com>

To: Alternate Universe Zachary Davis <main@altunivzackmdavis.net>

Subject: Message From the Office of the CEO

Dear Alternate Universe Zachary Davis,

I am writing to ask you to tell our elected officials how important affordable access to furniture at San Francisco State Upholstery and Home Furnishings Company is to you. California’s budget will be adopted in the next few weeks and you have one more chance to let legislators hear your voice.

TAKE ACTION

Last November, the California Legislature passed a budget that cut $750 million in subsidies from the state furniture system, forcing the CSU Board of Trustees to approve price increases for fall 2012 for customers.

The notification of this increase was met, understandably, with anger and frustration. When I met with customers protesting these cuts on December 1, 2011 it was agreed that we needed to work together to take our case to our elected officials and the "Customer Voices Campaign" was born. We launched a website and collected more than 400 stories about how budget cuts and price increases had affected customers and their families.

TAKE ACTION

A few weeks ago, I joined customers for a trip downtown to meet with our elected officials. The customers brought hard copies of each letter. We have been assured that each and every letter will be read. Your fellow customers who joined me spoke with power and passion—they were impressive.

But I have to tell you, I am not optimistic that our legislators really understand how customers are affected when state budgets force us to reduce inventory and ask you to shoulder a greater share of the cost. Over the next two weeks they will be gathering in Sacramento to make their final budget decisions. We have over 30,000 SF State customers and over 400,000 customers in the CSU, now is the time to inundate our elected officials with reminders about how important their budget decisions are to us.

By clicking the link below, you can send a pre-prepared message to all of your elected representatives in just a few seconds. Let them know the real consequences of their budget decisions.

TAKE ACTION

Sincerely yours,

Alternate Universe Robert A. Corrigan, CEO

Reading this letter made me very angry. "If a business selling any other kind of product—for example, math tutoring—provided such uniformly terrible customer service, they would either go bankrupt, or be burned to the ground by an angry mob, whichever came first," I fumed to myself. "And yet not only do these people treat their customers poorly, but they expect to be rewarded for it with taxpayer subsidies?! And Society just gives it to them, instead of laughing them out of business? The world is surely mad!"

But my anger subsided within a few minutes. What authority did I have to insist that it was Society that was in the wrong, and not I? The prerequisite policy must have been put into place for a good reason, and nor was it hard to discern what that reason was. San Francisco State Upholstery was, ultimately, just trying to protect me. Might it not be delusionally arrogant of me, a mere amateur, to suppose that my homemade table was adequate to support a lamp? What if I had been permitted to buy a lamp, but then it fell over and broke because my table wasn't sturdy enough?—I had to admit that was at least plausible. Should I not then be grateful that I was not permitted to take such a foolhardy risk?

Still, I thought, it simply wouldn't do to leave my table bare and my room dark for more than a year. So I—that is, my alternate-universe analogue—set aside all irrelevant thoughts, grabbed his cheap paperback copy of How to Build a Lamp by Alternate Universe Georgi E. Shilov (translated from the Russian by Alternate Universe Richard A. Silverman), and headed off to his workshop, to work.