aboutsummaryrefslogtreecommitdiffhomepage
path: root/library
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2002-02-12 16:26:59 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2002-02-12 16:26:59 +0000
commit63c3abfcb53bbe3dc7f601c6595c05d56f498299 (patch)
treee08228e8a517e967743eb7d34d9f2c6de5b7855e /library
parentcc2e8c9e7f8d414ed34e6e39b4df18a76ade35b4 (diff)
Raffinement library_part
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@2472 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'library')
-rw-r--r--library/declare.ml16
-rw-r--r--library/declare.mli2
2 files changed, 15 insertions, 3 deletions
diff --git a/library/declare.ml b/library/declare.ml
index 5c2ab7182..9741ca9fa 100644
--- a/library/declare.ml
+++ b/library/declare.ml
@@ -386,6 +386,18 @@ let strength_of_global = function
| VarRef id -> variable_strength id
| IndRef _ | ConstructRef _ -> NeverDischarge
-let library_part sp =
+let library_part ref =
+ let sp = Nametab.sp_of_global (Global.env ()) ref in
let dir,_ = repr_path sp in
- extract_dirpath_prefix (depth_of_strength (constant_strength sp)) dir
+ match strength_of_global ref with
+ | DischargeAt (dp,n) -> extract_dirpath_prefix n dp
+ | NeverDischarge ->
+ if is_dirpath_prefix_of dir (Lib.cwd ()) then
+ (* Theorem/Lemma not yet (fully) discharged *)
+ extract_dirpath_prefix (Lib.sections_depth ()) (Lib.cwd ())
+ else
+ (* Theorem/Lemma outside its outer section of definition *)
+ dir
+ | NotDeclare -> assert false
+
+
diff --git a/library/declare.mli b/library/declare.mli
index fd0ec9ff7..c914245ff 100644
--- a/library/declare.mli
+++ b/library/declare.mli
@@ -101,4 +101,4 @@ val is_global : identifier -> bool
val strength_of_global : global_reference -> strength
-val library_part : section_path -> dir_path
+val library_part : global_reference -> dir_path