        {"id":2498,"date":"2024-05-21T06:00:20","date_gmt":"2024-05-21T04:00:20","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2498"},"modified":"2024-05-17T18:34:34","modified_gmt":"2024-05-17T16:34:34","slug":"21-may-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/21-may-24\/","title":{"rendered":"La composici\u00f3n de una funci\u00f3n creciente y una decreciente es decreciente"},"content":{"rendered":"\n<p>Sea una funci\u00f3n &#92;(f&#92;) de &#92;(\u211d&#92;) en &#92;(\u211d&#92;). Se dice que &#92;(f&#92;) es <strong>creciente<\/strong> si para todo &#92;(x&#92;) e &#92;(y&#92;) tales que &#92;(x \u2264 y&#92;) se tiene que &#92;(f(x) \u2264 f(y)&#92;). Se dice que &#92;(f&#92;) es <strong>decreciente<\/strong> si para todo &#92;(x&#92;) e &#92;(y&#92;) tales que &#92;(x \u2264 y&#92;) se tiene que &#92;(f(x) \u2265 f(y)&#92;).<\/p>\n<p>Demostrar con Lean4 que si &#92;(f&#92;) es creciente y &#92;(g&#92;) es decreciente, entonces &#92;(g \u2218 f&#92;) es decreciente.<\/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\ndef creciente (f : \u211d \u2192 \u211d) : Prop :=\n  \u2200 {x y}, x \u2264 y \u2192 f x \u2264 f y\n\ndef decreciente (f : \u211d \u2192 \u211d) : Prop :=\n  \u2200 {x y}, x \u2264 y \u2192 f x \u2265 f y\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Sean &#92;(x, y \u2208 \u211d&#92;) tales que &#92;(x \u2264 y&#92;). Entonces, por ser &#92;(f&#92;) creciente,<br \/>\n&#92;[ f(x) \u2265 f(y) &#92;]<br \/>\ny, por ser g decreciente,<br \/>\n&#92;[ g(f(x)) \u2264 g(f(y)) &#92;]<br \/>\nPor tanto,<br \/>\n&#92;[ (g \u2218 f)(x) \u2264 (g \u2218 f)(y) &#92;]<\/p>\n<h2>2. Demostraciones con Lean4<\/h2>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\nvariable (f g : \u211d \u2192 \u211d)\n\ndef creciente (f : \u211d \u2192 \u211d) : Prop :=\n  \u2200 {x y}, x \u2264 y \u2192 f x \u2264 f y\n\ndef decreciente (f : \u211d \u2192 \u211d) : Prop :=\n  \u2200 {x y}, x \u2264 y \u2192 f x \u2265 f y\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nby\n  intro x y h\n  -- x y : \u211d\n  -- h : x \u2264 y\n  -- \u22a2 (g \u2218 f) x \u2265 (g \u2218 f) y\n  have h1 : f x \u2264 f y := hf h\n  show (g \u2218 f) x \u2265 (g \u2218 f) y\n  exact hg h1\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nby\n  intro x y h\n  -- x y : \u211d\n  -- h : x \u2264 y\n  -- \u22a2 (g \u2218 f) x \u2265 (g \u2218 f) y\n  show (g \u2218 f) x \u2265 (g \u2218 f) y\n  exact hg (hf h)\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nfun {_ _} h \u21a6 hg (hf h)\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nby\n  intros x y hxy\n  calc (g \u2218 f) x\n       = g (f x)   := rfl\n     _ \u2265 g (f y)   := hg (hf hxy)\n     _ = (g \u2218 f) y := rfl\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nby\n  unfold creciente decreciente at *\n  -- hf : \u2200 {x y : \u211d}, x \u2264 y \u2192 f x \u2264 f y\n  -- hg : \u2200 {x y : \u211d}, x \u2264 y \u2192 g x \u2265 g y\n  -- \u22a2 \u2200 {x y : \u211d}, x \u2264 y \u2192 (g \u2218 f) x \u2265 (g \u2218 f) y\n  intros x y h\n  -- x y : \u211d\n  -- h : x \u2264 y\n  -- \u22a2 (g \u2218 f) x \u2265 (g \u2218 f) y\n  unfold Function.comp\n  -- \u22a2 g (f x) \u2265 g (f y)\n  apply hg\n  -- \u22a2 f x \u2264 f y\n  apply hf\n  -- \u22a2 x \u2264 y\n  exact h\n\n-- 6\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nby\n  intros x y h\n  -- x y : \u211d\n  -- h : x \u2264 y\n  -- \u22a2 (g \u2218 f) x \u2265 (g \u2218 f) y\n  apply hg\n  -- \u22a2 f x \u2264 f y\n  apply hf\n  -- \u22a2 x \u2264 y\n  exact h\n\n-- 7\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nby\n  intros x y h\n  -- x y : \u211d\n  -- h : x \u2264 y\n  -- \u22a2 (g \u2218 f) x \u2265 (g \u2218 f) y\n  apply hg\n  -- \u22a2 f x \u2264 f y\n  exact hf h\n\n-- 8\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nby\n  intros x y h\n  -- x y : \u211d\n  -- h : x \u2264 y\n  -- \u22a2 (g \u2218 f) x \u2265 (g \u2218 f) y\n  exact hg (hf h)\n\n-- 9\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hf : creciente f)\n  (hg : decreciente g)\n  : decreciente (g \u2218 f) :=\nby tauto\n<\/pre>\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\/La_composicion_de_una_funcion_creciente_y_una_decreciente_es_decreciente.lean\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isar\">\ntheory La_composicion_de_una_funcion_creciente_y_una_decreciente_es_decreciente\nimports Main HOL.Real\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\n\nlemma\n  fixes f g :: \"real \u21d2 real\"\n  assumes \"mono f\"\n          \"antimono g\"\n  shows   \"antimono (g \u2218 f)\"\nproof (rule antimonoI)\n  fix x y :: real\n  assume \"x \u2264 y\"\n  have \"(g \u2218 f) y = g (f y)\"\n    by (simp only: o_apply)\n  also have \"\u2026 \u2264 g (f x)\"\n    using assms \u2039x \u2264 y\u203a\n    by (metis antimonoE monoD)\n  also have \"\u2026 = (g \u2218 f) x\"\n    by (simp only: o_apply)\n  finally show \"(g \u2218 f) x \u2265 (g \u2218 f) y\"\n    by this\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\n\nlemma\n  fixes f g :: \"real \u21d2 real\"\n  assumes \"mono f\"\n          \"antimono g\"\n  shows   \"antimono (g \u2218 f)\"\nproof (rule antimonoI)\n  fix x y :: real\n  assume \"x \u2264 y\"\n  have \"(g \u2218 f) y = g (f y)\"    by simp\n  also have \"\u2026 \u2264 g (f x)\"     by (meson \u2039x \u2264 y\u203a assms antimonoE monoE)\n  also have \"\u2026 = (g \u2218 f) x\"    by simp\n  finally show \"(g \u2218 f) x \u2265 (g \u2218 f) y\" .\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\n\nlemma\n  assumes \"mono f\"\n          \"antimono g\"\n  shows   \"antimono (g \u2218 f)\"\n  using assms(1) assms(2) monotone_on_o\n  by blast\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sea una funci\u00f3n &#92;(f&#92;) de &#92;(\u211d&#92;) en &#92;(\u211d&#92;). Se dice que &#92;(f&#92;) es creciente si para todo &#92;(x&#92;) e &#92;(y&#92;) tales que &#92;(x \u2264 y&#92;) se tiene que &#92;(f(x) \u2264 f(y)&#92;). Se dice que &#92;(f&#92;) es decreciente si para todo &#92;(x&#92;) e &#92;(y&#92;) tales que &#92;(x \u2264 y&#92;) se tiene que &#92;(f(x) \u2265 f(y)&#92;). Demostrar con Lean4 que si &#92;(f&#92;) es creciente y &#92;(g&#92;) es decreciente, entonces &#92;(g \u2218 f&#92;) es decreciente. Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Real.Basic variable (f g : \u211d \u2192 \u211d) def creciente (f : \u211d \u2192 \u211d) : Prop := \u2200 {x y}, x \u2264 y \u2192 f x \u2264 f y def decreciente (f : \u211d \u2192 \u211d) : Prop := \u2200 {x y}, x&#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":"default","_kad_post_title":"default","_kad_post_layout":"default","_kad_post_sidebar_id":"","_kad_post_content_style":"default","_kad_post_vertical_padding":"default","_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":[17],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2498"}],"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=2498"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2498\/revisions"}],"predecessor-version":[{"id":2499,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2498\/revisions\/2499"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}