Eindhoven · November 1971 · Dutch Television

ChomskyVERSUSFoucault

One believed in a human nature deep enough to ground justice. The other saw human nature as one more thing that power had written. This is a field guide to both minds — and the night they met.

Language·Power·Knowledge·The Self
Prologue

Two Men, One Question

In 1971 a Dutch philosopher put Noam Chomsky and Michel Foucault on the same stage and asked them a single question: is there such a thing as human nature? Everything they disagreed about grew from their answers.

The moderator, Fons Elders, wanted a fight, and he mostly got one — though a civil, dazzling one. On the surface the two men had a great deal in common. Both were on the political left. Both were about to become the most cited living authors in their respective fields. Both distrusted the institutions around them. Yet when Elders asked whether human beings share a fixed nature, the room split in two, and it never really came back together.

Chomsky said yes, emphatically. Under the endless variety of human languages and cultures, he argued, lies a common biological endowment — a mind built to a shared specification. That innate structure is not a cage; it is the very thing that makes creativity and freedom possible, and it gives us a place to stand when we judge a society as just or unjust.

Foucault said no, just as firmly — or rather, he refused the question's terms. Notions like "human nature," "justice," and "the human being" are not discoveries about biology, he suggested. They are ideas produced inside particular systems of power and knowledge, and they change as those systems change. To appeal to human nature against a regime is to fight it with a weapon the regime itself forged.

The real political task in a society such as ours is to criticize the working of institutions that appear to be both neutral and independent.— Foucault, during the 1971 debate

This guide takes that disagreement as its spine. The first half walks through Chomsky's world: generative grammar, the formal hierarchy of languages, the argument for an innate language faculty, and his later theory of how mass media manufactures consent. The second half enters Foucault's: power as a productive network rather than a possession, the disciplinary society and its panopticon, the historical epistemes that govern what can be thought, and his account of how the modern subject is made. A final chapter returns them to the stage.

Throughout, interactive widgets let you run the ideas yourself — derive a sentence from grammar rules, race a finite automaton against a language it cannot recognize, sweep a surveillance beam across a prison yard — and a set of GNU Octave labs turns the same concepts into runnable code. Where the mathematics matters, it is typeset properly. The two thinkers never fully reconciled; the point here is to understand each on his own terms well enough to see exactly where, and why, they part.

On the question of…Chomsky answersFoucault answers
Human natureA real, innate biological endowmentA concept produced by power/knowledge
Where to ground justiceIn that shared human natureNowhere fixed — justice is historical
What language revealsThe architecture of the mindThe discourse a society permits
What power isConcentrated, held by the fewDiffuse, productive, everywhere
The intellectual's taskSpeak truth, expose liesReveal how "truth" itself is made
Chomsky · I

The Generative Engine

A grammar is not a list of the sentences a language contains — there are infinitely many. It is a finite machine that generates them. That single reframing, from 1957, remade linguistics.

Before Chomsky, mainstream American linguistics was largely a science of cataloguing: collect utterances, sort them, describe the patterns. Chomsky's Syntactic Structures asked a different question. A native speaker can produce and understand sentences she has never heard before — an unbounded set — from finite experience and a finite brain. So the object of study cannot be the sentences themselves. It must be the generative system inside the speaker that produces them.

Generative Grammar

A finite set of rules that recursively specifies (generates) exactly the well-formed sentences of a language, and assigns each a structural description. Competence, not a corpus.

The simplest version is a set of phrase-structure rules — rewrite rules that expand one symbol into others. Start with the sentence symbol S and keep rewriting until only actual words remain. Each rule has the form "the thing on the left may be replaced by the things on the right."

$$S \rightarrow NP\;\; VP \qquad NP \rightarrow Det\;\; N \qquad VP \rightarrow V\;\; NP$$
A toy phrase-structure grammar. S = sentence, NP = noun phrase, VP = verb phrase, Det = determiner.

Because a rule like VP → V NP can reintroduce an NP, which may contain another clause, the system is recursive: a finite rule set generates infinitely many sentences of unbounded length. This is the formal heart of what Chomsky calls the creative aspect of language use. Run the engine below and watch a sentence build itself from the top symbol down.

Derivation EngineInteractive · rewrite rules

Each step replaces the leftmost non-terminal (a category like NP) using a grammar rule, until only words are left. Step through it, or let it run.

Press “Rewrite one symbol” to begin. Non-terminals are green; finished words are cream.

Deep structure and the transformation

Phrase-structure rules alone run into trouble. The active sentence "the scientist wrote the paper" and its passive "the paper was written by the scientist" clearly share a meaning, yet a flat phrase-structure grammar treats them as unrelated. Chomsky's answer was a second layer. Beneath the surface structure we actually say lies a deep structure that carries the core grammatical relations; transformations map one onto the other.

Deep structure

The underlying representation where "who did what to whom" is fixed. The active and passive share one deep structure — the same agent, action, and object.

Surface structure

What is actually pronounced. Transformations — move, insert, agree — reshape the deep structure into the spoken form, which is why one meaning can have several surfaces.

