        {"id":1690,"date":"2023-10-16T06:00:13","date_gmt":"2023-10-16T04:00:13","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=1690"},"modified":"2023-10-10T12:48:55","modified_gmt":"2023-10-10T10:48:55","slug":"16-oct-23","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/16-oct-23\/","title":{"rendered":"El producto de dos funciones impares es par"},"content":{"rendered":"<p>Demostrar con Lean4 que el producto de dos funciones impares es par.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\nvariable (f g : \u211d \u2192 \u211d)\n\n-- (esPar f) expresa que f es par.\ndef esPar (f : \u211d \u2192 \u211d) : Prop :=\n  \u2200 x, f x = f (-x)\n\n-- (esImpar f) expresa que f es impar.\ndef esImpar  (f : \u211d \u2192 \u211d) : Prop :=\n  \u2200 x, f x = - f (-x)\n\nexample\n  (h1 : esImpar f)\n  (h2 : esImpar g)\n  : esPar (f * g) :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<p><b>Demostraci\u00f3n en lenguaje natural<\/b><\/p>\n<p><br \/>\nSupongamos que &#92;(f&#92;) y &#92;(g&#92;) son funciones impares. Tenemos que demostrar que &#92;(f\u00b7g&#92;) es par; es decir, que<br \/>\n&#92;[ (\u2200 x \u2208 \u211d) (f\u00b7g)(x) = (f\u00b7g)(-x) &#92;]<br \/>\nSea &#92;(x \u2208 \u211d&#92;). Entonces,<br \/>\n&#92;begin{align}<br \/>\n   (f\u00b7g)(x) &amp;= f(x)g(x)          &#92;&#92;<br \/>\n            &amp;= (-f(-x))g(x)      &amp;&amp;&#92;text{[porque &#92;(f&#92;) es impar]} &#92;&#92;<br \/>\n            &amp;= (-f(-x)(-g(-x))   &amp;&amp;&#92;text{[porque &#92;(g&#92;) es impar]} &#92;&#92;<br \/>\n            &amp;= f(-x)g(-x))       &#92;&#92;<br \/>\n            &amp;= (f\u00b7g)(-x)<br \/>\n&#92;end{align}<\/p>\n<p><b>Demostraciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\nvariable (f g : \u211d \u2192 \u211d)\n\n-- (esPar f) expresa que f es par.\ndef esPar (f : \u211d \u2192 \u211d) : Prop :=\n  \u2200 x, f x = f (-x)\n\n-- (esImpar f) expresa que f es impar.\ndef esImpar  (f : \u211d \u2192 \u211d) : Prop :=\n  \u2200 x, f x = - f (-x)\n\n-- 1\u00aa demostraci\u00f3n\nexample\n  (h1 : esImpar f)\n  (h2 : esImpar g)\n  : esPar (f * g) :=\nby\n  intro x\n  have h1 : f x = -f (-x) := h1 x\n  have h2 : g x = -g (-x) := h2 x\n  calc (f * g) x\n       = f x * g x             := rfl\n     _ = (-f (-x)) * g x       := congrArg (. * g x) h1\n     _ = (-f (-x)) * (-g (-x)) := congrArg ((-f (-x)) * .) h2\n     _ = f (-x) * g (-x)       := neg_mul_neg (f (-x)) (g (-x))\n     _ = (f * g) (-x)          := rfl\n\n-- 2\u00aa demostraci\u00f3n\nexample\n  (h1 : esImpar f)\n  (h2 : esImpar g)\n  : esPar (f * g) :=\nby\n  intro x\n  calc (f * g) x\n       = f x * g x             := rfl\n     _ = (-f (-x)) * g x       := congrArg (. * g x) (h1 x)\n     _ = (-f (-x)) * (-g (-x)) := congrArg ((-f (-x)) * .) (h2 x)\n     _ = f (-x) * g (-x)       := neg_mul_neg (f (-x)) (g (-x))\n     _ = (f * g) (-x)          := rfl\n\n-- 3\u00aa demostraci\u00f3n\nexample\n  (h1 : esImpar f)\n  (h2 : esImpar g)\n  : esPar (f * g) :=\nby\n  intro x\n  calc (f * g) x\n       = f x * g x         := rfl\n     _ = -f (-x) * -g (-x) := by rw [h1, h2]\n     _ = f (-x) * g (-x)   := by rw [neg_mul_neg]\n     _ = (f * g) (-x)      := rfl\n\n-- 4\u00aa demostraci\u00f3n\nexample\n  (h1 : esImpar f)\n  (h2 : esImpar g)\n  : esPar (f * g) :=\nby\n  intro x\n  calc (f * g) x\n       = f x * g x       := rfl\n     _ = f (-x) * g (-x) := by rw [h1, h2, neg_mul_neg]\n     _ = (f * g) (-x)    := rfl\n\n-- Lemas usados\n-- ============\n\n-- variable (a b : \u211d)\n-- #check (neg_mul_neg a b : -a * -b = a * b)\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\/Producto_de_funciones_impares.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. 26.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que el producto de dos funciones impares es par. Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Real.Basic variable (f g : \u211d \u2192 \u211d) &#8212; (esPar f) expresa que f es par. def esPar (f : \u211d \u2192 \u211d) : Prop := \u2200 x, f x = f (-x) &#8212; (esImpar f) expresa que f es impar. def esImpar (f : \u211d \u2192 \u211d) : Prop := \u2200 x, f x = &#8211; f (-x) example (h1 : esImpar f) (h2 : esImpar g) : esPar (f * g) := 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":[302,297],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1690"}],"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=1690"}],"version-history":[{"count":5,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1690\/revisions"}],"predecessor-version":[{"id":1710,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1690\/revisions\/1710"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=1690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=1690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=1690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}