It made quite an impression on me at the time though it’s not clear what it means. I believe it was a discussion of a marijuana arrest at a sexual freedom league meeting. It sums up a lot of what was going on in Berkeley in those days.

Other than that, what’s interesting is that it’s almost all nouns. In English any noun can be used unchanged as an adjective. This makes possible headlines consisting of nouns piled up together. Our title has a non-noun in it, namely the adjective “free”. But we can replace it with “freedom” giving

*sex freedom pot bust rap*

a perfect example of what I call “noun talk” (the name itself also an example).

It’s amazing what you can say with just nouns, for example

*Theresa May Surprise Resignation Shock*

or

*Max 737 Software Assessment Implications*

Actually I made these up because modern headlines usually mix in verbs, adverbs, prepositions etc. But they’re easily altered to pure noun talk with its old fashioned tabloid-like flavor.

For example, this is an actual headline from today’s Huffington Post:

*Trump Opens State Visit to Japan with Remarks About Trade Imbalance*

This is easily expressed in noun talk as

*Trump Japan State Visit Trade Imbalance Remarks Opening*

Or another

*Record Number of Black women to Graduate west point military Academy*

becomes

*West Point Military Academy Black women Graduates Number Record*

Now you can argue that “west”, “military”, and “black” are adjectives but they are also nouns – eg “Black is back” – so it’s all kosher.

How about

Easy peasy

And

becomes

*Student Journalists High School Prison Labor Use Exposé*

Here’s one that occurred as is as a Hacker News headline:

*Blade Runner background wallpaper cyberpunk ambience website?*

How far can you take this? How much can you say in noun talk? This is on going research – the *noun talk expressiveness research project* – but it’s pretty far. Let’s switch to art and literature.

Many famous sentences convert easily. For example the unforgettable

*It was a dark and stormy night*

becomes

*night darkness, storminess*

(Notice punctuation is allowed in noun talk)

You’ve all been watching *Thrones Game* (Game of Thrones) based on *Ice, Fire Song* (song of Ice and Fire).

And read the *Rings Lord* trilogy *Ring Fellowship*, *Tower Duo,* and *King Return *and chuckled over the admonition

*mordor walking entrance inadvisibility*

Many titles are, perhaps with minor adjustment, already noun talk:* Brothers Karamazov; Clockwork Orange; Canterbury Tales; Treasure Island; Animal Farm; War, Peace; Pride, Prejudice; Crime, Punishment *(etc)*; Catalonia Homage; Hitchhiker Galaxy Guide; Alice Wonderland Adventures; Young Man Artist Portrait; Lion, Witch, Wardrobe; …*

And now a confession: I didn’t invent Noun Talk (although the name is mine). The credit goes to Michael Frayn, the famous playwright and novelist. The basic idea appears in his first novel *The Tin Men*.

*The Tin Men* takes place at the William Morris Institute for Automation. The Institute, which researches what we now call AI, is expecting a visit from the Queen to open the new Ethics Wing. AI? Ethics? Very up to date – except Frayn published *The Tin Men* more than fifty years ago!

Frayn’s book is a hilarious satire of automation, not to mention (bad) journalism and (bad) literature. In the book he briefly describes several on-going projects at the Institute.

For example the Ethics researchers are trying to endow robots with altruism (self sacrifice). To test their efforts they place their robot and another entity on a leaky raft in a swimming pool. When the other entity is an intern, the robot correctly throws itself overboard. However when the entity was a sandbag, an early version went down with the ship rather than throwing off the sandbag. It gets interesting when the other entity is another altruistic robot …

Another research group is automating journalism – writing newspaper articles. They did a survey of frequently appearing stories and discovered, for example, that some variant of “Paralyzed Girl Determined to Dance Again” appeared every ten days. They even surveyed readers as to their preferences and discovered, for example, that

*A rail crash was always entertaining, with or without children’s toys still lying pathetically among the wreckage.*

As for plane crashes

*What people enjoyed most was about 70 dead, with some 20 survivors including children rescued after at least one night in open boats. They liked it to be backed up with a story about a middle-aged housewife who had been booked to fly aboard the plane but who had changed her mind at the last moment.*

As part of the journalism automation project they invented UHL:

*UHL was Unit Headline Language, and it consisted of a comprehensive lexicon of all the multi-purpose monosyllables used by headline-writers. Goldwasser’s insight had been to see that if the grammar of “ban,” “dash,” “fear,” and the rest was ambiguous they could be used in almost any order to make a sentence, and that if they could be used in almost any order to make a sentence they could be easily randomised.*

Among other uses UHL could allow a story to be run with automated followups:

*STRIKE THREAT PLEA*

*STRIKE THREAT PLEA PROBE*

*STRIKE THREAT PLEA PROBE MOVE*

*STRIKE THREAT PLEA PROBE MOVE SHOCK
*

ad infinitum.

Recall that the “… Pot Bust Rap” and “… Cyberpunk Ambience … ” Noun Talk phrases were semantically ambiguous. They discovered the same thing at the William Morris Institute.

*Goldwasser had had a survey conducted, in fact, in which 457 people were shown the headline ROW HOPE MOVE PLEA LEAK DASH SHOCK HATE BAN BID PROBE*

The survey showed that

*Asked if they thought they understood the headlines, 86.4 per cent said yes, but of these 97.3 per cent were unable to offer any explanation of what it was they had understood. With UHL, in other words, a computer could turn out a paper whose language was both soothingly familiar and yet calmingly incomprehensible.*

Clearly UHL is Noun Talk, although a dialect restricted to one syllable nouns. All I’ve done is expanded it to allow multi syllable nouns and punctuation. And opened whole worlds of possibilities for this soothingly familiar yet calmingly incomprehensible new language.

BILL WADGE NOUN TALK EXPLANATION, MICHAEL FRAYN TIN MAN UNIT HEADLINE LANGUAGE COMPARISON TERMINATION

]]>

In the last post I proposes *neofictionalism*, the idea that the mathematical universe is a collective fiction (like Lord of the Rings, Star Trek or GOT) but about which statements can be objectively true or false. Thus the ordinal ω is comparable to the Iron Throne and the statement “ω is the set of all natural numbers” is objectively true in the same way that “the Iron Throne is made of swords” is objectively true.

Why *neo*-fictionalism? Because there is already a philosophy called “fictionalism” which presents a similar account but which declares that mathematical statements are all false because they refer to nonexistent objects. (Presumably statements about the Iron Throne are also all false).

What I’m saying is that ω and the Iron Throne are products of the human imagination. Humans are part of the real world and so is our imagination. So the products of our imagination surely exist in some sense. And if they exist, we must be able to make assertions about them.

All the members of the mathematical universe are like characters in a play, inventions of the human mind. This is true even if they are patterned after objects in the real world.

**The perfect circle, an early fiction**

Take circles, for example. As one comment on the Hacker News post pointed out, there are lots of circles in the world – the shape of the moon, the waves when a stone is thrown in a lake, the iris in your friend’s eye. But real world circles don’t hold up to close inspection.

Some are not quite circular. And all of them, under high magnification, are not made of perfect arcs – quantum mechanics, if nothing else – rules this out.

Mathematical circles, on the other hand, are idealizations or refinements of real world circles. The arcs are perfect (uniform curvature) at every level of magnification and have zero width. There are no such circles in the real world but we can imagine them. And, more importantly, we can come to a consensus about their properties so we can talk to each other about them.

Mathematics advances as we imagine new objects and work out a consensus about their properties. This has taken a long time – centuries in some cases. Think how long it took for a consensus to emerge to not use infinitesimals.

**The role of infinity**

Notice that already in the discussion of circles the word “infinite” popped up – perfect circles are infinitely accurate. Not an accident. The simple counting numbers are infinite in number, The ordinal ω is an infinite object. We mentioned infinitesimals, numbers which are infinitely small. Pure (mathematical) line segments are infinitely thin, have infinitely many points, and can be extended indefinitely.

If mathematical objects are imagined refinements of real world objects, then it seems that the refinement process involves proceeding from the finite to the infinite. Does the infinite exist in the real world? This is a difficult question but not one we have to answer. The important point is that humans can (consistently and collectively) *imagine* infinity.

**What is our inspiration?**

And where do we get the inspiration for these imaginary objects? From our experience solving technical problems in the real world.

The connection is not always straight forward but we can see the outline. Negative numbers record debts. Rational numbers record the results of dividing quantities into equal parts. Algebraic numbers (like the square root of two) allow measurements of geometric constructions and roots of equations. The real numbers and the continuum were created to describe continuous (smooth) change. The imaginary numbers allowed any polynomial to have roots.

The fact that mathematics is useful for describing the real world should hardly be a surprise. Mathematical objects were designed for this purpose. Saying math is unreasonably effective is like saying knives are unreasonably effective for cutting meat or hammers are unreasonably effective for hitting nails.

**Not so unreasonable effectiveness**

But perhaps that’s going a bit too far. It regularly happens that mathematical entities introduced for one purpose turn out, often decades later, to be perfect for another use that couldn’t possibly have been foreseen. My favorite example is Weierstrass functions, that are continuous but nowhere differentiable. Discovered in 1872, they were considered to be rare and pathological. Several decades later physicists realized they modeled ideal Brownian motion.

This was possible only thanks to centuries of struggle to find the right definition of a function. At first functions were considered as a defining expression, then piecewise by several expressions, then piecewise by infinitely many expressions. Finally the consensus emerged to allow arbitrary correspondences.

Nor should unforeseen applications surprise us. All really good technology is useful for purposes for which it was not designed. Take the world wide web: it was launched on networked personal computers, which had been designed for word processing, gaming, and exchanging recipes on bulletin boards. All good technology has redundant power which sometimes makes its effectiveness seem unreasonable.

**The wolf in the woods**

Neofictionalism also sheds light on issues of constructivism. A consensus has emerged in set theory, which is to use Zermelo – Fraenkl axioms plus the axiom of choice (ZFC). ZFC has been used for almost a century without a contradiction emerging and without finding a mathematical idea that can’t be formalized.

The axiom of choice is a perfect example of proceeding to the infinite. For a finite number of sets, our real world experience tells us it’s possible to make the choices. Visit each (say) jar and take one candy from each. AC says thus can be done even when there are infinitely many jars – and we can certainly imagine doing this even if in the real world it doesn’t make sense.

The problem is, infinite choice allows the construction of surprising objects.

In particular (AC) implies the existence of a nonmeasurable set – e.g. a surface that has no area. It implies the existence of an infinite game for which neither player has a winning strategy (and the game has no ties). It implies the existence of a voting system for denumerably infinite constituencies.

What does a nonmeasurable set look like? Or the game? How does the voting system work? Don’t ask. There are a whole group of results that say, basically, if you can give some sort of of concrete description of a set, it is measurable. Give a description of a game, there’s a winner. Of a voting system, it doesn’t work.

This is the explanation from a neofictionalist perspective: we imagine that there is a nonmeasurable set without there being a particular set that we imagine is nonmeasurable. There’s nothing impossible about this situation. It’s like writing a novel in which you say there’s a wolf in the woods without saying anything more about the wolf.

Constructivists reject the axiom of choice on principle but I don’t think there’s any principle at stake. It’s an engineering decision whether to include (AC) – we can imagine either possibility. And AC greatly simplifies the universe of set theory; it implies, for example, that the cardinals are linearly ordered.

Is ZFC the end of the story? I don’t think so. Mathematicians have been searching for alternatives to AC without the unpleasant side effects. So far without success, though the axiom of determinateness (every infinite game has a winner) looks promising.

Wherever this goes, I’m sure the last word has not been written. We’re free to choose our mathematical universe.

]]>

