

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Dr. Ferucio Laurent¸iu T¸ IPLEA Visiting Professor School of Computer Science University of Central Florida CSB # Orlando, FL 32816- Tel: (407) 823- E-mail: [email protected]
COP 5021 (Program Analysis)
This is the correctness proof for the specification Stack in Lecture Notes #4.
Correctness. We will prove that A is a member of ADT (Stack), that is, A is isomorphic to TΣ/=E. The first step is to show that A is a model of the set E of equations in the specification: ¯γstack(pop(estack)) = popA(estackA) = P op(λ) = λ = estackA = ¯γstack(estack)
and ¯γstack(pop(push(x, y))) = popA(pushA(γstack(x), γalph(y))) = P op(P ush(γstack(x), γalph(y))) = P op(γstack(x)γalph(y)) = γstack(x) = ¯γstack(x).
Therefore, A is a model of the set E of equations of the specification.
Define now the function f : TΣ/=E →A such that the diagram in Figure 1 is commutative, that is, fs([t]=E,s ) = evalA,s(t),
for any sort s and term t of sort s (f=E is the natural epimorphism induced by =E ).
f=E f
evalA
Figure 1: Graphic illustration of the isomorphism from TΣ/=E to A
We show that f is an isomorphism:
t =E,s t′^ ⇔ E ⊢ t = t′ ⇔ E |= t = t′ ⇔ M od(E) |= t = t′ ⇒ A |= t = t′ ⇒ evalA,s(t) = evalA,s(t′), which shows that fs([t]=E,s ) = fs([t′]=E,s );
falph(eT i Σ/=E) = falph([eT i Σ]=E,alph ) = falph([ei]=E,alph ) = evalA,alph(ei) = eAi ;
= fstack([pushTΣ^ (t 1 , t 2 )]=E,stack ) = fstack([push(t 1 , t 2 )]=E,stack ) = evalA,stack(push(t 1 , t 2 )) = pushA(evalA,stack(t 1 ), evalA,alph(t 2 )) = pushA(fstack([t 1 ]=E,stack ), falpha([t 2 ]=E,alph ));
= fstack([popTΣ^ (t)]=E,stack ) = fstack([pop(t)]=E,stack ) = evalA,stack(pop(t)) = popA(evalA,stack(t)) = popA(fstack([t]=E,stack ));
Calph = {e 1 ,... , en} and Cstack = {push(· · · push(estack, α 1 ),... , αm)|(∀i)(αi ∈ Calph)} ∪ {estack}. These sets satisfy: