src/HOL/Analysis/Lipschitz.thy
changeset 68838 5e013478bced
parent 68240 fa63bde6d659
child 69517 dc20f278e8f3
equal deleted inserted replaced
68837:99f0aee4adbd 68838:5e013478bced
     5 section \<open>Lipschitz continuity\<close>
     5 section \<open>Lipschitz continuity\<close>
     6 theory Lipschitz
     6 theory Lipschitz
     7   imports Borel_Space
     7   imports Borel_Space
     8 begin
     8 begin
     9 
     9 
    10 definition lipschitz_on
    10 definition%important lipschitz_on
    11   where "lipschitz_on C U f \<longleftrightarrow> (0 \<le> C \<and> (\<forall>x \<in> U. \<forall>y\<in>U. dist (f x) (f y) \<le> C * dist x y))"
    11   where "lipschitz_on C U f \<longleftrightarrow> (0 \<le> C \<and> (\<forall>x \<in> U. \<forall>y\<in>U. dist (f x) (f y) \<le> C * dist x y))"
    12 
    12 
    13 bundle lipschitz_syntax begin
    13 bundle lipschitz_syntax begin
    14 notation lipschitz_on ("_-lipschitz'_on" [1000])
    14 notation%important lipschitz_on ("_-lipschitz'_on" [1000])
    15 end
    15 end
    16 bundle no_lipschitz_syntax begin
    16 bundle no_lipschitz_syntax begin
    17 no_notation lipschitz_on ("_-lipschitz'_on" [1000])
    17 no_notation lipschitz_on ("_-lipschitz'_on" [1000])
    18 end
    18 end
    19 
    19 
   101     show ?thesis
   101     show ?thesis
   102       by (auto simp: fg)
   102       by (auto simp: fg)
   103   qed
   103   qed
   104 qed (rule lipschitz_on_nonneg[OF f])
   104 qed (rule lipschitz_on_nonneg[OF f])
   105 
   105 
   106 proposition lipschitz_on_concat_max:
   106 lemma lipschitz_on_concat_max:
   107   fixes a b c::real
   107   fixes a b c::real
   108   assumes f: "L-lipschitz_on {a .. b} f"
   108   assumes f: "L-lipschitz_on {a .. b} f"
   109   assumes g: "M-lipschitz_on {b .. c} g"
   109   assumes g: "M-lipschitz_on {b .. c} g"
   110   assumes fg: "f b = g b"
   110   assumes fg: "f b = g b"
   111   shows "(max L M)-lipschitz_on {a .. c} (\<lambda>x. if x \<le> b then f x else g x)"
   111   shows "(max L M)-lipschitz_on {a .. c} (\<lambda>x. if x \<le> b then f x else g x)"
   116 qed
   116 qed
   117 
   117 
   118 
   118 
   119 subsubsection \<open>Continuity\<close>
   119 subsubsection \<open>Continuity\<close>
   120 
   120 
   121 lemma lipschitz_on_uniformly_continuous:
   121 proposition lipschitz_on_uniformly_continuous:
   122   assumes "L-lipschitz_on X f"
   122   assumes "L-lipschitz_on X f"
   123   shows "uniformly_continuous_on X f"
   123   shows "uniformly_continuous_on X f"
   124   unfolding uniformly_continuous_on_def
   124   unfolding uniformly_continuous_on_def
   125 proof safe
   125 proof safe
   126   fix e::real
   126   fix e::real
   130   show "\<exists>d>0. \<forall>x\<in>X. \<forall>x'\<in>X. dist x' x < d \<longrightarrow> dist (f x') (f x) < e"
   130   show "\<exists>d>0. \<forall>x\<in>X. \<forall>x'\<in>X. dist x' x < d \<longrightarrow> dist (f x') (f x) < e"
   131     using lipschitz_onD[OF l] lipschitz_on_nonneg[OF assms] \<open>0 < e\<close>
   131     using lipschitz_onD[OF l] lipschitz_on_nonneg[OF assms] \<open>0 < e\<close>
   132     by (force intro!: exI[where x="e/(L + 1)"] simp: field_simps)
   132     by (force intro!: exI[where x="e/(L + 1)"] simp: field_simps)
   133 qed
   133 qed
   134 
   134 
   135 lemma lipschitz_on_continuous_on:
   135 proposition lipschitz_on_continuous_on:
   136   "continuous_on X f" if "L-lipschitz_on X f"
   136   "continuous_on X f" if "L-lipschitz_on X f"
   137   by (rule uniformly_continuous_imp_continuous[OF lipschitz_on_uniformly_continuous[OF that]])
   137   by (rule uniformly_continuous_imp_continuous[OF lipschitz_on_uniformly_continuous[OF that]])
   138 
   138 
   139 lemma lipschitz_on_continuous_within:
   139 lemma lipschitz_on_continuous_within:
   140   "continuous (at x within X) f" if "L-lipschitz_on X f" "x \<in> X"
   140   "continuous (at x within X) f" if "L-lipschitz_on X f" "x \<in> X"
   141   using lipschitz_on_continuous_on[OF that(1)] that(2)
   141   using lipschitz_on_continuous_on[OF that(1)] that(2)
   142   by (auto simp: continuous_on_eq_continuous_within)
   142   by (auto simp: continuous_on_eq_continuous_within)
   143 
   143 
   144 subsubsection \<open>Differentiable functions\<close>
   144 subsubsection \<open>Differentiable functions\<close>
   145 
   145 
   146 lemma bounded_derivative_imp_lipschitz:
   146 proposition bounded_derivative_imp_lipschitz:
   147   assumes "\<And>x. x \<in> X \<Longrightarrow> (f has_derivative f' x) (at x within X)"
   147   assumes "\<And>x. x \<in> X \<Longrightarrow> (f has_derivative f' x) (at x within X)"
   148   assumes convex: "convex X"
   148   assumes convex: "convex X"
   149   assumes "\<And>x. x \<in> X \<Longrightarrow> onorm (f' x) \<le> C" "0 \<le> C"
   149   assumes "\<And>x. x \<in> X \<Longrightarrow> onorm (f' x) \<le> C" "0 \<le> C"
   150   shows "C-lipschitz_on X f"
   150   shows "C-lipschitz_on X f"
   151 proof (rule lipschitz_onI)
   151 proof (rule lipschitz_onI)
   152   show "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> dist (f x) (f y) \<le> C * dist x y"
   152   show "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> dist (f x) (f y) \<le> C * dist x y"
   153     by (auto intro!: assms differentiable_bound[unfolded dist_norm[symmetric], OF convex])
   153     by (auto intro!: assms differentiable_bound[unfolded dist_norm[symmetric], OF convex])
   154 qed fact
   154 qed fact
   155 
   155 
   156 
   156 
   157 subsubsection \<open>Structural introduction rules\<close>
   157 subsubsection%unimportant \<open>Structural introduction rules\<close>
   158 
   158 
   159 named_theorems lipschitz_intros "structural introduction rules for Lipschitz controls"
   159 named_theorems lipschitz_intros "structural introduction rules for Lipschitz controls"
   160 
   160 
   161 lemma lipschitz_on_compose [lipschitz_intros]:
   161 lemma lipschitz_on_compose [lipschitz_intros]:
   162   "(D * C)-lipschitz_on U (g o f)"
   162   "(D * C)-lipschitz_on U (g o f)"
   478 qed
   478 qed
   479 
   479 
   480 
   480 
   481 subsection \<open>Local Lipschitz continuity (uniform for a family of functions)\<close>
   481 subsection \<open>Local Lipschitz continuity (uniform for a family of functions)\<close>
   482 
   482 
   483 definition local_lipschitz::
   483 definition%important local_lipschitz::
   484   "'a::metric_space set \<Rightarrow> 'b::metric_space set \<Rightarrow> ('a \<Rightarrow> 'b \<Rightarrow> 'c::metric_space) \<Rightarrow> bool"
   484   "'a::metric_space set \<Rightarrow> 'b::metric_space set \<Rightarrow> ('a \<Rightarrow> 'b \<Rightarrow> 'c::metric_space) \<Rightarrow> bool"
   485   where
   485   where
   486   "local_lipschitz T X f \<equiv> \<forall>x \<in> X. \<forall>t \<in> T.
   486   "local_lipschitz T X f \<equiv> \<forall>x \<in> X. \<forall>t \<in> T.
   487     \<exists>u>0. \<exists>L. \<forall>t \<in> cball t u \<inter> T. L-lipschitz_on (cball x u \<inter> X) (f t)"
   487     \<exists>u>0. \<exists>L. \<forall>t \<in> cball t u \<inter> T. L-lipschitz_on (cball x u \<inter> X) (f t)"
   488 
   488 
   783   from lipschitz_boundE[of "(cball x 1 \<inter> B)"] obtain C where "C-lipschitz_on (cball x 1 \<inter> B) f" by auto
   783   from lipschitz_boundE[of "(cball x 1 \<inter> B)"] obtain C where "C-lipschitz_on (cball x 1 \<inter> B) f" by auto
   784   then show ?case
   784   then show ?case
   785     by (auto intro: exI[where x=1])
   785     by (auto intro: exI[where x=1])
   786 qed
   786 qed
   787 
   787 
   788 lemma c1_implies_local_lipschitz:
   788 proposition c1_implies_local_lipschitz:
   789   fixes T::"real set" and X::"'a::{banach,heine_borel} set"
   789   fixes T::"real set" and X::"'a::{banach,heine_borel} set"
   790     and f::"real \<Rightarrow> 'a \<Rightarrow> 'a"
   790     and f::"real \<Rightarrow> 'a \<Rightarrow> 'a"
   791   assumes f': "\<And>t x. t \<in> T \<Longrightarrow> x \<in> X \<Longrightarrow> (f t has_derivative blinfun_apply (f' (t, x))) (at x)"
   791   assumes f': "\<And>t x. t \<in> T \<Longrightarrow> x \<in> X \<Longrightarrow> (f t has_derivative blinfun_apply (f' (t, x))) (at x)"
   792   assumes cont_f': "continuous_on (T \<times> X) f'"
   792   assumes cont_f': "continuous_on (T \<times> X) f'"
   793   assumes "open T"
   793   assumes "open T"