src/HOL/Codatatype/Tools/bnf_wrap.ML
changeset 49277 aee77001243f
parent 49266 70ffce5b65a4
child 49278 718e4ad1517e
equal deleted inserted replaced
49276:59fa53ed7507 49277:aee77001243f
   511 fun wrap_datatype tacss = (fn (goalss, after_qed, lthy) =>
   511 fun wrap_datatype tacss = (fn (goalss, after_qed, lthy) =>
   512   map2 (map2 (Skip_Proof.prove lthy [] [])) goalss tacss
   512   map2 (map2 (Skip_Proof.prove lthy [] [])) goalss tacss
   513   |> (fn thms => after_qed thms lthy)) oo
   513   |> (fn thms => after_qed thms lthy)) oo
   514   prepare_wrap_datatype (K I) (* FIXME? (singleton o Type_Infer_Context.infer_types) *)
   514   prepare_wrap_datatype (K I) (* FIXME? (singleton o Type_Infer_Context.infer_types) *)
   515 
   515 
   516 val parse_bindings = Parse.$$$ "[" |-- Parse.list Parse.binding --| Parse.$$$ "]";
   516 val parse_bindings = @{keyword "["} |-- Parse.list Parse.binding --| @{keyword "]"};
   517 val parse_bindingss = Parse.$$$ "[" |-- Parse.list parse_bindings --| Parse.$$$ "]";
   517 val parse_bindingss = @{keyword "["} |-- Parse.list parse_bindings --| @{keyword "]"};
   518 
   518 
   519 val wrap_datatype_cmd = (fn (goalss, after_qed, lthy) =>
   519 val wrap_datatype_cmd = (fn (goalss, after_qed, lthy) =>
   520   Proof.theorem NONE (snd oo after_qed) (map (map (rpair [])) goalss) lthy) oo
   520   Proof.theorem NONE (snd oo after_qed) (map (map (rpair [])) goalss) lthy) oo
   521   prepare_wrap_datatype Syntax.read_term;
   521   prepare_wrap_datatype Syntax.read_term;
   522 
   522 
   523 val _ =
   523 val _ =
   524   Outer_Syntax.local_theory_to_proof @{command_spec "wrap_data"} "wraps an existing datatype"
   524   Outer_Syntax.local_theory_to_proof @{command_spec "wrap_data"} "wraps an existing datatype"
   525     (((Parse.$$$ "[" |-- Parse.list Parse.term --| Parse.$$$ "]") -- Parse.term --
   525     (((@{keyword "["} |-- Parse.list Parse.term --| @{keyword "]"}) -- Parse.term --
   526       Scan.optional (parse_bindings -- Scan.optional parse_bindingss []) ([], []))
   526       Scan.optional (parse_bindings -- Scan.optional parse_bindingss []) ([], []))
   527      >> wrap_datatype_cmd);
   527      >> wrap_datatype_cmd);
   528 
   528 
   529 end;
   529 end;