Skip to content
Session 04 / 08· Direct it precisely

Thinking Like a Computer II — Abstraction & Algorithm Design

Precision and procedure: strip a request to what matters, then give the model an ordered procedure and make it show its working.

90 minutes60 taught + 30 hands-onDirect the machineLive experimentYour laptop · hands-on

The hook

Write instructions for making a sandwich so literally that a machine could follow them, and you discover how much of what you “said” you never said at all. A model can only follow the procedure you actually gave it — and it will follow a broken one with perfect confidence.

What you'll be able to do

  • Abstract a request down to what actually matters — the prompt equivalent of extracting the ratio from a judgment — and write a precise specification: role, task, context, constraints, format.
  • Design an algorithm for the model: a precise, ordered procedure, the way a legal test is applied step by step.
  • Use chain-of-thought prompting and explain why visible working is checkable working — the property that matters most to a lawyer.
  • Apply iteration discipline: explore prompt variants deliberately, then commit to the winner.

On the syllabus

  • Abstraction: stripping a request to what actually matters
  • The specification template — role, task, context, constraints, format
  • Algorithm design: giving a model a precise, ordered procedure
  • Chain-of-thought prompting, and why visible working is checkable working
  • Iteration discipline: explore variants, then exploit the winner

In short

Session 4 completes the four pillars. Abstraction is the discipline of leaving things out: a good prompt states the role, the task, the context, the constraints and the format, and nothing else — the same move as stripping a judgment to the principle that binds. Algorithm design is the discipline of order: give the model a procedure — apply this test, in these steps — and ask it to show its working, so that each link in the reasoning can be interrogated instead of trusted on confidence. The hour closes on iteration discipline, and the hands-on half hour continues the portfolio with a specification prompt and IRAC-as-procedure.

Why it matters for using AI well

Specify precisely, give the model a procedure, and make it show its working. The reward is not prettier output; it is output whose every step you can see and check — which is the only kind a lawyer can responsibly rely on, and the only kind that survives a question from the bench.

What they leave with

The skill

Write a specification rather than a request, hand the model the procedure, and verify the working rather than the conclusion.

The insight

Everything you leave unsaid, the model fills in with the statistically average assumption — which is almost never your client's situation.

The moment they remember

The sandwich algorithm. The room dictates step-by-step instructions for making a sandwich and the presenter executes them with perfect, malicious literalness — the knife goes into the sealed bread bag, the jam goes on the table. It collapses within three steps, to genuine laughter. The delight is that the laughter is the lesson: every failure was an instruction that assumed judgment the executor did not have, and thirty seconds later the same failure is on screen in a prompt with a legal task attached.

In this session

  • 01

    Abstraction is extracting the ratio: stripping a judgment down to the principle that binds is the lawyer's version of abstracting the essential from the noise. A prompt is an act of abstraction too — vague prompts invite vague, padded or fabricated answers, while a precise specification (role + task + context + constraints + format) invites a checkable one.

  • 02

    The literal machine: a model has no access to what you meant, only to what you wrote. The classic algorithm exercise — instructions for a sandwich, executed with malicious literalness — is run on the presenter, and then the same lesson lands on a prompt, where it stops being funny.

  • 03

    Algorithm design is applying a legal test: walking a multi-part test step by ordered step is an algorithm — a procedure that yields a result the same way every time. Give the model the procedure (IRAC; the elements of the tort; the limbs of the statutory test) rather than hoping it infers one.

  • 04

    Chain-of-thought: asking a model to reason step by step measurably changes outcomes on reasoning tasks and — far more importantly for a lawyer — it exposes the reasoning. Visible working is working you can check; a bare conclusion is a statement you must take on trust, and Session 1 already told you what to do with those.

  • 05

    Iteration discipline: explore several prompt variants, then exploit the winner — the explore-exploit idea, and the 37% rule, from Algorithms to Live By. Prompt selection should be a deliberate search rather than a single lucky shot.

  • 06

    The pillars, assembled: decomposition, pattern recognition, abstraction and algorithm design are what separate structured, traceable, verifiable output from fluent text that hides its errors. Every technique in Sessions 3 and 4 serves one end — output you can verify.

The four-step mirror

