        {"id":1552,"date":"2023-09-13T06:00:08","date_gmt":"2023-09-13T04:00:08","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/?p=1552"},"modified":"2023-08-24T17:15:50","modified_gmt":"2023-08-24T15:15:50","slug":"13-sep-23","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/13-sep-23\/","title":{"rendered":"Si x divide a w, entonces tambi\u00e9n divide a y(xz)+x\u00b2+w\u00b2"},"content":{"rendered":"<p>Demostrar con Lean4 que si \\(x\\) divide a \\(w\\), entonces tambi\u00e9n divide a \\(y(xz)+x^2+w^2\\).<\/p>\n<p>Para ello, completar la siguiente teor\u00eda de Lean4:<\/p>\n<pre lang=\"lean\">\r\nimport Mathlib.Data.Real.Basic\r\nvariable (w x y z : \u2115)\r\n\r\nexample\r\n  (h : x \u2223 w)\r\n  : x \u2223 y * (x * z) + x^2 + w^2 :=\r\nby sorry\r\n<\/pre>\n<p><!--more--><\/p>\n<p><b>Demostraci\u00f3n en lenguaje natural<\/b><\/p>\n<p><br \/>\nPor la divisibilidad de la suma basta probar que<br \/>\n\\begin{align}<br \/>\n   x &#038;\\mid yxz \\tag{1} \\\\<br \/>\n   x &#038;\\mid x^2 \\tag{2} \\\\<br \/>\n   x &#038;\\mid w^2 \\tag{3}<br \/>\n\\end{align}<\/p>\n<p>Para demostrar (1), por la divisibilidad del producto se tiene<br \/>\n\\[   x \\mid xz\\]<br \/>\ny, de nuevo por la divisibilidad del producto,<br \/>\n\\[   x \\mid y(xz)\\]<\/p>\n<p>La propiedad (2) se tiene por la definici\u00f3n de cuadrado y la divisibilidad del producto.<\/p>\n<p>La propiedad (3) se tiene por la definici\u00f3n de cuadrado, la hip\u00f3tesis y la divisibilidad del producto.<\/p>\n<p><b>Demostraciones con Lean4<\/b><\/p>\n<pre lang=\"lean\">\r\nimport Mathlib.Data.Real.Basic\r\nvariable (w x y z : \u2115)\r\n\r\n-- 1\u00aa demostraci\u00f3n\r\nexample\r\n  (h : x \u2223 w)\r\n  : x \u2223 y * (x * z) + x^2 + w^2 :=\r\nby\r\n  have h1 : x \u2223 x * z :=\r\n    dvd_mul_right x z\r\n  have h2 : x \u2223 y * (x * z) :=\r\n    dvd_mul_of_dvd_right h1 y\r\n  have h3 : x \u2223 x^2 := by\r\n    apply dvd_mul_left\r\n  have h4 : x \u2223 w * w :=\r\n    dvd_mul_of_dvd_left h w\r\n  have h5 : x \u2223 w^2 := by\r\n    rwa [\u2190 pow_two w] at h4\r\n  have h6 : x \u2223 y * (x * z) + x^2 :=\r\n    dvd_add h2 h3\r\n  show x \u2223 y * (x * z) + x^2 + w^2\r\n  exact dvd_add h6 h5\r\n\r\n-- 2\u00aa demostraci\u00f3n\r\nexample\r\n  (h : x \u2223 w)\r\n  : x \u2223 y * (x * z) + x^2 + w^2 :=\r\nby\r\n  apply dvd_add\r\n  { apply dvd_add\r\n    { apply dvd_mul_of_dvd_right\r\n      apply dvd_mul_right }\r\n    { rw [pow_two]\r\n      apply dvd_mul_right }}\r\n  { rw [pow_two]\r\n    apply dvd_mul_of_dvd_left h }\r\n\r\n-- 3\u00aa demostraci\u00f3n\r\nexample\r\n  (h : x \u2223 w)\r\n  : x \u2223 y * (x * z) + x^2 + w^2 :=\r\nby\r\n  repeat' apply dvd_add\r\n  { apply dvd_mul_of_dvd_right\r\n    apply dvd_mul_right }\r\n  { rw [pow_two]\r\n    apply dvd_mul_right }\r\n  { rw [pow_two]\r\n    apply dvd_mul_of_dvd_left h }\r\n\r\n-- Lemas usados\r\n-- ============\r\n\r\n-- #check (dvd_add : x \u2223 y \u2192 x \u2223 z \u2192 x \u2223 y + z)\r\n-- #check (dvd_mul_left x y : x \u2223 y * x)\r\n-- #check (dvd_mul_right x y : x \u2223 x * y)\r\n-- #check (dvd_mul_of_dvd_left : x \u2223 y \u2192 \u2200 (c : \u2115), x \u2223 y * c)\r\n-- #check (dvd_mul_of_dvd_right : x \u2223 y \u2192 \u2200 (c : \u2115), x \u2223 c * y)\r\n-- #check (pow_two x : x ^ 2 = x * x)\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\/Ejercicio_de_divisibilidad.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. 19.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Demostrar con Lean4 que si \\(x\\) divide a \\(w\\), entonces tambi\u00e9n divide a \\(y(xz)+x^2+w^2\\). Para ello, completar la siguiente teor\u00eda de Lean4: import Mathlib.Data.Real.Basic variable (w x y z : \u2115) example (h : x \u2223 w) : x \u2223 y * (x * z) + x^2 + w^2 := 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":"","_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":[291,297],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1552"}],"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=1552"}],"version-history":[{"count":3,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1552\/revisions"}],"predecessor-version":[{"id":1555,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/posts\/1552\/revisions\/1555"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/media?parent=1552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/categories?post=1552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/calculemus\/wp-json\/wp\/v2\/tags?post=1552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}