        {"id":2504,"date":"2024-05-23T06:00:20","date_gmt":"2024-05-23T04:00:20","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2504"},"modified":"2024-05-21T11:52:27","modified_gmt":"2024-05-21T09:52:27","slug":"23-may-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/23-may-24\/","title":{"rendered":"Si `f(x) \u2264 f(y) \u2192 x \u2264 y`, entonces f es inyectiva"},"content":{"rendered":"\n<p>Demostrar con Lean4 que si &#92;(f&#92;) una funci\u00f3n de &#92;(\u211d&#92;) en &#92;(\u211d&#92;) tal que<br \/>\n&#92;[ (\u2200 x, y)[f(x) \u2264 f(y) \u2192 x \u2264 y] &#92;]<br \/>\nentonces &#92;(f&#92;) es inyectiva.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\nopen Function\n\nvariable (f : \u211d \u2192 \u211d)\n\nexample\n  (h : \u2200 {x y}, f x \u2264 f y \u2192 x \u2264 y)\n  : Injective 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<br \/>\n&#92;[ f(x) = f(y) &#92;tag{1} &#92;]<br \/>\nTenemos que demostrar que &#92;(x = y&#92;).<\/p>\n<p>De (1), tenemos que<br \/>\n&#92;[ f(x) \u2264 f(y) &#92;]<br \/>\ny, por la hip\u00f3tesis,<br \/>\n&#92;[ x \u2264 y &#92;tag{2} &#92;]<\/p>\n<p>Tambi\u00e9n de (1), tenemos que<br \/>\n&#92;[ f(y) \u2264 f(x) &#92;]<br \/>\ny, por la hip\u00f3tesis,<br \/>\n&#92;[ y \u2264 x &#92;tag{3} &#92;]<\/p>\n<p>De (2) y (3), tenemos que<br \/>\n&#92;[ x = y &#92;]<\/p>\n<h2>2. Demostraciones con Lean4<\/h2>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\nopen Function\n\nvariable (f : \u211d \u2192 \u211d)\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : \u2200 {x y}, f x \u2264 f y \u2192 x \u2264 y)\n  : Injective f :=\nby\n  intros x y hxy\n  -- x y : \u211d\n  -- hxy : f x = f y\n  -- \u22a2 x = y\n  have h1 : f x \u2264 f y := le_of_eq hxy\n  have h2 : x \u2264 y     := h h1\n  have h3 : f y \u2264 f x := ge_of_eq hxy\n  have h4 : y \u2264 x     := h h3\n  show x = y\n  exact le_antisymm h2 h4\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : \u2200 {x y}, f x \u2264 f y \u2192 x \u2264 y)\n  : Injective f :=\nby\n  intros x y hxy\n  -- x y : \u211d\n  -- hxy : f x = f y\n  -- \u22a2 x = y\n  have h1 : x \u2264 y     := h (le_of_eq hxy)\n  have h2 : y \u2264 x     := h (ge_of_eq hxy)\n  show x = y\n  exact le_antisymm h1 h2\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : \u2200 {x y}, f x \u2264 f y \u2192 x \u2264 y)\n  : Injective f :=\nby\n  intros x y hxy\n  -- x y : \u211d\n  -- hxy : f x = f y\n  -- \u22a2 x = y\n  show x = y\n  exact le_antisymm (h (le_of_eq hxy)) (h (ge_of_eq hxy))\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : \u2200 {x y}, f x \u2264 f y \u2192 x \u2264 y)\n  : Injective f :=\nfun _ _ hxy \u21a6 le_antisymm (h hxy.le) (h hxy.ge)\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : \u2200 {x y}, f x \u2264 f y \u2192 x \u2264 y)\n  : Injective f :=\nby\n  intros x y hxy\n  -- x y : \u211d\n  -- hxy : f x = f y\n  -- \u22a2 x = y\n  apply le_antisymm\n  . -- \u22a2 x \u2264 y\n    apply h\n    -- \u22a2 f x \u2264 f y\n    exact le_of_eq hxy\n  . -- \u22a2 y \u2264 x\n    apply h\n    -- \u22a2 f y \u2264 f x\n    exact ge_of_eq hxy\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : \u2200 {x y}, f x \u2264 f y \u2192 x \u2264 y)\n  : Injective f :=\nby\n  intros x y hxy\n  -- x y : \u211d\n  -- hxy : f x = f y\n  -- \u22a2 x = y\n  apply le_antisymm\n  . -- \u22a2 x \u2264 y\n    exact h (le_of_eq hxy)\n  . -- \u22a2 y \u2264 x\n    exact h (ge_of_eq hxy)\n\n-- Lemas usados\n-- ============\n\n-- variable (a b : \u211d)\n-- #check (ge_of_eq : a = b \u2192 a \u2265 b)\n-- #check (le_antisymm : a \u2264 b \u2192 b \u2264 a \u2192 a = b)\n-- #check (le_of_eq : a = b \u2192 a \u2264 b)\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\/Si_f(x)_leq_f(y)_to_x_leq_y,_entonces_f_es_inyectiva.lean\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isar\">\ntheory \"Si_f(x)_leq_f(y)_to_x_leq_y,_entonces_f_es_inyectiva\"\nimports Main HOL.Real\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\n\nlemma\n  fixes f :: \"real \u21d2 real\"\n  assumes \"\u2200 x y. f x \u2264 f y \u27f6 x \u2264 y\"\n  shows   \"inj f\"\nproof (rule injI)\n  fix x y\n  assume \"f x = f y\"\n  show \"x = y\"\n  proof (rule antisym)\n    show \"x \u2264 y\"\n      by (simp only: assms \u2039f x = f y\u203a)\n  next\n    show \"y \u2264 x\"\n      by (simp only: assms \u2039f x = f y\u203a)\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\n\nlemma\n  fixes f :: \"real \u21d2 real\"\n  assumes \"\u2200 x y. f x \u2264 f y \u27f6 x \u2264 y\"\n  shows   \"inj f\"\nproof (rule injI)\n  fix x y\n  assume \"f x = f y\"\n  then show \"x = y\"\n    using assms\n    by (simp add: eq_iff)\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\n\nlemma\n  fixes f :: \"real \u21d2 real\"\n  assumes \"\u2200 x y. f x \u2264 f y \u27f6 x \u2264 y\"\n  shows   \"inj f\"\n  by (simp add: assms injI eq_iff)\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que si &#92;(f&#92;) una funci\u00f3n de &#92;(\u211d&#92;) en &#92;(\u211d&#92;) tal que &#92;[ (\u2200 x, y)[f(x) \u2264 f(y) \u2192 x \u2264 y] &#92;] entonces &#92;(f&#92;) es inyectiva. Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Real.Basic open Function variable (f : \u211d \u2192 \u211d) example (h : \u2200 {x y}, f x \u2264 f y \u2192 x \u2264 y) : Injective f := 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":"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\/2504"}],"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=2504"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2504\/revisions"}],"predecessor-version":[{"id":2505,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2504\/revisions\/2505"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}