        {"id":2316,"date":"2024-03-07T06:00:58","date_gmt":"2024-03-07T04:00:58","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2316"},"modified":"2024-03-07T16:59:54","modified_gmt":"2024-03-07T14:59:54","slug":"07-mar-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/07-mar-24\/","title":{"rendered":"s \u2229 (\u22c3\u1d62 A\u1d62) = \u22c3\u1d62 (A\u1d62 \u2229 s)"},"content":{"rendered":"\n<p>Demostrar con Lean4 que<br \/>\n&#92;[ s \u2229 \u22c3_i A_i = \u22c3_i (A_i \u2229 s) &#92;]<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.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) :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Tenemos que demostrar que para cada &#92;(x&#92;), se verifica que<br \/>\n&#92;[ x \u2208 s \u2229 \u22c3_i A_i \u2194 x \u2208 \u22c3_i A_i \u2229 s &#92;]<br \/>\nLo demostramos mediante la siguiente cadena de equivalencias<br \/>\n&#92;begin{align}<br \/>\n   x \u2208 s \u2229 \u22c3_i A_i &amp;\u2194 x \u2208 s \u2227 x \u2208 \u22c3_i A_i &#92;&#92;<br \/>\n                   &amp;\u2194 x \u2208 s \u2227 (\u2203 i)[x \u2208 A_i] &#92;&#92;<br \/>\n                   &amp;\u2194 (\u2203 i)[x \u2208 s \u2227 x \u2208 A_i] &#92;&#92;<br \/>\n                   &amp;\u2194 (\u2203 i)[x \u2208 A_i \u2227 x \u2208 s] &#92;&#92;<br \/>\n                   &amp;\u2194 (\u2203 i)[x \u2208 A_i \u2229 s] &#92;&#92;<br \/>\n                   &amp;\u2194 x \u2208 \u22c3_i (A i \u2229 s)<br \/>\n&#92;end{align}<\/p>\n<h2>2. Demostraciones con Lean4<\/h2>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.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) :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u2229 \u22c3 (i : \u2115), A i \u2194 x \u2208 \u22c3 (i : \u2115), A i \u2229 s\n  calc x \u2208 s \u2229 \u22c3 (i : \u2115), A i\n     \u2194 x \u2208 s \u2227 x \u2208 \u22c3 (i : \u2115), A i :=\n         by simp only [mem_inter_iff]\n   _ \u2194 x \u2208 s \u2227 (\u2203 i : \u2115, x \u2208 A i) :=\n         by simp only [mem_iUnion]\n   _ \u2194 \u2203 i : \u2115, x \u2208 s \u2227 x \u2208 A i :=\n         by simp only [exists_and_left]\n   _ \u2194 \u2203 i : \u2115, x \u2208 A i \u2227 x \u2208 s :=\n         by simp only [and_comm]\n   _ \u2194 \u2203 i : \u2115, x \u2208 A i \u2229 s :=\n         by simp only [mem_inter_iff]\n   _ \u2194 x \u2208 \u22c3 (i : \u2115), A i \u2229 s :=\n         by simp only [mem_iUnion]\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u2229 \u22c3 (i : \u2115), A i \u2194 x \u2208 \u22c3 (i : \u2115), A i \u2229 s\n  constructor\n  . -- \u22a2 x \u2208 s \u2229 \u22c3 (i : \u2115), A i \u2192 x \u2208 \u22c3 (i : \u2115), A i \u2229 s\n    intro h\n    -- h : x \u2208 s \u2229 \u22c3 (i : \u2115), A i\n    -- \u22a2 x \u2208 \u22c3 (i : \u2115), A i \u2229 s\n    rw [mem_iUnion]\n    -- \u22a2 \u2203 i, x \u2208 A i \u2229 s\n    rcases h with \u27e8xs, xUAi\u27e9\n    -- xs : x \u2208 s\n    -- xUAi : x \u2208 \u22c3 (i : \u2115), A i\n    rw [mem_iUnion] at xUAi\n    -- xUAi : \u2203 i, x \u2208 A i\n    rcases xUAi with \u27e8i, xAi\u27e9\n    -- i : \u2115\n    -- xAi : x \u2208 A i\n    use i\n    -- \u22a2 x \u2208 A i \u2229 s\n    constructor\n    . -- \u22a2 x \u2208 A i\n      exact xAi\n    . -- \u22a2 x \u2208 s\n      exact xs\n  . -- \u22a2 x \u2208 \u22c3 (i : \u2115), A i \u2229 s \u2192 x \u2208 s \u2229 \u22c3 (i : \u2115), A i\n    intro h\n    -- h : x \u2208 \u22c3 (i : \u2115), A i \u2229 s\n    -- \u22a2 x \u2208 s \u2229 \u22c3 (i : \u2115), A i\n    rw [mem_iUnion] at h\n    -- h : \u2203 i, x \u2208 A i \u2229 s\n    rcases h with \u27e8i, hi\u27e9\n    -- i : \u2115\n    -- hi : x \u2208 A i \u2229 s\n    rcases hi with \u27e8xAi, xs\u27e9\n    -- xAi : x \u2208 A i\n    -- xs : x \u2208 s\n    constructor\n    . -- \u22a2 x \u2208 s\n      exact xs\n    . -- \u22a2 x \u2208 \u22c3 (i : \u2115), A i\n      rw [mem_iUnion]\n      -- \u22a2 \u2203 i, x \u2208 A i\n      use i\n      -- \u22a2 x \u2208 A i\n      exact xAi\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u2229 \u22c3 (i : \u2115), A i \u2194 x \u2208 \u22c3 (i : \u2115), A i \u2229 s\n  simp\n  -- \u22a2 (x \u2208 s \u2227 \u2203 i, x \u2208 A i) \u2194 (\u2203 i, x \u2208 A i) \u2227 x \u2208 s\n  constructor\n  . -- \u22a2 (x \u2208 s \u2227 \u2203 i, x \u2208 A i) \u2192 (\u2203 i, x \u2208 A i) \u2227 x \u2208 s\n    rintro \u27e8xs, \u27e8i, xAi\u27e9\u27e9\n    -- xs : x \u2208 s\n    -- i : \u2115\n    -- xAi : x \u2208 A i\n    -- \u22a2 (\u2203 i, x \u2208 A i) \u2227 x \u2208 s\n    exact \u27e8\u27e8i, xAi\u27e9, xs\u27e9\n  . -- \u22a2 (\u2203 i, x \u2208 A i) \u2227 x \u2208 s \u2192 x \u2208 s \u2227 \u2203 i, x \u2208 A i\n    rintro \u27e8\u27e8i, xAi\u27e9, xs\u27e9\n    -- xs : x \u2208 s\n    -- i : \u2115\n    -- xAi : x \u2208 A i\n    -- \u22a2 x \u2208 s \u2227 \u2203 i, x \u2208 A i\n    exact \u27e8xs, \u27e8i, xAi\u27e9\u27e9\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u2229 \u22c3 (i : \u2115), A i \u2194 x \u2208 \u22c3 (i : \u2115), A i \u2229 s\n  aesop\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (\u22c3 i, A i) = \u22c3 i, (A i \u2229 s) :=\nby ext; aesop\n\n-- Lemas usados\n-- ============\n\n-- variable (x : \u03b1)\n-- variable (t : Set \u03b1)\n-- variable (a b : Prop)\n-- variable (p : \u03b1 \u2192 Prop)\n-- #check (mem_iUnion : x \u2208 \u22c3 i, A i \u2194 \u2203 i, x \u2208 A i)\n-- #check (mem_inter_iff x s t : x \u2208 s \u2229 t \u2194 x \u2208 s \u2227 x \u2208 t)\n-- #check (exists_and_left : (\u2203 (x : \u03b1), b \u2227 p x) \u2194 b \u2227 \u2203 (x : \u03b1), p x)\n-- #check (and_comm : a \u2227 b \u2194 b \u2227 a)\n<\/pre>\n<p>Se puede interactuar con las demostraciones anteriores en <a href=\"https:\/\/live.lean-lang.org\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Calculemus2\/main\/src\/Distributiva_de_la_interseccion_respecto_de_la_union_general.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isar\">\ntheory Distributiva_de_la_interseccion_respecto_de_la_union_general\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\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\n(* 2\u00aa demostraci\u00f3n *)\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\n(* 3\u00aa demostraci\u00f3n *)\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 con Lean4 que &#92;[ s \u2229 \u22c3_i A_i = \u22c3_i (A_i \u2229 s) &#92;] Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Set.Basic import Mathlib.Data.Set.Lattice import Mathlib.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) := by 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":"default","_kad_post_title":"default","_kad_post_layout":"default","_kad_post_sidebar_id":"","_kad_post_content_style":"default","_kad_post_vertical_padding":"default","_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\/2316"}],"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=2316"}],"version-history":[{"count":4,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2316\/revisions"}],"predecessor-version":[{"id":2321,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2316\/revisions\/2321"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}