*-George Carlin*

When we’re talking about π, what are we talking about? What kind of object is it?

A number, your text book will tell you. Where is it? On the real line. Where is the real line and how long has it been around? It’s just there, and has been forever …

Your textbook may not answer these questions but philosophers have tried. Needless to say there is no consensus. They’ve come up with several answers, and in my humble opinion, all have something to offer, but all miss the mark.

I have an answer which you’ll be happy to hear I am going to share with you. Briefly, π and its friends live in our collective imagination. To be corny, in our hearts and minds.

Why is it important to understand the nature of mathematics? Isn’t it just useless philosophical hair-splitting that distracts us from the hard work of discovering new math? (Or *inventing* new math. Hmmm).

In fact it’s of great practical importance. For a start, how do we discover/invent new math if we don’t know what math is? How do we evaluate what we come up with if we don’t know what math is? And the big question is, why is math so darn useful, “unreasonably effective” as the saying goes.

**Platonism**

Hands down the most popular philosophy is *Platonism*. According to Platonism, numbers, sets, functions etc live in the Platonic universe (PU) of mathematics (lately, set theory) independently of time and space. The job of mathematics is to discover facts about the PU, and logical rules that apply to it.

When you’re actually doing math, it’s hard not to think Platonicly. So it’s a good heuristic. But that doesn’t make it true.

What does it mean to exist independent of time and space? Nothing, as far as I can see. I was once at a UVIC philosophy seminar where this came up. I asked if, in the time of the dinosaurs, bounded linear operators already existed. Yes, I was told. I have no idea what this meant.

How do we find new math? By exploring the PU … (how?) How do we evaluate new math?… by verifying that it’s true in the PU (how?). Why is it so useful? – anybody’s guess.

**Formalism**

The second most popular philosophy of mathematics is *formalism*. Formalism reduces mathematics to symbol manipulation. According to formalism, mathematics is working with formalized facts and rules. You have a set of axioms and some rules of inference, and you draw logical consequences – you prove theorems. So π is just a symbol that appears in the facts and rules and in the consequences derived.

Formalism was famously described by Hilbert when he said that “mathematics is a game played according to certain simple rules with meaningless marks on paper.”

How do we find new math? – symbol manipulation. How do we know it’s … true? By carefully following the rules of the game. Why is it math so useful? – a mystery.

Formalism certainly describes a lot of what mathematicians actually do. But not everything. Gödel’s incompleteness killed formalism as a philosophy by showing that there are always candidate theorems that can neither be proved nor refuted, and that such ‘undecided’ assertions arise no matter how many axioms you add. OK, maybe the process is never complete. But where do new axioms come from?

**Intuitionism and Fictionalism**

The other theories are minor players. According to intuitionism, mathematical objects are products of our mind, like characters in a novel. I agree, as far as it goes [see below]. But it comes with a lot of constructivist baggage that results in severe constraints on the forms of reasoning (it allows assertions that are neither true nor false) and a very reduced mathematical universe (e.g. no discontinuous functions). It’s not clear to me that it answers any of the three questions.

There is another approach that, like intuitionism, nearly gets it right. This is *fictionalism*. Fictionalism holds that the mathematical universe is a collective fiction, like Star Trek or Game of Thrones. That the Cantor set or the Borel Hierarchy is like the USS Enterprise or the Iron Throne. In fact Star Trek fans talk of the Star Trek universe and GOT fans of Westeros and they talk like these places really exist.

So far so good. And fictionalism dispenses with the constructivist baggage. Even better. But there’s a gotcha: according to fictionalism, all statements of mathematics are *false*. Because they refer to entities that don’t exist. Thus the statement “James Kirk is captain of the Enterprise” is false because Kirk and the Enterprise are both made up. New math? Anything you want. Good math? It’s all false. Why is it useful? Mystery.

**Neofictionalism**

What I’m proposing is a minor patch to fictionalism – allow statements about imaginary entities to be true as well as false. So the statement the statement “Spock is captain of the Enterprise” is still false but “James Kirk is captain of the Enterprise” is now true.

Strictly speaking fictionalism has a point: we’re using “true” and “false” in a nonstandard sense; but the solution is not to discard the distinction, but to make it clear that we’re talking relative to a fiction. Maybe call them “true.ST” or “false.GOT”.

What I’m saying is that the mathematical universe (MU) is humanity’s most ambitious fictional creation. There are tens of thousands of Trekkies and (?) Gamesters who know their respective universes inside out and have passionate discussions about Kirk being the best captain ever or Jon Snow being the rightful heir to the Iron Throne. But there are millions – hundreds of millions – who know the MU well and can answer (as true.MU or false.MU) questions about it.

I’m calling this revised fictionalism “neofictionalism” (catchy). It says that Math is like Star Trek but on a vastly greater scale, both in time to create it, in terms of extent (the MU is huge). And, most important of all, in terms of the precision with which it is described.

More on this next week.

]]>

I woke up in my alien-bin after a good night’s hypno. On my way down to breakfast I noticed the sign in the elevator: maximum capacity six atoms. Greek elevators are really small.

I loaded my plaque with bacon and eggs. I think having a good breakfast is very semantic.

As an episkeptic [visitor] from Canada I appreciated the mild weather. Yesterday was a bit cryo, but today the weather was zesty – no need for a coat. They say tomorrow will be really thermos.

My collaborator Good-Looking [Aristophanes] picked me up in his autokinetic at nine the hour. We dropped some clothes at the clean-ateria and went by the ethnic bench [national bank] to get some cash. Then we went straight to the all-knowledge [university] where he slaves. He had to didact a course so I worked on my article. I don’t slave as hard as he does and I evened warned him he writes so many articles he’ll get arthritis [arthros=article]. Ha ha.

