Skip to content

Commit 1458cc6

Browse files
committed
Add an implicitness argument to coq.env.add-section-variable
1 parent ee28024 commit 1458cc6

File tree

5 files changed

+14
-25
lines changed

5 files changed

+14
-25
lines changed

builtin-doc/coq-builtin.elpi

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -804,24 +804,18 @@ external pred coq.env.add-const i:id, i:term, i:term, i:opaque?,
804804
% - @inline-at! N (default: no inlining)
805805
external pred coq.env.add-axiom i:id, i:term, o:constant.
806806

807-
% [coq.env.add-section-variable-two Name I Ty C] Declare a new section
808-
% variable: C gets a constant derived from Name
807+
% [coq.env.add-section-variable Name I Ty C] Declare a new section variable:
808+
% C gets a constant derived from Name
809809
% and the current module.
810810
%
811-
external pred coq.env.add-section-variable-two i:id, i:implicit_kind,
812-
i:term, o:constant.
813-
814-
815-
pred coq.env.add-section-variable i:id, i:term, o:constant.
816-
coq.env.add-section-variable Name Ty C :-
817-
coq.env.add-section-variable-two Name explicit Ty C.
818-
811+
external pred coq.env.add-section-variable i:id, i:implicit_kind, i:term,
812+
o:constant.
819813

820814

821815
pred coq.env.add-context i:context-decl.
822816
coq.env.add-context context-end.
823817
coq.env.add-context (context-item Name I Ty none Rest) :-
824-
coq.env.add-section-variable-two Name I Ty C,
818+
coq.env.add-section-variable Name I Ty C,
825819
coq.env.add-context (Rest {coq.env.global (const C)}).
826820
coq.env.add-context (context-item Name _I Ty (some Bo) Rest) :-
827821
coq.env.add-const Name Bo Ty ff C,

src/coq_elpi_builtins.ml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,30 +2041,25 @@ Supported attributes:
20412041
uctx, state, !: (global_constant_of_globref gr), []))),
20422042
DocAbove);
20432043

2044-
MLCode(Pred("coq.env.add-section-variable-two",
2044+
MLCode(Pred("coq.env.add-section-variable",
20452045
In(id, "Name",
2046-
In(implicit_kind, "I",
2046+
In(B.unspec implicit_kind, "I",
20472047
CIn(closed_ground_term, "Ty",
20482048
Out(constant, "C",
20492049
Full (global, {|Declare a new section variable: C gets a constant derived from Name
20502050
and the current module.
20512051
|}))))),
20522052
(fun id bkind ty _ ~depth {options} _ -> grab_global_env_drop_sigma_keep_univs "coq.env.add-section-variable" (fun state ->
2053+
let bkind = Option.default Glob_term.Explicit (unspec2opt bkind) in
20532054
let gr, uctx = add_axiom_or_variable "coq.env.add-section-variable" id ty (Some bkind) options state in
20542055
uctx, state, !: (global_constant_of_globref gr), []))),
20552056
DocAbove);
20562057

2057-
LPCode {|
2058-
pred coq.env.add-section-variable i:id, i:term, o:constant.
2059-
coq.env.add-section-variable Name Ty C :-
2060-
coq.env.add-section-variable-two Name explicit Ty C.
2061-
|};
2062-
20632058
LPCode {|
20642059
pred coq.env.add-context i:context-decl.
20652060
coq.env.add-context context-end.
20662061
coq.env.add-context (context-item Name I Ty none Rest) :-
2067-
coq.env.add-section-variable-two Name I Ty C,
2062+
coq.env.add-section-variable Name I Ty C,
20682063
coq.env.add-context (Rest {coq.env.global (const C)}).
20692064
coq.env.add-context (context-item Name _I Ty (some Bo) Rest) :-
20702065
coq.env.add-const Name Bo Ty ff C,

tests/test_API_section.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Elpi Query lp:{{
1717
coq.locate "b" (const CB),
1818
coq.locate "c" (const CC),
1919
coq.env.const CC (some (global (const CB))) _,
20-
coq.env.add-section-variable "d" {{ nat }} _,
21-
coq.env.add-section-variable "d1" {{ nat }} _,
20+
coq.env.add-section-variable "d" _ {{ nat }} _,
21+
coq.env.add-section-variable "d1" _ {{ nat }} _,
2222
@local! => coq.env.add-const "e" {{ 3 }} {{ nat }} _ _.
2323
}}.
2424
About d.
@@ -33,7 +33,7 @@ Elpi Query lp:{{
3333
std.do! [ coq.env.begin-section "Foo", coq.env.end-section ]
3434
}} lp:{{
3535
coq.env.begin-section "Foo",
36-
coq.env.add-section-variable "x" {{ nat }} X,
36+
coq.env.add-section-variable "x" _ {{ nat }} X,
3737
coq.env.section [X],
3838
coq.env.add-const "fx" (global (const X)) _ _ _,
3939
coq.env.end-section.

tests/test_HOAS.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Elpi Query lp:{{
6262
coq.env.begin-section "xxxxx",
6363
coq.univ.new U,
6464
T = sort (typ U),
65-
coq.env.add-section-variable "a" T _,
65+
coq.env.add-section-variable "a" _ T _,
6666
coq.env.end-section
6767
}}.
6868

tests/test_glob.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Elpi Accumulate lp:{{
1919
field _ _ {{ @eq nat lp:f2 1 }} _\
2020
end-record)) _,
2121
coq.env.begin-section "A",
22-
coq.env.add-section-variable "v" {{ nat }} _,
22+
coq.env.add-section-variable "v" _ {{ nat }} _,
2323
coq.env.end-section,
2424
coq.env.begin-module "N2" none,
2525
coq.env.end-module _,

0 commit comments

Comments
 (0)