        {"id":654,"date":"2021-08-14T06:00:09","date_gmt":"2021-08-14T04:00:09","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=654"},"modified":"2021-08-21T11:58:56","modified_gmt":"2021-08-21T09:58:56","slug":"la-composicion-de-funciones-inyectivas-es-inyectiva","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/la-composicion-de-funciones-inyectivas-es-inyectiva\/","title":{"rendered":"La composici\u00f3n de funciones inyectivas es inyectiva"},"content":{"rendered":"<p>Demostrar que la composici\u00f3n de dos funciones inyectivas es una funci\u00f3n inyectiva.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport tactic\nopen function\n\nvariables {X Y Z : Type}\nvariable  {f : X \u2192 Y}\nvariable  {g : Y \u2192 Z}\n\nexample\n  (Hf : injective f)\n  (Hg : injective g)\n  : injective (g \u2218 f) :=\nsorry\n<\/pre>\n<p>[expand title=\u00bbSoluciones con Lean\u00bb]<\/p>\n<pre lang=\"lean\">\r\nimport tactic\r\nopen function\r\n\r\nvariables {X Y Z : Type}\r\nvariable  {f : X \u2192 Y}\r\nvariable  {g : Y \u2192 Z}\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample\r\n  (Hf : injective f)\r\n  (Hg : injective g)\r\n  : injective (g \u2218 f) :=\r\nbegin\r\n  intros x y h,\r\n  apply Hf,\r\n  apply Hg,\r\n  exact h,\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample\r\n  (Hf : injective f)\r\n  (Hg : injective g)\r\n  : injective (g \u2218 f) :=\r\nbegin\r\n  intros x y h,\r\n  apply Hf,\r\n  exact Hg h,\r\nend\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample\r\n  (Hf : injective f)\r\n  (Hg : injective g)\r\n  : injective (g \u2218 f) :=\r\nbegin\r\n  intros x y h,\r\n  exact Hf (Hg h),\r\nend\r\n\r\n-- 4\u00aa demostraci\u00f3n\r\nexample\r\n  (Hf : injective f)\r\n  (Hg : injective g)\r\n  : injective (g \u2218 f) :=\r\n\u03bb x y h, Hf (Hg h)\r\n\r\n-- 5\u00aa demostraci\u00f3n\r\nexample\r\n  (Hf : injective f)\r\n  (Hg : injective g)\r\n  : injective (g \u2218 f) :=\r\nassume x y,\r\nassume h1 : (g \u2218 f) x = (g \u2218 f) y,\r\nhave h2 : f x = f y, from Hg h1,\r\nshow x = y, from Hf h2\r\n\r\n-- 6\u00aa demostraci\u00f3n\r\nexample\r\n  (Hf : injective f)\r\n  (Hg : injective g)\r\n  : injective (g \u2218 f) :=\r\nassume x y,\r\nassume h1 : (g \u2218 f) x = (g \u2218 f) y,\r\nshow x = y, from Hf (Hg h1)\r\n\r\n-- 7\u00aa demostraci\u00f3n\r\nexample\r\n  (Hf : injective f)\r\n  (Hg : injective g)\r\n  : injective (g \u2218 f) :=\r\nassume x y,\r\nassume h1 : (g \u2218 f) x = (g \u2218 f) y,\r\nHf (Hg h1)\r\n\r\n-- 8\u00aa demostraci\u00f3n\r\nexample\r\n  (Hf : injective f)\r\n  (Hg : injective g)\r\n  : injective (g \u2218 f) :=\r\n\u03bb x y h1, Hf (Hg h1)\r\n\r\n-- 9\u00aa demostraci\u00f3n\r\nexample\r\n  (Hg : injective g)\r\n  (Hf : injective f)\r\n  : injective (g \u2218 f) :=\r\n-- by library_search\r\ninjective.comp Hg Hf\r\n\r\n-- 10\u00aa demostraci\u00f3n\r\nexample\r\n  (Hg : injective g)\r\n  (Hf : injective f)\r\n  : injective (g \u2218 f) :=\r\n-- by hint\r\nby tauto\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\/La_composicion_de_funciones_inyectivas_es_inyectiva.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=\u00bbSoluciones con Isabelle\/HOL\u00bb]<\/p>\n<pre lang=\"isar\">\r\ntheory La_composicion_de_funciones_inyectivas_es_inyectiva\r\nimports Main\r\nbegin\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"inj f\"\r\n          \"inj g\"\r\n  shows   \"inj (f \u2218 g)\"\r\nproof (rule injI)\r\n  fix x y\r\n  assume \"(f \u2218 g) x = (f \u2218 g) y\"\r\n  then have \"f (g x) = f (g y)\"\r\n    by (simp only: o_apply)\r\n  then have \"g x = g y\"\r\n    using \u2039inj f\u203a by (simp only: injD)\r\n  then show \"x = y\"\r\n    using \u2039inj g\u203a by (simp only: injD)\r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"inj f\"\r\n          \"inj g\"\r\n  shows   \"inj (f \u2218 g)\"\r\nusing assms\r\nby (simp add: inj_def)\r\n\r\n(* 3\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"inj f\"\r\n          \"inj g\"\r\n  shows   \"inj (f \u2218 g)\"\r\nusing assms\r\nby (rule inj_compose)\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>Demostrar que la composici\u00f3n de dos funciones inyectivas es una funci\u00f3n inyectiva. Para ello, completar la siguiente teor\u00eda de Lean: import tactic open function variables {X Y Z : Type} variable {f : X \u2192 Y} variable {g : Y \u2192 Z} example (Hf : injective f) (Hg : injective g) : injective (g \u2218 f) := sorry [expand title=\u00bbSoluciones con Lean\u00bb] import tactic open function variables {X Y Z : Type} variable {f : X \u2192 Y} variable {g : Y \u2192 Z} &#8212; 1\u00aa demostraci\u00f3n example (Hf : injective f) (Hg : injective g) : injective (g \u2218 f) := begin intros x y h, apply Hf, apply Hg, exact h, end &#8212; 2\u00aa demostraci\u00f3n example (Hf : injective f) (Hg : injective&#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":"","_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":[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\/654"}],"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=654"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/654\/revisions"}],"predecessor-version":[{"id":655,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/654\/revisions\/655"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}