equal
deleted
inserted
replaced
1283 map2 (Thm.close_derivation oo Goal.prove_sorry lthy [] []) |
1283 map2 (Thm.close_derivation oo Goal.prove_sorry lthy [] []) |
1284 goals (map (mk_unfold_thms_then_tac lthy one_step_defs) tacs) |
1284 goals (map (mk_unfold_thms_then_tac lthy one_step_defs) tacs) |
1285 |> (fn thms => after_qed (map single thms @ wit_thms) lthy) |
1285 |> (fn thms => after_qed (map single thms @ wit_thms) lthy) |
1286 end) oo prepare_def const_policy fact_policy qualify (K I) Ds map_b rel_b set_bs; |
1286 end) oo prepare_def const_policy fact_policy qualify (K I) Ds map_b rel_b set_bs; |
1287 |
1287 |
1288 val bnf_def_cmd = (fn (key, goals, wit_goals, after_qed, lthy, defs) => |
1288 val bnf_cmd = (fn (key, goals, wit_goals, after_qed, lthy, defs) => |
1289 Proof.unfolding ([[(defs, [])]]) |
1289 Proof.unfolding ([[(defs, [])]]) |
1290 (Proof.theorem NONE (snd o register_bnf key oo after_qed) |
1290 (Proof.theorem NONE (snd o register_bnf key oo after_qed) |
1291 (map (single o rpair []) goals @ map (map (rpair [])) wit_goals) lthy)) oo |
1291 (map (single o rpair []) goals @ map (map (rpair [])) wit_goals) lthy)) oo |
1292 prepare_def Do_Inline (user_policy Note_Some) I Syntax.read_term NONE Binding.empty Binding.empty |
1292 prepare_def Do_Inline (user_policy Note_Some) I Syntax.read_term NONE Binding.empty Binding.empty |
1293 []; |
1293 []; |
1316 Pretty.big_list "BNFs:" (map pretty_bnf (Symtab.dest (Data.get (Context.Proof ctxt)))) |
1316 Pretty.big_list "BNFs:" (map pretty_bnf (Symtab.dest (Data.get (Context.Proof ctxt)))) |
1317 |> Pretty.writeln |
1317 |> Pretty.writeln |
1318 end; |
1318 end; |
1319 |
1319 |
1320 val _ = |
1320 val _ = |
1321 Outer_Syntax.improper_command @{command_spec "print_bnfs"} "print all BNFs" |
1321 Outer_Syntax.improper_command @{command_spec "print_bnfs"} |
|
1322 "print all BNFs (bounded natural functors)" |
1322 (Scan.succeed (Toplevel.keep (print_bnfs o Toplevel.context_of))); |
1323 (Scan.succeed (Toplevel.keep (print_bnfs o Toplevel.context_of))); |
1323 |
1324 |
1324 val _ = |
1325 val _ = |
1325 Outer_Syntax.local_theory_to_proof @{command_spec "bnf_def"} "define a BNF for an existing type" |
1326 Outer_Syntax.local_theory_to_proof @{command_spec "bnf"} |
|
1327 "register a type as a BNF (bounded natural functor)" |
1326 ((parse_opt_binding_colon -- Parse.term -- |
1328 ((parse_opt_binding_colon -- Parse.term -- |
1327 (@{keyword "["} |-- Parse.list Parse.term --| @{keyword "]"}) -- Parse.term -- |
1329 (@{keyword "["} |-- Parse.list Parse.term --| @{keyword "]"}) -- Parse.term -- |
1328 (@{keyword "["} |-- Parse.list Parse.term --| @{keyword "]"}) -- Scan.option Parse.term) |
1330 (@{keyword "["} |-- Parse.list Parse.term --| @{keyword "]"}) -- Scan.option Parse.term) |
1329 >> bnf_def_cmd); |
1331 >> bnf_cmd); |
1330 |
1332 |
1331 end; |
1333 end; |