        {"id":2358,"date":"2024-04-03T06:00:17","date_gmt":"2024-04-03T04:00:17","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2358"},"modified":"2024-04-03T19:25:25","modified_gmt":"2024-04-03T17:25:25","slug":"03-abr-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/03-abr-24\/","title":{"rendered":"Si s \u2286 t, entonces f[s] \u2286 f[t]"},"content":{"rendered":"\n<p>Demostrar con Lean4 que si &#92;(s \u2286 t&#92;), entonces &#92;(f[s] \u2286 f[t]&#92;).<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\nimport Mathlib.Tactic\n\nopen Set\n\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s t : Set \u03b1)\n\nexample\n  (h : s \u2286 t)\n  : f '' s \u2286 f '' t :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Sea &#92;(y \u2208 f[s]&#92;). Entonces, existe un x tal que<br \/>\n&#92;begin{align}<br \/>\n   &amp;x \u2208 s    &#92;tag{1} &#92;&#92;<br \/>\n   &amp;f(x) = y &#92;tag{2}<br \/>\n&#92;end{align}<br \/>\nPor (1) y la hip\u00f3tesis,<br \/>\n&#92;[ x \u2208 t &#92;tag{3} &#92;]<br \/>\nPor (3),<br \/>\n&#92;[ f(x) \u2208 f[t] &#92;tag{4} &#92;]<br \/>\ny, por (2) y (4),<br \/>\n&#92;[ y \u2208 f[t] &#92;]<\/p>\n<h2>2. Demostraciones con Lean4<\/h2>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Function\nimport Mathlib.Tactic\n\nopen Set\n\nvariable {\u03b1 \u03b2 : Type _}\nvariable (f : \u03b1 \u2192 \u03b2)\nvariable (s t : Set \u03b1)\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : s \u2286 t)\n  : f '' s \u2286 f '' t :=\nby\n  intros y hy\n  -- y : \u03b2\n  -- hy : y \u2208 f '' s\n  -- \u22a2 y \u2208 f '' t\n  rw [mem_image] at hy\n  -- hy : \u2203 x, x \u2208 s \u2227 f x = y\n  rcases hy 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 t \u2227 f x = y\n  constructor\n  . -- \u22a2 x \u2208 t\n    exact h xs\n  . -- \u22a2 f x = y\n    exact fxy\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : s \u2286 t)\n  : f '' s \u2286 f '' t :=\nby\n  intros y hy\n  -- y : \u03b2\n  -- hy : y \u2208 f '' s\n  -- \u22a2 y \u2208 f '' t\n  rcases hy with \u27e8x, xs, fxy\u27e9\n  -- x : \u03b1\n  -- xs : x \u2208 s\n  -- fxy : f x = y\n  use x\n  -- \u22a2 x \u2208 t \u2227 f x = y\n  exact \u27e8h xs, fxy\u27e9\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample\n  (h : s \u2286 t)\n  : f '' s \u2286 f '' t :=\nimage_subset f h\n\n-- Lemas usados\n-- ============\n\n-- variable (y : \u03b2)\n-- #check (mem_image f s y : y \u2208 f '' s \u2194 \u2203 x, x \u2208 s \u2227 f x = y)\n-- #check (image_subset f : s \u2286 t \u2192 f '' s \u2286 f '' 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\/Monotonia_de_la_imagen_de_conjuntos.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isar\">\ntheory Monotonia_de_la_imagen_de_conjuntos\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\nlemma\n  assumes \"s \u2286 t\"\n  shows \"f ` s \u2286 f ` t\"\nproof (rule subsetI)\n  fix y\n  assume \"y \u2208 f ` s\"\n  then show \"y \u2208 f ` t\"\n  proof (rule imageE)\n    fix x\n    assume \"y = f x\"\n    assume \"x \u2208 s\"\n    then have \"x \u2208 t\"\n      using \u2039s \u2286 t\u203a by (simp only: set_rev_mp)\n    then have \"f x \u2208 f ` t\"\n      by (rule imageI)\n    with \u2039y = f x\u203a show \"y \u2208 f ` t\"\n      by (rule ssubst)\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\nlemma\n  assumes \"s \u2286 t\"\n  shows \"f ` s \u2286 f ` t\"\nproof\n  fix y\n  assume \"y \u2208 f ` s\"\n  then show \"y \u2208 f ` t\"\n  proof\n    fix x\n    assume \"y = f x\"\n    assume \"x \u2208 s\"\n    then have \"x \u2208 t\"\n      using \u2039s \u2286 t\u203a by (simp only: set_rev_mp)\n    then have \"f x \u2208 f ` t\"\n      by simp\n    with \u2039y = f x\u203a show \"y \u2208 f ` t\"\n      by simp\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\nlemma\n  assumes \"s \u2286 t\"\n  shows \"f ` s \u2286 f ` t\"\n  using assms\n  by blast\n\n(* 4\u00aa demostraci\u00f3n *)\nlemma\n  assumes \"s \u2286 t\"\n  shows \"f ` s \u2286 f ` t\"\n  using assms\n  by (simp only: image_mono)\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que si &#92;(s \u2286 t&#92;), entonces &#92;(f[s] \u2286 f[t]&#92;). Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Set.Function import Mathlib.Tactic open Set variable {\u03b1 \u03b2 : Type _} variable (f : \u03b1 \u2192 \u03b2) variable (s t : Set \u03b1) example (h : s \u2286 t) : f \u00bb s \u2286 f \u00bb t := 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\/2358"}],"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=2358"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2358\/revisions"}],"predecessor-version":[{"id":2359,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2358\/revisions\/2359"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}