{"id":7408,"date":"2020-09-22T12:50:42","date_gmt":"2020-09-22T10:50:42","guid":{"rendered":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/?p=7408"},"modified":"2020-12-20T12:51:25","modified_gmt":"2020-12-20T11:51:25","slug":"formatus-pruebas-en-lean-de-p-%e2%88%a7-q-%e2%86%94-q-%e2%88%a7-p","status":"publish","type":"post","link":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/formatus-pruebas-en-lean-de-p-%e2%88%a7-q-%e2%86%94-q-%e2%88%a7-p\/","title":{"rendered":"ForMatUS: Pruebas en Lean de P \u2227 Q \u2194 Q \u2227 P"},"content":{"rendered":"<p>He a\u00f1adido a la lista <a href=\"https:\/\/bit.ly\/2FcUrwQ\">L\u00f3gica con Lean<\/a> el <a href=\"https:\/\/youtu.be\/CX55HDaKV7M\">v\u00eddeo<\/a> en el que se comentan 13 pruebas en Lean de<\/p>\n<pre lang=\"lean\">P \u2227 Q \u2194 Q \u2227 P\n<\/pre>\n<p>usando los estilos declarativos, aplicativos, funcional y autom\u00e1tico.<\/p>\n<p>A continuaci\u00f3n, se muestra el v\u00eddeo<\/p>\n<p><center><\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/CX55HDaKV7M\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\" data-mce-fragment=\"1\"><\/iframe><\/p>\n<p><\/center>y el <a href=\"https:\/\/github.com\/jaalonso\/Logica_con_Lean\/blob\/master\/src\/1_Proposicional\/Regla_de_introduccion_del_bicondicional_en_P%E2%88%A7Q%E2%86%94Q%E2%88%A7P.lean\">c\u00f3digo<\/a> de la teor\u00eda utilizada<\/p>\n<pre lang=\"lean\">-- ----------------------------------------------------\n-- Ej. 1. (p. 17) Demostrar\n--    P \u2227 Q \u2194 Q \u2227 P\n-- ----------------------------------------------------\n\nimport tactic\n\nvariables (P Q : Prop)\n\n-- 1\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\niff.intro\n  ( assume h1 : P \u2227 Q,\n    have h2 : P,\n      from and.elim_left h1,\n    have h3 : Q,\n      from and.elim_right h1,\n    show Q \u2227 P,\n      from and.intro h3 h2)\n  ( assume h4 : Q \u2227 P,\n    have h5 : Q,\n      from and.elim_left h4,\n    have h6 : P,\n      from and.elim_right h4,\n    show P \u2227 Q,\n      from and.intro h6 h5)\n\n-- 2\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\niff.intro\n  ( assume h1 : P \u2227 Q,\n    have h2 : P,\n      from h1.1,\n    have h3 : Q,\n      from h1.2,\n    show Q \u2227 P,\n      from and.intro h3 h2)\n  ( assume h4 : Q \u2227 P,\n    have h5 : Q,\n      from h4.1,\n    have h6 : P,\n      from h4.2,\n    show P \u2227 Q,\n      from and.intro h6 h5)\n\n-- 3\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\niff.intro\n  ( assume h1 : P \u2227 Q,\n    have h2 : P := h1.1,\n    have h3 : Q := h1.2,\n    show Q \u2227 P,\n      from and.intro h3 h2)\n  ( assume h4 : Q \u2227 P,\n    have h5 : Q := h4.1,\n    have h6 : P := h4.2,\n    show P \u2227 Q,\n      from and.intro h6 h5)\n\n-- 4\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\niff.intro\n  ( assume h1 : P \u2227 Q,\n    show Q \u2227 P,\n      from and.intro h1.2 h1.1)\n  ( assume h4 : Q \u2227 P,\n    show P \u2227 Q,\n      from and.intro h4.2 h4.1)\n\n-- 5\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\niff.intro\n  ( assume h1 : P \u2227 Q, and.intro h1.2 h1.1)\n  ( assume h4 : Q \u2227 P, and.intro h4.2 h4.1)\n\n-- 6\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\niff.intro\n  ( assume h1 : P \u2227 Q, \u27e8h1.2, h1.1\u27e9)\n  ( assume h4 : Q \u2227 P, \u27e8h4.2, h4.1\u27e9)\n\n-- 7\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\niff.intro\n  (\u03bb h, \u27e8h.2, h.1\u27e9)\n  (\u03bb h, \u27e8h.2, h.1\u27e9)\n\n-- 8\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\niff.intro\n  (\u03bb \u27e8hP, hQ\u27e9, \u27e8hQ, hP\u27e9)\n  (\u03bb \u27e8hQ, hP\u27e9, \u27e8hP, hQ\u27e9)\n\n-- 9\u00aa demostraci\u00f3n\nlemma aux :\n  P \u2227 Q \u2192 Q \u2227 P :=\n\u03bb h, \u27e8h.2, h.1\u27e9\n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\niff.intro (aux P Q) (aux Q P)\n\n-- 10\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\n-- by library_search\nand.comm\n\n-- 11\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\nbegin\n  split,\n  { intro h1,\n    cases h1 with h2 h3,\n    split,\n    { exact h3, },\n    { exact h2, }},\n  { intro h4,\n    cases h4 with h5 h6,\n    split,\n    { exact h6, },\n    { exact h5, }},\nend\n\n-- 12\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\nbegin\n  split,\n  { rintro \u27e8h2, h3\u27e9,\n    split,\n    { exact h3, },\n    { exact h2, }},\n  { rintro \u27e8h5, h6\u27e9,\n    split,\n    { exact h6, },\n    { exact h5, }},\nend\n\n-- 13\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\nbegin\n  constructor,\n  { rintro \u27e8h2, h3\u27e9,\n    constructor,\n    { exact h3, },\n    { exact h2, }},\n  { rintro \u27e8h5, h6\u27e9,\n    constructor,\n    { exact h6, },\n    { exact h5, }},\nend\n\n-- 14\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\n-- by hint\nby tauto\n\n-- 15\u00aa demostraci\u00f3n\nexample : P \u2227 Q \u2194 Q \u2227 P :=\nby finish\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>He a\u00f1adido a la lista L\u00f3gica con Lean el v\u00eddeo en el que se comentan 13 pruebas en Lean de P \u2227 Q \u2194 Q \u2227 P usando los estilos declarativos, aplicativos, funcional y autom\u00e1tico. A continuaci\u00f3n, se muestra el v\u00eddeo y el c\u00f3digo de la teor\u00eda utilizada &#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212; Ej. 1. (p. 17)&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","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,"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[335],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/7408"}],"collection":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/comments?post=7408"}],"version-history":[{"count":1,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/7408\/revisions"}],"predecessor-version":[{"id":7409,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/posts\/7408\/revisions\/7409"}],"wp:attachment":[{"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/media?parent=7408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/categories?post=7408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glc.us.es\/~jalonso\/vestigium\/wp-json\/wp\/v2\/tags?post=7408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}