chap6.r_0 1.7 KB

12345678910111213141516171819202122232425
  1. .nr chapter 5
  2. .chapter "Proving an Implementation Correct"
  3. This chapter is concerned with establishing the correctness of programs that
  4. implement data abstractions. What we desire is a process which establishes that a
  5. program correctly implements a concept that exists in someone's mind. To do this
  6. formally, it is necessary to provide a mathematical description of the concept. This
  7. can be done by a formal specification technique. The correctness of the program is
  8. then established by proving that it is equivalent to the specification.
  9. Here, the homomorphism property will be used in the proofs.
  10. In general, this involves
  11. showing the following. Assume there is a class of abstract objects A with abstract
  12. operations 4w*a1, ..., 4w*an. Furthermore, suppose that x*
  13. is the concrete representation of an abstract object belonging to A. Hence, in
  14. general, x* will be a collection or record of concrete variables. Let C be the
  15. collection of all such x*. Finally, suppose that 4w*c1, ...,
  16. 4w*c1 are the concrete operations that purport to be implementations of the
  17. abstract operations 4w*a1, ..., 4w*an. Then, the
  18. homomorphism property involves defining a representation function, rep, mapping
  19. from C onto A and showing for each i, 1<_i<_n,
  20. 4w*ai(rep(x*) = rep(4w*ci(x*)).
  21. Before attempting such a proof, two steps must be performed. First, the
  22. concrete representation of a data abstraction must be characterized. This is discussed
  23. in Section 6.1. Then the representation function must be described. For our purposes,
  24. this involves showing how to map the collection of concrete objects C onto the state set
  25. of a state machine specification. Section 6.2 is concerned with this issue.