Toggle the tree below between the two. The words on the leaves stay meaningful the same way; the branches above them rearrange. This deep/surface distinction, later refined into the Government-and-Binding and Minimalist frameworks, is the machinery Chomsky uses to argue that syntax is autonomous — a formal system in its own right, not a byproduct of meaning or communication.

Syntax Tree ExplorerInteractive · deep vs surface

The same sentence, drawn as a constituency tree. Switch between the active deep structure and the passive surface structure, and hover a node to highlight the phrase it dominates.

Showing the active structure. Click a node.
Chomsky · II

The Formal Hierarchy

Chomsky's other gift to computer science: a ladder of grammars, each strictly more powerful than the last, and a precise account of the machine each one needs.

In 1956 Chomsky classified formal grammars into four nested types by the shape of their rules. The Chomsky hierarchy turned out to be foundational for computer science — it maps exactly onto the abstract machines that recognise each language class, and it underlies every compiler and regular-expression engine written since.

$$\text{Regular} \subsetneq \text{Context-Free} \subsetneq \text{Context-Sensitive} \subsetneq \text{Recursively Enumerable}$$
Each class is a strict subset of the next. More permissive rules → more expressive power → a more powerful machine required.
TypeGrammar classRecognising machineExample language
Type 3RegularFinite automaton$a^*b^*$ — any a's then any b's
Type 2Context-freePushdown automaton (stack)$a^n b^n$ — matched counts
Type 1Context-sensitiveLinear-bounded automaton$a^n b^n c^n$
Type 0UnrestrictedTuring machineAny computable language

The classic dividing line is the language $a^n b^n$ — strings like ab, aabb, aaabbb, where the number of a's must equal the number of b's. A finite automaton has no memory of how many a's it has seen — only a fixed set of states — so it provably cannot check the match. A pushdown automaton can: it pushes each a onto a stack and pops one per b. Race them below.

Automaton Race: aⁿbⁿInteractive · DFA vs PDA

Build a string and feed it to both machines. The finite automaton (no memory) tries to accept only balanced strings and fails; the stack machine succeeds. Watch the stack rise and fall.

Current string: (empty). Build a string like aabb, then run.

Where does human language sit on this ladder? Chomsky argued natural languages exceed the regular and even the pure context-free classes — English contains cross-serial and nested dependencies that a Type-3 grammar cannot capture. The consensus landed on mildly context-sensitive: more than context-free, far less than the full power of a Turing machine. The point for the human-nature debate is that the language faculty is not a general-purpose learner soaking up statistics. It is tuned to a specific, narrow region of the formal hierarchy — which is exactly what you would expect from a dedicated biological organ.

Chomsky · III

The Argument for Human Nature

If a grammar is this intricate, and children master it fast, uniformly, and on thin evidence — where does the knowledge come from? Chomsky's answer is the backbone of his side of the debate.

The engine that drives Chomsky's whole philosophy is an argument about learning, usually called the poverty of the stimulus. Children acquire their native language with astonishing speed and uniformity, converging on the same complex grammar, despite input that is finite, full of errors, and — crucially — lacking the negative evidence (explicit corrections of every possible mistake) that would be needed to learn it by generalisation alone. The data underdetermines the outcome. So something must be supplied from inside.

Universal Grammar

The innate set of structural principles common to all human languages — the initial state of the language faculty, present before any experience. Learning a specific language is setting a limited number of "parameters" on this shared frame.

Consider a concrete case. To form a yes/no question in English, you front an auxiliary verb: "the man is tall" → "is the man tall?" A child could hypothesise a simple rule — "move the first is to the front." That rule is structure-independent: it counts words linearly. It also happens to be wrong, and children never even try it. Faced with "the man who is tall is happy," the linear rule yields the ungibberish "is the man who tall is happy?" Children instead apply a structure-dependent rule that operates on the syntactic tree, moving the auxiliary of the main clause. They pick the structural rule without ever being taught it, because — Chomsky argues — the option of a linear rule is not in the innate menu at all.

A person's competence is a system of knowledge that has somehow developed in the mind. The evidence available to the child is consistent with countless grammars; that it settles on the right one tells us the mind was not a blank slate.— After Chomsky, on the poverty of the stimulus

This is where Chomsky meets Foucault head-on. For Chomsky the innate faculty is not only real; it is liberating. Because our creative capacity is grounded in a fixed human nature, there is a fact of the matter about what fulfils or frustrates human beings — and therefore a foothold for saying some social arrangements are more just than others. Take away human nature, he warned, and you take away the ground on which you might oppose oppression. Foucault's reply, as we will see, was that this "ground" is itself an artifact of power.

Chomsky · IV

Manufacturing Consent

Chomsky's politics and his linguistics share a shape: both look past surface behaviour for the hidden structure that generates it. In the media, that structure is a set of filters.

