feat: Bitstring encodings - #21
Open
BoltonBailey wants to merge 7 commits into
Open
Conversation
BoltonBailey
marked this pull request as ready for review
August 1, 2026 14:19
Collaborator
Author
|
Hopefully with these changes it should also be possible to refactor existing files like:
|
BoltonBailey
marked this pull request as draft
August 1, 2026 22:57
# Conflicts: # Complexitylib/Models/RoseTreeMachine/Data.lean
`dev` de-exposed `Encoding/DataEncode.lean` as part of the module-interface minimization, but this branch adds `bitstringEncode` together with `bitstringEncode_def` and `bitstringEncode_injective`, both of which need the definition's body to typecheck. Expose the single definition rather than re-exposing the whole module. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
`dev` gained commit 60118c9 ("revert encoding stuff") via the SamuelSchlesinger#23 merge, which deleted Complexitylib/Encoding.lean and Encoding/Delimit.lean and inlined the delimiting logic back into Encoding/Pairing.lean. That is the exact refactor this branch performs, so the merge conflicts on both files. Resolved in favour of this branch's extraction: keep Encoding.lean and Encoding/Delimit.lean, and restore this branch's Encoding/Pairing.lean (`pair x y = delimit x ++ y`). No declaration is lost — every declaration in dev's Pairing.lean is present in this branch's Pairing.lean plus Delimit.lean. Also restore the `Complexitylib.Encoding` import in Complexitylib.lean, which the merge dropped because dev deleted the line. The two `pair`s produce the same bitstring but associate differently (`(A ++ sep) ++ y` here vs `A ++ (sep ++ y)` on dev), so five consumer proofs needed the shape realigned: - SAT/ThreeSAT/Verifier: unfold `delimit` in the `foldl_append` chain - TuringMachine/Subroutines/PairEmit/Internal: add `delimit` to `simpa` - TuringMachine/UTM/Internal/Init: add `delimit` to `simp` - Classes/NP/Internal/PairBuildTM: drop now-unused `List.append_assoc` - Classes/PPoly/Advice: drop now-unused `List.append_assoc` Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ncoding # Conflicts: # Complexitylib/Encoding/Data.lean # Complexitylib/Models.lean
BoltonBailey
force-pushed
the
feat/bitstring-encoding
branch
from
August 14, 2026 05:05
4925b02 to
f54611b
Compare
Revert the incidental docstring rewording and the `@[expose]` widening of `Encoding/Data.lean` introduced by this branch, keeping the diff against dev limited to substantive changes. Docstrings for newly added declarations are retained. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
BoltonBailey
marked this pull request as ready for review
August 16, 2026 18:24
SamuelSchlesinger
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR does some things to connect the Rose-Tree Data encoding to bitstring encoding, in preparation for #18.
It makes Data.toBits/Data.fromBits to convert a
Datainto a bitstring and back, and makes it possible for types in theDataEncodeable type class to encode to bitstrings. Also refactors some stuff related to Pairing into a "Delimit" operation.🤖 Generated with Claude Code