aboutsummaryrefslogtreecommitdiffhomepage
path: root/coq/ex-module.v
blob: 227b3ff7f30ef6e601bc1884c55a5061f1d044de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

Module Type O1.
Parameter A:Set.
Parameter B:Set.
End O1.


Module R:O1.
Definition A:=nat.
Definition B:=bool.
End R.

Module R2: O1 with Definition  A:=nat.
Definition A:=nat.
Definition B:=bool.
End R2.

Module R4.
Module R3: O1 with Definition  A:=nat :=R2.
End R4.




Module M.
  Module Type SIG.
    Parameter T:Set.
    Parameter x:T.
  End SIG.
  Lemma toto : O=O.
  Definition t:=nat.
	 Trivial.
  Save.
  Module N:SIG.
    Definition T:=nat.
    Definition x:=O.
  End N.
  Module O:=N.
End M.

Import M.
Print t.


Definition t:O=O.
Trivial.
Save.


Section toto.
Print M.
End toto.

Module N:=M.


Module Type typ.
Parameter T:Set.
Parameter a:T.
End typ.



Module Type N'.
Module Type M'.
Declare Module K:N.SIG.
End M'.
Declare Module N''.
  Definition T:=nat.
  Definition x:=O.
End N''.

Declare Module N':M.SIG. (* no interactive def started *)
Declare Module N''':= N'. (* no interactive def started *)
Declare Module N''''. (* interactive def started *)
Parameter foo:nat.
End N''''.            (* interactive def ended *)
End N'.



Lemma titi : O=O.
Trivial.
Module Type K:=N'.
Module N''':=M.
Save.

(* Here is a bug of Coq: *)

Lemma bar:O=O.
Module Type L. (* This should not be allowed by Coq, since the End L. below fails *)
Axiom foo: O=O.
End L. (* fails --> if we go back to Module Type: unsync *)
Module I.
End I.