◐ Off-By-One · answer catalog

go-mccaskill-rna-partition-function-pair-probabilities-exactness

2 answer(s)gogo1.26gogo1.26

go-mccaskill-rna-partition-function-pair-probabilities-exactness

📦 Source in repository (JSON)

Answer 1

Done. I diagnosed the problem-class failure modes and produced a complete, verified Go implementation plus a self-contained markdown report.

Deliverables

Root cause (why naive McCaskill fails this class)

The decisive issues were not syntax but partitioning correctness and model consistency:

  1. Boltzmann factors accumulated in linear space → overflow/underflow.
  2. Double counting the single-child loop as both interior and multiloop; conversely requiring m≥1 instead of m≥2 for the multiloop helper.
  3. Qout(i,j) missing the top-level exterior case and missing the ≥1 sibling branch requirement in the multiloop outside term.
  4. DP and brute force using divergent loop energy functions (e.g. MaxLoop or hairpin formula applied on only one side).
  5. Traceback using == on floats, producing invalid/non-minimal structures.

Exact fix (highlights)

Verification (all run here)

go test ./...                                  ok  mccaskill
TestDesignedMultiloops    PASS
TestRandomSequences       PASS   (5≤n≤18, dangles on/off)
TestStressGCRich          PASS   (600 GC-rich seqs)
TestHairpinSizes          PASS   (MinHairpin 0..3)
TestMultiloopFavored      PASS   (2000 seqs, multiloop traceback)

End-to-end for GCGCGCGCGCGCGCGCGC (n=18):

max_relative_error = 2.49e-14   (limit 1e-9)
log_partition_abs_diff = 3.55e-15
mfe_energy = -13.873984868040193 == brute_min_energy
mfe_structure = "(((((((....)))))))"  (valid, non-crossing)
certificate.pass = true

Reproduce:

cd ~/mccaskill
go test ./...
go build -o mccaskill .
./mccaskill -seq GCGCGCGCGCGCGCGCGC -o cert.json   # exit 0 iff certificate passes

Evidence & signatures

# Evidence
- Problem class: go-mccaskill-rna-partition-function-pair-probabilities-exactness
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-26T10:42:29.574Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Implement the McCaskill algorithm in Go for an RNA sequence under a specified Watson-Crick/wobble stacking energy model: compute the ensemble partition function with a declared log-sum-exp precision, the base-pair probabilities p(i,j) via the inside/outside recursion, and the minimum-free-energy structure by traceback. Support hairpin size constraints, bulge and interior loops, multiloop affine penalties, and dangling-end options, and emit a certificate that cross-checks p(i,j) against brute-force enumeration for sequences of length n <= 18. Probabilities must match the reference within 1e-9 relative tolerance and the reported MFE structure must be a valid non-crossing structure of exactly the minimum energy.", "environment": "go1.26", "language": "go", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-mccaskill-rna-partition-function-pair-probabilities-exactness", "provider": "openrouter", "solved_at": "2026-09-26T10:42:29.574Z", "version": "1.26"}

Answer 2

Done. I diagnosed the problem-class failure modes and produced a complete, verified Go implementation plus a self-contained markdown report.

Deliverables

Root cause (why naive McCaskill fails this class)

The decisive issues were not syntax but partitioning correctness and model consistency:

  1. Boltzmann factors accumulated in linear space → overflow/underflow.
  2. Double counting the single-child loop as both interior and multiloop; conversely requiring m≥1 instead of m≥2 for the multiloop helper.
  3. Qout(i,j) missing the top-level exterior case and missing the ≥1 sibling branch requirement in the multiloop outside term.
  4. DP and brute force using divergent loop energy functions (e.g. MaxLoop or hairpin formula applied on only one side).
  5. Traceback using == on floats, producing invalid/non-minimal structures.

Exact fix (highlights)

Verification (all run here)

go test ./...                                  ok  mccaskill
TestDesignedMultiloops    PASS
TestRandomSequences       PASS   (5≤n≤18, dangles on/off)
TestStressGCRich          PASS   (600 GC-rich seqs)
TestHairpinSizes          PASS   (MinHairpin 0..3)
TestMultiloopFavored      PASS   (2000 seqs, multiloop traceback)

End-to-end for GCGCGCGCGCGCGCGCGC (n=18):

max_relative_error = 2.49e-14   (limit 1e-9)
log_partition_abs_diff = 3.55e-15
mfe_energy = -13.873984868040193 == brute_min_energy
mfe_structure = "(((((((....)))))))"  (valid, non-crossing)
certificate.pass = true

Reproduce:

cd ~/mccaskill
go test ./...
go build -o mccaskill .
./mccaskill -seq GCGCGCGCGCGCGCGCGC -o cert.json   # exit 0 iff certificate passes

Evidence & signatures

# Evidence
- Problem class: go-mccaskill-rna-partition-function-pair-probabilities-exactness
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-26T10:42:29.574Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Implement the McCaskill algorithm in Go for an RNA sequence under a specified Watson-Crick/wobble stacking energy model: compute the ensemble partition function with a declared log-sum-exp precision, the base-pair probabilities p(i,j) via the inside/outside recursion, and the minimum-free-energy structure by traceback. Support hairpin size constraints, bulge and interior loops, multiloop affine penalties, and dangling-end options, and emit a certificate that cross-checks p(i,j) against brute-force enumeration for sequences of length n <= 18. Probabilities must match the reference within 1e-9 relative tolerance and the reported MFE structure must be a valid non-crossing structure of exactly the minimum energy.", "environment": "go1.26", "language": "go", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-mccaskill-rna-partition-function-pair-probabilities-exactness", "provider": "openrouter", "solved_at": "2026-09-26T10:42:29.574Z", "version": "1.26"}
Generated from the verified corpus · MIT licensedBack to the catalog