        {"id":2414,"date":"2024-04-25T19:12:31","date_gmt":"2024-04-25T17:12:31","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2414"},"modified":"2024-04-25T19:13:54","modified_gmt":"2024-04-25T17:13:54","slug":"25-abr-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/25-abr-24\/","title":{"rendered":"Imagen de la uni\u00f3n general"},"content":{"rendered":"\n<p>Demostrar con Lean4 que<br \/>\n&#92;[ f[\u22c3\u1d62A\u1d62] = \u22c3\u1d62f[A\u1d62] &#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.Tactic\n\nopen Set\n\nvariable {\u03b1 \u03b2 I : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (A : \u2115 \u2192 Set \u03b1)\n\nexample : f '' (\u22c3 i, A i) = \u22c3 i, f '' A i :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Tenemos que demostrar que, para todo &#92;(y&#92;),<br \/>\n&#92;[ y \u2208 f[\u22c3\u1d62A\u1d62] \u2194 y \u2208 \u22c3\u1d62f[A\u1d62] &#92;]<br \/>\nLo haremos demostrando las dos implicaciones.<\/p>\n<p>(\u27f9) Supongamos que &#92;(y \u2208 f[\u22c3\u1d62A\u1d62]&#92;). Entonces, existe un &#92;(x&#92;) tal que<br \/>\n&#92;begin{align}<br \/>\n   &amp;x \u2208 \u22c3\u1d62A\u1d62 &#92;tag{1} &#92;&#92;<br \/>\n   &amp;f(x) = y &#92;tag{2}<br \/>\n&#92;end{align}<br \/>\nPor (1), existe un i tal que<br \/>\n&#92;begin{align}<br \/>\n   &amp;i \u2208 \u2115  &#92;tag{3} &#92;&#92;<br \/>\n   &amp;x \u2208 A\u1d62 &#92;tag{4}<br \/>\n&#92;end{align}<br \/>\nPor (4),<br \/>\n&#92;[ f(x) \u2208 f[A\u1d62] &#92;]<br \/>\nPor (3),<br \/>\n&#92;[ f(x) \u2208 \u22c3\u1d62f[A\u1d62] &#92;]<br \/>\ny, por (2),<br \/>\n&#92;[ y \u2208 \u22c3\u1d62f[A\u1d62] &#92;]<\/p>\n<p>(\u27f8) Supongamos que &#92;(y \u2208 \u22c3\u1d62f[A\u1d62]&#92;). Entonces, existe un &#92;(i&#92;) tal que<br \/>\n&#92;begin{align}<br \/>\n   &amp;i \u2208 \u2115     &#92;tag{5} &#92;&#92;<br \/>\n   &amp;y \u2208 f[A\u1d62] &#92;tag{6}<br \/>\n&#92;end{align}<br \/>\nPor (6), existe un &#92;(x&#92;) tal que<br \/>\n&#92;begin{align}<br \/>\n   &amp;x \u2208 A\u1d62   &#92;tag{7} &#92;&#92;<br \/>\n   &amp;f(x) = y &#92;tag{8}<br \/>\n&#92;end{align}<br \/>\nPor (5) y (7),<br \/>\n&#92;[ x \u2208 \u22c3\u1d62A\u1d62 &#92;]<br \/>\nLuego,<br \/>\n&#92;[ f(x) \u2208 f[\u22c3\u1d62A\u1d62] &#92;]<br \/>\ny, por (8),<br \/>\n&#92;[ y \u2208 f[\u22c3\u1d62A\u1d62] &#92;]<\/p>\n<h2>2. Demostraciones con Lean4<\/h2>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Tactic\n\nopen Set\n\nvariable {\u03b1 \u03b2 I : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (A : \u2115 \u2192 Set \u03b1)\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (\u22c3 i, A i) = \u22c3 i, f '' A i :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' \u22c3 (i : \u2115), A i \u2194 y \u2208 \u22c3 (i : \u2115), f '' A i\n  constructor\n  . -- \u22a2 y \u2208 f '' \u22c3 (i : \u2115), A i \u2192 y \u2208 \u22c3 (i : \u2115), f '' A i\n    intro hy\n    -- hy : y \u2208 f '' \u22c3 (i : \u2115), A i\n    -- \u22a2 y \u2208 \u22c3 (i : \u2115), f '' A i\n    have h1 : \u2203 x, x \u2208 \u22c3 i, A i \u2227 f x = y := (mem_image f (\u22c3 i, A i) y).mp hy\n    obtain \u27e8x, hx : x \u2208 \u22c3 i, A i \u2227 f x = y\u27e9 := h1\n    have xUA : x \u2208 \u22c3 i, A i := hx.1\n    have fxy : f x = y := hx.2\n    have xUA : \u2203 i, x \u2208 A i := mem_iUnion.mp xUA\n    obtain \u27e8i, xAi : x \u2208 A i\u27e9 := xUA\n    have h2 : f x \u2208 f '' A i := mem_image_of_mem f xAi\n    have h3 : f x \u2208 \u22c3 i, f '' A i := mem_iUnion_of_mem i h2\n    show y \u2208 \u22c3 i, f '' A i\n    rwa [fxy] at h3\n  . -- \u22a2 y \u2208 \u22c3 (i : \u2115), f '' A i \u2192 y \u2208 f '' \u22c3 (i : \u2115), A i\n    intro hy\n    -- hy : y \u2208 \u22c3 (i : \u2115), f '' A i\n    -- \u22a2 y \u2208 f '' \u22c3 (i : \u2115), A i\n    have h4 : \u2203 i, y \u2208 f '' A i := mem_iUnion.mp hy\n    obtain \u27e8i, h5 : y \u2208 f '' A i\u27e9 := h4\n    have h6 : \u2203 x, x \u2208 A i \u2227 f x = y := (mem_image f (A i) y).mp h5\n    obtain \u27e8x, h7 : x \u2208 A i \u2227 f x = y\u27e9 := h6\n    have h8 : x \u2208 A i := h7.1\n    have h9 : x \u2208 \u22c3 i, A i := mem_iUnion_of_mem i h8\n    have h10 : f x \u2208 f '' (\u22c3 i, A i) := mem_image_of_mem f h9\n    show y \u2208 f '' (\u22c3 i, A i)\n    rwa [h7.2] at h10\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (\u22c3 i, A i) = \u22c3 i, f '' A i :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' \u22c3 (i : \u2115), A i \u2194 y \u2208 \u22c3 (i : \u2115), f '' A i\n  constructor\n  . -- \u22a2 y \u2208 f '' \u22c3 (i : \u2115), A i \u2192 y \u2208 \u22c3 (i : \u2115), f '' A i\n    intro hy\n    -- hy : y \u2208 f '' \u22c3 (i : \u2115), A i\n    -- \u22a2 y \u2208 \u22c3 (i : \u2115), f '' A i\n    rw [mem_image] at hy\n    -- hy : \u2203 x, x \u2208 \u22c3 (i : \u2115), A i \u2227 f x = y\n    cases' hy with x hx\n    -- x : \u03b1\n    -- hx : x \u2208 \u22c3 (i : \u2115), A i \u2227 f x = y\n    cases' hx with xUA fxy\n    -- xUA : x \u2208 \u22c3 (i : \u2115), A i\n    -- fxy : f x = y\n    rw [mem_iUnion] at xUA\n    -- xUA : \u2203 i, x \u2208 A i\n    cases' xUA with i xAi\n    -- i : \u2115\n    -- xAi : x \u2208 A i\n    rw [mem_iUnion]\n    -- \u22a2 \u2203 i, y \u2208 f '' A i\n    use i\n    -- \u22a2 y \u2208 f '' A i\n    rw [\u2190fxy]\n    -- \u22a2 f x \u2208 f '' A i\n    apply mem_image_of_mem\n    -- \u22a2 x \u2208 A i\n    exact xAi\n  . -- \u22a2 y \u2208 \u22c3 (i : \u2115), f '' A i \u2192 y \u2208 f '' \u22c3 (i : \u2115), A i\n    intro hy\n    -- hy : y \u2208 \u22c3 (i : \u2115), f '' A i\n    -- \u22a2 y \u2208 f '' \u22c3 (i : \u2115), A i\n    rw [mem_iUnion] at hy\n    -- hy : \u2203 i, y \u2208 f '' A i\n    cases' hy with i yAi\n    -- i : \u2115\n    -- yAi : y \u2208 f '' A i\n    cases' yAi with x hx\n    -- x : \u03b1\n    -- hx : x \u2208 A i \u2227 f x = y\n    cases' hx with xAi fxy\n    -- xAi : x \u2208 A i\n    -- fxy : f x = y\n    rw [\u2190fxy]\n    -- \u22a2 f x \u2208 f '' \u22c3 (i : \u2115), A i\n    apply mem_image_of_mem\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 : f '' (\u22c3 i, A i) = \u22c3 i, f '' A i :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' \u22c3 (i : \u2115), A i \u2194 y \u2208 \u22c3 (i : \u2115), f '' A i\n  simp\n  -- \u22a2 (\u2203 x, (\u2203 i, x \u2208 A i) \u2227 f x = y) \u2194 \u2203 i x, x \u2208 A i \u2227 f x = y\n  constructor\n  . -- \u22a2 (\u2203 x, (\u2203 i, x \u2208 A i) \u2227 f x = y) \u2192 \u2203 i x, x \u2208 A i \u2227 f x = y\n    rintro \u27e8x, \u27e8i, xAi\u27e9, fxy\u27e9\n    -- x : \u03b1\n    -- fxy : f x = y\n    -- i : \u2115\n    -- xAi : x \u2208 A i\n    -- \u22a2 \u2203 i x, x \u2208 A i \u2227 f x = y\n    use i, x, xAi\n    -- \u22a2 f x = y\n    exact fxy\n  . -- \u22a2 (\u2203 i x, x \u2208 A i \u2227 f x = y) \u2192 \u2203 x, (\u2203 i, x \u2208 A i) \u2227 f x = y\n    rintro \u27e8i, x, xAi, fxy\u27e9\n    -- i : \u2115\n    -- x : \u03b1\n    -- xAi : x \u2208 A i\n    -- fxy : f x = y\n    -- \u22a2 \u2203 x, (\u2203 i, x \u2208 A i) \u2227 f x = y\n    exact \u27e8x, \u27e8i, xAi\u27e9, fxy\u27e9\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (\u22c3 i, A i) = \u22c3 i, f '' A i :=\nimage_iUnion\n\n-- Lemas usados\n-- ============\n\n-- variable (x : \u03b1)\n-- variable (y : \u03b2)\n-- variable (s : Set \u03b1)\n-- variable (i : \u2115)\n-- #check (image_iUnion : f '' \u22c3 i, A i = \u22c3 i, f '' A i)\n-- #check (mem_iUnion : x \u2208 \u22c3 i, A i \u2194 \u2203 i, x \u2208 A i)\n-- #check (mem_iUnion_of_mem i : x \u2208 A i \u2192 x \u2208 \u22c3 i, A i)\n-- #check (mem_image f s y : (y \u2208 f '' s \u2194 \u2203 x, x \u2208 s \u2227 f x = y))\n-- #check (mem_image_of_mem f : x  \u2208 s \u2192 f x \u2208 f '' s)\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\/Imagen_de_la_union_general.lean\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isar\">\ntheory Imagen_de_la_union_general\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (\u22c3 i \u2208 I. A i) = (\u22c3 i \u2208 I. f ` A i)\"\nproof (rule equalityI)\n  show \"f ` (\u22c3 i \u2208 I. A i) \u2286 (\u22c3 i \u2208 I. f ` A i)\"\n  proof (rule subsetI)\n    fix y\n    assume \"y \u2208 f ` (\u22c3 i \u2208 I. A i)\"\n    then show \"y \u2208 (\u22c3 i \u2208 I. f ` A i)\"\n    proof (rule imageE)\n      fix x\n      assume \"y = f x\"\n      assume \"x \u2208 (\u22c3 i \u2208 I. A i)\"\n      then have \"f x \u2208 (\u22c3 i \u2208 I. f ` A i)\"\n      proof (rule UN_E)\n        fix i\n        assume \"i \u2208 I\"\n        assume \"x \u2208 A i\"\n        then have \"f x \u2208 f ` A i\"\n          by (rule imageI)\n        with \u2039i \u2208 I\u203a show \"f x \u2208 (\u22c3 i \u2208 I. f ` A i)\"\n          by (rule UN_I)\n      qed\n      with \u2039y = f x\u203a show \"y \u2208 (\u22c3 i \u2208 I. f ` A i)\"\n        by (rule ssubst)\n    qed\n  qed\nnext\n  show \"(\u22c3 i \u2208 I. f ` A i) \u2286 f ` (\u22c3 i \u2208 I. A i)\"\n  proof (rule subsetI)\n    fix y\n    assume \"y \u2208 (\u22c3 i \u2208 I. f ` A i)\"\n    then show \"y \u2208 f ` (\u22c3 i \u2208 I. A i)\"\n    proof (rule UN_E)\n      fix i\n      assume \"i \u2208 I\"\n      assume \"y \u2208 f ` A i\"\n      then show \"y \u2208 f ` (\u22c3 i \u2208 I. A i)\"\n      proof (rule imageE)\n        fix x\n        assume \"y = f x\"\n        assume \"x \u2208 A i\"\n        with \u2039i \u2208 I\u203a have \"x \u2208 (\u22c3 i \u2208 I. A i)\"\n          by (rule UN_I)\n        then have \"f x \u2208 f ` (\u22c3 i \u2208 I. A i)\"\n          by (rule imageI)\n        with \u2039y = f x\u203a show \"y \u2208 f ` (\u22c3 i \u2208 I. A i)\"\n          by (rule ssubst)\n      qed\n    qed\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (\u22c3 i \u2208 I. A i) = (\u22c3 i \u2208 I. f ` A i)\"\nproof\n  show \"f ` (\u22c3 i \u2208 I. A i) \u2286 (\u22c3 i \u2208 I. f ` A i)\"\n  proof\n    fix y\n    assume \"y \u2208 f ` (\u22c3 i \u2208 I. A i)\"\n    then show \"y \u2208 (\u22c3 i \u2208 I. f ` A i)\"\n    proof\n      fix x\n      assume \"y = f x\"\n      assume \"x \u2208 (\u22c3 i \u2208 I. A i)\"\n      then have \"f x \u2208 (\u22c3 i \u2208 I. f ` A i)\"\n      proof\n        fix i\n        assume \"i \u2208 I\"\n        assume \"x \u2208 A i\"\n        then have \"f x \u2208 f ` A i\" by simp\n        with \u2039i \u2208 I\u203a show \"f x \u2208 (\u22c3 i \u2208 I. f ` A i)\" by (rule UN_I)\n      qed\n      with \u2039y = f x\u203a show \"y \u2208 (\u22c3 i \u2208 I. f ` A i)\" by simp\n    qed\n  qed\nnext\n  show \"(\u22c3 i \u2208 I. f ` A i) \u2286 f ` (\u22c3 i \u2208 I. A i)\"\n  proof\n    fix y\n    assume \"y \u2208 (\u22c3 i \u2208 I. f ` A i)\"\n    then show \"y \u2208 f ` (\u22c3 i \u2208 I. A i)\"\n    proof\n      fix i\n      assume \"i \u2208 I\"\n      assume \"y \u2208 f ` A i\"\n      then show \"y \u2208 f ` (\u22c3 i \u2208 I. A i)\"\n      proof\n        fix x\n        assume \"y = f x\"\n        assume \"x \u2208 A i\"\n        with \u2039i \u2208 I\u203a have \"x \u2208 (\u22c3 i \u2208 I. A i)\" by (rule UN_I)\n        then have \"f x \u2208 f ` (\u22c3 i \u2208 I. A i)\" by simp\n        with \u2039y = f x\u203a show \"y \u2208 f ` (\u22c3 i \u2208 I. A i)\" by simp\n      qed\n    qed\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (\u22c3 i \u2208 I. A i) = (\u22c3 i \u2208 I. f ` A i)\"\n  by (simp only: image_UN)\n\n(* 4\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (\u22c3 i \u2208 I. A i) = (\u22c3 i \u2208 I. f ` A i)\"\n  by auto\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que &#92;[ f[\u22c3\u1d62A\u1d62] = \u22c3\u1d62f[A\u1d62] &#92;] Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Set.Basic import Mathlib.Tactic open Set variable {\u03b1 \u03b2 I : Type _} variable (f : \u03b1 \u2192 \u03b2) variable (A : \u2115 \u2192 Set \u03b1) example : f \u00bb (\u22c3 i, A i) = \u22c3 i, f \u00bb A i := 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":[17],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2414"}],"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=2414"}],"version-history":[{"count":3,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2414\/revisions"}],"predecessor-version":[{"id":2417,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2414\/revisions\/2417"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}