The new treatment of globs (introduced in #440 which fixes #102) leads to an unsoundness.
The theory below illustrates that.
(There are some admits, I can fill them in if they are required, but I think the admitted facts that have nothing to do with modules or globs should be uncontroversial.)
Maybe it is time to fix the glob-problem by first giving a definition to what glob means? This is the third unsoundness based on inconsistent glob treatment that I have posted.
require import AllCore.
module type AT = {
proc p():unit
}.
module A : AT = {
var x : bool
proc p() = {}
}.
module type BT(A:AT) = {
proc p():unit
}.
module B(A':AT) = {
proc p() = { A.x <- A.x; A'.p(); }
}.
(* I am axiomatizing a constant `card` here.
The intended meaning is: If 'a is a type with finitely many values, then `card<:'a>` is the number of these values.
If 'a is a type with infinitely many values, then `card<:'a> = 0`.
It could be defined properly but that is a bit tedious.
I believe that existence of that constant and the two lemmas `card_bool` and `card_prod` are uncontroversial, so I leave them admitted here.
If there is doubt, I can come up with a definition and proofs. *)
op card ['a] : int = witness.
lemma card_bool: card<:bool> = 2. admitted.
lemma card_prod ['a 'b]: card<:'a*'b> = card<:'a> * card<:'b>. admitted.
(* The trouble starts here *)
lemma contradiction: false.
(* When the argument to B is abstract, `glob B(A')` is unfolded to `glob A * glob A'`. *)
have H1: forall (A'<:AT), card<:glob B(A')> = 2 * card<:glob A'>.
move => A'.
rewrite card_prod<:glob A, glob A'> card_bool.
trivial.
(* When the argument to B is the concrete A, `glob B(A)` is unfolded to `bool` (=`glob A`) (because the variables of `B` and `A` are the same). *)
have H2: card<:glob B(A)> = 2.
rewrite card_bool.
trivial.
(* By instantiating the abstract, we get a different cardinality. *)
have H3: card<:glob B(A)> = 4.
rewrite (H1 A).
rewrite card_bool.
trivial.
clear H1.
(* And we derive a contradiction. *)
have H4: 2=4.
rewrite -H2 -H3.
trivial.
clear H2 H3.
trivial.
qed.
The new treatment of globs (introduced in #440 which fixes #102) leads to an unsoundness.
The theory below illustrates that.
(There are some admits, I can fill them in if they are required, but I think the admitted facts that have nothing to do with modules or globs should be uncontroversial.)
Maybe it is time to fix the glob-problem by first giving a definition to what glob means? This is the third unsoundness based on inconsistent glob treatment that I have posted.