{"id":8050,"date":"2023-11-18T08:42:49","date_gmt":"2023-11-18T07:42:49","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/?p=8050"},"modified":"2023-11-18T08:42:49","modified_gmt":"2023-11-18T07:42:49","slug":"18-nov-23","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/18-nov-23\/","title":{"rendered":"La semana en Calculemus (18 de noviembre de 2023)"},"content":{"rendered":"<p><br \/>\nEsta semana he publicado en <a href=\"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/\">Calculemus<\/a> las demostraciones con Lean4 de las siguientes propiedades:<\/p>\n<ul>\n<li><a href=\"#ej1\">1. Si f: \u211d \u2192 \u211d es suprayectiva, entonces \u2203x \u2208 \u211d tal que f(x)\u00b2 = 9<\/a><\/li>\n<li><a href=\"#ej2\">2. La composici\u00f3n de funciones suprayectivas es suprayectiva<\/a><\/li>\n<li><a href=\"#ej3\">3. En \u211d, a &lt; b \u2192 \u00ac(b &lt; a)<\/a><\/li>\n<li><a href=\"#ej4\">4. Si para cada a existe un x tal que f(x) > a, entonces f no tiene cota superior<\/a><\/li>\n<li><a href=\"#ej5\">5. Si para cada a existe un x tal que f(x) &lt; a, entonces f no tiene cota inferior<\/a><\/li>\n<\/ul>\n<p>A continuaci\u00f3n se muestran las soluciones.<br \/>\n<!--more--><br \/>\n<a name=\"ej1\"><\/a><\/p>\n<h3>1. Si f: \u211d \u2192 \u211d es suprayectiva, entonces \u2203x \u2208 \u211d tal que f(x)\u00b2 = 9<\/h3>\n<p>Demostrar con Lean4 que si &#92;(f: \u211d \u2192 \u211d&#92;) es suprayectiva, entonces &#92;(\u2203x \u2208 \u211d&#92;) tal que &#92;(f(x)\u00b2 = 9&#92;).<\/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\nexample\n  {f : \u211d \u2192 \u211d}\n  (h : Surjective f)\n  : \u2203 x, (f x)^2 = 9 :=\nby sorry\n<\/pre>\n<p><b>Demostraci\u00f3n en lenguaje natural<\/b><\/p>\n<p>Al ser &#92;(f&#92;) suprayectiva, existe un &#92;(y&#92;) tal que &#92;(f(y) = 3&#92;). Por tanto, &#92;(f(y)\u00b2 = 9&#92;).<\/p>\n<p><b>Demostraciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\nopen Function\n\nexample\n  {f : \u211d \u2192 \u211d}\n  (h : Surjective f)\n  : \u2203 x, (f x)^2 = 9 :=\nby\n  cases' h 3 with y hy\n  -- y : \u211d\n  -- hy : f y = 3\n  use y\n  -- \u22a2 f y ^ 2 = 9\n  rw [hy]\n  -- \u22a2 3 ^ 2 = 9\n  norm_num\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\/Propiedad_de_suprayectivas.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. 31.<\/li>\n<\/ul>\n<p><a name=\"ej2\"><\/a><\/p>\n<h3>2. La composici\u00f3n de funciones suprayectivas es suprayectiva<\/h3>\n<p>Demostrar con Lean4 que la composici\u00f3n de funciones suprayectivas es suprayectiva.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Tactic\nopen Function\nvariable {\u03b1 : Type _} {\u03b2 : Type _} {\u03b3 : Type _}\nvariable {f : \u03b1 \u2192 \u03b2} {g : \u03b2 \u2192 \u03b3}\n\nexample\n  (hg : Surjective g)\n  (hf : Surjective f)\n  : Surjective (g \u2218 f) :=\nby sorry\n<\/pre>\n<p><b>Demostraci\u00f3n en lenguaje natural<\/b><\/p>\n<p>Supongamos que &#92;(f : A \u2192 B&#92;) y &#92;(g : B \u2192 C&#92;) son suprayectivas. Tenemosque demostrar que<br \/>\n&#92;[ (\u2200z \u2208 C)(\u2203x \u2208 A)[g(f(x)) = z] &#92;]<br \/>\nSea &#92;(z \u2208 C&#92;). Por ser &#92;(g&#92;) suprayectiva, existe un &#92;(y \u2208 B&#92;) tal que<br \/>\n&#92;[ g(y) = z &#92;tag{1} &#92;]<br \/>\nPor ser &#92;(f&#92;) suprayectiva, existe un &#92;(x \u2208 A&#92;) tal que<br \/>\n&#92;[ f(x) = y &#92;tag{2} &#92;]<br \/>\nPor tanto,<br \/>\n&#92;begin{align}<br \/>\n    g(f(x)) &amp;= g(y)   &amp;&amp;&#92;text{[por (2)]} &#92;&#92;<br \/>\n            &amp;= z      &amp;&amp;&#92;text{[por (1)]}<br \/>\n&#92;end{align}<\/p>\n<p><b>Demostraciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\nimport Mathlib.Tactic\nopen Function\nvariable {\u03b1 : Type _} {\u03b2 : Type _} {\u03b3 : Type _}\nvariable {f : \u03b1 \u2192 \u03b2} {g : \u03b2 \u2192 \u03b3}\n\n-- 1\u00aa demostraci\u00f3n\nexample\n  (hg : Surjective g)\n  (hf : Surjective f)\n  : Surjective (g \u2218 f) :=\nby\n  intro z\n  -- z : \u03b3\n  -- \u22a2 \u2203 a, (g \u2218 f) a = z\n  cases' hg z with y hy\n  -- y : \u03b2\n  -- hy : g y = z\n  cases' hf y with x hx\n  -- x : \u03b1\n  -- hx : f x = y\n  use x\n  -- \u22a2 (g \u2218 f) x = z\n  dsimp\n  -- \u22a2 g (f x) = z\n  rw [hx]\n  -- \u22a2 g y = z\n  exact hy\n\n-- 2\u00aa demostraci\u00f3n\nexample\n  (hg : Surjective g)\n  (hf : Surjective f)\n  : Surjective (g \u2218 f) :=\nby\n  intro z\n  -- z : \u03b3\n  -- \u22a2 \u2203 a, (g \u2218 f) a = z\n  cases' hg z with y hy\n  -- y : \u03b2\n  -- hy : g y = z\n  cases' hf y with x hx\n  -- x : \u03b1\n  -- hx : f x = y\n  use x\n  -- \u22a2 (g \u2218 f) x = z\n  dsimp\n  -- \u22a2 g (f x) = z\n  rw [hx, hy]\n\n-- 3\u00aa demostraci\u00f3n\nexample\n  (hg : Surjective g)\n  (hf : Surjective f)\n  : Surjective (g \u2218 f) :=\nby\n  intro z\n  -- z : \u03b3\n  -- \u22a2 \u2203 a, (g \u2218 f) a = z\n  cases' hg z with y hy\n  -- y : \u03b2\n  -- hy : g y = z\n  cases' hf y with x hx\n  -- x : \u03b1\n  -- hx : f x = y\n  exact \u27e8x, by dsimp ; rw [hx, hy]\u27e9\n\n-- 4\u00aa demostraci\u00f3n\nexample\n  (hg : Surjective g)\n  (hf : Surjective f)\n  : Surjective (g \u2218 f) :=\nby\n  intro z\n  -- z : \u03b3\n  -- \u22a2 \u2203 a, (g \u2218 f) a = z\n  rcases hg z with \u27e8y, hy : g y = z\u27e9\n  rcases hf y with \u27e8x, hx : f x = y\u27e9\n  exact \u27e8x, by dsimp ; rw [hx, hy]\u27e9\n\n-- 5\u00aa demostraci\u00f3n\nexample\n  (hg : Surjective g)\n  (hf : Surjective f)\n  : Surjective (g \u2218 f) :=\nSurjective.comp hg hf\n\n-- Lemas usados\n-- ============\n\n-- #check (Surjective.comp : Surjective g \u2192 Surjective f \u2192 Surjective (g \u2218 f))\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\/Composicion_de_suprayectivas.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. 31.<\/li>\n<\/ul>\n<p><a name=\"ej3\"><\/a><\/p>\n<h3>3. En \u211d, a &lt; b \u2192 \u00ac(b &lt; a)<\/h3>\n<p>Demostrar con Lean4 que en &#92;(\u211d&#92;), &#92;(a &lt; b \u2192 \u00ac(b &lt; a)&#92;).<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\nvariable (a b : \u211d)\n\nexample\n  (h : a < b)\n  : \u00ac b < a :=\nby sorry\n<\/pre>\n<p><b>Demostraci\u00f3n en lenguaje natural<\/b><\/p>\n<p>Por hip\u00f3tesis &#92;(a &lt; b&#92;) y tenemos que demostrar que &#92;(\u00ac(b &lt; a)&#92;). Supongamos que &#92;(b &lt; a&#92;). Entonces, por la propiedad transiva &#92;(a &lt; a&#92;) que es una contradicci\u00f3n con la propiedad irreflexiva.<\/p>\n<p><b>Demostraciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\nvariable (a b : \u211d)\n\n-- 1\u00aa demostraci\u00f3n\nexample\n  (h : a < b)\n  : \u00ac b < a :=\nby\n  intro h1\n  -- h1 : b < a\n  -- \u22a2 False\n  have : a < a := lt_trans h h1\n  apply lt_irrefl a this\n\n-- 2\u00aa demostraci\u00f3n\nexample\n  (h : a < b)\n  : \u00ac b < a :=\nby\n  intro h1\n  -- h1 : b < a\n  -- \u22a2 False\n  exact lt_irrefl a (lt_trans h h1)\n\n-- 3\u00aa demostraci\u00f3n\nexample\n  (h : a < b)\n  : \u00ac b < a :=\nfun h1 \u21a6 lt_irrefl a (lt_trans h h1)\n\n-- 4\u00aa demostraci\u00f3n\nexample\n  (h : a < b)\n  : \u00ac b < a :=\nlt_asymm h\n\n-- Lemas usados\n-- ============\n\n-- variable (c : \u211d)\n-- #check (lt_asymm : a < b \u2192 \u00acb < a)\n-- #check (lt_irrefl a : \u00aca < a)\n-- #check (lt_trans : a < b \u2192 b < c \u2192 a < c)\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\/Asimetria_de_menor.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. 32.<\/li>\n<\/ul>\n<p><a name=\"ej4\"><\/a><\/p>\n<h3>4. Si para cada a existe un x tal que f(x) > a, entonces f no tiene cota superior<\/h3>\n<p>Demostrar con Lean4 que si &#92;(f&#92;) es una funci\u00f3n de &#92;(\u211d&#92;) en &#92;(\u211d&#92;) tal que para cada &#92;(a&#92;) existe un &#92;(x&#92;) tal que &#92;(f(x) > a&#92;), entonces &#92;(f&#92;) no tiene cota superior.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\ndef CotaSuperior (f : \u211d \u2192 \u211d) (a : \u211d) : Prop :=\n  \u2200 x, f x \u2264 a\n\ndef acotadaSup (f : \u211d \u2192 \u211d) : Prop :=\n  \u2203 a, CotaSuperior f a\n\nvariable (f : \u211d \u2192 \u211d)\n\nexample\n  (h : \u2200 a, \u2203 x, f x > a)\n  : \u00ac acotadaSup f :=\nby sorry\n<\/pre>\n<p><b>Demostraci\u00f3n en lenguaje natural<\/b><\/p>\n<p>Supongamos que &#92;(f&#92;) tiene cota superior. Sea &#92;(b&#92;) una de dichas cotas superiores. Por la hip\u00f3tesis, existe un &#92;(x&#92;) tal que &#92;(f(x) > b&#92;). Adem\u00e1s, como &#92;(b&#92;) es una cota superior de &#92;(f&#92;), &#92;(f(x) \u2264 b&#92;) que contradice la desigualdad anterior.<\/p>\n<p><b>Demostraciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\ndef CotaSuperior (f : \u211d \u2192 \u211d) (a : \u211d) : Prop :=\n  \u2200 x, f x \u2264 a\n\ndef acotadaSup (f : \u211d \u2192 \u211d) : Prop :=\n  \u2203 a, CotaSuperior f a\n\nvariable (f : \u211d \u2192 \u211d)\n\n-- 1\u00aa demostraci\u00f3n\nexample\n  (h : \u2200 a, \u2203 x, f x > a)\n  : \u00ac acotadaSup f :=\nby\n  intros hf\n  -- hf : acotadaSup f\n  -- \u22a2 False\n  cases' hf with b hb\n  -- b : \u211d\n  -- hb : CotaSuperior f b\n  cases' h b with x hx\n  -- x : \u211d\n  -- hx : f x > b\n  have : f x \u2264 b := hb x\n  linarith\n\n-- 2\u00aa demostraci\u00f3n\ntheorem sinCotaSup\n  (h : \u2200 a, \u2203 x, f x > a)\n  : \u00ac acotadaSup f :=\nby\n  intros hf\n  -- hf : acotadaSup f\n  -- \u22a2 False\n  rcases hf with \u27e8b, hb : CotaSuperior f b\u27e9\n  rcases h b with \u27e8x, hx : f x > b\u27e9\n  have : f x \u2264 b := hb x\n  linarith\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\/Funcion_no_acotada_superiormente.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. 32.<\/li>\n<\/ul>\n<p><a name=\"ej5\"><\/a><\/p>\n<h3>5. Si para cada a existe un x tal que f(x) &lt; a, entonces f no tiene cota inferior<\/h3>\n<p>Demostrar con Lean4 que si &#92;(f&#92;) es una funci\u00f3n de &#92;(\u211d&#92;) en &#92;(\u211d&#92;) tal que para cada &#92;(a&#92;) existe un &#92;(x&#92;) tal que &#92;(f(x) &lt; a&#92;), entonces &#92;(f&#92;) no tiene cota inferior.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\ndef CotaInferior (f : \u211d \u2192 \u211d) (a : \u211d) : Prop :=\n  \u2200 x, a \u2264 f x\n\ndef acotadaInf (f : \u211d \u2192 \u211d) : Prop :=\n  \u2203 a, CotaInferior f a\n\nvariable (f : \u211d \u2192 \u211d)\n\nexample\n  (h : \u2200 a, \u2203 x, f x < a)\n  : \u00ac acotadaInf f :=\nby sorry\n<\/pre>\n<p><b>Demostraci\u00f3n en lenguaje natural<\/b><\/p>\n<p>Supongamos que &#92;(f&#92;) tiene cota inferior. Sea &#92;(b&#92;) una de dichas cotas inferiores. Por la hip\u00f3tesis, existe un &#92;(x&#92;) tal que &#92;(f(x) &lt; b&#92;). Adem\u00e1s, como &#92;(b&#92;) es una cota inferior de &#92;(f&#92;), &#92;(b \u2264 f(x)&#92;) que contradice la desigualdad anterior.<\/p>\n<p><b>Demostraciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Real.Basic\n\ndef CotaInferior (f : \u211d \u2192 \u211d) (a : \u211d) : Prop :=\n  \u2200 x, a \u2264 f x\n\ndef acotadaInf (f : \u211d \u2192 \u211d) : Prop :=\n  \u2203 a, CotaInferior f a\n\nvariable (f : \u211d \u2192 \u211d)\n\n-- 1\u00aa demostraci\u00f3n\nexample\n  (h : \u2200 a, \u2203 x, f x < a)\n  : \u00ac acotadaInf f :=\nby\n  intros hf\n  -- hf : acotadaInf f\n  -- \u22a2 False\n  cases' hf with b hb\n  -- b : \u211d\n  -- hb : CotaInferior f b\n  cases' h b with x hx\n  -- x : \u211d\n  -- hx : f x < b\n  have : b \u2264 f x := hb x\n  linarith\n\n-- 2\u00aa demostraci\u00f3n\nexample\n  (h : \u2200 a, \u2203 x, f x < a)\n  : \u00ac acotadaInf f :=\nby\n  intros hf\n  -- hf : acotadaInf f\n  -- \u22a2 False\n  rcases hf with \u27e8b, hb : CotaInferior f b\u27e9\n  rcases h b with \u27e8x, hx : f x < b\u27e9\n  have : b \u2264 f x := hb x\n  linarith\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\/Funcion_no_acotada_inferiormente.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. 32.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Esta semana he publicado en Calculemus las demostraciones con Lean4 de las siguientes propiedades: 1. Si f: \u211d \u2192 \u211d es suprayectiva, entonces \u2203x \u2208 \u211d tal que f(x)\u00b2 = 9 2. La composici\u00f3n de funciones suprayectivas es suprayectiva 3. En \u211d, a &lt; b \u2192 \u00ac(b &lt; a) 4. Si para cada a existe&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","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,"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[335],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/8050"}],"collection":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/comments?post=8050"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/8050\/revisions"}],"predecessor-version":[{"id":8051,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/8050\/revisions\/8051"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/media?parent=8050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/categories?post=8050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/tags?post=8050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}