# HG changeset patch # User blanchet # Date 1261059747 -3600 # Node ID 7aac4d74bb76664535cd951c4bfdd5cd199609ec # Parent c4628a1dcf75e4059b94c656d444c5d33118054c# Parent 87cbdecaa87958281c6f2a0b79a9c03449b509a7 merged diff -r c4628a1dcf75 -r 7aac4d74bb76 Admin/user-aliases --- a/Admin/user-aliases Thu Dec 17 15:22:11 2009 +0100 +++ b/Admin/user-aliases Thu Dec 17 15:22:27 2009 +0100 @@ -1,5 +1,6 @@ lcp paulson norbert.schirmer@web.de schirmer +schirmer@in.tum.de schirmer urbanc@in.tum.de urbanc nipkow@lapbroy100.local nipkow chaieb@chaieb-laptop chaieb diff -r c4628a1dcf75 -r 7aac4d74bb76 src/HOL/Boogie/Examples/Boogie_Max_Stepwise.thy --- a/src/HOL/Boogie/Examples/Boogie_Max_Stepwise.thy Thu Dec 17 15:22:11 2009 +0100 +++ b/src/HOL/Boogie/Examples/Boogie_Max_Stepwise.thy Thu Dec 17 15:22:27 2009 +0100 @@ -50,7 +50,7 @@ text {* Let's find out which assertions of @{text max} are hard to prove: *} boogie_status (narrow timeout: 4) max - (try: (simp add: labels, (fast | blast)?)) + (try: (simp add: labels, (fast | metis)?)) -- {* The argument @{text timeout} is optional, restricting the runtime of each narrowing step by the given number of seconds. *} -- {* The tag @{text try} expects a method to be applied at each narrowing diff -r c4628a1dcf75 -r 7aac4d74bb76 src/HOL/Fun.thy --- a/src/HOL/Fun.thy Thu Dec 17 15:22:11 2009 +0100 +++ b/src/HOL/Fun.thy Thu Dec 17 15:22:27 2009 +0100 @@ -458,7 +458,7 @@ where "swap a b f = f (a := f b, b:= f a)" -lemma swap_self: "swap a a f = f" +lemma swap_self [simp]: "swap a a f = f" by (simp add: swap_def) lemma swap_commute: "swap a b f = swap b a f" @@ -467,6 +467,9 @@ lemma swap_nilpotent [simp]: "swap a b (swap a b f) = f" by (rule ext, simp add: fun_upd_def swap_def) +lemma comp_swap: "f \ swap a b g = swap a b (f \ g)" +by (rule ext, simp add: fun_upd_def swap_def) + lemma inj_on_imp_inj_on_swap: "[|inj_on f A; a \ A; b \ A|] ==> inj_on (swap a b f) A" by (simp add: inj_on_def swap_def, blast) diff -r c4628a1dcf75 -r 7aac4d74bb76 src/HOL/Library/Permutations.thy --- a/src/HOL/Library/Permutations.thy Thu Dec 17 15:22:11 2009 +0100 +++ b/src/HOL/Library/Permutations.thy Thu Dec 17 15:22:27 2009 +0100 @@ -15,7 +15,6 @@ (* Transpositions. *) (* ------------------------------------------------------------------------- *) -declare swap_self[simp] lemma swapid_sym: "Fun.swap a b id = Fun.swap b a id" by (auto simp add: expand_fun_eq swap_def fun_upd_def) lemma swap_id_refl: "Fun.swap a a id = id" by simp diff -r c4628a1dcf75 -r 7aac4d74bb76 src/HOL/Multivariate_Analysis/Derivative.thy --- a/src/HOL/Multivariate_Analysis/Derivative.thy Thu Dec 17 15:22:11 2009 +0100 +++ b/src/HOL/Multivariate_Analysis/Derivative.thy Thu Dec 17 15:22:27 2009 +0100 @@ -208,13 +208,14 @@ have *:"\x. x - vec 0 = (x::real^'n)" by auto have **:"\d x. d * (c x $ k - (c (netlimit net) $ k + c' (x - netlimit net) $ k)) = (d *\<^sub>R (c x - (c (netlimit net) + c' (x - netlimit net) ))) $k" by(auto simp add:field_simps) fix e assume "\ trivial_limit net" "0 < (e::real)" - then obtain A where A:"A\Rep_net net" "\x\A. dist ((1 / norm (x - netlimit net)) *\<^sub>R (c x - (c (netlimit net) + c' (x - netlimit net)))) 0 < e" - using assms[unfolded has_derivative_def Lim] unfolding eventually_def by auto - show "eventually (\x. dist (1 / norm (x - netlimit net) * (c x $ k - (c (netlimit net) $ k + c' (x - netlimit net) $ k))) 0 < e) net" - unfolding eventually_def apply(rule_tac x=A in bexI) apply rule proof- - case goal1 thus ?case apply -apply(drule A(2)[rule_format]) unfolding vector_dist_norm vec1_vec apply(rule le_less_trans) prefer 2 apply assumption unfolding * ** and norm_vec1[unfolded vec1_vec] - using component_le_norm[of "(1 / norm (x - netlimit net)) *\<^sub>R (c x - (c (netlimit net) + c' (x - netlimit net))) - 0" k] by auto - qed(insert A, auto) qed(insert assms[unfolded has_derivative_def], auto simp add:linear_conv_bounded_linear) qed + then have "eventually (\x. dist ((1 / norm (x - netlimit net)) *\<^sub>R (c x - (c (netlimit net) + c' (x - netlimit net)))) 0 < e) net" + using assms[unfolded has_derivative_def Lim] by auto + thus "eventually (\x. dist (1 / norm (x - netlimit net) * (c x $ k - (c (netlimit net) $ k + c' (x - netlimit net) $ k))) 0 < e) net" + proof (rule eventually_elim1) + case goal1 thus ?case apply - unfolding vector_dist_norm vec1_vec apply(rule le_less_trans) prefer 2 apply assumption unfolding * ** and norm_vec1[unfolded vec1_vec] + using component_le_norm[of "(1 / norm (x - netlimit net)) *\<^sub>R (c x - (c (netlimit net) + c' (x - netlimit net))) - 0" k] by auto + qed + qed(insert assms[unfolded has_derivative_def], auto simp add:linear_conv_bounded_linear) qed lemma has_derivative_vmul_within: fixes c::"real \ real" and v::"real^'a::finite" assumes "(c has_derivative c') (at x within s)" diff -r c4628a1dcf75 -r 7aac4d74bb76 src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Dec 17 15:22:11 2009 +0100 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Dec 17 15:22:27 2009 +0100 @@ -383,14 +383,15 @@ ~(e2 = {}))" unfolding connected_def openin_open by (safe, blast+) -lemma exists_diff: "(\S. P(UNIV - S)) \ (\S. P S)" (is "?lhs \ ?rhs") +lemma exists_diff: + fixes P :: "'a set \ bool" + shows "(\S. P(- S)) \ (\S. P S)" (is "?lhs \ ?rhs") proof- - {assume "?lhs" hence ?rhs by blast } moreover {fix S assume H: "P S" - have "S = UNIV - (UNIV - S)" by auto - with H have "P (UNIV - (UNIV - S))" by metis } + have "S = - (- S)" by auto + with H have "P (- (- S))" by metis } ultimately show ?thesis by metis qed @@ -398,11 +399,11 @@ (\T. openin (subtopology euclidean S) T \ closedin (subtopology euclidean S) T \ T = {} \ T = S)" (is "?lhs \ ?rhs") proof- - have " \ connected S \ (\e1 e2. open e1 \ open (UNIV - e2) \ S \ e1 \ (UNIV - e2) \ e1 \ (UNIV - e2) \ S = {} \ e1 \ S \ {} \ (UNIV - e2) \ S \ {})" + have " \ connected S \ (\e1 e2. open e1 \ open (- e2) \ S \ e1 \ (- e2) \ e1 \ (- e2) \ S = {} \ e1 \ S \ {} \ (- e2) \ S \ {})" unfolding connected_def openin_open closedin_closed apply (subst exists_diff) by blast - hence th0: "connected S \ \ (\e2 e1. closed e2 \ open e1 \ S \ e1 \ (UNIV - e2) \ e1 \ (UNIV - e2) \ S = {} \ e1 \ S \ {} \ (UNIV - e2) \ S \ {})" - (is " _ \ \ (\e2 e1. ?P e2 e1)") apply (simp add: closed_def Compl_eq_Diff_UNIV) by metis + hence th0: "connected S \ \ (\e2 e1. closed e2 \ open e1 \ S \ e1 \ (- e2) \ e1 \ (- e2) \ S = {} \ e1 \ S \ {} \ (- e2) \ S \ {})" + (is " _ \ \ (\e2 e1. ?P e2 e1)") apply (simp add: closed_def) by metis have th1: "?rhs \ \ (\t' t. closed t'\t = S\t' \ t\{} \ t\S \ (\t'. open t' \ t = S \ t'))" (is "_ \ \ (\t' t. ?Q t' t)") @@ -558,8 +559,8 @@ lemma closed_limpt: "closed S \ (\x. x islimpt S \ x \ S)" unfolding closed_def apply (subst open_subopen) - apply (simp add: islimpt_def subset_eq Compl_eq_Diff_UNIV) - by (metis DiffE DiffI UNIV_I insertCI insert_absorb mem_def) + apply (simp add: islimpt_def subset_eq) + by (metis ComplE ComplI insertCI insert_absorb mem_def) lemma islimpt_EMPTY[simp]: "\ x islimpt {}" unfolding islimpt_def by auto @@ -719,12 +720,12 @@ definition "closure S = S \ {x | x. x islimpt S}" -lemma closure_interior: "closure S = UNIV - interior (UNIV - S)" +lemma closure_interior: "closure S = - interior (- S)" proof- { fix x - have "x\UNIV - interior (UNIV - S) \ x \ closure S" (is "?lhs = ?rhs") + have "x\- interior (- S) \ x \ closure S" (is "?lhs = ?rhs") proof - let ?exT = "\ y. (\T. open T \ y \ T \ T \ UNIV - S)" + let ?exT = "\ y. (\T. open T \ y \ T \ T \ - S)" assume "?lhs" hence *:"\ ?exT x" unfolding interior_def @@ -746,10 +747,10 @@ by blast qed -lemma interior_closure: "interior S = UNIV - (closure (UNIV - S))" +lemma interior_closure: "interior S = - (closure (- S))" proof- { fix x - have "x \ interior S \ x \ UNIV - (closure (UNIV - S))" + have "x \ interior S \ x \ - (closure (- S))" unfolding interior_def closure_def islimpt_def by auto } @@ -759,7 +760,7 @@ lemma closed_closure[simp, intro]: "closed (closure S)" proof- - have "closed (UNIV - interior (UNIV -S))" by blast + have "closed (- interior (-S))" by blast thus ?thesis using closure_interior[of S] by simp qed @@ -844,8 +845,8 @@ lemma open_inter_closure_eq_empty: "open S \ (S \ closure T) = {} \ S \ T = {}" - using open_subset_interior[of S "UNIV - T"] - using interior_subset[of "UNIV - T"] + using open_subset_interior[of S "- T"] + using interior_subset[of "- T"] unfolding closure_interior by auto @@ -873,16 +874,16 @@ by blast qed -lemma closure_complement: "closure(UNIV - S) = UNIV - interior(S)" +lemma closure_complement: "closure(- S) = - interior(S)" proof- - have "S = UNIV - (UNIV - S)" + have "S = - (- S)" by auto thus ?thesis unfolding closure_interior by auto qed -lemma interior_complement: "interior(UNIV - S) = UNIV - closure(S)" +lemma interior_complement: "interior(- S) = - closure(S)" unfolding closure_interior by blast @@ -893,7 +894,7 @@ lemma frontier_closed: "closed(frontier S)" by (simp add: frontier_def closed_Diff) -lemma frontier_closures: "frontier S = (closure S) \ (closure(UNIV - S))" +lemma frontier_closures: "frontier S = (closure S) \ (closure(- S))" by (auto simp add: frontier_def interior_closure) lemma frontier_straddle: @@ -937,10 +938,10 @@ { fix T assume "a \ T" "open T" "a\S" then obtain e where "e>0" and balle: "ball a e \ T" unfolding open_contains_ball using `?rhs` by auto obtain x where "x \ S" "dist a x < e" using `?rhs` using `e>0` by auto - hence "\y\UNIV - S. y \ T \ y \ a" using balle `a\S` unfolding ball_def by (rule_tac x=x in bexI)auto + hence "\y\- S. y \ T \ y \ a" using balle `a\S` unfolding ball_def by (rule_tac x=x in bexI)auto } - hence "a islimpt (UNIV - S) \ a\S" unfolding islimpt_def by auto - ultimately show ?lhs unfolding frontier_closures using closure_def[of "UNIV - S"] by auto + hence "a islimpt (- S) \ a\S" unfolding islimpt_def by auto + ultimately show ?lhs unfolding frontier_closures using closure_def[of "- S"] by auto qed lemma frontier_subset_closed: "closed S \ frontier S \ S" @@ -958,12 +959,12 @@ thus ?thesis using frontier_subset_closed[of S] by auto qed -lemma frontier_complement: "frontier(UNIV - S) = frontier S" +lemma frontier_complement: "frontier(- S) = frontier S" by (auto simp add: frontier_def closure_complement interior_complement) lemma frontier_disjoint_eq: "frontier S \ S = {} \ open S" - using frontier_complement frontier_subset_eq[of "UNIV - S"] - unfolding open_closed Compl_eq_Diff_UNIV by auto + using frontier_complement frontier_subset_eq[of "- S"] + unfolding open_closed by auto subsection{* Common nets and The "within" modifier for nets. *} @@ -2437,7 +2438,7 @@ thus "\N. \m n. N \ m \ N \ n \ dist (s m) (s n) < e" using dist_triangle_half_l[of _ l e _] by (rule_tac x=N in exI) auto qed -lemma cauchy_imp_bounded: assumes "Cauchy s" shows "bounded {y. (\n::nat. y = s n)}" +lemma cauchy_imp_bounded: assumes "Cauchy s" shows "bounded (range s)" proof- from assms obtain N::nat where "\m n. N \ m \ N \ n \ dist (s m) (s n) < 1" unfolding cauchy_def apply(erule_tac x= 1 in allE) by auto hence N:"\n. N \ n \ dist (s N) (s n) < 1" by auto @@ -2448,7 +2449,7 @@ ultimately show "?thesis" unfolding bounded_any_center [where a="s N"] apply(rule_tac x="max a 1" in exI) apply auto - apply(erule_tac x=n in allE) apply(erule_tac x=n in ballE) by auto + apply(erule_tac x=y in allE) apply(erule_tac x=y in ballE) by auto qed lemma compact_imp_complete: assumes "compact s" shows "complete s" @@ -2474,12 +2475,12 @@ instance heine_borel < complete_space proof fix f :: "nat \ 'a" assume "Cauchy f" - hence "bounded (range f)" unfolding image_def - using cauchy_imp_bounded [of f] by auto + hence "bounded (range f)" + by (rule cauchy_imp_bounded) hence "compact (closure (range f))" using bounded_closed_imp_compact [of "closure (range f)"] by auto hence "complete (closure (range f))" - using compact_imp_complete by auto + by (rule compact_imp_complete) moreover have "\n. f n \ closure (range f)" using closure_subset [of "range f"] by auto ultimately have "\l\closure (range f). (f ---> l) sequentially" @@ -2732,10 +2733,10 @@ lemma sequence_infinite_lemma: fixes l :: "'a::metric_space" (* TODO: generalize *) assumes "\n::nat. (f n \ l)" "(f ---> l) sequentially" - shows "infinite {y. (\ n. y = f n)}" -proof(rule ccontr) - let ?A = "(\x. dist x l) ` {y. \n. y = f n}" - assume "\ infinite {y. \n. y = f n}" + shows "infinite (range f)" +proof + let ?A = "(\x. dist x l) ` range f" + assume "finite (range f)" hence **:"finite ?A" "?A \ {}" by auto obtain k where k:"dist (f k) l = Min ?A" using Min_in[OF **] by auto have "0 < Min ?A" using assms(1) unfolding dist_nz unfolding Min_gr_iff[OF **] by auto @@ -2746,7 +2747,7 @@ lemma sequence_unique_limpt: fixes l :: "'a::metric_space" (* TODO: generalize *) - assumes "\n::nat. (f n \ l)" "(f ---> l) sequentially" "l' islimpt {y. (\n. y = f n)}" + assumes "\n::nat. (f n \ l)" "(f ---> l) sequentially" "l' islimpt (range f)" shows "l' = l" proof(rule ccontr) def e \ "dist l' l" @@ -2773,8 +2774,8 @@ case False thus "l\s" using as(1) by auto next case True note cas = this - with as(2) have "infinite {y. \n. y = x n}" using sequence_infinite_lemma[of x l] by auto - then obtain l' where "l'\s" "l' islimpt {y. \n. y = x n}" using assms[THEN spec[where x="{y. \n. y = x n}"]] as(1) by auto + with as(2) have "infinite (range x)" using sequence_infinite_lemma[of x l] by auto + then obtain l' where "l'\s" "l' islimpt (range x)" using assms[THEN spec[where x="range x"]] as(1) by auto thus "l\s" using sequence_unique_limpt[of x l l'] using as cas by auto qed } thus ?thesis unfolding closed_sequential_limits by fast @@ -2957,11 +2958,11 @@ shows "s \ (\ f) \ {}" proof assume as:"s \ (\ f) = {}" - hence "s \ \op - UNIV ` f" by auto - moreover have "Ball (op - UNIV ` f) open" using open_Diff closed_Diff using assms(2) by auto - ultimately obtain f' where f':"f' \ op - UNIV ` f" "finite f'" "s \ \f'" using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="(\t. UNIV - t) ` f"]] by auto - hence "finite (op - UNIV ` f') \ op - UNIV ` f' \ f" by(auto simp add: Diff_Diff_Int) - hence "s \ \op - UNIV ` f' \ {}" using assms(3)[THEN spec[where x="op - UNIV ` f'"]] by auto + hence "s \ \ uminus ` f" by auto + moreover have "Ball (uminus ` f) open" using open_Diff closed_Diff using assms(2) by auto + ultimately obtain f' where f':"f' \ uminus ` f" "finite f'" "s \ \f'" using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="(\t. - t) ` f"]] by auto + hence "finite (uminus ` f') \ uminus ` f' \ f" by(auto simp add: Diff_Diff_Int) + hence "s \ \uminus ` f' \ {}" using assms(3)[THEN spec[where x="uminus ` f'"]] by auto thus False using f'(3) unfolding subset_eq and Union_iff by blast qed @@ -3031,21 +3032,22 @@ text{* Strengthen it to the intersection actually being a singleton. *} lemma decreasing_closed_nest_sing: + fixes s :: "nat \ 'a::heine_borel set" assumes "\n. closed(s n)" "\n. s n \ {}" "\m n. m \ n --> s n \ s m" "\e>0. \n. \x \ (s n). \ y\(s n). dist x y < e" - shows "\a::'a::heine_borel. \ {t. (\n::nat. t = s n)} = {a}" + shows "\a. \(range s) = {a}" proof- obtain a where a:"\n. a \ s n" using decreasing_closed_nest[of s] using assms by auto - { fix b assume b:"b \ \{t. \n. t = s n}" + { fix b assume b:"b \ \(range s)" { fix e::real assume "e>0" hence "dist a b < e" using assms(4 )using b using a by blast } hence "dist a b = 0" by (metis dist_eq_0_iff dist_nz real_less_def) } - with a have "\{t. \n. t = s n} = {a}" by auto - thus ?thesis by auto + with a have "\(range s) = {a}" unfolding image_def by auto + thus ?thesis .. qed text{* Cauchy-type criteria for uniform convergence. *} @@ -4547,6 +4549,11 @@ thus ?thesis using compact_closed_sums[OF compact_sing[of a] assms] by auto qed +lemma translation_Compl: + fixes a :: "'a::ab_group_add" + shows "(\x. a + x) ` (- t) = - ((\x. a + x) ` t)" + apply (auto simp add: image_iff) apply(rule_tac x="x - a" in bexI) by auto + lemma translation_UNIV: fixes a :: "'a::ab_group_add" shows "range (\x. a + x) = UNIV" apply (auto simp add: image_iff) apply(rule_tac x="x - a" in exI) by auto @@ -4560,10 +4567,10 @@ fixes a :: "'a::real_normed_vector" shows "closure ((\x. a + x) ` s) = (\x. a + x) ` (closure s)" proof- - have *:"op + a ` (UNIV - s) = UNIV - op + a ` s" + have *:"op + a ` (- s) = - op + a ` s" apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto - show ?thesis unfolding closure_interior translation_diff translation_UNIV - using interior_translation[of a "UNIV - s"] unfolding * by auto + show ?thesis unfolding closure_interior translation_Compl + using interior_translation[of a "- s"] unfolding * by auto qed lemma frontier_translation: @@ -5162,14 +5169,14 @@ lemma open_halfspace_lt: "open {x. inner a x < b}" proof- - have "UNIV - {x. b \ inner a x} = {x. inner a x < b}" by auto - thus ?thesis using closed_halfspace_ge[unfolded closed_def Compl_eq_Diff_UNIV, of b a] by auto + have "- {x. b \ inner a x} = {x. inner a x < b}" by auto + thus ?thesis using closed_halfspace_ge[unfolded closed_def, of b a] by auto qed lemma open_halfspace_gt: "open {x. inner a x > b}" proof- - have "UNIV - {x. b \ inner a x} = {x. inner a x > b}" by auto - thus ?thesis using closed_halfspace_le[unfolded closed_def Compl_eq_Diff_UNIV, of a b] by auto + have "- {x. b \ inner a x} = {x. inner a x > b}" by auto + thus ?thesis using closed_halfspace_le[unfolded closed_def, of a b] by auto qed lemma open_halfspace_component_lt: diff -r c4628a1dcf75 -r 7aac4d74bb76 src/Pure/Thy/completion.scala --- a/src/Pure/Thy/completion.scala Thu Dec 17 15:22:11 2009 +0100 +++ b/src/Pure/Thy/completion.scala Thu Dec 17 15:22:27 2009 +0100 @@ -116,13 +116,14 @@ abbrevs_lex.parse(abbrevs_lex.keyword, new Completion.Reverse(line)) match { case abbrevs_lex.Success(rev_a, _) => val (word, c) = abbrevs_map(rev_a) - Some(word, List(c)) + if (word == c) None + else Some(word, List(c)) case _ => Completion.Parse.read(line) match { case Some(word) => - words_lex.completions(word) match { + words_lex.completions(word).map(words_map(_)).filter(_ != word) match { case Nil => None - case cs => Some(word, cs.map(words_map(_)).sort(Completion.length_ord _)) + case cs => Some (word, cs.sort(Completion.length_ord _)) } case None => None } diff -r c4628a1dcf75 -r 7aac4d74bb76 src/Pure/Tools/find_theorems.ML --- a/src/Pure/Tools/find_theorems.ML Thu Dec 17 15:22:11 2009 +0100 +++ b/src/Pure/Tools/find_theorems.ML Thu Dec 17 15:22:27 2009 +0100 @@ -409,7 +409,7 @@ val len = length matches; val lim = the_default (! limit) opt_limit; - in (SOME len, drop (len - lim) matches) end; + in (SOME len, drop (Int.max (len - lim, 0)) matches) end; val find = if rem_dups orelse is_none opt_limit