Debian Codegraph @

test-suite/success/Derive.v

raw
1 Module M.
2 (* The encapsulation in a module tests that the grammar rules
3 and keywords are correctly registered *)
4 Require Derive.
5 End M.
6
7 (* Tests when x is refined by typechecking *)
8 Derive x in (eq_refl x = eq_refl 0) as x_ok.
9 reflexivity.
10 Qed.
11
12 Derive s in (forall z, eq_refl (s z) = eq_refl (S z)) as s_ok.
13 reflexivity.
14 Qed.
15
16 Derive foo : nat in (foo = foo) as bar.
17 Proof.
18 reflexivity.
19 Unshelve.
20 exact 0.
21 Qed.
22
23 Derive id : (forall {A}, A -> A) in (forall {A} (a:A), id a = a) as spec.
24 Proof.
25 unfold id.
26 reflexivity.
27 Qed.
28 About id.
29 Check id 0.
30
31 Set Universe Polymorphism.
32
33 (* An example with no polymorphic universe constraints in the witness *)
34 Derive id' : (forall {A}, A -> A) in (forall {A} (a:A), id' a = a) as spec'.
35 Proof.
36 Unshelve.
37 2: exact (fun A a => a).
38 reflexivity.
39 Qed.
40
41 (* An example with polymorphic universe constraints in the witness *)
42 Derive id'' : (forall {A}, A -> A) in (forall {A} (a:A), id'' a = a) as spec''.
43 Proof.
44 unfold id''.
45 reflexivity.
46 Qed.
47
48 Check id'@{Set} 0.
49
50 (* Test dependent types - issue fix *)
51 Derive (X : Type) (l : list X) in (l = l) as foo_dep.
52 exact (eq_refl (@nil unit)).
53 Defined.
54
55 (* goal naming *)
56 Derive (X' : Type) in X' as X'_val.
57 Proof.
58 [X']: exact nat.
59 Fail exact true.
60 exact 0.
61 Defined.