241 |
262 |
242 val _ = trace_msg (K "Defining raw permutations...") |
263 val _ = trace_msg (K "Defining raw permutations...") |
243 val ((raw_perm_funs, raw_perm_simps, raw_perm_laws), lthy2a) = define_raw_perms raw_dt_info lthy0 |
264 val ((raw_perm_funs, raw_perm_simps, raw_perm_laws), lthy2a) = define_raw_perms raw_dt_info lthy0 |
244 |
265 |
245 (* noting the raw permutations as eqvt theorems *) |
266 (* noting the raw permutations as eqvt theorems *) |
246 val (_, lthy3) = Local_Theory.note ((Binding.empty, [eqvt_attr]), raw_perm_simps) lthy2a |
267 val lthy3 = snd (Local_Theory.note ((Binding.empty, [eqvt_attr]), raw_perm_simps) lthy2a) |
247 |
268 |
248 val _ = trace_msg (K "Defining raw fv- and bn-functions...") |
269 val _ = trace_msg (K "Defining raw fv- and bn-functions...") |
249 val (raw_bns, raw_bn_defs, raw_bn_info, raw_bn_inducts, lthy3a) = |
270 val (raw_bns, raw_bn_defs, raw_bn_info, raw_bn_inducts, lthy3a) = |
250 define_raw_bns raw_dt_info raw_bn_funs raw_bn_eqs lthy3 |
271 define_raw_bns raw_dt_info raw_bn_funs raw_bn_eqs lthy3 |
251 |
272 |
404 |
425 |
405 val _ = trace_msg (K "Lifting of theorems...") |
426 val _ = trace_msg (K "Lifting of theorems...") |
406 val eq_iff_simps = @{thms alphas permute_prod.simps prod_fv.simps prod_alpha_def prod_rel_def |
427 val eq_iff_simps = @{thms alphas permute_prod.simps prod_fv.simps prod_alpha_def prod_rel_def |
407 prod.cases} |
428 prod.cases} |
408 |
429 |
409 val (((((((qdistincts, qeq_iffs), qfv_defs), qbn_defs), qperm_simps), qfv_qbn_eqvts), qbn_inducts), |
430 val ([ qdistincts, qeq_iffs, qfv_defs, qbn_defs, qperm_simps, qfv_qbn_eqvts, |
410 lthyA) = |
431 qbn_inducts, qsize_eqvt, [qinduct], qexhausts, qsize_simps, qperm_bn_simps, |
|
432 qalpha_refl_thms ], lthyB) = |
411 lthy9a |
433 lthy9a |
412 |> lift_thms qtys [] alpha_distincts |
434 |>>> lift_thms qtys [] alpha_distincts |
413 ||>> lift_thms qtys eq_iff_simps alpha_eq_iff |
435 ||>>> lift_thms qtys eq_iff_simps alpha_eq_iff |
414 ||>> lift_thms qtys [] raw_fv_defs |
436 ||>>> lift_thms qtys [] raw_fv_defs |
415 ||>> lift_thms qtys [] raw_bn_defs |
437 ||>>> lift_thms qtys [] raw_bn_defs |
416 ||>> lift_thms qtys [] raw_perm_simps |
438 ||>>> lift_thms qtys [] raw_perm_simps |
417 ||>> lift_thms qtys [] (raw_fv_eqvt @ raw_bn_eqvt) |
439 ||>>> lift_thms qtys [] (raw_fv_eqvt @ raw_bn_eqvt) |
418 ||>> lift_thms qtys [] raw_bn_inducts |
440 ||>>> lift_thms qtys [] raw_bn_inducts |
419 |
441 ||>>> lift_thms qtys [] raw_size_eqvt |
420 val ((((((qsize_eqvt, [qinduct]), qexhausts), qsize_simps), qperm_bn_simps), qalpha_refl_thms), lthyB) = |
442 ||>>> lift_thms qtys [] [raw_induct_thm] |
421 lthyA |
443 ||>>> lift_thms qtys [] raw_exhaust_thms |
422 |> lift_thms qtys [] raw_size_eqvt |
444 ||>>> lift_thms qtys [] raw_size_thms |
423 ||>> lift_thms qtys [] [raw_induct_thm] |
445 ||>>> lift_thms qtys [] raw_perm_bn_simps |
424 ||>> lift_thms qtys [] raw_exhaust_thms |
446 ||>>> lift_thms qtys [] alpha_refl_thms |
425 ||>> lift_thms qtys [] raw_size_thms |
|
426 ||>> lift_thms qtys [] raw_perm_bn_simps |
|
427 ||>> lift_thms qtys [] alpha_refl_thms |
|
428 |
447 |
429 val qinducts = Project_Rule.projections lthyB qinduct |
448 val qinducts = Project_Rule.projections lthyB qinduct |
430 |
449 |
431 val _ = trace_msg (K "Proving supp lemmas and fs-instances...") |
450 val _ = trace_msg (K "Proving supp lemmas and fs-instances...") |
432 val qsupports_thms = |
451 val qsupports_thms = prove_supports lthyB qperm_simps (flat qtrms) |
433 prove_supports lthyB qperm_simps (flat qtrms) |
|
434 |
452 |
435 (* finite supp lemmas *) |
453 (* finite supp lemmas *) |
436 val qfsupp_thms = prove_fsupp lthyB qtys qinduct qsupports_thms |
454 val qfsupp_thms = prove_fsupp lthyB qtys qinduct qsupports_thms |
437 |
455 |
438 (* fs instances *) |
456 (* fs instances *) |
549 (constrs @ [(cname, cargs', mx)], sorts') |
567 (constrs @ [(cname, cargs', mx)], sorts') |
550 end |
568 end |
551 |
569 |
552 fun prep_dts (tvs, tname, mx, constrs) (constr_trms, dts, sorts) = |
570 fun prep_dts (tvs, tname, mx, constrs) (constr_trms, dts, sorts) = |
553 let |
571 let |
|
572 |
554 val (constrs', sorts') = |
573 val (constrs', sorts') = |
555 fold prep_constr constrs ([], sorts) |
574 fold prep_constr constrs ([], sorts) |
556 |
575 |
557 val constr_trms' = |
576 val constr_trms' = |
558 map (mk_type tname (rev sorts')) constrs' |
577 map (mk_type tname (rev sorts')) constrs' |