        {"id":1686,"date":"2023-10-13T06:00:35","date_gmt":"2023-10-13T04:00:35","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=1686"},"modified":"2023-10-10T12:47:39","modified_gmt":"2023-10-10T10:47:39","slug":"13-oct-23","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/13-oct-23\/","title":{"rendered":"La suma de dos funciones pares es par"},"content":{"rendered":"<p>Demostrar con Lean4 que la suma de dos funciones pares 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\nexample\n  (h1 : esPar f)\n  (h2 : esPar 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 pares. Tenemos que demostrar que &#92;(f+g&#92;) es par; es decir, que<br \/>\n&#92;[ (\u2200 x \u2208 \u211d) [(f + g)(x) = (f + g)(-x)] &#92;]<br \/>\nSea &#92;(x \u2208 \u211d&#92;). Entonces,<br \/>\n&#92;begin{align}<br \/>\n   (f + g) 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 par]} &#92;&#92;<br \/>\n             &amp;= (f + g)(-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-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h1 : esPar f)\n  (h2 : esPar 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 + g) (-x)    := rfl\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h1 : esPar f)\n  (h2 : esPar 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 + g) (-x)    := rfl\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h1 : esPar f)\n  (h2 : esPar 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 + g) (-x)    := rfl\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_funciones_pares.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 la suma de dos funciones pares 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) example (h1 : esPar f) (h2 : esPar 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\/1686"}],"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=1686"}],"version-history":[{"count":4,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1686\/revisions"}],"predecessor-version":[{"id":1709,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1686\/revisions\/1709"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=1686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=1686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=1686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}