Debian Codegraph @

tests/test_mutind.v

raw
1 From elpi Require Import elpi.
2
3 Inductive tree : Type :=
4 | node (f : forest)
5 with forest : Type :=
6 | empty
7 | cons (t : tree) (f : forest).
8
9 Inductive ptree (A : Type) : Type :=
10 | pnode (x : A) (f : pforest A)
11 with pforest (A : Type) : Type :=
12 | pempty
13 | pcons (t : ptree A) (f : pforest A).
14
15 Inductive even : nat -> Type :=
16 | evenO : even 0
17 | evenS n : odd n -> even (S n)
18 with odd : nat -> Type :=
19 | oddS n : even n -> odd (S n).
20
21 Elpi Command test_mutind.
22 Elpi Accumulate lp:{{
23 main _ :-
24 coq.locate "tree" (indt Tree),
25 coq.env.indt-decl Tree TreeDecl,
26 std.assert-ok! (coq.typecheck-indt-decl TreeDecl) "tree declaration illtyped",
27
28 coq.locate "ptree" (indt PTree),
29 coq.env.indt-decl PTree PTreeDecl,
30 std.assert-ok! (coq.typecheck-indt-decl PTreeDecl) "ptree declaration illtyped",
31
32 coq.locate "even" (indt Even),
33 coq.env.indt-decl Even EvenDecl,
34 std.assert-ok! (coq.typecheck-indt-decl EvenDecl) "even declaration illtyped",
35
36 Tree2Decl = (minductive "tree2" tt (arity {{ Type }}) t\
37 (minductive "forest2" tt (arity {{ Type }}) f\
38 (mblock [
39 [constructor "node2" (arity {{ lp:f -> lp:t }})],
40 [constructor "empty2" (arity f),
41 constructor "cons2" (arity {{ lp:t -> lp:f -> lp:f }})]
42 ]))),
43 std.assert-ok! (coq.typecheck-indt-decl Tree2Decl) "tree2 declaration illtyped",
44 coq.env.add-indt Tree2Decl _,
45
46 PTree2Decl = (parameter "A" explicit {{ Type }} a\
47 (minductive "ptree2" tt (arity {{ Type }}) t\
48 (minductive "pforest2" tt (arity {{ Type }}) f\
49 (mblock [
50 [constructor "pnode2" (arity {{ lp:a -> lp:f -> lp:t }})],
51 [constructor "pempty2" (arity f),
52 constructor "pcons2" (arity {{ lp:t -> lp:f -> lp:f }})]
53 ])))),
54 std.assert-ok! (coq.typecheck-indt-decl PTree2Decl) "ptree2 declaration illtyped",
55 coq.env.add-indt PTree2Decl _,
56
57 Even2Decl = (minductive "even2" tt (arity {{ nat -> Type }}) even\
58 (minductive "odd2" tt (arity {{ nat -> Type }}) odd\
59 (mblock [
60 [constructor "evenO2" (arity {{ lp:even 0 }}),
61 constructor "evenS2" (parameter "n" explicit {{ nat }} n\
62 arity {{ lp:odd lp:n -> lp:even (S lp:n) }})],
63 [constructor "oddS2" (parameter "n" explicit {{ nat }} n\
64 arity {{ lp:even lp:n -> lp:odd (S lp:n) }})]
65 ]))),
66 std.assert-ok! (coq.typecheck-indt-decl Even2Decl) "even2 declaration illtyped",
67 coq.env.add-indt Even2Decl _.
68 }}.
69 Module Generated.
70 Elpi test_mutind.
71 End Generated.
72
73 Universe tree2_u ptree2_arg_u ptree2_u even2_u.
74
75 Module Type GeneratedMutualInductives.
76 Inductive tree2 : Type@{tree2_u} :=
77 | node2 (f : forest2)
78 with forest2 : Type@{tree2_u} :=
79 | empty2
80 | cons2 (t : tree2) (f : forest2).
81
82 Inductive ptree2 (A : Type@{ptree2_arg_u}) : Type@{ptree2_u} :=
83 | pnode2 (x : A) (f : pforest2 A)
84 with pforest2 (A : Type@{ptree2_arg_u}) : Type@{ptree2_u} :=
85 | pempty2
86 | pcons2 (t : ptree2 A) (f : pforest2 A).
87
88 Inductive even2 : nat -> Type@{even2_u} :=
89 | evenO2 : even2 0
90 | evenS2 n : odd2 n -> even2 (S n)
91 with odd2 : nat -> Type@{even2_u} :=
92 | oddS2 n : even2 n -> odd2 (S n).
93 End GeneratedMutualInductives.
94
95 Module GeneratedMatches <: GeneratedMutualInductives := Generated.