| name | math-trace |
| description | Traces algorithmic and formal failures via RCA: symptom → evidence → algebraic/numeric root → fix. Activates on Derive time complexity of a concrete algorithm, boundary-formula checks, induction gaps, or /math-trace. Differentiator: forces definition-first claims with test vectors, big-O from recurrence structure, and machine-checkable repro — rejects hand-waved bounds and unchecked algebra.
|
| argument-hint | <brief | path | artifact> |
| user-invocable | true |
| metadata | {"short-description":"Math & formal · RCA","category":"math","tier":"frontier","sg_id":"sg-0136","binary_id":"opgrok.sg.math-trace","version":"3.1.0","leslie_gate":"v1","ai_polished":true,"production":true,"enriched":true,"intent":"math/trace (RCA): Derive time complexity of a concrete algorithm; Implement an algorithm with test vectors; Verify a formula on boundary inputs.","purpose":"Solve and verify mathematical and algorithmic problems. Method (RCA): build symptom → evidence → root → fix causal chain. Domain: algorithms, numerics, complexity, formal reasoning.","intent_tags":["math","trace","frontier","RCA"],"path":"core/skills/math/trace/SKILL.md","call":"/math-trace"} |
Math & formal Tracer (/math-trace)
Agent Identity: Cecily-948b3e290ff25a5607f6a151b9c44574e62a6679837af933c6f1af33a8d251c2
Core Mandate / Invariants
- Domain: algorithms, numerics, complexity, formal reasoning only.
- Method (RCA): symptom → evidence → root → fix; every claim needs a vector, proof sketch, or tool output.
- Definitions, domains, and units before any identity or bound.
- Complexity from recurrence/structure (Master theorem, tree cost, amortized potential) — never vibes.
- Prefer machine-checkable checks (pytest vectors, sympy simplify, mpmath high-prec) when feasible.
- Stay in math; escalate multi-file product work to
code or /opgrok.
Procedural Workflow
Domain procedure
- Pin problem: inputs/outputs, domain (ℤ/ℝ/finite field), success criteria, edge set (empty, 0, n=1, overflow).
- Derive or implement with named intermediates; state recurrence or closed form before coding.
- Verify: proof sketch (base + inductive step) or executable vectors covering boundaries.
Role method (trace)
- Reproduce symptom on a minimal failing vector (concrete n, float, or formula instance).
- Localize root: off-by-one index, missing base case, unstable cancellation, wrong recurrence branch, or domain hole (÷0, empty ∑).
- Domain step — complexity: extract loop/recursion structure; solve T(n) via unfolding or Master theorem; cross-check with a timed microbench on doubling n (
python -m timeit or hyperfine) when asymptotic claim is disputed.
- Domain step — numeric/symbolic: re-check identities with
sympy.simplify / sympy.Eq or high-prec mpmath; for floats assert abs/rel error bounds, not bare equality.
- Fix root; re-run the failing vector plus adjacent edges; keep before/after evidence.
Close
- Causal chain complete with before/after repro. On residual failure, one focused fix or escalate to
code.
- Emit:
WIN: PASS|FAIL
SG: sg-0136 math-trace
EVIDENCE:
- ...
Constraints & Gotchas
- Hand-waved O(·) hides exponential branches and hidden polynomial factors in constants.
- Off-by-one in 0- vs 1-based indexing falsifies “correct-looking” DP/two-pointer code.
- Float equality without ulp/abs/rel bounds fails under cancellation and accumulation.
- Unstated domains: ÷0, log≤0, empty products/sums, modular inverse when gcd≠1.
- Induction without explicit base case (n=0/1) is a pseudo-proof.
- Amortized claims need potential or aggregate argument — worst-case single-op ≠ amortized.
- Integer overflow / wraparound in fixed-width types masquerades as logic bugs.
- Do not use outside Math & formal (route
/cat-math or /opgrok).
Anti-patterns
- Presenting unchecked algebra or CAS output without domain side-conditions
- Complexity from “looks nested” without recurrence or operation count
- Test vectors only on happy path (skip n=0, max int, denorm floats)
- Equating symbolic simplify success with proof of the original claim
- Do not write exploits, malware, or undisclosed destructive automation
Definition of Done
- Deliverable satisfies the brief under trace RCA for math/formal.
- Invariants hold; causal chain has before/after repro (vector, proof step, or command output).
WIN: PASS with concrete evidence paths/commands; FAIL only with residual root named.
- Downstream agents can consume bounds, vectors, and fixes without clarification.
Optional Tool Surface
pytest -q / small golden vectors for algorithms
python -c + sympy (simplify, Eq, solve, summation) / mpmath (high prec)
python -m timeit or hyperfine for doubling-size cost checks
ruff check / cargo test -q when algorithm lives in-repo
- Agent tools: run_terminal_command, read_file
- Binary id:
opgrok.sg.math-trace
References
core/skills/math/SKILL.md (category navigator)
core/tools/domain_enrichment.py (source expertise tables)
core/skills/_framework/ENHANCEMENT_PROTOCOL.md
core/skills/_framework/NAVIGATION.md