File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -817,6 +817,17 @@ coq.env.add-section-variable Name Ty C :-
817
817
coq.env.add-section-variable-two Name explicit Ty C.
818
818
819
819
820
+
821
+ pred coq.env.add-context i:context-decl.
822
+ coq.env.add-context context-end.
823
+ coq.env.add-context (context-item Name I Ty none Rest) :-
824
+ coq.env.add-section-variable-two Name I Ty C,
825
+ coq.env.add-context (Rest {coq.env.global (const C)}).
826
+ coq.env.add-context (context-item Name _I Ty (some Bo) Rest) :-
827
+ coq.env.add-const Name Bo Ty ff C,
828
+ coq.env.add-context (Rest {coq.env.global (const C)}).
829
+
830
+
820
831
% [coq.env.add-indt Decl I] Declares an inductive type.
821
832
% Supported attributes:
822
833
% - @dropunivs! (default: false, drops all universe constraints from the
Original file line number Diff line number Diff line change @@ -2060,6 +2060,17 @@ coq.env.add-section-variable Name Ty C :-
2060
2060
coq.env.add-section-variable-two Name explicit Ty C.
2061
2061
|} ;
2062
2062
2063
+ LPCode {|
2064
+ pred coq.env.add-context i:context-decl.
2065
+ coq.env.add-context context-end.
2066
+ coq.env.add-context (context-item Name I Ty none Rest) :-
2067
+ coq.env.add-section-variable-two Name I Ty C,
2068
+ coq.env.add-context (Rest {coq.env.global (const C)} ).
2069
+ coq .env .add -context (context -item Name _I Ty (some Bo) Rest) :-
2070
+ coq .env .add -const Name Bo Ty ff C,
2071
+ coq .env .add -context (Rest {coq.env.global (const C)} ).
2072
+ |};
2073
+
2063
2074
MLCode(Pred("coq.env.add-indt" ,
2064
2075
CIn(indt_decl_in , "Decl" ,
2065
2076
Out(inductive , "I" ,
Original file line number Diff line number Diff line change
1
+ From elpi Require Import elpi.
2
+
3
+ Elpi Command context.
4
+ Elpi Accumulate lp:{{
5
+ main [ctx-decl Ctx] :- !,
6
+ coq.env.add-context Ctx.
7
+ }}.
8
+
9
+ Section CA.
10
+ Elpi context Context (a : nat) [b : nat] {c : nat} (d : nat := 3) (e := 4).
11
+ Check eq_refl : d = 3.
12
+ Check eq_refl : e = 4.
13
+ Definition foo := a + b + c + d + e.
14
+ End CA.
15
+ Print foo.
16
+
17
+ Elpi Query lp:{{
18
+ coq.arguments.implicit {coq.locate "foo"} [[explicit, implicit, maximal]].
19
+ }}.
You can’t perform that action at this time.
0 commit comments