(* Limits_are_less_than_or_equal_to_upper_bounds.lean -- If x is the limit of u and y is an upper bound of u, then x \ y. -- José A. Alonso Jiménez -- Seville, September 3, 2024 -- ------------------------------------------------------------------ *) (* --------------------------------------------------------------------- -- In Isabelle/HOL, we can define that a is the limit of the sequence u -- by: -- definition is_limit :: "(nat \ real) \ real \ bool" where -- "is_limit u c \ (\\>0. \k. \n\k. \u n - c\ < \)" -- and that a is an upper bound of u by: -- definition is_upper_bound :: "(nat \ real) \ real \ bool" where -- "is_upper_bound u c \ (\n. u n \ c)" -- -- Prove that if x is the limit of the sequence u and y is an upper -- bound of u, then x \ y. -- ------------------------------------------------------------------ *) theory Limits_are_less_than_or_equal_to_upper_bounds imports Main HOL.Real begin definition is_limit :: "(nat \ real) \ real \ bool" where "is_limit u c \ (\\>0. \k. \n\k. \u n - c\ < \)" definition is_upper_bound :: "(nat \ real) \ real \ bool" where "is_upper_bound u c \ (\n. u n \ c)" (* Proof 1 *) lemma fixes x y :: real assumes "is_limit u x" "is_upper_bound u y" shows "x \ y" proof (rule field_le_epsilon) fix \ :: real assume "0 < \" then obtain k where hk : "\n\k. \u n - x\ < \" using assms(1) is_limit_def by auto then have "\u k - x\ < \" by simp then have "-\ < u k - x" by simp then have "x < u k + \" by simp moreover have "u k \ y" using assms(2) is_upper_bound_def by simp ultimately show "x \ y + \" by simp qed (* Proof 2 *) lemma fixes x y :: real assumes "is_limit u x" "is_upper_bound u y" shows "x \ y" proof (rule field_le_epsilon) fix \ :: real assume "0 < \" then obtain k where hk : "\n\k. \u n - x\ < \" using assms(1) is_limit_def by auto then have "x < u k + \" by auto moreover have "u k \ y" using assms(2) is_upper_bound_def by simp ultimately show "x \ y + \" by simp qed (* Proof 3 *) lemma fixes x y :: real assumes "is_limit u x" "is_upper_bound u y" shows "x \ y" proof (rule field_le_epsilon) fix \ :: real assume "0 < \" then obtain k where hk : "\n\k. \u n - x\ < \" using assms(1) is_limit_def by auto then show "x \ y + \" using assms(2) is_upper_bound_def by (smt (verit) order_refl) qed end