Commit dc2ccf1
docs: polish reductions.typ with theorem labels and cleanup (#31)
* Add design doc for polishing reductions.typ
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Update design: integrate reference package insights
- Add detailed metrics output inspired by UnitDiskMapping.jl
- Use instances from reference packages for cross-verification
- Document reference sources in example docstrings
- Update example template with transformation metrics
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Clarify: use existing export_petersen_mapping for unit disk example
Unit disk mapping (IS → GridGraph IS) already has a working example.
No need to create a new reduction example for it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Polish export_petersen_mapping example to match new format
- Add detailed docstring with mathematical equivalence
- Add structured output with transformation metrics
- Reference UnitDiskMapping.jl source
- Keep JSON export functionality for paper visualization
- Format consistent with new example template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Add JSON export requirement to example files
All examples should export structured JSON data to docs/paper/examples/
for embedding in the Typst paper. Also clarify:
- Split existing qubo_reductions.rs into 6 separate files
- Add docs/paper/examples/ to gitignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Add docs/paper/examples/ to gitignore
Example programs will generate JSON files in this directory
for use in the Typst paper. These are build artifacts.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* docs: add implementation plan for reductions.typ polish
5-pass approach with ~50-60 bite-sized tasks:
- Pass 1: Add theorem labels (5 tasks)
- Pass 2: Enhance problem definitions (7 tasks)
- Pass 3: Expand proofs and add links (5 tasks)
- Pass 4: Create 28 example files (5 tasks)
- Pass 5: Final verification (5 tasks)
Each task is 2-5 minutes with clear steps, commands, and expected outputs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* docs: add theorem labels and clean up problem definitions
Pass 1 of reductions.typ polish:
- Added <thm:*> labels to all 21 theorems for cross-referencing
- Moved table of contents after abstract with pagebreak
- Removed verbose impl Problem blocks from code examples
Labels added:
- Trivial: is-vc, is-to-setpacking, vc-to-setcovering, matching-to-setpacking, spinglass-qubo
- QUBO: is-to-qubo, vc-to-qubo, coloring-to-qubo, setpacking-to-qubo, ksat-to-qubo, ilp-to-qubo
- Non-trivial: sat-to-is, sat-to-coloring, sat-to-dominatingset, sat-ksat, circuit-to-spinglass, factoring-to-circuit, spinglass-maxcut, coloring-to-ilp, factoring-to-ilp, is-to-gridgraph
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: polish reductions paper and add 30 standalone example files
- Enhance 15 problem definitions with field mapping paragraphs and
theorem cross-references (replacing reduces-to/from problem links)
- Add 7 new ILP formulation theorems (IS, VC, Matching, SetPacking,
SetCovering, DominatingSet, Clique → ILP) with proofs
- Expand trivial reduction proofs with explicit variable mappings
- Add GitHub example links after all 28 theorem blocks
- Create 30 standalone reduction example files with docstrings,
closed-loop verification, and JSON export for paper visualization
- Fix Typst compilation: replace invalid `ni` symbol with `in.rev`,
enable theorem numbering for cross-references
- Update summary table with ILP reduction rows
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address 5 Copilot review comments on PR #31
- Add Clique definition (def:clique) and fix Clique→ILP theorem to
reference it instead of def:independent-set
- Fix misleading "Camera positions/cameras" wording in VC→QUBO example
to use "Cover vertices/vertices"
- Use bidirectional IS↔SetPacking in IS and SetPacking "Implemented
reductions" lists since both directions are implemented
- Fix SetPacking→ILP formulation to match implementation: uses
overlapping pair constraints (x_i + x_j ≤ 1) not per-element
constraints, with O(|S|²) bound
- Fix Typst deprecation: sect → inter
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: unify JSON schema across all 30 reduction examples
Replace 3 inconsistent JSON schemas (flat, QUBO-rich, nested) with a
single unified schema: ReductionData (source, target, overhead) and
ResultData (solutions) written to separate .json/.result.json files.
- Add src/export.rs with shared serialization types and helpers
- Convert all 30 examples to use problemreductions::export::*
- Update Typst paper to load unified schema (simplify load-example)
- Add load-results() and instance-vars() Typst helpers
- Use lookup_overhead_or_empty() for ILP reductions without inventory
- Add examples integration test and make examples target
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address remaining review comments and add export.rs test coverage
- Add unit tests for src/export.rs (17 tests covering all public functions)
to fix codecov/patch CI failure (was 0% coverage on 49 lines)
- Fix instance-vars: check num_variables first, handle Factoring as
num_bits_first + num_bits_second
- Guard against division by zero in reduction-example overhead calculation
- Rename <thm:is-vc> to <thm:is-to-vc> for consistent label naming
- Use unidirectional IS→SetPacking references (theorem only documents
one direction)
- Update all @thm:is-vc references to @thm:is-to-vc
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent cfad202 commit dc2ccf1
43 files changed
Lines changed: 5789 additions & 296 deletions
File tree
- docs
- paper
- plans
- examples
- src
- unit_tests
- tests
- suites
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
52 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
53 | 64 | | |
54 | 65 | | |
55 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
428 | | - | |
| 428 | + | |
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
434 | | - | |
| 434 | + | |
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
| 438 | + | |
439 | 439 | | |
440 | 440 | | |
441 | | - | |
| 441 | + | |
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
| 445 | + | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
449 | 449 | | |
450 | 450 | | |
451 | | - | |
| 451 | + | |
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
| 462 | + | |
463 | 463 | | |
464 | 464 | | |
465 | | - | |
| 465 | + | |
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
479 | | - | |
| 479 | + | |
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
| 485 | + | |
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
489 | | - | |
| 489 | + | |
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
| 496 | + | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
| 499 | + | |
500 | 500 | | |
501 | 501 | | |
502 | | - | |
| 502 | + | |
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
506 | | - | |
| 506 | + | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
| 509 | + | |
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
513 | | - | |
| 513 | + | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
| 516 | + | |
517 | 517 | | |
518 | 518 | | |
519 | | - | |
| 519 | + | |
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
| 523 | + | |
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
| 530 | + | |
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
540 | | - | |
| 540 | + | |
541 | 541 | | |
542 | 542 | | |
543 | | - | |
| 543 | + | |
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
553 | | - | |
| 553 | + | |
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| |||
0 commit comments