tema 7: c´alculo proposicional en pvsjalonso/cursos/d-ra-04/temas/tema-7.pdf · historia de pvs x...

24
Razonamiento autom ´ atico Curso 2004–05 Tema 7: C´ alculo proposicional en PVS Jos´ e A. Alonso Jim´ enez [email protected] http://www.cs.us.es/jalonso Dpto. de Ciencias de la Computaci´on e Inteligencia Artificial Universidad de Sevilla D-RA 2004–05 C c I a alculo proposicional en PVS 7.1

Upload: others

Post on 06-Oct-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Razonamiento automatico Curso 2004–05

Tema 7: Calculo proposicionalen PVS

Jose A. Alonso Jimenez

[email protected]://www.cs.us.es/∼jalonso

Dpto. de Ciencias de la Computacion e Inteligencia Artificial

Universidad de Sevilla

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.1

Page 2: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Historia de PVS

x PVS:u Nombre: Prototype Verification System

u Autores: N. Shankar, S. Owre y J.M. Rushby (SRI, USA)

u Def: “PVS is a verification system: that is, a specification language integrated

with support tools and a theorem prover”

u Historia: HDM (70), EHDM (84), PVS (91), PVS 2.4 (25-Nov-2001), PVS 3.0

x Propositos:

u The primary purpose of PVS is to provide formal support for conceptualization

and debugging in the early stages of the lifecycle of the design of a hardware or

software system

u The primary emphasis in the PVS proof checker is on supporting the construc-

tion of readable proofs

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.2

Page 3: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

El calculo de secuentes proposicional

x La sintaxis y la semantica proposicional

x Secuentes proposicionales

u Sintaxis: Γ =⇒ ∆,

con Γ y ∆ conjuntos de formulas proposicionales

u Semantica de Γ =⇒ ∆:∧

Γ → ∨∆

u Antecedente de Γ =⇒ ∆: Γ

u Consecuente de Γ =⇒ ∆: ∆

x Axiomas

Γ, A =⇒ A, ∆[Ax]

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.3

Page 4: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

El calculo de secuentes proposicional

x ReglasIzquierda Derecha

Γ =⇒ A, ∆

Γ, ¬A =⇒ ∆[¬I]

Γ, A =⇒ ∆

Γ =⇒ ¬A, ∆[¬D]

Γ, A =⇒ ∆ Γ, B =⇒ ∆

Γ, A ∨ B =⇒ ∆[∨I]

Γ =⇒ A, B, ∆

Γ =⇒ A ∨ B, ∆[∨D]

Γ, A, B =⇒ ∆

Γ, A ∧ B =⇒ ∆[∧I]

Γ =⇒ A, ∆ Γ =⇒ B, ∆

Γ =⇒ A ∧ B, ∆[∧D]

Γ, B =⇒ ∆ Γ =⇒ A, ∆

Γ, A → B =⇒ ∆[→I]

Γ, A =⇒ B, ∆

Γ =⇒ A → B, ∆[→D]

Γ, A → B, B → A =⇒ ∆

Γ, A ↔ B =⇒ ∆[↔I]

Γ =⇒ A → B, ∆ Γ =⇒ B → A, ∆

Γ =⇒ A ↔ B, ∆[↔D]

Γ, =⇒ A, ∆ Γ, A =⇒ ∆

Γ =⇒ ∆[Corte]

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.4

Page 5: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Demostraciones

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.5

Page 6: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Demostraciones con corte

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.6

Page 7: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Teorıa PVS

proposicional: THEORYBEGIN

A, B, C: bool

ej1: LEMMAA IMPLIES (B OR A)

ej2: LEMMA(A AND (A IMPLIES B)) IMPLIES B

ej3: LEMMA((A IMPLIES B) IMPLIES A) IMPLIES (B IMPLIES (B AND A))

ej4: CONJECTURE(A OR B) IMPLIES (B OR C)

END proposicional

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.7

Page 8: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Tactica flatten-disjunct acotadax Prueba del ej1 con flatten-disjunct acotada

ej1 :|-------

{1} A IMPLIES (B OR A)

Rule? (flatten-disjunct :depth 1)Applying disjunctive simplification to flatten sequent, this simplifies to:ej1 :{-1} A

|-------{1} (B OR A)

Rule? (flatten-disjunct :depth 1)Applying disjunctive simplification to flatten sequent, this simplifies to:ej1 :[-1] A

|-------{1} B{2} Awhich is trivially true. Q.E.D.

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.8

Page 9: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Tactica flatten-disjunct

x Prueba del ej1 con flatten-disjunct

ej1 :

|-------{1} A IMPLIES (B OR A)

Rule? (flatten-disjunct)Applying disjunctive simplification to flatten sequent, this simplifies to:ej1 :

{-1} A|-------

{1} B{2} A

which is trivially true.Q.E.D.

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.9

Page 10: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Tactica flatten

x Prueba del ej1 con flatten

ej1 :

|-------{1} A IMPLIES (B OR A)

Rule? (flatten)Applying disjunctive simplification to flatten sequent,Q.E.D.

x Tacticas usadas y reglas de inferencia

u La tactica flatten-disjunct aplica las reglas ∨D, ∧I, →D, ↔I, ¬I y ¬D.

u La tactica flatten equivale a flatten-disjunct sin lımite de profundidad

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.10

Page 11: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Tactica split

x Prueba del ej2 con flatten y split

ej2 :

|-------{1} (A AND (A IMPLIES B)) IMPLIES B

Rule? (flatten)Applying disjunctive simplification to flatten sequent, this simplifies to:ej2 :

{-1} A{-2} (A IMPLIES B)

|-------{1} B

Rule? (split)Splitting conjunctions, this yields 2 subgoals:

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.11

Page 12: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Tactica split

ej2.1 :

{-1} B[-2] A

|-------[1] B

which is trivially true. This completes the proof of ej2.1.

ej2.2 :

[-1] A|-------

{1} A[2] B

which is trivially true. This completes the proof of ej2.2.Q.E.D.

x La tactica split aplica las reglas ∨I, ∧D, →I, ↔D

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.12

Page 13: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La estrategia prop

x Prueba del ej2 con prop

ej2 :

|-------{1} (A AND (A IMPLIES B)) IMPLIES B

Rule? (prop)Applying propositional simplification,Q.E.D.

x Definicion de prop:(try (flatten) (prop$) (try (split) (prop$) (skip)))

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.13

Page 14: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La estrategia prop$

x Prueba del ej2 con prop$

ej2 :

|-------{1} (A AND (A IMPLIES B)) IMPLIES B

Rule? (prop$)Applying disjunctive simplification to flatten sequent, this simplifies to:ej2 :

{-1} A{-2} (A IMPLIES B)

|-------{1} B

No change on: (FLATTEN)...

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.14

Page 15: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La estrategia prop$

Splitting conjunctions, this yields 2 subgoals:ej2.1 :

{-1} B[-2] A

|-------[1] B

which is trivially true. This completes the proof of ej2.1.

ej2.2 :

[-1] A|-------

{1} A[2] B

which is trivially true. This completes the proof of ej2.2.Q.E.D.

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.15

Page 16: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La tactica case para cortes

x Prueba del ej3 con case

ej3 :

|-------{1} ((A IMPLIES B) IMPLIES A) IMPLIES (B IMPLIES (B AND A))

Rule? (flatten-disjunct :depth 1)Applying disjunctive simplification to flatten sequent, this simplifies to:ej3 :

{-1} ((A IMPLIES B) IMPLIES A)|-------

{1} (B IMPLIES (B AND A))

Rule? (case "A")Case splitting on A, this yields 2 subgoals:

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.16

Page 17: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La tactica case para cortes

ej3.1 :

{-1} A[-2] ((A IMPLIES B) IMPLIES A)

|-------[1] (B IMPLIES (B AND A))

Rule? (hide -2)Hiding formulas: -2, this simplifies to:ej3.1 :

[-1] A|-------

[1] (B IMPLIES (B AND A))

Rule? (flatten)Applying disjunctive simplification to flatten sequent, this simplifies to:

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.17

Page 18: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La tactica case para cortes

ej3.1 :

[-1] A{-2} B

|-------{1} (B AND A)

Rule? (split)Splitting conjunctions, this yields 2 subgoals:ej3.1.1 :

[-1] A[-2] B

|-------{1} B

which is trivially true.

This completes the proof of ej3.1.1.

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.18

Page 19: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La tactica case para cortes

ej3.1.2 :

[-1] A[-2] B

|-------{1} A

which is trivially true.

This completes the proof of ej3.1.2.

This completes the proof of ej3.1.

ej3.2 :

[-1] ((A IMPLIES B) IMPLIES A)|-------

{1} A[2] (B IMPLIES (B AND A))

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.19

Page 20: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La tactica case para cortes

Rule? (hide 2)Hiding formulas: 2, this simplifies to:ej3.2 :

[-1] ((A IMPLIES B) IMPLIES A)|-------

[1] A

Rule? (split)Splitting conjunctions, this yields 2 subgoals:ej3.2.1 :

{-1} A|-------

[1] A

which is trivially true.

This completes the proof of ej3.2.1.

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.20

Page 21: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La tactica case para cortes

ej3.2.2 :

|-------{1} (A IMPLIES B)[2] A

Rule? (flatten)Applying disjunctive simplification to flatten sequent,

This completes the proof of ej3.2.2.

This completes the proof of ej3.2.

Q.E.D.

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.21

Page 22: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

La tactica case para cortes

x Prueba del ej3 con prop

ej3 :

|-------{1} ((A IMPLIES B) IMPLIES A) IMPLIES (B IMPLIES (B AND A))

Rule? (prop)Applying propositional simplification,Q.E.D.

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.22

Page 23: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Busqueda de contramodelos

x Caculo de contramodelo del ej4ej4 :

|-------{1} (A OR B) IMPLIES (B OR C)

Rule? (prop)Applying propositional simplification,this simplifies to:ej4 :

{-1} A|-------

{1} B{2} C

x Contramodelo: v(A) = 1, v(B) = v(C) = 0

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.23

Page 24: Tema 7: C´alculo proposicional en PVSjalonso/cursos/d-ra-04/temas/tema-7.pdf · Historia de PVS x PVS: u Nombre: Prototype Verification System u Autores: N. Shankar, S. Owre y J.M

Bibliografıa

x J. Crow, S. Owre, J. Rushby, N. Shankar y M. Srivas A Tutorial Intro-duction to PVS (SRI International, 1995)

x M. Hofmann Razonamiento asistido por computadora (2001–02)

x N. Shankar Mechanized verification methodologies

D-RA 2004–05 CcIa Calculo proposicional en PVS 7.24