src/HOL/Tools/Function/partial_function.ML
changeset 62998 36d7e7f1805c
parent 62997 dd987efa5df3
child 63003 bf5fcc65586b
equal deleted inserted replaced
62997:dd987efa5df3 62998:36d7e7f1805c
   227     val ((_, plain_eqn), args_ctxt) = Variable.focus NONE eqn lthy;
   227     val ((_, plain_eqn), args_ctxt) = Variable.focus NONE eqn lthy;
   228 
   228 
   229     val ((f_binding, fT), mixfix) = the_single fixes;
   229     val ((f_binding, fT), mixfix) = the_single fixes;
   230     val f_bname = Binding.name_of f_binding;
   230     val f_bname = Binding.name_of f_binding;
   231 
   231 
       
   232     fun note_qualified (name, thms) =
       
   233       Local_Theory.note ((Binding.qualified true name (Binding.reset_pos f_binding), []), thms)
       
   234         #> snd
       
   235 
   232     val (lhs, rhs) = HOLogic.dest_eq (HOLogic.dest_Trueprop plain_eqn);
   236     val (lhs, rhs) = HOLogic.dest_eq (HOLogic.dest_Trueprop plain_eqn);
   233     val (head, args) = strip_comb lhs;
   237     val (head, args) = strip_comb lhs;
   234     val argnames = map (fst o dest_Free) args;
   238     val argnames = map (fst o dest_Free) args;
   235     val F = fold_rev lambda (head :: args) rhs;
   239     val F = fold_rev lambda (head :: args) rhs;
   236 
   240 
   292       end;
   296       end;
   293   in
   297   in
   294     lthy'
   298     lthy'
   295     |> Local_Theory.note (eq_abinding, [rec_rule])
   299     |> Local_Theory.note (eq_abinding, [rec_rule])
   296     |-> (fn (_, rec') =>
   300     |-> (fn (_, rec') =>
   297       Spec_Rules.add Spec_Rules.Equational ([f], rec')
   301       Spec_Rules.add Spec_Rules.Equational ([f], rec') #> note_qualified ("simps", rec'))
   298       #> Local_Theory.note ((Binding.qualified true "simps" f_binding, []), rec') #> snd)
   302     |> note_qualified ("mono", [mono_thm])
   299     |> Local_Theory.note ((Binding.qualified true "mono" f_binding, []), [mono_thm]) |> snd
   303     |> (case raw_induct of NONE => I | SOME thm => note_qualified ("raw_induct", [thm]))
   300     |> (case raw_induct of NONE => I | SOME thm =>
   304     |> note_qualified ("fixp_induct", [specialized_fixp_induct])
   301          Local_Theory.note ((Binding.qualified true "raw_induct" f_binding, []), [thm]) #> snd)
       
   302     |> Local_Theory.note
       
   303       ((Binding.qualified true "fixp_induct" f_binding, []), [specialized_fixp_induct])
       
   304     |> snd
       
   305   end;
   305   end;
   306 
   306 
   307 val add_partial_function = gen_add_partial_function Specification.check_spec;
   307 val add_partial_function = gen_add_partial_function Specification.check_spec;
   308 val add_partial_function_cmd = gen_add_partial_function Specification.read_spec;
   308 val add_partial_function_cmd = gen_add_partial_function Specification.read_spec;
   309 
   309