Skip to content

Commit 100ce57

Browse files
committed
update
1 parent b1ace36 commit 100ce57

23 files changed

Lines changed: 340 additions & 285 deletions

File tree

.claude/CLAUDE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ make fmt-check # Check code formatting
4141
make clippy # Run clippy lints
4242
make doc # Build mdBook documentation (includes reduction graph export)
4343
make mdbook # Build and serve mdBook with live reload
44-
make paper # Build Typst paper (runs examples + exports first)
44+
make paper # Build Typst paper from checked-in example fixtures
4545
make coverage # Generate coverage report (>95% required)
4646
make check # Quick pre-commit check (fmt + clippy + test)
4747
make rust-export # Generate Julia parity test data (mapping stages)
4848
make export-schemas # Regenerate problem schemas JSON
4949
make qubo-testdata # Regenerate QUBO ground truth JSON
5050
make clean # Clean build artifacts
5151
make diagrams # Generate SVG diagrams from Typst (light + dark)
52-
make examples # Generate example JSON for paper
5352
make compare # Generate and compare Rust mapping exports
5453
make jl-testdata # Regenerate Julia parity test data (requires julia)
5554
make cli # Build the pred CLI tool (without MCP, fast)

.claude/skills/add-rule/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ Use `graph-colors`, `g-node()`, `g-edge()` for graph visualization — see refer
162162
### 5d. Build and verify
163163

164164
```bash
165-
make examples # Regenerate example JSON
166165
make paper # Must compile without errors
167166
```
168167

.claude/skills/final-review/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ Verify the PR includes all required components. Check:
196196

197197
**Paper-example consistency check (both Model and Rule PRs):**
198198

199-
The paper example must use data from the generated JSON (`docs/paper/examples/generated/`), not hand-written data. To verify:
200-
1. Run `make examples` on the PR branch to regenerate `docs/paper/examples/generated/models.json` and `rules.json`.
201-
2. For **[Rule] PRs**: the paper's `reduction-rule` entry must call `load-example(source, target)` (defined in `reductions.typ`) to load the canonical example from `rules.json`, and derive all concrete values from the loaded data using Typst array operations — no hand-written instance data.
202-
3. For **[Model] PRs**: read the problem's entry in `models.json` and compare its `instance` field against the paper's `problem-def` example. The paper example must use the same instance (allowing 0-indexed JSON vs 1-indexed math notation). If they differ, flag: "Paper example does not match `example_db` canonical instance in `models.json`."
199+
The paper example must use data from the canonical fixture JSON (`src/example_db/fixtures/examples.json`), not hand-written data. To verify:
200+
1. If the PR changes example builders/specs, run `make regenerate-fixtures` on the PR branch.
201+
2. For **[Rule] PRs**: the paper's `reduction-rule` entry must call `load-example(source, target, ...)` (defined in `reductions.typ`) to load the canonical example from `examples.json`, and derive all concrete values from the loaded data using Typst array operations — no hand-written instance data.
202+
3. For **[Model] PRs**: read the problem's entry in `examples.json` under `models` and compare its `instance` field against the paper's `problem-def` example. The paper example must use the same instance (allowing 0-indexed JSON vs 1-indexed math notation). If they differ, flag: "Paper example does not match `example_db` canonical instance in `examples.json`."
203203

204204
**Issue–test round-trip consistency check (both Model and Rule PRs):**
205205

.claude/skills/write-model-in-paper/SKILL.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,16 @@ achieves $O^*(2^n)$ @bjorklund2009.
126126

127127
### 3c. Example with Visualization
128128

129-
A concrete small instance that illustrates the problem. **The example must use data from the generated `models.json`**, not an independently invented instance.
129+
A concrete small instance that illustrates the problem. **The example must use data from the checked-in canonical fixture DB**, not an independently invented instance.
130130

131131
#### Sourcing example data
132132

133-
1. Run `make examples` to ensure `docs/paper/examples/generated/models.json` is up to date.
134-
2. Find the problem's entry in `models.json` — it contains the canonical `instance`, `samples`, and `optimal` fields.
133+
1. If you changed example builders/specs, run `make regenerate-fixtures` to refresh `src/example_db/fixtures/examples.json`.
134+
2. Find the problem's entry in `src/example_db/fixtures/examples.json` under `models` — it contains the canonical `instance`, `samples`, and `optimal` fields.
135135
3. Use the values from `instance` in the paper example (translating 0-indexed code values to 1-indexed math notation where conventional, e.g., vertices {0,...,n-1} → {1,...,n}).
136136
4. Use `optimal` configurations to show the solution.
137137

138-
**Do not invent a different instance.** If the canonical example is too large or not pedagogically ideal, fix it in `canonical_model_example_specs()` first, re-run `make examples`, then write the paper entry from the updated JSON.
138+
**Do not invent a different instance.** If the canonical example is too large or not pedagogically ideal, fix it in `canonical_model_example_specs()` first, re-run `make regenerate-fixtures`, then write the paper entry from the updated JSON.
139139

140140
#### Requirements
141141

@@ -147,7 +147,7 @@ A concrete small instance that illustrates the problem. **The example must use d
147147
#### Structure
148148

149149
```typst
150-
*Example.* Consider [instance description with concrete numbers from models.json].
150+
*Example.* Consider [instance description with concrete numbers from `examples.json`].
151151
[Describe the solution and why it's valid/optimal].
152152
153153
#figure({
@@ -185,7 +185,7 @@ make paper
185185
- [ ] **Notation self-contained**: every symbol in `def` is defined before first use
186186
- [ ] **Background present**: historical context, applications, or structural properties
187187
- [ ] **Algorithms cited**: every complexity claim has `@citation` or footnote warning
188-
- [ ] **Example from JSON**: instance data matches `models.json` canonical example (not independently invented)
188+
- [ ] **Example from JSON**: instance data matches `src/example_db/fixtures/examples.json` canonical example (not independently invented)
189189
- [ ] **Evaluation shown**: objective/verifier computed on the example solution
190190
- [ ] **Diagram included**: figure with caption and label for graph/matrix/set visualization
191191
- [ ] **Paper compiles**: `make paper` succeeds without errors

.claude/skills/write-rule-in-paper/SKILL.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Full authoring guide for writing a `reduction-rule` entry in `docs/paper/reducti
1818
Before using this skill, ensure:
1919
- The reduction is implemented and tested (`src/rules/<source>_<target>.rs`)
2020
- A canonical example exists in `src/example_db/rule_builders.rs`
21-
- Example JSON is generated (`make examples`)
21+
- If the canonical example changed, fixtures are regenerated (`make regenerate-fixtures`)
2222
- The reduction graph and schemas are up to date (`cargo run --example export_graph && cargo run --example export_schemas`)
2323

