        {"id":2409,"date":"2024-04-24T13:38:19","date_gmt":"2024-04-24T11:38:19","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2409"},"modified":"2024-04-24T13:41:06","modified_gmt":"2024-04-24T11:41:06","slug":"24-abr-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/24-abr-24\/","title":{"rendered":"Uni\u00f3n con la imagen inversa"},"content":{"rendered":"\n<p>Demostrar con Lean4 que<br \/>\n&#92;[ s \u222a f\u207b\u00b9[v] \u2286 f\u207b\u00b9[f[s] \u222a v] &#92;]<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\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 (v : Set \u03b2)\n\nexample : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a v) :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Sea &#92;(x \u2208 s \u222a f\u207b\u00b9[v]&#92;). Entonces, se pueden dar dos casos.<\/p>\n<p>Caso 1: Supongamos que &#92;(x \u2208 s&#92;). Entonces, se tiene<br \/>\n&#92;begin{align}<br \/>\n   &amp;f(x) \u2208 f[s]       &#92;&#92;<br \/>\n   &amp;f(x) \u2208 f[s] \u222a v   &#92;&#92;<br \/>\n   &amp;x \u2208 f\u207b\u00b9[f[s] \u222a v]<br \/>\n&#92;end{align}<\/p>\n<p>Caso 2: Supongamos que x \u2208 f\u207b\u00b9[v]. Entonces, se tiene<br \/>\n&#92;begin{align}<br \/>\n   &amp;f(x) \u2208 v           &#92;&#92;<br \/>\n   &amp;f(x) \u2208 f[s] \u222a v    &#92;&#92;<br \/>\n   &amp;x \u2208 f\u207b\u00b9[f[s] \u222a v]<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 (v : Set \u03b2)\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a v) :=\nby\n  intros x hx\n  -- x : \u03b1\n  -- hx : x \u2208 s \u222a f \u207b\u00b9' v\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s \u222a v)\n  cases' hx with xs xv\n  . -- xs : x \u2208 s\n    have h1 : f x \u2208 f '' s := mem_image_of_mem f xs\n    have h2 : f x \u2208 f '' s \u222a v := mem_union_left v h1\n    show x \u2208 f \u207b\u00b9' (f '' s \u222a v)\n    exact mem_preimage.mpr h2\n  . -- xv : x \u2208 f \u207b\u00b9' v\n    have h3 : f x \u2208 v := mem_preimage.mp xv\n    have h4 : f x \u2208 f '' s \u222a v := mem_union_right (f '' s) h3\n    show x \u2208 f \u207b\u00b9' (f '' s \u222a v)\n    exact mem_preimage.mpr h4\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a v) :=\nby\n  intros x hx\n  -- x : \u03b1\n  -- hx : x \u2208 s \u222a f \u207b\u00b9' v\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s \u222a v)\n  rw [mem_preimage]\n  -- \u22a2 f x \u2208 f '' s \u222a v\n  cases' hx with xs xv\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  . -- xv : x \u2208 f \u207b\u00b9' v\n    apply mem_union_right\n    -- \u22a2 f x \u2208 v\n    rw [\u2190mem_preimage]\n    -- \u22a2 x \u2208 f \u207b\u00b9' v\n    exact xv\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a v) :=\nby\n  intros x hx\n  -- x : \u03b1\n  -- hx : x \u2208 s \u222a f \u207b\u00b9' v\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s \u222a v)\n  cases' hx with xs xv\n  . -- xs : x \u2208 s\n    rw [mem_preimage]\n    -- \u22a2 f x \u2208 f '' s \u222a v\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  . -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s \u222a v)\n    rw [mem_preimage]\n    -- \u22a2 f x \u2208 f '' s \u222a v\n    apply mem_union_right\n    -- \u22a2 f x \u2208 v\n    exact xv\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a v) :=\nby\n  rintro x (xs | xv)\n  -- x : \u03b1\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s \u222a v)\n  . -- xs : x \u2208 s\n    left\n    -- \u22a2 f x \u2208 f '' s\n    exact mem_image_of_mem f xs\n  . -- xv : x \u2208 f \u207b\u00b9' v\n    right\n    -- \u22a2 f x \u2208 v\n    exact xv\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a v) :=\nby\n  rintro x (xs | xv)\n  -- x : \u03b1\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s \u222a v)\n  . -- xs : x \u2208 s\n    exact Or.inl (mem_image_of_mem f xs)\n  . -- xv : x \u2208 f \u207b\u00b9' v\n    exact Or.inr xv\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a v) :=\nby\n  intros x h\n  -- x : \u03b1\n  -- h : x \u2208 s \u222a f \u207b\u00b9' v\n  -- \u22a2 x \u2208 f \u207b\u00b9' (f '' s \u222a v)\n  exact Or.elim h (fun xs \u21a6 Or.inl (mem_image_of_mem f xs)) Or.inr\n\n-- 6\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a v) :=\nfun _ h \u21a6 Or.elim h (fun xs \u21a6 Or.inl (mem_image_of_mem f xs)) Or.inr\n\n-- 7\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a v) :=\nunion_preimage_subset s v f\n\n-- Lemas usados\n-- ============\n\n-- variable (x : \u03b1)\n-- variable (t : Set \u03b1)\n-- variable (a b c : Prop)\n-- #check (Or.elim : a \u2228 b \u2192 (a \u2192 c) \u2192 (b \u2192 c) \u2192 c)\n-- #check (Or.inl : a \u2192 a \u2228 b)\n-- #check (Or.inr : b \u2192 a \u2228 b)\n-- #check (mem_image_of_mem f : x  \u2208 s \u2192 f x \u2208 f '' s)\n-- #check (mem_preimage : x \u2208 f \u207b\u00b9' v \u2194 f x \u2208 v)\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 (union_preimage_subset s v f : s \u222a f \u207b\u00b9' v \u2286 f \u207b\u00b9' (f '' s \u222a 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\/Union_con_la_imagen_inversa.lean\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isar\">\ntheory Union_con_la_imagen_inversa\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\n\nlemma \"s \u222a f -` v \u2286 f -` (f ` s \u222a v)\"\nproof (rule subsetI)\n  fix x\n  assume \"x \u2208 s \u222a f -` v\"\n  then have \"f x \u2208 f ` s \u222a v\"\n  proof (rule UnE)\n    assume \"x \u2208 s\"\n    then have \"f x \u2208 f ` s\"\n      by (rule imageI)\n    then show \"f x \u2208 f ` s \u222a v\"\n      by (rule UnI1)\n  next\n    assume \"x \u2208 f -` v\"\n    then have \"f x \u2208 v\"\n      by (rule vimageD)\n    then show \"f x \u2208 f ` s \u222a v\"\n      by (rule UnI2)\n  qed\n  then show \"x \u2208 f -` (f ` s \u222a v)\"\n    by (rule vimageI2)\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\n\nlemma \"s \u222a f -` v \u2286 f -` (f ` s \u222a v)\"\nproof\n  fix x\n  assume \"x \u2208 s \u222a f -` v\"\n  then have \"f x \u2208 f ` s \u222a v\"\n  proof\n    assume \"x \u2208 s\"\n    then have \"f x \u2208 f ` s\" by simp\n    then show \"f x \u2208 f ` s \u222a v\" by simp\n  next\n    assume \"x \u2208 f -` v\"\n    then have \"f x \u2208 v\" by simp\n    then show \"f x \u2208 f ` s \u222a v\" by simp\n  qed\n  then show \"x \u2208 f -` (f ` s \u222a v)\" by simp\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\n\nlemma \"s \u222a f -` v \u2286 f -` (f ` s \u222a v)\"\nproof\n  fix x\n  assume \"x \u2208 s \u222a f -` v\"\n  then have \"f x \u2208 f ` s \u222a v\"\n  proof\n    assume \"x \u2208 s\"\n    then show \"f x \u2208 f ` s \u222a v\" by simp\n  next\n    assume \"x \u2208 f -` v\"\n    then show \"f x \u2208 f ` s \u222a v\" by simp\n  qed\n  then show \"x \u2208 f -` (f ` s \u222a v)\" by simp\nqed\n\n(* 4\u00aa demostraci\u00f3n *)\n\nlemma \"s \u222a f -` v \u2286 f -` (f ` s \u222a v)\"\n  by auto\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostraciones con Lean4 e Isabelle\/HOL de s \u222a f\u207b\u00b9[v] \u2286 f\u207b\u00b9[f[s] \u222a v].<\/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\/2409"}],"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=2409"}],"version-history":[{"count":4,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2409\/revisions"}],"predecessor-version":[{"id":2413,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2409\/revisions\/2413"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}