Skip to content

docs: replace Rust code with JSON schema tables in paper#38

Merged
GiggleLiu merged 14 commits intomainfrom
feat/improve-reductions-typ
Feb 10, 2026
Merged

docs: replace Rust code with JSON schema tables in paper#38
GiggleLiu merged 14 commits intomainfrom
feat/improve-reductions-typ

Conversation

@GiggleLiu
Copy link
Contributor

Summary

  • Replace render-struct (Rust code blocks) with render-schema function that renders Field/Type/Description tables from problem_schemas.json — more useful for users who want to interop with this package
  • Classify reduction references as "Reduces to:" / "Reduces from:" instead of flat "Implemented reductions:" lists
  • Remove all Rust code blocks and See #link(...) lines from the paper, keeping mathematical examples

Test plan

  • make paper compiles successfully
  • make test passes
  • make clippy clean
  • PDF visually verified — schema tables render correctly

🤖 Generated with Claude Code

1. Replace render-struct (Rust code blocks) with render-schema (JSON field
   tables from problem_schemas.json) — more useful for interop users.
2. Classify reduction references as "Reduces to" / "Reduces from" instead
   of flat "Implemented reductions" lists.
3. Remove all Rust code blocks and "See ... .rs" links from the paper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 99.85591% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.37%. Comparing base (d6e82e3) to head (36e66c4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/rules/unitdiskmapping/pathdecomposition.rs 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #38      +/-   ##
==========================================
+ Coverage   97.30%   97.37%   +0.07%     
==========================================
  Files         176      176              
  Lines       26080    26217     +137     
==========================================
+ Hits        25378    25530     +152     
+ Misses        702      687      -15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

GiggleLiu and others added 7 commits February 10, 2026 19:17
Add `reduction-rule(source, target, ...)` Typst function that:
- Auto-generates theorem labels (<thm:source-to-target>)
- Auto-generates bold header (Source → Target) with display names
- Auto-generates [Problems: Definition X, Definition Y] links
- Renders proof and optional example with custom extra content
- Supports bidirectional (↔), display name overrides

Converts all 28 reduction theorems to use the new function,
eliminating repeated boilerplate (manual labels, problem links,
header formatting).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix Monomial/Polynomial Display to use `*` between terms
- Add num_literals to Satisfiability::problem_size()
- Fix 6 incorrect overhead polynomials:
  SAT→DS, SAT→IS, SAT→Coloring, SAT→kSAT, Factoring→Circuit, Coloring→QUBO
- Add poly!(a * b) macro variant for variable products
- Export overhead data in reduction_graph.json
- Simplify coloring_ilp.rs to use poly! macro

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add auto-generated overhead line to each reduction theorem by looking up
the edge data from reduction_graph.json. Format: field = formula pairs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add edge hover tooltip showing source→target and overhead formulas
- Add edge click handler to highlight edge and show overhead info
- Add cursor:pointer to edges for visual feedback
- Sync reduction_graph.json with overhead data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… paper and perf

Problem type renames for clarity:
- Clique → MaximumClique
- IndependentSet → MaximumIndependentSet
- Matching → MaximumMatching
- VertexCovering → MinimumVertexCover
- DominatingSet → MinimumDominatingSet
- SetPacking → MaximumSetPacking
- SetCovering → MinimumSetCovering

Renamed all source files, test files, rule files, example files, and test
data across 118 files. Updated all references in code, docs, benchmarks,
and the Typst paper.

Typst paper improvements:
- Removed name-abbrev and def-label-map dictionaries; use full names
- Added problem-def() wrapper for programmatic definition labels
- Added completeness warnings for missing models/rules vs JSON graph
- Made reduction-rule use context+query for resilient label references
- Swapped MVC↔MIS and MSP↔MIS theorem directions to match JSON edges
- Deleted redundant examples/qubo_reductions.rs (already split)

Performance:
- Added Auto variant to PathDecompositionMethod (now default)
- Auto uses exact branch-and-bound for ≤30 vertices, greedy for larger
- Fixes slow unit disk mapping tests on larger graphs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the crate’s public-facing problem naming and documentation/examples to use explicit optimization-direction names (e.g., MaximumIndependentSet, MinimumVertexCover) and enhances exported reduction metadata (notably overhead formulas) for documentation/visualization.

Changes:

  • Renames several core problem types and updates all corresponding reductions, tests, examples, and docs to match the new names.
  • Extends reduction-graph JSON export to include per-edge overhead formulas (and updates the docs UI to display them).
  • Adds PathDecompositionMethod::Auto and switches unit-disk mapping defaults to automatic method selection; improves polynomial formatting/printing utilities.

Reviewed changes

Copilot reviewed 121 out of 124 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/suites/integration.rs Updates integration tests to renamed problem types.
tests/suites/examples.rs Updates example list names to match renamed examples.
tests/data/qubo/minimumvertexcover_to_qubo.json Adds/updates QUBO ground-truth fixture for MVC→QUBO.
tests/data/qubo/maximumsetpacking_to_qubo.json Adds/updates QUBO ground-truth fixture for MSP→QUBO.
tests/data/qubo/maximumindependentset_to_qubo.json Adds/updates QUBO ground-truth fixture for MIS→QUBO.
src/unit_tests/variant.rs Updates variant tests to renamed problem types.
src/unit_tests/unitdiskmapping_algorithms/common.rs Updates unit-disk mapping test utilities to renamed MIS type.
src/unit_tests/trait_consistency.rs Updates trait consistency tests for renamed problems and energy modes.
src/unit_tests/testing/macros.rs Updates macro tests to renamed problem types.
src/unit_tests/rules/sat_minimumdominatingset.rs Updates SAT→MDS reduction unit tests for renamed type.
src/unit_tests/rules/sat_maximumindependentset.rs Updates SAT→MIS reduction unit tests for renamed type.
src/unit_tests/rules/registry.rs Updates reduction registry test expectations for renamed problems.
src/unit_tests/rules/minimumvertexcover_qubo.rs Updates MVC→QUBO reduction tests for renamed MVC type.
src/unit_tests/rules/minimumvertexcover_minimumsetcovering.rs Updates MVC→MSC reduction tests for renamed types.
src/unit_tests/rules/minimumvertexcover_maximumindependentset.rs Updates MIS↔MVC reduction tests for renamed types.
src/unit_tests/rules/minimumvertexcover_ilp.rs Updates MVC→ILP reduction tests for renamed MVC type.
src/unit_tests/rules/minimumsetcovering_ilp.rs Updates MSC→ILP reduction tests for renamed MSC type.
src/unit_tests/rules/minimumdominatingset_ilp.rs Updates MDS→ILP reduction tests for renamed MDS type.
src/unit_tests/rules/maximumsetpacking_qubo.rs Updates MSP→QUBO reduction tests for renamed MSP type.
src/unit_tests/rules/maximumsetpacking_ilp.rs Updates MSP→ILP reduction tests for renamed MSP type.
src/unit_tests/rules/maximummatching_ilp.rs Updates MaximumMatching→ILP tests for renamed matching type.
src/unit_tests/rules/maximumindependentset_qubo.rs Updates MIS→QUBO reduction tests for renamed MIS type.
src/unit_tests/rules/maximumindependentset_maximumsetpacking.rs Updates MIS↔MSP reduction tests for renamed types.
src/unit_tests/rules/maximumindependentset_ilp.rs Updates MIS→ILP reduction tests for renamed MIS type.
src/unit_tests/registry/schema.rs Updates schema registry tests for renamed problems.
src/unit_tests/registry/category.rs Updates category registry tests for renamed subcategory variants.
src/unit_tests/reduction_graph.rs Updates reduction graph tests for renamed nodes and edges.
src/unit_tests/property.rs Updates property-based tests for renamed MIS/MVC types.
src/unit_tests/io.rs Updates IO tests for renamed MIS type (serde roundtrips).
src/unit_tests/export.rs Updates export tests that reference renamed problem names.
src/types.rs Minor rustdoc formatting tweak.
src/traits.rs Updates rustdoc examples to reflect renamed problems.
src/topology/mod.rs Updates module-level rustdoc example to renamed MIS type.
src/testing/mod.rs Updates docs/examples for testing macros to renamed types.
src/testing/macros.rs Updates rustdoc examples for macros to renamed types.
src/solvers/ilp/solver.rs Updates solver rustdoc example to renamed MIS type.
src/rules/unitdiskmapping/triangular/mod.rs Switches default triangular mapping to PathDecompositionMethod::Auto.
src/rules/unitdiskmapping/triangular/mapping.rs Switches default weighted triangular mapping to Auto and updates docs.
src/rules/unitdiskmapping/triangular/gadgets.rs Minor comment change in triangular gadget implementation area.
src/rules/unitdiskmapping/pathdecomposition.rs Adds Auto method and selection logic (≤30 exact, otherwise greedy).
src/rules/unitdiskmapping/ksg/mapping.rs Switches KSG mapping defaults to Auto and updates docs.
src/rules/unitdiskmapping/alpha_tensor.rs Minor rustdoc formatting tweak.
src/rules/sat_minimumdominatingset.rs Renames SAT→DominatingSet reduction to SAT→MinimumDominatingSet; updates overhead.
src/rules/sat_maximumindependentset.rs Renames SAT→IndependentSet reduction to SAT→MaximumIndependentSet; updates overhead.
src/rules/sat_ksat.rs Updates overhead metadata to incorporate literal-count terms.
src/rules/sat_coloring.rs Updates BoolVar import path and overhead formula.
src/rules/registry.rs Updates rustdoc examples to renamed problem names.
src/rules/mod.rs Renames and re-exports rule modules to match renamed problems.
src/rules/minimumvertexcover_qubo.rs Renames VC→QUBO rule to MVC→QUBO and updates tests path.
src/rules/minimumvertexcover_minimumsetcovering.rs Renames VC→SC rule to MVC→MSC and updates tests path.
src/rules/minimumvertexcover_maximumindependentset.rs Renames IS↔VC rule to MIS↔MVC and updates tests path.
src/rules/minimumvertexcover_ilp.rs Renames VC→ILP rule to MVC→ILP and updates tests path.
src/rules/minimumsetcovering_ilp.rs Renames SC→ILP rule to MSC→ILP and updates tests path.
src/rules/minimumdominatingset_ilp.rs Renames DS→ILP rule to MDS→ILP and updates tests path.
src/rules/maximumsetpacking_qubo.rs Renames SP→QUBO rule to MSP→QUBO and updates tests path.
src/rules/maximumsetpacking_ilp.rs Renames SP→ILP rule to MSP→ILP and updates tests path.
src/rules/maximummatching_maximumsetpacking.rs Renames Matching→SetPacking rule to MaximumMatching→MaximumSetPacking.
src/rules/maximummatching_ilp.rs Renames Matching→ILP rule to MaximumMatching→ILP and updates tests path.
src/rules/maximumindependentset_qubo.rs Renames IS→QUBO rule to MIS→QUBO and updates tests path.
src/rules/maximumindependentset_maximumsetpacking.rs Renames IS↔SP rule to MIS↔MSP and updates tests path.
src/rules/maximumindependentset_ilp.rs Renames IS→ILP rule to MIS→ILP and updates tests path.
src/rules/maximumclique_ilp.rs Renames Clique→ILP rule to MaximumClique→ILP and updates tests path.
src/rules/graph.rs Adds overhead serialization to reduction graph JSON; updates naming/doc path mappings.
src/rules/factoring_circuit.rs Updates overhead polynomial formula to use two-bit-size product.
src/rules/coloring_qubo.rs Fixes/updates overhead polynomial for coloring→QUBO variable count.
src/rules/coloring_ilp.rs Simplifies overhead definitions using poly! macro.
src/rules/circuit_spinglass.rs Escapes brackets in rustdoc so they render correctly.
src/registry/schema.rs Updates rustdoc example name for problem schema entries.
src/registry/info.rs Improves rustdoc formatting for type-name examples.
src/registry/category.rs Renames subcategory enum variants and updates documentation text.
src/polynomial.rs Adds Display impls and extends poly! to support variable products.
src/models/set/mod.rs Renames set modules/types to Minimum/Maximum variants and updates re-exports.
src/models/set/minimum_set_covering.rs Renames SetCovering→MinimumSetCovering and updates schema registration/tests.
src/models/set/maximum_set_packing.rs Renames SetPacking→MaximumSetPacking and updates schema registration/tests.
src/models/satisfiability/sat.rs Adds num_literals() and includes it in problem_size().
src/models/mod.rs Updates model re-exports and docs for renamed problems.
src/models/graph/mod.rs Renames graph modules/types to Minimum/Maximum variants and updates re-exports.
src/models/graph/minimum_vertex_cover.rs Renames VertexCovering→MinimumVertexCover and updates schema registration/tests.
src/models/graph/minimum_dominating_set.rs Renames DominatingSet→MinimumDominatingSet and updates schema registration/tests.
src/models/graph/maximum_matching.rs Renames Matching→MaximumMatching and updates schema registration/tests.
src/models/graph/maximum_independent_set.rs Renames IndependentSet→MaximumIndependentSet and updates schema registration/tests.
src/models/graph/maximum_clique.rs Renames Clique→MaximumClique and updates schema registration/tests.
src/lib.rs Updates crate docs and prelude exports to renamed problems.
src/io.rs Updates rustdoc examples for IO APIs to renamed problems.
src/export.rs Updates export struct rustdoc to reflect renamed problem naming.
scripts/generate_qubo_tests.py Renames generated fixture filenames to match renamed problems.
examples/reduction_sat_to_minimumdominatingset.rs Updates SAT→MDS example naming and exported filenames.
examples/reduction_sat_to_maximumindependentset.rs Updates SAT→MIS example naming and exported filenames.
examples/reduction_minimumvertexcover_to_qubo.rs Updates MVC→QUBO example naming and exported filenames.
examples/reduction_minimumvertexcover_to_minimumsetcovering.rs Updates MVC→MSC example naming and exported filenames.
examples/reduction_minimumvertexcover_to_maximumindependentset.rs Updates MVC→MIS example naming and exported filenames.
examples/reduction_minimumvertexcover_to_ilp.rs Updates MVC→ILP example naming and exported filenames.
examples/reduction_minimumsetcovering_to_ilp.rs Updates MSC→ILP example naming and exported filenames.
examples/reduction_minimumdominatingset_to_ilp.rs Updates MDS→ILP example naming and exported filenames.
examples/reduction_maximumsetpacking_to_qubo.rs Updates MSP→QUBO example naming and exported filenames.
examples/reduction_maximumsetpacking_to_ilp.rs Updates MSP→ILP example naming and exported filenames.
examples/reduction_maximummatching_to_maximumsetpacking.rs Updates MaximumMatching→MSP example naming and exported filenames.
examples/reduction_maximummatching_to_ilp.rs Updates MaximumMatching→ILP example naming and exported filenames.
examples/reduction_maximumindependentset_to_qubo.rs Updates MIS→QUBO example naming and exported filenames.
examples/reduction_maximumindependentset_to_minimumvertexcover.rs Updates MIS→MVC example naming and exported filenames.
examples/reduction_maximumindependentset_to_maximumsetpacking.rs Updates MIS→MSP example naming and exported filenames.
examples/reduction_maximumindependentset_to_ilp.rs Updates MIS→ILP example naming and exported filenames.
examples/reduction_maximumclique_to_ilp.rs Updates MaximumClique→ILP example naming and exported filenames.
docs/src/io.md Updates docs snippets to renamed problem types.
docs/src/introduction.md Updates reduction graph UI to show overhead and updates example naming.
docs/src/getting-started.md Updates getting-started snippets to renamed problem types.
benches/solver_benchmarks.rs Updates benchmark group names and problem types to renamed variants.
Comments suppressed due to low confidence (8)

src/models/graph/maximum_matching.rs:5

  • Doc comment repeats "Maximum" ("Maximum MaximumMatching"), which reads like a typo and is inconsistent with the type name. Update the module docs and the struct docs to consistently use "MaximumMatching" (or "Maximum Matching").
    examples/reduction_sat_to_maximumindependentset.rs:15
  • The output paths in the header comment are inconsistent: this example writes using the name "sat_to_mis", so the result file should be sat_to_mis.result.json (not sat_to_is.result.json).
    examples/reduction_maximumindependentset_to_maximumsetpacking.rs:15
  • Header comment still references the old result filename (is_to_setpacking.result.json), but this example writes under the name mis_to_msp (see write_example("mis_to_msp", ...)). Update the documented result path to docs/paper/examples/mis_to_msp.result.json for consistency.
    examples/reduction_maximumindependentset_to_minimumvertexcover.rs:14
  • The documented result filename (is_to_vc.result.json) doesn’t match the example name mis_to_mvc used in write_example. Update the header comment to reference docs/paper/examples/mis_to_mvc.result.json.
    src/rules/maximummatching_ilp.rs:4
  • Docstring has a duplicated word: "Maximum MaximumMatching". This should read "MaximumMatching" (or "Maximum Matching") to avoid confusing users and rustdoc search results.
    scripts/generate_qubo_tests.py:65
  • The JSON metadata here still uses old problem names (e.g., "problem": "VertexCovering") even though the file/test name is minimumvertexcover_to_qubo. Even if tests ignore this field today, it makes the dataset self-inconsistent and harder to reuse; consider updating these strings to the new Problem::NAME values (e.g., MinimumVertexCover, MaximumIndependentSet, MaximumSetPacking).
    save_test("minimumvertexcover_to_qubo", {
        "problem": "VertexCovering",
        "source": {"num_vertices": n_nodes, "edges": edges, "penalty": penalty},
        "qubo_matrix": Q.tolist(),
        "qubo_num_vars": int(Q.shape[0]),
        "qubo_optimal": qubo_result,
    }, outdir)

src/models/graph/maximum_matching.rs:28

  • The struct-level doc comment also contains the duplicated term "Maximum MaximumMatching". Update this header to "The MaximumMatching problem" (or "Maximum Matching") for consistency.
    examples/reduction_minimumvertexcover_to_maximumindependentset.rs:15
  • The header comment lists vc_to_is.result.json, but this example writes under mvc_to_mis (see write_example("mvc_to_mis", ...)). Update the documented result filename to docs/paper/examples/mvc_to_mis.result.json.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +145 to 147
/// MaximumMatching problems
MaximumMatching,
}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

