Skip to content

Commit a58cfa6

Browse files
committed
Adapt to rocq-prover/rocq#21069 (records can be mutual with non records)
1 parent 7e0aec4 commit a58cfa6

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/rocq_elpi_HOAS.ml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,12 +3418,19 @@ let drop_nparams_from_ctx n ctx =
34183418
let ideclc = E.Constants.declare_global_symbol "indt-decl"
34193419
let uideclc = E.Constants.declare_global_symbol "upoly-indt-decl"
34203420

3421+
3422+
[%%if coq = "8.20" || coq = "9.0" || coq = "9.1"]
3423+
let mind_record (mib,_) = mib.Declarations.mind_record
3424+
[%%else]
3425+
let mind_record (_,mip) = mip.Declarations.mind_record
3426+
[%%endif]
3427+
34213428
let inductive_decl2lp ~depth coq_ctx constraints state (mutind,uinst,(mind,ind),(i_impls,k_impls)) =
34223429
let { Declarations.mind_params_ctxt;
34233430
mind_finite = kind;
34243431
mind_nparams = allparamsno;
34253432
mind_nparams_rec = paramsno;
3426-
mind_record } = mind in
3433+
} = mind in
34273434
let ntyps = Array.length mind.mind_packets in
34283435
let mind_params_ctxt = Vars.subst_instance_context uinst mind_params_ctxt in
34293436
let allparams = List.map EConstr.of_rel_decl mind_params_ctxt in
@@ -3432,7 +3439,9 @@ let inductive_decl2lp ~depth coq_ctx constraints state (mutind,uinst,(mind,ind),
34323439
let nuparams, params = CList.chop nuparamsno allparams in
34333440
let { Declarations.mind_consnames = constructor_names;
34343441
mind_typename = id;
3435-
mind_nf_lc = constructor_types } = ind in
3442+
mind_nf_lc = constructor_types;
3443+
} = ind in
3444+
let mind_record = mind_record (mind,ind) in
34363445
let constructor_types = constructor_types |> Array.map (fun (ctx,ty) -> Vars.subst_instance_context uinst ctx, Vars.subst_instance_constr uinst ty) in
34373446
let arity_w_params = Inductive.type_of_inductive ((mind,ind),uinst) in
34383447
let sigma = get_sigma state in

src/rocq_elpi_HOAS.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,4 @@ val restricted_sigma_of : Univ.Level.Set.t -> state -> Evd.evar_map
353353
val universes_of_term : state -> EConstr.t -> Univ.Level.Set.t
354354
val universes_of_udecl : state -> UState.universe_decl -> Univ.Level.Set.t
355355

356+
val mind_record : Declarations.mind_specif -> Declarations.record_info

src/rocq_elpi_builtins.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,8 +1890,8 @@ regarded as not non-informative).|})),
18901890
Out(bool,"PrimProjs",
18911891
Read(global, "checks if Ind is a record (PrimProjs = tt if Ind has primitive projections)"))),
18921892
(fun i _ ~depth {env} _ state ->
1893-
let mind, indbo = Inductive.lookup_mind_specif env i in
1894-
match mind.Declarations.mind_record with
1893+
let specif = Inductive.lookup_mind_specif env i in
1894+
match Rocq_elpi_HOAS.mind_record specif with
18951895
| Declarations.PrimRecord _ -> !: true
18961896
| Declarations.FakeRecord -> !: false
18971897
| _ -> raise No_clause

0 commit comments

Comments
 (0)