        {"id":2014,"date":"2024-02-02T06:00:23","date_gmt":"2024-02-02T04:00:23","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2014"},"modified":"2024-02-18T14:11:41","modified_gmt":"2024-02-18T12:11:41","slug":"02-feb-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/02-feb-24\/","title":{"rendered":"La sucesi\u00f3n constante s\u2099 = c converge a c"},"content":{"rendered":"\n<p>En Lean, una sucesi\u00f3n &#92;(s\u2080, s\u2081, s\u2082, &#8230;&#92;) se puede representar mediante una funci\u00f3n &#92;(s : \u2115 \u2192 \u211d&#92;) de forma que &#92;(s(n)&#92;) es &#92;(s\u2099&#92;).<\/p>\n<p>Se define que a es el l\u00edmite de la sucesi\u00f3n &#92;(s&#92;), por<\/p>\n<pre lang=\"lean\">\ndef limite (s : \u2115 \u2192 \u211d) (a : \u211d) :=\n  \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |s n - a| < \u03b5\n<\/pre>\n<p>Demostrar que el l\u00edmite de la sucesi\u00f3n constante &#92;(s\u2099 = c&#92;) es &#92;(c&#92;).<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\ndef limite (s : \u2115 \u2192 \u211d) (a : \u211d) :=\n  \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |s n - a| < \u03b5\n\nexample : limite (fun _ : \u2115 \u21a6 c) c :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Tenemos que demostrar que para cada &#92;(\u03b5 \u2208 \u211d&#92;) tal que &#92;(\u03b5 > 0&#92;), existe un &#92;(N \u2208 \u2115&#92;), tal que &#92;((\u2200n \u2208 \u2115)[n \u2265 N \u2192 |s(n) - a| &lt; \u03b5]&#92;). Basta tomar &#92;(N&#92;) como &#92;(0&#92;), ya que para todo &#92;(n \u2265 N&#92;) se tiene<br \/>\n&#92;begin{align}<br \/>\n   |s(n) - a| &amp;= |a - a| &#92;&#92;<br \/>\n              &amp;= |0|     &#92;&#92;<br \/>\n              &amp;= 0       &#92;&#92;<br \/>\n              &amp;&lt; \u03b5       &#92;&#92;<br \/>\n&#92;end{align}<\/p>\n<h2>2. Demostraciones con Lean4<\/h2>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\ndef limite (s : \u2115 \u2192 \u211d) (a : \u211d) :=\n  \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |s n - a| < \u03b5\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : limite (fun _ : \u2115 \u21a6 c) c :=\nby\n  intros \u03b5 h\u03b5\n  -- \u03b5 : \u211d\n  -- h\u03b5 : \u03b5 > 0\n  -- \u22a2 \u2203 N, \u2200 (n : \u2115), n \u2265 N \u2192 |(fun _ => c) n - c| < \u03b5\n  use 0\n  -- \u22a2 \u2200 (n : \u2115), n \u2265 0 \u2192 |(fun _ => c) n - c| < \u03b5\n  intros n _hn\n  -- n : \u2115\n  -- hn : n \u2265 0\n  -- \u22a2 |(fun _ => c) n - c| < \u03b5\n  show |(fun _ => c) n - c| < \u03b5\n  calc |(fun _ => c) n - c| = |c - c| := by dsimp\n                          _ = |0|     := by {congr ; exact sub_self c}\n                          _ = 0       := abs_zero\n                          _ < \u03b5       := h\u03b5\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : limite (fun _ : \u2115 \u21a6 c) c :=\nby\n  intros \u03b5 h\u03b5\n  -- \u03b5 : \u211d\n  -- h\u03b5 : \u03b5 > 0\n  -- \u22a2 \u2203 N, \u2200 (n : \u2115), n \u2265 N \u2192 |(fun _ => c) n - c| < \u03b5\n  use 0\n  -- \u22a2 \u2200 (n : \u2115), n \u2265 0 \u2192 |(fun _ => c) n - c| < \u03b5\n  intros n _hn\n  -- n : \u2115\n  -- hn : n \u2265 0\n  -- \u22a2 |(fun _ => c) n - c| < \u03b5\n  show |(fun _ => c) n - c| < \u03b5\n  calc |(fun _ => c) n - c| = 0       := by simp\n                          _ < \u03b5       := h\u03b5\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : limite (fun _ : \u2115 \u21a6 c) c :=\nby\n  intros \u03b5 h\u03b5\n  -- \u03b5 : \u211d\n  -- h\u03b5 : \u03b5 > 0\n  -- \u22a2 \u2203 N, \u2200 (n : \u2115), n \u2265 N \u2192 |(fun _ => c) n - c| < \u03b5\n  aesop\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : limite (fun _ : \u2115 \u21a6 c) c :=\nby\n  intros \u03b5 h\u03b5\n  -- \u03b5 : \u211d\n  -- h\u03b5 : \u03b5 > 0\n  -- \u22a2 \u2203 N, \u2200 (n : \u2115), n \u2265 N \u2192 |(fun _ => c) n - c| < \u03b5\n  aesop\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : limite (fun _ : \u2115 \u21a6 c) c :=\n  fun \u03b5 h\u03b5 \u21a6 by aesop\n\n-- Lemas usados\n-- ============\n\n-- #check (sub_self a : a - a = 0)\n<\/pre>\n<p>Se puede interactuar con las demostraciones anteriores en <a href=\"https:\/\/live.lean-lang.org\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Calculemus2\/main\/src\/Convergencia_de_la_sucesion_constante.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isabelle\">\ntheory Limite_de_sucesiones_constantes\nimports Main HOL.Real\nbegin\n\ndefinition limite :: \"(nat \u21d2 real) \u21d2 real \u21d2 bool\"\n  where \"limite u c \u27f7 (\u2200\u03b5>0. \u2203k::nat. \u2200n\u2265k. \u00a6u n - c\u00a6 < \u03b5)\"\n\n(* 1\u00aa demostraci\u00f3n *)\n\nlemma \"limite (\u03bb n. c) c\"\nproof (unfold limite_def)\n  show \"\u2200\u03b5>0. \u2203k::nat. \u2200n\u2265k. \u00a6c - c\u00a6 < \u03b5\"\n  proof (intro allI impI)\n    fix \u03b5 :: real\n    assume \"0 < \u03b5\"\n    have \"\u2200n\u22650::nat. \u00a6c - c\u00a6 < \u03b5\"\n    proof (intro allI impI)\n      fix n :: nat\n      assume \"0 \u2264 n\"\n      have \"c - c = 0\"\n        by (simp only: diff_self)\n      then have \"\u00a6c - c\u00a6 = 0\"\n        by (simp only: abs_eq_0_iff)\n      also have \"\u2026 < \u03b5\"\n        by (simp only: \u20390 < \u03b5\u203a)\n      finally show \"\u00a6c - c\u00a6 < \u03b5\"\n        by this\n    qed\n    then show \"\u2203k::nat. \u2200n\u2265k. \u00a6c - c\u00a6 < \u03b5\"\n      by (rule exI)\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\n\nlemma \"limite (\u03bb n. c) c\"\nproof (unfold limite_def)\n  show \"\u2200\u03b5>0. \u2203k::nat. \u2200n\u2265k. \u00a6c - c\u00a6 < \u03b5\"\n  proof (intro allI impI)\n    fix \u03b5 :: real\n    assume \"0 < \u03b5\"\n    have \"\u2200n\u22650::nat. \u00a6c - c\u00a6 < \u03b5\"          by (simp add: \u20390 < \u03b5\u203a)\n    then show \"\u2203k::nat. \u2200n\u2265k. \u00a6c - c\u00a6 < \u03b5\" by (rule exI)\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\n\nlemma \"limite (\u03bb n. c) c\"\n  unfolding limite_def\n  by simp\n\n(* 4\u00aa demostraci\u00f3n *)\n\nlemma \"limite (\u03bb n. c) c\"\n  by (simp add: limite_def)\n\nend\n<\/pre>\n<h2>Referencias<\/h2>\n<ul>\n<li> J. Avigad y P. Massot. <a href=\"https:\/\/bit.ly\/3U4UjBk\">Mathematics in Lean<\/a>, p. 41.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"[mathjax]\n<p>En Lean, una sucesi\u00f3n \\\\(s\u2080, s\u2081, s\u2082, &#8230;\\\\) se puede representar mediante una funci\u00f3n \\(s : \u2115 \u2192 \u211d\\) de forma que \\(s(n)\\) es \\(s\u2099\\).<\/p>\n<p>Se define que \\(a\\) es el l\u00edmite de la sucesi\u00f3n \\(s\\), por<\/p>\n<pre lang=\"lean\">\r\ndef limite (s : \u2115 \u2192 \u211d) (a : \u211d) :=\r\n  \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |s n - a| < \u03b5\r\n<\/pre>\n<p>Demostrar que el l\u00edmite de la sucesi\u00f3n constante \\(s\u2099 = c\\) es \\(c\\).<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\r\nimport Mathlib.Data.Real.Basic\r\n\r\ndef limite (s : \u2115 \u2192 \u211d) (a : \u211d) :=\r\n  \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |s n - a| < \u03b5\r\n\r\nexample : limite (fun _ : \u2115 \u21a6 c) c :=\r\nby sorry\r\n<\/pre>\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":"default","_kad_post_title":"default","_kad_post_layout":"default","_kad_post_sidebar_id":"","_kad_post_content_style":"default","_kad_post_vertical_padding":"default","_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\/2014"}],"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=2014"}],"version-history":[{"count":12,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2014\/revisions"}],"predecessor-version":[{"id":2210,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2014\/revisions\/2210"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}