Updated fix_name function
authorsteckerm
Sat, 20 Sep 2014 10:44:23 +0200
changeset 58404 4be5ab4452f4
parent 58403 ede6ca6a54ee
child 58405 c3c7a09a3ada
Updated fix_name function
src/HOL/Tools/ATP/atp_waldmeister.ML
--- a/src/HOL/Tools/ATP/atp_waldmeister.ML	Sat Sep 20 10:42:08 2014 +0200
+++ b/src/HOL/Tools/ATP/atp_waldmeister.ML	Sat Sep 20 10:44:23 2014 +0200
@@ -389,7 +389,7 @@
       (* Use name instead of encoded_name because Waldmeister renames free variables. *)
     else if name = waldmeister_equals then
       (case args of 
-        [_, _] => eq_const @{typ bool}
+        [_, _] => eq_const dummyT
       | _ => raise FailureMessage 
         (WM_ERROR_MSG ^ "waldmeister equals needs 2 arguments but has " ^ 
          Int.toString (length args)))
@@ -541,12 +541,20 @@
 fun get_skolem_info info names = case map (lookup info) names |> List.find is_some of
   SOME x => x |
   NONE => NONE
-  
-fun fix_name name = (* fixme *)
-  if String.isPrefix fact_prefix name then 
-    String.extract(name,7,NONE) |> unascii_of |> curry (op ^) "fact_0_"
-  else
-    name
+
+fun fix_name name =
+  let
+    fun drop_digits' xs [] = (xs, [])
+      | drop_digits' xs (c :: cs) = if Char.isDigit c then drop_digits' (c :: xs) cs else
+        (xs, (c :: cs))
+    fun drop_digits xs = drop_digits' [] xs
+  in
+    if String.isPrefix fact_prefix name then 
+      String.extract(name,size fact_prefix,NONE) |> String.explode |> drop_digits ||> tl 
+        ||> String.implode ||> unascii_of |> (fn (x,y) => fact_prefix ^ String.implode x ^ "_" ^ y)
+    else
+      name
+  end
 
 fun skolemization_steps info
   (proof_step as ((waldmeister_name, isabelle_names), _, trm, rule, _)) =