        {"id":926,"date":"2022-04-28T16:45:06","date_gmt":"2022-04-28T14:45:06","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=926"},"modified":"2022-04-28T18:41:38","modified_gmt":"2022-04-28T16:41:38","slug":"distributiva-de-la-interseccion-respecto-de-la-union-general","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/distributiva-de-la-interseccion-respecto-de-la-union-general\/","title":{"rendered":"Distributiva de la intersecci\u00f3n respecto de la uni\u00f3n general"},"content":{"rendered":"<p>Demostrar que <code>s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s)<\/code><\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport data.set.basic\nimport data.set.lattice\nimport tactic\n\nopen set\n\nvariable {\u03b1 : Type}\nvariable s : set \u03b1\nvariable A : \u2115 \u2192 set \u03b1\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nsorry\n<\/pre>\n<p><!--more--><\/p>\n<p><strong>Soluciones con Lean<\/strong><\/p>\n<pre lang=\"lean\">\nimport data.set.basic\nimport data.set.lattice\nimport tactic\n\nopen set\n\nvariable {\u03b1 : Type}\nvariable s : set \u03b1\nvariable A : \u2115 \u2192 set \u03b1\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nbegin\n  ext x,\n  split,\n  { intro h,\n    rw mem_Union,\n    cases h with xs xUAi,\n    rw mem_Union at xUAi,\n    cases xUAi with i xAi,\n    use i,\n    split,\n    { exact xAi, },\n    { exact xs, }},\n  { intro h,\n    rw mem_Union at h,\n    cases h with i hi,\n    cases hi with xAi xs,\n    split,\n    { exact xs, },\n    { rw mem_Union,\n      use i,\n      exact xAi, }},\nend\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nbegin\n  ext x,\n  simp,\n  split,\n  { rintros \u27e8xs, \u27e8i, xAi\u27e9\u27e9,\n    exact \u27e8\u27e8i, xAi\u27e9, xs\u27e9, },\n  { rintros \u27e8\u27e8i, xAi\u27e9, xs\u27e9,\n    exact \u27e8xs, \u27e8i, xAi\u27e9\u27e9 },\nend\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nbegin\n  ext x,\n  finish,\nend\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nby ext; finish\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nby finish [ext_iff]\n\n-- 6\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nby tidy\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\/Distributiva_de_la_interseccion_respecto_de_la_union_general.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\/Distributiva_de_la_interseccion_respecto_de_la_union_general.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\/lYd2xT-G3ZY\" 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 Distributiva_de_la_interseccion_respecto_de_la_union_general\nimports Main\nbegin\n\nsection \u20391\u00aa demostraci\u00f3n\u203a\n\nlemma \"s \u2229 (\u22c3 i \u2208 I. A i) = (\u22c3 i \u2208 I. (A i \u2229 s))\"\nproof (rule equalityI)\n  show \"s \u2229 (\u22c3 i \u2208 I. A i) \u2286 (\u22c3 i \u2208 I. (A i \u2229 s))\"\n  proof (rule subsetI)\n    fix x\n    assume \"x \u2208 s \u2229 (\u22c3 i \u2208 I. A i)\"\n    then have \"x \u2208 s\"\n      by (simp only: IntD1)\n    have \"x \u2208 (\u22c3 i \u2208 I. A i)\"\n      using \u2039x \u2208 s \u2229 (\u22c3 i \u2208 I. A i)\u203a by (simp only: IntD2)\n    then show \"x \u2208 (\u22c3 i \u2208 I. (A i \u2229 s))\"\n    proof (rule UN_E)\n      fix i\n      assume \"i \u2208 I\"\n      assume \"x \u2208 A i\"\n      then have \"x \u2208 A i \u2229 s\"\n        using \u2039x \u2208 s\u203a by (rule IntI)\n      with \u2039i \u2208 I\u203a show \"x \u2208 (\u22c3 i \u2208 I. (A i \u2229 s))\"\n        by (rule UN_I)\n    qed\n  qed\nnext\n  show \"(\u22c3 i \u2208 I. (A i \u2229 s)) \u2286 s \u2229 (\u22c3 i \u2208 I. A i)\"\n  proof (rule subsetI)\n    fix x\n    assume \"x \u2208 (\u22c3 i \u2208 I. A i \u2229 s)\"\n    then show \"x \u2208 s \u2229 (\u22c3 i \u2208 I. A i)\"\n    proof (rule UN_E)\n      fix i\n      assume \"i \u2208 I\"\n      assume \"x \u2208 A i \u2229 s\"\n      then have \"x \u2208 A i\"\n        by (rule IntD1)\n      have \"x \u2208 s\"\n        using \u2039x \u2208 A i \u2229 s\u203a by (rule IntD2)\n      moreover\n      have \"x \u2208 (\u22c3 i \u2208 I. A i)\"\n        using \u2039i \u2208 I\u203a \u2039x \u2208 A i\u203a by (rule UN_I)\n      ultimately show \"x \u2208 s \u2229 (\u22c3 i \u2208 I. A i)\"\n        by (rule IntI)\n    qed\n  qed\nqed\n\nsection \u20392\u00aa demostraci\u00f3n\u203a\n\nlemma \"s \u2229 (\u22c3 i \u2208 I. A i) = (\u22c3 i \u2208 I. (A i \u2229 s))\"\nproof\n  show \"s \u2229 (\u22c3 i \u2208 I. A i) \u2286 (\u22c3 i \u2208 I. (A i \u2229 s))\"\n  proof\n    fix x\n    assume \"x \u2208 s \u2229 (\u22c3 i \u2208 I. A i)\"\n    then have \"x \u2208 s\"\n      by simp\n    have \"x \u2208 (\u22c3 i \u2208 I. A i)\"\n      using \u2039x \u2208 s \u2229 (\u22c3 i \u2208 I. A i)\u203a by simp\n    then show \"x \u2208 (\u22c3 i \u2208 I. (A i \u2229 s))\"\n    proof\n      fix i\n      assume \"i \u2208 I\"\n      assume \"x \u2208 A i\"\n      then have \"x \u2208 A i \u2229 s\"\n        using \u2039x \u2208 s\u203a by simp\n      with \u2039i \u2208 I\u203a show \"x \u2208 (\u22c3 i \u2208 I. (A i \u2229 s))\"\n        by (rule UN_I)\n    qed\n  qed\nnext\n  show \"(\u22c3 i \u2208 I. (A i \u2229 s)) \u2286 s \u2229 (\u22c3 i \u2208 I. A i)\"\n  proof\n    fix x\n    assume \"x \u2208 (\u22c3 i \u2208 I. A i \u2229 s)\"\n    then show \"x \u2208 s \u2229 (\u22c3 i \u2208 I. A i)\"\n    proof\n      fix i\n      assume \"i \u2208 I\"\n      assume \"x \u2208 A i \u2229 s\"\n      then have \"x \u2208 A i\"\n        by simp\n      have \"x \u2208 s\"\n        using \u2039x \u2208 A i \u2229 s\u203a by simp\n      moreover\n      have \"x \u2208 (\u22c3 i \u2208 I. A i)\"\n        using \u2039i \u2208 I\u203a \u2039x \u2208 A i\u203a by (rule UN_I)\n      ultimately show \"x \u2208 s \u2229 (\u22c3 i \u2208 I. A i)\"\n        by simp\n    qed\n  qed\nqed\n\nsection \u20393\u00aa demostraci\u00f3n\u203a\n\nlemma \"s \u2229 (\u22c3 i \u2208 I. A i) = (\u22c3 i \u2208 I. (A i \u2229 s))\"\n  by auto\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar que s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) Para ello, completar la siguiente teor\u00eda de Lean: import data.set.basic import data.set.lattice import tactic open set variable {\u03b1 : Type} variable s : set \u03b1 variable A : \u2115 \u2192 set \u03b1 example : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) := 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\/926"}],"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=926"}],"version-history":[{"count":3,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/926\/revisions"}],"predecessor-version":[{"id":929,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/926\/revisions\/929"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}