        {"id":740,"date":"2021-09-06T06:00:48","date_gmt":"2021-09-06T04:00:48","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=740"},"modified":"2021-09-03T16:51:13","modified_gmt":"2021-09-03T14:51:13","slug":"limite-de-sucesiones-no-decrecientes","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/limite-de-sucesiones-no-decrecientes\/","title":{"rendered":"L\u00edmite de sucesiones no decrecientes"},"content":{"rendered":"<p>En Lean, una sucesi\u00f3n u\u2080, u\u2081, u\u2082, &#8230; se puede representar mediante una funci\u00f3n (u : \u2115 \u2192 \u211d) de forma que u(n) es u\u2099.<\/p>\n<p>En Lean, se define que a es el l\u00edmite de la sucesi\u00f3n u, por<\/p>\n<pre lang=\"text\">\r\n   def limite (u: \u2115 \u2192 \u211d) (a: \u211d) :=\r\n     \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n - a| < \u03b5\r\n<pre lang=\"text\">\r\ndonde se usa la notaci\u00f3n |x| para el valor absoluto de x\r\n<pre lang=\"text\">\r\n   notation `|`x`|` := abs x\r\n<\/pre>\n<p>y que la sucesi\u00f3n u es no decreciente por<\/p>\n<pre lang=\"text\">\r\n   def no_decreciente (u : \u2115 \u2192 \u211d) :=\r\n     \u2200 n m, n \u2264 m \u2192 u n \u2264 u m\r\n<\/pre>\n<p>Demostrar que si u es una sucesi\u00f3n no decreciente y su l\u00edmite es a, entonces u(n) \u2264 a para todo n.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\r\nimport data.real.basic\r\nimport tactic\r\n\r\nvariable {u : \u2115 \u2192 \u211d}\r\nvariable (a : \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 m, \u2200 n \u2265 m, |u n - a| < \u03b5\r\n\r\ndef no_decreciente (u : \u2115 \u2192 \u211d) :=\r\n  \u2200 n m, n \u2264 m \u2192 u n \u2264 u m\r\n\r\nexample\r\n  (h : limite u a)\r\n  (h' : no_decreciente u)\r\n  : \u2200 n, u n \u2264 a :=\r\nsorry\r\n<\/pre>\n<p>[expand title=\"Soluciones con Lean\"]<\/p>\n<pre lang=\"lean\">\r\nimport data.real.basic\r\nimport tactic\r\n\r\nvariable {u : \u2115 \u2192 \u211d}\r\nvariable (a : \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 m, \u2200 n \u2265 m, |u n - a| < \u03b5\r\n\r\ndef no_decreciente (u : \u2115 \u2192 \u211d) :=\r\n  \u2200 n m, n \u2264 m \u2192 u n \u2264 u m\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample\r\n  (h : limite u a)\r\n  (h' : no_decreciente u)\r\n  : \u2200 n, u n \u2264 a :=\r\nbegin\r\n  intro n,\r\n  by_contradiction H,\r\n  push_neg at H,\r\n  replace H : u n - a > 0 := sub_pos.mpr H,\r\n  cases h (u n - a) H with m hm,\r\n  let k := max n m,\r\n  specialize hm k (le_max_right _ _),\r\n  specialize h' n k (le_max_left _ _),\r\n  replace hm : |u k - a| < u k - a, by\r\n    calc |u k - a| < u n - a : hm\r\n               ... \u2264 u k - a : sub_le_sub_right h' a,\r\n  rw \u2190 not_le at hm,\r\n  apply hm,\r\n  exact le_abs_self (u k - a),\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample\r\n  (h : limite u a)\r\n  (h' : no_decreciente u)\r\n  : \u2200 n, u n \u2264 a :=\r\nbegin\r\n  intro n,\r\n  by_contradiction H,\r\n  push_neg at H,\r\n  cases h (u n - a) (by linarith) with m hm,\r\n  specialize hm (max n m) (le_max_right _ _),\r\n  specialize h' n (max n m) (le_max_left _ _),\r\n  rw abs_lt at hm,\r\n  linarith,\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\/Limite_de_sucesiones_no_decrecientes.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 Limite_de_sucesiones_no_decrecientes\r\nimports Main HOL.Real\r\nbegin\r\n\r\ndefinition limite :: \"(nat \u21d2 real) \u21d2 real \u21d2 bool\"\r\n  where \"limite u a \u27f7 (\u2200\u03b5>0. \u2203N. \u2200k\u2265N. \u00a6u k - a\u00a6 < \u03b5)\"\r\n\r\ndefinition no_decreciente :: \"(nat \u21d2 real) \u21d2 bool\"\r\n  where \"no_decreciente u \u27f7 (\u2200 n m. n \u2264 m \u27f6 u n \u2264 u m)\"\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"limite u a\"\r\n          \"no_decreciente u\"\r\n  shows   \"\u2200 n. u n \u2264 a\"\r\nproof (rule allI)\r\n  fix n\r\n  show \"u n \u2264 a\"\r\n  proof (rule ccontr)\r\n    assume \"\u00ac u n \u2264 a\"\r\n    then have \"a < u n\"\r\n      by (rule not_le_imp_less)\r\n    then have H : \"u n - a > 0\"\r\n      by (simp only: diff_gt_0_iff_gt)\r\n    then obtain m where hm : \"\u2200p\u2265m. \u00a6u p - a\u00a6 < u n - a\"\r\n      using assms(1) limite_def by blast\r\n    let ?k = \"max n m\"\r\n    have \"n \u2264 ?k\"\r\n      by (simp only: assms(2) no_decreciente_def)\r\n    then have \"u n \u2264 u ?k\"\r\n      using assms(2) no_decreciente_def by blast\r\n    have \"\u00a6u ?k - a\u00a6 < u n - a\"\r\n      by (simp only: hm)\r\n    also have \"\u2026 \u2264 u ?k - a\"\r\n      using \u2039u n \u2264 u ?k\u203a by (rule diff_right_mono)\r\n    finally have \"\u00a6u ?k - a\u00a6 < u ?k - a\"\r\n      by this\r\n    then have \"\u00ac u ?k - a \u2264 \u00a6u ?k - a\u00a6\"\r\n      by (simp only: not_le_imp_less)\r\n    moreover have \"u ?k - a \u2264 \u00a6u ?k - a\u00a6\"\r\n      by (rule abs_ge_self)\r\n    ultimately show False\r\n      by (rule notE)\r\n  qed\r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"limite u a\"\r\n          \"no_decreciente u\"\r\n  shows   \"\u2200 n. u n \u2264 a\"\r\nproof (rule allI)\r\n  fix n\r\n  show \"u n \u2264 a\"\r\n  proof (rule ccontr)\r\n    assume \"\u00ac u n \u2264 a\"\r\n    then have H : \"u n - a > 0\"\r\n      by simp\r\n    then obtain m where hm : \"\u2200p\u2265m. \u00a6u p - a\u00a6 < u n - a\"\r\n      using assms(1) limite_def by blast\r\n    let ?k = \"max n m\"\r\n    have \"\u00a6u ?k - a\u00a6 < u n - a\"\r\n      using hm by simp\r\n    moreover have \"u n \u2264 u ?k\"\r\n      using assms(2) no_decreciente_def by simp\r\n    ultimately have \"\u00a6u ?k - a\u00a6 < u ?k - a\"\r\n      by simp\r\n    then show False\r\n      by simp\r\n  qed\r\nqed\r\n\r\n(* 3\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"limite u a\"\r\n          \"no_decreciente u\"\r\n  shows   \"\u2200 n. u n \u2264 a\"\r\nproof\r\n  fix n\r\n  show \"u n \u2264 a\"\r\n  proof (rule ccontr)\r\n    assume \"\u00ac u n \u2264 a\"\r\n    then obtain m where hm : \"\u2200p\u2265m. \u00a6u p - a\u00a6 < u n - a\"\r\n      using assms(1) limite_def by fastforce\r\n    let ?k = \"max n m\"\r\n    have \"\u00a6u ?k - a\u00a6 < u n - a\"\r\n      using hm by simp\r\n    moreover have \"u n \u2264 u ?k\"\r\n      using assms(2) no_decreciente_def by simp\r\n    ultimately show False\r\n      by simp\r\n  qed\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, una sucesi\u00f3n u\u2080, u\u2081, u\u2082, &#8230; se puede representar mediante una funci\u00f3n (u : \u2115 \u2192 \u211d) de forma que u(n) es u\u2099. En Lean, se define que a es el l\u00edmite de la sucesi\u00f3n u, por def limite (u: \u2115 \u2192 \u211d) (a: \u211d) := \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n &#8211; a| < \u03b5 donde se usa la notaci\u00f3n |x| para el valor absoluto de x notation `|`x`|` := abs x y que la sucesi\u00f3n u es no decreciente por def no_decreciente (u : \u2115 \u2192 \u211d) := \u2200 n m, n \u2264 m \u2192 u n \u2264 u m Demostrar que si u es una sucesi\u00f3n no decreciente y su l\u00edmite es a, entonces...\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":[226,90,92,199,224,225,133,223,131,51,100,109,119,80,43,222,183,182,89,181,221,122,44,111,196,220,219],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/740"}],"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=740"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/740\/revisions"}],"predecessor-version":[{"id":741,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/740\/revisions\/741"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}