AWM
← All games‹ cd82dc22 ›

cn04

Move and rotate pieces until every red plug shares a cell with another plug to clear the level.

6 levels · 9 rules · all levels replayed in Lean

Replay

The certified run that cleared every level, one action at a time. Beside each step: the rules of the model that explain it; they are also marked in the rule list below.

cn04, first frame of the certified run

Explained by

Press Play or step to load the run. Keys, while the player is on screen: ← → step, Space play / pause. A click is circled; cells that changed are outlined.

How it plays

There are several pieces of different shapes on the field, each with a red plug. Only the selected piece can be operated at a time: a direction key translates it by one cell, and the function key rotates it clockwise by a right angle; if it is a pen, the function key lengthens it by one segment or shortens it by one segment. Click another piece and the selection switches to it; click the already selected piece again and the selection is cancelled. Pieces can walk over each other and are not blocked. When two plugs land on the same cell, that cell turns grey to indicate it is welded; after they move apart each is restored. After a step, if every plug on the field overlaps another plug in the same cell, the level is cleared. Some levels paint the whole unselected piece dark and hide its plug, visible only when selected. The top bar at the very top is spent down with the steps.

cn04, first frame of the certified run
Start
cn04, last frame of the certified run
After the winning move

Model

The final model: 4 object types and 9 rules. Each rule is a Python check against every recorded step; 8 of them are translated into Lean (the paper's per-game table). Code under a rule is the file of the same name in the agent's Lean project.

Object types

Rules

Code is shown with comments and the agent's notes removed; the files as written are in the archive under Check it yourself.

Proof

For every level, Lean starts from the level's first screen, applies the model's rules to the certified actions, and checks that every computed state agrees with the recorded frame on the components the model represents, and that the last one wins. Each theorem is closed by the Lean kernel and is a statement about the learned model.

Every level can be won

theorem L0_winnable : L0_acts.length = 14 ∧ Winnable (Witness.start0 : World) := …
theorem L1_winnable : L1_acts.length = 31 ∧ Winnable (Witness.start1 : World) := …
theorem L2_winnable : L2_acts.length = 34 ∧ Winnable (Witness.start2 : World) := …
theorem L3_winnable : L3_acts.length = 95 ∧ Winnable (Witness.start3 : World) := …
theorem L4_winnable : L4_acts.length = 46 ∧ Winnable (Witness.start4 : World) := …
theorem L5_winnable : L5_acts.length = 41 ∧ Winnable (Witness.start5 : World) := …
theorem keyA_nowin : ∀ w a w', KeyA w → step w a ≠ .won w' := …
theorem A_ctrl_winnable : Winnable (A_ctrl : World) := …
theorem keyB_nowin : ∀ w a w', KeyB w → step w a ≠ .won w' := …
theorem B_ctrl_winnable : Winnable (B_ctrl : World) := …

What cannot be won under the model

theorem keyA_unsolvable (w : World) (h : KeyA w) : Unsolvable w := …
theorem A_scene_unsolvable : Unsolvable (A_scene : World) := …
theorem keyB_unsolvable (w : World) (h : KeyB w) : Unsolvable w := …
theorem B_scene_unsolvable : Unsolvable (B_scene : World) := …

Statements only; the proofs and the full Lean project are in the archive, with the steps to re-run them, under Check it yourself.

Check it yourself

Everything on this page comes from files you can download and check. The archive holds the agent's files: the recorded run, the concept book, the concept sources, the Lean project and the sealed model file, plus the record of our kernel check.

Download cn04.zip 0.7 MB · 56 files

Re-run the proof

Before you start: our run of this check took 74 s and 3.3 GB of memory at its peak (2026-10-23).

  1. Download cn04.zip and unpack it. The model and its theorems are in archive/cn04-20260909/formal/Game.lean. Before changing it, check that its SHA-256 is
    8f0ab9ec07495b3b5f3d198408e848737fc876255e50678f79d16c07059923ca
  2. Install Lean with elan, then the version named in the archive's lean-toolchain:
    elan toolchain install leanprover/lean4:v4.34.0
  3. Copy the model file to Check.lean and append these two lines to the copy:
    #print axioms consistent
    #print axioms faithful
  4. In the folder that holds Check.lean, run:
    lean +leanprover/lean4:v4.34.0 -M60000 Check.lean
  5. Lean should finish without errors and print:
    GUARD_HITS move_up=93,move_down=158,move_left=131,move_right=115,no_block=497,overlap_draws_over=497,rot_cw=42,pen_step=45,select_click=12,swap_selection=12,sleep_wake=73,swap_sleep=76,wake_plugs=73,plug_at_deg1=425,plug_near_sleeper=90,sleep_overlay=105,uncover=388,dock_weld=411,goal_dock_wins=15,goal_needs_dock=679,hud_rate=694
    'consistent' depends on axioms: [propext]
    'faithful' depends on axioms: [propext]
    The first line is printed by the file itself: for each rule, how many recorded transitions meet its condition.

What a pass establishes

consistent: for every recorded transition, as read by the agent's parser and with duplicates removed, every rule whose condition holds also has its effect hold. faithful: the certified run, recomputed step by step from the first screen of each level, matches the record and ends in a win. Axioms used: propext, all among Lean's standard ones.

What it does not establish: that the parser reads the screens correctly (that step runs in Python, outside Lean), or that a rule whose condition never occurs in the record is right. The Python file that produced the readings inside the model file is in the archive at meta/repair-20260928/lib/cn04-20260909/_lib.py.