{"id":8157,"date":"2024-03-16T11:08:01","date_gmt":"2024-03-16T10:08:01","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/?p=8157"},"modified":"2024-03-16T11:13:07","modified_gmt":"2024-03-16T10:13:07","slug":"16-mar-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/16-mar-24\/","title":{"rendered":"La semana en Calculemus (16 de marzo de 2024)"},"content":{"rendered":"\n<p>Esta semana he publicado en <a href=\"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/\">Calculemus<\/a> las demostraciones con Lean4 de las siguientes propiedades:<\/p>\n<ul>\n<li><a href=\"#ej1\">1. s \u222a (\u22c2\u1d62 A\u1d62) = \u22c2\u1d62 (A\u1d62 \u222a s)<\/a><\/li>\n<li><a href=\"#ej2\">2. f\u207b\u00b9(u \u2229 v) = f\u207b\u00b9(u) \u2229 f\u207b\u00b9(v)<\/a><\/li>\n<li><a href=\"#ej3\">3. f(s \u222a t) = f(s) \u222a f(t)<\/a><\/li>\n<li><a href=\"#ej4\">4. s \u2286 f\u207b\u00b9(f(s))<\/a><\/li>\n<li><a href=\"#ej5\">5. f(s) \u2286 u \u2194 s \u2286 f\u207b\u00b9(u)<\/a><\/li>\n<\/ul>\n<p>A continuaci\u00f3n se muestran las soluciones.<br \/>\n<!--more--><br \/>\n<a name=\"ej1\"><\/a><\/p>\n<h3>1. s \u222a (\u22c2\u1d62 A\u1d62) = \u22c2\u1d62 (A\u1d62 \u222a s)<\/h3>\n<p>Demostrar con Lean4 que<br \/>\n&#92;[ s \u222a (\u22c2_i A_i) = \u22c2_i (A_i \u222a 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.Tactic\nopen Set\nvariable {\u03b1 : Type}\nvariable (s : Set \u03b1)\nvariable (A : \u2115 \u2192 Set \u03b1)\n\nexample : s \u222a (\u22c2 i, A i) = \u22c2 i, (A i \u222a s) :=\nby sorry\n<\/pre>\n<h4>1.1. Demostraci\u00f3n en lenguaje natural<\/h4>\n<p>Tenemos que demostrar que para todo &#92;(x&#92;),<br \/>\n&#92;[ x \u2208 s \u222a \u22c2_i A_i \u2194 x \u2208 \u22c2_i (A i \u222a s) &#92;]<br \/>\nLo haremos mediante la siguiente cadena de equivalencias<br \/>\n&#92;begin{align}<br \/>\n   x \u2208 s \u222a \u22c2_i A_i &amp;\u2194 x \u2208 s \u2228 x \u2208 \u22c2_i A_i &#92;&#92;<br \/>\n                   &amp;\u2194 x \u2208 s \u2228 (\u2200 i)[x \u2208 A_i] &#92;&#92;<br \/>\n                   &amp;\u2194 (\u2200 i)[x \u2208 s \u2228 x \u2208 A_i] &#92;&#92;<br \/>\n                   &amp;\u2194 (\u2200 i)[x \u2208 A_i \u2228 x \u2208 s] &#92;&#92;<br \/>\n                   &amp;\u2194 (\u2200 i)[x \u2208 A_i \u222a s]     &#92;&#92;<br \/>\n                   &amp;\u2194 x \u2208 \u22c2_i (A_i \u222a s)<br \/>\n&#92;end{align}<\/p>\n<h4>1.2. Demostraciones con Lean4<\/h4>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Basic\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 \u222a (\u22c2 i, A i) = \u22c2 i, (A i \u222a s) :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u222a \u22c2 (i : \u2115), A i \u2194 x \u2208 \u22c2 (i : \u2115), A i \u222a s\n  calc x \u2208 s \u222a \u22c2 i, A i\n     \u2194 x \u2208 s \u2228 x \u2208 \u22c2 i, A i :=\n         by simp only [mem_union]\n   _ \u2194 x \u2208 s \u2228 \u2200 i, x \u2208 A i :=\n         by simp only [mem_iInter]\n   _ \u2194 \u2200 i, x \u2208 s \u2228 x \u2208 A i :=\n         by simp only [forall_or_left]\n   _ \u2194 \u2200 i, x \u2208 A i \u2228 x \u2208 s  :=\n         by simp only [or_comm]\n   _ \u2194 \u2200 i, x \u2208 A i \u222a s  :=\n         by simp only [mem_union]\n   _ \u2194 x \u2208 \u22c2 i, A i \u222a s :=\n         by simp only [mem_iInter]\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a (\u22c2 i, A i) = \u22c2 i, (A i \u222a s) :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u222a \u22c2 (i : \u2115), A i \u2194 x \u2208 \u22c2 (i : \u2115), A i \u222a s\n  simp only [mem_union, mem_iInter]\n  -- \u22a2 (x \u2208 s \u2228 \u2200 (i : \u2115), x \u2208 A i) \u2194 \u2200 (i : \u2115), x \u2208 A i \u2228 x \u2208 s\n  constructor\n  . -- \u22a2 (x \u2208 s \u2228 \u2200 (i : \u2115), x \u2208 A i) \u2192 \u2200 (i : \u2115), x \u2208 A i \u2228 x \u2208 s\n    intros h i\n    -- h : x \u2208 s \u2228 \u2200 (i : \u2115), x \u2208 A i\n    -- i : \u2115\n    -- \u22a2 x \u2208 A i \u2228 x \u2208 s\n    rcases h with (xs | xAi)\n    . -- xs : x \u2208 s\n      right\n      -- \u22a2 x \u2208 s\n      exact xs\n    . -- xAi : \u2200 (i : \u2115), x \u2208 A i\n      left\n      -- \u22a2 x \u2208 A i\n      exact xAi i\n  . -- \u22a2 (\u2200 (i : \u2115), x \u2208 A i \u2228 x \u2208 s) \u2192 x \u2208 s \u2228 \u2200 (i : \u2115), x \u2208 A i\n    intro h\n    -- h : \u2200 (i : \u2115), x \u2208 A i \u2228 x \u2208 s\n    -- \u22a2 x \u2208 s \u2228 \u2200 (i : \u2115), x \u2208 A i\n    by_cases cxs : x \u2208 s\n    . -- cxs : x \u2208 s\n      left\n      -- \u22a2 x \u2208 s\n      exact cxs\n    . -- cns : \u00acx \u2208 s\n      right\n      -- \u22a2 \u2200 (i : \u2115), x \u2208 A i\n      intro i\n      -- i : \u2115\n      -- \u22a2 x \u2208 A i\n      rcases h i with (xAi | xs)\n      . -- \u22a2 x \u2208 A i\n        exact xAi\n      . -- xs : x \u2208 s\n        exact absurd xs cxs\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a (\u22c2 i, A i) = \u22c2 i, (A i \u222a s) :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u222a \u22c2 (i : \u2115), A i \u2194 x \u2208 \u22c2 (i : \u2115), A i \u222a s\n  simp only [mem_union, mem_iInter]\n  -- \u22a2 (x \u2208 s \u2228 \u2200 (i : \u2115), x \u2208 A i) \u2194 \u2200 (i : \u2115), x \u2208 A i \u2228 x \u2208 s\n  constructor\n  . -- \u22a2 (x \u2208 s \u2228 \u2200 (i : \u2115), x \u2208 A i) \u2192 \u2200 (i : \u2115), x \u2208 A i \u2228 x \u2208 s\n    rintro (xs | xI) i\n    . -- xs : x \u2208 s\n      -- i : \u2115\n      -- \u22a2 x \u2208 A i \u2228 x \u2208 s\n      right\n      -- \u22a2 x \u2208 s\n      exact xs\n    . -- xI : \u2200 (i : \u2115), x \u2208 A i\n      -- i : \u2115\n      -- \u22a2 x \u2208 A i \u2228 x \u2208 s\n      left\n      -- \u22a2 x \u2208 A i\n      exact xI i\n  . -- \u22a2 (\u2200 (i : \u2115), x \u2208 A i \u2228 x \u2208 s) \u2192 x \u2208 s \u2228 \u2200 (i : \u2115), x \u2208 A i\n    intro h\n    -- h : \u2200 (i : \u2115), x \u2208 A i \u2228 x \u2208 s\n    -- \u22a2 x \u2208 s \u2228 \u2200 (i : \u2115), x \u2208 A i\n    by_cases cxs : x \u2208 s\n    . -- cxs : x \u2208 s\n      left\n      -- \u22a2 x \u2208 s\n      exact cxs\n    . -- cxs : \u00acx \u2208 s\n      right\n      -- \u22a2 \u2200 (i : \u2115), x \u2208 A i\n      intro i\n      -- i : \u2115\n      -- \u22a2 x \u2208 A i\n      cases h i\n      . -- h : x \u2208 A i\n        assumption\n      . -- h : x \u2208 s\n        contradiction\n\n-- Lemas usados\n-- ============\n\n-- variable (x : \u03b1)\n-- variable (s t : Set \u03b1)\n-- variable (a b q : Prop)\n-- variable (p : \u2115 \u2192 Prop)\n-- #check (absurd : a \u2192 \u00aca \u2192 b)\n-- #check (forall_or_left : (\u2200 x, q \u2228 p x) \u2194 q \u2228 \u2200 x, p x)\n-- #check (mem_iInter : x \u2208 \u22c2 i, A i \u2194 \u2200 i, x \u2208 A i)\n-- #check (mem_union x a b : x \u2208 s \u222a t \u2194 x \u2208 s \u2228 x \u2208 t)\n-- #check (or_comm : a \u2228 b \u2194 b \u2228 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\/Union_con_interseccion_general.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h4>1.3. Demostraciones con Isabelle\/HOL<\/h4>\n<pre lang=\"isar\">\ntheory Union_con_interseccion_general\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\nlemma \"s \u222a (\u22c2 i \u2208 I. A i) = (\u22c2 i \u2208 I. A i \u222a s)\"\nproof (rule equalityI)\n  show \"s \u222a (\u22c2 i \u2208 I. A i) \u2286 (\u22c2 i \u2208 I. A i \u222a s)\"\n  proof (rule subsetI)\n    fix x\n    assume \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n    then show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n    proof (rule UnE)\n      assume \"x \u2208 s\"\n      show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n      proof (rule INT_I)\n        fix i\n        assume \"i \u2208 I\"\n        show \"x \u2208 A i \u222a s\"\n          using \u2039x \u2208 s\u203a by (rule UnI2)\n      qed\n    next\n      assume h1 : \"x \u2208 (\u22c2 i \u2208 I. A i)\"\n      show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n      proof (rule INT_I)\n        fix i\n        assume \"i \u2208 I\"\n        with h1 have \"x \u2208 A i\"\n          by (rule INT_D)\n        then show \"x \u2208 A i \u222a s\"\n          by (rule UnI1)\n      qed\n    qed\n  qed\nnext\n  show \"(\u22c2 i \u2208 I. A i \u222a s) \u2286 s \u222a (\u22c2 i \u2208 I. A i)\"\n  proof (rule subsetI)\n    fix x\n    assume h2 : \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n    show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n    proof (cases \"x \u2208 s\")\n      assume \"x \u2208 s\"\n      then show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n        by (rule UnI1)\n    next\n      assume \"x \u2209 s\"\n      have \"x \u2208 (\u22c2 i \u2208 I. A i)\"\n      proof (rule INT_I)\n        fix i\n        assume \"i \u2208 I\"\n        with h2 have \"x \u2208 A i \u222a s\"\n          by (rule INT_D)\n        then show \"x \u2208 A i\"\n        proof (rule UnE)\n          assume \"x \u2208 A i\"\n          then show \"x \u2208 A i\"\n            by this\n        next\n          assume \"x \u2208 s\"\n          with \u2039x \u2209 s\u203a show \"x \u2208 A i\"\n            by (rule notE)\n        qed\n      qed\n      then show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n        by (rule UnI2)\n    qed\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\nlemma \"s \u222a (\u22c2 i \u2208 I. A i) = (\u22c2 i \u2208 I. A i \u222a s)\"\nproof\n  show \"s \u222a (\u22c2 i \u2208 I. A i) \u2286 (\u22c2 i \u2208 I. A i \u222a s)\"\n  proof\n    fix x\n    assume \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n    then show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n    proof\n      assume \"x \u2208 s\"\n      show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n      proof\n        fix i\n        assume \"i \u2208 I\"\n        show \"x \u2208 A i \u222a s\"\n          using \u2039x \u2208 s\u203a by simp\n      qed\n    next\n      assume h1 : \"x \u2208 (\u22c2 i \u2208 I. A i)\"\n      show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n      proof\n        fix i\n        assume \"i \u2208 I\"\n        with h1 have \"x \u2208 A i\"\n          by simp\n        then show \"x \u2208 A i \u222a s\"\n          by simp\n      qed\n    qed\n  qed\nnext\n  show \"(\u22c2 i \u2208 I. A i \u222a s) \u2286 s \u222a (\u22c2 i \u2208 I. A i)\"\n  proof\n    fix x\n    assume h2 : \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n    show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n    proof (cases \"x \u2208 s\")\n      assume \"x \u2208 s\"\n      then show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n        by simp\n    next\n      assume \"x \u2209 s\"\n      have \"x \u2208 (\u22c2 i \u2208 I. A i)\"\n      proof\n        fix i\n        assume \"i \u2208 I\"\n        with h2 have \"x \u2208 A i \u222a s\"\n          by (rule INT_D)\n        then show \"x \u2208 A i\"\n        proof\n          assume \"x \u2208 A i\"\n          then show \"x \u2208 A i\"\n            by this\n        next\n          assume \"x \u2208 s\"\n          with \u2039x \u2209 s\u203a show \"x \u2208 A i\"\n            by simp\n        qed\n      qed\n      then show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n        by simp\n    qed\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\nlemma \"s \u222a (\u22c2 i \u2208 I. A i) = (\u22c2 i \u2208 I. A i \u222a s)\"\nproof\n  show \"s \u222a (\u22c2 i \u2208 I. A i) \u2286 (\u22c2 i \u2208 I. A i \u222a s)\"\n  proof\n    fix x\n    assume \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n    then show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n    proof\n      assume \"x \u2208 s\"\n      then show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n        by simp\n    next\n      assume \"x \u2208 (\u22c2 i \u2208 I. A i)\"\n      then show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n        by simp\n    qed\n  qed\nnext\n  show \"(\u22c2 i \u2208 I. A i \u222a s) \u2286 s \u222a (\u22c2 i \u2208 I. A i)\"\n  proof\n    fix x\n    assume h2 : \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n    show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n    proof (cases \"x \u2208 s\")\n      assume \"x \u2208 s\"\n      then show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n        by simp\n    next\n      assume \"x \u2209 s\"\n      then show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n        using h2 by simp\n    qed\n  qed\nqed\n\n(* 4\u00aa demostraci\u00f3n *)\nlemma \"s \u222a (\u22c2 i \u2208 I. A i) = (\u22c2 i \u2208 I. A i \u222a s)\"\nproof\n  show \"s \u222a (\u22c2 i \u2208 I. A i) \u2286 (\u22c2 i \u2208 I. A i \u222a s)\"\n  proof\n    fix x\n    assume \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n    then show \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n    proof\n      assume \"x \u2208 s\"\n      then show ?thesis by simp\n    next\n      assume \"x \u2208 (\u22c2 i \u2208 I. A i)\"\n      then show ?thesis by simp\n    qed\n  qed\nnext\n  show \"(\u22c2 i \u2208 I. A i \u222a s) \u2286 s \u222a (\u22c2 i \u2208 I. A i)\"\n  proof\n    fix x\n    assume h2 : \"x \u2208 (\u22c2 i \u2208 I. A i \u222a s)\"\n    show \"x \u2208 s \u222a (\u22c2 i \u2208 I. A i)\"\n    proof (cases \"x \u2208 s\")\n      case True\n      then show ?thesis by simp\n    next\n      case False\n      then show ?thesis using h2 by simp\n    qed\n  qed\nqed\n\n(* 5\u00aa demostraci\u00f3n *)\nlemma \"s \u222a (\u22c2 i \u2208 I. A i) = (\u22c2 i \u2208 I. A i \u222a s)\"\n  by auto\n\nend\n<\/pre>\n<p><a name=\"ej2\"><\/a><\/p>\n<h3>2. f\u207b\u00b9[u \u2229 v] = f\u207b\u00b9[u] \u2229 f\u207b\u00b9[v]<\/h3>\n<p>En Lean, la imagen inversa de un conjunto <code>s<\/code> (de elementos de tipo <code>\u03b2<\/code>) por la funci\u00f3n <code>f<\/code> (de tipo <code>\u03b1 \u2192 \u03b2<\/code>) es el conjunto <code>f \u207b\u00b9' s<\/code> de elementos <code>x<\/code> (de tipo <code>\u03b1<\/code>) tales que <code>f x \u2208 s<\/code>.<\/p>\n<p>Demostrar con Lean4 que<\/p>\n<pre lang=\"lean\">\n   f \u207b\u00b9' (u \u2229 v) = f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n<\/pre>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (u v : Set \u03b2)\nopen Set\n\nexample : f \u207b\u00b9' (u \u2229 v) = f \u207b\u00b9' u \u2229 f \u207b\u00b9' v :=\nby sorry\n<\/pre>\n<h4>2.1. Demostraci\u00f3n en lenguaje natural<\/h4>\n<p>Tenemos que demostrar que, para todo &#92;(x&#92;),<br \/>\n&#92;[ x \u2208 f\u207b\u00b9[u \u2229 v] \u2194 x \u2208 f\u207b\u00b9[u] \u2229 f\u207b\u00b9[v] &#92;]<br \/>\nLo haremos mediante la siguiente cadena de equivalencias<br \/>\n&#92;begin{align}<br \/>\n   x \u2208 f\u207b\u00b9[u \u2229 v] &amp;\u2194 f x \u2208 u \u2229 v &#92;&#92;<br \/>\n                  &amp;\u2194 f x \u2208 u \u2227 f x \u2208 v &#92;&#92;<br \/>\n                  &amp;\u2194 x \u2208 f\u207b\u00b9[u] \u2227 x \u2208 f\u207b\u00b9[v] &#92;&#92;<br \/>\n                  &amp;\u2194 x \u2208 f\u207b\u00b9[u] \u2229 f\u207b\u00b9[v] &#92;&#92;<br \/>\n&#92;end{align}<\/p>\n<h4>2.2. Demostraciones con Lean4<\/h4>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\n\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (u v : Set \u03b2)\n\nopen Set\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f \u207b\u00b9' (u \u2229 v) = f \u207b\u00b9' u \u2229 f \u207b\u00b9' v :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 f \u207b\u00b9' (u \u2229 v) \u2194 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n  calc x \u2208 f \u207b\u00b9' (u \u2229 v)\n     \u2194 f x \u2208 u \u2229 v :=\n         by simp only [mem_preimage]\n   _ \u2194 f x \u2208 u \u2227 f x \u2208 v :=\n         by simp only [mem_inter_iff]\n   _ \u2194 x \u2208 f \u207b\u00b9' u \u2227 x \u2208 f \u207b\u00b9' v :=\n         by simp only [mem_preimage]\n   _ \u2194 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v :=\n         by simp only [mem_inter_iff]\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f \u207b\u00b9' (u \u2229 v) = f \u207b\u00b9' u \u2229 f \u207b\u00b9' v :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 f \u207b\u00b9' (u \u2229 v) \u2194 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n  constructor\n  . -- \u22a2 x \u2208 f \u207b\u00b9' (u \u2229 v) \u2192 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n    intro h\n    -- h : x \u2208 f \u207b\u00b9' (u \u2229 v)\n    -- \u22a2 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n    constructor\n    . -- \u22a2 x \u2208 f \u207b\u00b9' u\n      apply mem_preimage.mpr\n      -- \u22a2 f x \u2208 u\n      rw [mem_preimage] at h\n      -- h : f x \u2208 u \u2229 v\n      exact mem_of_mem_inter_left h\n    . -- \u22a2 x \u2208 f \u207b\u00b9' v\n      apply mem_preimage.mpr\n      -- \u22a2 f x \u2208 v\n      rw [mem_preimage] at h\n      -- h : f x \u2208 u \u2229 v\n      exact mem_of_mem_inter_right h\n  . -- \u22a2 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v \u2192 x \u2208 f \u207b\u00b9' (u \u2229 v)\n    intro h\n    -- h : x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n    -- \u22a2 x \u2208 f \u207b\u00b9' (u \u2229 v)\n    apply mem_preimage.mpr\n    -- \u22a2 f x \u2208 u \u2229 v\n    constructor\n    . -- \u22a2 f x \u2208 u\n      apply mem_preimage.mp\n      -- \u22a2 x \u2208 f \u207b\u00b9' u\n      exact mem_of_mem_inter_left h\n    . -- \u22a2 f x \u2208 v\n      apply mem_preimage.mp\n      -- \u22a2 x \u2208 f \u207b\u00b9' v\n      exact mem_of_mem_inter_right h\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f \u207b\u00b9' (u \u2229 v) = f \u207b\u00b9' u \u2229 f \u207b\u00b9' v :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 f \u207b\u00b9' (u \u2229 v) \u2194 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n  constructor\n  . -- \u22a2 x \u2208 f \u207b\u00b9' (u \u2229 v) \u2192 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n    intro h\n    -- h : x \u2208 f \u207b\u00b9' (u \u2229 v)\n    -- \u22a2 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n    constructor\n    . -- \u22a2 x \u2208 f \u207b\u00b9' u\n      simp at *\n      -- h : f x \u2208 u \u2227 f x \u2208 v\n      -- \u22a2 f x \u2208 u\n      exact h.1\n    . -- \u22a2 x \u2208 f \u207b\u00b9' v\n      simp at *\n      -- h : f x \u2208 u \u2227 f x \u2208 v\n      -- \u22a2 f x \u2208 v\n      exact h.2\n  . -- \u22a2 x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v \u2192 x \u2208 f \u207b\u00b9' (u \u2229 v)\n    intro h\n    -- h : x \u2208 f \u207b\u00b9' u \u2229 f \u207b\u00b9' v\n    -- \u22a2 x \u2208 f \u207b\u00b9' (u \u2229 v)\n    simp at *\n    -- h : f x \u2208 u \u2227 f x \u2208 v\n    -- \u22a2 f x \u2208 u \u2227 f x \u2208 v\n    exact h\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f \u207b\u00b9' (u \u2229 v) = f \u207b\u00b9' u \u2229 f \u207b\u00b9' v :=\nby aesop\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f \u207b\u00b9' (u \u2229 v) = f \u207b\u00b9' u \u2229 f \u207b\u00b9' v :=\npreimage_inter\n\n-- 6\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f \u207b\u00b9' (u \u2229 v) = f \u207b\u00b9' u \u2229 f \u207b\u00b9' v :=\nrfl\n\n-- Lemas usados\n-- ============\n\n-- variable (x : \u03b1)\n-- variable (s t : Set \u03b1)\n-- #check (mem_of_mem_inter_left : x \u2208 s \u2229 t \u2192 x \u2208 s)\n-- #check (mem_of_mem_inter_right : x \u2208 s \u2229 t \u2192 x \u2208 t)\n-- #check (mem_preimage : x \u2208 f \u207b\u00b9' u \u2194 f x \u2208 u)\n-- #check (preimage_inter : f \u207b\u00b9' (u \u2229 v) = f \u207b\u00b9' u \u2229 f \u207b\u00b9' v)\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_inversa_de_la_interseccion.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h4>2.3. Demostraciones con Isabelle\/HOL<\/h4>\n<pre lang=\"isar\">\ntheory Imagen_inversa_de_la_interseccion\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\nlemma \"f -` (u \u2229 v) = f -` u \u2229 f -` v\"\nproof (rule equalityI)\n  show \"f -` (u \u2229 v) \u2286 f -` u \u2229 f -` v\"\n  proof (rule subsetI)\n    fix x\n    assume \"x \u2208 f -` (u \u2229 v)\"\n    then have h : \"f x \u2208 u \u2229 v\"\n      by (simp only: vimage_eq)\n    have \"x \u2208 f -` u\"\n    proof -\n      have \"f x \u2208 u\"\n        using h by (rule IntD1)\n      then show \"x \u2208 f -` u\"\n        by (rule vimageI2)\n    qed\n    moreover\n    have \"x \u2208 f -` v\"\n    proof -\n      have \"f x \u2208 v\"\n        using h by (rule IntD2)\n      then show \"x \u2208 f -` v\"\n        by (rule vimageI2)\n    qed\n    ultimately show \"x \u2208 f -` u \u2229 f -` v\"\n      by (rule IntI)\n  qed\nnext\n  show \"f -` u \u2229 f -` v \u2286 f -` (u \u2229 v)\"\n  proof (rule subsetI)\n    fix x\n    assume h2 : \"x \u2208 f -` u \u2229 f -` v\"\n    have \"f x \u2208 u\"\n    proof -\n      have \"x \u2208 f -` u\"\n        using h2 by (rule IntD1)\n      then show \"f x \u2208 u\"\n        by (rule vimageD)\n    qed\n    moreover\n    have \"f x \u2208 v\"\n    proof -\n      have \"x \u2208 f -` v\"\n        using h2 by (rule IntD2)\n      then show \"f x \u2208 v\"\n        by (rule vimageD)\n    qed\n    ultimately have \"f x \u2208 u \u2229 v\"\n      by (rule IntI)\n    then show \"x \u2208 f -` (u \u2229 v)\"\n      by (rule vimageI2)\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\nlemma \"f -` (u \u2229 v) = f -` u \u2229 f -` v\"\nproof\n  show \"f -` (u \u2229 v) \u2286 f -` u \u2229 f -` v\"\n  proof\n    fix x\n    assume \"x \u2208 f -` (u \u2229 v)\"\n    then have h : \"f x \u2208 u \u2229 v\"\n      by simp\n    have \"x \u2208 f -` u\"\n    proof -\n      have \"f x \u2208 u\"\n        using h by simp\n      then show \"x \u2208 f -` u\"\n        by simp\n    qed\n    moreover\n    have \"x \u2208 f -` v\"\n    proof -\n      have \"f x \u2208 v\"\n        using h by simp\n      then show \"x \u2208 f -` v\"\n        by simp\n    qed\n    ultimately show \"x \u2208 f -` u \u2229 f -` v\"\n      by simp\n  qed\nnext\n  show \"f -` u \u2229 f -` v \u2286 f -` (u \u2229 v)\"\n  proof\n    fix x\n    assume h2 : \"x \u2208 f -` u \u2229 f -` v\"\n    have \"f x \u2208 u\"\n    proof -\n      have \"x \u2208 f -` u\"\n        using h2 by simp\n      then show \"f x \u2208 u\"\n        by simp\n    qed\n    moreover\n    have \"f x \u2208 v\"\n    proof -\n      have \"x \u2208 f -` v\"\n        using h2 by simp\n      then show \"f x \u2208 v\"\n        by simp\n    qed\n    ultimately have \"f x \u2208 u \u2229 v\"\n      by simp\n    then show \"x \u2208 f -` (u \u2229 v)\"\n      by simp\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\nlemma \"f -` (u \u2229 v) = f -` u \u2229 f -` v\"\nproof\n  show \"f -` (u \u2229 v) \u2286 f -` u \u2229 f -` v\"\n  proof\n    fix x\n    assume h1 : \"x \u2208 f -` (u \u2229 v)\"\n    have \"x \u2208 f -` u\" using h1 by simp\n    moreover\n    have \"x \u2208 f -` v\" using h1 by simp\n    ultimately show \"x \u2208 f -` u \u2229 f -` v\" by simp\n  qed\nnext\n  show \"f -` u \u2229 f -` v \u2286 f -` (u \u2229 v)\"\n  proof\n    fix x\n    assume h2 : \"x \u2208 f -` u \u2229 f -` v\"\n    have \"f x \u2208 u\" using h2 by simp\n    moreover\n    have \"f x \u2208 v\" using h2 by simp\n    ultimately have \"f x \u2208 u \u2229 v\" by simp\n    then show \"x \u2208 f -` (u \u2229 v)\" by simp\n  qed\nqed\n\n(* 4\u00aa demostraci\u00f3n *)\nlemma \"f -` (u \u2229 v) = f -` u \u2229 f -` v\"\n  by (simp only: vimage_Int)\n\n(* 5\u00aa demostraci\u00f3n *)\nlemma \"f -` (u \u2229 v) = f -` u \u2229 f -` v\"\n  by auto\n\nend\n<\/pre>\n<p><a name=\"ej3\"><\/a><\/p>\n<h3>3. f[s \u222a t] = f[s] \u222a f[t]<\/h3>\n<p>En Lean4, la imagen de un conjunto s por una funci\u00f3n f se representa por <code>f '' s<\/code>; es decir,<\/p>\n<pre lang=\"lean\">\n   f '' s = {y | \u2203 x, x \u2208 s \u2227 f x = y}\n<\/pre>\n<p>Demostrar con Lean4 que<\/p>\n<pre lang=\"lean\">\n   f '' (s \u222a t) = f '' s \u222a f '' t\n<\/pre>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s t : Set \u03b1)\nopen Set\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nby sorry\n<\/pre>\n<h4>2.1. Demostraci\u00f3n en lenguaje natural<\/h4>\n<p>Tenemos que demostrar, para todo &#92;(y&#92;), que<br \/>\n&#92;[ y \u2208 f[s \u222a t] \u2194 y \u2208 f[s] \u222a f[t] &#92;]<br \/>\nLo haremos mediante la siguiente cadena de equivalencias<br \/>\n&#92;begin{align}<br \/>\n   y \u2208 f[s \u222a t] &amp;\u2194 (\u2203x)(x \u2208 s \u222a t \u2227 f x = y) &#92;&#92;<br \/>\n                &amp;\u2194 (\u2203x)((x \u2208 s \u2228 x \u2208 t) \u2227 f x = y) &#92;&#92;<br \/>\n                &amp;\u2194 (\u2203x)((x \u2208 s \u2227 f x = y) \u2228 (x \u2208 t \u2227 f x = y)) &#92;&#92;<br \/>\n                &amp;\u2194 (\u2203x)(x \u2208 s \u2227 f x = y) \u2228 (\u2203x)(x \u2208 t \u2227 f x = y) &#92;&#92;<br \/>\n                &amp;\u2194 y \u2208 f[s] \u2228 y \u2208 f[t] &#92;&#92;<br \/>\n                &amp;\u2194 y \u2208 f[s] \u222a f[t]<br \/>\n&#92;end{align}<\/p>\n<h4>3.2. Demostraciones con Lean4<\/h4>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\n\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s t : Set \u03b1)\n\nopen Set\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' (s \u222a t) \u2194 y \u2208 f '' s \u222a f '' t\n  calc y \u2208 f '' (s \u222a t)\n     \u2194 \u2203 x, x \u2208 s \u222a t \u2227 f x = y :=\n         by simp only [mem_image]\n   _ \u2194 \u2203 x, (x \u2208 s \u2228 x \u2208 t) \u2227 f x = y :=\n         by simp only [mem_union]\n   _ \u2194 \u2203 x, (x \u2208 s \u2227 f x = y) \u2228 (x \u2208 t \u2227 f x = y) :=\n         by simp only [or_and_right]\n   _ \u2194 (\u2203 x, x \u2208 s \u2227 f x = y) \u2228 (\u2203 x, x \u2208 t \u2227 f x = y) :=\n         by simp only [exists_or]\n   _ \u2194 y \u2208 f '' s \u2228 y \u2208 f '' t :=\n         by simp only [mem_image]\n   _ \u2194 y \u2208 f '' s \u222a f '' t :=\n         by simp only [mem_union]\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' (s \u222a t) \u2194 y \u2208 f '' s \u222a f '' t\n  constructor\n  . -- \u22a2 y \u2208 f '' (s \u222a t) \u2192 y \u2208 f '' s \u222a f '' t\n    intro h\n    -- h : y \u2208 f '' (s \u222a t)\n    -- \u22a2 y \u2208 f '' s \u222a f '' t\n    rw [mem_image] at h\n    -- h : \u2203 x, x \u2208 s \u222a t \u2227 f x = y\n    rcases h with \u27e8x, hx\u27e9\n    -- x : \u03b1\n    -- hx : x \u2208 s \u222a t \u2227 f x = y\n    rcases hx with \u27e8xst, fxy\u27e9\n    -- xst : x \u2208 s \u222a t\n    -- fxy : f x = y\n    rw [\u2190fxy]\n    -- \u22a2 f x \u2208 f '' s \u222a f '' t\n    rw [mem_union] at xst\n    -- xst : x \u2208 s \u2228 x \u2208 t\n    rcases xst with (xs | xt)\n    . -- xs : x \u2208 s\n      apply mem_union_left\n      -- \u22a2 f x \u2208 f '' s\n      apply mem_image_of_mem\n      -- \u22a2 x \u2208 s\n      exact xs\n    . -- xt : x \u2208 t\n      apply mem_union_right\n      -- \u22a2 f x \u2208 f '' t\n      apply mem_image_of_mem\n      -- \u22a2 x \u2208 t\n      exact xt\n  . -- \u22a2 y \u2208 f '' s \u222a f '' t \u2192 y \u2208 f '' (s \u222a t)\n    intro h\n    -- h : y \u2208 f '' s \u222a f '' t\n    -- \u22a2 y \u2208 f '' (s \u222a t)\n    rw [mem_union] at h\n    -- h : y \u2208 f '' s \u2228 y \u2208 f '' t\n    rcases h with (yfs | yft)\n    . -- yfs : y \u2208 f '' s\n      rw [mem_image]\n      -- \u22a2 \u2203 x, x \u2208 s \u222a t \u2227 f x = y\n      rw [mem_image] at yfs\n      -- yfs : \u2203 x, x \u2208 s \u2227 f x = y\n      rcases yfs with \u27e8x, hx\u27e9\n      -- x : \u03b1\n      -- hx : x \u2208 s \u2227 f x = y\n      rcases hx with \u27e8xs, fxy\u27e9\n      -- xs : x \u2208 s\n      -- fxy : f x = y\n      use x\n      -- \u22a2 x \u2208 s \u222a t \u2227 f x = y\n      constructor\n      . -- \u22a2 x \u2208 s \u222a t\n        apply mem_union_left\n        -- \u22a2 x \u2208 s\n        exact xs\n      . -- \u22a2 f x = y\n        exact fxy\n    . -- yft : y \u2208 f '' t\n      rw [mem_image]\n      -- \u22a2 \u2203 x, x \u2208 s \u222a t \u2227 f x = y\n      rw [mem_image] at yft\n      -- yft : \u2203 x, x \u2208 t \u2227 f x = y\n      rcases yft with \u27e8x, hx\u27e9\n      -- x : \u03b1\n      -- hx : x \u2208 t \u2227 f x = y\n      rcases hx with \u27e8xt, fxy\u27e9\n      -- xt : x \u2208 t\n      -- fxy : f x = y\n      use x\n      -- \u22a2 x \u2208 s \u222a t \u2227 f x = y\n      constructor\n      . -- \u22a2 x \u2208 s \u222a t\n        apply mem_union_right\n        -- \u22a2 x \u2208 t\n        exact xt\n      . -- \u22a2 f x = y\n        exact fxy\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' (s \u222a t) \u2194 y \u2208 f '' s \u222a f '' t\n  constructor\n  . -- \u22a2 y \u2208 f '' (s \u222a t) \u2192 y \u2208 f '' s \u222a f '' t\n    rintro \u27e8x, xst, rfl\u27e9\n    -- x : \u03b1\n    -- xst : x \u2208 s \u222a t\n    -- \u22a2 f x \u2208 f '' s \u222a f '' t\n    rcases xst with (xs | xt)\n    . -- xs : x \u2208 s\n      left\n      -- \u22a2 f x \u2208 f '' s\n      exact mem_image_of_mem f xs\n    . -- xt : x \u2208 t\n      right\n      -- \u22a2 f x \u2208 f '' t\n      exact mem_image_of_mem f xt\n  . -- \u22a2 y \u2208 f '' s \u222a f '' t \u2192 y \u2208 f '' (s \u222a t)\n    rintro (yfs | yft)\n    . -- yfs : y \u2208 f '' s\n      rcases yfs with \u27e8x, xs, rfl\u27e9\n      -- x : \u03b1\n      -- xs : x \u2208 s\n      -- \u22a2 f x \u2208 f '' (s \u222a t)\n      apply mem_image_of_mem\n      -- \u22a2 x \u2208 s \u222a t\n      left\n      -- \u22a2 x \u2208 s\n      exact xs\n    . -- yft : y \u2208 f '' t\n      rcases yft with \u27e8x, xt, rfl\u27e9\n      -- x : \u03b1\n      -- xs : x \u2208 s\n      -- \u22a2 f x \u2208 f '' (s \u222a t)\n      apply mem_image_of_mem\n      -- \u22a2 x \u2208 s \u222a t\n      right\n      -- \u22a2 x \u2208 t\n      exact xt\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' (s \u222a t) \u2194 y \u2208 f '' s \u222a f '' t\n  constructor\n  . -- \u22a2 y \u2208 f '' (s \u222a t) \u2192 y \u2208 f '' s \u222a f '' t\n    rintro \u27e8x, xst, rfl\u27e9\n    -- x : \u03b1\n    -- xst : x \u2208 s \u222a t\n    -- \u22a2 f x \u2208 f '' s \u222a f '' t\n    rcases xst with (xs | xt)\n    . -- xs : x \u2208 s\n      left\n      -- \u22a2 f x \u2208 f '' s\n      use x, xs\n    . -- xt : x \u2208 t\n      right\n      -- \u22a2 f x \u2208 f '' t\n      use x, xt\n  . rintro (yfs | yft)\n    . -- yfs : y \u2208 f '' s\n      rcases yfs with \u27e8x, xs, rfl\u27e9\n      -- x : \u03b1\n      -- xs : x \u2208 s\n      -- \u22a2 f x \u2208 f '' (s \u222a t)\n      use x, Or.inl xs\n    . -- yft : y \u2208 f '' t\n      rcases yft with \u27e8x, xt, rfl\u27e9\n      -- x : \u03b1\n      -- xt : x \u2208 t\n      -- \u22a2 f x \u2208 f '' (s \u222a t)\n      use x, Or.inr xt\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' (s \u222a t) \u2194 y \u2208 f '' s \u222a f '' t\n  constructor\n  . -- \u22a2 y \u2208 f '' (s \u222a t) \u2192 y \u2208 f '' s \u222a f '' t\n    rintro \u27e8x, xs | xt, rfl\u27e9\n    . -- x : \u03b1\n      -- xs : x \u2208 s\n      -- \u22a2 f x \u2208 f '' s \u222a f '' t\n      left\n      -- \u22a2 f x \u2208 f '' s\n      use x, xs\n    . -- x : \u03b1\n      -- xt : x \u2208 t\n      -- \u22a2 f x \u2208 f '' s \u222a f '' t\n      right\n      -- \u22a2 f x \u2208 f '' t\n      use x, xt\n  . -- \u22a2 y \u2208 f '' s \u222a f '' t \u2192 y \u2208 f '' (s \u222a t)\n    rintro (\u27e8x, xs, rfl\u27e9 | \u27e8x, xt, rfl\u27e9)\n    . -- x : \u03b1\n      -- xs : x \u2208 s\n      -- \u22a2 f x \u2208 f '' (s \u222a t)\n      use x, Or.inl xs\n    . -- x : \u03b1\n      -- xt : x \u2208 t\n      -- \u22a2 f x \u2208 f '' (s \u222a t)\n      use x, Or.inr xt\n\n-- 6\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' (s \u222a t) \u2194 y \u2208 f '' s \u222a f '' t\n  constructor\n  . -- \u22a2 y \u2208 f '' (s \u222a t) \u2192 y \u2208 f '' s \u222a f '' t\n    aesop\n  . -- \u22a2 y \u2208 f '' s \u222a f '' t \u2192 y \u2208 f '' (s \u222a t)\n    aesop\n\n-- 7\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nby\n  ext y\n  constructor <;> aesop\n\n-- 8\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nby\n  ext y\n  -- y : \u03b2\n  -- \u22a2 y \u2208 f '' (s \u222a t) \u2194 y \u2208 f '' s \u222a f '' t\n  rw [iff_def]\n  -- \u22a2 (y \u2208 f '' (s \u222a t) \u2192 y \u2208 f '' s \u222a f '' t) \u2227 (y \u2208 f '' s \u222a f '' t \u2192 y \u2208 f '' (s \u222a t))\n  aesop\n\n-- 9\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u222a t) = f '' s \u222a f '' t :=\nimage_union f s t\n\n-- Lemas usados\n-- ============\n\n-- variable (x : \u03b1)\n-- variable (y : \u03b2)\n-- variable (a b c : Prop)\n-- variable (p q : \u03b1 \u2192 Prop)\n-- #check (Or.inl : a \u2192 a \u2228 b)\n-- #check (Or.inr : b \u2192 a \u2228 b)\n-- #check (exists_or : (\u2203 x, p x \u2228 q x) \u2194 (\u2203 x, p x) \u2228 \u2203 x, q x)\n-- #check (iff_def : (a \u2194 b) \u2194 (a \u2192 b) \u2227 (b \u2192 a))\n-- #check (image_union f s t : f '' (s \u222a t) = f '' s \u222a f '' t)\n-- #check (mem_image f s y : (y \u2208 f '' s \u2194 \u2203 (x : \u03b1), x \u2208 s \u2227 f x = y))\n-- #check (mem_image_of_mem  f : x \u2208 s \u2192 f x \u2208 f '' s)\n-- #check (mem_union x s t : x \u2208 s \u222a t \u2194 x \u2208 s \u2228 x \u2208 t)\n-- #check (mem_union_left t : x \u2208 s \u2192 x \u2208 s \u222a t)\n-- #check (mem_union_right s : x \u2208 t \u2192 x \u2208 s \u222a t)\n-- #check (or_and_right : (a \u2228 b) \u2227 c \u2194 a \u2227 c \u2228 b \u2227 c)\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.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h4>3.3. Demostraciones con Isabelle\/HOL<\/h4>\n<pre lang=\"isar\">\ntheory Imagen_de_la_union\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\nlemma \"f ` (s \u222a t) = f ` s \u222a f ` t\"\nproof (rule equalityI)\n  show \"f ` (s \u222a t) \u2286 f ` s \u222a f ` t\"\n  proof (rule subsetI)\n    fix y\n    assume \"y \u2208 f ` (s \u222a t)\"\n    then show \"y \u2208 f ` s \u222a f ` t\"\n    proof (rule imageE)\n      fix x\n      assume \"y = f x\"\n      assume \"x \u2208 s \u222a t\"\n      then show \"y \u2208 f ` s \u222a f ` t\"\n      proof (rule UnE)\n        assume \"x \u2208 s\"\n        with \u2039y = f x\u203a have \"y \u2208 f ` s\"\n          by (simp only: image_eqI)\n        then show \"y \u2208 f ` s \u222a f ` t\"\n          by (rule UnI1)\n      next\n        assume \"x \u2208 t\"\n        with \u2039y = f x\u203a have \"y \u2208 f ` t\"\n          by (simp only: image_eqI)\n        then show \"y \u2208 f ` s \u222a f ` t\"\n          by (rule UnI2)\n      qed\n    qed\n  qed\nnext\n  show \"f ` s \u222a f ` t \u2286 f ` (s \u222a t)\"\n  proof (rule subsetI)\n    fix y\n    assume \"y \u2208 f ` s \u222a f ` t\"\n    then show \"y \u2208 f ` (s \u222a t)\"\n    proof (rule UnE)\n      assume \"y \u2208 f ` s\"\n      then show \"y \u2208 f ` (s \u222a t)\"\n      proof (rule imageE)\n        fix x\n        assume \"y = f x\"\n        assume \"x \u2208 s\"\n        then have \"x \u2208 s \u222a t\"\n          by (rule UnI1)\n        with \u2039y = f x\u203a show \"y \u2208 f ` (s \u222a t)\"\n          by (simp only: image_eqI)\n      qed\n    next\n      assume \"y \u2208 f ` t\"\n      then show \"y \u2208 f ` (s \u222a t)\"\n      proof (rule imageE)\n        fix x\n        assume \"y = f x\"\n        assume \"x \u2208 t\"\n        then have \"x \u2208 s \u222a t\"\n          by (rule UnI2)\n        with \u2039y = f x\u203a show \"y \u2208 f ` (s \u222a t)\"\n          by (simp only: image_eqI)\n      qed\n    qed\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\nlemma \"f ` (s \u222a t) = f ` s \u222a f ` t\"\nproof\n  show \"f ` (s \u222a t) \u2286 f ` s \u222a f ` t\"\n  proof\n    fix y\n    assume \"y \u2208 f ` (s \u222a t)\"\n    then show \"y \u2208 f ` s \u222a f ` t\"\n    proof\n      fix x\n      assume \"y = f x\"\n      assume \"x \u2208 s \u222a t\"\n      then show \"y \u2208 f ` s \u222a f ` t\"\n      proof\n        assume \"x \u2208 s\"\n        with \u2039y = f x\u203a have \"y \u2208 f ` s\"\n          by simp\n        then show \"y \u2208 f ` s \u222a f ` t\"\n          by simp\n      next\n        assume \"x \u2208 t\"\n        with \u2039y = f x\u203a have \"y \u2208 f ` t\"\n          by simp\n        then show \"y \u2208 f ` s \u222a f ` t\"\n          by simp\n      qed\n    qed\n  qed\nnext\n  show \"f ` s \u222a f ` t \u2286 f ` (s \u222a t)\"\n  proof\n    fix y\n    assume \"y \u2208 f ` s \u222a f ` t\"\n    then show \"y \u2208 f ` (s \u222a t)\"\n    proof\n      assume \"y \u2208 f ` s\"\n      then show \"y \u2208 f ` (s \u222a t)\"\n      proof\n        fix x\n        assume \"y = f x\"\n        assume \"x \u2208 s\"\n        then have \"x \u2208 s \u222a t\"\n          by simp\n        with \u2039y = f x\u203a show \"y \u2208 f ` (s \u222a t)\"\n          by simp\n      qed\n    next\n      assume \"y \u2208 f ` t\"\n      then show \"y \u2208 f ` (s \u222a t)\"\n      proof\n        fix x\n        assume \"y = f x\"\n        assume \"x \u2208 t\"\n        then have \"x \u2208 s \u222a t\"\n          by simp\n        with \u2039y = f x\u203a show \"y \u2208 f ` (s \u222a t)\"\n          by simp\n      qed\n    qed\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\nlemma \"f ` (s \u222a t) = f ` s \u222a f ` t\"\n  by (simp only: image_Un)\n\n(* 4\u00aa demostraci\u00f3n *)\nlemma \"f ` (s \u222a t) = f ` s \u222a f ` t\"\n  by auto\n\nend\n<\/pre>\n<p><a name=\"ej4\"><\/a><\/p>\n<h3>4. s \u2286 f\u207b\u00b9[f[s]\u200b]<\/h3>\n<p>Demostrar que si &#92;(s&#92;) es un subconjunto del dominio de la funci\u00f3n &#92;(f&#92;), entonces &#92;(s&#92;) est\u00e1 contenido en la imagen inversa de la imagen de &#92;(s&#92;) por &#92;(f&#92;); es decir,<br \/>\n&#92;[ s \u2286 f\u207b\u00b9[f[s]] &#92;]<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\nopen Set\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s : Set \u03b1)\n\nexample : s \u2286 f \u207b\u00b9' (f '' s) :=\nby sorry\n<\/pre>\n<h4>4.1. Demostraci\u00f3n en lenguaje natural<\/h4>\n<p>Se demuestra mediante la siguiente cadena de implicaciones<br \/>\n&#92;begin{align}<br \/>\n   x \u2208 s &amp;\u27f9 f(x) \u2208 f[s] &#92;&#92;<br \/>\n         &amp;\u27f9 x \u2208 f\u207b\u00b9[f[s]]<br \/>\n&#92;end{align}<\/p>\n<h4>4.2. Demostraciones con Lean4<\/h4>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\n\nopen Set\n\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s : Set \u03b1)\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2286 f \u207b\u00b9' (f '' s) :=\nby\n  intros x xs\n  -- x : \u03b1\n  -- xs : x \u2208 s\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s)\n  have h1 : f x \u2208 f '' s := mem_image_of_mem f xs\n  show x \u2208 f \u207b\u00b9' (f '' s)\n  exact mem_preimage.mp h1\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2286 f \u207b\u00b9' (f '' s) :=\nby\n  intros x xs\n  -- x : \u03b1\n  -- xs : x \u2208 s\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s)\n  apply mem_preimage.mpr\n  -- \u22a2 f x \u2208 f '' s\n  apply mem_image_of_mem\n  -- \u22a2 x \u2208 s\n  exact xs\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2286 f \u207b\u00b9' (f '' s) :=\nby\n  intros x xs\n  -- x : \u03b1\n  -- xs : x \u2208 s\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s)\n  apply mem_image_of_mem\n  -- \u22a2 x \u2208 s\n  exact xs\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2286 f \u207b\u00b9' (f '' s) :=\nfun _ \u21a6 mem_image_of_mem f\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2286 f \u207b\u00b9' (f '' s) :=\nby\n  intros x xs\n  -- x : \u03b1\n  -- xs : x \u2208 s\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s)\n  show f x \u2208 f '' s\n  use x, xs\n\n-- 6\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2286 f \u207b\u00b9' (f '' s) :=\nby\n  intros x xs\n  -- x : \u03b1\n  -- xs : x \u2208 s\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s)\n  use x, xs\n\n-- 7\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2286 f \u207b\u00b9' (f '' s) :=\nsubset_preimage_image f s\n\n-- Lemas usados\n-- ============\n\n-- variable (x : \u03b1)\n-- variable (t : Set \u03b2)\n-- #check (mem_preimage : x \u2208 f \u207b\u00b9' t \u2194 f x \u2208 t)\n-- #check (mem_image_of_mem f : x \u2208 s \u2192 f x \u2208 f '' s)\n-- #check (subset_preimage_image f s : s \u2286 f \u207b\u00b9' (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_inversa_de_la_imagen.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h4>4.3. Demostraciones con Isabelle\/HOL<\/h4>\n<pre lang=\"isar\">\ntheory Imagen_inversa_de_la_imagen\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\nlemma \"s \u2286 f -` (f ` s)\"\nproof (rule subsetI)\n  fix x\n  assume \"x \u2208 s\"\n  then have \"f x \u2208 f ` s\"\n    by (simp only: imageI)\n  then show \"x \u2208 f -` (f ` s)\"\n    by (simp only: vimageI)\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\nlemma \"s \u2286 f -` (f ` s)\"\nproof\n  fix x\n  assume \"x \u2208 s\"\n  then have \"f x \u2208 f ` s\" by simp\n  then show \"x \u2208 f -` (f ` s)\" by simp\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\nlemma \"s \u2286 f -` (f ` s)\"\n  by auto\n\nend\n<\/pre>\n<p><a name=\"ej5\"><\/a><\/p>\n<h3>5. f[s] \u2286 u \u2194 s \u2286 f\u207b\u00b9[u]<\/h3>\n<p>Demostrar con Lean4 que<br \/>\n&#92;[ f[s] \u2286 u \u2194 s \u2286 f\u207b\u00b9[u] &#92;]<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\nopen Set\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s : Set \u03b1)\nvariable (u : Set \u03b2)\n\nexample : f '' s \u2286 u \u2194 s \u2286 f \u207b\u00b9' u :=\nby sorry\n<\/pre>\n<h4>5.1. Demostraci\u00f3n en lenguaje natural<\/h4>\n<p>Los demostraremos probando las dos implicaciones.<\/p>\n<p>(\u27f9) Supongamos que<br \/>\n&#92;[ f[s] \u2286 u &#92;tag{1} &#92;]<br \/>\ny tenemos que demostrar que<br \/>\n&#92;[ s \u2286 f\u207b\u00b9[u] &#92;]<br \/>\nSe prueba mediante las siguientes implicaciones<br \/>\n&#92;begin{align}<br \/>\n   x \u2208 s &amp;\u27f9 f(x) \u2208 f[s] &#92;&#92;<br \/>\n         &amp;\u27f9 f(x) \u2208 u    &amp;&amp;&#92;text{[por (1)]} &#92;&#92;<br \/>\n         &amp;\u27f9 x \u2208 f\u207b\u00b9[u]<br \/>\n&#92;end{align}<\/p>\n<p>(\u27f8) Supongamos que<br \/>\n&#92;[ s \u2286 f\u207b\u00b9[u] &#92;tag{2} &#92;]<br \/>\ny tenemos que demostrar que<br \/>\n&#92;[ f[s] \u2286 u &#92;]<br \/>\nPara ello, sea &#92;(y \u2208 f[s]&#92;). Entonces, existe un<br \/>\n&#92;[ x \u2208 s &#92;tag{3} &#92;]<br \/>\ntal que<br \/>\n&#92;[ y = f(x) &#92;tag{4} &#92;]<br \/>\nEntonces,<br \/>\n&#92;begin{align}<br \/>\n       &amp;x \u2208 f\u207b\u00b9[u] &amp;&amp;&#92;text{[por (2) y (3)]} &#92;&#92;<br \/>\n   \u27f9 &amp;f(x) \u2208 u   &#92;&#92;<br \/>\n   \u27f9 &amp;y \u2208 u      &amp;&amp;&#92;text{[por (4)]}<br \/>\n&#92;end{align}<\/p>\n<h4>5.2. Demostraciones con Lean4<\/h4>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\n\nopen Set\n\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s : Set \u03b1)\nvariable (u : Set \u03b2)\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' s \u2286 u \u2194 s \u2286 f \u207b\u00b9' u :=\ncalc f '' s \u2286 u\n   \u2194 \u2200 y, y \u2208 f '' s \u2192 y \u2208 u :=\n       by simp only [subset_def]\n _ \u2194 \u2200 y, (\u2203 x, x \u2208 s \u2227 f x = y) \u2192 y \u2208 u :=\n       by simp only [mem_image]\n _ \u2194 \u2200 x, x \u2208 s \u2192 f x \u2208 u := by\n       constructor\n       . -- (\u2200 y, (\u2203 x, x \u2208 s \u2227 f x = y) \u2192 y \u2208 u) \u2192 (\u2200 x, x \u2208 s \u2192 f x \u2208 u)\n         intro h x xs\n         -- h : \u2200 (y : \u03b2), (\u2203 x, x \u2208 s \u2227 f x = y) \u2192 y \u2208 u\n         -- x : \u03b1\n         -- xs : x \u2208 s\n         -- \u22a2 f x \u2208 u\n         exact h (f x) (by use x, xs)\n       . -- (\u2200 x, x \u2208 s \u2192 f x \u2208 u) \u2192 (\u2200 y, (\u2203 x, x \u2208 s \u2227 f x = y) \u2192 y \u2208 u)\n         intro h y hy\n         -- h : \u2200 (x : \u03b1), x \u2208 s \u2192 f x \u2208 u\n         -- y : \u03b2\n         -- hy : \u2203 x, x \u2208 s \u2227 f x = y\n         -- \u22a2 y \u2208 u\n         obtain \u27e8x, hx\u27e9 := hy\n         -- x : \u03b1\n         -- hx : x \u2208 s \u2227 f x = y\n         have h1 : y = f x := hx.2.symm\n         have h2 : f x \u2208 u := h x hx.1\n         show y \u2208 u\n         exact mem_of_eq_of_mem h1 h2\n _ \u2194 \u2200 x, x \u2208 s \u2192 x \u2208 f \u207b\u00b9' u :=\n       by simp only [mem_preimage]\n _ \u2194 s \u2286 f \u207b\u00b9' u :=\n       by simp only [subset_def]\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' s \u2286 u \u2194 s \u2286 f \u207b\u00b9' u :=\ncalc f '' s \u2286 u\n   \u2194 \u2200 y, y \u2208 f '' s \u2192 y \u2208 u :=\n       by simp only [subset_def]\n _ \u2194 \u2200 y, (\u2203 x, x \u2208 s \u2227 f x = y) \u2192 y \u2208 u :=\n       by simp only [mem_image]\n _ \u2194 \u2200 x, x \u2208 s \u2192 f x \u2208 u := by\n       constructor\n       . -- (\u2200 y, (\u2203 x, x \u2208 s \u2227 f x = y) \u2192 y \u2208 u) \u2192 (\u2200 x, x \u2208 s \u2192 f x \u2208 u)\n         intro h x xs\n         -- h : \u2200 (y : \u03b2), (\u2203 x, x \u2208 s \u2227 f x = y) \u2192 y \u2208 u\n         -- x : \u03b1\n         -- xs : x \u2208 s\n         -- \u22a2 f x \u2208 u\n         apply h (f x)\n         -- \u22a2 \u2203 x_1, x_1 \u2208 s \u2227 f x_1 = f x\n         use x, xs\n       . -- (\u2200 x, x \u2208 s \u2192 f x \u2208 u) \u2192 (\u2200 y, (\u2203 x, x \u2208 s \u2227 f x = y) \u2192 y \u2208 u)\n         intro h y hy\n         -- h : \u2200 (x : \u03b1), x \u2208 s \u2192 f x \u2208 u\n         -- y : \u03b2\n         -- hy : \u2203 x, x \u2208 s \u2227 f x = y\n         -- \u22a2 y \u2208 u\n         obtain \u27e8x, hx\u27e9 := hy\n         -- x : \u03b1\n         -- hx : x \u2208 s \u2227 f x = y\n         rw [\u2190hx.2]\n         -- \u22a2 f x \u2208 u\n         apply h x\n         -- \u22a2 x \u2208 s\n         exact hx.1\n _ \u2194 \u2200 x, x \u2208 s \u2192 x \u2208 f \u207b\u00b9' u :=\n       by simp only [mem_preimage]\n _ \u2194 s \u2286 f \u207b\u00b9' u :=\n       by simp only [subset_def]\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' s \u2286 u \u2194 s \u2286 f \u207b\u00b9' u :=\nby\n  constructor\n  . -- \u22a2 f '' s \u2286 u \u2192 s \u2286 f \u207b\u00b9' u\n    intros h x xs\n    -- h : f '' s \u2286 u\n    -- x : \u03b1\n    -- xs : x \u2208 s\n    -- \u22a2 x \u2208 f \u207b\u00b9' u\n    apply mem_preimage.mpr\n    -- \u22a2 f x \u2208 u\n    apply h\n    -- \u22a2 f x \u2208 f '' s\n    apply mem_image_of_mem\n    -- \u22a2 x \u2208 s\n    exact xs\n  . -- \u22a2 s \u2286 f \u207b\u00b9' u \u2192 f '' s \u2286 u\n    intros h y hy\n    -- h : s \u2286 f \u207b\u00b9' u\n    -- y : \u03b2\n    -- hy : y \u2208 f '' s\n    -- \u22a2 y \u2208 u\n    rcases hy with \u27e8x, xs, fxy\u27e9\n    -- x : \u03b1\n    -- xs : x \u2208 s\n    -- fxy : f x = y\n    rw [\u2190fxy]\n    -- \u22a2 f x \u2208 u\n    exact h xs\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' s \u2286 u \u2194 s \u2286 f \u207b\u00b9' u :=\nby\n  constructor\n  . -- \u22a2 f '' s \u2286 u \u2192 s \u2286 f \u207b\u00b9' u\n    intros h x xs\n    -- h : f '' s \u2286 u\n    -- x : \u03b1\n    -- xs : x \u2208 s\n    -- \u22a2 x \u2208 f \u207b\u00b9' u\n    apply h\n    -- \u22a2 f x \u2208 f '' s\n    apply mem_image_of_mem\n    -- \u22a2 x \u2208 s\n    exact xs\n  . -- \u22a2 s \u2286 f \u207b\u00b9' u \u2192 f '' s \u2286 u\n    rintro h y \u27e8x, xs, rfl\u27e9\n    -- h : s \u2286 f \u207b\u00b9' u\n    -- x : \u03b1\n    -- xs : x \u2208 s\n    -- \u22a2 f x \u2208 u\n    exact h xs\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' s \u2286 u \u2194 s \u2286 f \u207b\u00b9' u :=\nimage_subset_iff\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' s \u2286 u \u2194 s \u2286 f \u207b\u00b9' u :=\nby simp\n\n-- Lemas usados\n-- ============\n\n-- variable (x y : \u03b1)\n-- #check (image_subset_iff : f '' s \u2286 u \u2194 s \u2286 f \u207b\u00b9' u)\n-- #check (mem_image_of_mem f : x \u2208 s \u2192 f x \u2208 f '' s)\n-- #check (mem_of_eq_of_mem : x = y \u2192 y \u2208 s \u2192 x \u2208 s)\n-- #check (mem_preimage : x \u2208 f \u207b\u00b9' u \u2194 f x \u2208 u)\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\/Subconjunto_de_la_imagen_inversa.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h4>5.3. Demostraciones con Isabelle\/HOL<\/h4>\n<pre lang=\"isar\">\ntheory Subconjunto_de_la_imagen_inversa\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\nlemma \"f ` s \u2286 u \u27f7 s \u2286 f -` u\"\nproof (rule iffI)\n  assume \"f ` s \u2286 u\"\n  show \"s \u2286 f -` u\"\n  proof (rule subsetI)\n    fix x\n    assume \"x \u2208 s\"\n    then have \"f x \u2208 f ` s\"\n      by (simp only: imageI)\n    then have \"f x \u2208 u\"\n      using \u2039f ` s \u2286 u\u203a by (rule set_rev_mp)\n    then show \"x \u2208 f -` u\"\n      by (simp only: vimageI)\n  qed\nnext\n  assume \"s \u2286 f -` u\"\n  show \"f ` s \u2286 u\"\n  proof (rule subsetI)\n    fix y\n    assume \"y \u2208 f ` s\"\n    then show \"y \u2208 u\"\n    proof\n      fix x\n      assume \"y = f x\"\n      assume \"x \u2208 s\"\n      then have \"x \u2208 f -` u\"\n        using \u2039s \u2286 f -` u\u203a by (rule set_rev_mp)\n      then have \"f x \u2208 u\"\n        by (rule vimageD)\n      with \u2039y = f x\u203a show \"y \u2208 u\"\n        by (rule ssubst)\n    qed\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\nlemma \"f ` s \u2286 u \u27f7 s \u2286 f -` u\"\nproof\n  assume \"f ` s \u2286 u\"\n  show \"s \u2286 f -` u\"\n  proof\n    fix x\n    assume \"x \u2208 s\"\n    then have \"f x \u2208 f ` s\"\n      by simp\n    then have \"f x \u2208 u\"\n      using \u2039f ` s \u2286 u\u203a by (simp add: set_rev_mp)\n    then show \"x \u2208 f -` u\"\n      by simp\n  qed\nnext\n  assume \"s \u2286 f -` u\"\n  show \"f ` s \u2286 u\"\n  proof\n    fix y\n    assume \"y \u2208 f ` s\"\n    then show \"y \u2208 u\"\n    proof\n      fix x\n      assume \"y = f x\"\n      assume \"x \u2208 s\"\n      then have \"x \u2208 f -` u\"\n        using \u2039s \u2286 f -` u\u203a by (simp only: set_rev_mp)\n      then have \"f x \u2208 u\"\n        by simp\n      with \u2039y = f x\u203a show \"y \u2208 u\"\n        by simp\n    qed\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\nlemma \"f ` s \u2286 u \u27f7 s \u2286 f -` u\"\n  by (simp only: image_subset_iff_subset_vimage)\n\n(* 4\u00aa demostraci\u00f3n *)\nlemma \"f ` s \u2286 u \u27f7 s \u2286 f -` u\"\n  by auto\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Esta semana he publicado en Calculemus las demostraciones con Lean4 de las siguientes propiedades: 1. s \u222a (\u22c2\u1d62 A\u1d62) = \u22c2\u1d62 (A\u1d62 \u222a s) 2. f\u207b\u00b9(u \u2229 v) = f\u207b\u00b9(u) \u2229 f\u207b\u00b9(v) 3. f(s \u222a t) = f(s) \u222a f(t) 4. s \u2286 f\u207b\u00b9(f(s)) 5. f(s) \u2286 u \u2194 s \u2286 f\u207b\u00b9(u) A continuaci\u00f3n se&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","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,"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[335],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/8157"}],"collection":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/comments?post=8157"}],"version-history":[{"count":2,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/8157\/revisions"}],"predecessor-version":[{"id":8159,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/8157\/revisions\/8159"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/media?parent=8157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/categories?post=8157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/tags?post=8157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}