and auxs context terms1 terms2 = (* as aux for list of terms *)
List.concat (List.map2 (fun t1 t2 -> aux context t1 t2) terms1 terms2)
in
+ let context_len = List.length context in
let roots = aux context where term in
match wanted with
None -> roots
let rec find_in_roots =
function
[] -> []
- | (context,where)::tl ->
+ | (context',where)::tl ->
let tl' = find_in_roots tl in
+ let context'_len = List.length context' in
let found =
- let wanted = CicSubstitution.lift (List.length context) wanted in
+ let wanted =
+ CicSubstitution.lift (context'_len - context_len) wanted
+ in
find_subterms ~wanted ~context where
in
found @ tl'