        {"id":1418,"date":"2023-08-01T06:00:53","date_gmt":"2023-08-01T04:00:53","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=1418"},"modified":"2023-07-27T09:16:42","modified_gmt":"2023-07-27T07:16:42","slug":"01-ago-23","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/01-ago-23\/","title":{"rendered":"Si R es un anillo y a, b, c \u2208 R tales que a+b=a+c, entonces b=c"},"content":{"rendered":"<p>Demostrar con Lean4 que si R es un anillo y a, b, c \u2208 R tales que<\/p>\n<pre lang=\"text\">\r\n   a + b = a + c\r\n<\/pre>\n<p>entonces<\/p>\n<pre lang=\"text\">\r\n   b = c\r\n<\/pre>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\r\nimport Mathlib.Algebra.Ring.Defs\r\nimport Mathlib.Tactic\r\n\r\nvariable {R : Type _} [Ring R]\r\nvariable {a b c : R}\r\n\r\nexample\r\n  (h : a + b = a + c)\r\n  : b = c :=\r\nsorry\r\n<\/pre>\n<p><!--more--><\/p>\n<p><b>Demostraci\u00f3n en lenguaje natural (LN)<\/b><\/p>\n<p><br \/>\n<b>1\u00aa demostraci\u00f3n en LN<\/b><\/p>\n<p>Por la siguiente cadena de igualdades<br \/>\n\\begin{align}<br \/>\nb &#038;= 0 + b           &#038;&#038;\\text{[por suma con cero]} \\\\<br \/>\n  &#038;= (-a + a) + b    &#038;&#038;\\text{[por suma con opuesto]} \\\\<br \/>\n  &#038;= -a + (a + b)    &#038;&#038;\\text{[por asociativa]} \\\\<br \/>\n  &#038;= -a + (a + c)    &#038;&#038;\\text{[por hip\u00f3tesis]} \\\\<br \/>\n  &#038;= (-a + a) + c    &#038;&#038;\\text{[por asociativa]} \\\\<br \/>\n  &#038;= 0 + c           &#038;&#038;\\text{[por suma con opuesto]} \\\\<br \/>\n  &#038;= c               &#038;&#038;\\text{[por suma con cero]}<br \/>\n\\end{align}<\/p>\n<p><b>2\u00aa demostraci\u00f3n en LN<\/b><\/p>\n<p>Por la siguiente cadena de implicaciones<br \/>\n\\begin{align}<br \/>\na + b = a + c<br \/>\n&#038;\\Longrightarrow -a + (a + b) = -a + (a + c)     &#038;&#038;\\text{[sumando -a]} \\\\<br \/>\n&#038;\\Longrightarrow  (-a + a) + b = (-a + a) + c    &#038;&#038;\\text{[por la asociativa]} \\\\<br \/>\n&#038;\\Longrightarrow  0 + b = 0 + b                  &#038;&#038;\\text{[suma con opuesto]} \\\\<br \/>\n&#038;\\Longrightarrow  b = c                          &#038;&#038;\\text{[suma con cero]}<br \/>\n\\end{align}<\/p>\n<p><b>3\u00aa demostraci\u00f3n en LN<\/b><\/p>\n<p>Por la siguiente cadena de igualdades<br \/>\n\\begin{align}<br \/>\nb &#038;= -a + (a + b)   \\\\<br \/>\n  &#038;= -a + (a + c)   &#038;&#038;\\text{[por la hip\u00f3tesis]} \\\\<br \/>\n  &#038;= c<br \/>\n\\end{align}<\/p>\n<p><b>Demostraciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\r\nimport Mathlib.Algebra.Ring.Defs\r\nimport Mathlib.Tactic\r\n\r\nvariable {R : Type _} [Ring R]\r\nvariable {a b c : R}\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample\r\n  (h : a + b = a + c)\r\n  : b = c :=\r\ncalc\r\n  b = 0 + b        := by rw [zero_add]\r\n  _ = (-a + a) + b := by rw [add_left_neg]\r\n  _ = -a + (a + b) := by rw [add_assoc]\r\n  _ = -a + (a + c) := by rw [h]\r\n  _ = (-a + a) + c := by rw [\u2190add_assoc]\r\n  _ = 0 + c        := by rw [add_left_neg]\r\n  _ = c            := by rw [zero_add]\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample\r\n  (h : a + b = a + c)\r\n  : b = c :=\r\nby\r\n  have h1 : -a + (a + b) = -a + (a + c) :=\r\n    congrArg (HAdd.hAdd (-a)) h\r\n  clear h\r\n  rw [\u2190 add_assoc] at h1\r\n  rw [add_left_neg] at h1\r\n  rw [zero_add] at h1\r\n  rw [\u2190 add_assoc] at h1\r\n  rw [add_left_neg] at h1\r\n  rw [zero_add] at h1\r\n  exact h1\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample\r\n  (h : a + b = a + c)\r\n  : b = c :=\r\ncalc\r\n  b = -a + (a + b) := by rw [neg_add_cancel_left a b]\r\n  _ = -a + (a + c) := by rw [h]\r\n  _ = c            := by rw [neg_add_cancel_left]\r\n\r\n-- 4\u00aa demostraci\u00f3n\r\nexample\r\n  (h : a + b = a + c)\r\n  : b = c :=\r\nby\r\n  rw [\u2190 neg_add_cancel_left a b]\r\n  rw [h]\r\n  rw [neg_add_cancel_left]\r\n\r\n-- 5\u00aa demostraci\u00f3n\r\nexample\r\n  (h : a + b = a + c)\r\n  : b = c :=\r\nby\r\n  rw [\u2190 neg_add_cancel_left a b, h, neg_add_cancel_left]\r\n\r\n-- 6\u00aa demostraci\u00f3n\r\nexample\r\n  (h : a + b = a + c)\r\n  : b = c :=\r\nadd_left_cancel h\r\n<\/pre>\n<p><b>Demostraciones interactivas<\/b><\/p>\n<p>Se puede interactuar con las demostraciones anteriores en <a href=\"https:\/\/lean.math.hhu.de\/#url=https:\/\/raw.githubusercontent.com\/jaalonso\/Calculemus2\/main\/src\/Cancelativa_izquierda.lean\" rel=\"noopener noreferrer\" target=\"_blank\">Lean 4 Web<\/a>.<\/p>\n<p><b>Referencias<\/b><\/p>\n<ul>\n<li> J. Avigad y P. Massot. <a href=\"https:\/\/bit.ly\/3U4UjBk\">Mathematics in Lean<\/a>, p. 11.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que si R es un anillo y a, b, c \u2208 R tales que a + b = a + c entonces b = c Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Algebra.Ring.Defs import Mathlib.Tactic variable {R : Type _} [Ring R] variable {a b c : R} example (h : a + b = a + c) : b = c := 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":"","_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":[1],"tags":[284,297],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1418"}],"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=1418"}],"version-history":[{"count":5,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1418\/revisions"}],"predecessor-version":[{"id":1424,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1418\/revisions\/1424"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=1418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=1418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=1418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}