The Ouroboros, From Antiquity To AI

Illustration: Elena Scotti (Photos: Getty Images, Shutterstock)

The Ouroboros—which symbolises the cyclical nature of life and death and the divine essence that lives on forever—was first recorded in the Egyptian Book of the Netherworld. Alchemists then adopted the symbol into their mystical work of physical and spiritual transformation. After chemistry supplanted its more mystical forebear, alchemy, the Ouroboros was largely forgotten. That is, until reemerging in the 19th century largely thanks to the psychologists Carl Jung. Today, the Ouroboros has taken on a new life in tech’s Ouroboros program, and has become integral to coding and our evolving understanding of artificial intelligence. 

As a medievalist, the transformation of the Ouroboros from an ancient Egyptian mystical symbol to artificial intelligence is endlessly fascinating to me. Why has this symbol been reimagined so many times through the centuries? In tech, Ouroboros programs, like their name would suggest, have no beginning input and no ultimate output. In other words, they begin without any coder starting them. They’re continuous, coding and coding forever seemingly on their own. So how did a mysterious symbol of a snake make its way from antiquity into modern technology?

The word “Ouroboros” is from ancient Greek, and means “tail-devouring.” The Egyptian origins of the Ouroboros are a little murkier. One of the first known precursors to the Ouroboros is found in the ancient Egyptian religious and funerary text, the Amduat. The important, early 15th century funerary text tells a story of resurrection that echoes across Gnostic and early Christian texts as well as in alchemy. In the Amduat, the deceased pharaoh travels with the sun god Ra through the realm of the dead known to the Egyptians as Duat. Every day after the sun sets in the West, Ra must travel through Duat to the East where the sun rises with Ra’s reemergence. It’s believed that when a pharaoh dies they too make this journey with Ra eventually becoming one with the sun god and living on forever. The Amduat served as a sort of road map for the dead pharaoh, instructing them on how to make this journey with Ra. It’s why the Amduat is often found carved into the wall’s of the pharaoh’s tomb. Like any good road trip, you want to keep a map close when travelling through the afterworld. The twelve hours of the night act as markers in the Amduat’s “map.”

It’s in the sixth hour that one of the most significant moments in the journey occurs—the pharaoh is met by Mehen, a huge coiled serpent. Mehen helps guide Ra and the pharaoh through the afterworld coiling around Ra and the pharaoh on the journey to protect them from all outside evils and lurking enemies. Mehen’s body not only acts a physical barrier of protection encircling Ra, but also a magical one as Egyptologist Peter A Piccione points out. Mehen is often seen as a connector between the physical and metaphysical linking him to Egyptian magical traditions. His association with magic and the liminal space between the real and the unreal eventually brings Mehen into the folds of alchemy.

In less esoteric circles, Mehen is also an ancient Egyptian board game, where a carved coiled serpent acts as the board.

“Game of the Snake” (Mehen) with gamestones; Limestone; Early Dynastic Period (ca. 3.000 BC), Egyptian Museum of Berlin. (Photo: WikiMedia)

It’s about two hundred years later, in the 13th century, that Mehen transforms into the single, continuous circle of the Ouroboros. The early Ouroboros depiction can be found in none other than in King Tut’s burial chamber, gilded in gold. In fact, not one but two Ourobori encircle the relief of a mummified figure, identified by scholar Alexandre Piankoff as King Tutankhamun. One encircles his head, shown below, and another encircles his feet.

Scholars believe that the encircling serpent is still a representation of Mehen, and pharaoh Tutankhamun’s journey through the afterworld with Ra. The significance comes though in how Mehen is drawn in King Tut’s burial chamber. Rather than being a squiggly line surrounding the pharaoh in earlier reliefs, this is the first time Mehen is shown as the Ouroboros is depicted in later centuries—as one continuous circle.

First known representation of the ouroboros on one of the shrines enclosing the sarcophagus of Tutankhamun. (Image: Wiki Commons)

Sometimes we forget that the ancient world was full of folks going and coming, exchanging knowledge and culture along the way. The Egyptians didn’t exist in a bubble, and already by the 2nd millennium BCE scholars know Egyptians and Greeks were rubbing shoulders. (The Egyptians, at that time, were a far more advanced civilisation when compared to the Greeks.) Mehen morphed into the Greek Ouroboros, and got imported East via the Egyptian practice of alchemy.

Alchemy brought together scholars from various corners of the globe. Greeks, Egyptians, Jews, and others from the peninsula all flocked to the Egyptian city of Alexandria to study the art of alchemy. Alchemy, with its elaborate experiments and mystical underpinnings, was at the cutting edge of research in the ancient world. By the early centuries of the Common Era, Alexandria was the epicentre of not only alchemy, but of maths, history, philosophy, medicine, and many other disciplines.

The 10th century copy of the Ouroboros from The Chrysopoeia of Cleopatra (Image: Public Domain, WikiMedia)

The earliest known alchemical depiction of the Ouroboros is found in the third century text, The Chrysopoeia of Cleopatra. Here the Ouroboros encircles the words “all is one.” By the time the alchemist Cleopatra, not to be confused with that other Cleopatra who killed herself with the snakes and had that whole thing with Mark Antony, drew this Ouroboros, the Ouroboros was no longer a depiction of Mehen. While related to its origin as Mehen, the Ouroboros by this point had morphed into an altogether new symbol. Both Mehen and the Ouroboros relate to the understanding of time being cyclical. Mehen encircles Ra through the god’s journey through the afterworld every night. The alchemical Ouroboros however no longer carries the protective and magical powers associated with Mehen.

In alchemy, the Ouroboros represents not only the cyclical nature of time and energy, but also the union of opposites necessary to yield the Philosopher’s Stone. The Philosopher’s Stone is the ultimate goal many alchemists worked towards. The Stone had the power to transmute anything into its highest form. It could transform lead to gold. It was the universal solvent and the elixir of life. It was the answer to anything alchemists worked to achieve in their laboratories. In fact, the Ouroboros itself can be a representation of the Philosopher’s Stone. No wonder then that the Ouroboros is at the heart of ancient alchemical study.

Outside of the Western world, the Ouroboros pops up almost simultaneously across the ancient world. In Hinduism mythology, a never-ending snake wraps around the world to keep it upright. In 2nd century yogic text, divine energy known as Kundalini is described as coiled serpent holding her tail in her mouth. In China, the Ouroboros represents the union of yin and yang. Even across the globe, Aztecs depicted the snake god Quetzalcoatl biting its own tail on the base of the Pyramid of the Feathered Serpent.

In the West, the Ouroboros travelled from the ancient world to the Gnostic, Christian, then Islamic worlds, and then on to Medieval and Renaissance Europe. During this time, the Ouroboros symbol was remixed several times. The 3rd century CE Gnostic text Pistis Sophia describes the Ouroboros as a twelve-part dragon. Perhaps a nod to the twelve hours of night associated with Mehen. Gnostics considered the Ouroboros to be a symbol of the eternal, never-ending soul.

Medieval christians, on the other hand, sometimes associated the Ouroboros with knowledge and the serpent who tempts Eve to eat from the Tree of knowledge. Yet, the Ouroboros also finds a home carved into the medieval English Church of St. Mary and St. David or in the 9th century Book of Kells, an Irish illuminated Gospel. So, the Christians couldn’t really seem to make up their minds about the Ouroboros—is it Satan disguised as a tree serpent or a holy symbol of Christ?

Even while some medieval Christians couldn’t decide how they felt about the Ouroboros, the Ouroboros still had a rich life in alchemical laboratories of the period. Continuing the tradition of alchemy from the ancient world, medieval alchemists associated the Ouroboros with the Philosopher’s Stone as the union of opposites. For medieval alchemists, the Ouroboros symbolized the organising of the world’s chaotic energy, known to the alchemists as First Matter or prima materia.

