# HG changeset patch # User paulson # Date 1464191228 -3600 # Node ID 427cf3baad1682afec454c8bc91b5faa14fc5aa3 # Parent 1aa23fe79b9761914f68bfb26da701f2ee29260a# Parent 6a767355d1a95009739df725ab9c53df1bb2fd59 Merge diff -r 1aa23fe79b97 -r 427cf3baad16 src/HOL/Library/Disjoint_Sets.thy --- a/src/HOL/Library/Disjoint_Sets.thy Wed May 25 16:39:07 2016 +0100 +++ b/src/HOL/Library/Disjoint_Sets.thy Wed May 25 16:47:08 2016 +0100 @@ -161,7 +161,7 @@ assumes "\finite A" "\x. x \ A \ f x \ {}" "disjoint_family_on f A" shows "\finite (UNION A f)" proof - - def g \ "\x. SOME y. y \ f x" + define g where "g x = (SOME y. y \ f x)" for x have g: "g x \ f x" if "x \ A" for x unfolding g_def by (rule someI_ex, insert assms(2) that) blast have inj_on_g: "inj_on g A" diff -r 1aa23fe79b97 -r 427cf3baad16 src/HOL/Library/Permutations.thy --- a/src/HOL/Library/Permutations.thy Wed May 25 16:39:07 2016 +0100 +++ b/src/HOL/Library/Permutations.thy Wed May 25 16:47:08 2016 +0100 @@ -943,7 +943,8 @@ proof - from mset_eq have [simp]: "length xs = length ys" by (rule mset_eq_length) - def indices_of \ "\(x::'a) xs. {i. i < length xs \ x = xs ! i}" + define indices_of :: "'a \ 'a list \ nat set" + where "indices_of x xs = {i. i < length xs \ x = xs ! i}" for x xs have indices_of_subset: "indices_of x xs \ {..f. \x\set xs. bij_betw (f x) (indices_of x xs) (indices_of x ys)" by (rule bchoice) then guess f .. note f = this - def g \ "\i. if i < n then f (xs ! i) i else i" + define g where "g i = (if i < n then f (xs ! i) i else i)" for i have bij_f: "bij_betw (\i. f (xs ! i) i) (indices_of x xs) (indices_of x ys)" if x: "x \ set xs" for x diff -r 1aa23fe79b97 -r 427cf3baad16 src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Wed May 25 16:39:07 2016 +0100 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Wed May 25 16:47:08 2016 +0100 @@ -11457,7 +11457,7 @@ using span_finite [OF \finite B\] by blast have "\c v. \(\v\C. c v *\<^sub>R v) = 0; v \ C\ \ c v = 0" using independent_explicit \independent C\ by blast - def cc \ "(\x. if x \ B then a x + e x else a x)" + define cc where "cc x = (if x \ B then a x + e x else a x)" for x have [simp]: "C \ B = B" "D \ B = B" "C \ - B = C-D" "B \ (D - C) = {}" using \B \ C\ \B \ D\ Beq by blast+ have f2: "(\v\C \ D. e v *\<^sub>R v) = (\v\D - C. a v *\<^sub>R v)" @@ -11701,7 +11701,7 @@ case (insert a T) have 0: "\x y. \x \ y; x \ S; y \ S\ \ x \ y = 0" using insert by (simp add: pairwise_def orthogonal_def) - def a' \ "a - (\b\S. (b \ a / (b \ b)) *\<^sub>R b)" + define a' where "a' = a - (\b\S. (b \ a / (b \ b)) *\<^sub>R b)" obtain U where orthU: "pairwise orthogonal (S \ insert a' U)" and spanU: "span (insert a' S \ U) = span (insert a' S \ T)" apply (rule exE [OF insert.IH [of "insert a' S"]]) @@ -11875,7 +11875,7 @@ case True then obtain u v where "u \ S" "v \ S" "a \ u \ b" "a \ v > b" using assms by (auto simp: not_le) - def \ \ "u + ((b - a \ u) / (a \ v - a \ u)) *\<^sub>R (v - u)" + define \ where "\ = u + ((b - a \ u) / (a \ v - a \ u)) *\<^sub>R (v - u)" have "\ \ S" by (simp add: \_def \u \ S\ \v \ S\ \affine S\ mem_affine_3_minus) moreover have "a \ \ = b" diff -r 1aa23fe79b97 -r 427cf3baad16 src/HOL/Multivariate_Analysis/Linear_Algebra.thy --- a/src/HOL/Multivariate_Analysis/Linear_Algebra.thy Wed May 25 16:39:07 2016 +0100 +++ b/src/HOL/Multivariate_Analysis/Linear_Algebra.thy Wed May 25 16:47:08 2016 +0100 @@ -978,8 +978,8 @@ using \independent B'\ by (rule independentD_unique[OF _ X(2) X(1)]) (auto intro: X simp: X(3)[symmetric]) - def f' \ "\y. if y \ B then f y else 0" - def g \ "\y. \x|X y x \ 0. X y x *\<^sub>R f' x" + define f' where "f' y = (if y \ B then f y else 0)" for y + define g where "g y = (\x|X y x \ 0. X y x *\<^sub>R f' x)" for y have g_f': "x \ B' \ g x = f' x" for x by (auto simp: g_def X_B') diff -r 1aa23fe79b97 -r 427cf3baad16 src/HOL/Multivariate_Analysis/Polytope.thy --- a/src/HOL/Multivariate_Analysis/Polytope.thy Wed May 25 16:39:07 2016 +0100 +++ b/src/HOL/Multivariate_Analysis/Polytope.thy Wed May 25 16:47:08 2016 +0100 @@ -186,7 +186,7 @@ case True with \b \ T\ show ?thesis by blast next case False - def d \ "b + (e / norm(b - c)) *\<^sub>R (b - c)" + define d where "d = b + (e / norm(b - c)) *\<^sub>R (b - c)" have "d \ cball b e \ affine hull u" using \e > 0\ \b \ u\ \c \ u\ by (simp add: d_def dist_norm hull_inc mem_affine_3_minus False) @@ -299,7 +299,7 @@ obtain u where "(1 - u) *\<^sub>R x + u *\<^sub>R y \ convex hull T" "x \ y" and weq: "w = (1 - u) *\<^sub>R x + u *\<^sub>R y" and u01: "0 < u" "u < 1" using w by (auto simp: open_segment_image_interval split: if_split_asm) - def c \ "\i. (1 - u) * a i + u * b i" + define c where "c i = (1 - u) * a i + u * b i" for i have cge0: "\i. i \ S \ 0 \ c i" using a b u01 by (simp add: c_def) have sumc1: "setsum c S = 1" @@ -325,7 +325,7 @@ done next case False - def k \ "setsum c (S - T)" + define k where "k = setsum c (S - T)" have "k > 0" using False unfolding k_def by (metis DiffD1 antisym_conv cge0 setsum_nonneg not_less) have weq_sumsum: "w = setsum (\x. c x *\<^sub>R x) T + setsum (\x. c x *\<^sub>R x) (S - T)" @@ -431,7 +431,7 @@ then obtain c where c: "\F'. \finite F'; F' \ T; card F' \ DIM('a) + 2\ \ c F' \ T \ c F' \ (\F') \ (\F')" by metis - def d \ "rec_nat {c{}} (\n r. insert (c r) r)" + define d where "d = rec_nat {c{}} (\n r. insert (c r) r)" have [simp]: "d 0 = {c {}}" by (simp add: d_def) have dSuc [simp]: "\n. d (Suc n) = insert (c (d n)) (d n)" @@ -1047,7 +1047,7 @@ then obtain m where "m \ S" and m: "\y. y \ S \ a \ m \ a \ y" using continuous_attains_inf [of S "\x. a \ x"] \compact S\ \u \ S\ by auto - def T \ "S \ {x. a \ x = a \ m}" + define T where "T = S \ {x. a \ x = a \ m}" have "m \ T" by (simp add: T_def \m \ S\) moreover have "compact T" @@ -1560,7 +1560,7 @@ using x by (auto simp: mem_rel_interior_ball) then have ins: "\y. \norm (x - y) < e; y \ affine hull S\ \ y \ S" by (metis IntI subsetD dist_norm mem_ball) - def \ \ "min (1/2) (e / 2 / norm(z - x))" + define \ where "\ = min (1/2) (e / 2 / norm(z - x))" have "norm (\ *\<^sub>R x - \ *\<^sub>R z) = norm (\ *\<^sub>R (x - z))" by (simp add: \_def algebra_simps norm_mult) also have "... = \ * norm (x - z)" @@ -1679,7 +1679,7 @@ (\x \ affine hull S. (x + a) \ affine hull S)" (is "?Q f0") by (force simp: polyhedron_Int_affine_parallel) - def n \ "LEAST n. \F. card F = n \ finite F \ ?P F \ ?Q F" + define n where "n = (LEAST n. \F. card F = n \ finite F \ ?P F \ ?Q F)" have nf: "\F. card F = n \ finite F \ ?P F \ ?Q F" apply (simp add: n_def) apply (rule LeastI [where k = "card f0"]) @@ -1755,8 +1755,8 @@ using faceq that by blast also have "... < a h \ z" using \z \ h\ faceq [OF that] xint by auto finally have xltz: "a h \ x < a h \ z" . - def l \ "(b h - a h \ x) / (a h \ z - a h \ x)" - def w \ "(1 - l) *\<^sub>R x + l *\<^sub>R z" + define l where "l = (b h - a h \ x) / (a h \ z - a h \ x)" + define w where "w = (1 - l) *\<^sub>R x + l *\<^sub>R z" have "0 < l" "l < 1" using able xltz \b h < a h \ z\ \h \ F\ by (auto simp: l_def divide_simps) @@ -1808,9 +1808,11 @@ next case False then obtain h' where h': "h' \ F - {h}" by auto - def inff \ "INF j:F - {h}. if 0 < a j \ y - a j \ w - then (b j - a j \ w) / (a j \ y - a j \ w) - else 1" + define inff where "inff = + (INF j:F - {h}. + if 0 < a j \ y - a j \ w + then (b j - a j \ w) / (a j \ y - a j \ w) + else 1)" have "0 < inff" apply (simp add: inff_def) apply (rule finite_imp_less_Inf) @@ -1843,7 +1845,7 @@ ultimately show ?thesis by (blast intro: that) qed - def c \ "(1 - T) *\<^sub>R w + T *\<^sub>R y" + define c where "c = (1 - T) *\<^sub>R w + T *\<^sub>R y" have "(1 - T) *\<^sub>R w + T *\<^sub>R y \ j" if "j \ F" for j proof (cases "j = h") case True @@ -2313,18 +2315,18 @@ case True then show ?thesis by auto next case False - def F \ "{h. h exposed_face_of S \ h \ {} \ h \ S}" + define F where "F = {h. h exposed_face_of S \ h \ {} \ h \ S}" have "finite F" by (simp add: fin F_def) have hface: "h face_of S" - and "\a b. a \ 0 \ S \ {x. a \ x \ b} \ h = S \ {x. a \ x = b}" - if "h \ F" for h + and "\a b. a \ 0 \ S \ {x. a \ x \ b} \ h = S \ {x. a \ x = b}" + if "h \ F" for h using exposed_face_of F_def that by simp_all auto then obtain a b where ab: "\h. h \ F \ a h \ 0 \ S \ {x. a h \ x \ b h} \ h = S \ {x. a h \ x = b h}" by metis have *: "False" - if paff: "p \ affine hull S" and "p \ S" and - pint: "p \ \{{x. a h \ x \ b h} |h. h \ F}" for p + if paff: "p \ affine hull S" and "p \ S" + and pint: "p \ \{{x. a h \ x \ b h} |h. h \ F}" for p proof - have "rel_interior S \ {}" by (simp add: \S \ {}\ \convex S\ rel_interior_eq_empty)