Category Archives: Good Math

Why am I doing this Pi-Calculus Language Thing?

Since my post on datatypes for my π-calculus language, I’ve gotten a bunch of questions from people who (I guess) picked up on the series after the original post where I said that the idea of the series was to see if I could create a programming language based on it. The questions are all variations on “Why design another programming language? Do you really think anyone will ever use it?”

Continue reading

True Pathology: A Multilingual Quine

While browser over at programming.reddit.com, I came across something simultaneously hideous and amazing.

I’ve showed quines before as part of the pathological programming posts: a quine is a program which, when run, generates itself as an output. I’ve even written about a programming language where the only way to create a loop is through quining the program.

But I’ve never seen anything like this before. It’s a multilingual quine: the program below is not just a quine, but it’s simultaneously a quite in three different languages: OCaml, Haskell, and Scheme. I have no idea how the author managed to figure out how to do this; and I probably don’t want to. 🙂

Continue reading

From Beautiful to Twisted in One Syntactic Step: False

Today’s friday programming language insanity is a tad different. I’m going to look at another twisted stack-based language. I’ve got a peculiar fondness for these buggers, because back in the day, I was a serious Forth addict. One of the ideas that’s actually come up in serious programming languages in the last few years is creating a sort of cross between functional languages and stack-based languages, producing what are known as concatenative languages. An excellent example of an extremely powerful and useful member of this family is called Factor, by Slava Pestov.

But serious useful languages aren’t the realm of my regular friday pathology. So I’m going to tell you about a not-really-serious version of a concatenative language, called False. Semantically, False is actually not a horrible language. In fact, if it weren’t for the bogglingly awful syntax, it’s something I could imagine using for tiny file-filtering utilities. But the syntax is designed to be truly horrible, and when you blend the natural potential for confusion that you get from doing everything backwards on a stack with a syntax that looks like line-noise, you get something that can really sprain your brain.

Continue reading

Sign Expansions of Infinity

Finally, as I promised a while ago, it’s time to look at the sign-expanded forms of infinites in the surreal numbers. Once you’ve gotten past the normal forms of surreal numbers, it’s pretty easy to translate them to sign-expanded form.

Continue reading

Process Equivalence in π-calculus

Before moving on, there’s one question that I thought was important enough to promote up to the front page, instead of just answering it in the comments. A commenter asked about process replication, !P, wanting to know if it terminates.

The answer comes in two parts.

  • !P does process creation on demand. It’s not an infinite parallel group of processes; it’s just a way of writing that there are as many of P as you need. So you can think of it like tape cells in a Turing machine: we never say that a Turing machine tape is infinitely long; but there’s always enough cells. !P isn’t an infinite replication of P; it’s a notation for “enough copies of P”. So when you’re done using replicas of P, you can think of !P disappearing.
  • Often in π-calculus, we actually don’t worry about termination of every process. You can think of it in terms of garbage collection: we’re running some group of processes to perform a computation. When they’re done, they terminate. Any process which has no ports that are reachable by any other active process can simply be collected.

The next place to go in our exploration of π-calculus is considering just what it really means for two processes to be equivalent. The fundamental equivalence relation in
π-calculus is called bisimulation. The idea of bisimulation is roughly a kind of observational equivalence: two processes are equivalent under bisimulation if they exhibit the same visible behavior under all tests by an external observer.

Continue reading

"Flip" Out with a Pathological Programming Language

As promised, this week, I’ve got a new friday pathological programming language. This one is another 2-dimensional language, but it’s pretty different from any of the 2d languages I’m written about before. It’s called “Flip“, and the warped minds behind describe it as being sort of like “Programmers Billiards”. It’s a seriously neat language, but it is pretty large and complicated. So I’m not going to describe everything about it in detail: you’ll have to read the language manual for that. But I’ll describe enough to give you the flavor of it, and show you a couple of examples to whet your appetite.

Continue reading

Numbers Using Processes and Messages: Part 1, Addition

Given a calculus, one of the things that I always want to see is how it can do
some kind of meaningful computation. The easiest way to do that is to start building numbers and basic arithmetic.

Continue reading

The π-Calculus Storage Cell

As I did with my first attempt at explaining π-calculus, I think that before getting into any of the deep semantics, it’s good to look at a few examples of things you can build with π-calculus. But before getting to the meat of the post, I’ll give you the answer the puzzle I left in the last post. What’s wrong with the example I gave for “Hello world” yesterday?

As a reminder, the question was: Assume “out” is the name for a channel that is read by a process that prints whatever it receives to the standard output. What’s wrong with the following process as an implementation of “Hello World”?

new(in).{ *(?in(x).!out(x).∅)
| !in(hello).!in(world).∅ }

Continue reading

Basics: Innumeracy

I’ve used the term innumeracy fairly often on this blog, and I’ve had a few people write to ask me what it means. It’s also, I think, a very important idea.

Innumeracy is math what illiteracy is to reading. It’s the fundamental lack of ability to understand or use numbers or math. And like illiteracy, true innumeracy is relatively rare, but there are huge numbers of people who, while having some minimal understanding of number and arithmetic, are functionally innumerate: they are not capable of anything but the most trivial arithmetic; and how anything more complicated than simple basic arithmetic actually works is a total mystery to them.

Continue reading

Back to π-Calculus: a better introduction

Now that things are settling down a little bit, I wanted to get back to the stuff I was writing about π-calculus. But looking back at what I’ve already written, I think I did a terrible job of introducing it. So I’m going to start over, and try to be more clear.

I’ll start with a basic refresher of what π-calculus is for, and a bit of history for where it came from.

Continue reading