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

Functors in sections #521

Closed
vbgl opened this issue Mar 14, 2024 · 2 comments · Fixed by #636
Closed

Functors in sections #521

vbgl opened this issue Mar 14, 2024 · 2 comments · Fixed by #636
Assignees
Labels

Comments

@vbgl
Copy link
Contributor

vbgl commented Mar 14, 2024

Following program is rejected by EasyCrypt with that message:

* In [lemmas or axioms]:/ [frag -1.0B])

lemma eq:
  forall (M_T <: T),
    equiv[ M_T.f ~ Sim(M_T).g : ={glob M_T} ==> ={glob M_T, res}].

[critical] [: line 1 (0) to line 39 (27)] call cannot be used with a lemma referring to `M.f/Sim(M).g': the last statement is a call to `M.f/M_T'.g'
module type T = {
  proc f(): bool
}.

module type T' (O : T) = {
  proc g(): bool
}.

module Sim (O : T) = {
  proc g() = {
    var r;

    r <@ O.f();
    return r;
  }
}.

section Bad.
declare module M_T <: T.

module M_T' = Sim(M_T). (* This should fail: M_T' should be required to be marked as local *)

equiv eq: M_T.f ~ M_T'.g: ={glob M_T} ==> ={glob M_T, res}.
proof. by proc *; inline *; sim. qed.
end section Bad.

print eq.

module M = {
  var b : bool

  proc f() = {
    b <- !b;
    return b;
  }
}.

equiv eq': M.f ~ M_T'.g: ={glob M} ==> ={glob M, res}.
proof. proc *. call (eq M).
@strub strub self-assigned this Mar 29, 2024
@strub strub added the bug label Mar 29, 2024
@strub
Copy link
Member

strub commented Mar 29, 2024

The module alias is correct, but its expansion when the section is closed is buggy.

@strub
Copy link
Member

strub commented Sep 30, 2024

Related to #635. Once this is merged, I'll be able to do the proper generalization of module aliases.

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

Successfully merging a pull request may close this issue.

2 participants