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

Need spurious bind to make function check #181

Open
mtzguido opened this issue Aug 21, 2024 · 1 comment
Open

Need spurious bind to make function check #181

mtzguido opened this issue Aug 21, 2024 · 1 comment

Comments

@mtzguido
Copy link
Member

assume val p : int
assume val q : int
assume val foo : int -> slprop
assume val lem () : Lemma (foo p == foo q)

ghost
fn test ()
  requires foo p
  ensures  foo q
{
  lem();
  // ()
}

This function fails to check:

- Cannot prove:
    foo q
- In the context:
    foo p

But uncommenting the extra (), or doing anything, will make it work. I think without it, the lemma is not eliminated into the context and so is not in scope for the query foo p == foo q.

@gebner
Copy link
Contributor

gebner commented Aug 30, 2024

Yes, I believe that's because we only run the elimination logic at the beginning of a statement, not after it.

= if Pulse.Checker.AssertWithBinders.handle_head_immediately t
then Pulse.Checker.AssertWithBinders.check g0 pre0 pre0_typing post_hint res_ppname t check
else (
let (| g, pre, pre_typing, k_elim_pure |) =
Pulse.Checker.Prover.elim_exists_and_pure pre0_typing
in

It's the same reason why you have to write (); show_proof_state instead of show_proof_state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants