src/HOL/Library/Convex.thy
changeset 62418 f1b0908028cf
parent 62376 85f38d5f8807
child 63007 aa894a49f77d
equal deleted inserted replaced
62417:d515293f5970 62418:f1b0908028cf
   321   assumes "\<And>t x y. t > 0 \<Longrightarrow> t < 1 \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x < y \<Longrightarrow>
   321   assumes "\<And>t x y. t > 0 \<Longrightarrow> t < 1 \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x < y \<Longrightarrow>
   322              f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y"
   322              f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y"
   323   shows   "convex_on A f"
   323   shows   "convex_on A f"
   324 proof
   324 proof
   325   fix t x y assume A: "x \<in> A" "y \<in> A" "(t::real) > 0" "t < 1"
   325   fix t x y assume A: "x \<in> A" "y \<in> A" "(t::real) > 0" "t < 1"
   326   case (goal1 t x y)
   326   with assms[of t x y] assms[of "1 - t" y x]
   327   with goal1 assms[of t x y] assms[of "1 - t" y x]
   327   show "f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y"
   328     show ?case by (cases x y rule: linorder_cases) (auto simp: algebra_simps)
   328     by (cases x y rule: linorder_cases) (auto simp: algebra_simps)
   329 qed
   329 qed
   330 
   330 
   331 lemma convex_onD:
   331 lemma convex_onD:
   332   assumes "convex_on A f"
   332   assumes "convex_on A f"
   333   shows   "\<And>t x y. t \<ge> 0 \<Longrightarrow> t \<le> 1 \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow>
   333   shows   "\<And>t x y. t \<ge> 0 \<Longrightarrow> t \<le> 1 \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow>