added extern_skolem;
authorwenzelm
Sun, 25 Jun 2000 23:54:32 +0200
changeset 9133 bc3742f62b80
parent 9132 52286129faa5
child 9134 b38e94631f19
added extern_skolem;
src/Pure/Isar/proof_context.ML
--- a/src/Pure/Isar/proof_context.ML	Sun Jun 25 23:54:13 2000 +0200
+++ b/src/Pure/Isar/proof_context.ML	Sun Jun 25 23:54:32 2000 +0200
@@ -28,6 +28,7 @@
   val read_typ: context -> string -> typ
   val cert_typ: context -> typ -> typ
   val cert_skolem: context -> string -> string
+  val extern_skolem: context -> term -> term
   val read_termTs: context -> (string * typ) list -> term list * (indexname * typ) list
   val read_term: context -> string -> term
   val read_prop: context -> string -> term
@@ -382,7 +383,8 @@
 
 (* internalize Skolem constants *)
 
-fun get_skolem (Context {asms = (_, (fixes, _)), ...}) x = assoc (fixes, x);
+fun fixes_of (Context {asms = (_, (fixes, _)), ...}) = fixes;
+fun get_skolem ctxt x = assoc (fixes_of ctxt, x);
 
 fun check_skolem ctxt check x =
   if check andalso can Syntax.dest_skolem x then
@@ -406,6 +408,21 @@
   | Some x' => x');
 
 
+(* externalize Skolem constants -- for printing purposes only *)
+
+fun extern_skolem ctxt =
+  let
+    val rev_fixes = map Library.swap (fixes_of ctxt);
+
+    fun extern (t as Free (x, T)) =
+          (case assoc (rev_fixes, x) of
+            Some x' => Free (if get_skolem ctxt x' = Some x then x' else NameSpace.hidden x', T)
+          | None => t)
+      | extern (t $ u) = extern t $ extern u
+      | extern (Abs (x, T, t)) = Abs (x, T, extern t)
+      | extern a = a;
+  in extern end
+
 
 (** prepare terms and propositions **)