        {"id":681,"date":"2021-08-24T06:00:50","date_gmt":"2021-08-24T04:00:50","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=681"},"modified":"2021-08-21T16:49:28","modified_gmt":"2021-08-21T14:49:28","slug":"el-conjunto-de-las-clases-de-equivalencia-es-una-particion","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/el-conjunto-de-las-clases-de-equivalencia-es-una-particion\/","title":{"rendered":"El conjunto de las clases de equivalencia es una partici\u00f3n"},"content":{"rendered":"<p>Demostrar que si R es una relaci\u00f3n de equivalencia en X, entonces las clases de equivalencia de R es una partici\u00f3n de X.<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean:<\/p>\n<pre lang=\"lean\">\nimport tactic\n\nvariable  {X : Type}\nvariables {x y: X}\nvariable  {R : X \u2192 X \u2192 Prop}\n\ndef clase (R : X \u2192 X \u2192 Prop) (x : X) :=\n  {y : X | R x y}\n\ndef particion (A : set (set X)) : Prop :=\n  (\u2200 x, (\u2203 B \u2208 A, x \u2208 B \u2227 \u2200 C \u2208 A, x \u2208 C \u2192 B = C)) \u2227 \u2205 \u2209 A\n\nexample\n  (h : equivalence R)\n  : particion {a : set X | \u2203 s : X, a = clase R s} :=\nsorry\n<\/pre>\n<p>[expand title=\u00bbSoluciones con Lean\u00bb]<\/p>\n<pre lang=\"lean\">\r\nimport tactic\r\n\r\nvariable  {X : Type}\r\nvariables {x y: X}\r\nvariable  {R : X \u2192 X \u2192 Prop}\r\n\r\ndef clase (R : X \u2192 X \u2192 Prop) (x : X) :=\r\n  {y : X | R x y}\r\n\r\ndef particion (A : set (set X)) : Prop :=\r\n  (\u2200 x, (\u2203 B \u2208 A, x \u2208 B \u2227 \u2200 C \u2208 A, x \u2208 C \u2192 B = C)) \u2227 \u2205 \u2209 A\r\n\r\nlemma aux\r\n  (h : equivalence R)\r\n  (hxy : R x y)\r\n  : clase R y \u2286 clase R x :=\r\n\u03bb z hz, h.2.2 hxy hz\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample\r\n  (h : equivalence R)\r\n  : particion {a : set X | \u2203 s : X, a = clase R s} :=\r\nbegin\r\n  split,\r\n  { simp,\r\n    intro y,\r\n    use (clase R y),\r\n    split,\r\n    { use y, },\r\n    { split,\r\n      { exact h.1 y, },\r\n      { intros x hx,\r\n        apply le_antisymm,\r\n        { exact aux h hx, },\r\n        { exact aux h (h.2.1 hx), }}}},\r\n  { simp,\r\n    intros x hx,\r\n    have h1 : x \u2208 clase R x := h.1 x,\r\n    rw \u2190 hx at h1,\r\n    exact set.not_mem_empty x h1, },\r\nend\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample\r\n  (h : equivalence R)\r\n  : particion {a : set X | \u2203 s : X, a = clase R s} :=\r\nbegin\r\n  split,\r\n  { simp,\r\n    intro y,\r\n    use (clase R y),\r\n    split,\r\n    { use y, },\r\n    { split,\r\n      { exact h.1 y, },\r\n      { intros x hx,\r\n        exact le_antisymm (aux h hx) (aux h (h.2.1 hx)), }}},\r\n  { simp,\r\n    intros x hx,\r\n    have h1 : x \u2208 clase R x := h.1 x,\r\n    rw \u2190 hx at h1,\r\n    exact set.not_mem_empty x h1, },\r\nend\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample\r\n  (h : equivalence R)\r\n  : particion {a : set X | \u2203 s : X, a = clase R s} :=\r\nbegin\r\n  split,\r\n  { simp,\r\n    intro y,\r\n    use [clase R y,\r\n         \u27e8by use y,\r\n          \u27e8h.1 y, \u03bb x hx, le_antisymm (aux h hx) (aux h (h.2.1 hx))\u27e9\u27e9], },\r\n  { simp,\r\n    intros x hx,\r\n    have h1 : x \u2208 clase R x := h.1 x,\r\n    rw \u2190 hx at h1,\r\n    exact set.not_mem_empty x h1, },\r\nend\r\n<\/pre>\n<p>Se puede interactuar con la prueba anterior en <a href=\"https:\/\/leanprover-community.github.io\/lean-web-editor\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Calculemus\/main\/src\/El_conjunto_de_las_clases_de_equivalencia_es_una_particion.lean\" rel=\"noopener noreferrer\" target=\"_blank\">esta sesi\u00f3n con Lean<\/a>.<\/p>\n<p>En los comentarios se pueden escribir otras soluciones, escribiendo el c\u00f3digo entre una l\u00ednea con &#60;pre lang=&quot;lean&quot;&#62; y otra con &#60;\/pre&#62;<br \/>\n[\/expand]<\/p>\n<p>[expand title=\u00bbSoluciones con Isabelle\/HOL\u00bb]<\/p>\n<pre lang=\"isar\">\r\ntheory El_conjunto_de_las_clases_de_equivalencia_es_una_particion\r\nimports Main\r\nbegin\r\n\r\ndefinition clase :: \"('a \u21d2 'a \u21d2 bool) \u21d2 'a \u21d2 'a set\"\r\n  where \"clase R x = {y. R x y}\"\r\n\r\ndefinition particion :: \"('a set) set \u21d2 bool\" where\r\n  \"particion P \u27f7 (\u2200x. (\u2203B\u2208P. x \u2208 B \u2227 (\u2200C\u2208P. x \u2208 C \u27f6 B = C))) \u2227 {} \u2209 P\"\r\n\r\nlemma\r\n  fixes   R :: \"'a \u21d2 'a \u21d2 bool\"\r\n  assumes \"equivp R\"\r\n  shows   \"particion (\u22c3x. {clase R x})\" (is \"particion ?P\")\r\nproof (unfold particion_def; intro conjI)\r\n  show \"(\u2200x. \u2203B\u2208?P. x \u2208 B \u2227 (\u2200C\u2208?P. x \u2208 C \u27f6 B = C))\"\r\n  proof (intro allI)\r\n    fix x\r\n    have \"clase R x \u2208 ?P\"\r\n      by auto\r\n    moreover have \"x \u2208 clase R x\"\r\n      using assms clase_def equivp_def\r\n      by (metis CollectI)\r\n    moreover have \"\u2200C\u2208?P. x \u2208 C \u27f6 clase R x = C\"\r\n    proof\r\n      fix C\r\n      assume \"C \u2208 ?P\"\r\n      then obtain y where \"C = clase R y\"\r\n        by auto\r\n      show \"x \u2208 C \u27f6 clase R x = C\"\r\n      proof\r\n        assume \"x \u2208 C\"\r\n        then have \"R y x\"\r\n          using \u2039C = clase R y\u203a assms clase_def\r\n          by (metis CollectD)\r\n        then show \"clase R x = C\"\r\n          using assms \u2039C = clase R y\u203a clase_def equivp_def\r\n          by metis\r\n      qed\r\n    qed\r\n    ultimately show \"\u2203B\u2208?P. x \u2208 B \u2227 (\u2200C\u2208?P. x \u2208 C \u27f6 B = C)\"\r\n      by blast\r\n  qed\r\nnext\r\n  show \"{} \u2209 ?P\"\r\n  proof\r\n    assume \"{} \u2208 ?P\"\r\n    then obtain x where \"{} = clase R x\"\r\n      by auto\r\n    moreover have \"x \u2208 clase R x\"\r\n      using assms clase_def equivp_def\r\n      by (metis CollectI)\r\n    ultimately show False\r\n      by simp\r\n  qed\r\nqed\r\n\r\nend\r\n<\/pre>\n<p>En los comentarios se pueden escribir otras soluciones, escribiendo el c\u00f3digo entre una l\u00ednea con &#60;pre lang=&quot;isar&quot;&#62; y otra con &#60;\/pre&#62;<br \/>\n[\/expand]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar que si R es una relaci\u00f3n de equivalencia en X, entonces las clases de equivalencia de R es una partici\u00f3n de X. Para ello, completar la siguiente teor\u00eda de Lean: import tactic variable {X : Type} variables {x y: X} variable {R : X \u2192 X \u2192 Prop} def clase (R : X \u2192 X \u2192 Prop) (x : X) := {y : X | R x y} def particion (A : set (set X)) : Prop := (\u2200 x, (\u2203 B \u2208 A, x \u2208 B \u2227 \u2200 C \u2208 A, x \u2208 C \u2192 B = C)) \u2227 \u2205 \u2209 A example (h : equivalence R) : particion {a : set X | \u2203 s : X, a = clase R s}&#8230;<\/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":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_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":[30],"tags":[90,77,92,117,116,58,113,118,115,60,100,114,109,108,49,43,63,110,112,111,99,48,46],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/681"}],"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=681"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/681\/revisions"}],"predecessor-version":[{"id":682,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/681\/revisions\/682"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}