        {"id":1241,"date":"2023-07-10T06:00:03","date_gmt":"2023-07-10T04:00:03","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=1241"},"modified":"2023-07-19T12:43:35","modified_gmt":"2023-07-19T10:43:35","slug":"10-jul-23","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/10-jul-23\/","title":{"rendered":"\u2200 m n : \u2115, Even n \u2192 Even (m * n)"},"content":{"rendered":"<p>Demostrar que los productos de los n\u00fameros naturales por n\u00fameros pares son pares.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\r\nimport Mathlib.Data.Nat.Basic\r\nimport Mathlib.Data.Nat.Parity\r\nimport Mathlib.Tactic\r\n\r\nopen Nat\r\n\r\nexample : \u2200 m n : \u2115, Even n \u2192 Even (m * n) := by\r\n  sorry\r\n<\/pre>\n<p><!-- more--><\/p>\n<p><b>Demostraci\u00f3n en lenguaje natural<\/b><\/p>\n<p><br \/>\nSi \\(n\\) es par, entonces (por la definici\u00f3n de `Even`) existe un \\(k\\) tal que<br \/>\n\\[<br \/>\n\\begin{align*}<br \/>\nn = k + k &#038;&#038; (1)<br \/>\n\\end{align*}<br \/>\n\\]<br \/>\nPor tanto,<br \/>\n\\[<br \/>\n\\begin{align*}<br \/>\n   mn &#038;= m(k + k)    &#038;&#038; (\\text{por (1)})\\\\<br \/>\n         &#038;= mk + mk  &#038;&#038; (\\text{por la propiedad distributiva})<br \/>\n\\end{align*}<br \/>\n\\]<br \/>\nPor consiguiente, \\(mn\\) es par.<\/p>\n<p><b>Soluciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\r\nimport Mathlib.Data.Nat.Basic\r\nimport Mathlib.Data.Nat.Parity\r\nimport Mathlib.Tactic\r\n\r\nopen Nat\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : \u2115, Even n \u2192 Even (m * n) := by\r\n  rintro m n \u27e8k, hk\u27e9\r\n  use m * k\r\n  rw [hk]\r\n  ring\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : \u2115, Even n \u2192 Even (m * n) := by\r\n  rintro m n \u27e8k, hk\u27e9\r\n  use m * k\r\n  rw [hk]\r\n  rw [mul_add]\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : \u2115, Even n \u2192 Even (m * n) := by\r\n  rintro m n \u27e8k, hk\u27e9\r\n  use m * k\r\n  rw [hk, mul_add]\r\n\r\n-- 4\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : Nat, Even n \u2192 Even (m * n) := by\r\n  rintro m n \u27e8k, hk\u27e9; use m * k; rw [hk, mul_add]\r\n\r\n-- 5\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : \u2115, Even n \u2192 Even (m * n) := by\r\n  rintro m n \u27e8k, hk\u27e9\r\n  exact \u27e8m * k, by rw [hk, mul_add]\u27e9\r\n\r\n-- 6\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : Nat, Even n \u2192 Even (m * n) :=\r\nfun m n \u27e8k, hk\u27e9 \u21a6 \u27e8m * k, by rw [hk, mul_add]\u27e9\r\n\r\n-- 7\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : \u2115, Even n \u2192 Even (m * n) := by\r\n  rintro m n \u27e8k, hk\u27e9\r\n  use m * k\r\n  rw [hk]\r\n  exact mul_add m k k\r\n\r\n-- 8\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : \u2115, Even n \u2192 Even (m * n) := by\r\n  intros m n hn\r\n  unfold Even at *\r\n  cases hn with\r\n  | intro k hk =>\r\n    use m * k\r\n    rw [hk, mul_add]\r\n\r\n-- 9\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : \u2115, Even n \u2192 Even (m * n) := by\r\n  intros m n hn\r\n  unfold Even at *\r\n  cases hn with\r\n  | intro k hk =>\r\n    use m * k\r\n    calc m * n\r\n       = m * (k + k)   := by exact congrArg (HMul.hMul m) hk\r\n     _ = m * k + m * k := by exact mul_add m k k\r\n\r\n-- 10\u00aa demostraci\u00f3n\r\nexample : \u2200 m n : Nat, Even n \u2192 Even (m * n) := by\r\n  intros; simp [*, parity_simps]\r\n<\/pre>\n<p>Se puede interactuar con las pruebas anteriores en <a href=\"https:\/\/lean.math.hhu.de\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Calculemus2\/main\/src\/El_producto_por_un_par_es_par.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. 3.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar que los productos de los n\u00fameros naturales por n\u00fameros pares son pares. Para ello, completar la siguiente teor\u00eda de Lean: import Mathlib.Data.Nat.Basic import Mathlib.Data.Nat.Parity import Mathlib.Tactic open Nat example : \u2200 m n : \u2115, Even n \u2192 Even (m * n) := by sorry Demostraci\u00f3n en lenguaje natural Si \\(n\\) es par, entonces (por la definici\u00f3n de `Even`) existe un \\(k\\) tal que \\[ \\begin{align*} n = k + k &#038;&#038; (1) \\end{align*} \\] Por tanto, \\[ \\begin{align*} mn &#038;= m(k + k) &#038;&#038; (\\text{por (1)})\\\\ &#038;= mk + mk &#038;&#038; (\\text{por la propiedad distributiva}) \\end{align*} \\] Por consiguiente, \\(mn\\) es par. Soluciones con Lean4 import Mathlib.Data.Nat.Basic import Mathlib.Data.Nat.Parity import Mathlib.Tactic open Nat &#8212; 1\u00aa demostraci\u00f3n example : \u2200 m n : \u2115,&#8230;<\/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":[25],"tags":[296],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1241"}],"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=1241"}],"version-history":[{"count":15,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1241\/revisions"}],"predecessor-version":[{"id":1368,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1241\/revisions\/1368"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=1241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=1241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=1241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}