Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ solving remains future work.
| Wang diagnostic renderer | Implemented as one presentation-only CLI with byte-stable square default and explicit `--hex` mode in the isolated `renderer/` project |
| Square-to-hex presentation port | Implemented as a pure in-memory Basire/Culik mapping with a raster-independent checker; no hex solver, schema, or core model |
| Static explainability snapshots | Implemented for parsed formula, canonical tile sheet, and unassigned region, with hash-bound JSON contracts and square/hex diagnostic views |
| Generalized tile presentation | Implemented as an exact presentation-only 14-to-23 mapping with a pure recognizer, semantic sheet, labelled atomic legend, and square-witness overlay |
| Reduction construction provenance | Implemented as a separate opt-in native-owned result with exact signal orders, swap-bound gadget spans, manifest v2, and a square overlay view; the compact standard ABI does not allocate it |
| Native solver event trace | Implemented as separate opt-in reference/optimized entry points with bounded observed events, full initial state, checkpoints, manifest v3, independent offline replay, and deterministic PNG/GIF views |
| Reproducible Z3 summaries | Implemented for fixed seed/thread settings and explicit Boolean/Wang encoding order, result/model, and stable project-owned counts; no internal Z3 trace claim |
Expand Down Expand Up @@ -185,7 +186,7 @@ make check

The imported renderer remains a separate locked Python project. Its Pillow and
NumPy dependencies are not installed by the root project or exercised by
`make check`. Run its 262-test combined suite independently:
`make check`. Run its 283-test combined suite independently:

```sh
cd renderer
Expand Down
2 changes: 1 addition & 1 deletion docs/plans/2026-08-31-narrative-migration-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ checks prove the old files are unreferenced before deletion.

## 8. Shared-asset migration order

1. [ ] Freeze and test the exact generalized 14-to-23 mapping without changing
1. [x] Freeze and test the exact generalized 14-to-23 mapping without changing
the atomic tileset or standard square/hex output.
2. [ ] Capture the explicit v2 multi-engine fields once per engine and bind all
component identities by SHA-256.
Expand Down
74 changes: 72 additions & 2 deletions renderer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,69 @@ Reduction spans describe the square construction itself, so this view rejects
the signal permutation, and gadget bounds without importing native code or
reconstructing builder geometry.

### Generalized Yang--Zhang presentation

Three explicit square-only views interpret the fixed 23 positional atomic IDs
as the 14 generalized tiles from the Yang--Zhang construction. The semantic
module `wang_generalized.py` contains the exact table and performs no raster,
solver, native, or root-project import. It first guards every canonical
`(N,E,S,W)` tuple, then recognizes only complete, correctly oriented,
adjacent, and non-overlapping compositions.

Render the 14-tile sheet and the separately labelled 23-tile atomic legend
from an existing hash-bound tileset snapshot:

```bash
uv run --locked python wang_square.py \
../tests/fixtures/pipeline_sat_explain/manifest.json \
output/generalized-sheet.png \
--view generalized-sheet

uv run --locked python wang_square.py \
../tests/fixtures/pipeline_sat_explain/manifest.json \
output/atomic-legend.png \
--view atomic-legend
```

Render an exact generalized overlay on the canonical verified square witness:

```bash
uv run --locked python wang_square.py \
../tests/fixtures/pipeline_sat_solver_trace/solution-2273f58cda026dca73c0dfa25c960e01296ac1e34ae6accbddf5be29034d156a.json \
output/generalized-overlay.png \
--view generalized-overlay
```

The fixed decomposition is:

| Generalized tile | Atomic IDs and orientation |
|---|---|
| `V0` | `0` above `1` above `2` |
| `V1` | one copy of `3` |
| `C0` | `4` |
| `C1` | `5` above `6` |
| `F0`, `F1` | `7`, `8` |
| `L0`, `L1` | `9`, `10` |
| `R0`, `R1` | `11|12`, `13|14` from left to right |
| `X00`, `X01`, `X10`, `X11` | `15/16`, `17/18`, `19/20`, `21/22` from top to bottom |

The symbolic palette keeps the paper colors `b`, `v`, `0`, `1`, `0′`
(rendered as the font-safe label `0-prime`), `l`, and `r` separate from
internal glues `V0:a`, `V0:b`, `C1`, `R0`, `R1`,
`X00`, `X01`, `X10`, and `X11`; numeric color IDs remain visible as secondary
transport labels. Multi-cell shapes receive one outer contour and a muted
internal seam. Every atomic tile keeps its numeric ID. In particular, three
adjacent cells carrying atomic tile `3` are three `V1` occurrences, never one
three-cell `V1`.

All three generalized views reject `--hex`: the checked Basire/Culik port is a
one-to-one presentation of atomic tiles and does not invent generalized hex
semantics. Generalized recognition checks only the exact atomic composition;
Wang adjacency, boundary, and SAT verification remain explicit upstream
preconditions, just as for the other renderer views. Without one of the new
`--view` values, default square, `--hex`, and `--explain` output remain
byte-for-byte unchanged.

### Offline trace and algorithm animations

The animation modules keep state interpretation separate from image encoding.
Expand Down Expand Up @@ -339,20 +402,26 @@ Raises `RenderingException` on pipeline errors.
├── wang_trace.py # Strict observed-trace loader and offline replay
├── wang_trace_render.py # Trace frame selection and composition CLI
├── wang_z3_summary.py # Encoding-order summary consumer and compositor
├── wang_generalized.py # Pure exact 14-to-23 mapping and recognizer
├── wang_generalized_render.py # Sheet, atomic legend, and square overlay
├── wang_animation.py # Deterministic PNG/contact-sheet/GIF encoder
├── wang_algorithm_animation.py # Canonical and didactic algorithm views
├── test_wang_square.py # Square loader, raster, isolation, CLI, and failures
├── test_wang_hex.py # Port proof obligations, hex raster, golden, and CLI
├── test_wang_snapshot.py # Snapshot contracts, views, isolation, and goldens
├── test_wang_trace.py # Hash-bound replay, isolation, and byte stability
├── test_wang_z3_summary.py # Fixed encoding summaries and byte stability
├── test_wang_generalized.py # Exact mapping, rejection, isolation, and goldens
├── test_wang_algorithm_animation.py # Source checks and animation goldens
├── input/ # Example input files (palette, scene, tiles, sprites)
├── output/ # Rendered PNG output goes here
├── test_data/
│ ├── wang_solution_v1_square_sat.png # Square golden for the Wang fixture
│ ├── wang_solution_v1_hex_sat.png # Pointy-top hex golden for the same fixture
│ ├── pipeline_sat_reduction.png # Native reduction-provenance golden
│ ├── pipeline_sat_generalized_sheet.png # Fixed 14-tile semantic sheet
│ ├── pipeline_sat_atomic_semantic_legend.png # Labelled 23-tile legend
│ ├── pipeline_sat_generalized_overlay.png # Canonical witness grouping
│ ├── palette_ok.json # Valid 16-color palette
│ ├── palette_wrong_count.json # Only 3 colors (invalid)
│ ├── palette_wrong_value.json # Component > 255 (invalid)
Expand All @@ -368,9 +437,10 @@ Raises `RenderingException` on pipeline errors.
uv run --locked pytest -q
```

The complete isolated suite has 262 tests: the 144 preserved legacy tests
The complete isolated suite has 283 tests: the 144 preserved legacy tests
below, 45 Wang square tests, 24 square-to-hex/hex-raster tests, 29 static
snapshot/explainability tests, and 20 trace/Z3/algorithm-animation tests.
snapshot/explainability tests, 21 generalized-presentation tests, and 20
trace/Z3/algorithm-animation tests.
To run only the original upstream suite:

```bash
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading