src/HOL/Tools/function_package/fundef_package.ML
changeset 19938 241a7777a3ff
parent 19922 984ae977f7aa
child 20270 3abe7dae681e
equal deleted inserted replaced
19937:d1b8374d8df7 19938:241a7777a3ff
    88 	val atts = map (map (map (prep_att thy))) raw_atts
    88 	val atts = map (map (map (prep_att thy))) raw_atts
    89 
    89 
    90 	val congs = get_fundef_congs (Context.Theory thy)
    90 	val congs = get_fundef_congs (Context.Theory thy)
    91 
    91 
    92 	val t_eqns = map (map (Sign.read_prop thy)) eqns
    92 	val t_eqns = map (map (Sign.read_prop thy)) eqns
    93 			 |> map (map (term_of o cterm_of thy)) (* HACK to prevent strange things from happening with abbreviations *)
       
    94 
    93 
    95 	val (mutual_info, name, (data, thy)) = FundefMutual.prepare_fundef_mutual congs t_eqns thy
    94 	val (mutual_info, name, (data, thy)) = FundefMutual.prepare_fundef_mutual congs t_eqns thy
    96 	val Prep {goal, goalI, ...} = data
    95 	val Prep {goal, goalI, ...} = data
    97     in
    96     in
    98 	thy |> ProofContext.init
    97 	thy |> ProofContext.init
   158 
   157 
   159 fun fundef_setup_termination_proof name NONE thy = 
   158 fun fundef_setup_termination_proof name NONE thy = 
   160     let
   159     let
   161 	val name = if name = "" then get_last_fundef thy else name
   160 	val name = if name = "" then get_last_fundef thy else name
   162 	val data = the (get_fundef_data name thy)
   161 	val data = the (get_fundef_data name thy)
       
   162                    handle Option.Option => raise ERROR ("No such function definition: " ^ name)
   163 
   163 
   164 	val (res as FundefMResult {termination, ...}, mutual, _, _) = data
   164 	val (res as FundefMResult {termination, ...}, mutual, _, _) = data
   165 	val goal = FundefTermination.mk_total_termination_goal data
   165 	val goal = FundefTermination.mk_total_termination_goal data
   166     in
   166     in
   167 	thy |> ProofContext.init
   167 	thy |> ProofContext.init