        {"id":1695,"date":"2023-10-17T06:00:54","date_gmt":"2023-10-17T04:00:54","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=1695"},"modified":"2023-10-10T12:50:14","modified_gmt":"2023-10-10T10:50:14","slug":"17-oct-23","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/17-oct-23\/","title":{"rendered":"El producto de una funci\u00f3n par por una impar es impar"},"content":{"rendered":"<p>Demostrar con Lean4 que el producto de una funci\u00f3n par por una impar es impar.<\/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 : esPar f)\n  (h2 : esImpar g)\n  : esImpar (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;) es una funci\u00f3n par y &#92;(g&#92;) lo es impar. Tenemos que demostrar que &#92;(f\u00b7g&#92;) es imppar; 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 par]} &#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 : esPar f)\n  (h2 : esImpar g)\n  : esImpar (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))   := mul_neg (f (-x)) (g (-x))\n     _ = -(f * g) (-x)        := rfl\n\n-- 2\u00aa demostraci\u00f3n\nexample\n  (h1 : esPar f)\n  (h2 : esImpar g)\n  : esImpar (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 [mul_neg]\n    _  = -(f * g) (-x)      := rfl\n\n-- 3\u00aa demostraci\u00f3n\nexample\n  (h1 : esPar f)\n  (h2 : esImpar g)\n  : esImpar (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, mul_neg]\n     _ = -((f * g) (-x))    := rfl\n\n-- Lemas usados\n-- ===========\n\n-- variable (a b : \u211d)\n-- #check (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_funcion_par_e_impar.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 una funci\u00f3n par por una impar es impar. 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 : esPar f) (h2 : esImpar g) : esImpar (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\/1695"}],"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=1695"}],"version-history":[{"count":3,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1695\/revisions"}],"predecessor-version":[{"id":1711,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1695\/revisions\/1711"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=1695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=1695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=1695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}