diff -r b87b14e885af -r 43f5dfb7fa35 src/HOL/Wellfounded.thy --- a/src/HOL/Wellfounded.thy Fri Jul 15 09:18:21 2022 +0200 +++ b/src/HOL/Wellfounded.thy Fri Jul 22 14:39:56 2022 +0200 @@ -257,8 +257,10 @@ then obtain z where "z \ Q" "(z, y) \ r\<^sup>*" "\z'. (z', z) \ r \ z' \ Q \ (z', y) \ r\<^sup>*" using R' [of "{z \ Q. (z,y) \ r\<^sup>*}"] by auto - with R show ?thesis - by (rule_tac x="z" in bexI) (blast intro: rtrancl_trans) + then have "\y'. (y', z) \ insert (y, x) r \ y' \ Q" + using R by(blast intro: rtrancl_trans)+ + then show ?thesis + by (rule bexI) fact next case False then show ?thesis @@ -293,7 +295,7 @@ thus ?thesis using inj unfolding A_def by (intro bexI[of _ "f a0"]) auto - qed (insert \b \ B\, unfold A_def, auto) + qed (use \b \ B\ in \unfold A_def, auto\) qed lemma wf_map_prod_image: "wf r \ inj f \ wf (map_prod f f ` r)" @@ -581,11 +583,13 @@ unfolding less_eq rtrancl_eq_or_trancl by auto lemma wf_pred_nat: "wf pred_nat" - apply (unfold wf_def pred_nat_def) - apply clarify - apply (induct_tac x) - apply blast+ - done + unfolding wf_def +proof clarify + fix P x + assume "\x'. (\y. (y, x') \ pred_nat \ P y) \ P x'" + then show "P x" + unfolding pred_nat_def by (induction x) blast+ +qed lemma wf_less_than [iff]: "wf less_than" by (simp add: less_than_def wf_pred_nat [THEN wf_trancl]) @@ -673,10 +677,12 @@ by (blast dest: accp_downwards_aux) theorem accp_wfPI: "\x. accp r x \ wfP r" - apply (rule wfPUNIVI) - apply (rule_tac P = P in accp_induct) - apply blast+ - done +proof (rule wfPUNIVI) + fix P x + assume "\x. accp r x" "\x. (\y. r y x \ P y) \ P x" + then show "P x" + using accp_induct[where P = P] by blast +qed theorem accp_wfPD: "wfP r \ accp r x" apply (erule wfP_induct_rule) @@ -750,15 +756,20 @@ fixes f :: "'a \ 'b" assumes "wf r" shows "wf (inv_image r f)" -proof (clarsimp simp: inv_image_def wf_eq_minimal) - fix P and x::'a - assume "x \ P" - then obtain w where w: "w \ {w. \x::'a. x \ P \ f x = w}" - by auto - have *: "\Q u. u \ Q \ \z\Q. \y. (y, z) \ r \ y \ Q" - using assms by (auto simp add: wf_eq_minimal) - show "\z\P. \y. (f y, f z) \ r \ y \ P" - using * [OF w] by auto +proof - + have "\x P. x \ P \ \z\P. \y. (f y, f z) \ r \ y \ P" + proof - + fix P and x::'a + assume "x \ P" + then obtain w where w: "w \ {w. \x::'a. x \ P \ f x = w}" + by auto + have *: "\Q u. u \ Q \ \z\Q. \y. (y, z) \ r \ y \ Q" + using assms by (auto simp add: wf_eq_minimal) + show "\z\P. \y. (f y, f z) \ r \ y \ P" + using * [OF w] by auto + qed + then show ?thesis + by (clarsimp simp: inv_image_def wf_eq_minimal) qed text \Measure functions into \<^typ>\nat\\ @@ -901,7 +912,7 @@ next case False from * finites have N2: "(?N2, M) \ max_ext r" - by (rule_tac max_extI[OF _ _ \M \ {}\]) auto + using max_extI[OF _ _ \M \ {}\, where ?X = ?N2] by auto with \M \ ?W\ show "?N2 \ ?W" by (rule acc_downward) qed with finites have "?N1 \ ?N2 \ ?W"