        {"id":2343,"date":"2024-03-18T06:00:25","date_gmt":"2024-03-18T04:00:25","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2343"},"modified":"2024-03-17T21:18:19","modified_gmt":"2024-03-17T19:18:19","slug":"18-mar-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/18-mar-24\/","title":{"rendered":"Si f es inyectiva, entonces f\u207b\u00b9[f[s]\u200b] \u2286 s"},"content":{"rendered":"\n<p>Demostrar con Lean4 que si &#92;(f&#92;) es inyectiva, entonces &#92;(f\u207b\u00b9[f[s]\u200b] \u2286 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 Function\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s : Set \u03b1)\n\nexample\n  (h : Injective f)\n  : f \u207b\u00b9' (f '' s) \u2286 s :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Sea &#92;(x&#92;) tal que<br \/>\n&#92;[ x \u2208 f\u207b\u00b9[f[s]] &#92;]<br \/>\nEntonces,<br \/>\n&#92;[ f(x) \u2208 f[s] &#92;]<br \/>\ny, por tanto, existe un<br \/>\n&#92;[ y \u2208 s &#92;tag{1} &#92;]<br \/>\ntal que<br \/>\n&#92;[ f(y) = f(x) &#92;tag{2} &#92;]<br \/>\nDe (2), puesto que &#92;(f&#92;) es inyectiva, se tiene que<br \/>\n&#92;[ y = x &#92;tag{3} &#92;]<br \/>\nFinalmente, de (3) y (1), se tiene que<br \/>\n&#92;[ x \u2208 s &#92;]<br \/>\nque es lo que ten\u00edamos que demostrar.<\/p>\n<h2>2. Demostraciones con Lean4<\/h2>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\n\nopen Set Function\n\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s : Set \u03b1)\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : Injective f)\n  : f \u207b\u00b9' (f '' s) \u2286 s :=\nby\n  intros x hx\n  -- x : \u03b1\n  -- hx : x \u2208 f \u207b\u00b9' (f '' s)\n  -- \u22a2 x \u2208 s\n  have h1 : f x \u2208 f '' s := mem_preimage.mp hx\n  have h2 : \u2203 y, y \u2208 s \u2227 f y = f x := (mem_image f s (f x)).mp h1\n  obtain \u27e8y, hy : y \u2208 s \u2227 f y = f x\u27e9 := h2\n  obtain \u27e8ys : y \u2208 s, fyx : f y = f x\u27e9 := hy\n  have h3 : y = x := h fyx\n  show x \u2208 s\n  exact h3 \u25b8 ys\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : Injective f)\n  : f \u207b\u00b9' (f '' s) \u2286 s :=\nby\n  intros x hx\n  -- x : \u03b1\n  -- hx : x \u2208 f \u207b\u00b9' (f '' s)\n  -- \u22a2 x \u2208 s\n  rw [mem_preimage] at hx\n  -- hx : f x \u2208 f '' s\n  rw [mem_image] at hx\n  -- hx : \u2203 x_1, x_1 \u2208 s \u2227 f x_1 = f x\n  rcases hx with \u27e8y, hy\u27e9\n  -- y : \u03b1\n  -- hy : y \u2208 s \u2227 f y = f x\n  rcases hy with \u27e8ys, fyx\u27e9\n  -- ys : y \u2208 s\n  -- fyx : f y = f x\n  unfold Injective at h\n  -- h : \u2200 \u2983a\u2081 a\u2082 : \u03b1\u2984, f a\u2081 = f a\u2082 \u2192 a\u2081 = a\u2082\n  have h1 : y = x := h fyx\n  rw [\u2190h1]\n  -- \u22a2 y \u2208 s\n  exact ys\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : Injective f)\n  : f \u207b\u00b9' (f '' s) \u2286 s :=\nby\n  intros x hx\n  -- x : \u03b1\n  -- hx : x \u2208 f \u207b\u00b9' (f '' s)\n  -- \u22a2 x \u2208 s\n  rw [mem_preimage] at hx\n  -- hx : f x \u2208 f '' s\n  rcases hx with \u27e8y, ys, fyx\u27e9\n  -- y : \u03b1\n  -- ys : y \u2208 s\n  -- fyx : f y = f x\n  rw [\u2190h fyx]\n  -- \u22a2 y \u2208 s\n  exact ys\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : Injective f)\n  : f \u207b\u00b9' (f '' s) \u2286 s :=\nby\n  rintro x \u27e8y, ys, hy\u27e9\n  -- x y : \u03b1\n  -- ys : y \u2208 s\n  -- hy : f y = f x\n  -- \u22a2 x \u2208 s\n  rw [\u2190h hy]\n  -- \u22a2 y \u2208 s\n  exact ys\n\n-- Lemas usados\n-- ============\n\n-- variable (x : \u03b1)\n-- variable (y : \u03b2)\n-- variable (t : Set \u03b2)\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_preimage : x \u2208 f \u207b\u00b9' t \u2194 f x \u2208 t)\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_de_aplicaciones_inyectivas.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isar\">\ntheory Imagen_inversa_de_la_imagen_de_aplicaciones_inyectivas\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\nlemma\n  assumes \"inj f\"\n  shows \"f -` (f ` s) \u2286 s\"\nproof (rule subsetI)\n  fix x\n  assume \"x \u2208 f -` (f ` s)\"\n  then have \"f x \u2208 f ` s\"\n    by (rule vimageD)\n  then show \"x \u2208 s\"\n  proof (rule imageE)\n    fix y\n    assume \"f x = f y\"\n    assume \"y \u2208 s\"\n    have \"x = y\"\n      using \u2039inj f\u203a \u2039f x = f y\u203a by (rule injD)\n    then show \"x \u2208 s\"\n      using \u2039y \u2208 s\u203a  by (rule ssubst)\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\nlemma\n  assumes \"inj f\"\n  shows \"f -` (f ` s) \u2286 s\"\nproof\n  fix x\n  assume \"x \u2208 f -` (f ` s)\"\n  then have \"f x \u2208 f ` s\"\n    by simp\n  then show \"x \u2208 s\"\n  proof\n    fix y\n    assume \"f x = f y\"\n    assume \"y \u2208 s\"\n    have \"x = y\"\n      using \u2039inj f\u203a \u2039f x = f y\u203a by (rule injD)\n    then show \"x \u2208 s\"\n      using \u2039y \u2208 s\u203a  by simp\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\nlemma\n  assumes \"inj f\"\n  shows \"f -` (f ` s) \u2286 s\"\n  using assms\n  unfolding inj_def\n  by auto\n\n(* 4\u00aa demostraci\u00f3n *)\nlemma\n  assumes \"inj f\"\n  shows \"f -` (f ` s) \u2286 s\"\n  using assms\n  by (simp only: inj_vimage_image_eq)\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que si &#92;(f&#92;) es inyectiva, entonces &#92;(f\u207b\u00b9[f[s]\u200b] \u2286 s&#92;). Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Set.Function open Set Function variable {\u03b1 \u03b2 : Type _} variable (f : \u03b1 \u2192 \u03b2) variable (s : Set \u03b1) example (h : Injective f) : f \u207b\u00b9&#8217; (f \u00bb s) \u2286 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":[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\/2343"}],"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=2343"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2343\/revisions"}],"predecessor-version":[{"id":2344,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2343\/revisions\/2344"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}