1 (* Copyright (C) 2006, 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 let raw_preamble buri = "
27 inductive eq (A:Type) (x:A) : A \\to Prop \\def refl_eq : eq A x x.
29 theorem sym_eq : \\forall A:Type.\\forall x,y:A. eq A x y \\to eq A y x.
30 intros.elim H. apply refl_eq.
34 \\forall A:Type.\\forall x:A. \\forall P: A \\to Prop.
35 P x \\to \\forall y:A. eq A y x \\to P y.
36 intros. elim (sym_eq ? ? ? H1).assumption.
40 \\forall A:Type.\\forall x,y,z:A. eq A x y \\to eq A y z \\to eq A x z.
41 intros.elim H1.assumption.
44 theorem eq_f: \\forall A,B:Type.\\forall f:A\\to B.
45 \\forall x,y:A. eq A x y \\to eq B (f x) (f y).
46 intros.elim H.reflexivity.
49 theorem eq_f1: \\forall A,B:Type.\\forall f:A\\to B.
50 \\forall x,y:A. eq A x y \\to eq B (f y) (f x).
51 intros.elim H.reflexivity.
56 " ^ buri ^ "/sym_eq.con
57 " ^ buri ^ "/trans_eq.con
58 " ^ buri ^ "/eq_ind.con
59 " ^ buri ^ "/eq_elim_r.con
61 " ^ buri ^ "/eq_f1.con.
63 inductive ex (A:Type) (P:A \\to Prop) : Prop \\def
64 ex_intro: \\forall x:A. P x \\to ex A P.
65 interpretation \"exists\" 'exists \\eta.x =
66 (" ^ buri ^ "/ex.ind#xpointer(1/1) _ x).
68 notation < \"hvbox(\\exists ident i opt (: ty) break . p)\"
69 right associative with precedence 20
70 for @{ 'exists ${default
71 @{\\lambda ${ident i} : $ty. $p)}
72 @{\\lambda ${ident i} . $p}}}.
77 let p_to_ma ?timeout ~tptppath ~filename () =
79 Tptp2grafite.tptp2grafite ?timeout ~filename ~tptppath:tptppath
86 MatitaInit.fill_registry ();
87 let tptppath = ref "./" in
88 let timeout = ref 600 in
89 MatitaInit.add_cmdline_spec
90 ["-tptppath",Arg.String (fun s -> tptppath:= s),
91 "Where to find the Axioms/ and Problems/ directory";
92 "-timeout", Arg.Int (fun x -> timeout := x),
93 "Timeout in seconds"];
94 MatitaInit.parse_cmdline ();
95 MatitaInit.load_configuration_file ();
96 Helm_registry.set_bool "db.nodb" true;
97 Helm_registry.set_bool "matita.nodisk" true;
98 HLog.set_log_callback (fun _ _ -> ());
99 let args = Helm_registry.get_list Helm_registry.string "matita.args" in
103 | _ -> prerr_endline "You must specify exactly one .p file."; exit 1
106 p_to_ma ~timeout:!timeout ~filename:inputfile ~tptppath:!tptppath ()
108 (* prerr_endline data; *)
109 let is = Ulexing.from_utf8_string data in
110 let gs = GrafiteSync.init () in
112 CicNotation2.load_notation ~include_paths:[]
113 BuildTimeConf.core_notation_script
115 Sys.catch_break true;
118 MatitaEngine.eval_from_stream
119 ~first_statement_only:false
122 ~do_heavy_checks:false
128 let pp_ast_statement =
129 GrafiteAstPp.pp_statement ~term_pp:CicNotationPp.pp_term
130 ~lazy_term_pp:CicNotationPp.pp_term ~obj_pp:CicNotationPp.pp_obj
132 prerr_endline (pp_ast_statement s))
137 prerr_endline (snd (MatitaExcPp.to_string exn));