2424
## Step 1: Load Example Data
@@ -29,8 +29,8 @@ Before using this skill, ensure:
2929
```
3030

3131
Where:
32-
- `load-example(source, target)` looks up the canonical rule entry from the generated rule database
33-
- The returned record contains `source`, `target`, `overhead`, and `solutions`
32+
- `load-example(source, target, ...)` looks up the canonical rule entry from `src/example_db/fixtures/examples.json`
33+
- The returned record contains `source`, `target`, and `solutions`
3434
- Access fields: `src_tgt.source.instance`, `src_tgt.target.instance`, `src_tgt_sol.source_config`, `src_tgt_sol.target_config`
3535

3636
## Step 2: Write the Theorem Body (Rule Statement)
@@ -220,9 +220,6 @@ If this is a new problem not yet in the paper, add to the `display-name` diction
220220
## Step 6: Build and Verify
221221

222222
```bash
223-
# Regenerate example JSON (if not already done)
224-
make examples
225-
226223
# Build the paper
227224
make paper
228225
```

Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ criterion = "0.8"
4545
name = "solver_benchmarks"
4646
harness = false
4747

48-
[[example]]
49-
name = "export_examples"
50-
path = "examples/export_examples.rs"
51-
required-features = ["example-db"]
52-
5348
[[example]]
5449
name = "regenerate_fixtures"
5550
path = "examples/regenerate_fixtures.rs"

Makefile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Makefile for problemreductions
22

3-
.PHONY: help build test mcp-test fmt clippy doc mdbook paper examples clean coverage rust-export compare qubo-testdata export-schemas release run-plan run-issue run-pipeline run-pipeline-forever run-review run-review-forever board-next board-claim board-ack board-move issue-context issue-guards pr-context pr-wait-ci worktree-issue worktree-pr diagrams jl-testdata cli cli-demo copilot-review regenerate-fixtures
3+
.PHONY: help build test mcp-test fmt clippy doc mdbook paper clean coverage rust-export compare qubo-testdata export-schemas release run-plan run-issue run-pipeline run-pipeline-forever run-review run-review-forever board-next board-claim board-ack board-move issue-context issue-guards pr-context pr-wait-ci worktree-issue worktree-pr diagrams jl-testdata cli cli-demo copilot-review regenerate-fixtures
44

55
RUNNER ?= codex
66
CLAUDE_MODEL ?= opus
@@ -18,13 +18,12 @@ help:
1818
@echo " doc - Build mdBook documentation"
1919
@echo " diagrams - Generate SVG diagrams from Typst (light + dark)"
2020
@echo " mdbook - Build and serve mdBook (with live reload)"
21-
@echo " paper - Build Typst paper (requires typst)"
21+
@echo " paper - Build Typst paper from checked-in fixtures (requires typst)"
2222
@echo " coverage - Generate coverage report (requires cargo-llvm-cov)"
2323
@echo " clean - Clean build artifacts"
2424
@echo " check - Quick check (fmt + clippy + test)"
2525
@echo " rust-export - Generate Rust mapping JSON exports"
2626
@echo " compare - Generate and compare Rust mapping exports"
27-
@echo " examples - Generate example JSON for paper (from fixtures, fast)"
2827
@echo " regenerate-fixtures - Recompute example DB fixtures (BruteForce/ILP, slow)"
2928
@echo " export-schemas - Export problem schemas to JSON"
3029
@echo " qubo-testdata - Regenerate QUBO test data (requires uv)"
@@ -114,11 +113,6 @@ mdbook:
114113
python3 -m http.server 3001 -d book &
115114
@sleep 1 && (command -v xdg-open >/dev/null && xdg-open http://localhost:3001 || open http://localhost:3001)
116115

117-
# Generate all example JSON files for the paper (loads from fixtures — fast)
118-
examples:
119-
cargo run --features "example-db" --example export_examples
120-
cargo run --example export_petersen_mapping
121-
122116
# Regenerate example DB fixtures from code (runs BruteForce/ILP — slow)
123117
regenerate-fixtures:
124118
cargo run --release --features "example-db" --example regenerate_fixtures
@@ -127,11 +121,12 @@ regenerate-fixtures:
127121
export-schemas:
128122
cargo run --example export_schemas
129123

130-
# Build Typst paper (generates examples first)
131-
paper: examples
124+
# Build Typst paper (reads canonical examples directly from fixtures)
125+
paper:
126+
cargo run --example export_petersen_mapping
132127
cargo run --example export_graph
133128
cargo run --example export_schemas
134-
cd docs/paper && typst compile --root .. reductions.typ reductions.pdf
129+
typst compile --root . docs/paper/reductions.typ docs/paper/reductions.pdf
135130

136131
# Generate coverage report (requires: cargo install cargo-llvm-cov)
137132
coverage:

docs/agent-profiles/SKILLS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Skills
22

3-
Example generation now goes through the example catalog and dedicated exporter.
3+
Example generation now goes through the example catalog and checked-in fixture DB.
44
When a workflow needs a paper/example instance, prefer the catalog path over ad hoc `examples/reduction_*.rs` binaries:
55

6-
- use `make examples` or `cargo run --features "ilp-highs example-db" --example export_examples`
6+
- use `src/example_db/fixtures/examples.json` directly for paper/example data
7+
- use `make regenerate-fixtures` when canonical examples change
78
- use `pred create --example <PROBLEM_SPEC>` to materialize a canonical model example as normal problem JSON
89
- use `pred create --example <SOURCE_SPEC> --to <TARGET_SPEC>` to materialize a canonical rule example as normal problem JSON
910
- when adding new example coverage, register a catalog entry instead of creating a new standalone reduction example file

docs/paper/reductions.typ

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#show: thmrules.with(qed-symbol: $square$)
1616

1717
// === Example JSON helpers ===
18-
// Load canonical example databases generated by `make examples`.
19-
#let example-db = json("examples/generated/examples.json")
18+
// Load canonical example database directly from the checked-in fixture file.
19+
#let example-db = json("../../src/example_db/fixtures/examples.json")
2020

2121
#let load-example(source, target, source-variant: none, target-variant: none) = {
2222
let matches = example-db.rules.filter(r =>
@@ -2781,7 +2781,7 @@ See #link("https://github.com/CodingThrust/problem-reductions/blob/main/examples
27812781

27822782
== Resource Estimation from Examples
27832783

2784-
The following table shows concrete variable overhead for example instances, generated from the reduction examples (`make examples`).
2784+
The following table shows concrete variable overhead for example instances, taken directly from the canonical fixture examples.
27852785

27862786
#let example-files = (
27872787
(source: "MaximumIndependentSet", target: "MinimumVertexCover"),

examples/export_examples.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)