1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(* $Id: proof_trees.ml 10124 2007-09-17 18:40:21Z herbelin $ *)
29
let is_bind = function
30
| Tacexpr.Cbindings _ -> true
34
(* Functions on goals *)
36
let mk_goal hyps cl extra =
37
{ evar_hyps = hyps; evar_concl = cl;
38
evar_filter = List.map (fun _ -> true) (named_context_of_val hyps);
39
evar_body = Evar_empty; evar_extra = extra }
41
(* Functions on proof trees *)
45
| None -> failwith "rule_of_proof"
48
let rule_of_proof pf =
49
let (r,_) = ref_of_proof pf in r
51
let children_of_proof pf =
52
let (_,cl) = ref_of_proof pf in cl
54
let goal_of_proof pf = pf.goal
56
let subproof_of_proof pf = match pf.ref with
57
| Some (Nested (_,pf), _) -> pf
58
| _ -> failwith "subproof_of_proof"
60
let status_of_proof pf = pf.open_subgoals
62
let is_complete_proof pf = pf.open_subgoals = 0
64
let is_leaf_proof pf = (pf.ref = None)
66
let is_tactic_proof pf = match pf.ref with
67
| Some (Nested (Tactic _,_),_) -> true
71
let pf_lookup_name_as_renamed env ccl s =
72
Detyping.lookup_name_as_renamed env ccl s
74
let pf_lookup_index_as_renamed env ccl n =
75
Detyping.lookup_index_as_renamed env ccl n
77
(* Functions on rules (Proof mode) *)
79
let is_dem_rule = function
83
let is_proof_instr = function
84
Nested(Proof_instr (_,_),_) -> true
87
let is_focussing_command = function
89
| Nested (Proof_instr (b,_),_) -> b
93
(*********************************************************************)
94
(* Pretty printing functions *)
95
(*********************************************************************)
100
let env = evar_env g in
101
let penv = print_named_context env in
102
let pc = print_constr_env env g.evar_concl in
103
str" " ++ hv 0 (penv ++ fnl () ++
104
str "============================" ++ fnl () ++
105
str" " ++ pc) ++ fnl ()