changeset 49308 | 6190b701e4f4 |
parent 49277 | aee77001243f |
child 49311 | 56fcd826f90c |
49307:30916e44d828 | 49308:6190b701e4f4 |
---|---|
19 |
19 |
20 open BNF_Def |
20 open BNF_Def |
21 open BNF_Util |
21 open BNF_Util |
22 open BNF_Tactics |
22 open BNF_Tactics |
23 open BNF_FP_Util |
23 open BNF_FP_Util |
24 open BNF_FP_Sugar |
|
24 open BNF_LFP_Util |
25 open BNF_LFP_Util |
25 open BNF_LFP_Tactics |
26 open BNF_LFP_Tactics |
26 |
27 |
27 (*all bnfs have the same lives*) |
28 (*all bnfs have the same lives*) |
28 fun bnf_lfp mixfixes resBs bs (resDs, Dss) bnfs lthy = |
29 fun bnf_lfp mixfixes resBs bs (resDs, Dss) bnfs lthy = |
1116 |> Thm.close_derivation; |
1117 |> Thm.close_derivation; |
1117 in |
1118 in |
1118 `split_conj_thm unique_mor |
1119 `split_conj_thm unique_mor |
1119 end; |
1120 end; |
1120 |
1121 |
1121 val (iter_unique_thms, iter_unique_thm) = |
1122 val iter_unique_thms = |
1122 `split_conj_thm (mk_conjIN n RS |
1123 split_conj_thm (mk_conjIN n RS |
1123 (mor_UNIV_thm RS @{thm ssubst[of _ _ "%x. x"]} RS iter_unique_mor_thm)) |
1124 (mor_UNIV_thm RS @{thm ssubst[of _ _ "%x. x"]} RS iter_unique_mor_thm)) |
1124 |
1125 |
1125 val iter_fld_thms = |
1126 val iter_fld_thms = |
1126 map (fn thm => (mor_incl_thm OF replicate n @{thm subset_UNIV}) RS thm RS sym) |
1127 map (fn thm => (mor_incl_thm OF replicate n @{thm subset_UNIV}) RS thm RS sym) |
1127 iter_unique_mor_thms; |
1128 iter_unique_mor_thms; |
1789 |> maps (fn (thmN, thmss) => |
1790 |> maps (fn (thmN, thmss) => |
1790 map2 (fn b => fn thms => |
1791 map2 (fn b => fn thms => |
1791 ((Binding.qualify true (Binding.name_of b) (Binding.name thmN), []), [(thms, [])])) |
1792 ((Binding.qualify true (Binding.name_of b) (Binding.name thmN), []), [(thms, [])])) |
1792 bs thmss) |
1793 bs thmss) |
1793 in |
1794 in |
1794 lthy |> Local_Theory.notes (Ibnf_common_notes @ Ibnf_notes) |> snd |
1795 timer; lthy |> Local_Theory.notes (Ibnf_common_notes @ Ibnf_notes) |> snd |
1795 end; |
1796 end; |
1796 |
1797 |
1797 val common_notes = |
1798 val common_notes = |
1798 [(fld_inductN, [fld_induct_thm]), |
1799 [(fld_inductN, [fld_induct_thm]), |
1799 (fld_induct2N, [fld_induct2_thm])] |
1800 (fld_induct2N, [fld_induct2_thm])] |
1819 ((unfs, flds, iters, recs, unf_fld_thms, fld_unf_thms, fld_inject_thms, iter_thms, rec_thms), |
1820 ((unfs, flds, iters, recs, unf_fld_thms, fld_unf_thms, fld_inject_thms, iter_thms, rec_thms), |
1820 lthy |> Local_Theory.notes (common_notes @ notes) |> snd) |
1821 lthy |> Local_Theory.notes (common_notes @ notes) |> snd) |
1821 end; |
1822 end; |
1822 |
1823 |
1823 val _ = |
1824 val _ = |
1824 Outer_Syntax.local_theory @{command_spec "data_raw"} "least fixed points of BNF equations" |
1825 Outer_Syntax.local_theory @{command_spec "data_raw"} |
1826 "define BNF-based inductive datatypes (low-level)" |
|
1825 (Parse.and_list1 |
1827 (Parse.and_list1 |
1826 ((Parse.binding --| @{keyword ":"}) -- (Parse.typ --| @{keyword "="} -- Parse.typ)) >> |
1828 ((Parse.binding --| @{keyword ":"}) -- (Parse.typ --| @{keyword "="} -- Parse.typ)) >> |
1827 (snd oo fp_bnf_cmd bnf_lfp o apsnd split_list o split_list)); |
1829 (snd oo fp_bnf_cmd bnf_lfp o apsnd split_list o split_list)); |
1828 |
1830 |
1831 val _ = |
|
1832 Outer_Syntax.local_theory @{command_spec "data"} "define BNF-based inductive datatypes" |
|
1833 (parse_datatype_cmd true bnf_lfp); |
|
1834 |
|
1829 end; |
1835 end; |