Ari/nes said he’d be a few leptos late because he had to pass by the workateria [lab]. Then we threw an eye at some ideas for liturgical systems and programming glosses [languages]. Time for lunch? Let’s fuge [leave]. Just a couple of deuteroleptos I said, finishing my article.

What would you like, asked the servitor. I’d had bacon for breakfast so I didn’t fancy more creatures [kreata=meat]. A nice country salad would be fine. For dessert we split a bougatsa as big as my pode. It was good but poly glucose.

After we phaged [ate] my friend had to didact again – C++. I’m glad I don’t have to math [learn] that gloss. Meanwhile I went to freshen up in the anthropological washroom. I noticed one of the stalls in the gynaecological washroom was out of liturgy – glad I’m an andron. Someone put up a sign saying the aitia [cause] was apolitical [uncivilized] people throwing paper in the toilet. The sign said they should gyre to the spielia [caves].

My friend is a family man and had to head off – he has a nymph [wife], two paedia [kids] and a moron [baby] at home. He dropped me off at the alien-bin and I decided to see a movie.

What kind of movie? Astro Polemics: the Dynamo Ex-hypnos [Star Wars: the Force Awakens] was playing but as I phobed it was sold out. Anathema! [Darn!] Luckily there were other epilogs [choices]. Normally I like epistemic fantasy but espionage movies are fun too. Will the catascope [spy] be caught? Or police thrillers. See the epitheorist [inspector] chase the criminal. Not to mention war movies. Follow the career of the young axiomatic [officer] who becomes a strategist on a white hippo. Or biography – the would-be pop star with the powerful pneumons who finally has a hit tragedy [song] and nike’s a grammy.

In the end I decided I’d rather see a Gouestern, so I agora’d a ticket to the Hateful Okto. A lot of haema spilled! And necro’s everywhere! Freaky!

Later my friend and his family joined me for dinner. It was good and the logarithm was reasonable – we didn’t spend a lot of cabbage.

As we pulled out of the restaurant’s idiotic [private] parking lot I realized that soon I would have to take the ironroad to the aerodrome. And hear the traditional Greek farewell greeting – “call a taxi” [kalo taxidi].

]]>Whenever you want to do something, there’s always someone who says there’s something else you have to do first.

Call the thing you want to do A, the thing you’ve been told you have to do first B. They’re telling you you have to do B before A.

I remember when I was a precocious kid (grade 8 I think) I wanted to find out what relativity was about. I got a book from the Penticton public library but no luck: it started with frames of reference with a lot of algebra. (In math class we were doing percentage). I taught myself algebra but it still didn’t make much sense. Worse, for general relativity (A) you needed tensors (B) for which you needed calculus (B’) for which you need algebra (B”). It seemed it would take years before I was ‘ready’ to understand relativity and so I gave up.

(In fact it is possible to explain relativity without mathematical machinery but I’ll leave this till another time.)

That was not an accident; our whole educational system is based on B before A. Here’s a typical scenario: start of September, a new PhD student comes to see me, eager to start research. But … there’s these grad courses she has to take, and has to do well in. Best not to start any projects. So I end up saying the equivalent of “welcome to the program, see you in June”. Depressing.

Suppose she’s really keen on data mining. There’s even a course on data mining. But she can’t take it – prerequisites. She has to take, say, the advanced database course first.

And this is someone who already has an undergraduate degree. For that matter the whole undergraduate program is one big B. So is school. For that matter the whole educational system is a giant B that you have to do before A – before becoming an active and productive member of society.

My dad had a B-before-A experience that became a standing family joke. This was a long time ago but we still laugh about it. Pierre Burton, a very popular Canadian author at the time, had just written a book – I believe it was *The Comfortable Pew*, a mild critique of the establishment churches. My dad wanted to take a look at it so he dropped by the (same) Penticton public library and asked for it.

The librarian was indignant. “You don’t just walk in off the street” she said, “and ask for a book like that”.

Hers was the voice of B before A. You don’t just pick up a book on relativity and understand it. You don’t just step into my office and start doing research. You don’t just walk in off the corridor and take data mining. You don’t just turn 13 and expect to contribute to society.

My daughter had a B-before-A experience that is still painful to recall.

When she was still little (maybe 8) she decided she wanted to play the drums, and we agreed we should encourage her. We asked around and some people said, hold on, first she should learn music theory and maybe a bit of piano. Hmm. You don’t just pick up some drumsticks and start banging away …

Luckily, I asked a colleague who is also a professional drummer and he said, let her start with drums, learning theory as needed. Sounded good.

In fact my colleague’s advice was a special case of an alternative to the B-before-A anti-pattern. That is, first you do a bit of A until you need some B. You do just enough B, then more A, till you need more B, and so on. Call it the a-b-a-b pattern.

So I took my daughter down to the music store and luckily for us there was an actual child size drum kit on display. Furthermore you could lease it (after all who knows how long the passion for drumming would last). I was ready to sign up when I remembered we were about to take a trip to California. “Sweetheart” I said, “when we get back from our trip (B) we’ll get the drums (A)”. Big frown.

You know what happened. When we got back, the kit was gone. As we were walking back to the car, my little girl burst into tears.

Father of the year!

]]>

I seem to be always discovering fundamental Laws of the Universe, especially about teaching. I’d like to share some of them with you. They are each called “Wadge’s Law” … by me. Maybe the name will catch on. Here they are.

**Wadge’s Law (of traffic)**

No matter how late you go through an orange light, the guy/gal behind you follows you through.

As far as I know this is not just a heuristic, it’s 100% true all the time. I’ve never witnessed an exception, and don’t know anyone who has.

**Wadge’s Law (of Vampire Courses)**

Whenever you’re giving a course, there’s always another course with a much heavier workload that is draining the life out of your students.

The students think that the Vampire Course, because it involves so much work, is more important, and its A’s and B’s are worth more. When in the clutches of the VC, they skip class or show up late, miss assignments, arrive pale and exhausted, fall asleep, drool, etc

