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 class proofStatus ~uri ~typ =
28 inherit MatitaTypes.subject
30 val mutable _proof = (uri, [ 1, [], typ ], Cic.Meta (1, []), typ)
31 val mutable _goal = Some 1
34 method setProof p = _proof <- p
36 method setGoal g = _goal <- g
39 (match _goal with Some g -> g | None -> raise MatitaTypes.No_proof)
40 method setStatus (p, g) =
45 let (uri, metasenv, bo, ty) = _proof in
47 (* TODO CSC: Wrong: [] is just plainly wrong *)
48 Cic.CurrentProof (UriManager.name_of_uri uri,metasenv,bo,ty,[])
50 let (acurrentproof,_,_,ids_to_inner_sorts,_,_,_) =
51 Cic2acic.acic_object_of_cic_object ~eta_fix:false currentproof
54 match Cic2Xml.print_object uri ~ids_to_inner_sorts
55 ~ask_dtd_to_the_getter:true acurrentproof
57 | xml, Some bodyxml -> xml, bodyxml
58 | _, None -> assert false
64 class proof ~uri ~typ =
66 val mutable _status = new proofStatus ~uri ~typ
67 method status = _status
68 method setStatus s = _status <- s
71 class tacticCommand ~(tactic:ProofEngineTypes.tactic) (status: proofStatus) =
73 val statusBackup = status#status
76 let (new_proof, new_goals) = tactic status#status in
77 status#setProof new_proof;
79 (match new_goals, new_proof with
80 | goal :: _, _ -> Some goal
81 | [], (_, (goal, _, _) :: _, _, _) ->
82 (* the tactic left no open goal: let's choose the first open goal *)
83 (* TODO CSC: here we could implement and use a proof-tree like
90 status#setStatus statusBackup;
96 ~tactic:(PrimitiveTactics.intros_tac ?mk_fresh_name_callback:namer ())
98 let reflexivity = new tacticCommand ~tactic:EqualityTactics.reflexivity_tac
99 let symmetry = new tacticCommand ~tactic:EqualityTactics.symmetry_tac
100 let transitivity term =
101 new tacticCommand ~tactic:(EqualityTactics.transitivity_tac ~term)
103 let exists = new tacticCommand ~tactic:IntroductionTactics.exists_tac
104 let split = new tacticCommand ~tactic:IntroductionTactics.split_tac
105 let left = new tacticCommand ~tactic:IntroductionTactics.left_tac
106 let right = new tacticCommand ~tactic:IntroductionTactics.right_tac
108 let assumption = new tacticCommand ~tactic:VariousTactics.assumption_tac