250 fun dt_constr_defs (((((_, (_, _, constrs)), tname), typedef: Typedef.info), T), constr_syntax) |
250 fun dt_constr_defs (((((_, (_, _, constrs)), tname), typedef: Typedef.info), T), constr_syntax) |
251 (thy, defs, eqns, rep_congs, dist_lemmas) = |
251 (thy, defs, eqns, rep_congs, dist_lemmas) = |
252 let |
252 let |
253 val _ $ (_ $ (cong_f $ _) $ _) = concl_of arg_cong; |
253 val _ $ (_ $ (cong_f $ _) $ _) = concl_of arg_cong; |
254 val rep_const = cterm_of thy (Const (#Rep_name (#1 typedef), T --> Univ_elT)); |
254 val rep_const = cterm_of thy (Const (#Rep_name (#1 typedef), T --> Univ_elT)); |
255 val cong' = |
255 val cong' = cterm_instantiate [(cterm_of thy cong_f, rep_const)] arg_cong; |
256 Drule.export_without_context |
256 val dist = cterm_instantiate [(cterm_of thy distinct_f, rep_const)] distinct_lemma; |
257 (cterm_instantiate [(cterm_of thy cong_f, rep_const)] arg_cong); |
|
258 val dist = |
|
259 Drule.export_without_context |
|
260 (cterm_instantiate [(cterm_of thy distinct_f, rep_const)] distinct_lemma); |
|
261 val (thy', defs', eqns', _) = |
257 val (thy', defs', eqns', _) = |
262 fold (make_constr_def typedef T (length constrs)) |
258 fold (make_constr_def typedef T (length constrs)) |
263 (constrs ~~ constr_syntax) (Sign.add_path tname thy, defs, [], 1); |
259 (constrs ~~ constr_syntax) (Sign.add_path tname thy, defs, [], 1); |
264 in |
260 in |
265 (Sign.parent_path thy', defs', eqns @ [eqns'], |
261 (Sign.parent_path thy', defs', eqns @ [eqns'], |