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 parseTactic: char Stream.t -> DisambiguateTypes.tactic
68 method parseTactical: char Stream.t -> DisambiguateTypes.tactical
69 method parseCommand: char Stream.t -> DisambiguateTypes.command
70 method parseScript: char Stream.t -> DisambiguateTypes.script
73 class type disambiguator =
75 method parserr: parserr
76 method setParserr: parserr -> unit
78 method env: DisambiguateTypes.environment
79 method setEnv: DisambiguateTypes.environment -> unit
81 (* TODO Zack: as long as matita doesn't support MDI inteface,
82 * disambiguateTerm will return a single term *)
83 (** @param env disambiguation environment. If this parameter is given the
84 * disambiguator act statelessly, that is internal disambiguation status
85 * want be changed but only returned. If this parameter is not given the
86 * internal one will be used and updated with the disambiguation status
87 * resulting from the disambiguation *)
88 method disambiguateTerm:
89 ?context:Cic.context -> ?metasenv:Cic.metasenv ->
90 ?env:DisambiguateTypes.environment ->
92 (DisambiguateTypes.environment * Cic.metasenv * Cic.term)
93 (** @param env @see disambiguateTerm above *)
94 method disambiguateTermAst:
95 ?context:Cic.context -> ?metasenv:Cic.metasenv ->
96 ?env:DisambiguateTypes.environment ->
97 DisambiguateTypes.term ->
98 (DisambiguateTypes.environment * Cic.metasenv * Cic.term)
101 class type proofStatus =
105 (** {3 properties} *)
107 method proof: ProofEngineTypes.proof
108 method setProof: ProofEngineTypes.proof -> unit
110 method goal: ProofEngineTypes.goal option
111 method setGoal: ProofEngineTypes.goal option -> unit
113 (** @raise MatitaTypes.No_proof *)
114 method status: ProofEngineTypes.status (* proof, goal *)
115 method setStatus: ProofEngineTypes.status -> unit
119 (** return a pair of "xml" (as defined in Xml module) representing the *
120 * current proof type and body, respectively *)
121 method toXml: Xml.token Stream.t * Xml.token Stream.t
122 method toString: string
128 method status: proofStatus
129 method setStatus: proofStatus -> unit
132 (** interpreter for toplevel phrases given via console *)
133 class type interpreter =
135 method evalPhrase: string -> unit
138 (** {2 shorthands} *)
140 type namer = ProofEngineTypes.mk_fresh_name_type
142 type choose_uris_callback =
143 selection_mode:[`MULTIPLE|`SINGLE] ->
144 ?title:string -> ?msg:string -> ?nonvars_button:bool ->
148 type choose_interp_callback = (string * string) list list -> int list