;;
let parametrize_proof p l r ty =
- let parameters =
- CicUtil.metas_of_term p @ CicUtil.metas_of_term l @ CicUtil.metas_of_term r
- in (* ?if they are under a lambda? *)
+ let uniq l = HExtlib.list_uniq (List.sort Pervasives.compare l) in
+ let mot = CicUtil.metas_of_term_set in
+ let parameters = uniq (mot p @ mot l @ mot r) in
+ (* ?if they are under a lambda? *)
let parameters =
HExtlib.list_uniq (List.sort Pervasives.compare parameters)
in
let topological_sort l =
(* build the partial order relation *)
- let m =
- List.fold_left (fun m i -> find_deps m i)
- M.empty l
+ let m = List.fold_left (fun m i -> find_deps m i) M.empty l in
+ let m = (* keep only deps inside l *)
+ List.fold_left
+ (fun m' i ->
+ M.add i (List.filter (fun x -> List.mem x l) (M.find i m)) m')
+ M.empty l
in
let m = M.map (fun x -> Some x) m in
(* utils *)
let res = ok @ res in
if ok = [] then res else aux m res
in
- aux m []
+ let rc = List.rev (aux m []) in
+ rc
;;