GraphSubcategory::MaximumMatching looks like an accidental rename of the generic "matching" subcategory. Since name() still returns "matching", keeping the variant as Matching would avoid a breaking public API change and better reflect the category concept.

Copilot uses AI. Check for mistakes.
Comment on lines 279 to 285
pub enum StringSubcategory {
/// Sequence problems (superstring, subsequence)
Sequence,
/// String matching
Matching,
MaximumMatching,
/// Compression problems
Compression,
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

StringSubcategory::MaximumMatching reads like a problem-specific rename rather than a generic category label. If this was meant to remain the string-matching subcategory, consider keeping the variant name Matching to avoid breaking the public API.

Copilot uses AI. Check for mistakes.
Comment on lines 917 to 919
// ============================================================================
// Pattern Matching and Application Functions
// Pattern MaximumMatching and Application Functions
// ============================================================================
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Comment header looks like an accidental search/replace: it says "Pattern MaximumMatching..." but the section is about general pattern matching for gadgets. Rename it back to "Pattern Matching and Application Functions" to avoid confusion.

Copilot uses AI. Check for mistakes.
GiggleLiu and others added 6 commits February 10, 2026 23:20
Edge documentation:
- Add module_path field to ReductionEntry, populated via module_path!()
  in the proc macro and 3 manual inventory::submit! calls
- Add doc_path to EdgeJson, computed from module_path
- Add edge double-click handler to navigate to reduction module rustdoc

Compound variant nodes:
- Replace base-node-only filtering with compound parent + variant children
- Parent nodes show problem name with dashed border, children show variant
  (Unweighted/Weighted/etc.)
- Edges connect variant nodes directly, preserving full reduction detail
- Update all event handlers (tooltip, path selection, edge click)

Also fix problem-def Typst function to accept (name, title, body) matching
all 16 call sites, and update CLAUDE.md/rules documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace compound node grouping with flat nodes where variant nodes are
placed physically near their parent problem. Base variants sit at the
cose-computed position labeled with the problem name; non-base variants
are offset below labeled like "ProblemName (Weighted)". Edge double-click
now navigates to GitHub source. Also: remove mermaid dependency, enable
previously ignored tests, simplify paper problem-def signatures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace trivial P4/K3/C4 instances across 30 examples with Petersen
graph (canonical), Octahedron (clique), random 3-SAT(5,7), and other
non-trivial instances sized 6-10 variables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
13 tasks covering all 30 example files: Petersen graph for graph problems,
octahedron for clique, 5-var 3-SAT, Petersen SpinGlass, full adder circuit,
6-var knapsack ILP, and factor 35=5x7.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename example files to strictly follow lower(ProblemName) convention
(sat→satisfiability, circuit→circuitsat, coloring→kcoloring). Replace
hardcoded write_example names with env!("CARGO_BIN_NAME") and auto-derive
Typst example references from source/target. Also fix PR review comments:
doubled words, stale headers, coverage gaps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@GiggleLiu GiggleLiu merged commit c400651 into main Feb 10, 2026
3 checks passed
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