Advent of Computing - Episode 146 - The Z4
Episode Date: November 25, 2024The Z4, completed by Konrad Zuse in 1945, is a computer with a wild story. It was made from scrounged parts, survived years of bombing raids, moved all around Berlin, and eventually took refuge in bas...ements and stables. In this episode we will follow the Z4's early days, and look at how it fits into the larger picture of Zuse's work. Along the way there is looting, rumors, and even... IBM! Selected Sources: The Computer, My Life - Konrad Zuse's autobiography https://web.archive.org/web/20090220012346/http://delivery.acm.org/10.1145/370000/361515/p678-bauer.pdf?key1=361515&key2=3342588511&coll=&dl=acm&CFID=15151515&CFTOKEN=6184618Â - Plankalkul, F.L. Bauer and H. Wossner https://ieeexplore.ieee.org/document/9787324 - Architecture of the Z4, Rojas
Transcript
Discussion (0)
In 1945, a frightening rumor started to spread in the town of Hinterstein.
The town itself was usually pretty sleepy, just a tiny thing perched near the Alps in
the far south of Bavaria.
But as the war had reached its conclusion, the town was swelling in size.
Refugees from all over Germany had been retreating from the cities and flooding the countryside. The long-time residents must have looked at all these newcomers with at least a little suspicion.
It wasn't until just after the end of the war that the rumor really started,
that a secret Nazi superweapon had been smuggled into this tiny little town.
That weapon even had a name, the V-4. A terrible vengeance weapon, perhaps even
made in the same factories as the deadly V-2 rocket. This wasn't just idle gossip, the
rumor had some legs to it.
Mere days before Germany surrendered, a beat-up Wehrmacht truck rolled into town. It was carrying
something heavy in a trailer. Its drivers weren't soldiers, but a troop of scientists?
Maybe engineers?
At least, they weren't carrying weapons and they weren't in uniform.
Someone in town remembers hearing them argue with a unit of SS troops.
They heard one of these strangers say something about secret weapons facilities in Göttingen, and something
about a flight from Berlin with another group of scientists.
The strangers even unloaded the... thing.
Once off the trucks, it was stashed in a basement, far out of view of normal eyes.
Townsfolk had tried to ask the strangers about what they were protecting, but the answers
they got made no sense.
They were told it was some kind of Reckenmachinen, a word that the townspeople had never even
heard before.
Maybe there was truth to the rumor.
Maybe a gaggle of scientists really had hidden a bomb in this sleepy little village. Welcome back to Advent of Computing.
I'm your host, Sean Haas, and this is episode 146, The Z4.
This episode is a continuation of the last one, which covered Conrad Seuss's early machines. In that episode,
we worked our way through the Z1, Z2, and Z3 computers. That's with a few quotes around
that word. We ended up with the Z3, a machine that is almost a general purpose computer,
but isn't Turing complete. It's missing conditional execution, but in all other forms, it's basically
a computer. This time, we're going to be looking at the Z4, the last computer that Zeus built
during World War II. It's also supposed to be Turing complete. Why does that matter?
Is it true at all? Well, that's what we'll be trying to figure out today We'll also be looking at one other part of Zeus's work plan Calcule
That is his programming language plan Calcule has been called the first
Programming language or at least the first high-level language
But as with all things Zeus that claim on its face can be hard to believe
Last time we painted this picture of a man working in isolation from the outside world, Zeus
developed his first machine, the Z1, with no knowledge of prior digital arts.
That's partly because there were, well, almost no prior arts to work off of. As
World War II sets in and Zeus develops more and more complex machines, he stays in
this isolated bubble.
New projects spring up around the world.
The digital revolution is just about to begin.
But due to the circumstances of the war, Zeus remains isolated from developments outside
of Germany.
Thus, his work is fairly unique.
He also has to contend with this touch and go relationship
with the Third Reich.
His work is funded, but not essential to the war effort.
That put Zeus in a situation
where he had to scrounge for parts from,
in some cases, pretty dubious sources.
This gets worse as the war goes on. The Z4 is completed in 1945,
which perhaps makes it all the more impressive. So let's dive back into Zeus's workshop.
This time I can certainly promise some very wild twists and turns along the way.
It's hard to figure out exactly why the Z4 was built.
I know that might sound stupid on its face, but let me explain.
I said last episode that it seems from Zeus' autobiography that he was simply bit by the
computing bug.
He had developed this vision of a digital future and worked tirelessly towards it.
So of course after the Z3, he should construct another machine.
The march must go on.
I've also seen it speculated that the Z4 was actually a commissioned computer.
Now this gets into the fun complication of how Zeus avoided the draft.
Back in 1940, Zeus had established this company
called Zeus Apartibale in order to build and eventually sell computers. But once again,
this computer work was not deemed essential to the war effort. This mattered for rationing
but also for draft exemptions.
Men who worked in jobs essential to the war effort could apply for an exemption from active duty service.
Without an exemption, Zeus could be sent to the meat grinder.
He could be sent to the front.
So he couldn't just work on these newfangled computer things.
Luckily he did have a day job.
It was at Hinchel and Sons,
a weapon and aircraft manufacturer.
There, he worked as an engineer designing
and building missiles.
That job was good enough for Zeus to get his exemption.
The issue here was that Zeus had to keep up that connection
in some capacity to remain exempt from service.
Exemptions were a tenuous thing.
There was a point where Zeus was almost sent to the front when he was between employment
contracts at Hinshull.
He was technically a contractor, I think, so he had these overlapping terms on his contract.
There's a little space between them.
That was enough that he was drafted and thrown on a train.
He was actually moving towards the front line when his contract came back into effect.
He was quite literally snatched from the jaws of fate.
At first, Zeus worked for Henschel full-time and ran his computing company as a moonlight
kind of gig.
During the construction of the Z3, he moved to
part-time at Henschel. Zeus's autobiography is a little jumbled about
the period. I think he may have been working less than part-time perhaps. I'm
not entirely sure because his work with Henschel starts to bleed together with
his computer work. He was able to get some Henschel employees to help out with
manufacturing components for machines. He constructed able to get some Hinchel employees to help out with manufacturing components for
machines. He constructed at least one special purpose machine for Hinchel, which I think
may or may not have been done as a contract through Zeus's own company.
Suffice to say, the Z4 might very well have been built to fulfill a contract for Hinchel.
Operations were so interconnected, and wheeling and dealing
was so prevalent that it's kind of difficult to say. This is just how a lot of folk had
to operate to survive in the Third Reich. There's also the matter of funding here. We
discussed the funding structure of Zeus' work last episode, but we have an abbreviation
so I need to bring it up again. Zeus' computer work was partly funded by DVL, the German Aeronautics Research
Institute. Of course the acronym is for the German words for that. That was the
state sponsor that Zeus was connected to and the reason his work was allowed to
proceed. DVL was part of the German government, of the Nazi state.
So at every turn,
Zeus had to be entangled with the state to continue working
and stay off the front line.
So for various intertangled and mixed up reasons,
Zeus starts constructing the Z4 in 1942.
Unlike Z2 and Z3, which were completed
pretty quickly, Z-4 wouldn't be finished until 1945. The big reason for the delay
comes down to circumstances of the time. The Allied forces first bombed Berlin
in 1940, but bombing raids in that period weren't very regular It's not until 1943 that bombing ramps up
It's during that period 43 onward that work is substantially disrupted
The Z1 Z2 and Z3 are destroyed during bombing raids in 1943
Zeus had to move his workshop multiple times in this period
Zeus had to move his workshop multiple times in this period. He had to move all his equipment, the Z4 itself, and all of the workers that were now participating
in its construction.
Bombing also disrupted his supply chain, which was, at the best of times, already tenuous.
Let's take memory as an example.
This is also one of those classic, weird decisions made by Zeus.
The Z4 used mechanical memory.
The reason here is, once again, a little mixed.
The Z1 and Z2 both used mechanical memory.
The Z3 used relays to store data.
But with the Z4, Zeus went back to his mechanical roots.
Why was that? Well, it was done in part to save space and save time.
Zeus was able to construct pretty small mechanical memory modules at this point because he was
very well practiced and was much more specialized than relay-based circuitry.
These modules were made up of tiny sheets of steel that slid past each other, moving tiny pins that represented ones and zeros.
Precision was very much the name of the game here.
The module used by Z1 and Z2 had been made by hand.
Zeus and his buddies just set up shop in his parents' apartment with coping saws and went to town.
For Z4, Zeus wanted to do one better. He convinced
a Henschel employee to manufacture dies for punching out plate steel parts to make the
memory module. That would have made for much faster, cleaner, and much more precise work.
Every part that was punched would be identical. The dyes were completed, but they were destroyed
in a bombing raid before they could ever be used. As Zeus explained, he was forced back to the
coping saw method. That took more time, and it introduced more errors in manufacturing.
A number of these roadblocks conspired to make the Z4 take years to build.
But luckily, Zeus was a scrapper, and he was surrounded by other scrappers.
It was the only way to survive in this period.
During this era, Zeus's company had something like 20 employees, plus his network of friends,
colleagues, and contacts that he had accrued over years of work. Relays were in short supply
due to rationing. When it came down to it, a relay could be used in planes and other
weapons platforms or in this weird computer thing that some dude in a Berlin basement
was building.
Where do you think the bulk ended up? Luckily, Zeus had a good working relationship with some folk who worked
at the telephone exchange in Berlin. They had plenty of relays to go around if they
pulled a few little tricks on the side. This had gotten him some parts for the Z3 and would
continue to be one supply line for the Z4. He'd get these gently used relays that weren't technically needed in the exchange,
at least not right now. Schreier, one of Zeus's constant companions and colleagues in this period,
was also able to wheel and deal his way into components.
This trick comes to us from the recollections of one Martin
Wolters, who worked with Schreier at the University of Berlin and had
dealings with Zeus in this period. To summarize Wolters, the trick worked like
this. During bombing raids, some Allied planes would get shot down in Nazi
airspace. Debris from those planes in various shapes and sizes would then fall
into Nazi-held territory. Schreier worked up this arrangement where the DVL would ship that debris to the University of Berlin for examination.
The official reason was something like industrial espionage.
These planes had all kinds of tech in them that the Third Reich hadn't seen before.
So it became the duty of the University of Berlin to figure out what this technology was.
The unofficial reason was that Schreier wanted to scrounge for parts. Allied planes had relays and
vacuum tubes tucked inside them. Anything that survived could be extracted, reported on, and then
disappeared into various projects. Some of those relays would make their way
into the Z4.
Then there was good old looting. This story, again, comes from Volters. To quote,
"...In spite of our supply of components and small parts, earned honestly with our
intelligence and knowledge, we needed a massive piece of bronze with high copper content.
Something like this was nowhere to be found.
The ever daring idea generating Dr. Schreier
merely commented that in general,
the street car overhead cables were made of bronze
that was a good conductor.
The cables also had the right diameter.
This was meant only as a comment, not as an invitation to plunder.
However, this could not prevent Yane and myself on watch as air raid wardens from equipping
ourselves with wire, measuring instruments, and a metal saw as soon as the all clear sounded."
It's important to point out that looting in this period was a capital offense.
Volters could have been executed for this, but he managed to pull off the operation.
Some of that conductor, at least as implied by Volters, to have been used in the Z4.
So behold this full picture. Zeus and his team are working in bombed out basements and abandoned warehouses.
They're putting together a computer with components from crashed allied planes, gently
loved telephone relays, and looted wires.
Zeus tells of missing bomb raid sirens and still being working at the Z4 as bombs were falling
and shattering windows around him.
And out of this, still emerged a working machine.
That on its own is a testament to Zeus and his crew.
What exactly was built in those Berlin basements and those bombed out warehouses?
We already discussed the memory module briefly.
It was fully mechanical. It could store 64 words of data, each 32 bits wide. We're still at this
point where memory space is so limited that stored programs aren't possible. Zeus would write about
the possibility of doing that, but it was just never a reality. As such, this is another tape-based machine.
The Z4 used the same tried-and-true punched celluloid tapes that all of Zeus's early machines read and wrote.
There was a reader for programs, one for input data, and a punch for output data. As far as instructions go, the Z4 had a
truly staggering instruction set.
As far as instructions go, the Z4 had a truly staggering instruction set. You may recall from last episode that the Z3 had a mere handful of instructions.
This new computer kept the same general design as the Z3.
It has this two-element stack that basically works like a calculator, with operations that
work off that stack.
You get load and store instructions
for moving data between memory and the stack.
But the math repertoire is much expanded.
The Z4 could perform 21 different math operations.
For an early machine, that is wild.
One of the reasons Zeus was able to fit
in so many instructions was that the Z4 was microprogrammed.
The Z3 also used microinstructions, but I chose to gloss over that a little bit.
So, what does this mean?
The theory here is a little... abstract. The idea is that the actual instructions that are exposed to the programmer are in reality
composed of many smaller steps.
The computer is set up such that it runs those smaller steps to complete a full instruction.
Each instruction, then, is stored as those micro-instructions.
This lets you easily add a new instruction by just writing out the micro-instructions. This lets you easily add a new instruction by just writing out the micro-instructions
and giving them a name, or a number in this case.
Each instruction was encoded as a set of these micro-steps on a wheel.
This isn't a euphemism, I mean a physical wheel.
Contacts and wiring inside that wheel would connect different parts of the Z4's logic
and math circuits during each step of an instruction.
That's a very sophisticated way to handle logic on a computer.
We still use microcode today, ours is just stored as actual code instead of a physical
spinning disk.
That's the good part.
Here's the bad, or maybe the weird.
The Z4 still did not support conditional execution,
at least not in a reasonable way.
This matters because conditional execution
is the final feature needed for turning completeness,
to be all that a computer can be.
If a machine is turning complete,
it can calculate anything that's calculatable.
It can do anything that any other computer can do.
You get hooked into all of this theory,
all of this practice, all of these tricks
that make your computer truly powerful.
But in 1945, as the Z4 reached completion, it just wasn't there.
Notice the very specific language I use. It couldn't do conditional execution.
That's because the Z4 did have a concept of conditionals. There were operations to
test the value of R1, the first register
of the stack. You could test if the value of R1 was negative, positive, or infinite.
The result would be stored in R1, but with kind of strange encoding. The Z4 used a minus
1 to represent false and a plus 1 to represent true. In theory, you could work up something similar to conditional execution using this.
I mean, I can think of how to do it, and I'm not all that bright when it comes to computer
science.
The idea would be to make the comparison, do some math to cast the value to either 0
or 1, and then multiply the result of whatever
you were doing by that number. That would turn any undesirable result to 0.
But that's not conditional execution. That's just a pretty standard trick used in math
equations. You can do the same trick just with a nice equation and it cancels out any terms that you don't want.
So in 1945 the Z4 was not Turing complete.
That means it wasn't the first true computer by the strictest definition.
Once we hit 45 we have the Harvard Mark I and ENIAC.
The Americans have entered the picture and they have working
conditional execution. They have Turing complete machines. But again, note the
very specific language. In 1945 the Z4 wasn't a true computer. By 1950 that
would change. But how we get to that point is another wild stage in the saga of Conrad Zeus.
Berlin fell to Allied forces in May of 1945.
Fighting would continue in the Pacific front for a number of months, but this would mark
the end of the war in Europe.
A twist of fate and a man named Funk helped save the Z4.
This is honestly one of the most bizarre stories
I've ran into while reading Zeus's truly bizarre
autobiography.
Here I'm heavily paraphrasing from that text
to keep some kind of brevity.
The story starts in 1944 as Zeus is hiring on more
workers to finish the Z4. This was tricky because of the whole draft exemption thing,
which seems to have self-selected for the kind of scrappy go-getters that made the Z4
possible in the first place. One of the folk that Zeus ended up hiring was named Dr. Hans-Jürgen Funk.
Now, if my knowledge of German, which is very hazy, is correct, I believe it's pronounced
something like Wunk or Plunk.
You'll have to excuse me if I slip into calling him Dr. Funk because that's a slight mispronunciation
that's hard to say no to.
Now, I can find little information about the doctor outside of what Zeus himself writes,
so we're just going to have to go with it.
Funk was a theoretical physicist and one of the survivor types that knew how to work the
Third Reich's administration.
He was able to, somewhat mysteriously, get exemptions
for employees. It seems he just knew how the bureaucracy worked, who to contact, what papers
to file, and what magic words you had to file on them. Zeus tells us that Funk in the summer of 1945 worked up an incantation to escape.
That incantation went like this, the V4 must be safely evacuated from Berlin.
That would set in motion a series of events that saved the Z4 and, perhaps, Zeus himself.
This all goes back to a quirk in naming convention.
Zeus had originally called his computers the V1, V2, V3, and V4. The V stands for Experimental
Model, auf Deutsch, of course. He would later retroactively change the name, swapping V for Z.
This was done because the names V1 and V2 were also used to refer to the so-called
Vengeance weapons.
The V1 was a cruise missile and the V2 was a rocket, both built explicitly to kill civilians.
But in 1945, Zeus' latest machine was still officially known as the V-4.
Technically, there was another thing called the V-4.
It was a weapon, a short-range ballistic rocket, but it was more commonly known as the Rheinbote.
V-3 was also taken for that matter by another vengeance weapon.
That was a cannon, which was commonly
known by its V name. So when a memo started going up the chain of command that said the
V4 must be evacuated from Berlin, well, that managed to fry some brains. This particular
V4 was a computer. But never mind that.
It sounds like a vengeance weapon, something that cannot be allowed to fall into allied hands.
Trucks and fuel was requisitioned.
Papers were signed allowing the staff that designed and built the V-4 to leave Berlin,
because you can't let them fall into allied hands either.
The V-4 was loaded onto pallets and sent on its way to
Göttingen. This all happened mere weeks before the fall of Berlin. It's likely the only reason why
the Z-4 survived the war. But this doesn't stop here. Once outside the city, things continued to
get strange. There still wasn't a clear home for the Z4, so for a few days it bounced around.
At one point, it was ordered to be installed in an ordinance facility.
Zeus flatly refused that order after seeing the working conditions in that factory.
This was late in the war, so it was staffed almost entirely by slaves drawn from concentration
camps.
Zeus and his crew roved through destroyed cities, blasted out roads, and the ruins of
the countryside on their flight.
They'd even spend a few days camped out in Bavaria with Werner von Braun and his team
of rocket scientists.
I must say, there is something funny about the V-4 cover leading
to a meetup with the creator of the V-2, but I digress.
Zeus eventually went to ground in Hinterstein, it's high in the mountains near the border
with Liechtenstein. The town was filled with other refugees, SS troops, and a few others
who managed to escape the cities. The Z4 itself was set up in the
basement of a farmhouse. Over the next few weeks, the Third Reich surrendered and Germany
was occupied. Refugees started to drain out of the Alpine village, leaving the locals
and a strange assortment of survivors. Zeus, his wife, his young son, and a few others would stay behind with the Z4.
This marks the beginning of a period of near-exile.
Zeus no longer had funding from the DVL, since, well, the DVL and the rest of the Third Reich
had been either dismantled or destroyed.
The Z4 was left adrift, more a curiosity in a basement than anything.
Zeus actually struggled to figure out what to do here, to pull from his autobiography,
quote, we stayed in Hinterstein and at first it was out of the question to consider continuing
with our work. Although someone did come up with the idea of generating horoscopes with the Z-4,
which perhaps could really have turned out to be a profitable business, but luckily,
we didn't know anyone who could supply the necessary formulas."
This is also when the Z-4 was renamed.
Remember, as the war ends, it was still called the V-4. Its cover was,
implicitly, that it was a weapon. Well, that kind of got around town during
the early occupational period. The rumor was that a scientist from Berlin was
hiding his V-4 thing, a giant bomb or rocket or poison gas or something underneath the town.
When Zeus got wind of this, he and his friends frantically relabeled all of their notes.
The V4 name had worked well enough, but it had just become a liability.
V became Z, and the Z4 was born just in time for French troops to come snooping. Over the next few years, Zeus worked on his art.
He helped raise his young son, and he had time to think about computing in the theoretical sense.
He had already formed some ideas about programming.
It's during this exile that those ideas would solidify.
But we'll get back to that in due time.
For now, I want to jump forward a few years.
In 1947, Zeus reestablished business as Zeus Engineering, in German of course.
This is when his years of isolation would end.
Prior to 47, Zeus had only scant rumors of computing in the outside world. He had, at one point, seen
an intelligence memo about the Harvard Mark I, but that was it. There were no real dealings
with the world outside Germany for him. That was rapidly changing. Perhaps it should be
no surprise, but the first to pounce on Zeus were IBM. The American company had actually maintained a strong presence
in Nazi Germany all throughout the war, which was in violation of numerous US and international
laws and also verged on the horrifyingly unethical. The main trick was that IBM's German branch
had restructured as a separate company. They were shell companies that were established to help funnel money back to America.
After the war, IBM reconstituted this German branch.
Once Zeus opened up shop, a few men in blue suits and a nice car came calling.
This is where a strange quirk played to Zeus's advantage.
Way back in the late 1930s, he had filed patents on a number of
technologies used in the Z1. Remember that mechanical beast? Well, those patents were general enough as
to be a little sticky for Big Blue, so IBM offered to license those patents. Apparently, they paid Zeus pretty well for that licensing fee.
Now, this leads to an interesting point. In his autobiography, Zeus seems a little upset
that his dealings with IBM ended there. He was looking for some kind of partnership,
or a research grant, or ongoing involvement. It would seem he wanted IBM to pick up the Z4
and elevate it to a grand stage, or at least pick up some of his work. Instead, he only
got very limited legal connections to IBM. Zeus makes it sound like he didn't understand
why IBM wasn't more interested in the Z4. But if we look at things from IBM's side, the reason is crystal clear.
At this point, IBM was already working on vacuum tube machines.
The SSEC, IBM's first tube machine, was already under construction.
This was a stored program computer with conditional execution, a much more capable machine than the Z4.
There's just not much of a comparison.
I don't see a world where IBM would be interested in the Z4 outside of possible patent concerns.
Remington Rand would also contract with Zeus on a few projects.
These, yet again, weren't related to his one extant computer,
but it did give Zeus and his colleagues a reason to visit the states. There they would
meet, of all people, Howard Aiken, the creator of the Harvard Mark I. It's also entirely
likely that Zeus met Grace Hopper on this visit, since she would have still been working in Eikens' lab at Harvard,
but I digress. In all of this, Zeus was still somewhat frustrated that the Z4 hadn't been
warmly received. That finally changed in 1949, when Dr. Edward Stiefel arrived at Zeus' office.
Stiefel had come from ETH, a mathematics research outfit in Zurich, looking for a computer.
To quote from Zeus, he had just returned from a study tour in the United States, where he
had seen many beautiful machines in beautiful cabinets with chromework.
The professor was more than a bit surprised to find the Z4 indeed, outwardly, a bit worse
for wear, housed in a stable.
Undaunted, he dictated a simple differential equation which I was able to program immediately,
feed into the computer and solve.
Afterwards, we signed a contract.
The Z4 would, after thorough repair and cleaning, be leased to ETH." The computer had finally found a home. After air
raids, its flight from Berlin, and years in a basement, the Z4 would be put to actual use.
But there was a caveat. Stiefel needed conditional execution. It always comes back to that pesky detail of Turing completeness,
doesn't it? Zeus fulfilled this request in kind of a wild way. So remember, the
Z4 is not a stored program computer. It does not have any code in memory. There's
no concept of an instruction pointer to move around. You have physical
tape. How, then, does one conditionally execute code? For this to make sense, we need to introduce
a few more instructions. Each program for the Z4 started with an instruction called
ST. It's short for start. That usually just tells the computer it's
time to get a move on. We're about to get going, buddy! There's a similar command
to end a program called THIN that just tells the Z4 to stop it. We're done.
A new instruction was added to support conditionals called SP. It's short for sprung, or jump if you want to take the
English. If the R1 register, which is the output for all math instructions, is set to
plus one, then the sprung instruction tells the Z4 to advance the tape until it reaches
a start instruction. This is a physical process.
The actual tape reader advances forward one instruction at a time,
clapping all the way until it sees the ST.
It ignores any instructions that come between the jump and the start.
And like that, the Z4 was made Turing complete.
Despite that, the Z4 was made Turing-complete. Using the SP instruction and a little bit of math, it was possible to control what parts
of the program were actually executed.
It's weird, it's limited, but I think it may be the only way to make conditionals really
work on a tape-based machine.
There is one more wild trick that made the Z4 more useful.
From what I've read, I think this feature is also post-45.
That is, the subroutine.
Once again, it's wild and to be clear, I'm getting all these technical details from yet
another Rojas paper.
Huge ups to Rojas.
So subroutines. As the Z4 was growing, it sprouted another tape reader specifically
for subroutine instructions. The up command transfers control from the main tape to this
secondary tape reader. That tape runs until it reaches a thin command. Then control is
transferred back to the primary tape reader.
On its own, that's not really the most useful thing in the world.
You can only use it once, since once the second tape hits thin, it's over.
That is, if you don't dream big.
Think way back to last episode when we talked about how the Z3 could technically be made
turning complete.
There were a number of tricks needed,
one of which was a physical loop. Since Zeus's machines used celluloid tape for program tape,
well, you could actually just splice it together into a closed loop. It was possible to use a
looped tape on the secondary reader with a smartly placed fin command.
That way, any time you ran an up, you ran a subroutine, it would run through the same
loop of code.
It's a repeatable subroutine, if a bit of a crude method.
The Z4 was shipped out to Zurich in 1950.
There it would operate for five years. It's supposed to have been pretty reliable.
Apparently the mechanical memory would occasionally jam, but that was the only real issue. As
with all things Zeus, we eventually arrive at something that sounds very normal. It's
just that the details are strange. Zeus designs and builds a computer, it gets leased to a research institute, and
it's used there for applied mathematics. That's such a normal story until you look under the
covers. Zeus would continue on in the field for decades. We've only really looked at the
very start of his career. But I want to step back to something that happened during his exile period, near the
Alps.
I said he developed a programming language.
Some, including Zeus himself, call it the first high-level language.
What's the deal with that?
I need to start here by explaining my thought process a little bit.
During this series, I've been working off of Zeus' autobiography, which is roughly
chronological but a little scattered.
Later papers that I've used are from people like Rojas or Knuth, and a number of other
authors.
They look at Zeus' work through the lens of computer science.
These are technical documents with a nod to the history.
I've been trying to mix those two streams together to form,
I hope, a very broad picture of Zeus's early work,
but also a technically accurate picture of his work.
You may have noticed that intent has been pretty hard
for me to pinpoint.
Zeus doesn't really give super clear reasons
for all his choices and whims.
It's just not his writing style.
We're not dealing with a Ted Nelson or a Calvin Morris who explains every thought they've
had since they were a teenager.
Similarly, the technical sources don't give rationale for everything.
When papers do talk of intent, it's with glances to the past. As I always say, it's hard to
appraise early eras in computing because we know the paths that continue forward.
We know which ideas were good ones, or at least which became popular and
venerated. I want to be especially considerate of this as we approach
Zeus's programming language. So before we even start that discussion,
I'm gonna take a beat to try to explain
something I've realized about Zeus.
In this period, before stored program computers
and before Zeus was really integrated
with the rest of the field,
he saw computing in a very visual way.
Remember, Zeus is an engineer and an artist.
He made realistic woodcuts, engineering diagrams,
and these wild oil paintings that depict winding and twisting skyscrapers. Zeus says in multiple
parts of his autobiography that he's a very visual person. I think that in this period he is still
approaching computing as a visual medium. That sounds super weird to us, I think,
because we know where computing goes. We know that computing becomes a purely textual exercise
for decades, that graphics only enter into the picture, ha ha, much later. But in the
era of the Z4, I believe Zeus is still looking at computing visually. Take, for instance,
the fact that he's still using mechanical memory. He's working from a totally different frame of mind. There's
also the simple fact that programming languages didn't exist yet. At best, we have things
like machine code, but nothing set in stone. There are no conventions. Take ENIAC as the
example here.
That machine was programmed with patch cables.
You had to physically connect different parts of the computer with these long wires.
Programs were recorded visually, as schematics drawn on graph paper.
This existed side by side with the Harvard Mark I, which, like Zeus's machine, accepted
instructions encoded as binary data on tape.
The field is smaller, that's true, but perhaps more diverse in approach.
Zeus's programming language is called Plan Kalkul, which roughly calculates as Plan Calculus.
I'm going to mainly call it PK, since that abbreviation is used in the literature and
prevents me from butchering a German word more than once.
PK is a strange language in every possible way. It's usually explained as just being a
quirk of the times, but I think there's a better explanation. PK is so strange because it's a
visual programming language. At least, it's much more visual than latter languages.
I'm gonna ease us into PK
since we do need to talk technical details
to really get to the interesting parts.
Let's start with data representation.
There's only one primitive data type in the language,
the binary digit.
Call it a dyad, a secundal, or a bit.
All other data structures are formed by groupings of bits,
either as arrays or records, which are groups of arrays.
Those shake out to be almost the same structure, though,
just with different ways of accessing data.
To create practical data types,
you have to build up these big
multi-dimensional arrays of bits. Let's say you want a list of normal numbers.
You'd first define a list element as a group of say 8 bits. That gives you a
little space to work with. Then you define a list of those elements. You can
access either the whole list, a single element, or even a single bit of a single element.
That's
relatively normal, at least for the most part. It's how you structure access that's the weird thing.
Everything is an array, so everything has a numeric index.
To describe a specific index, you write the variable's name, and then the index on
a line below it. For a subindex, like accessing a bit in our list, you would write another
number on the line below that. You end up with a vertical line of numbers. This is quite
literally the opposite of how every other programming language works.
In, say, Fortran, you can create a very similar list structure.
You access data by writing out, on one line, the variable followed by its indexes.
There's some syntax to make everything clean, but that's beside the point.
In a normal language, things are written left to right in a horizontal fashion on a single
line of text.
In PK, things are vertical, top to bottom.
This can be understood easily enough, right?
The horizontal format didn't exist yet because programming languages didn't really exist
yet.
Zeus is going from first principle, so he's unbridled by tradition. But, dear listener, there is a tradition
that he could work off of, one he was familiar with. In mathematics, we already
have a construct for these kinds of higher dimension arrays. It's called a
matrix. There's a well established notation for accessing
matrix elements. It's called the subscript. You can address any element in a matrix by
writing a subscript on the variable. If you have multiple subscripts, then you separate
them with a comma. The subscript is just written as a smaller text on the lower right hand
corner of the variable.
That lets you keep your equation on one line of paper, all horizontal left to right.
So the simple lack of tradition doesn't explain why PK is the way it is.
That's one of the reasons why I think Zeus was working visually.
So here's one of the implications of the weird vertical choice.
A single statement in PK takes up multiple lines of texts.
So I guess we gotta move up to statements.
A statement in PK sits next to something that looks,
at least to me, like the clef of sheet music.
You have three vertical letters, V, K, and S. Then to the right of those is
a vertical line. Those are identifiers, and there are some rules about how they're used
and what they need to be present for. Basically, anything on the right of the V is an input
variable. K denotes some information about indexing, and s denotes the type of
that variable. It's a structure. Note that a v line can actually be multiple lines because
of the nature of variable addressing in pk. Assignments are denoted as an arrow pointing
to the right. The right and left side of the arrow both follow the same staff rules.
In other languages, an assignment is simple.
X equals two, that sets the variable X to the value two.
But Zeus's language is structured
in such a fundamentally different way.
An assignment becomes this big block
that fully describes the types, indexing, and values
on both sides of the arrow. Despite that different structure, it still encodes, it still represents
all the same information as a more traditional statement in any other language. It has a
source and destination, it has information about what kind of data is moving around. It has what direction the data is moving in.
So really, it's just the representation that's different.
The idea is the same. I think that's classically Zeus, right?
I have one final wrinkle to add to the variable system before moving on to code.
In PK, it's possible to index an array with the value of another variable.
You can tell the language that you want the nth element of a list where n is some value stored
somewhere else in the program, maybe even some element of another array somewhere else.
This, however, is a little tricky. In PK's weird cleft notation, you have predetermined slots for variables and
indexes on that staff. So how do you note that an index is itself a variable? Well,
the solution's simple. You draw a line. This makes instant sense if you look at actual
code, but I'm stuck here in audio land, so let me
explain as best I can and I'll link to a paper on PlanCalcool that actually shows this operation.
For indexing by variable, you just write your first list in one column and leave the k-slot
open.
That's the index identifier.
Then you go over to the next column, you
write out the variable you want to use as the index. Finally, you draw a line
with a right angle elbow going from the k-slot of the first variable column to
the v-slot of the second variable. You end up with this square of data that has
this circuit-like trace cutting through the
middle.
It's strange to us.
It looks, frankly, a little arcane, like it should be written on a scroll somewhere
to describe components of some kind of spell.
But there are two things to point out here.
Firstly, like with other parts of PK, this is just a different way of expressing a very
common operation.
It has a direct equivalent in more traditional languages. Secondly, it is very visual.
You're literally drawing a line to express a relationship between two variables. I don't know how much more visual you can get than that while still having text on the page.
you can get them back while still having text on the page. Okay, I think we're set to get to the really wild part of this language.
This is something that when I found out I actually did kind of chuckle a little bit.
PK is Turing Complete.
Now I know, I've made a big deal out of how Zeus was a little behind the ball on the whole
Turing Completeness thing.
But the fact is that Zeus was thinking about conditional execution.
He just wasn't implementing it in hardware until 1950.
PK has conditional execution.
That, with all of its more fundamental features, make it a Turing complete language.
As always, this comes with some strangeness.
The condition isn't an if statement or some other familiar form.
It takes the shape of an assignment arrow with a dot over it.
That's visual, and that's frustrating.
So get this. A condition in PK is written as a boolean expression,
a dot arrow, and then the statement to execute.
If that boolean expression, that condition is true,
a value of one, since everything has to be a bit value,
then the statement the arrow points to is executed.
Otherwise, nothing happens.
In function, that is identical to an if statement. If, boolean expression, then do the statement.
It just happens to look like an assignment with a little dot above it. And let me assure
you, some of the code I've seen has very small dots. I find this frustrating since assignment
and conditional execution are miles apart.
They're totally different types of operations,
but in PK, they look nearly identical.
That's odd at best,
but I think part of that comes down to some typology.
Initially, Zeus had worked up a totally new symbol to use for assignment, once again,
classic Conrad.
It looks like a pipe that's spread on the left hand side.
He later switched to the arrow for assignment.
That means that initially an assigned pipe thing and a conditional arrow would look
totally different. PK also had loops and iterators. You could take an array and execute a subroutine
for each element of that array. That's some super modern and super convenient stuff. But remember,
stuff. But remember, we're visual here. Loops, iterators, and subroutines are all wrapped in big bold square brackets. Those are a normal sight in more textual
languages, but in PK we're talking proper big brackets. They involve multiple
statements, so in theory you could even wrap a whole page in these brackets.
This is another one of those features that we know today
it's just executed in a strange way.
When you see PK code that uses brackets,
it makes no sense until you get that it's just a block.
As early as ALGOL, way back in 1958,
we had this concept of the block.
It's a way to group together code for things like loops and subroutines.
In Algol, a block's wrapped in the words begin and end.
In C and its descendants, curly braces are used for the same purpose.
Python uses indents. But PK just takes a visual approach,
using big, bold brackets. There are a few other bits of PK that are less common in modern
languages, and here I do mean features, not just weird notation structure things. One One that sticks out to me is the mu operator. That's mu the symbol. It means roughly select.
You use mu to find the next entry of an array that matches some condition. You could write up
a very simple statement that would return the next element with a value over 10, or the next
element with a specific record structure.
There are equivalents in modern languages, like the filter functions in things like Python
and JavaScript, but that's all pretty new.
There's also the fact that mu functions as an iterator.
If I'm reading correctly, then you could use mu inside a loop to process all elements
that match your condition.
To make a long story short, that's very sophisticated.
By and large, this language is classic Conrad Zeus.
In isolation, he had this wild insight which lined up with the rest of the digital world.
He worked out what a high-level language needs to be, what it has to do, and how it has to
work.
If you look at the larger picture, it sounds very mundane, but the details are all very
unique.
Alright, that does it for this episode, and for our series on Konrad Zuse's early machines.
I can understand why so many listeners have
requested this one. Zuse is a fascinating character who created some truly fascinating
computers, but at the end here, we should look back at our initial questions. Did Zuse
invent the electronic digital computer? I hope I've made it clear how difficult that question is to answer. If we use
Turing completeness as the ruler, then no, not even close. Zeus only gets a Turing complete
machine working in 1950, maybe 1949 if we're generous. But Turing completeness isn't all
it's cracked up to be in the early era of computing. If we're talking about computer-like machines, machines that are structured like computers,
follow instructions and perform mathematics in binary using logic gates,
then Zeus's case gets a lot better.
The Z2 sparks to life in 1940, which puts him way ahead of the game.
I think that may count as the first electronic digital
computer under these more loose criteria. If we drop the electronic part and just count
digital, then the picture gets even rosier. The Z1, the little wonder from 1938, is mechanical,
but it is digital, and is structured like a computer. It even has tiny mechanical logic gates that operate on binary data.
I don't think we can just say Zeus invented the computer.
One, that's not entirely accurate, and two, it misses a lot of the subtlety of the situation.
Zeus independently invents many of the foundations of computing, like switching algebra,
high-level
programming, and even parallels to the Turing Completeness Theorem. This happens, in large part,
in isolation from the outside world. If we look at this from a larger angle, then Zeus gives us
perhaps the best argument for trends and forces. He even says so himself. I want to close today with a quote
that I used last episode that I think is especially applicable right now. Plus, I think it's only
fair to give the man himself the last word. To quote,
"...one can then ask oneself why the modern history of the computer begins in the third
decade of our century. Was the time ripe for a new start only then?
The technical difficulties that were Babbage's downfall
were already overcome by 1910.
Was there perhaps a certain inhibition
about making a critical study
of the intellectual abilities of man
and taking systemic steps
in the direction of amplifying intelligence?
One would almost have to assume so. Clearly,
in addition to the technical prerequisites, the active interest of the researchers and
inventors was necessary for a fresh start. And as so often is the case in history of
inventions, very similar ideas now developed independently in different places.
Thanks for listening to Admin of Computing. I'll be back in two weeks time with another piece of computing history, and I'm probably
going to go with something a little lighter this time.
After the Zeus episodes, I'm ready for something that's just pure old fun.
Anyway, if you want to support the show, you can do so by signing up for a patron on Patreon
or buying Advent of Computing merch from my merch store.
Patrons get early access to episodes, polls for the direction of the show, and bonus episodes.
You can find links to everything on my website, AdventOfComputing.com.
And until next time, have a great rest of your day.