In Manufacturing Consent (1988), Chomsky and Edward Herman proposed a propaganda model of the mass media. Their claim is not that journalists take orders or conspire. It is structural: in a market system, news passes through a series of filters, and by the time a story reaches print, the filters have already selected for content that serves concentrated power — no directive required. The bias is an emergent property of the institutional design, exactly as a grammar's output is an emergent property of its rules.

The model names five filters through which raw events must pass before becoming news:

Run a stack of stories through the filters below and watch which survive. The model is deterministic in spirit: you don't need anyone to decide to suppress a story; each filter simply lowers its odds, and the product is a news agenda skewed without a censor.

The Filter MachineInteractive · propaganda model

Send a batch of stories down the chute. Toggle each filter on or off and see how many stories reach print — and which kind. No filter forbids a story outright; each just reduces its chance of passing.

All five filters active. Press “Send 40 stories”.

Notice the affinity with Foucault that Chomsky himself would resist. Both men describe power that works without a commander — a system that produces conforming outputs through its structure. But Chomsky keeps a firm distinction between the manufactured consensus and the truth it obscures; the intellectual's job is to pierce the illusion and state the facts. Foucault would question whether there is a filter-free "truth" waiting behind the discourse at all. That is the seam where the two halves of this guide meet.

Foucault · I

Power Without a Throne

Foucault's first move is to stop asking "who holds power?" and start asking "how does power work?" The answer dissolves the throne into a thousand small mechanisms.

For most of political thought, power is a thing you possess — the king has it, the state wields it, the ruling class hoards it. Foucault called this the juridico-discursive or "repressive" conception: power as a No, a law that forbids, a force that says stop. He thought it was almost useless for understanding modern societies. Power, in his analysis, is not held but exercised; it is not centred but dispersed; and above all it is not merely repressive but productive.

Power/Knowledge (pouvoir/savoir)

Power and knowledge are not opposed — the myth that truth flourishes only where power withdraws. They generate each other. Every exercise of power produces knowledge (records, examinations, categories); every body of knowledge opens new possibilities of control. There is no knowledge that is not at once a relation of power.

Consider what productive power means concretely. A prison does not merely lock people away; it produces a new object of knowledge — "the delinquent" — complete with case files, criminological theories, and statistics. A clinic produces "the patient" and the vast apparatus of medical knowledge. A school produces "the pupil," ranked and examined. In each case power does not repress a pre-existing subject; it brings the subject into being as something knowable and manageable. This is why Foucault refuses Chomsky's human nature: the very category of "the human being," as studied by the human sciences, is one of power's products.

Power is everywhere; not because it embraces everything, but because it comes from everywhere. Power is not an institution, nor a structure; it is the name one attributes to a complex strategical situation in a particular society.— Foucault, The History of Sexuality, Vol. 1

Because power comes from everywhere, so does resistance — it is woven into the same net, not launched at it from outside. And because power is a relation rather than a possession, you cannot seize it in a single revolutionary stroke and expect the relations to vanish; they will re-form. This is the bleak realism Chomsky pushed back on. If there is no outside to power, no untouched human nature, then — Chomsky asked — in the name of what do you resist at all? Foucault's answer was that you resist specific intolerable practices, here and now, without needing a universal foundation to license you.

Foucault · II

Discipline and the Panopticon

Foucault found the emblem of modern power in an unbuilt prison: a design where the mere possibility of being watched does the work that chains once did.

In Discipline and Punish (1975), Foucault traced a shift in how societies punish. The book opens with the gruesome public execution of a regicide in 1757 — power written on the body, spectacular and occasional — and sets it against a prison timetable from eighty years later: silent, total, continuous regulation of every hour. Between them lies the birth of disciplinary power, which does not seize the body to destroy it but trains it to be useful and obedient.

Its perfect diagram is Jeremy Bentham's Panopticon: a ring of cells around a central tower. From the tower a guard can see into every cell, but the inmates — backlit and isolated — cannot see whether the tower is occupied. Not knowing when they are watched, they must behave as if always watched. Surveillance becomes internalised; the prisoner becomes his own guard. The apparatus, Foucault noted with force, works even when the tower is empty.

Panopticism

The generalisation of the panoptic principle beyond prisons — into schools, factories, hospitals, armies, offices. A mode of power that individualises those it watches, makes them permanently visible, and induces in them a state of conscious, self-enforced discipline. Visibility is a trap.

Step into the tower below. Sweep the guard's line of sight and watch the cells respond: an inmate who might be seen behaves, whether or not the beam is actually on them. Then remove the guard entirely and notice that compliance barely changes — the whole point of the design. This is what Foucault means by power that is "automatic and disindividualised": it no longer needs a person to hold it.

The PanopticonInteractive · surveillance geometry

Drag the beam around the tower, or let it sweep. Cells that fall under possible observation self-regulate. Toggle the guard away to see that the effect persists — visibility, not the watcher, is what disciplines.

Drag inside the yard to aim the beam. Guard present.