Run it on the class. Then on the machine.

An experiment on the room, the same effect explained in the model, a live demonstration on a real chatbot, and a named takeaway skill.

The literal machine — the sandwich algorithm

On the class

The room dictates step-by-step instructions for making a sandwich; the presenter follows them with perfect, malicious literalness. It goes wrong within three steps, to laughter — and every failure is an instruction that assumed judgment the executor did not have.

In the model

A language model executes the procedure you actually wrote, not the one you meant. Missing steps, unstated constraints and ambiguous order produce confident, wrong output.

Live chatbot

The presenter gives a chatbot a loosely worded legal procedure, then a precisely ordered one, and compares what each produces.

The skill

Give the model a precise, ordered procedure. If a step lives only in your head, it does not exist.

Show your working — the chain-of-thought face-off

On the class

The room is given a tricky legal issue and votes on whether a bare “give me the answer” prompt will get it right.

In the model

Asking the model to reason step by step — IRAC as a prompt — changes the answer on reasoning tasks and, crucially, makes the reasoning visible so each link and each cited authority can be checked.

Live chatbot

The presenter prompts the chatbot plainly, then with “apply IRAC and reason step by step, showing your working,” and compares how much of the reasoning is now exposed for checking.

The skill

Make the model show its reasoning. Verify the working, not just the conclusion.

Vague vs. specified — the abstraction test

On the class

Two prompts for the same task go up on screen: one conversational and complete-sounding, one a bare specification (role, task, context, constraints, format). The room votes on which will produce the more usable output.

In the model

Everything a specification leaves out, the model fills in with the statistically average assumption — which is rarely your client's situation.

Live chatbot

Both prompts run; the specified one comes back tighter, in the right format, and with fewer invented details.

The skill

Strip the request to what actually matters, and then say all of it. Abstraction is the prompt-craft of leaving nothing to be guessed.

Hands-on · on your own laptop

Legal Prompt Portfolio II — specify and proceduralise

Continue the portfolio. Write a full specification prompt for a real legal task and compare it against a conversational version; then take a tricky issue, prompt with IRAC-as-procedure plus “show your working,” and check each step of the reasoning rather than the conclusion. Close by exploring three variants of one prompt and recording why the winner won.

Run of show · 30 minutes

  1. 0–10 min — Write a full specification prompt (role, task, context, constraints, format) for a real legal task; run it alongside a conversational version of the same ask and compare.
  2. 10–20 min — Take a tricky legal issue. Prompt with IRAC as the procedure plus “reason step by step, showing your working,” then check each step against your own analysis and mark the first step you disagree with.
  3. 20–28 min — Explore three variants of one prompt, commit to a winner, and record in one line why it won.
  4. 28–30 min — One student's before-and-after goes on the projector for the room to critique.

Deliverable

Two further portfolio entries plus an iteration log: prompts, outputs, the critique of each, and which steps of the chain-of-thought you verified and how. Feeds the Legal Prompt Portfolio in the recommended assessment scheme.

Key sources & cases

  • Jeannette Wing, “Computational Thinking,” CACM 49(3) (2006)

    Abstraction and algorithmic thinking as the heart of computational thinking.

  • Brian Christian & Tom Griffiths, Algorithms to Live By (2016)

    Source of the explore-exploit idea and the 37% rule used for iteration discipline: explore prompt variants, then exploit the winner.

  • Seymour Papert, Mindstorms (1980)

    Debugging as a way of thinking — the habit of finding exactly which instruction went wrong.

  • Legal-prompting practice notes

    The specification template (role + task + context + constraints + format) and IRAC-as-prompt.

Readings

  • Jeannette Wing, “Computational Thinking,” CACM 49(3) (2006)
  • Brian Christian & Tom Griffiths, Algorithms to Live By (2016) — explore/exploit and the 37% rule
  • Seymour Papert, Mindstorms (1980)
  • Legal-prompting practice notes (specification template; IRAC-as-prompt)

Next session

Session 05 / 08

Truth, Provenance and Synthetic Evidence

Verify what you see

Sixteen hours, one professional discipline.

Using AI well is not a knack — it is competence, candour and verification, practised until they are habits you could defend in court.