{"id":7850,"date":"2022-11-27T07:56:56","date_gmt":"2022-11-27T06:56:56","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/?p=7850"},"modified":"2022-11-27T07:56:56","modified_gmt":"2022-11-27T06:56:56","slug":"27-nov-22","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/27-nov-22\/","title":{"rendered":"DAO: La semana en Calculemus (27 de noviembre de 2022)"},"content":{"rendered":"<p>Esta semana he publicado en <a href=\"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/\">Calculemus<\/a> las demostraciones con Lean de las siguientes propiedades:<\/p>\n<ul>\n<li><a href=\"#ej1\">1. Si a es una cota superior de s y a \u2264 b, entonces b es una cota superior de s<\/a><\/li>\n<li><a href=\"#ej2\">2. Para todo c \u2208 \u211d, la funci\u00f3n f(x) = x+c es inyectiva<\/a><\/li>\n<li><a href=\"#ej3\">3. Para todo c \u2208 \u211d-{0}, la funci\u00f3n f(x) = x * c es inyectiva<\/a><\/li>\n<li><a href=\"#ej4\">4. Si f: A \u2192 B y g: B \u2192 C son inyectiva, entonces g \u2218 f es inyectiva<\/a><\/li>\n<li><a href=\"#ej5\">5. \u2203 x \u2208 \u211d, 2 &lt; x &lt; 3<\/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 a es una cota superior de s y a \u2264 b, entonces b es una cota superior de s<\/h3>\n<p>Demostrar que si a es una cota superior de s y a \u2264 b, entonces b es una cota superior de s<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport tactic\n\nvariables {\u03b1 : Type*} [partial_order \u03b1]\nvariables s : set \u03b1\nvariables a b : \u03b1\n\n-- (cota_superior s a) expresa que a es una cota superior de s.\ndef cota_superior (s : set \u03b1) (a : \u03b1) := \u2200 {x}, x \u2208 s \u2192 x \u2264 a\n\nexample\n  (h1 : cota_superior s a)\n  (h2 : a \u2264 b)\n  : cota_superior s b :=\nsorry\n<\/pre>\n<p><b>Soluciones con Lean<\/b><\/p>\n<pre lang=\"lean\">\nimport tactic\n\nvariables {\u03b1 : Type*} [partial_order \u03b1]\nvariables s : set \u03b1\nvariables a b : \u03b1\n\n-- (cota_superior s a) expresa que a es una cota superior de s.\ndef cota_superior (s : set \u03b1) (a : \u03b1) := \u2200 {x}, x \u2208 s \u2192 x \u2264 a\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h1 : cota_superior s a)\n  (h2 : a \u2264 b)\n  : cota_superior s b :=\nbegin\n  intro x,\n  assume xs : x \u2208 s,\n  have h3 : x \u2264 a := h1 xs,\n  show x \u2264 b,\n    by exact le_trans h3 h2,\nend\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h1 : cota_superior s a)\n  (h2 : a \u2264 b)\n  : cota_superior s b :=\nbegin\n  intros x xs,\n  calc x \u2264 a : h1 xs\n     ... \u2264 b : h2\nend\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\/Cotas_superiores_de_conjuntos.lean\" rel=\"noopener noreferrer\" target=\"_blank\">esta sesi\u00f3n con Lean<\/a>.<\/p>\n<p><b>Referencias<\/b><\/p>\n<ul>\n<li>J. Avigad, K. Buzzard, R.Y. Lewis y P. Massot. <a href=\"https:\/\/bit.ly\/3U4UjBk\">Mathematics in Lean<\/a>, p. 29.<\/li>\n<\/ul>\n<p><a name=\"ej2\"><\/a><\/p>\n<h3>2. Para todo c \u2208 \u211d, la funci\u00f3n f(x) = x+c es inyectiva<\/h3>\n<p>Demostrar que para todo c \u2208 \u211d, la funci\u00f3n f(x) = x+c es inyectiva.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.real.basic\n\nopen function\n\nvariable {c : \u211d}\n\nexample : injective (\u03bb x, x + c) :=\nsorry\n<\/pre>\n<p><b>Soluciones con Lean<\/b><\/p>\n<pre lang=\"lean\">\nimport data.real.basic\n\nopen function\nvariable {c : \u211d}\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : injective (\u03bb x, x + c) :=\nbegin\n  assume x1 : \u211d,\n  assume x2 : \u211d,\n  assume h1 : (\u03bb x, x + c) x1 = (\u03bb x, x + c) x2,\n  have h2 : x1 + c = x2 + c := h1,\n  show x1 = x2,\n    by exact (add_left_inj c).mp h2,\nend\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : injective (\u03bb x, x + c) :=\nbegin\n  intros x1 x2 h,\n  change x1 + c = x2 + c at h,\n  apply add_right_cancel h,\nend\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : injective (\u03bb x, x + c) :=\nbegin\n  intros x1 x2 h,\n  apply (add_left_inj c).mp,\n  exact h,\nend\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : injective (\u03bb x, x + c) :=\n\u03bb x1 x2 h, (add_left_inj c).mp h\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\/Suma_constante_es_inyectiva.lean\" rel=\"noopener noreferrer\" target=\"_blank\">esta sesi\u00f3n con Lean<\/a>.<\/p>\n<p><b>Referencias<\/b><\/p>\n<ul>\n<li>J. Avigad, K. Buzzard, R.Y. Lewis y P. Massot. <a href=\"https:\/\/bit.ly\/3U4UjBk\">Mathematics in Lean<\/a>, p. 29.<\/li>\n<\/ul>\n<p><a name=\"ej3\"><\/a><\/p>\n<h3>3. Para todo c \u2208 \u211d-{0}, la funci\u00f3n f(x) = x * c es inyectiva<\/h3>\n<p>Demostrar que para todo c \u2208 \u211d-{0}, la funci\u00f3n f(x) = x * c es inyectiva<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.real.basic\n\nopen function\n\nvariable {c : \u211d}\n\nexample\n  (h : c \u2260 0)\n  : injective (\u03bb x, c * x) :=\nsorry\n<\/pre>\n<p><b>Soluciones con Lean<\/b><\/p>\n<pre lang=\"lean\">\nimport data.real.basic\n\nopen function\n\nvariable {c : \u211d}\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : c \u2260 0)\n  : injective (\u03bb x, c * x) :=\nbegin\n  assume x1 : \u211d,\n  assume x2 : \u211d,\n  assume h1 : (\u03bb x, c * x) x1 = (\u03bb x, c * x) x2,\n  have h2 : c * x1 = c * x2 := h1,\n  show x1 = x2,\n    by exact (mul_right_inj' h).mp h1,\nend\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : c \u2260 0)\n  : injective (\u03bb x, c * x) :=\nbegin\n  intros x1 x2 h',\n  dsimp at h',\n  apply mul_left_cancel\u2080 h,\n  exact h',\nend\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : c \u2260 0)\n  : injective (\u03bb x, c * x) :=\nbegin\n  intros x1 x2 h',\n  dsimp at h',\n  exact (mul_right_inj' h).mp h'\nend\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  {c : \u211d}\n  (h : c \u2260 0)\n  : injective (\u03bb x, c * x) :=\n\u03bb x1 x2 h', mul_left_cancel\u2080 h h'\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\/Producto_constante_es_inyectiva.lean\" rel=\"noopener noreferrer\" target=\"_blank\">esta sesi\u00f3n con Lean<\/a>.<\/p>\n<p><b>Referencias<\/b><\/p>\n<ul>\n<li>J. Avigad, K. Buzzard, R.Y. Lewis y P. Massot. <a href=\"https:\/\/bit.ly\/3U4UjBk\">Mathematics in Lean<\/a>, p. 29.<\/li>\n<\/ul>\n<p><a name=\"ej4\"><\/a><\/p>\n<h3>4. Si f: A \u2192 B y g: B \u2192 C son inyectiva, entonces g \u2218 f es inyectiva<\/h3>\n<p>Demostrar que si f: A \u2192 B y g: B \u2192 C son inyectiva, entonces g \u2218 f es inyectiva.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport tactic\n\nopen function\n\nvariables {A : Type*} {B : Type*} {C : Type*}\nvariables {f : A \u2192 B} {g : B \u2192 C}\n\nexample\n  (hg : injective g)\n  (hf : injective f) :\n  injective (g \u2218 f) :=\nsorry\n<\/pre>\n<p><b>Soluciones con Lean<\/b><\/p>\n<pre lang=\"lean\">\nimport tactic\n\nopen function\n\nvariables {A : Type*} {B : Type*} {C : Type*}\nvariables {f : A \u2192 B} {g : B \u2192 C}\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hg : injective g)\n  (hf : injective f) :\n  injective (g \u2218 f) :=\nbegin\n  assume x : A,\n  assume y : A,\n  assume h1: (g \u2218 f) x = (g \u2218 f) y,\n  have h2: g (f x) = g (f y) := h1,\n  have h3: f x = f y := hg h2,\n  show x = y,\n    by exact hf h3,\nend\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hg : injective g)\n  (hf : injective f) :\n  injective (g \u2218 f) :=\nbegin\n  intros x y h,\n  apply hf,\n  apply hg,\n  apply h,\nend\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hg : injective g)\n  (hf : injective f) :\n  injective (g \u2218 f) :=\n\u03bb x y h, hf (hg h)\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hg : injective g)\n  (hf : injective f) :\n  injective (g \u2218 f) :=\n-- by library_search\ninjective.comp hg hf\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (hg : injective g)\n  (hf : injective f) :\n  injective (g \u2218 f) :=\n-- by hint\nby tauto\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\/Composicion_de_funciones_inyectivas.lean\" rel=\"noopener noreferrer\" target=\"_blank\">esta sesi\u00f3n con Lean<\/a>.<\/p>\n<p><b>Referencias<\/b><\/p>\n<ul>\n<li>J. Avigad, K. Buzzard, R.Y. Lewis y P. Massot. <a href=\"https:\/\/bit.ly\/3U4UjBk\">Mathematics in Lean<\/a>, p. 29.<\/li>\n<\/ul>\n<p><a name=\"ej5\"><\/a><\/p>\n<h3>5. \u2203 x \u2208 \u211d, 2 &lt; x &lt; 3<\/h3>\n<p>Demostrar que \u2203 x \u2208 \u211d, 2 &lt; x &lt; 3<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.real.basic\n\nexample : \u2203 x : \u211d, 2 < x \u2227 x < 3 :=\nsorry\n<\/pre>\n<p><b>Soluciones con Lean<\/b><\/p>\n<pre lang=\"lean\">\nimport data.real.basic\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : \u2203 x : \u211d, 2 < x \u2227 x < 3 :=\nbegin\n  have h : 2 < (5 : \u211d) \/ 2 \u2227 (5 : \u211d) \/ 2 < 3,\n    by norm_num,\n  show \u2203 x : \u211d, 2 < x \u2227 x < 3,\n    by exact Exists.intro (5 \/ 2) h,\nend\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : \u2203 x : \u211d, 2 < x \u2227 x < 3 :=\nbegin\n  have h : 2 < (5 : \u211d) \/ 2 \u2227 (5 : \u211d) \/ 2 < 3,\n    by norm_num,\n  show \u2203 x : \u211d, 2 < x \u2227 x < 3,\n    by exact \u27e85 \/ 2, h\u27e9,\nend\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : \u2203 x : \u211d, 2 < x \u2227 x < 3 :=\nbegin\n  use 5 \/ 2,\n  norm_num\nend\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : \u2203 x : \u211d, 2 < x \u2227 x < 3 :=\n\u27e85 \/ 2, by norm_num\u27e9\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\/Existencia_de_valor_intermedio.lean\" rel=\"noopener noreferrer\" target=\"_blank\">esta sesi\u00f3n con Lean<\/a>.<\/p>\n<p><b>Referencias<\/b><\/p>\n<ul>\n<li>J. Avigad, K. Buzzard, R.Y. Lewis y P. Massot. <a href=\"https:\/\/bit.ly\/3U4UjBk\">Mathematics in Lean<\/a>, p. 30.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Esta semana he publicado en Calculemus las demostraciones con Lean de las siguientes propiedades: 1. Si a es una cota superior de s y a \u2264 b, entonces b es una cota superior de s 2. Para todo c \u2208 \u211d, la funci\u00f3n f(x) = x+c es inyectiva 3. Para todo c \u2208 \u211d-{0}, la&#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\/7850"}],"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=7850"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/7850\/revisions"}],"predecessor-version":[{"id":7851,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/7850\/revisions\/7851"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/media?parent=7850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/categories?post=7850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/tags?post=7850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}