src/HOL/Import/proof_kernel.ML
changeset 22675 acf10be7dcca
parent 22596 d0d2af4db18f
child 22691 290454649b8c
equal deleted inserted replaced
22674:1a610904bbca 22675:acf10be7dcca
   223 	  | G 3 = Library.setmp show_brackets true (G 2)
   223 	  | G 3 = Library.setmp show_brackets true (G 2)
   224           | G _ = raise SMART_STRING 
   224           | G _ = raise SMART_STRING 
   225 	fun F n =
   225 	fun F n =
   226 	    let
   226 	    let
   227 		val str = Library.setmp show_brackets false (G n string_of_cterm) ct
   227 		val str = Library.setmp show_brackets false (G n string_of_cterm) ct
   228 		val cu  = read_cterm thy (str,T)
   228 		val cu  = Thm.read_cterm thy (str,T)
   229 	    in
   229 	    in
   230 		if match cu
   230 		if match cu
   231 		then quote str
   231 		then quote str
   232 		else F (n+1)
   232 		else F (n+1)
   233 	    end
   233 	    end
   471 fun innocent_varname s = Syntax.is_identifier s andalso not (String.isPrefix "u_" s)
   471 fun innocent_varname s = Syntax.is_identifier s andalso not (String.isPrefix "u_" s)
   472 
   472 
   473 val check_name_thy = theory "Main"
   473 val check_name_thy = theory "Main"
   474 
   474 
   475 fun valid_boundvarname s =
   475 fun valid_boundvarname s =
   476   can (fn () => read_cterm check_name_thy ("SOME "^s^". True", TypeInfer.logicT)) ();
   476   can (fn () => Thm.read_cterm check_name_thy ("SOME "^s^". True", TypeInfer.logicT)) ();
   477 
   477 
   478 fun valid_varname s =
   478 fun valid_varname s =
   479   can (fn () => read_cterm check_name_thy (s, TypeInfer.logicT)) ();
   479   can (fn () => Thm.read_cterm check_name_thy (s, TypeInfer.logicT)) ();
   480 
   480 
   481 fun protect_varname s =
   481 fun protect_varname s =
   482     if innocent_varname s andalso valid_varname s then s else
   482     if innocent_varname s andalso valid_varname s then s else
   483     case Symtab.lookup (!protected_varnames) s of
   483     case Symtab.lookup (!protected_varnames) s of
   484       SOME t => t
   484       SOME t => t