diff -r 43c2355648d2 -r f2b783abfbe7 src/HOL/Fun.thy --- a/src/HOL/Fun.thy Wed Jan 22 19:17:59 2020 +0000 +++ b/src/HOL/Fun.thy Mon Jan 27 14:32:43 2020 +0000 @@ -283,15 +283,22 @@ from this A \x = f x'\ B show ?thesis .. qed +lemma linorder_inj_onI: + fixes A :: "'a::order set" + assumes ne: "\x y. \x < y; x\A; y\A\ \ f x \ f y" and lin: "\x y. \x\A; y\A\ \ x\y \ y\x" + shows "inj_on f A" +proof (rule inj_onI) + fix x y + assume eq: "f x = f y" and "x\A" "y\A" + then show "x = y" + using lin [of x y] ne by (force simp: dual_order.order_iff_strict) +qed + lemma linorder_injI: assumes "\x y::'a::linorder. x < y \ f x \ f y" shows "inj f" - \ \Courtesy of Stephan Merz\ -proof (rule inj_onI) - show "x = y" if "f x = f y" for x y - by (rule linorder_cases) (auto dest: assms simp: that) -qed - + \ \Courtesy of Stephan Merz\ +using assms by (auto intro: linorder_inj_onI linear) lemma inj_on_image_Pow: "inj_on f A \inj_on (image f) (Pow A)" unfolding Pow_def inj_on_def by blast