        {"id":764,"date":"2021-09-15T05:00:33","date_gmt":"2021-09-15T03:00:33","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=764"},"modified":"2021-09-10T19:15:57","modified_gmt":"2021-09-10T17:15:57","slug":"cs_de_y_menor_o_igual_que_x","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/cs_de_y_menor_o_igual_que_x\/","title":{"rendered":"Pruebas de \u00ab(\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192  y \u2264 x\u00bb"},"content":{"rendered":"<p>Sean x, y \u2208 \u211d. Demostrar que<\/p>\n<pre lang=\"text\">\n   (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192  y \u2264 x\n<\/pre>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.real.basic\n\nvariables {x y : \u211d}\n\nexample :\n  (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x :=\nsorry\n<\/pre>\n<p>[expand title=\u00bbSoluciones con Lean\u00bb]<\/p>\n<pre lang=\"lean\">\r\nimport data.real.basic\r\n\r\nvariables {x y : \u211d}\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample :\r\n  (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x :=\r\nbegin\r\n  contrapose!,\r\n  intro h,\r\n  use (y-x)\/2,\r\n  split,\r\n  { apply half_pos,\r\n    exact sub_pos.mpr h, },\r\n  { calc x + (y - x) \/ 2\r\n         = (x + y) \/ 2   : by ring_nf\r\n     ... < (y + y) \/ 2   : div_lt_div_of_lt zero_lt_two (add_lt_add_right h y)\r\n     ... = (2 * y) \/ 2   : congr_arg2 (\/) (two_mul y).symm rfl\r\n     ... = y             : by ring_nf, },\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample :\r\n  (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x :=\r\nbegin\r\n  contrapose!,\r\n  intro h,\r\n  use (y-x)\/2,\r\n  split,\r\n  { exact half_pos (sub_pos.mpr h), },\r\n  { calc x + (y - x) \/ 2\r\n         = (x + y) \/ 2   : by ring_nf\r\n     ... < (y + y) \/ 2   : by linarith\r\n     ... = (2 * y) \/ 2   : by ring_nf\r\n     ... = y             : by ring_nf, },\r\nend\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample :\r\n  (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x :=\r\nbegin\r\n  contrapose!,\r\n  intro h,\r\n  use (y-x)\/2,\r\n  split,\r\n  { linarith },\r\n  { linarith },\r\nend\r\n\r\n-- 4\u00aa demostraci\u00f3n\r\nexample :\r\n  (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x :=\r\nbegin\r\n  contrapose!,\r\n  intro h,\r\n  use (y-x)\/2,\r\n  split ; linarith,\r\nend\r\n\r\n-- 5\u00aa demostraci\u00f3n\r\nexample :\r\n  (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x :=\r\nbegin\r\n  intro h1,\r\n  by_contradiction h2,\r\n  replace h2 : x < y := not_le.mp h2,\r\n  rcases (exists_between h2) with \u27e8z, h3, h4\u27e9,\r\n  replace h3 : 0 < z - x := sub_pos.mpr h3,\r\n  replace h1 : y \u2264 x + (z - x) := h1 (z - x) h3,\r\n  replace h1 : y \u2264 z := by finish,\r\n  have h4 : y < y := gt_of_gt_of_ge h4 h1,\r\n  exact absurd h4 (irrefl y),\r\nend\r\n\r\n-- 6\u00aa demostraci\u00f3n\r\nexample :\r\n  (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x :=\r\nbegin\r\n  intro h1,\r\n  by_contradiction h2,\r\n  replace h2 : x < y := not_le.mp h2,\r\n  rcases (exists_between h2) with \u27e8z, hxz, hzy\u27e9,\r\n  apply lt_irrefl y,\r\n  calc y \u2264 x + (z - x) : h1 (z - x) (sub_pos.mpr hxz)\r\n     ... = z           : by ring\r\n     ... < y           : hzy,\r\nend\r\n<\/pre>\n<p>Se puede interactuar con la prueba anterior en <a href=\"https:\/\/leanprover-community.github.io\/lean-web-editor\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Calculemus\/main\/src\/CS_de_y_le_x.lean\" rel=\"noopener noreferrer\" target=\"_blank\">esta sesi\u00f3n con Lean<\/a>.<\/p>\n<p>En los comentarios se pueden escribir otras soluciones, escribiendo el c\u00f3digo entre una l\u00ednea con &#60;pre lang=&quot;lean&quot;&#62; y otra con &#60;\/pre&#62;<br \/>\n[\/expand]<\/p>\n<p>[expand title=\"Soluciones con Isabelle\/HOL\"]<\/p>\n<pre lang=\"isar\">\r\ntheory CS_de_y_le_x\r\nimports Main HOL.Real\r\nbegin\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma\r\n  fixes x y :: real\r\n  shows \"(\u2200\u03b5>0. y \u2264 x + \u03b5) \u27f6 y \u2264 x\"\r\nproof (rule impI)\r\n  assume h1 : \"(\u2200\u03b5>0. y \u2264 x + \u03b5)\"\r\n  show \"y \u2264 x\"\r\n  proof (rule ccontr)\r\n    assume \"\u00ac (y \u2264 x)\"\r\n    then have \"x < y\"\r\n      by simp\r\n    then have \"(y - x) \/ 2 > 0\"\r\n      by simp\r\n    then have \"y \u2264 x + (y - x) \/ 2\"\r\n      using h1 by blast\r\n    then have \"2 * y \u2264 2 * x + (y - x)\"\r\n      by argo\r\n    then have \"y \u2264 x\"\r\n      by simp\r\n    then show False\r\n      using \u2039\u00ac (y \u2264 x)\u203a by simp\r\n  qed\r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma\r\n  fixes x y :: real\r\n  shows \"(\u2200\u03b5>0. y \u2264 x + \u03b5) \u27f6 y \u2264 x\"\r\nproof (rule impI)\r\n  assume h1 : \"(\u2200\u03b5>0. y \u2264 x + \u03b5)\"\r\n  show \"y \u2264 x\"\r\n  proof (rule ccontr)\r\n    assume \"\u00ac (y \u2264 x)\"\r\n    then have \"x < y\"\r\n      by simp\r\n    then obtain z where hz : \"x < z \u2227 z < y\"\r\n      using Rats_dense_in_real by blast\r\n    then have \"0 < z -x\"\r\n      by simp\r\n    then have \"y \u2264 x + (z - x)\"\r\n      using h1 by blast\r\n    then have \"y \u2264 z\"\r\n      by simp\r\n    then show False\r\n      using hz by simp\r\n  qed\r\nqed\r\n\r\n(* 3\u00aa demostraci\u00f3n *)\r\nlemma\r\n  fixes x y :: real\r\n  shows \"(\u2200\u03b5>0. y \u2264 x + \u03b5) \u27f6 y \u2264 x\"\r\nproof (rule impI)\r\n  assume h1 : \"(\u2200\u03b5>0. y \u2264 x + \u03b5)\"\r\n  show \"y \u2264 x\"\r\n  proof (rule dense_le)\r\n    fix z\r\n    assume \"z < y\"\r\n    then have \"0 < y - z\"\r\n      by simp\r\n    then have \"y \u2264 x + (y - z)\"\r\n      using h1 by simp\r\n    then have \"0 \u2264 x - z\"\r\n      by simp\r\n    then show \"z \u2264 x\"\r\n      by simp\r\n  qed\r\nqed\r\n\r\n(* 4\u00aa demostraci\u00f3n *)\r\nlemma\r\n  fixes x y :: real\r\n  shows \"(\u2200\u03b5>0. y \u2264 x + \u03b5) \u27f6 y \u2264 x\"\r\n  by (simp add: field_le_epsilon)\r\n\r\nend\r\n<\/pre>\n<p>En los comentarios se pueden escribir otras soluciones, escribiendo el c\u00f3digo entre una l\u00ednea con &#60;pre lang=&quot;isar&quot;&#62; y otra con &#60;\/pre&#62;<br \/>\n[\/expand]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sean x, y \u2208 \u211d. Demostrar que (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x Para ello, completar la siguiente teor\u00eda de Lean: import data.real.basic variables {x y : \u211d} example : (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x := sorry [expand title=\u00bbSoluciones con Lean\u00bb] import data.real.basic variables {x y : \u211d} &#8212; 1\u00aa demostraci\u00f3n example : (\u2200 \u03b5 > 0, y \u2264 x + \u03b5) \u2192 y \u2264 x := begin contrapose!, intro h, use (y-x)\/2, split, { apply half_pos, exact sub_pos.mpr h, }, { calc x + (y &#8211; x) \/ 2 = (x + y) \/ 2 : by ring_nf &#8230; < (y + y) \/ 2 : div_lt_div_of_lt zero_lt_two (add_lt_add_right...\n<\/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":[13],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/764"}],"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=764"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/764\/revisions"}],"predecessor-version":[{"id":765,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/764\/revisions\/765"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}