let proof = ref (None : proof option)
let goal = ref (None : goal option)
-let apply_or_can_apply_tactic ~try_only ~tactic =
+let get_current_status_as_xml () =
+ match !proof with
+ None -> assert false
+ | Some (uri, metasenv, bo, ty) ->
+ let currentproof =
+ (*CSC: Wrong: [] is just plainly wrong *)
+ Cic.CurrentProof (UriManager.name_of_uri uri,metasenv,bo,ty,[])
+ in
+ let (acurrentproof,_,_,ids_to_inner_sorts,_,_,_) =
+ Cic2acic.acic_object_of_cic_object currentproof
+ in
+ let xml, bodyxml =
+ match
+ Cic2Xml.print_object uri ~ids_to_inner_sorts
+ ~ask_dtd_to_the_getter:true acurrentproof
+ with
+ xml,Some bodyxml -> xml,bodyxml
+ | _,None -> assert false
+ in
+ (xml, bodyxml)
+;;
+
+let apply_tactic ~tactic =
match !proof,!goal with
- None,_
+ | None,_
| _,None -> assert false
| Some proof', Some goal' ->
let (newproof, newgoals) = tactic ~status:(proof', goal') in
- if not try_only then
- begin
- proof := Some newproof;
- goal :=
- (match newgoals, newproof with
- goal::_, _ -> Some goal
- | [], (_,(goal,_,_)::_,_,_) ->
- (* the tactic left no open goal ; let's choose the first open goal *)
-(*CSC: here we could implement and use a proof-tree like notion... *)
- Some goal
- | _, _ -> None)
- end
-;;
-
-let apply_tactic = apply_or_can_apply_tactic ~try_only:false;;
-
-let can_apply_tactic ~tactic =
- try
- apply_or_can_apply_tactic ~try_only:true ~tactic ;
- true
- with
- Fail _ -> false
+ proof := Some newproof;
+ goal :=
+ (match newgoals, newproof with
+ goal::_, _ -> Some goal
+ | [], (_,(goal,_,_)::_,_,_) ->
+ (* the tactic left no open goal ; let's choose the first open goal *)
+ (*CSC: here we could implement and use a proof-tree like notion... *)
+ Some goal
+ | _, _ -> None)
;;
(* metas_in_term term *)
(* primitive tactics *)
-let can_apply term = can_apply_tactic (PrimitiveTactics.apply_tac ~term)
let apply term = apply_tactic (PrimitiveTactics.apply_tac ~term)
let intros ?mk_fresh_name_callback () =
apply_tactic (PrimitiveTactics.intros_tac ?mk_fresh_name_callback ())
val proof : ProofEngineTypes.proof option ref
val goal : ProofEngineTypes.goal option ref
+ (** return a pair of "xml" (as defined in Xml module) representing the current
+ proof type and body, respectively *)
+val get_current_status_as_xml : unit -> Xml.token Stream.t * Xml.token Stream.t
+
(* start a new goal undoing part of the proof *)
val perforate : Cic.context -> Cic.term -> Cic.term -> unit
val simpl_in_scratch : Cic.term list -> Cic.term -> Cic.term
(* "primitive" tactics *)
-val can_apply : Cic.term -> bool
val apply : Cic.term -> unit
val intros :
?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> unit -> unit