Wednesday, November 19, 2014

Politicians lie in cast iron sinks

Back in 1979 I had just joined Kienzle Data Systems as a programmer, and had been bundled off to their German headquarters at Villingen in the Black Forest to learn their assembler*. Here's a picture I took.

Villingen in the winter of 1979/80

Yes, it was very cold that year. Twenty below, the kind of cold which hurts your ears and bites your nose. In the evenings I curled up in my hotel room and read Douglas Hofstadter's new Pulitzer Prize-winning book, 'Gödel, Escher, Bach', which in my circles was the publishing event of the year, the decade or maybe even the century. Here's what Amazon has to say.
'What is a self, and how can a self come out of inaminate matter?' This is the riddle that drove Hofstadter to write this extraordinary book. Linking together the music of J.S. Bach, the graphic art of Escher and the mathematical theorems of Gödel, as well as ideas drawn from logic, biology, psychology, physics and linguistics, Douglas Hofstadter illuminates one of the greatest mysteries of modern science: the nature of human thought processes.
The book is astonishingly profound and well-written - if overlong - and is on the syllabus of many university computer science courses. Strangely, what  I particularly remember relates to the title of this post.

Hofstadter is introducing us, in his gentle way, to the propositional calculus. He is going to take us all the way to Gödel's great Incompleteness Theorems but first he has to teach us about logical connectives (such as AND and OR).

In logic if we have 'Dorsai are tough' together with 'Exotics are wise', both taken to be true, then we may validly deduce: 'Dorsai are tough AND Exotics are wise'. Sounds trivial, but that's how computers work. You will observe that this is really definitional of 'and'. Hofstadter playfully introduces us to this idea by using a preposition which is not in fact a logical connective - 'in'. So, he says, we can all agree that:
'Politicians lie'
(little has changed over the years), and
'cast iron sinks'.
But would we want to conclude that:
'Politicians lie in cast iron sinks'?
Cue big smiles, but you see what he did there? Changed a verb into a noun? There's playfulness, there's trickery and there's outright cheating!

Didn't forget it though.

--

* An incredibly geeky aside. We initially thought that the Kienzle assembly language directly spoke to their CPU chip. But then we learned that the microprocessor was in fact Intel, and that the Kienzle systems guys had 'microcoded' their own assembly language via an interpreter written in Intel assembler. No doubt they had their reasons - yet another layer of indirection, how traditional - but we felt, somehow, .. emasculated!

---

Continuing on this theme, soon afterwards I was asked whether I could modify some of the systems utilities: I recall they wanted some changes in the 'disk copy' program. Utilities were, of courser, written by the German systems programmers and we had only the binary, and no documentation.

I knew the answer: write a disassembler. Given the simplicity of the Kienzle assembly language this was a relatively trivial problem. The most difficult part was just finding where the end of a program actually was, as there was no 'terminating' code. Program-end was usually indicated by a long subsequent string of binary zeroes.

So I succeeded in disassembling the German copy utility, making the required changes and then re-assembling it. The management were happy. I was so impressed with myself that I decided that every floppy disk should have a copy of my disassembler on it, for the world's convenience. I therefore added some code that checked any mounted disk for a copy of my program and, if it didn't find one, wrote my disassembler out onto the said floppy.

Yes, I had written my first virus!