aboutsummaryrefslogtreecommitdiffhomepage
path: root/coq/ex-module.v
blob: f8df0c311882bc1a919c34602f6dbfa076131b22 (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

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.

Definition t:O=O.
Trivial.
Save.


Section toto.
Print M.
End toto.

  Module N:=M.

Module R:N.SIG.
 Definition T:Set:=nat.
 Definition x:T:= O.
 Definition foo:nat:=(S O).
End R.


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.