| author | blanchet | 
| Thu, 18 Sep 2014 16:47:40 +0200 | |
| changeset 58377 | c6f93b8d2d8e | 
| parent 58353 | c9f374b64d99 | 
| child 58446 | e89f57d1e46c | 
| permissions | -rw-r--r-- | 
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
1  | 
(* Title: HOL/Tools/BNF/bnf_lfp_basic_sugar.ML  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
2  | 
Author: Jasmin Blanchette, TU Muenchen  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
3  | 
Copyright 2014  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
4  | 
|
| 58353 | 5  | 
Registration of basic types as BNF least fixpoints (datatypes).  | 
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
6  | 
*)  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
7  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
8  | 
structure BNF_LFP_Basic_Sugar : sig end =  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
9  | 
struct  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
10  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
11  | 
open Ctr_Sugar  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
12  | 
open BNF_Util  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
13  | 
open BNF_Def  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
14  | 
open BNF_Comp  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
15  | 
open BNF_FP_Rec_Sugar_Util  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
16  | 
open BNF_FP_Util  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
17  | 
open BNF_FP_Def_Sugar  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
18  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
19  | 
fun trivial_absT_info_of fpT =  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
20  | 
  {absT = fpT,
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
21  | 
repT = fpT,  | 
| 58353 | 22  | 
   abs = Const (@{const_name id_bnf}, fpT --> fpT),
 | 
23  | 
   rep = Const (@{const_name id_bnf}, fpT --> fpT),
 | 
|
24  | 
   abs_inject = @{thm type_definition.Abs_inject[OF type_definition_id_bnf_UNIV UNIV_I UNIV_I]},
 | 
|
25  | 
   abs_inverse = @{thm type_definition.Abs_inverse[OF type_definition_id_bnf_UNIV UNIV_I]},
 | 
|
26  | 
   type_definition = @{thm type_definition_id_bnf_UNIV}};
 | 
|
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
27  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
28  | 
fun the_frozen_ctr_sugar_of ctxt fpT_name =  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
29  | 
the (ctr_sugar_of ctxt fpT_name)  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
30  | 
|> morph_ctr_sugar (Morphism.typ_morphism "BNF" Logic.unvarifyT_global  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
31  | 
$> Morphism.term_morphism "BNF" (Term.map_types Logic.unvarifyT_global));  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
32  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
33  | 
fun trivial_fp_result_of fp_bnf fpT C xtor_map xtor_sets xtor_rel ctor_rec_o_map xtor_rel_induct =  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
34  | 
  {Ts = [fpT],
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
35  | 
bnfs = [fp_bnf],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
36  | 
   ctors = [Const (@{const_name xtor}, fpT --> fpT)],
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
37  | 
   dtors = [Const (@{const_name xtor}, fpT --> fpT)],
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
38  | 
   xtor_co_recs = [Const (@{const_name ctor_rec}, (fpT --> C) --> (fpT --> C))],
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
39  | 
   xtor_co_induct = @{thm xtor_induct},
 | 
| 
58377
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
40  | 
   dtor_ctors = @{thms xtor_xtor},
 | 
| 
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
41  | 
   ctor_dtors = @{thms xtor_xtor},
 | 
| 
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
42  | 
   ctor_injects = @{thms xtor_inject},
 | 
| 
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
43  | 
   dtor_injects = @{thms xtor_inject},
 | 
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
44  | 
xtor_map_thms = [xtor_map],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
45  | 
xtor_set_thmss = [xtor_sets],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
46  | 
xtor_rel_thms = [xtor_rel],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
47  | 
   xtor_co_rec_thms = [map_id0_of_bnf fp_bnf RS @{thm ctor_rec}],
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
48  | 
xtor_co_rec_o_map_thms = [ctor_rec_o_map],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
49  | 
rel_xtor_co_induct_thm = xtor_rel_induct,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
50  | 
dtor_set_induct_thms = []};  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
51  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
52  | 
fun fp_sugar_of_sum ctxt =  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
53  | 
let  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
54  | 
    val fpT as Type (fpT_name, As) = @{typ "'a + 'b"};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
55  | 
    val fpBT = @{typ "'c + 'd"};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
56  | 
    val C = @{typ 'e};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
57  | 
    val X = @{typ 'sum};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
58  | 
val ctr_Tss = map single As;  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
59  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
60  | 
val fp_bnf = the (bnf_of ctxt fpT_name);  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
61  | 
    val xtor_map = @{thm xtor_map[of "map_sum f1 f2" for f1 f2]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
62  | 
    val xtor_sets = @{thms xtor_set[of setl] xtor_set[of setr]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
63  | 
    val xtor_rel = @{thm xtor_rel[of "rel_sum R1 R2" for R1 R2]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
64  | 
    val ctor_rec_o_map = @{thm ctor_rec_o_map[of _ "map_sum g1 g2" for g1 g2]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
65  | 
    val xtor_rel_induct = @{thm xtor_rel_induct[of "rel_sum R1 R2" for R1 R2]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
66  | 
in  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
67  | 
    {T = fpT,
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
68  | 
BT = fpBT,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
69  | 
X = X,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
70  | 
fp = Least_FP,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
71  | 
fp_res_index = 0,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
72  | 
fp_res =  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
73  | 
trivial_fp_result_of fp_bnf fpT C xtor_map xtor_sets xtor_rel ctor_rec_o_map xtor_rel_induct,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
74  | 
pre_bnf = ID_bnf (*wrong*),  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
75  | 
absT_info = trivial_absT_info_of fpT,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
76  | 
fp_nesting_bnfs = [],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
77  | 
live_nesting_bnfs = [],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
78  | 
ctrXs_Tss = ctr_Tss,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
79  | 
     ctr_defs = @{thms Inl_def_alt Inr_def_alt},
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
80  | 
ctr_sugar = the_frozen_ctr_sugar_of ctxt fpT_name,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
81  | 
     co_rec = Const (@{const_name case_sum}, map (fn Ts => (Ts ---> C)) ctr_Tss ---> fpT --> C),
 | 
| 
58377
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
82  | 
     co_rec_def = @{thm ctor_rec_def_alt[of "case_sum f1 f2" for f1 f2]},
 | 
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
83  | 
     maps = @{thms map_sum.simps},
 | 
| 
58377
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
84  | 
     common_co_inducts = @{thms sum.induct},
 | 
| 
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
85  | 
     co_inducts = @{thms sum.induct},
 | 
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
86  | 
     co_rec_thms = @{thms sum.case},
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
87  | 
co_rec_discs = [],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
88  | 
co_rec_selss = [],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
89  | 
     rel_injects = @{thms rel_sum_simps(1,4)},
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
90  | 
     rel_distincts = @{thms rel_sum_simps(2,3)[THEN eq_False[THEN iffD1]]}}
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
91  | 
end;  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
92  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
93  | 
fun fp_sugar_of_prod ctxt =  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
94  | 
let  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
95  | 
    val fpT as Type (fpT_name, As) = @{typ "'a * 'b"};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
96  | 
    val fpBT = @{typ "'c * 'd"};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
97  | 
    val C = @{typ 'e};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
98  | 
    val X = @{typ 'prod};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
99  | 
val ctr_Ts = As;  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
100  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
101  | 
val fp_bnf = the (bnf_of ctxt fpT_name);  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
102  | 
    val xtor_map = @{thm xtor_map[of "map_prod f1 f2" for f1 f2]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
103  | 
    val xtor_sets = @{thms xtor_set[of fsts] xtor_set[of snds]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
104  | 
    val xtor_rel = @{thm xtor_rel[of "rel_prod R1 R2" for R1 R2]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
105  | 
    val ctor_rec_o_map = @{thm ctor_rec_o_map[of _ "map_prod g1 g2" for g1 g2]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
106  | 
    val xtor_rel_induct = @{thm xtor_rel_induct[of "rel_prod R1 R2" for R1 R2]};
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
107  | 
in  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
108  | 
    {T = fpT,
 | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
109  | 
BT = fpBT,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
110  | 
X = X,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
111  | 
fp = Least_FP,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
112  | 
fp_res_index = 0,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
113  | 
fp_res =  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
114  | 
trivial_fp_result_of fp_bnf fpT C xtor_map xtor_sets xtor_rel ctor_rec_o_map xtor_rel_induct,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
115  | 
pre_bnf = ID_bnf (*wrong*),  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
116  | 
absT_info = trivial_absT_info_of fpT,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
117  | 
fp_nesting_bnfs = [],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
118  | 
live_nesting_bnfs = [],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
119  | 
ctrXs_Tss = [ctr_Ts],  | 
| 
58377
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
120  | 
     ctr_defs = @{thms Pair_def_alt},
 | 
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
121  | 
ctr_sugar = the_frozen_ctr_sugar_of ctxt fpT_name,  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
122  | 
     co_rec = Const (@{const_name case_prod}, (ctr_Ts ---> C) --> fpT --> C),
 | 
| 
58377
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
123  | 
     co_rec_def = @{thm ctor_rec_def_alt[of "case_prod f" for f]},
 | 
| 
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
124  | 
     maps = @{thms map_prod_simp},
 | 
| 
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
125  | 
     common_co_inducts = @{thms prod.induct},
 | 
| 
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
126  | 
     co_inducts = @{thms prod.induct},
 | 
| 
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
127  | 
     co_rec_thms = @{thms prod.case},
 | 
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
128  | 
co_rec_discs = [],  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
129  | 
co_rec_selss = [],  | 
| 
58377
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
130  | 
     rel_injects = @{thms rel_prod_apply},
 | 
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
131  | 
rel_distincts = []}  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
132  | 
end;  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
133  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
134  | 
val _ = Theory.setup (map_local_theory (fn lthy =>  | 
| 
58377
 
c6f93b8d2d8e
moved old 'size' generator together with 'old_datatype'
 
blanchet 
parents: 
58353 
diff
changeset
 | 
135  | 
fold (BNF_FP_Def_Sugar.register_fp_sugars (K true) o single o (fn f => f lthy))  | 
| 
58352
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
136  | 
[fp_sugar_of_sum, fp_sugar_of_prod] lthy));  | 
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
137  | 
|
| 
 
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
 
blanchet 
parents:  
diff
changeset
 | 
138  | 
end;  |