324 @{lemma "a \<notin> f -` B ==> (\<And> x. f a = x ==> x \<notin> B ==> P) ==> P" by simp} |
324 @{lemma "a \<notin> f -` B ==> (\<And> x. f a = x ==> x \<notin> B ==> P) ==> P" by simp} |
325 |
325 |
326 val collectI' = @{lemma "\<not> P a ==> a \<notin> {x. P x}" by auto} |
326 val collectI' = @{lemma "\<not> P a ==> a \<notin> {x. P x}" by auto} |
327 val collectE' = @{lemma "a \<notin> {x. P x} ==> (\<not> P a ==> Q) ==> Q" by auto} |
327 val collectE' = @{lemma "a \<notin> {x. P x} ==> (\<not> P a ==> Q) ==> Q" by auto} |
328 |
328 |
329 val elim_Collect_tac = dtac @{thm iffD1[OF mem_Collect_eq]} |
329 fun elim_Collect_tac ss = dtac @{thm iffD1[OF mem_Collect_eq]} |
330 THEN' (REPEAT_DETERM o (eresolve_tac @{thms exE})) |
330 THEN' (REPEAT_DETERM o (eresolve_tac @{thms exE})) |
331 THEN' REPEAT_DETERM o etac @{thm conjE} |
331 THEN' REPEAT_DETERM o etac @{thm conjE} |
332 THEN' TRY o hyp_subst_tac; |
332 THEN' TRY o hyp_subst_tac' ss; |
333 |
333 |
334 fun intro_image_tac ctxt = rtac @{thm image_eqI} |
334 fun intro_image_tac ctxt = rtac @{thm image_eqI} |
335 THEN' (REPEAT_DETERM1 o |
335 THEN' (REPEAT_DETERM1 o |
336 (rtac @{thm refl} |
336 (rtac @{thm refl} |
337 ORELSE' rtac |
337 ORELSE' rtac |
341 |
341 |
342 fun elim_image_tac ss = etac @{thm imageE} |
342 fun elim_image_tac ss = etac @{thm imageE} |
343 THEN' REPEAT_DETERM o CHANGED o |
343 THEN' REPEAT_DETERM o CHANGED o |
344 (TRY o Simplifier.full_simp_tac (Simplifier.inherit_context ss (HOL_basic_ss addsimps @{thms split_paired_all prod.cases})) |
344 (TRY o Simplifier.full_simp_tac (Simplifier.inherit_context ss (HOL_basic_ss addsimps @{thms split_paired_all prod.cases})) |
345 THEN' REPEAT_DETERM o etac @{thm Pair_inject} |
345 THEN' REPEAT_DETERM o etac @{thm Pair_inject} |
346 THEN' TRY o hyp_subst_tac) |
346 THEN' TRY o hyp_subst_tac' ss) |
347 |
347 |
348 fun tac1_of_formula ss (Int (fm1, fm2)) = |
348 fun tac1_of_formula ss (Int (fm1, fm2)) = |
349 TRY o etac @{thm conjE} |
349 TRY o etac @{thm conjE} |
350 THEN' rtac @{thm IntI} |
350 THEN' rtac @{thm IntI} |
351 THEN' (fn i => tac1_of_formula ss fm2 (i + 1)) |
351 THEN' (fn i => tac1_of_formula ss fm2 (i + 1)) |
385 (atac |
385 (atac |
386 ORELSE' dtac @{thm iffD1[OF mem_Sigma_iff]} |
386 ORELSE' dtac @{thm iffD1[OF mem_Sigma_iff]} |
387 ORELSE' etac @{thm conjE} |
387 ORELSE' etac @{thm conjE} |
388 ORELSE' ((etac @{thm CollectE} ORELSE' etac collectE') THEN' |
388 ORELSE' ((etac @{thm CollectE} ORELSE' etac collectE') THEN' |
389 TRY o Simplifier.full_simp_tac (Simplifier.inherit_context ss (HOL_basic_ss addsimps [@{thm prod.cases}])) THEN' |
389 TRY o Simplifier.full_simp_tac (Simplifier.inherit_context ss (HOL_basic_ss addsimps [@{thm prod.cases}])) THEN' |
390 REPEAT_DETERM o etac @{thm Pair_inject} THEN' TRY o hyp_subst_tac THEN' TRY o rtac @{thm refl}) |
390 REPEAT_DETERM o etac @{thm Pair_inject} THEN' TRY o hyp_subst_tac' ss THEN' TRY o rtac @{thm refl}) |
391 ORELSE' (etac @{thm imageE} |
391 ORELSE' (etac @{thm imageE} |
392 THEN' (REPEAT_DETERM o CHANGED o |
392 THEN' (REPEAT_DETERM o CHANGED o |
393 (TRY o Simplifier.full_simp_tac (Simplifier.inherit_context ss (HOL_basic_ss addsimps @{thms split_paired_all prod.cases})) |
393 (TRY o Simplifier.full_simp_tac (Simplifier.inherit_context ss (HOL_basic_ss addsimps @{thms split_paired_all prod.cases})) |
394 THEN' REPEAT_DETERM o etac @{thm Pair_inject} |
394 THEN' REPEAT_DETERM o etac @{thm Pair_inject} |
395 THEN' TRY o hyp_subst_tac THEN' TRY o rtac @{thm refl}))) |
395 THEN' TRY o hyp_subst_tac' ss THEN' TRY o rtac @{thm refl}))) |
396 ORELSE' etac @{thm ComplE} |
396 ORELSE' etac @{thm ComplE} |
397 ORELSE' ((etac @{thm vimageE} ORELSE' etac vimageE') |
397 ORELSE' ((etac @{thm vimageE} ORELSE' etac vimageE') |
398 THEN' TRY o Simplifier.full_simp_tac (Simplifier.inherit_context ss (HOL_basic_ss addsimps [@{thm prod.cases}])) |
398 THEN' TRY o Simplifier.full_simp_tac (Simplifier.inherit_context ss (HOL_basic_ss addsimps [@{thm prod.cases}])) |
399 THEN' TRY o hyp_subst_tac THEN' TRY o rtac @{thm refl})) |
399 THEN' TRY o hyp_subst_tac' ss THEN' TRY o rtac @{thm refl})) |
400 |
400 |
401 fun tac ss ctxt fm = |
401 fun tac ss ctxt fm = |
402 let |
402 let |
403 val subset_tac1 = rtac @{thm subsetI} |
403 val subset_tac1 = rtac @{thm subsetI} |
404 THEN' elim_Collect_tac |
404 THEN' elim_Collect_tac ss |
405 THEN' intro_image_tac ctxt |
405 THEN' intro_image_tac ctxt |
406 THEN' tac1_of_formula ss fm |
406 THEN' tac1_of_formula ss fm |
407 val subset_tac2 = rtac @{thm subsetI} |
407 val subset_tac2 = rtac @{thm subsetI} |
408 THEN' elim_image_tac ss |
408 THEN' elim_image_tac ss |
409 THEN' rtac @{thm iffD2[OF mem_Collect_eq]} |
409 THEN' rtac @{thm iffD2[OF mem_Collect_eq]} |
410 THEN' REPEAT_DETERM o resolve_tac @{thms exI} |
410 THEN' REPEAT_DETERM o resolve_tac @{thms exI} |
411 THEN' (TRY o REPEAT_ALL_NEW (rtac @{thm conjI})) |
411 THEN' (TRY o REPEAT_ALL_NEW (rtac @{thm conjI})) |
412 THEN' (K (TRY (FIRSTGOAL ((TRY o hyp_subst_tac) THEN' rtac @{thm refl})))) |
412 THEN' (K (TRY (FIRSTGOAL ((TRY o hyp_subst_tac' ss) THEN' rtac @{thm refl})))) |
413 THEN' (fn i => EVERY (rev (map_index (fn (j, f) => |
413 THEN' (fn i => EVERY (rev (map_index (fn (j, f) => |
414 REPEAT_DETERM (etac @{thm IntE} (i + j)) THEN tac2_of_formula ss f (i + j)) (strip_Int fm)))) |
414 REPEAT_DETERM (etac @{thm IntE} (i + j)) THEN tac2_of_formula ss f (i + j)) (strip_Int fm)))) |
415 in |
415 in |
416 rtac @{thm subset_antisym} THEN' subset_tac1 THEN' subset_tac2 |
416 rtac @{thm subset_antisym} THEN' subset_tac1 THEN' subset_tac2 |
417 end; |
417 end; |