The disciplines share a toolkit Foucault dissects in detail: hierarchical observation (architectures that make people seeable), normalising judgement (a continuous grading against a norm, so that the smallest deviation is noted and corrected), and the examination (which combines the two — the exam observes you and files the result, making you a documented case). Together they manufacture the modern individual: not a free agent that power then constrains, but an entity that disciplinary power itself produces, measures, and knows.

Foucault · III

Epistemes and the Order of Things

Beneath the ideas of any era, Foucault argued, lies a hidden grid that decides what can count as knowledge at all. When the grid shifts, whole ways of thinking become suddenly unthinkable.

Foucault's earlier, "archaeological" work — especially The Order of Things (1966) — hunts for something deeper than particular theories. He called it the episteme: the underlying system of a period that defines what questions are askable, what counts as evidence, what makes a statement true-or-false rather than simply meaningless. Two eras can use the same words and mean entirely different operations by them, because the grid beneath has moved.

Episteme

The historical a priori of an age: the tacit set of rules that governs what can be said and known within it. Not a worldview people hold, but the condition that makes their worldviews possible. Knowledge sits on top of it the way a sentence sits on top of a grammar.

His famous sketch runs across three broad Western epistemes. In the Renaissance, knowledge worked by resemblance: the world was a text of signatures, walnuts resembled and therefore healed the brain, everything mirrored everything. In the Classical age (roughly 1650–1800), resemblance gave way to representation and order: knowledge meant sorting things into tables and taxonomies, laying them out in a grid of identities and differences. Then, around 1800, came the Modern episteme, organised by history, depth, and the human being — biology, economics, and philology replaced the flat tables with hidden forces unfolding in time, and "Man" appeared for the first time as both the knower and the object known.

Slide through the three epistemes below. The same object — say, a living creature — is grasped in a wholly different way in each: a web of correspondences, then a slot in a table, then an organism with a history. That "Man" is a recent invention of the modern grid sets up Foucault's most quoted line, and his sharpest disagreement with Chomsky's timeless human nature.

Episteme SliderInteractive · the order of things

Move through three historical grids of knowledge. Watch how the same objects reorganise — from a web of resemblances, to a classifying table, to a depth of hidden forces and time.

Renaissance episteme: knowledge as resemblance.
Man is an invention of recent date. And one perhaps nearing its end… one can certainly wager that man would be erased, like a face drawn in sand at the edge of the sea.— Foucault, The Order of Things

Read against Chomsky, the provocation is exact. Where Chomsky finds a biological "Man" whose nature has held constant across all of history and grounds our claims to justice, Foucault finds a "Man" that appeared around 1800 as an effect of a particular episteme and may dissolve when that grid shifts. Neither was denying that humans are animals with brains. The fight was over whether the concept that anchors humanism is a bedrock discovery or a passing arrangement of thought.

Foucault · IV

Making the Subject

In his last works Foucault turned from how power acts on us to how we are led to act on ourselves — and, at the very end, to whether we might fashion ourselves otherwise.

The late Foucault shifts the question one more time. Discipline showed power shaping bodies from outside; his final project asked how individuals are enlisted to constitute themselves as subjects — how we come to monitor, confess, interpret, and govern our own desires. He mapped this across three axes: how we are made objects of knowledge, how we are sorted by power, and how we turn ourselves into ethical subjects through what he called technologies of the self.

The History of Sexuality supplies the key case. The modern West, Foucault argued, did not simply repress sex; it produced an endless, compulsory discourse about it — in confession, psychiatry, medicine, and law — and in doing so produced "sexuality" itself as the supposed hidden truth of the self. We were invited to believe that decoding our desire would reveal who we really are. That invitation, he suggests, is a technique of power dressed as self-discovery.

Technologies of the Self

The practices by which individuals work on their own bodies, thoughts, and conduct — to transform themselves toward some state of happiness, purity, or wisdom. Not simply imposed by power, but the site where subjects are actively formed, and therefore also the site where they might be reformed differently.

This is the note of freedom in a body of work often read as claustrophobic. If the self is made rather than given, then it is not fixed — and Foucault, mining ancient Greek and Roman ethics, floated the idea of an aesthetics of existence: treating one's life as a material to be shaped with care, a work of art rather than the obedient read-out of a nature. It is not Chomsky's freedom, which rests on a nature to be fulfilled. It is a freedom that comes precisely because there is no fixed nature to obey.

The Collision

Where They Break

Having heard each thinker in his own voice, put them back on the stage. On five questions they diverge — not by degree, but at the root. Flip each card to hear both replies.

The 1971 debate is often remembered for its final third, when Elders steered it toward politics and the gloves loosened. Chomsky laid out a vision of a just future society grounded in human nature; Foucault replied that "justice" is invented within each social order to serve its own ends, so appealing to it against the order is naïve. Chomsky later said Foucault was the most amoral person he had ever met; Foucault thought Chomsky dangerously idealistic. Yet each understood the other precisely — which is why the disagreement is worth preserving whole.

The Five Fault LinesInteractive · flip to compare

Click a card to turn it. The front poses the question; the back gives Chomsky's answer in green and Foucault's in crimson.

Not a winner, but a map