A carving of the Ouroboros in the Church of St. Mary and St. David. (Image: Public Domain, WikiMedia)

The Ouroboros’s symbolic life continues on through to the Enlightenment. But, with the decline of alchemy in the late 18th century, the Ouroboros was relegated to Romantic and Victorian séances and spiritualist meetings. It was still around. But, it was no longer a symbol at the heart of human existence, a symbol that spoke to life’s cyclical nature. Now, it was just a cool magical sign. That is until tech world came along.

Artificial Intelligence is all about creating a machine that can mimic the human brain’s ability for cognition. AI technology has already been proven to out perform humans—in some very specific ways. World champion Go player Lee Sedol decided to retire after 24 years as Go champion after being defeated by an AI computer. Chatbots use Natural Language Processing (NLP) to field customer questions so well that customers can’t even tell they’re talking to a robot. Smart programs outperform humans in trading stocks. In later stages, if that technology ever becomes possible, the goal for Artificial Intelligence development may be to create a machine with its own consciousness, but we are very far from that point in history.

Enter Ouroboros programs. These emerged from a type of code sequence known as a quine. A quine doesn’t have any input, and its only output is its own source code. In other words, a quine is a type of code that has no beginning, creating an output seemingly on its own. A normal computer program is basically just a set of directions that then a computer follows. So, say you’re a coder and you write a program that adds numbers. You still have to provide the numbers for the computer to add even after you’re all done writing the code. Quines magically don’t need any numbers to start adding away. The numbers, aka the input, aren’t necessary for quines to power up.

The name “quine” actually was coined in Douglas Hofstadter’s 1979 Pulitzer Prize winning book Gödel, Escher, Bach. The book is a non-fiction Alice in Wonderland-esque romp through symmetry, mathematics, and art, and in it Hofstadter uses the term “quining” to describe when an object/number/musical note refers back to itself indirectly. So, instead of saying, “I’m sarah,” it’d be the mathematical equivalent to saying “I’m a medievalist.” This relates to tech quines because, going back to our calculator program, quines create their self-generated input using self-reference. They take something of their own code and copy it slightly differently, so they can continue to grow.

An Ouroboros program is similar to a quine, but in addition to having no input, it also has no output. In other words, Ouroboros programs have no beginning and no end. So, again going back to our calculator program, where quines create some final solution. They add whatever numbers and find a solution. Ouroboros programs would just keep adding and adding and adding until they miraculously got back to the same number they started at, and then would do it all again. So, just like the snake version of the Ouroboros, tech’s Ouroboros program eats itself (so to speak). Ouroboros programs are completely self-contained. It’s why they’re sometimes called self-replicating programs or quine relays. They just go on and on and on, until eventually returning to its source code creating one big loop. Quines and Ouroboros programs are useful to coders, because coders can basically just leave them alone to do their thing. Since neither program requires an input, they can do a specified task seemingly on their own.

In addition to having no beginning or end, Ouroboros programs cycle through completely different coding languages. They might begin in language X, then transition to Y, then Z, and so on until coming back to language X. Coder Yusuke Endoh created an Ouroboros program that cycled through as many as 50 different coding languages. This has made Ouroboros programs increasingly important to the development and creation of different coding languages, like Java. It also allows the Ouroboros program to function in completely different coding languages moving from Python to Ruby like it was child’s play. It’s as if an Ouroboros program is immediately fluent.

As computer science researchers Dario Floreano and Claudio Mattiussi have explored in their book, Bio-Inspired Artificial Intelligence: Theories, Methods, and Technologies, computer scientists have looked to the origins of biological life to find clues on how to create artificial life. The origin of biological life, they and other computer scientists believe, could act as a blueprint to creating artificial life.

