        {"id":568,"date":"2021-07-15T06:00:54","date_gmt":"2021-07-15T04:00:54","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=568"},"modified":"2021-07-07T12:46:43","modified_gmt":"2021-07-07T10:46:43","slug":"568-2","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/568-2\/","title":{"rendered":"L\u00edmite multiplicado por una constante"},"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 el l\u00edmite de u(i) es a, entonces el de c\u00b7u(i) es c\u00b7a.<\/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 : (\u2115 \u2192 \u211d) \u2192 \u211d \u2192 Prop :=\n\u03bb u c, \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n - c| < \u03b5\n\nexample\n  (h : limite u a)\n  : limite (\u03bb n, c * (u n)) (c * a) :=\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 : (\u2115 \u2192 \u211d) \u2192 \u211d \u2192 Prop :=\r\n\u03bb u c, \u2200 \u03b5 > 0, \u2203 N, \u2200 n \u2265 N, |u n - c| < \u03b5\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\n-- ===============\r\n\r\nexample\r\n  (h : limite u a)\r\n  : limite (\u03bb n, c * (u n)) (c * a) :=\r\nbegin\r\n  by_cases hc : c = 0,\r\n  { subst hc,\r\n    intros \u03b5 h\u03b5,\r\n    by finish, },\r\n  { intros \u03b5 h\u03b5,\r\n    have hc' : 0 < |c| := abs_pos.mpr hc,\r\n    have h\u03b5c : 0 < \u03b5 \/ |c| := div_pos h\u03b5 hc',\r\n    specialize h (\u03b5\/|c|) h\u03b5c,\r\n    cases h with N hN,\r\n    use N,\r\n    intros n hn,\r\n    specialize hN n hn,\r\n    dsimp only,\r\n    rw \u2190 mul_sub,\r\n    rw abs_mul,\r\n    rw \u2190 lt_div_iff' hc',\r\n    exact hN, }\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\n-- ===============\r\n\r\nexample\r\n  (h : limite u a)\r\n  : limite (\u03bb n, c * (u n)) (c * a) :=\r\nbegin\r\n  by_cases hc : c = 0,\r\n  { subst hc,\r\n    intros \u03b5 h\u03b5,\r\n    by finish, },\r\n  { intros \u03b5 h\u03b5,\r\n    have hc' : 0 < |c| := by finish,\r\n    have h\u03b5c : 0 < \u03b5 \/ |c| := div_pos h\u03b5 hc',\r\n    cases h (\u03b5\/|c|) h\u03b5c with N hN,\r\n    use N,\r\n    intros n hn,\r\n    specialize hN n hn,\r\n    dsimp only,\r\n    rw [\u2190 mul_sub, abs_mul, \u2190 lt_div_iff' hc'],\r\n    exact hN, }\r\nend\r\n<\/pre>\n<p>Se puede interactuar con la prueba anterior en <a href=\"https:\/\/www.cs.us.es\/~jalonso\/lean-web-editor\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Calculemus\/main\/src\/Limite_multiplicado_por_una_constante.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_multiplicado_por_una_constante\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\nlemma\r\n  assumes \"limite u a\"\r\n  shows   \"limite (\u03bb n. c * u n) (c * a)\"\r\nproof (unfold limite_def)\r\n  show \"\u2200\u03b5>0. \u2203k. \u2200n\u2265k. \u00a6c * u n - c * a\u00a6 < \u03b5\"\r\n  proof (intro allI impI)\r\n    fix \u03b5 :: real\r\n    assume \"0 < \u03b5\"\r\n    show \"\u2203k. \u2200n\u2265k. \u00a6c * u n - c * a\u00a6 < \u03b5\"\r\n    proof (cases \"c = 0\")\r\n      assume \"c = 0\"\r\n      then show \"\u2203k. \u2200n\u2265k. \u00a6c * u n - c * a\u00a6 < \u03b5\"\r\n        by (simp add: \u20390 < \u03b5\u203a)\r\n    next\r\n      assume \"c \u2260 0\"\r\n      then have \"0 < \u00a6c\u00a6\"\r\n        by simp\r\n      then have \"0 < \u03b5\/\u00a6c\u00a6\"\r\n        by (simp add: \u20390 < \u03b5\u203a)\r\n      then obtain N where hN : \"\u2200n\u2265N. \u00a6u n - a\u00a6 < \u03b5\/\u00a6c\u00a6\"\r\n        using assms limite_def\r\n        by auto\r\n      have \"\u2200n\u2265N. \u00a6c * u n - c * a\u00a6 < \u03b5\"\r\n      proof (intro allI impI)\r\n        fix n\r\n        assume \"n \u2265 N\"\r\n        have \"\u00a6c * u n - c * a\u00a6 = \u00a6c * (u n - a)\u00a6\"\r\n          by argo\r\n        also have \"\u2026 = \u00a6c\u00a6 * \u00a6u n - a\u00a6\"\r\n          by (simp only: abs_mult)\r\n        also have \"\u2026 < \u00a6c\u00a6 * (\u03b5\/\u00a6c\u00a6)\"\r\n          using hN \u2039n \u2265 N\u203a \u20390 < \u00a6c\u00a6\u203a\r\n          by (simp only: mult_strict_left_mono)\r\n        finally show \"\u00a6c * u n - c * a\u00a6 < \u03b5\"\r\n          using \u20390 < \u00a6c\u00a6\u203a\r\n          by auto\r\n      qed\r\n      then show \"\u2203k. \u2200n\u2265k. \u00a6c * u n - c * a\u00a6 < \u03b5\"\r\n        by (rule exI)\r\n    qed\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. 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 el l\u00edmite de u(i) es a, entonces el de c\u00b7u(i) es c\u00b7a. Para ello, completar la siguiente teor\u00eda de Lean: import data.real.basic import tactic variables (u v : \u2115 \u2192 \u211d) variables (a c : \u211d) notation `|`x`|`...\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\/568"}],"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=568"}],"version-history":[{"count":4,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/568\/revisions"}],"predecessor-version":[{"id":572,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/568\/revisions\/572"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}