src/HOL/BNF/Tools/bnf_gfp.ML
changeset 54591 c822230fd22b
parent 54557 d71c2737ee21
child 54793 c99f0fdb0886
equal deleted inserted replaced
54587:19cd731eb745 54591:c822230fd22b
  2919 
  2919 
  2920 val _ =
  2920 val _ =
  2921   Outer_Syntax.local_theory @{command_spec "codatatype"} "define coinductive datatypes"
  2921   Outer_Syntax.local_theory @{command_spec "codatatype"} "define coinductive datatypes"
  2922     (parse_co_datatype_cmd Greatest_FP construct_gfp);
  2922     (parse_co_datatype_cmd Greatest_FP construct_gfp);
  2923 
  2923 
  2924 val option_parser = Parse.group (fn () => "option") (Parse.reserved "sequential" >> K true);
  2924 val option_parser = Parse.group (fn () => "option")
       
  2925   ((Parse.reserved "sequential" >> K Option_Sequential)
       
  2926   || (Parse.reserved "exhaustive" >> K Option_Exhaustive))
  2925 
  2927 
  2926 val where_alt_specs_of_parser = Parse.where_ |-- Parse.!!! (Parse.enum1 "|"
  2928 val where_alt_specs_of_parser = Parse.where_ |-- Parse.!!! (Parse.enum1 "|"
  2927   (Parse_Spec.spec -- Scan.option (Parse.reserved "of" |-- Parse.const)));
  2929   (Parse_Spec.spec -- Scan.option (Parse.reserved "of" |-- Parse.const)));
  2928 
  2930 
  2929 val _ = Outer_Syntax.local_theory_to_proof @{command_spec "primcorecursive"}
  2931 val _ = Outer_Syntax.local_theory_to_proof @{command_spec "primcorecursive"}
  2930   "define primitive corecursive functions"
  2932   "define primitive corecursive functions"
  2931   ((Scan.optional (@{keyword "("} |-- Parse.!!! option_parser --| @{keyword ")"}) false) --
  2933   ((Scan.optional (@{keyword "("} |--
       
  2934       Parse.!!! (Parse.list1 option_parser) --| @{keyword ")"}) []) --
  2932     (Parse.fixes -- where_alt_specs_of_parser) >> uncurry add_primcorecursive_cmd);
  2935     (Parse.fixes -- where_alt_specs_of_parser) >> uncurry add_primcorecursive_cmd);
  2933 
  2936 
  2934 val _ = Outer_Syntax.local_theory @{command_spec "primcorec"}
  2937 val _ = Outer_Syntax.local_theory @{command_spec "primcorec"}
  2935   "define primitive corecursive functions"
  2938   "define primitive corecursive functions"
  2936   ((Scan.optional (@{keyword "("} |-- Parse.!!! option_parser --| @{keyword ")"}) false) --
  2939   ((Scan.optional (@{keyword "("} |--
       
  2940       Parse.!!! (Parse.list1 option_parser) --| @{keyword ")"}) []) --
  2937     (Parse.fixes -- where_alt_specs_of_parser) >> uncurry add_primcorec_cmd);
  2941     (Parse.fixes -- where_alt_specs_of_parser) >> uncurry add_primcorec_cmd);
  2938 
  2942 
  2939 end;
  2943 end;