src/HOL/Tools/Function/function.ML
changeset 37145 01aa36932739
parent 36960 01594f816e3a
child 37744 3daaf23b9ab4
equal deleted inserted replaced
37144:fd6308b4df72 37145:01aa36932739
   147     lthy'
   147     lthy'
   148     |> afterqed [[pattern_thm]]
   148     |> afterqed [[pattern_thm]]
   149   end
   149   end
   150 
   150 
   151 val add_function =
   151 val add_function =
   152   gen_add_function false Specification.check_spec (TypeInfer.anyT HOLogic.typeS)
   152   gen_add_function false Specification.check_spec (Type_Infer.anyT HOLogic.typeS)
   153 val add_function_cmd = gen_add_function true Specification.read_spec "_::type"
   153 val add_function_cmd = gen_add_function true Specification.read_spec "_::type"
   154 
   154 
   155 fun gen_function is_external prep default_constraint fixspec eqns config lthy =
   155 fun gen_function is_external prep default_constraint fixspec eqns config lthy =
   156   let
   156   let
   157     val ((goal_state, afterqed), lthy') =
   157     val ((goal_state, afterqed), lthy') =
   161     |> Proof.theorem NONE (snd oo afterqed) [[(Logic.unprotect (concl_of goal_state), [])]]
   161     |> Proof.theorem NONE (snd oo afterqed) [[(Logic.unprotect (concl_of goal_state), [])]]
   162     |> Proof.refine (Method.primitive_text (K goal_state)) |> Seq.hd
   162     |> Proof.refine (Method.primitive_text (K goal_state)) |> Seq.hd
   163   end
   163   end
   164 
   164 
   165 val function =
   165 val function =
   166   gen_function false Specification.check_spec (TypeInfer.anyT HOLogic.typeS)
   166   gen_function false Specification.check_spec (Type_Infer.anyT HOLogic.typeS)
   167 val function_cmd = gen_function true Specification.read_spec "_::type"
   167 val function_cmd = gen_function true Specification.read_spec "_::type"
   168 
   168 
   169 fun prepare_termination_proof prep_term raw_term_opt lthy =
   169 fun prepare_termination_proof prep_term raw_term_opt lthy =
   170   let
   170   let
   171     val term_opt = Option.map (prep_term lthy) raw_term_opt
   171     val term_opt = Option.map (prep_term lthy) raw_term_opt