Debian Codegraph @

tests/test_API_arguments.v

raw
1 From elpi Require Import elpi.
2
3 Elpi Command arguments.
4
5 (***** Impargs *******************************)
6
7 Module X2.
8
9 Axiom imp : forall T (x:T), x = x -> Prop.
10 Arguments imp {_} [_] _ , [_] _ _ .
11
12 Elpi Query lp:{{
13 coq.locate "imp" I,
14 coq.arguments.implicit I
15 [[maximal,implicit,explicit], [implicit,explicit,explicit]],
16 (@global! => coq.arguments.set-implicit I [[]]),
17 coq.arguments.implicit I
18 [[explicit,explicit,explicit]]
19 }}.
20 End X2.
21 About X2.imp.
22
23 Module X3.
24 Definition foo (T : Type) (x : T) := x.
25 Arguments foo : clear implicits.
26
27 Fail Check foo 3.
28
29 Elpi Query lp:{{
30 @global! => coq.arguments.set-default-implicit {coq.locate "foo"}
31 }}.
32
33 Check foo 3.
34
35 End X3.
36
37
38 (***** Argnames/scopes/simpl *******************************)
39
40 Definition f T (x : T) := x = x.
41
42 Elpi Query lp:{{
43 coq.arguments.set-name {coq.locate "f"} [some "S"],
44 coq.arguments.name {coq.locate "f"} [some "S"],
45 coq.arguments.set-implicit {coq.locate "f"} [[implicit]],
46 coq.arguments.set-scope {coq.locate "f"} [["type"]],
47 coq.arguments.scope {coq.locate "f"} [["type_scope"]]
48 }}.
49 About f.
50 Check f (S:= bool * bool).
51
52 Elpi Query lp:{{
53 coq.arguments.set-simplification {coq.locate "f"} (when [] (some 1))
54 }}.
55 About f.
56 Check f (S:= bool * bool).
57 Eval simpl in f (S := bool).