Skip to content

Commit a31475c

Browse files
authored
Merge pull request #122 from ppedrot/econstr-inductiveops-api
Adapt w.r.t. rocq-prover/rocq#18935.
2 parents 4eba947 + 2f74108 commit a31475c

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/parametricity.ml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,9 @@ and translate_fix order evd env t =
758758
let (ind, u), ind_args = Inductiveops.find_inductive env !evd typ in
759759
let nparams = Inductiveops.inductive_nparams env ind in
760760
let _, realargs = List.chop nparams ind_args in
761-
let erealargs = List.map of_constr realargs in
762761
List.iteri (fun i x ->
763-
debug [`Fix] (Printf.sprintf "realargs.(%d) = " i) env !evd x) erealargs;
764-
List.for_all (fun x -> List.mem x args) erealargs
762+
debug [`Fix] (Printf.sprintf "realargs.(%d) = " i) env !evd x) realargs;
763+
List.for_all (fun x -> List.mem x args) realargs
765764

766765
and process_case env depth (fun_args : constr list) case =
767766

@@ -781,16 +780,15 @@ and translate_fix order evd env t =
781780
in
782781
let i_params, i_realargs = List.chop i_nparams params_args in
783782
debug_string [`Fix] "make inductive family ...";
784-
let ind_fam = Inductiveops.make_ind_family ((ind, EInstance.kind !evd u), i_params) in
783+
let ind_fam = Inductiveops.make_ind_family ((ind, u), i_params) in
785784
debug_string [`Fix] "get_constructors";
786785
let constructors = Inductiveops.get_constructors env ind_fam in
787786
debug_string [`Fix] "done";
788787

789788
assert (List.length i_realargs = i_nargs);
790-
let ei_realargs = List.map of_constr i_realargs in
791789
let fun_args_i =
792790
List.map (fun x -> if x = c then mkRel 1
793-
else if List.mem x ei_realargs then mkRel (2 + i_nargs - (List.index (=) x ei_realargs))
791+
else if List.mem x i_realargs then mkRel (2 + i_nargs - (List.index (=) x i_realargs))
794792
else lift (i_nargs + 1) x) fun_args
795793
in
796794
let theta = inst_args (depth + i_nargs + 1) fun_args_i in
@@ -815,11 +813,10 @@ and translate_fix order evd env t =
815813
else begin
816814
Array.mapi (fun i b ->
817815
let (cstr, u) as cstru = constructors.(i).Inductiveops.cs_cstr in
818-
let pcstr = mkConstructU (cstr, EInstance.make u) in
816+
let pcstr = mkConstructU (cstr, u) in
819817
let nrealdecls = Inductiveops.constructor_nrealdecls env cstr in
820818
let realdecls, b = decompose_lambda_n_decls !evd nrealdecls b in
821-
let ei_params = List.map of_constr i_params in
822-
let lifted_i_params = List.map (lift nrealdecls) ei_params in
819+
let lifted_i_params = List.map (lift nrealdecls) i_params in
823820
let instr_cstr =
824821
mkApp (pcstr,
825822
Array.of_list
@@ -830,11 +827,11 @@ and translate_fix order evd env t =
830827
assert (Array.length concls = i_nargs);
831828
let fun_args =
832829
List.map (fun x -> if x = c then instr_cstr
833-
else if List.mem x ei_realargs then (of_constr @@ concls.(i_nargs - (List.index (=) x ei_realargs)))
830+
else if List.mem x i_realargs then concls.(i_nargs - (List.index (=) x i_realargs))
834831
else lift nrealdecls x) fun_args
835832
in
836833
let realdecls_R = translate_rel_context order evd env realdecls in
837-
let sub = instr_cstr::(List.map of_constr @@ List.rev (Array.to_list concls)) in
834+
let sub = instr_cstr::(List.rev (Array.to_list concls)) in
838835
let typ = substl sub typ in
839836
(* FIXME : translate twice here :*)
840837
let typ_R = relation order evd env_lams typ in

0 commit comments

Comments
 (0)