        {"id":631,"date":"2021-08-05T06:00:44","date_gmt":"2021-08-05T04:00:44","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=631"},"modified":"2021-08-03T16:23:47","modified_gmt":"2021-08-03T14:23:47","slug":"las-funciones-con-inversa-por-la-derecha-son-suprayectivas","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/las-funciones-con-inversa-por-la-derecha-son-suprayectivas\/","title":{"rendered":"Las funciones con inversa por la derecha son suprayectivas"},"content":{"rendered":"<p>En Lean, que g es una inversa por la izquierda de f est\u00e1 definido por<\/p>\n<pre lang=\"text\">\n   left_inverse (g : \u03b2 \u2192 \u03b1) (f : \u03b1 \u2192 \u03b2) : Prop :=\n      \u2200 x, g (f x) = x\n<\/pre>\n<p>que g es una inversa por la derecha de f est\u00e1 definido por<\/p>\n<pre lang=\"text\">\n   right_inverse (g : \u03b2 \u2192 \u03b1) (f : \u03b1 \u2192 \u03b2) : Prop :=\n      left_inverse f g\n<\/pre>\n<p>y que f tenga inversa por la derecha est\u00e1 definido por<\/p>\n<pre lang=\"text\">\n   has_right_inverse (f : \u03b1 \u2192 \u03b2) : Prop :=\n      \u2203 g : \u03b2 \u2192 \u03b1, right_inverse g f\n<\/pre>\n<p>Finalmente, que f es suprayectiva est\u00e1 definido por<\/p>\n<pre lang=\"text\">\n   def surjective (f : \u03b1 \u2192 \u03b2) : Prop :=\n      \u2200 b, \u2203 a, f a = b\n<\/pre>\n<p>Demostrar que si la funci\u00f3n f tiene inversa por la derecha, entonces f es suprayectiva.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport tactic\nopen function\n\nvariables {\u03b1 \u03b2: Type*}\nvariable  {f : \u03b1 \u2192 \u03b2}\n\nexample\n  (hf : has_right_inverse f)\n  : surjective 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 {\u03b1 \u03b2: Type*}\r\nvariable  {f : \u03b1 \u2192 \u03b2}\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : has_right_inverse f)\r\n  : surjective f :=\r\nbegin\r\n  unfold surjective,\r\n  unfold has_right_inverse at hf,\r\n  cases hf with g hg,\r\n  intro b,\r\n  use g b,\r\n  exact hg b,\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : has_right_inverse f)\r\n  : surjective f :=\r\nbegin\r\n  intro b,\r\n  cases hf with g hg,\r\n  use g b,\r\n  exact hg b,\r\nend\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : has_right_inverse f)\r\n  : surjective f :=\r\nbegin\r\n  intro b,\r\n  cases hf with g hg,\r\n  use [g b, hg b],\r\nend\r\n\r\n-- 4\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : has_right_inverse f)\r\n  : surjective f :=\r\nhas_right_inverse.surjective hf\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\/Las_funciones_con_inversa_por_la_derecha_son_suprayectivas.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 Las_funciones_con_inversa_por_la_derecha_son_suprayectivas\r\nimports Main\r\nbegin\r\n\r\ndefinition tiene_inversa_dcha :: \"('a \u21d2 'b) \u21d2 bool\" where\r\n  \"tiene_inversa_dcha f \u27f7 (\u2203g. \u2200y. f (g y) = y)\"\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"tiene_inversa_dcha f\"\r\n  shows   \"surj f\"\r\nproof (unfold surj_def; intro allI)\r\n  fix y\r\n  obtain g where \"\u2200y. f (g y) = y\"\r\n    using assms tiene_inversa_dcha_def by auto\r\n  then have \"f (g y) = y\"\r\n    by (rule allE)\r\n  then have \"y = f (g y)\"\r\n    by (rule sym)\r\n  then show \"\u2203x. y = f x\"\r\n    by (rule exI)\r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"tiene_inversa_dcha f\"\r\n  shows   \"surj f\"\r\nproof (unfold surj_def; intro allI)\r\n  fix y\r\n  obtain g where \"\u2200y. f (g y) = y\"\r\n    using assms tiene_inversa_dcha_def by auto\r\n  then have \"y = f (g y)\"\r\n    by simp\r\n  then show \"\u2203x. y = f x\"\r\n    by (rule exI)\r\nqed\r\n\r\n(* 3\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"tiene_inversa_dcha f\"\r\n  shows   \"surj f\"\r\nproof (unfold surj_def; intro allI)\r\n  fix y\r\n  obtain g where \"\u2200y. f (g y) = y\"\r\n    using assms tiene_inversa_dcha_def by auto\r\n  then show \"\u2203x. y = f x\"\r\n    by metis\r\nqed\r\n\r\n(* 4\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"tiene_inversa_dcha f\"\r\n  shows   \"surj f\"\r\nproof (unfold surj_def; intro allI)\r\n  fix y\r\n  show \"\u2203x. y = f x\"\r\n    using assms tiene_inversa_dcha_def\r\n    by metis\r\nqed\r\n\r\n(* 5\u00aa demostraci\u00f3n *)\r\nlemma\r\n  assumes \"tiene_inversa_dcha f\"\r\n  shows   \"surj f\"\r\nusing assms tiene_inversa_dcha_def surj_def\r\nby metis\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>En Lean, que g es una inversa por la izquierda de f est\u00e1 definido por left_inverse (g : \u03b2 \u2192 \u03b1) (f : \u03b1 \u2192 \u03b2) : Prop := \u2200 x, g (f x) = x que g es una inversa por la derecha de f est\u00e1 definido por right_inverse (g : \u03b2 \u2192 \u03b1) (f : \u03b1 \u2192 \u03b2) : Prop := left_inverse f g y que f tenga inversa por la derecha est\u00e1 definido por has_right_inverse (f : \u03b1 \u2192 \u03b2) : Prop := \u2203 g : \u03b2 \u2192 \u03b1, right_inverse g f Finalmente, que f es suprayectiva est\u00e1 definido por def surjective (f : \u03b1 \u2192 \u03b2) : Prop := \u2200 b, \u2203 a, f a = b Demostrar que si la&#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\/631"}],"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=631"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/631\/revisions"}],"predecessor-version":[{"id":632,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/631\/revisions\/632"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}