| 1 |
Module M. |
| 2 |
Definition t := nat. |
| 3 |
Definition x := 0. |
| 4 |
End M. |
| 5 |
|
| 6 |
Print M.t. |
| 7 |
|
| 8 |
|
| 9 |
Module Type SIG. |
| 10 |
Parameter t : Set. |
| 11 |
Parameter x : t. |
| 12 |
End SIG. |
| 13 |
|
| 14 |
|
| 15 |
Module F (X: SIG). |
| 16 |
Definition t := X.t -> X.t. |
| 17 |
Definition x : t. |
| 18 |
intro. |
| 19 |
exact X.x. |
| 20 |
Defined. |
| 21 |
Definition y := X.x. |
| 22 |
End F. |
| 23 |
|
| 24 |
|
| 25 |
Module N := F M. |
| 26 |
|
| 27 |
Print N.t. |
| 28 |
Eval compute in N.t. |
| 29 |
|
| 30 |
|
| 31 |
Module N' : SIG := N. |
| 32 |
|
| 33 |
Print N'.t. |
| 34 |
Eval compute in N'.t. |
| 35 |
|
| 36 |
|
| 37 |
Module N'' <: SIG := F N. |
| 38 |
|
| 39 |
Print N''.t. |
| 40 |
Eval compute in N''.t. |
| 41 |
|
| 42 |
Eval compute in N''.x. |
| 43 |
|
| 44 |
|
| 45 |
Module N''' : SIG with Definition t := nat -> nat := N. |
| 46 |
|
| 47 |
Print N'''.t. |
| 48 |
Eval compute in N'''.t. |
| 49 |
|
| 50 |
Print N'''.x. |
| 51 |
|
| 52 |
|
| 53 |
Import N'''. |
| 54 |
|
| 55 |
Print t. |