Biologists trace the origin of life on Earth to a simple molecule that four billion years ago learned how to replicate itself. Once molecule-based genetic variations learned how to replicate themselves, they started competing in Darwin’s fun game of natural selection. The variations that were able to survive and copy themselves the best continued to replicate. The variations that weren’t as prolific were voted off the prehistoric island. Eventually, the first cell was formed, followed by the first organisms, then the dinosaurs, and then us humans. And, that’s creation in a nutshell.

As Floreano and Mattiussi discuss in the preface of their book, mainstream AI research hasn’t focused on human’s own origin story to create artificial life. Mainstream AI is very good at creating algorithms and devices to solve problems even more quickly than humans. Take my earlier example of Go player Lee Sodel moved to retire because AI could problem-solve its way to victory far better than himself.

But, starting in the 1980s, AI researchers began looking to develop more human-like AI. By the turn of the millennia, this new type of AI research solidified as new artificial intelligence. The aim of AI was broadened from problem-solving to exploring cognition and other organic processes. In their article Neural Network Quines, Oscar Chang and Hod Lipson of Columbia University’s Data Science Institute explore how Ouroboros programs and quines, similar to the first self-replicating cell, could be the first step towards developing this “new,” conscious AI. In addition, self-replicating programs could make AI even more human-like.

For instance, AI created using self-replicating programs, like the Ouroboros program or quines, could in theory repair or “heal” themselves. By replicating undamaged code to replace damaged code, quine-based AI could heal itself much like you and I can. As French mathematician David Madore explains, quines, and Ouroboros programs by extension, can repair damaged code through a process known as bootstrapping. In bootstrapping, a quine can basically hit a coder version of a restart button on its own. In other word, the quine “pulls itself up by its bootstraps” and starts over.

Computer scientists have also taught machines to identify sound, text, and images through what’s known as deep learning models. Deep learning models are based upon programs that learn much like our brains. Computer scientists build deep learning models using “neural network architecture” that are borrowed directly from neurology and often employ Ouroboros programs. Neural network architectures are basically a collection of quines that work together. This creates a much stronger system. In the same way neurons fire to other neurons in our brains, these quine neural networks do the same thing. Quines work with other quines to process information more quickly.

Oscar Chang and Hod Lipson of Columbia University have in fact written about the importance of self-replication in AI. In a recent article, they looked specifically at “neural network quines.” Neural network quines can self-replicate and build upon what they already know, allowing AI to learn faster. Perhaps even faster than humans—at least, eventually.

The Ouroboros program is in many ways the nexus of tech and theology. As professor of theology and computer science at St. John’s University in Minnesota, Noreen Herzfeld puts it AI begs the question, what is life? How do we define it? How do we know if we’ve found it? What is the nature of consciousness? These philosophical questions so at the heart of AI are the same questions that religions and spiritual traditions have tried to answer for millennia, as Herzfeld points out. This is no coincidence.

In the past, religion and science intermingled more fluidly than they do today. Religion informed science, and science informed religion. Alchemy, a precursor to modern day chemistry, was in many ways its own religion. Then, when the Enlightenment came along, science and religion were separated from one another. But, today innovations like the Ouroboros program ask us to ponder those religious and spiritual questions in a very immediate way. You can’t build artificial consciousness, if you don’t first understand what consciousness is.

And, at the heart of AI research and its future is an ancient spiritual symbol of the universe, the Ouroboros. The Ouroboros, with its connection to ancient Egyptian religion and alchemy, was and is a religious and spiritual symbol. And now, it’s a term applied to a coding program that could potentially eventually lead to a new kind of consciousness. That’s not an accident.

In this one symbol, religion and science again intermingle. The Ouroboros is a symbol of life and death, of time. And, perhaps that’s what consciousness is all about. Because what’s more human than pondering the cycles of life and death, and our place within them? And, how cool is it that, as we move towards creating artificial life, the Ouroboros symbol will be at the literal centre of whatever new life we create?

Sarah Durn is a freelance writer, actor, and medievalist based in New Orleans, LA. She is the author of an upcoming book on alchemy to be published in Spring 2020.