src/Pure/Proof/extraction.ML
changeset 16195 0eb3c15298cd
parent 16149 d8cac577493c
child 16287 7a03b4b4df67
equal deleted inserted replaced
16194:3d192ab9907b 16195:0eb3c15298cd
   121 
   121 
   122   in rew end;
   122   in rew end;
   123 
   123 
   124 val chtype = change_type o SOME;
   124 val chtype = change_type o SOME;
   125 
   125 
   126 fun add_prefix a b = NameSpace.pack (a :: NameSpace.unpack b);
   126 fun extr_name s vs = NameSpace.append "extr" (space_implode "_" (s :: vs));
   127 
   127 fun corr_name s vs = extr_name s vs ^ "_correctness";
   128 fun corr_name s vs =
   128 
   129   add_prefix "extr" (space_implode "_" (s :: vs)) ^ "_correctness";
   129 fun msg d s = priority (Symbol.spaces d ^ s);
   130 
       
   131 fun extr_name s vs = add_prefix "extr" (space_implode "_" (s :: vs));
       
   132 
       
   133 fun msg d s = priority (implode (replicate d " ") ^ s);
       
   134 
   130 
   135 fun vars_of t = rev (foldl_aterms
   131 fun vars_of t = rev (foldl_aterms
   136   (fn (vs, v as Var _) => v ins vs | (vs, _) => vs) ([], t));
   132   (fn (vs, v as Var _) => v ins vs | (vs, _) => vs) ([], t));
   137 
   133 
   138 fun vfs_of t = vars_of t @ sort (make_ord atless) (term_frees t);
   134 fun vfs_of t = vars_of t @ sort (make_ord atless) (term_frees t);
   277 
   273 
   278 val add_typeof_eqns_i = gen_add_typeof_eqns (K I);
   274 val add_typeof_eqns_i = gen_add_typeof_eqns (K I);
   279 val add_typeof_eqns = gen_add_typeof_eqns read_condeq;
   275 val add_typeof_eqns = gen_add_typeof_eqns read_condeq;
   280 
   276 
   281 fun thaw (T as TFree (a, S)) =
   277 fun thaw (T as TFree (a, S)) =
   282       if ":" mem explode a then TVar (unpack_ixn a, S) else T
   278       if exists_string (equal ":") a then TVar (unpack_ixn a, S) else T
   283   | thaw (Type (a, Ts)) = Type (a, map thaw Ts)
   279   | thaw (Type (a, Ts)) = Type (a, map thaw Ts)
   284   | thaw T = T;
   280   | thaw T = T;
   285 
   281 
   286 fun freeze (TVar ((a, i), S)) = TFree (a ^ ":" ^ string_of_int i, S)
   282 fun freeze (TVar ((a, i), S)) = TFree (a ^ ":" ^ string_of_int i, S)
   287   | freeze (Type (a, Ts)) = Type (a, map freeze Ts)
   283   | freeze (Type (a, Ts)) = Type (a, map freeze Ts)