forked from coq/coq
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Module subtyping: primitive fields cannot be implemented
Fix coq#18503
- Loading branch information
1 parent
c011e08
commit 6aba568
Showing
4 changed files
with
70 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- **Fixed:** | ||
Primitives being incorrectly considered convertible to anything by module subtyping | ||
(`#18507 <https://github.com/coq/coq/pull/18507>`_, | ||
fixes `#18503 <https://github.com/coq/coq/issues/18503>`_, | ||
by Gaëtan Gilbert). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Require Import PrimInt63. | ||
Open Scope int63_scope. | ||
|
||
Module Type T. | ||
Primitive bar := #int63_sub. | ||
|
||
Axiom bar_land : bar = land. | ||
End T. | ||
|
||
Module F(X:T). | ||
Definition foo : X.bar 1 1 = 0 := eq_refl. | ||
End F. | ||
|
||
Module M. | ||
Definition bar := land. | ||
Definition bar_land : bar = land := eq_refl. | ||
End M. | ||
|
||
Fail Module N : T := M. | ||
|
||
(* | ||
Module A := F N. | ||
Lemma bad : False. | ||
Proof. | ||
pose (f := fun x => eqb x 1). | ||
assert (H:f 1 = f 0). | ||
{ f_equal. change 1 with (land 1 1). | ||
rewrite <-N.bar_land. | ||
exact A.foo. } | ||
change (true = false) in H. | ||
inversion H. | ||
Qed. | ||
Print Assumptions bad. | ||
(* Axioms: | ||
land : int -> int -> int | ||
int : Set | ||
eqb : int -> int -> bool | ||
*) | ||
*) |