        {"id":766,"date":"2021-09-16T05:00:20","date_gmt":"2021-09-16T03:00:20","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=766"},"modified":"2021-09-11T18:10:03","modified_gmt":"2021-09-11T16:10:03","slug":"los-limites-son-menores-o-iguales-que-las-cotas-superiores","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/los-limites-son-menores-o-iguales-que-las-cotas-superiores\/","title":{"rendered":"Los l\u00edmites son menores o iguales que las cotas superiores"},"content":{"rendered":"<p>En Lean, se puede definir que a es el l\u00edmite de la sucesi\u00f3n u por<\/p>\n<pre lang=\"text\">\n   def limite (u : \u2115 \u2192 \u211d) (a : \u211d) :=\n     \u2200 \u03b5 > 0, \u2203 k, \u2200 n \u2265 k, |u n - a| < \u03b5\n<\/pre>\n<p>y que a es una cota superior de  u por<\/p>\n<pre lang=\"text\">\n   def cota_superior (u : \u2115 \u2192 \u211d) (a : \u211d) :=\n     \u2200 n, u n \u2264 a\n<\/pre>\n<p>Demostrar que si x es el l\u00edmite de la sucesi\u00f3n u e y es una cota superior de u, entonces x \u2264 y.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.real.basic\n\nvariable  (u : \u2115 \u2192 \u211d)\nvariables (x y : \u211d)\n\nnotation `|`x`|` := abs x\n\ndef limite (u : \u2115 \u2192 \u211d) (a : \u211d) :=\n  \u2200 \u03b5 > 0, \u2203 k, \u2200 n \u2265 k, |u n - a| < \u03b5\n\ndef cota_superior (u : \u2115 \u2192 \u211d) (a : \u211d) :=\n  \u2200 n, u n \u2264 a\n\nexample\n  (hx : limite u x)\n  (hy : cota_superior u y)\n  : x \u2264 y :=\nsorry\n<\/pre>\n<p>[expand title=\"Soluciones con Lean\"]<\/p>\n<pre lang=\"lean\">\r\nimport data.real.basic\r\n\r\nvariable  (u : \u2115 \u2192 \u211d)\r\nvariables (x y : \u211d)\r\n\r\nnotation `|`x`|` := abs x\r\n\r\ndef limite (u : \u2115 \u2192 \u211d) (a : \u211d) :=\r\n  \u2200 \u03b5 > 0, \u2203 k, \u2200 n \u2265 k, |u n - a| < \u03b5\r\n\r\ndef cota_superior (u : \u2115 \u2192 \u211d) (a : \u211d) :=\r\n  \u2200 n, u n \u2264 a\r\n\r\nlemma aux :\r\n  (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x :=\r\nbegin\r\n  contrapose!,\r\n  intro h,\r\n  use (y-x)\/2,\r\n  split ; linarith,\r\nend\r\n\r\n-- 1\u00ba demostraci\u00f3n\r\nexample\r\n  (hx : limite u x)\r\n  (hy : cota_superior u y)\r\n  : x \u2264 y :=\r\nbegin\r\n  apply aux,\r\n  intros \u03b5 h\u03b5,\r\n  cases hx \u03b5 h\u03b5 with k hk,\r\n  specialize hk k rfl.ge,\r\n  replace hk : -\u03b5 < u k - x := neg_lt_of_abs_lt hk,\r\n  replace hk : x < u k + \u03b5 := neg_lt_sub_iff_lt_add'.mp hk,\r\n  apply le_of_lt,\r\n  exact lt_add_of_lt_add_right hk (hy k),\r\nend\r\n\r\n-- 2\u00ba demostraci\u00f3n\r\nexample\r\n  (hx : limite u x)\r\n  (hy : cota_superior u y)\r\n  : x \u2264 y :=\r\nbegin\r\n  apply aux,\r\n  intros \u03b5 h\u03b5,\r\n  cases hx \u03b5 h\u03b5 with k hk,\r\n  specialize hk k rfl.ge,\r\n  apply le_of_lt,\r\n  calc x < u k + \u03b5 : neg_lt_sub_iff_lt_add'.mp (neg_lt_of_abs_lt hk)\r\n     ... \u2264 y + \u03b5   : add_le_add_right (hy k) \u03b5,\r\nend\r\n\r\n-- 3\u00ba demostraci\u00f3n\r\nexample\r\n  (hx : limite u x)\r\n  (hy : cota_superior u y)\r\n  : x \u2264 y :=\r\nbegin\r\n  apply aux,\r\n  intros \u03b5 h\u03b5,\r\n  cases hx \u03b5 h\u03b5 with k hk,\r\n  specialize hk k (by linarith),\r\n  rw abs_lt at hk,\r\n  linarith [hy k],\r\nend\r\n<\/pre>\n<p>Se puede interactuar con la prueba anterior en <a href=\"https:\/\/leanprover-community.github.io\/lean-web-editor\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Calculemus\/main\/src\/Los_limites_son_menores_o_iguales_que_las_cotas_superiores.lean\" rel=\"noopener noreferrer\" target=\"_blank\">esta sesi\u00f3n con Lean<\/a>.<\/p>\n<p>En los comentarios se pueden escribir otras soluciones, escribiendo el c\u00f3digo entre una l\u00ednea con &#60;pre lang=&quot;lean&quot;&#62; y otra con &#60;\/pre&#62;<br \/>\n[\/expand]<\/p>\n<p>[expand title=\"Soluciones con Isabelle\/HOL\"]<\/p>\n<pre lang=\"isar\">\r\ntheory Los_limites_son_menores_o_iguales_que_las_cotas_superiores\r\nimports Main HOL.Real\r\nbegin\r\n\r\ndefinition limite :: \"(nat \u21d2 real) \u21d2 real \u21d2 bool\" where\r\n  \"limite u c \u27f7 (\u2200\u03b5>0. \u2203k. \u2200n\u2265k. \u00a6u n - c\u00a6 < \u03b5)\"\r\n\r\ndefinition cota_superior :: \"(nat \u21d2 real) \u21d2 real \u21d2 bool\" where\r\n  \"cota_superior u c \u27f7 (\u2200n. u n \u2264 c)\"\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma\r\n  fixes x y :: real\r\n  assumes \"limite u x\"\r\n          \"cota_superior u y\"\r\n  shows   \"x \u2264 y\"\r\nproof (rule field_le_epsilon)\r\n  fix \u03b5 :: real\r\n  assume \"0 < \u03b5\"\r\n  then obtain k where hk : \"\u2200n\u2265k. \u00a6u n - x\u00a6 < \u03b5\"\r\n    using assms(1) limite_def by auto\r\n  then have \"\u00a6u k - x\u00a6 < \u03b5\"\r\n    by simp\r\n  then have \"-\u03b5 < u k - x\"\r\n    by simp\r\n  then have \"x < u k + \u03b5\"\r\n    by simp\r\n  moreover have \"u k \u2264 y\"\r\n    using assms(2) cota_superior_def by simp\r\n  ultimately show \"x \u2264 y + \u03b5\"\r\n    by simp\r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma\r\n  fixes x y :: real\r\n  assumes \"limite u x\"\r\n          \"cota_superior u y\"\r\n  shows   \"x \u2264 y\"\r\nproof (rule field_le_epsilon)\r\n  fix \u03b5 :: real\r\n  assume \"0 < \u03b5\"\r\n  then obtain k where hk : \"\u2200n\u2265k. \u00a6u n - x\u00a6 < \u03b5\"\r\n    using assms(1) limite_def by auto\r\n  then have \"x < u k + \u03b5\"\r\n    by auto\r\n  moreover have \"u k \u2264 y\"\r\n    using assms(2) cota_superior_def by simp\r\n  ultimately show \"x \u2264 y + \u03b5\"\r\n    by simp\r\nqed\r\n\r\n(* 3\u00aa demostraci\u00f3n *)\r\nlemma\r\n  fixes x y :: real\r\n  assumes \"limite u x\"\r\n          \"cota_superior u y\"\r\n  shows   \"x \u2264 y\"\r\nproof (rule field_le_epsilon)\r\n  fix \u03b5 :: real\r\n  assume \"0 < \u03b5\"\r\n  then obtain k where hk : \"\u2200n\u2265k. \u00a6u n - x\u00a6 < \u03b5\"\r\n    using assms(1) limite_def by auto\r\n  then show \"x \u2264 y + \u03b5\"\r\n    using assms(2) cota_superior_def\r\n    by (smt (verit) order_refl)\r\nqed\r\n\r\nend\r\n<\/pre>\n<p>En los comentarios se pueden escribir otras soluciones, escribiendo el c\u00f3digo entre una l\u00ednea con &#60;pre lang=&quot;isar&quot;&#62; y otra con &#60;\/pre&#62;<br \/>\n[\/expand]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>En Lean, se puede definir que a es el l\u00edmite de la sucesi\u00f3n u por def limite (u : \u2115 \u2192 \u211d) (a : \u211d) := \u2200 \u03b5 > 0, \u2203 k, \u2200 n \u2265 k, |u n &#8211; a| < \u03b5 y que a es una cota superior de u por def cota_superior (u : \u2115 \u2192 \u211d) (a : \u211d) := \u2200 n, u n \u2264 a Demostrar que si x es el l\u00edmite de la sucesi\u00f3n u e y es una cota superior de u, entonces x \u2264 y. Para ello, completar la siguiente teor\u00eda de Lean: import data.real.basic variable (u : \u2115 \u2192 \u211d) variables (x y : \u211d) notation `|`x`|` := abs x def limite (u : \u2115 \u2192 \u211d)...\n<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[14],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/766"}],"collection":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/comments?post=766"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/766\/revisions"}],"predecessor-version":[{"id":767,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/766\/revisions\/767"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}