let print_candidates mode term res =
-(* match res with *)
-(* | [] -> () *)
-(* | _ -> *)
- let _ =
- match mode with
- | Matching ->
- Printf.printf "| candidates Matching %s\n" (CicPp.ppterm term)
- | Unification ->
- Printf.printf "| candidates Unification %s\n" (CicPp.ppterm term)
- in
- print_endline
- (String.concat "\n"
- (List.map
- (fun (p, e) ->
- Printf.sprintf "| (%s, %s)" (Utils.string_of_pos p)
- (Inference.string_of_equality e))
- res));
- print_endline "|";
+ let _ =
+ match mode with
+ | Matching ->
+ Printf.printf "| candidates Matching %s\n" (CicPp.ppterm term)
+ | Unification ->
+ Printf.printf "| candidates Unification %s\n" (CicPp.ppterm term)
+ in
+ print_endline
+ (String.concat "\n"
+ (List.map
+ (fun (p, e) ->
+ Printf.sprintf "| (%s, %s)" (Utils.string_of_pos p)
+ (Inference.string_of_equality e))
+ res));
+ print_endline "|";
;;
-(*
let empty_table () =
Path_indexing.PSTrie.empty
;;
and in_index = Path_indexing.in_index;;
let get_candidates mode trie term =
- let res =
- let s =
- match mode with
- | Matching -> Path_indexing.retrieve_generalizations trie term
- | Unification -> Path_indexing.retrieve_unifiables trie term
- in
- Path_indexing.PosEqSet.elements s
+ let s =
+ match mode with
+ | Matching -> Path_indexing.retrieve_generalizations trie term
+ | Unification -> Path_indexing.retrieve_unifiables trie term
in
- print_candidates mode term res;
- res
+ Path_indexing.PosEqSet.elements s
;;
-*)
+(*
let empty_table () =
Discrimination_tree.DiscriminationTree.empty
;;
(* print_candidates mode term res; *)
res
;;
+*)
let rec find_matches metasenv context ugraph lift_amount term =
let module S = CicSubstitution in
let module M = CicMetaSubst in
let module HL = HelmLibraryObjects in
+ let candidates = get_candidates Matching table term in
match term with
| C.Meta _ -> None
| term ->
- let candidates = get_candidates Matching table term in
let res =
find_matches metasenv context ugraph lift_amount term candidates
in
let module S = CicSubstitution in
let module M = CicMetaSubst in
let module HL = HelmLibraryObjects in
+ let candidates = get_candidates Unification table term in
let res, lifted_term =
match term with
| C.Meta (i, l) ->
match term with
| C.Meta _ -> res, lifted_term
| term ->
- let candidates = get_candidates Unification table term in
let r =
find_all_matches metasenv context ugraph lift_amount term candidates
in