@@ -309,33 +309,39 @@ get-cs-instance (cs-instance _ _ (const Inst)) Inst.
309309pred has-cs-instance i:gref, i:cs-instance.
310310has-cs-instance GTy (cs-instance _ (cs-gref GTy) _).
311311
312+ pred term->cs-pattern i:term, o:cs-pattern.
313+ term->cs-pattern (prod _ _ _) cs-prod.
314+ term->cs-pattern (sort U) (cs-sort U).
315+ term->cs-pattern T (cs-gref GR) :- term->gref T GR.
316+ term->cs-pattern T _ :- coq.error T "HB database: is not a valid canonical key".
317+
318+ pred cs-pattern->name i:cs-pattern, o:string.
319+ cs-pattern->name cs-prod "prod".
320+ cs-pattern->name (cs-sort _) "sort".
321+ cs-pattern->name cs-default "default".
322+ cs-pattern->name (cs-gref GR) Name :- gref->modname-label GR 1 "_" Name.
323+
312324pred get-canonical-structures i:term, o:list structure.
313325get-canonical-structures TyTrm StructL :- std.do! [
314- term->gref TyTrm CanonValue,
315- if (coq.version _ _ N _, N > 12)
316- (coq.CS.db-for _ (cs-gref CanonValue) DBGTyL)
317- (std.filter {coq.CS.db} (has-cs-instance CanonValue) DBGTyL),
326+ term->cs-pattern TyTrm Pat, !,
327+ coq.CS.db-for _ Pat DBGTyL,
318328 std.map-filter DBGTyL get-cs-structure StructL,
319329].
320330
321331pred get-canonical-instances i:term, o:list constant.
322- get-canonical-instances TyTrm CL :- std.do! [
323- term->gref TyTrm CanonValue,
324- if (coq.version _ _ N _, N > 12)
325- (coq.CS.db-for _ (cs-gref CanonValue) DBGTyL)
326- (std.filter {coq.CS.db} (has-cs-instance CanonValue) DBGTyL),
327- std.map-filter DBGTyL get-cs-instance CL,
332+ get-canonical-instances TyTrm StructL :- std.do! [
333+ term->cs-pattern TyTrm Pat, !,
334+ coq.CS.db-for _ Pat DBGTyL,
335+ std.map-filter DBGTyL get-cs-instance StructL,
328336].
329337
330338pred has-CS-instance? i:term, i:structure.
331- has-CS-instance? TyTerm (indt Struct) :- coq.version _ _ N _, N > 12, !,
332- term->gref TyTerm Value ,
339+ has-CS-instance? TyTerm (indt Struct) :- std.do! [
340+ term->cs-pattern TyTerm Pat ,
333341 coq.env.projections Struct [some Proj, _],
334- coq.CS.db-for (const Proj) (cs-gref Value) L,
335- not(L = []).
336- has-CS-instance? TyTerm Struct :-
337- get-canonical-structures TyTerm StructL,
338- std.mem! StructL Struct.
342+ coq.CS.db-for (const Proj) Pat L,
343+ not(L = [])
344+ ].
339345
340346pred structure-nparams i:structure, o:int.
341347structure-nparams Structure NParams :-
0 commit comments