        {"id":318,"date":"2021-05-24T13:03:52","date_gmt":"2021-05-24T11:03:52","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=318"},"modified":"2021-05-24T18:44:50","modified_gmt":"2021-05-24T16:44:50","slug":"conmutatividad-de-la-interseccion","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/conmutatividad-de-la-interseccion\/","title":{"rendered":"Conmutatividad de la intersecci\u00f3n"},"content":{"rendered":"<p>Demostrar que<\/p>\n<blockquote><p>\n  s \u2229 t = t \u2229 s\n<\/p><\/blockquote>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.set.basic\nopen set\n\nvariable {\u03b1 : Type}\nvariables s t u : set \u03b1\n\nexample : s \u2229 t = t \u2229 s :=\nsorry\n<\/pre>\n<p><strong>Notas<\/strong><\/p>\n<ul>\n<li>En <a href=\"https:\/\/bit.ly\/3yw2r2O\">este enlace<\/a> se puede escribir las soluciones en Lean.<\/li>\n<li>A continuaci\u00f3n se muestran algunas soluciones (que se pueden probar en <a href=\"https:\/\/bit.ly\/3hNkUBU\">este enlace<\/a>).<\/li>\n<li>En los comentarios se pueden publicar otras soluciones, en Lean o en otros sistemas de razonamiento.\n<ul>\n<li>Para publicar las demostraciones en Lean se deben de escribir entre una l\u00ednea con &#60;pre lang=&quot;lean&quot;&#62; y otra con &#60;\/pre&#62;<\/li>\n<li>Para publicar las demostraciones en Isabelle\/HOL se deben de escribir entre una l\u00ednea con &#60;pre lang=&quot;isar&quot;&#62; y otra con &#60;\/pre&#62;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p><strong>Soluciones con Lean<\/strong><\/p>\n<pre lang=\"lean\">\nimport data.set.basic\nopen set\n\nvariable {\u03b1 : Type}\nvariables s t u : set \u03b1\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 t = t \u2229 s :=\nbegin\n  ext x,\n  simp only [mem_inter_eq],\n  split,\n  { intro h,\n    split,\n    { exact h.2, },\n    { exact h.1, }},\n  { intro h,\n    split,\n    { exact h.2, },\n    { exact h.1, }},\nend\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 t = t \u2229 s :=\nbegin\n  ext,\n  simp only [mem_inter_eq],\n  exact \u27e8\u03bb h, \u27e8h.2, h.1\u27e9,\n         \u03bb h, \u27e8h.2, h.1\u27e9\u27e9,\nend\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 t = t \u2229 s :=\nbegin\n  ext,\n  exact \u27e8\u03bb h, \u27e8h.2, h.1\u27e9,\n         \u03bb h, \u27e8h.2, h.1\u27e9\u27e9,\nend\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 t = t \u2229 s :=\nbegin\n  ext x,\n  simp only [mem_inter_eq],\n  split,\n  { rintros \u27e8xs, xt\u27e9,\n    exact \u27e8xt, xs\u27e9 },\n  { rintros \u27e8xt, xs\u27e9,\n    exact \u27e8xs, xt\u27e9 },\nend\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 t = t \u2229 s :=\nbegin\n  ext x,\n  exact and.comm,\nend\n\n-- 6\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 t = t \u2229 s :=\next (\u03bb x, and.comm)\n\n-- 7\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 t = t \u2229 s :=\nby ext x; simp [and.comm]\n\n-- 8\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 t = t \u2229 s :=\ninter_comm s t\n\n-- 9\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 t = t \u2229 s :=\nby finish\n<\/pre>\n<p><strong>Soluciones con Isabelle\/HOL<\/strong><\/p>\n<pre lang=\"isar\">\ntheory Conmutatividad_de_la_interseccion\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 t = t \u2229 s\"\nproof (rule set_eqI)\n  fix x\n  show \"x \u2208 s \u2229 t \u27f7 x \u2208 t \u2229 s\"\n  proof (rule iffI)\n    assume h : \"x \u2208 s \u2229 t\"\n    then have xs : \"x \u2208 s\"\n      by (simp only: IntD1)\n    have xt : \"x \u2208 t\"\n      using h by (simp only: IntD2)\n    then show \"x \u2208 t \u2229 s\"\n      using xs by (rule IntI)\n  next\n    assume h : \"x \u2208 t \u2229 s\"\n    then have xt : \"x \u2208 t\"\n      by (simp only: IntD1)\n    have xs : \"x \u2208 s\"\n      using h by (simp only: IntD2)\n    then show \"x \u2208 s \u2229 t\"\n      using xt by (rule IntI)\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 t = t \u2229 s\"\nproof (rule set_eqI)\n  fix x\n  show \"x \u2208 s \u2229 t \u27f7 x \u2208 t \u2229 s\"\n  proof\n    assume h : \"x \u2208 s \u2229 t\"\n    then have xs : \"x \u2208 s\"\n      by simp\n    have xt : \"x \u2208 t\"\n      using h by simp\n    then show \"x \u2208 t \u2229 s\"\n      using xs by simp\n  next\n    assume h : \"x \u2208 t \u2229 s\"\n    then have xt : \"x \u2208 t\"\n      by simp\n    have xs : \"x \u2208 s\"\n      using h by simp\n    then show \"x \u2208 s \u2229 t\"\n      using xt by simp\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 t = t \u2229 s\"\nproof (rule equalityI)\n  show \"s \u2229 t \u2286 t \u2229 s\"\n  proof (rule subsetI)\n    fix x\n    assume h : \"x \u2208 s \u2229 t\"\n    then have xs : \"x \u2208 s\"\n      by (simp only: IntD1)\n    have xt : \"x \u2208 t\"\n      using h by (simp only: IntD2)\n    then show \"x \u2208 t \u2229 s\"\n      using xs by (rule IntI)\n  qed\nnext\n  show \"t \u2229 s \u2286 s \u2229 t\"\n  proof (rule subsetI)\n    fix x\n    assume h : \"x \u2208 t \u2229 s\"\n    then have xt : \"x \u2208 t\"\n      by (simp only: IntD1)\n    have xs : \"x \u2208 s\"\n      using h by (simp only: IntD2)\n    then show \"x \u2208 s \u2229 t\"\n      using xt by (rule IntI)\n  qed\nqed\n\n(* 4\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 t = t \u2229 s\"\nproof\n  show \"s \u2229 t \u2286 t \u2229 s\"\n  proof\n    fix x\n    assume h : \"x \u2208 s \u2229 t\"\n    then have xs : \"x \u2208 s\"\n      by simp\n    have xt : \"x \u2208 t\"\n      using h by simp\n    then show \"x \u2208 t \u2229 s\"\n      using xs by simp\n  qed\nnext\n  show \"t \u2229 s \u2286 s \u2229 t\"\n  proof\n    fix x\n    assume h : \"x \u2208 t \u2229 s\"\n    then have xt : \"x \u2208 t\"\n      by simp\n    have xs : \"x \u2208 s\"\n      using h by simp\n    then show \"x \u2208 s \u2229 t\"\n      using xt by simp\n  qed\nqed\n\n(* 5\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 t = t \u2229 s\"\nproof\n  show \"s \u2229 t \u2286 t \u2229 s\"\n  proof\n    fix x\n    assume \"x \u2208 s \u2229 t\"\n    then show \"x \u2208 t \u2229 s\"\n      by simp\n  qed\nnext\n  show \"t \u2229 s \u2286 s \u2229 t\"\n  proof\n    fix x\n    assume \"x \u2208 t \u2229 s\"\n    then show \"x \u2208 s \u2229 t\"\n      by simp\n  qed\nqed\n\n(* 6\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 t = t \u2229 s\"\nby (fact Int_commute)\n\n(* 7\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 t = t \u2229 s\"\nby (fact inf_commute)\n\n(* 8\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 t = t \u2229 s\"\nby auto\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar que s \u2229 t = t \u2229 s Para ello, completar la siguiente teor\u00eda de Lean: import data.set.basic open set variable {\u03b1 : Type} variables s t u : set \u03b1 example : s \u2229 t = t \u2229 s := sorry Notas En este enlace se puede escribir las soluciones en Lean. A continuaci\u00f3n se muestran algunas soluciones (que se pueden probar en este enlace). En los comentarios se pueden publicar otras soluciones, en Lean o en otros sistemas de razonamiento. Para publicar las demostraciones en Lean se deben de escribir entre una l\u00ednea con &#60;pre lang=&quot;lean&quot;&#62; y otra con &#60;\/pre&#62; Para publicar las demostraciones en Isabelle\/HOL se deben de escribir entre una l\u00ednea con &#60;pre lang=&quot;isar&quot;&#62; y otra con &#60;\/pre&#62;<\/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\/318"}],"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=318"}],"version-history":[{"count":2,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/318\/revisions"}],"predecessor-version":[{"id":323,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/318\/revisions\/323"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}