Skip to content

There is no valid module type for modules using a functor #1235

Open

Description

@oskgo

The following fails with no way to fix it from what I can tell:

module type T = {}.

module type FT (M: T) = {
  proc p(): bool
}.

module type A (M : T) (F : FT) = {
  proc p() : bool
}.

module (C : A) (M : T) (F : FT) = {
  proc p() = {
    var b;
    b <@ F(M).p();
    return b;
  }
}.

The error is:

the module C does not have the module type A:
  procedure `p' is not compatible:
    the function is not allowed to use F(M).p

This means you can't do things like abstract over games. Games take adversaries which are often functors.

If this is changed, care should be taken to ensure that the abstract call rule remains sound. I found this limitation while investigating what I thought was an unsoundness in the call rule, which turned out to be saved by this limitation.

If we intend to keep this limitation around, maybe we should emit an error already at the definition of A?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions