        {"id":591,"date":"2021-07-23T06:00:28","date_gmt":"2021-07-23T04:00:28","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=591"},"modified":"2021-07-21T16:49:35","modified_gmt":"2021-07-21T14:49:35","slug":"los-supremos-de-las-sucesiones-crecientes-son-sus-limites","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/los-supremos-de-las-sucesiones-crecientes-son-sus-limites\/","title":{"rendered":"Los supremos de las sucesiones crecientes son sus l\u00edmites"},"content":{"rendered":"<p>Demostrar que si M es un supremo de una sucesi\u00f3n creciente u, entonces el l\u00edmite de u es M.<\/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)\nvariable (M : \u211d)\n\nnotation `|`x`|` := abs x\n\n-- (limite u c) expresa que el l\u00edmite de u es c.\ndef limite (u : \u2115 \u2192 \u211d) (c : \u211d) :=\n  \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n - c| \u2264 \u03b5\n\n-- (supremo u M) expresa que el supremo de u es M.\ndef supremo (u : \u2115 \u2192 \u211d) (M : \u211d) :=\n  (\u2200 n, u n \u2264 M) \u2227 \u2200 \u03b5 > 0, \u2203 n\u2080, u n\u2080 \u2265 M - \u03b5\n\nexample\n  (hu : monotone u)\n  (hM : supremo u M)\n  : limite u M :=\nsorry\n<\/pre>\n<p>[expand title=\u00bbSoluciones con Lean\u00bb]<\/p>\n<pre lang=\"lean\">\r\nimport data.real.basic\r\n\r\nvariable (u : \u2115 \u2192 \u211d)\r\nvariable (M : \u211d)\r\n\r\nnotation `|`x`|` := abs x\r\n\r\n-- (limite u c) expresa que el l\u00edmite de u es c.\r\ndef limite (u : \u2115 \u2192 \u211d) (c : \u211d) :=\r\n  \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n - c| \u2264 \u03b5\r\n\r\n-- (supremo u M) expresa que el supremo de u es M.\r\ndef supremo (u : \u2115 \u2192 \u211d) (M : \u211d) :=\r\n  (\u2200 n, u n \u2264 M) \u2227 \u2200 \u03b5 > 0, \u2203 n\u2080, u n\u2080 \u2265 M - \u03b5\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample\r\n  (hu : monotone u)\r\n  (hM : supremo u M)\r\n  : limite u M :=\r\nbegin\r\n  -- unfold limite,\r\n  intros \u03b5 h\u03b5,\r\n  -- unfold supremo at h,\r\n  cases hM with hM\u2081 hM\u2082,\r\n  cases hM\u2082 \u03b5 h\u03b5 with n\u2080 hn\u2080,\r\n  use n\u2080,\r\n  intros n hn,\r\n  rw abs_le,\r\n  split,\r\n  { -- unfold monotone at h',\r\n    specialize hu hn,\r\n    calc -\u03b5\r\n         = (M - \u03b5) - M : by ring\r\n     ... \u2264 u n\u2080 - M    : sub_le_sub_right hn\u2080 M\r\n     ... \u2264 u n - M     : sub_le_sub_right hu M },\r\n  { calc u n - M\r\n         \u2264 M - M       : sub_le_sub_right (hM\u2081 n) M\r\n     ... = 0           : sub_self M\r\n     ... \u2264 \u03b5           : le_of_lt h\u03b5, },\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample\r\n  (hu : monotone u)\r\n  (hM : supremo u M)\r\n  : limite u M :=\r\nbegin\r\n  intros \u03b5 h\u03b5,\r\n  cases hM with hM\u2081 hM\u2082,\r\n  cases hM\u2082 \u03b5 h\u03b5 with n\u2080 hn\u2080,\r\n  use n\u2080,\r\n  intros n hn,\r\n  rw abs_le,\r\n  split,\r\n  { linarith [hu hn] },\r\n  { linarith [hM\u2081 n] },\r\nend\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample\r\n  (hu : monotone u)\r\n  (hM : supremo u M)\r\n  : limite u M :=\r\nbegin\r\n  intros \u03b5 h\u03b5,\r\n  cases hM with hM\u2081 hM\u2082,\r\n  cases hM\u2082 \u03b5 h\u03b5 with n\u2080 hn\u2080,\r\n  use n\u2080,\r\n  intros n hn,\r\n  rw abs_le,\r\n  split ; linarith [hu hn, hM\u2081 n],\r\nend\r\n\r\n-- 4\u00aa demostraci\u00f3n\r\nexample\r\n  (hu : monotone u)\r\n  (hM : supremo u M)\r\n  : limite u M :=\r\nassume \u03b5,\r\nassume h\u03b5 : \u03b5 > 0,\r\nhave hM\u2081 : \u2200 (n : \u2115), u n \u2264 M,\r\n  from hM.left,\r\nhave hM\u2082 : \u2200 (\u03b5 : \u211d), \u03b5 > 0 \u2192 (\u2203 (n\u2080 : \u2115), u n\u2080 \u2265 M - \u03b5),\r\n  from hM.right,\r\nexists.elim (hM\u2082 \u03b5 h\u03b5)\r\n  ( assume n\u2080,\r\n    assume hn\u2080 : u n\u2080 \u2265 M - \u03b5,\r\n    have h1 : \u2200 n, n \u2265 n\u2080 \u2192 |u n - M| \u2264 \u03b5,\r\n      { assume n,\r\n        assume hn : n \u2265 n\u2080,\r\n        have h2 : -\u03b5 \u2264 u n - M,\r\n          { have h3 : u n\u2080 \u2264 u n,\r\n              from hu hn,\r\n            calc -\u03b5\r\n                 = (M - \u03b5) - M : by ring\r\n             ... \u2264 u n\u2080 - M    : sub_le_sub_right hn\u2080 M\r\n             ... \u2264 u n - M     : sub_le_sub_right h3 M },\r\n        have h4 : u n - M \u2264 \u03b5,\r\n          { calc u n - M\r\n                 \u2264 M - M       : sub_le_sub_right (hM\u2081 n) M\r\n             ... = 0           : sub_self M\r\n             ... \u2264 \u03b5           : le_of_lt h\u03b5 },\r\n        show |u n - M| \u2264 \u03b5,\r\n          from abs_le.mpr (and.intro h2 h4) },\r\n    show \u2203 N, \u2200 n, n \u2265 N \u2192 |u n - M| \u2264 \u03b5,\r\n      from exists.intro n\u2080 h1)\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_supremos_de_las_sucesiones_crecientes_son_sus_limites.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=\u00bbSoluciones con Isabelle\/HOL\u00bb]<\/p>\n<pre lang=\"isar\">\r\ntheory Los_supremos_de_las_sucesiones_crecientes_son_sus_limites\r\nimports Main HOL.Real\r\nbegin\r\n\r\n(* (limite u c) expresa que el l\u00edmite de u es c. *)\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 \u2264 \u03b5)\"\r\n\r\n(* (supremo u M) expresa que el supremo de u es M. *)\r\ndefinition supremo :: \"(nat \u21d2 real) \u21d2 real \u21d2 bool\" where    \r\n  \"supremo u M \u27f7 ((\u2200n. u n \u2264 M) \u2227 (\u2200\u03b5>0. \u2203k. \u2200n\u2265k. u n \u2265 M - \u03b5))\"\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"mono u\"\r\n          \"supremo u M\"\r\n  shows   \"limite u M\"\r\nproof (unfold limite_def; intro allI impI)\r\n  fix \u03b5 :: real\r\n  assume \"0 < \u03b5\"\r\n  have hM : \"((\u2200n. u n \u2264 M) \u2227 (\u2200\u03b5>0. \u2203k. \u2200n\u2265k. u n \u2265 M - \u03b5))\"\r\n    using assms(2) \r\n    by (simp add: supremo_def)\r\n  then have \"\u2200\u03b5>0. \u2203k. \u2200n\u2265k. u n \u2265 M - \u03b5\"\r\n    by (rule conjunct2)\r\n  then have \"\u2203k. \u2200n\u2265k. u n \u2265 M - \u03b5\"\r\n    by (simp only: \u20390 < \u03b5\u203a) \r\n  then obtain n0 where \"\u2200n\u2265n0. u n \u2265 M - \u03b5\"\r\n    by (rule exE)\r\n  have \"\u2200n\u2265n0. \u00a6u n - M\u00a6 \u2264 \u03b5\" \r\n  proof (intro allI impI)\r\n    fix n\r\n    assume \"n \u2265 n0\"\r\n    show \"\u00a6u n - M\u00a6 \u2264 \u03b5\" \r\n    proof (rule abs_leI)\r\n      have \"\u2200n. u n \u2264 M\"\r\n        using hM by (rule conjunct1)\r\n      then have \"u n - M \u2264 M - M\" \r\n        by simp\r\n      also have \"\u2026 = 0\" \r\n        by (simp only: diff_self)\r\n      also have \"\u2026 \u2264 \u03b5\" \r\n        using \u20390 < \u03b5\u203a by (simp only: less_imp_le)\r\n      finally show \"u n - M \u2264 \u03b5\" \r\n        by this\r\n    next\r\n      have \"-\u03b5 = (M - \u03b5) - M\" \r\n        by simp\r\n      also have \"\u2026 \u2264 u n - M\" \r\n        using \u2039\u2200n\u2265n0. M - \u03b5 \u2264 u n\u203a \u2039n0 \u2264 n\u203a by auto\r\n      finally have \"-\u03b5 \u2264 u n - M\"\r\n        by this\r\n      then show \"- (u n - M) \u2264 \u03b5\" \r\n        by simp\r\n    qed\r\n  qed\r\n  then show \"\u2203k. \u2200n\u2265k. \u00a6u n - M\u00a6 \u2264 \u03b5\"\r\n    by (rule exI)\r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"mono u\"\r\n          \"supremo u M\"\r\n  shows   \"limite u M\"\r\nproof (unfold limite_def; intro allI impI)\r\n  fix \u03b5 :: real\r\n  assume \"0 < \u03b5\"\r\n  have hM : \"((\u2200n. u n \u2264 M) \u2227 (\u2200\u03b5>0. \u2203k. \u2200n\u2265k. u n \u2265 M - \u03b5))\"\r\n    using assms(2) \r\n    by (simp add: supremo_def)\r\n  then have \"\u2203k. \u2200n\u2265k. u n \u2265 M - \u03b5\"\r\n    using \u20390 < \u03b5\u203a by presburger\r\n  then obtain n0 where \"\u2200n\u2265n0. u n \u2265 M - \u03b5\" \r\n    by (rule exE)\r\n  then have \"\u2200n\u2265n0. \u00a6u n - M\u00a6 \u2264 \u03b5\" \r\n    using hM by auto\r\n  then show \"\u2203k. \u2200n\u2265k. \u00a6u n - M\u00a6 \u2264 \u03b5\"\r\n    by (rule exI)\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>Demostrar que si M es un supremo de una sucesi\u00f3n creciente u, entonces el l\u00edmite de u es M. Para ello, completar la siguiente teor\u00eda de Lean: import data.real.basic variable (u : \u2115 \u2192 \u211d) variable (M : \u211d) notation `|`x`|` := abs x &#8212; (limite u c) expresa que el l\u00edmite de u es c. def limite (u : \u2115 \u2192 \u211d) (c : \u211d) := \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n &#8211; c| \u2264 \u03b5 &#8212; (supremo u M) expresa que el supremo de u es M. def supremo (u : \u2115 \u2192 \u211d) (M : \u211d) := (\u2200 n, u n \u2264 M) \u2227 \u2200 \u03b5 > 0, \u2203 n\u2080, u n\u2080 \u2265 M &#8211; \u03b5&#8230;<\/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":[13,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\/591"}],"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=591"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/591\/revisions"}],"predecessor-version":[{"id":592,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/591\/revisions\/592"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}