open DisambiguateTypes
open UriManager
-exception Invalid_choice
exception No_choices of domain_item
exception NoWellTypedInterpretation
| Symbol (s, _) -> s
| Num i -> string_of_int i
-let symbol_choices = Hashtbl.create 1023
-let num_choices = ref []
-
-let add_symbol_choice symbol codomain_item =
- let current_choices =
- try
- Hashtbl.find symbol_choices symbol
- with Not_found -> []
- in
- Hashtbl.replace symbol_choices symbol (codomain_item :: current_choices)
-let add_num_choice choice = num_choices := choice :: !num_choices
-
type test_result =
| Ok of Cic.term * Cic.metasenv
| Ko
match resolve env (Id indty_ident) () with
| Cic.MutInd (uri, tyno, _) -> uri, tyno
| Cic.Implicit -> raise Try_again
- | _ -> raise Invalid_choice
+ | _ -> raise DisambiguateChoices.Invalid_choice
in
Cic.MutCase (indtype_uri, indtype_no, cic_outtype, cic_term,
(List.map do_branch branches))
let choices = choices_of_id mqi_handle id in
Hashtbl.add id_choices id choices;
choices)
- | Symbol (symb, _) ->
- (try Hashtbl.find symbol_choices symb with Not_found -> [])
- | Num instance -> !num_choices
+ | Symbol (symb, _) -> DisambiguateChoices.lookup_symbol_choices symb
+ | Num instance -> DisambiguateChoices.lookup_num_choices ()
in
if choices = [] then raise (No_choices item);
choices
refine metasenv context cic_term
with
| Try_again -> Uncertain
- | Invalid_choice -> Ko
+ | DisambiguateChoices.Invalid_choice -> Ko
in
(* (4) build all possible interpretations *)
let rec aux current_env todo_dom =