Use mathematical notation for semantic policy Display#914
Open
febyeji wants to merge 1 commit intorust-bitcoin:masterfrom
Open
Use mathematical notation for semantic policy Display#914febyeji wants to merge 1 commit intorust-bitcoin:masterfrom
febyeji wants to merge 1 commit intorust-bitcoin:masterfrom
Conversation
a0d28b3 to
aee1d82
Compare
Member
The correct inequality is |
febyeji
added a commit
to febyeji/rust-miniscript
that referenced
this pull request
Apr 2, 2026
thresh requires exactly k satisfactions to be valid, not k or more. Providing too many satisfactions makes the witness invalid. Addresses apoelstra's review feedback on PR rust-bitcoin#914.
Author
|
Thanks for the review! Changed ≥ to = and added a doc comment to Display noting the notation and that it's not parseable. |
Member
|
Can you squash these commits, so that there isn't one modifying code introduced by the other? |
- Use mathematical symbols (∧, ∨, #{...} = k) instead of and()/or()/thresh()
for semantic policy Display output.
- Update fuzz regression test to compare liftability only
b796520 to
73ee818
Compare
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.
Closes #885 (partially)
Summary
semantic::PolicyDisplayimpl to use mathematical notation:and(a,b)→(a ∧ b)or(a,b)→(a ∨ b)thresh(k,a,b,c)→#{a, b, c} = kserde_string_impl_pk!since Display is no longer round-trippable withFromStrNote
(2 = a + b + c)). This PR uses#{a, b, c} = k. Happy to change if a different notation is preferred!regression_descriptor_parsefuzz test previously compared lifted semantic policyto_string()output between the current crate andold_miniscript. Since the Display format has intentionally changed to mathematical notation, and cross-crate structural comparison is not possible (FuzzPk'sDisplay/FromStrdon't roundtrip), the test now only verifies that both crates agree on liftability (both succeed or both fail). Please tell me if we need more rigorous comparison here.