## Monday, July 24, 2006

### Polish Notation

The new Philosophers' Carnival is up at "the boundaries of language." One of the posts is a post at LogBlog on the rules for dot notation (such as one finds in, e.g., the Principia Mathematica). A commenter (the same person who is rising great little posts here and here on the term logic of Englebretsen and Sommers; I am not inclined to say that Englebretsen, in particular, is not quite so arbitrary as the posts suggest, but part of the problem is that most of the work is scattered work-in-progress sort of stuff, and still needs clarification at times. For instance, the subscript notation is actually just a matter of convenience. It's clear from Englebretsen's summarized presentation in Bare Facts and Naked Truths, for instance, that their chief purpose is to help us keep the terms straight. They don't affect the syntax -- except to the extent that the meaning of the terms does. For instance, +C12 would differ from +C21 solely in that one is active voice, 1 C's 2, and the other is passive voice, 1 is C'd by 2. In that sense, they can be arbitrary, as long as you are consistent in using them; they are supposed to be due to the meaning of the term, and don't contribute anything to the form of the sentence except a way to avoid equivocation in handling things like voice.) -- A commenter, I say, in case you have forgotten the beginning of this sentence, which is easy enough to do given the massive parenthetical comment plunked down into the middle of it like a sore thumb -- A commenter, I say, suggested that it was less confusing than Polish notation. It is, of course, true that Polish notation is confusing; but it is also lovely. So I thought I'd say something about Polish notation, since I haven't at all. Since, as I insist once more, Polish notation is lovely, this is a serious omission.

Polish notation is a prefix notation for invented by the great Łukasiewicz in order to simplify propositional logic (it was expanded from there and later standardized). That is, it stacks all the operators on the prefix side. To see how this works, we need to introduce the standard operators. They are the same as you would get in any sort of propositional logic course, just in different notation:

Nx is (¬x)
Kxy is (x ∧ y)
Axy is (x ∨ y)
Cxy is (x → y)
Exy is (x ↔ y)
Dxy is (x | y), i.e., the Sheffer stroke
Mx is (◊x)
Lx is (x)
∑x is (∃x)
∏x is (∀x)

The real difference you have to see in action. For instance, take the following sentence:

(p → q) ↔ (¬q → ¬p)

In Polish notation we get rid of those ugly crutches, the parenthesis:

ECpqCNqNp

If you wanted to, of course, you could break it up:

E(C[pq] C[NqNp])

But then we've brought back those ugly parentheses. Without the parentheses, you just reason it out. E has to have two variables. Cpq has to be all together, because it's an implication; CNqNp has to go together, because it's an implication. Not only does it eliminate the need for parentheses, it allows you to see the order of operations in a clear and straightforward way. Of course, it can get confusing, because we don't teach people to pay attention to the order of operations, in part because the notation we're all taught is useful precisely in the fact that you can ignore the order of operations, because it's usually already organized according to order of operation. Let's take another:

CKAprKCpNqCrsANqs

Of course, this looks like gobbledygook at first. But that's because if we are beginners trying to read it, we want to read it forwards, when we really (as beginners) should read it backwards. So, starting from the right, we take the first chunk falling under the scope of an operator that takes more than one element (in this case, ANqs). So we have (not-q or s). Then we do the same for next (Crs) to get (r implies s). Then on to the next (CpNq) to get (p implies not-q). The next operator is K; it takes two elements, and so it takes the previous two chunks we found (KCpNqCrs). From it we get ((p implies not-q) and (r implies s)). The next chunk (Apr) gets us (p or r). The next operator, K, takes two elements again, namely, KAprKCpNqCrs; from it we get, ((p or r) and ((p implies not-q) and (r implies s))). The next operator is C; its scope is the whole thing, so we use it to put all our chunks together, and get the result (in Peano-Russell notation, and assuming I haven't made some stupid mistake somewhere):

((p ∨ r) ∧ ((p → ¬q) ∧ (r → s))) → (¬q ∨ s)

Which is not really any less confusing than the Polish original. Unless you're used to Peano-Russell notation, keeping track of all the groupings is not any simpler when they are put this way than when they are put the other way. The one and only advantage Peano-Russell notation has over Polish notation is that all the operators look clearly different.* In Polish notation, of course, they are all letters of the alphabet, so you have to get used to how they work, and that takes more doing than in Peano-Russell. After a while you get used to things: taking the whole sentence in, you see that the first C has to be relating KAprKCpNqCrs to ANqs, and the first K has to be relating Apr to KCpNqCrs, and the second K has to be relating CpNq to Crs. But it takes a bit of practice. When I took an undergraduate logic course, I was often a bit bored, and had come across Polish notation; so I spent time translating all the Peano-Russell sentences into Polish sentences and back again. I still do it occasionally when I'm bored and have a logic text handy. But I find even now that I always have to reason the first few through before I start seeing the relations among the elements. (Also, sometimes I forget which is K and which is C, so whenever I start using Polish notation I have to begin by warning myself sternly not confuse conjunction and implication merely because conjunction starts with C, which is the operator for implication.) But it's all quite lovely and economical. And I wish, actually, that undergraduate logic courses taught it first. Logically it works just like P-R notation; but it forces beginners to think through what goes with what. And everyone who starts with Polish can easily pick up P-R, because they can easily see that it involves the same logical pattern of operators, whereas almost nobody who starts with P-R ever gets the hang of Polish, because they don't learn to see the logical pattern of operators, just the groupings. That's why people trained in Peano-Russell have difficulty reading Polish notation, despite the fact that the two are merely different notations portraying exactly the same logical operations: they aren't seeing the logical operations at all.**

* Well, strictly speaking I suppose you could also say that anyone who has taken algebra is used to organizing sentences this way; but I'm inclined to think this less important than it is usually thought. We're used to working with fractions, too; but we rarely use fractional notations, and find them confusing when we do. And so on with other mathematics-based notations.
** And there are other advantages, too. For instance, I think truth tables and truth trees can be made much, much more perspicacious for undergrads by using Polish notation. In part this is because you can write Polish notation horizontally, vertically, or in stepwise fashion, as you deem fit. So you can use the diagrammatic arrangement most convenient for what you are doing.