1 (* Copyright (C) 2004, HELM Team.
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.
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.
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.
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,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
26 exception Not_implemented of string
27 let not_implemented feature = raise (Not_implemented feature)
29 (** exceptions whose content should be presented to the user *)
30 exception Failure of string
31 let error s = raise (Failure s)
32 let warning s = prerr_endline ("MATITA WARNING:\t" ^ s)
34 if BuildTimeConf.debug then prerr_endline ("MATITA DEBUG:\t" ^ s)
36 exception No_proof (** no current proof is available *)
38 let untitled_con_uri = UriManager.uri_of_string "cic:/untitled.con"
39 let untitled_def_uri = UriManager.uri_of_string "cic:/untitled.ind"
42 (* "observer" pattern *)
44 method update: unit -> unit
48 (* "observer" pattern *)
50 val mutable observers = []
51 method attach (o: observer) = observers <- o :: observers
52 method detach (o: observer) =
53 observers <- List.filter (fun o' -> o' != o) observers
54 method notify () = List.iter (fun o -> o#update ()) observers
58 (* "command" pattern *)
60 method execute: unit -> unit
61 method undo: unit -> unit
64 class type parserr = (* "parser" is a keyword :-( *)
66 method parseTerm: char Stream.t -> DisambiguateTypes.term
67 method parseTactical: char Stream.t -> DisambiguateTypes.tactical
70 class type disambiguator =
72 method parserr: parserr
73 method setParserr: parserr -> unit
75 method env: DisambiguateTypes.environment
76 method setEnv: DisambiguateTypes.environment -> unit
78 (* TODO Zack: as long as matita doesn't support MDI inteface,
79 * disambiguateTerm will return a single term *)
80 (** @param env disambiguation environment. If this parameter is given the
81 * disambiguator act statelessly, that is internal disambiguation status
82 * want be changed but only returned. If this parameter is not given the
83 * internal one will be used and updated with the disambiguation status
84 * resulting from the disambiguation *)
85 method disambiguateTerm:
86 ?context:Cic.context -> ?metasenv:Cic.metasenv ->
87 ?env:DisambiguateTypes.environment ->
89 (DisambiguateTypes.environment * Cic.metasenv * Cic.term)
90 (** @param env @see disambiguateTerm above *)
91 method disambiguateTermAst:
92 ?context:Cic.context -> ?metasenv:Cic.metasenv ->
93 ?env:DisambiguateTypes.environment ->
94 DisambiguateTypes.term ->
95 (DisambiguateTypes.environment * Cic.metasenv * Cic.term)
98 class type proofStatus =
102 (** {3 properties} *)
104 method proof: ProofEngineTypes.proof
105 method setProof: ProofEngineTypes.proof -> unit
107 method goal: ProofEngineTypes.goal option
108 method setGoal: ProofEngineTypes.goal option -> unit
110 (** @raise MatitaTypes.No_proof *)
111 method status: ProofEngineTypes.status (* proof, goal *)
112 method setStatus: ProofEngineTypes.status -> unit
116 (** return a pair of "xml" (as defined in Xml module) representing the *
117 * current proof type and body, respectively *)
118 method toXml: Xml.token Stream.t * Xml.token Stream.t
119 method toString: string
125 method status: proofStatus
126 method setStatus: proofStatus -> unit
130 { get_proof: unit -> proof; (* return current proof or fail *)
131 set_proof: proof option -> unit; (* set a proof option as current proof *)
132 has_proof: unit -> bool; (* check if a current proof is available or not *)
133 new_proof: proof -> unit; (* as a set_proof but takes care also to register
138 (** interpreter for toplevel phrases given via console *)
139 class type interpreter =
141 method evalPhrase: string -> unit
144 (** {2 shorthands} *)
146 type namer = ProofEngineTypes.mk_fresh_name_type
148 type choose_uris_callback =
149 selection_mode:[`MULTIPLE|`SINGLE] ->
150 ?title:string -> ?msg:string -> ?nonvars_button:bool ->
154 type choose_interp_callback = (string * string) list list -> int list