It would be a mistake to score the debate. The two men were not answering the same question with different data; they were disagreeing about which questions are legitimate. Chomsky works forward from a science of the mind toward an ethics grounded in nature. Foucault works backward from present institutions to expose the contingency of the very concepts — nature, justice, Man — that Chomsky treats as bedrock. Each method has a cost. Chomsky risks smuggling a particular culture's values into "human nature." Foucault risks leaving himself no firm ground from which to condemn anything at all, a charge he spent his later career wrestling with.

There is even a structural rhyme between them, which is why they share this guide. Both are anti-surface thinkers. Chomsky looks past the sentences we say to the generative grammar beneath; Foucault looks past the ideas we hold to the episteme beneath. Both describe systems that produce their outputs impersonally, without a mastermind — grammars and disciplines alike run on their own. The deep difference is what they think lies at the very bottom. For Chomsky it is human nature, fixed and enabling. For Foucault it is history all the way down, and "human nature" is just its most recent sediment.

Zipf's Law: Order in the WordsInteractive · a shared object, two readings

Word frequencies in any large text follow a startling regularity: the nth most common word appears about proportionally to 1/n. Chomsky sees performance data skimming a deeper competence; a Foucauldian sees the shape of a discourse. Generate a corpus and fit the law.

Rank–frequency on log–log axes. A straight line means Zipf's law holds.
$$f(r) \;\propto\; \frac{1}{r^{s}}, \qquad s \approx 1 \quad\Longrightarrow\quad \log f(r) = C - s\,\log r$$
Zipf's law: frequency $f$ of the word at rank $r$. On log–log axes it is a straight line of slope $-s$.
Appendix

The Octave Labs

Nine self-contained GNU Octave scripts turn the ideas above into runnable code. Paste any one into Octave (or MATLAB, with the plotting caveats noted) and run it. Every script was executed and verified in Octave 8.4.

The labs alternate between the two halves of the guide. The first six make Chomsky's formal claims concrete — the statistics of text, the limits of Markov models, the generative power of grammars, and the exact point where a finite automaton fails. The last three model Foucault's mechanisms — the arithmetic of the panopticon, institutions as a network of power, and the emergent skew of the propaganda filters. Together they show that "language" and "power" can both be handled with the same modest toolbox.

LAB 01Zipf's Law

Generate a synthetic corpus from a Zipfian distribution and recover the exponent by fitting the rank–frequency line on log–log axes. The order in words that both thinkers, in different ways, look past.

lab1_zipf.mGNU Octave
% Lab 1 — Zipf's law: does word frequency obey 1/r^s?
% Generate a synthetic corpus from a Zipfian distribution, then recover s.
1;

function w = zipf_sample(n, s, V)
  ranks = (1:V);
  p = ranks .^ (-s);
  p = p / sum(p);
  cdf = cumsum(p);
  w = zeros(1, n);
  r = rand(1, n);
  for i = 1:n
    w(i) = find(cdf >= r(i), 1, 'first');
  end
end

V = 1500; s_true = 1.07; N = 200000;
words = zipf_sample(N, s_true, V);

counts = accumarray(words(:), 1);
counts = sort(counts(counts > 0), 'descend');
rank = (1:numel(counts))';

% Fit log f = C - s log r on the informative middle range
lo = 2; hi = min(400, numel(counts));
x = log(rank(lo:hi)); y = log(counts(lo:hi));
A = [ones(numel(x),1), x];
coef = A \ y;
s_fit = -coef(2);

printf('True exponent s      : %.3f\n', s_true);
printf('Recovered exponent s : %.3f\n', s_fit);
printf('Vocabulary observed  : %d types\n', numel(counts));
printf('Most frequent word   : %d occurrences\n', counts(1));

figure('visible','off');
loglog(rank, counts, 'o', 'markersize', 3); hold on;
loglog(rank, exp(coef(1)) .* rank .^ (coef(2)), 'r-', 'linewidth', 2);
xlabel('rank r'); ylabel('frequency f'); title('Zipf rank-frequency');
legend('data', sprintf('fit s=%.2f', s_fit));
print('zipf.png', '-dpng');
disp('Wrote zipf.png');

Expected output · Recovered exponent s : 1.067 (true 1.070) — the law holds.

LAB 02Letter Entropy

Compute the Shannon entropy of English letters and the redundancy that makes text compressible — the quantitative face of linguistic structure.

lab2_entropy.mGNU Octave
% Lab 2 — Information content of English letters (Shannon entropy).
% How many bits does one letter carry? Compare to a uniform alphabet.
1;

% Approximate English letter frequencies (%), a-z
freq = [8.17 1.49 2.78 4.25 12.70 2.23 2.02 6.09 6.97 0.15 ...
        0.77 4.03 2.41 6.75 7.51 1.93 0.10 5.99 6.33 9.06 ...
        2.76 0.98 2.36 0.15 1.97 0.07];
p = freq / sum(freq);

H = -sum(p .* log2(p));               % entropy of English letters
Hmax = log2(26);                      % uniform alphabet
redundancy = 1 - H / Hmax;

