Skip to content
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

Improve MRSolver interface #1675

Merged
merged 7 commits into from
May 24, 2022
Merged

Improve MRSolver interface #1675

merged 7 commits into from
May 24, 2022

Conversation

m-yac
Copy link
Contributor

@m-yac m-yac commented May 23, 2022

This PR cleans up the Mr. Solver interface and introduces a new type of Mr. Solver assumption.

The interface now consists of:

  • mr_solver_prove t1 t2 which asks Mr. Solver to prove t1 |= t2, throwing an error and exiting if it cannot, or adding a new assumption to the Mr. Solver context if it can. For refinements of the form f1 ... |= f2 ..., the assumption is added as an opaque assumption, which means calls to f1 on the LHS will now only be unfolded if a matching f2 cannot be found on the RHS. (Specifically, if we have such an opaque assumption and encounter f1 args1 >>= k1 |= f2 args2 >>= k2, we now prove that f1 args1 |= f2 args2 is provable from our assumption, then continue proving k1 |= k2.) Otherwise, for refinements of the form f1 ... |= rhs, the assumption is added as a rewrite assumption, which has the old behavior: always replacing calls of f1 on the LHS with rhs.
  • mr_solver_test t1 t2 which is like the above, but does not add the result as an assumption. This is useful for testing that a refinement holds in isolation, e.g. for reflexivity or no-errors proofs.
  • mr_solver_query t1 t2 which asks Mr. Solver to prove t1 |= t2, but unlike the above returns a boolean as to whether it could or could not. Calls to this function will never fail, and never add any assumptions.
  • mr_solver_set_debug_level i sets the debug level of Mr. Solver until its next invocation.

Additionally, the first three have new console output which indicate when and when not assumptions are added to scope.

Finally, a change to the way memoization works in monadification was needed to make sure examples which use opaque assumptions work properly.

@m-yac m-yac added the MRSolver Issues specifically related to the Mr. Solver sub-system label May 23, 2022
@m-yac m-yac requested a review from eddywestbrook May 23, 2022 23:11
Copy link
Contributor

@eddywestbrook eddywestbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@eddywestbrook eddywestbrook added the ready-to-merge If at least one person approves this PR, automatically merge it when CI finishes successfully. label May 24, 2022
@mergify mergify bot merged commit af9172f into master May 24, 2022
@mergify mergify bot deleted the mr-solver/clean-up-interface branch May 24, 2022 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MRSolver Issues specifically related to the Mr. Solver sub-system ready-to-merge If at least one person approves this PR, automatically merge it when CI finishes successfully.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants