added find_free (from term.ML);
authorwenzelm
Tue, 25 Jul 2006 21:18:08 +0200
changeset 20201 24b49cbd438b
parent 20200 c6fb50dbbc30
child 20202 87205ea2af06
added find_free (from term.ML);
src/Pure/Isar/obtain.ML
--- a/src/Pure/Isar/obtain.ML	Tue Jul 25 21:18:07 2006 +0200
+++ b/src/Pure/Isar/obtain.ML	Tue Jul 25 21:18:08 2006 +0200
@@ -99,6 +99,13 @@
 
 local
 
+fun find_free t x =
+  let
+    exception Found of term;
+    fun find (t as Free (x', _)) = if x = x' then raise Found t else I
+      | find _ = I;
+  in (fold_aterms find t (); NONE) handle Found v => SOME v end;
+
 fun gen_obtain prep_att prep_vars prep_propp
     name raw_vars raw_asms int state =
   let
@@ -124,7 +131,7 @@
     val (thesis_var, thesis) = bind_judgment fix_ctxt thesisN;
 
     fun occs_var x = Library.get_first (fn t =>
-      Term.find_free t (ProofContext.get_skolem fix_ctxt x)) asm_props;
+      find_free t (ProofContext.get_skolem fix_ctxt x)) asm_props;
     val parms =
       map_filter (fn (SOME (Free a), x) => SOME (a, x) | _ => NONE) (map occs_var xs ~~ xs);