printf('Entropy of English letters : %.3f bits/letter\n', H);
printf('Maximum (uniform 26)       : %.3f bits/letter\n', Hmax);
printf('Redundancy                 : %.1f%%\n', 100*redundancy);
printf('So ~%.1f%% of letter choices are predictable from the distribution alone.\n', 100*redundancy);

[ps, idx] = sort(p, 'descend');
letters = 'abcdefghijklmnopqrstuvwxyz';
printf('\nMost informative rare letters (high surprisal):\n');
surpr = -log2(p);
[ss, si] = sort(surpr, 'descend');
for k = 1:4
  printf('  %c : %.2f bits\n', letters(si(k)), ss(k));
end

Expected output · Entropy 4.176 bits/letter; redundancy 11.2%.

LAB 03A Markov Language Model

Build a first-order Markov chain over words and sample from it. Chomsky's 1957 argument in miniature: locally fluent, globally structureless — no stack, no real syntax.

lab3_markov.mGNU Octave
% Lab 3 — A finite-state (Markov) language model.
% Chomsky's 1957 point: n-gram/Markov chains are Type-3 and cannot capture
% real syntax. Here we build one anyway and watch it produce fluent nonsense.
1;

training = ['the child studies the grammar . ', ...
            'the grammar shapes the mind . ', ...
            'the mind knows the language . ', ...
            'the language shapes the child . ', ...
            'a child knows a language . '];

toks = strsplit(strtrim(training), ' ');
vocab = unique(toks);
V = numel(vocab);
idx = containers.Map(vocab, num2cell(1:V));

% First-order transition counts
T = zeros(V, V);
for i = 1:numel(toks)-1
  a = idx(toks{i}); b = idx(toks{i+1});
  T(a,b) = T(a,b) + 1;
end
% Row-normalise to probabilities
row = sum(T,2); row(row==0) = 1;
P = T ./ row;

printf('Vocabulary (%d types): %s\n', V, strjoin(vocab, ' '));

% Generate 3 sentences by sampling the chain
rand('seed', 7);
for s = 1:3
  cur = idx('the');
  out = {vocab{cur}};
  for step = 1:9
    r = rand; c = cumsum(P(cur,:)); nxt = find(c >= r, 1, 'first');
    if isempty(nxt), break; end
    out{end+1} = vocab{nxt};
    if strcmp(vocab{nxt}, '.'), break; end
    cur = nxt;
  end
  printf('  gen %d: %s\n', s, strjoin(out, ' '));
end
printf('\nFluent locally, structureless globally: the chain has no stack,\n');
printf('so it can never enforce long-range agreement or nesting.\n');

Expected output · gen: the child . / the grammar . / the language .

LAB 04A Context-Free Generator

Recursively expand the start symbol with phrase-structure rules. A finite rule set, an infinite language — the generative engine of Chapter I made runnable.

lab4_cfg.mGNU Octave
% Lab 4 — A context-free grammar as a generative engine.
% Recursively expand S using phrase-structure rules. Recursion (VP -> V NP,
% NP -> Det N PP...) yields unboundedly long grammatical sentences.
1;

function s = expand(sym, depth)
  rules = struct();
  rules.S   = {{'NP','VP'}};
  rules.NP  = {{'Det','N'}, {'Det','N','PP'}};
  rules.VP  = {{'V','NP'}, {'V','NP','PP'}};
  rules.PP  = {{'P','NP'}};
  rules.Det = {{'the'},{'a'}};
  rules.N   = {{'linguist'},{'philosopher'},{'grammar'},{'prison'},{'idea'}};
  rules.V   = {{'studies'},{'watches'},{'shapes'},{'describes'}};
  rules.P   = {{'in'},{'of'},{'near'}};

  if ~isfield(rules, sym)
    s = sym; return;            % terminal
  end
  opts = rules.(sym);
  % Discourage deep recursion so strings terminate
  if depth > 4
    choice = opts{1};
  else
    choice = opts{randi(numel(opts))};
  end
  parts = {};
  for i = 1:numel(choice)
    parts{end+1} = expand(choice{i}, depth+1);
  end
  s = strtrim(strjoin(parts, ' '));
end

rand('seed', 3); randn('seed', 3);
printf('Sentences generated by the CFG:\n');
for k = 1:6
  printf('  %s\n', expand('S', 0));
end
printf('\nEach is grammatical; the rule set is finite but the language is infinite.\n');

Expected output · the prison watches a idea of the linguist in the linguist…

LAB 05The CYK Parser

Decide membership in a context-free language by dynamic programming over a triangular chart. Accepts grammatical strings, rejects word-salad.

lab5_cyk.mGNU Octave
% Lab 5 — The CYK parser: decide if a string is generated by a CFG.
% Grammar in Chomsky Normal Form. Dynamic programming fills a triangular
% table; if S reaches the top cell, the string is in the language.
1;

function s = ternary(c, a, b)
  if c, s = a; else s = b; end
end

