;;
let qed () =
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> assert false
| Some (uri,[],bo,ty) ->
if
let refresh_proof (output : TermViewer.proof_viewer) =
try
let uri,currentproof =
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> assert false
| Some (uri,metasenv,bo,ty) ->
- ProofEngine.proof := Some(uri,metasenv,bo,ty);
+ ProofEngine.set_proof (Some (uri,metasenv,bo,ty)) ;
if List.length metasenv = 0 then
begin
!qed_set_sensitive true ;
ignore (output#load_proof uri currentproof)
with
e ->
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> assert false
| Some (uri,metasenv,bo,ty) ->
prerr_endline ("Offending proof: " ^ CicPp.ppobj (Cic.CurrentProof ("questa",metasenv,bo,ty,[]))) ; flush stderr ;
notebook#proofw#unload
| Some metano ->
let metasenv =
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> assert false
| Some (_,metasenv,_,_) -> metasenv
in
| Some m -> m
in
let metasenv =
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> assert false
| Some (_,metasenv,_,_) -> metasenv
in
match CicParser.obj_of_xml prooffiletype (Some prooffile) with
Cic.CurrentProof (_,metasenv,bo,ty,_) ->
typecheck_loaded_proof metasenv bo ty ;
- ProofEngine.proof :=
- Some (uri, metasenv, bo, ty) ;
+ ProofEngine.set_proof
+ (Some (uri, metasenv, bo, ty)) ;
ProofEngine.goal :=
(match metasenv with
[] -> None
let notebook = (rendering_window ())#notebook in
let outputhtml = ((rendering_window ())#outputhtml : GHtml.xmhtml) in
let metasenv =
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> assert false
| Some (_,metasenv,_,_) -> metasenv
in
try
let metasenv,expr = !get_metasenv_and_term () in
let _ = CicTypeChecker.type_of_aux' metasenv [] expr in
- ProofEngine.proof :=
- Some (!get_uri (), (1,[],expr)::metasenv, Cic.Meta (1,[]), expr) ;
+ ProofEngine.set_proof
+ (Some (!get_uri (), (1,[],expr)::metasenv, Cic.Meta (1,[]), expr)) ;
ProofEngine.goal := Some 1 ;
refresh_goals notebook ;
refresh_proof output ;
let inputt = ((rendering_window ())#inputt : TermEditor.term_editor) in
let outputhtml = ((rendering_window ())#outputhtml : GHtml.xmhtml) in
let metasenv =
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> []
| Some (_,metasenv,_,_) -> metasenv
in
| Cic.Variable _
| Cic.InductiveDefinition _ -> raise NotADefinition
in
- ProofEngine.proof :=
- Some (uri, metasenv, bo, ty) ;
+ ProofEngine.set_proof
+ (Some (uri, metasenv, bo, ty)) ;
ProofEngine.goal := None ;
refresh_goals notebook ;
refresh_proof output ;
let outputhtml = ((rendering_window ())#outputhtml : GHtml.xmhtml) in
try
let proof =
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> assert false
| Some proof -> proof
in
~callback:
(function _ ->
ApplyStylesheets.reload_stylesheets () ;
- if !ProofEngine.proof <> None then
+ if ProofEngine.get_proof () <> None then
try
refresh_goals notebook ;
refresh_proof output
struct
let call_tactic tactic () =
- let savedproof = !ProofEngine.proof in
+ let savedproof = ProofEngine.get_proof () in
let savedgoal = !ProofEngine.goal in
begin
try
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of the " ^
"sequent: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals ()
| RefreshProofException e ->
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of the " ^
"proof: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals () ;
C.refresh_proof ()
| e ->
C.output_html
("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal
end
let call_tactic_with_input tactic ?term () =
- let savedproof = !ProofEngine.proof in
+ let savedproof = ProofEngine.get_proof () in
let savedgoal = !ProofEngine.goal in
let uri,metasenv,bo,ty =
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> assert false
| Some (uri,metasenv,bo,ty) -> uri,metasenv,bo,ty
in
| Some t -> (C.term_editor ())#set_term t);
(C.term_editor ())#get_metasenv_and_term canonical_context metasenv
in
- ProofEngine.proof := Some (uri,metasenv',bo,ty) ;
+ ProofEngine.set_proof (Some (uri,metasenv',bo,ty)) ;
tactic expr ;
C.refresh_goals () ;
C.refresh_proof () ;
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of the " ^
"sequent: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals ()
| RefreshProofException e ->
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of the " ^
"proof: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals () ;
C.refresh_proof ()
| e ->
C.output_html
("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal
let call_tactic_with_goal_input tactic () =
let module L = LogicalOperations in
let module G = Gdome in
- let savedproof = !ProofEngine.proof in
+ let savedproof = ProofEngine.get_proof () in
let savedgoal = !ProofEngine.goal in
match (C.sequent_viewer ())#get_selected_terms with
[term] ->
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of " ^
"the sequent: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals ()
| RefreshProofException e ->
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of " ^
"the proof: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals () ;
C.refresh_proof ()
| e ->
C.output_html
("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
end
| [] ->
let call_tactic_with_goal_inputs tactic () =
let module L = LogicalOperations in
let module G = Gdome in
- let savedproof = !ProofEngine.proof in
+ let savedproof = ProofEngine.get_proof () in
let savedgoal = !ProofEngine.goal in
try
match (C.sequent_viewer ())#get_selected_terms with
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of the " ^
"sequent: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals ()
| RefreshProofException e ->
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of the " ^
"proof: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals () ;
C.refresh_proof ()
| e ->
C.output_html
("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal
let call_tactic_with_input_and_goal_input tactic () =
let module L = LogicalOperations in
let module G = Gdome in
- let savedproof = !ProofEngine.proof in
+ let savedproof = ProofEngine.get_proof () in
let savedgoal = !ProofEngine.goal in
match (C.sequent_viewer ())#get_selected_terms with
[term] ->
begin
try
let uri,metasenv,bo,ty =
- match !ProofEngine.proof with
+ match ProofEngine.get_proof () with
None -> assert false
| Some (uri,metasenv,bo,ty) -> uri,metasenv,bo,ty
in
let (metasenv',expr) =
(C.term_editor ())#get_metasenv_and_term canonical_context metasenv
in
- ProofEngine.proof := Some (uri,metasenv',bo,ty) ;
+ ProofEngine.set_proof (Some (uri,metasenv',bo,ty)) ;
tactic ~goal_input:term ~input:expr ;
C.refresh_goals () ;
C.refresh_proof () ;
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of " ^
"the sequent: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals ()
| RefreshProofException e ->
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of " ^
"the proof: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals () ;
C.refresh_proof ()
| e ->
C.output_html
("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
end
| [] ->
let call_tactic_with_hypothesis_input tactic () =
let module L = LogicalOperations in
let module G = Gdome in
- let savedproof = !ProofEngine.proof in
+ let savedproof = ProofEngine.get_proof () in
let savedgoal = !ProofEngine.goal in
match (C.sequent_viewer ())#get_selected_hypotheses with
[hypothesis] ->
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of " ^
"the sequent: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals ()
| RefreshProofException e ->
C.output_html
("<h1 color=\"red\">Exception raised during the refresh of " ^
"the proof: " ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
C.refresh_goals () ;
C.refresh_proof ()
| e ->
C.output_html
("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
- ProofEngine.proof := savedproof ;
+ ProofEngine.set_proof savedproof ;
ProofEngine.goal := savedgoal ;
end
| [] ->
let proof = ref (None : proof option)
let goal = ref (None : goal option)
+let get_proof () = !proof;;
+let set_proof p = proof := p;;
+
let get_current_status_as_xml () =
- match !proof with
+ match get_proof () with
None -> assert false
| Some (uri, metasenv, bo, ty) ->
let currentproof =
;;
let apply_tactic ~tactic =
- match !proof,!goal with
+ match get_proof (),!goal with
| None,_
| _,None -> assert false
| Some proof', Some goal' ->
let (newproof, newgoals) = tactic ~status:(proof', goal') in
- proof := Some newproof;
+ set_proof (Some newproof);
goal :=
(match newgoals, newproof with
goal::_, _ -> Some goal
(* are efficiency reasons. *)
let perforate context term ty =
let module C = Cic in
- match !proof with
+ match get_proof () with
None -> assert false
| Some (uri,metasenv,bo,gty as proof') ->
let newmeta = new_meta proof' in
let metasenv'' =
List.filter (function (n,_,_) -> List.mem n newmetas) metasenv'
in
- proof := Some (uri,metasenv'',bo',gty) ;
+ set_proof (Some (uri,metasenv'',bo',gty)) ;
goal := Some newmeta
(* Reduces [term] using [reduction_function] in the current scratch goal [ty] *)
let reduction_tactic_in_scratch reduction_function terms ty =
let metasenv =
- match !proof with
+ match get_proof () with
None -> []
| Some (_,metasenv,_,_) -> metasenv
in