eliminated old 'def';
authorwenzelm
Mon Apr 25 16:09:26 2016 +0200 (2016-04-25)
changeset 63040eb4ddd18d635
parent 63039 1a20fd9cf281
child 63041 cb495c4807b3
eliminated old 'def';
tuned comments;
src/HOL/Algebra/Ideal.thy
src/HOL/Algebra/QuotRing.thy
src/HOL/BNF_Cardinal_Order_Relation.thy
src/HOL/BNF_Wellorder_Constructions.thy
src/HOL/Binomial.thy
src/HOL/Cardinals/Bounded_Set.thy
src/HOL/Cardinals/Cardinal_Arithmetic.thy
src/HOL/Cardinals/Cardinal_Order_Relation.thy
src/HOL/Cardinals/Ordinal_Arithmetic.thy
src/HOL/Cardinals/Wellorder_Constructions.thy
src/HOL/Cardinals/Wellorder_Extension.thy
src/HOL/Complex.thy
src/HOL/Conditionally_Complete_Lattices.thy
src/HOL/Datatype_Examples/Derivation_Trees/Gram_Lang.thy
src/HOL/Decision_Procs/Approximation.thy
src/HOL/Deriv.thy
src/HOL/Divides.thy
src/HOL/Finite_Set.thy
src/HOL/Groups_Big.thy
src/HOL/HOLCF/Adm.thy
src/HOL/HOLCF/Completion.thy
src/HOL/HOLCF/Representable.thy
src/HOL/HOLCF/Up.thy
src/HOL/Hahn_Banach/Function_Norm.thy
src/HOL/Hahn_Banach/Hahn_Banach.thy
src/HOL/Hahn_Banach/Hahn_Banach_Ext_Lemmas.thy
src/HOL/Hahn_Banach/Hahn_Banach_Sup_Lemmas.thy
src/HOL/Hahn_Banach/Subspace.thy
src/HOL/Hilbert_Choice.thy
src/HOL/Isar_Examples/Schroeder_Bernstein.thy
src/HOL/Library/Complete_Partial_Order2.thy
src/HOL/Library/ContNotDenum.thy
src/HOL/Library/Convex.thy
src/HOL/Library/Countable.thy
src/HOL/Library/Countable_Set_Type.thy
src/HOL/Library/DAList_Multiset.thy
src/HOL/Library/Extended_Real.thy
src/HOL/Library/FSet.thy
src/HOL/Library/Float.thy
src/HOL/Library/Formal_Power_Series.thy
src/HOL/Library/Fun_Lexorder.thy
src/HOL/Library/Function_Growth.thy
src/HOL/Library/More_List.thy
src/HOL/Library/Multiset.thy
src/HOL/Library/Multiset_Order.thy
src/HOL/Library/Omega_Words_Fun.thy
src/HOL/Library/Polynomial.thy
src/HOL/Library/Product_Vector.thy
src/HOL/Library/RBT_Impl.thy
src/HOL/Library/While_Combinator.thy
src/HOL/Lifting_Set.thy
src/HOL/Limits.thy
src/HOL/List.thy
src/HOL/MacLaurin.thy
src/HOL/Metis_Examples/Tarski.thy
src/HOL/MicroJava/Comp/Index.thy
src/HOL/Multivariate_Analysis/Bounded_Linear_Function.thy
src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy
src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy
src/HOL/Multivariate_Analysis/Complex_Transcendental.thy
src/HOL/Multivariate_Analysis/Conformal_Mappings.thy
src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Derivative.thy
src/HOL/Multivariate_Analysis/Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Fashoda.thy
src/HOL/Multivariate_Analysis/Finite_Cartesian_Product.thy
src/HOL/Multivariate_Analysis/Gamma.thy
src/HOL/Multivariate_Analysis/Generalised_Binomial_Theorem.thy
src/HOL/Multivariate_Analysis/Harmonic_Numbers.thy
src/HOL/Multivariate_Analysis/Integration.thy
src/HOL/Multivariate_Analysis/Path_Connected.thy
src/HOL/Multivariate_Analysis/Summation.thy
src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Uniform_Limit.thy
src/HOL/Multivariate_Analysis/Weierstrass.thy
src/HOL/Multivariate_Analysis/ex/Approximations.thy
src/HOL/Nat.thy
src/HOL/Nonstandard_Analysis/HLim.thy
src/HOL/NthRoot.thy
src/HOL/Number_Theory/Eratosthenes.thy
src/HOL/Number_Theory/Euclidean_Algorithm.thy
src/HOL/Number_Theory/Factorial_Ring.thy
src/HOL/Power.thy
src/HOL/Probability/Binary_Product_Measure.thy
src/HOL/Probability/Bochner_Integration.thy
src/HOL/Probability/Borel_Space.thy
src/HOL/Probability/Caratheodory.thy
src/HOL/Probability/Central_Limit_Theorem.thy
src/HOL/Probability/Characteristic_Functions.thy
src/HOL/Probability/Distributions.thy
src/HOL/Probability/Fin_Map.thy
src/HOL/Probability/Finite_Product_Measure.thy
src/HOL/Probability/Giry_Monad.thy
src/HOL/Probability/Helly_Selection.thy
src/HOL/Probability/Independent_Family.thy
src/HOL/Probability/Information.thy
src/HOL/Probability/Interval_Integral.thy
src/HOL/Probability/Lebesgue_Measure.thy
src/HOL/Probability/Measurable.thy
src/HOL/Probability/Measure_Space.thy
src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy
src/HOL/Probability/Probability_Mass_Function.thy
src/HOL/Probability/Probability_Measure.thy
src/HOL/Probability/Projective_Family.thy
src/HOL/Probability/Projective_Limit.thy
src/HOL/Probability/Radon_Nikodym.thy
src/HOL/Probability/Regularity.thy
src/HOL/Probability/Sigma_Algebra.thy
src/HOL/Probability/Weak_Convergence.thy
src/HOL/Probability/ex/Dining_Cryptographers.thy
src/HOL/Probability/ex/Measure_Not_CCC.thy
src/HOL/Real.thy
src/HOL/Real_Vector_Spaces.thy
src/HOL/Rings.thy
src/HOL/Series.thy
src/HOL/Topological_Spaces.thy
src/HOL/Transcendental.thy
src/HOL/Wfrec.thy
src/HOL/Zorn.thy
src/HOL/ex/Ballot.thy
src/HOL/ex/Erdoes_Szekeres.thy
src/HOL/ex/Gauge_Integration.thy
src/HOL/ex/HarmonicSeries.thy
src/ZF/CardinalArith.thy
src/ZF/Induct/Multiset.thy
src/ZF/QUniv.thy
     1.1 --- a/src/HOL/Algebra/Ideal.thy	Sun Apr 24 21:31:14 2016 +0200
     1.2 +++ b/src/HOL/Algebra/Ideal.thy	Mon Apr 25 16:09:26 2016 +0200
     1.3 @@ -787,7 +787,7 @@
     1.4        abI: "a \<otimes> b \<in> I" and
     1.5        anI: "a \<notin> I" and
     1.6        bnI: "b \<notin> I" by fast
     1.7 -    def J \<equiv> "{x\<in>carrier R. a \<otimes> x \<in> I}"
     1.8 +    define J where "J = {x\<in>carrier R. a \<otimes> x \<in> I}"
     1.9      
    1.10      from is_cring and acarr have idealJ: "ideal J R"
    1.11        unfolding J_def by (rule helper_max_prime)
     2.1 --- a/src/HOL/Algebra/QuotRing.thy	Sun Apr 24 21:31:14 2016 +0200
     2.2 +++ b/src/HOL/Algebra/QuotRing.thy	Mon Apr 25 16:09:26 2016 +0200
     2.3 @@ -238,7 +238,7 @@
     2.4      assume IanI: "I +> a \<noteq> I" and acarr: "a \<in> carrier R"
     2.5  
     2.6      --\<open>Helper ideal @{text "J"}\<close>
     2.7 -    def J \<equiv> "(carrier R #> a) <+> I :: 'a set"
     2.8 +    define J :: "'a set" where "J = (carrier R #> a) <+> I"
     2.9      have idealJ: "ideal J R"
    2.10        apply (unfold J_def, rule add_ideals)
    2.11         apply (simp only: cgenideal_eq_rcos[symmetric], rule cgenideal_ideal, rule acarr)
     3.1 --- a/src/HOL/BNF_Cardinal_Order_Relation.thy	Sun Apr 24 21:31:14 2016 +0200
     3.2 +++ b/src/HOL/BNF_Cardinal_Order_Relation.thy	Mon Apr 25 16:09:26 2016 +0200
     3.3 @@ -470,10 +470,15 @@
     3.4  fixes A :: "'a set" and B :: "'b set" and C :: "'c set"
     3.5  shows "|(A <+> B) <+> C| =o |A <+> B <+> C|"
     3.6  proof -
     3.7 -  def f \<equiv> "\<lambda>(k::('a + 'b) + 'c).
     3.8 -  case k of Inl ab \<Rightarrow> (case ab of Inl a \<Rightarrow> Inl a
     3.9 -                                 |Inr b \<Rightarrow> Inr (Inl b))
    3.10 -           |Inr c \<Rightarrow> Inr (Inr c)"
    3.11 +  define f :: "('a + 'b) + 'c \<Rightarrow> 'a + 'b + 'c"
    3.12 +    where [abs_def]: "f k =
    3.13 +      (case k of
    3.14 +        Inl ab \<Rightarrow>
    3.15 +          (case ab of
    3.16 +            Inl a \<Rightarrow> Inl a
    3.17 +          | Inr b \<Rightarrow> Inr (Inl b))
    3.18 +      | Inr c \<Rightarrow> Inr (Inr c))"
    3.19 +    for k
    3.20    have "A <+> B <+> C \<subseteq> f ` ((A <+> B) <+> C)"
    3.21    proof
    3.22      fix x assume x: "x \<in> A <+> B <+> C"
    3.23 @@ -499,7 +504,7 @@
    3.24      qed
    3.25    qed
    3.26    hence "bij_betw f ((A <+> B) <+> C) (A <+> B <+> C)"
    3.27 -  unfolding bij_betw_def inj_on_def f_def by fastforce
    3.28 +    unfolding bij_betw_def inj_on_def f_def by fastforce
    3.29    thus ?thesis using card_of_ordIso by blast
    3.30  qed
    3.31  
    3.32 @@ -1626,8 +1631,8 @@
    3.33  lemma card_of_Pow_Func:
    3.34  "|Pow A| =o |Func A (UNIV::bool set)|"
    3.35  proof-
    3.36 -  def F \<equiv> "\<lambda> A' a. if a \<in> A then (if a \<in> A' then True else False)
    3.37 -                            else undefined"
    3.38 +  define F where [abs_def]: "F A' a =
    3.39 +    (if a \<in> A then (if a \<in> A' then True else False) else undefined)" for A' a
    3.40    have "bij_betw F (Pow A) (Func A (UNIV::bool set))"
    3.41    unfolding bij_betw_def inj_on_def proof (intro ballI impI conjI)
    3.42      fix A1 A2 assume "A1 \<in> Pow A" "A2 \<in> Pow A" "F A1 = F A2"
    3.43 @@ -1638,8 +1643,9 @@
    3.44        fix f assume f: "f \<in> Func A (UNIV::bool set)"
    3.45        show "f \<in> F ` Pow A" unfolding image_def mem_Collect_eq proof(intro bexI)
    3.46          let ?A1 = "{a \<in> A. f a = True}"
    3.47 -        show "f = F ?A1" unfolding F_def apply(rule ext)
    3.48 -        using f unfolding Func_def mem_Collect_eq by auto
    3.49 +        show "f = F ?A1"
    3.50 +          unfolding F_def apply(rule ext)
    3.51 +          using f unfolding Func_def mem_Collect_eq by auto
    3.52        qed auto
    3.53      qed(unfold Func_def mem_Collect_eq F_def, auto)
    3.54    qed
     4.1 --- a/src/HOL/BNF_Wellorder_Constructions.thy	Sun Apr 24 21:31:14 2016 +0200
     4.2 +++ b/src/HOL/BNF_Wellorder_Constructions.thy	Mon Apr 25 16:09:26 2016 +0200
     4.3 @@ -1616,7 +1616,7 @@
     4.4    show ?thesis
     4.5    proof safe
     4.6      fix h assume h: "h \<in> Func B2 B1"
     4.7 -    def j1 \<equiv> "inv_into A1 f1"
     4.8 +    define j1 where "j1 = inv_into A1 f1"
     4.9      have "\<forall> a2 \<in> f2 ` B2. \<exists> b2. b2 \<in> B2 \<and> f2 b2 = a2" by blast
    4.10      then obtain k where k: "\<forall> a2 \<in> f2 ` B2. k a2 \<in> B2 \<and> f2 (k a2) = a2"
    4.11        by atomize_elim (rule bchoice)
    4.12 @@ -1626,11 +1626,11 @@
    4.13       ultimately have "k (f2 b2) = b2" using b2 A2(1) unfolding inj_on_def by blast
    4.14      } note kk = this
    4.15      obtain b22 where b22: "b22 \<in> B2" using B2 by auto
    4.16 -    def j2 \<equiv> "\<lambda> a2. if a2 \<in> f2 ` B2 then k a2 else b22"
    4.17 +    define j2 where [abs_def]: "j2 a2 = (if a2 \<in> f2 ` B2 then k a2 else b22)" for a2
    4.18      have j2A2: "j2 ` A2 \<subseteq> B2" unfolding j2_def using k b22 by auto
    4.19      have j2: "\<And> b2. b2 \<in> B2 \<Longrightarrow> j2 (f2 b2) = b2"
    4.20      using kk unfolding j2_def by auto
    4.21 -    def g \<equiv> "Func_map A2 j1 j2 h"
    4.22 +    define g where "g = Func_map A2 j1 j2 h"
    4.23      have "Func_map B2 f1 f2 g = h"
    4.24      proof (rule ext)
    4.25        fix b2 show "Func_map B2 f1 f2 g b2 = h b2"
     5.1 --- a/src/HOL/Binomial.thy	Sun Apr 24 21:31:14 2016 +0200
     5.2 +++ b/src/HOL/Binomial.thy	Mon Apr 25 16:09:26 2016 +0200
     5.3 @@ -643,7 +643,7 @@
     5.4    shows "pochhammer z (Suc n) * pochhammer (z + 1/2) (Suc n) = (\<Prod>k=0..2*n+1. z + of_nat k / 2)"
     5.5  proof (induction n)
     5.6    case (Suc n)
     5.7 -  def n' \<equiv> "Suc n"
     5.8 +  define n' where "n' = Suc n"
     5.9    have "pochhammer z (Suc n') * pochhammer (z + 1 / 2) (Suc n') =
    5.10            (pochhammer z n' * pochhammer (z + 1 / 2) n') *
    5.11            ((z + of_nat n') * (z + 1/2 + of_nat n'))" (is "_ = _ * ?A")
    5.12 @@ -1161,7 +1161,8 @@
    5.13         (\<Sum>k\<le>m. (-r gchoose k) * (-x)^k * (x + y)^(m-k))" (is "?lhs m = ?rhs m")
    5.14  proof (induction m)
    5.15    case (Suc mm)
    5.16 -  def G \<equiv> "\<lambda>i k. (of_nat i + r gchoose k) * x^k * y^(i-k)" and S \<equiv> ?lhs
    5.17 +  define G where "G i k = (of_nat i + r gchoose k) * x^k * y^(i-k)" for i k
    5.18 +  define S where "S = ?lhs"
    5.19    have SG_def: "S = (\<lambda>i. (\<Sum>k\<le>i. (G i k)))" unfolding S_def G_def ..
    5.20  
    5.21    have "S (Suc mm) = G (Suc mm) 0 + (\<Sum>k=Suc 0..Suc mm. G (Suc mm) k)"
    5.22 @@ -1388,7 +1389,7 @@
    5.23    proof(rule setsum.cong[OF refl])
    5.24      fix x
    5.25      assume x: "x \<in> \<Union>A"
    5.26 -    def K \<equiv> "{X \<in> A. x \<in> X}"
    5.27 +    define K where "K = {X \<in> A. x \<in> X}"
    5.28      with \<open>finite A\<close> have K: "finite K" by auto
    5.29      let ?I = "\<lambda>i. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter>I}"
    5.30      have "inj_on snd (SIGMA i:{1..card A}. ?I i)"
     6.1 --- a/src/HOL/Cardinals/Bounded_Set.thy	Sun Apr 24 21:31:14 2016 +0200
     6.2 +++ b/src/HOL/Cardinals/Bounded_Set.thy	Mon Apr 25 16:09:26 2016 +0200
     6.3 @@ -50,8 +50,9 @@
     6.4      BNF_Def.Grp {a. set_bset a \<subseteq> {(a, b). R a b}} (map_bset snd)) a b" (is "?L \<longleftrightarrow> ?R")
     6.5  proof
     6.6    assume ?L
     6.7 -  def R' \<equiv> "the_inv set_bset (Collect (case_prod R) \<inter> (set_bset a \<times> set_bset b)) :: ('a \<times> 'b) set['k]"
     6.8 -    (is "the_inv set_bset ?L'")
     6.9 +  define R' :: "('a \<times> 'b) set['k]"
    6.10 +    where "R' = the_inv set_bset (Collect (case_prod R) \<inter> (set_bset a \<times> set_bset b))"
    6.11 +      (is "_ = the_inv set_bset ?L'")
    6.12    have "|?L'| <o natLeq +c |UNIV :: 'k set|"
    6.13      unfolding csum_def Field_natLeq
    6.14      by (intro ordLeq_ordLess_trans[OF card_of_mono1[OF Int_lower2]]
     7.1 --- a/src/HOL/Cardinals/Cardinal_Arithmetic.thy	Sun Apr 24 21:31:14 2016 +0200
     7.2 +++ b/src/HOL/Cardinals/Cardinal_Arithmetic.thy	Mon Apr 25 16:09:26 2016 +0200
     7.3 @@ -47,10 +47,10 @@
     7.4  by (simp only: cprod_def Field_card_of card_of_refl)
     7.5  
     7.6  lemma card_of_Times_singleton:
     7.7 -fixes A :: "'a set"
     7.8 -shows "|A \<times> {x}| =o |A|"
     7.9 +  fixes A :: "'a set"
    7.10 +  shows "|A \<times> {x}| =o |A|"
    7.11  proof -
    7.12 -  def f \<equiv> "\<lambda>(a::'a,b::'b). (a)"
    7.13 +  define f :: "'a \<times> 'b \<Rightarrow> 'a" where "f = (\<lambda>(a, b). a)"
    7.14    have "A \<subseteq> f ` (A \<times> {x})" unfolding f_def by (auto simp: image_iff)
    7.15    hence "bij_betw f (A \<times> {x}) A"  unfolding bij_betw_def inj_on_def f_def by fastforce
    7.16    thus ?thesis using card_of_ordIso by blast
    7.17 @@ -223,7 +223,7 @@
    7.18  fixes x :: 'b and A :: "'a set"
    7.19  shows "|Func A {x}| =o |{x}|"
    7.20  proof (rule ordIso_symmetric)
    7.21 -  def f \<equiv> "\<lambda>y a. if y = x \<and> a \<in> A then x else undefined"
    7.22 +  define f where [abs_def]: "f y a = (if y = x \<and> a \<in> A then x else undefined)" for y a
    7.23    have "Func A {x} \<subseteq> f ` {x}" unfolding f_def Func_def by (force simp: fun_eq_iff)
    7.24    hence "bij_betw f {x} (Func A {x})" unfolding bij_betw_def inj_on_def f_def Func_def
    7.25      by (auto split: if_split_asm)
    7.26 @@ -237,7 +237,7 @@
    7.27    fixes A :: "'a set"
    7.28    shows "|Func (UNIV :: bool set) A| =o |A \<times> A|"
    7.29  proof (rule ordIso_symmetric)
    7.30 -  def f \<equiv> "\<lambda>(x::'a,y) b. if A = {} then undefined else if b then x else y"
    7.31 +  define f where "f = (\<lambda>(x::'a,y) b. if A = {} then undefined else if b then x else y)"
    7.32    have "Func (UNIV :: bool set) A \<subseteq> f ` (A \<times> A)" unfolding f_def Func_def
    7.33      by (auto simp: image_iff fun_eq_iff split: option.splits if_split_asm) blast
    7.34    hence "bij_betw f (A \<times> A) (Func (UNIV :: bool set) A)"
    7.35 @@ -252,8 +252,8 @@
    7.36    fixes A :: "'a set" and B :: "'b set" and C :: "'c set"
    7.37    shows "|Func (A <+> B) C| =o |Func A C \<times> Func B C|"
    7.38  proof (rule ordIso_symmetric)
    7.39 -  def f \<equiv> "\<lambda>(g :: 'a => 'c, h::'b \<Rightarrow> 'c) ab. case ab of Inl a \<Rightarrow> g a | Inr b \<Rightarrow> h b"
    7.40 -  def f' \<equiv> "\<lambda>(f :: ('a + 'b) \<Rightarrow> 'c). (\<lambda>a. f (Inl a), \<lambda>b. f (Inr b))"
    7.41 +  define f where "f = (\<lambda>(g :: 'a => 'c, h::'b \<Rightarrow> 'c) ab. case ab of Inl a \<Rightarrow> g a | Inr b \<Rightarrow> h b)"
    7.42 +  define f' where "f' = (\<lambda>(f :: ('a + 'b) \<Rightarrow> 'c). (\<lambda>a. f (Inl a), \<lambda>b. f (Inr b)))"
    7.43    have "f ` (Func A C \<times> Func B C) \<subseteq> Func (A <+> B) C"
    7.44      unfolding Func_def f_def by (force split: sum.splits)
    7.45    moreover have "f' ` Func (A <+> B) C \<subseteq> Func A C \<times> Func B C" unfolding Func_def f'_def by force
     8.1 --- a/src/HOL/Cardinals/Cardinal_Order_Relation.thy	Sun Apr 24 21:31:14 2016 +0200
     8.2 +++ b/src/HOL/Cardinals/Cardinal_Order_Relation.thy	Mon Apr 25 16:09:26 2016 +0200
     8.3 @@ -1431,7 +1431,7 @@
     8.4      show "?F ` Func A B = Func_option A B"
     8.5      proof safe
     8.6        fix f assume f: "f \<in> Func_option A B"
     8.7 -      def g \<equiv> "\<lambda> a. case f a of Some b \<Rightarrow> b | None \<Rightarrow> undefined"
     8.8 +      define g where [abs_def]: "g a = (case f a of Some b \<Rightarrow> b | None \<Rightarrow> undefined)" for a
     8.9        have "g \<in> Func A B"
    8.10        using f unfolding g_def Func_def Func_option_def by force+
    8.11        moreover have "f = ?F g"
    8.12 @@ -1475,8 +1475,8 @@
    8.13  shows "|Func A1 B| \<le>o |Func A2 B|"
    8.14  proof-
    8.15    obtain bb where bb: "bb \<in> B" using B by auto
    8.16 -  def F \<equiv> "\<lambda> (f1::'a \<Rightarrow> 'b) a. if a \<in> A2 then (if a \<in> A1 then f1 a else bb)
    8.17 -                                                else undefined"
    8.18 +  define F where [abs_def]: "F f1 a =
    8.19 +    (if a \<in> A2 then (if a \<in> A1 then f1 a else bb) else undefined)" for f1 :: "'a \<Rightarrow> 'b" and a
    8.20    show ?thesis unfolding card_of_ordLeq[symmetric] proof(intro exI[of _ F] conjI)
    8.21      show "inj_on F (Func A1 B)" unfolding inj_on_def proof safe
    8.22        fix f g assume f: "f \<in> Func A1 B" and g: "g \<in> Func A1 B" and eq: "F f = F g"
    8.23 @@ -1523,7 +1523,7 @@
    8.24     hence "|X| \<le>o |Field r|" by (metis Field_card_of card_of_mono2)
    8.25     then obtain F where 1: "X = F ` (Field r)"
    8.26     using card_of_ordLeq2[OF X] by metis
    8.27 -   def f \<equiv> "\<lambda> i. if i \<in> Field r then F i else undefined"
    8.28 +   define f where [abs_def]: "f i = (if i \<in> Field r then F i else undefined)" for i
    8.29     have "\<exists> f \<in> Func (Field r) A. X = ?F f"
    8.30     apply (intro bexI[of _ f]) using 1 XA unfolding Func_def f_def by auto
    8.31    }
    8.32 @@ -1586,7 +1586,7 @@
    8.33    hence rr: "Refl r" by (metis wo_rel.REFL)
    8.34    show ?thesis unfolding wo_rel.isLimOrd_def[OF 0] wo_rel.isSuccOrd_def[OF 0] proof safe
    8.35      fix j assume j: "j \<in> Field r" and jm: "\<forall>i\<in>Field r. (i, j) \<in> r"
    8.36 -    def p \<equiv> "Restr r (Field r - {j})"
    8.37 +    define p where "p = Restr r (Field r - {j})"
    8.38      have fp: "Field p = Field r - {j}"
    8.39      unfolding p_def apply(rule Refl_Field_Restr2[OF rr]) by auto
    8.40      have of: "ofilter r (Field p)" unfolding wo_rel.ofilter_def[OF 0] proof safe
    8.41 @@ -1703,7 +1703,7 @@
    8.42     ultimately obtain f where f: "f ` Sigma A F = Field r" using card_of_ordLeq2 by metis
    8.43     have r: "wo_rel r" using cr unfolding card_order_on_def wo_rel_def by auto
    8.44     {fix a assume a: "a \<in> A"
    8.45 -    def L \<equiv> "{(a,u) | u. u \<in> F a}"
    8.46 +    define L where "L = {(a,u) | u. u \<in> F a}"
    8.47      have fL: "f ` L \<subseteq> Field r" using f a unfolding L_def by auto
    8.48      have "|L| =o |F a|" unfolding L_def card_of_ordIso[symmetric]
    8.49      apply(rule exI[of _ snd]) unfolding bij_betw_def inj_on_def by (auto simp: image_def)
    8.50 @@ -1717,7 +1717,7 @@
    8.51     }
    8.52     then obtain gg where gg: "\<forall> a \<in> A. \<forall> u \<in> F a. (f (a,u), gg a) \<in> r" by metis
    8.53     obtain j0 where j0: "j0 \<in> Field r" using Fi by auto
    8.54 -   def g \<equiv> "\<lambda> a. if F a \<noteq> {} then gg a else j0"
    8.55 +   define g where [abs_def]: "g a = (if F a \<noteq> {} then gg a else j0)" for a
    8.56     have g: "\<forall> a \<in> A. \<forall> u \<in> F a. (f (a,u),g a) \<in> r" using gg unfolding g_def by auto
    8.57     hence 1: "Field r \<subseteq> (\<Union>a \<in> A. under r (g a))"
    8.58     using f[symmetric] unfolding under_def image_def by auto
     9.1 --- a/src/HOL/Cardinals/Ordinal_Arithmetic.thy	Sun Apr 24 21:31:14 2016 +0200
     9.2 +++ b/src/HOL/Cardinals/Ordinal_Arithmetic.thy	Mon Apr 25 16:09:26 2016 +0200
     9.3 @@ -751,12 +751,12 @@
     9.4              with F have maxF: "\<forall>f \<in> F. s.isMaxim (SUPP f) (s.maxim (SUPP f))"
     9.5                and SUPPF: "\<forall>f \<in> F. finite (SUPP f) \<and> SUPP f \<noteq> {} \<and> SUPP f \<subseteq> Field s"
     9.6                using maxim_isMaxim_support support_not_const by auto
     9.7 -            def z \<equiv> "s.minim {s.maxim (SUPP f) | f. f \<in> F}"
     9.8 +            define z where "z = s.minim {s.maxim (SUPP f) | f. f \<in> F}"
     9.9              from F SUPPF maxF have zmin: "s.isMinim {s.maxim (SUPP f) | f. f \<in> F} z"
    9.10                unfolding z_def by (intro s.minim_isMinim) (auto simp: s.isMaxim_def)
    9.11              with F have zy: "(z, y) \<in> s" unfolding s.isMinim_def by auto
    9.12              hence zField: "z \<in> Field s" unfolding Field_def by auto
    9.13 -            def x0 \<equiv> "r.minim {f z | f. f \<in> F \<and> z = s.maxim (SUPP f)}"
    9.14 +            define x0 where "x0 = r.minim {f z | f. f \<in> F \<and> z = s.maxim (SUPP f)}"
    9.15              from F(1,2) maxF(1) SUPPF zmin
    9.16                have x0min: "r.isMinim {f z | f. f \<in> F \<and> z = s.maxim (SUPP f)} x0"
    9.17                unfolding x0_def s.isMaxim_def s.isMinim_def
    9.18 @@ -766,7 +766,7 @@
    9.19              from x0min maxF(1) SUPPF F(1) have x0notzero: "x0 \<noteq> r.zero"
    9.20                unfolding r.isMinim_def s.isMaxim_def FinFunc_def Func_def support_def
    9.21                by fastforce
    9.22 -            def G \<equiv> "{f(z := r.zero) | f. f \<in> F \<and> z = s.maxim (SUPP f) \<and> f z = x0}"
    9.23 +            define G where "G = {f(z := r.zero) | f. f \<in> F \<and> z = s.maxim (SUPP f) \<and> f z = x0}"
    9.24              from zmin x0min have "G \<noteq> {}" unfolding G_def z_def s.isMinim_def r.isMinim_def by blast
    9.25              have GF: "G \<subseteq> (\<lambda>f. f(z := r.zero)) ` F" unfolding G_def by auto
    9.26              have "G \<subseteq> fin_support r.zero (Field s)"
    9.27 @@ -786,7 +786,7 @@
    9.28                with G have maxG: "\<forall>g \<in> G. s.isMaxim (SUPP g) (s.maxim (SUPP g))"
    9.29                  and SUPPG: "\<forall>g \<in> G. finite (SUPP g) \<and> SUPP g \<noteq> {} \<and> SUPP g \<subseteq> Field s"
    9.30                  using maxim_isMaxim_support support_not_const by auto
    9.31 -              def y' \<equiv> "s.minim {s.maxim (SUPP f) | f. f \<in> G}"
    9.32 +              define y' where "y' = s.minim {s.maxim (SUPP f) | f. f \<in> G}"
    9.33                from G SUPPG maxG `G \<noteq> {}` have y'min: "s.isMinim {s.maxim (SUPP f) | f. f \<in> G} y'"
    9.34                  unfolding y'_def by (intro s.minim_isMinim) (auto simp: s.isMaxim_def)
    9.35                moreover
    9.36 @@ -810,7 +810,7 @@
    9.37              qed simp
    9.38              then obtain g0 where g0: "g0 \<in> G" "\<forall>g \<in> G. (g0, g) \<in> oexp" by blast
    9.39              hence g0z: "g0 z = r.zero" unfolding G_def by auto
    9.40 -            def f0 \<equiv> "g0(z := x0)"
    9.41 +            define f0 where "f0 = g0(z := x0)"
    9.42              with x0notzero zField have SUPP: "SUPP f0 = SUPP g0 \<union> {z}" unfolding support_def by auto
    9.43              from g0z have f0z: "f0(z := r.zero) = g0" unfolding f0_def fun_upd_upd by auto
    9.44              have f0: "f0 \<in> F" using x0min g0(1)
    9.45 @@ -1297,8 +1297,9 @@
    9.46      using embed_iff_compat_inj_on_ofilter[OF s t, of f] embedS_iff[OF s, of t f]
    9.47      unfolding embedS_def by auto
    9.48    note invff = the_inv_into_f_f[OF *(1)] and injfD = inj_onD[OF *(1)]
    9.49 -  def F \<equiv> "\<lambda>g z. if z \<in> f ` Field s then g (the_inv_into (Field s) f z) else
    9.50 -    if z \<in> Field t then r.zero else undefined"
    9.51 +  define F where [abs_def]: "F g z =
    9.52 +    (if z \<in> f ` Field s then g (the_inv_into (Field s) f z)
    9.53 +     else if z \<in> Field t then r.zero else undefined)" for g z
    9.54    from *(4) x(2) the_inv_into_f_eq[OF *(1)] have FLR: "F ` Field ?L \<subseteq> Field ?R"
    9.55      unfolding rt.Field_oexp rs.Field_oexp FinFunc_def Func_def fin_support_def support_def F_def
    9.56      by (fastforce split: option.splits if_split_asm elim!: finite_surj[of _ _ f])
    9.57 @@ -1368,7 +1369,8 @@
    9.58    from FLR have "F ` Field ?L \<subset> Field ?R"
    9.59    proof (intro psubsetI)
    9.60      from *(4) obtain z where z: "z \<in> Field t" "z \<notin> f ` Field s" by auto
    9.61 -    def h \<equiv> "\<lambda>z'. if z' \<in> Field t then if z' = z then x else r.zero else undefined"
    9.62 +    define h where [abs_def]: "h z' =
    9.63 +      (if z' \<in> Field t then if z' = z then x else r.zero else undefined)" for z'
    9.64      from z x(3) have "rt.SUPP h = {z}" unfolding support_def h_def by simp
    9.65      with x have "h \<in> Field ?R" unfolding h_def rt.Field_oexp FinFunc_def Func_def fin_support_def
    9.66        by auto
    10.1 --- a/src/HOL/Cardinals/Wellorder_Constructions.thy	Sun Apr 24 21:31:14 2016 +0200
    10.2 +++ b/src/HOL/Cardinals/Wellorder_Constructions.thy	Mon Apr 25 16:09:26 2016 +0200
    10.3 @@ -658,7 +658,7 @@
    10.4  lemma isSucc_pred_in:
    10.5  assumes "isSucc i"  shows "(pred i, i) \<in> r"
    10.6  proof-
    10.7 -  def j \<equiv> "pred i"
    10.8 +  define j where "j = pred i"
    10.9    have i: "i = succ j" using assms unfolding j_def by simp
   10.10    have a: "aboveS j \<noteq> {}" unfolding j_def using assms by auto
   10.11    show ?thesis unfolding j_def[symmetric] unfolding i using succ_in[OF a] .
   10.12 @@ -766,7 +766,7 @@
   10.13  assumes a: "adm_woL L" and i: "aboveS j \<noteq> {}"
   10.14  shows "worecSL S L (succ j) = S j (worecSL S L j)"
   10.15  proof-
   10.16 -  def i \<equiv> "succ j"
   10.17 +  define i where "i = succ j"
   10.18    have i: "isSucc i" by (metis i i_def isSucc_succ)
   10.19    have ij: "j = pred i" unfolding i_def using assms by simp
   10.20    have 0: "succ (pred i) = i" using i by simp
   10.21 @@ -935,7 +935,7 @@
   10.22    interpret r: wo_rel r by unfold_locales (rule r)
   10.23    interpret s: wo_rel s by unfold_locales (rule s)
   10.24    let ?G = "\<lambda> g a. suc s (g ` underS r a)"
   10.25 -  def g \<equiv> "worec r ?G"
   10.26 +  define g where "g = worec r ?G"
   10.27    have adm: "adm_wo r ?G" unfolding r.adm_wo_def image_def by auto
   10.28    (*  *)
   10.29    {fix a assume "a \<in> Field r"
    11.1 --- a/src/HOL/Cardinals/Wellorder_Extension.thy	Sun Apr 24 21:31:14 2016 +0200
    11.2 +++ b/src/HOL/Cardinals/Wellorder_Extension.thy	Mon Apr 25 16:09:26 2016 +0200
    11.3 @@ -66,7 +66,7 @@
    11.4    shows "\<exists>w. p \<subseteq> w \<and> Well_order w"
    11.5  proof -
    11.6    let ?K = "{r. Well_order r \<and> downset_on (Field r) p \<and> extension_on (Field r) r p}"
    11.7 -  def I \<equiv> "init_seg_of \<inter> ?K \<times> ?K"
    11.8 +  define I where "I = init_seg_of \<inter> ?K \<times> ?K"
    11.9    have I_init: "I \<subseteq> init_seg_of" by (simp add: I_def)
   11.10    then have subch: "\<And>R. R \<in> Chains I \<Longrightarrow> chain\<^sub>\<subseteq> R"
   11.11      by (auto simp: init_seg_of_def chain_subset_def Chains_def)
    12.1 --- a/src/HOL/Complex.thy	Sun Apr 24 21:31:14 2016 +0200
    12.2 +++ b/src/HOL/Complex.thy	Mon Apr 25 16:09:26 2016 +0200
    12.3 @@ -817,7 +817,8 @@
    12.4    from assms have "z \<noteq> 0" by auto
    12.5    have "(SOME a. sgn z = cis a \<and> -pi < a \<and> a \<le> pi) = x"
    12.6    proof
    12.7 -    fix a def d \<equiv> "a - x"
    12.8 +    fix a
    12.9 +    define d where "d = a - x"
   12.10      assume a: "sgn z = cis a \<and> - pi < a \<and> a \<le> pi"
   12.11      from a assms have "- (2*pi) < d \<and> d < 2*pi"
   12.12        unfolding d_def by simp
   12.13 @@ -839,7 +840,7 @@
   12.14  proof (simp add: arg_def assms, rule someI_ex)
   12.15    obtain r a where z: "z = rcis r a" using rcis_Ex by fast
   12.16    with assms have "r \<noteq> 0" by auto
   12.17 -  def b \<equiv> "if 0 < r then a else a + pi"
   12.18 +  define b where "b = (if 0 < r then a else a + pi)"
   12.19    have b: "sgn z = cis b"
   12.20      unfolding z b_def rcis_def using \<open>r \<noteq> 0\<close>
   12.21      by (simp add: of_real_def sgn_scaleR sgn_if complex_eq_iff)
   12.22 @@ -848,7 +849,7 @@
   12.23    have cis_2pi_int: "\<And>x. cis (2 * pi * real_of_int x) = 1"
   12.24      by (case_tac x rule: int_diff_cases)
   12.25         (simp add: right_diff_distrib cis_divide [symmetric] cis_2pi_nat)
   12.26 -  def c \<equiv> "b - 2*pi * of_int \<lceil>(b - pi) / (2*pi)\<rceil>"
   12.27 +  define c where "c = b - 2 * pi * of_int \<lceil>(b - pi) / (2 * pi)\<rceil>"
   12.28    have "sgn z = cis c"
   12.29      unfolding b c_def
   12.30      by (simp add: cis_divide [symmetric] cis_2pi_int)
    13.1 --- a/src/HOL/Conditionally_Complete_Lattices.thy	Sun Apr 24 21:31:14 2016 +0200
    13.2 +++ b/src/HOL/Conditionally_Complete_Lattices.thy	Mon Apr 25 16:09:26 2016 +0200
    13.3 @@ -590,7 +590,7 @@
    13.4      S = {a..<b} \<or>
    13.5      S = {a..b}"
    13.6  proof -
    13.7 -  def lower \<equiv> "{x. \<exists>s\<in>S. s \<le> x}" and upper \<equiv> "{x. \<exists>s\<in>S. x \<le> s}"
    13.8 +  define lower upper where "lower = {x. \<exists>s\<in>S. s \<le> x}" and "upper = {x. \<exists>s\<in>S. x \<le> s}"
    13.9    with ivl have "S = lower \<inter> upper"
   13.10      by auto
   13.11    moreover 
    14.1 --- a/src/HOL/Datatype_Examples/Derivation_Trees/Gram_Lang.thy	Sun Apr 24 21:31:14 2016 +0200
    14.2 +++ b/src/HOL/Datatype_Examples/Derivation_Trees/Gram_Lang.thy	Mon Apr 25 16:09:26 2016 +0200
    14.3 @@ -665,7 +665,7 @@
    14.4    assume ?C then obtain tr where
    14.5    tr_tr0: "Inr tr \<in> cont tr0" and t_tr: "inFr (ns - {root tr0}) tr t"
    14.6    unfolding inFrr_def by auto
    14.7 -  def tr1 \<equiv> "hsubst tr"
    14.8 +  define tr1 where "tr1 = hsubst tr"
    14.9    have 1: "inFr ns tr1 t" using t_tr unfolding tr1_def using inFr_hsubst_minus by auto
   14.10    have "Inr tr1 \<in> cont (hsubst tr0)" unfolding tr1_def using tr_tr0 by auto
   14.11    thus ?A using 1 inFr.Ind assms by (metis root_hsubst)
   14.12 @@ -689,8 +689,9 @@
   14.13  
   14.14  lemma regular_def2: "regular tr \<longleftrightarrow> (\<exists> f. reg f tr \<and> (\<forall> n. root (f n) = n))"
   14.15  unfolding regular_def proof safe
   14.16 -  fix f assume f: "reg f tr"
   14.17 -  def g \<equiv> "\<lambda> n. if inItr UNIV tr n then f n else deftr n"
   14.18 +  fix f
   14.19 +  assume f: "reg f tr"
   14.20 +  define g where "g n = (if inItr UNIV tr n then f n else deftr n)" for n
   14.21    show "\<exists>g. reg g tr \<and> (\<forall>n. root (g n) = n)"
   14.22    apply(rule exI[of _ g])
   14.23    using f deftr_simps(1) unfolding g_def reg_def apply safe
   14.24 @@ -1169,8 +1170,8 @@
   14.25    fix ts assume "ts \<in> Lr ns n"
   14.26    then obtain tr where dtr: "wf tr" and r: "root tr = n" and tr: "regular tr"
   14.27    and ts: "ts = Fr ns tr" unfolding Lr_def by auto
   14.28 -  def tns \<equiv> "(id \<oplus> root) ` (cont tr)"
   14.29 -  def K \<equiv> "\<lambda> n'. Fr (ns - {n}) (subtrOf tr n')"
   14.30 +  define tns where "tns = (id \<oplus> root) ` (cont tr)"
   14.31 +  define K where "K n' = Fr (ns - {n}) (subtrOf tr n')" for n'
   14.32    show "\<exists>tns K. ts = ?F tns K \<and> (n, tns) \<in> P \<and> ?\<phi> tns K"
   14.33    apply(rule exI[of _ tns], rule exI[of _ K]) proof(intro conjI allI impI)
   14.34      show "ts = Inl -` tns \<union> \<Union>{K n' |n'. Inr n' \<in> tns}"
   14.35 @@ -1222,7 +1223,8 @@
   14.36    then obtain ftr where 0: "\<And> n'. Inr n' \<in> tns \<Longrightarrow>
   14.37    K n' = Fr (ns - {n}) (ftr n') \<and> wf (ftr n') \<and> root (ftr n') = n'"
   14.38    by metis
   14.39 -  def tr \<equiv> "Node n ((id \<oplus> ftr) ` tns)"  def tr' \<equiv> "hsubst tr tr"
   14.40 +  define tr where "tr = Node n ((id \<oplus> ftr) ` tns)"
   14.41 +  define tr' where "tr' = hsubst tr tr"
   14.42    have rtr: "root tr = n" and ctr: "cont tr = (id \<oplus> ftr) ` tns"
   14.43    unfolding tr_def by (simp, metis P cont_Node finite_imageI finite_in_P)
   14.44    have prtr: "prodOf tr = tns" apply(rule Inl_Inr_image_cong)
    15.1 --- a/src/HOL/Decision_Procs/Approximation.thy	Sun Apr 24 21:31:14 2016 +0200
    15.2 +++ b/src/HOL/Decision_Procs/Approximation.thy	Mon Apr 25 16:09:26 2016 +0200
    15.3 @@ -2399,7 +2399,7 @@
    15.4    shows "ln (Float m e) = ln 2 * (e + (bitlen m - 1)) + ln (Float m (- (bitlen m - 1)))"
    15.5  proof -
    15.6    let ?B = "2^nat (bitlen m - 1)"
    15.7 -  def bl \<equiv> "bitlen m - 1"
    15.8 +  define bl where "bl = bitlen m - 1"
    15.9    have "0 < real_of_int m" and "\<And>X. (0 :: real) < 2^X" and "0 < (2 :: real)" and "m \<noteq> 0"
   15.10      using assms by auto
   15.11    hence "0 \<le> bl" by (simp add: bitlen_def bl_def)
   15.12 @@ -2528,8 +2528,8 @@
   15.13      using \<open>1 \<le> x\<close> by auto
   15.14    show ?thesis
   15.15    proof -
   15.16 -    def m \<equiv> "mantissa x"
   15.17 -    def e \<equiv> "exponent x"
   15.18 +    define m where "m = mantissa x"
   15.19 +    define e where "e = exponent x"
   15.20      from Float_mantissa_exponent[of x] have Float: "x = Float m e"
   15.21        by (simp add: m_def e_def)
   15.22      let ?s = "Float (e + (bitlen m - 1)) 0"
   15.23 @@ -2539,7 +2539,7 @@
   15.24        apply (auto simp add: zero_less_mult_iff)
   15.25        using not_le powr_ge_pzero apply blast
   15.26        done
   15.27 -    def bl \<equiv> "bitlen m - 1"
   15.28 +    define bl where "bl = bitlen m - 1"
   15.29      hence "bl \<ge> 0"
   15.30        using \<open>m > 0\<close> by (simp add: bitlen_def)
   15.31      have "1 \<le> Float m e"
   15.32 @@ -2746,7 +2746,7 @@
   15.33      with x lu show ?thesis by (auto simp: bnds_powr_def)
   15.34    next
   15.35      assume A: "l1 = 0" "u1 \<noteq> 0" "l2 \<ge> 1"
   15.36 -    def uln \<equiv> "the (ub_ln prec u1)"
   15.37 +    define uln where "uln = the (ub_ln prec u1)"
   15.38      show ?thesis
   15.39      proof (cases "x = 0")
   15.40        case False
   15.41 @@ -3969,7 +3969,7 @@
   15.42      have setsum_move0: "\<And>k F. setsum F {0..<Suc k} = F 0 + setsum (\<lambda> k. F (Suc k)) {0..<k}"
   15.43        unfolding setsum_shift_bounds_Suc_ivl[symmetric]
   15.44        unfolding setsum_head_upt_Suc[OF zero_less_Suc] ..
   15.45 -    def C \<equiv> "xs!x - c"
   15.46 +    define C where "C = xs!x - c"
   15.47  
   15.48      {
   15.49        fix t::real assume t: "t \<in> {lx .. ux}"
   15.50 @@ -4006,7 +4006,8 @@
   15.51      and ate: "Some (l, u) = approx_tse prec x s c 1 f vs"
   15.52    shows "interpret_floatarith f xs \<in> {l .. u}"
   15.53  proof -
   15.54 -  def F \<equiv> "\<lambda>n z. interpret_floatarith ((DERIV_floatarith x ^^ n) f) (xs[x := z])"
   15.55 +  define F where [abs_def]: "F n z =
   15.56 +    interpret_floatarith ((DERIV_floatarith x ^^ n) f) (xs[x := z])" for n z
   15.57    hence F0: "F 0 = (\<lambda> z. interpret_floatarith f (xs[x := z]))" by auto
   15.58  
   15.59    hence "bounded_by (xs[x := c]) vs" and "x < length vs" "x < length xs"
    16.1 --- a/src/HOL/Deriv.thy	Sun Apr 24 21:31:14 2016 +0200
    16.2 +++ b/src/HOL/Deriv.thy	Mon Apr 25 16:09:26 2016 +0200
    16.3 @@ -235,8 +235,8 @@
    16.4    let ?D = "\<lambda>f f' x y. (f y - f x) - f' (y - x)"
    16.5    let ?N = "\<lambda>f f' x y. norm (?D f f' x y) / norm (y - x)"
    16.6    let ?gf = "\<lambda>x. g (f x)" and ?gf' = "\<lambda>x. g' (f' x)"
    16.7 -  def Nf \<equiv> "?N f f' x"
    16.8 -  def Ng \<equiv> "\<lambda>y. ?N g g' (f x) (f y)"
    16.9 +  define Nf where "Nf = ?N f f' x"
   16.10 +  define Ng where [abs_def]: "Ng y = ?N g g' (f x) (f y)" for y
   16.11  
   16.12    show ?thesis
   16.13    proof (rule has_derivativeI_sandwich[of 1])
   16.14 @@ -297,7 +297,8 @@
   16.15      "\<And>a b. norm (a ** b) \<le> norm a * norm b * K" by fast
   16.16    let ?D = "\<lambda>f f' y. f y - f x - f' (y - x)"
   16.17    let ?N = "\<lambda>f f' y. norm (?D f f' y) / norm (y - x)"
   16.18 -  def Ng =="?N g g'" and Nf =="?N f f'"
   16.19 +  define Ng where "Ng = ?N g g'"
   16.20 +  define Nf where "Nf = ?N f f'"
   16.21  
   16.22    let ?fun1 = "\<lambda>y. norm (f y ** g y - f x ** g x - (f x ** g' (y - x) + f' (y - x) ** g x)) / norm (y - x)"
   16.23    let ?fun2 = "\<lambda>y. norm (f x) * Ng y * K + Nf y * norm (g y) * K + KF * norm (g y - g x) * K"
   16.24 @@ -1612,10 +1613,10 @@
   16.25    assumes lim: "((\<lambda> x. (f' x / g' x)) \<longlongrightarrow> x) (at_right 0)"
   16.26    shows "((\<lambda> x. f0 x / g0 x) \<longlongrightarrow> x) (at_right 0)"
   16.27  proof -
   16.28 -  def f \<equiv> "\<lambda>x. if x \<le> 0 then 0 else f0 x"
   16.29 +  define f where [abs_def]: "f x = (if x \<le> 0 then 0 else f0 x)" for x
   16.30    then have "f 0 = 0" by simp
   16.31  
   16.32 -  def g \<equiv> "\<lambda>x. if x \<le> 0 then 0 else g0 x"
   16.33 +  define g where [abs_def]: "g x = (if x \<le> 0 then 0 else g0 x)" for x
   16.34    then have "g 0 = 0" by simp
   16.35  
   16.36    have "eventually (\<lambda>x. g0 x \<noteq> 0 \<and> g' x \<noteq> 0 \<and>
    17.1 --- a/src/HOL/Divides.thy	Sun Apr 24 21:31:14 2016 +0200
    17.2 +++ b/src/HOL/Divides.thy	Mon Apr 25 16:09:26 2016 +0200
    17.3 @@ -623,7 +623,8 @@
    17.4    with \<open>0 < b\<close> have "0 < a div b" by (auto intro: div_positive)
    17.5    then have [simp]: "1 \<le> a div b" by (simp add: discrete)
    17.6    with \<open>0 < b\<close> have mod_less: "a mod b < b" by (simp add: pos_mod_bound)
    17.7 -  def w \<equiv> "a div b mod 2" with parity have w_exhaust: "w = 0 \<or> w = 1" by auto
    17.8 +  define w where "w = a div b mod 2"
    17.9 +  with parity have w_exhaust: "w = 0 \<or> w = 1" by auto
   17.10    have mod_w: "a mod (2 * b) = a mod b + b * w"
   17.11      by (simp add: w_def mod_mult2_eq ac_simps)
   17.12    from assms w_exhaust have "w = 1"
   17.13 @@ -641,7 +642,8 @@
   17.14    shows "2 * (a div (2 * b)) = a div b" (is "?P")
   17.15      and "a mod (2 * b) = a mod b" (is "?Q")
   17.16  proof -
   17.17 -  def w \<equiv> "a div b mod 2" with parity have w_exhaust: "w = 0 \<or> w = 1" by auto
   17.18 +  define w where "w = a div b mod 2"
   17.19 +  with parity have w_exhaust: "w = 0 \<or> w = 1" by auto
   17.20    have mod_w: "a mod (2 * b) = a mod b + b * w"
   17.21      by (simp add: w_def mod_mult2_eq ac_simps)
   17.22    moreover have "b \<le> a mod b + b"
    18.1 --- a/src/HOL/Finite_Set.thy	Sun Apr 24 21:31:14 2016 +0200
    18.2 +++ b/src/HOL/Finite_Set.thy	Mon Apr 25 16:09:26 2016 +0200
    18.3 @@ -919,7 +919,7 @@
    18.4          case 0 then show ?case by simp
    18.5        next
    18.6          case (Suc n g)
    18.7 -        def h \<equiv> "\<lambda>z. g z - 1"
    18.8 +        define h where "h z = g z - 1" for z
    18.9          with Suc have "n = h y" by simp
   18.10          with Suc have hyp: "f y ^^ h y \<circ> f x = f x \<circ> f y ^^ h y"
   18.11            by auto
   18.12 @@ -927,7 +927,7 @@
   18.13          then show ?case by (simp add: comp_assoc hyp)
   18.14            (simp add: o_assoc comp_fun_commute)
   18.15        qed
   18.16 -      def h \<equiv> "\<lambda>z. if z = x then g x - 1 else g z"
   18.17 +      define h where "h z = (if z = x then g x - 1 else g z)" for z
   18.18        with Suc have "n = h x" by simp
   18.19        with Suc have "f y ^^ h y \<circ> f x ^^ h x = f x ^^ h x \<circ> f y ^^ h y"
   18.20          by auto
    19.1 --- a/src/HOL/Groups_Big.thy	Sun Apr 24 21:31:14 2016 +0200
    19.2 +++ b/src/HOL/Groups_Big.thy	Mon Apr 25 16:09:26 2016 +0200
    19.3 @@ -1137,7 +1137,7 @@
    19.4        case True with insert show ?thesis by simp
    19.5      next
    19.6        case False with insert have "a \<in> B" by simp
    19.7 -      def C \<equiv> "B - {a}"
    19.8 +      define C where "C = B - {a}"
    19.9        with \<open>finite B\<close> \<open>a \<in> B\<close>
   19.10          have *: "B = insert a C" "finite C" "a \<notin> C" by auto
   19.11        with insert show ?thesis by (auto simp add: insert_commute ac_simps)
    20.1 --- a/src/HOL/HOLCF/Adm.thy	Sun Apr 24 21:31:14 2016 +0200
    20.2 +++ b/src/HOL/HOLCF/Adm.thy	Mon Apr 25 16:09:26 2016 +0200
    20.3 @@ -61,7 +61,7 @@
    20.4    assumes P: "\<forall>i. \<exists>j\<ge>i. P (Y j)"
    20.5    shows "P (\<Squnion>i. Y i)"
    20.6  proof -
    20.7 -  def f \<equiv> "\<lambda>i. LEAST j. i \<le> j \<and> P (Y j)"
    20.8 +  define f where "f i = (LEAST j. i \<le> j \<and> P (Y j))" for i
    20.9    have chain': "chain (\<lambda>i. Y (f i))"
   20.10      unfolding f_def
   20.11      apply (rule chainI)
    21.1 --- a/src/HOL/HOLCF/Completion.thy	Sun Apr 24 21:31:14 2016 +0200
    21.2 +++ b/src/HOL/HOLCF/Completion.thy	Mon Apr 25 16:09:26 2016 +0200
    21.3 @@ -191,14 +191,14 @@
    21.4  proof -
    21.5    obtain count :: "'a \<Rightarrow> nat" where inj: "inj count"
    21.6      using countable ..
    21.7 -  def enum \<equiv> "\<lambda>i. THE a. count a = i"
    21.8 +  define enum where "enum i = (THE a. count a = i)" for i
    21.9    have enum_count [simp]: "\<And>x. enum (count x) = x"
   21.10      unfolding enum_def by (simp add: inj_eq [OF inj])
   21.11 -  def a \<equiv> "LEAST i. enum i \<in> rep x"
   21.12 -  def b \<equiv> "\<lambda>i. LEAST j. enum j \<in> rep x \<and> \<not> enum j \<preceq> enum i"
   21.13 -  def c \<equiv> "\<lambda>i j. LEAST k. enum k \<in> rep x \<and> enum i \<preceq> enum k \<and> enum j \<preceq> enum k"
   21.14 -  def P \<equiv> "\<lambda>i. \<exists>j. enum j \<in> rep x \<and> \<not> enum j \<preceq> enum i"
   21.15 -  def X \<equiv> "rec_nat a (\<lambda>n i. if P i then c i (b i) else i)"
   21.16 +  define a where "a = (LEAST i. enum i \<in> rep x)"
   21.17 +  define b where "b i = (LEAST j. enum j \<in> rep x \<and> \<not> enum j \<preceq> enum i)" for i
   21.18 +  define c where "c i j = (LEAST k. enum k \<in> rep x \<and> enum i \<preceq> enum k \<and> enum j \<preceq> enum k)" for i j
   21.19 +  define P where "P i \<longleftrightarrow> (\<exists>j. enum j \<in> rep x \<and> \<not> enum j \<preceq> enum i)" for i
   21.20 +  define X where "X = rec_nat a (\<lambda>n i. if P i then c i (b i) else i)"
   21.21    have X_0: "X 0 = a" unfolding X_def by simp
   21.22    have X_Suc: "\<And>n. X (Suc n) = (if P (X n) then c (X n) (b (X n)) else X n)"
   21.23      unfolding X_def by simp
    22.1 --- a/src/HOL/HOLCF/Representable.thy	Sun Apr 24 21:31:14 2016 +0200
    22.2 +++ b/src/HOL/HOLCF/Representable.thy	Mon Apr 25 16:09:26 2016 +0200
    22.3 @@ -97,7 +97,7 @@
    22.4    obtain Y where Y: "\<forall>i. Y i \<sqsubseteq> Y (Suc i)"
    22.5    and t: "t = (\<Squnion>i. defl_principal (Y i))"
    22.6      by (rule defl.obtain_principal_chain)
    22.7 -  def approx \<equiv> "\<lambda>i. (p oo cast\<cdot>(defl_principal (Y i)) oo e) :: 'a \<rightarrow> 'a"
    22.8 +  define approx where "approx i = (p oo cast\<cdot>(defl_principal (Y i)) oo e)" for i
    22.9    have "approx_chain approx"
   22.10    proof (rule approx_chain.intro)
   22.11      show "chain (\<lambda>i. approx i)"
    23.1 --- a/src/HOL/HOLCF/Up.thy	Sun Apr 24 21:31:14 2016 +0200
    23.2 +++ b/src/HOL/HOLCF/Up.thy	Mon Apr 25 16:09:26 2016 +0200
    23.3 @@ -73,7 +73,7 @@
    23.4  proof (cases "\<exists>k. Y k \<noteq> Ibottom")
    23.5    case True
    23.6    then obtain k where k: "Y k \<noteq> Ibottom" ..
    23.7 -  def A \<equiv> "\<lambda>i. THE a. Iup a = Y (i + k)"
    23.8 +  define A where "A i = (THE a. Iup a = Y (i + k))" for i
    23.9    have Iup_A: "\<forall>i. Iup (A i) = Y (i + k)"
   23.10    proof
   23.11      fix i :: nat
    24.1 --- a/src/HOL/Hahn_Banach/Function_Norm.thy	Sun Apr 24 21:31:14 2016 +0200
    24.2 +++ b/src/HOL/Hahn_Banach/Function_Norm.thy	Mon Apr 25 16:09:26 2016 +0200
    24.3 @@ -108,7 +108,7 @@
    24.4          that \<open>y \<le> b\<close> for all \<open>y \<in> B\<close>. Due to the definition of \<open>B\<close> there are
    24.5          two cases.\<close>
    24.6  
    24.7 -      def b \<equiv> "max c 0"
    24.8 +      define b where "b = max c 0"
    24.9        have "\<forall>y \<in> B V f. y \<le> b"
   24.10        proof
   24.11          fix y assume y: "y \<in> B V f"
    25.1 --- a/src/HOL/Hahn_Banach/Hahn_Banach.thy	Sun Apr 24 21:31:14 2016 +0200
    25.2 +++ b/src/HOL/Hahn_Banach/Hahn_Banach.thy	Mon Apr 25 16:09:26 2016 +0200
    25.3 @@ -55,7 +55,7 @@
    25.4    interpret subspace F E by fact
    25.5    interpret seminorm E p by fact
    25.6    interpret linearform F f by fact
    25.7 -  def M \<equiv> "norm_pres_extensions E p F f"
    25.8 +  define M where "M = norm_pres_extensions E p F f"
    25.9    then have M: "M = \<dots>" by (simp only:)
   25.10    from E have F: "vectorspace F" ..
   25.11    note FE = \<open>F \<unlhd> E\<close>
   25.12 @@ -140,7 +140,7 @@
   25.13          qed
   25.14        qed
   25.15  
   25.16 -      def H' \<equiv> "H + lin x'"
   25.17 +      define H' where "H' = H + lin x'"
   25.18          \<comment> \<open>Define \<open>H'\<close> as the direct sum of \<open>H\<close> and the linear closure of \<open>x'\<close>. \<^smallskip>\<close>
   25.19        have HH': "H \<unlhd> H'"
   25.20        proof (unfold H'_def)
   25.21 @@ -178,8 +178,8 @@
   25.22          then show thesis by (blast intro: that)
   25.23        qed
   25.24  
   25.25 -      def h' \<equiv> "\<lambda>x. let (y, a) =
   25.26 -          SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H in h y + a * xi"
   25.27 +      define h' where "h' x = (let (y, a) =
   25.28 +          SOME (y, a). x = y + a \<cdot> x' \<and> y \<in> H in h y + a * xi)" for x
   25.29          \<comment> \<open>Define the extension \<open>h'\<close> of \<open>h\<close> to \<open>H'\<close> using \<open>\<xi>\<close>. \<^smallskip>\<close>
   25.30  
   25.31        have "g \<subseteq> graph H' h' \<and> g \<noteq> graph H' h'"
   25.32 @@ -365,7 +365,7 @@
   25.33         OF F_norm \<open>continuous F f norm\<close> , folded B_def fn_norm_def])
   25.34    txt \<open>We define a function \<open>p\<close> on \<open>E\<close> as follows:
   25.35      \<open>p x = \<parallel>f\<parallel> \<cdot> \<parallel>x\<parallel>\<close>\<close>
   25.36 -  def p \<equiv> "\<lambda>x. \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>"
   25.37 +  define p where "p x = \<parallel>f\<parallel>\<hyphen>F * \<parallel>x\<parallel>" for x
   25.38  
   25.39    txt \<open>\<open>p\<close> is a seminorm on \<open>E\<close>:\<close>
   25.40    have q: "seminorm E p"
    26.1 --- a/src/HOL/Hahn_Banach/Hahn_Banach_Ext_Lemmas.thy	Sun Apr 24 21:31:14 2016 +0200
    26.2 +++ b/src/HOL/Hahn_Banach/Hahn_Banach_Ext_Lemmas.thy	Mon Apr 25 16:09:26 2016 +0200
    26.3 @@ -86,9 +86,9 @@
    26.4  \<close>
    26.5  
    26.6  lemma h'_lf:
    26.7 -  assumes h'_def: "h' \<equiv> \<lambda>x. let (y, a) =
    26.8 -      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi"
    26.9 -    and H'_def: "H' \<equiv> H + lin x0"
   26.10 +  assumes h'_def: "\<And>x. h' x = (let (y, a) =
   26.11 +      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi)"
   26.12 +    and H'_def: "H' = H + lin x0"
   26.13      and HE: "H \<unlhd> E"
   26.14    assumes "linearform H h"
   26.15    assumes x0: "x0 \<notin> H"  "x0 \<in> E"  "x0 \<noteq> 0"
   26.16 @@ -192,9 +192,9 @@
   26.17  \<close>
   26.18  
   26.19  lemma h'_norm_pres:
   26.20 -  assumes h'_def: "h' \<equiv> \<lambda>x. let (y, a) =
   26.21 -      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi"
   26.22 -    and H'_def: "H' \<equiv> H + lin x0"
   26.23 +  assumes h'_def: "\<And>x. h' x = (let (y, a) =
   26.24 +      SOME (y, a). x = y + a \<cdot> x0 \<and> y \<in> H in h y + a * xi)"
   26.25 +    and H'_def: "H' = H + lin x0"
   26.26      and x0: "x0 \<notin> H"  "x0 \<in> E"  "x0 \<noteq> 0"
   26.27    assumes E: "vectorspace E" and HE: "subspace H E"
   26.28      and "seminorm E p" and "linearform H h"
    27.1 --- a/src/HOL/Hahn_Banach/Hahn_Banach_Sup_Lemmas.thy	Sun Apr 24 21:31:14 2016 +0200
    27.2 +++ b/src/HOL/Hahn_Banach/Hahn_Banach_Sup_Lemmas.thy	Mon Apr 25 16:09:26 2016 +0200
    27.3 @@ -158,7 +158,7 @@
    27.4  \<close>
    27.5  
    27.6  lemma sup_definite:
    27.7 -  assumes M_def: "M \<equiv> norm_pres_extensions E p F f"
    27.8 +  assumes M_def: "M = norm_pres_extensions E p F f"
    27.9      and cM: "c \<in> chains M"
   27.10      and xy: "(x, y) \<in> \<Union>c"
   27.11      and xz: "(x, z) \<in> \<Union>c"
    28.1 --- a/src/HOL/Hahn_Banach/Subspace.thy	Sun Apr 24 21:31:14 2016 +0200
    28.2 +++ b/src/HOL/Hahn_Banach/Subspace.thy	Mon Apr 25 16:09:26 2016 +0200
    28.3 @@ -467,9 +467,9 @@
    28.4  lemma h'_definite:
    28.5    fixes H
    28.6    assumes h'_def:
    28.7 -    "h' \<equiv> \<lambda>x.
    28.8 -      let (y, a) = SOME (y, a). (x = y + a \<cdot> x' \<and> y \<in> H)
    28.9 -      in (h y) + a * xi"
   28.10 +    "\<And>x. h' x =
   28.11 +      (let (y, a) = SOME (y, a). (x = y + a \<cdot> x' \<and> y \<in> H)
   28.12 +       in (h y) + a * xi)"
   28.13      and x: "x = y + a \<cdot> x'"
   28.14    assumes "vectorspace E" "subspace H E"
   28.15    assumes y: "y \<in> H"
    29.1 --- a/src/HOL/Hilbert_Choice.thy	Sun Apr 24 21:31:14 2016 +0200
    29.2 +++ b/src/HOL/Hilbert_Choice.thy	Mon Apr 25 16:09:26 2016 +0200
    29.3 @@ -110,7 +110,8 @@
    29.4             2: "\<And>x n. P n x \<Longrightarrow> \<exists>y. P (Suc n) y \<and> Q n x y"
    29.5    shows "\<exists>f. \<forall>n. P n (f n) \<and> Q n (f n) (f (Suc n))"
    29.6  proof (intro exI allI conjI)
    29.7 -  fix n def f \<equiv> "rec_nat (SOME x. P 0 x) (\<lambda>n x. SOME y. P (Suc n) y \<and> Q n x y)"
    29.8 +  fix n
    29.9 +  define f where "f = rec_nat (SOME x. P 0 x) (\<lambda>n x. SOME y. P (Suc n) y \<and> Q n x y)"
   29.10    have "P 0 (f 0)" "\<And>n. P n (f n) \<Longrightarrow> P (Suc n) (f (Suc n)) \<and> Q n (f n) (f (Suc n))"
   29.11      using someI_ex[OF 1] someI_ex[OF 2] by (simp_all add: f_def)
   29.12    then show "P n (f n)" "Q n (f n) (f (Suc n))"
   29.13 @@ -309,8 +310,8 @@
   29.14    shows "\<exists>f. inj (f::nat \<Rightarrow> 'a) \<and> range f \<subseteq> S"
   29.15    \<comment> \<open>Courtesy of Stephan Merz\<close>
   29.16  proof -
   29.17 -  def Sseq \<equiv> "rec_nat S (\<lambda>n T. T - {SOME e. e \<in> T})"
   29.18 -  def pick \<equiv> "\<lambda>n. (SOME e. e \<in> Sseq n)"
   29.19 +  define Sseq where "Sseq = rec_nat S (\<lambda>n T. T - {SOME e. e \<in> T})"
   29.20 +  define pick where "pick n = (SOME e. e \<in> Sseq n)" for n
   29.21    { fix n have "Sseq n \<subseteq> S" "\<not> finite (Sseq n)" by (induct n) (auto simp add: Sseq_def inf) }
   29.22    moreover then have *: "\<And>n. pick n \<in> Sseq n"
   29.23      unfolding pick_def by (subst (asm) finite.simps) (auto simp add: ex_in_conv intro: someI_ex)
   29.24 @@ -746,7 +747,7 @@
   29.25      then show False by simp
   29.26    qed
   29.27    then obtain n where n: "f n = f (Suc n)" ..
   29.28 -  def N \<equiv> "LEAST n. f n = f (Suc n)"
   29.29 +  define N where "N = (LEAST n. f n = f (Suc n))"
   29.30    have N: "f N = f (Suc N)"
   29.31      unfolding N_def using n by (rule LeastI)
   29.32    show ?thesis
    30.1 --- a/src/HOL/Isar_Examples/Schroeder_Bernstein.thy	Sun Apr 24 21:31:14 2016 +0200
    30.2 +++ b/src/HOL/Isar_Examples/Schroeder_Bernstein.thy	Mon Apr 25 16:09:26 2016 +0200
    30.3 @@ -21,8 +21,8 @@
    30.4    assumes "inj f" and "inj g"
    30.5    shows "\<exists>h :: 'a \<Rightarrow> 'b. inj h \<and> surj h"
    30.6  proof
    30.7 -  def A \<equiv> "lfp (\<lambda>X. - (g ` (- (f ` X))))"
    30.8 -  def g' \<equiv> "inv g"
    30.9 +  define A where "A = lfp (\<lambda>X. - (g ` (- (f ` X))))"
   30.10 +  define g' where "g' = inv g"
   30.11    let ?h = "\<lambda>z. if z \<in> A then f z else g' z"
   30.12  
   30.13    have "A = - (g ` (- (f ` A)))"
    31.1 --- a/src/HOL/Library/Complete_Partial_Order2.thy	Sun Apr 24 21:31:14 2016 +0200
    31.2 +++ b/src/HOL/Library/Complete_Partial_Order2.thy	Mon Apr 25 16:09:26 2016 +0200
    31.3 @@ -133,7 +133,7 @@
    31.4        fix x
    31.5        assume "x \<in> f y' ` Y"
    31.6        then obtain y where "y \<in> Y" and x: "x = f y' y" by blast
    31.7 -      def y'' \<equiv> "if y \<sqsubseteq> y' then y' else y"
    31.8 +      define y'' where "y'' = (if y \<sqsubseteq> y' then y' else y)"
    31.9        from chain \<open>y \<in> Y\<close> \<open>y' \<in> Y\<close> have "y \<sqsubseteq> y' \<or> y' \<sqsubseteq> y" by(rule chainD)
   31.10        hence "f y' y \<le> f y'' y''" using \<open>y \<in> Y\<close> \<open>y' \<in> Y\<close>
   31.11          by(auto simp add: y''_def intro: mono2 monotoneD[OF mono1])
    32.1 --- a/src/HOL/Library/ContNotDenum.thy	Sun Apr 24 21:31:14 2016 +0200
    32.2 +++ b/src/HOL/Library/ContNotDenum.thy	Mon Apr 25 16:09:26 2016 +0200
    32.3 @@ -46,8 +46,9 @@
    32.4      "\<And>a b c. a < b \<Longrightarrow> c \<notin> {i a b c .. j a b c}"
    32.5      by metis
    32.6  
    32.7 -  def ivl \<equiv> "rec_nat (f 0 + 1, f 0 + 2) (\<lambda>n x. (i (fst x) (snd x) (f n), j (fst x) (snd x) (f n)))"
    32.8 -  def I \<equiv> "\<lambda>n. {fst (ivl n) .. snd (ivl n)}"
    32.9 +  define ivl where "ivl =
   32.10 +    rec_nat (f 0 + 1, f 0 + 2) (\<lambda>n x. (i (fst x) (snd x) (f n), j (fst x) (snd x) (f n)))"
   32.11 +  define I where "I n = {fst (ivl n) .. snd (ivl n)}" for n
   32.12  
   32.13    have ivl[simp]:
   32.14      "ivl 0 = (f 0 + 1, f 0 + 2)"
   32.15 @@ -95,7 +96,7 @@
   32.16    assumes "a < b" "c < d"
   32.17    shows "\<exists>f. bij_betw f {a<..<b} {c<..<d}"
   32.18  proof -
   32.19 -  def f \<equiv> "\<lambda>a b c d x::real. (d - c)/(b - a) * (x - a) + c"
   32.20 +  define f where "f a b c d x = (d - c)/(b - a) * (x - a) + c" for a b c d x :: real
   32.21    { fix a b c d x :: real assume *: "a < b" "c < d" "a < x" "x < b"
   32.22      moreover from * have "(d - c) * (x - a) < (d - c) * (b - a)"
   32.23        by (intro mult_strict_left_mono) simp_all
    33.1 --- a/src/HOL/Library/Convex.thy	Sun Apr 24 21:31:14 2016 +0200
    33.2 +++ b/src/HOL/Library/Convex.thy	Mon Apr 25 16:09:26 2016 +0200
    33.3 @@ -664,7 +664,7 @@
    33.4    shows "(f x - f t) / (x - t) \<le> (f x - f y) / (x - y)"
    33.5      and "(f x - f y) / (x - y) \<le> (f t - f y) / (t - y)"
    33.6  proof -
    33.7 -  def a \<equiv> "(t - y) / (x - y)"
    33.8 +  define a where "a \<equiv> (t - y) / (x - y)"
    33.9    with t have "0 \<le> a" "0 \<le> 1 - a"
   33.10      by (auto simp: field_simps)
   33.11    with f \<open>x \<in> I\<close> \<open>y \<in> I\<close> have cvx: "f (a * x + (1 - a) * y) \<le> a * f x + (1 - a) * f y"
   33.12 @@ -882,7 +882,7 @@
   33.13  proof (rule convex_on_linorderI)
   33.14    fix t x y :: real
   33.15    assume t: "t > 0" "t < 1" and xy: "x \<in> A" "y \<in> A" "x < y"
   33.16 -  def z \<equiv> "(1 - t) * x + t * y"
   33.17 +  define z where "z = (1 - t) * x + t * y"
   33.18    with \<open>connected A\<close> and xy have ivl: "{x..y} \<subseteq> A" using connected_contains_Icc by blast
   33.19  
   33.20    from xy t have xz: "z > x" by (simp add: z_def algebra_simps)
    34.1 --- a/src/HOL/Library/Countable.thy	Sun Apr 24 21:31:14 2016 +0200
    34.2 +++ b/src/HOL/Library/Countable.thy	Mon Apr 25 16:09:26 2016 +0200
    34.3 @@ -142,7 +142,7 @@
    34.4    assumes finite_item: "\<And>x. rep_set x \<Longrightarrow> finite_item x"
    34.5    shows "OFCLASS('b, countable_class)"
    34.6  proof
    34.7 -  def f \<equiv> "\<lambda>y. LEAST n. nth_item n = Rep y"
    34.8 +  define f where "f y = (LEAST n. nth_item n = Rep y)" for y
    34.9    {
   34.10      fix y :: 'b
   34.11      have "rep_set (Rep y)"
    35.1 --- a/src/HOL/Library/Countable_Set_Type.thy	Sun Apr 24 21:31:14 2016 +0200
    35.2 +++ b/src/HOL/Library/Countable_Set_Type.thy	Mon Apr 25 16:09:26 2016 +0200
    35.3 @@ -567,8 +567,8 @@
    35.4     BNF_Def.Grp {x. rcset x \<subseteq> {(a, b). R a b}} (cimage snd)) a b" (is "?L = ?R")
    35.5  proof
    35.6    assume ?L
    35.7 -  def R' \<equiv> "the_inv rcset (Collect (case_prod R) \<inter> (rcset a \<times> rcset b))"
    35.8 -  (is "the_inv rcset ?L'")
    35.9 +  define R' where "R' = the_inv rcset (Collect (case_prod R) \<inter> (rcset a \<times> rcset b))"
   35.10 +    (is "_ = the_inv rcset ?L'")
   35.11    have L: "countable ?L'" by auto
   35.12    hence *: "rcset R' = ?L'" unfolding R'_def by (intro rcset_to_rcset)
   35.13    thus ?R unfolding Grp_def relcompp.simps conversep.simps including cset.lifting
    36.1 --- a/src/HOL/Library/DAList_Multiset.thy	Sun Apr 24 21:31:14 2016 +0200
    36.2 +++ b/src/HOL/Library/DAList_Multiset.thy	Mon Apr 25 16:09:26 2016 +0200
    36.3 @@ -313,7 +313,7 @@
    36.4      have inv: "ys \<in> ?inv"
    36.5        using Cons(2) by auto
    36.6      note IH = Cons(1)[OF inv]
    36.7 -    def Ys \<equiv> "Abs_multiset (count_of ys)"
    36.8 +    define Ys where "Ys = Abs_multiset (count_of ys)"
    36.9      have id: "Abs_multiset (count_of ((a, n) # ys)) = ((op + {# a #}) ^^ n) Ys"
   36.10        unfolding Ys_def
   36.11      proof (rule multiset_eqI, unfold count)
    37.1 --- a/src/HOL/Library/Extended_Real.thy	Sun Apr 24 21:31:14 2016 +0200
    37.2 +++ b/src/HOL/Library/Extended_Real.thy	Mon Apr 25 16:09:26 2016 +0200
    37.3 @@ -3900,7 +3900,7 @@
    37.4    shows   Liminf_inverse_ereal: "Liminf F (\<lambda>x. inverse (f x)) = inverse (Limsup F f)"
    37.5    and     Limsup_inverse_ereal: "Limsup F (\<lambda>x. inverse (f x)) = inverse (Liminf F f)"
    37.6  proof -
    37.7 -  def inv \<equiv> "\<lambda>x. if x \<le> 0 then \<infinity> else inverse x :: ereal"
    37.8 +  define inv where [abs_def]: "inv x = (if x \<le> 0 then \<infinity> else inverse x)" for x :: ereal
    37.9    have "continuous_on ({..0} \<union> {0..}) inv" unfolding inv_def
   37.10      by (intro continuous_on_If) (auto intro!: continuous_intros)
   37.11    also have "{..0} \<union> {0..} = (UNIV :: ereal set)" by auto
    38.1 --- a/src/HOL/Library/FSet.thy	Sun Apr 24 21:31:14 2016 +0200
    38.2 +++ b/src/HOL/Library/FSet.thy	Mon Apr 25 16:09:26 2016 +0200
    38.3 @@ -939,7 +939,8 @@
    38.4    BNF_Def.Grp {a. fset a \<subseteq> {(a, b). R a b}} (fimage snd)) a b" (is "?L = ?R")
    38.5  proof
    38.6    assume ?L
    38.7 -  def R' \<equiv> "the_inv fset (Collect (case_prod R) \<inter> (fset a \<times> fset b))" (is "the_inv fset ?L'")
    38.8 +  define R' where "R' =
    38.9 +    the_inv fset (Collect (case_prod R) \<inter> (fset a \<times> fset b))" (is "_ = the_inv fset ?L'")
   38.10    have "finite ?L'" by (intro finite_Int[OF disjI2] finite_cartesian_product) (transfer, simp)+
   38.11    hence *: "fset R' = ?L'" unfolding R'_def by (intro fset_to_fset)
   38.12    show ?R unfolding Grp_def relcompp.simps conversep.simps
    39.1 --- a/src/HOL/Library/Float.thy	Sun Apr 24 21:31:14 2016 +0200
    39.2 +++ b/src/HOL/Library/Float.thy	Mon Apr 25 16:09:26 2016 +0200
    39.3 @@ -953,7 +953,7 @@
    39.4        then show ?thesis by simp
    39.5      next
    39.6        case False
    39.7 -      def n \<equiv> "\<lfloor>log 2 (real_of_int x)\<rfloor>"
    39.8 +      define n where "n = \<lfloor>log 2 (real_of_int x)\<rfloor>"
    39.9        then have "0 \<le> n"
   39.10          using \<open>2 \<le> x\<close> by simp
   39.11        from \<open>2 \<le> x\<close> False have "x mod 2 = 1" "\<not> 2 dvd x"
   39.12 @@ -1306,7 +1306,7 @@
   39.13    show ?thesis
   39.14    proof (cases "0 \<le> l")
   39.15      case True
   39.16 -    def x' \<equiv> "x * 2 ^ nat l"
   39.17 +    define x' where "x' = x * 2 ^ nat l"
   39.18      have "int x * 2 ^ nat l = x'"
   39.19        by (simp add: x'_def of_nat_mult of_nat_power)
   39.20      moreover have "real x * 2 powr l = real x'"
   39.21 @@ -1319,7 +1319,7 @@
   39.22        by (metis floor_divide_of_int_eq of_int_of_nat_eq)
   39.23     next
   39.24      case False
   39.25 -    def y' \<equiv> "y * 2 ^ nat (- l)"
   39.26 +    define y' where "y' = y * 2 ^ nat (- l)"
   39.27      from \<open>y \<noteq> 0\<close> have "y' \<noteq> 0" by (simp add: y'_def)
   39.28      have "int y * 2 ^ nat (- l) = y'" by (simp add: y'_def of_nat_mult of_nat_power)
   39.29      moreover have "real x * real_of_int (2::int) powr real_of_int l / real y = x / real y'"
   39.30 @@ -1683,14 +1683,14 @@
   39.31    then show ?thesis by simp
   39.32  next
   39.33    case False
   39.34 -  def k \<equiv> "\<lfloor>log 2 \<bar>ai\<bar>\<rfloor>"
   39.35 +  define k where "k = \<lfloor>log 2 \<bar>ai\<bar>\<rfloor>"
   39.36    then have "\<lfloor>log 2 \<bar>ai\<bar>\<rfloor> = k"
   39.37      by simp
   39.38    then have k: "2 powr k \<le> \<bar>ai\<bar>" "\<bar>ai\<bar> < 2 powr (k + 1)"
   39.39      by (simp_all add: floor_log_eq_powr_iff \<open>ai \<noteq> 0\<close>)
   39.40    have "k \<ge> 0"
   39.41      using assms by (auto simp: k_def)
   39.42 -  def r \<equiv> "\<bar>ai\<bar> - 2 ^ nat k"
   39.43 +  define r where "r = \<bar>ai\<bar> - 2 ^ nat k"
   39.44    have r: "0 \<le> r" "r < 2 powr k"
   39.45      using \<open>k \<ge> 0\<close> k
   39.46      by (auto simp: r_def k_def algebra_simps powr_add abs_if powr_int)
    40.1 --- a/src/HOL/Library/Formal_Power_Series.thy	Sun Apr 24 21:31:14 2016 +0200
    40.2 +++ b/src/HOL/Library/Formal_Power_Series.thy	Mon Apr 25 16:09:26 2016 +0200
    40.3 @@ -1157,8 +1157,8 @@
    40.4    shows   "f div g * g = f"
    40.5  proof (cases "f = 0")
    40.6    assume nz: "f \<noteq> 0"
    40.7 -  def n \<equiv> "subdegree g"
    40.8 -  def h \<equiv> "fps_shift n g"
    40.9 +  define n where "n = subdegree g"
   40.10 +  define h where "h = fps_shift n g"
   40.11    from assms have [simp]: "h $ 0 \<noteq> 0" unfolding h_def by (simp add: n_def)
   40.12  
   40.13    from assms nz have "f div g * g = fps_shift n (f * inverse h) * g"
   40.14 @@ -1217,8 +1217,8 @@
   40.15  
   40.16  instance proof
   40.17    fix f g :: "'a fps"
   40.18 -  def n \<equiv> "subdegree g"
   40.19 -  def h \<equiv> "fps_shift n g"
   40.20 +  define n where "n = subdegree g"
   40.21 +  define h where "h = fps_shift n g"
   40.22  
   40.23    show "f div g * g + f mod g = f"
   40.24    proof (cases "g = 0 \<or> f = 0")
   40.25 @@ -1248,8 +1248,8 @@
   40.26    assume "h \<noteq> 0"
   40.27    show "(h * f) div (h * g) = f div g"
   40.28    proof -
   40.29 -    def m \<equiv> "subdegree h"
   40.30 -    def h' \<equiv> "fps_shift m h"
   40.31 +    define m where "m = subdegree h"
   40.32 +    define h' where "h' = fps_shift m h"
   40.33      have h_decomp: "h = h' * X ^ m" unfolding h'_def m_def by (rule subdegree_decompose)
   40.34      from \<open>h \<noteq> 0\<close> have [simp]: "h'$0 \<noteq> 0" by (simp add: h'_def m_def)
   40.35      have "(h * f) div (h * g) = (h' * f * X^m) div (h' * g * X^m)"
   40.36 @@ -1261,9 +1261,7 @@
   40.37  next
   40.38    fix f g h :: "'a fps"
   40.39    assume [simp]: "h \<noteq> 0"
   40.40 -  def n \<equiv> "subdegree h"
   40.41 -  def h' \<equiv> "fps_shift n h"
   40.42 -  note dfs = n_def h'_def
   40.43 +  define n h' where dfs: "n = subdegree h" "h' = fps_shift n h"
   40.44    have "(f + g * h) div h = fps_shift n (f * inverse h') + fps_shift n (g * (h * inverse h'))"
   40.45      by (simp add: fps_divide_def Let_def dfs[symmetric] algebra_simps fps_shift_add)
   40.46    also have "h * inverse h' = (inverse h' * h') * X^n"
    41.1 --- a/src/HOL/Library/Fun_Lexorder.thy	Sun Apr 24 21:31:14 2016 +0200
    41.2 +++ b/src/HOL/Library/Fun_Lexorder.thy	Mon Apr 25 16:09:26 2016 +0200
    41.3 @@ -76,12 +76,12 @@
    41.4    assumes "finite {k. f k \<noteq> g k}"
    41.5    shows "less_fun f g \<or> f = g \<or> less_fun g f"
    41.6  proof -
    41.7 -  { def K \<equiv> "{k. f k \<noteq> g k}"
    41.8 +  { define K where "K = {k. f k \<noteq> g k}"
    41.9      assume "f \<noteq> g"
   41.10      then obtain k' where "f k' \<noteq> g k'" by auto
   41.11      then have [simp]: "K \<noteq> {}" by (auto simp add: K_def)
   41.12      with assms have [simp]: "finite K" by (simp add: K_def)
   41.13 -    def q \<equiv> "Min K"
   41.14 +    define q where "q = Min K"
   41.15      then have "q \<in> K" and "\<And>k. k \<in> K \<Longrightarrow> k \<ge> q" by auto
   41.16      then have "\<And>k. \<not> k \<ge> q \<Longrightarrow> k \<notin> K" by blast
   41.17      then have *: "\<And>k. k < q \<Longrightarrow> f k = g k" by (simp add: K_def)
    42.1 --- a/src/HOL/Library/Function_Growth.thy	Sun Apr 24 21:31:14 2016 +0200
    42.2 +++ b/src/HOL/Library/Function_Growth.thy	Mon Apr 25 16:09:26 2016 +0200
    42.3 @@ -35,7 +35,7 @@
    42.4    assumes "m \<ge> n"
    42.5    shows "a ^ (m - n) = (a ^ m) div (a ^ n)"
    42.6  proof -
    42.7 -  def q == "m - n"
    42.8 +  define q where "q = m - n"
    42.9    moreover with assms have "m = q + n" by (simp add: q_def)
   42.10    ultimately show ?thesis using \<open>a \<noteq> 0\<close> by (simp add: power_add)
   42.11  qed
    43.1 --- a/src/HOL/Library/More_List.thy	Sun Apr 24 21:31:14 2016 +0200
    43.2 +++ b/src/HOL/Library/More_List.thy	Mon Apr 25 16:09:26 2016 +0200
    43.3 @@ -165,7 +165,7 @@
    43.4  lemma strip_while_idem_iff:
    43.5    "strip_while P xs = xs \<longleftrightarrow> no_trailing P xs"
    43.6  proof -
    43.7 -  def ys \<equiv> "rev xs"
    43.8 +  define ys where "ys = rev xs"
    43.9    moreover have "strip_while P (rev ys) = rev ys \<longleftrightarrow> no_trailing P (rev ys)"
   43.10      by (simp add: dropWhile_idem_iff)
   43.11    ultimately show ?thesis by simp
    44.1 --- a/src/HOL/Library/Multiset.thy	Sun Apr 24 21:31:14 2016 +0200
    44.2 +++ b/src/HOL/Library/Multiset.thy	Mon Apr 25 16:09:26 2016 +0200
    44.3 @@ -1071,7 +1071,7 @@
    44.4        by (simp add: fold_mset_def del: count_union)
    44.5    next
    44.6      case True
    44.7 -    def N \<equiv> "set_mset M - {x}"
    44.8 +    define N where "N = set_mset M - {x}"
    44.9      from N_def True have *: "set_mset M = insert x N" "x \<notin> N" "finite N" by auto
   44.10      then have "Finite_Set.fold (\<lambda>y. f y ^^ count (M + {#x#}) y) s N =
   44.11        Finite_Set.fold (\<lambda>y. f y ^^ count M y) s N"
   44.12 @@ -2617,7 +2617,7 @@
   44.13    obtain j where j_len: "j < length xs'" and nth_j: "xs' ! j = x"
   44.14      by (metis Cons.prems in_set_conv_nth list.set_intros(1) mset_eq_setD)
   44.15  
   44.16 -  def xsa \<equiv> "take j xs' @ drop (Suc j) xs'"
   44.17 +  define xsa where "xsa = take j xs' @ drop (Suc j) xs'"
   44.18    have "mset xs' = {#x#} + mset xsa"
   44.19      unfolding xsa_def using j_len nth_j
   44.20      by (metis (no_types) ab_semigroup_add_class.add_ac(1) append_take_drop_id Cons_nth_drop_Suc
   44.21 @@ -2628,7 +2628,7 @@
   44.22      len_a: "length ysa = length xsa" and ms_a: "mset (zip xsa ysa) = mset (zip xs ys)"
   44.23      using Cons.hyps(2) by blast
   44.24  
   44.25 -  def ys' \<equiv> "take j ysa @ y # drop j ysa"
   44.26 +  define ys' where "ys' = take j ysa @ y # drop j ysa"
   44.27    have xs': "xs' = take j xsa @ x # drop j xsa"
   44.28      using ms_x j_len nth_j Cons.prems xsa_def
   44.29      by (metis append_eq_append_conv append_take_drop_id diff_Suc_Suc Cons_nth_drop_Suc length_Cons
    45.1 --- a/src/HOL/Library/Multiset_Order.thy	Sun Apr 24 21:31:14 2016 +0200
    45.2 +++ b/src/HOL/Library/Multiset_Order.thy	Mon Apr 25 16:09:26 2016 +0200
    45.3 @@ -157,8 +157,8 @@
    45.4    assume "less_multiset\<^sub>H\<^sub>O M N"
    45.5    then obtain z where z: "count M z < count N z"
    45.6      unfolding less_multiset\<^sub>H\<^sub>O_def by (auto simp: multiset_eq_iff nat_neq_iff)
    45.7 -  def X \<equiv> "N - M"
    45.8 -  def Y \<equiv> "M - N"
    45.9 +  define X where "X = N - M"
   45.10 +  define Y where "Y = M - N"
   45.11    from z show "X \<noteq> {#}" unfolding X_def by (auto simp: multiset_eq_iff not_less_eq_eq Suc_le_eq)
   45.12    from z show "X \<le># N" unfolding X_def by auto
   45.13    show "M = (N - X) + Y" unfolding X_def Y_def multiset_eq_iff count_union count_diff by force
    46.1 --- a/src/HOL/Library/Omega_Words_Fun.thy	Sun Apr 24 21:31:14 2016 +0200
    46.2 +++ b/src/HOL/Library/Omega_Words_Fun.thy	Mon Apr 25 16:09:26 2016 +0200
    46.3 @@ -355,7 +355,7 @@
    46.4    assumes "A \<inter> range w \<noteq> {}"
    46.5    obtains u a v where "w = u \<frown> [a] \<frown> v" "A \<inter> set u = {}" "a \<in> A"
    46.6  proof -
    46.7 -  def i \<equiv> "LEAST i. w i \<in> A"
    46.8 +  define i where "i = (LEAST i. w i \<in> A)"
    46.9    show ?thesis
   46.10    proof
   46.11      show "w = prefix i w \<frown> [w i] \<frown> suffix (Suc i) w"
    47.1 --- a/src/HOL/Library/Polynomial.thy	Sun Apr 24 21:31:14 2016 +0200
    47.2 +++ b/src/HOL/Library/Polynomial.thy	Mon Apr 25 16:09:26 2016 +0200
    47.3 @@ -1529,7 +1529,7 @@
    47.4    case (Suc n q r dr)
    47.5    let ?rr = "smult lc r"
    47.6    let ?qq = "coeff r dr"
    47.7 -  def [simp]: b \<equiv> "monom ?qq n"
    47.8 +  define b where [simp]: "b = monom ?qq n"
    47.9    let ?rrr = "?rr - b * d"
   47.10    let ?qqq = "smult lc q + b"
   47.11    note res = Suc(3)
   47.12 @@ -1610,7 +1610,7 @@
   47.13  proof - 
   47.14    let ?cg = "coeff g (degree g)"
   47.15    let ?cge = "?cg ^ (Suc (degree f) - degree g)"
   47.16 -  def a \<equiv> ?cge
   47.17 +  define a where "a = ?cge"
   47.18    obtain q where pdm: "pseudo_divmod f g = (q,r)" using r_def[unfolded pseudo_mod_def]
   47.19      by (cases "pseudo_divmod f g", auto)
   47.20    from pseudo_divmod[OF g pdm] have id: "smult a f = g * q + r" and "r = 0 \<or> degree r < degree g" 
   47.21 @@ -1649,7 +1649,7 @@
   47.22    let ?rr = "d * r"
   47.23    let ?a = "coeff ?rr dr"
   47.24    let ?qq = "?a div lc"
   47.25 -  def [simp]: b \<equiv> "monom ?qq n"
   47.26 +  define b where [simp]: "b = monom ?qq n"
   47.27    let ?rrr =  "d * (r - b)"
   47.28    let ?qqq = "q + b"
   47.29    note res = Suc(3)
   47.30 @@ -2434,8 +2434,8 @@
   47.31       in (smult ilc q, r))" (is "?l = ?r")
   47.32  proof (cases "g = 0")
   47.33    case False
   47.34 -  def lc \<equiv> "inverse (coeff g (degree g))"
   47.35 -  def h \<equiv> "smult lc g"
   47.36 +  define lc where "lc = inverse (coeff g (degree g))"
   47.37 +  define h where "h = smult lc g"
   47.38    from False have h1: "coeff h (degree h) = 1" and lc: "lc \<noteq> 0" unfolding h_def lc_def by auto
   47.39    hence h0: "h \<noteq> 0" by auto
   47.40    obtain q r where p: "pseudo_divmod f h = (q,r)" by force
   47.41 @@ -2468,7 +2468,7 @@
   47.42      case True thus ?thesis unfolding d by auto
   47.43    next
   47.44      case False
   47.45 -    def ilc \<equiv> "inverse (coeff g (degree g))"
   47.46 +    define ilc where "ilc = inverse (coeff g (degree g))"
   47.47      from False have ilc: "ilc \<noteq> 0" unfolding ilc_def by auto
   47.48      with False have id: "(g = 0) = False" "(coeffs g = []) = False" 
   47.49        "last (coeffs g) = coeff g (degree g)" 
   47.50 @@ -2756,9 +2756,9 @@
   47.51    assumes "P 0 0" "\<And>a p b q. P p q \<Longrightarrow> P (pCons a p) (pCons b q)"
   47.52    shows   "P p q"
   47.53  proof -
   47.54 -  def n \<equiv> "max (length (coeffs p)) (length (coeffs q))"
   47.55 -  def xs \<equiv> "coeffs p @ (replicate (n - length (coeffs p)) 0)"
   47.56 -  def ys \<equiv> "coeffs q @ (replicate (n - length (coeffs q)) 0)"
   47.57 +  define n where "n = max (length (coeffs p)) (length (coeffs q))"
   47.58 +  define xs where "xs = coeffs p @ (replicate (n - length (coeffs p)) 0)"
   47.59 +  define ys where "ys = coeffs q @ (replicate (n - length (coeffs q)) 0)"
   47.60    have "length xs = length ys" 
   47.61      by (simp add: xs_def ys_def n_def)
   47.62    hence "P (Poly xs) (Poly ys)" 
   47.63 @@ -3284,7 +3284,7 @@
   47.64        assume "p\<noteq>0"
   47.65        then obtain n1 where gte_lcoeff:"\<forall>x\<ge>n1. lead_coeff p \<le> poly p x" using that pCons by auto
   47.66        have gt_0:"lead_coeff p >0" using pCons(3) \<open>p\<noteq>0\<close> by auto
   47.67 -      def n\<equiv>"max n1 (1+ \<bar>a\<bar>/(lead_coeff p))"
   47.68 +      define n where "n = max n1 (1+ \<bar>a\<bar>/(lead_coeff p))"
   47.69        show ?thesis 
   47.70          proof (rule_tac x=n in exI,rule,rule) 
   47.71            fix x assume "n \<le> x"
   47.72 @@ -3351,13 +3351,13 @@
   47.73    shows "algebraic x \<longleftrightarrow> (\<exists>p. (\<forall>i. coeff p i \<in> \<rat>) \<and> p \<noteq> 0 \<and> poly p x = 0)"
   47.74  proof safe
   47.75    fix p assume rat: "\<forall>i. coeff p i \<in> \<rat>" and root: "poly p x = 0" and nz: "p \<noteq> 0"
   47.76 -  def cs \<equiv> "coeffs p"
   47.77 +  define cs where "cs = coeffs p"
   47.78    from rat have "\<forall>c\<in>range (coeff p). \<exists>c'. c = of_rat c'" unfolding Rats_def by blast
   47.79    then obtain f where f: "\<And>i. coeff p i = of_rat (f (coeff p i))" 
   47.80      by (subst (asm) bchoice_iff) blast
   47.81 -  def cs' \<equiv> "map (quotient_of \<circ> f) (coeffs p)"
   47.82 -  def d \<equiv> "Lcm (set (map snd cs'))"
   47.83 -  def p' \<equiv> "smult (of_int d) p"
   47.84 +  define cs' where "cs' = map (quotient_of \<circ> f) (coeffs p)"
   47.85 +  define d where "d = Lcm (set (map snd cs'))"
   47.86 +  define p' where "p' = smult (of_int d) p"
   47.87    
   47.88    have "\<forall>n. coeff p' n \<in> \<int>"
   47.89    proof
   47.90 @@ -3365,8 +3365,9 @@
   47.91      show "coeff p' n \<in> \<int>"
   47.92      proof (cases "n \<le> degree p")
   47.93        case True
   47.94 -      def c \<equiv> "coeff p n"
   47.95 -      def a \<equiv> "fst (quotient_of (f (coeff p n)))" and b \<equiv> "snd (quotient_of (f (coeff p n)))"
   47.96 +      define c where "c = coeff p n"
   47.97 +      define a where "a = fst (quotient_of (f (coeff p n)))"
   47.98 +      define b where "b = snd (quotient_of (f (coeff p n)))"
   47.99        have b_pos: "b > 0" unfolding b_def using quotient_of_denom_pos' by simp
  47.100        have "coeff p' n = of_int d * coeff p n" by (simp add: p'_def)
  47.101        also have "coeff p n = of_rat (of_int a / of_int b)" unfolding a_def b_def
  47.102 @@ -3483,9 +3484,9 @@
  47.103  
  47.104  lemma order_mult: "p * q \<noteq> 0 \<Longrightarrow> order a (p * q) = order a p + order a q"
  47.105  proof -
  47.106 -  def i \<equiv> "order a p"
  47.107 -  def j \<equiv> "order a q"
  47.108 -  def t \<equiv> "[:-a, 1:]"
  47.109 +  define i where "i = order a p"
  47.110 +  define j where "j = order a q"
  47.111 +  define t where "t = [:-a, 1:]"
  47.112    have t_dvd_iff: "\<And>u. t dvd u \<longleftrightarrow> poly u a = 0"
  47.113      unfolding t_def by (simp add: dvd_iff_poly_eq_0)
  47.114    assume "p * q \<noteq> 0"
    48.1 --- a/src/HOL/Library/Product_Vector.thy	Sun Apr 24 21:31:14 2016 +0200
    48.2 +++ b/src/HOL/Library/Product_Vector.thy	Mon Apr 25 16:09:26 2016 +0200
    48.3 @@ -125,12 +125,14 @@
    48.4        fix x assume "x \<in> S"
    48.5        then obtain e where "0 < e" and S: "\<forall>y. dist y x < e \<longrightarrow> y \<in> S"
    48.6          using * by fast
    48.7 -      def r \<equiv> "e / sqrt 2" and s \<equiv> "e / sqrt 2"
    48.8 +      define r where "r = e / sqrt 2"
    48.9 +      define s where "s = e / sqrt 2"
   48.10        from \<open>0 < e\<close> have "0 < r" and "0 < s"
   48.11          unfolding r_def s_def by simp_all
   48.12        from \<open>0 < e\<close> have "e = sqrt (r\<^sup>2 + s\<^sup>2)"
   48.13          unfolding r_def s_def by (simp add: power_divide)
   48.14 -      def A \<equiv> "{y. dist (fst x) y < r}" and B \<equiv> "{y. dist (snd x) y < s}"
   48.15 +      define A where "A = {y. dist (fst x) y < r}"
   48.16 +      define B where "B = {y. dist (snd x) y < s}"
   48.17        have "open A" and "open B"
   48.18          unfolding A_def B_def by (simp_all add: open_ball)
   48.19        moreover have "x \<in> A \<times> B"
    49.1 --- a/src/HOL/Library/RBT_Impl.thy	Sun Apr 24 21:31:14 2016 +0200
    49.2 +++ b/src/HOL/Library/RBT_Impl.thy	Mon Apr 25 16:09:26 2016 +0200
    49.3 @@ -906,7 +906,7 @@
    49.4    qed simp+
    49.5  next    
    49.6    case (3 xx lta zz vv rta yy ss bb)
    49.7 -  def mt[simp]: mt == "Branch B lta zz vv rta"
    49.8 +  define mt where [simp]: "mt = Branch B lta zz vv rta"
    49.9    from 3 have "inv2 mt \<and> inv1 mt" by simp
   49.10    hence "inv2 (rbt_del xx mt) \<and> (color_of mt = R \<and> bheight (rbt_del xx mt) = bheight mt \<and> inv1 (rbt_del xx mt) \<or> color_of mt = B \<and> bheight (rbt_del xx mt) = bheight mt - 1 \<and> inv1l (rbt_del xx mt))" by (blast dest: rbt_del_inv1_inv2)
   49.11    with 3 have 4: "entry_in_tree k v (rbt_del_from_left xx mt yy ss bb) = (False \<or> xx \<noteq> k \<and> entry_in_tree k v mt \<or> (k = yy \<and> v = ss) \<or> entry_in_tree k v bb)" by (simp add: balance_left_in_tree)
   49.12 @@ -936,7 +936,7 @@
   49.13    qed auto
   49.14  next
   49.15    case (5 xx aa yy ss lta zz vv rta)
   49.16 -  def mt[simp]: mt == "Branch B lta zz vv rta"
   49.17 +  define mt where [simp]: "mt = Branch B lta zz vv rta"
   49.18    from 5 have "inv2 mt \<and> inv1 mt" by simp
   49.19    hence "inv2 (rbt_del xx mt) \<and> (color_of mt = R \<and> bheight (rbt_del xx mt) = bheight mt \<and> inv1 (rbt_del xx mt) \<or> color_of mt = B \<and> bheight (rbt_del xx mt) = bheight mt - 1 \<and> inv1l (rbt_del xx mt))" by (blast dest: rbt_del_inv1_inv2)
   49.20    with 5 have 3: "entry_in_tree k v (rbt_del_from_right xx aa yy ss mt) = (entry_in_tree k v aa \<or> (k = yy \<and> v = ss) \<or> False \<or> xx \<noteq> k \<and> entry_in_tree k v mt)" by (simp add: balance_right_in_tree)
   49.21 @@ -1924,7 +1924,7 @@
   49.22    assumes "is_rbt t1"
   49.23    shows "is_rbt (fold (rbt_insert_with_key f) t2 t1)"
   49.24  proof -
   49.25 -  def xs \<equiv> "entries t2"
   49.26 +  define xs where "xs = entries t2"
   49.27    from assms show ?thesis unfolding fold_def xs_def[symmetric]
   49.28      by(induct xs rule: rev_induct)(auto simp add: rbt_insertwk_is_rbt)
   49.29  qed
   49.30 @@ -1936,7 +1936,7 @@
   49.31     | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v
   49.32                 | Some w \<Rightarrow> Some (f k w v))"
   49.33  proof -
   49.34 -  def xs \<equiv> "entries t1"
   49.35 +  define xs where "xs = entries t1"
   49.36    hence dt1: "distinct (map fst xs)" using t1 by(simp add: distinct_entries)
   49.37    with t2 show ?thesis
   49.38      unfolding fold_def map_of_entries[OF t1, symmetric]
    50.1 --- a/src/HOL/Library/While_Combinator.thy	Sun Apr 24 21:31:14 2016 +0200
    50.2 +++ b/src/HOL/Library/While_Combinator.thy	Mon Apr 25 16:09:26 2016 +0200
    50.3 @@ -60,12 +60,12 @@
    50.4  by(metis while_option_stop2)
    50.5  
    50.6  theorem while_option_rule:
    50.7 -assumes step: "!!s. P s ==> b s ==> P (c s)"
    50.8 -and result: "while_option b c s = Some t"
    50.9 -and init: "P s"
   50.10 -shows "P t"
   50.11 +  assumes step: "!!s. P s ==> b s ==> P (c s)"
   50.12 +    and result: "while_option b c s = Some t"
   50.13 +    and init: "P s"
   50.14 +  shows "P t"
   50.15  proof -
   50.16 -  def k == "LEAST k. ~ b ((c ^^ k) s)"
   50.17 +  define k where "k = (LEAST k. ~ b ((c ^^ k) s))"
   50.18    from assms have t: "t = (c ^^ k) s"
   50.19      by (simp add: while_option_def k_def split: if_splits)    
   50.20    have 1: "ALL i<k. b ((c ^^ i) s)"
    51.1 --- a/src/HOL/Lifting_Set.thy	Sun Apr 24 21:31:14 2016 +0200
    51.2 +++ b/src/HOL/Lifting_Set.thy	Mon Apr 25 16:09:26 2016 +0200
    51.3 @@ -80,7 +80,7 @@
    51.4    assumes "bi_unique R" and "rel_set R X Y"
    51.5    obtains f where "Y = image f X" and "inj_on f X" and "\<forall>x\<in>X. R x (f x)"
    51.6  proof
    51.7 -  def f \<equiv> "\<lambda>x. THE y. R x y"
    51.8 +  define f where "f x = (THE y. R x y)" for x
    51.9    { fix x assume "x \<in> X"
   51.10      with \<open>rel_set R X Y\<close> \<open>bi_unique R\<close> have "R x (f x)"
   51.11        by (simp add: bi_unique_def rel_set_def f_def) (metis theI)
    52.1 --- a/src/HOL/Limits.thy	Sun Apr 24 21:31:14 2016 +0200
    52.2 +++ b/src/HOL/Limits.thy	Mon Apr 25 16:09:26 2016 +0200
    52.3 @@ -1070,8 +1070,9 @@
    52.4  lemma tendsto_of_nat [tendsto_intros]:
    52.5    "filterlim (of_nat :: nat \<Rightarrow> 'a :: real_normed_algebra_1) at_infinity sequentially"
    52.6  proof (subst filterlim_at_infinity[OF order.refl], intro allI impI)
    52.7 -  fix r :: real assume r: "r > 0"
    52.8 -  def n \<equiv> "nat \<lceil>r\<rceil>"
    52.9 +  fix r :: real
   52.10 +  assume r: "r > 0"
   52.11 +  define n where "n = nat \<lceil>r\<rceil>"
   52.12    from r have n: "\<forall>m\<ge>n. of_nat m \<ge> r" unfolding n_def by linarith
   52.13    from eventually_ge_at_top[of n] show "eventually (\<lambda>m. norm (of_nat m :: 'a) \<ge> r) sequentially"
   52.14      by eventually_elim (insert n, simp_all)
   52.15 @@ -2199,8 +2200,9 @@
   52.16    assumes local: "\<And>x. a \<le> x \<Longrightarrow> x \<le> b \<Longrightarrow> \<exists>d>0. \<forall>a b. a \<le> x \<and> x \<le> b \<and> b - a < d \<longrightarrow> P a b"
   52.17    shows "P a b"
   52.18  proof -
   52.19 -  def bisect \<equiv> "rec_nat (a, b) (\<lambda>n (x, y). if P x ((x+y) / 2) then ((x+y)/2, y) else (x, (x+y)/2))"
   52.20 -  def l \<equiv> "\<lambda>n. fst (bisect n)" and u \<equiv> "\<lambda>n. snd (bisect n)"
   52.21 +  define bisect where "bisect =
   52.22 +    rec_nat (a, b) (\<lambda>n (x, y). if P x ((x+y) / 2) then ((x+y)/2, y) else (x, (x+y)/2))"
   52.23 +  define l u where "l n = fst (bisect n)" and "u n = snd (bisect n)" for n
   52.24    have l[simp]: "l 0 = a" "\<And>n. l (Suc n) = (if P (l n) ((l n + u n) / 2) then (l n + u n) / 2 else l n)"
   52.25      and u[simp]: "u 0 = b" "\<And>n. u (Suc n) = (if P (l n) ((l n + u n) / 2) then u n else (l n + u n) / 2)"
   52.26      by (simp_all add: l_def u_def bisect_def split: prod.split)
   52.27 @@ -2243,7 +2245,7 @@
   52.28  lemma compact_Icc[simp, intro]: "compact {a .. b::real}"
   52.29  proof (cases "a \<le> b", rule compactI)
   52.30    fix C assume C: "a \<le> b" "\<forall>t\<in>C. open t" "{a..b} \<subseteq> \<Union>C"
   52.31 -  def T == "{a .. b}"
   52.32 +  define T where "T = {a .. b}"
   52.33    from C(1,3) show "\<exists>C'\<subseteq>C. finite C' \<and> {a..b} \<subseteq> \<Union>C'"
   52.34    proof (induct rule: Bolzano)
   52.35      case (trans a b c)
    53.1 --- a/src/HOL/List.thy	Sun Apr 24 21:31:14 2016 +0200
    53.2 +++ b/src/HOL/List.thy	Mon Apr 25 16:09:26 2016 +0200
    53.3 @@ -3468,7 +3468,7 @@
    53.4      case (3 x1 x2 xs ys)
    53.5      let ?xs = "x1 # x2 # xs"
    53.6      let ?cond = "x1 = x2"
    53.7 -    def zs \<equiv> "remdups_adj (x2 # xs)"
    53.8 +    define zs where "zs = remdups_adj (x2 # xs)"
    53.9      from 3(1-2)[of zs]
   53.10      obtain f where p: "?p f (x2 # xs) zs" unfolding zs_def by (cases ?cond) auto
   53.11      then have f0: "f 0 = 0"
   53.12 @@ -3585,7 +3585,7 @@
   53.13          apply (rename_tac [2] ys', case_tac [2] ys')
   53.14          by (auto simp: \<open>f 0 = 0\<close> \<open>f (Suc 0) = Suc 0\<close>)
   53.15  
   53.16 -      def f' \<equiv> "\<lambda>x. f (Suc x) - 1"
   53.17 +      define f' where "f' x = f (Suc x) - 1" for x
   53.18  
   53.19        { fix i
   53.20          have "Suc 0 \<le> f (Suc 0)" using f_nth[of 0] \<open>x1 \<noteq> x2\<close> \<open>f 0 = 0\<close>  by auto
   53.21 @@ -4046,8 +4046,8 @@
   53.22  proof (induct "length (xs @ ys)" arbitrary: xs ys rule: less_induct)
   53.23    case less
   53.24  
   53.25 -  def xs' \<equiv> "if (length xs \<le> length ys) then xs else ys"
   53.26 -    and ys' \<equiv> "if (length xs \<le> length ys) then ys else xs"
   53.27 +  define xs' ys' where "xs' = (if (length xs \<le> length ys) then xs else ys)"
   53.28 +    and "ys' = (if (length xs \<le> length ys) then ys else xs)"
   53.29    then have
   53.30      prems': "length xs' \<le> length ys'"
   53.31              "xs' @ ys' = ys' @ xs'"
   53.32 @@ -4499,7 +4499,7 @@
   53.33    shows "transpose xs ! i = map (\<lambda>xs. xs ! i) [ys \<leftarrow> xs. i < length ys]"
   53.34  using assms proof (induct arbitrary: i rule: transpose.induct)
   53.35    case (3 x xs xss)
   53.36 -  def XS == "(x # xs) # xss"
   53.37 +  define XS where "XS = (x # xs) # xss"
   53.38    hence [simp]: "XS \<noteq> []" by auto
   53.39    thus ?case
   53.40    proof (cases i)
    54.1 --- a/src/HOL/MacLaurin.thy	Sun Apr 24 21:31:14 2016 +0200
    54.2 +++ b/src/HOL/MacLaurin.thy	Mon Apr 25 16:09:26 2016 +0200
    54.3 @@ -85,22 +85,22 @@
    54.4          (\<Sum>m<n. diff m (0::real) / (fact m) * h ^ m) + B * (h ^ n / (fact n))"
    54.5      using Maclaurin_lemma [OF h] ..
    54.6  
    54.7 -  def g \<equiv> "(\<lambda>t. f t -
    54.8 -    (setsum (\<lambda>m. (diff m 0 / (fact m)) * t^m) {..<n} + (B * (t^n / (fact n)))))"
    54.9 +  define g where [abs_def]: "g t =
   54.10 +    f t - (setsum (\<lambda>m. (diff m 0 / (fact m)) * t^m) {..<n} + (B * (t^n / (fact n))))" for t
   54.11  
   54.12    have g2: "g 0 = 0 & g h = 0"
   54.13      by (simp add: m f_h g_def lessThan_Suc_eq_insert_0 image_iff diff_0 setsum.reindex)
   54.14  
   54.15 -  def difg \<equiv> "(%m t. diff m t -
   54.16 -    (setsum (%p. (diff (m + p) 0 / (fact p)) * (t ^ p)) {..<n-m}
   54.17 -      + (B * ((t ^ (n - m)) / (fact (n - m))))))"
   54.18 +  define difg where [abs_def]: "difg m t =
   54.19 +    diff m t - (setsum (%p. (diff (m + p) 0 / (fact p)) * (t ^ p)) {..<n-m}
   54.20 +      + (B * ((t ^ (n - m)) / (fact (n - m)))))" for m t
   54.21  
   54.22    have difg_0: "difg 0 = g"
   54.23      unfolding difg_def g_def by (simp add: diff_0)
   54.24  
   54.25    have difg_Suc: "\<forall>(m::nat) t::real.
   54.26          m < n \<and> (0::real) \<le> t \<and> t \<le> h \<longrightarrow> DERIV (difg m) t :> difg (Suc m) t"
   54.27 -    using diff_Suc m unfolding difg_def by (rule Maclaurin_lemma2)
   54.28 +    using diff_Suc m unfolding difg_def [abs_def] by (rule Maclaurin_lemma2)
   54.29  
   54.30    have difg_eq_0: "\<forall>m<n. difg m 0 = 0"
   54.31      by (auto simp: difg_def m Suc_diff_le lessThan_Suc_eq_insert_0 image_iff setsum.reindex)
    55.1 --- a/src/HOL/Metis_Examples/Tarski.thy	Sun Apr 24 21:31:14 2016 +0200
    55.2 +++ b/src/HOL/Metis_Examples/Tarski.thy	Mon Apr 25 16:09:26 2016 +0200
    55.3 @@ -461,7 +461,7 @@
    55.4  (*never proved, 2007-01-22*)
    55.5  apply (rule transE)
    55.6  -- {* instantiates @{text "(x, ?z) \<in> order cl to (x, f x)"}, *}
    55.7 --- {* because of the def of @{text H} *}
    55.8 +-- {* because of the definition of @{text H} *}
    55.9  apply fast
   55.10  -- {* so it remains to show @{text "(f x, f (lub H cl)) \<in> r"} *}
   55.11  apply (rule_tac f = "f" in monotoneE)
    56.1 --- a/src/HOL/MicroJava/Comp/Index.thy	Sun Apr 24 21:31:14 2016 +0200
    56.2 +++ b/src/HOL/MicroJava/Comp/Index.thy	Mon Apr 25 16:09:26 2016 +0200
    56.3 @@ -98,7 +98,7 @@
    56.4  
    56.5  
    56.6  
    56.7 -(* The following def should replace the conditions in WellType.thy / wf_java_mdecl
    56.8 +(* The following definition should replace the conditions in WellType.thy / wf_java_mdecl
    56.9  *)
   56.10  definition disjoint_varnames :: "[vname list, (vname \<times> ty) list] \<Rightarrow> bool" where
   56.11    "disjoint_varnames pns lvars \<equiv> 
    57.1 --- a/src/HOL/Multivariate_Analysis/Bounded_Linear_Function.thy	Sun Apr 24 21:31:14 2016 +0200
    57.2 +++ b/src/HOL/Multivariate_Analysis/Bounded_Linear_Function.thy	Mon Apr 25 16:09:26 2016 +0200
    57.3 @@ -244,7 +244,7 @@
    57.4        hence "convergent (\<lambda>n. X n x)"
    57.5          by (metis Cauchy_convergent_iff)
    57.6      } note convergent_norm1 = this
    57.7 -    def y \<equiv> "x /\<^sub>R norm x"
    57.8 +    define y where "y = x /\<^sub>R norm x"
    57.9      have y: "norm y \<le> 1" and xy: "x = norm x *\<^sub>R y"
   57.10        by (simp_all add: y_def inverse_eq_divide)
   57.11      have "convergent (\<lambda>n. norm x *\<^sub>R X n y)"
   57.12 @@ -301,7 +301,7 @@
   57.13    have "X \<longlonglongrightarrow> Blinfun v"
   57.14    proof (rule LIMSEQ_I)
   57.15      fix r::real assume "r > 0"
   57.16 -    def r' \<equiv> "r / 2"
   57.17 +    define r' where "r' = r / 2"
   57.18      have "0 < r'" "r' < r" using \<open>r > 0\<close> by (simp_all add: r'_def)
   57.19      from CauchyD[OF \<open>Cauchy X\<close> \<open>r' > 0\<close>]
   57.20      obtain M where M: "\<And>m n. m \<ge> M \<Longrightarrow> n \<ge> M \<Longrightarrow> norm (X m - X n) < r'"
    58.1 --- a/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy	Sun Apr 24 21:31:14 2016 +0200
    58.2 +++ b/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy	Mon Apr 25 16:09:26 2016 +0200
    58.3 @@ -602,7 +602,8 @@
    58.4        have n_in_upd: "\<And>i. n \<in> upd ` {..< Suc i}"
    58.5          using \<open>upd 0 = n\<close> by auto
    58.6  
    58.7 -      def f' \<equiv> "\<lambda>i j. if j \<in> (upd\<circ>Suc)`{..< i} then Suc ((base(n := p)) j) else (base(n := p)) j"
    58.8 +      define f' where "f' i j =
    58.9 +        (if j \<in> (upd\<circ>Suc)`{..< i} then Suc ((base(n := p)) j) else (base(n := p)) j)" for i j
   58.10        { fix x i assume i[arith]: "i \<le> n" then have "enum (Suc i) x = f' i x"
   58.11            unfolding f'_def enum_def using \<open>a n < p\<close> \<open>a = enum 0\<close> \<open>upd 0 = n\<close> \<open>a n = p - 1\<close>
   58.12            by (simp add: upd_Suc enum_0 n_in_upd) }
   58.13 @@ -616,8 +617,8 @@
   58.14    proof cases
   58.15      case (ksimplex base upd)
   58.16      then interpret kuhn_simplex p n base upd s' .
   58.17 -    def b \<equiv> "base (n := p - 1)"
   58.18 -    def u \<equiv> "\<lambda>i. case i of 0 \<Rightarrow> n | Suc i \<Rightarrow> upd i"
   58.19 +    define b where "b = base (n := p - 1)"
   58.20 +    define u where "u i = (case i of 0 \<Rightarrow> n | Suc i \<Rightarrow> upd i)" for i
   58.21  
   58.22      have "ksimplex p (Suc n) (s' \<union> {b})"
   58.23      proof (rule ksimplex.intros, standard)
   58.24 @@ -632,7 +633,7 @@
   58.25        then show "bij_betw u {..<Suc n} {..<Suc n}"
   58.26          by (simp add: u_def lessThan_Suc[symmetric] lessThan_Suc_eq_insert_0)
   58.27  
   58.28 -      def f' \<equiv> "\<lambda>i j. if j \<in> u`{..< i} then Suc (b j) else b j"
   58.29 +      define f' where "f' i j = (if j \<in> u`{..< i} then Suc (b j) else b j)" for i j
   58.30  
   58.31        have u_eq: "\<And>i. i \<le> n \<Longrightarrow> u ` {..< Suc i} = upd ` {..< i} \<union> { n }"
   58.32          by (auto simp: u_def image_iff upd_inj Ball_def split: nat.split) arith
   58.33 @@ -724,7 +725,7 @@
   58.34    then have "\<exists>!s'. s' \<noteq> s \<and> ksimplex p n s' \<and> (\<exists>b\<in>s'. s - {a} = s'- {b})"
   58.35    proof (elim disjE conjE)
   58.36      assume "i = 0"
   58.37 -    def rot \<equiv> "\<lambda>i. if i + 1 = n then 0 else i + 1"
   58.38 +    define rot where [abs_def]: "rot i = (if i + 1 = n then 0 else i + 1)" for i
   58.39      let ?upd = "upd \<circ> rot"
   58.40  
   58.41      have rot: "bij_betw rot {..< n} {..< n}"
   58.42 @@ -733,7 +734,8 @@
   58.43      from rot upd have "bij_betw ?upd {..<n} {..<n}"
   58.44        by (rule bij_betw_trans)
   58.45  
   58.46 -    def f' \<equiv> "\<lambda>i j. if j \<in> ?upd`{..< i} then Suc (enum (Suc 0) j) else enum (Suc 0) j"
   58.47 +    define f' where [abs_def]: "f' i j =
   58.48 +      (if j \<in> ?upd`{..< i} then Suc (enum (Suc 0) j) else enum (Suc 0) j)" for i j
   58.49  
   58.50      interpret b: kuhn_simplex p n "enum (Suc 0)" "upd \<circ> rot" "f' ` {.. n}"
   58.51      proof
   58.52 @@ -832,7 +834,7 @@
   58.53      from \<open>n \<noteq> 0\<close> obtain n' where n': "n = Suc n'"
   58.54        by (cases n) auto
   58.55  
   58.56 -    def rot \<equiv> "\<lambda>i. case i of 0 \<Rightarrow> n' | Suc i \<Rightarrow> i"
   58.57 +    define rot where "rot i = (case i of 0 \<Rightarrow> n' | Suc i \<Rightarrow> i)" for i
   58.58      let ?upd = "upd \<circ> rot"
   58.59  
   58.60      have rot: "bij_betw rot {..< n} {..< n}"
   58.61 @@ -841,8 +843,8 @@
   58.62      from rot upd have "bij_betw ?upd {..<n} {..<n}"
   58.63        by (rule bij_betw_trans)
   58.64  
   58.65 -    def b \<equiv> "base (upd n' := base (upd n') - 1)"
   58.66 -    def f' \<equiv> "\<lambda>i j. if j \<in> ?upd`{..< i} then Suc (b j) else b j"
   58.67 +    define b where "b = base (upd n' := base (upd n') - 1)"
   58.68 +    define f' where [abs_def]: "f' i j = (if j \<in> ?upd`{..< i} then Suc (b j) else b j)" for i j
   58.69  
   58.70      interpret b: kuhn_simplex p n b "upd \<circ> rot" "f' ` {.. n}"
   58.71      proof
   58.72 @@ -945,7 +947,7 @@
   58.73        done
   58.74    next
   58.75      assume i: "0 < i" "i < n"
   58.76 -    def i' \<equiv> "i - 1"
   58.77 +    define i' where "i' = i - 1"
   58.78      with i have "Suc i' < n"
   58.79        by simp
   58.80      with i have Suc_i': "Suc i' = i"
   58.81 @@ -955,7 +957,8 @@
   58.82      from i upd have "bij_betw ?upd {..< n} {..< n}"
   58.83        by (subst bij_betw_swap_iff) (auto simp: i'_def)
   58.84  
   58.85 -    def f' \<equiv> "\<lambda>i j. if j \<in> ?upd`{..< i} then Suc (base j) else base j"
   58.86 +    define f' where [abs_def]: "f' i j = (if j \<in> ?upd`{..< i} then Suc (base j) else base j)"
   58.87 +      for i j
   58.88      interpret b: kuhn_simplex p n base ?upd "f' ` {.. n}"
   58.89      proof
   58.90        show "base \<in> {..<n} \<rightarrow> {..<p}" by fact
   58.91 @@ -1056,7 +1059,7 @@
   58.92            using eq_sma \<open>a \<in> s\<close> \<open>c \<in> t\<close> by auto
   58.93        next
   58.94          assume u: "u l = upd (Suc i')"
   58.95 -        def B \<equiv> "b.enum ` {..n}"
   58.96 +        define B where "B = b.enum ` {..n}"
   58.97          have "b.enum i' = enum i'"
   58.98            using enum_eq_benum[of i'] i by (auto simp add: i'_def gr0_conv_Suc)
   58.99          have "c = t.enum (Suc l)" unfolding c_eq ..
  58.100 @@ -1447,7 +1450,7 @@
  58.101      and "f ` unit_cube \<subseteq> unit_cube"
  58.102    shows "\<exists>x\<in>unit_cube. f x = x"
  58.103  proof (rule ccontr)
  58.104 -  def n \<equiv> "DIM('a)"
  58.105 +  define n where "n = DIM('a)"
  58.106    have n: "1 \<le> n" "0 < n" "n \<noteq> 0"
  58.107      unfolding n_def by (auto simp add: Suc_le_eq DIM_positive)
  58.108    assume "\<not> ?thesis"
  58.109 @@ -1625,7 +1628,7 @@
  58.110  
  58.111    obtain b :: "nat \<Rightarrow> 'a" where b: "bij_betw b {..< n} Basis"
  58.112      by atomize_elim (auto simp: n_def intro!: finite_same_card_bij)
  58.113 -  def b' \<equiv> "inv_into {..< n} b"
  58.114 +  define b' where "b' = inv_into {..< n} b"
  58.115    then have b': "bij_betw b' Basis {..< n}"
  58.116      using bij_betw_inv_into[OF b] by auto
  58.117    then have b'_Basis: "\<And>i. i \<in> Basis \<Longrightarrow> b' i \<in> {..< n}"
  58.118 @@ -1668,7 +1671,7 @@
  58.119                 (label (\<Sum>i\<in>Basis. (real (r (b' i)) / real p) *\<^sub>R i) \<circ> b) i \<noteq>
  58.120                 (label (\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i) \<circ> b) i"
  58.121      by (rule kuhn_lemma[OF q1 q2 q3])
  58.122 -  def z \<equiv> "(\<Sum>i\<in>Basis. (real (q (b' i)) / real p) *\<^sub>R i)::'a"
  58.123 +  define z :: 'a where "z = (\<Sum>i\<in>Basis. (real (q (b' i)) / real p) *\<^sub>R i)"
  58.124    have "\<exists>i\<in>Basis. d / real n \<le> \<bar>(f z - z)\<bullet>i\<bar>"
  58.125    proof (rule ccontr)
  58.126      have "\<forall>i\<in>Basis. q (b' i) \<in> {0..p}"
  58.127 @@ -1710,7 +1713,7 @@
  58.128      using q(2)[rule_format,OF *] by blast
  58.129    have b'_im: "\<And>i. i \<in> Basis \<Longrightarrow>  b' i < n"
  58.130      using b' unfolding bij_betw_def by auto
  58.131 -  def r' \<equiv> "(\<Sum>i\<in>Basis. (real (r (b' i)) / real p) *\<^sub>R i)::'a"
  58.132 +  define r' ::'a where "r' = (\<Sum>i\<in>Basis. (real (r (b' i)) / real p) *\<^sub>R i)"
  58.133    have "\<And>i. i \<in> Basis \<Longrightarrow> r (b' i) \<le> p"
  58.134      apply (rule order_trans)
  58.135      apply (rule rs(1)[OF b'_im,THEN conjunct2])
  58.136 @@ -1721,7 +1724,7 @@
  58.137      unfolding r'_def mem_unit_cube
  58.138      using b'_Basis
  58.139      by (auto simp add: bij_betw_def zero_le_divide_iff divide_le_eq_1)
  58.140 -  def s' \<equiv> "(\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i)::'a"
  58.141 +  define s' :: 'a where "s' = (\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i)"
  58.142    have "\<And>i. i \<in> Basis \<Longrightarrow> s (b' i) \<le> p"
  58.143      apply (rule order_trans)
  58.144      apply (rule rs(2)[OF b'_im, THEN conjunct2])
    59.1 --- a/src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy	Sun Apr 24 21:31:14 2016 +0200
    59.2 +++ b/src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy	Mon Apr 25 16:09:26 2016 +0200
    59.3 @@ -1941,9 +1941,9 @@
    59.4             e * (K/2)^2 \<le> norm(contour_integral(linepath a' b') f + contour_integral(linepath b' c') f + contour_integral(linepath c' a') f)"
    59.5  proof -
    59.6    note divide_le_eq_numeral1 [simp del]
    59.7 -  def a' \<equiv> "midpoint b c"
    59.8 -  def b' \<equiv> "midpoint c a"
    59.9 -  def c' \<equiv> "midpoint a b"
   59.10 +  define a' where "a' = midpoint b c"
   59.11 +  define b' where "b' = midpoint c a"
   59.12 +  define c' where "c' = midpoint a b"
   59.13    have fabc: "continuous_on (closed_segment a b) f" "continuous_on (closed_segment b c) f" "continuous_on (closed_segment c a) f"
   59.14      using f continuous_on_subset segments_subset_convex_hull by metis+
   59.15    have fcont': "continuous_on (closed_segment c' b') f"
   59.16 @@ -2145,17 +2145,19 @@
   59.17    { fix y::complex
   59.18      assume fy: "(f has_contour_integral y) (linepath a b +++ linepath b c +++ linepath c a)"
   59.19         and ynz: "y \<noteq> 0"
   59.20 -    def K \<equiv> "1 + max (dist a b) (max (dist b c) (dist c a))"
   59.21 -    def e \<equiv> "norm y / K^2"
   59.22 +    define K where "K = 1 + max (dist a b) (max (dist b c) (dist c a))"
   59.23 +    define e where "e = norm y / K^2"
   59.24      have K1: "K \<ge> 1"  by (simp add: K_def max.coboundedI1)
   59.25      then have K: "K > 0" by linarith
   59.26      have [iff]: "dist a b \<le> K" "dist b c \<le> K" "dist c a \<le> K"
   59.27        by (simp_all add: K_def)
   59.28      have e: "e > 0"
   59.29        unfolding e_def using ynz K1 by simp
   59.30 -    def At \<equiv> "\<lambda>x y z n. convex hull {x,y,z} \<subseteq> convex hull {a,b,c} \<and>
   59.31 -                         dist x y \<le> K/2^n \<and> dist y z \<le> K/2^n \<and> dist z x \<le> K/2^n \<and>
   59.32 -                         norm(?pathint x y + ?pathint y z + ?pathint z x) \<ge> e*(K/2^n)^2"
   59.33 +    define At where "At x y z n \<longleftrightarrow>
   59.34 +        convex hull {x,y,z} \<subseteq> convex hull {a,b,c} \<and>
   59.35 +        dist x y \<le> K/2^n \<and> dist y z \<le> K/2^n \<and> dist z x \<le> K/2^n \<and>
   59.36 +        norm(?pathint x y + ?pathint y z + ?pathint z x) \<ge> e*(K/2^n)^2"
   59.37 +      for x y z n
   59.38      have At0: "At a b c 0"
   59.39        using fy
   59.40        by (simp add: At_def e_def has_chain_integral_chain_integral3)
   59.41 @@ -2358,8 +2360,8 @@
   59.42          assume d1_pos: "0 < d1"
   59.43             and d1: "\<And>x x'. \<lbrakk>x\<in>convex hull {a, b, c}; x'\<in>convex hull {a, b, c}; cmod (x' - x) < d1\<rbrakk>
   59.44                             \<Longrightarrow> cmod (f x' - f x) < cmod y / (24 * C)"
   59.45 -        def e      \<equiv> "min 1 (min (d1/(4*C)) ((norm y / 24 / C) / B))"
   59.46 -        def shrink \<equiv> "\<lambda>x. x - e *\<^sub>R (x - d)"
   59.47 +        define e where "e = min 1 (min (d1/(4*C)) ((norm y / 24 / C) / B))"
   59.48 +        define shrink where "shrink x = x - e *\<^sub>R (x - d)" for x
   59.49          let ?pathint = "\<lambda>x y. contour_integral(linepath x y) f"
   59.50          have e: "0 < e" "e \<le> 1" "e \<le> d1 / (4 * C)" "e \<le> cmod y / 24 / C / B"
   59.51            using d1_pos \<open>C>0\<close> \<open>B>0\<close> ynz by (simp_all add: e_def)
   59.52 @@ -2982,7 +2984,7 @@
   59.53      using open_contains_ball os p(2) by blast
   59.54    then obtain ee where ee: "\<And>z. z \<in> path_image p \<Longrightarrow> 0 < ee z \<and> ball z (ee z) \<subseteq> s"
   59.55      by metis
   59.56 -  def cover \<equiv> "(\<lambda>z. ball z (ee z/3)) ` (path_image p)"
   59.57 +  define cover where "cover = (\<lambda>z. ball z (ee z/3)) ` (path_image p)"
   59.58    have "compact (path_image p)"
   59.59      by (metis p(1) compact_path_image)
   59.60    moreover have "path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))"
   59.61 @@ -3001,7 +3003,7 @@
   59.62      using k  by (auto simp: path_image_def)
   59.63    then have eepi: "\<And>i. i \<in> k \<Longrightarrow> 0 < ee((p i))"
   59.64      by (metis ee)
   59.65 -  def e \<equiv> "Min((ee o p) ` k)"
   59.66 +  define e where "e = Min((ee o p) ` k)"
   59.67    have fin_eep: "finite ((ee o p) ` k)"
   59.68      using k  by blast
   59.69    have enz: "0 < e"
   59.70 @@ -3475,7 +3477,7 @@
   59.71    then obtain h where h: "polynomial_function h \<and> pathstart h = pathstart \<gamma> \<and> pathfinish h = pathfinish \<gamma> \<and>
   59.72                            (\<forall>t \<in> {0..1}. norm(h t - \<gamma> t) < d/2)"
   59.73      using path_approx_polynomial_function [OF \<open>path \<gamma>\<close>, of "d/2"] d by auto
   59.74 -  def nn \<equiv> "1/(2* pi*ii) * contour_integral h (\<lambda>w. 1/(w - z))"
   59.75 +  define nn where "nn = 1/(2* pi*ii) * contour_integral h (\<lambda>w. 1/(w - z))"
   59.76    have "\<exists>n. \<forall>e > 0. \<exists>p. valid_path p \<and> z \<notin> path_image p \<and>
   59.77                          pathstart p = pathstart \<gamma> \<and>  pathfinish p = pathfinish \<gamma> \<and>
   59.78                          (\<forall>t \<in> {0..1}. norm(\<gamma> t - p t) < e) \<and>
   59.79 @@ -3924,7 +3926,7 @@
   59.80      using path_image_def z by auto
   59.81    have gpd: "\<gamma> piecewise_C1_differentiable_on {0..1}"
   59.82      using \<gamma> valid_path_def by blast
   59.83 -  def r \<equiv> "(w - z) / (\<gamma> 0 - z)"
   59.84 +  define r where "r = (w - z) / (\<gamma> 0 - z)"
   59.85    have [simp]: "r \<noteq> 0"
   59.86      using w z by (auto simp: r_def)
   59.87    have "Arg r \<le> 2*pi"
   59.88 @@ -3944,7 +3946,7 @@
   59.89    then obtain t where t:     "t \<in> {0..1}"
   59.90                    and eqArg: "Im (integral {0..t} (\<lambda>x. vector_derivative \<gamma> (at x)/(\<gamma> x - z))) = Arg r"
   59.91      by blast
   59.92 -  def i \<equiv> "integral {0..t} (\<lambda>x. vector_derivative \<gamma> (at x) / (\<gamma> x - z))"
   59.93 +  define i where "i = integral {0..t} (\<lambda>x. vector_derivative \<gamma> (at x) / (\<gamma> x - z))"
   59.94    have iArg: "Arg r = Im i"
   59.95      using eqArg by (simp add: i_def)
   59.96    have gpdt: "\<gamma> piecewise_C1_differentiable_on {0..t}"
   59.97 @@ -4433,7 +4435,7 @@
   59.98        by (metis continuous_at_winding_number valid_path_imp_path \<gamma> z)
   59.99      then obtain d where "d>0" and d: "\<And>x'. dist x' z < d \<Longrightarrow> dist (winding_number \<gamma> x') (winding_number \<gamma> z) < \<bar>Re(winding_number \<gamma> z)\<bar> - 1/2"
  59.100        using continuous_at_eps_delta wnz_12 diff_gt_0_iff_gt by blast
  59.101 -    def z' \<equiv> "z - (d / (2 * cmod a)) *\<^sub>R a"
  59.102 +    define z' where "z' = z - (d / (2 * cmod a)) *\<^sub>R a"
  59.103      have *: "a \<bullet> z' \<le> b - d / 3 * cmod a"
  59.104        unfolding z'_def inner_mult_right' divide_inverse
  59.105        apply (simp add: divide_simps algebra_simps dot_square_norm power2_eq_square anz)
  59.106 @@ -4612,15 +4614,15 @@
  59.107                        \<longrightarrow> contour_integral g2 f = contour_integral g1 f)))"
  59.108      by metis
  59.109    note ee_rule = ee [THEN conjunct2, rule_format]
  59.110 -  def C \<equiv> "(\<lambda>t. ball t (ee t / 3)) ` {0..1}"
  59.111 +  define C where "C = (\<lambda>t. ball t (ee t / 3)) ` {0..1}"
  59.112    have "\<forall>t \<in> C. open t" by (simp add: C_def)
  59.113    moreover have "{0..1} \<subseteq> \<Union>C"
  59.114      using ee [THEN conjunct1] by (auto simp: C_def dist_norm)
  59.115    ultimately obtain C' where C': "C' \<subseteq> C" "finite C'" and C'01: "{0..1} \<subseteq> \<Union>C'"
  59.116      by (rule compactE [OF compact_interval])
  59.117 -  def kk \<equiv> "{t \<in> {0..1}. ball t (ee t / 3) \<in> C'}"
  59.118 +  define kk where "kk = {t \<in> {0..1}. ball t (ee t / 3) \<in> C'}"
  59.119    have kk01: "kk \<subseteq> {0..1}" by (auto simp: kk_def)
  59.120 -  def e \<equiv> "Min (ee ` kk)"
  59.121 +  define e where "e = Min (ee ` kk)"
  59.122    have C'_eq: "C' = (\<lambda>t. ball t (ee t / 3)) ` kk"
  59.123      using C' by (auto simp: kk_def C_def)
  59.124    have ee_pos[simp]: "\<And>t. t \<in> {0..1} \<Longrightarrow> ee t > 0"
  59.125 @@ -4985,7 +4987,7 @@
  59.126        by (metis "2" abs_of_pos diff_gt_0_iff_gt norm_of_real of_real_diff)
  59.127      have "finite (part_circlepath z r s t -` {y} \<inter> {0..1})" if "y \<in> k" for y
  59.128      proof -
  59.129 -      def w \<equiv> "(y - z)/of_real r / exp(ii * of_real s)"
  59.130 +      define w where "w = (y - z)/of_real r / exp(ii * of_real s)"
  59.131        have fin: "finite (of_real -` {z. cmod z \<le> 1 \<and> exp (\<i> * complex_of_real (t - s) * z) = w})"
  59.132          apply (rule finite_vimageI [OF finite_bounded_log2])
  59.133          using \<open>s < t\<close> apply (auto simp: inj_of_real)
  59.134 @@ -5205,7 +5207,7 @@
  59.135      case True then show ?thesis by force
  59.136    next
  59.137      case False
  59.138 -    def w \<equiv> "x - z"
  59.139 +    define w where "w = x - z"
  59.140      then have "w \<noteq> 0" by (simp add: False)
  59.141      have **: "\<And>t. \<lbrakk>Re w = cos t * cmod w; Im w = sin t * cmod w\<rbrakk> \<Longrightarrow> w = of_real (cmod w) * exp (\<i> * t)"
  59.142        using cis_conv_exp complex_eq_iff by auto
  59.143 @@ -5279,7 +5281,7 @@
  59.144    case False
  59.145    have [simp]: "r > 0"
  59.146      using assms le_less_trans norm_ge_zero by blast
  59.147 -  def r' \<equiv> "norm(w - z)"
  59.148 +  define r' where "r' = norm(w - z)"
  59.149    have "r' < r"
  59.150      by (simp add: assms r'_def)
  59.151    have disjo: "cball z r' \<inter> sphere z r = {}"
  59.152 @@ -5379,7 +5381,7 @@
  59.153      apply (blast intro: integrable_uniform_limit_real)
  59.154      done
  59.155    { fix e::real
  59.156 -    def B' \<equiv> "B+1"
  59.157 +    define B' where "B' = B + 1"
  59.158      have B': "B' > 0" "B' > B" using  \<open>0 \<le> B\<close> by (auto simp: B'_def)
  59.159      assume "0 < e"
  59.160      then have ev_no': "\<forall>\<^sub>F n in F. \<forall>x\<in>path_image \<gamma>. 2 * cmod (f n x - l x) < e / B'"
  59.161 @@ -5463,9 +5465,11 @@
  59.162                  and uw_less: "cmod (u - w) < e * (d / 2) ^ (k+2) / (1 + real k)"
  59.163              for u x
  59.164      proof -
  59.165 -      def ff \<equiv> "\<lambda>n::nat. \<lambda>w. if n = 0 then inverse(x - w)^k
  59.166 -                              else if n = 1 then k / (x - w)^(Suc k)
  59.167 -                              else (k * of_real(Suc k)) / (x - w)^(k + 2)"
  59.168 +      define ff where [abs_def]:
  59.169 +        "ff n w =
  59.170 +          (if n = 0 then inverse(x - w)^k
  59.171 +           else if n = 1 then k / (x - w)^(Suc k)
  59.172 +           else (k * of_real(Suc k)) / (x - w)^(k + 2))" for n :: nat and w
  59.173        have km1: "\<And>z::complex. z \<noteq> 0 \<Longrightarrow> z ^ (k - Suc 0) = z ^ k / z"
  59.174          by (simp add: field_simps) (metis Suc_pred \<open>k \<noteq> 0\<close> neq0_conv power_Suc)
  59.175        have ff1: "(ff i has_field_derivative ff (Suc i) z) (at z within ball w (d / 2))"
  59.176 @@ -6285,7 +6289,7 @@
  59.177    with inf [unfolded Lim_at_infinity, rule_format, of "norm(f z)/2"]
  59.178    obtain B where B: "\<And>x. B \<le> cmod x \<Longrightarrow> norm (f x) * 2 < cmod (f z)"
  59.179      by (auto simp: dist_norm)
  59.180 -  def R \<equiv> "1 + \<bar>B\<bar> + norm z"
  59.181 +  define R where "R = 1 + \<bar>B\<bar> + norm z"
  59.182    have "R > 0" unfolding R_def 
  59.183    proof -
  59.184      have "0 \<le> cmod z + \<bar>B\<bar>"
  59.185 @@ -6384,7 +6388,7 @@
  59.186    have 2: "((\<lambda>u. 1 / (2 * of_real pi * \<i>) * g u / (u - w) ^ 1) has_contour_integral g w) (circlepath z r)"
  59.187         if w: "w \<in> ball z r" for w
  59.188    proof -
  59.189 -    def d \<equiv> "(r - norm(w - z))"
  59.190 +    define d where "d = (r - norm(w - z))"
  59.191      have "0 < d"  "d \<le> r" using w by (auto simp: norm_minus_commute d_def dist_norm)
  59.192      have dle: "\<And>u. cmod (z - u) = r \<Longrightarrow> d \<le> cmod (u - w)"
  59.193        unfolding d_def by (metis add_diff_eq diff_add_cancel norm_diff_ineq norm_minus_commute)
  59.194 @@ -6468,7 +6472,7 @@
  59.195        show ?thesis
  59.196          by (simp add: f' Cauchy_contour_integral_circlepath_2 [OF g w] derg [OF w] divide_simps)
  59.197      qed
  59.198 -    def d \<equiv> "(r - norm(w - z))^2"
  59.199 +    define d where "d = (r - norm(w - z))^2"
  59.200      have "d > 0"
  59.201        using w by (simp add: dist_commute dist_norm d_def)
  59.202      have dle: "\<And>y. r = cmod (z - y) \<Longrightarrow> d \<le> cmod ((y - w)\<^sup>2)"
  59.203 @@ -7082,8 +7086,8 @@
  59.204      by (simp add: path_image_def compact_imp_bounded compact_continuous_image continuous_on_polymonial_function)
  59.205    then obtain B where "B>0" and B: "\<And>x. x \<in> path_image \<gamma>' \<Longrightarrow> norm x \<le> B"
  59.206      using bounded_pos by force
  59.207 -  def d \<equiv> "\<lambda>z w. if w = z then deriv f z else (f w - f z)/(w - z)"
  59.208 -  def v \<equiv> "{w. w \<notin> path_image \<gamma> \<and> winding_number \<gamma> w = 0}"
  59.209 +  define d where [abs_def]: "d z w = (if w = z then deriv f z else (f w - f z)/(w - z))" for z w
  59.210 +  define v where "v = {w. w \<notin> path_image \<gamma> \<and> winding_number \<gamma> w = 0}"
  59.211    have "path \<gamma>" "valid_path \<gamma>" using \<gamma>
  59.212      by (auto simp: path_polynomial_function valid_path_polynomial_function)
  59.213    then have ov: "open v"
  59.214 @@ -7120,7 +7124,8 @@
  59.215      apply (rule continuous_intros holomorphic_intros continuous_on_subset [OF conf] holomorphic_on_subset [OF holf] |
  59.216                  force simp add: that)+
  59.217      done
  59.218 -  def h \<equiv> "\<lambda>z. if z \<in> u then contour_integral \<gamma> (d z) else contour_integral \<gamma> (\<lambda>w. f w/(w - z))"
  59.219 +  define h where
  59.220 +    "h z = (if z \<in> u then contour_integral \<gamma> (d z) else contour_integral \<gamma> (\<lambda>w. f w/(w - z)))" for z
  59.221    have U: "\<And>z. z \<in> u \<Longrightarrow> ((d z) has_contour_integral h z) \<gamma>"
  59.222      apply (simp add: h_def)
  59.223      apply (rule has_contour_integral_integral [OF contour_integrable_holomorphic_simple [where s=u]])
    60.1 --- a/src/HOL/Multivariate_Analysis/Complex_Transcendental.thy	Sun Apr 24 21:31:14 2016 +0200
    60.2 +++ b/src/HOL/Multivariate_Analysis/Complex_Transcendental.thy	Mon Apr 25 16:09:26 2016 +0200
    60.3 @@ -1367,7 +1367,7 @@
    60.4    proof (rule has_field_derivative_zero_constant)
    60.5      fix z :: complex assume z': "z \<in> ball 0 1"
    60.6      hence z: "norm z < 1" by (simp add: dist_0_norm)
    60.7 -    def t \<equiv> "of_real (1 + norm z) / 2 :: complex"
    60.8 +    define t :: complex where "t = of_real (1 + norm z) / 2"
    60.9      from z have t: "norm z < norm t" "norm t < 1" unfolding t_def
   60.10        by (simp_all add: field_simps norm_divide del: of_real_add)
   60.11  
   60.12 @@ -2049,7 +2049,7 @@
   60.13    shows   "(\<lambda>n. g n * z^n) sums Arctan z"
   60.14    and     "h z sums Arctan z"
   60.15  proof -
   60.16 -  def G \<equiv> "\<lambda>z. (\<Sum>n. g n * z^n)"
   60.17 +  define G where [abs_def]: "G z = (\<Sum>n. g n * z^n)" for z
   60.18    have summable: "summable (\<lambda>n. g n * u^n)" if "norm u < 1" for u
   60.19    proof (cases "u = 0")
   60.20      assume u: "u \<noteq> 0"
   60.21 @@ -2089,7 +2089,7 @@
   60.22    proof (rule has_field_derivative_zero_constant)
   60.23      fix u :: complex assume "u \<in> ball 0 1"
   60.24      hence u: "norm u < 1" by (simp add: dist_0_norm)
   60.25 -    def K \<equiv> "(norm u + 1) / 2"
   60.26 +    define K where "K = (norm u + 1) / 2"
   60.27      from u and abs_Im_le_cmod[of u] have Im_u: "\<bar>Im u\<bar> < 1" by linarith
   60.28      from u have K: "0 \<le> K" "norm u < K" "K < 1" by (simp_all add: K_def)
   60.29      hence "(G has_field_derivative (\<Sum>n. diffs g n * u ^ n)) (at u)" unfolding G_def
   60.30 @@ -2120,7 +2120,7 @@
   60.31    assumes x: "x > (0::real)"
   60.32    shows "(\<lambda>n. (2*((x - 1) / (x + 1)) ^ (2*n+1) / of_nat (2*n+1))) sums ln x"
   60.33  proof -
   60.34 -  def y \<equiv> "of_real ((x-1)/(x+1)) :: complex"
   60.35 +  define y :: complex where "y = of_real ((x-1)/(x+1))"
   60.36    from x have x': "complex_of_real x \<noteq> of_real (-1)"  by (subst of_real_eq_iff) auto
   60.37    from x have "\<bar>x - 1\<bar> < \<bar>x + 1\<bar>" by linarith
   60.38    hence "norm (complex_of_real (x - 1) / complex_of_real (x + 1)) < 1"
    61.1 --- a/src/HOL/Multivariate_Analysis/Conformal_Mappings.thy	Sun Apr 24 21:31:14 2016 +0200
    61.2 +++ b/src/HOL/Multivariate_Analysis/Conformal_Mappings.thy	Mon Apr 25 16:09:26 2016 +0200
    61.3 @@ -35,7 +35,7 @@
    61.4      by (rule contf continuous_intros)+
    61.5    have holf': "(\<lambda>u. (f u - y)) holomorphic_on (ball z r)"
    61.6      by (simp add: holf holomorphic_on_diff)
    61.7 -  def a \<equiv> "(2 * pi)/(fact n)"
    61.8 +  define a where "a = (2 * pi)/(fact n)"
    61.9    have "0 < a"  by (simp add: a_def)
   61.10    have "B0/r^(Suc n)*2 * pi * r = a*((fact n)*B0/r^n)"
   61.11      using \<open>0 < r\<close> by (simp add: a_def divide_simps)
   61.12 @@ -105,44 +105,44 @@
   61.13      case True then show ?thesis by simp
   61.14    next
   61.15      case False
   61.16 -      def w \<equiv> "complex_of_real (fact k * B / cmod ((deriv ^^ k) f 0) + (\<bar>A\<bar> + 1))"
   61.17 -      have "1 \<le> abs (fact k * B / cmod ((deriv ^^ k) f 0) + (\<bar>A\<bar> + 1))"
   61.18 -        using \<open>0 < B\<close> by simp
   61.19 -      then have wge1: "1 \<le> norm w"
   61.20 -        by (metis norm_of_real w_def)
   61.21 -      then have "w \<noteq> 0" by auto
   61.22 -      have kB: "0 < fact k * B"
   61.23 -        using \<open>0 < B\<close> by simp
   61.24 -      then have "0 \<le> fact k * B / cmod ((deriv ^^ k) f 0)"
   61.25 -        by simp
   61.26 -      then have wgeA: "A \<le> cmod w"
   61.27 -        by (simp only: w_def norm_of_real)
   61.28 -      have "fact k * B / cmod ((deriv ^^ k) f 0) < abs (fact k * B / cmod ((deriv ^^ k) f 0) + (\<bar>A\<bar> + 1))"
   61.29 -        using \<open>0 < B\<close> by simp
   61.30 -      then have wge: "fact k * B / cmod ((deriv ^^ k) f 0) < norm w"
   61.31 -        by (metis norm_of_real w_def)
   61.32 -      then have "fact k * B / norm w < cmod ((deriv ^^ k) f 0)"
   61.33 -        using False by (simp add: divide_simps mult.commute split: if_split_asm)
   61.34 -      also have "... \<le> fact k * (B * norm w ^ n) / norm w ^ k"
   61.35 -        apply (rule Cauchy_inequality)
   61.36 -           using holf holomorphic_on_subset apply force
   61.37 -          using holf holomorphic_on_imp_continuous_on holomorphic_on_subset apply blast
   61.38 -         using \<open>w \<noteq> 0\<close> apply (simp add:)
   61.39 -         by (metis nof wgeA dist_0_norm dist_norm)
   61.40 -      also have "... = fact k * (B * 1 / cmod w ^ (k-n))"
   61.41 -        apply (simp only: mult_cancel_left times_divide_eq_right [symmetric])
   61.42 -        using \<open>k>n\<close> \<open>w \<noteq> 0\<close> \<open>0 < B\<close> apply (simp add: divide_simps semiring_normalization_rules)
   61.43 -        done
   61.44 -      also have "... = fact k * B / cmod w ^ (k-n)"
   61.45 -        by simp
   61.46 -      finally have "fact k * B / cmod w < fact k * B / cmod w ^ (k - n)" .
   61.47 -      then have "1 / cmod w < 1 / cmod w ^ (k - n)"
   61.48 -        by (metis kB divide_inverse inverse_eq_divide mult_less_cancel_left_pos)
   61.49 -      then have "cmod w ^ (k - n) < cmod w"
   61.50 -        by (metis frac_le le_less_trans norm_ge_zero norm_one not_less order_refl wge1 zero_less_one)
   61.51 -      with self_le_power [OF wge1] have False
   61.52 -        by (meson diff_is_0_eq not_gr0 not_le that)
   61.53 -      then show ?thesis by blast
   61.54 +    define w where "w = complex_of_real (fact k * B / cmod ((deriv ^^ k) f 0) + (\<bar>A\<bar> + 1))"
   61.55 +    have "1 \<le> abs (fact k * B / cmod ((deriv ^^ k) f 0) + (\<bar>A\<bar> + 1))"
   61.56 +      using \<open>0 < B\<close> by simp
   61.57 +    then have wge1: "1 \<le> norm w"
   61.58 +      by (metis norm_of_real w_def)
   61.59 +    then have "w \<noteq> 0" by auto
   61.60 +    have kB: "0 < fact k * B"
   61.61 +      using \<open>0 < B\<close> by simp
   61.62 +    then have "0 \<le> fact k * B / cmod ((deriv ^^ k) f 0)"
   61.63 +      by simp
   61.64 +    then have wgeA: "A \<le> cmod w"
   61.65 +      by (simp only: w_def norm_of_real)
   61.66 +    have "fact k * B / cmod ((deriv ^^ k) f 0) < abs (fact k * B / cmod ((deriv ^^ k) f 0) + (\<bar>A\<bar> + 1))"
   61.67 +      using \<open>0 < B\<close> by simp
   61.68 +    then have wge: "fact k * B / cmod ((deriv ^^ k) f 0) < norm w"
   61.69 +      by (metis norm_of_real w_def)
   61.70 +    then have "fact k * B / norm w < cmod ((deriv ^^ k) f 0)"
   61.71 +      using False by (simp add: divide_simps mult.commute split: if_split_asm)
   61.72 +    also have "... \<le> fact k * (B * norm w ^ n) / norm w ^ k"
   61.73 +      apply (rule Cauchy_inequality)
   61.74 +         using holf holomorphic_on_subset apply force
   61.75 +        using holf holomorphic_on_imp_continuous_on holomorphic_on_subset apply blast
   61.76 +       using \<open>w \<noteq> 0\<close> apply (simp add:)
   61.77 +       by (metis nof wgeA dist_0_norm dist_norm)
   61.78 +    also have "... = fact k * (B * 1 / cmod w ^ (k-n))"
   61.79 +      apply (simp only: mult_cancel_left times_divide_eq_right [symmetric])
   61.80 +      using \<open>k>n\<close> \<open>w \<noteq> 0\<close> \<open>0 < B\<close> apply (simp add: divide_simps semiring_normalization_rules)
   61.81 +      done
   61.82 +    also have "... = fact k * B / cmod w ^ (k-n)"
   61.83 +      by simp
   61.84 +    finally have "fact k * B / cmod w < fact k * B / cmod w ^ (k - n)" .
   61.85 +    then have "1 / cmod w < 1 / cmod w ^ (k - n)"
   61.86 +      by (metis kB divide_inverse inverse_eq_divide mult_less_cancel_left_pos)
   61.87 +    then have "cmod w ^ (k - n) < cmod w"
   61.88 +      by (metis frac_le le_less_trans norm_ge_zero norm_one not_less order_refl wge1 zero_less_one)
   61.89 +    with self_le_power [OF wge1] have False
   61.90 +      by (meson diff_is_0_eq not_gr0 not_le that)
   61.91 +    then show ?thesis by blast
   61.92    qed
   61.93    then have "(deriv ^^ (k + Suc n)) f 0 / fact (k + Suc n) * \<xi> ^ (k + Suc n) = 0" for k
   61.94      using not_less_eq by blast
   61.95 @@ -185,8 +185,8 @@
   61.96      apply (rule LeastI2)
   61.97      apply (fastforce intro:  dest!: not_less_Least)+
   61.98      done
   61.99 -  def b \<equiv> "\<lambda>i. a (i+m) / a m"
  61.100 -  def g \<equiv> "\<lambda>x. suminf (\<lambda>i. b i * (x - \<xi>) ^ i)"
  61.101 +  define b where "b i = a (i+m) / a m" for i
  61.102 +  define g where "g x = suminf (\<lambda>i. b i * (x - \<xi>) ^ i)" for x
  61.103    have [simp]: "b 0 = 1"
  61.104      by (simp add: am b_def)
  61.105    { fix x::'a
  61.106 @@ -258,7 +258,7 @@
  61.107  proof -
  61.108    obtain e where "0 < e" and e: "cball \<xi> e \<subseteq> S"
  61.109      using \<open>open S\<close> \<open>\<xi> \<in> S\<close> open_contains_cball_eq by blast
  61.110 -  def T \<equiv> "cball \<xi> e \<inter> U"
  61.111 +  define T where "T = cball \<xi> e \<inter> U"
  61.112    have contf: "continuous_on (closure T) f"
  61.113      by (metis T_def closed_cball closure_minimal e holf holomorphic_on_imp_continuous_on
  61.114                holomorphic_on_subset inf.cobounded1)
  61.115 @@ -295,7 +295,7 @@
  61.116        by (metis norm_less dist_norm fnz less_eq_real_def mem_ball mem_cball norm_not_less_zero norm_zero)
  61.117      have "frontier(cball \<xi> r) \<noteq> {}"
  61.118        using \<open>0 < r\<close> by simp
  61.119 -    def g \<equiv> "\<lambda>z. inverse (f z)"
  61.120 +    define g where [abs_def]: "g z = inverse (f z)" for z
  61.121      have contg: "continuous_on (cball \<xi> r) g"
  61.122        unfolding g_def using contf continuous_on_inverse fnz' by blast
  61.123      have holg: "g holomorphic_on ball \<xi> r"
  61.124 @@ -377,7 +377,7 @@
  61.125          apply (rule bexE [OF continuous_attains_inf [OF cof frne contfr]])
  61.126          apply (simp add: dist_norm)
  61.127          done
  61.128 -      moreover def \<epsilon> \<equiv> "norm (f w - f \<xi>) / 3"
  61.129 +      moreover define \<epsilon> where "\<epsilon> \<equiv> norm (f w - f \<xi>) / 3"
  61.130        ultimately have "0 < \<epsilon>"
  61.131          using \<open>0 < r\<close> dist_complex_def r sne by auto
  61.132        have "ball (f \<xi>) \<epsilon> \<subseteq> f ` U"
  61.133 @@ -601,12 +601,12 @@
  61.134    obtain r where "r>0" and r: "ball \<xi> r \<subseteq> S" using assms by (blast elim!: openE)
  61.135    then have holfb: "f holomorphic_on ball \<xi> r"
  61.136      using holf holomorphic_on_subset by blast
  61.137 -  def g \<equiv> "\<lambda>w. suminf (\<lambda>i. (deriv ^^ (i + n)) f \<xi> / (fact(i + n)) * (w - \<xi>)^i)"
  61.138 +  define g where "g w = suminf (\<lambda>i. (deriv ^^ (i + n)) f \<xi> / (fact(i + n)) * (w - \<xi>)^i)" for w
  61.139    have sumsg: "(\<lambda>i. (deriv ^^ (i + n)) f \<xi> / (fact(i + n)) * (w - \<xi>)^i) sums g w"
  61.140     and feq: "f w - f \<xi> = (w - \<xi>)^n * g w"
  61.141         if w: "w \<in> ball \<xi> r" for w
  61.142    proof -
  61.143 -    def powf \<equiv> "(\<lambda>i. (deriv ^^ i) f \<xi>/(fact i) * (w - \<xi>)^i)"
  61.144 +    define powf where "powf = (\<lambda>i. (deriv ^^ i) f \<xi>/(fact i) * (w - \<xi>)^i)"
  61.145      have sing: "{..<n} - {i. powf i = 0} = (if f \<xi> = 0 then {} else {0})"
  61.146        unfolding powf_def using \<open>0 < n\<close> dfz by (auto simp: dfz; metis funpow_0 not_gr0)
  61.147      have "powf sums f w"
  61.148 @@ -737,7 +737,7 @@
  61.149    case False
  61.150    then obtain n0 where "n0 > 0" and n0: "(deriv ^^ n0) f \<xi> \<noteq> 0" by blast
  61.151    obtain r0 where "r0 > 0" "ball \<xi> r0 \<subseteq> S" using S openE \<open>\<xi> \<in> S\<close> by auto
  61.152 -  def n \<equiv> "LEAST n. (deriv ^^ n) f \<xi> \<noteq> 0"
  61.153 +  define n where "n \<equiv> LEAST n. (deriv ^^ n) f \<xi> \<noteq> 0"
  61.154    have n_ne: "(deriv ^^ n) f \<xi> \<noteq> 0"
  61.155      by (rule def_LeastI [OF n_def]) (rule n0)
  61.156    then have "0 < n" using \<open>f \<xi> = 0\<close>
  61.157 @@ -766,7 +766,7 @@
  61.158              "ball \<xi> r \<subseteq> S"
  61.159              "\<And>w. w \<in> ball \<xi> r \<Longrightarrow> k * norm(w - \<xi>)^n \<le> norm(f w - f \<xi>)"
  61.160  proof -
  61.161 -  def n \<equiv> "LEAST n. 0 < n \<and> (deriv ^^ n) f \<xi> \<noteq> 0"
  61.162 +  define n where "n = (LEAST n. 0 < n \<and> (deriv ^^ n) f \<xi> \<noteq> 0)"
  61.163    obtain n0 where "0 < n0" and n0: "(deriv ^^ n0) f \<xi> \<noteq> 0"
  61.164      using fne holomorphic_fun_eq_const_on_connected [OF holf S] \<open>\<xi> \<in> S\<close> \<open>\<phi> \<in> S\<close> by blast
  61.165    then have "0 < n" and n_ne: "(deriv ^^ n) f \<xi> \<noteq> 0"
  61.166 @@ -781,7 +781,7 @@
  61.167    obtain e where "e>0" and e: "ball \<xi> e \<subseteq> S" using assms by (blast elim!: openE)
  61.168    then have holfb: "f holomorphic_on ball \<xi> e"
  61.169      using holf holomorphic_on_subset by blast
  61.170 -  def d \<equiv> "(min e r) / 2"
  61.171 +  define d where "d = (min e r) / 2"
  61.172    have "0 < d" using \<open>0 < r\<close> \<open>0 < e\<close> by (simp add: d_def)
  61.173    have "d < r"
  61.174      using \<open>0 < r\<close> by (auto simp: d_def)
  61.175 @@ -847,7 +847,7 @@
  61.176      by (rule lim_null_mult_right_bounded [OF _ that]) (simp add: LIM_zero)
  61.177    moreover have "?P" if "(\<lambda>z. (z - \<xi>) * f z) \<midarrow>\<xi>\<rightarrow> 0"
  61.178    proof -
  61.179 -    def h \<equiv> "\<lambda>z. (z - \<xi>)^2 * f z"
  61.180 +    define h where [abs_def]: "h z = (z - \<xi>)^2 * f z" for z
  61.181      have h0: "(h has_field_derivative 0) (at \<xi>)"
  61.182        apply (simp add: h_def Derivative.DERIV_within_iff)
  61.183        apply (rule Lim_transform_within [OF that, of 1])
  61.184 @@ -870,7 +870,7 @@
  61.185            by (simp add: h_def power2_eq_square derivative_intros)
  61.186        qed
  61.187      qed
  61.188 -    def g \<equiv> "\<lambda>z. if z = \<xi> then deriv h \<xi> else (h z - h \<xi>) / (z - \<xi>)"
  61.189 +    define g where [abs_def]: "g z = (if z = \<xi> then deriv h \<xi> else (h z - h \<xi>) / (z - \<xi>))" for z
  61.190      have holg: "g holomorphic_on S"
  61.191        unfolding g_def by (rule pole_lemma [OF holh \<xi>])
  61.192      show ?thesis
  61.193 @@ -1058,7 +1058,7 @@
  61.194    next
  61.195      case False
  61.196      then obtain k where k: "0 < k" "k\<le>n" "a k \<noteq> 0" by force
  61.197 -    def m \<equiv> "GREATEST k. k\<le>n \<and> a k \<noteq> 0"
  61.198 +    define m where "m = (GREATEST k. k\<le>n \<and> a k \<noteq> 0)"
  61.199      have m: "m\<le>n \<and> a m \<noteq> 0"
  61.200        unfolding m_def
  61.201        apply (rule GreatestI [where b = "Suc n"])
  61.202 @@ -1185,7 +1185,7 @@
  61.203    next
  61.204      case False
  61.205      then obtain n0 where n0: "n0 > 0 \<and> (deriv ^^ n0) f \<xi> \<noteq> 0" by blast
  61.206 -    def n \<equiv> "LEAST n. n > 0 \<and> (deriv ^^ n) f \<xi> \<noteq> 0"
  61.207 +    define n where [abs_def]: "n = (LEAST n. n > 0 \<and> (deriv ^^ n) f \<xi> \<noteq> 0)"
  61.208      have n_ne: "n > 0" "(deriv ^^ n) f \<xi> \<noteq> 0"
  61.209        using def_LeastI [OF n_def n0] by auto
  61.210      have n_min: "\<And>k. 0 < k \<Longrightarrow> k < n \<Longrightarrow> (deriv ^^ k) f \<xi> = 0"
  61.211 @@ -1220,7 +1220,7 @@
  61.212          using \<open>0 < r\<close> \<open>0 < \<delta>\<close>
  61.213          apply (simp_all add:)
  61.214          by (meson Topology_Euclidean_Space.open_ball centre_in_ball)
  61.215 -      def U \<equiv> "(\<lambda>w. (w - \<xi>) * g w) ` T"
  61.216 +      define U where "U = (\<lambda>w. (w - \<xi>) * g w) ` T"
  61.217        have "open U" by (metis oimT U_def)
  61.218        have "0 \<in> U"
  61.219          apply (auto simp: U_def)
  61.220 @@ -1350,7 +1350,7 @@
  61.221    assumes holf: "f holomorphic_on (ball 0 r)" and [simp]: "f 0 = 0"
  61.222    obtains h where "h holomorphic_on (ball 0 r)" and "\<And>z. norm z < r \<Longrightarrow> f z = z * (h z)" and "deriv f 0 = h 0"
  61.223  proof -
  61.224 -  def h \<equiv> "\<lambda>z. if z = 0 then deriv f 0 else f z / z"
  61.225 +  define h where "h z = (if z = 0 then deriv f 0 else f z / z)" for z
  61.226    have d0: "deriv f 0 = h 0"
  61.227      by (simp add: h_def)
  61.228    moreover have "h holomorphic_on (ball 0 r)"
  61.229 @@ -1742,7 +1742,7 @@
  61.230      case True then show ?thesis by simp
  61.231    next
  61.232      case False
  61.233 -    def C \<equiv> "2 * norm(deriv f 0)"
  61.234 +    define C where "C = 2 * norm(deriv f 0)"
  61.235      have "0 < C" using False by (simp add: C_def)
  61.236      have holf': "f holomorphic_on ball 0 r" using holf
  61.237        using ball_subset_cball holomorphic_on_subset by blast
  61.238 @@ -1932,9 +1932,9 @@
  61.239    assumes holf: "f holomorphic_on ball a 1" and [simp]: "deriv f a = 1"
  61.240    obtains b r where "1/12 < r" "ball b r \<subseteq> f ` (ball a 1)"
  61.241  proof -
  61.242 -  def r \<equiv> "249/256::real"
  61.243 +  define r :: real where "r = 249/256"
  61.244    have "0 < r" "r < 1" by (auto simp: r_def)
  61.245 -  def g \<equiv> "\<lambda>z. deriv f z * of_real(r - norm(z - a))"
  61.246 +  define g where "g z = deriv f z * of_real(r - norm(z - a))" for z
  61.247    have "deriv f holomorphic_on ball a 1"
  61.248      by (rule holomorphic_deriv [OF holf open_ball])
  61.249    then have "continuous_on (ball a 1) (deriv f)"
  61.250 @@ -1950,7 +1950,7 @@
  61.251    obtain p where pr: "p \<in> cball a r" 
  61.252               and pge: "\<And>y. y \<in> cball a r \<Longrightarrow> norm (g y) \<le> norm (g p)"
  61.253      using distance_attains_sup [OF 1 2, of 0] by force
  61.254 -  def t \<equiv> "(r - norm(p - a)) / 2"
  61.255 +  define t where "t = (r - norm(p - a)) / 2"
  61.256    have "norm (p - a) \<noteq> r"
  61.257      using pge [of a] \<open>r > 0\<close> by (auto simp: g_def norm_mult)
  61.258    then have "norm (p - a) < r" using pr 
  61.259 @@ -2028,73 +2028,73 @@
  61.260      using ball_eq_empty that by fastforce
  61.261  next
  61.262    case False
  61.263 -    def C \<equiv> "deriv f a"
  61.264 -    have "0 < norm C" using False by (simp add: C_def)
  61.265 -    have dfa: "f field_differentiable at a"
  61.266 -      apply (rule holomorphic_on_imp_differentiable_at [OF holf])
  61.267 -      using \<open>0 < r\<close> by auto
  61.268 -    have fo: "(\<lambda>z. f (a + of_real r * z)) = f o (\<lambda>z. (a + of_real r * z))"
  61.269 -      by (simp add: o_def)
  61.270 -    have holf': "f holomorphic_on (\<lambda>z. a + complex_of_real r * z) ` ball 0 1"
  61.271 -      apply (rule holomorphic_on_subset [OF holf])
  61.272 -      using \<open>0 < r\<close> apply (force simp: dist_norm norm_mult)
  61.273 -      done
  61.274 -    have 1: "(\<lambda>z. f (a + r * z) / (C * r)) holomorphic_on ball 0 1"
  61.275 -      apply (rule holomorphic_intros holomorphic_on_compose holf' | simp add: fo)+
  61.276 -      using \<open>0 < r\<close> by (simp add: C_def False)
  61.277 -    have "((\<lambda>z. f (a + of_real r * z) / (C * of_real r)) has_field_derivative
  61.278 -          (deriv f (a + of_real r * z) / C)) (at z)" 
  61.279 -         if "norm z < 1" for z
  61.280 -    proof -
  61.281 +  define C where "C = deriv f a"
  61.282 +  have "0 < norm C" using False by (simp add: C_def)
  61.283 +  have dfa: "f field_differentiable at a"
  61.284 +    apply (rule holomorphic_on_imp_differentiable_at [OF holf])
  61.285 +    using \<open>0 < r\<close> by auto
  61.286 +  have fo: "(\<lambda>z. f (a + of_real r * z)) = f o (\<lambda>z. (a + of_real r * z))"
  61.287 +    by (simp add: o_def)
  61.288 +  have holf': "f holomorphic_on (\<lambda>z. a + complex_of_real r * z) ` ball 0 1"
  61.289 +    apply (rule holomorphic_on_subset [OF holf])
  61.290 +    using \<open>0 < r\<close> apply (force simp: dist_norm norm_mult)
  61.291 +    done
  61.292 +  have 1: "(\<lambda>z. f (a + r * z) / (C * r)) holomorphic_on ball 0 1"
  61.293 +    apply (rule holomorphic_intros holomorphic_on_compose holf' | simp add: fo)+
  61.294 +    using \<open>0 < r\<close> by (simp add: C_def False)
  61.295 +  have "((\<lambda>z. f (a + of_real r * z) / (C * of_real r)) has_field_derivative
  61.296 +        (deriv f (a + of_real r * z) / C)) (at z)" 
  61.297 +       if "norm z < 1" for z
  61.298 +  proof -
  61.299      have *: "((\<lambda>x. f (a + of_real r * x)) has_field_derivative
  61.300 -             (deriv f (a + of_real r * z) * of_real r)) (at z)"
  61.301 -        apply (simp add: fo)
  61.302 -        apply (rule DERIV_chain [OF field_differentiable_derivI])
  61.303 -        apply (rule holomorphic_on_imp_differentiable_at [OF holf], simp)
  61.304 -        using \<open>0 < r\<close> apply (simp add: dist_norm norm_mult that)
  61.305 -        apply (rule derivative_eq_intros | simp)+
  61.306 -        done
  61.307 -      show ?thesis
  61.308 -        apply (rule derivative_eq_intros * | simp)+
  61.309 -        using \<open>0 < r\<close> by (auto simp: C_def False)
  61.310 -    qed
  61.311 -    have 2: "deriv (\<lambda>z. f (a + of_real r * z) / (C * of_real r)) 0 = 1"
  61.312 -      apply (subst deriv_cdivide_right)
  61.313 -      apply (simp add: field_differentiable_def fo)
  61.314 -      apply (rule exI)
  61.315 +           (deriv f (a + of_real r * z) * of_real r)) (at z)"
  61.316 +      apply (simp add: fo)
  61.317        apply (rule DERIV_chain [OF field_differentiable_derivI])
  61.318 -      apply (simp add: dfa)
  61.319 -      apply (rule derivative_eq_intros | simp add: C_def False fo)+
  61.320 -      using \<open>0 < r\<close> 
  61.321 -      apply (simp add: C_def False fo)
  61.322 -      apply (simp add: derivative_intros dfa complex_derivative_chain)
  61.323 +      apply (rule holomorphic_on_imp_differentiable_at [OF holf], simp)
  61.324 +      using \<open>0 < r\<close> apply (simp add: dist_norm norm_mult that)
  61.325 +      apply (rule derivative_eq_intros | simp)+
  61.326        done
  61.327 -    have sb1: "op * (C * r) ` (\<lambda>z. f (a + of_real r * z) / (C * r)) ` ball 0 1 
  61.328 -               \<subseteq> f ` ball a r"
  61.329 -      using \<open>0 < r\<close> by (auto simp: dist_norm norm_mult C_def False)
  61.330 -    have sb2: "ball (C * r * b) r' \<subseteq> op * (C * r) ` ball b t" 
  61.331 -               if "1 / 12 < t" for b t
  61.332 -    proof -
  61.333 -      have *: "r * cmod (deriv f a) / 12 \<le> r * (t * cmod (deriv f a))"
  61.334 -        using that \<open>0 < r\<close> less_eq_real_def mult.commute mult.right_neutral mult_left_mono norm_ge_zero times_divide_eq_right 
  61.335 -        by auto
  61.336 -      show ?thesis
  61.337 -        apply clarify
  61.338 -        apply (rule_tac x="x / (C * r)" in image_eqI)
  61.339 -        using \<open>0 < r\<close>  
  61.340 -        apply (simp_all add: dist_norm norm_mult norm_divide C_def False field_simps)
  61.341 -        apply (erule less_le_trans)
  61.342 -        apply (rule order_trans [OF r' *])
  61.343 -        done
  61.344 -    qed
  61.345      show ?thesis
  61.346 -      apply (rule Bloch_unit [OF 1 2])
  61.347 -      apply (rename_tac t)
  61.348 -      apply (rule_tac b="(C * of_real r) * b" in that)
  61.349 -      apply (drule image_mono [where f = "\<lambda>z. (C * of_real r) * z"])
  61.350 -      using sb1 sb2
  61.351 -      apply force
  61.352 +      apply (rule derivative_eq_intros * | simp)+
  61.353 +      using \<open>0 < r\<close> by (auto simp: C_def False)
  61.354 +  qed
  61.355 +  have 2: "deriv (\<lambda>z. f (a + of_real r * z) / (C * of_real r)) 0 = 1"
  61.356 +    apply (subst deriv_cdivide_right)
  61.357 +    apply (simp add: field_differentiable_def fo)
  61.358 +    apply (rule exI)
  61.359 +    apply (rule DERIV_chain [OF field_differentiable_derivI])
  61.360 +    apply (simp add: dfa)
  61.361 +    apply (rule derivative_eq_intros | simp add: C_def False fo)+
  61.362 +    using \<open>0 < r\<close> 
  61.363 +    apply (simp add: C_def False fo)
  61.364 +    apply (simp add: derivative_intros dfa complex_derivative_chain)
  61.365 +    done
  61.366 +  have sb1: "op * (C * r) ` (\<lambda>z. f (a + of_real r * z) / (C * r)) ` ball 0 1 
  61.367 +             \<subseteq> f ` ball a r"
  61.368 +    using \<open>0 < r\<close> by (auto simp: dist_norm norm_mult C_def False)
  61.369 +  have sb2: "ball (C * r * b) r' \<subseteq> op * (C * r) ` ball b t" 
  61.370 +             if "1 / 12 < t" for b t
  61.371 +  proof -
  61.372 +    have *: "r * cmod (deriv f a) / 12 \<le> r * (t * cmod (deriv f a))"
  61.373 +      using that \<open>0 < r\<close> less_eq_real_def mult.commute mult.right_neutral mult_left_mono norm_ge_zero times_divide_eq_right 
  61.374 +      by auto
  61.375 +    show ?thesis
  61.376 +      apply clarify
  61.377 +      apply (rule_tac x="x / (C * r)" in image_eqI)
  61.378 +      using \<open>0 < r\<close>  
  61.379 +      apply (simp_all add: dist_norm norm_mult norm_divide C_def False field_simps)
  61.380 +      apply (erule less_le_trans)
  61.381 +      apply (rule order_trans [OF r' *])
  61.382        done
  61.383 +  qed
  61.384 +  show ?thesis
  61.385 +    apply (rule Bloch_unit [OF 1 2])
  61.386 +    apply (rename_tac t)
  61.387 +    apply (rule_tac b="(C * of_real r) * b" in that)
  61.388 +    apply (drule image_mono [where f = "\<lambda>z. (C * of_real r) * z"])
  61.389 +    using sb1 sb2
  61.390 +    apply force
  61.391 +    done
  61.392  qed
  61.393  
  61.394  corollary Bloch_general:
  61.395 @@ -2157,8 +2157,8 @@
  61.396            then show "\<lbrakk>x' \<in> ball z r; 0 < dist x' z;dist x' z < r\<rbrakk> 
  61.397              \<Longrightarrow> (x' - z) ^ (n - m) * g x' = h x'" for x' by auto
  61.398          next
  61.399 -          def F\<equiv>"at z within ball z r"
  61.400 -            and f'\<equiv>"\<lambda>x. (x - z) ^ (n-m)"
  61.401 +          define F where "F = at z within ball z r"
  61.402 +          define f' where [abs_def]: "f' x = (x - z) ^ (n-m)" for x
  61.403            have "f' z=0" using \<open>n>m\<close> unfolding f'_def by auto
  61.404            moreover have "continuous F f'" unfolding f'_def F_def
  61.405              by (intro continuous_intros)
  61.406 @@ -2187,8 +2187,8 @@
  61.407            then show "\<lbrakk>x' \<in> ball z r; 0 < dist x' z;dist x' z < r\<rbrakk> 
  61.408              \<Longrightarrow> (x' - z) ^ (m - n) * h x' = g x'" for x' by auto
  61.409          next
  61.410 -          def F\<equiv>"at z within ball z r"
  61.411 -            and f'\<equiv>"\<lambda>x. (x - z) ^ (m-n)"
  61.412 +          define F where "F = at z within ball z r"
  61.413 +          define f' where [abs_def]: "f' x = (x - z) ^ (m-n)" for x
  61.414            have "f' z=0" using \<open>m>n\<close> unfolding f'_def by auto
  61.415            moreover have "continuous F f'" unfolding f'_def F_def
  61.416              by (intro continuous_intros)
  61.417 @@ -2224,7 +2224,7 @@
  61.418            "\<And>w. w \<in> ball z r \<Longrightarrow> g w \<noteq> 0"
  61.419      using holomorphic_factor_zero_nonconstant[OF holo \<open>open s\<close> \<open>connected s\<close> \<open>z\<in>s\<close> \<open>f z=0\<close>]
  61.420      by (metis assms(3) assms(5) assms(6))
  61.421 -  def r'\<equiv>"r/2"
  61.422 +  define r' where "r' = r/2"
  61.423    have "cball z r' \<subseteq> ball z r" unfolding r'_def by (simp add: \<open>0 < r\<close> cball_subset_ball_iff)
  61.424    hence "cball z r' \<subseteq> s" "g holomorphic_on cball z r'" 
  61.425        "(\<forall>w\<in>cball z r'. f w = (w - z) ^ n * g w \<and> g w \<noteq> 0)"
  61.426 @@ -2236,14 +2236,14 @@
  61.427      by (simp add:\<open>0 < n\<close>)
  61.428  next
  61.429    fix m n 
  61.430 -  def fac\<equiv>"\<lambda>n g r. \<forall>w\<in>cball z r. f w = (w - z) ^ n * g w \<and> g w \<noteq> 0"  
  61.431 +  define fac where "fac n g r \<longleftrightarrow> (\<forall>w\<in>cball z r. f w = (w - z) ^ n * g w \<and> g w \<noteq> 0)" for n g r
  61.432    assume n_asm:"\<exists>g r1. 0 < n \<and> 0 < r1 \<and> g holomorphic_on cball z r1 \<and> fac n g r1"
  61.433       and m_asm:"\<exists>h r2. 0 < m \<and> 0 < r2  \<and> h holomorphic_on cball z r2 \<and> fac m h r2"
  61.434    obtain g r1 where "0 < n" "0 < r1" and g_holo: "g holomorphic_on cball z r1" 
  61.435      and "fac n g r1" using n_asm by auto
  61.436    obtain h r2 where "0 < m" "0 < r2" and h_holo: "h holomorphic_on cball z r2"  
  61.437      and "fac m h r2" using m_asm by auto
  61.438 -  def r\<equiv>"min r1 r2"
  61.439 +  define r where "r = min r1 r2"
  61.440    have "r>0" using \<open>r1>0\<close> \<open>r2>0\<close> unfolding r_def by auto
  61.441    moreover have "\<forall>w\<in>ball z r. f w = (w-z)^n * g w \<and> g w\<noteq>0 \<and> f w = (w - z)^m * h w \<and> h w\<noteq>0" 
  61.442      using \<open>fac m h r2\<close> \<open>fac n g r1\<close>   unfolding fac_def r_def
  61.443 @@ -2276,7 +2276,7 @@
  61.444    fix p assume "p\<in>s"
  61.445    then obtain e1 where "e1>0" and e1: "\<forall>w\<in>ball p e1. w\<in>s \<and> (w\<noteq>p \<longrightarrow> w\<notin>pts)" 
  61.446      using finite_ball_avoid[OF assms] by auto
  61.447 -  def e2\<equiv>"e1/2"
  61.448 +  define e2 where "e2 = e1/2"
  61.449    have "e2>0" and "e2<e1" unfolding e2_def using \<open>e1>0\<close> by auto
  61.450    then have "cball p e2 \<subseteq> ball p e1" by (subst cball_subset_ball_iff,auto)
  61.451    then show "\<exists>e>0. \<forall>w\<in>cball p e. w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts)" using \<open>e2>0\<close> e1 by auto
  61.452 @@ -2302,39 +2302,39 @@
  61.453      using finite_ball_avoid[OF \<open>open s\<close> \<open>finite (insert p pts)\<close>,rule_format,of a]  
  61.454        \<open>a \<in> s - insert p pts\<close>
  61.455      by auto
  61.456 -  def a'\<equiv>"a+e/2"
  61.457 +  define a' where "a' = a+e/2"
  61.458    have "a'\<in>s-{p} -pts"  using e[rule_format,of "a+e/2"] \<open>e>0\<close>  
  61.459      by (auto simp add:dist_complex_def a'_def)
  61.460    then obtain g' where g'[simp]:"valid_path g'" "pathstart g' = a'" "pathfinish g' = b" 
  61.461      "path_image g' \<subseteq> s - {p} - pts" "f contour_integrable_on g'"    
  61.462      using idt.hyps(3)[of a' "s-{p}"] idt.prems idt.hyps(1) 
  61.463      by (metis Diff_insert2 open_delete)
  61.464 -  def g\<equiv>"linepath a a' +++ g'"
  61.465 +  define g where "g = linepath a a' +++ g'"
  61.466    have "valid_path g" unfolding g_def by (auto intro: valid_path_join)
  61.467    moreover have "pathstart g = a" and  "pathfinish g = b" unfolding g_def by auto 
  61.468    moreover have "path_image g \<subseteq> s - insert p pts" unfolding g_def 
  61.469 -    proof (rule subset_path_image_join)
  61.470 -      have "closed_segment a a' \<subseteq> ball a e" using \<open>e>0\<close> 
  61.471 -        by (auto dest!:segment_bound1 simp:a'_def dist_complex_def norm_minus_commute)
  61.472 -      then show "path_image (linepath a a') \<subseteq> s - insert p pts" using e idt(9)
  61.473 -        by auto
  61.474 -    next
  61.475 -      show "path_image g' \<subseteq> s - insert p pts" using g'(4) by blast
  61.476 -    qed
  61.477 +  proof (rule subset_path_image_join)
  61.478 +    have "closed_segment a a' \<subseteq> ball a e" using \<open>e>0\<close> 
  61.479 +      by (auto dest!:segment_bound1 simp:a'_def dist_complex_def norm_minus_commute)
  61.480 +    then show "path_image (linepath a a') \<subseteq> s - insert p pts" using e idt(9)
  61.481 +      by auto
  61.482 +  next
  61.483 +    show "path_image g' \<subseteq> s - insert p pts" using g'(4) by blast
  61.484 +  qed
  61.485    moreover have "f contour_integrable_on g"  
  61.486 -    proof -
  61.487 -      have "closed_segment a a' \<subseteq> ball a e" using \<open>e>0\<close> 
  61.488 -        by (auto dest!:segment_bound1 simp:a'_def dist_complex_def norm_minus_commute)
  61.489 -      then have "continuous_on (closed_segment a a') f" 
  61.490 -        using e idt.prems(6) holomorphic_on_imp_continuous_on[OF idt.prems(5)]
  61.491 -        apply (elim continuous_on_subset)
  61.492 -        by auto
  61.493 -      then have "f contour_integrable_on linepath a a'" 
  61.494 -        using contour_integrable_continuous_linepath by auto
  61.495 -      then show ?thesis unfolding g_def
  61.496 -        apply (rule contour_integrable_joinI)
  61.497 -        by (auto simp add: \<open>e>0\<close>)
  61.498 -    qed
  61.499 +  proof -
  61.500 +    have "closed_segment a a' \<subseteq> ball a e" using \<open>e>0\<close> 
  61.501 +      by (auto dest!:segment_bound1 simp:a'_def dist_complex_def norm_minus_commute)
  61.502 +    then have "continuous_on (closed_segment a a') f" 
  61.503 +      using e idt.prems(6) holomorphic_on_imp_continuous_on[OF idt.prems(5)]
  61.504 +      apply (elim continuous_on_subset)
  61.505 +      by auto
  61.506 +    then have "f contour_integrable_on linepath a a'" 
  61.507 +      using contour_integrable_continuous_linepath by auto
  61.508 +    then show ?thesis unfolding g_def
  61.509 +      apply (rule contour_integrable_joinI)
  61.510 +      by (auto simp add: \<open>e>0\<close>)
  61.511 +  qed
  61.512    ultimately show ?case using idt.prems(1)[of g] by auto
  61.513  qed
  61.514  
  61.515 @@ -2376,9 +2376,10 @@
  61.516    obtain n::int where "n=winding_number g p"
  61.517      using integer_winding_number[OF _ g_loop,of p] valid path_img 
  61.518      by (metis DiffD2 Ints_cases insertI1 subset_eq valid_path_imp_path)
  61.519 -  def p_circ\<equiv>"circlepath p (h p)" and p_circ_pt\<equiv>"linepath (p+h p) (p+h p)"
  61.520 -  def n_circ\<equiv>"\<lambda>n. (op +++ p_circ ^^ n) p_circ_pt"
  61.521 -  def cp\<equiv>"if n\<ge>0 then reversepath (n_circ (nat n)) else n_circ (nat (- n))"
  61.522 +  define p_circ where "p_circ = circlepath p (h p)"
  61.523 +  define p_circ_pt where "p_circ_pt = linepath (p+h p) (p+h p)"
  61.524 +  define n_circ where "n_circ n = (op +++ p_circ ^^ n) p_circ_pt" for n
  61.525 +  define cp where "cp = (if n\<ge>0 then reversepath (n_circ (nat n)) else n_circ (nat (- n)))"
  61.526    have n_circ:"valid_path (n_circ k)"    
  61.527        "winding_number (n_circ k) p = k"
  61.528        "pathstart (n_circ k) = p + h p" "pathfinish (n_circ k) = p + h p" 
  61.529 @@ -2509,7 +2510,7 @@
  61.530          unfolding cp_def using contour_integral_reversepath[OF n_circ(1)] n_circ(9)
  61.531          by auto
  61.532      qed
  61.533 -  def g'\<equiv>"g +++ pg +++ cp +++ (reversepath pg)"
  61.534 +  define g' where "g' = g +++ pg +++ cp +++ (reversepath pg)"
  61.535    have "contour_integral g' f = (\<Sum>p\<in>pts. winding_number g' p * contour_integral (circlepath p (h p)) f)"
  61.536      proof (rule "2.hyps"(3)[of "s-{p}" "g'",OF _ _ \<open>finite pts\<close> ]) 
  61.537        show "connected (s - {p} - pts)" using connected by (metis Diff_insert2)
  61.538 @@ -2523,8 +2524,8 @@
  61.539          unfolding g'_def cp_def using pg(2) by simp
  61.540        show "path_image g' \<subseteq> s - {p} - pts" 
  61.541          proof -
  61.542 -          def s'\<equiv>"s - {p} - pts"
  61.543 -          have s':"s' = s-insert p pts " unfolding s'_def by auto
  61.544 +          define s' where "s' = s - {p} - pts"
  61.545 +          have s': "s' = s-insert p pts " unfolding s'_def by auto
  61.546            then show ?thesis using path_img pg(4) cp(4)      
  61.547              unfolding g'_def 
  61.548              apply (fold s'_def s')           
  61.549 @@ -2648,9 +2649,10 @@
  61.550    shows "contour_integral g f = (\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f)"
  61.551      (is "?L=?R")
  61.552  proof -
  61.553 -  def circ\<equiv>"\<lambda>p. winding_number g p * contour_integral (circlepath p (h p)) f"
  61.554 -  def pts1\<equiv>"pts \<inter> s" 
  61.555 -  def pts2\<equiv>"pts - pts1"
  61.556 +  define circ
  61.557 +    where [abs_def]: "circ p = winding_number g p * contour_integral (circlepath p (h p)) f" for p
  61.558 +  define pts1 where "pts1 = pts \<inter> s" 
  61.559 +  define pts2 where "pts2 = pts - pts1"
  61.560    have "pts=pts1 \<union> pts2" "pts1 \<inter> pts2 = {}" "pts2 \<inter> s={}" "pts1\<subseteq>s" 
  61.561      unfolding pts1_def pts2_def by auto
  61.562    have "contour_integral g f =  (\<Sum>p\<in>pts1. circ p)" unfolding circ_def
  61.563 @@ -2680,8 +2682,6 @@
  61.564  qed
  61.565  
  61.566  
  61.567 -
  61.568 -
  61.569  (*order of the zero of f at z*)
  61.570  definition zorder::"(complex \<Rightarrow> complex) \<Rightarrow> complex \<Rightarrow> nat" where
  61.571    "zorder f z = (THE n. n>0 \<and> (\<exists>h r. r>0 \<and> h holomorphic_on cball z r 
  61.572 @@ -2714,8 +2714,8 @@
  61.573    shows "\<exists>r. n>0 \<and> r>0 \<and> cball z r \<subseteq> s \<and> h holomorphic_on cball z r 
  61.574      \<and> (\<forall>w\<in>cball z r. f w  = h w * (w-z)^n \<and> h w \<noteq>0) "
  61.575  proof -
  61.576 -  def P\<equiv>"\<lambda>h r n. r>0 \<and> h holomorphic_on cball z r 
  61.577 -    \<and> (\<forall>w\<in>cball z r. ( f w  = h w * (w-z)^n) \<and> h w \<noteq>0)"
  61.578 +  define P where "P h r n \<longleftrightarrow> r>0 \<and> h holomorphic_on cball z r 
  61.579 +    \<and> (\<forall>w\<in>cball z r. ( f w  = h w * (w-z)^n) \<and> h w \<noteq>0)" for h r n
  61.580    have "(\<exists>!n. n>0 \<and> (\<exists> h r. P h r n))"
  61.581      proof -
  61.582        have "\<exists>!n. \<exists>h r. n>0 \<and> P h r n"
  61.583 @@ -2739,7 +2739,7 @@
  61.584    then obtain r1 where "P h r1 n" by auto
  61.585    obtain r2 where "r2>0" "cball z r2 \<subseteq> s" 
  61.586      using assms(3) assms(5) open_contains_cball_eq by blast
  61.587 -  def r3\<equiv>"min r1 r2"
  61.588 +  define r3 where "r3 = min r1 r2"
  61.589    have "P h r3 n" using \<open>P h r1 n\<close> \<open>r2>0\<close> unfolding P_def r3_def
  61.590      by auto
  61.591    moreover have "cball z r3 \<subseteq> s" using \<open>cball z r2 \<subseteq> s\<close> unfolding r3_def by auto
  61.592 @@ -2755,7 +2755,8 @@
  61.593    shows "\<exists>r. n>0 \<and> r>0 \<and> cball z r \<subseteq> s \<and> h holomorphic_on cball z r 
  61.594      \<and> (\<forall>w\<in>cball z r. f w  = h w / (w-z)^n \<and> h w \<noteq>0)"
  61.595  proof -
  61.596 -  def zo\<equiv>"zorder (inverse \<circ> f) z" and zp\<equiv>"zer_poly (inverse \<circ> f) z"
  61.597 +  define zo where "zo = zorder (inverse \<circ> f) z"
  61.598 +  define zp where "zp = zer_poly (inverse \<circ> f) z"
  61.599    obtain r where "0 < zo" "0 < r" "cball z r \<subseteq> s" and zp_holo: "zp holomorphic_on cball z r" and
  61.600        zp_fac: "\<forall>w\<in>cball z r. (inverse \<circ> f) w = zp w * (w - z) ^ zo \<and> zp w \<noteq> 0"
  61.601      using zorder_exist[OF \<open>open s\<close> \<open>connected s\<close> \<open>z\<in>s\<close> holo,folded zo_def zp_def] 
  61.602 @@ -2782,14 +2783,15 @@
  61.603    shows "\<exists>r>0. cball z r \<subseteq> s 
  61.604      \<and> (f has_contour_integral complex_of_real (2 * pi) * \<i> * residue f z) (circlepath z r)"
  61.605  proof -
  61.606 -  def n\<equiv>"porder f z" and h\<equiv>"pol_poly f z"
  61.607 +  define n where "n = porder f z"
  61.608 +  define h where "h = pol_poly f z"
  61.609    obtain r where "n>0" "0 < r" and
  61.610        r_b:"cball z r \<subseteq> s" and
  61.611        h_holo:"h holomorphic_on cball z r" 
  61.612        and h:"(\<forall>w\<in>cball z r. f w = h w / (w - z) ^ n \<and> h w \<noteq> 0)"
  61.613      using porder_exist[OF \<open>open s\<close> \<open>connected s\<close> \<open>z\<in>s\<close> holo \<open>f z=0\<close> non_c]
  61.614      unfolding n_def h_def by auto
  61.615 -  def c\<equiv>"complex_of_real (2 * pi) * \<i>"
  61.616 +  define c where "c = complex_of_real (2 * pi) * \<i>"
  61.617    have "residue f z =  (deriv ^^ (n - 1)) h z / fact (n-1)"
  61.618      unfolding residue_def 
  61.619      apply (fold n_def h_def)
  61.620 @@ -2819,10 +2821,11 @@
  61.621            poles:"\<forall>p\<in>poles. is_pole f p"
  61.622    shows "contour_integral \<gamma> f = 2 * pi * \<i> *(\<Sum>p\<in>poles. winding_number \<gamma> p * residue f p)"
  61.623  proof -
  61.624 -  def pts\<equiv>"{p. f p=0}"
  61.625 -  def c\<equiv>"2 * complex_of_real pi * \<i> "
  61.626 -  def contour\<equiv>"\<lambda>p e. (f has_contour_integral c * residue f p) (circlepath p e)"
  61.627 -  def avoid\<equiv>"\<lambda>p e. \<forall>w\<in>cball p e. w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts)"
  61.628 +  define pts where "pts = {p. f p=0}"
  61.629 +  define c where "c = 2 * complex_of_real pi * \<i> "
  61.630 +  define contour
  61.631 +    where "contour p e = (f has_contour_integral c * residue f p) (circlepath p e)" for p e
  61.632 +  define avoid where "avoid p e \<longleftrightarrow> (\<forall>w\<in>cball p e. w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts))" for p e
  61.633    have "poles \<subseteq> pts" and "finite pts"
  61.634      using poles \<open>finite {p. f p=0}\<close> unfolding pts_def is_pole_def by auto
  61.635    have "\<exists>e>0. avoid p e \<and> (p\<in>poles \<longrightarrow> contour p e)" 
  61.636 @@ -2832,35 +2835,35 @@
  61.637          using finite_cball_avoid[OF \<open>open s\<close> \<open>finite pts\<close>] \<open>p\<in>s\<close> unfolding avoid_def by auto
  61.638        have "\<exists>e2>0. cball p e2 \<subseteq> ball p e1 \<and> contour p e2"
  61.639          when "p\<in>poles" unfolding c_def contour_def
  61.640 -        proof (rule base_residue[of "ball p e1" p f,simplified,OF \<open>e1>0\<close>])
  61.641 -          show "inverse \<circ> f holomorphic_on ball p e1" 
  61.642 -            proof -
  61.643 -              def f'\<equiv>"inverse o f"
  61.644 -              have "f holomorphic_on ball p e1 - {p}" 
  61.645 -                using holo e \<open>poles \<subseteq> pts\<close> unfolding avoid_def
  61.646 -                apply (elim holomorphic_on_subset)
  61.647 -                by auto
  61.648 -              then have f'_holo:"f' holomorphic_on ball p e1 - {p}" unfolding f'_def comp_def 
  61.649 -                apply (elim holomorphic_on_inverse)
  61.650 -                using e pts_def  ball_subset_cball unfolding avoid_def by blast
  61.651 -              moreover have "isCont f' p" using \<open>p\<in>poles\<close> poles unfolding f'_def is_pole_def by auto
  61.652 -              ultimately show "f' holomorphic_on ball p e1"
  61.653 -                apply (elim no_isolated_singularity[rotated])
  61.654 -                apply (auto simp add:continuous_on_eq_continuous_at[of "ball p e1",simplified])
  61.655 -                using field_differentiable_imp_continuous_at f'_holo 
  61.656 -                  holomorphic_on_imp_differentiable_at by fastforce
  61.657 -            qed
  61.658 -        next
  61.659 -          show "f p = 0" using \<open>p\<in>poles\<close> poles unfolding is_pole_def by auto
  61.660 -        next
  61.661 -          def p'\<equiv>"p+e1/2"
  61.662 -          have "p'\<in>ball p e1" and "p'\<noteq>p" using \<open>e1>0\<close> unfolding p'_def by (auto simp add:dist_norm)
  61.663 -          then show "\<exists>w\<in>ball p e1. f w \<noteq> 0" using e unfolding avoid_def
  61.664 -            apply (rule_tac x=p' in bexI)
  61.665 -            by (auto simp add:pts_def)
  61.666 +      proof (rule base_residue[of "ball p e1" p f,simplified,OF \<open>e1>0\<close>])
  61.667 +        show "inverse \<circ> f holomorphic_on ball p e1"
  61.668 +        proof -
  61.669 +          define f' where "f' = inverse o f"
  61.670 +          have "f holomorphic_on ball p e1 - {p}" 
  61.671 +            using holo e \<open>poles \<subseteq> pts\<close> unfolding avoid_def
  61.672 +            apply (elim holomorphic_on_subset)
  61.673 +            by auto
  61.674 +          then have f'_holo:"f' holomorphic_on ball p e1 - {p}" unfolding f'_def comp_def 
  61.675 +            apply (elim holomorphic_on_inverse)
  61.676 +            using e pts_def  ball_subset_cball unfolding avoid_def by blast
  61.677 +          moreover have "isCont f' p" using \<open>p\<in>poles\<close> poles unfolding f'_def is_pole_def by auto
  61.678 +          ultimately show "f' holomorphic_on ball p e1"
  61.679 +            apply (elim no_isolated_singularity[rotated])
  61.680 +            apply (auto simp add:continuous_on_eq_continuous_at[of "ball p e1",simplified])
  61.681 +            using field_differentiable_imp_continuous_at f'_holo 
  61.682 +              holomorphic_on_imp_differentiable_at by fastforce
  61.683          qed
  61.684 +      next
  61.685 +        show "f p = 0" using \<open>p\<in>poles\<close> poles unfolding is_pole_def by auto
  61.686 +      next
  61.687 +        define p' where "p' = p+e1/2"
  61.688 +        have "p'\<in>ball p e1" and "p'\<noteq>p" using \<open>e1>0\<close> unfolding p'_def by (auto simp add:dist_norm)
  61.689 +        then show "\<exists>w\<in>ball p e1. f w \<noteq> 0" using e unfolding avoid_def
  61.690 +          apply (rule_tac x=p' in bexI)
  61.691 +          by (auto simp add:pts_def)
  61.692 +      qed
  61.693        then obtain e2 where e2:"p\<in>poles \<longrightarrow> e2>0 \<and> cball p e2 \<subseteq> ball p e1 \<and> contour p e2" by auto
  61.694 -      def e3\<equiv>"if p\<in>poles then e2 else e1"
  61.695 +      define e3 where "e3 = (if p\<in>poles then e2 else e1)"
  61.696        have "avoid p e3" 
  61.697          using e2 e that  avoid_def e3_def by auto
  61.698        moreover have "e3>0" using \<open>e1>0\<close> e2 unfolding e3_def by auto        
  61.699 @@ -2869,33 +2872,33 @@
  61.700      qed  
  61.701    then obtain h where h:"\<forall>p\<in>s. h p>0 \<and> (avoid p (h p) \<and> (p\<in>poles \<longrightarrow> contour p (h p)))"
  61.702      by metis
  61.703 -  def cont\<equiv>"\<lambda>p. contour_integral (circlepath p (h p)) f"
  61.704 +  define cont where "cont p = contour_integral (circlepath p (h p)) f" for p
  61.705    have "contour_integral \<gamma> f = (\<Sum>p\<in>poles. winding_number \<gamma> p * cont p)"
  61.706      unfolding cont_def
  61.707 -    proof (rule Cauchy_theorem_singularities[OF \<open>open s\<close> \<open>connected (s-poles)\<close> _ holo \<open>valid_path \<gamma>\<close> 
  61.708 -        loop \<open>path_image \<gamma> \<subseteq> s-poles\<close> homo])
  61.709 -      show "finite poles" using \<open>poles \<subseteq> pts\<close> and \<open>finite pts\<close> by (simp add: finite_subset)
  61.710 -    next
  61.711 -      show "\<forall>p\<in>s. 0 < h p \<and> (\<forall>w\<in>cball p (h p). w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> poles))"
  61.712 -        using   \<open>poles \<subseteq> pts\<close> h unfolding avoid_def by blast
  61.713 -    qed
  61.714 +  proof (rule Cauchy_theorem_singularities[OF \<open>open s\<close> \<open>connected (s-poles)\<close> _ holo \<open>valid_path \<gamma>\<close> 
  61.715 +      loop \<open>path_image \<gamma> \<subseteq> s-poles\<close> homo])
  61.716 +    show "finite poles" using \<open>poles \<subseteq> pts\<close> and \<open>finite pts\<close> by (simp add: finite_subset)
  61.717 +  next
  61.718 +    show "\<forall>p\<in>s. 0 < h p \<and> (\<forall>w\<in>cball p (h p). w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> poles))"
  61.719 +      using   \<open>poles \<subseteq> pts\<close> h unfolding avoid_def by blast
  61.720 +  qed
  61.721    also have "... = (\<Sum>p\<in>poles. c * (winding_number \<gamma> p * residue f p))" 
  61.722 -    proof (rule setsum.cong[of poles poles,simplified])
  61.723 -      fix p assume "p \<in> poles"
  61.724 -      show "winding_number \<gamma> p * cont p = c * (winding_number \<gamma> p * residue f p)"
  61.725 -        proof (cases "p\<in>s")
  61.726 -          assume "p \<in> s"
  61.727 -          then have "cont p=c*residue f p"
  61.728 -            unfolding cont_def
  61.729 -            apply (intro contour_integral_unique)
  61.730 -            using h[unfolded contour_def] \<open>p \<in> poles\<close> by blast
  61.731 -          then show ?thesis by auto
  61.732 -        next
  61.733 -          assume "p\<notin>s"
  61.734 -          then have "winding_number \<gamma> p=0" using homo by auto
  61.735 -          then show ?thesis by auto
  61.736 -        qed
  61.737 +  proof (rule setsum.cong[of poles poles,simplified])
  61.738 +    fix p assume "p \<in> poles"
  61.739 +    show "winding_number \<gamma> p * cont p = c * (winding_number \<gamma> p * residue f p)"
  61.740 +    proof (cases "p\<in>s")
  61.741 +      assume "p \<in> s"
  61.742 +      then have "cont p=c*residue f p"
  61.743 +        unfolding cont_def
  61.744 +        apply (intro contour_integral_unique)
  61.745 +        using h[unfolded contour_def] \<open>p \<in> poles\<close> by blast
  61.746 +      then show ?thesis by auto
  61.747 +    next
  61.748 +      assume "p\<notin>s"
  61.749 +      then have "winding_number \<gamma> p=0" using homo by auto
  61.750 +      then show ?thesis by auto
  61.751      qed
  61.752 +  qed
  61.753    also have "... = c * (\<Sum>p\<in>poles. winding_number \<gamma> p * residue f p)" 
  61.754      apply (subst setsum_right_distrib)
  61.755      by simp
  61.756 @@ -2921,11 +2924,13 @@
  61.757             - (\<Sum>p\<in>poles. winding_number g p * h p * porder f p))"
  61.758      (is "?L=?R")
  61.759  proof -
  61.760 -  def c\<equiv>"2 * complex_of_real pi * \<i> "
  61.761 -  def ff\<equiv>"(\<lambda>x. deriv f x * h x / f x)"
  61.762 -  def cont_pole\<equiv>"\<lambda>ff p e. (ff has_contour_integral - c  * porder f p * h p) (circlepath p e)"
  61.763 -  def cont_zero\<equiv>"\<lambda>ff p e. (ff has_contour_integral c * zorder f p * h p ) (circlepath p e)"
  61.764 -  def avoid\<equiv>"\<lambda>p e. \<forall>w\<in>cball p e. w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts)"
  61.765 +  define c where "c = 2 * complex_of_real pi * \<i> "
  61.766 +  define ff where [abs_def]: "ff x = deriv f x * h x / f x" for x
  61.767 +  define cont_pole where "cont_pole ff p e \<longleftrightarrow>
  61.768 +    (ff has_contour_integral - c  * porder f p * h p) (circlepath p e)" for ff p e
  61.769 +  define cont_zero where "cont_zero ff p e \<longleftrightarrow>
  61.770 +    (ff has_contour_integral c * zorder f p * h p ) (circlepath p e)" for ff p e
  61.771 +  define avoid where "avoid p e \<longleftrightarrow> (\<forall>w\<in>cball p e. w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts))" for p e
  61.772    have "poles \<subseteq> pts" and "zeros \<subseteq> pts" and "finite zeros" and "pts=zeros \<union> poles"
  61.773      using poles \<open>finite pts\<close> unfolding pts_def zeros_def is_pole_def by auto
  61.774    have "\<exists>e>0. avoid p e \<and> (p\<in>poles \<longrightarrow> cont_pole ff p e) \<and> (p\<in>zeros \<longrightarrow> cont_zero ff p e)" 
  61.775 @@ -2936,10 +2941,10 @@
  61.776        have "\<exists>e2>0. cball p e2 \<subseteq> ball p e1 \<and> cont_pole ff p e2"
  61.777          when "p\<in>poles" 
  61.778          proof - 
  61.779 -          def po\<equiv>"porder f p"
  61.780 -          def pp\<equiv>"pol_poly f p"
  61.781 -          def f'\<equiv>"\<lambda>w. pp w / (w - p) ^ po"
  61.782 -          def ff'\<equiv>"(\<lambda>x. deriv f' x * h x / f' x)"
  61.783 +          define po where "po = porder f p"
  61.784 +          define pp where "pp = pol_poly f p"
  61.785 +          define f' where [abs_def]: "f' w = pp w / (w - p) ^ po" for w
  61.786 +          define ff' where [abs_def]: "ff' x = deriv f' x * h x / f' x" for x
  61.787            have "inverse \<circ> f holomorphic_on ball p e1" 
  61.788              proof -
  61.789                have "f holomorphic_on ball p e1 - {p}" 
  61.790 @@ -2962,7 +2967,7 @@
  61.791            moreover have "f p = 0" using \<open>p\<in>poles\<close> poles unfolding is_pole_def by auto
  61.792            moreover have "\<exists>w\<in>ball p e1. f w \<noteq> 0" 
  61.793              proof -
  61.794 -              def p'\<equiv>"p+e1/2"
  61.795 +              define p' where "p' = p+e1/2"
  61.796                have "p'\<in>ball p e1" and "p'\<noteq>p" using \<open>e1>0\<close> unfolding p'_def by (auto simp add:dist_norm)
  61.797                then show "\<exists>w\<in>ball p e1. f w \<noteq> 0" using e unfolding avoid_def
  61.798                  apply (rule_tac x=p' in bexI)
  61.799 @@ -2975,40 +2980,41 @@
  61.800                pp_po:"(\<forall>w\<in>cball p r. f w = pp w / (w - p) ^ po \<and> pp w \<noteq> 0)"
  61.801              using porder_exist[of "ball p e1" p f,simplified,OF \<open>e1>0\<close>] unfolding po_def pp_def
  61.802              by auto    
  61.803 -          def e2\<equiv>"r/2"
  61.804 +          define e2 where "e2 = r/2"
  61.805            have "e2>0" using \<open>r>0\<close> unfolding e2_def by auto
  61.806 -          def anal\<equiv>"\<lambda>w. deriv pp w * h w / pp w" and prin\<equiv>"\<lambda>w. - of_nat po * h w / (w - p)"
  61.807 +          define anal where [abs_def]: "anal w = deriv pp w * h w / pp w" for w
  61.808 +          define prin where [abs_def]: "prin w = - of_nat po * h w / (w - p)" for w
  61.809            have "((\<lambda>w.  prin w + anal w) has_contour_integral - c * po * h p) (circlepath p e2)"
  61.810 -            proof (rule  has_contour_integral_add[of _ _ _ _ 0,simplified])
  61.811 -              have "ball p r \<subseteq> s" 
  61.812 -                using \<open>cball p r \<subseteq> ball p e1\<close> avoid_def ball_subset_cball e by blast
  61.813 -              then have "cball p e2 \<subseteq> s"
  61.814 -                using \<open>r>0\<close> unfolding e2_def by auto  
  61.815 -              then have "(\<lambda>w. - of_nat po * h w) holomorphic_on cball p e2" 
  61.816 -                using h_holo
  61.817 -                by (auto intro!: holomorphic_intros)
  61.818 -              then show "(prin has_contour_integral - c * of_nat po * h p ) (circlepath p e2)"
  61.819 -                using Cauchy_integral_circlepath_simple[folded c_def, of "\<lambda>w. - of_nat po * h w"]
  61.820 -                  \<open>e2>0\<close>
  61.821 -                unfolding prin_def
  61.822 -                by (auto simp add: mult.assoc)
  61.823 -              have "anal holomorphic_on ball p r" unfolding anal_def 
  61.824 -                using pp_holo h_holo pp_po \<open>ball p r \<subseteq> s\<close>
  61.825 -                by (auto intro!: holomorphic_intros)
  61.826 -              then show "(anal has_contour_integral 0) (circlepath p e2)"
  61.827 -                using e2_def \<open>r>0\<close>
  61.828 -                by (auto elim!: Cauchy_theorem_disc_simple)
  61.829 -            qed
  61.830 +          proof (rule  has_contour_integral_add[of _ _ _ _ 0,simplified])
  61.831 +            have "ball p r \<subseteq> s" 
  61.832 +              using \<open>cball p r \<subseteq> ball p e1\<close> avoid_def ball_subset_cball e by blast
  61.833 +            then have "cball p e2 \<subseteq> s"
  61.834 +              using \<open>r>0\<close> unfolding e2_def by auto  
  61.835 +            then have "(\<lambda>w. - of_nat po * h w) holomorphic_on cball p e2" 
  61.836 +              using h_holo
  61.837 +              by (auto intro!: holomorphic_intros)
  61.838 +            then show "(prin has_contour_integral - c * of_nat po * h p ) (circlepath p e2)"
  61.839 +              using Cauchy_integral_circlepath_simple[folded c_def, of "\<lambda>w. - of_nat po * h w"]
  61.840 +                \<open>e2>0\<close>
  61.841 +              unfolding prin_def
  61.842 +              by (auto simp add: mult.assoc)
  61.843 +            have "anal holomorphic_on ball p r" unfolding anal_def 
  61.844 +              using pp_holo h_holo pp_po \<open>ball p r \<subseteq> s\<close>
  61.845 +              by (auto intro!: holomorphic_intros)
  61.846 +            then show "(anal has_contour_integral 0) (circlepath p e2)"
  61.847 +              using e2_def \<open>r>0\<close>
  61.848 +              by (auto elim!: Cauchy_theorem_disc_simple)
  61.849 +          qed
  61.850            then have "cont_pole ff' p e2" unfolding cont_pole_def po_def
  61.851              proof (elim has_contour_integral_eq)
  61.852                fix w assume "w \<in> path_image (circlepath p e2)" 
  61.853                then have "w\<in>ball p r" and "w\<noteq>p" unfolding e2_def using \<open>r>0\<close> by auto
  61.854 -              def wp\<equiv>"w-p"
  61.855 +              define wp where "wp = w-p"
  61.856                have "wp\<noteq>0" and "pp w \<noteq>0" 
  61.857                  unfolding wp_def using \<open>w\<noteq>p\<close> \<open>w\<in>ball p r\<close> pp_po by auto 
  61.858                moreover have der_f':"deriv f' w = - po * pp w / (w-p)^(po+1) + deriv pp w / (w-p)^po" 
  61.859                  proof (rule DERIV_imp_deriv)
  61.860 -                  def der \<equiv> "- po * pp w / (w-p)^(po+1) + deriv pp w / (w-p)^po"
  61.861 +                  define der where "der = - po * pp w / (w-p)^(po+1) + deriv pp w / (w-p)^po"
  61.862                    have po:"po = Suc (po - Suc 0) " using \<open>po>0\<close> by auto
  61.863                    have "(pp has_field_derivative (deriv pp w)) (at w)" 
  61.864                      using DERIV_deriv_iff_field_differentiable \<open>w\<in>ball p r\<close>
  61.865 @@ -3067,26 +3073,27 @@
  61.866        have "\<exists>e3>0. cball p e3 \<subseteq> ball p e1 \<and> cont_zero ff p e3"
  61.867          when "p\<in>zeros"
  61.868          proof -
  61.869 -          def zo\<equiv>"zorder f p"
  61.870 -          def zp\<equiv>"zer_poly f p"
  61.871 -          def f'\<equiv>"\<lambda>w. zp w * (w - p) ^ zo"
  61.872 -          def ff'\<equiv>"(\<lambda>x. deriv f' x * h x / f' x)"
  61.873 +          define zo where "zo = zorder f p"
  61.874 +          define zp where "zp = zer_poly f p"
  61.875 +          define f' where [abs_def]: "f' w = zp w * (w - p) ^ zo" for w
  61.876 +          define ff' where [abs_def]: "ff' x = deriv f' x * h x / f' x" for x
  61.877            have "f holomorphic_on ball p e1" 
  61.878 -            proof -
  61.879 -              have "ball p e1 \<subseteq> s - poles" 
  61.880 -                using \<open>poles \<subseteq> pts\<close> avoid_def ball_subset_cball e that zeros_def by fastforce
  61.881 -              thus ?thesis using f_holo by auto
  61.882 -            qed
  61.883 +          proof -
  61.884 +            have "ball p e1 \<subseteq> s - poles" 
  61.885 +              using \<open>poles \<subseteq> pts\<close> avoid_def ball_subset_cball e that zeros_def by fastforce
  61.886 +            thus ?thesis using f_holo by auto
  61.887 +          qed
  61.888            moreover have "f p = 0" using \<open>p\<in>zeros\<close> 
  61.889              using DiffD1 mem_Collect_eq pts_def zeros_def by blast
  61.890            moreover have "\<exists>w\<in>ball p e1. f w \<noteq> 0" 
  61.891 -            proof -
  61.892 -              def p'\<equiv>"p+e1/2"
  61.893 -              have "p'\<in>ball p e1" and "p'\<noteq>p" using \<open>e1>0\<close> unfolding p'_def by (auto simp add:dist_norm)
  61.894 -              then show "\<exists>w\<in>ball p e1. f w \<noteq> 0" using e unfolding avoid_def
  61.895 -                apply (rule_tac x=p' in bexI)
  61.896 -                by (auto simp add:pts_def)
  61.897 -            qed
  61.898 +          proof -
  61.899 +            define p' where "p' = p+e1/2"
  61.900 +            have "p'\<in>ball p e1" and "p'\<noteq>p"
  61.901 +              using \<open>e1>0\<close> unfolding p'_def by (auto simp add:dist_norm)
  61.902 +            then show "\<exists>w\<in>ball p e1. f w \<noteq> 0" using e unfolding avoid_def
  61.903 +              apply (rule_tac x=p' in bexI)
  61.904 +              by (auto simp add:pts_def)
  61.905 +          qed
  61.906            ultimately obtain r where 
  61.907                "0 < zo" "r>0"
  61.908                "cball p r \<subseteq> ball p e1" and
  61.909 @@ -3094,58 +3101,59 @@
  61.910                pp_po:"(\<forall>w\<in>cball p r. f w = zp w * (w - p) ^ zo \<and> zp w \<noteq> 0)"
  61.911              using zorder_exist[of "ball p e1" p f,simplified,OF \<open>e1>0\<close>] unfolding zo_def zp_def
  61.912              by auto    
  61.913 -          def e2\<equiv>"r/2"
  61.914 +          define e2 where "e2 = r/2"
  61.915            have "e2>0" using \<open>r>0\<close> unfolding e2_def by auto
  61.916 -          def anal\<equiv>"\<lambda>w. deriv zp w * h w / zp w" and prin\<equiv>"\<lambda>w. of_nat zo * h w / (w - p)"
  61.917 +          define anal where [abs_def]: "anal w = deriv zp w * h w / zp w" for w
  61.918 +          define prin where [abs_def]: "prin w = of_nat zo * h w / (w - p)" for w
  61.919            have "((\<lambda>w.  prin w + anal w) has_contour_integral c * zo * h p) (circlepath p e2)"
  61.920 -            proof (rule  has_contour_integral_add[of _ _ _ _ 0,simplified])
  61.921 -              have "ball p r \<subseteq> s" 
  61.922 -                using \<open>cball p r \<subseteq> ball p e1\<close> avoid_def ball_subset_cball e by blast
  61.923 -              then have "cball p e2 \<subseteq> s"
  61.924 -                using \<open>r>0\<close> unfolding e2_def by auto  
  61.925 -              then have "(\<lambda>w. of_nat zo * h w) holomorphic_on cball p e2" 
  61.926 -                using h_holo
  61.927 -                by (auto intro!: holomorphic_intros)
  61.928 -              then show "(prin has_contour_integral c * of_nat zo * h p ) (circlepath p e2)"
  61.929 -                using Cauchy_integral_circlepath_simple[folded c_def, of "\<lambda>w. of_nat zo * h w"]
  61.930 -                  \<open>e2>0\<close>
  61.931 -                unfolding prin_def
  61.932 -                by (auto simp add: mult.assoc)
  61.933 -              have "anal holomorphic_on ball p r" unfolding anal_def 
  61.934 -                using pp_holo h_holo pp_po \<open>ball p r \<subseteq> s\<close>
  61.935 -                by (auto intro!: holomorphic_intros)
  61.936 -              then show "(anal has_contour_integral 0) (circlepath p e2)"
  61.937 -                using e2_def \<open>r>0\<close>
  61.938 -                by (auto elim!: Cauchy_theorem_disc_simple)
  61.939 -            qed
  61.940 +          proof (rule  has_contour_integral_add[of _ _ _ _ 0,simplified])
  61.941 +            have "ball p r \<subseteq> s" 
  61.942 +              using \<open>cball p r \<subseteq> ball p e1\<close> avoid_def ball_subset_cball e by blast
  61.943 +            then have "cball p e2 \<subseteq> s"
  61.944 +              using \<open>r>0\<close> unfolding e2_def by auto  
  61.945 +            then have "(\<lambda>w. of_nat zo * h w) holomorphic_on cball p e2" 
  61.946 +              using h_holo
  61.947 +              by (auto intro!: holomorphic_intros)
  61.948 +            then show "(prin has_contour_integral c * of_nat zo * h p ) (circlepath p e2)"
  61.949 +              using Cauchy_integral_circlepath_simple[folded c_def, of "\<lambda>w. of_nat zo * h w"]
  61.950 +                \<open>e2>0\<close>
  61.951 +              unfolding prin_def
  61.952 +              by (auto simp add: mult.assoc)
  61.953 +            have "anal holomorphic_on ball p r" unfolding anal_def 
  61.954 +              using pp_holo h_holo pp_po \<open>ball p r \<subseteq> s\<close>
  61.955 +              by (auto intro!: holomorphic_intros)
  61.956 +            then show "(anal has_contour_integral 0) (circlepath p e2)"
  61.957 +              using e2_def \<open>r>0\<close>
  61.958 +              by (auto elim!: Cauchy_theorem_disc_simple)
  61.959 +          qed
  61.960            then have "cont_zero ff' p e2" unfolding cont_zero_def zo_def
  61.961 -            proof (elim has_contour_integral_eq)
  61.962 -              fix w assume "w \<in> path_image (circlepath p e2)" 
  61.963 -              then have "w\<in>ball p r" and "w\<noteq>p" unfolding e2_def using \<open>r>0\<close> by auto
  61.964 -              def wp\<equiv>"w-p"
  61.965 -              have "wp\<noteq>0" and "zp w \<noteq>0" 
  61.966 -                unfolding wp_def using \<open>w\<noteq>p\<close> \<open>w\<in>ball p r\<close> pp_po by auto 
  61.967 -              moreover have der_f':"deriv f' w = zo * zp w * (w-p)^(zo-1) + deriv zp w * (w-p)^zo" 
  61.968 -                proof (rule DERIV_imp_deriv)
  61.969 -                  def der\<equiv>"zo * zp w * (w-p)^(zo-1) + deriv zp w * (w-p)^zo"
  61.970 -                  have po:"zo = Suc (zo - Suc 0) " using \<open>zo>0\<close> by auto
  61.971 -                  have "(zp has_field_derivative (deriv zp w)) (at w)" 
  61.972 -                    using DERIV_deriv_iff_field_differentiable \<open>w\<in>ball p r\<close>
  61.973 -                          holomorphic_on_imp_differentiable_at[of _ "ball p r"] 
  61.974 -                          holomorphic_on_subset [OF pp_holo ball_subset_cball]
  61.975 -                    by (metis open_ball)
  61.976 -                  then show "(f' has_field_derivative  der) (at w)" 
  61.977 -                    using \<open>w\<noteq>p\<close> \<open>zo>0\<close> unfolding der_def f'_def
  61.978 -                    by (auto intro!: derivative_eq_intros simp add:field_simps)
  61.979 -                qed
  61.980 -              ultimately show "prin w + anal w = ff' w"
  61.981 -                unfolding ff'_def prin_def anal_def
  61.982 -                apply simp
  61.983 -                apply (unfold f'_def)
  61.984 -                apply (fold wp_def)
  61.985 -                apply (auto simp add:field_simps)
  61.986 -                by (metis Suc_diff_Suc minus_nat.diff_0 power_Suc)
  61.987 -            qed
  61.988 +          proof (elim has_contour_integral_eq)
  61.989 +            fix w assume "w \<in> path_image (circlepath p e2)" 
  61.990 +            then have "w\<in>ball p r" and "w\<noteq>p" unfolding e2_def using \<open>r>0\<close> by auto
  61.991 +            define wp where "wp = w-p"
  61.992 +            have "wp\<noteq>0" and "zp w \<noteq>0" 
  61.993 +              unfolding wp_def using \<open>w\<noteq>p\<close> \<open>w\<in>ball p r\<close> pp_po by auto 
  61.994 +            moreover have der_f':"deriv f' w = zo * zp w * (w-p)^(zo-1) + deriv zp w * (w-p)^zo" 
  61.995 +              proof (rule DERIV_imp_deriv)
  61.996 +                define der where "der = zo * zp w * (w-p)^(zo-1) + deriv zp w * (w-p)^zo"
  61.997 +                have po:"zo = Suc (zo - Suc 0) " using \<open>zo>0\<close> by auto
  61.998 +                have "(zp has_field_derivative (deriv zp w)) (at w)" 
  61.999 +                  using DERIV_deriv_iff_field_differentiable \<open>w\<in>ball p r\<close>
 61.1000 +                        holomorphic_on_imp_differentiable_at[of _ "ball p r"] 
 61.1001 +                        holomorphic_on_subset [OF pp_holo ball_subset_cball]
 61.1002 +                  by (metis open_ball)
 61.1003 +                then show "(f' has_field_derivative  der) (at w)" 
 61.1004 +                  using \<open>w\<noteq>p\<close> \<open>zo>0\<close> unfolding der_def f'_def
 61.1005 +                  by (auto intro!: derivative_eq_intros simp add:field_simps)
 61.1006 +              qed
 61.1007 +            ultimately show "prin w + anal w = ff' w"
 61.1008 +              unfolding ff'_def prin_def anal_def
 61.1009 +              apply simp
 61.1010 +              apply (unfold f'_def)
 61.1011 +              apply (fold wp_def)
 61.1012 +              apply (auto simp add:field_simps)
 61.1013 +              by (metis Suc_diff_Suc minus_nat.diff_0 power_Suc)
 61.1014 +          qed
 61.1015            then have "cont_zero ff p e2" unfolding cont_zero_def   
 61.1016              proof (elim has_contour_integral_eq)
 61.1017                fix w assume "w \<in> path_image (circlepath p e2)"
 61.1018 @@ -3181,7 +3189,7 @@
 61.1019          qed
 61.1020        then obtain e3 where e3:"p\<in>zeros \<longrightarrow> e3>0 \<and> cball p e3 \<subseteq> ball p e1 \<and> cont_zero ff p e3"
 61.1021          by auto          
 61.1022 -      def e4\<equiv>"if p\<in>poles then e2 else if p\<in>zeros then e3 else e1"
 61.1023 +      define e4 where "e4 = (if p\<in>poles then e2 else if p\<in>zeros then e3 else e1)"
 61.1024        have "e4>0" using e2 e3 \<open>e1>0\<close> unfolding e4_def by auto
 61.1025        moreover have "avoid p e4" using e2 e3 \<open>e1>0\<close> e unfolding e4_def avoid_def by auto
 61.1026        moreover have "p\<in>poles \<longrightarrow> cont_pole ff p e4" and "p\<in>zeros \<longrightarrow> cont_zero ff p e4" 
 61.1027 @@ -3191,19 +3199,19 @@
 61.1028    then obtain get_e where get_e:"\<forall>p\<in>s. get_e p>0 \<and> avoid p (get_e p) 
 61.1029        \<and> (p\<in>poles \<longrightarrow> cont_pole ff p (get_e p)) \<and> (p\<in>zeros \<longrightarrow> cont_zero ff p (get_e p))"
 61.1030      by metis
 61.1031 -  def cont\<equiv>"\<lambda>p. contour_integral (circlepath p (get_e p)) ff"
 61.1032 -  def w\<equiv>"\<lambda>p. winding_number g p"
 61.1033 +  define cont where "cont p = contour_integral (circlepath p (get_e p)) ff" for p
 61.1034 +  define w where "w p = winding_number g p" for p
 61.1035    have "contour_integral g ff = (\<Sum>p\<in>pts. w p * cont p)"
 61.1036      unfolding cont_def w_def
 61.1037 -    proof (rule Cauchy_theorem_singularities[OF \<open>open s\<close> connected finite _ \<open>valid_path g\<close> loop 
 61.1038 -        path_img homo])
 61.1039 -      have "open (s - pts)" using open_Diff[OF _ finite_imp_closed[OF finite]] \<open>open s\<close> by auto 
 61.1040 -      then show "ff holomorphic_on s - pts" unfolding ff_def using f_holo \<open>poles \<subseteq> pts\<close> h_holo
 61.1041 -        by (auto intro!: holomorphic_intros simp add:pts_def)
 61.1042 -    next
 61.1043 -      show "\<forall>p\<in>s. 0 < get_e p \<and> (\<forall>w\<in>cball p (get_e p). w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts))"
 61.1044 -        using get_e using avoid_def by blast
 61.1045 -    qed
 61.1046 +  proof (rule Cauchy_theorem_singularities[OF \<open>open s\<close> connected finite _ \<open>valid_path g\<close> loop 
 61.1047 +      path_img homo])
 61.1048 +    have "open (s - pts)" using open_Diff[OF _ finite_imp_closed[OF finite]] \<open>open s\<close> by auto 
 61.1049 +    then show "ff holomorphic_on s - pts" unfolding ff_def using f_holo \<open>poles \<subseteq> pts\<close> h_holo
 61.1050 +      by (auto intro!: holomorphic_intros simp add:pts_def)
 61.1051 +  next
 61.1052 +    show "\<forall>p\<in>s. 0 < get_e p \<and> (\<forall>w\<in>cball p (get_e p). w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts))"
 61.1053 +      using get_e using avoid_def by blast
 61.1054 +  qed
 61.1055    also have "... = (\<Sum>p\<in>zeros. w p * cont p) + (\<Sum>p\<in>poles. w p * cont p)"
 61.1056      using \<open>finite pts\<close> unfolding \<open>pts=zeros \<union> poles\<close>
 61.1057      apply (subst setsum.union_disjoint)
 61.1058 @@ -3309,9 +3317,9 @@
 61.1059          qed
 61.1060        then show ?thesis unfolding zeros_f_def using path_img by auto 
 61.1061      qed
 61.1062 -  def w\<equiv>"\<lambda>p. winding_number \<gamma> p"
 61.1063 -  def c\<equiv>"2 * complex_of_real pi * \<i>"
 61.1064 -  def h\<equiv>"\<lambda>p. g p / f p + 1" 
 61.1065 +  define w where "w p = winding_number \<gamma> p" for p
 61.1066 +  define c where "c = 2 * complex_of_real pi * \<i>"
 61.1067 +  define h where [abs_def]: "h p = g p / f p + 1"  for p
 61.1068    obtain spikes
 61.1069      where "finite spikes" and spikes: "\<forall>x\<in>{0..1} - spikes. \<gamma> differentiable at x"
 61.1070      using \<open>valid_path \<gamma>\<close>
 61.1071 @@ -3366,8 +3374,8 @@
 61.1072          proof (rule vector_derivative_chain_at_general)
 61.1073            show "\<gamma> differentiable at x" using that \<open>valid_path \<gamma>\<close> spikes by auto
 61.1074          next
 61.1075 -          def der\<equiv>"\<lambda>p. (deriv g p * f p - g p * deriv f p)/(f p * f p)"
 61.1076 -          def t\<equiv>"\<gamma> x"
 61.1077 +          define der where "der p = (deriv g p * f p - g p * deriv f p)/(f p * f p)" for p
 61.1078 +          define t where "t = \<gamma> x"
 61.1079            have "f t\<noteq>0" unfolding zeros_f_def t_def 
 61.1080              by (metis DiffD1 image_eqI norm_not_less_zero norm_zero path_defs(4) path_less that)
 61.1081            moreover have "t\<in>s" 
 61.1082 @@ -3412,29 +3420,29 @@
 61.1083            have "fg p\<noteq>0" and "f p\<noteq>0" using path_f path_fg that unfolding zeros_f_def zeros_fg_def
 61.1084              by auto
 61.1085            have "h p\<noteq>0" 
 61.1086 -            proof (rule ccontr)
 61.1087 -              assume "\<not> h p \<noteq> 0"
 61.1088 -              then have "g p / f p= -1" unfolding h_def by (simp add: add_eq_0_iff2)
 61.1089 -              then have "cmod (g p/f p) = 1" by auto
 61.1090 -              moreover have "cmod (g p/f p) <1" using path_less[rule_format,OF that] 
 61.1091 -                apply (cases "cmod (f p) = 0")
 61.1092 -                by (auto simp add: norm_divide)
 61.1093 -              ultimately show False by auto
 61.1094 -            qed
 61.1095 +          proof (rule ccontr)
 61.1096 +            assume "\<not> h p \<noteq> 0"
 61.1097 +            then have "g p / f p= -1" unfolding h_def by (simp add: add_eq_0_iff2)
 61.1098 +            then have "cmod (g p/f p) = 1" by auto
 61.1099 +            moreover have "cmod (g p/f p) <1" using path_less[rule_format,OF that] 
 61.1100 +              apply (cases "cmod (f p) = 0")
 61.1101 +              by (auto simp add: norm_divide)
 61.1102 +            ultimately show False by auto
 61.1103 +          qed
 61.1104            have der_fg:"deriv fg p =  deriv f p + deriv g p" unfolding fg_def
 61.1105              using f_holo g_holo holomorphic_on_imp_differentiable_at[OF _  \<open>open s\<close>] path_img that
 61.1106              by (auto intro!: deriv_add)
 61.1107            have der_h:"deriv h p = (deriv g p * f p - g p * deriv f p)/(f p * f p)"
 61.1108 -            proof -
 61.1109 -              def der\<equiv>"\<lambda>p. (deriv g p * f p - g p * deriv f p)/(f p * f p)"          
 61.1110 -              have "p\<in>s" using path_img that by auto
 61.1111 -              then have "(h has_field_derivative der p) (at p)"
 61.1112 -                unfolding h_def der_def using g_holo f_holo \<open>f p\<noteq>0\<close>
 61.1113 -                apply (auto intro!: derivative_eq_intros)
 61.1114 -                by (auto simp add: DERIV_deriv_iff_field_differentiable 
 61.1115 -                    holomorphic_on_imp_differentiable_at[OF _ \<open>open s\<close>])
 61.1116 -              then show ?thesis unfolding der_def using DERIV_imp_deriv by auto
 61.1117 -            qed
 61.1118 +          proof -
 61.1119 +            define der where "der p = (deriv g p * f p - g p * deriv f p)/(f p * f p)" for p
 61.1120 +            have "p\<in>s" using path_img that by auto
 61.1121 +            then have "(h has_field_derivative der p) (at p)"
 61.1122 +              unfolding h_def der_def using g_holo f_holo \<open>f p\<noteq>0\<close>
 61.1123 +              apply (auto intro!: derivative_eq_intros)
 61.1124 +              by (auto simp add: DERIV_deriv_iff_field_differentiable 
 61.1125 +                  holomorphic_on_imp_differentiable_at[OF _ \<open>open s\<close>])
 61.1126 +            then show ?thesis unfolding der_def using DERIV_imp_deriv by auto
 61.1127 +          qed
 61.1128            show ?thesis
 61.1129              apply (simp only:der_fg der_h)   
 61.1130              apply (auto simp add:field_simps \<open>h p\<noteq>0\<close> \<open>f p\<noteq>0\<close> \<open>fg p\<noteq>0\<close>)
    62.1 --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy	Sun Apr 24 21:31:14 2016 +0200
    62.2 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy	Mon Apr 25 16:09:26 2016 +0200
    62.3 @@ -105,7 +105,7 @@
    62.4  proof -
    62.5    {
    62.6      fix x :: "'n::euclidean_space"
    62.7 -    def y \<equiv> "(e / norm x) *\<^sub>R x"
    62.8 +    define y where "y = (e / norm x) *\<^sub>R x"
    62.9      then have "y \<in> cball 0 e"
   62.10        using assms by auto
   62.11      moreover have *: "x = (norm x / e) *\<^sub>R y"
   62.12 @@ -463,7 +463,7 @@
   62.13    fix s u
   62.14    assume as: "\<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V"
   62.15      "finite s" "s \<noteq> {}" "s \<subseteq> V" "setsum u s = (1::real)"
   62.16 -  def n \<equiv> "card s"
   62.17 +  define n where "n = card s"
   62.18    have "card s = 0 \<or> card s = 1 \<or> card s = 2 \<or> card s > 2" by auto
   62.19    then show "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V"
   62.20    proof (auto simp only: disjE)
   62.21 @@ -838,7 +838,7 @@
   62.22    assume "y = a + v" "v \<in> span {x - a |x. x \<in> s}"
   62.23    then obtain t u where obt: "finite t" "t \<subseteq> {x - a |x. x \<in> s}" "a + (\<Sum>v\<in>t. u v *\<^sub>R v) = y"
   62.24      unfolding span_explicit by auto
   62.25 -  def f \<equiv> "(\<lambda>x. x + a) ` t"
   62.26 +  define f where "f = (\<lambda>x. x + a) ` t"
   62.27    have f: "finite f" "f \<subseteq> s" "(\<Sum>v\<in>f. u (v - a) *\<^sub>R (v - a)) = y - a"
   62.28      unfolding f_def using obt by (auto simp add: setsum.reindex[unfolded inj_on_def])
   62.29    have *: "f \<inter> {a} = {}" "f \<inter> - {a} = f"
   62.30 @@ -989,7 +989,7 @@
   62.31      {
   62.32        fix x y
   62.33        assume xy: "x \<in> S" "y \<in> S"
   62.34 -      def u == "(1 :: real)/2"
   62.35 +      define u where "u = (1 :: real)/2"
   62.36        have "(1/2) *\<^sub>R (x+y) = (1/2) *\<^sub>R (x+y)"
   62.37          by auto
   62.38        moreover
   62.39 @@ -1370,7 +1370,7 @@
   62.40    moreover
   62.41    assume "A \<inter> s \<noteq> {}" "B \<inter> s \<noteq> {}"
   62.42    then obtain a b where a: "a \<in> A" "a \<in> s" and b: "b \<in> B" "b \<in> s" by auto
   62.43 -  def f \<equiv> "\<lambda>u. u *\<^sub>R a + (1 - u) *\<^sub>R b"
   62.44 +  define f where [abs_def]: "f u = u *\<^sub>R a + (1 - u) *\<^sub>R b" for u
   62.45    then have "continuous_on {0 .. 1} f"
   62.46      by (auto intro!: continuous_intros)
   62.47    then have "connected (f ` {0 .. 1})"
   62.48 @@ -1802,7 +1802,7 @@
   62.49          using uv(1) x(1)[THEN bspec[where x=i]] by auto
   62.50      next
   62.51        case False
   62.52 -      def j \<equiv> "i - k1"
   62.53 +      define j where "j = i - k1"
   62.54        from i False have "j \<in> {1..k2}"
   62.55          unfolding j_def by auto
   62.56        then show ?thesis
   62.57 @@ -2149,7 +2149,7 @@
   62.58    from assms(1)[unfolded dependent_explicit] obtain S u v
   62.59      where obt: "finite S" "S \<subseteq> {x - a |x. x \<in> s}" "v\<in>S" "u v  \<noteq> 0" "(\<Sum>v\<in>S. u v *\<^sub>R v) = 0"
   62.60      by auto
   62.61 -  def t \<equiv> "(\<lambda>x. x + a) ` S"
   62.62 +  define t where "t = (\<lambda>x. x + a) ` S"
   62.63  
   62.64    have inj: "inj_on (\<lambda>x. x + a) S"
   62.65      unfolding inj_on_def by auto
   62.66 @@ -2469,7 +2469,7 @@
   62.67      "(\<lambda>x. -a+x) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (\<lambda>x. -a+x) ` V \<and> independent B \<and> (\<lambda>x. -a+x) ` V \<subseteq> span B"
   62.68       using maximal_independent_subset_extend[of "(\<lambda>x. -a+x) ` (S-{a})" "(\<lambda>x. -a + x) ` V"] assms
   62.69       by blast
   62.70 -  def T \<equiv> "(\<lambda>x. a+x) ` insert 0 B"
   62.71 +  define T where "T = (\<lambda>x. a+x) ` insert 0 B"
   62.72    then have "T = insert a ((\<lambda>x. a+x) ` B)"
   62.73      by auto
   62.74    then have "affine hull T = (\<lambda>x. a+x) ` span B"
   62.75 @@ -2601,7 +2601,7 @@
   62.76      using assms B affine_hull_nonempty[of V] affine_hull_nonempty[of B]
   62.77      by auto
   62.78    then obtain a where a: "a \<in> B" by auto
   62.79 -  def Lb \<equiv> "span ((\<lambda>x. -a+x) ` (B-{a}))"
   62.80 +  define Lb where "Lb = span ((\<lambda>x. -a+x) ` (B-{a}))"
   62.81    moreover have "affine_parallel (affine hull B) Lb"
   62.82      using Lb_def B assms affine_hull_span2[of a B] a
   62.83        affine_parallel_commut[of "Lb" "(affine hull B)"]
   62.84 @@ -2765,7 +2765,7 @@
   62.85  next
   62.86    case False
   62.87    then obtain a where a: "a \<in> B" by auto
   62.88 -  def Lb \<equiv> "span ((\<lambda>x. -a+x) ` (B-{a}))"
   62.89 +  define Lb where "Lb = span ((\<lambda>x. -a+x) ` (B-{a}))"
   62.90    have "affine_parallel (affine hull B) Lb"
   62.91      using Lb_def affine_hull_span2[of a B] a
   62.92        affine_parallel_commut[of "Lb" "(affine hull B)"]
   62.93 @@ -3002,13 +3002,13 @@
   62.94  proof -
   62.95    obtain a where "a \<in> S" using assms by auto
   62.96    then have "a \<in> T" using assms by auto
   62.97 -  def LS \<equiv> "{y. \<exists>x \<in> S. (-a) + x = y}"
   62.98 +  define LS where "LS = {y. \<exists>x \<in> S. (-a) + x = y}"
   62.99    then have ls: "subspace LS" "affine_parallel S LS"
  62.100      using assms parallel_subspace_explicit[of S a LS] \<open>a \<in> S\<close> by auto
  62.101    then have h1: "int(dim LS) = aff_dim S"
  62.102      using assms aff_dim_affine[of S LS] by auto
  62.103    have "T \<noteq> {}" using assms by auto
  62.104 -  def LT \<equiv> "{y. \<exists>x \<in> T. (-a) + x = y}"
  62.105 +  define LT where "LT = {y. \<exists>x \<in> T. (-a) + x = y}"
  62.106    then have lt: "subspace LT \<and> affine_parallel T LT"
  62.107      using assms parallel_subspace_explicit[of T a LT] \<open>a \<in> T\<close> by auto
  62.108    then have "int(dim LT) = aff_dim T"
  62.109 @@ -3062,7 +3062,7 @@
  62.110             where a1 [simp]: "setsum a t = 1" and [simp]: "setsum (\<lambda>v. a v *\<^sub>R v) t = y"
  62.111               and [simp]: "setsum b u = 1" "setsum (\<lambda>v. b v *\<^sub>R v) u = y"
  62.112        by (auto simp: affine_hull_finite \<open>finite t\<close> \<open>finite u\<close>)
  62.113 -    def c \<equiv> "\<lambda>x. if x \<in> t then a x else if x \<in> u then -(b x) else 0"
  62.114 +    define c where "c x = (if x \<in> t then a x else if x \<in> u then -(b x) else 0)" for x
  62.115      have [simp]: "s \<inter> t = t" "s \<inter> - t \<inter> u = u" using assms by auto
  62.116      have "setsum c s = 0"
  62.117        by (simp add: c_def comm_monoid_add_class.setsum.If_cases \<open>finite s\<close> setsum_negf)
  62.118 @@ -3172,8 +3172,8 @@
  62.119        by blast
  62.120      then obtain w v where wv: "setsum w s = 0" "v\<in>s" "w v \<noteq> 0" "(\<Sum>v\<in>s. w v *\<^sub>R v) = 0"
  62.121        using affine_dependent_explicit_finite[OF obt(1)] by auto
  62.122 -    def i \<equiv> "(\<lambda>v. (u v) / (- w v)) ` {v\<in>s. w v < 0}"
  62.123 -    def t \<equiv> "Min i"
  62.124 +    define i where "i = (\<lambda>v. (u v) / (- w v)) ` {v\<in>s. w v < 0}"
  62.125 +    define t where "t = Min i"
  62.126      have "\<exists>x\<in>s. w x < 0"
  62.127      proof (rule ccontr, simp add: not_less)
  62.128        assume as:"\<forall>x\<in>s. 0 \<le> w x"
  62.129 @@ -3428,7 +3428,7 @@
  62.130    {
  62.131      fix x
  62.132      assume x: "x \<in> affine hull S"
  62.133 -    def e \<equiv> "1::real"
  62.134 +    define e :: real where "e = 1"
  62.135      then have "e > 0" "ball x e \<inter> affine hull (affine hull S) \<subseteq> affine hull S"
  62.136        using hull_hull[of _ S] by auto
  62.137      then have "x \<in> rel_interior (affine hull S)"
  62.138 @@ -3727,7 +3727,7 @@
  62.139    qed
  62.140    then obtain y where "y \<in> S" and y: "norm (y - x) * (1 - e) < e * d"
  62.141      by auto
  62.142 -  def z \<equiv> "c + ((1 - e) / e) *\<^sub>R (x - y)"
  62.143 +  define z where "z = c + ((1 - e) / e) *\<^sub>R (x - y)"
  62.144    have *: "x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)"
  62.145      unfolding z_def using \<open>e > 0\<close>
  62.146      by (auto simp add: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib)
  62.147 @@ -3846,10 +3846,10 @@
  62.148        using z rel_interior_cball[of "f ` S"] by auto
  62.149      obtain K where K: "K > 0" "\<And>x. norm (f x) \<le> norm x * K"
  62.150       using assms Real_Vector_Spaces.bounded_linear.pos_bounded[of f] by auto
  62.151 -    def e1 \<equiv> "1 / K"
  62.152 +    define e1 where "e1 = 1 / K"
  62.153      then have e1: "e1 > 0" "\<And>x. e1 * norm (f x) \<le> norm x"
  62.154        using K pos_le_divide_eq[of e1] by auto
  62.155 -    def e \<equiv> "e1 * e2"
  62.156 +    define e where "e = e1 * e2"
  62.157      then have "e > 0" using e1 e2 by auto
  62.158      {
  62.159        fix y
  62.160 @@ -3892,7 +3892,7 @@
  62.161        using assms injective_imp_isometric[of "span S" f]
  62.162          subspace_span[of S] closed_subspace[of "span S"]
  62.163        by auto
  62.164 -    def e \<equiv> "e1 * e2"
  62.165 +    define e where "e = e1 * e2"
  62.166      hence "e > 0" using e1 e2 by auto
  62.167      {
  62.168        fix y
  62.169 @@ -3969,7 +3969,7 @@
  62.170      using bchoice[of s "\<lambda>x e. e > 0 \<and> cball x e \<subseteq> s"] by auto
  62.171    have "b ` t \<noteq> {}"
  62.172      using obt by auto
  62.173 -  def i \<equiv> "b ` t"
  62.174 +  define i where "i = b ` t"
  62.175  
  62.176    show "\<exists>e > 0.
  62.177      cball a e \<subseteq> {y. \<exists>sa u. finite sa \<and> sa \<subseteq> s \<and> (\<forall>x\<in>sa. 0 \<le> u x) \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = y}"
  62.178 @@ -4726,7 +4726,7 @@
  62.179      apply (erule_tac x="x - y" in ballE)
  62.180      apply (auto simp add: inner_diff)
  62.181      done
  62.182 -  def k \<equiv> "SUP x:t. a \<bullet> x"
  62.183 +  define k where "k = (SUP x:t. a \<bullet> x)"
  62.184    show ?thesis
  62.185      apply (rule_tac x="-a" in exI)
  62.186      apply (rule_tac x="-(k + b / 2)" in exI)
  62.187 @@ -5064,7 +5064,7 @@
  62.188      using radon_ex_lemma[OF assms] by auto
  62.189    have fin: "finite {x \<in> c. 0 < u x}" "finite {x \<in> c. 0 > u x}"
  62.190      using assms(1) by auto
  62.191 -  def z \<equiv> "inverse (setsum u {x\<in>c. u x > 0}) *\<^sub>R setsum (\<lambda>x. u x *\<^sub>R x) {x\<in>c. u x > 0}"
  62.192 +  define z  where "z = inverse (setsum u {x\<in>c. u x > 0}) *\<^sub>R setsum (\<lambda>x. u x *\<^sub>R x) {x\<in>c. u x > 0}"
  62.193    have "setsum u {x \<in> c. 0 < u x} \<noteq> 0"
  62.194    proof (cases "u v \<ge> 0")
  62.195      case False
  62.196 @@ -5356,7 +5356,7 @@
  62.197      using compact_imp_closed[OF assms(1)]
  62.198      apply simp
  62.199      done
  62.200 -  def pi \<equiv> "\<lambda>x::'a. inverse (norm x) *\<^sub>R x"
  62.201 +  define pi where [abs_def]: "pi x = inverse (norm x) *\<^sub>R x" for x :: 'a
  62.202    have "0 \<notin> frontier s"
  62.203      unfolding frontier_straddle
  62.204      apply (rule notI)
  62.205 @@ -5373,7 +5373,7 @@
  62.206      apply (intro continuous_intros)
  62.207      apply simp
  62.208      done
  62.209 -  def sphere \<equiv> "{x::'a. norm x = 1}"
  62.210 +  define sphere :: "'a set" where "sphere = {x. norm x = 1}"
  62.211    have pi: "\<And>x. x \<noteq> 0 \<Longrightarrow> pi x \<in> sphere" "\<And>x u. u>0 \<Longrightarrow> pi (u *\<^sub>R x) = pi x"
  62.212      unfolding pi_def sphere_def by auto
  62.213  
  62.214 @@ -6292,7 +6292,7 @@
  62.215  proof (rule,rule,rule)
  62.216    fix x and e :: real
  62.217    assume "x \<in> s" "e > 0"
  62.218 -  def B \<equiv> "\<bar>b\<bar> + 1"
  62.219 +  define B where "B = \<bar>b\<bar> + 1"
  62.220    have B: "0 < B" "\<And>x. x\<in>s \<Longrightarrow> \<bar>f x\<bar> \<le> B"
  62.221      unfolding B_def
  62.222      defer
  62.223 @@ -6312,7 +6312,7 @@
  62.224      show "\<bar>f y - f x\<bar> < e"
  62.225      proof (cases "y = x")
  62.226        case False
  62.227 -      def t \<equiv> "k / norm (y - x)"
  62.228 +      define t where "t = k / norm (y - x)"
  62.229        have "2 < t" "0<t"
  62.230          unfolding t_def using as False and \<open>k>0\<close>
  62.231          by (auto simp add:field_simps)
  62.232 @@ -6323,7 +6323,7 @@
  62.233          using as
  62.234          by (auto simp add: field_simps norm_minus_commute)
  62.235        {
  62.236 -        def w \<equiv> "x + t *\<^sub>R (y - x)"
  62.237 +        define w where "w = x + t *\<^sub>R (y - x)"
  62.238          have "w \<in> s"
  62.239            unfolding w_def
  62.240            apply (rule k[unfolded subset_eq,rule_format])
  62.241 @@ -6356,7 +6356,7 @@
  62.242        }
  62.243        moreover
  62.244        {
  62.245 -        def w \<equiv> "x - t *\<^sub>R (y - x)"
  62.246 +        define w where "w = x - t *\<^sub>R (y - x)"
  62.247          have "w \<in> s"
  62.248            unfolding w_def
  62.249            apply (rule k[unfolded subset_eq,rule_format])
  62.250 @@ -6408,7 +6408,7 @@
  62.251    case True
  62.252    fix y
  62.253    assume y: "y \<in> cball x e"
  62.254 -  def z \<equiv> "2 *\<^sub>R x - y"
  62.255 +  define z where "z = 2 *\<^sub>R x - y"
  62.256    have *: "x - (2 *\<^sub>R x - y) = y - x"
  62.257      by (simp add: scaleR_2)
  62.258    have z: "z \<in> cball x e"
  62.259 @@ -6445,7 +6445,7 @@
  62.260    assume "x \<in> s"
  62.261    then obtain e where e: "cball x e \<subseteq> s" "e > 0"
  62.262      using assms(1) unfolding open_contains_cball by auto
  62.263 -  def d \<equiv> "e / real DIM('a)"
  62.264 +  define d where "d = e / real DIM('a)"
  62.265    have "0 < d"
  62.266      unfolding d_def using \<open>e > 0\<close> dimge1 by auto
  62.267    let ?d = "(\<Sum>i\<in>Basis. d *\<^sub>R i)::'a"
  62.268 @@ -6454,7 +6454,7 @@
  62.269      and c1: "convex hull c \<subseteq> cball x e"
  62.270      and c2: "cball x d \<subseteq> convex hull c"
  62.271    proof
  62.272 -    def c \<equiv> "\<Sum>i\<in>Basis. (\<lambda>a. a *\<^sub>R i) ` {x\<bullet>i - d, x\<bullet>i + d}"
  62.273 +    define c where "c = (\<Sum>i\<in>Basis. (\<lambda>a. a *\<^sub>R i) ` {x\<bullet>i - d, x\<bullet>i + d})"
  62.274      show "finite c"
  62.275        unfolding c_def by (simp add: finite_set_setsum)
  62.276      have 1: "convex hull c = {a. \<forall>i\<in>Basis. a \<bullet> i \<in> cbox (x \<bullet> i - d) (x \<bullet> i + d)}"
  62.277 @@ -6490,7 +6490,7 @@
  62.278        apply simp
  62.279        done
  62.280    qed
  62.281 -  def k \<equiv> "Max (f ` c)"
  62.282 +  define k where "k = Max (f ` c)"
  62.283    have "convex_on (convex hull c) f"
  62.284      apply(rule convex_on_subset[OF assms(2)])
  62.285      apply(rule subset_trans[OF _ e(1)])
  62.286 @@ -7302,7 +7302,7 @@
  62.287    qed
  62.288    then obtain y where "y \<in> s" and y: "norm (y - x) * (1 - e) < e * d"
  62.289      by auto
  62.290 -  def z \<equiv> "c + ((1 - e) / e) *\<^sub>R (x - y)"
  62.291 +  define z where "z = c + ((1 - e) / e) *\<^sub>R (x - y)"
  62.292    have *: "x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)"
  62.293      unfolding z_def using \<open>e > 0\<close>
  62.294      by (auto simp add: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib)
  62.295 @@ -7908,7 +7908,7 @@
  62.296           {
  62.297             fix e :: real
  62.298             assume "e > 0"
  62.299 -           def e1 \<equiv> "min 1 (e/norm (x - a))"
  62.300 +           define e1 where "e1 = min 1 (e/norm (x - a))"
  62.301             then have e1: "e1 > 0" "e1 \<le> 1" "e1 * norm (x - a) \<le> e"
  62.302               using \<open>x \<noteq> a\<close> \<open>e > 0\<close> le_divide_eq[of e1 e "norm (x - a)"]
  62.303               by simp_all
  62.304 @@ -7973,7 +7973,7 @@
  62.305    assumes "0 < a" "0 < b" "(a + b) *\<^sub>R z = a *\<^sub>R x + b *\<^sub>R y"
  62.306    obtains e where "0 < e" "e \<le> 1" "z = y - e *\<^sub>R (y - x)"
  62.307  proof -
  62.308 -  def e \<equiv> "a / (a + b)"
  62.309 +  define e where "e = a / (a + b)"
  62.310    have "z = (1 / (a + b)) *\<^sub>R ((a + b) *\<^sub>R z)"
  62.311      apply auto
  62.312      using assms
  62.313 @@ -8023,7 +8023,7 @@
  62.314        obtain e where e: "e > 0" "cball z e \<inter> affine hull closure S \<le> closure S"
  62.315          using z rel_interior_cball[of "closure S"] by auto
  62.316        hence *: "0 < e/norm(z-x)" using e False by auto
  62.317 -      def y \<equiv> "z + (e/norm(z-x)) *\<^sub>R (z-x)"
  62.318 +      define y where "y = z + (e/norm(z-x)) *\<^sub>R (z-x)"
  62.319        have yball: "y \<in> cball z e"
  62.320          using mem_cball y_def dist_norm[of z y] e by auto
  62.321        have "x \<in> affine hull closure S"
  62.322 @@ -8239,7 +8239,7 @@
  62.323      assume x: "x \<in> affine hull S"
  62.324      {
  62.325        assume "x \<noteq> z"
  62.326 -      def m \<equiv> "1 + e1/norm(x-z)"
  62.327 +      define m where "m = 1 + e1/norm(x-z)"
  62.328        hence "m > 1" using e1 \<open>x \<noteq> z\<close> by auto
  62.329        {
  62.330          fix e
  62.331 @@ -8274,7 +8274,7 @@
  62.332      moreover
  62.333      {
  62.334        assume "x = z"
  62.335 -      def m \<equiv> "1 + e1"
  62.336 +      define m where "m = 1 + e1"
  62.337        then have "m > 1"
  62.338          using e1 by auto
  62.339        {
  62.340 @@ -8314,9 +8314,9 @@
  62.341      using rel_interior_subset by auto
  62.342    then obtain e where e: "e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
  62.343      using assms by auto
  62.344 -  def y \<equiv> "(1 - e) *\<^sub>R x + e *\<^sub>R z"
  62.345 +  define y where [abs_def]: "y = (1 - e) *\<^sub>R x + e *\<^sub>R z"
  62.346    then have "y \<in> S" using e by auto
  62.347 -  def e1 \<equiv> "1/e"
  62.348 +  define e1 where "e1 = 1/e"
  62.349    then have "0 < e1 \<and> e1 < 1" using e by auto
  62.350    then have "z  =y - (1 - e1) *\<^sub>R (y - x)"
  62.351      using e1_def y_def by (auto simp add: algebra_simps)
  62.352 @@ -8362,10 +8362,10 @@
  62.353          using r by auto
  62.354        obtain e2 where e2: "e2 > 0 \<and> z + e2 *\<^sub>R (z - x) \<in> S"
  62.355          using r by auto
  62.356 -      def x1 \<equiv> "z + e1 *\<^sub>R (x - z)"
  62.357 +      define x1 where [abs_def]: "x1 = z + e1 *\<^sub>R (x - z)"
  62.358        then have x1: "x1 \<in> affine hull S"
  62.359          using e1 hull_subset[of S] by auto
  62.360 -      def x2 \<equiv> "z + e2 *\<^sub>R (z - x)"
  62.361 +      define x2 where [abs_def]: "x2 = z + e2 *\<^sub>R (z - x)"
  62.362        then have x2: "x2 \<in> affine hull S"
  62.363          using e2 hull_subset[of S] by auto
  62.364        have *: "e1/(e1+e2) + e2/(e1+e2) = 1"
  62.365 @@ -8412,7 +8412,7 @@
  62.366      fix x
  62.367      obtain e1 where e1: "e1 > 1" "(1 - e1) *\<^sub>R (z - x) + e1 *\<^sub>R z \<in> S"
  62.368        using **[rule_format, of "z-x"] by auto
  62.369 -    def e \<equiv> "e1 - 1"
  62.370 +    define e where [abs_def]: "e = e1 - 1"
  62.371      then have "(1 - e1) *\<^sub>R (z - x) + e1 *\<^sub>R z = z + e *\<^sub>R x"
  62.372        by (simp add: algebra_simps)
  62.373      then have "e > 0" "z + e *\<^sub>R x \<in> S"
  62.374 @@ -8427,7 +8427,7 @@
  62.375        fix x
  62.376        obtain e1 where e1: "e1 > 0" "z + e1 *\<^sub>R (z - x) \<in> S"
  62.377          using r[rule_format, of "z-x"] by auto
  62.378 -      def e \<equiv> "e1 + 1"
  62.379 +      define e where "e = e1 + 1"
  62.380        then have "z + e1 *\<^sub>R (z - x) = (1 - e) *\<^sub>R x + e *\<^sub>R z"
  62.381          by (simp add: algebra_simps)
  62.382        then have "e > 1" "(1 - e)*\<^sub>R x + e *\<^sub>R z \<in> S"
  62.383 @@ -8508,11 +8508,11 @@
  62.384        assume "y \<noteq> x"
  62.385        { fix e :: real
  62.386          assume e: "e > 0"
  62.387 -        def e1 \<equiv> "min 1 (e/norm (y - x))"
  62.388 +        define e1 where "e1 = min 1 (e/norm (y - x))"
  62.389          then have e1: "e1 > 0" "e1 \<le> 1" "e1 * norm (y - x) \<le> e"
  62.390            using \<open>y \<noteq> x\<close> \<open>e > 0\<close> le_divide_eq[of e1 e "norm (y - x)"]
  62.391            by simp_all
  62.392 -        def z \<equiv> "y - e1 *\<^sub>R (y - x)"
  62.393 +        define z where "z = y - e1 *\<^sub>R (y - x)"
  62.394          {
  62.395            fix S
  62.396            assume "S \<in> I"
  62.397 @@ -8624,7 +8624,7 @@
  62.398          }
  62.399          then obtain mS where
  62.400            mS: "\<forall>S\<in>I. mS S > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> mS S \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)" by metis
  62.401 -        def e \<equiv> "Min (mS ` I)"
  62.402 +        define e where "e = Min (mS ` I)"
  62.403          then have "e \<in> mS ` I" using assms \<open>I \<noteq> {}\<close> by simp
  62.404          then have "e > 1" using mS by auto
  62.405          moreover have "\<forall>S\<in>I. e \<le> mS S"
  62.406 @@ -9112,7 +9112,7 @@
  62.407    have conv: "convex ({(1 :: real)} \<times> S)"
  62.408      using convex_Times[of "{(1 :: real)}" S] assms convex_singleton[of "1 :: real"]
  62.409      by auto
  62.410 -  def f \<equiv> "\<lambda>y. {z. (y, z) \<in> cone hull ({1 :: real} \<times> S)}"
  62.411 +  define f where "f y = {z. (y, z) \<in> cone hull ({1 :: real} \<times> S)}" for y
  62.412    then have *: "(c, x) \<in> rel_interior (cone hull ({(1 :: real)} \<times> S)) =
  62.413      (c \<in> rel_interior {y. f y \<noteq> {}} \<and> x \<in> rel_interior (f c))"
  62.414      apply (subst rel_interior_projection[of "cone hull ({(1 :: real)} \<times> S)" f c x])
  62.415 @@ -9210,11 +9210,11 @@
  62.416      {
  62.417        fix x
  62.418        assume "x \<in> S i"
  62.419 -      def c \<equiv> "\<lambda>j. if j = i then 1::real else 0"
  62.420 +      define c where "c j = (if j = i then 1::real else 0)" for j
  62.421        then have *: "setsum c I = 1"
  62.422          using \<open>finite I\<close> \<open>i \<in> I\<close> setsum.delta[of I i "\<lambda>j::'a. 1::real"]
  62.423          by auto
  62.424 -      def s \<equiv> "\<lambda>j. if j = i then x else p j"
  62.425 +      define s where "s j = (if j = i then x else p j)" for j
  62.426        then have "\<forall>j. c j *\<^sub>R s j = (if j = i then x else 0)"
  62.427          using c_def by (auto simp add: algebra_simps)
  62.428        then have "x = setsum (\<lambda>i. c i *\<^sub>R s i) I"
  62.429 @@ -9243,7 +9243,7 @@
  62.430      from xy obtain d t where
  62.431        yc: "y = setsum (\<lambda>i. d i *\<^sub>R t i) I \<and> (\<forall>i\<in>I. d i \<ge> 0) \<and> setsum d I = 1 \<and> (\<forall>i\<in>I. t i \<in> S i)"
  62.432        by auto
  62.433 -    def e \<equiv> "\<lambda>i. u * c i + v * d i"
  62.434 +    define e where "e i = u * c i + v * d i" for i
  62.435      have ge0: "\<forall>i\<in>I. e i \<ge> 0"
  62.436        using e_def xc yc uv by simp
  62.437      have "setsum (\<lambda>i. u * c i) I = u * setsum c I"
  62.438 @@ -9252,7 +9252,8 @@
  62.439        by (simp add: setsum_right_distrib)
  62.440      ultimately have sum1: "setsum e I = 1"
  62.441        using e_def xc yc uv by (simp add: setsum.distrib)
  62.442 -    def q \<equiv> "\<lambda>i. if e i = 0 then p i else (u * c i / e i) *\<^sub>R s i + (v * d i / e i) *\<^sub>R t i"
  62.443 +    define q where "q i = (if e i = 0 then p i else (u * c i / e i) *\<^sub>R s i + (v * d i / e i) *\<^sub>R t i)"
  62.444 +      for i
  62.445      {
  62.446        fix i
  62.447        assume i: "i \<in> I"
  62.448 @@ -9318,8 +9319,8 @@
  62.449      {u *\<^sub>R s + v *\<^sub>R t | u v s t. u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}"
  62.450    (is "?lhs = ?rhs")
  62.451  proof
  62.452 -  def I \<equiv> "{1::nat, 2}"
  62.453 -  def s \<equiv> "\<lambda>i. if i = (1::nat) then S else T"
  62.454 +  define I :: "nat set" where "I = {1, 2}"
  62.455 +  define s where "s i = (if i = (1::nat) then S else T)" for i
  62.456    have "\<Union>(s ` I) = S \<union> T"
  62.457      using s_def I_def by auto
  62.458    then have "convex hull (\<Union>(s ` I)) = convex hull (S \<union> T)"
  62.459 @@ -9414,7 +9415,7 @@
  62.460      then obtain c xs where
  62.461        x: "x = setsum (\<lambda>i. c i *\<^sub>R xs i) I \<and> (\<forall>i\<in>I. c i \<ge> 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. xs i \<in> S i)"
  62.462        using convex_hull_finite_union[of I S] assms by auto
  62.463 -    def s \<equiv> "\<lambda>i. c i *\<^sub>R xs i"
  62.464 +    define s where "s i = c i *\<^sub>R xs i" for i
  62.465      {
  62.466        fix i
  62.467        assume "i \<in> I"
  62.468 @@ -9432,7 +9433,7 @@
  62.469      assume "x \<in> ?rhs"
  62.470      then obtain s where x: "x = setsum s I \<and> (\<forall>i\<in>I. s i \<in> S i)"
  62.471        using set_setsum_alt[of I S] assms by auto
  62.472 -    def xs \<equiv> "\<lambda>i. of_nat(card I) *\<^sub>R s i"
  62.473 +    define xs where "xs i = of_nat(card I) *\<^sub>R s i" for i
  62.474      then have "x = setsum (\<lambda>i. ((1 :: real) / of_nat(card I)) *\<^sub>R xs i) I"
  62.475        using x assms by auto
  62.476      moreover have "\<forall>i\<in>I. xs i \<in> S i"
  62.477 @@ -9465,8 +9466,8 @@
  62.478      and "T \<noteq> {}"
  62.479    shows "convex hull (S \<union> T) = S + T"
  62.480  proof -
  62.481 -  def I \<equiv> "{1::nat, 2}"
  62.482 -  def A \<equiv> "(\<lambda>i. if i = (1::nat) then S else T)"
  62.483 +  define I :: "nat set" where "I = {1, 2}"
  62.484 +  define A where "A i = (if i = (1::nat) then S else T)" for i
  62.485    have "\<Union>(A ` I) = S \<union> T"
  62.486      using A_def I_def by auto
  62.487    then have "convex hull (\<Union>(A ` I)) = convex hull (S \<union> T)"
  62.488 @@ -9500,11 +9501,11 @@
  62.489      using convex_hull_empty rel_interior_empty by auto
  62.490  next
  62.491    case False
  62.492 -  def C0 \<equiv> "convex hull (\<Union>(S ` I))"
  62.493 +  define C0 where "C0 = convex hull (\<Union>(S ` I))"
  62.494    have "\<forall>i\<in>I. C0 \<ge> S i"
  62.495      unfolding C0_def using hull_subset[of "\<Union>(S ` I)"] by auto
  62.496 -  def K0 \<equiv> "cone hull ({1 :: real} \<times> C0)"
  62.497 -  def K \<equiv> "\<lambda>i. cone hull ({1 :: real} \<times> S i)"
  62.498 +  define K0 where "K0 = cone hull ({1 :: real} \<times> C0)"
  62.499 +  define K where "K i = cone hull ({1 :: real} \<times> S i)" for i
  62.500    have "\<forall>i\<in>I. K i \<noteq> {}"
  62.501      unfolding K_def using assms
  62.502      by (simp add: cone_hull_empty_iff[symmetric])
  62.503 @@ -9619,7 +9620,7 @@
  62.504      then obtain c s where cs: "x = setsum (\<lambda>i. c i *\<^sub>R s i) I \<and>
  62.505          (\<forall>i\<in>I. c i > 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> rel_interior (S i))"
  62.506        by auto
  62.507 -    def k \<equiv> "\<lambda>i. (c i, c i *\<^sub>R s i)"
  62.508 +    define k where "k i = (c i, c i *\<^sub>R s i)" for i
  62.509      {
  62.510        fix i assume "i:I"
  62.511        then have "k i \<in> rel_interior (K i)"
  62.512 @@ -9653,7 +9654,7 @@
  62.513    have "open (interior I)" by auto
  62.514    from openE[OF this \<open>x \<in> interior I\<close>]
  62.515    obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
  62.516 -  moreover def t \<equiv> "min (x + e / 2) ((x + y) / 2)"
  62.517 +  moreover define t where "t = min (x + e / 2) ((x + y) / 2)"
  62.518    ultimately have "x < t" "t < y" "t \<in> ball x e"
  62.519      by (auto simp: dist_real_def field_simps split: split_min)
  62.520    with \<open>x \<in> interior I\<close> e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
  62.521 @@ -9661,7 +9662,7 @@
  62.522    have "open (interior I)" by auto
  62.523    from openE[OF this \<open>x \<in> interior I\<close>]
  62.524    obtain e where "0 < e" "ball x e \<subseteq> interior I" .
  62.525 -  moreover def K \<equiv> "x - e / 2"
  62.526 +  moreover define K where "K = x - e / 2"
  62.527    with \<open>0 < e\<close> have "K \<in> ball x e" "K < x"
  62.528      by (auto simp: dist_real_def)
  62.529    ultimately have "K \<in> I" "K < x" "x \<in> I"
  62.530 @@ -9688,7 +9689,7 @@
  62.531    have "open (interior I)" by auto
  62.532    from openE[OF this \<open>x \<in> interior I\<close>]
  62.533    obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
  62.534 -  moreover def t \<equiv> "x + e / 2"
  62.535 +  moreover define t where "t = x + e / 2"
  62.536    ultimately have "x < t" "t \<in> ball x e"
  62.537      by (auto simp: dist_real_def field_simps)
  62.538    with \<open>x \<in> interior I\<close> e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
  62.539 @@ -10767,7 +10768,7 @@
  62.540        by blast
  62.541    next
  62.542      case False
  62.543 -    def k \<equiv> "min (1/2) (e / norm (x-a))"
  62.544 +    define k where "k = min (1/2) (e / norm (x-a))"
  62.545      have k: "0 < k" "k < 1"
  62.546        using \<open>e > 0\<close> False by (auto simp: k_def)
  62.547      then have xa: "(x-a) = inverse k *\<^sub>R k *\<^sub>R (x-a)"
  62.548 @@ -11233,7 +11234,7 @@
  62.549    assumes "convex S" "S \<noteq> {}" "0 \<notin> S"
  62.550    obtains a where "a \<in> span S" "a \<noteq> 0" "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> a \<bullet> x"
  62.551  proof -
  62.552 -  def k \<equiv> "\<lambda>c::'a. {x. 0 \<le> c \<bullet> x}"
  62.553 +  define k where [abs_def]: "k c = {x. 0 \<le> c \<bullet> x}" for c :: 'a
  62.554    have *: "span S \<inter> frontier (cball 0 1) \<inter> \<Inter>f' \<noteq> {}"
  62.555            if f': "finite f'" "f' \<subseteq> k ` S" for f'
  62.556    proof -
  62.557 @@ -11346,7 +11347,7 @@
  62.558    proof -
  62.559      obtain e where "0 < e" "y \<in> S" and e: "cball y e \<inter> affine hull S \<subseteq> S"
  62.560        using \<open>y \<in> rel_interior S\<close> by (force simp: rel_interior_cball)
  62.561 -    def y' \<equiv> "y - (e / norm a) *\<^sub>R ((x + a) - x)"
  62.562 +    define y' where "y' = y - (e / norm a) *\<^sub>R ((x + a) - x)"
  62.563      have "y' \<in> cball y e"
  62.564        unfolding y'_def using \<open>0 < e\<close> by force
  62.565      moreover have "y' \<in> affine hull S"
  62.566 @@ -11392,7 +11393,7 @@
  62.567                   "setsum v t = 1"
  62.568           and eq: "(\<Sum>x\<in>t. v x *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x)" for u v
  62.569      proof -
  62.570 -    def f \<equiv> "\<lambda>x. (if x \<in> s then u x else 0) - (if x \<in> t then v x else 0)"
  62.571 +    define f where "f x = (if x \<in> s then u x else 0) - (if x \<in> t then v x else 0)" for x
  62.572      have "setsum f (s \<union> t) = 0"
  62.573        apply (simp add: f_def setsum_Un setsum_subtractf)
  62.574        apply (simp add: setsum.inter_restrict [symmetric] Int_commute)
    63.1 --- a/src/HOL/Multivariate_Analysis/Derivative.thy	Sun Apr 24 21:31:14 2016 +0200
    63.2 +++ b/src/HOL/Multivariate_Analysis/Derivative.thy	Mon Apr 25 16:09:26 2016 +0200
    63.3 @@ -379,7 +379,7 @@
    63.4    proof (rule, rule ccontr)
    63.5      fix i :: 'a
    63.6      assume i: "i \<in> Basis"
    63.7 -    def e \<equiv> "norm (f' i - f'' i)"
    63.8 +    define e where "e = norm (f' i - f'' i)"
    63.9      assume "f' i \<noteq> f'' i"
   63.10      then have "e > 0"
   63.11        unfolding e_def by auto
   63.12 @@ -613,7 +613,7 @@
   63.13        then show ?thesis
   63.14          by (metis c(2) d(2) box_subset_cbox subset_iff)
   63.15      next
   63.16 -      def e \<equiv> "(a + b) /2"
   63.17 +      define e where "e = (a + b) /2"
   63.18        case False
   63.19        then have "f d = f c"
   63.20          using d c assms(2) by auto
   63.21 @@ -781,9 +781,10 @@
   63.22    note phi_tendsto = assms(3)[simplified continuous_on_def, rule_format]
   63.23    {
   63.24      fix e::real assume "e > 0"
   63.25 -    def e2 \<equiv> "e / 2" with \<open>e > 0\<close> have "e2 > 0" by simp
   63.26 +    define e2 where "e2 = e / 2"
   63.27 +    with \<open>e > 0\<close> have "e2 > 0" by simp
   63.28      let ?le = "\<lambda>x1. norm (f x1 - f a) \<le> \<phi> x1 - \<phi> a + e * (x1 - a) + e"
   63.29 -    def A \<equiv> "{x2. a \<le> x2 \<and> x2 \<le> b \<and> (\<forall>x1\<in>{a ..< x2}. ?le x1)}"
   63.30 +    define A where "A = {x2. a \<le> x2 \<and> x2 \<le> b \<and> (\<forall>x1\<in>{a ..< x2}. ?le x1)}"
   63.31      have A_subset: "A \<subseteq> {a .. b}" by (auto simp: A_def)
   63.32      {
   63.33        fix x2
   63.34 @@ -817,7 +818,7 @@
   63.35      have A_ivl: "\<And>x1 x2. x2 \<in> A \<Longrightarrow> x1 \<in> {a ..x2} \<Longrightarrow> x1 \<in> A"
   63.36        by (simp add: A_def)
   63.37      have [simp]: "bdd_above A" by (auto simp: A_def)
   63.38 -    def y \<equiv> "Sup A"
   63.39 +    define y where "y = Sup A"
   63.40      have "y \<le> b"
   63.41        unfolding y_def
   63.42        by (simp add: cSup_le_iff) (simp add: A_def)
   63.43 @@ -878,7 +879,7 @@
   63.44            by metis
   63.45          from \<open>open S\<close> obtain d where d: "\<And>x. dist x y < d \<Longrightarrow> x \<in> S" "d > 0"
   63.46            by (force simp: dist_commute open_dist ball_def dest!: bspec[OF _ \<open>y \<in> S\<close>])
   63.47 -        def d' \<equiv> "min ((y + b)/2) (y + (d/2))"
   63.48 +        define d' where "d' = min ((y + b)/2) (y + (d/2))"
   63.49          have "d' \<in> A"
   63.50            unfolding A_def
   63.51          proof safe
   63.52 @@ -942,7 +943,7 @@
   63.53          by metis
   63.54        from \<open>open S\<close> obtain d where d: "\<And>x. dist x y < d \<Longrightarrow> x \<in> S" "d > 0"
   63.55          by (force simp: dist_commute open_dist ball_def dest!: bspec[OF _ \<open>y \<in> S\<close>])
   63.56 -      def d' \<equiv> "min b (y + (d/2))"
   63.57 +      define d' where "d' = min b (y + (d/2))"
   63.58        have "d' \<in> A"
   63.59          unfolding A_def
   63.60        proof safe
   63.61 @@ -1077,7 +1078,7 @@
   63.62    assumes "x0 \<in> S"
   63.63    shows "norm (f b - f a - f' x0 (b - a)) \<le> norm (b - a) * B"
   63.64  proof -
   63.65 -  def g \<equiv> "\<lambda>x. f x - f' x0 x"
   63.66 +  define g where [abs_def]: "g x = f x - f' x0 x" for x
   63.67    have g: "\<And>x. x \<in> S \<Longrightarrow> (g has_derivative (\<lambda>i. f' x i - f' x0 i)) (at x within S)"
   63.68      unfolding g_def using assms
   63.69      by (auto intro!: derivative_eq_intros
   63.70 @@ -1232,7 +1233,7 @@
   63.71        "0 < d"
   63.72        "\<forall>z. norm (z - y) < d \<longrightarrow> norm (g z - g y - g' (z - y)) \<le> 1 / 2 * norm (g z - g y)"
   63.73      using lem1 * by blast
   63.74 -  def B \<equiv> "C * 2"
   63.75 +  define B where "B = C * 2"
   63.76    have "B > 0"
   63.77      unfolding B_def using C by auto
   63.78    have lem2: "norm (g z - g y) \<le> B * norm (z - y)" if z: "norm(z - y) < d" for z
   63.79 @@ -1722,7 +1723,7 @@
   63.80    then have *: "0 < onorm g'"
   63.81      unfolding onorm_pos_lt[OF assms(3)]
   63.82      by fastforce
   63.83 -  def k \<equiv> "1 / onorm g' / 2"
   63.84 +  define k where "k = 1 / onorm g' / 2"
   63.85    have *: "k > 0"
   63.86      unfolding k_def using * by auto
   63.87    obtain d1 where d1:
   63.88 @@ -1749,7 +1750,7 @@
   63.89      proof (intro strip)
   63.90        fix x y
   63.91        assume as: "x \<in> ball a d" "y \<in> ball a d" "f x = f y"
   63.92 -      def ph \<equiv> "\<lambda>w. w - g' (f w - f x)"
   63.93 +      define ph where [abs_def]: "ph w = w - g' (f w - f x)" for w
   63.94        have ph':"ph = g' \<circ> (\<lambda>w. f' a w - (f w - f x))"
   63.95          unfolding ph_def o_def
   63.96          unfolding diff
   63.97 @@ -2207,7 +2208,7 @@
   63.98    shows   "summable (\<lambda>n. f n x)" "((\<lambda>x. \<Sum>n. f n x) has_field_derivative (\<Sum>n. f' n x)) (at x)"
   63.99  proof -
  63.100    from \<open>x \<in> interior s\<close> have "x \<in> s" using interior_subset by blast
  63.101 -  def g' \<equiv> "\<lambda>x. \<Sum>i. f' i x"
  63.102 +  define g' where [abs_def]: "g' x = (\<Sum>i. f' i x)" for x
  63.103    from assms(3) have "uniform_limit s (\<lambda>n x. \<Sum>i<n. f' i x) g' sequentially"
  63.104      by (simp add: uniformly_convergent_uniform_limit_iff suminf_eq_lim g'_def)
  63.105    from has_field_derivative_series[OF assms(1,2) this assms(4,5)] obtain g where g:
  63.106 @@ -2702,7 +2703,7 @@
  63.107    shows "((\<lambda>(x, y). f x y) has_derivative (\<lambda>(tx, ty). fx x y tx + fy x y ty)) (at (x, y) within X \<times> Y)"
  63.108  proof (safe intro!: has_derivativeI tendstoI, goal_cases)
  63.109    case (2 e')
  63.110 -  def e\<equiv>"e' / 9"
  63.111 +  define e where "e = e' / 9"
  63.112    have "e > 0" using \<open>e' > 0\<close> by (simp add: e_def)
  63.113  
  63.114    have "(x, y) \<in> X \<times> Y" using assms by auto
  63.115 @@ -2720,7 +2721,7 @@
  63.116      for x' y'
  63.117      using \<open>0 < e\<close>
  63.118      by (cases "(x', y') = (x, y)") auto
  63.119 -  def d \<equiv> "d' / sqrt 2"
  63.120 +  define d where "d = d' / sqrt 2"
  63.121    have "d > 0" using \<open>0 < d'\<close> by (simp add: d_def)
  63.122    have d: "x' \<in> X \<Longrightarrow> y' \<in> Y \<Longrightarrow> dist x' x < d \<Longrightarrow> dist y' y < d \<Longrightarrow> dist (fy x' y') (fy x y) < e"
  63.123      for x' y'
    64.1 --- a/src/HOL/Multivariate_Analysis/Euclidean_Space.thy	Sun Apr 24 21:31:14 2016 +0200
    64.2 +++ b/src/HOL/Multivariate_Analysis/Euclidean_Space.thy	Mon Apr 25 16:09:26 2016 +0200
    64.3 @@ -119,7 +119,7 @@
    64.4      assume "open {x}"
    64.5      then obtain e where "0 < e" and e: "\<forall>y. dist y x < e \<longrightarrow> y = x"
    64.6        unfolding open_dist by fast
    64.7 -    def y \<equiv> "x + scaleR (e/2) (SOME b. b \<in> Basis)"
    64.8 +    define y where "y = x + scaleR (e/2) (SOME b. b \<in> Basis)"
    64.9      have [simp]: "(SOME b. b \<in> Basis) \<in> Basis"
   64.10        by (rule someI_ex) (auto simp: ex_in_conv)
   64.11      from \<open>0 < e\<close> have "y \<noteq> x"
    65.1 --- a/src/HOL/Multivariate_Analysis/Fashoda.thy	Sun Apr 24 21:31:14 2016 +0200
    65.2 +++ b/src/HOL/Multivariate_Analysis/Fashoda.thy	Mon Apr 25 16:09:26 2016 +0200
    65.3 @@ -102,8 +102,10 @@
    65.4  proof (rule ccontr)
    65.5    assume "\<not> ?thesis"
    65.6    note as = this[unfolded bex_simps,rule_format]
    65.7 -  def sqprojection \<equiv> "\<lambda>z::real^2. (inverse (infnorm z)) *\<^sub>R z" 
    65.8 -  def negatex \<equiv> "\<lambda>x::real^2. (vector [-(x$1), x$2])::real^2"
    65.9 +  define sqprojection
   65.10 +    where [abs_def]: "sqprojection z = (inverse (infnorm z)) *\<^sub>R z" for z :: "real^2"
   65.11 +  define negatex :: "real^2 \<Rightarrow> real^2"
   65.12 +    where "negatex x = (vector [-(x$1), x$2])" for x
   65.13    have lem1: "\<forall>z::real^2. infnorm (negatex z) = infnorm z"
   65.14      unfolding negatex_def infnorm_2 vector_2 by auto
   65.15    have lem2: "\<forall>z. z \<noteq> 0 \<longrightarrow> infnorm (sqprojection z) = 1"
   65.16 @@ -349,7 +351,7 @@
   65.17    obtains z where "z \<in> path_image f" and "z \<in> path_image g"
   65.18  proof -
   65.19    note assms=assms[unfolded path_def pathstart_def pathfinish_def path_image_def]
   65.20 -  def iscale \<equiv> "\<lambda>z::real. inverse 2 *\<^sub>R (z + 1)"
   65.21 +  define iscale where [abs_def]: "iscale z = inverse 2 *\<^sub>R (z + 1)" for z :: real
   65.22    have isc: "iscale ` {- 1..1} \<subseteq> {0..1}"
   65.23      unfolding iscale_def by auto
   65.24    have "\<exists>s\<in>{- 1..1}. \<exists>t\<in>{- 1..1}. (f \<circ> iscale) s = (g \<circ> iscale) t"
    66.1 --- a/src/HOL/Multivariate_Analysis/Finite_Cartesian_Product.thy	Sun Apr 24 21:31:14 2016 +0200
    66.2 +++ b/src/HOL/Multivariate_Analysis/Finite_Cartesian_Product.thy	Mon Apr 25 16:09:26 2016 +0200
    66.3 @@ -328,12 +328,12 @@
    66.4        fix x assume "x \<in> S"
    66.5        then obtain e where "0 < e" and S: "\<forall>y. dist y x < e \<longrightarrow> y \<in> S"
    66.6          using * by fast
    66.7 -      def r \<equiv> "\<lambda>i::'b. e / sqrt (of_nat CARD('b))"
    66.8 +      define r where [abs_def]: "r i = e / sqrt (of_nat CARD('b))" for i :: 'b
    66.9        from \<open>0 < e\<close> have r: "\<forall>i. 0 < r i"
   66.10          unfolding r_def by simp_all
   66.11        from \<open>0 < e\<close> have e: "e = setL2 r UNIV"
   66.12          unfolding r_def by (simp add: setL2_constant)
   66.13 -      def A \<equiv> "\<lambda>i. {y. dist (x $ i) y < r i}"
   66.14 +      define A where "A i = {y. dist (x $ i) y < r i}" for i
   66.15        have "\<forall>i. open (A i) \<and> x $ i \<in> A i"
   66.16          unfolding A_def by (simp add: open_ball r)
   66.17        moreover have "\<forall>y. (\<forall>i. y $ i \<in> A i) \<longrightarrow> y \<in> S"
   66.18 @@ -360,8 +360,8 @@
   66.19  proof (rule metric_CauchyI)
   66.20    fix r :: real assume "0 < r"
   66.21    hence "0 < r / of_nat CARD('n)" (is "0 < ?s") by simp
   66.22 -  def N \<equiv> "\<lambda>i. LEAST N. \<forall>m\<ge>N. \<forall>n\<ge>N. dist (X m $ i) (X n $ i) < ?s"
   66.23 -  def M \<equiv> "Max (range N)"
   66.24 +  define N where "N i = (LEAST N. \<forall>m\<ge>N. \<forall>n\<ge>N. dist (X m $ i) (X n $ i) < ?s)" for i
   66.25 +  define M where "M = Max (range N)"
   66.26    have "\<And>i. \<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. dist (X m $ i) (X n $ i) < ?s"
   66.27      using X \<open>0 < ?s\<close> by (rule metric_CauchyD)
   66.28    hence "\<And>i. \<forall>m\<ge>N i. \<forall>n\<ge>N i. dist (X m $ i) (X n $ i) < ?s"
    67.1 --- a/src/HOL/Multivariate_Analysis/Gamma.thy	Sun Apr 24 21:31:14 2016 +0200
    67.2 +++ b/src/HOL/Multivariate_Analysis/Gamma.thy	Mon Apr 25 16:09:26 2016 +0200
    67.3 @@ -344,8 +344,8 @@
    67.4    shows "uniformly_convergent_on (ball z d) (\<lambda>n z. ln_Gamma_series z n :: complex)"
    67.5  proof (intro Cauchy_uniformly_convergent uniformly_Cauchy_onI')
    67.6    fix e :: real assume e: "e > 0"
    67.7 -  def e'' \<equiv> "SUP t:ball z d. norm t + norm t^2"
    67.8 -  def e' \<equiv> "e / (2*e'')"
    67.9 +  define e'' where "e'' = (SUP t:ball z d. norm t + norm t^2)"
   67.10 +  define e' where "e' = e / (2*e'')"
   67.11    have "bounded ((\<lambda>t. norm t + norm t^2) ` cball z d)"
   67.12      by (intro compact_imp_bounded compact_continuous_image) (auto intro!: continuous_intros)
   67.13    hence "bounded ((\<lambda>t. norm t + norm t^2) ` ball z d)" by (rule bounded_subset) auto
   67.14 @@ -362,7 +362,7 @@
   67.15      by (rule inverse_power_summable) simp
   67.16    from summable_partial_sum_bound[OF this e'] guess M . note M = this
   67.17  
   67.18 -  def N \<equiv> "max 2 (max (nat \<lceil>2 * (norm z + d)\<rceil>) M)"
   67.19 +  define N where "N = max 2 (max (nat \<lceil>2 * (norm z + d)\<rceil>) M)"
   67.20    {
   67.21      from d have "\<lceil>2 * (cmod z + d)\<rceil> \<ge> \<lceil>0::real\<rceil>"
   67.22        by (intro ceiling_mono mult_nonneg_nonneg add_nonneg_nonneg) simp_all
   67.23 @@ -434,8 +434,8 @@
   67.24    assumes z: "(z :: complex) \<notin> \<int>\<^sub>\<le>\<^sub>0"
   67.25    shows "\<exists>d>0. uniformly_convergent_on (ball z d) (\<lambda>n z. ln_Gamma_series z n)"
   67.26  proof -
   67.27 -  def d' \<equiv> "Re z"
   67.28 -  def d \<equiv> "if d' > 0 then d' / 2 else norm (z - of_int (round d')) / 2"
   67.29 +  define d' where "d' = Re z"
   67.30 +  define d where "d = (if d' > 0 then d' / 2 else norm (z - of_int (round d')) / 2)"
   67.31    have "of_int (round d') \<in> \<int>\<^sub>\<le>\<^sub>0" if "d' \<le> 0" using that
   67.32      by (intro nonpos_Ints_of_int) (simp_all add: round_def)
   67.33    with assms have d_pos: "d > 0" unfolding d_def by (force simp: not_less)
   67.34 @@ -633,8 +633,8 @@
   67.35    assumes z: "z \<noteq> 0" and n: "n \<ge> 2"
   67.36    shows "uniformly_convergent_on (ball z d) (\<lambda>k z. \<Sum>i<k. inverse ((z + of_nat i)^n))"
   67.37  proof (rule weierstrass_m_test'_ev)
   67.38 -  def e \<equiv> "(1 + d / norm z)"
   67.39 -  def m \<equiv> "nat \<lceil>norm z * e\<rceil>"
   67.40 +  define e where "e = (1 + d / norm z)"
   67.41 +  define m where "m = nat \<lceil>norm z * e\<rceil>"
   67.42    {
   67.43      fix t assume t: "t \<in> ball z d"
   67.44      have "norm t = norm (z + (t - z))" by simp
   67.45 @@ -683,7 +683,7 @@
   67.46       by blast+
   67.47    let ?f' = "\<lambda>z k. inverse (of_nat (Suc k)) - inverse (z + of_nat (Suc k))"
   67.48    let ?f = "\<lambda>z k. z / of_nat (Suc k) - ln (1 + z / of_nat (Suc k))" and ?F' = "\<lambda>z. \<Sum>n. ?f' z n"
   67.49 -  def d \<equiv> "min (norm z/2) (if Im z = 0 then Re z / 2 else abs (Im z) / 2)"
   67.50 +  define d where "d = min (norm z/2) (if Im z = 0 then Re z / 2 else abs (Im z) / 2)"
   67.51    from z have d: "d > 0" "norm z/2 \<ge> d" by (auto simp add: complex_nonpos_Reals_iff d_def)
   67.52    have ball: "Im t = 0 \<longrightarrow> Re t > 0" if "dist z t < d" for t
   67.53      using no_nonpos_Real_in_ball[OF z, of t] that unfolding d_def by (force simp add: complex_nonpos_Reals_iff)
   67.54 @@ -860,7 +860,7 @@
   67.55    assume n: "n \<noteq> 0"
   67.56    from z have z': "z \<noteq> 0" by auto
   67.57    from no_nonpos_Int_in_ball'[OF z] guess d . note d = this
   67.58 -  def n' \<equiv> "Suc n"
   67.59 +  define n' where "n' = Suc n"
   67.60    from n have n': "n' \<ge> 2" by (simp add: n'_def)
   67.61    have "((\<lambda>z. \<Sum>k. inverse ((z + of_nat k) ^ n')) has_field_derivative
   67.62                  (\<Sum>k. - of_nat n' * inverse ((z + of_nat k) ^ (n'+1)))) (at z)"
   67.63 @@ -1763,10 +1763,10 @@
   67.64    defines "a \<equiv> complex_of_real pi"
   67.65    obtains h' where "continuous_on UNIV h'" "\<And>z. (h has_field_derivative (h' z)) (at z)"
   67.66  proof -
   67.67 -  def f \<equiv> "\<lambda>n. a * of_real (cos_coeff (n+1) - sin_coeff (n+2))"
   67.68 -  def F \<equiv> "\<lambda>z. if z = 0 then 0 else (cos (a*z) - sin (a*z)/(a*z)) / z"
   67.69 -  def g \<equiv> "\<lambda>n. complex_of_real (sin_coeff (n+1))"
   67.70 -  def G \<equiv> "\<lambda>z. if z = 0 then 1 else sin (a*z)/(a*z)"
   67.71 +  define f where "f n = a * of_real (cos_coeff (n+1) - sin_coeff (n+2))" for n
   67.72 +  define F where "F z = (if z = 0 then 0 else (cos (a*z) - sin (a*z)/(a*z)) / z)" for z
   67.73 +  define g where "g n = complex_of_real (sin_coeff (n+1))" for n
   67.74 +  define G where "G z = (if z = 0 then 1 else sin (a*z)/(a*z))" for z
   67.75    have a_nz: "a \<noteq> 0" unfolding a_def by simp
   67.76  
   67.77    have "(\<lambda>n. f n * (a*z)^n) sums (F z) \<and> (\<lambda>n. g n * (a*z)^n) sums (G z)"
   67.78 @@ -1803,13 +1803,13 @@
   67.79    qed
   67.80    note sums = conjunct1[OF this] conjunct2[OF this]
   67.81  
   67.82 -  def h2 \<equiv> "\<lambda>z. (\<Sum>n. f n * (a*z)^n) / (\<Sum>n. g n * (a*z)^n) +
   67.83 -            Digamma (1 + z) - Digamma (1 - z)"
   67.84 -  def POWSER \<equiv> "\<lambda>f z. (\<Sum>n. f n * (z^n :: complex))"
   67.85 -  def POWSER' \<equiv> "\<lambda>f z. (\<Sum>n. diffs f n * (z^n :: complex))"
   67.86 -
   67.87 -  def h2' \<equiv> "\<lambda>z. a * (POWSER g (a*z) * POWSER' f (a*z) - POWSER f (a*z) * POWSER' g (a*z)) /
   67.88 -                     (POWSER g (a*z))^2 + Polygamma 1 (1 + z) + Polygamma 1 (1 - z)"
   67.89 +  define h2 where [abs_def]:
   67.90 +    "h2 z = (\<Sum>n. f n * (a*z)^n) / (\<Sum>n. g n * (a*z)^n) + Digamma (1 + z) - Digamma (1 - z)" for z
   67.91 +  define POWSER where [abs_def]: "POWSER f z = (\<Sum>n. f n * (z^n :: complex))" for f z
   67.92 +  define POWSER' where [abs_def]: "POWSER' f z = (\<Sum>n. diffs f n * (z^n))" for f and z :: complex
   67.93 +  define h2' where [abs_def]:
   67.94 +    "h2' z = a * (POWSER g (a*z) * POWSER' f (a*z) - POWSER f (a*z) * POWSER' g (a*z)) /
   67.95 +      (POWSER g (a*z))^2 + Polygamma 1 (1 + z) + Polygamma 1 (1 - z)" for z
   67.96  
   67.97    have h_eq: "h t = h2 t" if "abs (Re t) < 1" for t
   67.98    proof -
   67.99 @@ -1850,7 +1850,7 @@
  67.100  
  67.101    {
  67.102      fix z :: complex assume z: "abs (Re z) < 1"
  67.103 -    def d \<equiv> "\<i> * of_real (norm z + 1)"
  67.104 +    define d where "d = \<i> * of_real (norm z + 1)"
  67.105      have d: "abs (Re d) < 1" "norm z < norm d" by (simp_all add: d_def norm_mult del: of_real_add)
  67.106      have "eventually (\<lambda>z. h z = h2 z) (nhds z)"
  67.107        using eventually_nhds_in_nhd[of z ?A] using h_eq z
  67.108 @@ -1902,7 +1902,7 @@
  67.109      ultimately show "h2' (z - 1) = h2' z" by (rule DERIV_unique)
  67.110    qed
  67.111  
  67.112 -  def h2'' \<equiv> "\<lambda>z. h2' (z - of_int \<lfloor>Re z\<rfloor>)"
  67.113 +  define h2'' where "h2'' z = h2' (z - of_int \<lfloor>Re z\<rfloor>)" for z
  67.114    have deriv: "(h has_field_derivative h2'' z) (at z)" for z
  67.115    proof -
  67.116      fix z :: complex
  67.117 @@ -1916,8 +1916,8 @@
  67.118    have cont: "continuous_on UNIV h2''"
  67.119    proof (intro continuous_at_imp_continuous_on ballI)
  67.120      fix z :: complex
  67.121 -    def r \<equiv> "\<lfloor>Re z\<rfloor>"
  67.122 -    def A \<equiv> "{t. of_int r - 1 < Re t \<and> Re t < of_int r + 1}"
  67.123 +    define r where "r = \<lfloor>Re z\<rfloor>"
  67.124 +    define A where "A = {t. of_int r - 1 < Re t \<and> Re t < of_int r + 1}"
  67.125      have "continuous_on A (\<lambda>t. h2' (t - of_int r))" unfolding A_def
  67.126        by (intro continuous_at_imp_continuous_on isCont_o2[OF _ A(2)] ballI continuous_intros)
  67.127           (simp_all add: abs_real_def)
  67.128 @@ -1957,9 +1957,9 @@
  67.129    shows "Gamma z * Gamma (1 - z) = of_real pi / sin (of_real pi * z)"
  67.130  proof -
  67.131    let ?g = "\<lambda>z::complex. Gamma z * Gamma (1 - z) * sin (of_real pi * z)"
  67.132 -  def g \<equiv> "\<lambda>z::complex. if z \<in> \<int> then of_real pi else ?g z"
  67.133 +  define g where [abs_def]: "g z = (if z \<in> \<int> then of_real pi else ?g z)" for z :: complex
  67.134    let ?h = "\<lambda>z::complex. (of_real pi * cot (of_real pi*z) + Digamma z - Digamma (1 - z))"
  67.135 -  def h \<equiv> "\<lambda>z::complex. if z \<in> \<int> then 0 else ?h z"
  67.136 +  define h where [abs_def]: "h z = (if z \<in> \<int> then 0 else ?h z)" for z :: complex
  67.137  
  67.138    \<comment> \<open>@{term g} is periodic with period 1.\<close>
  67.139    interpret g: periodic_fun_simple' g
  67.140 @@ -2073,7 +2073,7 @@
  67.141    qed
  67.142    have g_eq: "g (z/2) * g ((z+1)/2) = Gamma (1/2)^2 * g z" for z
  67.143    proof -
  67.144 -    def r \<equiv> "\<lfloor>Re z / 2\<rfloor>"
  67.145 +    define r where "r = \<lfloor>Re z / 2\<rfloor>"
  67.146      have "Gamma (1/2)^2 * g z = Gamma (1/2)^2 * g (z - of_int (2*r))" by (simp only: g.minus_of_int)
  67.147      also have "of_int (2*r) = 2 * of_int r" by simp
  67.148      also have "Re z - 2 * of_int r > -1" "Re z - 2 * of_int r < 2" unfolding r_def by linarith+
  67.149 @@ -2126,8 +2126,8 @@
  67.150  
  67.151    have h'_zero: "h' z = 0" for z
  67.152    proof -
  67.153 -    def m \<equiv> "max 1 \<bar>Re z\<bar>"
  67.154 -    def B \<equiv> "{t. abs (Re t) \<le> m \<and> abs (Im t) \<le> abs (Im z)}"
  67.155 +    define m where "m = max 1 \<bar>Re z\<bar>"
  67.156 +    define B where "B = {t. abs (Re t) \<le> m \<and> abs (Im t) \<le> abs (Im z)}"
  67.157      have "closed ({t. Re t \<ge> -m} \<inter> {t. Re t \<le> m} \<inter>
  67.158                    {t. Im t \<ge> -\<bar>Im z\<bar>} \<inter> {t. Im t \<le> \<bar>Im z\<bar>})"
  67.159        (is "closed ?B") by (intro closed_Int closed_halfspace_Re_ge closed_halfspace_Re_le
  67.160 @@ -2144,7 +2144,7 @@
  67.161      qed
  67.162      ultimately have compact: "compact B" by (subst compact_eq_bounded_closed) blast
  67.163  
  67.164 -    def M \<equiv> "SUP z:B. norm (h' z)"
  67.165 +    define M where "M = (SUP z:B. norm (h' z))"
  67.166      have "compact (h' ` B)"
  67.167        by (intro compact_continuous_image continuous_on_subset[OF h'_cont] compact) blast+
  67.168      hence bdd: "bdd_above ((\<lambda>z. norm (h' z)) ` B)"
  67.169 @@ -2560,10 +2560,10 @@
  67.170  
  67.171  theorem inverse_squares_sums: "(\<lambda>n. 1 / (n + 1)\<^sup>2) sums (pi\<^sup>2 / 6)"
  67.172  proof -
  67.173 -  def P \<equiv> "\<lambda>x n. (\<Prod>k=1..n. 1 - x^2 / of_nat k^2 :: real)"
  67.174 -  def K \<equiv> "\<Sum>n. inverse (real_of_nat (Suc n))^2"
  67.175 -  def f \<equiv> "\<lambda>x. \<Sum>n. P x n / of_nat (Suc n)^2"
  67.176 -  def g \<equiv> "\<lambda>x. (1 - sin (pi * x) / (pi * x))"
  67.177 +  define P where "P x n = (\<Prod>k=1..n. 1 - x^2 / of_nat k^2)" for x :: real and n
  67.178 +  define K where "K = (\<Sum>n. inverse (real_of_nat (Suc n))^2)"
  67.179 +  define f where [abs_def]: "f x = (\<Sum>n. P x n / of_nat (Suc n)^2)" for x
  67.180 +  define g where [abs_def]: "g x = (1 - sin (pi * x) / (pi * x))" for x
  67.181  
  67.182    have sums: "(\<lambda>n. P x n / of_nat (Suc n)^2) sums (if x = 0 then K else g x / x^2)" for x
  67.183    proof (cases "x = 0")
  67.184 @@ -2606,7 +2606,7 @@
  67.185  
  67.186    moreover have "f \<midarrow> 0 \<rightarrow> pi^2 / 6"
  67.187    proof (rule Lim_transform_eventually)
  67.188 -    def f' \<equiv> "\<lambda>x. \<Sum>n. - sin_coeff (n+3) * pi ^ (n+2) * x^n"
  67.189 +    define f' where [abs_def]: "f' x = (\<Sum>n. - sin_coeff (n+3) * pi ^ (n+2) * x^n)" for x
  67.190      have "eventually (\<lambda>x. x \<noteq> (0::real)) (at 0)"
  67.191        by (auto simp add: eventually_at intro!: exI[of _ 1])
  67.192      thus "eventually (\<lambda>x. f' x = f x) (at 0)"
    68.1 --- a/src/HOL/Multivariate_Analysis/Generalised_Binomial_Theorem.thy	Sun Apr 24 21:31:14 2016 +0200
    68.2 +++ b/src/HOL/Multivariate_Analysis/Generalised_Binomial_Theorem.thy	Mon Apr 25 16:09:26 2016 +0200
    68.3 @@ -73,7 +73,7 @@
    68.4    assumes "norm z < 1"
    68.5    shows   "(\<lambda>n. (a gchoose n) * z^n) sums (1 + z) powr a"
    68.6  proof -
    68.7 -  def K \<equiv> "1 - (1 - norm z) / 2"
    68.8 +  define K where "K = 1 - (1 - norm z) / 2"
    68.9    from assms have K: "K > 0" "K < 1" "norm z < K"
   68.10       unfolding K_def by (auto simp: field_simps intro!: add_pos_nonneg)
   68.11    let ?f = "\<lambda>n. a gchoose n" and ?f' = "diffs (\<lambda>n. a gchoose n)"
   68.12 @@ -83,7 +83,7 @@
   68.13    hence summable': "summable (\<lambda>n. ?f' n * z ^ n)" if "norm z < K" for z using that
   68.14      by (intro termdiff_converges[of _ K]) simp_all
   68.15    
   68.16 -  def f \<equiv> "\<lambda>z. \<Sum>n. ?f n * z ^ n" and f' \<equiv> "\<lambda>z. \<Sum>n. ?f' n * z ^ n"
   68.17 +  define f f' where [abs_def]: "f z = (\<Sum>n. ?f n * z ^ n)" "f' z = (\<Sum>n. ?f' n * z ^ n)" for z
   68.18    {
   68.19      fix z :: complex assume z: "norm z < K"
   68.20      from summable_mult2[OF summable'[OF z], of z]
   68.21 @@ -92,7 +92,7 @@
   68.22        unfolding diffs_def by (subst (asm) summable_Suc_iff)
   68.23  
   68.24      have "(1 + z) * f' z = (\<Sum>n. ?f' n * z^n) + (\<Sum>n. ?f' n * z^Suc n)"
   68.25 -      unfolding f'_def using summable' z by (simp add: algebra_simps suminf_mult)
   68.26 +      unfolding f_f'_def using summable' z by (simp add: algebra_simps suminf_mult)
   68.27      also have "(\<Sum>n. ?f' n * z^n) = (\<Sum>n. of_nat (Suc n) * ?f (Suc n) * z^n)"
   68.28        by (intro suminf_cong) (simp add: diffs_def)
   68.29      also have "(\<Sum>n. ?f' n * z^Suc n) = (\<Sum>n. of_nat n * ?f n * z ^ n)" 
   68.30 @@ -103,15 +103,15 @@
   68.31        by (subst gbinomial_mult_1, subst suminf_add)
   68.32           (insert summable'[OF z] summable2, 
   68.33            simp_all add: summable_powser_split_head algebra_simps diffs_def)
   68.34 -    also have "\<dots> = a * f z" unfolding f_def
   68.35 +    also have "\<dots> = a * f z" unfolding f_f'_def
   68.36        by (subst suminf_mult[symmetric]) (simp_all add: summable[OF z] mult_ac)
   68.37      finally have "a * f z = (1 + z) * f' z" by simp
   68.38    } note deriv = this
   68.39  
   68.40    have [derivative_intros]: "(f has_field_derivative f' z) (at z)" if "norm z < of_real K" for z
   68.41 -    unfolding f_def f'_def using K that
   68.42 +    unfolding f_f'_def using K that
   68.43      by (intro termdiffs_strong[of "?f" K z] summable_strong) simp_all
   68.44 -  have "f 0 = (\<Sum>n. if n = 0 then 1 else 0)" unfolding f_def by (intro suminf_cong) simp
   68.45 +  have "f 0 = (\<Sum>n. if n = 0 then 1 else 0)" unfolding f_f'_def by (intro suminf_cong) simp
   68.46    also have "\<dots> = 1" using sums_single[of 0 "\<lambda>_. 1::complex"] unfolding sums_iff by simp
   68.47    finally have [simp]: "f 0 = 1" .
   68.48  
   68.49 @@ -133,7 +133,7 @@
   68.50    from c[of 0] and K have "c = 1" by simp
   68.51    with c[of z] have "f z = (1 + z) powr a" using K 
   68.52      by (simp add: powr_minus_complex field_simps dist_complex_def)
   68.53 -  with summable K show ?thesis unfolding f_def by (simp add: sums_iff)
   68.54 +  with summable K show ?thesis unfolding f_f'_def by (simp add: sums_iff)
   68.55  qed
   68.56  
   68.57  lemma gen_binomial_complex':
    69.1 --- a/src/HOL/Multivariate_Analysis/Harmonic_Numbers.thy	Sun Apr 24 21:31:14 2016 +0200
    69.2 +++ b/src/HOL/Multivariate_Analysis/Harmonic_Numbers.thy	Mon Apr 25 16:09:26 2016 +0200
    69.3 @@ -250,7 +250,7 @@
    69.4    assumes "(x::real) > 0" "a > 0"
    69.5    shows   "ln (x + a) - ln x \<le> a * (inverse x + inverse (x + a))/2" (is "_ \<le> ?A")
    69.6  proof -
    69.7 -  def f' \<equiv> "(inverse (x + a) - inverse x)/a"
    69.8 +  define f' where "f' = (inverse (x + a) - inverse x)/a"
    69.9    have f'_nonpos: "f' \<le> 0" using assms by (simp add: f'_def divide_simps)
   69.10    let ?f = "\<lambda>t. (t - x) * f' + inverse x"
   69.11    let ?F = "\<lambda>t. (t - x)^2 * f' / 2 + t * inverse x"
   69.12 @@ -297,8 +297,8 @@
   69.13    assumes "(x::real) > 0" "x < y"
   69.14    shows   "ln y - ln x \<ge> 2 * (y - x) / (x + y)" (is "_ \<ge> ?A")
   69.15  proof -
   69.16 -  def m \<equiv> "(x+y)/2"
   69.17 -  def f' \<equiv> "-inverse (m^2)"
   69.18 +  define m where "m = (x+y)/2"
   69.19 +  define f' where "f' = -inverse (m^2)"
   69.20    from assms have m: "m > 0" by (simp add: m_def)
   69.21    let ?F = "\<lambda>t. (t - m)^2 * f' / 2 + t / m"
   69.22    from assms have "((\<lambda>t. (t - m) * f' + inverse m) has_integral (?F y - ?F x)) {x..y}"
   69.23 @@ -337,9 +337,10 @@
   69.24    and euler_mascheroni_upper:
   69.25          "euler_mascheroni \<le> harm (Suc n) - ln (real_of_nat (n + 2)) + 1/real_of_nat (2 * (n + 1))"
   69.26  proof -
   69.27 -  def D \<equiv> "\<lambda>n. inverse (of_nat (n+1)) + ln (of_nat (n+1)) - ln (of_nat (n+2)) :: real"
   69.28 +  define D :: "_ \<Rightarrow> real"
   69.29 +    where "D n = inverse (of_nat (n+1)) + ln (of_nat (n+1)) - ln (of_nat (n+2))" for n
   69.30    let ?g = "\<lambda>n. ln (of_nat (n+2)) - ln (of_nat (n+1)) - inverse (of_nat (n+1)) :: real"
   69.31 -  def inv \<equiv> "\<lambda>n. inverse (real_of_nat n)"
   69.32 +  define inv where [abs_def]: "inv n = inverse (real_of_nat n)" for n
   69.33    fix n :: nat
   69.34    note summable = sums_summable[OF euler_mascheroni_sum, folded D_def]
   69.35    have sums: "(\<lambda>k. (inv (Suc (k + (n+1))) - inv (Suc (Suc k + (n+1))))/2) sums ((inv (Suc (0 + (n+1))) - 0)/2)"
   69.36 @@ -358,7 +359,7 @@
   69.37    also have "\<dots> \<le> -(\<Sum>k. (inv (k + Suc n + 1) - inv (k + Suc n + 2)) / 2)"
   69.38    proof (intro le_imp_neg_le suminf_le allI summable_ignore_initial_segment[OF summable])
   69.39      fix k' :: nat
   69.40 -    def k \<equiv> "k' + Suc n"
   69.41 +    define k where "k = k' + Suc n"
   69.42      hence k: "k > 0" by (simp add: k_def)
   69.43      have "real_of_nat (k+1) > 0" by (simp add: k_def)
   69.44      with ln_inverse_approx_le[OF this zero_less_one]
   69.45 @@ -386,7 +387,7 @@
   69.46    also have "-(\<Sum>k. D (k + Suc n)) \<ge> -(\<Sum>k. (inv (Suc (k + n)) - inv (Suc (Suc k + n)))/2)"
   69.47    proof (intro le_imp_neg_le suminf_le allI summable_ignore_initial_segment[OF summable])
   69.48      fix k' :: nat
   69.49 -    def k \<equiv> "k' + Suc n"
   69.50 +    define k where "k = k' + Suc n"
   69.51      hence k: "k > 0" by (simp add: k_def)
   69.52      have "real_of_nat (k+1) > 0" by (simp add: k_def)
   69.53      from ln_inverse_approx_ge[of "of_nat k + 1" "of_nat k + 2"]
   69.54 @@ -435,7 +436,7 @@
   69.55  
   69.56    let ?f = "\<lambda>k. 2 * y ^ (2*k+1) / of_nat (2*k+1)"
   69.57    note sums = ln_series_quadratic[OF x(1)]
   69.58 -  def c \<equiv> "inverse (2*y^(2*n+1))"
   69.59 +  define c where "c = inverse (2*y^(2*n+1))"
   69.60    let ?d = "c * (ln x - (\<Sum>k<n. ?f k))"
   69.61    have "\<forall>k. y\<^sup>2^k / of_nat (2*(k+n)+1) \<le> y\<^sup>2 ^ k / of_nat (2*n+1)"
   69.62      by (intro allI divide_left_mono mult_right_mono mult_pos_pos zero_le_power[of "y^2"]) simp_all
   69.63 @@ -466,7 +467,7 @@
   69.64    shows   ln_approx_bounds: "ln x \<in> {approx..approx + 2*d}"
   69.65    and     ln_approx_abs:    "abs (ln x - (approx + d)) \<le> d"
   69.66  proof -
   69.67 -  def c \<equiv> "2*y^(2*n+1)"
   69.68 +  define c where "c = 2*y^(2*n+1)"
   69.69    from x have c_pos: "c > 0" unfolding c_def y_def 
   69.70      by (intro mult_pos_pos zero_less_power) simp_all
   69.71    have A: "inverse c * (ln x - (\<Sum>k<n. 2*y^(2*k+1) / of_nat (2*k+1))) \<in>
    70.1 --- a/src/HOL/Multivariate_Analysis/Integration.thy	Sun Apr 24 21:31:14 2016 +0200
    70.2 +++ b/src/HOL/Multivariate_Analysis/Integration.thy	Mon Apr 25 16:09:26 2016 +0200
    70.3 @@ -928,7 +928,7 @@
    70.4  proof
    70.5    let ?B = "\<lambda>f::'a\<Rightarrow>'a \<times> 'a.
    70.6      cbox (\<Sum>i\<in>Basis. (fst (f i) \<bullet> i) *\<^sub>R i) (\<Sum>i\<in>Basis. (snd (f i) \<bullet> i) *\<^sub>R i)"
    70.7 -  def p \<equiv> "?B ` (Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)})"
    70.8 +  define p where "p = ?B ` (Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)})"
    70.9  
   70.10    show "cbox c d \<in> p"
   70.11      unfolding p_def
   70.12 @@ -2004,10 +2004,7 @@
   70.13      apply (drule choice)
   70.14      apply blast
   70.15      done
   70.16 -  def AB \<equiv> "\<lambda>n. (f ^^ n) (a,b)"
   70.17 -  def A \<equiv> "\<lambda>n. fst(AB n)"
   70.18 -  def B \<equiv> "\<lambda>n. snd(AB n)"
   70.19 -  note ab_def = A_def B_def AB_def
   70.20 +  define AB A B where ab_def: "AB n = (f ^^ n) (a,b)" "A n = fst(AB n)" "B n = snd(AB n)" for n
   70.21    have "A 0 = a" "B 0 = b" "\<And>n. \<not> P (cbox (A(Suc n)) (B(Suc n))) \<and>
   70.22      (\<forall>i\<in>Basis. A(n)\<bullet>i \<le> A(Suc n)\<bullet>i \<and> A(Suc n)\<bullet>i \<le> B(Suc n)\<bullet>i \<and> B(Suc n)\<bullet>i \<le> B(n)\<bullet>i \<and>
   70.23      2 * (B(Suc n)\<bullet>i - A(Suc n)\<bullet>i) \<le> B(n)\<bullet>i - A(n)\<bullet>i)" (is "\<And>n. ?P n")
   70.24 @@ -3453,8 +3450,8 @@
   70.25      and "f integrable_on (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" (is ?t2)
   70.26  proof -
   70.27    guess y using assms(1) unfolding integrable_on_def .. note y=this
   70.28 -  def b' \<equiv> "\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) c else b\<bullet>i)*\<^sub>R i::'a"
   70.29 -  def a' \<equiv> "\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) c else a\<bullet>i)*\<^sub>R i::'a"
   70.30 +  define b' where "b' = (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) c else b\<bullet>i)*\<^sub>R i)"
   70.31 +  define a' where "a' = (\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) c else a\<bullet>i)*\<^sub>R i)"
   70.32    show ?t1 ?t2
   70.33      unfolding interval_split[OF k] integrable_cauchy
   70.34      unfolding interval_split[symmetric,OF k]
   70.35 @@ -3954,7 +3951,7 @@
   70.36        by (simp add: "*" iterate_expand_cases)
   70.37    next
   70.38      case True
   70.39 -    def su \<equiv> "support opp f s"
   70.40 +    define su where "su = support opp f s"
   70.41      have fsu: "finite su"
   70.42        using True by (simp add: su_def)
   70.43      moreover
   70.44 @@ -3976,7 +3973,7 @@
   70.45        and "d division_of (cbox a b)"
   70.46      shows "iterate opp d f = f (cbox a b)"
   70.47  proof -
   70.48 -  def C \<equiv> "card (division_points (cbox a b) d)"
   70.49 +  define C where [abs_def]: "C = card (division_points (cbox a b) d)"
   70.50    then show ?thesis
   70.51      using assms
   70.52    proof (induct C arbitrary: a b d rule: full_nat_induct)
   70.53 @@ -4079,10 +4076,10 @@
   70.54            done
   70.55          note this(2-4,1) note kc=this[unfolded interval_bounds[OF ab']]
   70.56          from this(3) guess j .. note j=this
   70.57 -        def d1 \<equiv> "{l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}"
   70.58 -        def d2 \<equiv> "{l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}"
   70.59 -        def cb \<equiv> "(\<Sum>i\<in>Basis. (if i = k then c else b\<bullet>i) *\<^sub>R i)::'a"
   70.60 -        def ca \<equiv> "(\<Sum>i\<in>Basis. (if i = k then c else a\<bullet>i) *\<^sub>R i)::'a"
   70.61 +        define d1 where "d1 = {l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}"
   70.62 +        define d2 where "d2 = {l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}"
   70.63 +        define cb where "cb = (\<Sum>i\<in>Basis. (if i = k then c else b\<bullet>i) *\<^sub>R i)"
   70.64 +        define ca where "ca = (\<Sum>i\<in>Basis. (if i = k then c else a\<bullet>i) *\<^sub>R i)"
   70.65          note division_points_psubset[OF \<open>d division_of cbox a b\<close> ab kc(1-2) j]
   70.66          note psubset_card_mono[OF _ this(1)] psubset_card_mono[OF _ this(2)]
   70.67          then have *: "(iterate opp d1 f) = f (cbox a b \<inter> {x. x\<bullet>k \<le> c})"
   70.68 @@ -4734,7 +4731,7 @@
   70.69      done
   70.70  next
   70.71    case False
   70.72 -  def d \<equiv> "e / 3 / setprod (\<lambda>i. b\<bullet>i - a\<bullet>i) (Basis - {k})"
   70.73 +  define d where "d = e / 3 / setprod (\<lambda>i. b\<bullet>i - a\<bullet>i) (Basis - {k})"
   70.74    note False[unfolded content_eq_0 not_ex not_le, rule_format]
   70.75    then have "\<And>x. x \<in> Basis \<Longrightarrow> b\<bullet>x > a\<bullet>x"
   70.76      by (auto simp add:not_le)
   70.77 @@ -5227,7 +5224,7 @@
   70.78        next
   70.79          fix x k
   70.80          assume xk: "(x, k) \<in> p"
   70.81 -        def n \<equiv> "nat \<lfloor>norm (f x)\<rfloor>"
   70.82 +        define n where "n = nat \<lfloor>norm (f x)\<rfloor>"
   70.83          have *: "norm (f x) \<in> (\<lambda>(x, k). norm (f x)) ` p"
   70.84            using xk by auto
   70.85          have nfx: "real n \<le> norm (f x)" "norm (f x) \<le> real n + 1"
   70.86 @@ -6085,7 +6082,7 @@
   70.87    using assms
   70.88  proof cases
   70.89    assume p: "p \<noteq> 1"
   70.90 -  def p' \<equiv> "p - 2"
   70.91 +  define p' where "p' = p - 2"
   70.92    from assms p have p': "{..<p} = {..Suc p'}" "p = Suc (Suc p')"
   70.93      by (auto simp: p'_def)
   70.94    have *: "\<And>i. i \<le> p' \<Longrightarrow> Suc (Suc p' - i) = (Suc (Suc p') - i)"
   70.95 @@ -6125,8 +6122,9 @@
   70.96    case 1
   70.97    interpret bounded_bilinear "scaleR::real\<Rightarrow>'a\<Rightarrow>'a"
   70.98      by (rule bounded_bilinear_scaleR)
   70.99 -  def g \<equiv> "\<lambda>s. (b - s)^(p - 1)/fact (p - 1)"
  70.100 -  def Dg \<equiv> "\<lambda>n s. if n < p then (-1)^n * (b - s)^(p - 1 - n) / fact (p - 1 - n) else 0"
  70.101 +  define g where "g s = (b - s)^(p - 1)/fact (p - 1)" for s
  70.102 +  define Dg where [abs_def]:
  70.103 +    "Dg n s = (if n < p then (-1)^n * (b - s)^(p - 1 - n) / fact (p - 1 - n) else 0)" for n s
  70.104    have g0: "Dg 0 = g"
  70.105      using \<open>p > 0\<close>
  70.106      by (auto simp add: Dg_def divide_simps g_def split: if_split_asm)
  70.107 @@ -6253,8 +6251,8 @@
  70.108        using s(3)[OF k(1),unfolded k] unfolding box_ne_empty by auto
  70.109      then have xi: "x\<bullet>i = d\<bullet>i"
  70.110        using as unfolding k mem_box by (metis antisym)
  70.111 -    def y \<equiv> "\<Sum>j\<in>Basis. (if j = i then if c\<bullet>i \<le> (a\<bullet>i + b\<bullet>i) / 2 then c\<bullet>i +
  70.112 -      min e (b\<bullet>i - c\<bullet>i) / 2 else c\<bullet>i - min e (c\<bullet>i - a\<bullet>i) / 2 else x\<bullet>j) *\<^sub>R j"
  70.113 +    define y where "y = (\<Sum>j\<in>Basis. (if j = i then if c\<bullet>i \<le> (a\<bullet>i + b\<bullet>i) / 2 then c\<bullet>i +
  70.114 +      min e (b\<bullet>i - c\<bullet>i) / 2 else c\<bullet>i - min e (c\<bullet>i - a\<bullet>i) / 2 else x\<bullet>j) *\<^sub>R j)"
  70.115      show "\<exists>x'\<in>\<Union>(s - {k}). x' \<noteq> x \<and> dist x' x < e"
  70.116        apply (rule_tac x=y in bexI)
  70.117      proof
  70.118 @@ -6619,7 +6617,7 @@
  70.119      assume e: "e > 0"
  70.120      with assms(1) have "e * r > 0" by simp
  70.121      from assms(8)[unfolded has_integral,rule_format,OF this] guess d by (elim exE conjE) note d=this[rule_format]
  70.122 -    def d' \<equiv> "\<lambda>x. {y. g y \<in> d (g x)}"
  70.123 +    define d' where "d' x = {y. g y \<in> d (g x)}" for x
  70.124      have d': "\<And>x. d' x = {y. g y \<in> (d (g x))}"
  70.125        unfolding d'_def ..
  70.126      show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of h ` cbox a b \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e)"
  70.127 @@ -7590,7 +7588,7 @@
  70.128      done
  70.129    from integrable_integral[OF this,unfolded has_integral_real,rule_format,OF *] guess d1 ..
  70.130    note d1 = conjunctD2[OF this,rule_format]
  70.131 -  def d \<equiv> "\<lambda>x. ball x w \<inter> d1 x"
  70.132 +  define d where [abs_def]: "d x = ball x w \<inter> d1 x" for x
  70.133    have "gauge d"
  70.134      unfolding d_def using w(1) d1 by auto
  70.135    note this[unfolded gauge_def,rule_format,of c]
  70.136 @@ -7628,7 +7626,7 @@
  70.137        done
  70.138      from integrable_integral[OF this,unfolded has_integral_real,rule_format,OF *] guess d2 ..
  70.139      note d2 = conjunctD2[OF this,rule_format]
  70.140 -    def d3 \<equiv> "\<lambda>x. if x \<le> t then d1 x \<inter> d2 x else d1 x"
  70.141 +    define d3 where "d3 x = (if x \<le> t then d1 x \<inter> d2 x else d1 x)" for x
  70.142      have "gauge d3"
  70.143        using d2(1) d1(1) unfolding d3_def gauge_def by auto
  70.144      from fine_division_exists_real[OF this, of a t] guess p . note p=this
  70.145 @@ -8072,7 +8070,7 @@
  70.146      and "cbox c d \<subseteq> cbox a b"
  70.147    shows "((\<lambda>x. if x \<in> box c d then f x else 0) has_integral i) (cbox a b)"
  70.148  proof -
  70.149 -  def g \<equiv> "\<lambda>x. if x \<in>box c d then f x else 0"
  70.150 +  define g where [abs_def]: "g x = (if x \<in>box c d then f x else 0)" for x
  70.151    {
  70.152      presume *: "cbox c d \<noteq> {} \<Longrightarrow> ?thesis"
  70.153      show ?thesis
  70.154 @@ -8264,8 +8262,8 @@
  70.155    next
  70.156      assume as: "\<forall>e>0. ?r e"
  70.157      from this[rule_format,OF zero_less_one] guess C .. note C=conjunctD2[OF this,rule_format]
  70.158 -    def c \<equiv> "(\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)::'n"
  70.159 -    def d \<equiv> "(\<Sum>i\<in>Basis. max B C *\<^sub>R i)::'n"
  70.160 +    define c :: 'n where "c = (\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)"
  70.161 +    define d :: 'n where "d = (\<Sum>i\<in>Basis. max B C *\<^sub>R i)"
  70.162      have c_d: "cbox a b \<subseteq> cbox c d"
  70.163        apply safe
  70.164        apply (drule B(2))
  70.165 @@ -8300,8 +8298,8 @@
  70.166        then have "0 < norm (y - i)"
  70.167          by auto
  70.168        from as[rule_format,OF this] guess C ..  note C=conjunctD2[OF this,rule_format]
  70.169 -      def c \<equiv> "(\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)::'n"
  70.170 -      def d \<equiv> "(\<Sum>i\<in>Basis. max B C *\<^sub>R i)::'n"
  70.171 +      define c :: 'n where "c = (\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)"
  70.172 +      define d :: 'n where "d = (\<Sum>i\<in>Basis. max B C *\<^sub>R i)"
  70.173        have c_d: "cbox a b \<subseteq> cbox c d"
  70.174          apply safe
  70.175          apply (drule B(2))
  70.176 @@ -8895,8 +8893,8 @@
  70.177      note conjunctD2[OF this, rule_format]
  70.178      note h = this(1) and this(2)[OF *]
  70.179      from this(2) guess B2 .. note B2 = conjunctD2[OF this,rule_format]
  70.180 -    def c \<equiv> "\<Sum>i\<in>Basis. min (a\<bullet>i) (- (max B1 B2)) *\<^sub>R i::'n"
  70.181 -    def d \<equiv> "\<Sum>i\<in>Basis. max (b\<bullet>i) (max B1 B2) *\<^sub>R i::'n"
  70.182 +    define c :: 'n where "c = (\<Sum>i\<in>Basis. min (a\<bullet>i) (- (max B1 B2)) *\<^sub>R i)"
  70.183 +    define d :: 'n where "d = (\<Sum>i\<in>Basis. max (b\<bullet>i) (max B1 B2) *\<^sub>R i)"
  70.184      have *: "ball 0 B1 \<subseteq> cbox c d" "ball 0 B2 \<subseteq> cbox c d"
  70.185        apply safe
  70.186        unfolding mem_ball mem_box dist_norm
  70.187 @@ -9283,7 +9281,7 @@
  70.188      using p'(3) by fastforce
  70.189    note partial_division_of_tagged_division[OF p(1)] this
  70.190    from partial_division_extend_interval[OF this] guess q . note q=this and q' = division_ofD[OF this(2)]
  70.191 -  def r \<equiv> "q - snd ` p"
  70.192 +  define r where "r = q - snd ` p"
  70.193    have "snd ` p \<inter> r = {}"
  70.194      unfolding r_def by auto
  70.195    have r: "finite r"
  70.196 @@ -9567,7 +9565,7 @@
  70.197    fixes x :: "'a::ring_1"
  70.198    shows "(1 - x) * setsum (\<lambda>i. x^i) {0 .. n} = (1 - x^(Suc n))"
  70.199  proof -
  70.200 -  def y \<equiv> "1 - x"
  70.201 +  define y where "y = 1 - x"
  70.202    have "y * (\<Sum>i=0..n. (1 - y) ^ i) = 1 - (1 - y) ^ Suc n"
  70.203      by (induct n) (simp_all add: algebra_simps)
  70.204    then show ?thesis
  70.205 @@ -9745,8 +9743,7 @@
  70.206          done
  70.207      qed
  70.208      from bchoice[OF this] guess m .. note m=conjunctD2[OF this[rule_format],rule_format]
  70.209 -    def d \<equiv> "\<lambda>x. c (m x) x"
  70.210 -
  70.211 +    define d where "d x = c (m x) x" for x
  70.212      show ?case
  70.213        apply (rule_tac x=d in exI)
  70.214      proof safe
  70.215 @@ -10548,7 +10545,7 @@
  70.216        assume "p tagged_division_of (cbox a b)" and "?g fine p"
  70.217        note p = this(1) conjunctD2[OF this(2)[unfolded fine_inter]]
  70.218        note p' = tagged_division_ofD[OF p(1)]
  70.219 -      def p' \<equiv> "{(x,k) | x k. \<exists>i l. x \<in> i \<and> i \<in> d \<and> (x,l) \<in> p \<and> k = i \<inter> l}"
  70.220 +      define p' where "p' = {(x,k) | x k. \<exists>i l. x \<in> i \<and> i \<in> d \<and> (x,l) \<in> p \<and> k = i \<inter> l}"
  70.221        have gp': "g fine p'"
  70.222          using p(2)
  70.223          unfolding p'_def fine_def
  70.224 @@ -10705,7 +10702,7 @@
  70.225          proof (rule setsum_mono, goal_cases)
  70.226            case k: (1 k)
  70.227            from d'(4)[OF this] guess u v by (elim exE) note uv=this
  70.228 -          def d' \<equiv> "{cbox u v \<inter> l |l. l \<in> snd ` p \<and>  cbox u v \<inter> l \<noteq> {}}"
  70.229 +          define d' where "d' = {cbox u v \<inter> l |l. l \<in> snd ` p \<and>  cbox u v \<inter> l \<noteq> {}}"
  70.230            note uvab = d'(2)[OF k[unfolded uv]]
  70.231            have "d' division_of cbox u v"
  70.232              apply (subst d'_def)
  70.233 @@ -11609,8 +11606,8 @@
  70.234    obtains X0 where "x0 \<in> X0" "open X0"
  70.235      "\<forall>x\<in>X0 \<inter> U. \<forall>t \<in> C. dist (fx (x, t)) (fx (x0, t)) \<le> e"
  70.236  proof -
  70.237 -  def psi \<equiv> "\<lambda>(x, t). dist (fx (x, t)) (fx (x0, t))"
  70.238 -  def W0 \<equiv> "{(x, t) \<in> U \<times> C. psi (x, t) < e}"
  70.239 +  define psi where "psi = (\<lambda>(x, t). dist (fx (x, t)) (fx (x0, t)))"
  70.240 +  define W0 where "W0 = {(x, t) \<in> U \<times> C. psi (x, t) < e}"
  70.241    have W0_eq: "W0 = psi -` {..<e} \<inter> U \<times> C"
  70.242      by (auto simp: vimage_def W0_def)
  70.243    have "open {..<e}" by simp
  70.244 @@ -11668,7 +11665,7 @@
  70.245    proof (safe intro!: tendstoI)
  70.246      fix e'::real and x
  70.247      assume "e' > 0"
  70.248 -    def e \<equiv> "e' / (content (cbox a b) + 1)"
  70.249 +    define e where "e = e' / (content (cbox a b) + 1)"
  70.250      have "e > 0" using \<open>e' > 0\<close> by (auto simp: e_def intro!: divide_pos_pos add_nonneg_pos)
  70.251      assume "x \<in> U"
  70.252      from continuous_on_prod_compactE[OF cont_fx compact_cbox \<open>x \<in> U\<close> \<open>0 < e\<close>]
  70.253 @@ -11744,7 +11741,7 @@
  70.254      note [continuous_intros] = continuous_on_compose2[OF cont_f1]
  70.255      fix e'::real
  70.256      assume "e' > 0"
  70.257 -    def e \<equiv> "e' / (content (cbox a b) + 1)"
  70.258 +    define e where "e = e' / (content (cbox a b) + 1)"
  70.259      have "e > 0" using \<open>e' > 0\<close> by (auto simp: e_def intro!: divide_pos_pos add_nonneg_pos)
  70.260      from continuous_on_prod_compactE[OF cont_fx compact_cbox \<open>x0 \<in> U\<close> \<open>e > 0\<close>]
  70.261      obtain X0 where X0: "x0 \<in> X0" "open X0"
  70.262 @@ -11916,7 +11913,7 @@
  70.263      proof (rule tendstoI)
  70.264        fix e::real
  70.265        assume "e > 0"
  70.266 -      def e' \<equiv> "e / 2"
  70.267 +      define e' where "e' = e / 2"
  70.268        with \<open>e > 0\<close> have "e' > 0" by simp
  70.269        then have "\<forall>\<^sub>F n in F. \<forall>x\<in>cbox a b. norm (f n x - g x) < e' / content (cbox a b)"
  70.270          using u content_nonzero content_pos_le[of a b]
    71.1 --- a/src/HOL/Multivariate_Analysis/Path_Connected.thy	Sun Apr 24 21:31:14 2016 +0200
    71.2 +++ b/src/HOL/Multivariate_Analysis/Path_Connected.thy	Mon Apr 25 16:09:26 2016 +0200
    71.3 @@ -563,7 +563,7 @@
    71.4    assumes "path(g1 +++ g2)" "path g2" 
    71.5      shows "pathfinish g1 = pathstart g2"
    71.6  proof (rule ccontr)
    71.7 -  def e \<equiv> "dist (g1 1) (g2 0)"
    71.8 +  define e where "e = dist (g1 1) (g2 0)"
    71.9    assume Neg: "pathfinish g1 \<noteq> pathstart g2"
   71.10    then have "0 < dist (pathfinish g1) (pathstart g2)"
   71.11      by auto
   71.12 @@ -1934,7 +1934,7 @@
   71.13      then obtain B::real where B: "0 < B" and Bx: "norm (a - x) < B" and By: "norm (a - y) < B"
   71.14                            and "s \<subseteq> ball a B"
   71.15        using bounded_subset_ballD [OF bxy, of a] by (auto simp: dist_norm)
   71.16 -    def C == "B / norm(x - a)"
   71.17 +    define C where "C = B / norm(x - a)"
   71.18      { fix u
   71.19        assume u: "(1 - u) *\<^sub>R x + u *\<^sub>R (a + C *\<^sub>R (x - a)) \<in> s" and "0 \<le> u" "u \<le> 1"
   71.20        have CC: "1 \<le> 1 + (C - 1) * u"
   71.21 @@ -1969,7 +1969,7 @@
   71.22      }
   71.23      then have pcx: "path_component (- s) x (a + C *\<^sub>R (x - a))"
   71.24        by (force simp: closed_segment_def intro!: path_connected_linepath)
   71.25 -    def D == "B / norm(y - a)"  \<comment>\<open>massive duplication with the proof above\<close>
   71.26 +    define D where "D = B / norm(y - a)"  \<comment>\<open>massive duplication with the proof above\<close>
   71.27      { fix u
   71.28        assume u: "(1 - u) *\<^sub>R y + u *\<^sub>R (a + D *\<^sub>R (y - a)) \<in> s" and "0 \<le> u" "u \<le> 1"
   71.29        have DD: "1 \<le> 1 + (D - 1) * u"
   71.30 @@ -2531,7 +2531,7 @@
   71.31    { assume "bounded (connected_component_set (- s) z)"
   71.32      with bounded_pos_less obtain B where "B>0" and B: "\<And>x. connected_component (- s) z x \<Longrightarrow> norm x < B"
   71.33        by (metis mem_Collect_eq)
   71.34 -    def C \<equiv> "((B + 1 + norm z) / norm (z-a))"
   71.35 +    define C where "C = (B + 1 + norm z) / norm (z-a)"
   71.36      have "C > 0"
   71.37        using \<open>0 < B\<close> zna by (simp add: C_def divide_simps add_strict_increasing)
   71.38      have "\<bar>norm (z + C *\<^sub>R (z-a)) - norm (C *\<^sub>R (z-a))\<bar> \<le> norm z"
   71.39 @@ -2751,7 +2751,7 @@
   71.40        { fix \<gamma>
   71.41          assume "path \<gamma>" and pimg_sbs: "path_image \<gamma> - {pathfinish \<gamma>} \<subseteq> interior (- t)"
   71.42             and pf: "pathfinish \<gamma> \<in> frontier t" and ps: "pathstart \<gamma> = a"
   71.43 -        def c \<equiv> "pathfinish \<gamma>"
   71.44 +        define c where "c = pathfinish \<gamma>"
   71.45          have "c \<in> -s" unfolding c_def using front pf by blast
   71.46          moreover have "open (-s)" using s compact_imp_closed by blast
   71.47          ultimately obtain \<epsilon>::real where "\<epsilon> > 0" and \<epsilon>: "cball c \<epsilon> \<subseteq> -s"
   71.48 @@ -3260,8 +3260,10 @@
   71.49         and geq: "\<forall>x. k1 (1, x) = g x" "\<forall>x. k2 (0, x) = g x"
   71.50         and k12: "\<forall>x. k1 (0, x) = f x" "\<forall>x. k2 (1, x) = h x"
   71.51         and P:   "\<forall>t\<in>{0..1}. P (\<lambda>x. k1 (t, x))" "\<forall>t\<in>{0..1}. P (\<lambda>x. k2 (t, x))"
   71.52 -    def k \<equiv> "\<lambda>y. if fst y \<le> 1 / 2 then (k1 o (\<lambda>x. (2 *\<^sub>R fst x, snd x))) y
   71.53 -                                   else (k2 o (\<lambda>x. (2 *\<^sub>R fst x -1, snd x))) y"
   71.54 +    define k where "k y =
   71.55 +      (if fst y \<le> 1 / 2
   71.56 +       then (k1 o (\<lambda>x. (2 *\<^sub>R fst x, snd x))) y
   71.57 +       else (k2 o (\<lambda>x. (2 *\<^sub>R fst x -1, snd x))) y)" for y
   71.58      have keq: "k1 (2 * u, v) = k2 (2 * u - 1, v)" if "u = 1/2"  for u v
   71.59        by (simp add: geq that)
   71.60      have "continuous_on ({0..1} \<times> X) k"
    72.1 --- a/src/HOL/Multivariate_Analysis/Summation.thy	Sun Apr 24 21:31:14 2016 +0200
    72.2 +++ b/src/HOL/Multivariate_Analysis/Summation.thy	Mon Apr 25 16:09:26 2016 +0200
    72.3 @@ -142,7 +142,7 @@
    72.4    finally have "l \<ge> 0" by simp
    72.5    with l obtain l' where l': "l = ereal l'" by (cases l) simp_all
    72.6  
    72.7 -  def c \<equiv> "(1 - l') / 2"
    72.8 +  define c where "c = (1 - l') / 2"
    72.9    from l and \<open>l \<ge> 0\<close> have c: "l + c > l" "l' + c \<ge> 0" "l' + c < 1" unfolding c_def 
   72.10      by (simp_all add: field_simps l')
   72.11    have "\<forall>C>l. eventually (\<lambda>n. ereal (root n (norm (f n))) < C) sequentially"
   72.12 @@ -176,7 +176,7 @@
   72.13    also have "... \<le> l" unfolding l_def by (intro Limsup_mono) (simp_all add: real_root_ge_zero)
   72.14    finally have l_nonneg: "l \<ge> 0" by simp
   72.15  
   72.16 -  def c \<equiv> "if l = \<infinity> then 2 else 1 + (real_of_ereal l - 1) / 2"
   72.17 +  define c where "c = (if l = \<infinity> then 2 else 1 + (real_of_ereal l - 1) / 2)"
   72.18    from l l_nonneg consider "l = \<infinity>" | "\<exists>l'. l = ereal l'" by (cases l) simp_all
   72.19    hence c: "c > 1 \<and> ereal c < l" by cases (insert l, auto simp: c_def field_simps)
   72.20  
   72.21 @@ -193,7 +193,7 @@
   72.22    qed
   72.23    
   72.24    from bounded obtain K where K: "K > 0" "\<And>n. norm (f n) \<le> K" using BseqE by blast
   72.25 -  def n \<equiv> "nat \<lceil>log c K\<rceil>"
   72.26 +  define n where "n = nat \<lceil>log c K\<rceil>"
   72.27    from unbounded have "\<exists>m>n. c < root m (norm (f m))" unfolding bdd_above_def
   72.28      by (auto simp: not_le)
   72.29    then guess m by (elim exE conjE) note m = this
   72.30 @@ -253,7 +253,7 @@
   72.31    assumes nonneg: "\<And>n. f n \<ge> 0"
   72.32    shows "summable f \<longleftrightarrow> summable (\<lambda>n. 2^n * f (2^n))"
   72.33  proof -
   72.34 -  def f' \<equiv> "\<lambda>n. if n = 0 then 0 else f n"
   72.35 +  define f' where "f' n = (if n = 0 then 0 else f n)" for n
   72.36    from mono have mono': "decseq (\<lambda>n. f (Suc n))" by (intro decseq_SucI) simp
   72.37    hence mono': "f n \<le> f m" if "m \<le> n" "m > 0" for m n 
   72.38      using that decseqD[OF mono', of "m - 1" "n - 1"] by simp
   72.39 @@ -402,7 +402,7 @@
   72.40    shows   "summable f"
   72.41    unfolding summable_iff_convergent'
   72.42  proof -
   72.43 -  def r \<equiv> "(if l = \<infinity> then 1 else real_of_ereal l / 2)"
   72.44 +  define r where "r = (if l = \<infinity> then 1 else real_of_ereal l / 2)"
   72.45    from l have "r > 0 \<and> of_real r < l" by (cases l) (simp_all add: r_def)
   72.46    hence r: "r > 0" "of_real r < l" by simp_all
   72.47    hence "eventually (\<lambda>n. p n * f n / f (Suc n) - p (Suc n) > r) sequentially"
   72.48 @@ -420,7 +420,7 @@
   72.49    have "Bseq (\<lambda>n. (\<Sum>k\<le>n + Suc m. f k))"
   72.50    proof (rule BseqI')
   72.51      fix k :: nat
   72.52 -    def n \<equiv> "k + Suc m"
   72.53 +    define n where "n = k + Suc m"
   72.54      have n: "n > m" by (simp add: n_def)
   72.55  
   72.56      from r have "r * norm (\<Sum>k\<le>n. f k) = norm (\<Sum>k\<le>n. r * f k)"
   72.57 @@ -588,7 +588,7 @@
   72.58    assumes "ereal (norm z) < conv_radius f"
   72.59    shows   "summable (\<lambda>n. norm (f n * z ^ n))"
   72.60  proof (rule root_test_convergence')
   72.61 -  def l \<equiv> "limsup (\<lambda>n. ereal (root n (norm (f n))))"
   72.62 +  define l where "l = limsup (\<lambda>n. ereal (root n (norm (f n))))"
   72.63    have "0 = limsup (\<lambda>n. 0)" by (simp add: Limsup_const)
   72.64    also have "... \<le> l" unfolding l_def by (intro Limsup_mono) (simp_all add: real_root_ge_zero)
   72.65    finally have l_nonneg: "l \<ge> 0" .
   72.66 @@ -626,7 +626,7 @@
   72.67    assumes "ereal (norm z) > conv_radius f"
   72.68    shows   "\<not>summable (\<lambda>n. f n * z ^ n)"
   72.69  proof (rule root_test_divergence)
   72.70 -  def l \<equiv> "limsup (\<lambda>n. ereal (root n (norm (f n))))"
   72.71 +  define l where "l = limsup (\<lambda>n. ereal (root n (norm (f n))))"
   72.72    have "0 = limsup (\<lambda>n. 0)" by (simp add: Limsup_const)
   72.73    also have "... \<le> l" unfolding l_def by (intro Limsup_mono) (simp_all add: real_root_ge_zero)
   72.74    finally have l_nonneg: "l \<ge> 0" .
   72.75 @@ -676,7 +676,7 @@
   72.76    with conv_radius_nonneg[of f] obtain conv_radius' 
   72.77      where [simp]: "conv_radius f = ereal conv_radius'"
   72.78      by (cases "conv_radius f") simp_all
   72.79 -  def r \<equiv> "if R = \<infinity> then conv_radius' + 1 else (real_of_ereal R + conv_radius') / 2"
   72.80 +  define r where "r = (if R = \<infinity> then conv_radius' + 1 else (real_of_ereal R + conv_radius') / 2)"
   72.81    from R conv_radius_nonneg[of f] have "0 < r \<and> ereal r < R \<and> ereal r > conv_radius f" 
   72.82      unfolding r_def by (cases R) (auto simp: r_def field_simps)
   72.83    with assms(1)[of r] obtain z where "norm z > conv_radius f" "summable (\<lambda>n. f n * z^n)" by auto
   72.84 @@ -701,7 +701,8 @@
   72.85  proof (rule linorder_cases[of "conv_radius f" R])
   72.86    assume R: "conv_radius f > R"
   72.87    from R assms(1) obtain R' where R': "R = ereal R'" by (cases R) simp_all
   72.88 -  def r \<equiv> "if conv_radius f = \<infinity> then R' + 1 else (R' + real_of_ereal (conv_radius f)) / 2"
   72.89 +  define r where
   72.90 +    "r = (if conv_radius f = \<infinity> then R' + 1 else (R' + real_of_ereal (conv_radius f)) / 2)"
   72.91    from R conv_radius_nonneg[of f] have "r > R \<and> r < conv_radius f" unfolding r_def
   72.92      by (cases "conv_radius f") (auto simp: r_def field_simps R')
   72.93    with assms(1) assms(2)[of r] R' 
   72.94 @@ -749,7 +750,7 @@
   72.95  proof (rule ccontr)
   72.96    assume "conv_radius f \<noteq> 0"
   72.97    with conv_radius_nonneg[of f] have pos: "conv_radius f > 0" by simp
   72.98 -  def r \<equiv> "if conv_radius f = \<infinity> then 1 else real_of_ereal (conv_radius f) / 2"
   72.99 +  define r where "r = (if conv_radius f = \<infinity> then 1 else real_of_ereal (conv_radius f) / 2)"
  72.100    from pos have r: "ereal r > 0 \<and> ereal r < conv_radius f" 
  72.101      by (cases "conv_radius f") (simp_all add: r_def)
  72.102    hence "summable (\<lambda>n. f n * of_real r ^ n)" by (intro summable_in_conv_radius) simp
    73.1 --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Sun Apr 24 21:31:14 2016 +0200
    73.2 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Mon Apr 25 16:09:26 2016 +0200
    73.3 @@ -228,7 +228,8 @@
    73.4      "\<And>a. a \<in> A' \<Longrightarrow> open a"
    73.5      "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>a\<in>A'. a \<subseteq> S"
    73.6      by (rule first_countable_basisE) blast
    73.7 -  def A \<equiv> "(\<lambda>N. \<Inter>((\<lambda>n. from_nat_into A' n) ` N)) ` (Collect finite::nat set set)"
    73.8 +  define A where [abs_def]:
    73.9 +    "A = (\<lambda>N. \<Inter>((\<lambda>n. from_nat_into A' n) ` N)) ` (Collect finite::nat set set)"
   73.10    then show "\<exists>A. countable A \<and> (\<forall>a. a \<in> A \<longrightarrow> x \<in> a) \<and> (\<forall>a. a \<in> A \<longrightarrow> open a) \<and>
   73.11          (\<forall>S. open S \<longrightarrow> x \<in> S \<longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)) \<and> (\<forall>a b. a \<in> A \<longrightarrow> b \<in> A \<longrightarrow> a \<inter> b \<in> A)"
   73.12    proof (safe intro!: exI[where x=A])
   73.13 @@ -385,7 +386,7 @@
   73.14  instance second_countable_topology \<subseteq> first_countable_topology
   73.15  proof
   73.16    fix x :: 'a
   73.17 -  def B \<equiv> "SOME B::'a set set. countable B \<and> topological_basis B"
   73.18 +  define B :: "'a set set" where "B = (SOME B. countable B \<and> topological_basis B)"
   73.19    then have B: "countable B" "topological_basis B"
   73.20      using countable_basis is_basis
   73.21      by (auto simp: countable_basis is_basis)
   73.22 @@ -723,7 +724,7 @@
   73.23    then show ?rhs
   73.24      unfolding openin_open open_dist by blast
   73.25  next
   73.26 -  def T \<equiv> "{x. \<exists>a\<in>S. \<exists>d>0. (\<forall>y\<in>U. dist y a < d \<longrightarrow> y \<in> S) \<and> dist x a < d}"
   73.27 +  define T where "T = {x. \<exists>a\<in>S. \<exists>d>0. (\<forall>y\<in>U. dist y a < d \<longrightarrow> y \<in> S) \<and> dist x a < d}"
   73.28    have 1: "\<forall>x\<in>T. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> T"
   73.29      unfolding T_def
   73.30      apply clarsimp
   73.31 @@ -1030,7 +1031,7 @@
   73.32    assumes "e > 0"
   73.33    shows "\<exists>a b. (\<forall>i\<in>Basis. a \<bullet> i \<in> \<rat> \<and> b \<bullet> i \<in> \<rat> ) \<and> x \<in> box a b \<and> box a b \<subseteq> ball x e"
   73.34  proof -
   73.35 -  def e' \<equiv> "e / (2 * sqrt (real (DIM ('a))))"
   73.36 +  define e' where "e' = e / (2 * sqrt (real (DIM ('a))))"
   73.37    then have e: "e' > 0"
   73.38      using assms by (auto simp: DIM_positive)
   73.39    have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> y < x \<bullet> i \<and> x \<bullet> i - y < e'" (is "\<forall>i. ?th i")
   73.40 @@ -1385,9 +1386,8 @@
   73.41      bs: "set bs = Basis" "distinct bs"
   73.42      by (metis finite_distinct_list)
   73.43    from nonempty_Basis s obtain j where j: "j \<in> Basis" "s j \<in> S" by blast
   73.44 -  def y \<equiv> "rec_list
   73.45 -    (s j)
   73.46 -    (\<lambda>j _ Y. (\<Sum>i\<in>Basis. (if i = j then s i \<bullet> i else Y \<bullet> i) *\<^sub>R i))"
   73.47 +  define y where
   73.48 +    "y = rec_list (s j) (\<lambda>j _ Y. (\<Sum>i\<in>Basis. (if i = j then s i \<bullet> i else Y \<bullet> i) *\<^sub>R i))"
   73.49    have "x = (\<Sum>i\<in>Basis. (if i \<in> set bs then s i \<bullet> i else s j \<bullet> i) *\<^sub>R i)"
   73.50      using bs by (auto simp add: s(1)[symmetric] euclidean_representation)
   73.51    also have [symmetric]: "y bs = \<dots>"
   73.52 @@ -2534,7 +2534,7 @@
   73.53        "\<And>i. x \<in> A i"
   73.54        "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially"
   73.55      by blast
   73.56 -  def f \<equiv> "\<lambda>n. SOME y. y \<in> S \<and> y \<in> A n \<and> x \<noteq> y"
   73.57 +  define f where "f n = (SOME y. y \<in> S \<and> y \<in> A n \<and> x \<noteq> y)" for n
   73.58    {
   73.59      fix n
   73.60      from \<open>?lhs\<close> have "\<exists>y. y \<in> S \<and> y \<in> A n \<and> x \<noteq> y"
   73.61 @@ -3137,8 +3137,8 @@
   73.62    then obtain r where "0 < r" "\<forall>z. dist z y < r \<longrightarrow> z \<in> T"
   73.63      unfolding open_dist by fast
   73.64    (* choose point between x and y, within distance r of y. *)
   73.65 -  def k \<equiv> "min 1 (r / (2 * dist x y))"
   73.66 -  def z \<equiv> "y + scaleR k (x - y)"
   73.67 +  define k where "k = min 1 (r / (2 * dist x y))"
   73.68 +  define z where "z = y + scaleR k (x - y)"
   73.69    have z_def2: "z = x + scaleR (1 - k) (y - x)"
   73.70      unfolding z_def by (simp add: algebra_simps)
   73.71    have "dist z y < r"
   73.72 @@ -3676,7 +3676,7 @@
   73.73        "\<And>i. l \<in> A i"
   73.74        "\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially"
   73.75      by blast
   73.76 -  def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> f j \<in> A (Suc n)"
   73.77 +  define s where "s n i = (SOME j. i < j \<and> f j \<in> A (Suc n))" for n i
   73.78    {
   73.79      fix n i
   73.80      have "infinite (A (Suc n) \<inter> range f - f`{.. i})"
   73.81 @@ -3691,7 +3691,7 @@
   73.82        unfolding s_def by (auto intro: someI2_ex)
   73.83    }
   73.84    note s = this
   73.85 -  def r \<equiv> "rec_nat (s 0 0) s"
   73.86 +  define r where "r = rec_nat (s 0 0) s"
   73.87    have "subseq r"
   73.88      by (auto simp: r_def s subseq_Suc_iff)
   73.89    moreover
   73.90 @@ -3984,7 +3984,7 @@
   73.91    then have "U \<noteq> {}"
   73.92      by (auto simp: eventually_False)
   73.93  
   73.94 -  def Z \<equiv> "closure ` {A. eventually (\<lambda>x. x \<in> A) F}"
   73.95 +  define Z where "Z = closure ` {A. eventually (\<lambda>x. x \<in> A) F}"
   73.96    then have "\<forall>z\<in>Z. closed z"
   73.97      by auto
   73.98    moreover
   73.99 @@ -4018,7 +4018,7 @@
  73.100  next
  73.101    fix A
  73.102    assume A: "\<forall>a\<in>A. closed a" "\<forall>B\<subseteq>A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}" "U \<inter> \<Inter>A = {}"
  73.103 -  def F \<equiv> "INF a:insert U A. principal a"
  73.104 +  define F where "F = (INF a:insert U A. principal a)"
  73.105    have "F \<noteq> bot"
  73.106      unfolding F_def
  73.107    proof (rule INF_filter_not_bot)
  73.108 @@ -4089,8 +4089,7 @@
  73.109    fix A
  73.110    assume A: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A"
  73.111    assume *: "\<forall>A. countable A \<longrightarrow> (\<forall>a\<in>A. open a) \<longrightarrow> U \<subseteq> \<Union>A \<longrightarrow> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T)"
  73.112 -
  73.113 -  moreover def C \<equiv> "{b\<in>B. \<exists>a\<in>A. b \<inter> U \<subseteq> a}"
  73.114 +  moreover define C where "C = {b\<in>B. \<exists>a\<in>A. b \<inter> U \<subseteq> a}"
  73.115    ultimately have "countable C" "\<forall>a\<in>C. open a"
  73.116      unfolding C_def using ccover by auto
  73.117    moreover
  73.118 @@ -4202,7 +4201,7 @@
  73.119          by auto
  73.120        then obtain X' where T: "\<And>T. T \<subseteq> A \<Longrightarrow> finite T \<Longrightarrow> X' T \<in> U - \<Union>T"
  73.121          by metis
  73.122 -      def X \<equiv> "\<lambda>n. X' (from_nat_into A ` {.. n})"
  73.123 +      define X where "X n = X' (from_nat_into A ` {.. n})" for n
  73.124        have X: "\<And>n. X n \<in> U - (\<Union>i\<le>n. from_nat_into A i)"
  73.125          using \<open>A \<noteq> {}\<close> unfolding X_def by (intro T) (auto intro: from_nat_into)
  73.126        then have "range X \<subseteq> U"
  73.127 @@ -4249,7 +4248,7 @@
  73.128        "\<And>i. x \<in> A i"
  73.129        "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially"
  73.130      by blast
  73.131 -  def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> X j \<in> A (Suc n)"
  73.132 +  define s where "s n i = (SOME j. i < j \<and> X j \<in> A (Suc n))" for n i
  73.133    {
  73.134      fix n i
  73.135      have "\<exists>a. i < a \<and> X a \<in> A (Suc n)"
  73.136 @@ -4270,7 +4269,7 @@
  73.137        unfolding s_def by (auto intro: someI2_ex)
  73.138    }
  73.139    note s = this
  73.140 -  def r \<equiv> "rec_nat (s 0 0) s"
  73.141 +  define r where "r = rec_nat (s 0 0) s"
  73.142    have "subseq r"
  73.143      by (auto simp: r_def s subseq_Suc_iff)
  73.144    moreover
  73.145 @@ -4303,7 +4302,7 @@
  73.146      and "t \<subseteq> s"
  73.147    shows "\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t)"
  73.148  proof (rule ccontr)
  73.149 -  def C \<equiv> "(\<lambda>F. interior (F \<union> (- t))) ` {F. finite F \<and> F \<subseteq> t }"
  73.150 +  define C where "C = (\<lambda>F. interior (F \<union> (- t))) ` {F. finite F \<and> F \<subseteq> t }"
  73.151    note \<open>countably_compact s\<close>
  73.152    moreover have "\<forall>t\<in>C. open t"
  73.153      by (auto simp: C_def)
  73.154 @@ -4442,7 +4441,7 @@
  73.155    from seq_compact_imp_totally_bounded[OF \<open>seq_compact s\<close>]
  73.156    obtain f where f: "\<forall>e>0. finite (f e) \<and> f e \<subseteq> s \<and> s \<subseteq> (\<Union>x\<in>f e. ball x e)"
  73.157      unfolding choice_iff' ..
  73.158 -  def K \<equiv> "(\<lambda>(x, r). ball x r) ` ((\<Union>e \<in> \<rat> \<inter> {0 <..}. f e) \<times> \<rat>)"
  73.159 +  define K where "K = (\<lambda>(x, r). ball x r) ` ((\<Union>e \<in> \<rat> \<inter> {0 <..}. f e) \<times> \<rat>)"
  73.160    have "countably_compact s"
  73.161      using \<open>seq_compact s\<close> by (rule seq_compact_imp_countably_compact)
  73.162    then show "compact s"
  73.163 @@ -4628,11 +4627,11 @@
  73.164      then obtain l2 r2 where r2:"subseq r2" and lr2:"((\<lambda>i. f (r1 (r2 i)) proj k) \<longlongrightarrow> l2) sequentially"
  73.165        using bounded_imp_convergent_subsequence[of "\<lambda>i. f (r1 i) proj k"]
  73.166        by (auto simp: o_def)
  73.167 -    def r \<equiv> "r1 \<circ> r2"
  73.168 +    define r where "r = r1 \<circ> r2"
  73.169      have r:"subseq r"
  73.170        using r1 and r2 unfolding r_def o_def subseq_def by auto
  73.171      moreover
  73.172 -    def l \<equiv> "unproj (\<lambda>i. if i = k then l2 else l1 proj i)::'a"
  73.173 +    define l where "l = unproj (\<lambda>i. if i = k then l2 else l1 proj i)"
  73.174      {
  73.175        fix e::real
  73.176        assume "e > 0"
  73.177 @@ -4822,9 +4821,9 @@
  73.178        fix f :: "nat \<Rightarrow> 'a"
  73.179        assume f: "\<forall>n. f n \<in> s"
  73.180  
  73.181 -      def e \<equiv> "\<lambda>n. 1 / (2 * Suc n)"
  73.182 +      define e where "e n = 1 / (2 * Suc n)" for n
  73.183        then have [simp]: "\<And>n. 0 < e n" by auto
  73.184 -      def B \<equiv> "\<lambda>n U. SOME b. infinite {n. f n \<in> b} \<and> (\<exists>x. b \<subseteq> ball x (e n) \<inter> U)"
  73.185 +      define B where "B n U = (SOME b. infinite {n. f n \<in> b} \<and> (\<exists>x. b \<subseteq> ball x (e n) \<inter> U))" for n U
  73.186        {
  73.187          fix n U
  73.188          assume "infinite {n. f n \<in> U}"
  73.189 @@ -4841,7 +4840,7 @@
  73.190        }
  73.191        note B = this
  73.192  
  73.193 -      def F \<equiv> "rec_nat (B 0 UNIV) B"
  73.194 +      define F where "F = rec_nat (B 0 UNIV) B"
  73.195        {
  73.196          fix n
  73.197          have "infinite {i. f i \<in> F n}"
  73.198 @@ -4862,7 +4861,7 @@
  73.199            by (simp add: set_eq_iff not_le conj_commute)
  73.200        qed
  73.201  
  73.202 -      def t \<equiv> "rec_nat (sel 0 0) (\<lambda>n i. sel (Suc n) i)"
  73.203 +      define t where "t = rec_nat (sel 0 0) (\<lambda>n i. sel (Suc n) i)"
  73.204        have "subseq t"
  73.205          unfolding subseq_Suc_iff by (simp add: t_def sel)
  73.206        moreover have "\<forall>i. (f \<circ> t) i \<in> s"
  73.207 @@ -5587,8 +5586,8 @@
  73.208        using choice[of "\<lambda>d x. d>0 \<longrightarrow> fst x \<in> s \<and> snd x \<in> s \<and> dist (snd x) (fst x) < d \<and> \<not> dist (f (snd x)) (f (fst x)) < e"]
  73.209        unfolding Bex_def
  73.210        by (auto simp add: dist_commute)
  73.211 -    def x \<equiv> "\<lambda>n::nat. fst (fa (inverse (real n + 1)))"
  73.212 -    def y \<equiv> "\<lambda>n::nat. snd (fa (inverse (real n + 1)))"
  73.213 +    define x where "x n = fst (fa (inverse (real n + 1)))" for n
  73.214 +    define y where "y n = snd (fa (inverse (real n + 1)))" for n
  73.215      have xyn: "\<forall>n. x n \<in> s \<and> y n \<in> s"
  73.216        and xy0: "\<forall>n. dist (x n) (y n) < inverse (real n + 1)"
  73.217        and fxy:"\<forall>n. \<not> dist (f (x n)) (f (y n)) < e"
  73.218 @@ -6552,7 +6551,8 @@
  73.219  proof (cases, safe)
  73.220    fix e :: real
  73.221    assume "0 < e" "s \<noteq> {}"
  73.222 -  def [simp]: R \<equiv> "{(y, d). y \<in> s \<and> 0 < d \<and> ball y d \<inter> s \<subseteq> {x \<in> s. f x \<in> ball (f y) (e/2) } }"
  73.223 +  define R where [simp]:
  73.224 +    "R = {(y, d). y \<in> s \<and> 0 < d \<and> ball y d \<inter> s \<subseteq> {x \<in> s. f x \<in> ball (f y) (e/2)}}"
  73.225    let ?b = "(\<lambda>(y, d). ball y (d/2))"
  73.226    have "(\<forall>r\<in>R. open (?b r))" "s \<subseteq> (\<Union>r\<in>R. ?b r)"
  73.227    proof safe
  73.228 @@ -7451,13 +7451,13 @@
  73.229  
  73.230  instance euclidean_space \<subseteq> second_countable_topology
  73.231  proof
  73.232 -  def a \<equiv> "\<lambda>f :: 'a \<Rightarrow> (real \<times> real). \<Sum>i\<in>Basis. fst (f i) *\<^sub>R i"
  73.233 +  define a where "a f = (\<Sum>i\<in>Basis. fst (f i) *\<^sub>R i)" for f :: "'a \<Rightarrow> real \<times> real"
  73.234    then have a: "\<And>f. (\<Sum>i\<in>Basis. fst (f i) *\<^sub>R i) = a f"
  73.235      by simp
  73.236 -  def b \<equiv> "\<lambda>f :: 'a \<Rightarrow> (real \<times> real). \<Sum>i\<in>Basis. snd (f i) *\<^sub>R i"
  73.237 +  define b where "b f = (\<Sum>i\<in>Basis. snd (f i) *\<^sub>R i)" for f :: "'a \<Rightarrow> real \<times> real"
  73.238    then have b: "\<And>f. (\<Sum>i\<in>Basis. snd (f i) *\<^sub>R i) = b f"
  73.239      by simp
  73.240 -  def B \<equiv> "(\<lambda>f. box (a f) (b f)) ` (Basis \<rightarrow>\<^sub>E (\<rat> \<times> \<rat>))"
  73.241 +  define B where "B = (\<lambda>f. box (a f) (b f)) ` (Basis \<rightarrow>\<^sub>E (\<rat> \<times> \<rat>))"
  73.242  
  73.243    have "Ball B open" by (simp add: B_def open_box)
  73.244    moreover have "(\<forall>A. open A \<longrightarrow> (\<exists>B'\<subseteq>B. \<Union>B' = A))"
  73.245 @@ -7655,7 +7655,7 @@
  73.246    {
  73.247      fix x
  73.248      assume as:"x \<in> cbox a b"
  73.249 -    def f \<equiv> "\<lambda>n::nat. x + (inverse (real n + 1)) *\<^sub>R (?c - x)"
  73.250 +    define f where [abs_def]: "f n = x + (inverse (real n + 1)) *\<^sub>R (?c - x)" for n
  73.251      {
  73.252        fix n
  73.253        assume fn: "f n <e b \<longrightarrow> a <e f n \<longrightarrow> f n = x" and xc: "x \<noteq> ?c"
  73.254 @@ -7712,7 +7712,7 @@
  73.255  proof -
  73.256    obtain b where "b>0" and b: "\<forall>x\<in>s. norm x \<le> b"
  73.257      using assms[unfolded bounded_pos] by auto
  73.258 -  def a \<equiv> "(\<Sum>i\<in>Basis. (b + 1) *\<^sub>R i)::'a"
  73.259 +  define a :: 'a where "a = (\<Sum>i\<in>Basis. (b + 1) *\<^sub>R i)"
  73.260    {
  73.261      fix x
  73.262      assume "x \<in> s"
  73.263 @@ -8062,7 +8062,7 @@
  73.264    assumes "compact s" "continuous_on s f"  "f ` s = t"  "inj_on f s"
  73.265    shows "\<exists>g. homeomorphism s t f g"
  73.266  proof -
  73.267 -  def g \<equiv> "\<lambda>x. SOME y. y\<in>s \<and> f y = x"
  73.268 +  define g where "g x = (SOME y. y\<in>s \<and> f y = x)" for x
  73.269    have g: "\<forall>x\<in>s. g (f x) = x"
  73.270      using assms(3) assms(4)[unfolded inj_on_def] unfolding g_def by auto
  73.271    {
  73.272 @@ -8486,7 +8486,7 @@
  73.273    have "1 - c > 0" using c by auto
  73.274  
  73.275    from s(2) obtain z0 where "z0 \<in> s" by auto
  73.276 -  def z \<equiv> "\<lambda>n. (f ^^ n) z0"
  73.277 +  define z where "z n = (f ^^ n) z0" for n
  73.278    {
  73.279      fix n :: nat
  73.280      have "z n \<in> s" unfolding z_def
  73.281 @@ -8498,7 +8498,7 @@
  73.282        then show ?case using f by auto qed
  73.283    } note z_in_s = this
  73.284  
  73.285 -  def d \<equiv> "dist (z 0) (z 1)"
  73.286 +  define d where "d = dist (z 0) (z 1)"
  73.287  
  73.288    have fzn:"\<And>n. f (z n) = z (Suc n)" unfolding z_def by auto
  73.289    {
  73.290 @@ -8608,7 +8608,7 @@
  73.291    then obtain x where "x\<in>s" and x:"(z \<longlongrightarrow> x) sequentially"
  73.292      using s(1)[unfolded compact_def complete_def, THEN spec[where x=z]] and z_in_s by auto
  73.293  
  73.294 -  def e \<equiv> "dist (f x) x"
  73.295 +  define e where "e = dist (f x) x"
  73.296    have "e = 0"
  73.297    proof (rule ccontr)
  73.298      assume "e \<noteq> 0"
    74.1 --- a/src/HOL/Multivariate_Analysis/Uniform_Limit.thy	Sun Apr 24 21:31:14 2016 +0200
    74.2 +++ b/src/HOL/Multivariate_Analysis/Uniform_Limit.thy	Mon Apr 25 16:09:26 2016 +0200
    74.3 @@ -72,7 +72,7 @@
    74.4    shows "(h \<longlongrightarrow> l) (at x within S)"
    74.5  proof (rule tendstoI)
    74.6    fix e :: real
    74.7 -  def e' \<equiv> "e/3"
    74.8 +  define e' where "e' = e/3"
    74.9    assume "0 < e"
   74.10    then have "0 < e'" by (simp add: e'_def)
   74.11    from uniform_limitD[OF uc \<open>0 < e'\<close>]
    75.1 --- a/src/HOL/Multivariate_Analysis/Weierstrass.thy	Sun Apr 24 21:31:14 2016 +0200
    75.2 +++ b/src/HOL/Multivariate_Analysis/Weierstrass.thy	Mon Apr 25 16:09:26 2016 +0200
    75.3 @@ -218,7 +218,7 @@
    75.4      have "t \<noteq> t0" using t t0 by auto
    75.5      then obtain g where g: "g \<in> R" "g t \<noteq> g t0"
    75.6        using separable t0  by (metis Diff_subset subset_eq t)
    75.7 -    def h \<equiv> "\<lambda>x. g x - g t0"
    75.8 +    define h where [abs_def]: "h x = g x - g t0" for x
    75.9      have "h \<in> R"
   75.10        unfolding h_def by (fast intro: g const diff)
   75.11      then have hsq: "(\<lambda>w. (h w)\<^sup>2) \<in> R"
   75.12 @@ -232,7 +232,7 @@
   75.13      also have "... \<le> normf (\<lambda>w. (h w)\<^sup>2)"
   75.14        using t normf_upper [where x=t] continuous [OF hsq] by force
   75.15      finally have nfp: "0 < normf (\<lambda>w. (h w)\<^sup>2)" .
   75.16 -    def p \<equiv> "\<lambda>x. (1 / normf (\<lambda>w. (h w)\<^sup>2)) * (h x)^2"
   75.17 +    define p where [abs_def]: "p x = (1 / normf (\<lambda>w. (h w)\<^sup>2)) * (h x)^2" for x
   75.18      have "p \<in> R"
   75.19        unfolding p_def by (fast intro: hsq const mult)
   75.20      moreover have "p t0 = 0"
   75.21 @@ -266,7 +266,7 @@
   75.22      using t1 by auto
   75.23    then have cardp: "card subU > 0" using subU
   75.24      by (simp add: card_gt_0_iff)
   75.25 -  def p \<equiv> "\<lambda>x. (1 / card subU) * (\<Sum>t \<in> subU. pf t x)"
   75.26 +  define p where [abs_def]: "p x = (1 / card subU) * (\<Sum>t \<in> subU. pf t x)" for x
   75.27    have pR: "p \<in> R"
   75.28      unfolding p_def using subU pf by (fast intro: pf const mult setsum)
   75.29    have pt0 [simp]: "p t0 = 0"
   75.30 @@ -307,7 +307,7 @@
   75.31      by (auto simp: elim!: openE)
   75.32    then have pt_delta: "\<And>x. x \<in> s-U \<Longrightarrow> p x \<ge> delta0"
   75.33      by (force simp: ball_def dist_norm dest: p01)
   75.34 -  def \<delta> \<equiv> "delta0/2"
   75.35 +  define \<delta> where "\<delta> = delta0/2"
   75.36    have "delta0 \<le> 1" using delta0 p01 [of t1] t1
   75.37        by (force simp: ball_def dist_norm dest: p01)
   75.38    with delta0 have \<delta>01: "0 < \<delta>" "\<delta> < 1"
   75.39 @@ -318,7 +318,7 @@
   75.40      by (rule open_Collect_less_Int [OF continuous [OF pR] continuous_on_const])
   75.41    then obtain V where V: "open V" "V \<inter> s = {x\<in>s. p x < \<delta>/2}"
   75.42      by blast
   75.43 -  def k \<equiv> "nat\<lfloor>1/\<delta>\<rfloor> + 1"
   75.44 +  define k where "k = nat\<lfloor>1/\<delta>\<rfloor> + 1"
   75.45    have "k>0"  by (simp add: k_def)
   75.46    have "k-1 \<le> 1/\<delta>"
   75.47      using \<delta>01 by (simp add: k_def)
   75.48 @@ -331,7 +331,7 @@
   75.49      using \<delta>01 unfolding k_def by linarith
   75.50    with \<delta>01 k2\<delta> have k\<delta>: "1 < k*\<delta>" "k*\<delta> < 2"
   75.51      by (auto simp: divide_simps)
   75.52 -  def q \<equiv> "\<lambda>n t. (1 - p t ^ n) ^ (k^n)"
   75.53 +  define q where [abs_def]: "q n t = (1 - p t ^ n) ^ (k^n)" for n t
   75.54    have qR: "q n \<in> R" for n
   75.55      by (simp add: q_def const diff power pR)
   75.56    have q01: "\<And>n t. t \<in> s \<Longrightarrow> q n t \<in> {0..1}"
   75.57 @@ -387,7 +387,8 @@
   75.58        by (fastforce simp: field_simps)
   75.59      finally have "q n t \<le> (1 / (real k * \<delta>)) ^ n " .
   75.60    } note limitNonU = this
   75.61 -  def NN \<equiv> "\<lambda>e. 1 + nat \<lceil>max (ln e / ln (real k * \<delta> / 2)) (- ln e / ln (real k * \<delta>))\<rceil>"
   75.62 +  define NN
   75.63 +    where "NN e = 1 + nat \<lceil>max (ln e / ln (real k * \<delta> / 2)) (- ln e / ln (real k * \<delta>))\<rceil>" for e
   75.64    have NN: "of_nat (NN e) > ln e / ln (real k * \<delta> / 2)"  "of_nat (NN e) > - ln e / ln (real k * \<delta>)"
   75.65                if "0<e" for e
   75.66        unfolding NN_def  by linarith+
   75.67 @@ -464,7 +465,7 @@
   75.68           "\<And>w. w \<in> A \<Longrightarrow> ff w \<in> R \<and> ff w ` s \<subseteq> {0..1} \<and>
   75.69                           (\<forall>x \<in> s \<inter> Vf w. ff w x < e / card subA) \<and> (\<forall>x \<in> s \<inter> B. ff w x > 1 - e / card subA)"
   75.70      by metis
   75.71 -  def pff \<equiv> "\<lambda>x. (\<Prod>w \<in> subA. ff w x)"
   75.72 +  define pff where [abs_def]: "pff x = (\<Prod>w \<in> subA. ff w x)" for x
   75.73    have pffR: "pff \<in> R"
   75.74      unfolding pff_def using subA ff by (auto simp: intro: setprod)
   75.75    moreover
   75.76 @@ -559,9 +560,9 @@
   75.77        and e: "0 < e" "e < 1/3"
   75.78    shows "\<exists>g \<in> R. \<forall>x\<in>s. \<bar>f x - g x\<bar> < 2*e"
   75.79  proof -
   75.80 -  def n \<equiv> "1 + nat \<lceil>normf f / e\<rceil>"
   75.81 -  def A \<equiv> "\<lambda>j::nat. {x \<in> s. f x \<le> (j - 1/3)*e}"
   75.82 -  def B \<equiv> "\<lambda>j::nat. {x \<in> s. f x \<ge> (j + 1/3)*e}"
   75.83 +  define n where "n = 1 + nat \<lceil>normf f / e\<rceil>"
   75.84 +  define A where "A j = {x \<in> s. f x \<le> (j - 1/3)*e}" for j :: nat
   75.85 +  define B where "B j = {x \<in> s. f x \<ge> (j + 1/3)*e}" for j :: nat
   75.86    have ngt: "(n-1) * e \<ge> normf f" "n\<ge>1"
   75.87      using e
   75.88      apply (simp_all add: n_def field_simps of_nat_Suc)
   75.89 @@ -591,7 +592,7 @@
   75.90                     and xfA: "\<And>x j. x \<in> A j \<Longrightarrow> xf j x < e/n"
   75.91                     and xfB: "\<And>x j. x \<in> B j \<Longrightarrow> xf j x > 1 - e/n"
   75.92      by metis
   75.93 -  def g \<equiv> "\<lambda>x. e * (\<Sum>i\<le>n. xf i x)"
   75.94 +  define g where [abs_def]: "g x = e * (\<Sum>i\<le>n. xf i x)" for x
   75.95    have gR: "g \<in> R"
   75.96      unfolding g_def by (fast intro: mult const setsum xfR)
   75.97    have gge0: "\<And>x. x \<in> s \<Longrightarrow> g x \<ge> 0"
   75.98 @@ -606,7 +607,7 @@
   75.99      done
  75.100    { fix t
  75.101      assume t: "t \<in> s"
  75.102 -    def j \<equiv> "LEAST j. t \<in> A j"
  75.103 +    define j where "j = (LEAST j. t \<in> A j)"
  75.104      have jn: "j \<le> n"
  75.105        using t An by (simp add: Least_le j_def)
  75.106      have Aj: "t \<in> A j"
    76.1 --- a/src/HOL/Multivariate_Analysis/ex/Approximations.thy	Sun Apr 24 21:31:14 2016 +0200
    76.2 +++ b/src/HOL/Multivariate_Analysis/ex/Approximations.thy	Mon Apr 25 16:09:26 2016 +0200
    76.3 @@ -89,7 +89,7 @@
    76.4    assumes "n > 0" "0 \<le> x" "x < 2"
    76.5    shows   "exp (x::real) - (\<Sum>k<n. x^k / fact k) \<in> {0..(2 * x^n / (2 - x)) / fact n}"
    76.6  proof (unfold atLeastAtMost_iff, safe)
    76.7 -  def approx \<equiv> "(\<Sum>k<n. x^k / fact k)"
    76.8 +  define approx where "approx = (\<Sum>k<n. x^k / fact k)"
    76.9    have "(\<lambda>k. x^k / fact k) sums exp x"
   76.10      using exp_converges[of x] by (simp add: field_simps)
   76.11    from sums_split_initial_segment[OF this, of n]
   76.12 @@ -323,10 +323,12 @@
   76.13    shows   "abs (euler_mascheroni - approx :: real) < e"
   76.14    (is "abs (_ - ?approx) < ?e")
   76.15  proof -
   76.16 -  def l \<equiv> "47388813395531028639296492901910937/82101866951584879688289000000000000 :: real"
   76.17 -  def u \<equiv> "142196984054132045946501548559032969 / 246305600854754639064867000000000000 :: real"
   76.18 +  define l :: real
   76.19 +    where "l = 47388813395531028639296492901910937/82101866951584879688289000000000000"
   76.20 +  define u :: real
   76.21 +    where "u = 142196984054132045946501548559032969 / 246305600854754639064867000000000000"
   76.22    have impI: "P \<longrightarrow> Q" if Q for P Q using that by blast
   76.23 -  have hsum_63: "harm 63 = (310559566510213034489743057 / 65681493561267903750631200 ::real)"
   76.24 +  have hsum_63: "harm 63 = (310559566510213034489743057 / 65681493561267903750631200 :: real)"
   76.25      by (simp add: harm_expand)
   76.26    from harm_Suc[of 63] have hsum_64: "harm 64 =
   76.27            623171679694215690971693339 / (131362987122535807501262400::real)"
   76.28 @@ -368,7 +370,7 @@
   76.29    assumes x: "0 \<le> x" "x < 1" and n: "even n"
   76.30    shows   "arctan x - arctan_approx n x \<in> {0..x^(2*n+1) / (1-x^4)}"
   76.31  proof -
   76.32 -  def c \<equiv> "\<lambda>k. 1 / (1+(4*real k + 2*real n)) - x\<^sup>2 / (3+(4*real k + 2*real n))"
   76.33 +  define c where "c k = 1 / (1+(4*real k + 2*real n)) - x\<^sup>2 / (3+(4*real k + 2*real n))" for k
   76.34    from assms have "(\<lambda>k. (-1) ^ k * (1 / real (k * 2 + 1) * x^(k*2+1))) sums arctan x"
   76.35      using arctan_series' by simp
   76.36    also have "(\<lambda>k. (-1) ^ k * (1 / real (k * 2 + 1) * x^(k*2+1))) =
   76.37 @@ -559,11 +561,13 @@
   76.38  text \<open>We can now approximate pi to 22 decimals within a fraction of a second.\<close>
   76.39  lemma pi_approx_75: "abs (pi - 3.1415926535897932384626 :: real) \<le> inverse (10^22)"
   76.40  proof -
   76.41 -  def a \<equiv> "8295936325956147794769600190539918304 / 2626685325478320010006427764892578125 :: real"
   76.42 -  def b \<equiv> "8428294561696506782041394632 / 503593538783547230635598424135 :: real"
   76.43 +  define a :: real
   76.44 +    where "a = 8295936325956147794769600190539918304 / 2626685325478320010006427764892578125"
   76.45 +  define b :: real
   76.46 +    where "b = 8428294561696506782041394632 / 503593538783547230635598424135"
   76.47    \<comment> \<open>The introduction of this constant prevents the simplifier from applying solvers that
   76.48        we don't want. We want it to simply evaluate the terms to rational constants.}\<close>
   76.49 -  def eq \<equiv> "op = :: real \<Rightarrow> real \<Rightarrow> bool"
   76.50 +  define eq :: "real \<Rightarrow> real \<Rightarrow> bool" where "eq = op ="
   76.51  
   76.52    \<comment> \<open>Splitting the computation into several steps has the advantage that simplification can
   76.53        be done in parallel\<close>
   76.54 @@ -664,15 +668,18 @@
   76.55    "abs (pi - 3.141592653589793238462643383279502884197169399375105821 :: real) \<le> inverse (10^54)"
   76.56    (is "abs (pi - ?pi') \<le> _")
   76.57  proof -
   76.58 -  def a \<equiv> "2829469759662002867886529831139137601191652261996513014734415222704732791803 /
   76.59 -           1062141879292765061960538947347721564047051545995266466660439319087625011200 :: real"
   76.60 -  def b \<equiv> "13355545553549848714922837267299490903143206628621657811747118592 /
   76.61 -           23792006023392488526789546722992491355941103837356113731091180925 :: real"
   76.62 -  def c \<equiv> "28274063397213534906669125255762067746830085389618481175335056 /
   76.63 -           337877029279505250241149903214554249587517250716358486542628059 :: real"
   76.64 +  define a :: real
   76.65 +    where "a = 2829469759662002867886529831139137601191652261996513014734415222704732791803 /
   76.66 +           1062141879292765061960538947347721564047051545995266466660439319087625011200"
   76.67 +  define b :: real
   76.68 +    where "b = 13355545553549848714922837267299490903143206628621657811747118592 /
   76.69 +           23792006023392488526789546722992491355941103837356113731091180925"
   76.70 +  define c :: real
   76.71 +    where "c = 28274063397213534906669125255762067746830085389618481175335056 /
   76.72 +           337877029279505250241149903214554249587517250716358486542628059"
   76.73    let ?pi'' = "3882327391761098513316067116522233897127356523627918964967729040413954225768920394233198626889767468122598417405434625348404038165437924058179155035564590497837027530349 /
   76.74                 1235783190199688165469648572769847552336447197542738425378629633275352407743112409829873464564018488572820294102599160968781449606552922108667790799771278860366957772800"
   76.75 -  def eq \<equiv> "op = :: real \<Rightarrow> real \<Rightarrow> bool"
   76.76 +  define eq :: "real \<Rightarrow> real \<Rightarrow> bool" where "eq = op ="
   76.77  
   76.78    have "abs (pi - pi_approx2 4) \<le> inverse (2^183)" by (rule pi_approx2') simp_all
   76.79    also have "pi_approx2 4 = 48 * arctan_approx 24 (1 / 18) +
    77.1 --- a/src/HOL/Nat.thy	Sun Apr 24 21:31:14 2016 +0200
    77.2 +++ b/src/HOL/Nat.thy	Mon Apr 25 16:09:26 2016 +0200
    77.3 @@ -1832,7 +1832,7 @@
    77.4  proof -
    77.5    from assms obtain q where "m = n + Suc q"
    77.6      by (auto dest: less_imp_Suc_add)
    77.7 -  moreover def r \<equiv> "Suc q"
    77.8 +  moreover define r where "r = Suc q"
    77.9    ultimately have "Suc (m - Suc n) = r" and "m = n + r"
   77.10      by simp_all
   77.11    then show ?thesis by simp
    78.1 --- a/src/HOL/Nonstandard_Analysis/HLim.thy	Sun Apr 24 21:31:14 2016 +0200
    78.2 +++ b/src/HOL/Nonstandard_Analysis/HLim.thy	Mon Apr 25 16:09:26 2016 +0200
    78.3 @@ -209,7 +209,7 @@
    78.4  done
    78.5  
    78.6  text\<open>NS continuity can be defined using NS Limit in
    78.7 -    similar fashion to standard def of continuity\<close>
    78.8 +    similar fashion to standard definition of continuity\<close>
    78.9  lemma isNSCont_NSLIM_iff: "(isNSCont f a) = (f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (f a))"
   78.10  by (blast intro: isNSCont_NSLIM NSLIM_isNSCont)
   78.11  
   78.12 @@ -236,7 +236,7 @@
   78.13  text\<open>Alternative definition of continuity\<close>
   78.14  
   78.15  (* Prove equivalence between NS limits - *)
   78.16 -(* seems easier than using standard def  *)
   78.17 +(* seems easier than using standard definition  *)
   78.18  lemma NSLIM_h_iff: "(f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L) = ((%h. f(a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S L)"
   78.19  apply (simp add: NSLIM_def, auto)
   78.20  apply (drule_tac x = "star_of a + x" in spec)
    79.1 --- a/src/HOL/NthRoot.thy	Sun Apr 24 21:31:14 2016 +0200
    79.2 +++ b/src/HOL/NthRoot.thy	Mon Apr 25 16:09:26 2016 +0200
    79.3 @@ -646,7 +646,7 @@
    79.4  
    79.5  lemma LIMSEQ_root: "(\<lambda>n. root n n) \<longlonglongrightarrow> 1"
    79.6  proof -
    79.7 -  def x \<equiv> "\<lambda>n. root n n - 1"
    79.8 +  define x where "x n = root n n - 1" for n
    79.9    have "x \<longlonglongrightarrow> sqrt 0"
   79.10    proof (rule tendsto_sandwich[OF _ _ tendsto_const])
   79.11      show "(\<lambda>x. sqrt (2 / x)) \<longlonglongrightarrow> sqrt 0"
   79.12 @@ -684,7 +684,7 @@
   79.13    shows "(\<lambda>n. root n c) \<longlonglongrightarrow> 1"
   79.14  proof -
   79.15    { fix c :: real assume "1 \<le> c"
   79.16 -    def x \<equiv> "\<lambda>n. root n c - 1"
   79.17 +    define x where "x n = root n c - 1" for n
   79.18      have "x \<longlonglongrightarrow> 0"
   79.19      proof (rule tendsto_sandwich[OF _ _ tendsto_const])
   79.20        show "(\<lambda>n. c / n) \<longlonglongrightarrow> 0"
    80.1 --- a/src/HOL/Number_Theory/Eratosthenes.thy	Sun Apr 24 21:31:14 2016 +0200
    80.2 +++ b/src/HOL/Number_Theory/Eratosthenes.thy	Mon Apr 25 16:09:26 2016 +0200
    80.3 @@ -96,7 +96,7 @@
    80.4      with A B C show ?thesis by simp
    80.5    next
    80.6      case False
    80.7 -    def m \<equiv> "Suc n"
    80.8 +    define m where "m = Suc n"
    80.9      then have "m > 0" by simp
   80.10      from False have "n > 0" by simp
   80.11      from A obtain q where q: "Suc (Suc a) = Suc n * q" by (rule dvdE)
   80.12 @@ -133,7 +133,8 @@
   80.13        enumerate_Suc_eq in_set_enumerate_eq less_eq_dvd_minus)
   80.14  next
   80.15    case 3
   80.16 -  { def v \<equiv> "Suc m" and w \<equiv> "Suc n"
   80.17 +  { define v where "v = Suc m"
   80.18 +    define w where "w = Suc n"
   80.19      fix q
   80.20      assume "m + n \<le> q"
   80.21      then obtain r where q: "q = m + n + r" by (auto simp add: le_iff_add)
   80.22 @@ -359,7 +360,7 @@
   80.23    have "List.find (\<lambda>p. p \<ge> m) (primes_upto n) = Some (smallest_prime_beyond m)"
   80.24      if assms: "m \<le> p" "prime p" "p \<le> n" for p
   80.25    proof -
   80.26 -    def A \<equiv> "{p. p \<le> n \<and> prime p \<and> m \<le> p}"
   80.27 +    define A where "A = {p. p \<le> n \<and> prime p \<and> m \<le> p}"
   80.28      from assms have "smallest_prime_beyond m \<le> p"
   80.29        by (auto intro: smallest_prime_beyond_smallest)
   80.30      from this \<open>p \<le> n\<close> have *: "smallest_prime_beyond m \<le> n"
    81.1 --- a/src/HOL/Number_Theory/Euclidean_Algorithm.thy	Sun Apr 24 21:31:14 2016 +0200
    81.2 +++ b/src/HOL/Number_Theory/Euclidean_Algorithm.thy	Mon Apr 25 16:09:26 2016 +0200
    81.3 @@ -159,8 +159,8 @@
    81.4    next
    81.5      case True
    81.6      then obtain l\<^sub>0 where l\<^sub>0_props: "l\<^sub>0 \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l\<^sub>0)" by blast
    81.7 -    def n \<equiv> "LEAST n. \<exists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l) \<and> euclidean_size l = n"
    81.8 -    def l \<equiv> "SOME l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l) \<and> euclidean_size l = n"
    81.9 +    define n where "n = (LEAST n. \<exists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l) \<and> euclidean_size l = n)"
   81.10 +    define l where "l = (SOME l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l) \<and> euclidean_size l = n)"
   81.11      have "\<exists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l) \<and> euclidean_size l = n"
   81.12        apply (subst n_def)
   81.13        apply (rule LeastI[of _ "euclidean_size l\<^sub>0"])
    82.1 --- a/src/HOL/Number_Theory/Factorial_Ring.thy	Sun Apr 24 21:31:14 2016 +0200
    82.2 +++ b/src/HOL/Number_Theory/Factorial_Ring.thy	Mon Apr 25 16:09:26 2016 +0200
    82.3 @@ -258,7 +258,7 @@
    82.4        by (rule dvd_mult_left)
    82.5      with Suc \<open>is_prime p\<close> \<open>\<not> p dvd a\<close> have "p dvd b"
    82.6        by (simp add: prime_dvd_mult_iff)
    82.7 -    moreover def c \<equiv> "b div p"
    82.8 +    moreover define c where "c = b div p"
    82.9      ultimately have b: "b = p * c" by simp
   82.10      with * have "p * p ^ n dvd p * (a * c)"
   82.11        by (simp add: ac_simps)
   82.12 @@ -371,10 +371,10 @@
   82.13        by simp
   82.14      then have "p dvd a" and "is_prime p" and "normalize p = p" and "p \<noteq> 0"
   82.15        by (auto intro!: is_prime_not_zeroI)
   82.16 -    def n \<equiv> "Max {n. p ^ n dvd a}"
   82.17 +    define n where "n = Max {n. p ^ n dvd a}"
   82.18      then have "n > 0" and "p ^ n dvd a" and "\<not> p ^ Suc n dvd a" 
   82.19      proof -
   82.20 -      def N \<equiv> "{n. p ^ n dvd a}"
   82.21 +      define N where "N = {n. p ^ n dvd a}"
   82.22        then have n_M: "n = Max N" by (simp add: n_def)
   82.23        from is_prime_inj_power \<open>is_prime p\<close> have "inj (op ^ p)" .
   82.24        then have "inj_on (op ^ p) U" for U
   82.25 @@ -402,7 +402,7 @@
   82.26        then show "\<not> p ^ Suc n dvd a"
   82.27          by (simp add: n_M)
   82.28      qed
   82.29 -    def b \<equiv> "a div p ^ n"
   82.30 +    define b where "b = a div p ^ n"
   82.31      with \<open>p ^ n dvd a\<close> have a: "a = p ^ n * b"
   82.32        by simp
   82.33      with \<open>\<not> p ^ Suc n dvd a\<close> have "\<not> p dvd b" and "b \<noteq> 0"
   82.34 @@ -466,7 +466,7 @@
   82.35          "replicate_mset (Max {n. q ^ n dvd a}) q = replicate_mset (Max {n. q ^ n dvd b}) q"
   82.36          by simp
   82.37      qed
   82.38 -    def Q \<equiv> "the (factorization b)"
   82.39 +    define Q where "Q = the (factorization b)"
   82.40      with \<open>b \<noteq> 0\<close> have [simp]: "factorization b = Some Q"
   82.41        by simp
   82.42      from \<open>a \<noteq> 0\<close> have "factorization a =
    83.1 --- a/src/HOL/Power.thy	Sun Apr 24 21:31:14 2016 +0200
    83.2 +++ b/src/HOL/Power.thy	Mon Apr 25 16:09:26 2016 +0200
    83.3 @@ -90,7 +90,7 @@
    83.4    case 0 then show ?case by (simp add: fun_eq_iff)
    83.5  next
    83.6    case (Suc n)
    83.7 -  def g \<equiv> "\<lambda>x. f x - 1"
    83.8 +  define g where "g x = f x - 1" for x
    83.9    with Suc have "n = g x" by simp
   83.10    with Suc have "times x ^^ g x = times (x ^ g x)" by simp
   83.11    moreover from Suc g_def have "f x = g x + 1" by simp
    84.1 --- a/src/HOL/Probability/Binary_Product_Measure.thy	Sun Apr 24 21:31:14 2016 +0200
    84.2 +++ b/src/HOL/Probability/Binary_Product_Measure.thy	Mon Apr 25 16:09:26 2016 +0200
    84.3 @@ -995,7 +995,7 @@
    84.4      finally show ?thesis by (simp add: top_unique)
    84.5    next
    84.6      case False
    84.7 -    def C' \<equiv> "fst ` C"
    84.8 +    define C' where "C' = fst ` C"
    84.9      have "\<infinity> = \<integral>\<^sup>+ x. ennreal (1 / Suc n) * indicator C' x \<partial>count_space UNIV"
   84.10        using C'_def False by(simp add: nn_integral_cmult ennreal_mult_top)
   84.11      also have "\<dots> = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. ennreal (1 / Suc n) * indicator C' x * indicator {SOME y. (x, y) \<in> C} y \<partial>count_space UNIV \<partial>count_space UNIV"
    85.1 --- a/src/HOL/Probability/Bochner_Integration.thy	Sun Apr 24 21:31:14 2016 +0200
    85.2 +++ b/src/HOL/Probability/Bochner_Integration.thy	Mon Apr 25 16:09:26 2016 +0200
    85.3 @@ -24,7 +24,7 @@
    85.4    obtain D :: "'b set" where "countable D" and D: "\<And>X. open X \<Longrightarrow> X \<noteq> {} \<Longrightarrow> \<exists>d\<in>D. d \<in> X"
    85.5      by (erule countable_dense_setE)
    85.6  
    85.7 -  def e \<equiv> "from_nat_into D"
    85.8 +  define e where "e = from_nat_into D"
    85.9    { fix n x
   85.10      obtain d where "d \<in> D" and d: "d \<in> ball x (1 / Suc n)"
   85.11        using D[of "ball x (1 / Suc n)"] by auto
   85.12 @@ -34,12 +34,14 @@
   85.13        by auto }
   85.14    note e = this
   85.15  
   85.16 -  def A \<equiv> "\<lambda>m n. {x\<in>space M. dist (f x) (e n) < 1 / (Suc m) \<and> 1 / (Suc m) \<le> dist (f x) z}"
   85.17 -  def B \<equiv> "\<lambda>m. disjointed (A m)"
   85.18 +  define A where [abs_def]: "A m n =
   85.19 +    {x\<in>space M. dist (f x) (e n) < 1 / (Suc m) \<and> 1 / (Suc m) \<le> dist (f x) z}" for m n
   85.20 +  define B where [abs_def]: "B m = disjointed (A m)" for m
   85.21  
   85.22 -  def m \<equiv> "\<lambda>N x. Max {m::nat. m \<le> N \<and> x \<in> (\<Union>n\<le>N. B m n)}"
   85.23 -  def F \<equiv> "\<lambda>N::nat. \<lambda>x. if (\<exists>m\<le>N. x \<in> (\<Union>n\<le>N. B m n)) \<and> (\<exists>n\<le>N. x \<in> B (m N x) n)
   85.24 -    then e (LEAST n. x \<in> B (m N x) n) else z"
   85.25 +  define m where [abs_def]: "m N x = Max {m. m \<le> N \<and> x \<in> (\<Union>n\<le>N. B m n)}" for N x
   85.26 +  define F where [abs_def]: "F N x =
   85.27 +    (if (\<exists>m\<le>N. x \<in> (\<Union>n\<le>N. B m n)) \<and> (\<exists>n\<le>N. x \<in> B (m N x) n)
   85.28 +     then e (LEAST n. x \<in> B (m N x) n) else z)" for N x
   85.29  
   85.30    have B_imp_A[intro, simp]: "\<And>x m n. x \<in> B m n \<Longrightarrow> x \<in> A m n"
   85.31      using disjointed_subset[of "A m" for m] unfolding B_def by auto
   85.32 @@ -86,7 +88,7 @@
   85.33        then have 1: "\<exists>m\<le>N. x \<in> (\<Union>n\<le>N. B m n)" by auto
   85.34        from m[OF this] obtain n where n: "m N x \<le> N" "n \<le> N" "x \<in> B (m N x) n" by auto
   85.35        moreover
   85.36 -      def L \<equiv> "LEAST n. x \<in> B (m N x) n"
   85.37 +      define L where "L = (LEAST n. x \<in> B (m N x) n)"
   85.38        have "dist (f x) (e L) < 1 / Suc (m N x)"
   85.39        proof -
   85.40          have "x \<in> B (m N x) L"
   85.41 @@ -175,7 +177,7 @@
   85.42      sup: "\<And>x. (SUP i. U i x) = ennreal (u x)"
   85.43      by blast
   85.44  
   85.45 -  def U' \<equiv> "\<lambda>i x. indicator (space M) x * enn2real (U i x)"
   85.46 +  define U' where [abs_def]: "U' i x = indicator (space M) x * enn2real (U i x)" for i x
   85.47    then have U'_sf[measurable]: "\<And>i. simple_function M (U' i)"
   85.48      using U by (auto intro!: simple_function_compose1[where g=enn2real])
   85.49  
   85.50 @@ -268,7 +270,7 @@
   85.51  
   85.52    assume non_empty: "\<exists>x\<in>space M. f x \<noteq> 0"
   85.53  
   85.54 -  def m \<equiv> "Min (f`space M - {0})"
   85.55 +  define m where "m = Min (f`space M - {0})"
   85.56    have "m \<in> f`space M - {0}"
   85.57      unfolding m_def using f non_empty by (intro Min_in) (auto simp: simple_function_def)
   85.58    then have m: "0 < m"
   85.59 @@ -730,7 +732,7 @@
   85.60    have [measurable]: "\<And>i. s i \<in> borel_measurable M"
   85.61      using s by (auto intro: borel_measurable_simple_function elim: simple_bochner_integrable.cases)
   85.62  
   85.63 -  def m \<equiv> "if space M = {} then 0 else Max ((\<lambda>x. norm (s i x))`space M)"
   85.64 +  define m where "m = (if space M = {} then 0 else Max ((\<lambda>x. norm (s i x))`space M))"
   85.65    have "finite (s i ` space M)"
   85.66      using s by (auto simp: simple_function_def simple_bochner_integrable.simps)
   85.67    then have "finite (norm ` s i ` space M)"
   85.68 @@ -1821,7 +1823,7 @@
   85.69      by (induct A rule: infinite_finite_induct) (auto intro!: add) }
   85.70    note setsum = this
   85.71  
   85.72 -  def s' \<equiv> "\<lambda>i z. indicator (space M) z *\<^sub>R s i z"
   85.73 +  define s' where [abs_def]: "s' i z = indicator (space M) z *\<^sub>R s i z" for i z
   85.74    then have s'_eq_s: "\<And>i x. x \<in> space M \<Longrightarrow> s' i x = s i x"
   85.75      by simp
   85.76  
   85.77 @@ -2600,7 +2602,8 @@
   85.78    have "\<And>i. s i \<in> measurable (N \<Otimes>\<^sub>M M) (count_space UNIV)"
   85.79      by (rule measurable_simple_function) fact
   85.80  
   85.81 -  def f' \<equiv> "\<lambda>i x. if integrable M (f x) then simple_bochner_integral M (\<lambda>y. s i (x, y)) else 0"
   85.82 +  define f' where [abs_def]: "f' i x =
   85.83 +    (if integrable M (f x) then simple_bochner_integral M (\<lambda>y. s i (x, y)) else 0)" for i x
   85.84  
   85.85    { fix i x assume "x \<in> space N"
   85.86      then have "simple_bochner_integral M (\<lambda>y. s i (x, y)) =
    86.1 --- a/src/HOL/Probability/Borel_Space.thy	Sun Apr 24 21:31:14 2016 +0200
    86.2 +++ b/src/HOL/Probability/Borel_Space.thy	Mon Apr 25 16:09:26 2016 +0200
    86.3 @@ -282,34 +282,35 @@
    86.4    assumes "a \<le> b" "(c::real) \<le> d" "{c..d} \<subseteq> {g a..g b}"
    86.5    obtains c' d' where "{a..b} \<inter> g -` {c..d} = {c'..d'}" "c' \<le> d'" "g c' = c" "g d' = d"
    86.6  proof-
    86.7 -    let ?A = "{a..b} \<inter> g -` {c..d}"
    86.8 -    from IVT'[of g a c b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5)
    86.9 -         obtain c'' where c'': "c'' \<in> ?A" "g c'' = c" by auto
   86.10 -    from IVT'[of g a d b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5)
   86.11 -         obtain d'' where d'': "d'' \<in> ?A" "g d'' = d" by auto
   86.12 -    hence [simp]: "?A \<noteq> {}" by blast
   86.13 +  let ?A = "{a..b} \<inter> g -` {c..d}"
   86.14 +  from IVT'[of g a c b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5)
   86.15 +  obtain c'' where c'': "c'' \<in> ?A" "g c'' = c" by auto
   86.16 +  from IVT'[of g a d b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5)
   86.17 +  obtain d'' where d'': "d'' \<in> ?A" "g d'' = d" by auto
   86.18 +  hence [simp]: "?A \<noteq> {}" by blast
   86.19  
   86.20 -    def c' \<equiv> "Inf ?A" and d' \<equiv> "Sup ?A"
   86.21 -    have "?A \<subseteq> {c'..d'}" unfolding c'_def d'_def
   86.22 -        by (intro subsetI) (auto intro: cInf_lower cSup_upper)
   86.23 -    moreover from assms have "closed ?A"
   86.24 -        using continuous_on_closed_vimage[of "{a..b}" g] by (subst Int_commute) simp
   86.25 -    hence c'd'_in_set: "c' \<in> ?A" "d' \<in> ?A" unfolding c'_def d'_def
   86.26 -        by ((intro closed_contains_Inf closed_contains_Sup, simp_all)[])+
   86.27 -    hence "{c'..d'} \<subseteq> ?A" using assms
   86.28 -        by (intro subsetI)
   86.29 -           (auto intro!: order_trans[of c "g c'" "g x" for x] order_trans[of "g x" "g d'" d for x]
   86.30 -                 intro!: mono)
   86.31 -    moreover have "c' \<le> d'" using c'd'_in_set(2) unfolding c'_def by (intro cInf_lower) auto
   86.32 -    moreover have "g c' \<le> c" "g d' \<ge> d"
   86.33 -      apply (insert c'' d'' c'd'_in_set)
   86.34 -      apply (subst c''(2)[symmetric])
   86.35 -      apply (auto simp: c'_def intro!: mono cInf_lower c'') []
   86.36 -      apply (subst d''(2)[symmetric])
   86.37 -      apply (auto simp: d'_def intro!: mono cSup_upper d'') []
   86.38 -      done
   86.39 -    with c'd'_in_set have "g c' = c" "g d' = d" by auto
   86.40 -    ultimately show ?thesis using that by blast
   86.41 +  define c' where "c' = Inf ?A"
   86.42 +  define d' where "d' = Sup ?A"
   86.43 +  have "?A \<subseteq> {c'..d'}" unfolding c'_def d'_def
   86.44 +    by (intro subsetI) (auto intro: cInf_lower cSup_upper)
   86.45 +  moreover from assms have "closed ?A"
   86.46 +    using continuous_on_closed_vimage[of "{a..b}" g] by (subst Int_commute) simp
   86.47 +  hence c'd'_in_set: "c' \<in> ?A" "d' \<in> ?A" unfolding c'_def d'_def
   86.48 +    by ((intro closed_contains_Inf closed_contains_Sup, simp_all)[])+
   86.49 +  hence "{c'..d'} \<subseteq> ?A" using assms
   86.50 +    by (intro subsetI)
   86.51 +       (auto intro!: order_trans[of c "g c'" "g x" for x] order_trans[of "g x" "g d'" d for x]
   86.52 +             intro!: mono)
   86.53 +  moreover have "c' \<le> d'" using c'd'_in_set(2) unfolding c'_def by (intro cInf_lower) auto
   86.54 +  moreover have "g c' \<le> c" "g d' \<ge> d"
   86.55 +    apply (insert c'' d'' c'd'_in_set)
   86.56 +    apply (subst c''(2)[symmetric])
   86.57 +    apply (auto simp: c'_def intro!: mono cInf_lower c'') []
   86.58 +    apply (subst d''(2)[symmetric])
   86.59 +    apply (auto simp: d'_def intro!: mono cSup_upper d'') []
   86.60 +    done
   86.61 +  with c'd'_in_set have "g c' = c" "g d' = d" by auto
   86.62 +  ultimately show ?thesis using that by blast
   86.63  qed
   86.64  
   86.65  subsection \<open>Generic Borel spaces\<close>
   86.66 @@ -540,7 +541,7 @@
   86.67        by (auto simp: topological_basis_def)
   86.68      from B(2)[OF K] obtain m where m: "\<And>k. k \<in> K \<Longrightarrow> m k \<subseteq> B" "\<And>k. k \<in> K \<Longrightarrow> (\<Union>m k) = k"
   86.69        by metis
   86.70 -    def U \<equiv> "(\<Union>k\<in>K. m k)"
   86.71 +    define U where "U = (\<Union>k\<in>K. m k)"
   86.72      with m have "countable U"
   86.73        by (intro countable_subset[OF _ \<open>countable B\<close>]) auto
   86.74      have "\<Union>U = (\<Union>A\<in>U. A)" by simp
   86.75 @@ -1811,7 +1812,7 @@
   86.76    assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M"
   86.77    shows "(\<lambda>x. lim (\<lambda>i. f i x)) \<in> borel_measurable M"
   86.78  proof -
   86.79 -  def u' \<equiv> "\<lambda>x. lim (\<lambda>i. if Cauchy (\<lambda>i. f i x) then f i x else 0)"
   86.80 +  define u' where "u' x = lim (\<lambda>i. if Cauchy (\<lambda>i. f i x) then f i x else 0)" for x
   86.81    then have *: "\<And>x. lim (\<lambda>i. f i x) = (if Cauchy (\<lambda>i. f i x) then u' x else (THE x. False))"
   86.82      by (auto simp: lim_def convergent_eq_cauchy[symmetric])
   86.83    have "u' \<in> borel_measurable M"
    87.1 --- a/src/HOL/Probability/Caratheodory.thy	Sun Apr 24 21:31:14 2016 +0200
    87.2 +++ b/src/HOL/Probability/Caratheodory.thy	Mon Apr 25 16:09:26 2016 +0200
    87.3 @@ -372,7 +372,7 @@
    87.4        and Ble: "\<And>n. (\<Sum>i. f (B n i)) \<le> ?O (A n) + e * (1/2)^(Suc n)"
    87.5        by (metis less_imp_le outer_measure_close[OF *])
    87.6  
    87.7 -    def C \<equiv> "case_prod B o prod_decode"
    87.8 +    define C where "C = case_prod B o prod_decode"
    87.9      from B have B_in_M: "\<And>i j. B i j \<in> M"
   87.10        by (rule range_subsetD)
   87.11      then have C: "range C \<subseteq> M"
   87.12 @@ -469,7 +469,7 @@
   87.13    have inc: "increasing M f"
   87.14      by (metis additive_increasing ca countably_additive_additive posf)
   87.15    let ?O = "outer_measure M f"
   87.16 -  def ls \<equiv> "lambda_system \<Omega> (Pow \<Omega>) ?O"
   87.17 +  define ls where "ls = lambda_system \<Omega> (Pow \<Omega>) ?O"
   87.18    have mls: "measure_space \<Omega> ls ?O"
   87.19      using sigma_algebra.caratheodory_lemma
   87.20              [OF sigma_algebra_Pow outer_measure_space_outer_measure [OF posf inc]]
   87.21 @@ -660,7 +660,7 @@
   87.22        have "F' i \<inter> F' j = {}"
   87.23          by auto }
   87.24      note F'_disj = this
   87.25 -    def F \<equiv> "\<lambda>i. if i < card C then F' i else {}"
   87.26 +    define F where "F i = (if i < card C then F' i else {})" for i
   87.27      then have "disjoint_family F"
   87.28        using F'_disj by (auto simp: disjoint_family_on_def)
   87.29      moreover from F' have "(\<Union>i. F i) = \<Union>C"
   87.30 @@ -704,7 +704,7 @@
   87.31      from generated_ringE[OF Un_A] guess C' . note C' = this
   87.32  
   87.33      { fix c assume "c \<in> C'"
   87.34 -      moreover def A \<equiv> "\<lambda>i. A' i \<inter> c"
   87.35 +      moreover define A where [abs_def]: "A i = A' i \<inter> c" for i
   87.36        ultimately have A: "range A \<subseteq> generated_ring" "disjoint_family A"
   87.37          and Un_A: "(\<Union>i. A i) \<in> generated_ring"
   87.38          using A' C'
   87.39 @@ -722,7 +722,7 @@
   87.40          have "\<exists>F'. bij_betw F' {..<card C} C"
   87.41            by (rule finite_same_card_bij[OF _ \<open>finite C\<close>]) auto
   87.42          then guess F .. note F = this
   87.43 -        def f \<equiv> "\<lambda>i. if i < card C then F i else {}"
   87.44 +        define f where [abs_def]: "f i = (if i < card C then F i else {})" for i
   87.45          then have f: "bij_betw f {..< card C} C"
   87.46            by (intro bij_betw_cong[THEN iffD1, OF _ F]) auto
   87.47          with C have "\<forall>j. f j \<in> M"
    88.1 --- a/src/HOL/Probability/Central_Limit_Theorem.thy	Sun Apr 24 21:31:14 2016 +0200
    88.2 +++ b/src/HOL/Probability/Central_Limit_Theorem.thy	Mon Apr 25 16:09:26 2016 +0200
    88.3 @@ -24,8 +24,8 @@
    88.4    shows "weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (n * \<sigma>\<^sup>2))) std_normal_distribution"
    88.5  proof -
    88.6    let ?S' = "\<lambda>n x. S n x / sqrt (real n * \<sigma>\<^sup>2)"
    88.7 -  def \<phi> \<equiv> "\<lambda>n. char (distr M borel (?S' n))"
    88.8 -  def \<psi> \<equiv> "\<lambda>n t. char \<mu> (t / sqrt (\<sigma>\<^sup>2 * n))"
    88.9 +  define \<phi> where "\<phi> n = char (distr M borel (?S' n))" for n
   88.10 +  define \<psi> where "\<psi> n t = char \<mu> (t / sqrt (\<sigma>\<^sup>2 * n))" for n t
   88.11  
   88.12    have X_rv [simp, measurable]: "\<And>n. random_variable borel (X n)"
   88.13      using X_indep unfolding indep_vars_def2 by simp
   88.14 @@ -48,7 +48,7 @@
   88.15      hence n: "n \<ge> t^2 / 4" by (subst nat_ceiling_le_eq [symmetric])
   88.16      let ?t = "t / sqrt (\<sigma>\<^sup>2 * n)"
   88.17  
   88.18 -    def \<psi>' \<equiv> "\<lambda>n i. char (distr M borel (\<lambda>x. X i x / sqrt (\<sigma>\<^sup>2 * n)))"
   88.19 +    define \<psi>' where "\<psi>' n i = char (distr M borel (\<lambda>x. X i x / sqrt (\<sigma>\<^sup>2 * n)))" for n i
   88.20      have *: "\<And>n i t. \<psi>' n i t = \<psi> n t"
   88.21        unfolding \<psi>_def \<psi>'_def char_def
   88.22        by (subst X_distrib [symmetric]) (auto simp: integral_distr)
    89.1 --- a/src/HOL/Probability/Characteristic_Functions.thy	Sun Apr 24 21:31:14 2016 +0200
    89.2 +++ b/src/HOL/Probability/Characteristic_Functions.thy	Mon Apr 25 16:09:26 2016 +0200
    89.3 @@ -308,7 +308,7 @@
    89.4    have integ_iexp: "integrable M (\<lambda>x. iexp (t * x))"
    89.5      by (intro integrable_const_bound) auto
    89.6    
    89.7 -  def c \<equiv> "\<lambda>k x. (ii * t)^k / fact k * complex_of_real (x^k)"
    89.8 +  define c where [abs_def]: "c k x = (ii * t)^k / fact k * complex_of_real (x^k)" for k x
    89.9    have integ_c: "\<And>k. k \<le> n \<Longrightarrow> integrable M (\<lambda>x. c k x)"
   89.10      unfolding c_def by (intro integrable_mult_right integrable_of_real integrable_moments)
   89.11    
   89.12 @@ -343,7 +343,7 @@
   89.13    have integ_iexp: "integrable M (\<lambda>x. iexp (t * x))"
   89.14      by (intro integrable_const_bound) auto
   89.15    
   89.16 -  def c \<equiv> "\<lambda>k x. (ii * t)^k / fact k * complex_of_real (x^k)"
   89.17 +  define c where [abs_def]: "c k x = (ii * t)^k / fact k * complex_of_real (x^k)" for k x
   89.18    have integ_c: "\<And>k. k \<le> n \<Longrightarrow> integrable M (\<lambda>x. c k x)"
   89.19      unfolding c_def by (intro integrable_mult_right integrable_of_real integrable_moments)
   89.20  
    90.1 --- a/src/HOL/Probability/Distributions.thy	Sun Apr 24 21:31:14 2016 +0200
    90.2 +++ b/src/HOL/Probability/Distributions.thy	Mon Apr 25 16:09:26 2016 +0200
    90.3 @@ -1216,7 +1216,7 @@
    90.4    shows "(\<lambda>x. \<integral>\<^sup>+y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) =
    90.5      normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2))"  (is "?LHS = ?RHS")
    90.6  proof -
    90.7 -  def \<sigma>' \<equiv> "\<sigma>\<^sup>2" and \<tau>' \<equiv> "\<tau>\<^sup>2"
    90.8 +  define \<sigma>' \<tau>' where "\<sigma>' = \<sigma>\<^sup>2" and "\<tau>' = \<tau>\<^sup>2"
    90.9    then have [simp, arith]: "0 < \<sigma>'" "0 < \<tau>'"
   90.10      by simp_all
   90.11    let ?\<sigma> = "sqrt ((\<sigma>' * \<tau>') / (\<sigma>' + \<tau>'))"
    91.1 --- a/src/HOL/Probability/Fin_Map.thy	Sun Apr 24 21:31:14 2016 +0200
    91.2 +++ b/src/HOL/Probability/Fin_Map.thy	Mon Apr 25 16:09:26 2016 +0200
    91.3 @@ -467,12 +467,12 @@
    91.4    assume "Cauchy P"
    91.5    then obtain Nd where Nd: "\<And>n. n \<ge> Nd \<Longrightarrow> dist (P n) (P Nd) < 1"
    91.6      by (force simp: cauchy)
    91.7 -  def d \<equiv> "domain (P Nd)"
    91.8 +  define d where "d = domain (P Nd)"
    91.9    with Nd have dim: "\<And>n. n \<ge> Nd \<Longrightarrow> domain (P n) = d" using dist_le_1_imp_domain_eq by auto
   91.10    have [simp]: "finite d" unfolding d_def by simp
   91.11 -  def p \<equiv> "\<lambda>i n. (P n) i"
   91.12 -  def q \<equiv> "\<lambda>i. lim (p i)"
   91.13 -  def Q \<equiv> "finmap_of d q"
   91.14 +  define p where "p i n = P n i" for i n
   91.15 +  define q where "q i = lim (p i)" for i
   91.16 +  define Q where "Q = finmap_of d q"
   91.17    have q: "\<And>i. i \<in> d \<Longrightarrow> q i = Q i" by (auto simp add: Q_def Abs_finmap_inverse)
   91.18    {
   91.19      fix i assume "i \<in> d"
   91.20 @@ -505,7 +505,7 @@
   91.21        from p[OF \<open>i \<in> d\<close>, THEN metric_LIMSEQ_D, OF \<open>0 < e\<close>]
   91.22        show "\<exists>no. \<forall>n\<ge>no. dist (p i n) (q i) < e" .
   91.23      qed then guess ni .. note ni = this
   91.24 -    def N \<equiv> "max Nd (Max (ni ` d))"
   91.25 +    define N where "N = max Nd (Max (ni ` d))"
   91.26      show "\<exists>N. \<forall>n\<ge>N. dist (P n) Q < e"
   91.27      proof (safe intro!: exI[where x="N"])
   91.28        fix n assume "N \<le> n"
   91.29 @@ -602,7 +602,7 @@
   91.30      thus "\<exists>y. x i \<in> y \<and> y \<subseteq> a i \<and> y \<in> basis_proj" by auto
   91.31    qed
   91.32    then guess B .. note B = this
   91.33 -  def B' \<equiv> "Pi' (domain x) (\<lambda>i. (B i)::'b set)"
   91.34 +  define B' where "B' = Pi' (domain x) (\<lambda>i. (B i)::'b set)"
   91.35    have "B' \<subseteq> Pi' (domain x) a" using B by (auto intro!: Pi'_mono simp: B'_def)
   91.36    also note \<open>\<dots> \<subseteq> O'\<close>
   91.37    finally show "\<exists>B'\<in>basis_finmap. x \<in> B' \<and> B' \<subseteq> O'" using B
   91.38 @@ -1097,7 +1097,7 @@
   91.39    proof (rule sigma_fprod_algebra_sigma_eq)
   91.40      show "finite I" by simp
   91.41      show "I \<noteq> {}" by fact
   91.42 -    def S'\<equiv>"from_nat_into S"
   91.43 +    define S' where "S' = from_nat_into S"
   91.44      show "(\<Union>j. S' j) = space borel"
   91.45        using S
   91.46        apply (auto simp add: from_nat_into countable_basis_proj S'_def basis_proj_def)
    92.1 --- a/src/HOL/Probability/Finite_Product_Measure.thy	Sun Apr 24 21:31:14 2016 +0200
    92.2 +++ b/src/HOL/Probability/Finite_Product_Measure.thy	Mon Apr 25 16:09:26 2016 +0200
    92.3 @@ -440,7 +440,7 @@
    92.4      obtain S where S: "\<And>i. i \<in> j \<Longrightarrow> S i \<subseteq> E i" "\<And>i. i \<in> j \<Longrightarrow> countable (S i)"
    92.5        "\<And>i. i \<in> j \<Longrightarrow> \<Omega> i = \<Union>(S i)"
    92.6        by (metis subset_eq \<Omega>_cover \<open>j \<subseteq> I\<close>)
    92.7 -    def A' \<equiv> "\<lambda>n. n(i := A)"
    92.8 +    define A' where "A' n = n(i := A)" for n
    92.9      then have A'_i: "\<And>n. A' n i = A"
   92.10        by simp
   92.11      { fix n assume "n \<in> Pi\<^sub>E (j - {i}) S"
   92.12 @@ -804,10 +804,12 @@
   92.13    shows "P = Q"
   92.14  proof (rule measure_eqI_generator_eq[OF Int_stable_prod_algebra prod_algebra_sets_into_space])
   92.15    interpret finite_measure P by fact
   92.16 -  def i \<equiv> "SOME i. i \<in> I"
   92.17 +  define i where "i = (SOME i. i \<in> I)"
   92.18    have i: "I \<noteq> {} \<Longrightarrow> i \<in> I"
   92.19      unfolding i_def by (rule someI_ex) auto
   92.20 -  def A \<equiv> "\<lambda>n::nat. if I = {} then prod_emb I M {} (\<Pi>\<^sub>E i\<in>{}. {}) else prod_emb I M {i} (\<Pi>\<^sub>E i\<in>{i}. space (M i))"
   92.21 +  define A where "A n =
   92.22 +    (if I = {} then prod_emb I M {} (\<Pi>\<^sub>E i\<in>{}. {}) else prod_emb I M {i} (\<Pi>\<^sub>E i\<in>{i}. space (M i)))"
   92.23 +    for n :: nat
   92.24    then show "range A \<subseteq> prod_algebra I M"
   92.25      using prod_algebraI[of "{}" I "\<lambda>i. space (M i)" M] by (auto intro!: prod_algebraI i)
   92.26    have "\<And>i. A i = space (PiM I M)"
   92.27 @@ -954,7 +956,7 @@
   92.28    proof (rule measure_eqI_PiM_finite[OF I refl P, symmetric])
   92.29      show "(\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (M i)) \<Longrightarrow> (Pi\<^sub>M I M) (Pi\<^sub>E I A) = P (Pi\<^sub>E I A)" for A
   92.30        by (simp add: eq emeasure_PiM)
   92.31 -    def A \<equiv> "\<lambda>n. \<Pi>\<^sub>E i\<in>I. C i n"
   92.32 +    define A where "A n = (\<Pi>\<^sub>E i\<in>I. C i n)" for n
   92.33      with C show "range A \<subseteq> prod_algebra I M" "\<And>i. emeasure (Pi\<^sub>M I M) (A i) \<noteq> \<infinity>" "(\<Union>i. A i) = space (PiM I M)"
   92.34        by (auto intro!: prod_algebraI_finite simp: emeasure_PiM subset_eq ennreal_setprod_eq_top)
   92.35    qed
    93.1 --- a/src/HOL/Probability/Giry_Monad.thy	Sun Apr 24 21:31:14 2016 +0200
    93.2 +++ b/src/HOL/Probability/Giry_Monad.thy	Mon Apr 25 16:09:26 2016 +0200
    93.3 @@ -349,7 +349,8 @@
    93.4    have [measurable]: "F i \<in> N \<rightarrow>\<^sub>M count_space UNIV" for i
    93.5      using F(1) by (rule measurable_simple_function)
    93.6  
    93.7 -  def F' \<equiv> "\<lambda>M i. if integrable M f then integral\<^sup>L M (F i) else 0"
    93.8 +  define F' where [abs_def]:
    93.9 +    "F' M i = (if integrable M f then integral\<^sup>L M (F i) else 0)" for M i
   93.10  
   93.11    have "(\<lambda>M. F' M i) \<in> subprob_algebra N \<rightarrow>\<^sub>M borel" for i
   93.12    proof (rule measurable_cong[THEN iffD2])
    94.1 --- a/src/HOL/Probability/Helly_Selection.thy	Sun Apr 24 21:31:14 2016 +0200
    94.2 +++ b/src/HOL/Probability/Helly_Selection.thy	Mon Apr 25 16:09:26 2016 +0200
    94.3 @@ -43,7 +43,7 @@
    94.4      thus "\<exists>s'. subseq s' \<and> (\<exists>l. (\<lambda>k. f (s (s' k)) (r n)) \<longlonglongrightarrow> l)"
    94.5        by (auto simp: comp_def)
    94.6    qed
    94.7 -  def d \<equiv> "nat.diagseq"
    94.8 +  define d where "d = nat.diagseq"
    94.9    have subseq: "subseq d"
   94.10      unfolding d_def using nat.subseq_diagseq by auto
   94.11    have rat_cnv: "?P n d" for n
   94.12 @@ -86,7 +86,7 @@
   94.13    then have nonempty: "{lim (?f n) |n. x < r n} \<noteq> {}" for x
   94.14      by auto
   94.15  
   94.16 -  def F \<equiv> "\<lambda>x. Inf {lim (?f n) |n. x < r n}"
   94.17 +  define F where "F x = Inf {lim (?f n) |n. x < r n}" for x
   94.18    have F_eq: "ereal (F x) = (INF n:{n. x < r n}. ereal (lim (?f n)))" for x
   94.19      unfolding F_def by (subst ereal_Inf'[OF bdd_below nonempty]) (simp add: setcompr_eq_image)
   94.20    have mono_F: "mono F"
   94.21 @@ -160,7 +160,7 @@
   94.22    assumes \<mu>: "tight \<mu>" "subseq s"
   94.23    shows "\<exists>r M. subseq r \<and> real_distribution M \<and> weak_conv_m (\<mu> \<circ> s \<circ> r) M"
   94.24  proof -
   94.25 -  def f \<equiv> "\<lambda>k. cdf (\<mu> (s k))"
   94.26 +  define f where "f k = cdf (\<mu> (s k))" for k
   94.27    interpret \<mu>: real_distribution "\<mu> k" for k
   94.28      using \<mu> unfolding tight_def by auto
   94.29  
   94.30 @@ -275,7 +275,8 @@
   94.31      subseq: "\<And>s \<nu>. subseq s \<Longrightarrow> real_distribution \<nu> \<Longrightarrow> weak_conv_m (\<mu> \<circ> s) \<nu> \<Longrightarrow> weak_conv_m (\<mu> \<circ> s) M"
   94.32    shows "weak_conv_m \<mu> M"
   94.33  proof (rule ccontr)
   94.34 -  def f \<equiv> "\<lambda>n. cdf (\<mu> n)" and F \<equiv> "cdf M"
   94.35 +  define f where "f n = cdf (\<mu> n)" for n
   94.36 +  define F where "F = cdf M"
   94.37  
   94.38    assume "\<not> weak_conv_m \<mu> M"
   94.39    then obtain x where x: "isCont F x" "\<not> (\<lambda>n. f n x) \<longlonglongrightarrow> F x"
    95.1 --- a/src/HOL/Probability/Independent_Family.thy	Sun Apr 24 21:31:14 2016 +0200
    95.2 +++ b/src/HOL/Probability/Independent_Family.thy	Mon Apr 25 16:09:26 2016 +0200
    95.3 @@ -132,7 +132,7 @@
    95.4      then have "indep_sets (?G J) K"
    95.5      proof induct
    95.6        case (insert j J)
    95.7 -      moreover def G \<equiv> "?G J"
    95.8 +      moreover define G where "G = ?G J"
    95.9        ultimately have G: "indep_sets G K" "\<And>i. i \<in> K \<Longrightarrow> G i \<subseteq> events" and "j \<in> K"
   95.10          by (auto simp: indep_sets_def)
   95.11        let ?D = "{E\<in>events. indep_sets (G(j := {E})) K }"
   95.12 @@ -464,7 +464,7 @@
   95.13          qed }
   95.14        note L_inj = this
   95.15  
   95.16 -      def k \<equiv> "\<lambda>l. (SOME k. k \<in> K \<and> l \<in> L k)"
   95.17 +      define k where "k l = (SOME k. k \<in> K \<and> l \<in> L k)" for l
   95.18        { fix x j l assume *: "j \<in> K" "l \<in> L j"
   95.19          have "k l = j" unfolding k_def
   95.20          proof (rule some_equality)
   95.21 @@ -1265,7 +1265,7 @@
   95.22    shows "(\<integral>\<^sup>+\<omega>. (\<Prod>i\<in>I. X i \<omega>) \<partial>M) = (\<Prod>i\<in>I. \<integral>\<^sup>+\<omega>. X i \<omega> \<partial>M)"
   95.23  proof cases
   95.24    assume "I \<noteq> {}"
   95.25 -  def Y \<equiv> "\<lambda>i \<omega>. if i \<in> I then X i \<omega> else 0"
   95.26 +  define Y where [abs_def]: "Y i \<omega> = (if i \<in> I then X i \<omega> else 0)" for i \<omega>
   95.27    { fix i have "i \<in> I \<Longrightarrow> random_variable borel (X i)"
   95.28      using I(2) by (cases "i\<in>I") (auto simp: indep_vars_def) }
   95.29    note rv_X = this
   95.30 @@ -1302,7 +1302,7 @@
   95.31      and indep_vars_integrable: "integrable M (\<lambda>\<omega>. (\<Prod>i\<in>I. X i \<omega>))" (is ?int)
   95.32  proof (induct rule: case_split)
   95.33    assume "I \<noteq> {}"
   95.34 -  def Y \<equiv> "\<lambda>i \<omega>. if i \<in> I then X i \<omega> else 0"
   95.35 +  define Y where [abs_def]: "Y i \<omega> = (if i \<in> I then X i \<omega> else 0)" for i \<omega>
   95.36    { fix i have "i \<in> I \<Longrightarrow> random_variable borel (X i)"
   95.37      using I(2) by (cases "i\<in>I") (auto simp: indep_vars_def) }
   95.38    note rv_X = this[measurable]
    96.1 --- a/src/HOL/Probability/Information.thy	Sun Apr 24 21:31:14 2016 +0200
    96.2 +++ b/src/HOL/Probability/Information.thy	Mon Apr 25 16:09:26 2016 +0200
    96.3 @@ -1671,9 +1671,14 @@
    96.4    assumes X: "simple_function M X" and Y: "simple_function M Y"
    96.5    shows "\<I>(X ; X | Y) = \<H>(X | Y)"
    96.6  proof -
    96.7 -  def Py \<equiv> "\<lambda>x. if x \<in> Y`space M then measure M (Y -` {x} \<inter> space M) else 0"
    96.8 -  def Pxy \<equiv> "\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x))`space M then measure M ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M) else 0"
    96.9 -  def Pxxy \<equiv> "\<lambda>x. if x \<in> (\<lambda>x. (X x, X x, Y x))`space M then measure M ((\<lambda>x. (X x, X x, Y x)) -` {x} \<inter> space M) else 0"
   96.10 +  define Py where "Py x = (if x \<in> Y`space M then measure M (Y -` {x} \<inter> space M) else 0)" for x
   96.11 +  define Pxy where "Pxy x =
   96.12 +      (if x \<in> (\<lambda>x. (X x, Y x))`space M then measure M ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M) else 0)"
   96.13 +    for x
   96.14 +  define Pxxy where "Pxxy x =
   96.15 +      (if x \<in> (\<lambda>x. (X x, X x, Y x))`space M then measure M ((\<lambda>x. (X x, X x, Y x)) -` {x} \<inter> space M)
   96.16 +       else 0)"
   96.17 +    for x
   96.18    let ?M = "X`space M \<times> X`space M \<times> Y`space M"
   96.19  
   96.20    note XY = simple_function_Pair[OF X Y]
    97.1 --- a/src/HOL/Probability/Interval_Integral.thy	Sun Apr 24 21:31:14 2016 +0200
    97.2 +++ b/src/HOL/Probability/Interval_Integral.thy	Mon Apr 25 16:09:26 2016 +0200
    97.3 @@ -81,7 +81,7 @@
    97.4         (auto simp: incseq_def PInf)
    97.5  next
    97.6    case (real b')
    97.7 -  def d \<equiv> "b' - (if a = -\<infinity> then b' - 1 else real_of_ereal a)"
    97.8 +  define d where "d = b' - (if a = -\<infinity> then b' - 1 else real_of_ereal a)"
    97.9    with \<open>a < b\<close> have a': "0 < d"
   97.10      by (cases a) (auto simp: real)
   97.11    moreover
    98.1 --- a/src/HOL/Probability/Lebesgue_Measure.thy	Sun Apr 24 21:31:14 2016 +0200
    98.2 +++ b/src/HOL/Probability/Lebesgue_Measure.thy	Mon Apr 25 16:09:26 2016 +0200
    98.3 @@ -195,7 +195,7 @@
    98.4      then obtain a' where a'lea [arith]: "a' > a" and
    98.5        a_prop: "F a' - F a < epsilon / 2"
    98.6        by auto
    98.7 -    def S' \<equiv> "{i. l i < r i}"
    98.8 +    define S' where "S' = {i. l i < r i}"
    98.9      obtain S :: "nat set" where
   98.10        "S \<subseteq> S'" and finS: "finite S" and
   98.11        Sprop: "{a'..b} \<subseteq> (\<Union>i \<in> S. {l i<..<r i + delta i})"
    99.1 --- a/src/HOL/Probability/Measurable.thy	Sun Apr 24 21:31:14 2016 +0200
    99.2 +++ b/src/HOL/Probability/Measurable.thy	Mon Apr 25 16:09:26 2016 +0200
    99.3 @@ -559,7 +559,8 @@
    99.4    unfolding measurable_def
    99.5  proof safe
    99.6    fix X
    99.7 -  def f \<equiv> "\<lambda>x. THE i. P i x" def undef \<equiv> "THE i::'a. False"
    99.8 +  define f where "f x = (THE i. P i x)" for x
    99.9 +  define undef where "undef = (THE i::'a. False)"
   99.10    { fix i x assume "x \<in> space M" "P i x" then have "f x = i"
   99.11        unfolding f_def using unique by auto }
   99.12    note f_eq = this
   100.1 --- a/src/HOL/Probability/Measure_Space.thy	Sun Apr 24 21:31:14 2016 +0200
   100.2 +++ b/src/HOL/Probability/Measure_Space.thy	Mon Apr 25 16:09:26 2016 +0200
   100.3 @@ -567,7 +567,7 @@
   100.4      by simp
   100.5  next
   100.6    assume "infinite I"
   100.7 -  def L \<equiv> "\<lambda>n. LEAST i. i \<in> I \<and> i \<ge> n"
   100.8 +  define L where "L n = (LEAST i. i \<in> I \<and> i \<ge> n)" for n
   100.9    have L: "L n \<in> I \<and> n \<le> L n" for n
  100.10      unfolding L_def
  100.11    proof (rule LeastI_ex)
   101.1 --- a/src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy	Sun Apr 24 21:31:14 2016 +0200
   101.2 +++ b/src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy	Mon Apr 25 16:09:26 2016 +0200
   101.3 @@ -210,7 +210,8 @@
   101.4    assumes u[measurable]: "u \<in> borel_measurable M"
   101.5    shows "\<exists>f. incseq f \<and> (\<forall>i. (\<forall>x. f i x < top) \<and> simple_function M (f i)) \<and> u = (SUP i. f i)"
   101.6  proof -
   101.7 -  def f \<equiv> "\<lambda>i x. real_of_int (floor (enn2real (min i (u x)) * 2^i)) / 2^i"
   101.8 +  define f where [abs_def]:
   101.9 +    "f i x = real_of_int (floor (enn2real (min i (u x)) * 2^i)) / 2^i" for i x
  101.10  
  101.11    have [simp]: "0 \<le> f i x" for i x
  101.12      by (auto simp: f_def intro!: divide_nonneg_nonneg mult_nonneg_nonneg enn2real_nonneg)
  101.13 @@ -424,7 +425,8 @@
  101.14    assumes sf: "simple_function M f" "simple_function M g" and A: "A \<inter> space M \<in> sets M"
  101.15    shows "simple_function M (\<lambda>x. if x \<in> A then f x else g x)" (is "simple_function M ?IF")
  101.16  proof -
  101.17 -  def F \<equiv> "\<lambda>x. f -` {x} \<inter> space M" and G \<equiv> "\<lambda>x. g -` {x} \<inter> space M"
  101.18 +  define F where "F x = f -` {x} \<inter> space M" for x
  101.19 +  define G where "G x = g -` {x} \<inter> space M" for x
  101.20    show ?thesis unfolding simple_function_def
  101.21    proof safe
  101.22      have "?IF ` space M \<subseteq> f ` space M \<union> g ` space M" by auto
  101.23 @@ -1452,7 +1454,7 @@
  101.24    assumes "f \<in> measurable M (count_space UNIV)"
  101.25    shows "(\<integral>\<^sup>+x. of_nat (f x) \<partial>M) = (\<Sum>t. emeasure M {x\<in>space M. t < f x})"
  101.26  proof -
  101.27 -  def F \<equiv> "\<lambda>i. {x\<in>space M. i < f x}"
  101.28 +  define F where "F i = {x\<in>space M. i < f x}" for i
  101.29    with assms have [measurable]: "\<And>i. F i \<in> sets M"
  101.30      by auto
  101.31  
  101.32 @@ -1637,7 +1639,7 @@
  101.33    assumes f: "f \<in> measurable M (count_space UNIV)"
  101.34    shows "(\<integral>\<^sup>+ x. ennreal_of_enat (f x) \<partial>M) = (\<Sum>t. emeasure M {x \<in> space M. t < f x})"
  101.35  proof -
  101.36 -  def F \<equiv> "\<lambda>i::nat. {x\<in>space M. i < f x}"
  101.37 +  define F where "F i = {x\<in>space M. i < f x}" for i :: nat
  101.38    with assms have [measurable]: "\<And>i. F i \<in> sets M"
  101.39      by auto
  101.40  
   102.1 --- a/src/HOL/Probability/Probability_Mass_Function.thy	Sun Apr 24 21:31:14 2016 +0200
   102.2 +++ b/src/HOL/Probability/Probability_Mass_Function.thy	Mon Apr 25 16:09:26 2016 +0200
   102.3 @@ -1138,7 +1138,9 @@
   102.4        from qr obtain qr where qr: "\<And>y z. (y, z) \<in> set_pmf qr \<Longrightarrow> S y z"
   102.5          and q': "q = map_pmf fst qr" and r: "r = map_pmf snd qr" by cases auto
   102.6  
   102.7 -      def pr \<equiv> "bind_pmf pq (\<lambda>xy. bind_pmf (cond_pmf qr {yz. fst yz = snd xy}) (\<lambda>yz. return_pmf (fst xy, snd yz)))"
   102.8 +      define pr where "pr =
   102.9 +        bind_pmf pq (\<lambda>xy. bind_pmf (cond_pmf qr {yz. fst yz = snd xy})
  102.10 +          (\<lambda>yz. return_pmf (fst xy, snd yz)))"
  102.11        have pr_welldefined: "\<And>y. y \<in> q \<Longrightarrow> qr \<inter> {yz. fst yz = y} \<noteq> {}"
  102.12          by (force simp: q')
  102.13  
   103.1 --- a/src/HOL/Probability/Probability_Measure.thy	Sun Apr 24 21:31:14 2016 +0200
   103.2 +++ b/src/HOL/Probability/Probability_Measure.thy	Mon Apr 25 16:09:26 2016 +0200
   103.3 @@ -1147,7 +1147,7 @@
   103.4    show "Int_stable (range atMost :: real set set)"
   103.5      by (auto simp: Int_stable_def)
   103.6    have vimage_eq: "\<And>a. (X -` {..a} \<inter> space M) = {x\<in>space M. X x \<le> a}" by auto
   103.7 -  def A \<equiv> "\<lambda>i::nat. {.. real i}"
   103.8 +  define A where "A i = {.. real i}" for i :: nat
   103.9    then show "range A \<subseteq> range atMost" "(\<Union>i. A i) = space lborel"
  103.10      "\<And>i. emeasure (distr M lborel X) (A i) \<noteq> \<infinity>"
  103.11      by (auto simp: real_arch_simple emeasure_distr vimage_eq M_eq)
   104.1 --- a/src/HOL/Probability/Projective_Family.thy	Sun Apr 24 21:31:14 2016 +0200
   104.2 +++ b/src/HOL/Probability/Projective_Family.thy	Mon Apr 25 16:09:26 2016 +0200
   104.3 @@ -441,7 +441,8 @@
   104.4  proof (rule PF.emeasure_lim[OF J subset_UNIV X])
   104.5    fix J X' assume J[simp]: "\<And>i. finite (J i)" and X'[measurable]: "\<And>i. X' i \<in> sets (Pi\<^sub>M (J i) M)"
   104.6      and dec: "decseq (\<lambda>i. PF.emb UNIV (J i) (X' i))"
   104.7 -  def X \<equiv> "\<lambda>n. (\<Inter>i\<in>{i. J i \<subseteq> {0..< n}}. PF.emb {0..<n} (J i) (X' i)) \<inter> space (PiM {0..<n} M)"
   104.8 +  define X where "X n =
   104.9 +    (\<Inter>i\<in>{i. J i \<subseteq> {0..< n}}. PF.emb {0..<n} (J i) (X' i)) \<inter> space (PiM {0..<n} M)" for n
  104.10  
  104.11    have sets_X[measurable]: "X n \<in> sets (PiM {0..<n} M)" for n
  104.12      by (cases "{i. J i \<subseteq> {0..< n}} = {}")
  104.13 @@ -605,7 +606,8 @@
  104.14      assume inf: "infinite (\<Union>i. J i)"
  104.15      moreover have count: "countable (\<Union>i. J i)"
  104.16        using 1(3) by (auto intro: countable_finite)
  104.17 -    def f \<equiv> "from_nat_into (\<Union>i. J i)" and t \<equiv> "to_nat_on (\<Union>i. J i)"
  104.18 +    define f where "f = from_nat_into (\<Union>i. J i)"
  104.19 +    define t where "t = to_nat_on (\<Union>i. J i)"
  104.20      have ft[simp]: "x \<in> J i \<Longrightarrow> f (t x) = x" for x i
  104.21        unfolding f_def t_def using inf count by (intro from_nat_into_to_nat_on) auto
  104.22      have tf[simp]: "t (f i) = i" for i
   105.1 --- a/src/HOL/Probability/Projective_Limit.thy	Sun Apr 24 21:31:14 2016 +0200
   105.2 +++ b/src/HOL/Probability/Projective_Limit.thy	Mon Apr 25 16:09:26 2016 +0200
   105.3 @@ -117,7 +117,7 @@
   105.4      using J by (auto intro!: INF_lower2[of 0] prob_space_P[THEN prob_space.measure_le_1])
   105.5    ultimately obtain r where r: "?a = ennreal r" "0 < r" "r \<le> 1"
   105.6      by (cases "?a") (auto simp: top_unique)
   105.7 -  def Z \<equiv> "\<lambda>n. emb I (J n) (B n)"
   105.8 +  define Z where "Z n = emb I (J n) (B n)" for n
   105.9    have Z_mono: "n \<le> m \<Longrightarrow> Z m \<subseteq> Z n" for n m
  105.10      unfolding Z_def using B[THEN antimonoD, of n m] .
  105.11    have J_mono: "\<And>n m. n \<le> m \<Longrightarrow> J n \<subseteq> J m"
  105.12 @@ -133,13 +133,13 @@
  105.13      unfolding Z_def by (auto intro!: generator.intros J)
  105.14  
  105.15    have countable_UN_J: "countable (\<Union>n. J n)" by (simp add: countable_finite)
  105.16 -  def Utn \<equiv> "to_nat_on (\<Union>n. J n)"
  105.17 +  define Utn where "Utn = to_nat_on (\<Union>n. J n)"
  105.18    interpret function_to_finmap "J n" Utn "from_nat_into (\<Union>n. J n)" for n
  105.19      by unfold_locales (auto simp: Utn_def intro: from_nat_into_to_nat_on[OF countable_UN_J])
  105.20    have inj_on_Utn: "inj_on Utn (\<Union>n. J n)"
  105.21      unfolding Utn_def using countable_UN_J by (rule inj_on_to_nat_on)
  105.22    hence inj_on_Utn_J: "\<And>n. inj_on Utn (J n)" by (rule subset_inj_on) auto
  105.23 -  def P' \<equiv> "\<lambda>n. mapmeasure n (P (J n)) (\<lambda>_. borel)"
  105.24 +  define P' where "P' n = mapmeasure n (P (J n)) (\<lambda>_. borel)" for n
  105.25    interpret P': prob_space "P' n" for n
  105.26      unfolding P'_def mapmeasure_def using J
  105.27      by (auto intro!: prob_space_distr fm_measurable simp: measurable_cong_sets[OF sets_P])
  105.28 @@ -189,7 +189,7 @@
  105.29      "\<And>n. emeasure (P (J n)) (B n) - emeasure (P' n) (K' n) \<le> ennreal (2 powr - real n) * ?a"
  105.30      "\<And>n. compact (K' n)" "\<And>n. K' n \<subseteq> fm n ` B n"
  105.31      unfolding choice_iff by blast
  105.32 -  def K \<equiv> "\<lambda>n. fm n -` K' n \<inter> space (Pi\<^sub>M (J n) (\<lambda>_. borel))"
  105.33 +  define K where "K n = fm n -` K' n \<inter> space (Pi\<^sub>M (J n) (\<lambda>_. borel))" for n
  105.34    have K_sets: "\<And>n. K n \<in> sets (Pi\<^sub>M (J n) (\<lambda>_. borel))"
  105.35      unfolding K_def
  105.36      using compact_imp_closed[OF \<open>compact (K' _)\<close>]
  105.37 @@ -204,7 +204,7 @@
  105.38        using \<open>x \<in> K n\<close> K_sets sets.sets_into_space J(1,2,3)[of n] inj_on_image_mem_iff[OF inj_on_fm]
  105.39      by (metis (no_types) Int_iff K_def fm_in space_borel)
  105.40    qed
  105.41 -  def Z' \<equiv> "\<lambda>n. emb I (J n) (K n)"
  105.42 +  define Z' where "Z' n = emb I (J n) (K n)" for n
  105.43    have Z': "\<And>n. Z' n \<subseteq> Z n"
  105.44      unfolding Z'_def Z_def
  105.45    proof (rule prod_emb_mono, safe)
  105.46 @@ -228,7 +228,7 @@
  105.47    have "\<And>n. Z' n \<in> generator" using J K'(2) unfolding Z'_def
  105.48      by (auto intro!: generator.intros measurable_sets[OF fm_measurable[of _ "Collect finite"]]
  105.49               simp: K_def borel_eq_PiF_borel[symmetric] compact_imp_closed)
  105.50 -  def Y \<equiv> "\<lambda>n. \<Inter>i\<in>{1..n}. Z' i"
  105.51 +  define Y where "Y n = (\<Inter>i\<in>{1..n}. Z' i)" for n
  105.52    hence "\<And>n k. Y (n + k) \<subseteq> Y n" by (induct_tac k) (auto simp: Y_def)
  105.53    hence Y_mono: "\<And>n m. n \<le> m \<Longrightarrow> Y m \<subseteq> Y n" by (auto simp: le_iff_add)
  105.54    have Y_Z': "\<And>n. n \<ge> 1 \<Longrightarrow> Y n \<subseteq> Z' n" by (auto simp: Y_def)
   106.1 --- a/src/HOL/Probability/Radon_Nikodym.thy	Sun Apr 24 21:31:14 2016 +0200
   106.2 +++ b/src/HOL/Probability/Radon_Nikodym.thy	Mon Apr 25 16:09:26 2016 +0200
   106.3 @@ -153,7 +153,7 @@
   106.4    let ?A = "\<lambda>A. if (\<forall>B\<in>sets M. B \<subseteq> space M - A \<longrightarrow> -e < ?d B)
   106.5      then {}
   106.6      else (SOME B. B \<in> sets M \<and> B \<subseteq> space M - A \<and> ?d B \<le> -e)"
   106.7 -  def A \<equiv> "\<lambda>n. ((\<lambda>B. B \<union> ?A B) ^^ n) {}"
   106.8 +  define A where "A n = ((\<lambda>B. B \<union> ?A B) ^^ n) {}" for n
   106.9    have A_simps[simp]:
  106.10      "A 0 = {}"
  106.11      "\<And>n. A (Suc n) = (A n \<union> ?A (A n))" unfolding A_def by simp_all
  106.12 @@ -296,7 +296,8 @@
  106.13    shows "\<exists>f \<in> borel_measurable M. (\<forall>x. 0 \<le> f x) \<and> density M f = N"
  106.14  proof -
  106.15    interpret N: finite_measure N by fact
  106.16 -  def G \<equiv> "{g \<in> borel_measurable M. (\<forall>x. 0 \<le> g x) \<and> (\<forall>A\<in>sets M. (\<integral>\<^sup>+x. g x * indicator A x \<partial>M) \<le> N A)}"
  106.17 +  define G where "G =
  106.18 +    {g \<in> borel_measurable M. (\<forall>x. 0 \<le> g x) \<and> (\<forall>A\<in>sets M. (\<integral>\<^sup>+x. g x * indicator A x \<partial>M) \<le> N A)}"
  106.19    { fix f have "f \<in> G \<Longrightarrow> f \<in> borel_measurable M" by (auto simp: G_def) }
  106.20    note this[measurable_dest]
  106.21    have "(\<lambda>x. 0) \<in> G" unfolding G_def by auto
  106.22 @@ -366,7 +367,7 @@
  106.23    from choice[OF this] obtain gs where "\<And>i. gs i \<in> G" "\<And>n. integral\<^sup>N M (gs n) = ys n" by auto
  106.24    hence y_eq: "?y = (SUP i. integral\<^sup>N M (gs i))" using ys by auto
  106.25    let ?g = "\<lambda>i x. Max ((\<lambda>n. gs n x) ` {..i})"
  106.26 -  def f \<equiv> "\<lambda>x. SUP i. ?g i x"
  106.27 +  define f where [abs_def]: "f x = (SUP i. ?g i x)" for x
  106.28    let ?F = "\<lambda>A x. f x * indicator A x"
  106.29    have gs_not_empty: "\<And>i x. (\<lambda>n. gs n x) ` {..i} \<noteq> {}" by auto
  106.30    { fix i have "?g i \<in> G"
  106.31 @@ -443,7 +444,7 @@
  106.32      hence "(\<integral>\<^sup>+x. f x * indicator (space M) x \<partial>M) \<noteq> \<infinity>"
  106.33        using M'.finite_emeasure_space by (auto simp: top_unique)
  106.34      moreover
  106.35 -    def b \<equiv> "?M (space M) / emeasure M (space M) / 2"
  106.36 +    define b where "b = ?M (space M) / emeasure M (space M) / 2"
  106.37      ultimately have b: "b \<noteq> 0 \<and> 0 \<le> b \<and> b \<noteq> \<infinity>"
  106.38        by (auto simp: ennreal_divide_eq_top_iff)
  106.39      then have b: "b \<noteq> 0" "0 \<le> b" "0 < b"  "b \<noteq> \<infinity>"
  106.40 @@ -584,7 +585,7 @@
  106.41    qed
  106.42    let ?O_0 = "(\<Union>i. ?O i)"
  106.43    have "?O_0 \<in> sets M" using Q' by auto
  106.44 -  def Q \<equiv> "\<lambda>i. case i of 0 \<Rightarrow> Q' 0 | Suc n \<Rightarrow> ?O (Suc n) - ?O n"
  106.45 +  define Q where "Q i = (case i of 0 \<Rightarrow> Q' 0 | Suc n \<Rightarrow> ?O (Suc n) - ?O n)" for i
  106.46    { fix i have "Q i \<in> sets M" unfolding Q_def using Q'[of 0] by (cases i) (auto intro: O_sets) }
  106.47    note Q_sets = this
  106.48    show ?thesis
  106.49 @@ -990,7 +991,8 @@
  106.50  next
  106.51    assume AE: "AE x in M. f x \<noteq> \<infinity>"
  106.52    from sigma_finite guess Q . note Q = this
  106.53 -  def A \<equiv> "\<lambda>i. f -` (case i of 0 \<Rightarrow> {\<infinity>} | Suc n \<Rightarrow> {.. ennreal(of_nat (Suc n))}) \<inter> space M"
  106.54 +  define A where "A i =
  106.55 +    f -` (case i of 0 \<Rightarrow> {\<infinity>} | Suc n \<Rightarrow> {.. ennreal(of_nat (Suc n))}) \<inter> space M" for i
  106.56    { fix i j have "A i \<inter> Q j \<in> sets M"
  106.57      unfolding A_def using f Q
  106.58      apply (rule_tac sets.Int)
   107.1 --- a/src/HOL/Probability/Regularity.thy	Sun Apr 24 21:31:14 2016 +0200
   107.2 +++ b/src/HOL/Probability/Regularity.thy	Mon Apr 25 16:09:26 2016 +0200
   107.3 @@ -76,7 +76,8 @@
   107.4      "\<exists>K \<in> {K. K \<subseteq> space M \<and> compact K}. emeasure M (space M) \<le> emeasure M K + ennreal e"
   107.5      (is "?thesis e") if "0 < e" for e :: real
   107.6    proof -
   107.7 -    def B \<equiv> "\<lambda>n. \<Union>i\<in>{0..k e (Suc n)}. cball (from_nat_into X i) (1 / Suc n)"
   107.8 +    define B where [abs_def]:
   107.9 +      "B n = (\<Union>i\<in>{0..k e (Suc n)}. cball (from_nat_into X i) (1 / Suc n))" for n
  107.10      have "\<And>n. closed (B n)" by (auto simp: B_def)
  107.11      hence [simp]: "\<And>n. B n \<in> sets M" by (simp add: sb)
  107.12      from k[OF \<open>e > 0\<close> zero_less_Suc]
  107.13 @@ -84,7 +85,7 @@
  107.14        by (simp add: algebra_simps B_def finite_measure_compl)
  107.15      hence B_compl_le: "\<And>n::nat. measure M (space M - B n) \<le> e * 2 powr - real (Suc n)"
  107.16        by (simp add: finite_measure_compl)
  107.17 -    def K \<equiv> "\<Inter>n. B n"
  107.18 +    define K where "K = (\<Inter>n. B n)"
  107.19      from \<open>closed (B _)\<close> have "closed K" by (auto simp: K_def)
  107.20      hence [simp]: "K \<in> sets M" by (simp add: sb)
  107.21      have "measure M (space M) - measure M K = measure M (space M - K)"
   108.1 --- a/src/HOL/Probability/Sigma_Algebra.thy	Sun Apr 24 21:31:14 2016 +0200
   108.2 +++ b/src/HOL/Probability/Sigma_Algebra.thy	Mon Apr 25 16:09:26 2016 +0200
   108.3 @@ -846,7 +846,7 @@
   108.4  proof -
   108.5    from a guess Ca .. note Ca = this
   108.6    from b guess Cb .. note Cb = this
   108.7 -  def C \<equiv> "(\<lambda>(a,b). a \<inter> b)` (Ca\<times>Cb)"
   108.8 +  define C where "C = (\<lambda>(a,b). a \<inter> b)` (Ca\<times>Cb)"
   108.9    show ?thesis
  108.10    proof
  108.11      show "disjoint C"
  108.12 @@ -1971,7 +1971,7 @@
  108.13    with \<open>i\<in>I\<close> * show ?thesis
  108.14      by simp
  108.15  next
  108.16 -  def P \<equiv> "\<lambda>\<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>'"
  108.17 +  define P where "P \<mu>' \<longleftrightarrow> (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>'" for \<mu>'
  108.18    assume "\<not> (\<forall>i\<in>I. \<mu> i = 0)"
  108.19    moreover
  108.20    have "measure_space (space M) (sets M) \<mu>'"
   109.1 --- a/src/HOL/Probability/Weak_Convergence.thy	Sun Apr 24 21:31:14 2016 +0200
   109.2 +++ b/src/HOL/Probability/Weak_Convergence.thy	Mon Apr 25 16:09:26 2016 +0200
   109.3 @@ -212,11 +212,11 @@
   109.4      using emeasure_lborel_countable[OF D_countable]
   109.5      by (subst emeasure_restrict_space) auto
   109.6  
   109.7 -  def Y' \<equiv> "\<lambda>\<omega>. if \<omega> \<in> ?D then 0 else M.I \<omega>"
   109.8 +  define Y' where "Y' \<omega> = (if \<omega> \<in> ?D then 0 else M.I \<omega>)" for \<omega>
   109.9    have Y'_AE: "AE \<omega> in ?\<Omega>. Y' \<omega> = M.I \<omega>"
  109.10      by (rule AE_I [OF _ D]) (auto simp: space_restrict_space sets_restrict_space_iff Y'_def)
  109.11  
  109.12 -  def Y_seq' \<equiv> "\<lambda>n \<omega>. if \<omega> \<in> ?D then 0 else \<mu>.I n \<omega>"
  109.13 +  define Y_seq' where "Y_seq' n \<omega> = (if \<omega> \<in> ?D then 0 else \<mu>.I n \<omega>)" for n \<omega>
  109.14    have Y_seq'_AE: "\<And>n. AE \<omega> in ?\<Omega>. Y_seq' n \<omega> = \<mu>.I n \<omega>"
  109.15      by (rule AE_I [OF _ D]) (auto simp: space_restrict_space sets_restrict_space_iff Y_seq'_def)
  109.16  
   110.1 --- a/src/HOL/Probability/ex/Dining_Cryptographers.thy	Sun Apr 24 21:31:14 2016 +0200
   110.2 +++ b/src/HOL/Probability/ex/Dining_Cryptographers.thy	Mon Apr 25 16:09:26 2016 +0200
   110.3 @@ -64,7 +64,7 @@
   110.4    have foldl_coin:
   110.5      "\<not> ?XOR (\<lambda>c. coin dc c \<noteq> coin dc (c + 1)) n"
   110.6    proof -
   110.7 -    def n' \<equiv> n \<comment> "Need to hide n, as it is hidden in coin"
   110.8 +    define n' where "n' = n" \<comment> "Need to hide n, as it is hidden in coin"
   110.9      have "?XOR (\<lambda>c. coin dc c \<noteq> coin dc (c + 1)) n'
  110.10          = (coin dc 0 \<noteq> coin dc n')"
  110.11        by (induct n') auto
  110.12 @@ -81,7 +81,7 @@
  110.13    next
  110.14      assume "\<exists>k<n. payer dc = Some k"
  110.15      then obtain k where "k < n" and "payer dc = Some k" by auto
  110.16 -    def l \<equiv> n \<comment> "Need to hide n, as it is hidden in coin, payer etc."
  110.17 +    define l where "l = n" \<comment> "Need to hide n, as it is hidden in coin, payer etc."
  110.18      have "?XOR (\<lambda>c. (payer dc = Some c) \<noteq> (coin dc c \<noteq> coin dc (c + 1))) l =
  110.19          ((k < l) \<noteq> ?XOR (\<lambda>c. (coin dc c \<noteq> coin dc (c + 1))) l)"
  110.20        using \<open>payer dc = Some k\<close> by (induct l) auto
  110.21 @@ -156,7 +156,7 @@
  110.22      @{term i}.
  110.23  \<close>
  110.24  
  110.25 -  def zs \<equiv> "map (\<lambda>p. if p \<in> {min i j<..max i j} then \<not> ys ! p else ys ! p) [0..<n]"
  110.26 +  define zs where "zs = map (\<lambda>p. if p \<in> {min i j<..max i j} then \<not> ys ! p else ys ! p) [0..<n]"
  110.27    hence [simp]: "length zs = n" by simp
  110.28    hence [simp]: "0 < length zs" using n_gt_3 by simp
  110.29  
  110.30 @@ -458,7 +458,7 @@
  110.31        by (simp add: image_iff space_uniform_count_measure dc_crypto Bex_def) blast
  110.32      then have xs: "inversion (Some i, xs) \<in> inversion`dc_crypto" and i: "Some i \<in> Some ` {0..<n}"
  110.33        and x: "x = (inversion (Some i, xs), Some i)" by (simp_all add: payer_def dc_crypto)
  110.34 -    moreover def ys \<equiv> "inversion (Some i, xs)"
  110.35 +    moreover define ys where "ys = inversion (Some i, xs)"
  110.36      ultimately have ys: "ys \<in> inversion`dc_crypto"
  110.37        and "Some i \<in> Some ` {0..<n}" "x = (ys, Some i)" by simp_all
  110.38      then have "(\<lambda>x. (inversion x, payer x)) -` {x} \<inter> space (uniform_count_measure dc_crypto) =
   111.1 --- a/src/HOL/Probability/ex/Measure_Not_CCC.thy	Sun Apr 24 21:31:14 2016 +0200
   111.2 +++ b/src/HOL/Probability/ex/Measure_Not_CCC.thy	Mon Apr 25 16:09:26 2016 +0200
   111.3 @@ -106,7 +106,7 @@
   111.4      unfolding fun_eq_iff using Union.IH by metis
   111.5    show ?case
   111.6    proof (intro exI conjI)
   111.7 -    def G \<equiv> "\<lambda>j. (\<Union>i. if j \<in> J i then F i j else X i)"
   111.8 +    define G where "G j = (\<Union>i. if j \<in> J i then F i j else X i)" for j
   111.9      show "(\<Union>i. X i) \<in> sets M" "countable (\<Union>i. J i)" "G \<in> (\<Union>i. J i) \<rightarrow> sets M"
  111.10        using XFJ by (auto simp: G_def Pi_iff)
  111.11      show "UNION UNIV A = (UNIV - (\<Union>i. J i)) \<times> (\<Union>i. X i) \<union> (SIGMA j:\<Union>i. J i. \<Union>i. if j \<in> J i then F i j else X i)"
   112.1 --- a/src/HOL/Real.thy	Sun Apr 24 21:31:14 2016 +0200
   112.2 +++ b/src/HOL/Real.thy	Mon Apr 25 16:09:26 2016 +0200
   112.3 @@ -775,7 +775,7 @@
   112.4    obtain x where x: "x \<in> S" using assms(1) ..
   112.5    obtain z where z: "\<forall>x\<in>S. x \<le> z" using assms(2) ..
   112.6  
   112.7 -  def P \<equiv> "\<lambda>x. \<forall>y\<in>S. y \<le> of_rat x"
   112.8 +  define P where "P x \<longleftrightarrow> (\<forall>y\<in>S. y \<le> of_rat x)" for x
   112.9    obtain a where a: "\<not> P a"
  112.10    proof
  112.11      have "of_int \<lfloor>x - 1\<rfloor> \<le> x - 1" by (rule of_int_floor_le)
  112.12 @@ -797,11 +797,11 @@
  112.13      qed
  112.14    qed
  112.15  
  112.16 -  def avg \<equiv> "\<lambda>x y :: rat. x/2 + y/2"
  112.17 -  def bisect \<equiv> "\<lambda>(x, y). if P (avg x y) then (x, avg x y) else (avg x y, y)"
  112.18 -  def A \<equiv> "\<lambda>n. fst ((bisect ^^ n) (a, b))"
  112.19 -  def B \<equiv> "\<lambda>n. snd ((bisect ^^ n) (a, b))"
  112.20 -  def C \<equiv> "\<lambda>n. avg (A n) (B n)"
  112.21 +  define avg where "avg x y = x/2 + y/2" for x y :: rat
  112.22 +  define bisect where "bisect = (\<lambda>(x, y). if P (avg x y) then (x, avg x y) else (avg x y, y))"
  112.23 +  define A where "A n = fst ((bisect ^^ n) (a, b))" for n
  112.24 +  define B where "B n = snd ((bisect ^^ n) (a, b))" for n
  112.25 +  define C where "C n = avg (A n) (B n)" for n
  112.26    have A_0 [simp]: "A 0 = a" unfolding A_def by simp
  112.27    have B_0 [simp]: "B 0 = b" unfolding B_def by simp
  112.28    have A_Suc [simp]: "\<And>n. A (Suc n) = (if P (C n) then A n else C n)"
  112.29 @@ -1251,8 +1251,8 @@
  112.30    from \<open>x<y\<close> have "0 < y-x" by simp
  112.31    with reals_Archimedean obtain q::nat
  112.32      where q: "inverse (real q) < y-x" and "0 < q" by blast
  112.33 -  def p \<equiv> "\<lceil>y * real q\<rceil> - 1"
  112.34 -  def r \<equiv> "of_int p / real q"
  112.35 +  define p where "p = \<lceil>y * real q\<rceil> - 1"
  112.36 +  define r where "r = of_int p / real q"
  112.37    from q have "x < y - inverse (real q)" by simp
  112.38    also have "y - inverse (real q) \<le> r"
  112.39      unfolding r_def p_def
   113.1 --- a/src/HOL/Real_Vector_Spaces.thy	Sun Apr 24 21:31:14 2016 +0200
   113.2 +++ b/src/HOL/Real_Vector_Spaces.thy	Mon Apr 25 16:09:26 2016 +0200
   113.3 @@ -2070,7 +2070,7 @@
   113.4    assumes X: "Cauchy X"
   113.5    shows "convergent X"
   113.6  proof -
   113.7 -  def S \<equiv> "{x::real. \<exists>N. \<forall>n\<ge>N. x < X n}"
   113.8 +  define S :: "real set" where "S = {x. \<exists>N. \<forall>n\<ge>N. x < X n}"
   113.9    then have mem_S: "\<And>N x. \<forall>n\<ge>N. x < X n \<Longrightarrow> x \<in> S" by auto
  113.10  
  113.11    { fix N x assume N: "\<forall>n\<ge>N. X n < x"
   114.1 --- a/src/HOL/Rings.thy	Sun Apr 24 21:31:14 2016 +0200
   114.2 +++ b/src/HOL/Rings.thy	Mon Apr 25 16:09:26 2016 +0200
   114.3 @@ -847,7 +847,7 @@
   114.4      and "is_unit b" and "1 div a = b" and "1 div b = a"
   114.5      and "a * b = 1" and "c div a = c * b"
   114.6  proof (rule that)
   114.7 -  def b \<equiv> "1 div a"
   114.8 +  define b where "b = 1 div a"
   114.9    then show "1 div a = b" by simp
  114.10    from b_def \<open>is_unit a\<close> show "is_unit b" by simp
  114.11    from \<open>is_unit a\<close> and \<open>is_unit b\<close> show "a \<noteq> 0" and "b \<noteq> 0" by auto
   115.1 --- a/src/HOL/Series.thy	Sun Apr 24 21:31:14 2016 +0200
   115.2 +++ b/src/HOL/Series.thy	Mon Apr 25 16:09:26 2016 +0200
   115.3 @@ -84,7 +84,7 @@
   115.4    shows   "summable f = summable g"
   115.5  proof -
   115.6    from assms obtain N where N: "\<forall>n\<ge>N. f n = g n" by (auto simp: eventually_at_top_linorder)
   115.7 -  def C \<equiv> "(\<Sum>k<N. f k - g k)"
   115.8 +  define C where "C = (\<Sum>k<N. f k - g k)"
   115.9    from eventually_ge_at_top[of N]
  115.10      have "eventually (\<lambda>n. setsum f {..<n} = C + setsum g {..<n}) sequentially"
  115.11    proof eventually_elim
  115.12 @@ -1048,7 +1048,7 @@
  115.13    finally show "(\<lambda>n. \<Sum>k<n. f (g k)) \<longlonglongrightarrow> c" .
  115.14  next
  115.15    assume lim: "(\<lambda>n. \<Sum>k<n. f (g k)) \<longlonglongrightarrow> c"
  115.16 -  def g_inv \<equiv> "\<lambda>n. LEAST m. g m \<ge> n"
  115.17 +  define g_inv where "g_inv n = (LEAST m. g m \<ge> n)" for n
  115.18    from filterlim_subseq[OF subseq] have g_inv_ex: "\<exists>m. g m \<ge> n" for n
  115.19      by (auto simp: filterlim_at_top eventually_at_top_linorder)
  115.20    hence g_inv: "g (g_inv n) \<ge> n" for n unfolding g_inv_def by (rule LeastI_ex)
   116.1 --- a/src/HOL/Topological_Spaces.thy	Sun Apr 24 21:31:14 2016 +0200
   116.2 +++ b/src/HOL/Topological_Spaces.thy	Mon Apr 25 16:09:26 2016 +0200
   116.3 @@ -1183,7 +1183,7 @@
   116.4    from first_countable_basis[of x] obtain A :: "nat \<Rightarrow> 'a set" where
   116.5      nhds: "\<And>i. open (A i)" "\<And>i. x \<in> A i"
   116.6      and incl: "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>i. A i \<subseteq> S"  by auto
   116.7 -  def F \<equiv> "\<lambda>n. \<Inter>i\<le>n. A i"
   116.8 +  define F where "F n = (\<Inter>i\<le>n. A i)" for n
   116.9    show "\<exists>A. (\<forall>i. open (A i)) \<and> (\<forall>i. x \<in> A i) \<and>
  116.10        (\<forall>S. open S \<longrightarrow> x \<in> S \<longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially)"
  116.11    proof (safe intro!: exI[of _ F])
   117.1 --- a/src/HOL/Transcendental.thy	Sun Apr 24 21:31:14 2016 +0200
   117.2 +++ b/src/HOL/Transcendental.thy	Mon Apr 25 16:09:26 2016 +0200
   117.3 @@ -893,7 +893,7 @@
   117.4    from \<open>0 < r\<close> have "0 < ?r" by simp
   117.5  
   117.6    let ?s = "\<lambda>n. SOME s. 0 < s \<and> (\<forall> x. x \<noteq> 0 \<and> \<bar> x \<bar> < s \<longrightarrow> \<bar> ?diff n x - f' x0 n \<bar> < ?r)"
   117.7 -  def S' \<equiv> "Min (?s ` {..< ?N })"
   117.8 +  define S' where "S' = Min (?s ` {..< ?N })"
   117.9  
  117.10    have "0 < S'" unfolding S'_def
  117.11    proof (rule iffD2[OF Min_gr_iff])
  117.12 @@ -911,7 +911,7 @@
  117.13      qed
  117.14    qed auto
  117.15  
  117.16 -  def S \<equiv> "min (min (x0 - a) (b - x0)) S'"
  117.17 +  define S where "S = min (min (x0 - a) (b - x0)) S'"
  117.18    hence "0 < S" and S_a: "S \<le> x0 - a" and S_b: "S \<le> b - x0"
  117.19      and "S \<le> S'" using x0_in_I and \<open>0 < S'\<close>
  117.20      by auto
  117.21 @@ -2248,7 +2248,7 @@
  117.22    assumes "x > 0"
  117.23    shows "DERIV (\<lambda>y. log b y) x :> 1 / (ln b * x)"
  117.24  proof -
  117.25 -  def lb \<equiv> "1 / ln b"
  117.26 +  define lb where "lb = 1 / ln b"
  117.27    moreover have "DERIV (\<lambda>y. lb * ln y) x :> lb / x"
  117.28      using \<open>x > 0\<close> by (auto intro!: derivative_eq_intros)
  117.29    ultimately show ?thesis
  117.30 @@ -4769,7 +4769,7 @@
  117.31  proof (rule tendstoI)
  117.32    fix e :: real
  117.33    assume "0 < e"
  117.34 -  def y \<equiv> "pi/2 - min (pi/2) e"
  117.35 +  define y where "y = pi/2 - min (pi/2) e"
  117.36    then have y: "0 \<le> y" "y < pi/2" "pi/2 \<le> e + y"
  117.37      using \<open>0 < e\<close> by auto
  117.38  
   118.1 --- a/src/HOL/Wfrec.thy	Sun Apr 24 21:31:14 2016 +0200
   118.2 +++ b/src/HOL/Wfrec.thy	Mon Apr 25 16:09:26 2016 +0200
   118.3 @@ -37,7 +37,7 @@
   118.4  lemma wfrec_unique: assumes "adm_wf R F" "wf R" shows "\<exists>!y. wfrec_rel R F x y"
   118.5    using \<open>wf R\<close>
   118.6  proof induct
   118.7 -  def f \<equiv> "\<lambda>y. THE z. wfrec_rel R F y z"
   118.8 +  define f where "f y = (THE z. wfrec_rel R F y z)" for y
   118.9    case (less x)
  118.10    then have "\<And>y z. (y, x) \<in> R \<Longrightarrow> wfrec_rel R F y z \<longleftrightarrow> z = f y"
  118.11      unfolding f_def by (rule theI_unique)
   119.1 --- a/src/HOL/Zorn.thy	Sun Apr 24 21:31:14 2016 +0200
   119.2 +++ b/src/HOL/Zorn.thy	Mon Apr 25 16:09:26 2016 +0200
   119.3 @@ -609,7 +609,7 @@
   119.4  proof -
   119.5  \<comment> \<open>The initial segment relation on well-orders:\<close>
   119.6    let ?WO = "{r::'a rel. Well_order r}"
   119.7 -  def I \<equiv> "init_seg_of \<inter> ?WO \<times> ?WO"
   119.8 +  define I where "I = init_seg_of \<inter> ?WO \<times> ?WO"
   119.9    have I_init: "I \<subseteq> init_seg_of" by (auto simp: I_def)
  119.10    hence subch: "\<And>R. R \<in> Chains I \<Longrightarrow> chain\<^sub>\<subseteq> R"
  119.11      unfolding init_seg_of_def chain_subset_def Chains_def by blast
  119.12 @@ -732,7 +732,7 @@
  119.13    shows "\<exists>f. \<forall>x. P f x (f x)"
  119.14  proof (intro exI allI)
  119.15    fix x 
  119.16 -  def f \<equiv> "wfrec R (\<lambda>f x. SOME r. P f x r)"
  119.17 +  define f where "f \<equiv> wfrec R (\<lambda>f x. SOME r. P f x r)"
  119.18    from \<open>wf R\<close> show "P f x (f x)"
  119.19    proof (induct x)
  119.20      fix x assume "\<And>y. (y, x) \<in> R \<Longrightarrow> P f y (f y)"
   120.1 --- a/src/HOL/ex/Ballot.thy	Sun Apr 24 21:31:14 2016 +0200
   120.2 +++ b/src/HOL/ex/Ballot.thy	Mon Apr 25 16:09:26 2016 +0200
   120.3 @@ -77,13 +77,14 @@
   120.4        card {V\<in>Pow {0..<a+b}. card V = a \<and> (\<forall>m\<in>{1..a+b}. card ({0..<m} \<inter> V) > m - card ({0..<m} \<inter> V))}"
   120.5        (is "_ = card ?V")
   120.6  proof -
   120.7 -  def P \<equiv> "\<lambda>j i. i < a + b \<and> j = Suc i"
   120.8 +  define P where "P j i \<longleftrightarrow> i < a + b \<and> j = Suc i" for j i
   120.9    have unique_P: "bi_unique P" and total_P: "\<And>m. m \<le> a + b \<Longrightarrow> rel_set P {1..m} {0..<m}"
  120.10      by (auto simp add: bi_unique_def rel_set_def P_def Suc_le_eq gr0_conv_Suc)
  120.11    have rel_fun_P: "\<And>R f g. (\<And>i. i < a+b \<Longrightarrow> R (f  (Suc i)) (g i)) \<Longrightarrow> rel_fun P R f g"
  120.12      by (simp add: rel_fun_def P_def)
  120.13      
  120.14 -  def R \<equiv> "\<lambda>f V. V \<subseteq> {0..<a+b} \<and> f \<in> extensional {1..a+b} \<and> (\<forall>i<a+b. i \<in> V \<longleftrightarrow> f (Suc i) = A)"
  120.15 +  define R where "R f V \<longleftrightarrow>
  120.16 +    V \<subseteq> {0..<a+b} \<and> f \<in> extensional {1..a+b} \<and> (\<forall>i<a+b. i \<in> V \<longleftrightarrow> f (Suc i) = A)" for f V
  120.17    { fix f g :: "nat \<Rightarrow> vote" assume "f \<in> extensional {1..a + b}" "g \<in> extensional {1..a + b}" 
  120.18      moreover assume "\<forall>i<a + b. (f (Suc i) = A) = (g (Suc i) = A)"
  120.19      then have "\<forall>i<a + b. f (Suc i) = g (Suc i)"
   121.1 --- a/src/HOL/ex/Erdoes_Szekeres.thy	Sun Apr 24 21:31:14 2016 +0200
   121.2 +++ b/src/HOL/ex/Erdoes_Szekeres.thy	Mon Apr 25 16:09:26 2016 +0200
   121.3 @@ -80,7 +80,7 @@
   121.4           (\<exists>S. S \<subseteq> {0..m * n} \<and> card S = n + 1 \<and> mono_on f (op \<ge>) S)"
   121.5  proof (rule ccontr)
   121.6    let ?max_subseq = "\<lambda>R k. Max (card ` {S. S \<subseteq> {0..k} \<and> mono_on f R S \<and> k \<in> S})"
   121.7 -  def phi == "\<lambda>k. (?max_subseq (op \<le>) k, ?max_subseq (op \<ge>) k)"
   121.8 +  define phi where "phi k = (?max_subseq (op \<le>) k, ?max_subseq (op \<ge>) k)" for k
   121.9  
  121.10    have one_member: "\<And>R k. reflp R \<Longrightarrow> {k} \<in> {S. S \<subseteq> {0..k} \<and> mono_on f R S \<and> k \<in> S}" by auto
  121.11  
   122.1 --- a/src/HOL/ex/Gauge_Integration.thy	Sun Apr 24 21:31:14 2016 +0200
   122.2 +++ b/src/HOL/ex/Gauge_Integration.thy	Mon Apr 25 16:09:26 2016 +0200
   122.3 @@ -379,9 +379,10 @@
   122.4      and I2: "\<And> D. fine \<delta>2 (b,c) D \<Longrightarrow> \<bar> rsum D f - x2 \<bar> < (\<epsilon> / 2)"
   122.5      using IntegralE [OF \<open>Integral (b, c) f x2\<close> \<open>0 < \<epsilon>/2\<close>] by auto
   122.6  
   122.7 -  def \<delta> \<equiv> "\<lambda> x. if x < b then min (\<delta>1 x) (b - x)
   122.8 -           else if x = b then min (\<delta>1 b) (\<delta>2 b)
   122.9 -                         else min (\<delta>2 x) (x - b)"
  122.10 +  define \<delta> where "\<delta> x =
  122.11 +    (if x < b then min (\<delta>1 x) (b - x)
  122.12 +     else if x = b then min (\<delta>1 b) (\<delta>2 b)
  122.13 +     else min (\<delta>2 x) (x - b))" for x
  122.14  
  122.15    have "gauge {a..c} \<delta>"
  122.16      using \<delta>1_gauge \<delta>2_gauge unfolding \<delta>_def gauge_def by auto
  122.17 @@ -410,8 +411,8 @@
  122.18  
  122.19      let ?D1 = "take N D"
  122.20      let ?D2 = "drop N D"
  122.21 -    def D1 \<equiv> "take N D @ [(d, t, b)]"
  122.22 -    def D2 \<equiv> "(if b = e then [] else [(b, t, e)]) @ drop (Suc N) D"
  122.23 +    define D1 where "D1 = take N D @ [(d, t, b)]"
  122.24 +    define D2 where "D2 = (if b = e then [] else [(b, t, e)]) @ drop (Suc N) D"
  122.25  
  122.26      from hd_drop_conv_nth[OF \<open>N < length D\<close>]
  122.27      have "fst (hd ?D2) = d" using \<open>D ! N = (d, t, e)\<close> by auto
   123.1 --- a/src/HOL/ex/HarmonicSeries.thy	Sun Apr 24 21:31:14 2016 +0200
   123.2 +++ b/src/HOL/ex/HarmonicSeries.thy	Mon Apr 25 16:09:26 2016 +0200
   123.3 @@ -279,7 +279,7 @@
   123.4    assume sf: "summable ?f"
   123.5    then obtain n::nat where ndef: "n = nat \<lceil>2 * ?s\<rceil>" by simp
   123.6    then have ngt: "1 + real n/2 > ?s" by linarith
   123.7 -  def j \<equiv> "(2::nat)^n" 
   123.8 +  define j where "j = (2::nat)^n"
   123.9    have "\<forall>m\<ge>j. 0 < ?f m" by simp
  123.10    with sf have "(\<Sum>i<j. ?f i) < ?s" by (rule setsum_less_suminf)
  123.11    then have "(\<Sum>i\<in>{Suc 0..<Suc j}. 1/(real i)) < ?s"
   124.1 --- a/src/ZF/CardinalArith.thy	Sun Apr 24 21:31:14 2016 +0200
   124.2 +++ b/src/ZF/CardinalArith.thy	Mon Apr 25 16:09:26 2016 +0200
   124.3 @@ -28,7 +28,7 @@
   124.4  
   124.5  definition
   124.6    jump_cardinal :: "i=>i"  where
   124.7 -    \<comment>\<open>This def is more complex than Kunen's but it more easily proved to
   124.8 +    \<comment>\<open>This definition is more complex than Kunen's but it more easily proved to
   124.9          be a cardinal\<close>
  124.10      "jump_cardinal(K) ==
  124.11           \<Union>X\<in>Pow(K). {z. r \<in> Pow(K*K), well_ord(X,r) & z = ordertype(X,r)}"
   125.1 --- a/src/ZF/Induct/Multiset.thy	Sun Apr 24 21:31:14 2016 +0200
   125.2 +++ b/src/ZF/Induct/Multiset.thy	Mon Apr 25 16:09:26 2016 +0200
   125.3 @@ -895,7 +895,7 @@
   125.4  apply (rule multirel1_mono, auto)
   125.5  done
   125.6  
   125.7 -(* Equivalence of multirel with the usual (closure-free) def *)
   125.8 +(* Equivalence of multirel with the usual (closure-free) definition *)
   125.9  
  125.10  lemma add_diff_eq: "k \<in> nat ==> 0 < k \<longrightarrow> n #+ k #- 1 = n #+ (k #- 1)"
  125.11  by (erule nat_induct, auto)
   126.1 --- a/src/ZF/QUniv.thy	Sun Apr 24 21:31:14 2016 +0200
   126.2 +++ b/src/ZF/QUniv.thy	Mon Apr 25 16:09:26 2016 +0200
   126.3 @@ -58,7 +58,7 @@
   126.4  apply (rule Transset_eclose [THEN Transset_univ])
   126.5  done
   126.6  
   126.7 -(*Key property for proving A_subset_quniv; requires eclose in def of quniv*)
   126.8 +(*Key property for proving A_subset_quniv; requires eclose in definition of quniv*)
   126.9  lemma univ_subset_quniv: "univ(A) \<subseteq> quniv(A)"
  126.10  apply (rule arg_subset_eclose [THEN univ_mono, THEN subset_trans])
  126.11  apply (rule univ_eclose_subset_quniv)