        {"id":610,"date":"2021-07-30T06:00:55","date_gmt":"2021-07-30T04:00:55","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=610"},"modified":"2021-07-29T15:42:51","modified_gmt":"2021-07-29T13:42:51","slug":"limite-de-sucesion-menor-que-otra-sucesion","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/limite-de-sucesion-menor-que-otra-sucesion\/","title":{"rendered":"L\u00edmite de sucesi\u00f3n menor que otra sucesi\u00f3n"},"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>Se define que a es el l\u00edmite de la sucesi\u00f3n u, por<\/p>\n<pre lang=\"text\">\n   def limite : (\u2115 \u2192 \u211d) \u2192 \u211d \u2192 Prop :=\n   \u03bb u a, \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n - a| < \u03b5\n<\/pre>\n<p>donde se usa la notaci\u00f3n |x| para el valor absoluto de x<\/p>\n<pre lang=\"text\">\n   notation `|`x`|` := abs x\n<\/pre>\n<p>Demostrar que si a\u2099 \u2192 l, b\u2099 \u2192 m y a\u2099 \u2264 b\u2099 para todo n, entonces l \u2264 m.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.real.basic\nimport tactic\n\nvariables (u v : \u2115 \u2192 \u211d)\nvariables (a c : \u211d)\n\nnotation `|`x`|` := abs x\n\ndef limite (u : \u2115 \u2192 \u211d) (c : \u211d) :=\n\u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n - c| < \u03b5\n\nexample\n  (hu : limite u a)\n  (hv : limite v c)\n  (hle : \u2200 n, u n \u2264 v n)\n  : a \u2264 c :=\nsorry\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\nvariables (u v : \u2115 \u2192 \u211d)\r\nvariables (a c : \u211d)\r\n\r\nnotation `|`x`|` := abs x\r\n\r\ndef limite (u : \u2115 \u2192 \u211d) (c : \u211d) :=\r\n\u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n - c| < \u03b5\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample\r\n  (hu : limite u a)\r\n  (hv : limite v c)\r\n  (hle : \u2200 n, u n \u2264 v n)\r\n  : a \u2264 c :=\r\nbegin\r\n  apply le_of_not_lt,\r\n  intro hlt,\r\n  set \u03b5 := (a - c) \/2 with h\u03b5ac,\r\n  have h\u03b5 : 0 < \u03b5 :=\r\n    half_pos (sub_pos.mpr hlt),\r\n  cases hu \u03b5 h\u03b5 with Nu HNu,\r\n  cases hv \u03b5 h\u03b5 with Nv HNv,\r\n  let N := max Nu Nv,\r\n  have HNu' : Nu \u2264 N := le_max_left Nu Nv,\r\n  have HNv' : Nv \u2264 N := le_max_right Nu Nv,\r\n  have Ha : |u N - a| < \u03b5 := HNu N HNu',\r\n  have Hc : |v N - c| < \u03b5 := HNv N HNv',\r\n  have HN : u N \u2264 v N := hle N,\r\n  apply lt_irrefl (a - c),\r\n  calc a - c\r\n       = (a - u N) + (u N - c)   : by ring\r\n   ... \u2264 (a - u N) + (v N - c)   : by simp [HN]\r\n   ... \u2264 |(a - u N) + (v N - c)| : le_abs_self ((a - u N) + (v N - c))\r\n   ... \u2264 |a - u N| + |v N - c|   : abs_add (a - u N) (v N - c)\r\n   ... = |u N - a| + |v N - c|   : by simp only [abs_sub]\r\n   ... < \u03b5 + \u03b5                   : add_lt_add Ha Hc\r\n   ... = a - c                   : add_halves (a - c),\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample\r\n  (hu : limite u a)\r\n  (hv : limite v c)\r\n  (hle : \u2200 n, u n \u2264 v n)\r\n  : a \u2264 c :=\r\nbegin\r\n  apply le_of_not_lt,\r\n  intro hlt,\r\n  set \u03b5 := (a - c) \/2 with h\u03b5,\r\n  cases hu \u03b5 (by linarith) with Nu HNu,\r\n  cases hv \u03b5 (by linarith) with Nv HNv,\r\n  let N := max Nu Nv,\r\n  have Ha : |u N - a| < \u03b5 :=\r\n    HNu N (le_max_left Nu Nv),\r\n  have Hc : |v N - c| < \u03b5 :=\r\n    HNv N (le_max_right Nu Nv),\r\n  have HN : u N \u2264 v N := hle N,\r\n  apply lt_irrefl (a - c),\r\n  calc a - c\r\n       = (a - u N) + (u N - c)   : by ring\r\n   ... \u2264 (a - u N) + (v N - c)   : by simp [HN]\r\n   ... \u2264 |(a - u N) + (v N - c)| : le_abs_self ((a - u N) + (v N - c))\r\n   ... \u2264 |a - u N| + |v N - c|   : abs_add (a - u N) (v N - c)\r\n   ... = |u N - a| + |v N - c|   : by simp only [abs_sub]\r\n   ... < \u03b5 + \u03b5                   : add_lt_add Ha Hc\r\n   ... = a - c                   : add_halves (a - c),\r\nend\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample\r\n  (hu : limite u a)\r\n  (hv : limite v c)\r\n  (hle : \u2200 n, u n \u2264 v n)\r\n  : a \u2264 c :=\r\nbegin\r\n  apply le_of_not_lt,\r\n  intro hlt,\r\n  set \u03b5 := (a - c) \/2 with h\u03b5,\r\n  cases hu \u03b5 (by linarith) with Nu HNu,\r\n  cases hv \u03b5 (by linarith) with Nv HNv,\r\n  let N := max Nu Nv,\r\n  have Ha : |u N - a| < \u03b5 :=\r\n    HNu N (le_max_left Nu Nv),\r\n  have Hc : |v N - c| < \u03b5 :=\r\n    HNv N (le_max_right Nu Nv),\r\n  have HN : u N \u2264 v N := hle N,\r\n  apply lt_irrefl (a - c),\r\n  calc a - c\r\n       = (a - u N) + (u N - c)   : by ring\r\n   ... \u2264 (a - u N) + (v N - c)   : by simp [HN]\r\n   ... \u2264 |(a - u N) + (v N - c)| : by simp [le_abs_self]\r\n   ... \u2264 |a - u N| + |v N - c|   : by simp [abs_add]\r\n   ... = |u N - a| + |v N - c|   : by simp [abs_sub]\r\n   ... < \u03b5 + \u03b5                   : add_lt_add Ha Hc\r\n   ... = a - c                   : by simp,\r\nend\r\n\r\n-- 4\u00aa demostraci\u00f3n\r\nexample\r\n  (hu : limite u a)\r\n  (hv : limite v c)\r\n  (hle : \u2200 n, u n \u2264 v n)\r\n  : a \u2264 c :=\r\nbegin\r\n  apply le_of_not_lt,\r\n  intro hlt,\r\n  set \u03b5 := (a - c) \/2 with h\u03b5,\r\n  cases hu \u03b5 (by linarith) with Nu HNu,\r\n  cases hv \u03b5 (by linarith) with Nv HNv,\r\n  let N := max Nu Nv,\r\n  have Ha : |u N - a| < \u03b5 :=\r\n    HNu N (le_max_left Nu Nv),\r\n  have Hc : |v N - c| < \u03b5 :=\r\n    HNv N (le_max_right Nu Nv),\r\n  have HN : u N \u2264 v N := hle N,\r\n  apply lt_irrefl (a - c),\r\n  rw abs_lt at Ha Hc,\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_sucesion_menor_que_otra_sucesion.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_sucesion_menor_que_otra_sucesion\r\nimports Main HOL.Real\r\nbegin\r\n\r\ndefinition limite :: \"(nat \u21d2 real) \u21d2 real \u21d2 bool\"\r\n  where \"limite u c \u27f7 (\u2200\u03b5>0. \u2203k::nat. \u2200n\u2265k. \u00a6u n - c\u00a6 < \u03b5)\"\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"limite u a\"\r\n          \"limite v c\"\r\n          \"\u2200n. u n \u2264 v n\"\r\n  shows   \"a \u2264 c\"\r\nproof (rule leI ; intro notI)\r\n  assume \"c < a\"\r\n  let ?\u03b5 = \"(a - c) \/2\"\r\n  have \"0 < ?\u03b5\"\r\n    using \u2039c < a\u203a by simp\r\n  obtain Nu where HNu : \"\u2200n\u2265Nu. \u00a6u n - a\u00a6 < ?\u03b5\"\r\n    using assms(1) limite_def \u20390 < ?\u03b5\u203a by blast\r\n  obtain Nv where HNv : \"\u2200n\u2265Nv. \u00a6v n - c\u00a6 < ?\u03b5\"\r\n    using assms(2) limite_def \u20390 < ?\u03b5\u203a by blast\r\n  let ?N = \"max Nu Nv\"\r\n  have \"?N \u2265 Nu\"\r\n    by simp\r\n  then have Ha : \"\u00a6u ?N - a\u00a6 < ?\u03b5\"\r\n    using HNu by simp\r\n  have \"?N \u2265 Nv\"\r\n    by simp\r\n  then have Hc : \"\u00a6v ?N - c\u00a6 < ?\u03b5\"\r\n    using HNv by simp\r\n  have \"a - c < a - c\"\r\n  proof -\r\n    have \"a - c = (a - u ?N) + (u ?N - c)\"\r\n      by simp\r\n    also have \"\u2026 \u2264 (a - u ?N) + (v ?N - c)\"\r\n      using assms(3) by auto\r\n    also have \"\u2026 \u2264 \u00a6(a - u ?N) + (v ?N - c)\u00a6\"\r\n      by (rule abs_ge_self)\r\n    also have \"\u2026 \u2264 \u00a6a - u ?N\u00a6 + \u00a6v ?N - c\u00a6\"\r\n      by (rule abs_triangle_ineq)\r\n    also have \"\u2026 = \u00a6u ?N - a\u00a6 + \u00a6v ?N - c\u00a6\"\r\n      by (simp only: abs_minus_commute)\r\n    also have \"\u2026 < ?\u03b5 + ?\u03b5\"\r\n      using Ha Hc by (simp only: add_strict_mono)\r\n    also have \"\u2026 = a - c\"\r\n      by (rule field_sum_of_halves)\r\n    finally show \"a - c < a - c\"\r\n      by this\r\n  qed\r\n  have \"\u00ac a - c < a - c\"\r\n    by (rule less_irrefl)\r\n  then show False\r\n    using \u2039a - c < a - c\u203a by (rule notE)\r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"limite u a\"\r\n          \"limite v c\"\r\n          \"\u2200n. u n \u2264 v n\"\r\n  shows   \"a \u2264 c\"\r\nproof (rule leI ; intro notI)\r\n  assume \"c < a\"\r\n  let ?\u03b5 = \"(a - c) \/2\"\r\n  have \"0 < ?\u03b5\"\r\n    using \u2039c < a\u203a by simp\r\n  obtain Nu where HNu : \"\u2200n\u2265Nu. \u00a6u n - a\u00a6 < ?\u03b5\"\r\n    using assms(1) limite_def \u20390 < ?\u03b5\u203a by blast\r\n  obtain Nv where HNv : \"\u2200n\u2265Nv. \u00a6v n - c\u00a6 < ?\u03b5\"\r\n    using assms(2) limite_def \u20390 < ?\u03b5\u203a by blast\r\n  let ?N = \"max Nu Nv\"\r\n  have \"?N \u2265 Nu\"\r\n    by simp\r\n  then have Ha : \"\u00a6u ?N - a\u00a6 < ?\u03b5\"\r\n    using HNu by simp\r\n  then have Ha' : \"u ?N - a < ?\u03b5 \u2227 -(u ?N - a) < ?\u03b5\"\r\n    by argo\r\n  have \"?N \u2265 Nv\"\r\n    by simp\r\n  then have Hc : \"\u00a6v ?N - c\u00a6 < ?\u03b5\"\r\n    using HNv by simp\r\n  then have Hc' : \"v ?N - c < ?\u03b5 \u2227 -(v ?N - c) < ?\u03b5\"\r\n    by argo\r\n  have \"a - c < a - c\"\r\n    using assms(3) Ha' Hc'\r\n    by (smt (verit, best) field_sum_of_halves)\r\n  have \"\u00ac a - c < a - c\"\r\n    by simp\r\n  then show False\r\n    using \u2039a - c < a - c\u203a by simp\r\nqed\r\n\r\n(* 3\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"limite u a\"\r\n          \"limite v c\"\r\n          \"\u2200n. u n \u2264 v n\"\r\n  shows   \"a \u2264 c\"\r\nproof (rule leI ; intro notI)\r\n  assume \"c < a\"\r\n  let ?\u03b5 = \"(a - c) \/2\"\r\n  have \"0 < ?\u03b5\"\r\n    using \u2039c < a\u203a by simp\r\n  obtain Nu where HNu : \"\u2200n\u2265Nu. \u00a6u n - a\u00a6 < ?\u03b5\"\r\n    using assms(1) limite_def \u20390 < ?\u03b5\u203a by blast\r\n  obtain Nv where HNv : \"\u2200n\u2265Nv. \u00a6v n - c\u00a6 < ?\u03b5\"\r\n    using assms(2) limite_def \u20390 < ?\u03b5\u203a by blast\r\n  let ?N = \"max Nu Nv\"\r\n  have \"?N \u2265 Nu\"\r\n    by simp\r\n  then have Ha : \"\u00a6u ?N - a\u00a6 < ?\u03b5\"\r\n    using HNu by simp\r\n  then have Ha' : \"u ?N - a < ?\u03b5 \u2227 -(u ?N - a) < ?\u03b5\"\r\n    by argo\r\n  have \"?N \u2265 Nv\"\r\n    by simp\r\n  then have Hc : \"\u00a6v ?N - c\u00a6 < ?\u03b5\"\r\n    using HNv by simp\r\n  then have Hc' : \"v ?N - c < ?\u03b5 \u2227 -(v ?N - c) < ?\u03b5\"\r\n    by argo\r\n  show False\r\n    using assms(3) Ha' Hc'\r\n    by (smt (verit, best) field_sum_of_halves)\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. Se define que a es el l\u00edmite de la sucesi\u00f3n u, por def limite : (\u2115 \u2192 \u211d) \u2192 \u211d \u2192 Prop := \u03bb u a, \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 Demostrar que si a\u2099 \u2192 l, b\u2099 \u2192 m y a\u2099 \u2264 b\u2099 para todo n, entonces l \u2264 m. Para ello, completar la siguiente teor\u00eda de Lean: import data.real.basic import tactic variables (u v : \u2115 \u2192 \u211d) variables (a...\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\/610"}],"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=610"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/610\/revisions"}],"predecessor-version":[{"id":611,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/610\/revisions\/611"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}