        {"id":2340,"date":"2024-03-15T06:00:45","date_gmt":"2024-03-15T04:00:45","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2340"},"modified":"2024-03-16T11:51:11","modified_gmt":"2024-03-16T09:51:11","slug":"15-mar-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/15-mar-24\/","title":{"rendered":"f[s] \u2286 u \u2194 s \u2286 f\u207b\u00b9[u]"},"content":{"rendered":"\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<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\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<h2>2. Demostraciones con Lean4<\/h2>\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<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\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>Demostrar con Lean4 que &#92;[ f[s] \u2286 u \u2194 s \u2286 f\u207b\u00b9[u] &#92;] Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Set.Function open Set variable {\u03b1 \u03b2 : Type _} variable (f : \u03b1 \u2192 \u03b2) variable (s : Set \u03b1) variable (u : Set \u03b2) example : f \u00bb s \u2286 u \u2194 s \u2286 f \u207b\u00b9&#8217; u := 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\/2340"}],"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=2340"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2340\/revisions"}],"predecessor-version":[{"id":2341,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2340\/revisions\/2341"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}