Skip to content

Prove decoder terminates - #43

Merged
Jbsco merged 2 commits into
mainfrom
feat/decoder-termination
Dec 1, 2026
Merged

Jbsco merged 2 commits into
mainfrom
feat/decoder-termination

Conversation

@Jbsco

@Jbsco Jbsco commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Proves that no input can hang the SPARK decoder. gnatprove checks a procedure for termination only when it states Always_Terminates, and none did.

  • Always_Terminates on every SPARK procedure of the proved units: Bit_Streams.Get and Put, Range_Coding.Start, Decode_Bit, Decode_Direct and Normalize, Canonical_Decoding.Decode, and Block_Codec.Decode with its residual and LPC readers and Lms_Update.
  • Loop variants on each loop without a fixed range: unary reads in Rice, adaptive and run-length residuals, run-length symbols, tier length halving, and range coder renormalization.
  • README.md, docs/decoder-cost.md, docs/spec.md and docs/README.md say what the proof now covers.

Verification: prove.do, test.do and style.do pass. With the run-length loop's variant removed, gnatprove reported that Always_Terminates on Get_Run could be incorrect, so these checks are live.

@Jbsco
Jbsco merged commit 11c079b into main Dec 1, 2026
3 checks passed
@Jbsco
Jbsco deleted the feat/decoder-termination branch December 1, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant