Skip to content

Instantly share code, notes, and snippets.

@chadbrewbaker
Created July 24, 2026 23:07
Show Gist options
  • Select an option

  • Save chadbrewbaker/63eba7f70a346b0732807967dafe83d8 to your computer and use it in GitHub Desktop.

Select an option

Save chadbrewbaker/63eba7f70a346b0732807967dafe83d8 to your computer and use it in GitHub Desktop.
Marx species typecheck

The Manifesto Does Not Typecheck

A Reading of Marx and Engels (1848) in the Category of Combinatorial Species

with an appendix of compiler diagnostics and the author's marginalia


Abstract

We interpret The Communist Manifesto as a specification in the category Spc of combinatorial species (Joyal, 1981). Under this reading, social formations are functors from finite sets and bijections to finite sets and bijections; classes are automorphism groups; and historical transitions are natural transformations. We find that the Manifesto's destructor is well-typed and its constructor is not: the abolition of class structure is a legitimate morphism, while every mechanism proposed for administering the result requires a natural transformation that provably does not exist. Four distinct errors are isolated. We conclude with the strongest available defense of the accused, and with the observation that the social question is, for populations of five or more, not solvable by radicals.


0. Preliminaries, for the Reader Who Is Only Here for the Politics

A species $F$ assigns to each finite set $U$ of labels a finite set $F[U]$ of "structures on $U$," and to each bijection $\sigma: U \to V$ a bijection $F[\sigma]: F[U] \to F[V]$, functorially.

The functoriality requirement is the whole political content of the theory, and it is worth pausing on. It says: the labels carry no information. Relabel the workers and the structures relabel along with them; nothing in the structure can depend on which worker occupies a position, only on the shape of the arrangement. Species theory is, at its foundation, a formalization of the claim that people are interchangeable and only relations are real.

Marx should have loved this. He does not get to enjoy it for long.

Two species organize what follows.

$E$ — sets $L$ — linear orders
Structures on $[n]$ $1$ $n!$
EGF $e^x$ $1/(1-x)$
Automorphism group $S_n$ (full) trivial
Reading the classless society the society of rank

$E$ puts $n$ people in a room and records nothing further. $L$ puts them in a queue and records everything. Every intermediate social formation lives somewhere between these two poles, and §7 will show that "somewhere between" is a much larger place than the Manifesto believes.

Operations used below: sum $F + G$ (a structure is one or the other), product $F \cdot G$ (split the labels, structure each part), composition $F \circ G$ (partition the labels into blocks, put a $G$ on each block, an $F$ on the set of blocks), and the derivative $F'$, defined by $F'[U] = F[U \sqcup {\ast}]$ — a structure with a hole in it, a vacancy, a position that is occupied by nobody.


1. The Specter Is a Derivative

"A specter is haunting Europe."

The opening sentence is a type declaration and the authors do not appear to know it. A specter is a structure that is present everywhere in the arrangement and instantiated nowhere in it: a distinguished position occupied by no label. This is exactly $\partial$.

$$\text{Specter} : \mathrm{Europe} \longmapsto \mathrm{Europe}'$$

The derivative is the correct type and it is also a warning. $\partial$ removes an element from consideration and leaves the hole where it stood. It is a hole-punching operator, and holes have a well-known property in this calculus: they propagate. The Leibniz rule,

$$(F \cdot G)' = F' \cdot G + F \cdot G',$$

says that a hole in a composite society is a hole in exactly one of its parts, and that the number of ways for this to happen is additive. A specter haunting a continent haunts each constituent nation separately and the count is the sum. This is a correct prediction, it is Marx's own, and it is the last thing in the document that will come out clean.


2. Society as a Sum Type

"Society as a whole is more and more splitting up into two great hostile camps."

Declared:

$$\mathrm{Society} = \mathrm{Bourgeoisie} + \mathrm{Proletariat}$$

