Skip to content

Commit

Permalink
Simplify more.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodolphe Lepigre committed Feb 15, 2024
1 parent 8f910a1 commit f957bc9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions apps/derive/elpi/derive_synterp.elpi
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ pred chain i:string, i:list derive.
chain _ [].
chain T [derive Name _ _|FS] :- not(selected Name), !,
chain T FS.
chain T [derive Name _ AlreadyDone|FS] :- (pi x\ stop x :- !, fail) => AlreadyDone, !,
chain T [derive _ _ AlreadyDone|FS] :- (pi x\ stop x :- !, fail) => AlreadyDone, !,
chain T FS.
chain T [derive Name F _|FS] :- get-option "only" _, !, % request this one
chain T [derive _ F _|FS] :- get-option "only" _, !, % request this one
F _,
chain T FS.
chain T [derive Name F _|FS] :- % all are selected, we can fail
chain T [derive _ F _|FS] :- % all are selected, we can fail
(pi x\ stop x :- !, fail) => F _, !,
chain T FS.
chain T [derive F _ _|FS] :-
chain T [derive _ _ _|FS] :-
chain T FS.

pred toposort i:list derive, o:list derive.
Expand Down Expand Up @@ -55,11 +55,11 @@ topo L Deps SL :-
topo Other NewDeps SOther,
std.append LNoDeps SOther SL.

pred main i:string, i:bool, o:list prop.
main T P CL :- main1 T P CL.
pred main i:string, i:bool.
main T P :- main1 T P.

pred main1 i:string, i:bool, o:list prop.
main1 T P CL :-
pred main1 i:string, i:bool.
main1 T P :-
if (P = tt) (Prefix is T ^ "_") (Prefix = ""),
std.findall (derivation T Prefix _) L,
std.map L (x\r\ x = derivation _ _ r) DL,
Expand Down
6 changes: 3 additions & 3 deletions apps/derive/theories/derive.v
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ usage :-

#[synterp] Elpi Accumulate lp:{{
main [str I] :- !,
with-attributes (derive.main I tt _).
with-attributes (derive.main I tt).

main [indt-decl D] :- !,
with-attributes (with_name D).
Expand All @@ -110,11 +110,11 @@ usage :-
pi p\ with_name (F p).
with_name (inductive N _ _ _) :-
coq.env.begin-module N none,
derive.main N tt _,
derive.main N tt,
coq.env.end-module _.
with_name (record N _ _ _) :-
coq.env.begin-module N none,
derive.main N tt _,
derive.main N tt,
coq.env.end-module _.
}}.
Elpi Typecheck.
Expand Down

0 comments on commit f957bc9

Please sign in to comment.