**Wadge’s Law (of Meetings).**

*Before every formal meeting there’s a smaller, more exclusive, less formal meeting where all the important decisions are made.*

This is based on decades of experience in academia and friends’ experience in industry and government. Sometimes there’s an even smaller, more exclusive, less formal pre pre meeting where all the decisions of the pre meeting are made. Maybe even a pre pre pre meeting … until you reach some guy deciding everything in the shower.

**Wadge’s Law (of teaching)**

Just when you think you’re captivating the students, entrancing them, enthralling them, you turn around and see at least one of them half unconscious from boredom.

Head askew, eyes glazed and half shut, body starting to slump. And if you thought you were really soaring, there will be drooling.

**Wadge’s Law (of citation)**

No matter how unusual your last name, no matter how impressive your publication list, when you look up your citations there’s someone with the same name who totally outperforms you.

For me it’s a geologist named Geoff Wadge (absolutely true). He writes about volcanoes. A lot. More than I do about anything.

I have a friend with an unusual name, let’s call him Sam Wassereimer. I told Sam about this law and he says “I’m a counterexample”. Sam has published a few books and on Amazon he has no equal among the Wassereimers. I got suspicious, went to Google Scholar, and sure enough there’s a WD Wassereimer who totally outperforms Sam (a lot of journal publications). Says Sam, “but WD is dead!” Says I, “even dead he outperforms you!”

A break from Laws about academia.

**Wadge’s Law (of departure)**

From the time you get up and start leaving the house, till the time you actually drive away, an inexplicable five minutes has passed.

More generally, a five minute surcharge applies in other scenarios. Suppose you live in an apartment and it takes seven minutes to take the elevator down to the garage and exit it. If you leave at 1:30, you will drive away at 1:42.

**Wadge’s Law (of invigilation)**

No matter how easy the exam, and how much time the students have, there’s always at least one who stays till the bitter end.

Again, no known exceptions. I’ve seen the bitter enders play with their pencils to kill time.

My daughter, who also teaches, pointed out a companion Law. Since she uses Wadge as her professional name, this is

**Wadge’s Second Law of Invigilation**

No matter how hard the exam, and how little time the students have, there’s always at least one who leaves ridiculously early.

The next one is derives from a long career teaching Computer Science:

**Wadge’s Law (of computer courses)**

Every Computer Science Course has a tendency to degenerate into a programming course.

For example, in an AI course the students write a chess player, in an embedded systems course they write realtime software, in a hardware course they write simulators … and so on.

This rule is not absolute; the instructor can resist the tendency. But it takes effort.

This rule is so profound I’ll devote a future posting to it. For example, what does a Physics course degenerate into? A psychology course? For that matter, a programming course?Think about it.

Finally, the most profoundest Law I’ve discovered so far.

**Wadge’s Law (of B before A)**

Whenever you want to do something, there’s always someone who says there’s something else you have to do first.

You’ll have to wait for yet another post to learn all many instances and examples of this Law. (Actually, I just gave you one).

Well I personally think this post has been excellent and can’t wait for feedback.

Oops!

]]>A formal power series is a (usually) infinite polynomial in x. For example

*1 + x + x*^{2}* + x*^{3}* + x*^{4}* + …*

This is an expression, not a number. If we give a value to x, we may get a number, or the evaluation may run away (diverge) on us (if |x|≥1).

They’re called *formal* power series because we don’t normally try to evaluate them, we just manipulate them formally and symbolically.

For example, if we multiply the above series by *1-x*, we get … *1*. So *1-x* is the multiplicative inverse of that series, even though the series diverges for most values of *x*. These are purely formal manipulations.

So where’s the fun? Well recently my colleagues and I produced a Lucid interpreter. It’s written in Python and handles the full language described in the Lucid book, plus it supports an extra space dimension. I’ll tell you about it in another post and make it available through github.

Anyway pyLucid plus formal power series spells fun. Clearly a formal power series is determined by the infinite sequence of its coefficients, and such a sequence can be represented in a straightforward way as a space vector. Thus the power series 1 is *1 sby 0*, the series *x* is *0 sby 1 sby 0*, the series *x ^{2}* is

More precisely 1 sby 0 is the vector

1, 0, 0, 0, …

which represents

1 + 0x + 0x^2+ 0x^3 + …

0 sby 1 sby 0 is the vector

0, 1, 0, 0, 0, …

which represents the series

0 + 1x + 0x^2+ 0x^3 + …

0 sby 0 sby 1 sby 0 represents

0 + 0x + 1x^2+ 0x^3 + …

and 1 is the vector

1, 1, 1, 1, …

which represents the original series above.

What about operations on power series? Addition is just that: if pyLucid vectors P and Q represent two power series, P+Q represents their sum, since addition is coefficientwise.Multiplication is more complex.

(I’m going using ASCII notation instead of proper sub and super scripting. I tried but the cockamamy new wordpress editor ate my html).

Anyway we can break down P to p0+xP’ where P’ is p1+p2x+p3x^2+… . Similarly Q is q0+xQ’ and multiplying them we get

p*0q0 + (p0q1+p1q0)x + P’Q’x^2*

This defines multiplication of P and Q in terms of multiplication of P’ and Q’. This is recursion but P’ and Q’ are in no sense simpler than P and Q. However we can use it to write pyLucid code because it produces two coefficients before it recurses. It doesn’t deadlock.

The pyLucid definition of product of two series represented as space vectors is

*pprod(p,q) = r where p0 = init p; q0 = init q; pp = succ p; qp = succ q; r0 = p0*q0; r = (r0 sby (p0*qp + q0*pp)) + (0 sby 0 sby pprod(pp,qp)); end*;

(Dangnabbit, there doesn’t seem to be a way to indent a block in Gutenberg, WordPress’ newfangled editor.)

We can test *pprod* by multiplying 1 (our original power series) by itself, and we get