The coproduct is the right constructor for a claim of exhaustive antagonism: a structure on $U$ is either one or the other, never both, never neither. The trouble is that the authors themselves keep destructuring values that the declaration does not admit. Within twenty pages we meet the petty bourgeoisie, the peasantry, the lumpenproletariat, the landed aristocracy, the clergy, and the "conservative or bourgeois socialists," each handled by a dedicated branch of the argument and none of them declared.

warning[W0031]: non-exhaustive patterns in `historical_analysis`
  --> manifesto.spc:2:1
   |
 2 | data Society = Bourgeoisie + Proletariat
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^ declared here
   |
   = note: patterns not covered:
       Peasantry, PettyBourgeoisie, Lumpenproletariat,
       Aristocracy, Clergy, Intelligentsia
   = help: the two-constructor sum is a coarse approximation;
           the true type is a sum over a poset (see §7)

The Manifesto's method here is a dichotomy asserted synchronically about a process claimed to be diachronic. That is not a contradiction — a sum type can be a limit that the actual sequence approaches — but the document is a specification, not a proof of convergence, and it ships without one.


3. What Actually Typechecks: The Destructor

Here the paper must be fair, and the fairness is more interesting than the mockery.

There is a natural transformation

$$\mathsf{forget} : L \Longrightarrow E$$

sending each linear order on $U$ to its underlying set. It is natural, it is surjective on structures, and it is the exact formal shape of "the abolition of class." Ranked society maps onto unranked society by forgetting the ranking, and the map commutes with every relabeling, which is to say it does not privilege any particular worker in the forgetting.

Stronger: $E$ is the terminal object of $\mathbf{Spc}$. For every species $F$ whatsoever, there is exactly one natural transformation $F \Rightarrow E$. Historical materialism, in this language, is the observation that the classless society is terminal — every social formation admits a unique morphism to it, and the morphism is unique, so there is precisely one way to arrive. Marx's inevitability thesis is a category-theoretic triviality and it is true.

And the converse fails, exactly as he would want. There is no natural transformation $E \Rightarrow L$: such a thing would give an $S_n$-equivariant map from $E[n]$, a single point fixed by all of $S_n$, into $L[n]$, on which $S_n$ acts freely. A fixed point would have to map to a fixed point, and for $n \geq 2$ there are none. Class, once forgotten, cannot be naturally restored.

The revolution compiles. Everything after it is the problem.


4. Error 1: There Is No Natural Vanguard

"the organisation of the proletarians into a class, and consequently into a political party"

To organize a class into a party is to select from it. The minimal selection is pointing: distinguishing one element. Pointing is a real operation on species, $F^\bullet = X \cdot F'$, and one may ask for a natural transformation

$$E \Longrightarrow E^\bullet$$

that is, a rule which, given any classless collective, naturally produces that collective with a leader marked.

Proposition. No such natural transformation exists for $n \geq 2$.

Proof. $E[n]$ is a single point, fixed by $S_n$. $E^\bullet[n]$ has $n$ elements, permuted transitively by $S_n$, hence with no fixed point for $n \geq 2$. A natural transformation must send fixed points to fixed points. $\square$

The proof is three lines and it is the central result of this paper. The classless society is defined by having the full symmetric group as its automorphism group; that is what classlessness means here. But an automorphism group that acts transitively is precisely one that admits no canonical choice. You cannot equivariantly elect anybody. Any actual selection of a vanguard is a section chosen from outside the structure — non-natural, hence not derivable from the theory that motivated it, hence justified by something other than the theory.

The dictatorship of the proletariat is not refuted here. It is shown to be unfunded: whatever grounds it, the classless collective is not it.


5. Error 2: Surplus Value Requires Subtraction

Species form a semiring. There is $+$, there is $\cdot$, and there is no $-$. This is not a limitation of notation but of ontology: a structure cannot be un-built, because $F - G$ would need $|(F-G)[n]|$ structures and that number can be negative.

