]> matita.cs.unibo.it Git - helm.git/blob - matitaB/components/disambiguation/disambiguate.mli
Matitaweb:
[helm.git] / matitaB / components / disambiguation / disambiguate.mli
1 (* Copyright (C) 2004, HELM Team.
2  * 
3  * This file is part of HELM, an Hypertextual, Electronic
4  * Library of Mathematics, developed at the Computer Science
5  * Department, University of Bologna, Italy.
6  * 
7  * HELM is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * 
12  * HELM is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with HELM; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://helm.cs.unibo.it/
24  *)
25
26 (** {2 Disambiguation interface} *)
27
28 type ('alias,'ast_thing,'metasenv,'subst,'thing,'ugraph) disamb_result =
29   | Disamb_success of ('ast_thing * 'metasenv * 'subst * 'thing * 'ugraph) list 
30   | Disamb_failure of 
31       (('ast_thing * 'alias option * Stdpp.location * string) list * Stdpp.location) list *
32       (('ast_thing * 'alias option * Stdpp.location * string) list * Stdpp.location) list
33
34 exception NoWellTypedInterpretation of
35  ((Stdpp.location * string) list *
36   (Stdpp.location * string) list)
37
38 exception PathNotWellFormed
39
40 type 'a disambiguator_input = string * int * 'a
41     
42 type domain = domain_tree list
43 and domain_tree = 
44   Node of Stdpp.location list * DisambiguateTypes.domain_item * domain
45
46 type ('term,'metasenv,'subst,'graph) test_result =
47   | Ok of 'term * 'metasenv * 'subst * 'graph
48   | Ko of (Stdpp.location * string) Lazy.t
49   | Uncertain of (Stdpp.location * string) Lazy.t
50
51 exception Try_again of string Lazy.t
52
53 (*
54 val set_choose_uris_callback:
55   DisambiguateTypes.interactive_user_uri_choice_type -> unit
56
57 val set_choose_interp_callback:
58   DisambiguateTypes.interactive_interpretation_choice_type -> unit
59
60 val set_choose_disamb_callback:
61   DisambiguateTypes.interactive_ast_choice_type -> unit
62
63 (** @raise Ambiguous_input if called, default value for internal
64   * choose_uris_callback if not set otherwise with set_choose_uris_callback
65   * above *)
66 val mono_uris_callback: DisambiguateTypes.interactive_user_uri_choice_type
67
68 (** @raise Ambiguous_input if called, default value for internal
69   * choose_interp_callback if not set otherwise with set_choose_interp_callback
70   * above *)
71 val mono_interp_callback: DisambiguateTypes.interactive_interpretation_choice_type
72 *)
73
74 val resolve : 
75   env:'alias1 DisambiguateTypes.InterprEnv.t ->
76   universe: GrafiteAst.alias_spec list DisambiguateTypes.Environment.t ->
77   mk_choice:('alias1 -> 'term DisambiguateTypes.codomain_item) ->
78   DisambiguateTypes.InterprEnv.key -> 'alias1 option -> 
79    [`Num_arg of string | `Args of 'term list] -> 'term
80
81 val find_in_context: string -> string option list -> int
82 val domain_of_term: context:
83   string option list -> NotationPt.term -> domain
84 val domain_of_obj: 
85   context:string option list -> NotationPt.term NotationPt.obj -> domain
86
87 val disambiguate_thing:
88   context:'context ->
89   metasenv:'metasenv ->
90   subst:'subst ->
91   use_coercions:bool ->
92   string_context_of_context:('context -> string option list) ->
93   initial_ugraph:'ugraph ->
94   expty: 'refined_thing option ->
95   mk_implicit:(bool -> 'alias) ->
96   description_of_alias:('alias -> string) ->
97   fix_instance:(DisambiguateTypes.domain_item -> 'alias list -> 'alias list) ->
98   aliases:'alias DisambiguateTypes.InterprEnv.t ->
99   universe:GrafiteAst.alias_spec list DisambiguateTypes.Environment.t ->
100   lookup_in_library:(
101     DisambiguateTypes.interactive_user_uri_choice_type ->
102     DisambiguateTypes.input_or_locate_uri_type ->
103     DisambiguateTypes.Environment.key ->
104     'alias list) ->
105   uri:'uri ->
106   pp_thing:('ast_thing -> string) ->
107   pp_term:(NotationPt.term -> string) ->
108   domain_of_thing:(context: string option list -> 'ast_thing -> domain) ->
109   interpretate_thing:(
110     context:'context ->
111     env:'alias DisambiguateTypes.InterprEnv.t ->
112     universe: GrafiteAst.alias_spec list DisambiguateTypes.Environment.t ->
113     uri:'uri ->
114     is_path:bool -> 
115     'ast_thing -> 
116     localization_tbl:'cichash -> 
117       'raw_thing) ->
118   refine_thing:(
119     'metasenv -> 'subst -> 'context -> 'uri -> use_coercions:bool ->
120     'raw_thing -> 'refined_thing option -> 'ugraph -> localization_tbl:'cichash -> 
121       ('refined_thing, 'metasenv,'subst,'ugraph) test_result) ->
122   visit:(pp_term:(NotationPt.term -> string) ->
123          (NotationPt.term -> bool) -> 'ast_thing -> 
124         ((NotationPt.term -> 'ast_thing) * NotationPt.term * Stdpp.location) option) -> 
125   mk_localization_tbl:(int -> 'cichash) ->
126   'ast_thing disambiguator_input ->
127   (GrafiteAst.alias_spec,'ast_thing,'metasenv,'subst,'refined_thing,'ugraph) disamb_result 
128
129 type 'ast marked_ast = 
130   (NotationPt.term -> 'ast) * NotationPt.term * Stdpp.location
131
132 val bfvisit :
133   pp_term:(NotationPt.term -> string) -> 
134   (NotationPt.term -> bool) ->
135    NotationPt.term -> (NotationPt.term marked_ast) option
136
137 val bfvisit_obj :
138   pp_term:(NotationPt.term -> string) -> 
139   (NotationPt.term -> bool) ->
140    NotationPt.term NotationPt.obj -> 
141   ((NotationPt.term NotationPt.obj) marked_ast) option