Nexus Learn

Lecture 3: Turing Machine and the Turing Test

Lecture Notes CS-511 Artificial Intelligence 12 min read Updated 8 Nov 2026

↓ Download notes (Word)

On this page
  1. Learning Outcomes
  2. 1. The Turing Machine
  3. 2. Tracing Turing Machines
  4. 3. What Turing Machines Tell Us
  5. 4. The Turing Test
  6. 5. Can Machines Really Think?
  7. 6. Common Mistakes
  8. Word Bank
  9. Summary
  10. Self-Check Questions

Learning Outcomes

SLO

After this lecture you will be able to...

CLO

Bloom

SLO 3.1

Describe the parts of a Turing machine: tape, head, states and transition rules

CLO1

C1 Remember

SLO 3.2

Trace a simple Turing machine on an input, step by step, and give its output

CLO1

C2 Understand

SLO 3.3

Explain the Church-Turing thesis and the halting problem in simple words

CLO1

C2 Understand

SLO 3.4

Explain the Turing Test, the total Turing Test and CAPTCHA, with their history

CLO1

C2 Understand

SLO 3.5

Explain the Chinese Room argument and the main weaknesses of the Turing Test

CLO1

C2 Understand

1. The Turing Machine

§1.1 Why Turing invented it

Slide L03-S06

In 1936 the word 'computer' meant a person who did calculations with paper and pencil by following fixed rules. Alan Turing asked: what exactly can be computed by following simple rules, one step at a time? In his paper "On Computable Numbers" (1936) he described an imaginary machine that does what such a person does. It is a model (a thought experiment), not a real machine - but no real computer can compute anything that a Turing machine cannot; real computers are only faster.

§1.2 The four parts

Slide L03-S07

Part

What it is

Analogy (cashier)

Tape

An unlimited strip of cells; each cell holds one symbol (0, 1, +, or blank ␣)

A very long receipt roll

Head

Reads the symbol in one cell, writes a symbol, then moves one cell Left (L), Right (R) or Stays (S)

A finger and a pen on one line

States

The machine's 'state of mind': q0 (start), q1, q2 ... and HALT (stop)

What job the cashier is doing now

Transition rules

The program: (state, symbol read) → (symbol to write, move, next state)

The rule card

Read a rule as a sentence: (q0, 0) → (1, R, q0) means "If I am in state q0 and I read 0, I write 1, move one cell right, and stay in state q0."

2. Tracing Turing Machines

§2.1 Machine 1: the bit flipper

Slide L03-S08 to S09

State

Reads

Writes

Moves

Next state

q0

0

1

R

q0

q0

1

0

R

q0

q0

␣

␣

S

HALT

Trace on input 1011 (head starts on the first symbol). 'Tape before' is the tape when the head arrives at that step.

Step

State

Head at cell

Reads

Tape before

Action

0

q0

0

1

1011

write 0, move R, q0

1

q0

1

0

0011

write 1, move R, q0

2

q0

2

1

0111

write 0, move R, q0

3

q0

3

1

0101

write 0, move R, q0

4

q0

4

␣

0100␣

write ␣, stay, HALT

Output: 0100. Every bit is flipped.

§2.2 Machine 2: add 1 to a binary number

Slide L03-S10

This copies how you add 1 by hand: go to the rightmost digit; 1 + 1 = 0 with a carry, so keep moving left; when you meet a 0 (or the empty cell in front), write 1 and stop. State q0 walks to the end; state q1 adds the carry.

State

Reads

Writes

Moves

Next

Meaning

q0

0

0

R

q0

walk right over the number

q0

1

1

R

q0

walk right over the number

q0

␣

␣

L

q1

end found → step back to the last digit

q1

1

0

L

q1

1 + 1 = 0, carry 1 to the left

q1

0

1

S

HALT

0 + 1 = 1, done

q1

␣

1

S

HALT

carry went past the front → write 1

§2.3 Worked trace: 1011 + 1

Slide L03-S11

Step

State

Cell

Reads

Tape before

Action

0

q0

0

1

1011

write 1, R, q0

1

q0

1

0

1011

write 0, R, q0

2

q0

2

1

1011

write 1, R, q0

3

q0

3

1

1011

write 1, R, q0

4

q0

4

␣

1011␣

write ␣, L, q1

5

q1

3

1

1011␣

write 0, L, q1

6

q1

2

1

1010␣

write 0, L, q1

7

q1

1

0

1000␣

write 1, S, HALT

Output: 1100 (eleven + 1 = twelve). 8 steps (0 to 7).

Second example: on input 111 (seven) the carry runs past the first digit. In state q1 the head reads the blank in front (cell -1) and writes 1, giving 1000 (eight).

§2.4 How to answer a trace question in the exam

Slide L03-S11

  • Copy the rule table. Write the start tape and mark the head (usually on the first symbol, state q0).
  • For each step write: step number, state, head cell, symbol read, and the action from the rule table.
  • Update the tape after every write. Move the head exactly ONE cell.
  • Stop when the state becomes HALT. Write the final tape clearly.

§2.5 Try it in Python

Slide Optional - links to Practical 1

This short program (verified - the output below is its real run) simulates Machine 2. Change the rules and the input tape to test your homework.

# A tiny Turing machine simulator (try it at home in Python)

rules = { # (state, read): (write, move, next state) -- Machine 2: add 1 to a binary number

("q0", "0"): ("0", "R", "q0"), ("q0", "1"): ("1", "R", "q0"), ("q0", "_"): ("_", "L", "q1"),

("q1", "1"): ("0", "L", "q1"), ("q1", "0"): ("1", "S", "HALT"), ("q1", "_"): ("1", "S", "HALT"),

}

tape = dict(enumerate("1011")) # cell number -> symbol

state, head, step = "q0", 0, 0

while state != "HALT":

read = tape.get(head, "_")

write, move, new = rules[(state, read)]

print(f"step {step}: {state} reads {read} -> write {write}, move {move}, go {new}")

tape[head] = write

head += {"R": 1, "L": -1, "S": 0}[move]

state, step = new, step + 1

print("final tape:", "".join(tape[i] for i in sorted(tape)).strip("_"))

step 0: q0 reads 1 -> write 1, move R, go q0

step 1: q0 reads 0 -> write 0, move R, go q0

step 2: q0 reads 1 -> write 1, move R, go q0

step 3: q0 reads 1 -> write 1, move R, go q0

step 4: q0 reads _ -> write _, move L, go q1

step 5: q1 reads 1 -> write 0, move L, go q1

step 6: q1 reads 1 -> write 0, move L, go q1

step 7: q1 reads 0 -> write 1, move S, go HALT

final tape: 1100

3. What Turing Machines Tell Us

§3.1 Church-Turing thesis and the universal machine

Slide L03-S12

Church-Turing thesis: anything that can be computed by an algorithm (a step-by-step method) can be computed by a Turing machine. It is called a thesis (a strongly believed claim) because it cannot be proved like a theorem. Alonzo Church reached the same idea by a different method in 1936.

Universal Turing machine: one machine that reads the rule table of ANOTHER machine from its tape and runs it. This is the idea of the stored-program computer: your phone is one piece of hardware that runs thousands of apps. Languages such as Python and C++ are Turing complete - they can compute anything a Turing machine can.

§3.2 A limit: the halting problem

Slide L03-S13

The halting problem asks: can one program look at ANY program and its input and say correctly whether it will stop or run forever? Turing proved (1936) that the answer is NO. Idea: if a perfect checker H existed, we could build a program that asks H about itself and then does the opposite of H's answer, so H would be wrong. Problems like this are called undecidable. Everyday link: Windows shows 'Not responding' and asks you to wait or close, because it cannot know whether the program will recover.

4. The Turing Test

§4.1 The imitation game

Slide L03-S15

In "Computing Machinery and Intelligence" (journal Mind, 1950) Turing replaced the vague question "Can machines think?" with a game. A human judge (interrogator, C) types questions to two hidden players: a human (B) and a machine (A). Communication is by text only. After a short conversation the judge must say which is the machine. If the judge cannot reliably tell, the machine passes. Turing predicted that by about the year 2000, after five minutes of questioning, an average judge would have no more than a 70% chance of identifying the machine correctly.

§4.2 Abilities needed and the total Turing Test

Slide L03-S16

Ability

Meaning

Needed for

Natural language processing

Understand and write a human language

Standard and total test

Knowledge representation

Store what it knows or is told

Standard and total test

Automated reasoning

Use knowledge to answer and draw conclusions

Standard and total test

Machine learning

Adapt to new situations and find patterns

Standard and total test

Computer vision

See and recognise objects (video signal)

Total test only

Robotics

Handle and move physical objects

Total test only

§4.3 The Turing Test in practice

Slide L03-S17

Year

Event

1966

ELIZA chatbot: simple pattern rules; some users believed it understood them.

1991-2019

Loebner Prize: a yearly Turing Test contest; no machine won the gold prize.

2014

Eugene Goostman, posing as a 13-year-old Ukrainian boy, fooled 33% of judges in 5-minute chats - criticised as a trick.

2025

Researchers at UC San Diego ran a three-party test: GPT-4.5, told to play a shy young person, was judged to be the human 73% of the time.

§4.4 CAPTCHA: a reverse Turing test

Slide L03-S18

CAPTCHA stands for Completely Automated Public Turing test to tell Computers and Humans Apart (2003). Here the judge is a computer and the one being tested is YOU. Examples: twisted letters, 'select all traffic lights', the 'I'm not a robot' box on bank and admission websites. Its purpose is to block bots that make fake accounts, send spam or buy all the tickets. Modern AI can solve many picture CAPTCHAs, so websites also check mouse movement and behaviour.

5. Can Machines Really Think?

§5.1 The Chinese Room (John Searle, 1980)

Slide L03-S20

A man who knows no Chinese sits in a closed room with a large rule book written in English. Questions in Chinese come in through a slot. He matches the symbols in the book, which tells him which Chinese symbols to send back. People outside receive perfect Chinese answers and think someone inside understands Chinese - but the man understands nothing.

Word

Meaning

Syntax

The form of symbols and the rules for arranging them

Semantics

The meaning of the symbols

Searle's conclusion: a computer only manipulates symbols (syntax) without understanding their meaning (semantics). So passing the Turing Test does not prove understanding.

§5.2 Replies and weaknesses

Slide L03-S21

  • Systems reply: the man alone does not understand, but the whole system (man + book + room) might - just as one brain cell does not understand Urdu but the whole brain does.
  • Searle's answer: let the man memorise the whole book; he still does not understand Chinese.

Weakness of the Turing Test

Example

It tests fooling (deception), not intelligence

Eugene Goostman's excuses as a 13-year-old

Short tests can be passed with tricks

Five minutes is not enough to find the gaps

Humans can fail it

A shy person or a non-native English speaker

It ignores non-human intelligence

A chess engine is very capable but cannot chat

This is why this course measures AI by rational behaviour (agents, Lecture 4) rather than by fooling people.

6. Common Mistakes

Slide L03-S23

Wrong idea

Correct idea

A Turing machine is a real, physical computer.

It is an imaginary model of computing (1936).

The tape is short, like RAM.

The tape is unlimited in both directions.

The head can jump to any cell.

The head moves only one cell at a time: L, R or S.

Passing the Turing Test proves a machine thinks.

It shows it can imitate human chat; imitation ≠ understanding.

CAPTCHA tests computers' intelligence.

In CAPTCHA the computer is the judge and tests whether you are human.

Word Bank

Word

Simple meaning

Example

Model

A simplified imaginary design used to study something

Turing machine = model of computing

Transition rule

Instruction: in this state, on this symbol, do this

(q1, 1) → (0, L, q1)

Halt

Stop running

State HALT

Algorithm

A step-by-step method to solve a problem

Long addition by hand

Thesis

A strongly believed claim that is not formally proved

Church-Turing thesis

Undecidable

No algorithm can ever solve it for all inputs

Halting problem

Interrogator

The person who asks questions; the judge

Judge C in the imitation game

Syntax / semantics

Form of symbols / meaning of symbols

Chinese Room

Unary

Writing a number with only 1s

3 = 111

Summary

  • A Turing machine has a tape, a head, states and transition rules: (state, read) → (write, move, next state).
  • Trace a machine by recording state, head cell, symbol read and action at every step until HALT.
  • Church-Turing thesis: anything computable by an algorithm is computable by a Turing machine. Some problems, like halting, are undecidable.
  • Turing Test (1950): a judge chats by text with a hidden human and a machine; CAPTCHA reverses the roles.
  • Searle's Chinese Room: symbol manipulation (syntax) is not understanding (semantics).

Self-Check Questions

  1. Name the four parts of a Turing machine and explain each in one line. (see §1.2)
  2. Write the rule (q0, 1) → (0, R, q0) as a sentence. (see §1.2)
  3. Trace the bit flipper on input 0110. (see §2.1)
  4. Trace Machine 2 on input 111. What is the output and why does the tape get longer? (see §2.2-2.3)
  5. State the Church-Turing thesis. Why is it called a thesis? (see §3.1)
  6. What is the halting problem? Give an everyday example. (see §3.2)
  7. Describe the setup of the imitation game and Turing's prediction. (see §4.1)
  8. Which two extra abilities does the total Turing Test need? (see §4.2)
  9. How is CAPTCHA different from the Turing Test? (see §4.4)
  10. Explain the Chinese Room argument and the systems reply. (see §5.1-5.2)

Reading: Kaplan (2016) Chapter 4; Russell & Norvig (4e) Sections 1.1.1 and 28.1-28.2.

← All CS-511 material