421 |
421 |
422 val type_rls = |
422 val type_rls = |
423 @{thms canTs} @ @{thms icanTs} @ @{thms applyT2} @ @{thms ncanTs} @ @{thms incanTs} @ |
423 @{thms canTs} @ @{thms icanTs} @ @{thms applyT2} @ @{thms ncanTs} @ @{thms incanTs} @ |
424 @{thms precTs} @ @{thms letrecTs} @ @{thms letT} @ @{thms Subtype_canTs}; |
424 @{thms precTs} @ @{thms letrecTs} @ @{thms letT} @ @{thms Subtype_canTs}; |
425 |
425 |
426 fun bvars (Const("all",_) $ Abs(s,_,t)) l = bvars t (s::l) |
426 fun bvars (Const(@{const_name all},_) $ Abs(s,_,t)) l = bvars t (s::l) |
427 | bvars _ l = l |
427 | bvars _ l = l |
428 |
428 |
429 fun get_bno l n (Const("all",_) $ Abs(s,_,t)) = get_bno (s::l) n t |
429 fun get_bno l n (Const(@{const_name all},_) $ Abs(s,_,t)) = get_bno (s::l) n t |
430 | get_bno l n (Const("Trueprop",_) $ t) = get_bno l n t |
430 | get_bno l n (Const(@{const_name Trueprop},_) $ t) = get_bno l n t |
431 | get_bno l n (Const("Ball",_) $ _ $ Abs(s,_,t)) = get_bno (s::l) (n+1) t |
431 | get_bno l n (Const(@{const_name Ball},_) $ _ $ Abs(s,_,t)) = get_bno (s::l) (n+1) t |
432 | get_bno l n (Const("mem",_) $ t $ _) = get_bno l n t |
432 | get_bno l n (Const(@{const_name mem},_) $ t $ _) = get_bno l n t |
433 | get_bno l n (t $ s) = get_bno l n t |
433 | get_bno l n (t $ s) = get_bno l n t |
434 | get_bno l n (Bound m) = (m-length(l),n) |
434 | get_bno l n (Bound m) = (m-length(l),n) |
435 |
435 |
436 (* Not a great way of identifying induction hypothesis! *) |
436 (* Not a great way of identifying induction hypothesis! *) |
437 fun could_IH x = Term.could_unify(x,hd (prems_of @{thm rcallT})) orelse |
437 fun could_IH x = Term.could_unify(x,hd (prems_of @{thm rcallT})) orelse |
448 | try_IHs ((x,y)::xs) = tac [(("g", 0), x)] (List.nth(rls,y-1)) i ORELSE (try_IHs xs) |
448 | try_IHs ((x,y)::xs) = tac [(("g", 0), x)] (List.nth(rls,y-1)) i ORELSE (try_IHs xs) |
449 in try_IHs rnames end) |
449 in try_IHs rnames end) |
450 |
450 |
451 fun is_rigid_prog t = |
451 fun is_rigid_prog t = |
452 case (Logic.strip_assums_concl t) of |
452 case (Logic.strip_assums_concl t) of |
453 (Const("Trueprop",_) $ (Const("mem",_) $ a $ _)) => null (Term.add_vars a []) |
453 (Const(@{const_name Trueprop},_) $ (Const(@{const_name mem},_) $ a $ _)) => null (Term.add_vars a []) |
454 | _ => false |
454 | _ => false |
455 in |
455 in |
456 |
456 |
457 fun rcall_tac ctxt i = |
457 fun rcall_tac ctxt i = |
458 let fun tac ps rl i = res_inst_tac ctxt ps rl i THEN atac i |
458 let fun tac ps rl i = res_inst_tac ctxt ps rl i THEN atac i |