        {"id":943,"date":"2022-05-06T12:05:52","date_gmt":"2022-05-06T10:05:52","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=943"},"modified":"2022-05-06T14:01:00","modified_gmt":"2022-05-06T12:01:00","slug":"teorema-de-cantor","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/teorema-de-cantor\/","title":{"rendered":"Teorema de Cantor"},"content":{"rendered":"<p>Demostrar el teorema de Cantor; es decir, que no existe ninguna aplicaci\u00f3n suprayectiva de un conjunto en su conjunto potencia.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.set.basic\nopen function\n\nvariables {\u03b1 : Type}\n\nexample : \u2200 f : \u03b1 \u2192 set \u03b1, \u00ac surjective f :=\nsorry\n<\/pre>\n<p><!--more--><\/p>\n<p><strong>Soluciones con Lean<\/strong><\/p>\n<pre lang=\"lean\">\nimport data.set.basic\nopen function\n\nvariables {\u03b1 : Type}\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : \u2200 f : \u03b1 \u2192 set \u03b1, \u00ac surjective f :=\nbegin\n  intros f hf,\n  let S := {i | i \u2209 f i},\n  unfold surjective at hf,\n  cases hf S with j hj,\n  by_cases j \u2208 S,\n  { dsimp at h,\n    apply h,\n    rw hj,\n    exact h, },\n  { apply h,\n    rw \u2190 hj at h,\n    exact h, },\nend\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : \u2200 f : \u03b1 \u2192 set \u03b1, \u00ac surjective f :=\nbegin\n  intros f hf,\n  let S := {i | i \u2209 f i},\n  cases hf S with j hj,\n  by_cases j \u2208 S,\n  { apply  h,\n    rwa hj, },\n  { apply h,\n    rwa \u2190 hj at h, },\nend\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : \u2200 f : \u03b1 \u2192 set \u03b1, \u00ac surjective f :=\nbegin\n  intros f hf,\n  let S := {i | i \u2209 f i},\n  cases hf S with j hj,\n  have h : (j \u2208 S) = (j \u2209 S), from\n    calc  (j \u2208 S)\n        = (j \u2209 f j) : set.mem_set_of_eq\n    ... = (j \u2209 S)   : congr_arg not (congr_arg (has_mem.mem j) hj),\n  exact false_of_a_eq_not_a h,\nend\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : \u2200 f : \u03b1 \u2192 set \u03b1, \u00ac surjective f :=\nbegin\n  intros f hf,\n  let S := {i | i \u2209 f i},\n  cases hf S with j hj,\n  have h : (j \u2208 S) = (j \u2209 S),\n  { dsimp,\n    exact congr_arg not (congr_arg (has_mem.mem j) hj), },\n  { exact false_of_a_eq_not_a (congr_arg not (congr_arg not h)), },\nend\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : \u2200 f : \u03b1 \u2192 set \u03b1, \u00ac surjective f :=\ncantor_surjective\n<\/pre>\n<p>El c\u00f3digo de las demostraciones se encuentra en <a href=\"https:\/\/github.com\/jaalonso\/Razonando-con-Lean\/blob\/main\/src\/Teorema_de_Cantor.lean\">GitHub<\/a> y puede ejecutarse con el <a href=\"https:\/\/leanprover-community.github.io\/lean-web-editor\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Razonando-con-Lean\/main\/src\/Teorema_de_Cantor.lean\">Lean Web editor<\/a>.<\/p>\n<p>La construcci\u00f3n de las demostraciones se muestra en el siguiente v\u00eddeo<\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/Kn79deNnEhU\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p><strong>Soluciones con Isabelle\/HOL<\/strong><\/p>\n<pre lang=\"isar\">\ntheory Teorema_de_Cantor\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\n\ntheorem\n  fixes f :: \"'\u03b1 \u21d2 '\u03b1 set\"\n  shows \"\u00ac surj f\"\nproof (rule notI)\n  assume \"surj f\"\n  let ?S = \"{i. i \u2209 f i}\"\n  have \"\u2203 j. ?S = f j\"\n    using \u2039surj f\u203a by (simp only: surjD)\n  then obtain j where \"?S = f j\"\n    by (rule exE)\n  show False\n  proof (cases \"j \u2208 ?S\")\n    assume \"j \u2208 ?S\"\n    then have \"j \u2209 f j\"\n      by (rule CollectD)\n    moreover\n    have \"j \u2208 f j\"\n      using \u2039?S = f j\u203a \u2039j \u2208 ?S\u203a by (rule subst)\n    ultimately show False\n      by (rule notE)\n  next\n    assume \"j \u2209 ?S\"\n    with \u2039?S = f j\u203a have \"j \u2209 f j\"\n      by (rule subst)\n    then have \"j \u2208 ?S\"\n      by (rule CollectI)\n    with \u2039j \u2209 ?S\u203a show False\n      by (rule notE)\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\n\ntheorem\n  fixes f :: \"'\u03b1 \u21d2 '\u03b1 set\"\n  shows \"\u00ac surj f\"\nproof (rule notI)\n  assume \"surj f\"\n  let ?S = \"{i. i \u2209 f i}\"\n  have \"\u2203 j. ?S = f j\"\n    using \u2039surj f\u203a by (simp only: surjD)\n  then obtain j where \"?S = f j\"\n    by (rule exE)\n  have \"j \u2209 ?S\"\n  proof (rule notI)\n    assume \"j \u2208 ?S\"\n    then have \"j \u2209 f j\"\n      by (rule CollectD)\n    with \u2039?S = f j\u203a have \"j \u2209 ?S\"\n      by (rule ssubst)\n    then show False\n      using \u2039j \u2208 ?S\u203a by (rule notE)\n  qed\n  moreover\n  have \"j \u2208 ?S\"\n  proof (rule CollectI)\n    show \"j \u2209 f j\"\n    proof (rule notI)\n      assume \"j \u2208 f j\"\n      with \u2039?S = f j\u203a have \"j \u2208 ?S\"\n        by (rule ssubst)\n      then have \"j \u2209 f j\"\n        by (rule CollectD)\n      then show False\n        using \u2039j \u2208 f j\u203a by (rule notE)\n    qed\n  qed\n  ultimately show False\n    by (rule notE)\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\n\ntheorem\n  fixes f :: \"'\u03b1 \u21d2 '\u03b1 set\"\n  shows \"\u00ac surj f\"\nproof\n  assume \"surj f\"\n  let ?S = \"{i. i \u2209 f i}\"\n  have \"\u2203 j. ?S = f j\" using \u2039surj f\u203a by (simp only: surjD)\n  then obtain j where \"?S = f j\" by (rule exE)\n  have \"j \u2209 ?S\"\n  proof\n    assume \"j \u2208 ?S\"\n    then have \"j \u2209 f j\" by simp\n    with \u2039?S = f j\u203a have \"j \u2209 ?S\" by simp\n    then show False using \u2039j \u2208 ?S\u203a by simp\n  qed\n  moreover\n  have \"j \u2208 ?S\"\n  proof\n    show \"j \u2209 f j\"\n    proof\n      assume \"j \u2208 f j\"\n      with \u2039?S = f j\u203a have \"j \u2208 ?S\" by simp\n      then have \"j \u2209 f j\" by simp\n      then show False using \u2039j \u2208 f j\u203a by simp\n    qed\n  qed\n  ultimately show False by simp\nqed\n\n(* 4\u00aa demostraci\u00f3n *)\n\ntheorem\n  fixes f :: \"'\u03b1 \u21d2 '\u03b1 set\"\n  shows \"\u00ac surj f\"\nproof (rule notI)\n  assume \"surj f\"\n  let ?S = \"{i. i \u2209 f i}\"\n  have \"\u2203 j. ?S = f j\"\n    using \u2039surj f\u203a by (simp only: surjD)\n  then obtain j where \"?S = f j\"\n    by (rule exE)\n  have \"j \u2208 ?S = (j \u2209 f j)\"\n    by (rule mem_Collect_eq)\n  also have \"\u2026 = (j \u2209 ?S)\"\n    by (simp only: \u2039?S = f j\u203a)\n  finally show False\n    by (simp only: simp_thms(10))\nqed\n\n(* 5\u00aa demostraci\u00f3n *)\n\ntheorem\n  fixes f :: \"'\u03b1 \u21d2 '\u03b1 set\"\n  shows \"\u00ac surj f\"\nproof\n  assume \"surj f\"\n  let ?S = \"{i. i \u2209 f i}\"\n  have \"\u2203 j. ?S = f j\" using \u2039surj f\u203a by (simp only: surjD)\n  then obtain j where \"?S = f j\" by (rule exE)\n  have \"j \u2208 ?S = (j \u2209 f j)\" by simp\n  also have \"\u2026 = (j \u2209 ?S)\" using \u2039?S = f j\u203a by simp\n  finally show False by simp\nqed\n\n(* 6\u00aa demostraci\u00f3n *)\n\ntheorem\n  fixes f :: \"'\u03b1 \u21d2 '\u03b1 set\"\n  shows \"\u00ac surj f\"\n  unfolding surj_def\n  by best\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar el teorema de Cantor; es decir, que no existe ninguna aplicaci\u00f3n suprayectiva de un conjunto en su conjunto potencia. Para ello, completar la siguiente teor\u00eda de Lean: import data.set.basic open function variables {\u03b1 : Type} example : \u2200 f : \u03b1 \u2192 set \u03b1, \u00ac surjective f := sorry<\/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":[282],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/943"}],"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=943"}],"version-history":[{"count":3,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/943\/revisions"}],"predecessor-version":[{"id":946,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/943\/revisions\/946"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}