Skip to content
12 changes: 6 additions & 6 deletions .claude/skills/add-model/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Before any implementation, collect all required information. If called from `iss
| 8 | **Objective function** | How to compute the metric | "Sum of weights of selected vertices" |
| 9 | **Best known exact algorithm** | Complexity with variable definitions | "O(1.1996^n) by Xiao & Nagamochi (2017), where n = \|V\|" |
| 10 | **Solving strategy** | How it can be solved | "BruteForce works; ILP reduction available" |
| 11 | **Category** | Which sub-module under `src/models/` | `graph`, `optimization`, `satisfiability`, `set`, `specialized` |
| 11 | **Category** | Which sub-module under `src/models/` | `graph`, `formula`, `set`, `algebraic`, `misc` |

If any item is missing, ask the user to provide it. Do NOT proceed until the checklist is complete.

## Reference Implementations

Read these first to understand the patterns:
- **Optimization problem:** `src/models/graph/maximum_independent_set.rs`
- **Satisfaction problem:** `src/models/satisfiability/sat.rs`
- **Satisfaction problem:** `src/models/formula/sat.rs`
- **Model tests:** `src/unit_tests/models/graph/maximum_independent_set.rs`
- **Trait definitions:** `src/traits.rs` (`Problem`, `OptimizationProblem`, `SatisfactionProblem`)
- **CLI dispatch:** `problemreductions-cli/src/dispatch.rs`
Expand All @@ -42,11 +42,11 @@ Read these first to understand the patterns:
## Step 1: Determine the category

Choose the appropriate sub-module under `src/models/`:
- `graph/` -- problems defined on graphs (vertex/edge selection)
- `optimization/` -- generic optimization formulations (QUBO, ILP, SpinGlass)
- `satisfiability/` -- boolean satisfaction problems (SAT, k-SAT)
- `graph/` -- problems defined on graphs (vertex/edge selection, SpinGlass, etc.)
- `formula/` -- logical formulas and circuits (SAT, k-SAT, CircuitSAT)
- `set/` -- set-based problems (set packing, set cover)
- `specialized/` -- problems that don't fit other categories (factoring, circuit, paintshop)
- `algebraic/` -- matrices, linear systems, lattices (QUBO, ILP, CVP, BMF)
- `misc/` -- unique input structures that don't fit other categories (BinPacking, PaintShop, Factoring)

## Step 1.5: Infer problem size getters

Expand Down
9 changes: 5 additions & 4 deletions .claude/skills/review-implementation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ if [ -n "$PR_NUM" ]; then
ISSUE_NUM=$(gh pr view $PR_NUM --json body -q .body | grep -oE '#[0-9]+' | head -1 | tr -d '#')
fi

# Fetch the issue body if found
# Fetch the issue body and comments if found
if [ -n "$ISSUE_NUM" ]; then
ISSUE_BODY=$(gh issue view $ISSUE_NUM --json title,body -q '"# " + .title + "\n\n" + .body')
ISSUE_COMMENTS=$(gh issue view $ISSUE_NUM --json comments -q '.comments[] | "**" + .author.login + "** (" + .createdAt + "):\n" + .body + "\n"')
fi
```

If an issue is found, pass it as `{ISSUE_CONTEXT}` to both subagents. If not, set `{ISSUE_CONTEXT}` to "No linked issue found."
If an issue is found, pass `{ISSUE_CONTEXT}` (title + body + comments) to both subagents. If not, set `{ISSUE_CONTEXT}` to "No linked issue found." Comments often contain clarifications, corrections, or additional requirements from maintainers.

## Step 3: Dispatch Subagents in Parallel

Expand All @@ -83,7 +84,7 @@ Dispatch using `Agent` tool with `subagent_type="superpowers:code-reviewer"`:
- `{REVIEW_PARAMS}` -> summary of what's being reviewed
- `{PROBLEM_NAME}`, `{CATEGORY}`, `{FILE_STEM}` -> for model reviews
- `{SOURCE}`, `{TARGET}`, `{RULE_STEM}`, `{EXAMPLE_STEM}` -> for rule reviews
- `{ISSUE_CONTEXT}` -> full issue title + body (or "No linked issue found.")
- `{ISSUE_CONTEXT}` -> full issue title + body + comments (or "No linked issue found.")
- Prompt = filled template

### Quality Reviewer (always)
Expand All @@ -96,7 +97,7 @@ Dispatch using `Agent` tool with `subagent_type="superpowers:code-reviewer"`:
- `{CHANGED_FILES}` -> list of changed files
- `{PLAN_STEP}` -> description of what was implemented (or "standalone review")
- `{BASE_SHA}`, `{HEAD_SHA}` -> git range
- `{ISSUE_CONTEXT}` -> full issue title + body (or "No linked issue found.")
- `{ISSUE_CONTEXT}` -> full issue title + body + comments (or "No linked issue found.")
- Prompt = filled template

**Both subagents must be dispatched in parallel** (single message with two Agent tool calls — use `run_in_background: true` on one, foreground on the other, then read the background result with `TaskOutput`).
Expand Down
27 changes: 27 additions & 0 deletions docs/agent-profiles/pred-sym-prof-yuki-tanaka.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# pred-sym-prof-yuki-tanaka

## Target
pred-sym (symbolic expression CLI)

## Use Case
Three combined scenarios:
1. **Complexity comparison** — Compare algorithm complexity expressions to determine asymptotic equivalence (e.g., O(n^2 + n) == O(n^2), O(n log n) != O(n^2)).
2. **Reduction overhead audit** — Parse and simplify overhead expressions from reduction rules to verify they match expected growth (e.g., '3*num_vertices + num_edges^2').
3. **Teaching complexity notation** — Use pred-sym as a learning/demonstration tool to explore how expressions simplify, evaluate at concrete sizes, and compare growth rates.

## Expected Outcome
All subcommands (parse, canon, big-o, eval, compare) produce mathematically correct, clear output. Canonical and Big-O forms are rigorous. Edge cases (zero exponents, nested functions, multi-variable expressions) are handled gracefully with precise error messages.

## Agent

### Background
Prof. Yuki Tanaka is a theoretical computer science professor at a research university, specializing in computational complexity and approximation algorithms. She regularly teaches graduate courses on NP-hard problems and writes textbooks. She evaluates tools against textbook definitions and mathematical rigor standards.

### Experience Level
Expert

### Decision Tendencies
Stress-tests edge cases systematically — zero, negative, nested, degenerate inputs. Expects mathematically rigorous output and will flag any algebraically incorrect simplification. Compares results against textbook definitions of canonical forms and asymptotic notation. Tests all subcommands in sequence, then tries to compose them in shell pipelines.

### Quirks
Will try expressions with Unicode math symbols to see what happens. Tests the boundary between polynomial and exponential complexity deliberately. Expects `--help` to be precise and well-organized — gets annoyed by imprecise language like "simplify" when "canonicalize" is meant. Will attempt to pipe output of one subcommand into another.
32 changes: 32 additions & 0 deletions docs/paper/reductions.typ
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"BinPacking": [Bin Packing],
"ClosestVectorProblem": [Closest Vector Problem],
"SubsetSum": [Subset Sum],
"MinimumFeedbackVertexSet": [Minimum Feedback Vertex Set],
)

// Definition label: "def:<ProblemName>" — each definition block must have a matching label
Expand Down Expand Up @@ -537,6 +538,37 @@ caption: [Path $P_5$ with maximal IS $S = {v_1, v_3}$ (blue, $w(S) = 2$). $S$ is
) <fig:path-maximal-is>
]

#problem-def("MinimumFeedbackVertexSet")[
Given a directed graph $G = (V, A)$ with vertex weights $w: V -> RR$, find $S subset.eq V$ minimizing $sum_(v in S) w(v)$ such that the induced subgraph $G[V backslash S]$ is a directed acyclic graph (DAG).
][
One of Karp's 21 NP-complete problems ("Feedback Node Set") @karp1972. Applications include deadlock detection in operating systems, loop breaking in circuit design, and Bayesian network structure learning. The directed version is strictly harder than undirected FVS: the best known exact algorithm runs in $O^*(1.9977^n)$ @razgon2007, compared to $O^*(1.7548^n)$ for undirected graphs. An $O(log n dot log log n)$-approximation exists @even1998.

*Example.* Consider the directed graph $G$ with $n = 5$ vertices, $|A| = 7$ arcs, and unit weights. The arcs form two overlapping directed cycles: $C_1 = v_0 -> v_1 -> v_2 -> v_0$ and $C_2 = v_0 -> v_3 -> v_4 -> v_1$. The set $S = {v_0}$ with $w(S) = 1$ is a minimum feedback vertex set: removing $v_0$ breaks both cycles, leaving a DAG with topological order $(v_3, v_4, v_1, v_2)$. No 0-vertex set suffices since $C_1$ and $C_2$ overlap only at $v_0$ and $v_1$, and removing $v_1$ alone leaves $C_1' = v_0 -> v_3 -> v_4 -> v_1 -> v_2 -> v_0$.

#figure({
// Directed graph: 5 vertices, 7 arcs, two overlapping cycles
let verts = ((0, 1), (2, 1), (1, 0), (-0.5, -0.2), (0.8, -0.5))
let arcs = ((0, 1), (1, 2), (2, 0), (0, 3), (3, 4), (4, 1), (2, 4))
let highlights = (0,) // FVS = {v_0}
canvas(length: 1cm, {
// Draw directed arcs with arrows
for (u, v) in arcs {
draw.line(verts.at(u), verts.at(v),
stroke: 1pt + black,
mark: (end: "straight", scale: 0.4))
}
// Draw nodes on top
for (k, pos) in verts.enumerate() {
let s = highlights.contains(k)
g-node(pos, name: "v" + str(k),
fill: if s { graph-colors.at(0) } else { white },
label: if s { text(fill: white)[$v_#k$] } else { [$v_#k$] })
}
})
},
caption: [A directed graph with FVS $S = {v_0}$ (blue, $w(S) = 1$). Removing $v_0$ breaks both directed cycles $v_0 -> v_1 -> v_2 -> v_0$ and $v_0 -> v_3 -> v_4 -> v_1$, leaving a DAG.],
) <fig:fvs-example>
]

== Set Problems

Expand Down
19 changes: 19 additions & 0 deletions docs/paper/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,25 @@ @inproceedings{aggarwal2015
doi = {10.1109/FOCS.2015.41}
}

@inproceedings{razgon2007,
author = {Igor Razgon},
title = {Computing Minimum Directed Feedback Vertex Set in {$O^*(1.9977^n)$}},
booktitle = {Proceedings of the 10th Italian Conference on Theoretical Computer Science (ICTCS)},
pages = {70--81},
year = {2007}
}

@article{even1998,
author = {Guy Even and Joseph Naor and Baruch Schieber and Madhu Sudan},
title = {Approximating Minimum Feedback Sets and Multicuts in Directed Graphs},
journal = {Algorithmica},
volume = {20},
number = {2},
pages = {151--174},
year = {1998},
doi = {10.1007/PL00009191}
}

@article{shannon1956,
author = {Claude E. Shannon},
title = {The zero error capacity of a noisy channel},
Expand Down
16 changes: 16 additions & 0 deletions docs/src/reductions/problem_schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,22 @@
}
]
},
{
"name": "MinimumFeedbackVertexSet",
"description": "Find minimum weight feedback vertex set in a directed graph",
"fields": [
{
"name": "graph",
"type_name": "DirectedGraph",
"description": "The directed graph G=(V,A)"
},
{
"name": "weights",
"type_name": "Vec<W>",
"description": "Vertex weights w: V -> R"
}
]
},
{
"name": "MinimumSetCovering",
"description": "Find minimum weight collection covering the universe",
Expand Down
Loading
Loading