Skip to content

Feedback over finite-state channels, and the zero-error trapdoor code - #36

Merged
Autoplectic merged 5 commits into
mainfrom
feedback-codes-main
Oct 26, 2026
Merged

Autoplectic merged 5 commits into
mainfrom
feedback-codes-main

Conversation

@Autoplectic

Copy link
Copy Markdown
Member

Re-lands #35, which was merged into dit-channel-adapter after #34 had already merged, so it never reached main. Same five commits, cherry-picked onto current main, including a ty fix for #34's test imports. Needs dit's feedback codes (dit/dit#304).

Summary

  • FiniteStateChannel feedback methods: feedback_initial / feedback_step step the channel one use at a time, with the normalized forward vector as the transmitter's belief. feedback_capacity brackets the capacity with feedback. dit's feedback codes now run over Mealy-machine channels.
  • sofic.generators.trapdoor_code.trapdoor_code(k): the zero-error feedback code of Permuter, Cuff, Van Roy & Weissman (2008, Sec. VII) for the trapdoor channel.
    • Each input is chosen relative to the ball in the channel (same or opposite), which the encoder knows from the feedback.
    • Messages are enumerated into words with no two "opposite" choices in a row; the decoder reads them backward from whether consecutive outputs differ.
    • Each transmission starts by flushing the unknown initial state, 3.5 uses on average.
    • The module is not imported by sofic.generators, so sofic still imports with older dit.
  • Results on trapdoor():
    • Horstein's scheme reaches about 0.60 / 0.62 / 0.63 bits per use for k = 8 / 10 / 12, already above the best no-feedback upper bound of 0.584 (Huleihel et al. 2021).
    • The trapdoor code is exactly zero-error with E[N] = N + 3.5 and reaches about 0.663 at k = 64, approaching log2(phi) ≈ 0.694.
  • Docs: a "Codes with feedback" section in docs/generators/channel_coding.rst, a Horstein1963 bib entry, and changelog entries.

Test plan

  • tests/test_channel_feedback.py: 12 tests. They check that feedback_step reproduces log_likelihood (hypothesis), that a one-state channel matches dit's BSC, that exact matches Monte Carlo on the trapdoor, and that the feedback-capacity bracket contains log2(phi). Horstein must beat 0.584. The enumerative code must be a bijection (hypothesis), and the trapdoor code must be exactly zero-error with E[N] = N + 3.5. The tests skip when the installed dit lacks feedback codes.
  • ruff check / ruff format are clean.

Ryan James and others added 5 commits October 26, 2026 14:31
Co-authored-by: Cursor <cursoragent@cursor.com>
feedback_initial / feedback_step use the normalized forward vector as the
transmitter's belief, and feedback_capacity brackets the capacity with
feedback. Horstein's scheme on the trapdoor channel beats the no-feedback
upper bound.

Co-authored-by: Cursor <cursoragent@cursor.com>
Actions relative to the known ball, enumerative coding into words with no
two 1s, and backward decoding from output differences; the rate approaches
log2(phi), the trapdoor's feedback capacity.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Autoplectic
Autoplectic merged commit 2748806 into main Oct 26, 2026
10 checks passed
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