From 58d209fe36e37b6c0ee4acd702dac333388b1b88 Mon Sep 17 00:00:00 2001 From: Jasper Hugunin Date: Sat, 6 Jan 2018 16:37:06 +0900 Subject: Use let-in aware prod_applist_assum in dtauto and firstorder. Fixes #6490. `prod_applist_assum` is copied from `kernel/term.ml` to `engine/termops.ml`, and adjusted to work with econstr. This change uncovered a bug in `Hipattern.match_with_nodep_ind`, where `has_nodep_prod_after` counts both products and let-ins, but was only being passed `mib.mind_nparams`, which does not count let-ins. Replaced with (Context.Rel.length mib.mind_params_ctxt). --- engine/termops.ml | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'engine/termops.ml') diff --git a/engine/termops.ml b/engine/termops.ml index a71bdff31e..40b3d0d8b6 100644 --- a/engine/termops.ml +++ b/engine/termops.ml @@ -1463,6 +1463,18 @@ let prod_applist sigma c l = | _ -> anomaly (Pp.str "Not enough prod's.") in app [] c l +let prod_applist_assum sigma n c l = + let open EConstr in + let rec app n subst c l = + if Int.equal n 0 then + if l == [] then Vars.substl subst c + else anomaly (Pp.str "Not enough arguments.") + else match EConstr.kind sigma c, l with + | Prod(_,_,c), arg::l -> app (n-1) (arg::subst) c l + | LetIn(_,b,_,c), _ -> app (n-1) (Vars.substl subst b::subst) c l + | _ -> anomaly (Pp.str "Not enough prod/let's.") in + app n [] c l + (* Combinators on judgments *) let on_judgment f j = { uj_val = f j.uj_val; uj_type = f j.uj_type } -- cgit v1.2.3