function ok = cyk(sentence, bin, lex)
  w = strsplit(strtrim(sentence), ' ');
  n = numel(w);
  table = cell(n, n);       % table{i,len} = symbols spanning w(i..i+len-1)
  for i = 1:n
    S = {};
    for r = 1:size(lex,1)
      if strcmp(lex{r,2}, w{i}), S{end+1} = lex{r,1}; end
    end
    table{i,1} = unique(S);
  end
  for len = 2:n
    for i = 1:n-len+1
      found = {};
      for split = 1:len-1
        left = table{i, split};
        right = table{i+split, len-split};
        for r = 1:size(bin,1)
          if any(strcmp(left, bin{r,2})) && any(strcmp(right, bin{r,3}))
            found{end+1} = bin{r,1};
          end
        end
      end
      table{i,len} = unique(found);
    end
  end
  ok = any(strcmp(table{1,n}, 'S'));
end

% S -> NP VP ;  NP -> Det N ;  VP -> V NP ;  plus lexicon
bin = { 'S','NP','VP'; 'NP','Det','N'; 'VP','V','NP' };
lex = { 'Det','the'; 'Det','a'; 'N','linguist'; 'N','grammar'; ...
        'V','studies'; 'V','shapes' };

tests = { 'the linguist studies the grammar', ...
          'the grammar shapes a linguist', ...
          'linguist the studies grammar', ...
          'the studies grammar' };
for t = 1:numel(tests)
  res = cyk(tests{t}, bin, lex);
  printf('  [%s]  "%s"\n', ternary(res,'ACCEPT','REJECT'), tests{t});
end

Expected output · [ACCEPT] the linguist studies the grammar / [REJECT] linguist the studies grammar

LAB 06DFA vs PDA on aⁿbⁿ

The formal heart of the hierarchy: a finite-memory machine provably fails on balanced strings once they exceed its states, while a stack machine never does.

lab6_anbn.mGNU Octave
% Lab 6 — Why a finite automaton cannot recognise a^n b^n.
% Simulate a DFA (fixed states, no memory) and a PDA (a stack).
% The DFA must fail on some balanced string; the PDA succeeds on all.
1;

function s = tf(x)
  if x, s = 'accept'; else s = 'REJECT'; end
end

function ok = dfa_anbn(s, maxstate)
  % A DFA can only "count" up to maxstate a's, then saturates -> errors.
  na = 0; seen_b = false; ok = true;
  for i = 1:numel(s)
    c = s(i);
    if c == 'a'
      if seen_b, ok = false; return; end   % a after b: reject
      na = min(na + 1, maxstate);           % saturating counter = finite memory
    elseif c == 'b'
      seen_b = true;
      if na == 0, ok = false; return; end
      na = na - 1;
    end
  end
  ok = (na == 0);
end

function ok = pda_anbn(s)
  stack = 0;                                 % unbounded counter = stack
  phase_b = false;
  for i = 1:numel(s)
    if s(i) == 'a'
      if phase_b, ok = false; return; end
      stack = stack + 1;
    else
      phase_b = true;
      stack = stack - 1;
      if stack < 0, ok = false; return; end
    end
  end
  ok = (stack == 0);
end

maxstate = 5;   % the DFA can only remember up to 5 a's
printf('  n |  string        | DFA(mem=%d) | PDA(stack)\n', maxstate);
printf(' ---+----------------+------------+-----------\n');
for n = 1:8
  s = [repmat('a',1,n), repmat('b',1,n)];
  d = dfa_anbn(s, maxstate);
  p = pda_anbn(s);
  printf('  %d | %-14s |    %-7s |   %s\n', n, s, tf(d), tf(p));
end
printf('\nThe DFA breaks once n exceeds its finite memory; the PDA never does.\n');
printf('This is the formal core of "language needs more than a Markov chain."\n');

Expected output · DFA fails at n=6; PDA accepts every n.

LAB 07Panopticon Geometry

Model cells on a ring and Monte-Carlo the compliance that follows from *possible* observation. Compliance far exceeds actual watching — the tower can be empty.

lab7_panopticon.mGNU Octave
% Lab 7 — Panopticon geometry and the economy of surveillance.
% Model cells on a ring around a central tower. A guard sees a cell only
% within a viewing arc, but inmates don't know when. Monte-Carlo the
% compliance that results from *possible* observation.
1;

Ncells = 24;
theta = linspace(0, 2*pi, Ncells+1); theta(end) = [];
% Guard sweeps; at any instant sees a wedge of half-width phi
phi = pi/8;

% Probability a cell is actually observed at a random instant = arc / 2pi
p_observed = (2*phi) / (2*pi);
printf('Cells on the ring          : %d\n', Ncells);
printf('Guard field of view        : %.0f degrees\n', 2*phi*180/pi);
printf('Chance any cell is watched  : %.3f at a random instant\n', p_observed);

