一键导入
topology-sanity-check
Run sanity checks on the reduction graph topology — detect orphan (isolated) problems, NP-hardness proof gaps, and redundant reduction rules
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run sanity checks on the reduction graph topology — detect orphan (isolated) problems, NP-hardness proof gaps, and redundant reduction rules
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when you want to take a Backlog issue all the way to Final review without manual orchestration — chains check-issue, fix-issue, add-model/add-rule, run-pipeline, and review-pipeline; substantive issue-quality problems are sent to a rewrite subagent; algorithmically unsalvageable issues are parked on OnHold
Use when reviewing a [Rule] or [Model] GitHub issue for quality before implementation — checks usefulness, non-triviality, correctness of literature claims, and writing quality
Use when a user wants to propose a new problem model or reduction rule — guides them through brainstorming, clarifies the design, and files a GitHub issue
Review the Typst paper (docs/paper/reductions.typ) for quality issues — evaluates 10 entries per session, reports mechanical and critical issues without fixing
Reverse of find-solver — given a solver for a model, discover what other problems it can handle via incoming reductions, ranked by effective complexity
Interactive guide — match a real-world problem to a library model, explore reduction paths, recommend solvers (built-in + external), and generate a solution doc
基于 SOC 职业分类
| name | topology-sanity-check |
| description | Run sanity checks on the reduction graph topology — detect orphan (isolated) problems, NP-hardness proof gaps, and redundant reduction rules |
Runs structural health checks on the reduction graph. Detects orphan problems, verifies NP-hardness proof chains from 3-SAT, and identifies redundant reduction rules dominated by composite paths.
/topology-sanity-check # Run ALL checks
/topology-sanity-check orphans # Orphan detection only
/topology-sanity-check np-hardness # 3-SAT reachability only
/topology-sanity-check redundancy # Rule redundancy only
/topology-sanity-check redundancy <source> <target> # Check a specific rule
Examples:
/topology-sanity-check
/topology-sanity-check orphans
/topology-sanity-check np-hardness
/topology-sanity-check redundancy
/topology-sanity-check redundancy MIS ILP
orphans)Finds problem types that have no reduction rules connecting them to the main graph — they are registered but unreachable.
cargo run --example detect_isolated_problems 2>&1
Parse the output and produce:
## Orphan Detection Report
### Graph Summary
- Total problem types: N
- Connected components: N
### Isolated Problems (N)
| # | Problem | Variants | Category |
|---|---------|----------|----------|
| 1 | ProblemName | 2 (f64, i32) | algebraic |
### Existing Issues
For each isolated problem, search GitHub for open issues that would connect it:
gh issue list --repo CodingThrust/problem-reductions --state open --search "<problem name>" --json number,title
Report matches or "No issues filed".
### Verdict
- **All connected**: Every problem type is reachable from the main component.
- **N orphans found**: List them and reference issue #610 (meta-issue tracking connectivity).
np-hardness)Verifies that every NP-hard problem has a directed reduction path from 3-SAT, constituting a proof of NP-hardness. Problems without such a path are classified as: in P (correctly unreachable), intermediate complexity, orphans, or NP-hard with a missing proof chain.
cargo run --example detect_unreachable_from_3sat 2>&1
Parse the output and produce:
## NP-Hardness Proof Chain Report
### Summary
- Total problem types: N
- Reachable from 3-SAT: N
- Not reachable: N
### Reachable from 3-SAT (N)
| # | Problem | Hops |
|---|---------|------|
| 1 | KSatisfiability | 0 |
| 2 | Satisfiability | 1 |
### NP-hard but missing proof chain (N) — needs new reductions
| # | Problem | Outgoing | Incoming |
|---|---------|----------|----------|
| 1 | MaximumClique | 1 | 0 |
### Correctly unreachable
**In P:** MaximumMatching, KSatisfiability(K2), KColoring(K2)
**Intermediate complexity:** Factoring
### Orphans (no edges at all)
[list]
### Verdict
- **PASS**: All NP-hard problems have proof chains from 3-SAT
- **WARN**: N NP-hard problems missing proof chains (list them)
The script automatically classifies unreachable problems. Problems with 0 incoming AND 0 outgoing reductions are orphans. Known P-time problems (MaximumMatching, 2-SAT, 2-Coloring) and intermediate-complexity problems (Factoring) are flagged as correctly unreachable. Everything else is reported as a missing proof chain.
redundancy)Determines whether reduction rules are redundant (dominated by composite paths through the reduction graph). Can check all primitive rules or a single source-target pair.
redundancy)Run the codebase's find_dominated_rules analysis test:
cargo test test_find_dominated_rules_returns_known_set -- --nocapture 2>&1
This runs the analysis from src/rules/analysis.rs which:
Always report rules with full variant-qualified endpoints, not just base names.
Use the same display style as ReductionStep, e.g.
MaximumIndependentSet {graph: "SimpleGraph", weight: "One"} -> MaximumIndependentSet {graph: "KingsSubgraph", weight: "i32"}.
Base-name-only summaries are ambiguous and can hide cast-only paths.
Parse the test output and report:
## Rule Redundancy Report
### Dominated Rules (N)
| # | Rule | Dominating Path |
|---|------|-----------------|
| 1 | Source {variant...} -> Target {variant...} | A -> B -> C |
### Unknown Comparisons (N)
| # | Rule | Reason |
|---|------|--------|
| 1 | Source {variant...} -> Target {variant...} | expression comparison returned Unknown |
### Allowed (acknowledged) dominated rules
List the entries from the `allowed` set in `test_find_dominated_rules_returns_known_set`
(file: `src/unit_tests/rules/analysis.rs`), and note when that allow-list is keyed only by base names while the reported dominated rule is variant-specific.
### Verdict
- If test passes: all dominated rules are acknowledged in the allow-list.
- If test fails: report the unexpected dominated rule or stale allow-list entry.
Use MCP tools (show_problem) to validate and resolve aliases (MIS = MaximumIndependentSet, MVC = MinimumVertexCover, SAT = Satisfiability, etc.).
Use show_problem on the source and check its reduces_to array for a direct edge to the target.
<source> -> <target> already exists" and proceed to redundancy analysis (Step 3).<source> -> <target> exists yet." Then check if any path exists:
find_path MCP tool.Use find_path with all: true to get all paths between source and target.
For each composite path (length > 1 step):
Dominance definition: A composite path dominates the direct rule if, on every common overhead field, the composite's expression has equal or smaller asymptotic growth.
## Redundancy Check: <Source> -> <Target>
### Direct Rule
- Rule: `Source {variant...} -> Target {variant...}`
- Overhead: [field = expr, ...]
### Composite Paths Found: N
| # | Path | Steps | Overhead | Comparison |
|---|------|-------|----------|------------|
| 1 | A -> B -> C | 2 | field = expr | Dominates / Worse / Unknown |
### Verdict
- **Redundant**: At least one composite path dominates the direct rule
- **Not Redundant**: No composite path dominates the direct rule
- **Inconclusive**: Some paths have Unknown comparison (non-polynomial overhead)
### Recommendation
If redundant:
> The direct rule `Source {variant...} -> Target {variant...}` is dominated by the composite path `[path]`.
> Consider removing it unless it provides value for:
> - Simpler solution extraction (fewer intermediate steps)
> - Educational/documentation clarity
> - Better numerical behavior in practice
If not redundant:
> The direct rule `Source {variant...} -> Target {variant...}` is not dominated by any composite path.
> It provides overhead that cannot be achieved through existing reductions.
When invoked with no arguments, run all three checks and produce a combined report. Run Check 1 and Check 2 in parallel (both are cargo run --example), then Check 3 sequentially:
# Topology Sanity Check
## 1. Orphan Detection
[orphan report]
## 2. NP-Hardness Proof Chains
[np-hardness report]
## 3. Rule Redundancy
[redundancy report]
## Summary
- Orphans: N isolated problems
- NP-hard without proof chain: N
- Dominated rules: N (M acknowledged)
- Unknown comparisons: N
- Overall: PASS / WARN / FAIL
Overall verdict:
num_vertices vs num_clauses), comparison may not be meaningful — report as Unknownsrc/rules/analysis.rs (find_dominated_rules) with the allow-list in src/unit_tests/rules/analysis.rs (test_find_dominated_rules_returns_known_set)