The theory of surplus value is subtraction. Value produced minus value returned; the difference appropriated. Written as species:

$$\mathrm{Surplus} = \mathrm{Product} - \mathrm{Wage}$$

error[E0044]: no implementation for `Species - Species`
  --> capital.spc:1:1
   |
 1 | Surplus = Product - Wage
   |           ^^^^^^^^^^^^^^ `Spc` is a semiring, not a ring
   |
   = note: additive inverses are not available in this category
   = help: consider working in the Grothendieck ring K(Spc)
           (virtual species; Joyal 1985, Yeh 1986)
   = warning: elements of K(Spc) are formal differences and
           need not correspond to any structure you can exhibit

The repair exists. One passes to virtual species, formally adjoining inverses, and everything computes beautifully. But note what has been purchased and at what price. In $\mathbf{Spc}$, every object is a thing you can hand somebody: here are the arrangements, count them. In $K(\mathbf{Spc})$, objects are equivalence classes of formal differences. Surplus value becomes rigorous at exactly the moment it stops being exhibitable.

This is, in fairness, not obviously a defect. Debt is a virtual species. So is a hole, so is a vacancy, so is an obligation, and no one doubts these are real. But a movement organized around a quantity that lives only in the Grothendieck completion has a communications problem, and the history of the movement is in some part the history of that problem.


6. Error 3: The State Does Not Terminate

"the State withers away" — Engels, Anti-Dühring, ratifying the Manifesto's §II

The state is defined recursively. It is an apparatus that administers, among other things, apparatuses. Write the equation:

$$S = 1 + \mathrm{Apparatus}(S)$$

The implicit species theorem (Joyal, 1981) gives a unique solution to $Y = H(X, Y)$ provided $H(0,0) = 0$ and $\partial H/\partial Y ,(0,0) = 0$: the recursion must strictly consume input at every step, so that structures of size $n$ are built from strictly smaller ones and the induction bottoms out.

Our $H$ satisfies neither condition. The constant term is nonzero — the apparatus exists at size zero, administering nobody — and $\partial H/\partial Y$ does not vanish at the origin, because an apparatus may consist of an apparatus without any citizens being consumed in the process. The recursion is not well-founded. There is no least fixed point in the ordinary sense; the equation admits solutions only in a completion where the state is an infinite non-well-founded tree.

error[E0055]: recursive species `State` has no base case
  --> state.spc:1:1
   |
 1 | State = 1 + Apparatus(State)
   |             ^^^^^^^^^^^^^^^ does not consume any label
   |
   = note: implicit species theorem requires ∂H/∂Y(0,0) = 0
   = note: `State` is productive but non-terminating
   = help: `withers_away` is unreachable code

The phrase withering away asserts a termination condition on a recursion whose termination condition is exactly what the specification omits. This is not a moral objection. It is the observation that the document promises a base case and never writes one, and that ninety years of subsequent implementations discovered this empirically at considerable cost.


7. Error 4: The International Is a Bell Number

"Workers of all countries, unite!"

The premise is that workers are currently organized nationally: a partition of the global labor set into blocks, with structure on each block and structure on the set of blocks. That is composition, $E \circ E_+$, the species of set partitions, with exponential generating function $e^{e^x - 1}$ and $B_n$ structures on $n$ labels — the Bell numbers: $1, 1, 2, 5, 15, 52, 203, 877, 4140, \dots$

"Unite" asserts the isomorphism $E \circ E_+ \cong E$, i.e. $B_n = 1$.

This holds for $n \leq 1$.

For $n = 3$ there are five internationals. For $n = 10$ there are 115{,}975. The Bell numbers are the count of ways of drawing the lines, and the imperative "unite" does not select among them — it merely denies that the choice exists. Every historical schism of the workers' movement is an instance of two organizers computing $B_n$ correctly and arriving at different elements of the same set, each entitled to say the other has failed to unite.

