        {"id":1884,"date":"2023-12-27T06:00:13","date_gmt":"2023-12-27T04:00:13","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=1884"},"modified":"2023-12-25T13:17:35","modified_gmt":"2023-12-25T11:17:35","slug":"27-dic-23","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/27-dic-23\/","title":{"rendered":"En \u211d, x\u00b2 + y\u00b2 = 0 \u2194 x = 0 \u2227 y = 0"},"content":{"rendered":"\n<p>Demostrar con Lean4 que si &#92;(x, y \u2208 \u211d&#92;), entonces<br \/>\n&#92;[ x^2 + y^2 = 0 \u2194 x = 0 \u2227 y = 0 &#92;]<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\nvariable {x y : \u211d}\n\nexample : x^2 + y^2 = 0 \u2194 x = 0 \u2227 y = 0 :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<p><b>Demostraci\u00f3n en lenguaje natural<\/b><\/p>\n<p>En la demostraci\u00f3n usaremos el siguiente lema auxiliar<br \/>\n&#92;[ (\u2200 x, y \u2208 \u211d)[x\u00b2 + y\u00b2 = 0 \u2192 x = 0] &#92;]<\/p>\n<p>Para la primera implicaci\u00f3n, supongamos que<br \/>\n&#92;[ x\u00b2 + y\u00b2 = 0 &#92;tag{1} &#92;]<br \/>\nEntonces, por el lema auxiliar,<br \/>\n&#92;[ x = 0 &#92;tag{2} &#92;]<br \/>\nAdem\u00e1s, aplicando la conmutativa a (1), se tiene<br \/>\n&#92;[ y\u00b2 + x\u00b2 = 0 &#92;]<br \/>\ny, por el lema auxiliar,<br \/>\n&#92;[ y = 0 &#92;tag{3} &#92;]<br \/>\nDe (2) y (3) se tiene<br \/>\n&#92;[ x = 0 \u2227 y = 0 &#92;]<\/p>\n<p>Para la segunda implicaci\u00f3n, supongamos que<br \/>\n&#92;[ x = 0 \u2227 y = 0 &#92;]<br \/>\nPor tanto,<br \/>\n&#92;begin{align}<br \/>\n   x\u00b2 + y\u00b2 &amp;= 0\u00b2 + 0\u00b2 &#92;&#92;<br \/>\n           &amp;= 0<br \/>\n&#92;end{align}<\/p>\n<p>En la demostraci\u00f3n del lema auxiliar se usar\u00e1n los siguientes lemas<br \/>\n&#92;begin{align}<br \/>\n   &amp;(\u2200 x \u2208 \u211d)(\u2200 n \u2208 \u2115)[x^n = 0 \u2192 x = 0]  &#92;tag{L1} &#92;&#92;<br \/>\n   &amp;(\u2200 x, y \u2208 \u211d)[x \u2264 y \u2192 y \u2264 x \u2192 x = y]  &#92;tag{L2} &#92;&#92;<br \/>\n   &amp;(\u2200 x, y \u2208 \u211d)[0 \u2264 y \u2192 x \u2264 x + y]      &#92;tag{L3} &#92;&#92;<br \/>\n   &amp;(\u2200 x \u2208 \u211d)[0 \u2264 x\u00b2]                    &#92;tag{L4}<br \/>\n&#92;end{align}<\/p>\n<p>Por el lema L1, para demostrar el lema auxiliar basta demostrar<br \/>\n&#92;[ x\u00b2 = 0 &#92;tag{1} &#92;]<br \/>\ny, por el lema L2, basta demostrar las siguientes desigualdades<br \/>\n&#92;begin{align}<br \/>\n    &amp;x\u00b2 \u2264 0 &#92;tag{2} &#92;&#92;<br \/>\n    &amp;0 \u2264 x\u00b2 &#92;tag{3}<br \/>\n&#92;end{align}<\/p>\n<p>La prueba de la (2) es<br \/>\n&#92;begin{align}<br \/>\n   x\u00b2 &amp;\u2264 x\u00b2 + y\u00b2   &amp;&amp;&#92;text{[por L3 y L4]} &#92;&#92;<br \/>\n      &amp;= 0         &amp;&amp;&#92;text{[por la hip\u00f3tesis]}<br \/>\n&#92;end{align}<\/p>\n<p>La (3) se tiene por el lema L4.<\/p>\n<p><b>Demostraciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\nvariable {x y : \u211d}\n\n-- 1\u00aa demostraci\u00f3n del lema auxiliar\n-- =================================\n\nexample\n  (h : x^2 + y^2 = 0)\n  : x = 0 :=\nby\n  have h' : x^2 = 0 := by\n  { apply le_antisymm\n    . show x ^ 2 \u2264 0\n      calc x ^ 2 \u2264 x^2 + y^2 := by simp [le_add_of_nonneg_right,\n                                         pow_two_nonneg]\n               _ = 0         := by exact h\n    . show 0 \u2264 x ^ 2\n      apply pow_two_nonneg }\n  show x = 0\n  exact pow_eq_zero h'\n\n-- 2\u00aa demostraci\u00f3n lema auxiliar\n-- =============================\n\nexample\n  (h : x^2 + y^2 = 0)\n  : x = 0 :=\nby\n  have h' : x^2 = 0 := by\n  { apply le_antisymm\n    . -- \u22a2 x ^ 2 \u2264 0\n      calc x ^ 2 \u2264 x^2 + y^2 := by simp [le_add_of_nonneg_right,\n                                         pow_two_nonneg]\n               _ = 0         := by exact h\n    . -- \u22a2 0 \u2264 x ^ 2\n      apply pow_two_nonneg }\n  exact pow_eq_zero h'\n\n-- 3\u00aa demostraci\u00f3n lema auxiliar\n-- =============================\n\nlemma aux\n  (h : x^2 + y^2 = 0)\n  : x = 0 :=\n  have h' : x ^ 2 = 0 := by linarith [pow_two_nonneg x, pow_two_nonneg y]\n  pow_eq_zero h'\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : x^2 + y^2 = 0 \u2194 x = 0 \u2227 y = 0 :=\nby\n  constructor\n  . -- \u22a2 x ^ 2 + y ^ 2 = 0 \u2192 x = 0 \u2227 y = 0\n    intro h\n    -- h : x ^ 2 + y ^ 2 = 0\n    -- \u22a2 x = 0 \u2227 y = 0\n    constructor\n    . -- \u22a2 x = 0\n      exact aux h\n    . -- \u22a2 y = 0\n      rw [add_comm] at h\n      -- h : x ^ 2 + y ^ 2 = 0\n      exact aux h\n  . -- \u22a2 x = 0 \u2227 y = 0 \u2192 x ^ 2 + y ^ 2 = 0\n    intro h1\n    -- h1 : x = 0 \u2227 y = 0\n    -- \u22a2 x ^ 2 + y ^ 2 = 0\n    rcases h1 with \u27e8h2, h3\u27e9\n    -- h2 : x = 0\n    -- h3 : y = 0\n    rw [h2, h3]\n    -- \u22a2 0 ^ 2 + 0 ^ 2 = 0\n    norm_num\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : x^2 + y^2 = 0 \u2194 x = 0 \u2227 y = 0 :=\nby\n  constructor\n  . -- \u22a2 x ^ 2 + y ^ 2 = 0 \u2192 x = 0 \u2227 y = 0\n    intro h\n    -- h : x ^ 2 + y ^ 2 = 0\n    -- \u22a2 x = 0 \u2227 y = 0\n    constructor\n    . -- \u22a2 x = 0\n      exact aux h\n    . -- \u22a2 y = 0\n      rw [add_comm] at h\n      -- h : x ^ 2 + y ^ 2 = 0\n      exact aux h\n  . -- \u22a2 x = 0 \u2227 y = 0 \u2192 x ^ 2 + y ^ 2 = 0\n    rintro \u27e8h1, h2\u27e9\n    -- h1 : x = 0\n    -- h2 : y = 0\n    -- \u22a2 x ^ 2 + y ^ 2 = 0\n    rw [h1, h2]\n    -- \u22a2 0 ^ 2 + 0 ^ 2 = 0\n    norm_num\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : x ^ 2 + y ^ 2 = 0 \u2194 x = 0 \u2227 y = 0 := by\n  constructor\n  \u00b7 -- \u22a2 x ^ 2 + y ^ 2 = 0 \u2192 x = 0 \u2227 y = 0\n    intro h\n    -- h : x ^ 2 + y ^ 2 = 0\n    -- \u22a2 x = 0 \u2227 y = 0\n    constructor\n    \u00b7 -- x = 0\n      exact aux h\n    . -- \u22a2 y = 0\n      rw [add_comm] at h\n      -- h : y ^ 2 + x ^ 2 = 0\n      exact aux h\n  . -- \u22a2 x = 0 \u2227 y = 0 \u2192 x ^ 2 + y ^ 2 = 0\n    rintro \u27e8rfl, rfl\u27e9\n    -- \u22a2 0 ^ 2 + 0 ^ 2 = 0\n    norm_num\n\n-- Lemas usados\n-- ============\n\n-- #check (add_comm x y : x + y = y + x)\n-- #check (le_add_of_nonneg_right : 0 \u2264 y \u2192 x \u2264 x + y)\n-- #check (le_antisymm : x \u2264 y \u2192 y \u2264 x \u2192 x = y)\n-- #check (pow_eq_zero : \u2200 {n : \u2115}, x ^ n = 0 \u2192 x = 0)\n-- #check (pow_two_nonneg x : 0 \u2264 x ^ 2)\n<\/pre>\n<p><b>Demostraciones interactivas<\/b><\/p>\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\/Suma_nula_de_dos_cuadrados.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<p><b>Referencias<\/b><\/p>\n<ul>\n<li> J. Avigad y P. Massot. <a href=\"https:\/\/bit.ly\/3U4UjBk\">Mathematics in Lean<\/a>, p. 37.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que si &#92;(x, y \u2208 \u211d&#92;), entonces &#92;[ x^2 + y^2 = 0 \u2194 x = 0 \u2227 y = 0 &#92;] Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Real.Basic variable {x y : \u211d} example : x^2 + y^2 = 0 \u2194 x = 0 \u2227 y = 0 := by sorry<\/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":[1],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1884"}],"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=1884"}],"version-history":[{"count":2,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1884\/revisions"}],"predecessor-version":[{"id":1886,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1884\/revisions\/1886"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=1884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=1884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=1884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}