equal
deleted
inserted
replaced
260 val rvs = map fst (relevant_vars (prop_of rule)); |
260 val rvs = map fst (relevant_vars (prop_of rule)); |
261 val xs = rev (Term.add_vars (prop_of rule) []); |
261 val xs = rev (Term.add_vars (prop_of rule) []); |
262 val vs1 = map Var (filter_out (fn ((a, _), _) => member (op =) rvs a) xs); |
262 val vs1 = map Var (filter_out (fn ((a, _), _) => member (op =) rvs a) xs); |
263 val rlzvs = rev (Term.add_vars (prop_of rrule) []); |
263 val rlzvs = rev (Term.add_vars (prop_of rrule) []); |
264 val vs2 = map (fn (ixn, _) => Var (ixn, (the o AList.lookup (op =) rlzvs) ixn)) xs; |
264 val vs2 = map (fn (ixn, _) => Var (ixn, (the o AList.lookup (op =) rlzvs) ixn)) xs; |
265 val rs = map Var (subtract (op = o pairself fst) xs rlzvs); |
265 val rs = map Var (subtract (op = o apply2 fst) xs rlzvs); |
266 val rlz' = fold_rev Logic.all rs (prop_of rrule) |
266 val rlz' = fold_rev Logic.all rs (prop_of rrule) |
267 in (name, (vs, |
267 in (name, (vs, |
268 if rt = Extraction.nullt then rt else fold_rev lambda vs1 rt, |
268 if rt = Extraction.nullt then rt else fold_rev lambda vs1 rt, |
269 Extraction.abs_corr_shyps thy rule vs vs2 |
269 Extraction.abs_corr_shyps thy rule vs vs2 |
270 (ProofRewriteRules.un_hhf_proof rlz' (attach_typeS rlz) |
270 (ProofRewriteRules.un_hhf_proof rlz' (attach_typeS rlz) |
338 let |
338 let |
339 val Const (s, T) = head_of (HOLogic.dest_Trueprop (Logic.strip_assums_concl rintr)); |
339 val Const (s, T) = head_of (HOLogic.dest_Trueprop (Logic.strip_assums_concl rintr)); |
340 val s' = Long_Name.base_name s; |
340 val s' = Long_Name.base_name s; |
341 val T' = Logic.unvarifyT_global T; |
341 val T' = Logic.unvarifyT_global T; |
342 in (((s', T'), NoSyn), (Const (s, T'), Free (s', T'))) end) |
342 in (((s', T'), NoSyn), (Const (s, T'), Free (s', T'))) end) |
343 |> distinct (op = o pairself (#1 o #1)) |
343 |> distinct (op = o apply2 (#1 o #1)) |
344 |> map (apfst (apfst (apfst Binding.name))) |
344 |> map (apfst (apfst (apfst Binding.name))) |
345 |> split_list; |
345 |> split_list; |
346 |
346 |
347 val rlzparams = map (fn Var ((s, _), T) => (s, Logic.unvarifyT_global T)) |
347 val rlzparams = map (fn Var ((s, _), T) => (s, Logic.unvarifyT_global T)) |
348 (List.take (snd (strip_comb |
348 (List.take (snd (strip_comb |
367 SOME (fst (fst (dest_Var (head_of P)))) else NONE) |
367 SOME (fst (fst (dest_Var (head_of P)))) else NONE) |
368 (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of raw_induct))); |
368 (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of raw_induct))); |
369 |
369 |
370 fun add_ind_realizer Ps thy = |
370 fun add_ind_realizer Ps thy = |
371 let |
371 let |
372 val vs' = rename (map (pairself (fst o fst o dest_Var)) |
372 val vs' = rename (map (apply2 (fst o fst o dest_Var)) |
373 (params ~~ List.take (snd (strip_comb (HOLogic.dest_Trueprop |
373 (params ~~ List.take (snd (strip_comb (HOLogic.dest_Trueprop |
374 (hd (prems_of (hd inducts))))), nparms))) vs; |
374 (hd (prems_of (hd inducts))))), nparms))) vs; |
375 val rs = indrule_realizer thy induct raw_induct rsets params' |
375 val rs = indrule_realizer thy induct raw_induct rsets params' |
376 (vs' @ Ps) rec_names rss' intrs dummies; |
376 (vs' @ Ps) rec_names rss' intrs dummies; |
377 val rlzs = map (fn (r, ind) => Extraction.realizes_of thy (vs' @ Ps) r |
377 val rlzs = map (fn (r, ind) => Extraction.realizes_of thy (vs' @ Ps) r |
489 |
489 |
490 fun add_ind_realizers name rsets thy = |
490 fun add_ind_realizers name rsets thy = |
491 let |
491 let |
492 val (_, {intrs, induct, raw_induct, elims, ...}) = |
492 val (_, {intrs, induct, raw_induct, elims, ...}) = |
493 Inductive.the_inductive (Proof_Context.init_global thy) name; |
493 Inductive.the_inductive (Proof_Context.init_global thy) name; |
494 val vss = sort (int_ord o pairself length) |
494 val vss = sort (int_ord o apply2 length) |
495 (subsets (map fst (relevant_vars (concl_of (hd intrs))))) |
495 (subsets (map fst (relevant_vars (concl_of (hd intrs))))) |
496 in |
496 in |
497 fold_rev (add_ind_realizer rsets intrs induct raw_induct elims) vss thy |
497 fold_rev (add_ind_realizer rsets intrs induct raw_induct elims) vss thy |
498 end |
498 end |
499 |
499 |