diff -r d1742d1b7f0f -r 249fa34faba2 src/HOL/Fun.thy --- a/src/HOL/Fun.thy Tue Jul 05 22:47:48 2016 +0200 +++ b/src/HOL/Fun.thy Tue Jul 05 23:39:49 2016 +0200 @@ -21,6 +21,7 @@ lemma b_uniq_choice: "\x\S. \!y. Q x y \ \f. \x\S. Q x (f x)" by (force intro: theI') + subsection \The Identity Function \id\\ definition id :: "'a \ 'a" @@ -283,9 +284,8 @@ shows "inj f" \ \Courtesy of Stephan Merz\ proof (rule inj_onI) - fix x y - assume f_eq: "f x = f y" - show "x = y" by (rule linorder_cases) (auto dest: hyp simp: f_eq) + show "x = y" if "f x = f y" for x y + by (rule linorder_cases) (auto dest: hyp simp: that) qed lemma surj_def: "surj f \ (\y. \x. y = f x)" @@ -427,9 +427,8 @@ by (auto simp add: bij_betw_def) lemma bij_betw_combine: - assumes "bij_betw f A B" "bij_betw f C D" "B \ D = {}" - shows "bij_betw f (A \ C) (B \ D)" - using assms unfolding bij_betw_def inj_on_Un image_Un by auto + "bij_betw f A B \ bij_betw f C D \ B \ D = {} \ bij_betw f (A \ C) (B \ D)" + unfolding bij_betw_def inj_on_Un image_Un by auto lemma bij_betw_subset: "bij_betw f A A' \ B \ A \ f ` B = B' \ bij_betw f B B'" by (auto simp add: bij_betw_def inj_on_def) @@ -531,14 +530,15 @@ and img2: "f' ` A' \ A" shows "bij_betw f A A'" using assms -proof (unfold bij_betw_def inj_on_def, safe) + unfolding bij_betw_def inj_on_def +proof safe fix a b assume *: "a \ A" "b \ A" and **: "f a = f b" have "a = f' (f a) \ b = f'(f b)" using * left by simp with ** show "a = b" by simp next fix a' assume *: "a' \ A'" - hence "f' a' \ A" using img2 by blast + then have "f' a' \ A" using img2 by blast moreover have "a' = f (f' a')" using * right by simp ultimately show "a' \ f ` A" by blast @@ -823,7 +823,7 @@ subsubsection \Proof tools\ -text \Simplify terms of the form f(...,x:=y,...,x:=z,...) to f(...,x:=z,...)\ +text \Simplify terms of the form \f(\,x:=y,\,x:=z,\)\ to \f(\,x:=z,\)\\ simproc_setup fun_upd2 ("f(v := w, x := y)") = \fn _ => let @@ -843,14 +843,14 @@ let val t = Thm.term_of ct in - case find_double t of + (case find_double t of (T, NONE) => NONE | (T, SOME rhs) => SOME (Goal.prove ctxt [] [] (Logic.mk_equals (t, rhs)) (fn _ => resolve_tac ctxt [eq_reflection] 1 THEN resolve_tac ctxt @{thms ext} 1 THEN - simp_tac (put_simpset ss ctxt) 1)) + simp_tac (put_simpset ss ctxt) 1))) end in proc end \