Great Fleas… a poem about recursion

Computer scientists and mathematicians can be poets too, even writing poems about computation. One of my favourite poems is about recursion and was written by the Victorian logician Augustus De Morgan who is famous for his laws of boolean logic that are a mainstay of reasoning about boolean tests in programs.

Great fleas Have Lesser Fleas,
upon Their backs To Bite’em,
And Lesser Fleas Have Lesser fleas,
And So, Ad infinitum.


and Those great Fleas, Themselves, In turn
Have Greater Fleas To go On;
while Those Again have Greater still,
And greater Still, And So on.

– Augustus De Morgan

Recursion, solving problems by breaking them into smaller versions of the same problem, is a way of writing programs that repeat just using function call (no while loops or for loops needed). It is a core concept of the programming paradigm, functional programming. Using recursion in a way that goes on forever as in the poem leads to non-terminating programs.

De Morgan was also Maths tutor of Victorian mathematician and computer scientist, Ada Lovelace. Her father was the great poet Lord Byron though (philistine that I presumably am) I like De Morgan’s poem better than Byron’s.

De Morgan made the idea of mathematical induction rigorous. It is the basis of how you prove recursive programs (and iterative ones) are correct.

Paul Curzon, Queen Mary University of London

More on …

Subscribe to be notified whenever we publish a new post to the CS4FN blog.


Transitional Automaton: a poem

Image by Агзам Гайсин from Pixabay M

My poetry collection, «Αλγόριθμοι Σιωπής» (Algorithms of Silence), explores the quiet, often unseen structures that shape our inner lives. As a computer scientist and a poet, I’m fascinated by the language we use to describe these systems – whether they are emotional, social, or computational. 

The following piece is an experiment that embodies this theme. It presents a single core idea – about choice, memory, and predetermination – in three different languages: the original Greek poem “Αυτόματον Μεταβατικόν,” an English transcreation, and a pseudocode version that translates the poem’s philosophical questions into the logic of an automaton.

– Vasileios Klimis, Queen Mary University of London

Transitional Automaton

Once,
a decision – small,
like a flaw in a cogwheel –
tilted the whole system toward a version
never written.

In the workshop of habits,
every choice left behind
a trace of activation;
you don’t see it,
but it returns
like a pulse
through a one-way gate.

I walk through a matrix of transitions
where each state defines the memory of the next.
Not infinite possibilities –
only those the structure permits.

Is this freedom?
Or merely the optimal illusion
of a system with elastic rules?

In moments of quiet
(but not of silence)
I feel the null persisting
not as absence,
but as a repository in waiting.
Perhaps that is where it resides,
all that was never activated.

If there is a continuation,
it will resemble a debug session
more than a crisis.

Not a moral crisis;
a recursion.
Who passes down to the final terminal
the most probable path?

The question is not
what we lived.
But which of the contingencies
remained active
when we
stopped calculating.


Αυτόματον μεταβατικόν

Κάποτε,
μια απόφαση – μικρή, σαν στρέβλωση σε οδοντωτό τροχό –
έγερνε το σύνολο προς μια εκδοχή
που δεν γράφτηκε ποτέ.

Στο εργαστήριο των συνηθειών
κάθε επιλογή άφηνε πίσω της
ένα ίχνος ενεργοποίησης·
δεν το βλέπεις,
αλλά επιστρέφει
σαν παλμός σε μη αντιστρεπτή πύλη.

Περπατώ μέσα σ’ έναν πίνακα μεταβάσεων
όπου κάθε κατάσταση ορίζει τη μνήμη της επόμενης.
Όχι άπειρες πιθανότητες –
μόνον όσες η δομή επιτρέπει.
Είναι ελευθερία αυτό;
Ή απλώς η βέλτιστη πλάνη
ενός συστήματος με ελαστικούς κανόνες;

Σε στιγμές σιγής (αλλά όχι σιωπής)
νιώθω το μηδέν να επιμένει
όχι ως απουσία,
αλλά ως αποθήκη αναμονής.
Ίσως εκεί διαμένει
ό,τι δεν ενεργοποιήθηκε.

Αν υπάρξει συνέχεια,
θα μοιάζει περισσότερο με debug session
παρά με κρίση.

Όχι κρίση ηθική·
μία αναδρομή.
Ποιος μεταβιβάζει στο τερματικό του τέλους
το πιο πιθανό μονοπάτι;

Η ερώτηση δεν είναι τι ζήσαμε.
Αλλά ποιο από τα ενδεχόμενα έμεινε ενεργό
όταν εμείς
σταματήσαμε να υπολογίζουμε.


Pseudocode Poem version

Pseudocode poems are poems written in pseudocode: the semi-formailsed language used for writing algorithms and planning the design of program. Here is the above poem as a pseudocode poem.

FUNCTION life_automaton(initial_state)
  DEFINE State_Transitions AS Matrix;
  DEFINE active_path AS Log;
  DEFINE potential_paths AS Set = {all_versions_never_written};

  current_state = initial_state;
  system.log("Initializing in the workshop of habits.");

  REPEAT

    WAIT FOR event.decision;
    // a decision — small, like a flaw in a cogwheel
    IF (event.decision.is_subtle) THEN
       previous_state = current_state;
       current_state = State_Transitions.calculate_next
                                (previous_state, event.decision);
       // it returns like a pulse through a one-way gate
       active_path.append(previous_state -> current_state);
       potential_paths.remove(current_state.version);
    END IF

   // Is this freedom? Or merely the optimal illusion
   // of a system with elastic rules?
   
   IF (system.isQuiet) THEN
       // I feel the null persisting
       // not as absence, but as a repository in waiting.
       // Perhaps that is where it resides, all that was never activated.
       PROCESS potential_paths.contemplate();
   END IF

  UNTIL system.isTerminated;
   
  // If there is a continuation,
  // it will resemble a debug session more than a crisis.
  // Not a moral crisis; a recursion.
  DEBUG_SESSION.run(active_path);

  // The question is not what we lived.
  // But which of the contingencies remained active
  // when we stopped calculating.
  RETURN final_state = active_path.getLast();
END FUNCTION

More on

Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This blog is funded by EPSRC on research agreement EP/W033615/1.

QMUL CS4FN EPSRC logos