aboutsummaryrefslogtreecommitdiff
path: root/tactics
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2021-03-30 16:35:42 +0200
committerPierre-Marie Pédrot2021-03-30 21:46:12 +0200
commit75fec5716327beb1e93f294b70d563300d8f81ec (patch)
tree4e3e7ce7326f059181c599621d973214bae7f39d /tactics
parent6effcc263beded0d530d724fab8edae86815adf8 (diff)
Properly expand projection parameters in Btermdn.
The old code was generating different patterns, depending on whether a projection with parameters was expanded or not. In the first case, parameters were present, whereas in the latter they were not. We fix this by adding dummy parameter arguments on sight. Fixes #14009: TC search failure with primitive projections.
Diffstat (limited to 'tactics')
-rw-r--r--tactics/btermdn.ml15
1 files changed, 11 insertions, 4 deletions
diff --git a/tactics/btermdn.ml b/tactics/btermdn.ml
index af0ca22868..794d2bb94f 100644
--- a/tactics/btermdn.ml
+++ b/tactics/btermdn.ml
@@ -32,18 +32,25 @@ let compare_term_label t1 t2 = match t1, t2 with
type 'res lookup_res = 'res Dn.lookup_res = Label of 'res | Nothing | Everything
-let decomp_pat =
+let decomp_pat p =
let rec decrec acc = function
| PApp (f,args) -> decrec (Array.to_list args @ acc) f
- | PProj (p, c) -> (PRef (GlobRef.ConstRef (Projection.constant p)), c :: acc)
+ | PProj (p, c) ->
+ let hole = PMeta None in
+ let params = List.make (Projection.npars p) hole in
+ (PRef (GlobRef.ConstRef (Projection.constant p)), params @ c :: acc)
| c -> (c,acc)
in
- decrec []
+ decrec [] p
let decomp sigma t =
let rec decrec acc c = match EConstr.kind sigma c with
| App (f,l) -> decrec (Array.fold_right (fun a l -> a::l) l acc) f
- | Proj (p, c) -> (mkConst (Projection.constant p), c :: acc)
+ | Proj (p, c) ->
+ (* Hack: fake evar to generate [Everything] in the functions below *)
+ let hole = mkEvar (Evar.unsafe_of_int (-1), []) in
+ let params = List.make (Projection.npars p) hole in
+ (mkConst (Projection.constant p), params @ c :: acc)
| Cast (c1,_,_) -> decrec acc c1
| _ -> (c,acc)
in