1 (* Copyright (C) 2000, 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://cs.unibo.it/helm/.
26 (******************************************************************************)
30 (* Claudio Sacerdoti Coen <sacerdot@cs.unibo.it> *)
34 (******************************************************************************)
36 (* GLOBAL CONSTANTS *)
38 let helmns = Gdome.domString "http://www.cs.unibo.it/helm";;
42 " <body bgColor=\"white\">"
50 (* GLOBAL REFERENCES (USED BY CALLBACKS) *)
52 let htmlheader_and_content = ref htmlheader;;
54 let current_cic_infos = ref None;;
55 let current_goal_infos = ref None;;
56 let current_scratch_infos = ref None;;
61 let domImpl = Gdome.domImplementation ();;
65 domImpl#createDocumentFromURI
67 ~uri:("http://phd.cs.unibo.it:8081/getxslt?uri=" ^ name) ?mode:None
69 ~uri:("styles/" ^ name) ()
71 Gdome_xslt.processStylesheet style
74 let d_c = parseStyle "drop_coercions.xsl";;
75 let tc1 = parseStyle "objtheorycontent.xsl";;
76 let hc2 = parseStyle "content_to_html.xsl";;
77 let l = parseStyle "link.xsl";;
79 let c1 = parseStyle "rootcontent.xsl";;
80 let g = parseStyle "genmmlid.xsl";;
81 let c2 = parseStyle "annotatedpres.xsl";;
84 let getterURL = Configuration.getter_url;;
85 let processorURL = Configuration.processor_url;;
87 let mml_styles = [d_c ; c1 ; g ; c2 ; l];;
89 ["processorURL", "'" ^ processorURL ^ "'" ;
90 "getterURL", "'" ^ getterURL ^ "'" ;
91 "draw_graphURL", "'http%3A//phd.cs.unibo.it%3A8083/'" ;
92 "uri_set_queueURL", "'http%3A//phd.cs.unibo.it%3A8084/'" ;
93 "UNICODEvsSYMBOL", "'symbol'" ;
94 "doctype-public", "'-//W3C//DTD%20XHTML%201.0%20Transitional//EN'" ;
95 "encoding", "'iso-8859-1'" ;
96 "media-type", "'text/html'" ;
97 "keys", "'d_c%2CC1%2CG%2CC2%2CL'" ;
98 "interfaceURL", "'http%3A//phd.cs.unibo.it/helm/html/cic/index.html'" ;
99 "naturalLanguage", "'yes'" ;
100 "annotations", "'no'" ;
101 "explodeall", "'true()'" ;
102 "topurl", "'http://phd.cs.unibo.it/helm'" ;
103 "CICURI", "'cic:/Coq/Init/Datatypes/bool_ind.con'" ]
106 let sequent_styles = [d_c ; c1 ; g ; c2 ; l];;
108 ["processorURL", "'" ^ processorURL ^ "'" ;
109 "getterURL", "'" ^ getterURL ^ "'" ;
110 "draw_graphURL", "'http%3A//phd.cs.unibo.it%3A8083/'" ;
111 "uri_set_queueURL", "'http%3A//phd.cs.unibo.it%3A8084/'" ;
112 "UNICODEvsSYMBOL", "'symbol'" ;
113 "doctype-public", "'-//W3C//DTD%20XHTML%201.0%20Transitional//EN'" ;
114 "encoding", "'iso-8859-1'" ;
115 "media-type", "'text/html'" ;
116 "keys", "'d_c%2CC1%2CG%2CC2%2CL'" ;
117 "interfaceURL", "'http%3A//phd.cs.unibo.it/helm/html/cic/index.html'" ;
118 "naturalLanguage", "'no'" ;
119 "annotations", "'no'" ;
120 "explodeall", "'true()'" ;
121 "topurl", "'http://phd.cs.unibo.it/helm'" ;
122 "CICURI", "'cic:/Coq/Init/Datatypes/bool_ind.con'" ]
125 let parse_file filename =
126 let inch = open_in filename in
127 let rec read_lines () =
129 let line = input_line inch in
137 let applyStylesheets input styles args =
138 List.fold_left (fun i style -> Gdome_xslt.applyStylesheet i style args)
142 let mml_of_cic_object uri annobj ids_to_inner_sorts ids_to_inner_types =
144 Cic2Xml.print_object uri ids_to_inner_sorts annobj
147 Cic2Xml.print_inner_types uri ids_to_inner_sorts
150 let input = Xml2Gdome.document_of_xml domImpl xml in
151 (*CSC: We save the innertypes to disk so that we can retrieve them in the *)
152 (*CSC: stylesheet. This DOES NOT work when UWOBO and/or the getter are not *)
154 Xml.pp xmlinnertypes (Some "/public/sacerdot/innertypes") ;
155 let output = applyStylesheets input mml_styles mml_args in
162 exception RefreshSequentException of exn;;
163 exception RefreshProofException of exn;;
165 let refresh_proof (output : GMathView.math_view) =
167 let uri,currentproof =
168 match !ProofEngine.proof with
170 | Some (uri,metasenv,bo,ty) ->
171 uri,(Cic.CurrentProof (UriManager.name_of_uri uri, metasenv, bo, ty))
174 (acic,ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,
175 ids_to_inner_types,ids_to_conjectures,ids_to_hypotheses)
177 Cic2acic.acic_object_of_cic_object currentproof
180 mml_of_cic_object uri acic ids_to_inner_sorts ids_to_inner_types
182 output#load_tree mml ;
184 Some (ids_to_terms,ids_to_father_ids,ids_to_conjectures,ids_to_hypotheses)
187 match !ProofEngine.proof with
189 | Some (uri,metasenv,bo,ty) ->
190 prerr_endline ("Offending proof: " ^ CicPp.ppobj (Cic.CurrentProof ("questa",metasenv,bo,ty))) ; flush stderr ;
191 raise (RefreshProofException e)
194 let refresh_sequent (proofw : GMathView.math_view) =
196 match !ProofEngine.goal with
197 None -> proofw#unload
200 match !ProofEngine.proof with
202 | Some (_,metasenv,_,_) -> metasenv
204 let currentsequent = List.find (function (m,_,_) -> m=metano) metasenv in
205 let sequent_gdome,ids_to_terms,ids_to_father_ids,ids_to_hypotheses =
206 SequentPp.XmlPp.print_sequent metasenv currentsequent
209 Xml2Gdome.document_of_xml domImpl sequent_gdome
212 applyStylesheets sequent_doc sequent_styles sequent_args
214 proofw#load_tree ~dom:sequent_mml ;
215 current_goal_infos :=
216 Some (ids_to_terms,ids_to_father_ids,ids_to_hypotheses)
220 match !ProofEngine.goal with
225 match !ProofEngine.proof with
227 | Some (_,metasenv,_,_) -> metasenv
229 let currentsequent = List.find (function (m,_,_) -> m=metano) metasenv in
230 prerr_endline ("Offending sequent: " ^ SequentPp.TextualPp.print_sequent currentsequent) ; flush stderr ;
231 raise (RefreshSequentException e)
235 ignore(domImpl#saveDocumentToFile ~doc:sequent_doc
236 ~name:"/public/sacerdot/guruguru1" ~indent:true ()) ;
239 let mml_of_cic_term metano term =
241 match !ProofEngine.proof with
243 | Some (_,metasenv,_,_) -> metasenv
246 match !ProofEngine.goal with
249 let (_,canonical_context,_) =
250 List.find (function (m,_,_) -> m=metano) metasenv
254 let sequent_gdome,ids_to_terms,ids_to_father_ids,ids_to_hypotheses =
255 SequentPp.XmlPp.print_sequent metasenv (metano,context,term)
258 Xml2Gdome.document_of_xml domImpl sequent_gdome
261 applyStylesheets sequent_doc sequent_styles sequent_args ;
263 current_scratch_infos :=
264 Some (term,ids_to_terms,ids_to_father_ids,ids_to_hypotheses) ;
268 let output_html outputhtml msg =
269 htmlheader_and_content := !htmlheader_and_content ^ msg ;
270 outputhtml#source (!htmlheader_and_content ^ htmlfooter) ;
271 outputhtml#set_topline (-1)
274 (***********************)
276 (***********************)
278 let call_tactic tactic rendering_window () =
279 let proofw = (rendering_window#proofw : GMathView.math_view) in
280 let output = (rendering_window#output : GMathView.math_view) in
281 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
282 let savedproof = !ProofEngine.proof in
283 let savedgoal = !ProofEngine.goal in
287 refresh_sequent proofw ;
290 RefreshSequentException e ->
291 output_html outputhtml
292 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
293 "sequent: " ^ Printexc.to_string e ^ "</h1>") ;
294 ProofEngine.proof := savedproof ;
295 ProofEngine.goal := savedgoal ;
296 refresh_sequent proofw
297 | RefreshProofException e ->
298 output_html outputhtml
299 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
300 "proof: " ^ Printexc.to_string e ^ "</h1>") ;
301 ProofEngine.proof := savedproof ;
302 ProofEngine.goal := savedgoal ;
303 refresh_sequent proofw ;
306 output_html outputhtml
307 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
308 ProofEngine.proof := savedproof ;
309 ProofEngine.goal := savedgoal ;
313 let call_tactic_with_input tactic rendering_window () =
314 let proofw = (rendering_window#proofw : GMathView.math_view) in
315 let output = (rendering_window#output : GMathView.math_view) in
316 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
317 let inputt = (rendering_window#inputt : GEdit.text) in
318 let savedproof = !ProofEngine.proof in
319 let savedgoal = !ProofEngine.goal in
320 (*CSC: Gran cut&paste da sotto... *)
321 let inputlen = inputt#length in
322 let input = inputt#get_chars 0 inputlen ^ "\n" in
323 let lexbuf = Lexing.from_string input in
325 match !ProofEngine.proof with
327 | Some (curi,_,_,_) -> curi
330 match !ProofEngine.proof with
332 | Some (_,metasenv,_,_) -> metasenv
339 (match !ProofEngine.goal with
342 let (_,canonical_context,_) =
343 List.find (function (m,_,_) -> m=metano) metasenv
351 CicTextualParserContext.main curi context CicTextualLexer.token lexbuf
356 refresh_sequent proofw ;
360 CicTextualParser0.Eof ->
361 inputt#delete_text 0 inputlen
362 | RefreshSequentException e ->
363 output_html outputhtml
364 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
365 "sequent: " ^ Printexc.to_string e ^ "</h1>") ;
366 ProofEngine.proof := savedproof ;
367 ProofEngine.goal := savedgoal ;
368 refresh_sequent proofw
369 | RefreshProofException e ->
370 output_html outputhtml
371 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
372 "proof: " ^ Printexc.to_string e ^ "</h1>") ;
373 ProofEngine.proof := savedproof ;
374 ProofEngine.goal := savedgoal ;
375 refresh_sequent proofw ;
378 output_html outputhtml
379 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
380 ProofEngine.proof := savedproof ;
381 ProofEngine.goal := savedgoal ;
384 let call_tactic_with_goal_input tactic rendering_window () =
385 let module L = LogicalOperations in
386 let module G = Gdome in
387 let proofw = (rendering_window#proofw : GMathView.math_view) in
388 let output = (rendering_window#output : GMathView.math_view) in
389 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
390 let savedproof = !ProofEngine.proof in
391 let savedgoal = !ProofEngine.goal in
392 match proofw#get_selection with
395 ((node : Gdome.element)#getAttributeNS
397 ~localName:(G.domString "xref"))#to_string
399 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
403 match !current_goal_infos with
404 Some (ids_to_terms, ids_to_father_ids,_) ->
406 tactic (Hashtbl.find ids_to_terms id) ;
407 refresh_sequent rendering_window#proofw ;
408 refresh_proof rendering_window#output
409 | None -> assert false (* "ERROR: No current term!!!" *)
411 RefreshSequentException e ->
412 output_html outputhtml
413 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
414 "sequent: " ^ Printexc.to_string e ^ "</h1>") ;
415 ProofEngine.proof := savedproof ;
416 ProofEngine.goal := savedgoal ;
417 refresh_sequent proofw
418 | RefreshProofException e ->
419 output_html outputhtml
420 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
421 "proof: " ^ Printexc.to_string e ^ "</h1>") ;
422 ProofEngine.proof := savedproof ;
423 ProofEngine.goal := savedgoal ;
424 refresh_sequent proofw ;
427 output_html outputhtml
428 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
429 ProofEngine.proof := savedproof ;
430 ProofEngine.goal := savedgoal ;
433 output_html outputhtml
434 ("<h1 color=\"red\">No term selected</h1>")
437 let call_tactic_with_input_and_goal_input tactic rendering_window () =
438 let module L = LogicalOperations in
439 let module G = Gdome in
440 let proofw = (rendering_window#proofw : GMathView.math_view) in
441 let output = (rendering_window#output : GMathView.math_view) in
442 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
443 let inputt = (rendering_window#inputt : GEdit.text) in
444 let savedproof = !ProofEngine.proof in
445 let savedgoal = !ProofEngine.goal in
446 match proofw#get_selection with
449 ((node : Gdome.element)#getAttributeNS
451 ~localName:(G.domString "xref"))#to_string
453 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
457 match !current_goal_infos with
458 Some (ids_to_terms, ids_to_father_ids,_) ->
460 (* Let's parse the input *)
461 let inputlen = inputt#length in
462 let input = inputt#get_chars 0 inputlen ^ "\n" in
463 let lexbuf = Lexing.from_string input in
465 match !ProofEngine.proof with
467 | Some (curi,_,_,_) -> curi
470 match !ProofEngine.proof with
472 | Some (_,metasenv,_,_) -> metasenv
479 (match !ProofEngine.goal with
482 let (_,canonical_context,_) =
483 List.find (function (m,_,_) -> m=metano) metasenv
492 CicTextualParserContext.main curi context
493 CicTextualLexer.token lexbuf
497 tactic ~goal_input:(Hashtbl.find ids_to_terms id)
499 refresh_sequent proofw ;
503 CicTextualParser0.Eof ->
504 inputt#delete_text 0 inputlen
506 | None -> assert false (* "ERROR: No current term!!!" *)
508 RefreshSequentException e ->
509 output_html outputhtml
510 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
511 "sequent: " ^ Printexc.to_string e ^ "</h1>") ;
512 ProofEngine.proof := savedproof ;
513 ProofEngine.goal := savedgoal ;
514 refresh_sequent proofw
515 | RefreshProofException e ->
516 output_html outputhtml
517 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
518 "proof: " ^ Printexc.to_string e ^ "</h1>") ;
519 ProofEngine.proof := savedproof ;
520 ProofEngine.goal := savedgoal ;
521 refresh_sequent proofw ;
524 output_html outputhtml
525 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
526 ProofEngine.proof := savedproof ;
527 ProofEngine.goal := savedgoal ;
530 output_html outputhtml
531 ("<h1 color=\"red\">No term selected</h1>")
534 let call_tactic_with_goal_input_in_scratch tactic scratch_window () =
535 let module L = LogicalOperations in
536 let module G = Gdome in
537 let mmlwidget = (scratch_window#mmlwidget : GMathView.math_view) in
538 let outputhtml = (scratch_window#outputhtml : GHtml.xmhtml) in
539 let savedproof = !ProofEngine.proof in
540 let savedgoal = !ProofEngine.goal in
541 match mmlwidget#get_selection with
544 ((node : Gdome.element)#getAttributeNS
546 ~localName:(G.domString "xref"))#to_string
548 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
552 match !current_scratch_infos with
553 (* term is the whole goal in the scratch_area *)
554 Some (term,ids_to_terms, ids_to_father_ids,_) ->
556 let expr = tactic term (Hashtbl.find ids_to_terms id) in
557 let mml = mml_of_cic_term 111 expr in
558 scratch_window#show () ;
559 scratch_window#mmlwidget#load_tree ~dom:mml
560 | None -> assert false (* "ERROR: No current term!!!" *)
563 output_html outputhtml
564 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>")
567 output_html outputhtml
568 ("<h1 color=\"red\">No term selected</h1>")
571 let call_tactic_with_hypothesis_input tactic rendering_window () =
572 let module L = LogicalOperations in
573 let module G = Gdome in
574 let proofw = (rendering_window#proofw : GMathView.math_view) in
575 let output = (rendering_window#output : GMathView.math_view) in
576 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
577 let savedproof = !ProofEngine.proof in
578 let savedgoal = !ProofEngine.goal in
579 match proofw#get_selection with
582 ((node : Gdome.element)#getAttributeNS
584 ~localName:(G.domString "xref"))#to_string
586 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
590 match !current_goal_infos with
591 Some (_,_,ids_to_hypotheses) ->
593 tactic (Hashtbl.find ids_to_hypotheses id) ;
594 refresh_sequent rendering_window#proofw ;
595 refresh_proof rendering_window#output
596 | None -> assert false (* "ERROR: No current term!!!" *)
598 RefreshSequentException e ->
599 output_html outputhtml
600 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
601 "sequent: " ^ Printexc.to_string e ^ "</h1>") ;
602 ProofEngine.proof := savedproof ;
603 ProofEngine.goal := savedgoal ;
604 refresh_sequent proofw
605 | RefreshProofException e ->
606 output_html outputhtml
607 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
608 "proof: " ^ Printexc.to_string e ^ "</h1>") ;
609 ProofEngine.proof := savedproof ;
610 ProofEngine.goal := savedgoal ;
611 refresh_sequent proofw ;
614 output_html outputhtml
615 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
616 ProofEngine.proof := savedproof ;
617 ProofEngine.goal := savedgoal ;
620 output_html outputhtml
621 ("<h1 color=\"red\">No term selected</h1>")
625 let intros rendering_window = call_tactic ProofEngine.intros rendering_window;;
626 let exact rendering_window =
627 call_tactic_with_input ProofEngine.exact rendering_window
629 let apply rendering_window =
630 call_tactic_with_input ProofEngine.apply rendering_window
632 let elimintrossimpl rendering_window =
633 call_tactic_with_input ProofEngine.elim_intros_simpl rendering_window
635 let whd rendering_window =
636 call_tactic_with_goal_input ProofEngine.whd rendering_window
638 let reduce rendering_window =
639 call_tactic_with_goal_input ProofEngine.reduce rendering_window
641 let simpl rendering_window =
642 call_tactic_with_goal_input ProofEngine.simpl rendering_window
644 let fold rendering_window =
645 call_tactic_with_input ProofEngine.fold rendering_window
647 let cut rendering_window =
648 call_tactic_with_input ProofEngine.cut rendering_window
650 let change rendering_window =
651 call_tactic_with_input_and_goal_input ProofEngine.change rendering_window
653 let letin rendering_window =
654 call_tactic_with_input ProofEngine.letin rendering_window
656 let clearbody rendering_window =
657 call_tactic_with_hypothesis_input ProofEngine.clearbody rendering_window
659 let clear rendering_window =
660 call_tactic_with_hypothesis_input ProofEngine.clear rendering_window
664 let whd_in_scratch scratch_window =
665 call_tactic_with_goal_input_in_scratch ProofEngine.whd_in_scratch
668 let reduce_in_scratch scratch_window =
669 call_tactic_with_goal_input_in_scratch ProofEngine.reduce_in_scratch
672 let simpl_in_scratch scratch_window =
673 call_tactic_with_goal_input_in_scratch ProofEngine.simpl_in_scratch
679 (**********************)
681 (**********************)
683 exception OpenConjecturesStillThere;;
684 exception WrongProof;;
686 let qed rendering_window () =
687 match !ProofEngine.proof with
689 | Some (uri,[],bo,ty) ->
691 CicReduction.are_convertible []
692 (CicTypeChecker.type_of_aux' [] [] bo) ty
695 (*CSC: Wrong: [] is just plainly wrong *)
696 let proof = Cic.Definition (UriManager.name_of_uri uri,bo,ty,[]) in
698 (acic,ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,
699 ids_to_inner_types,ids_to_conjectures,ids_to_hypotheses)
701 Cic2acic.acic_object_of_cic_object proof
704 mml_of_cic_object uri acic ids_to_inner_sorts ids_to_inner_types
706 (rendering_window#output : GMathView.math_view)#load_tree mml ;
709 (ids_to_terms,ids_to_father_ids,ids_to_conjectures,
714 | _ -> raise OpenConjecturesStillThere
718 let dtdname = "http://www.cs.unibo.it/helm/dtd/cic.dtd";;
720 let dtdname = "/projects/helm/V7/dtd/cic.dtd";;
722 let save rendering_window () =
723 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
724 match !ProofEngine.proof with
726 | Some (uri, metasenv, bo, ty) ->
728 Cic.CurrentProof (UriManager.name_of_uri uri,metasenv,bo,ty)
730 let (acurrentproof,_,_,ids_to_inner_sorts,_,_,_) =
731 Cic2acic.acic_object_of_cic_object currentproof
733 let xml = Cic2Xml.print_object uri ids_to_inner_sorts acurrentproof in
735 [< Xml.xml_cdata "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
737 ("<!DOCTYPE CurrentProof SYSTEM \"" ^ dtdname ^ "\">\n\n") ;
741 Xml.pp ~quiet:true xml' (Some "/public/sacerdot/currentproof") ;
742 output_html outputhtml
743 ("<h1 color=\"Green\">Current proof saved to " ^
744 "/public/sacerdot/currentproof</h1>")
747 let load rendering_window () =
748 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
749 let output = (rendering_window#output : GMathView.math_view) in
750 let proofw = (rendering_window#proofw : GMathView.math_view) in
752 let uri = UriManager.uri_of_string "cic:/dummy.con" in
753 match CicParser.obj_of_xml "/public/sacerdot/currentproof" uri with
754 Cic.CurrentProof (_,metasenv,bo,ty) ->
756 Some (uri, metasenv, bo, ty) ;
760 | (metano,_,_)::_ -> Some metano
762 refresh_proof output ;
763 refresh_sequent proofw ;
764 output_html outputhtml
765 ("<h1 color=\"Green\">Current proof loaded from " ^
766 "/public/sacerdot/currentproof</h1>")
769 RefreshSequentException e ->
770 output_html outputhtml
771 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
772 "sequent: " ^ Printexc.to_string e ^ "</h1>")
773 | RefreshProofException e ->
774 output_html outputhtml
775 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
776 "proof: " ^ Printexc.to_string e ^ "</h1>")
778 output_html outputhtml
779 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
782 let proveit rendering_window () =
783 let module L = LogicalOperations in
784 let module G = Gdome in
785 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
786 match rendering_window#output#get_selection with
789 ((node : Gdome.element)#getAttributeNS
791 ((element : G.element)#getAttributeNS
794 ~localName:(G.domString "xref"))#to_string
796 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
800 match !current_cic_infos with
801 Some (ids_to_terms, ids_to_father_ids, _, _) ->
803 L.to_sequent id ids_to_terms ids_to_father_ids ;
804 refresh_proof rendering_window#output ;
805 refresh_sequent rendering_window#proofw
806 | None -> assert false (* "ERROR: No current term!!!" *)
808 RefreshSequentException e ->
809 output_html outputhtml
810 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
811 "sequent: " ^ Printexc.to_string e ^ "</h1>")
812 | RefreshProofException e ->
813 output_html outputhtml
814 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
815 "proof: " ^ Printexc.to_string e ^ "</h1>")
817 output_html outputhtml
818 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>")
820 | None -> assert false (* "ERROR: No selection!!!" *)
823 let focus rendering_window () =
824 let module L = LogicalOperations in
825 let module G = Gdome in
826 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
827 match rendering_window#output#get_selection with
830 ((node : Gdome.element)#getAttributeNS
832 ((element : G.element)#getAttributeNS
835 ~localName:(G.domString "xref"))#to_string
837 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
841 match !current_cic_infos with
842 Some (ids_to_terms, ids_to_father_ids, _, _) ->
844 L.focus id ids_to_terms ids_to_father_ids ;
845 refresh_sequent rendering_window#proofw
846 | None -> assert false (* "ERROR: No current term!!!" *)
848 RefreshSequentException e ->
849 output_html outputhtml
850 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
851 "sequent: " ^ Printexc.to_string e ^ "</h1>")
852 | RefreshProofException e ->
853 output_html outputhtml
854 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
855 "proof: " ^ Printexc.to_string e ^ "</h1>")
857 output_html outputhtml
858 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>")
860 | None -> assert false (* "ERROR: No selection!!!" *)
863 exception NoPrevGoal;;
864 exception NoNextGoal;;
866 let prevgoal metasenv metano =
870 | [(m,_,_)] -> raise NoPrevGoal
871 | (n,_,_)::(m,_,_)::_ when m=metano -> n
877 let nextgoal metasenv metano =
881 | [(m,_,_)] when m = metano -> raise NoNextGoal
882 | (m,_,_)::(n,_,_)::_ when m=metano -> n
888 let prev_or_next_goal select_goal rendering_window () =
889 let module L = LogicalOperations in
890 let module G = Gdome in
891 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
893 match !ProofEngine.proof with
895 | Some (_,metasenv,_,_) -> metasenv
898 match !ProofEngine.goal with
903 ProofEngine.goal := Some (select_goal metasenv metano) ;
904 refresh_sequent rendering_window#proofw
906 RefreshSequentException e ->
907 output_html outputhtml
908 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
909 "sequent: " ^ Printexc.to_string e ^ "</h1>")
911 output_html outputhtml
912 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>")
915 exception NotADefinition;;
917 let open_ rendering_window () =
918 let inputt = (rendering_window#inputt : GEdit.text) in
919 let oldinputt = (rendering_window#oldinputt : GEdit.text) in
920 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
921 let output = (rendering_window#output : GMathView.math_view) in
922 let proofw = (rendering_window#proofw : GMathView.math_view) in
923 let inputlen = inputt#length in
924 let input = inputt#get_chars 0 inputlen ^ "\n" in
926 let uri = UriManager.uri_of_string ("cic:" ^ input) in
927 CicTypeChecker.typecheck uri ;
929 match CicEnvironment.get_cooked_obj uri 0 with
930 Cic.Definition (_,bo,ty,_) -> [],bo,ty
931 | Cic.CurrentProof (_,metasenv,bo,ty) -> metasenv,bo,ty
934 | Cic.InductiveDefinition _ -> raise NotADefinition
937 Some (uri, metasenv, bo, ty) ;
938 ProofEngine.goal := None ;
939 refresh_sequent proofw ;
940 refresh_proof output ;
941 inputt#delete_text 0 inputlen ;
942 ignore(oldinputt#insert_text input oldinputt#length)
944 RefreshSequentException e ->
945 output_html outputhtml
946 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
947 "sequent: " ^ Printexc.to_string e ^ "</h1>")
948 | RefreshProofException e ->
949 output_html outputhtml
950 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
951 "proof: " ^ Printexc.to_string e ^ "</h1>")
953 output_html outputhtml
954 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
957 let state rendering_window () =
958 let inputt = (rendering_window#inputt : GEdit.text) in
959 let oldinputt = (rendering_window#oldinputt : GEdit.text) in
960 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
961 let output = (rendering_window#output : GMathView.math_view) in
962 let proofw = (rendering_window#proofw : GMathView.math_view) in
963 let inputlen = inputt#length in
964 let input = inputt#get_chars 0 inputlen ^ "\n" in
965 (* Do something interesting *)
966 let lexbuf = Lexing.from_string input in
969 (* Execute the actions *)
970 match CicTextualParser.main CicTextualLexer.token lexbuf with
973 let _ = CicTypeChecker.type_of_aux' [] [] expr in
975 Some (UriManager.uri_of_string "cic:/dummy.con",
976 [1,[],expr], Cic.Meta (1,[]), expr) ;
977 ProofEngine.goal := Some 1 ;
978 refresh_sequent proofw ;
979 refresh_proof output ;
982 CicTextualParser0.Eof ->
983 inputt#delete_text 0 inputlen ;
984 ignore(oldinputt#insert_text input oldinputt#length)
985 | RefreshSequentException e ->
986 output_html outputhtml
987 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
988 "sequent: " ^ Printexc.to_string e ^ "</h1>")
989 | RefreshProofException e ->
990 output_html outputhtml
991 ("<h1 color=\"red\">Exception raised during the refresh of the " ^
992 "proof: " ^ Printexc.to_string e ^ "</h1>")
994 output_html outputhtml
995 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
998 let check rendering_window scratch_window () =
999 let inputt = (rendering_window#inputt : GEdit.text) in
1000 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
1001 let output = (rendering_window#output : GMathView.math_view) in
1002 let proofw = (rendering_window#proofw : GMathView.math_view) in
1003 let inputlen = inputt#length in
1004 let input = inputt#get_chars 0 inputlen ^ "\n" in
1006 match !ProofEngine.proof with
1007 None -> UriManager.uri_of_string "cic:/dummy.con", []
1008 | Some (curi,metasenv,_,_) -> curi,metasenv
1010 let context,names_context =
1012 match !ProofEngine.goal with
1015 let (_,canonical_context,_) =
1016 List.find (function (m,_,_) -> m=metano) metasenv
1023 Some (n,_) -> Some n
1027 (* Do something interesting *)
1028 let lexbuf = Lexing.from_string input in
1031 (* Execute the actions *)
1033 CicTextualParserContext.main curi names_context CicTextualLexer.token
1039 let ty = CicTypeChecker.type_of_aux' metasenv context expr in
1040 let mml = mml_of_cic_term 111 (Cic.Cast (expr,ty)) in
1041 scratch_window#show () ;
1042 scratch_window#mmlwidget#load_tree ~dom:mml
1045 print_endline ("? " ^ CicPp.ppterm expr) ;
1049 CicTextualParser0.Eof -> ()
1051 output_html outputhtml
1052 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
1055 let locate rendering_window () =
1056 let inputt = (rendering_window#inputt : GEdit.text) in
1057 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
1058 let inputlen = inputt#length in
1059 let input = inputt#get_chars 0 inputlen in
1060 output_html outputhtml (
1062 match Str.split (Str.regexp "[ \t]+") input with
1065 inputt#delete_text 0 inputlen;
1068 e -> "<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>"
1072 let backward rendering_window () =
1073 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
1074 let inputt = (rendering_window#inputt : GEdit.text) in
1075 let inputlen = inputt#length in
1076 let input = inputt#get_chars 0 inputlen in
1077 let level = int_of_string input in
1079 match !ProofEngine.proof with
1080 None -> assert false
1081 | Some (_,metasenv,_,_) -> metasenv
1084 match !ProofEngine.goal with
1088 List.find (function (m,_,_) -> m=metano) metasenv
1090 Mquery.backward ty level
1092 output_html outputhtml result
1094 let choose_selection
1095 (mmlwidget : GMathView.math_view) (element : Gdome.element option)
1097 let module G = Gdome in
1098 let rec aux element =
1099 if element#hasAttributeNS
1100 ~namespaceURI:helmns
1101 ~localName:(G.domString "xref")
1103 mmlwidget#set_selection (Some element)
1105 match element#get_parentNode with
1106 None -> assert false
1107 (*CSC: OCAML DIVERGES!
1108 | Some p -> aux (new G.element_of_node p)
1110 | Some p -> aux (new Gdome.element_of_node p)
1114 | None -> mmlwidget#set_selection None
1117 (* STUFF TO BUILD THE GTK INTERFACE *)
1119 (* Stuff for the widget settings *)
1121 let export_to_postscript (output : GMathView.math_view) () =
1122 output#export_to_postscript ~filename:"output.ps" ();
1125 let activate_t1 (output : GMathView.math_view) button_set_anti_aliasing
1126 button_set_kerning button_set_transparency button_export_to_postscript
1129 let is_set = button_t1#active in
1130 output#set_font_manager_type
1131 (if is_set then `font_manager_t1 else `font_manager_gtk) ;
1134 button_set_anti_aliasing#misc#set_sensitive true ;
1135 button_set_kerning#misc#set_sensitive true ;
1136 button_set_transparency#misc#set_sensitive true ;
1137 button_export_to_postscript#misc#set_sensitive true ;
1141 button_set_anti_aliasing#misc#set_sensitive false ;
1142 button_set_kerning#misc#set_sensitive false ;
1143 button_set_transparency#misc#set_sensitive false ;
1144 button_export_to_postscript#misc#set_sensitive false ;
1148 let set_anti_aliasing output button_set_anti_aliasing () =
1149 output#set_anti_aliasing button_set_anti_aliasing#active
1152 let set_kerning output button_set_kerning () =
1153 output#set_kerning button_set_kerning#active
1156 let set_transparency output button_set_transparency () =
1157 output#set_transparency button_set_transparency#active
1160 let changefont output font_size_spinb () =
1161 output#set_font_size font_size_spinb#value_as_int
1164 let set_log_verbosity output log_verbosity_spinb () =
1165 output#set_log_verbosity log_verbosity_spinb#value_as_int
1168 class settings_window (output : GMathView.math_view) sw
1169 button_export_to_postscript selection_changed_callback
1171 let settings_window = GWindow.window ~title:"GtkMathView settings" () in
1173 GPack.vbox ~packing:settings_window#add () in
1176 ~rows:1 ~columns:3 ~homogeneous:false ~row_spacings:5 ~col_spacings:5
1177 ~border_width:5 ~packing:vbox#add () in
1179 GButton.toggle_button ~label:"activate t1 fonts"
1180 ~packing:(table#attach ~left:0 ~top:0) () in
1181 let button_set_anti_aliasing =
1182 GButton.toggle_button ~label:"set_anti_aliasing"
1183 ~packing:(table#attach ~left:0 ~top:1) () in
1184 let button_set_kerning =
1185 GButton.toggle_button ~label:"set_kerning"
1186 ~packing:(table#attach ~left:1 ~top:1) () in
1187 let button_set_transparency =
1188 GButton.toggle_button ~label:"set_transparency"
1189 ~packing:(table#attach ~left:2 ~top:1) () in
1192 ~rows:2 ~columns:2 ~homogeneous:false ~row_spacings:5 ~col_spacings:5
1193 ~border_width:5 ~packing:vbox#add () in
1194 let font_size_label =
1195 GMisc.label ~text:"font size:"
1196 ~packing:(table#attach ~left:0 ~top:0 ~expand:`NONE) () in
1197 let font_size_spinb =
1199 GData.adjustment ~value:14.0 ~lower:5.0 ~upper:50.0 ~step_incr:1.0 ()
1202 ~adjustment:sadj ~packing:(table#attach ~left:1 ~top:0 ~fill:`NONE) () in
1203 let log_verbosity_label =
1204 GMisc.label ~text:"log verbosity:"
1205 ~packing:(table#attach ~left:0 ~top:1) () in
1206 let log_verbosity_spinb =
1208 GData.adjustment ~value:0.0 ~lower:0.0 ~upper:3.0 ~step_incr:1.0 ()
1211 ~adjustment:sadj ~packing:(table#attach ~left:1 ~top:1) () in
1213 GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in
1215 GButton.button ~label:"Close"
1216 ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in
1218 method show = settings_window#show
1220 button_set_anti_aliasing#misc#set_sensitive false ;
1221 button_set_kerning#misc#set_sensitive false ;
1222 button_set_transparency#misc#set_sensitive false ;
1223 (* Signals connection *)
1224 ignore(button_t1#connect#clicked
1225 (activate_t1 output button_set_anti_aliasing button_set_kerning
1226 button_set_transparency button_export_to_postscript button_t1)) ;
1227 ignore(font_size_spinb#connect#changed (changefont output font_size_spinb)) ;
1228 ignore(button_set_anti_aliasing#connect#toggled
1229 (set_anti_aliasing output button_set_anti_aliasing));
1230 ignore(button_set_kerning#connect#toggled
1231 (set_kerning output button_set_kerning)) ;
1232 ignore(button_set_transparency#connect#toggled
1233 (set_transparency output button_set_transparency)) ;
1234 ignore(log_verbosity_spinb#connect#changed
1235 (set_log_verbosity output log_verbosity_spinb)) ;
1236 ignore(closeb#connect#clicked settings_window#misc#hide)
1239 (* Scratch window *)
1241 class scratch_window outputhtml =
1243 GWindow.window ~title:"MathML viewer" ~border_width:2 () in
1245 GPack.vbox ~packing:window#add () in
1247 GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in
1249 GButton.button ~label:"Whd"
1250 ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in
1252 GButton.button ~label:"Reduce"
1253 ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in
1255 GButton.button ~label:"Simpl"
1256 ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in
1257 let scrolled_window =
1258 GBin.scrolled_window ~border_width:10
1259 ~packing:(vbox#pack ~expand:true ~padding:5) () in
1262 ~packing:(scrolled_window#add) ~width:400 ~height:280 () in
1264 method outputhtml = outputhtml
1265 method mmlwidget = mmlwidget
1266 method show () = window#misc#hide () ; window#show ()
1268 ignore(mmlwidget#connect#selection_changed (choose_selection mmlwidget)) ;
1269 ignore(window#event#connect#delete (fun _ -> window#misc#hide () ; true )) ;
1270 ignore(whdb#connect#clicked (whd_in_scratch self)) ;
1271 ignore(reduceb#connect#clicked (reduce_in_scratch self)) ;
1272 ignore(simplb#connect#clicked (simpl_in_scratch self))
1277 class rendering_window output proofw (label : GMisc.label) =
1279 GWindow.window ~title:"MathML viewer" ~border_width:2 () in
1281 GPack.hbox ~packing:window#add () in
1283 GPack.vbox ~packing:(hbox0#pack ~expand:false ~fill:false ~padding:5) () in
1284 let _ = vbox#pack ~expand:false ~fill:false ~padding:5 label#coerce in
1285 let scrolled_window0 =
1286 GBin.scrolled_window ~border_width:10
1287 ~packing:(vbox#pack ~expand:true ~padding:5) () in
1288 let _ = scrolled_window0#add output#coerce in
1290 GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in
1292 GButton.button ~label:"Settings"
1293 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
1294 let button_export_to_postscript =
1295 GButton.button ~label:"export_to_postscript"
1296 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
1298 GButton.button ~label:"Qed"
1299 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
1301 GButton.button ~label:"Save"
1302 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
1304 GButton.button ~label:"Load"
1305 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
1307 GButton.button ~label:"Close"
1308 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
1310 GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in
1312 GButton.button ~label:"Prove It"
1313 ~packing:(hbox2#pack ~expand:false ~fill:false ~padding:5) () in
1315 GButton.button ~label:"Focus"
1316 ~packing:(hbox2#pack ~expand:false ~fill:false ~padding:5) () in
1318 GButton.button ~label:"<"
1319 ~packing:(hbox2#pack ~expand:false ~fill:false ~padding:5) () in
1321 GButton.button ~label:">"
1322 ~packing:(hbox2#pack ~expand:false ~fill:false ~padding:5) () in
1323 let oldinputt = GEdit.text ~editable:false ~width:400 ~height:180
1324 ~packing:(vbox#pack ~padding:5) () in
1326 GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in
1328 GButton.button ~label:"State"
1329 ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
1331 GButton.button ~label:"Open"
1332 ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
1334 GButton.button ~label:"Check"
1335 ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
1337 GButton.button ~label:"Locate"
1338 ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
1340 GButton.button ~label:"Backward"
1341 ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
1342 let inputt = GEdit.text ~editable:true ~width:400 ~height: 100
1343 ~packing:(vbox#pack ~padding:5) () in
1345 GPack.vbox ~packing:(hbox0#pack ~expand:false ~fill:false ~padding:5) () in
1346 let scrolled_window1 =
1347 GBin.scrolled_window ~border_width:10
1348 ~packing:(vbox1#pack ~expand:true ~padding:5) () in
1349 let _ = scrolled_window1#add proofw#coerce in
1351 GPack.hbox ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5) () in
1353 GButton.button ~label:"Exact"
1354 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1356 GButton.button ~label:"Intros"
1357 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1359 GButton.button ~label:"Apply"
1360 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1361 let elimintrossimplb =
1362 GButton.button ~label:"ElimIntrosSimpl"
1363 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1365 GButton.button ~label:"Whd"
1366 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1368 GButton.button ~label:"Reduce"
1369 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1371 GButton.button ~label:"Simpl"
1372 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1374 GButton.button ~label:"Fold"
1375 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1377 GButton.button ~label:"Cut"
1378 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1380 GButton.button ~label:"Change"
1381 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1383 GButton.button ~label:"Let ... In"
1384 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
1386 GPack.hbox ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5) () in
1388 GButton.button ~label:"ClearBody"
1389 ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
1391 GButton.button ~label:"Clear"
1392 ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
1395 ~source:"<html><body bgColor=\"white\"></body></html>"
1396 ~width:400 ~height: 200
1397 ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5)
1399 let scratch_window = new scratch_window outputhtml in
1401 method outputhtml = outputhtml
1402 method oldinputt = oldinputt
1403 method inputt = inputt
1404 method output = (output : GMathView.math_view)
1405 method proofw = (proofw : GMathView.math_view)
1406 method show = window#show
1408 button_export_to_postscript#misc#set_sensitive false ;
1410 (* signal handlers here *)
1411 ignore(output#connect#selection_changed
1412 (function elem -> proofw#unload ; choose_selection output elem)) ;
1413 ignore(proofw#connect#selection_changed (choose_selection proofw)) ;
1414 ignore(closeb#connect#clicked (fun _ -> GMain.Main.quit ())) ;
1415 let settings_window = new settings_window output scrolled_window0
1416 button_export_to_postscript (choose_selection output) in
1417 ignore(settingsb#connect#clicked settings_window#show) ;
1418 ignore(button_export_to_postscript#connect#clicked (export_to_postscript output)) ;
1419 ignore(qedb#connect#clicked (qed self)) ;
1420 ignore(saveb#connect#clicked (save self)) ;
1421 ignore(loadb#connect#clicked (load self)) ;
1422 ignore(proveitb#connect#clicked (proveit self)) ;
1423 ignore(focusb#connect#clicked (focus self)) ;
1424 ignore(prevgoalb#connect#clicked (prev_or_next_goal prevgoal self)) ;
1425 ignore(nextgoalb#connect#clicked (prev_or_next_goal nextgoal self)) ;
1426 ignore(window#event#connect#delete (fun _ -> GMain.Main.quit () ; true )) ;
1427 ignore(stateb#connect#clicked (state self)) ;
1428 ignore(openb#connect#clicked (open_ self)) ;
1429 ignore(checkb#connect#clicked (check self scratch_window)) ;
1430 ignore(locateb#connect#clicked (locate self)) ;
1431 ignore(backwardb#connect#clicked (backward self)) ;
1432 ignore(exactb#connect#clicked (exact self)) ;
1433 ignore(applyb#connect#clicked (apply self)) ;
1434 ignore(elimintrossimplb#connect#clicked (elimintrossimpl self)) ;
1435 ignore(whdb#connect#clicked (whd self)) ;
1436 ignore(reduceb#connect#clicked (reduce self)) ;
1437 ignore(simplb#connect#clicked (simpl self)) ;
1438 ignore(foldb#connect#clicked (fold self)) ;
1439 ignore(cutb#connect#clicked (cut self)) ;
1440 ignore(changeb#connect#clicked (change self)) ;
1441 ignore(letinb#connect#clicked (letin self)) ;
1442 ignore(clearbodyb#connect#clicked (clearbody self)) ;
1443 ignore(clearb#connect#clicked (clear self)) ;
1444 ignore(introsb#connect#clicked (intros self)) ;
1445 Logger.log_callback :=
1446 (Logger.log_to_html ~print_and_flush:(output_html outputhtml))
1451 let initialize_everything () =
1452 let module U = Unix in
1453 let output = GMathView.math_view ~width:400 ~height:280 ()
1454 and proofw = GMathView.math_view ~width:400 ~height:275 ()
1455 and label = GMisc.label ~text:"gTopLevel" () in
1456 let rendering_window =
1457 new rendering_window output proofw label
1459 rendering_window#show () ;
1464 CicCooking.init () ;
1466 ignore (GtkMain.Main.init ()) ;
1467 initialize_everything () ;