Debian Codegraph @

test-suite/output/PrintAssumptions.v

raw
1
2 (** Print Assumption and opaque modules :
3
4 Print Assumption used to consider as axioms the modular fields
5 unexported by their signature, cf bug report #2186. This should
6 now be fixed, let's test this here. *)
7
8 (* First, a minimal test-case *)
9
10 Axiom foo : nat.
11
12 Module Type T.
13 Parameter bar : nat.
14 End T.
15
16 Module M : T.
17 Module Hide. (* An entire sub-module could be hidden *)
18 Definition x := foo.
19 End Hide.
20 Definition bar := Hide.x.
21 End M.
22
23 Module N (X:T) : T.
24 Definition y := X.bar. (* A non-exported field *)
25 Definition bar := y.
26 End N.
27
28 Module P := N M.
29
30 Print Assumptions M.bar. (* Should answer: foo *)
31 Print Assumptions P.bar. (* Should answer: foo *)
32
33 (* Print Assumptions used empty instances on polymorphic inductives *)
34 Module Poly.
35
36 Set Universe Polymorphism.
37 Axiom bli : Type.
38
39 Definition bla := bli -> bli.
40
41 Inductive blo : bli -> Type := .
42
43 Print Assumptions bla.
44 Print Assumptions blo.
45
46 End Poly.
47
48 Module UIP.
49 Set Definitional UIP.
50
51 Inductive seq {A} (a:A) : A -> SProp :=
52 srefl : seq a a.
53 Arguments srefl {_ _}.
54
55 Definition eq_to_seq {A x y} (e:x = y :> A) : seq x y
56 := match e with eq_refl => srefl end.
57 Definition seq_to_eq {A x y} (e:seq x y) : x = y :> A
58 := match e with srefl => eq_refl end.
59
60 Definition norm {A x y} (e:x = y :> A) : x = y
61 := seq_to_eq (eq_to_seq e).
62
63 Definition norm_id {A x y} (e:x = y :> A) : norm e = e
64 := match e with eq_refl => eq_refl end.
65
66 Theorem UIP {A x y} (e e':x = y :> A) : e = e'.
67 Proof.
68 rewrite <-(norm_id e), <-(norm_id e').
69 reflexivity.
70 Defined.
71
72 Print Assumptions UIP.
73 End UIP.
74
75 (** Print Assumption and Include *)
76
77 Module INCLUDE.
78
79 Module M.
80 Axiom foo : False.
81 End M.
82
83 Module N.
84 Include M.
85 End N.
86
87 Print Assumptions N.foo.
88
89 End INCLUDE.
90
91 (* Print Assumptions did not enter implementation of submodules (#7192) *)
92
93 Module SUBMODULES.
94
95 Definition a := True.
96 Module Type B. Axiom f : Prop. End B.
97 Module Type C. Declare Module D : B. End C.
98 Module E: C.
99 Module D <: B. Definition f := a. End D.
100 End E.
101 Print Assumptions E.D.f.
102
103 (* Idem in the scope of a functor *)
104
105 Module Type T. End T.
106 Module F (X : T).
107 Definition a := True.
108 Module Type B. Axiom f : Prop. End B.
109 Module Type C. Declare Module D : B. End C.
110 Module E: C.
111 Module D <: B. Definition f := a. End D.
112 End E.
113 Print Assumptions E.D.f.
114 End F.
115
116 End SUBMODULES.
117
118 (* Testing a variant of #7192 across files *)
119 (* This was missing in the original fix to #7192 *)
120 Require Import module_bug7192.
121 Print Assumptions M7192.D.f.
122
123 (* Testing reporting assumptions from modules in files *)
124 (* A regression introduced in the original fix to #7192 was missing implementations *)
125 Require Import module_bug8416.
126 Print Assumptions M8416.f.