        {"id":2398,"date":"2024-03-19T13:46:28","date_gmt":"2024-03-19T11:46:28","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2398"},"modified":"2024-04-21T13:47:57","modified_gmt":"2024-04-21T11:47:57","slug":"19-mar-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/19-mar-24\/","title":{"rendered":"f[f\u207b\u00b9[u]] \u2286 u"},"content":{"rendered":"\n<p>Demostrar con Lean4 que<br \/>\n&#92;[ f[f\u207b\u00b9[u]] \u2286 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\n\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (u : Set \u03b2)\n\nexample : f '' (f\u207b\u00b9' u) \u2286 u :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Sea &#92;(y \u2208 f[f\u207b\u00b9[u]]&#92;). Entonces existe un &#92;(x&#92;) tal que<br \/>\n&#92;begin{align}<br \/>\n   &amp;x \u2208 f\u207b\u00b9[u] &#92;tag{1} &#92;&#92;<br \/>\n   &amp;f(x) = y   &#92;tag{2}<br \/>\n&#92;end{align}<br \/>\nPor (1),<br \/>\n&#92;[ f(x) \u2208 u &#92;]<br \/>\ny, por (2),<br \/>\n&#92;[ y \u2208 u &#92;]<\/p>\n<h2>2. Demostraciones con Lean4<\/h2>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\nopen Set\n\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (u : Set \u03b2)\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (f\u207b\u00b9' u) \u2286 u :=\nby\n  intros y h\n  -- y : \u03b2\n  -- h : y \u2208 f '' (f \u207b\u00b9' u)\n  -- \u22a2 y \u2208 u\n  obtain \u27e8x : \u03b1, h1 : x \u2208 f \u207b\u00b9' u \u2227 f x = y\u27e9 := h\n  obtain \u27e8hx : x \u2208 f \u207b\u00b9' u, fxy : f x = y\u27e9 := h1\n  have h2 : f x \u2208 u := mem_preimage.mp hx\n  show y \u2208 u\n  exact fxy \u25b8 h2\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (f\u207b\u00b9' u) \u2286 u :=\nby\n  intros y h\n  -- y : \u03b2\n  -- h : y \u2208 f '' (f \u207b\u00b9' u)\n  -- \u22a2 y \u2208 u\n  rcases h with \u27e8x, h2\u27e9\n  -- x : \u03b1\n  -- h2 : x \u2208 f \u207b\u00b9' u \u2227 f x = y\n  rcases h2 with \u27e8hx, fxy\u27e9\n  -- hx : x \u2208 f \u207b\u00b9' u\n  -- fxy : f x = y\n  rw [\u2190fxy]\n  -- \u22a2 f x \u2208 u\n  exact hx\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (f\u207b\u00b9' u) \u2286 u :=\nby\n  intros y h\n  -- y : \u03b2\n  -- h : y \u2208 f '' (f \u207b\u00b9' u)\n  -- \u22a2 y \u2208 u\n  rcases h with \u27e8x, hx, fxy\u27e9\n  -- x : \u03b1\n  -- hx : x \u2208 f \u207b\u00b9' u\n  -- fxy : f x = y\n  rw [\u2190fxy]\n  -- \u22a2 f x \u2208 u\n  exact hx\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (f\u207b\u00b9' u) \u2286 u :=\nby\n  rintro y \u27e8x, hx, fxy\u27e9\n  -- y : \u03b2\n  -- x : \u03b1\n  -- hx : x \u2208 f \u207b\u00b9' u\n  -- fxy : f x = y\n  -- \u22a2 y \u2208 u\n  rw [\u2190fxy]\n  -- \u22a2 f x \u2208 u\n  exact hx\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (f\u207b\u00b9' u) \u2286 u :=\nby\n  rintro y \u27e8x, hx, rfl\u27e9\n  -- x : \u03b1\n  -- hx : x \u2208 f \u207b\u00b9' u\n  -- \u22a2 f x \u2208 u\n  exact hx\n\n-- 6\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (f\u207b\u00b9' u) \u2286 u :=\nimage_preimage_subset f u\n\n-- Lemas usados\n-- ============\n\n-- #check (image_preimage_subset f u : f '' (f\u207b\u00b9' u) \u2286 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\/Imagen_de_la_imagen_inversa.lean\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isar\">\ntheory Imagen_de_la_imagen_inversa\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (f -` u) \u2286 u\"\nproof (rule subsetI)\n  fix y\n  assume \"y \u2208 f ` (f -` u)\"\n  then show \"y \u2208 u\"\n  proof (rule imageE)\n    fix x\n    assume \"y = f x\"\n    assume \"x \u2208 f -` u\"\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\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (f -` u) \u2286 u\"\nproof\n  fix y\n  assume \"y \u2208 f ` (f -` u)\"\n  then show \"y \u2208 u\"\n  proof\n    fix x\n    assume \"y = f x\"\n    assume \"x \u2208 f -` u\"\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\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (f -` u) \u2286 u\"\n  by (simp only: image_vimage_subset)\n\n(* 4\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (f -` u) \u2286 u\"\n  by auto\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que &#92;[ f[f\u207b\u00b9[u]] \u2286 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 (u : Set \u03b2) example : f \u00bb (f\u207b\u00b9&#8217; u) \u2286 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\/2398"}],"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=2398"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2398\/revisions"}],"predecessor-version":[{"id":2399,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2398\/revisions\/2399"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}