        {"id":2288,"date":"2024-02-18T06:00:53","date_gmt":"2024-02-18T04:00:53","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=2288"},"modified":"2024-02-25T18:04:43","modified_gmt":"2024-02-25T16:04:43","slug":"28-feb-24","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/28-feb-24\/","title":{"rendered":"s \u2229 (s \u222a t) = s"},"content":{"rendered":"\n<p>Demostrar con Lean4 que<br \/>\n&#92;[ s \u2229 (s \u222a t) = s &#92;]<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Tactic\nopen Set\nvariable {\u03b1 : Type}\nvariable (s t : Set \u03b1)\n\nexample : s \u2229 (s \u222a t) = s :=\nby sorry\n<\/pre>\n<p><!--more--><\/p>\n<h2>1. Demostraci\u00f3n en lenguaje natural<\/h2>\n<p>Tenemos que demostrar que<br \/>\n&#92;[ (\u2200 x)[x \u2208 s \u2229 (s \u222a t) \u2194 x \u2208 s] &#92;]<br \/>\ny lo haremos demostrando las dos implicaciones.<\/p>\n<p>(\u27f9) Sea &#92;(x \u2208 s \u2229 (s \u222a t)&#92;). Entonces, &#92;(x \u2208 s&#92;).<\/p>\n<p>(\u27f8) Sea &#92;(x \u2208 s&#92;). Entonces, &#92;(x \u2208 s \u222a t&#92;) y, por tanto, &#92;(x \u2208 s \u2229 (s \u222a t)&#92;).<\/p>\n<h2>2. Demostraciones con Lean4<\/h2>\n<pre lang=\"lean\">\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Tactic\nopen Set\n\nvariable {\u03b1 : Type}\nvariable (s t : Set \u03b1)\n\n-- 1\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (s \u222a t) = s :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u2229 (s \u222a t) \u2194 x \u2208 s\n  constructor\n  . -- \u22a2 x \u2208 s \u2229 (s \u222a t) \u2192 x \u2208 s\n    intros h\n  -- h : x \u2208 s \u2229 (s \u222a t)\n  -- \u22a2 x \u2208 s\n    exact h.1\n  . -- \u22a2 x \u2208 s \u2192 x \u2208 s \u2229 (s \u222a t)\n    intro xs\n    -- xs : x \u2208 s\n    -- \u22a2 x \u2208 s \u2229 (s \u222a t)\n    constructor\n    . -- \u22a2 x \u2208 s\n      exact xs\n    . -- \u22a2 x \u2208 s \u222a t\n      left\n      -- \u22a2 x \u2208 s\n      exact xs\n\n-- 2\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (s \u222a t) = s :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u2229 (s \u222a t) \u2194 x \u2208 s\n  constructor\n  . -- \u22a2 x \u2208 s \u2229 (s \u222a t) \u2192 x \u2208 s\n    intro h\n    -- h : x \u2208 s \u2229 (s \u222a t)\n    -- \u22a2 x \u2208 s\n    exact h.1\n  . -- \u22a2 x \u2208 s \u2192 x \u2208 s \u2229 (s \u222a t)\n    intro xs\n    -- xs : x \u2208 s\n    -- \u22a2 x \u2208 s \u2229 (s \u222a t)\n    constructor\n    . -- \u22a2 x \u2208 s\n      exact xs\n    . -- \u22a2 x \u2208 s \u222a t\n      exact (Or.inl xs)\n\n-- 3\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (s \u222a t) = s :=\nby\n  ext\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u2229 (s \u222a t) \u2194 x \u2208 s\n  exact \u27e8fun h \u21a6 h.1,\n         fun xs \u21a6 \u27e8xs, Or.inl xs\u27e9\u27e9\n\n-- 4\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (s \u222a t) = s :=\nby\n  ext\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u2229 (s \u222a t) \u2194 x \u2208 s\n  exact \u27e8And.left,\n         fun xs \u21a6 \u27e8xs, Or.inl xs\u27e9\u27e9\n\n-- 5\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (s \u222a t) = s :=\nby\n  ext x\n  -- x : \u03b1\n  -- \u22a2 x \u2208 s \u2229 (s \u222a t) \u2194 x \u2208 s\n  constructor\n  . -- \u22a2 x \u2208 s \u2229 (s \u222a t) \u2192 x \u2208 s\n    rintro \u27e8xs, -\u27e9\n    -- xs : x \u2208 s\n    -- \u22a2 x \u2208 s\n    exact xs\n  . -- \u22a2 x \u2208 s \u2192 x \u2208 s \u2229 (s \u222a t)\n    intro xs\n    -- xs : x \u2208 s\n    -- \u22a2 x \u2208 s \u2229 (s \u222a t)\n    use xs\n    -- \u22a2 x \u2208 s \u222a t\n    left\n    -- \u22a2 x \u2208 s\n    exact xs\n\n-- 6\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (s \u222a t) = s :=\nby\n  apply subset_antisymm\n  . -- \u22a2 s \u2229 (s \u222a t) \u2286 s\n    rintro x \u27e8hxs, -\u27e9\n    -- x : \u03b1\n    -- hxs : x \u2208 s\n    -- \u22a2 x \u2208 s\n    exact hxs\n  . -- \u22a2 s \u2286 s \u2229 (s \u222a t)\n    intros x hxs\n    -- x : \u03b1\n    -- hxs : x \u2208 s\n    -- \u22a2 x \u2208 s \u2229 (s \u222a t)\n    exact \u27e8hxs, Or.inl hxs\u27e9\n\n-- 7\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (s \u222a t) = s :=\ninf_sup_self\n\n-- 8\u00aa demostraci\u00f3n\n-- ===============\n\nexample : s \u2229 (s \u222a t) = s :=\nby aesop\n\n-- Lemas usados\n-- ============\n\n-- variable (a b : Prop)\n-- #check (And.left : a \u2227 b \u2192 a)\n-- #check (Or.inl : a \u2192 a \u2228 b)\n-- #check (inf_sup_self : s \u2229 (s \u222a t) = s)\n-- #check (subset_antisymm : s \u2286 t \u2192 t \u2286 s \u2192 s = 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\/Interseccion_con_su_union.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<h2>3. Demostraciones con Isabelle\/HOL<\/h2>\n<pre lang=\"isar\">\ntheory Interseccion_con_su_union\nimports Main\nbegin\n\n(* 1\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 (s \u222a t) = s\"\nproof (rule  equalityI)\n  show \"s \u2229 (s \u222a t) \u2286 s\"\n  proof (rule subsetI)\n    fix x\n    assume \"x \u2208 s \u2229 (s \u222a t)\"\n    then show \"x \u2208 s\"\n      by (simp only: IntD1)\n  qed\nnext\n  show \"s \u2286 s \u2229 (s \u222a t)\"\n  proof (rule subsetI)\n    fix x\n    assume \"x \u2208 s\"\n    then have \"x \u2208 s \u222a t\"\n      by (simp only: UnI1)\n    with \u2039x \u2208 s\u203a show \"x \u2208 s \u2229 (s \u222a t)\"\n      by (rule IntI)\n  qed\nqed\n\n(* 2\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 (s \u222a t) = s\"\nproof\n  show \"s \u2229 (s \u222a t) \u2286 s\"\n  proof\n    fix x\n    assume \"x \u2208 s \u2229 (s \u222a t)\"\n    then show \"x \u2208 s\"\n      by simp\n  qed\nnext\n  show \"s \u2286 s \u2229 (s \u222a t)\"\n  proof\n    fix x\n    assume \"x \u2208 s\"\n    then have \"x \u2208 s \u222a t\"\n      by simp\n    then show \"x \u2208 s \u2229 (s \u222a t)\"\n      using \u2039x \u2208 s\u203a by simp\n  qed\nqed\n\n(* 3\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 (s \u222a t) = s\"\nby (fact Un_Int_eq)\n\n(* 4\u00aa demostraci\u00f3n *)\nlemma \"s \u2229 (s \u222a t) = s\"\nby auto\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que &#92;[ s \u2229 (s \u222a t) = s &#92;] Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Set.Basic import Mathlib.Tactic open Set variable {\u03b1 : Type} variable (s t : Set \u03b1) example : s \u2229 (s \u222a t) = 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":[7],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2288"}],"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=2288"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2288\/revisions"}],"predecessor-version":[{"id":2289,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/2288\/revisions\/2289"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=2288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=2288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=2288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}