        {"id":645,"date":"2021-08-12T06:00:53","date_gmt":"2021-08-12T04:00:53","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=645"},"modified":"2021-08-05T15:26:56","modified_gmt":"2021-08-05T13:26:56","slug":"la-inversa-de-una-funcion-biyectiva-es-biyectiva","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/la-inversa-de-una-funcion-biyectiva-es-biyectiva\/","title":{"rendered":"La inversa de una funci\u00f3n biyectiva es biyectiva"},"content":{"rendered":"<p>En Lean se puede definir que g es una inversa de f por<\/p>\n<pre lang=\"text\">\n   def inversa (f : X \u2192 Y) (g : Y \u2192 X) :=\n     (\u2200 x, (g \u2218 f) x = x) \u2227 (\u2200 y, (f \u2218 g) y = y)\n<\/pre>\n<p>Demostrar que si la funci\u00f3n f es biyectiva y g es una inversa de f, entonces g es biyectiva.<\/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 : Type*}\nvariable (f : X \u2192 Y)\nvariable (g : Y \u2192 X)\n\ndef inversa (f : X \u2192 Y) (g : Y \u2192 X) :=\n  (\u2200 x, (g \u2218 f) x = x) \u2227 (\u2200 y, (f \u2218 g) y = y)\n\nexample\n  (hf : bijective f)\n  (hg : inversa g f)\n  : bijective g :=\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 : Type*}\r\nvariable (f : X \u2192 Y)\r\nvariable (g : Y \u2192 X)\r\n\r\ndef inversa (f : X \u2192 Y) (g : Y \u2192 X) :=\r\n  (\u2200 x, (g \u2218 f) x = x) \u2227 (\u2200 y, (f \u2218 g) y = y)\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : bijective f)\r\n  (hg : inversa g f)\r\n  : bijective g :=\r\nbegin\r\n  rcases hg with \u27e8h1, h2\u27e9,\r\n  rw bijective_iff_has_inverse,\r\n  use f,\r\n  split,\r\n  { exact h1, },\r\n  { exact h2, },\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : bijective f)\r\n  (hg : inversa g f)\r\n  : bijective g :=\r\nbegin\r\n  rcases hg with \u27e8h1, h2\u27e9,\r\n  rw bijective_iff_has_inverse,\r\n  use f,\r\n  exact \u27e8h1, h2\u27e9,\r\nend\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : bijective f)\r\n  (hg : inversa g f)\r\n  : bijective g :=\r\nbegin\r\n  rcases hg with \u27e8h1, h2\u27e9,\r\n  rw bijective_iff_has_inverse,\r\n  use [f, \u27e8h1, h2\u27e9],\r\nend\r\n\r\n-- 4\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : bijective f)\r\n  (hg : inversa g f)\r\n  : bijective g :=\r\nbegin\r\n  rw bijective_iff_has_inverse,\r\n  use f,\r\n  exact hg,\r\nend\r\n\r\n-- 5\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : bijective f)\r\n  (hg : inversa g f)\r\n  : bijective g :=\r\nbegin\r\n  rw bijective_iff_has_inverse,\r\n  use [f, hg],\r\nend\r\n\r\n-- 6\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : bijective f)\r\n  (hg : inversa g f)\r\n  : bijective g :=\r\nbegin\r\n  apply bijective_iff_has_inverse.mpr,\r\n  use [f, hg],\r\nend\r\n\r\n-- 7\u00aa demostraci\u00f3n\r\nexample\r\n  (hf : bijective f)\r\n  (hg : inversa g f)\r\n  : bijective g :=\r\nbijective_iff_has_inverse.mpr (by use [f, hg])\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_inversa_de_una_funcion_biyectiva_es_biyectiva.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_inversa_de_una_funcion_biyectiva_es_biyectiva\r\nimports Main\r\nbegin\r\n\r\ndefinition inversa :: \"('a \u21d2 'b) \u21d2 ('b \u21d2 'a) \u21d2 bool\" where\r\n  \"inversa f g \u27f7 (\u2200 x. (g \u2218 f) x = x) \u2227 (\u2200 y. (f \u2218 g) y = y)\"\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma \r\n  fixes   f :: \"'a \u21d2 'b\"\r\n  assumes \"bij f\"\r\n          \"inversa g f\"\r\n  shows   \"bij g\"\r\nproof (rule bijI)\r\n  show \"inj g\"\r\n  proof (rule injI)\r\n    fix x y\r\n    assume \"g x = g y\"\r\n    have h1 : \"\u2200 y. (f \u2218 g) y = y\"\r\n      by (meson assms(2) inversa_def)\r\n    then have \"x = (f \u2218 g) x\" \r\n      by (simp only: allE)\r\n    also have \"\u2026 = f (g x)\"\r\n      by (simp only: o_apply)\r\n    also have \"\u2026 = f (g y)\"\r\n      by (simp only: \u2039g x = g y\u203a)\r\n    also have \"\u2026 = (f \u2218 g) y\"\r\n      by (simp only: o_apply)\r\n    also have \"\u2026 = y\"\r\n      using h1 by (simp only: allE)\r\n    finally show \"x = y\" \r\n      by this\r\n  qed\r\nnext\r\n  show \"surj g\" \r\n  proof (rule surjI)\r\n    fix x\r\n    have h2 : \"\u2200 x. (g \u2218 f) x = x\"\r\n      by (meson assms(2) inversa_def)\r\n    then have \"(g \u2218 f) x = x\" \r\n      by (simp only: allE)\r\n    then show \"g (f x) = x\" \r\n      by (simp only: o_apply)\r\n  qed \r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma \r\n  fixes   f :: \"'a \u21d2 'b\"\r\n  assumes \"bij f\"\r\n          \"inversa g f\"\r\n  shows   \"bij g\"\r\nproof (rule bijI)\r\n  show \"inj g\"\r\n  proof (rule injI)\r\n    fix x y\r\n    assume \"g x = g y\"\r\n    have h1 : \"\u2200 y. (f \u2218 g) y = y\"\r\n      by (meson assms(2) inversa_def)\r\n    then show \"x = y\" \r\n      by (metis \u2039g x = g y\u203a o_apply)\r\n  qed\r\nnext\r\n  show \"surj g\" \r\n  proof (rule surjI)\r\n    fix x\r\n    have h2 : \"\u2200 x. (g \u2218 f) x = x\"\r\n      by (meson assms(2) inversa_def)\r\n    then show \"g (f x) = x\" \r\n      by (simp only: o_apply)\r\n  qed \r\nqed\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 se puede definir que g es una inversa de f por def inversa (f : X \u2192 Y) (g : Y \u2192 X) := (\u2200 x, (g \u2218 f) x = x) \u2227 (\u2200 y, (f \u2218 g) y = y) Demostrar que si la funci\u00f3n f es biyectiva y g es una inversa de f, entonces g es biyectiva. Para ello, completar la siguiente teor\u00eda de Lean: import tactic open function variables {X Y : Type*} variable (f : X \u2192 Y) variable (g : Y \u2192 X) def inversa (f : X \u2192 Y) (g : Y \u2192 X) := (\u2200 x, (g \u2218 f) x = x) \u2227 (\u2200 y, (f \u2218 g) y = y) example (hf : bijective&#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\/645"}],"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=645"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/645\/revisions"}],"predecessor-version":[{"id":646,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/645\/revisions\/646"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}