        {"id":2387,"date":"2024-04-12T16:46:56","date_gmt":"2024-04-12T14:46:56","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2387"},"modified":"2024-04-12T16:48:03","modified_gmt":"2024-04-12T14:48:03","slug":"12-abr-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/12-abr-24\/","title":{"rendered":"f[s \u2229 t] \u2286 f[s] \u2229 f[t]"},"content":{"rendered":"\n<p>Demostrar con Lean4 que<br \/>\n&#92;[ f[s \u2229 t] \u2286 f[s] \u2229 f[t]\u200b &#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 : f '' (s \u2229 t) \u2286 f '' s \u2229 f '' t :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Sea tal que<br \/>\n&#92;[ y \u2208 f[s \u2229 t] &#92;]<br \/>\nPor tanto, existe un &#92;(x&#92;) tal que<br \/>\n&#92;begin{align}<br \/>\n  x \u2208 s \u2229 t  &#92;tag{1} &#92;&#92;<br \/>\n  f(x) = y   &#92;tag{2}<br \/>\n&#92;end{align}<br \/>\nPor (1), se tiene que<br \/>\n&#92;begin{align}<br \/>\n  x \u2208 s      &#92;tag{3} &#92;&#92;<br \/>\n  x \u2208 t      &#92;tag{4}<br \/>\n&#92;end{align}<br \/>\nPor (2) y (3), se tiene<br \/>\n&#92;[ y \u2208 f[s] &#92;tag{5} &#92;]<br \/>\nPor (2) y (4), se tiene<br \/>\n&#92;[ y \u2208 f[t] &#92;tag{6} &#92;]<br \/>\nPor (5) y (6), se tiene<br \/>\n&#92;[ y \u2208 f[s] \u2229 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 : f '' (s \u2229 t) \u2286 f '' s \u2229 f '' t :=\nby\n  intros y hy\n  -- y : \u03b2\n  -- hy : y \u2208 f '' (s \u2229 t)\n  -- \u22a2 y \u2208 f '' s \u2229 f '' t\n  rcases hy with \u27e8x, hx\u27e9\n  -- x : \u03b1\n  -- hx : x \u2208 s \u2229 t \u2227 f x = y\n  rcases hx with \u27e8xst, fxy\u27e9\n  -- xst : x \u2208 s \u2229 t\n  -- fxy : f x = y\n  constructor\n  . -- \u22a2 y \u2208 f '' s\n    use x\n    -- \u22a2 x \u2208 s \u2227 f x = y\n    constructor\n    . -- \u22a2 x \u2208 s\n      exact xst.1\n    . -- \u22a2 f x = y\n      exact fxy\n  . -- \u22a2 y \u2208 f '' t\n    use x\n    -- \u22a2 x \u2208 t \u2227 f x = y\n    constructor\n    . -- \u22a2 x \u2208 t\n      exact xst.2\n    . -- \u22a2 f x = y\n      exact fxy\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u2229 t) \u2286 f '' s \u2229 f '' t :=\nby\n  intros y hy\n  -- y : \u03b2\n  -- hy : y \u2208 f '' (s \u2229 t)\n  -- \u22a2 y \u2208 f '' s \u2229 f '' t\n  rcases hy with \u27e8x, \u27e8xs, xt\u27e9, fxy\u27e9\n  -- x : \u03b1\n  -- fxy : f x = y\n  -- xs : x \u2208 s\n  -- xt : x \u2208 t\n  constructor\n  . -- \u22a2 y \u2208 f '' s\n    use x\n    -- \u22a2 x \u2208 s \u2227 f x = y\n    exact \u27e8xs, fxy\u27e9\n  . -- \u22a2 y \u2208 f '' t\n    use x\n    -- \u22a2 x \u2208 t \u2227 f x = y\n    exact \u27e8xt, fxy\u27e9\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u2229 t) \u2286 f '' s \u2229 f '' t :=\nimage_inter_subset f s t\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : f '' (s \u2229 t) \u2286 f '' s \u2229 f '' t :=\nby intro ; aesop\n\n-- Lemas usados\n-- ============\n\n-- #check (image_inter_subset f s t : f '' (s \u2229 t) \u2286 f '' s \u2229 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\/Imagen_de_la_interseccion.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_de_la_interseccion\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (s \u2229 t) \u2286 f ` s \u2229 f ` t\"\nproof (rule subsetI)\n  fix y\n  assume \"y \u2208 f ` (s \u2229 t)\"\n  then have \"y \u2208 f ` s\"\n  proof (rule imageE)\n    fix x\n    assume \"y = f x\"\n    assume \"x \u2208 s \u2229 t\"\n    have \"x \u2208 s\"\n      using \u2039x \u2208 s \u2229 t\u203a by (rule IntD1)\n    then have \"f x \u2208 f ` s\"\n      by (rule imageI)\n    with \u2039y = f x\u203a show \"y \u2208 f ` s\"\n      by (rule ssubst)\n  qed\n  moreover\n  note \u2039y \u2208 f ` (s \u2229 t)\u203a\n  then have \"y \u2208 f ` t\"\n  proof (rule imageE)\n    fix x\n    assume \"y = f x\"\n    assume \"x \u2208 s \u2229 t\"\n    have \"x \u2208 t\"\n      using \u2039x \u2208 s \u2229 t\u203a by (rule IntD2)\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\n  ultimately show \"y \u2208 f ` s \u2229 f ` t\"\n    by (rule IntI)\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (s \u2229 t) \u2286 f ` s \u2229 f ` t\"\nproof\n  fix y\n  assume \"y \u2208 f ` (s \u2229 t)\"\n  then have \"y \u2208 f ` s\"\n  proof\n    fix x\n    assume \"y = f x\"\n    assume \"x \u2208 s \u2229 t\"\n    have \"x \u2208 s\"\n      using \u2039x \u2208 s \u2229 t\u203a by simp\n    then have \"f x \u2208 f ` s\"\n      by simp\n    with \u2039y = f x\u203a show \"y \u2208 f ` s\"\n      by simp\n  qed\n  moreover\n  note \u2039y \u2208 f ` (s \u2229 t)\u203a\n  then have \"y \u2208 f ` t\"\n  proof\n    fix x\n    assume \"y = f x\"\n    assume \"x \u2208 s \u2229 t\"\n    have \"x \u2208 t\"\n      using \u2039x \u2208 s \u2229 t\u203a by simp\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\n  ultimately show \"y \u2208 f ` s \u2229 f ` t\"\n    by simp\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (s \u2229 t) \u2286 f ` s \u2229 f ` t\"\nproof\n  fix y\n  assume \"y \u2208 f ` (s \u2229 t)\"\n  then obtain x where hx : \"y = f x \u2227 x \u2208 s \u2229 t\" by auto\n  then have \"y = f x\" by simp\n  have \"x \u2208 s\" using hx by simp\n  have \"x \u2208 t\" using hx by simp\n  have \"y \u2208  f ` s\" using \u2039y = f x\u203a \u2039x \u2208 s\u203a by simp\n  moreover\n  have \"y \u2208  f ` t\" using \u2039y = f x\u203a \u2039x \u2208 t\u203a by simp\n  ultimately show \"y \u2208 f ` s \u2229 f ` t\"\n    by simp\nqed\n\n(* 4\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (s \u2229 t) \u2286 f ` s \u2229 f ` t\"\n  by (simp only: image_Int_subset)\n\n(* 5\u00aa demostraci\u00f3n *)\n\nlemma \"f ` (s \u2229 t) \u2286 f ` s \u2229 f ` t\"\n  by auto\n\nend\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que &#92;[ f[s \u2229 t] \u2286 f[s] \u2229 f[t]\u200b &#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 : f \u00bb (s \u2229 t) \u2286 f \u00bb s \u2229 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\/2387"}],"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=2387"}],"version-history":[{"count":2,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2387\/revisions"}],"predecessor-version":[{"id":2389,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2387\/revisions\/2389"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}