| 1 |
(* license: GNU Lesser General Public License Version 2.1 or later *) |
| 2 |
(* ------------------------------------------------------------------------- *) |
| 3 |
|
| 4 |
From elpi Require Import elpi. |
| 5 |
|
| 6 |
(* |
| 7 |
tc_option.db contains the set of options used by the solver of tc. |
| 8 |
all the options are set to false by default |
| 9 |
*) |
| 10 |
Elpi Db tc_options.db lp:{{ |
| 11 |
namespace tc { |
| 12 |
func oTC-eta-reduce-proof -> list string. |
| 13 |
oTC-eta-reduce-proof ["TC", "Eta", "Reduce", "Proof"]. |
| 14 |
|
| 15 |
% Time taken by only instance search (we time tc-recursive-search) |
| 16 |
func oTC-time-instance-search -> list string. |
| 17 |
oTC-time-instance-search ["TC", "Time", "Instance", "Search"]. |
| 18 |
|
| 19 |
func oTC-time-compile-goal -> list string. |
| 20 |
oTC-time-compile-goal ["TC", "Time", "Compile", "Query"]. |
| 21 |
|
| 22 |
func oTC-time-mode-check -> list string. |
| 23 |
oTC-time-mode-check ["TC", "Time", "Mode", "Check"]. |
| 24 |
|
| 25 |
% Time taken by the whole search in tc |
| 26 |
func oTC-time-msolve -> list string. |
| 27 |
oTC-time-msolve ["TC", "Time"]. |
| 28 |
|
| 29 |
% Time taken to refine the solution |
| 30 |
func oTC-time-refine -> list string. |
| 31 |
oTC-time-refine ["TC", "Time", "Refine"]. |
| 32 |
|
| 33 |
func oTC-time-compile-instance -> list string. |
| 34 |
oTC-time-compile-instance ["TC", "Time", "Compile", "Instance"]. |
| 35 |
|
| 36 |
func oTC-time-compile-class -> list string. |
| 37 |
oTC-time-compile-class ["TC", "Time", "Compile", "Class"]. |
| 38 |
|
| 39 |
func oTC-clauseNameShortName -> list string. |
| 40 |
oTC-clauseNameShortName ["TC", "NameShortPath"]. |
| 41 |
|
| 42 |
func oTC-debug -> list string. |
| 43 |
oTC-debug ["TC", "Debug"]. |
| 44 |
|
| 45 |
func oTC-use-pattern-fragment-compiler -> list string. |
| 46 |
oTC-use-pattern-fragment-compiler ["TC", "CompilerWithPatternFragment"]. |
| 47 |
|
| 48 |
func all-options -> list (func -> (list string)). |
| 49 |
all-options [ |
| 50 |
oTC-eta-reduce-proof, oTC-time-refine, oTC-time-msolve, |
| 51 |
oTC-clauseNameShortName, oTC-time-instance-search, oTC-debug, |
| 52 |
oTC-use-pattern-fragment-compiler, oTC-time-compile-goal, |
| 53 |
oTC-time-mode-check, oTC-time-compile-instance, |
| 54 |
oTC-time-compile-class |
| 55 |
]. |
| 56 |
|
| 57 |
func is-option-active (func (list string) ->) ->. |
| 58 |
is-option-active uvar :- !, fail. |
| 59 |
is-option-active Opt :- |
| 60 |
Opt X, coq.option.get X (coq.option.bool tt). |
| 61 |
|
| 62 |
func warning-name -> string. |
| 63 |
warning-name "[TC] Warning". |
| 64 |
} |
| 65 |
}}. |
| 66 |
|
| 67 |
Elpi Db tc.db lp:{{ |
| 68 |
namespace tc { |
| 69 |
% the type of search for a typeclass |
| 70 |
% deterministic :- no backtrack after having found a solution/fail |
| 71 |
% classic :- the classic search, if a path is failing, we backtrack |
| 72 |
kind search-mode type. |
| 73 |
type deterministic search-mode. |
| 74 |
type classic search-mode. |
| 75 |
|
| 76 |
% [instance Path InstGR ClassGR Locality], ClassGR is the class implemented by InstGR |
| 77 |
% Locality is either the empty list, or [@local!], or [@global!] |
| 78 |
pred instance o:list string, o:gref, o:gref, o:list prop. |
| 79 |
|
| 80 |
% [class ClassGR PredName SearchMode Modes], for each class GR, it contains |
| 81 |
% the name of its predicate and its SearchMode |
| 82 |
:index (5) |
| 83 |
pred class o:gref, o:string, o:search-mode, o:list string. |
| 84 |
|
| 85 |
% pred on which we graft instances in the database |
| 86 |
pred hook o:string. |
| 87 |
:name "firstHook" hook "firstHook". |
| 88 |
:name "lastHook" hook "lastHook". |
| 89 |
|
| 90 |
% [unfold-constant C] constants to be unfolded before goal resolution |
| 91 |
pred unfold-constant o:constant. |
| 92 |
|
| 93 |
% the set of instances that we are not yet able to compile, |
| 94 |
% in majority they use universe polimorphism |
| 95 |
pred banned o:gref. |
| 96 |
|
| 97 |
pred pending-mode o:list string. |
| 98 |
|
| 99 |
pred ho-link o:term, i:term, o:A. |
| 100 |
func link.eta term, term ->. |
| 101 |
func link.llam term, term ->. |
| 102 |
func link.unif-eq term, term ->. |
| 103 |
|
| 104 |
} |
| 105 |
}}. |
| 106 |
From elpi.apps.tc.elpi Extra Dependency "base.elpi" as base. |
| 107 |
#[superglobal] Elpi Accumulate tc.db File base. |