equal
deleted
inserted
replaced
662 and I: "x \<in> I" "y \<in> I" |
662 and I: "x \<in> I" "y \<in> I" |
663 and t: "x < t" "t < y" |
663 and t: "x < t" "t < y" |
664 shows "(f x - f t) / (x - t) \<le> (f x - f y) / (x - y)" |
664 shows "(f x - f t) / (x - t) \<le> (f x - f y) / (x - y)" |
665 and "(f x - f y) / (x - y) \<le> (f t - f y) / (t - y)" |
665 and "(f x - f y) / (x - y) \<le> (f t - f y) / (t - y)" |
666 proof - |
666 proof - |
667 def a \<equiv> "(t - y) / (x - y)" |
667 define a where "a \<equiv> (t - y) / (x - y)" |
668 with t have "0 \<le> a" "0 \<le> 1 - a" |
668 with t have "0 \<le> a" "0 \<le> 1 - a" |
669 by (auto simp: field_simps) |
669 by (auto simp: field_simps) |
670 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" |
670 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" |
671 by (auto simp: convex_on_def) |
671 by (auto simp: convex_on_def) |
672 have "a * x + (1 - a) * y = a * (x - y) + y" |
672 have "a * x + (1 - a) * y = a * (x - y) + y" |
880 assumes "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x \<le> y \<Longrightarrow> f' x \<le> f' y" |
880 assumes "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x \<le> y \<Longrightarrow> f' x \<le> f' y" |
881 shows "convex_on A f" |
881 shows "convex_on A f" |
882 proof (rule convex_on_linorderI) |
882 proof (rule convex_on_linorderI) |
883 fix t x y :: real |
883 fix t x y :: real |
884 assume t: "t > 0" "t < 1" and xy: "x \<in> A" "y \<in> A" "x < y" |
884 assume t: "t > 0" "t < 1" and xy: "x \<in> A" "y \<in> A" "x < y" |
885 def z \<equiv> "(1 - t) * x + t * y" |
885 define z where "z = (1 - t) * x + t * y" |
886 with \<open>connected A\<close> and xy have ivl: "{x..y} \<subseteq> A" using connected_contains_Icc by blast |
886 with \<open>connected A\<close> and xy have ivl: "{x..y} \<subseteq> A" using connected_contains_Icc by blast |
887 |
887 |
888 from xy t have xz: "z > x" by (simp add: z_def algebra_simps) |
888 from xy t have xz: "z > x" by (simp add: z_def algebra_simps) |
889 have "y - z = (1 - t) * (y - x)" by (simp add: z_def algebra_simps) |
889 have "y - z = (1 - t) * (y - x)" by (simp add: z_def algebra_simps) |
890 also from xy t have "... > 0" by (intro mult_pos_pos) simp_all |
890 also from xy t have "... > 0" by (intro mult_pos_pos) simp_all |