84 a ->> List.foldr (op ->>) (mk_maybeT c) bs ->> mk_maybeT c; |
84 a ->> List.foldr (op ->>) (mk_maybeT c) bs ->> mk_maybeT c; |
85 fun mat (con,args,mx) = |
85 fun mat (con,args,mx) = |
86 (mat_name_ con, |
86 (mat_name_ con, |
87 mk_matT(dtype, map third args, freetvar "t" 1), |
87 mk_matT(dtype, map third args, freetvar "t" 1), |
88 Mixfix(escape ("match_" ^ Binding.name_of con), [], Syntax.max_pri)); |
88 Mixfix(escape ("match_" ^ Binding.name_of con), [], Syntax.max_pri)); |
89 fun sel1 (_,sel,typ) = |
|
90 Option.map (fn s => (s,dtype ->> typ,NoSyn)) sel; |
|
91 fun sel (con,args,mx) = map_filter sel1 args; |
|
92 fun mk_patT (a,b) = a ->> mk_maybeT b; |
89 fun mk_patT (a,b) = a ->> mk_maybeT b; |
93 fun pat_arg_typ n arg = mk_patT (third arg, freetvar "t" n); |
90 fun pat_arg_typ n arg = mk_patT (third arg, freetvar "t" n); |
94 fun pat (con,args,mx) = |
91 fun pat (con,args,mx) = |
95 (pat_name_ con, |
92 (pat_name_ con, |
96 (mapn pat_arg_typ 1 args) |
93 (mapn pat_arg_typ 1 args) |
99 Mixfix(escape (Binding.name_of con ^ "_pat"), [], Syntax.max_pri)); |
96 Mixfix(escape (Binding.name_of con ^ "_pat"), [], Syntax.max_pri)); |
100 in |
97 in |
101 val consts_dis = map dis cons'; |
98 val consts_dis = map dis cons'; |
102 val consts_mat = map mat cons'; |
99 val consts_mat = map mat cons'; |
103 val consts_pat = map pat cons'; |
100 val consts_pat = map pat cons'; |
104 val consts_sel = maps sel cons'; |
|
105 end; |
101 end; |
106 |
102 |
107 (* ----- constants concerning induction ------------------------------------- *) |
103 (* ----- constants concerning induction ------------------------------------- *) |
108 |
104 |
109 val const_take = (dbind "_take" , HOLogic.natT-->dtype->>dtype, NoSyn); |
105 val const_take = (dbind "_take" , HOLogic.natT-->dtype->>dtype, NoSyn); |
167 end; |
163 end; |
168 val optional_consts = |
164 val optional_consts = |
169 if definitional then [] else [const_rep, const_abs, const_copy]; |
165 if definitional then [] else [const_rep, const_abs, const_copy]; |
170 |
166 |
171 in (optional_consts @ [const_when] @ |
167 in (optional_consts @ [const_when] @ |
172 consts_dis @ consts_mat @ consts_pat @ consts_sel @ |
168 consts_dis @ consts_mat @ consts_pat @ |
173 [const_take, const_finite], |
169 [const_take, const_finite], |
174 (case_trans false :: case_trans true :: (abscon_trans false @ abscon_trans true @ Case_trans))) |
170 (case_trans false :: case_trans true :: (abscon_trans false @ abscon_trans true @ Case_trans))) |
175 end; (* let *) |
171 end; (* let *) |
176 |
172 |
177 (* ----- putting all the syntax stuff together ------------------------------ *) |
173 (* ----- putting all the syntax stuff together ------------------------------ *) |