123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869(** {1 Plugins} *)(** The operations for a solver plugin. A plugin can contribute types,
terms, or other ways of implementing a theory. *)openSolver_types(** Heterogeneous tuple of services *)type_service_list=|S_nil:unitservice_list|S_cons:'aService.Key.t*'a*'bservice_list->('a*'b)service_list(** Heterogeneous tuple of keys *)type_service_key_list=|K_nil:unitservice_key_list|K_cons:'aService.Key.t*'bservice_key_list->('a*'b)service_key_list(** Main interface for plugins. Each plugin must abide by this
interface. *)moduletypeS=sigvalid:plugin_idvalname:string(** Descriptive name *)valprovided_services:Service.anylist(** List of provided services, to be registered for other plugins
to use *)valcheck_if_sat:actions->check_res(** Last call before answering "sat". If the current trail is not
theory-satisfiable, the plugin {b MUST} give a conflict here. *)valiter_terms:termIter.t(** Iterate on all terms known to the plugin. Used for
checking all variables to assign, and for
garbage collection. *)valgc_all:unit->int(** Garbage collect all unmarked terms
@returns the number of collected (deleted) terms *)endtypet=(moduleS)let[@inline]owns_term(moduleP:S)(t:term):bool=Term.plugin_idt=P.idlet[@inline]name(moduleP:S)=P.name(** {2 Factory} *)moduleFactory=structtypeplugin=ttypet=Factory:{name:string;priority:int;requires:'aservice_key_list;build:plugin_id->'aservice_list->plugin}->tletcompare(a:t)(b:t)=letFactory{priority=p_a;_}=ainletFactory{priority=p_b;_}=binCCInt.comparep_ap_bletmake?(priority=50)~name~requires~build()=Factory{priority;name;requires;build;}end