# HG changeset patch # User Manuel Eberl # Date 1522073656 -7200 # Node ID 655aa11359dc49974c2337880c7f4c15117227e3 # Parent 99eaa5cedbb74e6d12214a579ccff6583a4a2b99 Removed some uses of deprecated _tac methods. (Patch from Viorel Preoteasa) diff -r 99eaa5cedbb7 -r 655aa11359dc src/HOL/Enum.thy --- a/src/HOL/Enum.thy Mon Mar 26 16:12:55 2018 +0200 +++ b/src/HOL/Enum.thy Mon Mar 26 16:14:16 2018 +0200 @@ -795,18 +795,29 @@ proof fix x A show "x \ A \ \A \ x" - by (cut_tac A = A and a = x in Inf_finite_insert, simp add: insert_absorb inf.absorb_iff2) + by (metis Set.set_insert abel_semigroup.commute local.Inf_finite_insert local.inf.abel_semigroup_axioms local.inf.left_idem local.inf.orderI) show "x \ A \ x \ \A" - by (cut_tac A = A and a = x in Sup_finite_insert, simp add: insert_absorb sup.absorb_iff2) + by (metis Set.set_insert insert_absorb2 local.Sup_finite_insert local.sup.absorb_iff2) next fix A z - show "(\x. x \ A \ z \ x) \ z \ \A" - apply (cut_tac F = A and P = "\ A . (\ x. x \ A \ z \ x) \ z \ \A" in finite_induct, simp_all add: Inf_finite_empty Inf_finite_insert) - by(cut_tac A = UNIV and a = z in Sup_finite_insert, simp add: insert_UNIV local.sup.absorb_iff2) + have "\ UNIV = z \ \UNIV" + by (subst Sup_finite_insert [symmetric], simp add: insert_UNIV) + from this have [simp]: "z \ \UNIV" + using local.le_iff_sup by auto + have "(\ x. x \ A \ z \ x) \ z \ \A" + apply (rule finite_induct [of A "\ A . (\ x. x \ A \ z \ x) \ z \ \A"]) + by (simp_all add: Inf_finite_empty Inf_finite_insert) + from this show "(\x. x \ A \ z \ x) \ z \ \A" + by simp - show " (\x. x \ A \ x \ z) \ \A \ z" - apply (cut_tac F = A and P = "\ A . (\ x. x \ A \ x \ z) \ \A \ z" in finite_induct, simp_all add: Sup_finite_empty Sup_finite_insert) - by(cut_tac A = UNIV and a = z in Inf_finite_insert, simp add: insert_UNIV local.inf.absorb_iff2) + have "\ UNIV = z \ \UNIV" + by (subst Inf_finite_insert [symmetric], simp add: insert_UNIV) + from this have [simp]: "\UNIV \ z" + by (simp add: local.inf.absorb_iff2) + have "(\ x. x \ A \ x \ z) \ \A \ z" + by (rule finite_induct [of A "\ A . (\ x. x \ A \ x \ z) \ \A \ z" ], simp_all add: Sup_finite_empty Sup_finite_insert) + from this show " (\x. x \ A \ x \ z) \ \A \ z" + by blast next show "\{} = \" by (simp add: Inf_finite_empty top_finite_def) @@ -818,40 +829,38 @@ class finite_distrib_lattice = finite_lattice + distrib_lattice begin lemma finite_inf_Sup: "a \ (Sup A) = Sup {a \ b | b . b \ A}" -proof (cut_tac F = A and P = "\ A . a \ (Sup A) = Sup {a \ b | b . b \ A}" in finite_induct, simp_all) +proof (rule finite_induct [of A "\ A . a \ (Sup A) = Sup {a \ b | b . b \ A}"], simp_all) fix x::"'a" fix F assume "x \ F" - assume A: "a \ \F = \{a \ b |b. b \ F}" - + assume [simp]: "a \ \F = \{a \ b |b. b \ F}" have [simp]: " insert (a \ x) {a \ b |b. b \ F} = {a \ b |b. b = x \ b \ F}" - by auto - + by blast have "a \ (x \ \F) = a \ x \ a \ \F" by (simp add: inf_sup_distrib1) also have "... = a \ x \ \{a \ b |b. b \ F}" - by (simp add: A) + by simp also have "... = \{a \ b |b. b = x \ b \ F}" by (unfold Sup_insert[THEN sym], simp) - finally show "a \ (x \ \F) = \{a \ b |b. b = x \ b \ F}" by simp qed lemma finite_Inf_Sup: "INFIMUM A Sup \ SUPREMUM {f ` A |f. \Y\A. f Y \ Y} Inf" -proof (cut_tac F = A and P = "\ A .INFIMUM A Sup \ SUPREMUM {f ` A |f. \Y\A. f Y \ Y} Inf" in finite_induct, simp_all add: finite_UnionD) +proof (rule finite_induct [of A "\ A .INFIMUM A Sup \ SUPREMUM {f ` A |f. \Y\A. f Y \ Y} Inf"], simp_all add: finite_UnionD) fix x::"'a set" fix F assume "x \ F" - have [simp]: "{\x \ b |b . b \ Inf ` {f ` F |f. \Y\F. f Y \ Y} } = {\x \ (Inf (f ` F)) |f . (\Y\F. f Y \ Y)}" - by auto - have [simp]:" \f b. \Y\F. f Y \ Y \ b \ x \ \fa. insert b (f ` (F \ {Y. Y \ x})) = insert (fa x) (fa ` F) \ fa x \ x \ (\Y\F. fa Y \ Y)" - apply (rule_tac x = "(\ Y . (if Y = x then b else f Y))" in exI) + have [simp]: "{\x \ b |b . b \ Inf ` {f ` F |f. \Y\F. f Y \ Y} } = {\x \ (Inf (f ` F)) |f . (\Y\F. f Y \ Y)}" by auto - have [simp]: "\f b. \Y\F. f Y \ Y \ b \ x \ (\x\F. f x) \ b \ SUPREMUM {insert (f x) (f ` F) |f. f x \ x \ (\Y\F. f Y \ Y)} Inf" - apply (rule_tac i = "(\ Y . (if Y = x then b else f Y)) ` ({x} \ F)" in SUP_upper2, simp) - apply (subst inf_commute) - by (simp add: INF_greatest Inf_lower inf.coboundedI2) + define fa where "fa = (\ (b::'a) f Y . (if Y = x then b else f Y))" + have "\f b. \Y\F. f Y \ Y \ b \ x \ insert b (f ` (F \ {Y. Y \ x})) = insert (fa b f x) (fa b f ` F) \ fa b f x \ x \ (\Y\F. fa b f Y \ Y)" + by (auto simp add: fa_def) + from this have B: "\f b. \Y\F. f Y \ Y \ b \ x \ fa b f ` ({x} \ F) \ {insert (f x) (f ` F) |f. f x \ x \ (\Y\F. f Y \ Y)}" + by blast + have [simp]: "\f b. \Y\F. f Y \ Y \ b \ x \ b \ (\x\F. f x) \ SUPREMUM {insert (f x) (f ` F) |f. f x \ x \ (\Y\F. f Y \ Y)} Inf" + using B apply (rule SUP_upper2, simp_all) + by (simp_all add: INF_greatest Inf_lower inf.coboundedI2 fa_def) assume "INFIMUM F Sup \ SUPREMUM {f ` F |f. \Y\F. f Y \ Y} Inf" @@ -866,7 +875,8 @@ by (simp add: finite_inf_Sup) also have "... \ SUPREMUM {insert (f x) (f ` F) |f. f x \ x \ (\Y\F. f Y \ Y)} Inf" - by (rule Sup_least, clarsimp, rule Sup_least, clarsimp) + apply (rule Sup_least, clarsimp)+ + by (subst inf_commute, simp) finally show "\x \ INFIMUM F Sup \ SUPREMUM {insert (f x) (f ` F) |f. f x \ x \ (\Y\F. f Y \ Y)} Inf" by simp diff -r 99eaa5cedbb7 -r 655aa11359dc src/HOL/Hilbert_Choice.thy --- a/src/HOL/Hilbert_Choice.thy Mon Mar 26 16:12:55 2018 +0200 +++ b/src/HOL/Hilbert_Choice.thy Mon Mar 26 16:14:16 2018 +0200 @@ -815,7 +815,7 @@ using Inf_lower2 Sup_upper by auto next show "INFIMUM {f ` A |f. \Y\A. f Y \ Y} Sup \ SUPREMUM A Inf" - proof (simp add: Inf_Sup, rule_tac SUP_least, simp, safe) + proof (simp add: Inf_Sup, rule SUP_least, simp, safe) fix f assume "\Y. (\f. Y = f ` A \ (\Y\A. f Y \ Y)) \ f Y \ Y" from this have B: "\ F . (\ Y \ A . F Y \ Y) \ \ Z \ A . f (F ` A) = F Z" @@ -828,7 +828,7 @@ have B: "... \ SUPREMUM A Inf" by (simp add: SUP_upper) from A and B show ?thesis - by (drule_tac order_trans, simp_all) + by simp next case False from this have X: "\ Z . Z \ A \ \ x . x \ Z \ \ INFIMUM {f ` A |f. \Y\A. f Y \ Y} f \ x" @@ -842,8 +842,9 @@ by blast from E and D have W: "\ INFIMUM {f ` A |f. \Y\A. f Y \ Y} f \ F Z" by simp - from C have "INFIMUM {f ` A |f. \Y\A. f Y \ Y} f \ f (F ` A)" - by (rule_tac INF_lower, blast) + have "INFIMUM {f ` A |f. \Y\A. f Y \ Y} f \ f (F ` A)" + apply (rule INF_lower) + using C by blast from this and W and Y show ?thesis by simp qed @@ -859,12 +860,13 @@ lemma sup_Inf: "a \ Inf B = (INF b:B. a \ b)" proof (rule antisym) show "a \ Inf B \ (INF b:B. a \ b)" - using Inf_lower sup.mono by (rule_tac INF_greatest, fastforce) + apply (rule INF_greatest) + using Inf_lower sup.mono by fastforce next have "(INF b:B. a \ b) \ INFIMUM {{f {a}, f B} |f. f {a} = a \ f B \ B} Sup" by (rule INF_greatest, auto simp add: INF_lower) - also have "... = a \ Inf B" - by (cut_tac A = "{{a}, B}" in Sup_Inf, simp) + also have "... = SUPREMUM {{a}, B} Inf" + by (unfold Sup_Inf, simp) finally show "(INF b:B. a \ b) \ a \ Inf B" by simp qed @@ -879,7 +881,7 @@ by (rule SUP_least, rule INF_greatest, rule SUP_upper2, simp_all, rule INF_lower2, simp, blast) next have "(INF y. SUP x. ((P x y))) \ Inf (Sup ` {{P x y | x . True} | y . True })" (is "?A \ ?B") - proof (rule_tac INF_greatest, clarsimp) + proof (rule INF_greatest, clarsimp) fix y have "?A \ (SUP x. P x y)" by (rule INF_lower, simp) @@ -889,7 +891,7 @@ by simp qed also have "... \ (SUP x. INF y. P (x y) y)" - proof (subst Inf_Sup, rule_tac SUP_least, clarsimp) + proof (subst Inf_Sup, rule SUP_least, clarsimp) fix f assume A: "\Y. (\y. Y = {uu. \x. uu = P x y}) \ f Y \ Y" @@ -897,9 +899,10 @@ proof (rule INF_greatest, clarsimp) fix y have "(INF x:{uu. \y. uu = {uu. \x. uu = P x y}}. f x) \ f {uu. \x. uu = P x y}" - by (rule_tac INF_lower, blast) + by (rule INF_lower, blast) also have "... \ P (SOME x. f {uu . \x. uu = P x y} = P x y) y" - using A by (rule_tac someI2_ex, auto) + apply (rule someI2_ex) + using A by auto finally show "(INF x:{uu. \y. uu = {uu. \x. uu = P x y}}. f x) \ P (SOME x. f {uu . \x. uu = P x y} = P x y) y" by simp qed @@ -914,8 +917,12 @@ lemma INF_SUP_set: "(INF x:A. SUP a:x. (g a)) = (SUP x:{f ` A |f. \Y\A. f Y \ Y}. INF a:x. g a)" proof (rule antisym) + have [simp]: "\f xa. \Y\A. f Y \ Y \ xa \ A \ (\x\A. g (f x)) \ g (f xa)" + by (rule INF_lower2, blast+) + have B: "\f xa. \Y\A. f Y \ Y \ xa \ A \ f xa \ xa" + by blast have A: "\f xa. \Y\A. f Y \ Y \ xa \ A \ (\x\A. g (f x)) \ SUPREMUM xa g" - by (rule_tac i = "(f xa)" in SUP_upper2, simp, rule_tac i = "xa" in INF_lower2, simp_all) + by (rule SUP_upper2, rule B, simp_all, simp) show "(\x\{f ` A |f. \Y\A. f Y \ Y}. \a\x. g a) \ (\x\A. \a\x. g a)" apply (rule SUP_least, simp, safe, rule INF_greatest, simp) by (rule A) @@ -924,22 +931,38 @@ proof (cases "{} \ A") case True then show ?thesis - by (rule_tac i = "{}" in INF_lower2, simp_all) + by (rule INF_lower2, simp_all) next case False have [simp]: "\x xa xb. xb \ A \ x xb \ xb \ (\xa. if xa \ A then if x xa \ xa then g (x xa) else \ else \) \ g (x xb)" - by (rule_tac i = xb in INF_lower2, simp_all) + by (rule INF_lower2, auto) have [simp]: " \x xa y. y \ A \ x y \ y \ (\xa. if xa \ A then if x xa \ xa then g (x xa) else \ else \) \ g (SOME x. x \ y)" - by (rule_tac i = y in INF_lower2, simp_all) + by (rule INF_lower2, auto) have [simp]: "\x. (\xa. if xa \ A then if x xa \ xa then g (x xa) else \ else \) \ (\x\{f ` A |f. \Y\A. f Y \ Y}. \x\x. g x)" - apply (rule_tac i = "(\ y . if x y \ y then x y else (SOME x . x \y)) ` A" in SUP_upper2, simp) - apply (rule_tac x = "(\ y . if x y \ y then x y else (SOME x . x \y))" in exI, simp) - using False some_in_eq apply auto[1] - by (rule INF_greatest, auto) - have "\x. (\x\A. \x\x. g x) \ (\xa. if x \ A then if xa \ x then g xa else \ else \)" - apply (case_tac "x \ A") - apply (rule INF_lower2, simp) - by (rule SUP_least, rule SUP_upper2, auto) + proof - + fix x + define F where "F = (\ (y::'b set) . if x y \ y then x y else (SOME x . x \y))" + have B: "(\Y\A. F Y \ Y)" + using False some_in_eq F_def by auto + have A: "F ` A \ {f ` A |f. \Y\A. f Y \ Y}" + using B by blast + show "(\xa. if xa \ A then if x xa \ xa then g (x xa) else \ else \) \ (\x\{f ` A |f. \Y\A. f Y \ Y}. \x\x. g x)" + using A apply (rule SUP_upper2) + by (simp add: F_def, rule INF_greatest, auto) + qed + + {fix x + have "(\x\A. \x\x. g x) \ (\xa. if x \ A then if xa \ x then g xa else \ else \)" + proof (cases "x \ A") + case True + then show ?thesis + apply (rule INF_lower2, simp_all) + by (rule SUP_least, rule SUP_upper2, auto) + next + case False + then show ?thesis by simp + qed + } from this have "(\x\A. \a\x. g a) \ (\x. \xa. if x \ A then if xa \ x then g xa else \ else \)" by (rule INF_greatest) also have "... = (\x. \xa. if xa \ A then if x xa \ xa then g (x xa) else \ else \)" @@ -1020,10 +1043,14 @@ from this have B: " (\xa \ F ` A. x \ xa)" apply (safe, simp add: F_def) by (rule someI2_ex, auto) - + + have C: "(\Y\A. F Y \ Y)" + apply (simp add: F_def, safe) + apply (rule someI2_ex) + using A by auto + have "(\f. F ` A = f ` A \ (\Y\A. f Y \ Y))" - apply (rule_tac x = "F" in exI, simp add: F_def, safe) - using A by (rule_tac someI2_ex, auto) + using C by blast from B and this show "\X. (\f. X = f ` A \ (\Y\A. f Y \ Y)) \ (\xa\X. x \ xa)" by auto @@ -1063,10 +1090,13 @@ define F where "F = (\ Y . SOME k . k \ Y \ z < k)" have D: "\ Y . Y \ A \ z < F Y" - using B by (simp add: F_def, rule_tac someI2_ex, auto) + using B apply (simp add: F_def) + by (rule someI2_ex, auto) + have E: "\ Y . Y \ A \ F Y \ Y" - using B by (simp add: F_def, rule_tac someI2_ex, auto) + using B apply (simp add: F_def) + by (rule someI2_ex, auto) have "z \ Inf (F ` A)" by (simp add: D local.INF_greatest local.order.strict_implies_order) @@ -1093,10 +1123,12 @@ define F where "F = (\ Y . SOME k . k \ Y \ SUPREMUM {f ` A |f. \Y\A. f Y \ Y} Inf < k)" have D: "\ Y . Y \ A \ SUPREMUM {f ` A |f. \Y\A. f Y \ Y} Inf < F Y" - using B by (simp add: F_def, rule_tac someI2_ex, auto) + using B apply (simp add: F_def) + by (rule someI2_ex, auto) have E: "\ Y . Y \ A \ F Y \ Y" - using B by (simp add: F_def, rule_tac someI2_ex, auto) + using B apply (simp add: F_def) + by (rule someI2_ex, auto) have "\ Y . Y \ A \ INFIMUM A Sup \ F Y" using D False local.leI by blast @@ -1112,7 +1144,7 @@ by simp from C and this show ?thesis - using local.not_less by blast + using not_less by blast qed qed end diff -r 99eaa5cedbb7 -r 655aa11359dc src/HOL/Library/Option_ord.thy --- a/src/HOL/Library/Option_ord.thy Mon Mar 26 16:12:55 2018 +0200 +++ b/src/HOL/Library/Option_ord.thy Mon Mar 26 16:14:16 2018 +0200 @@ -287,7 +287,7 @@ proof (cases "{} \ A") case True then show ?thesis - by (rule_tac i = "{}" in INF_lower2, simp_all) + by (rule INF_lower2, simp_all) next case False from this have X: "{} \ A" @@ -296,37 +296,41 @@ proof (cases "{None} \ A") case True then show ?thesis - by (rule_tac i = "{None}" in INF_lower2, simp_all) + by (rule INF_lower2, simp_all) next case False - have "\ y . y\A \ Sup (y - {None}) = Sup y" - by (metis (no_types, lifting) Sup_option_def insert_Diff_single these_insert_None these_not_empty_eq) - + + {fix y + assume A: "y \ A" + have "Sup (y - {None}) = Sup y" + by (metis (no_types, lifting) Sup_option_def insert_Diff_single these_insert_None these_not_empty_eq) + from A and this have "(\z. y - {None} = z - {None} \ z \ A) \ \y = \(y - {None})" + by auto + } from this have A: "Sup ` A = (Sup ` {y - {None} | y. y\A})" - apply (simp add: image_def, simp, safe) - apply (rule_tac x = "xa - {None}" in exI, simp, blast) - by blast + by (auto simp add: image_def) have [simp]: "\y. y \ A \ \ya. {ya. \x. x \ y \ (\y. x = Some y) \ ya = the x} = {y. \x\ya - {None}. y = the x} \ ya \ A" - by (rule_tac x = "y" in exI, auto) + by (rule exI, auto) have [simp]: "\y. y \ A \ (\ya. y - {None} = ya - {None} \ ya \ A) \ \{ya. \x\y - {None}. ya = the x} = \{ya. \x. x \ y \ (\y. x = Some y) \ ya = the x}" - apply safe - apply blast - apply (rule_tac f = Sup in arg_cong) - by auto - - have C: "(\x. (\Option.these x)) ` {y - {None} |y. y \ A} = (Sup ` {the ` (y - {None}) |y. y \ A})" - apply (simp add: image_def Option.these_def, safe) - apply (rule_tac x = "{ya. \x. x \ y - {None} \ (\y. x = Some y) \ ya = the x}" in exI, simp) - by (rule_tac x = "y -{None}" in exI, simp) + apply (safe, blast) + by (rule arg_cong [of _ _ Sup], auto) + {fix y + assume [simp]: "y \ A" + have "\x. (\y. x = {ya. \x\y - {None}. ya = the x} \ y \ A) \ \{ya. \x. x \ y \ (\y. x = Some y) \ ya = the x} = \x" + and "\x. (\y. x = y - {None} \ y \ A) \ \{ya. \x\y - {None}. ya = the x} = \{y. \xa. xa \ x \ (\y. xa = Some y) \ y = the xa}" + apply (rule exI [of _ "{ya. \x. x \ y \ (\y. x = Some y) \ ya = the x}"], simp) + by (rule exI [of _ "y - {None}"], simp) + } + from this have C: "(\x. (\Option.these x)) ` {y - {None} |y. y \ A} = (Sup ` {the ` (y - {None}) |y. y \ A})" + by (simp add: image_def Option.these_def, safe, simp_all) have D: "\ f . \Y\A. f Y \ Y \ False" - apply (drule_tac x = "\ Y . SOME x . x \ Y" in spec, safe) - by (simp add: X some_in_eq) + by (drule spec [of _ "\ Y . SOME x . x \ Y"], simp add: X some_in_eq) define F where "F = (\ Y . SOME x::'a option . x \ (Y - {None}))" @@ -341,12 +345,13 @@ less_eq_option_Some singletonI) from this have "Inf (F ` A) \ None" - by (case_tac "\x\A. F x", simp_all) - + by (cases "\x\A. F x", simp_all) + + from this have "Inf (F ` A) \ None \ Inf (F ` A) \ Inf ` {f ` A |f. \Y\A. f Y \ Y}" + using F by auto + from this have "\ x . x \ None \ x \ Inf ` {f ` A |f. \Y\A. f Y \ Y}" - apply (rule_tac x = "Inf (F ` A)" in exI, simp add: image_def, safe) - apply (rule_tac x = "F ` A" in exI, safe) - using F by auto + by blast from this have E:" Inf ` {f ` A |f. \Y\A. f Y \ Y} = {None} \ False" by blast @@ -358,36 +363,59 @@ have B: "Option.these ((\x. Some (\Option.these x)) ` {y - {None} |y. y \ A}) = ((\x. (\ Option.these x)) ` {y - {None} |y. y \ A})" by (metis image_image these_image_Some_eq) + { + fix f + assume A: "\ Y . (\y. Y = the ` (y - {None}) \ y \ A) \ f Y \ Y" - have [simp]: "\f. \Y. (\y. Y = {ya. \x\y - {None}. ya = the x} \ y \ A) \ f Y \ Y \ - \x. (\f. x = {y. \x\A. y = f x} \ (\Y\A. f Y \ Y)) \ (\x\A. Some (f {y. \x\x - {None}. y = the x})) = \x" - apply (rule_tac x = "{Some (f {y. \a\x - {None}. y = the a}) | x . x\ A}" in exI, safe) - apply (rule_tac x = "(\ Y . Some (f (the ` (Y - {None})))) " in exI, safe) - apply (rule_tac x = xa in bexI, simp add: image_def, simp) - apply (rule_tac x = xa in exI, simp add: image_def) - apply(drule_tac x = "(the ` (Y - {None}))" in spec) - apply (simp add: image_def,safe, simp) - using option.collapse apply fastforce - by (simp add: Setcompr_eq_image) + have "\xa. xa \ A \ f {y. \a\xa - {None}. y = the a} = f (the ` (xa - {None}))" + by (simp add: image_def) + from this have [simp]: "\xa. xa \ A \ \x\A. f {y. \a\xa - {None}. y = the a} = f (the ` (x - {None}))" + by blast + have "\xa. xa \ A \ f (the ` (xa - {None})) = f {y. \a \ xa - {None}. y = the a} \ xa \ A" + by (simp add: image_def) + from this have [simp]: "\xa. xa \ A \ \x. f (the ` (xa - {None})) = f {y. \a\x - {None}. y = the a} \ x \ A" + by blast - have [simp]: "\f. \Y. (\y. Y = {ya. \x\y - {None}. ya = the x} \ y \ A) \ f Y \ Y - \ \y. (\x\A. Some (f {y. \x\x - {None}. y = the x})) = Some y" - by (metis (no_types) Some_INF) + { + fix Y + have "Y \ A \ Some (f (the ` (Y - {None}))) \ Y" + using A [of "the ` (Y - {None})"] apply (simp add: image_def) + using option.collapse by fastforce + } + from this have [simp]: "\ Y . Y \ A \ Some (f (the ` (Y - {None}))) \ Y" + by blast + have [simp]: "(\x\A. Some (f {y. \x\x - {None}. y = the x})) = \{Some (f {y. \a\x - {None}. y = the a}) |x. x \ A}" + by (simp add: Setcompr_eq_image) + + have [simp]: "\x. (\f. x = {y. \x\A. y = f x} \ (\Y\A. f Y \ Y)) \ \{Some (f {y. \a\x - {None}. y = the a}) |x. x \ A} = \x" + apply (rule exI [of _ "{Some (f {y. \a\x - {None}. y = the a}) | x . x\ A}"], safe) + by (rule exI [of _ "(\ Y . Some (f (the ` (Y - {None})))) "], safe, simp_all) - have [simp]: "\ f. - (\x\{the ` (y - {None}) |y. y \ A}. f x) \ the (\Y\A. Some (f (the ` (Y - {None}))))" - apply (simp add: Inf_option_def, safe) - apply (rule Inf_greatest, simp add: image_def Option.these_def, safe) - apply (rule_tac i = " {y. \x\xb - {None}. y = the x}" in INF_lower2) - apply simp_all + { + fix xb + have "xb \ A \ (\x\{{ya. \x\y - {None}. ya = the x} |y. y \ A}. f x) \ f {y. \x\xb - {None}. y = the x}" + apply (rule INF_lower2 [of "{y. \x\xb - {None}. y = the x}"]) + by blast+ + } + from this have [simp]: "(\x\{the ` (y - {None}) |y. y \ A}. f x) \ the (\Y\A. Some (f (the ` (Y - {None}))))" + apply (simp add: Inf_option_def image_def Option.these_def) + by (rule Inf_greatest, clarsimp) + + have [simp]: "the (\Y\A. Some (f (the ` (Y - {None})))) \ Option.these (Inf ` {f ` A |f. \Y\A. f Y \ Y})" + apply (simp add: Option.these_def image_def) + apply (rule exI [of _ "(\x\A. Some (f {y. \x\x - {None}. y = the x}))"], simp) + by (simp add: Inf_option_def) + + have "(\x\{the ` (y - {None}) |y. y \ A}. f x) \ \Option.these (Inf ` {f ` A |f. \Y\A. f Y \ Y})" + by (rule Sup_upper2 [of "the (Inf ((\ Y . Some (f (the ` (Y - {None})) )) ` A))"], simp_all) + } + from this have X: "\ f . \Y. (\y. Y = the ` (y - {None}) \ y \ A) \ f Y \ Y \ + (\x\{the ` (y - {None}) |y. y \ A}. f x) \ \Option.these (Inf ` {f ` A |f. \Y\A. f Y \ Y})" by blast + - have X: "\ f . \Y. (\y. Y = the ` (y - {None}) \ y \ A) \ f Y \ Y - \ (\x\{the ` (y - {None}) |y. y \ A}. f x) \ \Option.these (Inf ` {f ` A |f. \Y\A. f Y \ Y})" - apply (rule_tac u = "the (Inf ((\ Y . Some (f (the ` (Y - {None})) )) ` A))" in Sup_upper2) - apply (simp add: Option.these_def image_def) - apply (rule_tac x = "(\x\A. Some (f {y. \x\x - {None}. y = the x}))" in exI, simp) - by simp + have [simp]: "\ x . x\{y - {None} |y. y \ A} \ x \ {} \ x \ {None}" + using F by fastforce have "(Inf (Sup `A)) = (Inf (Sup ` {y - {None} | y. y\A}))" by (subst A, simp) @@ -396,7 +424,6 @@ by (simp add: Sup_option_def) also have "... = (\x\{y - {None} |y. y \ A}. Some (\Option.these x))" - apply (subgoal_tac "\ x . x\{y - {None} |y. y \ A} \ x \ {} \ x \ {None}", simp) using G by fastforce also have "... = Some (\Option.these ((\x. Some (\Option.these x)) ` {y - {None} |y. y \ A}))" @@ -412,12 +439,18 @@ by (simp add: Inf_Sup) also have "... \ SUPREMUM {f ` A |f. \Y\A. f Y \ Y} Inf" - apply (simp add: less_eq_option_def) - apply (case_tac "\x\{f ` A |f. \Y\A. f Y \ Y}. \x", simp_all) - apply (rule Sup_least, safe) - apply (simp add: Sup_option_def) - apply (case_tac "(\f. \Y\A. f Y \ Y) \ Inf ` {f ` A |f. \Y\A. f Y \ Y} = {None}", simp_all) - by (drule X, simp) + proof (cases "SUPREMUM {f ` A |f. \Y\A. f Y \ Y} Inf") + case None + then show ?thesis by (simp add: less_eq_option_def) + next + case (Some a) + then show ?thesis + apply simp + apply (rule Sup_least, safe) + apply (simp add: Sup_option_def) + apply (cases "(\f. \Y\A. f Y \ Y) \ Inf ` {f ` A |f. \Y\A. f Y \ Y} = {None}", simp_all) + by (drule X, simp) + qed finally show ?thesis by simp qed qed diff -r 99eaa5cedbb7 -r 655aa11359dc src/HOL/Predicate.thy --- a/src/HOL/Predicate.thy Mon Mar 26 16:12:55 2018 +0200 +++ b/src/HOL/Predicate.thy Mon Mar 26 16:14:16 2018 +0200 @@ -110,9 +110,10 @@ define F where "F = (\ x . SOME f . f \ x \ eval f w)" have [simp]: "(\f\ (F ` A). eval f w)" by (metis (no_types, lifting) A F_def image_iff some_eq_ex) - show "\x. (\f. x = f ` A \ (\Y\A. f Y \ Y)) \ (\f\x. eval f w)" - apply (rule_tac x = "F ` A" in exI, simp) - using A by (metis (no_types, lifting) F_def someI)+ + have "(\f. F ` A = f ` A \ (\Y\A. f Y \ Y)) \ (\f\(F ` A). eval f w)" + using A by (simp, metis (no_types, lifting) F_def someI)+ + from this show "\x. (\f. x = f ` A \ (\Y\A. f Y \ Y)) \ (\f\x. eval f w)" + by (rule exI [of _ "F ` A"]) qed qed (auto intro!: pred_eqI)