-
Notifications
You must be signed in to change notification settings - Fork 54
Tactic coupling, a more general rnd tactic
#805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
f8d5997 to
0ae5093
Compare
rnd tacticscoupling, a more general rnd tactic
f8d5997 to
25220c3
Compare
|
Why not |
Because the former is more readable and easier to understand. This is Manuel's suggestion, and I think it makes sense. Do you agree @fdupress ? |
|
I think this is a pretty Quixotic quest. Proofs where this will make a difference to the actual readability of the actual post are likely to be small enough that a reasonable user will remember "oh yeah, I used the tactic that says that the sampling on the left is coupled with the result of applying For proofs that are complex enough that the user loses track of the fact they did that, this little drop of readability is likely to get lost in an ocean of symbols that gets mooshed by But maybe it's worth giving the user a chance, knowing that |
feedf34 to
e68870d
Compare
e68870d to
69efeae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new coupling tactic for proving pRHL (probabilistic Relational Hoare Logic) goals involving sampling statements. The tactic generalizes the existing rnd tactic by allowing non-bijective functions and direct coupling specifications.
Key changes:
- Adds support for one-sided coupling (using a function from one distribution to another)
- Adds support for two-sided coupling (using an explicit coupling distribution)
- Includes two supporting lemmas (
iscpl_dmap1andiscpl_dmap2) for the one-sided case
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| theories/distributions/Distr.ec | Adds two lemmas establishing coupling properties for mapped distributions |
| tests/coupling-rnd.ec | Provides comprehensive test cases demonstrating all forms of the coupling tactic |
| src/phl/ecPhlRnd.mli | Exports the new process_coupling function |
| src/phl/ecPhlRnd.ml | Implements the core coupling tactic logic with goal generation |
| src/ecParsetree.ml | Adds the Pcoupling parse tree constructor |
| src/ecParser.mly | Adds grammar rule for parsing the coupling tactic |
| src/ecLexer.mll | Registers "coupling" as a keyword token |
| src/ecHiTacticals.ml | Wires the coupling tactic into the tactical processor |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
69efeae to
fa0601e
Compare
fa0601e to
82327fd
Compare
|
I updated the generated goal from |
82327fd to
b323239
Compare
b323239 to
43fd769
Compare
|
Apparently there's a github bug where a change request sticks around if you make changes before resolving them. Reviewers with write access should feel free to dismiss mine now. |
This PR introduces a
couplingtactic, which works on pRHL goal where the last statements on the two sides are both sampling statements.It has two forms.
rndin the sense that the function is not restricted to be bijective.This form of tactic will generate one of two goals:
This form of tactic will generate a goal as follows:
See
tests/coupling-rnd.ecfor the usage.Remark: The original
rndtactic contains some post-processing simplification containing short-circuiting conjunctions. There's no post-processing for thiscouplingtactic.Update: instead of generating
forall a b, a \in supp(d1) => b = g(a) => psi[x -> a, y -> b], I choose to generateforall a, a \in supp(d1) => psi[x -> a, y -> g(a)]directly. The reason for this change is as follows: I found that the default substitution API will automatically use let-binding if at least twice substitutions are needed for one pattern, which already satisfies the readability target for this unnecessaryb = g(a).