Skip to content

Commit 20a88e2

Browse files
committed
Add env universes to eqschemes ucontexts
1 parent 15a4fc2 commit 20a88e2

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

engine/uState.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,10 @@ let univ_entry ~poly uctx =
488488

489489
let of_context_set ((qs,us),csts) =
490490
let sort_variables = QState.of_set qs in
491+
let univs = Level.Set.fold (UGraph.add_universe ~strict:false) us UGraph.initial_universes in
491492
{ empty with
493+
initial_universes = univs;
494+
universes = univs;
492495
local = (us,csts);
493496
sort_variables;}
494497

tactics/eqschemes.ml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ let fresh env id avoid =
7676
let with_context_set ctx (b, ctx') =
7777
(b, UnivGen.sort_context_union ctx ctx')
7878

79+
let of_context_set env ctx =
80+
UState.merge_sort_context ~sideff:false UnivRigid QGraph.Internal (UState.from_env env) ctx
81+
7982
let build_dependent_inductive ind (mib,mip) =
8083
let realargs,_ = List.chop mip.mind_nrealdecls mip.mind_arity_ctxt in
8184
applist
@@ -230,7 +233,7 @@ let build_sym_scheme env _handle ind =
230233
mkRel 1 (* varH *),
231234
[|cstr (nrealargs+1)|])))))
232235
in
233-
c, UState.of_context_set ctx
236+
c, of_context_set env ctx
234237

235238
let sym_scheme_kind =
236239
declare_individual_scheme_object "sym"
@@ -301,7 +304,7 @@ let build_sym_involutive_scheme env handle ind =
301304
NoInvert,
302305
mkRel 1 (* varH *),
303306
[|mkApp(eqrefl,[|applied_ind_C;cstr (nrealargs+1)|])|])))))
304-
in (c, UState.of_context_set ctx)
307+
in (c, of_context_set env ctx)
305308

306309
let sym_involutive_scheme_kind =
307310
declare_individual_scheme_object "sym_involutive"
@@ -461,7 +464,7 @@ let build_l2r_rew_scheme dep env handle ind kind =
461464
[|main_body|]))
462465
else
463466
main_body))))))
464-
in (c, UState.of_context_set ctx)
467+
in (c, of_context_set env ctx)
465468

466469
(**********************************************************************)
467470
(* Build the left-to-right rewriting lemma for hypotheses associated *)
@@ -554,7 +557,7 @@ let build_l2r_forward_rew_scheme dep env ind kind =
554557
(if dep then realsign_ind_P 1 applied_ind_P' else realsign_P 2) s)
555558
(mkNamedLambda (make_annot varHC sr) applied_PC'
556559
(mkVar varHC))|]))))))
557-
in c, UState.of_context_set ctx
560+
in c, of_context_set env ctx
558561

559562
(**********************************************************************)
560563
(* Build the right-to-left rewriting lemma for hypotheses associated *)
@@ -641,7 +644,7 @@ let build_r2l_forward_rew_scheme dep env ind kind =
641644
lift (nrealargs+3) applied_PC,
642645
mkRel 1)|])),
643646
[|mkVar varHC|]))))))
644-
in c, UState.of_context_set ctx
647+
in c, of_context_set env ctx
645648

646649
(**********************************************************************)
647650
(* This function "repairs" the non-dependent r2l forward rewriting *)
@@ -859,7 +862,7 @@ let build_congr env (eq,refl,ctx) ind =
859862
[|mkApp (refl,
860863
[|mkVar varB;
861864
mkApp (mkVar varf, [|lift (mip.mind_nrealargs+3) b|])|])|])))))))
862-
in c, UState.of_context_set ctx
865+
in c, of_context_set env ctx
863866

864867
let congr_scheme_kind = declare_individual_scheme_object "congr"
865868
(fun env _ ind ->

vernac/indschemes.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ let do_mutual_induction_scheme ~register ?(force_mutual=false) env ?(isrec=true)
380380
let _, ctx = Typeops.type_of_global_in_context env (Names.GlobRef.IndRef ind) in
381381
let u, ctx = UnivGen.fresh_instance_from ctx None in
382382
let u = EConstr.EInstance.make u in
383-
let sigma = Evd.from_ctx (UState.of_context_set ctx) in
383+
let sigma = Evd.from_ctx (UState.(union (from_env env) (of_context_set ctx))) in
384384
sigma, u
385385
in
386386
let sigma, lrecspec =

0 commit comments

Comments
 (0)