You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/rocq_elpi_builtins.ml
+34-20Lines changed: 34 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -539,53 +539,62 @@ let err_if_contains_alg_univ ~depth t =
539
539
matchUniv.Universe.level u with
540
540
|None -> true
541
541
|Somel -> is_global_level env l in
542
-
letrec aux~depthacct=
542
+
letrec aux~depth(acc,acci)t=
543
543
matchE.look ~depth t with
544
+
|E.CDatacwhen isuinstance c -> (acc,acci+1)
544
545
|E.CDatacwhen isuniv c ->
545
546
let u = univout c in
546
-
if is_global u then acc
547
+
if is_global u then acc, acci
547
548
else
548
549
beginmatchUniv.Universe.level u with
549
550
|None ->
550
551
err Pp.(strbrk "The hypothetical clause contains terms of type univ which are not global, you should abstract them out or replace them by global ones: "++
|x -> Rocq_elpi_utils.fold_elpi_term aux acc ~depth x
555
+
|x -> Rocq_elpi_utils.fold_elpi_term aux (acc,acci)~depth x
555
556
in
556
-
let univs = aux ~depthUniv.Universe.Set.empty t in
557
+
let univs = aux ~depth(Univ.Universe.Set.empty,0) t in
557
558
univs
558
559
559
560
letpreprocess_clause~depthclause=
560
-
let levels_to_abstract = err_if_contains_alg_univ ~depth clause in
561
+
let levels_to_abstract, instances_to_abstract= err_if_contains_alg_univ ~depth clause in
561
562
let levels_to_abstract_no =Univ.Universe.Set.cardinal levels_to_abstract in
562
-
letrec subst~depthmt=
563
+
letrec subst~depthmmit=
563
564
matchE.look ~depth t with
564
565
|E.CDatacwhen isuniv c ->
565
566
begintryE.mkBound (Univ.Universe.Map.find (univout c) m)
566
567
withNot_found -> t end
568
+
|E.CDatacwhen isuinstance c ->
569
+
decr mi; E.mkBound !mi
567
570
|E.App(c,x,xs) ->
568
-
E.mkApp c (subst ~depth m x) (List.map (subst ~depth m) xs)
571
+
E.mkApp c (subst ~depth m mi x) (List.map (subst ~depth m mi) xs)
569
572
|E.Cons(x,xs) ->
570
-
E.mkCons (subst ~depth m x) (subst ~depth m xs)
573
+
E.mkCons (subst ~depth m mi x) (subst ~depth m mi xs)
571
574
|E.Lamx ->
572
-
E.mkLam (subst ~depth:(depth+1) m x)
575
+
E.mkLam (subst ~depth:(depth+1) m mi x)
573
576
|E.Builtin(c,xs) ->
574
-
E.mkBuiltin c (List.map (subst ~depth m) xs)
577
+
E.mkBuiltin c (List.map (subst ~depth m mi) xs)
575
578
|E.UnifVar_ -> CErrors.user_err Pp.(str"The clause begin accumulated contains unification variables, this is forbidden. You must quantify them out using 'pi'.")
576
579
|E.Const_|E.Nil|E.CData_ -> t
577
580
in
578
581
let clause =
579
-
letrec binddmap=function
582
+
letrec bindd(map: int Univ.Universe.Map.t) (mapi: int ref)=function
0 commit comments