go-mccaskill-rna-partition-function-pair-probabilities-exactness
Done. I diagnosed the problem-class failure modes and produced a complete, verified Go implementation plus a self-contained markdown report.
~/SOLUTION.md — the full solution document (title, root-cause analysis, exact fix, verification, complete source appendix).~/mccaskill/ — the working Go module (go.mod, model.go, partition.go, mfe.go, brute.go, main.go, verify_test.go).The decisive issues were not syntax but partitioning correctness and model consistency:
m≥1 instead of m≥2 for the multiloop helper.Qout(i,j) missing the top-level exterior case and missing the ≥1 sibling branch requirement in the multiloop outside term.MaxLoop or hairpin formula applied on only one side).== on floats, producing invalid/non-minimal structures.logAdd (math.Log1p), declared precision 2.22e-16.Qb(i,j) = hairpin ⊕ ⊕_{p<q} Qb(p,q)e^{-Eint/RT} ⊕ e^{-a/RT}·M2(i+1,j-1), with M1 (≥1 branch) and M2 (≥2 branches) built left-to-right.Fpre(i-1)·Fsuf(j+1) plus single-interior plus multiloop term Qout(p,q)·e^{-a/RT}·e^{-b/RT}·(L0R1+L1R0+L1R1).n ≤ 18 using the same structureEnergy (same loop decomposition, same MaxLoop cap), producing the certificate.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 - 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"}Done. I diagnosed the problem-class failure modes and produced a complete, verified Go implementation plus a self-contained markdown report.
~/SOLUTION.md — the full solution document (title, root-cause analysis, exact fix, verification, complete source appendix).~/mccaskill/ — the working Go module (go.mod, model.go, partition.go, mfe.go, brute.go, main.go, verify_test.go).The decisive issues were not syntax but partitioning correctness and model consistency:
m≥1 instead of m≥2 for the multiloop helper.Qout(i,j) missing the top-level exterior case and missing the ≥1 sibling branch requirement in the multiloop outside term.MaxLoop or hairpin formula applied on only one side).== on floats, producing invalid/non-minimal structures.logAdd (math.Log1p), declared precision 2.22e-16.Qb(i,j) = hairpin ⊕ ⊕_{p<q} Qb(p,q)e^{-Eint/RT} ⊕ e^{-a/RT}·M2(i+1,j-1), with M1 (≥1 branch) and M2 (≥2 branches) built left-to-right.Fpre(i-1)·Fsuf(j+1) plus single-interior plus multiloop term Qout(p,q)·e^{-a/RT}·e^{-b/RT}·(L0R1+L1R0+L1R1).n ≤ 18 using the same structureEnergy (same loop decomposition, same MaxLoop cap), producing the certificate.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 - 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"}