929 |
929 |
930 fun ring_tac add_ths del_ths ctxt = |
930 fun ring_tac add_ths del_ths ctxt = |
931 Object_Logic.full_atomize_tac ctxt |
931 Object_Logic.full_atomize_tac ctxt |
932 THEN' presimplify ctxt add_ths del_ths |
932 THEN' presimplify ctxt add_ths del_ths |
933 THEN' CSUBGOAL (fn (p, i) => |
933 THEN' CSUBGOAL (fn (p, i) => |
934 rtac (let val form = Object_Logic.dest_judgment ctxt p |
934 resolve_tac ctxt [let val form = Object_Logic.dest_judgment ctxt p |
935 in case get_ring_ideal_convs ctxt form of |
935 in case get_ring_ideal_convs ctxt form of |
936 NONE => Thm.reflexive form |
936 NONE => Thm.reflexive form |
937 | SOME thy => #ring_conv thy ctxt form |
937 | SOME thy => #ring_conv thy ctxt form |
938 end) i |
938 end] i |
939 handle TERM _ => no_tac |
939 handle TERM _ => no_tac |
940 | CTERM _ => no_tac |
940 | CTERM _ => no_tac |
941 | THM _ => no_tac); |
941 | THM _ => no_tac); |
942 |
942 |
943 local |
943 local |
944 fun lhs t = case Thm.term_of t of |
944 fun lhs t = case Thm.term_of t of |
945 Const(@{const_name HOL.eq},_)$_$_ => Thm.dest_arg1 t |
945 Const(@{const_name HOL.eq},_)$_$_ => Thm.dest_arg1 t |
946 | _=> raise CTERM ("ideal_tac - lhs",[t]) |
946 | _=> raise CTERM ("ideal_tac - lhs",[t]) |
947 fun exitac NONE = no_tac |
947 fun exitac _ NONE = no_tac |
948 | exitac (SOME y) = rtac (instantiate' [SOME (Thm.ctyp_of_cterm y)] [NONE,SOME y] exI) 1 |
948 | exitac ctxt (SOME y) = |
|
949 resolve_tac ctxt [instantiate' [SOME (Thm.ctyp_of_cterm y)] [NONE,SOME y] exI] 1 |
949 |
950 |
950 val claset = claset_of @{context} |
951 val claset = claset_of @{context} |
951 in |
952 in |
952 fun ideal_tac add_ths del_ths ctxt = |
953 fun ideal_tac add_ths del_ths ctxt = |
953 presimplify ctxt add_ths del_ths |
954 presimplify ctxt add_ths del_ths |
962 let |
963 let |
963 val (evs,bod) = strip_exists (Thm.dest_arg concl) |
964 val (evs,bod) = strip_exists (Thm.dest_arg concl) |
964 val ps = map_filter (try (lhs o Thm.dest_arg)) asms |
965 val ps = map_filter (try (lhs o Thm.dest_arg)) asms |
965 val cfs = (map swap o #multi_ideal thy evs ps) |
966 val cfs = (map swap o #multi_ideal thy evs ps) |
966 (map Thm.dest_arg1 (conjuncts bod)) |
967 (map Thm.dest_arg1 (conjuncts bod)) |
967 val ws = map (exitac o AList.lookup op aconvc cfs) evs |
968 val ws = map (exitac ctxt o AList.lookup op aconvc cfs) evs |
968 in EVERY (rev ws) THEN Method.insert_tac prems 1 |
969 in EVERY (rev ws) THEN Method.insert_tac prems 1 |
969 THEN ring_tac add_ths del_ths ctxt 1 |
970 THEN ring_tac add_ths del_ths ctxt 1 |
970 end |
971 end |
971 in |
972 in |
972 clarify_tac (put_claset claset ctxt) i |
973 clarify_tac (put_claset claset ctxt) i |