Skip to content

Commit a5bffcf

Browse files
SkySkimmergares
authored andcommitted
Adapt to rocq-prover/rocq#19346 (ComInductive flags)
1 parent bb21847 commit a5bffcf

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

src/coq_elpi_HOAS.ml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3039,23 +3039,28 @@ let lp2inductive_entry ~depth coq_ctx constraints state t =
30393039
Univ.Level.Set.union acc
30403040
(universes_of_term state t))
30413041
used (nuparams @ params) in
3042-
let sigma = restricted_sigma_of used state in
3042+
let sigma = restricted_sigma_of used state in
3043+
let flags = {
3044+
ComInductive.poly;
3045+
cumulative;
3046+
template = Some false;
3047+
auto_prop_lowering = false;
3048+
finite = finiteness;
3049+
}
3050+
in
30433051

30443052
state, comInductive_interp_mutual_inductive_constr
30453053
env_ar_params sigma arity
30463054
~sigma
3047-
~template:(Some false)
3055+
~flags
30483056
~udecl
30493057
~variances
30503058
~ctx_params:(nuparams @ params)
30513059
~indnames:[itname]
30523060
~arities:[arity]
30533061
~constructors:[knames, ktypes]
30543062
~env_ar_params
3055-
~cumulative
3056-
~poly
3057-
~private_ind
3058-
~finite:finiteness |> comInductive_interp_mutual_inductive_constr_post
3063+
~private_ind |> comInductive_interp_mutual_inductive_constr_post
30593064
in
30603065
let mind = { mind with
30613066
Entries.mind_entry_record =

src/coq_elpi_arg_HOAS.ml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ let univpoly_of ~poly ~cumulative =
233233

234234
let of_coq_inductive_definition id =
235235
let open Vernacentries.Preprocessed_Mind_decl in
236-
let { flags; typing_flags; private_ind; uniform; inductives } = id in
236+
let { flags; udecl; typing_flags; private_ind; uniform; inductives } = id in
237237
if List.length inductives != 1 then nYI "mutual inductives";
238238
let inductive = List.hd inductives in
239239
let (((name),(parameters,non_uniform_parameters),arity,constructors),notations) = inductive in
@@ -243,7 +243,7 @@ let univpoly_of ~poly ~cumulative =
243243
List.map (function (Vernacexpr.(_,NoCoercion,NoInstance),c) -> c
244244
| _ -> CErrors.user_err Pp.(str "coercion and instance flags not supported"))
245245
constructors in
246-
let { template; udecl; cumulative; poly; finite } = flags in
246+
let { ComInductive.template; cumulative; poly; finite } = flags in
247247
if template <> None then nYI "raw template polymorphic inductives";
248248
if udecl <> None then nYI "raw universe polymorphic inductives with universe declaration";
249249
{
@@ -257,7 +257,7 @@ let univpoly_of ~poly ~cumulative =
257257
}
258258
let of_coq_record_definition id =
259259
let open Vernacentries.Preprocessed_Mind_decl in
260-
let { flags; primitive_proj; kind; records; } : record = id in
260+
let { flags; udecl; primitive_proj; kind; records; } : record = id in
261261
if List.length records != 1 then nYI "mutual inductives";
262262
let open Record.Ast in
263263
let { name; is_coercion; binders : Constrexpr.local_binder_expr list; cfs; idbuild; sort; default_inhabitant_id : Names.Id.t option; } = List.hd records in
@@ -267,7 +267,7 @@ let univpoly_of ~poly ~cumulative =
267267
match sort.CAst.v with
268268
| Constrexpr.CSort s -> s
269269
| _ -> CErrors.user_err ?loc:sort.CAst.loc Pp.(str "only explicits sorts are supported")) in
270-
let { template; udecl; cumulative; poly; finite } = flags in
270+
let { ComInductive.template; cumulative; poly; finite } = flags in
271271
if template <> None then nYI "raw template polymorphic inductives";
272272
if udecl <> None then nYI "raw universe polymorphic inductives with universe declaration";
273273
{
@@ -996,6 +996,9 @@ let handle_template_polymorphism = function
996996
| Some false -> Some false
997997
| Some true -> err Pp.(str "#[universes(template)] is not supported")
998998

999+
let handle_template_polymorphism flags =
1000+
{ flags with ComInductive.template = handle_template_polymorphism flags.ComInductive.template }
1001+
9991002
let in_elpi_cmd_synterp ~depth ?calldepth state (x : Cmd.raw) =
10001003
let open Cmd in
10011004
match x with
@@ -1033,11 +1036,11 @@ let in_elpi_cmd ~depth ?calldepth coq_ctx state ~raw (x : Cmd.top) =
10331036
state, t, []
10341037
| RecordDecl (_ist,(glob_sign,raw_rdecl)) ->
10351038
let open Vernacentries.Preprocessed_Mind_decl in
1036-
let { flags = { template; poly; cumulative; udecl; finite }; primitive_proj; kind; records } = raw_rdecl in
1037-
let template = handle_template_polymorphism template in
1039+
let { flags; udecl; primitive_proj; kind; records } = raw_rdecl in
1040+
let flags = handle_template_polymorphism flags in
10381041
(* Definitional type classes cannot be interpreted using this function (why?) *)
10391042
let kind = if kind = Vernacexpr.Class true then Vernacexpr.Class false else kind in
1040-
let e = Record.interp_structure ~template udecl kind ~cumulative ~poly ~primitive_proj finite records in
1043+
let e = Record.interp_structure ~flags udecl kind ~primitive_proj records in
10411044
record_entry2lp ~depth coq_ctx E.no_constraints state ~loose_udecl:(udecl = None) e
10421045
| IndtDecl (_ist,(glob_sign,raw_indt)) when raw ->
10431046
let raw_indt = of_coq_inductive_definition raw_indt in
@@ -1047,14 +1050,14 @@ let in_elpi_cmd ~depth ?calldepth coq_ctx state ~raw (x : Cmd.top) =
10471050
state, t, []
10481051
| IndtDecl (_ist,(glob_sign,raw_indt)) ->
10491052
let open Vernacentries.Preprocessed_Mind_decl in
1050-
let { flags = { template; poly; cumulative; udecl; finite }; typing_flags; uniform; private_ind; inductives } = raw_indt in
1051-
let template = handle_template_polymorphism template in
1053+
let { flags; udecl; typing_flags; uniform; private_ind; inductives } = raw_indt in
1054+
let flags = handle_template_polymorphism flags in
10521055
let e =
10531056
match inductives with
10541057
| [mind_w_not] ->
10551058
ComInductive.interp_mutual_inductive ~env:coq_ctx.env
1056-
~template ~cumulative ~poly ~uniform ~private_ind ?typing_flags
1057-
udecl [mind_w_not] finite
1059+
~flags ~uniform ~private_ind ?typing_flags
1060+
udecl [mind_w_not]
10581061
| _ -> nYI "(HOAS) mutual inductives"
10591062
in
10601063
inductive_entry2lp ~depth coq_ctx E.no_constraints state ~loose_udecl:(udecl = None) e

0 commit comments

Comments
 (0)