equal
deleted
inserted
replaced
34 val pnames = |
34 val pnames = |
35 if length descr = 1 then ["P"] |
35 if length descr = 1 then ["P"] |
36 else map (fn i => "P" ^ string_of_int i) (1 upto length descr); |
36 else map (fn i => "P" ^ string_of_int i) (1 upto length descr); |
37 |
37 |
38 val rec_result_Ts = map (fn ((i, _), P) => |
38 val rec_result_Ts = map (fn ((i, _), P) => |
39 if member (op =) is i then TFree ("'" ^ P, HOLogic.typeS) else HOLogic.unitT) |
39 if member (op =) is i then TFree ("'" ^ P, @{sort type}) else HOLogic.unitT) |
40 (descr ~~ pnames); |
40 (descr ~~ pnames); |
41 |
41 |
42 fun make_pred i T U r x = |
42 fun make_pred i T U r x = |
43 if member (op =) is i then |
43 if member (op =) is i then |
44 Free (nth pnames i, T --> U --> HOLogic.boolT) $ r $ x |
44 Free (nth pnames i, T --> U --> HOLogic.boolT) $ r $ x |
161 |
161 |
162 fun make_casedists ({index, descr, case_name, case_rewrites, exhaust, ...} : Datatype.info) thy = |
162 fun make_casedists ({index, descr, case_name, case_rewrites, exhaust, ...} : Datatype.info) thy = |
163 let |
163 let |
164 val ctxt = Proof_Context.init_global thy; |
164 val ctxt = Proof_Context.init_global thy; |
165 val cert = cterm_of thy; |
165 val cert = cterm_of thy; |
166 val rT = TFree ("'P", HOLogic.typeS); |
166 val rT = TFree ("'P", @{sort type}); |
167 val rT' = TVar (("'P", 0), HOLogic.typeS); |
167 val rT' = TVar (("'P", 0), @{sort type}); |
168 |
168 |
169 fun make_casedist_prem T (cname, cargs) = |
169 fun make_casedist_prem T (cname, cargs) = |
170 let |
170 let |
171 val Ts = map (Datatype_Aux.typ_of_dtyp descr) cargs; |
171 val Ts = map (Datatype_Aux.typ_of_dtyp descr) cargs; |
172 val frees = Name.variant_list ["P", "y"] (Datatype_Prop.make_tnames Ts) ~~ Ts; |
172 val frees = Name.variant_list ["P", "y"] (Datatype_Prop.make_tnames Ts) ~~ Ts; |