-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TC solver 2 #529
TC solver 2 #529
Conversation
apps/tc/theories/tc.v
Outdated
Elpi Command AddInstances. | ||
Elpi Accumulate Db tc.db. | ||
Elpi Accumulate File base. | ||
Elpi Accumulate File tc_aux. | ||
Elpi Accumulate File modes. | ||
Elpi Accumulate File compiler. | ||
Elpi Accumulate File parser_addInstances. | ||
Elpi Accumulate lp:{{ | ||
% The main of the Command | ||
main Arguments :- | ||
std.time (parse Arguments Res, run-command Res) T, | ||
if (coq.option.get ["TimeAddInstances"] (coq.option.bool tt)) | ||
(coq.say "Add instance all Time" T) true. | ||
}}. | ||
(* Elpi Typecheck. *) | ||
Elpi Query lp:{{ | ||
coq.option.add ["TimeAddInstances"] (coq.option.bool ff) ff. | ||
}}. | ||
(* Elpi Typecheck. *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment: needed if we don't want to also declare the instance in Coq
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AddAllInstances class logpath
eg AddAllInstances Decidable Coq.stdpp.file.
.
std.forall {coq.TC.db-tc} (x\ add-tc-or-inst-gr [] L1 [x])) T, | ||
if (coq.option.get ["TimeAddInstances"] (coq.option.bool tt)) | ||
(coq.say "Add instance Time" T) true. | ||
}}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idealli (or TODO) add #[local] AddAllInstances ...
apps/tc/elpi/compiler.elpi
Outdated
% [add-inst->db IgnoreClassDepL ForceAdd Inst] add the Inst to | ||
% the database except those depending on at least one | ||
% inside IgnoreClassDepL | ||
pred add-inst->db i:list gref, i:bool, i:gref. | ||
:name "add-inst->db:start" | ||
add-inst->db IgnoreClassDepL ForceAdd Inst :- | ||
coq.env.current-section-path SectionPath, | ||
get-sub-classes Inst Dep, | ||
warn-multiple-deps Inst Dep, | ||
if ((ForceAdd = tt; not (instance _ Inst _)), | ||
not (std.exists Dep (std.mem IgnoreClassDepL)), not (banned Inst)) | ||
( | ||
compile Inst _IsLeaf TC-of-Inst Clause, | ||
% TODO: a clause is flexible if an instance is polimorphic (pglobal) | ||
not (var Clause), | ||
Graft is after (int_to_string {get-inst-prio Inst}), | ||
get-full-path Inst ClauseName, | ||
if (is-local) (Visibility = [@local!]) | ||
(if (has-context-deps Inst) | ||
(@local! => add-tc-db _ Graft (instance SectionPath Inst TC-of-Inst)) | ||
(@global! => add-tc-db _ Graft (instance [] Inst TC-of-Inst)), Visibility = [@global!]), | ||
Visibility => add-tc-db ClauseName Graft Clause | ||
) | ||
true; @global! => add-tc-db _ _ (banned Inst), | ||
coq.warning "Not-added" "TC_solver" "Warning : Cannot compile " Inst "since it is pglobal". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify assuming one calls #[local] AddAllInstances
, call add-inst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (get-option "local" tt) (P = @local!) true, P =>
add-tc-or-inst-gr IgnoreDepClass IgnoreInsts Names :- | ||
std.map IgnoreDepClass coq.locate IgnoreDepClassGR, | ||
std.map IgnoreInsts coq.locate IgnoreInstsGR, | ||
std.forall Names (GR\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can remove these blacklists, since there is a global one already
TODO (before/after merge):
Need of elpi and/or coq update: