equal
deleted
inserted
replaced
370 |
370 |
371 fun add_ind_realizer Ps thy = |
371 fun add_ind_realizer Ps thy = |
372 let |
372 let |
373 val vs' = rename (map (apply2 (fst o fst o dest_Var)) |
373 val vs' = rename (map (apply2 (fst o fst o dest_Var)) |
374 (params ~~ List.take (snd (strip_comb (HOLogic.dest_Trueprop |
374 (params ~~ List.take (snd (strip_comb (HOLogic.dest_Trueprop |
375 (hd (Thm.prems_of (hd inducts))))), nparms))) vs; |
375 (hd (Thm.take_prems_of 1 (hd inducts))))), nparms))) vs; |
376 val rs = indrule_realizer thy induct raw_induct rsets params' |
376 val rs = indrule_realizer thy induct raw_induct rsets params' |
377 (vs' @ Ps) rec_names rss' intrs dummies; |
377 (vs' @ Ps) rec_names rss' intrs dummies; |
378 val rlzs = map (fn (r, ind) => Extraction.realizes_of thy (vs' @ Ps) r |
378 val rlzs = map (fn (r, ind) => Extraction.realizes_of thy (vs' @ Ps) r |
379 (Thm.prop_of ind)) (rs ~~ inducts); |
379 (Thm.prop_of ind)) (rs ~~ inducts); |
380 val used = fold Term.add_free_names rlzs []; |
380 val used = fold Term.add_free_names rlzs []; |
503 fun rlz_attrib arg = Thm.declaration_attribute (fn thm => Context.mapping |
503 fun rlz_attrib arg = Thm.declaration_attribute (fn thm => Context.mapping |
504 let |
504 let |
505 fun err () = error "ind_realizer: bad rule"; |
505 fun err () = error "ind_realizer: bad rule"; |
506 val sets = |
506 val sets = |
507 (case HOLogic.dest_conj (HOLogic.dest_Trueprop (Thm.concl_of thm)) of |
507 (case HOLogic.dest_conj (HOLogic.dest_Trueprop (Thm.concl_of thm)) of |
508 [_] => [pred_of (HOLogic.dest_Trueprop (hd (Thm.prems_of thm)))] |
508 [_] => [pred_of (HOLogic.dest_Trueprop (hd (Thm.take_prems_of 1 thm)))] |
509 | xs => map (pred_of o fst o HOLogic.dest_imp) xs) |
509 | xs => map (pred_of o fst o HOLogic.dest_imp) xs) |
510 handle TERM _ => err () | List.Empty => err (); |
510 handle TERM _ => err () | List.Empty => err (); |
511 in |
511 in |
512 add_ind_realizers (hd sets) |
512 add_ind_realizers (hd sets) |
513 (case arg of |
513 (case arg of |