Skip to content

langtons_highway: four follow-up experiments, two of which correct earlier claims - #19

Merged
CrazyDubya merged 3 commits into
mainfrom
claude/problem-solving-movie-x67tec
Sep 22, 2026
Merged

CrazyDubya merged 3 commits into
mainfrom
claude/problem-solving-movie-x67tec

Conversation

@CrazyDubya

@CrazyDubya CrazyDubya commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

What this is

Four experiments that probe the Langton's Ant highway conjecture from angles the brute-force survey (#14) and the SAT catalogue (#17) cannot reach. Two of them correct claims this README previously made, and a review round corrected a third.

1. Is Langton's rule special? No. (turmite_core.c, turmite_survey.py)

The ant and its highway certificate are generalised to any n-colour turmite rule (a string of L/R; RL is Langton's). The certificate carries over unchanged with "white" becoming "colour 0", because a cell's colour is still its visit count mod n.

All 4,095 rules of length 1–12, 20M steps each:

outcome rules
certified highway 468 11.4%
no highway within budget 3,365
grew off the grid 250
proved periodic 12

The highway fraction holds near 11% at every rule length from 6 to 12. There are 135 distinct periods, longest 1,968; period 104 is shared by only 11 rules and the most common is 18. 65% of highway rules reach their highway faster than Langton's 9,977 steps, the quickest (RRL) in 39. Drifts are usually diagonal but not always: (16,0), (8,0), (0,2), (12,−8), (−3,11) all occur.

Soundness fix along the way: an initial "stopped visiting new cells" heuristic wrongly called LRRRRRLLR bounded after it had densely filled a 1468×1468 region and was still growing. Bounded behaviour is now proved via Brent cycle detection over an incremental grid hash.

Budget caveat, tested rather than asserted. The largest exactly-measured onset is 18,962,907 against a 20,000,000 budget, so the cutoff is inside the onset distribution. I reran 150 randomly chosen timed-out rules at ten times the budget: none converted. The figure looks stable, but it is a sample and remains an upper bound in principle.

Six of the 468 onsets are bounds rather than measurements, each stopping exactly at the ring-buffer wall. They are flagged per-entry with onset_exact and named under onset_inexact_rules, and never counted toward the exact maximum.

2. The highway cannot be destroyed at this scale (trap.py)

Obstacles dropped in the road of a running highway. Of 245 trials, 188 actually struck:

recovered a certified highway 188 of 188
never recovered 0
recovery after contact 311 min / 7,047 median / 56,117 max
period of the new highway 104, every time
same direction / deflected 67 / 121

A 21-cell wall across the road is absorbed in a few thousand steps. The highway is easy to deflect and impossible to destroy here, the dynamical counterpart of #17's uniqueness result.

Soundness detail: the certificate treats everything outside the visited bounding box as background, so obstacles are placed only after widening that box. Otherwise it would certify a highway about to hit a wall. There is a test for this.

3. The past is the future rotated 180° (backward.py)

The forward map is a bijection, so the ant has a unique past. Iterating the inverse step from an empty grid yields no new system:

backward position at step n == rot180(forward position at step n-1) + (0,-1)

Zero mismatches over 50,000 steps, grids agreeing at every checkpoint. Same onset 9,977, same period 104, drift negated. So the conjecture is time-symmetric, and reversibility independently rules out any proof that argues by shrinking basins — distinct configurations never merge, and the highway is not an attractor in the contracting sense.

4. Correction: the maximum onset does NOT grow with box size

The exhaustive maxima (43,264 / 119,673 / 233,232 for 3×3, 4×4, 5×5) drew 512, 65,536 and 33,554,432 patterns. They differ in sample size as much as in box size. At an equal 50,000 samples each:

box max onset mean median 99.9th pct
4×4 119,673 3,795 1,732 47,476
5×5 88,940 4,253 2,042 57,877
6×6 112,767 4,520 2,284 59,569
7×7 107,981 4,745 2,499 58,872
8×8 126,826 4,984 2,677 57,985

The maximum is flat. Only the typical onset grows, and mildly (median +55% from 4×4 to 8×8). The earlier reading was a sample-size artifact. All 250,000 samples reached a certified highway, extending the evidence to 6×6, 7×7 and 8×8, never covered exhaustively.

Review round

Three P2 findings from the Codex bot, all correct, all mine, fixed in ec3fe27 with a regression test each:

  1. The summary dropped the core's onset_exact flag, presenting six truncation bounds as measurements. The largest of them, 19,171,329, had reached the README; it now quotes the largest exact onset instead.
  2. cells_per_period was actually the cumulative visited count (RRL: period 18, value 286). Renamed to visited_at_certification.
  3. backward.py's onset scan started past the end of its array, so it always printed the run length instead of the onset. It now recovers 9,977, as the time-reversal symmetry requires.

summarize() was split out so --summarize-only rebuilds the summary from an existing rules.csv without repeating the sweep.

Testing

pytest langtons_highway/tests -o addopts="" → 14 passed. flake8 . --select=E9,F63,F7,F82 → 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DVvB1dWEhjyBKh95Zojt3F

Adds the code and data for four experiments that probe the conjecture from
angles the brute-force survey cannot reach.

turmite_core.c / turmite_survey.py: generalise the ant and its highway
certificate to any n-colour turmite rule ("RL" is Langton's). Sweeps all
4,095 rules up to length 12 and classifies each. Bounded behaviour is now
proved rather than guessed: Brent cycle detection over an incremental
grid hash replaces an unsound "stopped growing" heuristic.

backward.py: the forward map is a bijection, so the ant has a unique past.
Iterating the inverse step from an empty grid shows the time-reversed ant
is exactly the forward ant rotated 180 degrees, so the past holds no new
information and the conjecture is time-symmetric.

trap.py: lets the ant build its highway, drops obstacles in the road and
measures whether it recovers, how long it takes and which way it leaves.
Obstacles are added only after widening the visited bounding box, since
the certificate treats everything outside that box as background and
would otherwise be unsound.

data/: rule classifications, trapping trials, and equal-sample-size onset
histograms for boxes 4x4 through 8x8.

Tests cover the inverse step, the 180-degree time-reversal correspondence,
the bounding-box widening, and that the generalised core reproduces
Langton's onset of 9,977 and period 104 exactly.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DVvB1dWEhjyBKh95Zojt3F
Records what each experiment found, including the two results that
correct earlier claims in this README.

- Langton's rule is not special: 468 of 4,095 turmite rules certify a
  highway, a fraction steady near 11% at every rule length, across 135
  distinct periods. Period 104 is shared by 11 rules and 65% of highway
  rules are faster than Langton's. A control reruns 150 timed-out rules
  at ten times the budget; none convert.
- The highway cannot be destroyed at this scale: all 188 struck obstacles
  were absorbed, every recovery returning to period 104, though most left
  in a new direction.
- The past is the future rotated 180 degrees, so the backward dynamics
  holds no new information and the conjecture is time-symmetric.
  Reversibility also rules out any proof that argues by shrinking basins.
- The maximum onset does NOT grow with box size. At equal sample size it
  is flat; the earlier apparent growth tracked sample size. Only the
  typical onset grows, and only mildly.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DVvB1dWEhjyBKh95Zojt3F
@CrazyDubya
CrazyDubya marked this pull request as ready for review September 20, 2026 15:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50a5e68b61

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread langtons_highway/backward.py Outdated
Comment thread langtons_highway/turmite_survey.py Outdated
Comment thread langtons_highway/turmite_survey.py Outdated
All three were mine, and one of them had reached the README.

- turmite_survey.py dropped the core's onset_exact flag. Six of the 468
  highway rows are bounds, not measurements: the backward scan that finds
  an onset can only see as far as the ring buffer reaches, and stops at
  that wall. The largest reported onset, 19,171,329, was one of them, and
  the README quoted it as if measured. Every highway entry now carries
  its own onset_exact, the six rules are named under onset_inexact_rules,
  and the README quotes the largest exact onset, 18,962,907, instead.

- turmite_survey.py labelled column 7 "cells_per_period" when it is the
  cumulative count of distinct cells visited by certification time. RRL
  has period 18 but was emitted with cells_per_period 286. Renamed to
  visited_at_certification.

- backward.py's onset scan began at the last index, so its first partner
  lookup was already past the end of the array and it always reported the
  run length instead of the onset. It now starts a full period earlier and
  recovers 9,977, which is what the 180-degree time-reversal symmetry
  predicts it must.

summarize() is now a separate function, so --summarize-only rebuilds
summary.json from an existing rules.csv without repeating the sweep.
Three regression tests added; 14 pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DVvB1dWEhjyBKh95Zojt3F
@CrazyDubya
CrazyDubya merged commit c582376 into main Sep 22, 2026
1 check passed
@CrazyDubya
CrazyDubya deleted the claude/problem-solving-movie-x67tec branch September 22, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants