aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2010-10-31 21:19:11 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2010-10-31 21:19:11 +0000
commit5b7992d4650e0aea9c34cdc08c00d292a000928c (patch)
treeb76c6d13aca9b2e894ee3183729858a1ed14148a
parent05b3d029cfbffcb496c1e6e4e0e21f573a4db9a5 (diff)
Minor factorization of the part of the code used for Unnamed_thm saving.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13595 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--toplevel/lemmas.ml27
1 files changed, 13 insertions, 14 deletions
diff --git a/toplevel/lemmas.ml b/toplevel/lemmas.ml
index b75ba3d73..0d7a3b2f9 100644
--- a/toplevel/lemmas.ml
+++ b/toplevel/lemmas.ml
@@ -174,14 +174,6 @@ let save id const do_guard (locality,kind) hook =
definition_message id;
hook l r
-let save_hook = ref ignore
-let set_save_hook f = save_hook := f
-
-let save_named opacity =
- let id,(const,do_guard,persistence,hook) = Pfedit.cook_proof !save_hook in
- let const = { const with const_entry_opaque = opacity } in
- save id const do_guard persistence hook
-
let default_thm_id = id_of_string "Unnamed_thm"
let compute_proof_name locality = function
@@ -229,21 +221,28 @@ let save_remaining_recthms (local,kind) body opaq i (id,(t_i,(_,imps))) =
let kn = declare_constant id (DefinitionEntry const, k) in
(Global,ConstRef kn,imps)
-(* 4.2| General support for goals *)
+let save_hook = ref ignore
+let set_save_hook f = save_hook := f
+
+let get_proof opacity =
+ let id,(const,do_guard,persistence,hook) = Pfedit.cook_proof !save_hook in
+ id,{const with const_entry_opaque = opacity},do_guard,persistence,hook
+
+let save_named opacity =
+ let id,const,do_guard,persistence,hook = get_proof opacity in
+ save id const do_guard persistence hook
let check_anonymity id save_ident =
- if atompart_of_id id <> "Unnamed_thm" then
+ if atompart_of_id id <> string_of_id (default_thm_id) then
error "This command can only be used for unnamed theorem."
let save_anonymous opacity save_ident =
- let id,(const,do_guard,persistence,hook) = Pfedit.cook_proof !save_hook in
- let const = { const with const_entry_opaque = opacity } in
+ let id,const,do_guard,persistence,hook = get_proof opacity in
check_anonymity id save_ident;
save save_ident const do_guard persistence hook
let save_anonymous_with_strength kind opacity save_ident =
- let id,(const,do_guard,_,hook) = Pfedit.cook_proof !save_hook in
- let const = { const with const_entry_opaque = opacity } in
+ let id,const,do_guard,_,hook = get_proof opacity in
check_anonymity id save_ident;
(* we consider that non opaque behaves as local for discharge *)
save save_ident const do_guard (Global, Proof kind) hook