src/HOL/Tools/recdef_package.ML
changeset 29006 abe0f11cfa4e
parent 28965 1de908189869
child 29579 cb520b766e00
equal deleted inserted replaced
29005:ce378dcfddab 29006:abe0f11cfa4e
   297 val hints =
   297 val hints =
   298   P.$$$ "(" |-- P.!!! (P.position (P.$$$ "hints" -- Args.parse) --| P.$$$ ")") >> Args.src;
   298   P.$$$ "(" |-- P.!!! (P.position (P.$$$ "hints" -- Args.parse) --| P.$$$ ")") >> Args.src;
   299 
   299 
   300 val recdef_decl =
   300 val recdef_decl =
   301   Scan.optional (P.$$$ "(" -- P.!!! (P.$$$ "permissive" -- P.$$$ ")") >> K false) true --
   301   Scan.optional (P.$$$ "(" -- P.!!! (P.$$$ "permissive" -- P.$$$ ")") >> K false) true --
   302   P.name -- P.term -- Scan.repeat1 ((SpecParse.opt_thm_name ":" >> apfst Name.name_of) -- P.prop)
   302   P.name -- P.term -- Scan.repeat1 ((SpecParse.opt_thm_name ":" >> apfst Binding.base_name) -- P.prop)
   303     -- Scan.option hints
   303     -- Scan.option hints
   304   >> (fn ((((p, f), R), eqs), src) => #1 o add_recdef p f R (map P.triple_swap eqs) src);
   304   >> (fn ((((p, f), R), eqs), src) => #1 o add_recdef p f R (map P.triple_swap eqs) src);
   305 
   305 
   306 val _ =
   306 val _ =
   307   OuterSyntax.command "recdef" "define general recursive functions (TFL)" K.thy_decl
   307   OuterSyntax.command "recdef" "define general recursive functions (TFL)" K.thy_decl
   318     (defer_recdef_decl >> Toplevel.theory);
   318     (defer_recdef_decl >> Toplevel.theory);
   319 
   319 
   320 val _ =
   320 val _ =
   321   OuterSyntax.local_theory_to_proof' "recdef_tc" "recommence proof of termination condition (TFL)"
   321   OuterSyntax.local_theory_to_proof' "recdef_tc" "recommence proof of termination condition (TFL)"
   322     K.thy_goal
   322     K.thy_goal
   323     ((SpecParse.opt_thm_name ":" >> apfst Name.name_of) -- P.xname --
   323     ((SpecParse.opt_thm_name ":" >> apfst Binding.base_name) -- P.xname --
   324         Scan.option (P.$$$ "(" |-- P.nat --| P.$$$ ")")
   324         Scan.option (P.$$$ "(" |-- P.nat --| P.$$$ ")")
   325       >> (fn ((thm_name, name), i) => recdef_tc thm_name name i));
   325       >> (fn ((thm_name, name), i) => recdef_tc thm_name name i));
   326 
   326 
   327 end;
   327 end;
   328 
   328