        {"id":601,"date":"2021-07-26T06:00:19","date_gmt":"2021-07-26T04:00:19","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=601"},"modified":"2021-07-25T19:29:55","modified_gmt":"2021-07-25T17:29:55","slug":"la-paradoja-del-barbero","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/la-paradoja-del-barbero\/","title":{"rendered":"La paradoja del barbero"},"content":{"rendered":"<p>Demostrar la <a href=\"https:\/\/bit.ly\/3eWyvVw\">paradoja del barbero<\/a>; es decir, que no existe un hombre que afeite a todos los que no se afeitan a s\u00ed mismo y s\u00f3lo a los que no se afeitan a s\u00ed mismo.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport tactic\n\nvariable (Hombre : Type)\nvariable (afeita : Hombre \u2192 Hombre \u2192 Prop)\n\nexample :\n  \u00ac(\u2203 x : Hombre, \u2200 y : Hombre, afeita x y \u2194 \u00ac afeita y y) :=\nsorry\n<\/pre>\n<p>[expand title=\u00bbSoluciones con Lean\u00bb]<\/p>\n<pre lang=\"lean\">\r\nimport tactic\r\n\r\nvariable (Hombre : Type)\r\nvariable (afeita : Hombre \u2192 Hombre \u2192 Prop)\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample :\r\n  \u00ac(\u2203 x : Hombre, \u2200 y : Hombre, afeita x y \u2194 \u00ac afeita y y) :=\r\nbegin\r\n  intro h,\r\n  cases h with b hb,\r\n  specialize hb b,\r\n  by_cases (afeita b b),\r\n  { apply absurd h,\r\n    exact hb.mp h, },\r\n  { apply h,\r\n    exact hb.mpr h, },\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample :\r\n  \u00ac(\u2203 x : Hombre, \u2200 y : Hombre, afeita x y \u2194 \u00ac afeita y y) :=\r\nbegin\r\n  intro h,\r\n  cases h with b hb,\r\n  specialize hb b,\r\n  by_cases (afeita b b),\r\n  { exact (hb.mp h) h, },\r\n  { exact h (hb.mpr h), },\r\nend\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample :\r\n  \u00ac(\u2203 x : Hombre, \u2200 y : Hombre, afeita x y \u2194 \u00ac afeita y y) :=\r\nbegin\r\n  intro h,\r\n  cases h with b hb,\r\n  specialize hb b,\r\n  by itauto,\r\nend\r\n\r\n-- 4\u00aa demostraci\u00f3n\r\nexample :\r\n  \u00ac (\u2203 x : Hombre,  \u2200 y : Hombre, afeita x y \u2194 \u00ac afeita y y ) :=\r\nbegin\r\n  rintro \u27e8b, hb\u27e9,\r\n  exact (iff_not_self (afeita b b)).mp (hb b),\r\nend\r\n\r\n-- 5\u00aa demostraci\u00f3n\r\nexample :\r\n  \u00ac (\u2203 x : Hombre,  \u2200 y : Hombre, afeita x y \u2194 \u00ac afeita y y ) :=\r\n\u03bb \u27e8b, hb\u27e9, (iff_not_self (afeita b b)).mp (hb b)\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_paradoja_del_barbero.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_paradoja_del_barbero\r\nimports Main\r\nbegin\r\n\r\n(* 1\u00aa demostraci\u00f3n *)\r\nlemma\r\n  \"\u00ac(\u2203 x::'H. \u2200 y::'H. afeita x y \u27f7 \u00ac afeita y y)\"\r\nproof (rule notI)\r\n  assume \"\u2203 x. \u2200 y. afeita x y \u27f7 \u00ac afeita y y\"\r\n  then obtain b where \"\u2200 y. afeita b y \u27f7 \u00ac afeita y y\"\r\n    by (rule exE)\r\n  then have h : \"afeita b b \u27f7 \u00ac afeita b b\"\r\n    by (rule allE)\r\n  show False\r\n  proof (cases \"afeita b b\")\r\n    assume \"afeita b b\"\r\n    then have \"\u00ac afeita b b\"\r\n      using h by (rule rev_iffD1)\r\n    then show False\r\n      using \u2039afeita b b\u203a by (rule notE)\r\n  next\r\n    assume \"\u00ac afeita b b\"\r\n    then have \"afeita b b\"\r\n      using h by (rule rev_iffD2)\r\n    with \u2039\u00ac afeita b b\u203a show False\r\n      by (rule notE)\r\n  qed\r\nqed\r\n\r\n(* 2\u00aa demostraci\u00f3n *)\r\nlemma\r\n  \"\u00ac(\u2203 x::'H. \u2200 y::'H. afeita x y \u27f7 \u00ac afeita y y)\"\r\nproof\r\n  assume \"\u2203 x. \u2200 y. afeita x y \u27f7 \u00ac afeita y y\"\r\n  then obtain b where \"\u2200 y. afeita b y \u27f7 \u00ac afeita y y\"\r\n    by (rule exE)\r\n  then have h : \"afeita b b \u27f7 \u00ac afeita b b\"\r\n    by (rule allE)\r\n  then show False\r\n    by simp\r\nqed\r\n\r\n(* 3\u00aa demostraci\u00f3n *)\r\nlemma\r\n  \"\u00ac(\u2203 x::'H. \u2200 y::'H. afeita x y \u27f7 \u00ac afeita y y)\"\r\n  by auto\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 la paradoja del barbero; es decir, que no existe un hombre que afeite a todos los que no se afeitan a s\u00ed mismo y s\u00f3lo a los que no se afeitan a s\u00ed mismo. Para ello, completar la siguiente teor\u00eda de Lean: import tactic variable (Hombre : Type) variable (afeita : Hombre \u2192 Hombre \u2192 Prop) example : \u00ac(\u2203 x : Hombre, \u2200 y : Hombre, afeita x y \u2194 \u00ac afeita y y) := sorry [expand title=\u00bbSoluciones con Lean\u00bb] import tactic variable (Hombre : Type) variable (afeita : Hombre \u2192 Hombre \u2192 Prop) &#8212; 1\u00aa demostraci\u00f3n example : \u00ac(\u2203 x : Hombre, \u2200 y : Hombre, afeita x y \u2194 \u00ac afeita y y) := begin intro h, cases h with b hb,&#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":[7],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/601"}],"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=601"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/601\/revisions"}],"predecessor-version":[{"id":602,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/601\/revisions\/602"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}