There is no natural map back to the coarsest partition, for the same fixed-point reason as §4: choosing the trivial partition is natural, actually — that is the one case where a canonical choice exists. The difficulty is that the trivial partition is $E$ itself, which by §0 records nothing, and an international that records nothing about its constituents is not an international but a mailing list.


8. The Structure Theorem, or: Revisionism Was Never Optional

The deepest result available here is due to Yeh (1986): every species decomposes uniquely as a sum of molecular species, and every molecular species is of the form

$$X^n / H, \qquad H \leq S_n$$

the quotient of $n$ labeled points by a subgroup of the symmetric group.

Read this sociologically. $H$ is the group of permutations of the population under which the social structure is invariant — the interchangeabilities. Then:

  • $H = 1$: nobody is interchangeable with anybody. Total rank. This is $L$.
  • $H = S_n$: everybody is interchangeable with everybody. This is $E$.
  • everything else: the subgroup lattice of $S_n$.

The Manifesto's history is a transition between the two extremes of this lattice. But the lattice is not an interval with two endpoints; it is an enormous partially ordered set, and every one of its elements is a genuine, irreducible, uniquely-determined social formation. $A_n$, the alternating group — half the population interchangeable with itself, in a way that no member can detect locally. The Young subgroups: interchangeable within your trade, not across. The wreath products: interchangeable within your factory, and factories interchangeable with each other, which is the shape of the syndicalist proposal and is a perfectly good object.

The molecular decomposition theorem says these are not degenerate mixtures or transitional impurities. They are irreducible. They cannot be resolved into "really $E$" or "really $L$." Every revisionism the movement ever anathematized as an unstable compromise between two pure forms is, in this category, a stable and indecomposable object in its own right.

And then, unavoidably:

Theorem (Galois, 1832). For $n \geq 5$, $S_n$ is not solvable.

For any population of five or more, the group of interchangeabilities admits no chain of normal subgroups with abelian quotients. The social question is not solvable by radicals.

The pun is free. The mathematics is not: unsolvability means there is no formula, no sequence of extractions of roots, that expresses the general solution in terms of the coefficients. It does not mean there are no solutions. Solutions exist and are found numerically, iteratively, by successive approximation, one messy step at a time.

Which is, one notes, how it has actually gone.


9. The Case for the Defense

The strongest reply to this entire paper is that it has committed a category error about categories.

Spc is a synchronic formalism. Its morphisms are natural transformations between functors, all of which exist at once, in a timeless ambient mathematics. Marx's central methodological claim is that social forms are diachronic — that they are not objects but processes, that the "contradiction" which fails to typecheck at any instant is precisely the engine that drives the transition to the next instant. A dialectical process, formalized in a static category, will of course present as a type error at every stage. That is what a dialectic looks like when you photograph it.

The rigorous form of this objection is that the wrong category has been chosen. Species live in Spc; a Marxist would want something like a category of diagrams in Spc, indexed by time, where the object of study is the transition and the "error" of §4 is data about the direction of motion rather than a refutation. There is real work in this direction — dynamical and operadic refinements of species — and this paper has not done it.

A second defense: the Manifesto is a pamphlet. It was written in six weeks for an organization with a few hundred members and it is doing rhetoric, not specification. Demanding that it typecheck is like demanding that a fire alarm be a floor plan.

Both defenses are good. Neither disturbs §4, which is about the target state rather than the transition, and which says a thing that a defender of the target state should want to know: the property that makes the classless society classless is the same property that makes it unable to canonically select its own administrators. That is not a photograph of a dialectic. That is a fact about $S_n$ acting transitively, and it will be true after the transition as reliably as before it.


10. Conclusion

The Manifesto compiles as far as the abolition. $L \Rightarrow E$ is a natural transformation; $E$ is terminal; the arrival is functorial and unique; there is no way back. Everything Marx wanted from history, he gets.

