Use mathematical notation for semantic policy Display#914
Use mathematical notation for semantic policy Display#914febyeji wants to merge 2 commits intorust-bitcoin:masterfrom
Conversation
a0d28b3 to
aee1d82
Compare
The correct inequality is |
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.
|
Thanks for the review! Changed ≥ to = and added a doc comment to Display noting the notation and that it's not parseable. |
|
Can you squash these commits, so that there isn't one modifying code introduced by the other? |
b796520 to
73ee818
Compare
|
Do we want to close the issue if this merges? |
@tcharding Don't close #885 until issues are made for these at least
|
|
No, to close the issue we've also got to do the renames and doc changes to stop referring to semantic policies as "policies". |
|
@tcharding Looks good, thanks for updating the PR body. Happy with that. |
5a0282a to
eb6011e
Compare
|
In eb6011e: This parser is gratuitously inefficient. You should be able to just parse the new syntax directly. It is a simple CFG and I don't think it even needs lookahead. You definitely do not need to rewrite the string into the old syntax, and even if you did, this manages to be both recursive (we should not be introducing any new recursive code) and still manages to rescan the entire string on every iteration. |
…ss parser Replace the recursive `rewrite_math_notation` that rescanned the input at every depth with a single linear pass that builds `Policy<Pk>` directly using an explicit frame stack. Matches `expression::Tree`'s non-recursive conventions. Addresses apoelstra's review on rust-bitcoin#914.
eb6011e to
9852620
Compare
9201b03 to
357554e
Compare
|
I simplified the parser and added hybrid rejection. The math parser now refuses atoms whose root name is |
|
That solution is insane. I feel like I'm just arguing with a LLM by proxy here. I am not going to provide detailed feedback anymore. |
357554e to
1384586
Compare
|
@apoelstra Apologies for the back-and-forth. I wrote the parser myself, but without carefully understanding the codebase. I was trying to be conservative and reuse I've rewritten the code. If the result isn't what you had in mind, please feel free to close the PR. I will just leave one note in case it helps resolving the issue later.
|
trevarj
left a comment
There was a problem hiding this comment.
Leaving some starting feedback on the parser. If the suggestions get implemented then I will do another review and see if we can refine it more.
You may want to not force push and start stacking some commits in case Andrew or someone else doesn't like a change and then you can drop that commit and rebase later.
trevarj
left a comment
There was a problem hiding this comment.
I think the parser is turning out pretty good, I like it.
Probably my last round of review since everything else seems ok to me.
Thanks!
511e81b to
9aeffc7
Compare
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} = kClose #926