Skip to content

Restrictions of module aliases are not checked correctly #1234

Open

Description

@oskgo

Restrictions are not checked correctly (or at all?) in module (C: F) (M: T) = M.

This permits the following code:

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

module True = {proc p()={return true;}}.

module False = {proc p()={return false;}}.

module type F (M: T) = {
  proc p(): bool {} (* restricted to not make any calls *)
}.

lemma L1 (F<:F): equiv[F(True).p ~F(False).p : ={glob F} ==> ={res}].
proof. proc*; call (: true); auto => />. qed.

module (C: F) (M: T) = M.

require import Real.

lemma bad: false.
suff//: forall &m, 1%r = 2%r.
move => &m.
have->:1%r=Pr[C(True).p() @&m: true].
- by byphoare => //; proc.
rewrite Pr[mu_split res] /=.
have->:Pr[C(True).p()@&m:!res]=Pr[C(False).p()@&m:!res].
- byequiv (L1 C) => //.
have->:Pr[C(True).p()@&m:res]=1%r by byphoare => //; proc.
have->:Pr[C(False).p()@&m:!res]=1%r by byphoare => //; proc.
done.
qed.

Not fixed by #1229.

Activity

  1. changed the title [-]Module type of derived module is not checked correctly[/-] [+]Restrictions of module aliases are not checked correctly[/+] on Nov 10, 2026
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