| 1 |
|
| 2 |
(* Bug report #3746 : Include and restricted signature *) |
| 3 |
|
| 4 |
Module Type MT. Parameter p : nat. End MT. |
| 5 |
Module Type EMPTY. End EMPTY. |
| 6 |
Module Empty. End Empty. |
| 7 |
|
| 8 |
(* Include of an applied functor with restricted sig : |
| 9 |
Used to create axioms (bug report #3746), now forbidden. *) |
| 10 |
|
| 11 |
Module F (X:EMPTY) : MT. |
| 12 |
Definition p := 0. |
| 13 |
End F. |
| 14 |
|
| 15 |
Module InclFunctRestr. |
| 16 |
Fail Include F(Empty). |
| 17 |
End InclFunctRestr. |
| 18 |
|
| 19 |
(* A few variants (indirect restricted signature), also forbidden. *) |
| 20 |
|
| 21 |
Module F1 := F. |
| 22 |
Module F2 (X:EMPTY) := F X. |
| 23 |
|
| 24 |
Module F3a (X:EMPTY). Definition p := 0. End F3a. |
| 25 |
Module F3 (X:EMPTY) : MT := F3a X. |
| 26 |
|
| 27 |
Module InclFunctRestrBis. |
| 28 |
Fail Include F1(Empty). |
| 29 |
Fail Include F2(Empty). |
| 30 |
Fail Include F3(Empty). |
| 31 |
End InclFunctRestrBis. |
| 32 |
|
| 33 |
(* Recommended workaround: manual instance before the include. *) |
| 34 |
|
| 35 |
Module InclWorkaround. |
| 36 |
Module Temp := F(Empty). |
| 37 |
Include Temp. |
| 38 |
End InclWorkaround. |
| 39 |
|
| 40 |
Compute InclWorkaround.p. |
| 41 |
Print InclWorkaround.p. |
| 42 |
Print Assumptions InclWorkaround.p. (* Closed under the global context *) |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
(* Related situations which are ok, just to check *) |
| 47 |
|
| 48 |
(* A) Include of non-functor with restricted signature : |
| 49 |
creates a proxy to initial stuff *) |
| 50 |
|
| 51 |
Module M : MT. |
| 52 |
Definition p := 0. |
| 53 |
End M. |
| 54 |
|
| 55 |
Module InclNonFunct. |
| 56 |
Include M. |
| 57 |
End InclNonFunct. |
| 58 |
|
| 59 |
Definition check : InclNonFunct.p = M.p := eq_refl. |
| 60 |
Print Assumptions InclNonFunct.p. (* Closed *) |
| 61 |
|
| 62 |
|
| 63 |
(* B) Include of a module type with opaque content: |
| 64 |
The opaque content is "copy-pasted". *) |
| 65 |
|
| 66 |
Module Type SigOpaque. |
| 67 |
Definition p : nat. Proof. exact 0. Qed. |
| 68 |
End SigOpaque. |
| 69 |
|
| 70 |
Module InclSigOpaque. |
| 71 |
Include SigOpaque. |
| 72 |
End InclSigOpaque. |
| 73 |
|
| 74 |
Compute InclSigOpaque.p. |
| 75 |
Print InclSigOpaque.p. |
| 76 |
Print Assumptions InclSigOpaque.p. (* Closed *) |
| 77 |
|
| 78 |
|
| 79 |
(* C) Include of an applied functor with opaque proofs : |
| 80 |
opaque proof "copy-pasted" (and substituted). *) |
| 81 |
|
| 82 |
Module F' (X:EMPTY). |
| 83 |
Definition p : nat. Proof. exact 0. Qed. |
| 84 |
End F'. |
| 85 |
|
| 86 |
Module InclFunctOpa. |
| 87 |
Include F'(Empty). |
| 88 |
End InclFunctOpa. |
| 89 |
|
| 90 |
Compute InclFunctOpa.p. |
| 91 |
Print InclFunctOpa.p. |
| 92 |
Print Assumptions InclFunctOpa.p. (* Closed *) |