*1 + 2x + 3x^2 + 4x^3 + …*

which is correct. In other words, *pprod(1,1)* is

*1, 2, 3, 4, …*

Division is even trickier, I’ll spare you the explanation, the code is

*pdiv(q,w) = t where q0 = init q; w0 = init w; r = q0/w0; v = succ(q – r*w); t = r sby pdiv(v,w); end;*

We can test it by setting *one = 1 sby 0* and calculating *pdiv(one,1)* which gives coefficients

1, -1, 0, 0, 0, …

which is correct since the result is *1-x.*

Formal power series can be integrated and differentiated (formally) and that’s where things get interesting. The derivative of

*p0 + p1x + p2x^2 + p3x^3 + …*

is

*p1 + 2p2x + 3p3x^2 + …*

and this is easy to code:

*pderiv(g) = h where gp = succ g; k = 1 sby k+1; h = gp*k; end;*

Integration is even simpler, the integral of

p*0 + p1x + p2x^2 + p3x^3 + …*

is

*c + p0x + p1x^2/2 + p2x^3/3 + …*

(c is the constant of integration.)

The code is

*pinteg(c,s) = d where i = 1 sby i+1; d = c sby s/i; end;*

Simple enough … but now let’s think about the power series corresponding to the exponential function e^x. This function is its own derivative and therefore also its own integral. More precisely, e^x is one plus the integral of e^x. In code, we get

*ex = pinteg(1,ex)*

and this works! Even though it’s recursive, we get all the coefficients:

1.00000 1.00000 0.50000 0.16667 0.04167 0.00833 0.00139 0.00020 …

Let’s compute e! By evaluating ex at x=1. Evaluating doesn’t always work but sometimes we can get approximations. The code

*peval(p,a) = v where v = init p +(0 sby a * peval(succ p, a)); end;*

gives us the sequence of partial sums, which sometimes converges. Sure enough, *peval(ex,1)* yields

1.00000 2.00000 2.50000 2.66667 2.70833 2.71667 2.71806 2.71825 2.71828 …

In the same way, sin(x) and cos(x) are each others derivatives/integrals and the pyLucid code

*sinx = pinteg(0,cosx)cosx = pinteg(1,sinx)*

works. For example, the coefficients of *sinx* are

0.00000 1.00000 0.00000 -0.16667 0.00000 0.00833 0.00000 -0.00020 …

Now for the fireworks! Arctan(x) is really interesting and its derivative is 1/(1+x^2). We can integrate this in code:

*x2 = 0 sby 0 sby 1 sby 0; one = 1 sby 0; atanx = pinteg(0,pdiv(one,one+x2));*

This does the job, giving the coefficients of arctan(x) as

0.00000 1.00000 0.00000 -0.33333 0.00000 0.20000 0.00000 -0.14286 …

Now it so happens that the arctan of 1/2 plus the arctan of 1/3 is pi/4. So the expression

*4*(peval(atanx,1/2)+peval(atanx,1/3))*

is what we want, and sure enough we get

0.00000 3.33333 3.33333 3.11728 3.11728 3.14558 3.14558 3.14085 3.14085 3.14174 3.14174 3.14156 3.14156 3.14160 3.14160 3.14159 …

The amazing thing about all this is that pi emerges from a relatively simple program (given in full below) in which only small integers appear.

Enough fun for now. I’ll leave you with the complete program and a promise to tell you more about the interpreter and to make it publicly available.

4*(peval(atanx,1/2)+peval(atanx,1/3))

where

x2 = 0 sby 0 sby 1 sby 0;

atanx = pinteg(0,pdiv(one,one+x2));

one = 1 sby 0;

peval(p,a) = v where v = init p +(0 sby a * peval(succ p, a)); end; pdiv(q,w) = t where q0 = init q; w0 = init w; r = q0/w0; v = succ(q - r*w); t = r sby pdiv(v,w); end; pinteg(c,s) = d where i = 1 sby i+1; d = c sby s/i; end; columns = 16; rows = 1; numformat = '%7.5f';

end

(Sorry this is the best I can do with the persnickety editor which even screws up a simple paste. Land o’ Goshen)

In this model there is a first or initial time point, and every time point has a unique successor. Imperative iterations normally terminate, so we should have only finitely many time points. Lucid avoids the complications of finite time domains by making everything at least notionally infinite, so that the domain of time points is the natural numbers with the usual order.

In temporal logic logicians have studied a huge variety of time domains. What do they mean in terms of iteration and how do we write iterative programs over nonstandard time domains?

One simple generalization is to drop the requirement that there be an initial time point and specify instead that every time point also has a unique predecessor. This gives us the integers as the time domain. We won’t get into philosophical problems about infinite negative time and iterations that have formally been going on forever.

We can adapt Lucid to this notion of time by making our streams have the integers as their domain. For primitives we can retain the usual **first**, **next**, and **fby***. *It’s obvious how the first two work. And that **next** has a dual **prev.** But **fby** needs some thought. We soon see that *X ***fby*** Y *must be the standard part of *Y* shifted right preceded by the 0 point of *X * preceded by the nonstandard part of *X*. In other words

*… x _{-2}, x_{-1}, x_{0}, y_{0}, y_{1}, y_{2}, …*

with *x _{0}* at the zero point.

After playing around a bit we discover we need another operator that works like **fby** except that it puts *y _{0}* at the zero point. Since it’s sort of a backwards

*1, 1, 2, 3, 5, 8, 11, …*

Then

*1* **ybf*** (0*** ybf prev prev*** Fib + ***prev*** Fib)*

This definition goes two steps into the past to define the current value of *Fib* in terms of the two previous values. We can also go only one step by writing

*Fib = 0 ***ybf*** (1 ***fby prev ***Fib + Fib)*

and here we’re defining the next value of *Fib* in terms of the current and previous values.

Either of these is preferable to the confusing

*Fib = 1* **fby*** 1* **fby*** Fib +* **next*** Fib*

which is correct but hard to grasp because it defines **next next** *Fib* in terms of **next** *Fib* and the current *Fib.*

What would this mean for imperative programming? What would a **while** loop look like that has pre-initialization? Let alone one that has already been going on, forever? No idea.

What if we want to define a stream by two recurrence relations, one forward and one reverse? The simplest example is a counter, given in standard Lucid as

*I = 0* **fby*** I+1*

This clearly gives the wrong answer in the new interpretation; I is

*… 0, 0, 0, 0, 1, 2, 3, 4, …*

So let’s define the left hand part by

*J = J-1* **ybf*** 0*

and this defines *J* as

*… -3, -2, -1, 0, 0, 0, 0, …*

then we can put them together as *J* **fby*** I* giving

*… -3, -2, -1, 0, 1, 2, 3, …*

Interestingly, *J* **ybf*** I* gives the same result.

But this is all pretty clumsy. Can we do better? Yes, it turns out

*K = K-1* **ybf*** (0* **fby*** K+1)*

does the job. What if we parenthesize it the other way? What if

*K = (K-1* **ybf*** 0)* **fby*** K+1*

It turns out we get the same result. This is not a coincidence. There is a general rule that

*A* **ybf*** (M* **fby*** B) = (A* **ybf*** M)* **f****b****y** B

for any *A, B,* and *M*. Both expressions denote the generalized stream

*… a _{-3}, a_{-2}, a_{-1}, a_{0}, m_{0}, b_{0}, b_{1}, b_{2}, b_{3}, …*

This is a very pleasing identity (trivial to verify) and justifies us omitting parentheses in definitions such as

*K = K-1* **ybf*** 0* **fby*** K+1*

which combines two recurrence relations, one backwards, one forward.

Now let’s do an example involving both space and time. Obviously we’ll allow negative space coordinates. Instead of thinking up new names for the operators we’ll simply add .s to the time operators, e.g. **prev.s**.

The example is a simple minded numerical analysis treatment of heat flow. We have an infinite (in both directions) iron bar at temperature 1 in the middle tapering off linearly to 0. First we define a distribution that goes negative then min it with 0 to get the desired initial heat distribution Q:

*P = P-0.01* **ybf.s*** 1* **fby.s*** P-0.01*

*Q =***min***(P,0)*

Now we define an iteration in which (I know this is simple minded) H starts with Q and at each step each value of H is replaced by the average of the neighboring values.

*H = Q* **fby (prev.s*** H +* **next.s*** H)/2*

Imagine the headache it would be to do this with only nonnegative indices. We’d have to shift it all over, calculate how much shift, etc.

What about conventional imperative languages – do they have arrays with negative indices? Apparently not … I don’t know of any and neither do knowledgeable friends. Of course in Python (for example) you can write *A*[-3] but this is just for counting from the end of the array. Odd that.

Next post: branching time.

]]>

*2, 3, 5, 7, 9, eod, eod, eod, …*

The input and output conventions are adjusted to interpret *eod* as termination. If the above stream is the output, the implementation will ‘print’ the first five values and terminate normally. If a user inputs the first five values, then terminates the input stream, this is not treated as an error. Instead, the ‘missing’ values are evaluated to *eod* if requested.

What makes it interesting is that when a (strict) data operation is evaluated, if any (or all) of the operands are *eod*, the result is *eod.* (Non strict operations like *if-then-else-fi* need special rules). Thus termination propagates through expressions, which is almost always what you want. A continuously running filter which computes, say, a running average of its input will terminate normally if its input is terminated. There is no need to repeatedly test for end of input.

Furthermore, *eod* allows us to write expressions and filters for problems that require constructs like *while* or *for*.

A simple example is the *last* filter. Suppose we define S

*S = 0 fby S+I*

to be a running sum of the stream I. Let’s say I is finite and we want the sum of its elements. Obviously, this is the last value of S; so we write

*Sum = last S*

And how is last defined? Easy

*last X = X asa iseod next X*

Here *iseod* is a special operator that can examine *eod* without being turned to *eod*. It returns true if its argument is *eod*, false otherwise.

I was browsing Hacker News the other day and learned about the “rainfall problem”, a coding exercise used as a solve-at-the-whiteboard interview question. You have a series (finite, of course) of numbers and you must calculate the average of the positive numbers that appear before the sentinel value -999. Let’s solve it in Lucid with *eod*.

The first step is to remove the ad hoc sentinel value and replace is with *eod*. Let *R* be the original data stream; we define *T*, the finite stream of temperatures, as

*T = R until R eq -999*

Here *X until* P is like the stream *X* except that once *P is* true, the output is *eod*. The operator *until* (which normally would be built in) has a simple definition:

*X until P = if sofar not P then X else eod fi*

where *sofar Q* is true at a timepoint iff *Q* has been true up to then. We can define *sofar* as

*sofar Q = R where R = true fby R and Q end*

Now that we have the temperatures as a proper finite stream we can define the stream *P* of the positive temperatures as

*P = T whenever T>0*

(For this to work our implementation of *whenever* must handle *eod* correctly. This will be the case, for example, if we base it on the recursive definition

*X whenever P = if first P then first X fby (next X whenever next P)*

* else next X whenever next P fi*

which gives sensible results if *X* and/or *P *are finite.)

Finally we define the stream *A* of averages as

*A = S/N where S = first P fby S+next P; N = 1 fby N+1 end*

and the number we want is the last one

*answer = last A fby eod*

Note that if we count *until*, *sofar*, and *last* as being built-in, we don’t use *iseod*.

What happens when there is more than the time dimension? What do we do? If there is also a space dimension then we can add another special value, *eos* (end of space). The value *eos* propagates like *eod* when combined with ordinary data. And we add an extra rule: when *eos* combines with *eod* the result is *eod*; *eod* trumps *eos*. With this arrangement we have a simple output convention. If *X* is the 2D stream being output, we evaluate *X* at timepoint 0 and at successive spacepoints till we encounter *eos*. Then we move to the next line, increase the timepoint to 1, and output successive spacepoints till we again encounter *eos*. We then increase the timepoint to 2, output successive spacepoints etc.

If at any stage we encounter *eod*, we terminate normally. We could call this the ‘typewriter’ output convention. There is a corresponding input convention that requires an end-of-line input as well as an end-of-data input.

And what about three dimensions? For example, video in which frames vary in the time dimension and a frame varies in a horizontal (*h*) dimension and a vertical (*v*). We can generalize the typewriter convention using *eoh* (end of horizontal), *eof* (end of frame), and *eod*.

What’s the general situation, when there’s lots of dimensions? W. Du suggested a family of special objects, indexed by a *set* of dimensions. If *eod(S1)* and *eod(S2) *are the objects corresponding to the sets *S1* and *S2* of dimensions, then the result of combining them (say, adding them) is *eod(S1∪S2)*. Thus the bigger the index set, the more overpowering is the object. The value *eos* is revealed to be *eod({s})* and what we call simply eod is *eod({s,t})*. In the video context, *eoh* is *eod({h})*, *eof* is *eod({h,v})* and *eod* is *eod({h,v,t})*.

EOD

]]>

“But wait!” I hear you say. “It’s nice to write elegant equations defining the infinite array of all primes but what about the everyday working world? What about the array of midterm marks of my class? It’s finite! How do you work with that in Lucid2D?”

Not obvious. You can create an infinite array whose first elements are the midterm marks followed by infinitely many -99 values. Then set a variable N equal to the number of valid marks and (say) average the first N values of the array. But in what form to you read it in in the first place? We need a general input protocol that, obviously, doesn’t give -99 a special status.

This becomes more pressing if we’re inputting a finite number of finite arrays. In which case we need a whole stream of N’s.

As I mentioned when we first tried to “add arrays” to Lucid we tried to find a simple algebra of finite vectors, matrices, etc but never succeeded. The algebra would be specially complex if you want ‘ragged’ arrays in which rows have different lengths (as mentioned above). It turned out that infinite arrays are mathematically simpler than finite ones.

Still, a language that can’t easily average a finite list of midterm grades is not much use. Eventually, we came up with a better solution.

The idea is to introduce a special value that works like -99 above but isn’t an actual number. The new object is *eod,* which stands for “end of data”. The object *eod* is not a number, (or a string or a boolean etc). It’s the value of a stream that has terminated. I think of it as the value read in (in UNIX) after you hit control-D.

The input convention is clear. A finite stream gets entered as an infinite one padded with *eod’s*. The output convention is also simple. When outputting a stream X, you (as usual) demand the values of X in order and output them. When the value returned is *eod*, you don’t produce anything, rather you terminate normally.

Lucid is based on an algebra: a set of values together with a set of operations on these values. If you extend the set of values, you have to extend the operations and say how they work if any of the operands are the new values.

Fortunately that’s simple for *eod*. The basic rule is that any data operation (like “+”) that is strict (needs all its arguments) returns *eod* if *any* of its arguments are *eod*. In other words

*eod+1 = 4+eod = eod+eod = eod*

For an operation like *if-then-els*e that doesn’t need all its arguments, the first argument needed is sensitive on its own to *eod*:

*if eod then 3 else 4 fi = eod*

Otherwise it simply chooses between alternatives as usual:

*if true then 3 else eod fi = 3*

*if false then 3 else eod fi = eod*

*if false then eod else eod fi = eod*

Similarly

*false and eod = false*

*true and eod = eod*

*eod and eod = eod*

As for the space and time Lucid operations, they aren’t affected. For example, the value of *next X* at time *t* is still the value of *X* at time* t+1* – whether or not this value is *eod*. So if we’ve written an eductive interpreter, the only part that needs changing is the part that evaluates data operations.

For strict operations, the rule (above) is simple. For* if-then-else-fi* we first evaluate the test; if it is *eod*, we return *eod*. Otherwise we evaluate and return the chosen alternative. Similarly, to evaluate an *and* expression we evaluate the first operand and return *eod* if that value is *eod*. Otherwise, we evaluate the second operand and return this value.

To conclude let’s consider the midterm grades problem. Suppose that we input the stream (a stream, rather than an array) of grades as G, padded with *eod’s* as above. Let’s say G is

*56, 79, 66, 85, eod, eod, eod, …*

(it’s a small class).

First we define a running sum

*S = first G fby S + next G*

so that S is

*56, 135, 201, 286, eod, eod, eod, …*

Notice that S is also ‘really’ a finite stream of the same length. Yet its definition doesn’t take finiteness into account. When the next value of S is computed by increasing it by the next value of G, and this next value is *eod*, the resulting value of S is also *eod*.

Now we define a counter and form the running average A:

*N = 1 fby N+1*

*A = S/N*

so that A is

*56, 67.5, 67, 71.5, eod, eod, eod, …*

(because *eod/5* etc is *eod*).

All we need is the last value of A; the value when the next value is *eod*. At the moment we can’t do this because we can’t test for *eod*. The comparison *X eq eod* returns *eod*, because *eq* is a strict data operation.

We need a primitive that can gaze on *eod* without being turned to *eod*. We call it *iseod* and *iseod X* returns *true* if X is *eod*, *false* otherwise. Then we can define *last* as

*last(X) = X asa iseod next X*

and what we want is *last(A)*. However that’s all we want, so if we ask for

*last(A) fby eod*

we get one number and a normal termination, as desired. More eloquently, if

*just(Y) = first Y fby eod*

our output is* just(last(A))*.

There’s more interesting operators like *last* that can be defined with *eod* and *iseod*. Also, what about intensions that are finite in space as well as time? I’ll talk about these next time.

Finally, you know how this post has to end.

*eod*

]]>