367 end; |
367 end; |
368 |
368 |
369 val dt_info = |
369 val dt_info = |
370 {inductive = true, |
370 {inductive = true, |
371 constructors = constructors, |
371 constructors = constructors, |
372 rec_rewrites = recursor_eqns, |
372 rec_rewrites = map Thm.trim_context recursor_eqns, |
373 case_rewrites = case_eqns, |
373 case_rewrites = map Thm.trim_context case_eqns, |
374 induct = induct, |
374 induct = Thm.trim_context induct, |
375 mutual_induct = mutual_induct, |
375 mutual_induct = Thm.trim_context mutual_induct, |
376 exhaustion = elim}; |
376 exhaustion = Thm.trim_context elim}; |
377 |
377 |
378 val con_info = |
378 val con_info = |
379 {big_rec_name = big_rec_name, |
379 {big_rec_name = big_rec_name, |
380 constructors = constructors, |
380 constructors = constructors, |
381 (*let primrec handle definition by cases*) |
381 (*let primrec handle definition by cases*) |
382 free_iffs = free_iffs, |
382 free_iffs = map Thm.trim_context free_iffs, |
383 rec_rewrites = (case recursor_eqns of |
383 rec_rewrites = |
384 [] => case_eqns | _ => recursor_eqns)}; |
384 (case recursor_eqns of [] => case_eqns | _ => recursor_eqns) |
|
385 |> map Thm.trim_context}; |
385 |
386 |
386 (*associate with each constructor the datatype name and rewrites*) |
387 (*associate with each constructor the datatype name and rewrites*) |
387 val con_pairs = map (fn c => (#1 (dest_Const c), con_info)) constructors |
388 val con_pairs = map (fn c => (#1 (dest_Const c), con_info)) constructors |
388 |
389 |
389 in |
390 in |