% Behavioural model: an inmate complies if watched (certain), OR, not knowing,
% complies with self-discipline probability d because it *might* be watched.
d = 0.85;                 % internalised discipline
trials = 200000;
watched = rand(trials,1) < p_observed;
comply  = watched | (rand(trials,1) < d);
printf('\nActual observation rate    : %.1f%%\n', 100*mean(watched));
printf('Overall compliance rate    : %.1f%%\n', 100*mean(comply));
printf('Compliance with EMPTY tower: %.1f%%  (d alone)\n', 100*d);
printf('\nCompliance far exceeds observation: the mechanism works\n');
printf('because inmates internalise the gaze. The tower can be empty.\n');

figure('visible','off');
x = cos(theta); y = sin(theta);
plot(x, y, 'o', 'markersize', 8); hold on;
plot(0,0,'ks','markersize',12,'markerfacecolor','k');
for k=1:Ncells, line([0 x(k)],[0 y(k)],'color',[.8 .8 .8]); end
axis equal off; title('Panopticon ring');
print('panopticon.png','-dpng');
disp('Wrote panopticon.png');

Expected output · Observation 12.4%, compliance 86.9%, empty-tower compliance 85.0%.

LAB 08Institutions as a Power Network

Represent disciplinary institutions as a graph and compute eigenvector centrality. Power concentrates through dense connection, not decree — Foucault's diffuse, relational power.

lab8_network.mGNU Octave
% Lab 8 — Disciplinary institutions as a network of power.
% Foucault: power is not a point but a web. Model institutions as nodes and
% compute eigenvector centrality -- which node's influence is most reinforced
% by connection to other influential nodes (power that comes "from everywhere").
1;

nodes = {'Prison','School','Clinic','Factory','Army','Family','Media'};
n = numel(nodes);
% Adjacency: shared disciplinary techniques / flows of individuals & norms
A = [0 1 1 1 1 0 0;   % Prison
     1 0 1 1 1 1 1;   % School
     1 1 0 1 0 1 1;   % Clinic
     1 1 1 0 1 0 1;   % Factory
     1 1 0 1 0 1 0;   % Army
     0 1 1 0 1 0 1;   % Family
     0 1 1 1 0 1 0];  % Media
A = (A + A')>0;        % symmetric

% Eigenvector centrality = principal eigenvector of A
[V, D] = eig(double(A));
[~, k] = max(diag(D));
c = abs(V(:,k)); c = c / sum(c);

deg = sum(A,2);
[cs, order] = sort(c, 'descend');
printf('Institution centrality (eigenvector):\n');
printf('  %-9s | degree | centrality\n', 'node');
printf('  ----------+--------+-----------\n');
for i = 1:n
  j = order(i);
  printf('  %-9s |   %d    |  %.3f\n', nodes{j}, deg(j), c(j));
end
printf('\nMost central: %s. Power concentrates not by decree but by how\n', nodes{order(1)});
printf('densely a node is woven into the others -- diffuse, relational power.\n');

Expected output · Most central node: School (0.177).

LAB 09The Propaganda Filters

Push thousands of stories through five probabilistic filters. No filter censors outright, yet the surviving agenda is systematically friendlier — bias as an emergent property.

lab9_filter.mGNU Octave
% Lab 9 — Simulating the propaganda model's five filters.
% Each story has a "power-friendliness" score. Each active filter passes a
% story with probability rising in that score. No filter censors outright;
% the aggregate still skews the surviving agenda -- structure, not conspiracy.
1;

rand('seed', 11);
Nstories = 5000;
% friendliness in [-1,1]: -1 challenges power, +1 flatters it
friend = 2*rand(Nstories,1) - 1;

filters_on = [1 1 1 1 1];      % ownership, advertising, sourcing, flak, enemy
weights    = [0.9 0.8 1.0 0.7 0.9];

function p = pass_prob(f, w)
  % logistic: friendly stories pass easily, hostile ones rarely
  p = 1 ./ (1 + exp(-4*w.*f));
end

survive = true(Nstories,1);
for k = 1:5
  if filters_on(k)
    p = pass_prob(friend, weights(k));
    survive = survive & (rand(Nstories,1) < p);
  end
end

printf('Stories submitted        : %d\n', Nstories);
printf('Stories that reach print : %d (%.1f%%)\n', sum(survive), 100*mean(survive));
printf('Mean friendliness IN     : %+.3f\n', mean(friend));
printf('Mean friendliness PRINTED: %+.3f\n', mean(friend(survive)));
printf('\nThe printed agenda is systematically friendlier than the input,\n');
printf('though no single filter forbade a hostile story. Bias is emergent.\n');

% Compare: turn OFF ownership+advertising
filters_on2 = [0 0 1 1 1];
survive2 = true(Nstories,1);
for k = 1:5
  if filters_on2(k)
    survive2 = survive2 & (rand(Nstories,1) < pass_prob(friend, weights(k)));
  end
end
printf('\nWith ownership+advertising OFF:\n');
printf('  printed friendliness    : %+.3f (%.1f%% pass)\n', ...
       mean(friend(survive2)), 100*mean(survive2));

Expected output · Input friendliness −0.01 → printed +0.67.