equal
deleted
inserted
replaced
235 val thm' = Thm.instantiate ([], insts) thm; |
235 val thm' = Thm.instantiate ([], insts) thm; |
236 val thm'' = (case optfs' of |
236 val thm'' = (case optfs' of |
237 NONE => thm' RS sym |
237 NONE => thm' RS sym |
238 | SOME fs' => |
238 | SOME fs' => |
239 let |
239 let |
240 val U = HOLogic.dest_setT (body_type T); |
240 val (_, U) = split_last (binder_types T); |
241 val Ts = HOLogic.prodT_factors' fs' U; |
241 val Ts = HOLogic.prodT_factors' fs' U; |
242 (* FIXME: should cterm_instantiate increment indexes? *) |
242 (* FIXME: should cterm_instantiate increment indexes? *) |
243 val arg_cong' = Thm.incr_indexes (Thm.maxidx_of thm + 1) arg_cong; |
243 val arg_cong' = Thm.incr_indexes (Thm.maxidx_of thm + 1) arg_cong; |
244 val (arg_cong_f, _) = arg_cong' |> cprop_of |> Drule.strip_imp_concl |> |
244 val (arg_cong_f, _) = arg_cong' |> cprop_of |> Drule.strip_imp_concl |> |
245 Thm.dest_comb |> snd |> Drule.strip_comb |> snd |> hd |> Thm.dest_comb |
245 Thm.dest_comb |> snd |> Drule.strip_comb |> snd |> hd |> Thm.dest_comb |
411 | infer (Const ("op :", _) $ t $ u) = |
411 | infer (Const ("op :", _) $ t $ u) = |
412 infer_arities thy set_arities (SOME (HOLogic.prod_factors t), u) |
412 infer_arities thy set_arities (SOME (HOLogic.prod_factors t), u) |
413 | infer (t $ u) = infer t #> infer u |
413 | infer (t $ u) = infer t #> infer u |
414 | infer _ = I; |
414 | infer _ = I; |
415 val new_arities = filter_out |
415 val new_arities = filter_out |
416 (fn (x as Free (_, Type ("fun", _)), _) => x mem params |
416 (fn (x as Free (_, T), _) => x mem params andalso length (binder_types T) > 1 |
417 | _ => false) (fold (snd #> infer) intros []); |
417 | _ => false) (fold (snd #> infer) intros []); |
418 val params' = map (fn x => (case AList.lookup op = new_arities x of |
418 val params' = map (fn x => (case AList.lookup op = new_arities x of |
419 SOME fs => |
419 SOME fs => |
420 let |
420 let |
421 val T = HOLogic.dest_setT (fastype_of x); |
421 val T = HOLogic.dest_setT (fastype_of x); |
435 |
435 |
436 (* equations for converting sets to predicates *) |
436 (* equations for converting sets to predicates *) |
437 val ((cs', cs_info), eqns) = cs |> map (fn c as Free (s, T) => |
437 val ((cs', cs_info), eqns) = cs |> map (fn c as Free (s, T) => |
438 let |
438 let |
439 val fs = the_default [] (AList.lookup op = new_arities c); |
439 val fs = the_default [] (AList.lookup op = new_arities c); |
440 val U = HOLogic.dest_setT (body_type T); |
440 val (_, U) = split_last (binder_types T); |
441 val Ts = HOLogic.prodT_factors' fs U; |
441 val Ts = HOLogic.prodT_factors' fs U; |
442 val c' = Free (s ^ "p", |
442 val c' = Free (s ^ "p", |
443 map fastype_of params1 @ Ts ---> HOLogic.boolT) |
443 map fastype_of params1 @ Ts ---> HOLogic.boolT) |
444 in |
444 in |
445 ((c', (fs, U, Ts)), |
445 ((c', (fs, U, Ts)), |