Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Verificação de Programas

816 Aufrufe

Veröffentlicht am

Slides sobre Verificação de Programas baseados no livro de Silva, Finger e Melo

Veröffentlicht in: Bildung
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • Gehören Sie zu den Ersten, denen das gefällt!

Verificação de Programas

  1. 1. Verifica¸˜o de Programas ca Adolfo Neto (DAINF-UTFPR)http://www.dainf.ct.utfpr.edu.br/~adolfo November 6, 2012 Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  2. 2. Uma linguagem de programa¸˜o ca Sintaxe da linguagem: Express˜es Aritm´ticas: o e E ::= n|x|(−E )|(E + E )|(E − E )|(E ∗ E ) Express˜es L´gicas: o o B ::= true|false|(!B)|(B&B)|(E < E )|(E == E )|(E ! = E ) Comandos: C ::= x := E |C ; C |if B{C } else {C }|while B{C } Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  3. 3. Semˆntica Operacional a A semˆntica operacional “denota o efeito sobre o estado do a programa de cada comando da linguagem.” Representa¸˜o da execu¸˜o de um comando C : ca ca C, σ → σ onde σ ´ o estado antes da execu¸˜o do comando e σ ´ o e ca e estado depois da execu¸˜o do comando C . ca “A semˆntica operacional deve denotar os efeitos de todos os a comandos da linguagem e, para isso, deve ser definida sobre todos os comandos e express˜es da linguagem” o Fonte: (SILVA; FINGER; MELO, 2006, p.189). Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  4. 4. Regras da Semˆntica Operacional a Exemplo de regra (ex. 7.2.1 de (SILVA; FINGER; MELO, 2006, p.189)) – Atrib-Operacional: E, σ → m x := E , σ → σ[m/x] Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  5. 5. Exemplo Exemplo 7.2.2 (SILVA; FINGER; MELO, 2006, p.190). ´ E preciso definir a semˆntica operacional de todas as express˜es a o aritm´ticas e l´gicas, al´m dos comandos. e o e Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  6. 6. Mais sobre a Semˆntica Operacional a De (SILVA; FINGER; MELO, 2006, p.191): A semˆntica operacional n˜o faz uma representa¸˜o expl´ a a ca ıcita entre asser¸˜es que denotam as pr´ e p´s-condi¸˜es dos co e o co programas. ϕ Prog ψ (tripla de Hoare) Corre¸˜o parcial: para todo estado σ que satisfaz ϕ, se a ca execu¸˜o de Prog a partir do estado σ termina, produzindo ca um estado σ , ent˜o σ satisfaz ψ. a Queremos um sistema (c´lculo) de provas para provar a a validade da asser¸˜o “ ϕ Prog ψ ”: ca ϕ Prog ψ Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  7. 7. Mais sobre a Semˆntica Operacional a De (SILVA; FINGER; MELO, 2006, p.192): As precondi¸˜es ϕ s˜o propriedades sobre o estado inicial do co a programa Prog. Podemos ter um estado σ que satisfa¸a a asser¸˜o ϕ: c ca σ ϕ Portanto, ap´s a execu¸˜o de Prog sobre o estado σ, um o ca estado σ ´ produzido. E σ satisfaz ψ: e σ ϕ → Prog σ ψ onde Prog termina se executado sobre um estado que satisfaz ϕ e Prog σ representa o estado produzido por Prog ap´s sua o execu¸˜o sobre o estado σ. ca Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  8. 8. Mais sobre a Semˆntica Operacional a De (SILVA; FINGER; MELO, 2006, p.192): A asser¸˜o ca ϕ Prog ψ deve ser v´lida para TODOS os a estados que satisfazem ϕ: ∀σ(σ ϕ) → Prog σ ψ Assumimos que Prog termina quando executado sobre os estados σ. Na pr´tica temos programas que n˜o param. a a As provas de programas podem ser divididas em: provas quando assumimos que o programa p´ra; e a provas que tem como tarefa tamb´m provar a termina¸˜o do e ca programa. Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  9. 9. Mais sobre a Semˆntica Operacional: Corre¸˜o Parcial a ca De (SILVA; FINGER; MELO, 2006, p.192), def. 7.3.1: Corre¸˜o parcial: A tripla ca ϕ Prog ψ ´ satisfeita sob corre¸˜o parcial se, para todos os estados que e ca satisfazem ϕ, o estado resultante da execu¸˜o do programa ca Prog satisfaz a p´s-condi¸˜o ψ, se Prog termina. o ca Nesse caso, par ´ a rela¸˜o de satisfazibilidade para corre¸˜o e ca ca parcial: par ϕ Prog ψ Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  10. 10. Mais sobre a Semˆntica Operacional: Corre¸˜o Parcial a ca De (SILVA; FINGER; MELO, 2006, p.192), def. 7.3.1: Corre¸˜o parcial ´ um requisito ineficiente, na pr´tica, porque ca e a n˜o garante a termina¸˜o do programa. a ca Qualquer programa que n˜o termina satisfaz a sua a especifica¸˜o. ca Na outra no¸˜o de corre¸˜o (corre¸˜o total), a ca ca ca satisfazibilidade, bem como a termina¸˜o do programa, deve ca ser provada. Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  11. 11. Mais sobre a Semˆntica Operacional: Corre¸˜o Total a ca De (SILVA; FINGER; MELO, 2006, p.193), def. 7.3.2: Corre¸˜o total: A tripla ca ϕ Prog ψ ´ satisfeita sob corre¸˜o total se, para todos os estados que e ca satisfazem ϕ, o estado resultante da execu¸˜o do programa ca Prog satisfaz a p´s-condi¸˜o ψ e Prog termina. o ca Nesse caso, tot ´ a rela¸˜o de satisfazibilidade para corre¸˜o e ca ca total: tot ϕ Prog ψ Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  12. 12. Mais sobre a Semˆntica Operacional: Corre¸˜o Total a ca De (SILVA; FINGER; MELO, 2006, p.193): Qualque programa que entra em um la¸o infinito de repeti¸˜o c ca n˜o satisfaz sua especifica¸˜o sob a rela¸˜o de corre¸˜o total. a ca ca ca Essa rela¸˜o ´ muito mais util na pr´tica. ca e ´ a Provar corre¸˜o total de programas pode ser dividido em: ca 1. provar corre¸˜o parcial ca 2. provar que o programa termina Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  13. 13. Exemplos Demonstra¸˜es informais: co Exemplo 7.3.1 (SILVA; FINGER; MELO, 2006, p.193). Exemplo 7.3.2 (SILVA; FINGER; MELO, 2006, p.194-195). Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  14. 14. Corre¸˜o Parcial de Programas ca O sistema de provas prova ´ definido sobre cada elemento e sint´tico da linguagem a As provas s˜o realizadas usando indu¸˜o sobre as estruturas a ca dos programas Ou seja, as regras provam a corre¸˜o de uma asser¸˜o para ca ca um comando mais complexo pela prova de corre¸˜o das ca asser¸˜es de seus subcomandos. co Devemos distinguir dois elementos no sistema de provas: 1. as regras de inferˆncia sobre cada um dos elementos sint´ticos e a dos programas 2. o mecanismo de prova usando as regras definidas As regras s˜o chamadas regras de Hoare. O conjunto das a regras forma a l´gica de Hoare. o Fonte: (SILVA; FINGER; MELO, 2006, p.195). Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  15. 15. Regras da Semˆntica Operacional a Composi¸˜o: ca ϕ C1 η η C2 ψ ϕ C 1; C 2 ψ Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  16. 16. Regras da Semˆntica Operacional a Atribui¸˜o: ca ψ[E /x] x := E ψ A propriedade a ser satisfeita antes da atribui¸˜o ´ a pr´pria ψ com ca e o todas as ocorrˆncias de x substitu´ e ıdas pela express˜o E , ψ[E /x]. a Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  17. 17. Regras da Semˆntica Operacional a IfElse: φ ∧ B C1 ψ φ ∧ ¬B C 2 ψ φ if B{C 1}else {C 2} ψ Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  18. 18. Regras da Semˆntica Operacional a WhileParcial: η∧B C η η while B{C } η ∧ ¬B Obs.: η ´ um invariante que deve ser satisfeito antes e depois de o e comando C ser executado. Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  19. 19. Regras da Semˆntica Operacional a Implica¸˜o: ca ϕ →ϕ ϕC ψ ψ→ψ ϕ C ψ Observa¸˜es: co Esta regra faz a conex˜o entre as provas que podemos ter na a l´gica de predicados, usada na especifica¸˜o dos problemas, o ca com a l´gica de programas aqui apresentada. o Isto nos permite considerar as provas na l´gica de predicados o como parte das provas de programas Estabelece o elo de liga¸˜o entre especifica¸˜o e programas ca ca Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  20. 20. Regras da Semˆntica Operacional a E, σ → m ϕ C1 η η C2 ψ x := E , σ → σ[m/x] ϕ C 1; C 2 ψ φ ∧ B C1 ψ φ ∧ ¬B C 2 ψ ψ[E /x] x := E ψ φ if B{C 1}else {C 2} ψ η∧B C η ϕ →ϕ ϕC ψ ψ→ψ η while B{C } η ∧ ¬B ϕ C ψ Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  21. 21. Sistema de Provas Provar que o programa P C0; C1; C2; . . . Cn satisfaz a especifica¸˜o ca Pre: ϕ Pos: ψ par ϕ P ψ corresponde a . . . Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  22. 22. Sistema de Provas Provar cada um dos comandos para as suas pr´ e p´s-condi¸˜es e o co individuais ϕ C0; ϕ1 C1; ϕ2 . . . ϕn Cn ψ O que corresponde a . . . Fonte: (SILVA; FINGER; MELO, 2006, p.199). Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  23. 23. Sistema de Provas O que corresponde a par ϕ C0 ϕ1 par ϕ1 C1 ϕ2 . . . par ϕ n Cn ψ Fonte: (SILVA; FINGER; MELO, 2006, p.200). Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  24. 24. Sistema de Provas A regra a ser aplicada para provar cada comando ´ detectada e pela pr´pria sintaxe do comando: se ´ uma Atribui¸˜o, um o e ca IfElse, etc. Mas aqui foram introduzidas asser¸˜es intermedi´rias entre os co a comandos. Como encontrar tais asser¸˜es quando temos co apenas a especifica¸˜o das pr´ (ϕ) e p´s-condi¸˜es (ψ) do ca e o co problema? Exemplo 7.4.1 (SILVA; FINGER; MELO, 2006, p.200-201) Fonte: (SILVA; FINGER; MELO, 2006, p.200-201). Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  25. 25. Sistema de Provas Mas aqui foram introduzidas asser¸˜es intermedi´rias entre os co a comandos. Como encontrar tais asser¸˜es quando temos co apenas a especifica¸˜o das pr´ (ϕ) e p´s-condi¸˜es (ψ) do ca e o co problema? Olhamos o que queremos provar para, ent˜o, introduzir a asser¸˜es intermedi´rias para verificar se a premissa ´ co a e suficiente para provar a asser¸˜o do topo do programa. ca Fonte: (SILVA; FINGER; MELO, 2006, p.201). Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  26. 26. Pr´ximos Passos o Tablˆ de provas o Exemplos de provas Corre¸˜o e completude do sistema de provas ca Corre¸˜o total de programas ca Notas bibliogr´ficas a Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca
  27. 27. Referˆncias e SILVA, Fl´vio S. C. da; FINGER, Marcelo; MELO, Ana C. V. a de. L´gica para Computa¸˜o. S˜o Paulo: Thomson o ca a Learning, 2006. Adolfo Neto (DAINF-UTFPR) Verifica¸˜o de Programas ca

×