بنقرة واحدة
write-model-in-paper
Use when writing or improving a problem-def entry in the Typst paper (docs/paper/reductions.typ)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when writing or improving a problem-def entry in the Typst paper (docs/paper/reductions.typ)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
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
| name | write-model-in-paper |
| description | Use when writing or improving a problem-def entry in the Typst paper (docs/paper/reductions.typ) |
Full authoring guide for writing a problem-def entry in docs/paper/reductions.typ. Covers formal definition, background, examples with visualization, and verification.
Note: This content is also inlined in
add-modelStep 6 (condensed form). This standalone version has more detail and is useful for improving existing entries.
Before using this skill, ensure:
src/models/<category>/<name>.rs)src/example_db/model_builders.rscargo run --example export_graph && cargo run --example export_schemas)MaximumIndependentSet in docs/paper/reductions.typ is the gold-standard model example. Search for problem-def("MaximumIndependentSet") to see the complete entry. Use it as a template for style, depth, and structure.
problem-def Function#problem-def("ProblemName")[
Formal definition... // parameter 1: def
][
Background, example, figure... // parameter 2: body
]
Three parameters:
name (string) — problem name matching display-name dictionary keydef (content) — formal mathematical definitionbody (content) — background, examples, figures, algorithm listAuto-generated between def and body:
declare_variants! metadata)Add to the display-name dictionary near the top of reductions.typ:
"ProblemName": [Display Name],
def parameter)One self-contained sentence or short paragraph. Requirements:
Given [inputs with domains], find [solution variable] [maximizing/minimizing] [objective] such that [constraints].
Given [inputs with domains], find [solution variable] such that [constraints].
Given $G = (V, E)$ with vertex weights $w: V -> RR$, find $S subset.eq V$
maximizing $sum_(v in S) w(v)$ such that no two vertices in $S$ are
adjacent: $forall u, v in S: (u, v) in.not E$.
The body goes AFTER the auto-generated sections (complexity, reductions, schema). It contains four parts in order:
1-3 sentences covering:
If the user provides specific justification or motivation, incorporate it here.
Must clearly state which algorithm gives the best complexity and cite reference. Add a warning as footnote if no reliable reference is found.
Integrate algorithm complexity naturally into the background prose — do NOT append a terse "Best known: $O^*(...)$" at the end:
% Good: names the algorithm, cites reference
The best known algorithm runs in $O^*(1.1996^n)$ time via measure-and-conquer
branching @xiao2017.
% Good: brute-force with footnote when no better algorithm is known
The best known algorithm runs in $O^*(2^n)$ by brute-force
enumeration#footnote[No algorithm improving on brute-force is known for ...].
% Bad: terse appendage, no algorithm name, no reference
Best known: $O^*(2^n)$.
For problems with multiple notable algorithms or special cases, weave them into the text:
Solvable in $O(n+m)$ for $k=2$ via bipartiteness testing. For $k=3$, the best
known algorithm runs in $O^*(1.3289^n)$ @beigel2005; in general, inclusion-exclusion
achieves $O^*(2^n)$ @bjorklund2009.
Citation rules:
@key) identifying the algorithm#footnote[No algorithm improving on brute-force enumeration is known for ...]#footnote[Complexity not independently verified from literature.]Consistency note: The auto-generated complexity table (from declare_variants!) also shows complexity per variant. The written text and the auto-generated table may overlap. Keep both — the written text provides references and context; the auto-generated table provides per-variant detail. A future verification step will check consistency between them.
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.
make regenerate-fixtures to refresh src/example_db/fixtures/examples.json.src/example_db/fixtures/examples.json under models — it contains the canonical instance, samples, and optimal fields.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}).optimal configurations to show the solution.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.
*Example.* Consider [instance description with concrete numbers from `examples.json`].
[Describe the solution and why it's valid/optimal].
#figure({
// visualization code — see MaximumIndependentSet for graph rendering pattern
},
caption: [Caption describing the figure with key parameters],
) <fig:problem-example>
Add a pred-commands() block after the *Example.* paragraph and before the #figure. The pred create --example ... spec must be derived from the loaded example data, not handwritten:
#let problem-spec(data) = {
if data.variant.len() == 0 { data.problem }
else { data.problem + "/" + data.variant.values().join("/") }
}
#pred-commands(
"pred create --example " + problem-spec(x) + " -o <name>.json",
"pred solve <name>.json",
"pred evaluate <name>.json --config " + x.optimal_config.map(str).join(","),
)
If docs/paper/reductions.typ already defines a shared problem-spec() helper, reuse it instead of reintroducing it locally. Do not guess whether the default variant matches the canonical example; canonical fixtures may live on non-default variants, and handwritten bare aliases can silently produce broken commands.
For satisfaction problems, replace pred solve with pred solve <name>.json --solver brute-force if the problem has no ILP reduction path.
For graph problems, use the paper's existing graph helpers:
petersen-graph(), house-graph() or define custom vertex/edge listscanvas(length: ..., { ... }) with g-node() and g-edge()graph-colors.at(0) (blue) and use white fill for non-solutionRefer to the MaximumIndependentSet entry for the complete graph rendering pattern. Adapt it to your problem.
Explain how a configuration is evaluated — this maps to the Rust evaluate() method:
This can be woven into the example text (as MIS does: "$w(S) = sum_(v in S) w(v) = 4 = alpha(G)$").
# Build the paper (auto-runs export_graph + export_schemas)
make paper
display-name dictionarydef is defined before first use@citation or footnote warningsrc/example_db/fixtures/examples.json canonical example (not independently invented)make paper succeeds without errorspred-commands() block after example text, before figure, with create/solve/evaluate pipeline