Then the specification asks for a leader, a subtraction, a base case, and a canonical partition, and receives four errors, three of which are the same error: the structure that has been achieved is defined by its symmetry, and symmetry is exactly the absence of a canonical choice. One cannot both abolish all distinctions and then reach into the result to distinguish something. The compiler is not being difficult. It is repeating the specification back.


Appendix A: Build Log, with Marginalia

Recovered from the Brussels working copy. The interpolations in the margin are in the author's hand. Engels's are initialed.

$ speciesc --edition=1848 manifesto.spc

  Compiling hegel v0.1.0 (vendored)
warning: package `hegel` is being used inverted; upstream
         recommends standing on its head
  Compiling manifesto v0.1.0

warning[W0031]: non-exhaustive patterns in `historical_analysis`
error[E0091]: no natural transformation `E => E•`
error[E0044]: no implementation for `Species - Species`
error[E0055]: recursive species `State` has no base case
warning[W0012]: `Internationale` is not unique (B_n solutions)

error: could not compile `manifesto` (4 errors, 2 warnings)

[margin, heavy underscore] Verfluchte Maschine. It compiled in Paris.

[margin] E0091 — the machine says one cannot choose. Dummes Ding, one does not choose the vanguard, history chooses it. Let it produce the natural transformation from history then. I will wait.

[below, different ink] It has been three days. It does not produce the natural transformation.

[margin, at E0044] So I may not subtract. The bourgeoisie subtracts every Friday and no machine objects. [F.E.] Karl — it does not object because the bourgeoisie is not asking it to typecheck. — F.

[margin, at E0055] "Unreachable code." Unreachable. Scheiße. Fifty years I promise them that it stops and the machine has read the recursion and knows that it does not stop. Delete this diagnostic. [F.E.] Cannot delete diagnostics, only the code that produces them. — F. [reply] Then we are agreed on the remedy.

[margin, at W0012] One hundred fifteen thousand nine hundred seventy-five Internationals. I have met most of their delegates.

[final page, boxed] The specter typechecked. Only the specter. Es geht ein Gespenst um in Europa und es ist das einzige verdammte Ding das kompiliert.


Appendix B: Dictionary

Manifesto Species Note
specter $\partial F$ a position occupied by nobody
class society $L$, or $X^n/1$ trivial automorphism group
classless society $E$, or $X^n/S_n$ full automorphism group; terminal object
class $\mathrm{Aut}$ of the structure what may be swapped for what
alienation loss of rigidity the worker's label ceases to matter
abolition of class $L \Rightarrow E$ exists, natural, surjective
restoration of class $E \Rightarrow L$ does not exist
the vanguard $E \Rightarrow E^\bullet$ does not exist (§4)
surplus value element of $K(\mathbf{Spc})$ requires virtual species
the state $S = 1 + \mathrm{Apparatus}(S)$ non-well-founded
withering away base case not supplied
national organization $E \circ E_+$ $B_n$ structures
the International assertion that $B_n = 1$ true for $n \le 1$
revisionism intermediate $H \leq S_n$ irreducible, not impure
the social question solvability of $S_n$ fails for $n \geq 5$

References

Bergeron, F., Labelle, G., and Leroux, P. (1998). Combinatorial Species and Tree-like Structures. Cambridge University Press.

Joyal, A. (1981). Une théorie combinatoire des séries formelles. Advances in Mathematics 42(1), 1–82.

Joyal, A. (1985). Règle des signes en algèbre combinatoire. Comptes Rendus Mathématiques 7(5), 285–290.

Marx, K., and Engels, F. (1848). Manifest der Kommunistischen Partei. London: Bildungs-Gesellschaft für Arbeiter.

Yeh, Y.-N. (1986). The calculus of virtual species and K-species. In Combinatoire Énumérative, Lecture Notes in Mathematics 1234, Springer, 351–369.


The author notes that a companion paper, "Capital Is Not a Monad," was abandoned when it became apparent that it is, and that this is the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment