home *** CD-ROM | disk | FTP | other *** search
/ ftp.umcs.maine.edu / 2015-02-07.ftp.umcs.maine.edu.tar / ftp.umcs.maine.edu / pub / WISR / wisr6 / proceedings / ascii / weide.ascii < prev    next >
Text File  |  1993-10-19  |  18KB  |  373 lines

  1.  
  2.  
  3.  
  4.  
  5. Procedure  Calls  and  Local  Certifiability  of  Comp onent  Correctness
  6.  
  7.  
  8.  
  9.                                                    Bruce W. Weide
  10.  
  11.                                                    Wayne D. Heym
  12.  
  13.                                                   William F.Ogden
  14.  
  15.  
  16.  
  17.                            Department of Computer and Information Science
  18.  
  19.                                             The Ohio State University
  20.  
  21.                                               2036 Neil Avenue Mall
  22.  
  23.                                                Columbus, OH 43210
  24.  
  25.                             Tel:  (614) 292-1517 (Weide), fax:  (614) 292-2911
  26.  
  27.                               Email: fweide,heym,ogdeng@cis.ohio-state.edu
  28.  
  29.  
  30.  
  31.                                                         Abstract
  32.  
  33.  
  34.           Results from work involving formal methods in software engineering often can be interpreted
  35.       in the context of practical software engineering problems, and thereby contribute to solutions.
  36.       One example of this phenomenon involves an understanding of the need for restrictions imp osed
  37.       by "toy" languages that admit modular program verification systems.  This analysis can be
  38.       applied to "real" languages that are ostensibly intended to support component reuse (e.g., Ada
  39.       and C++). The result is that unless we restrict procedure calls in ways that are not _ indeed,
  40.       cannot be _ checked or enforced by compilers for these languages as presentlydefined,  it is
  41.       impossible to develop a modular system for reasoning about program behavior.  However,  by
  42.       adopting an alternate explanation of parameter passing, call-by-swapping, we can remove the
  43.       procedure-call impediment to a modular reasoning system without restricting calls in any way.
  44.  
  45.  
  46.       Keywords:  Reuse, software component, local certification, proof of correctness, verification,
  47.       aliasing, parameter passing, call-by-reference, call-by-swapping
  48.  
  49.  
  50.       Workshop Goals:  Learning; networking; having an opportunity to get feedback from others
  51.       on our ideas, and to provide same for others' ideas
  52.  
  53.  
  54.       Working Groups:  Design guidelines for reuse,  Reuse and OO methods,  Reuse and formal
  55.       methods, Reusable component certification, Reuse handbook, Education
  56.  
  57.  
  58.  
  59.                                                         Weide- 1
  60.  
  61.  
  62. 1      Background
  63.  
  64.  
  65.  
  66. Our Reusable Software Research Group has done extensive work on the technical barriers to reuse,
  67. two examples of which are directly relevant to the remainder of this paper and are discussed in
  68. Subsections 1.1 and 1.2. This work has been supported by the National Science Foundation since
  69. 1988; current support is under grant CCR-9111892.
  70.  
  71.  
  72.  
  73. 1.1     Local  Certifiability
  74.  
  75.  
  76.  
  77. Last year at this workshop we discussedthe idea of "local certifiability" and showed why it should
  78. be  required  of  any  serious  software  engineering  discipline  [1 ].  We  proposed  that  support  for  lo-
  79. cal  certifiability  should  be  a  litmus  test  for  any  proposed  programming  or  software  engineering
  80. methodology:  If we design software in this way, can we reason about our programs ina mo dular
  81. (i.e., component-wise) fashion? The working group on design for reuse unanimously acknowledged
  82. the importance of designing for local certifiability [2] and Ware Myers' workshop summary [3] for
  83. IEEE Software highlighted local certifiability as one of the keytechnical issues discussed by the
  84. workshop participants.
  85.  
  86.  
  87. Local certifiability of a property is the ability to establish that property for a software component
  88. out of the context of any particular client of the component.  In thispap er we deal with the property
  89. of correctness with respect to an abstract specification, and consider procedures as thecomp onents
  90. in  question.  So  suppose  we  have  an  abstract  specification  of  what  a  procedure  is  supposed  to
  91. compute and an implementation of that procedure. With local certifiability,we can establish once
  92. and for all that the implementation is correct,put the procedure header and the body's object code
  93. in a reuse library, and henceforth trust that code to compute what the specification says it will
  94. compute; we don't have to look at the source code for the procedure body to reason about the
  95. caller's behavior. Without local certifiability, in some cases wemight have to "expand" the source
  96. for the procedure body into the context of the client in order to determine what it will do for a
  97. particular call; we can't always rely on the pro cedure's abstract specification to tell us this.
  98.  
  99.  
  100. Local certifiability of correctness is equivalent to the ability to reason modularly, on a component-
  101. wise basis, about software systems. Our argument for the intrinsic importance of local certifiability
  102. [1] was based on the intractability of dealing with the monolithic programs that would result from
  103. source-code expansion in large software systems. It is simply a practical reality that if onecannot
  104. reason modularly about a large system, one cannot really hope to reason about it at all.
  105.  
  106.  
  107.  
  108. 1.2     Modular Proof Systems for Procedure Components
  109.  
  110.  
  111.  
  112. Suppose we wish to develop a formal system for program verification, i.e., proving programs to be
  113. correct with respect to an abstract specification. Any such reasoning process must have two logical
  114. properties [4, 5 ], roughly defined as follows:
  115.  
  116.  
  117.  
  118.     fflSoundness _ If a program is incorrect if executed, then the reasoning system must be unable
  119.        to predict it is correct.
  120.  
  121.  
  122.     ffl(Relative) completeness _ If a program is correct if executed, then the reasoning system must
  123.        be able to predict it is correct.
  124.  
  125.  
  126.  
  127.                                                          Weide- 2
  128.  
  129.  
  130. And of course in order to meet the test of local certifiability, the reasoning process must be modular
  131. in the sense explained in the first section.
  132.  
  133.  
  134. One such sound and relatively complete modular verification system is Cook's [4 ].  This system
  135. is  defined  for  a  very  simple, but  still  interesting, Pascal-like  language.  The  most  exciting  part
  136. of  Cook's  language  is  that  it  has  procedures  (although  no  recursive  ones)  with  parameters  like
  137. those in Ada (later) termed "in" and "in out" mode. But here are some of the simplifications and
  138. compiler-checkable restrictions for this language:
  139.  
  140.  
  141.  
  142.     fflType restriction _ All variables are scalars of the same type, e.g., integer. There are neither
  143.        type constructors such as arrays and pointers, nor user-defined types.
  144.  
  145.  
  146.     fflRepeated argumentrestriction _ In any call, all arguments whose corresponding formals have
  147.        mode "in out" must be distinct variables.
  148.  
  149.  
  150.     fflGlobal variable restriction _ In any call, no argument whose corresponding formal has mode
  151.        "in out" may be visible within the called procedure's body (or within the body of any proce-
  152.        dure called directly or indirectly by P) by virtue of being global to it.
  153.  
  154.  
  155.  
  156. Note that Ada and C++ _ and similar "real" languages widely used to develop component-built
  157. software systems _ are similar to Cook's language in many ways, but also differ from it in several
  158. respects. They permit recursive procedures; they have many scalar types; they have record, array,
  159. and pointer type constructors; they permit user-defined abstract types; and they do not ask the
  160. compiler to enforce either the repeated argument or global variable restriction on procedure calls.
  161. The question immediately arises: Does the existence of a sound and complete modular proof system
  162. for Cook's simple language say anything about the feasibility of modular reasoningab out Adaor
  163. C++ programs?
  164.  
  165.  
  166. We have develop edmo dular pro of rulesfor a language that includes modules, user-defined abstract
  167. types, and a variety of other more advanced constructs [6 ]. However,for purp oses of this paper we
  168. wish to concentrate on the better-known, more classical work of Cook to illustrate our positions.
  169.  
  170.  
  171.  
  172. 2      Position
  173.  
  174.  
  175.  
  176. It is apparent that some of the simplifications of Cook's "toy" language might be merely convenient
  177. to make the language and proof system smaller and more easily understandable; there would be no
  178. fundamental technical problems if these restrictions were relaxed.  But others might be technically
  179. essential to obtain the results; they are imposed because, without them, the proof system would
  180. fail to be sound or relatively complete.  As isoften the case with such papers, Co ok's  discussion
  181. does not distinguish explicitly between these cases. His audience was mathematicians,not software
  182. engineers.
  183.  
  184.  
  185. The  "meta-position"  of  this  position  paper  is  that  it  is  dangerous  to  err  in  either  direction  in
  186. characterizing these language simplifications as merely convenient or technically essential.  Some
  187. software engineers tend to downplay the value of formal methods (especially in program verification)
  188. because  they  guess  that  nearly  all  the  simplifications  are  essential;  that  the  "toy"  language  is
  189. therefore so far removed from "real" ones that theresults based on it can't possibly say anything
  190. interesting about the practical world. Others tend to guess that nearly all the simplifications are
  191. merely convenient; that the results for the "toy" language therefore apply to "real" ones that are
  192.  
  193.  
  194.  
  195.                                                          Weide- 3
  196.  
  197.  
  198. similar.  The only way to tell for sure (not just to guess) is to understand the proof system and
  199. the proof of its soundness and relative completeness; in other words, Cook's entire paper and then
  200. some.  We have tried to do that, and to interpret two of our observations as specific positions to
  201. defend for this workshop:
  202.  
  203.  
  204.  
  205.     1. There can be no sound and relativelycomplete modular reasoning system for the class of legal
  206.        programs written in Ada or C++.
  207.  
  208.  
  209.     2. If a language is defined to pass parameters using call-by-swapping [7 ], not call-by-reference or
  210.        call-by-value-result, then the repeated argument and global variable restrictions on procedure
  211.        calls are not necessary to obtain a sound and relatively complete modular reasoning system.
  212.  
  213.  
  214.  
  215. Space limitations prevent us from defending theseclaims in any detail in this short position paper.
  216. Instead we note the relevance of the above claims to issues of software component reuse. We will,
  217. of course, be prepared to argue the validity of these p ositions at the workshop itself.
  218.  
  219.  
  220. The first claim says that the full-fledged Ada and C++ languages p ermitlegal programs (i.e., ones
  221. that compile without error) that may not submit to local certification of correctness.  We cannot
  222. rely on the compiler to "weed out" the offending programs. If we want to be sure of the ability
  223. to reason modularly about programs _ a prerequisite to successful component-oriented reuse [1 ]
  224. _  then  we  must  subscribe  to  a  strict  personal  discipline  or  programming metho dology  such  as
  225. that  described  by  Hollingsworth  for  Ada  [8].  Understanding  which  language  simplifications  are
  226. technically essential for modular reasoning tells us what guidelines this discipline must contain.
  227.  
  228.  
  229. The  second  claim  says  that  two  of the  restrictions  in  Cook's  language  that  are  most  commonly
  230. considered  to  be  technically  essential  are,  in  fact, not  essential  if  one  adopts  a  non-traditional
  231. parameter passing mechanism.
  232.  
  233.  
  234. Ada includes a curiously indirect approach to these restrictions.  An execution of a program whose
  235. effect depends on whether certain parameters are passed using call-by-reference or call-by-value-
  236. result is termed an "erroneous execution." A call violating the repeated argument or global variable
  237. restriction almost certainly can distinguish between these mechanisms for some, but not necessarily
  238. all, values of its arguments.  So defining dependence on the parameter passing mechanism as a source
  239. of erroneous execution is,  in effect,  a roundabout way of telling programmers not to violate the
  240. repeated argument and global variable restrictions.  Note also that because array entries can be
  241. used as though they were variables,it is not always possible for an Ada compiler to detect violations
  242. of the repeated argument restriction. But an Ada compiler must accept a program as "legal" even
  243. when it is possible to determine at compile time that there is the potential for erroneous execution,
  244. because it is the execution that is defined to be erroneous, not the program.
  245.  
  246.  
  247. On the basis of an admittedly superficial analysis, we conjecture that changing the explanation of
  248. parameter passing in Ada, from what is now in the language reference manual to call-by-swapping,
  249. would be an "upward-compatible" changein the following sense:  (1) A legal Ada program that
  250. does not have the potential for erroneous execution under thecurrent language definition would
  251. have the same effect if call-by-swapping were used.  (2) A legal Ada program that does have the
  252. potential for erroneous execution due to dependence on the parameter passing mechanism under the
  253. current language definition would always give (modularly) predictable results if call-by-swapping
  254. were used. This change therefore could have important expressiveness consequences, especially in
  255. certain numerical and linear algebra applications where repeated arguments in procedure calls are
  256. both natural and desirable.
  257.  
  258.  
  259.  
  260.                                                          Weide- 4
  261.  
  262.  
  263. 3      Comparison
  264.  
  265.  
  266.  
  267. Guaspari, et al.  [9 ] note that their verification system for Ada do es not handle procedures in a
  268. modular fashion, but they do not show why this is impossible without changes to the language
  269. definition itself.
  270.  
  271.  
  272. Of course many programming language textbooks contain examples to illustrate pathological situ-
  273. ations for call-by-reference, call-by-value-result, and other parameter passing mechanisms. But to
  274. our knowledge none discusses the consequences for modular reasoning, for software engineering in
  275. general, or for component reuse in particular. Nor does any suggest call-by-swappingas a p ossible
  276. alternative mechanism that makes seemingly pathological procedure call behavior predictable from
  277. procedure specifications alone, without the need for examining the called procedure's body.
  278.  
  279.  
  280. There have been extensions to Cook's original system [4] having to do with procedure calls.  For
  281. example, Clarke [10 ] suggests some relaxations of the repeated argument and global variable re-
  282. strictions, but he does not suggest it is possible to do awaywith them entirely.
  283.  
  284.  
  285.  
  286. 4      References
  287.  
  288.  
  289.  
  290. References
  291.  
  292.  
  293.  
  294.   [1] B. Weide and J. Hollingsworth, "Scalability of Reuse Technology to Large Systems Requires
  295.       Local Certifiability," in Proceedings 5th Workshop on Software Reuse,1992.
  296.  
  297.  
  298.   [2] M. Griss and W. Tracz, "WISR '92:  5th Workshop on Software Reuse Working Group Re-
  299.       ports," Software Engineering Notes, vol. 18, pp. 74-85, April 1993.
  300.  
  301.  
  302.   [3] W. Myers, "Workshop Participants Take the Pulse of Reuse," IEEESoftware, vol. 10, pp. 116-
  303.       117, January 1993.
  304.  
  305.  
  306.   [4] S. Cook, "Soundness and Completeness of an Axiom System for Program Verification," SIAM
  307.       Journal of Computing, vol. 7, pp. 70-90, February 1978.
  308.  
  309.  
  310.   [5] G. Ernst, J. Menegay, R. Hookway, and W. Ogden, "Semantics of Programming Languages
  311.       for Modular Verification," Tech. Rep. CES-85-4, Case Western Reserve University, Dept. of
  312.       Computer Engineering and Science, October 1985.
  313.  
  314.  
  315.   [6] J. Krone, "The Role of Verification in Software Reusability," tech. rep., Ohio State University,
  316.       Dept. of Computer and Information Science, August 1988.
  317.  
  318.  
  319.   [7] D.  Harms  and  B.  Weide, "Copying  and  Swapping:  Influences  on  the  Design  of  Reusable
  320.       Software Components," IEEE  Transactions  on  Software  Engineering,  vol.  17,  pp.  424-435,
  321.       May 1991.
  322.  
  323.  
  324.   [8] J. Hollingsworth, "Software Component Design-for-Reuse: A Language-Independent Discipline
  325.       Applied to Ada," tech. rep., Ohio State University, Dept. of Computer and Information Science,
  326.       August 1992.
  327.  
  328.  
  329.   [9] D. Guaspari, C. Marceau, and W. Polak, "Formal Verification of Ada Programs," IEEE Trans-
  330.       actions on Software Engineering, vol. 16, pp. 1058-1075, September 1990.
  331.  
  332.  
  333.  
  334.                                                          Weide- 5
  335.  
  336.  
  337. [10]  E. Clarke, "Programming Language Constructs for Which It Is Impossible To Obtain Good
  338.       Hoare Axiom Systems," Journal of the ACM, vol. 26, pp. 129-147, January 1979.
  339.  
  340.  
  341.  
  342. 5      Biography
  343.  
  344.  
  345.  
  346. Bruce W. Weide is Associate Professor of Computerand Information Science at The Ohio State
  347. University in Columbus.  He received his B.S.E.E. degree from the University of Toledo and the
  348. Ph.D.  in  Computer  Science  from  Carnegie  Mellon  University.  He  has  been  at  Ohio  State  since
  349. 1978. Professor Weide's research interests include various aspects of reusable software components
  350. and  software  engineering  in  general: software  design,  formal sp ecification  and  verification,  data
  351. structures and algorithms, and programming language issues.  He also has published recently in the
  352. area of software support for real-time and embedded systems.
  353.  
  354.  
  355. Wayne D. Heym received his undergraduate degree from Miami University (Ohio) and his masterUs
  356. degree from Cornell University.  He has also worked at Kodak Corporation.  As a Ph.D. student
  357. at Ohio State he has worked on a variety of problems related to software reuse, including formal
  358. specification  and  verification  and  component  testing, and  has  published  in  the  latter  area.  His
  359. Ph.D.  research  involves  development  of  a  "natural"  modular  system  for  verification  of  assertive
  360. programs, including proofs of soundness and relative completeness of thesystem.
  361.  
  362.  
  363. William F. Ogden is Associate Professor of Computer and Information Science at TheOhio State
  364. University in Columbus. He is a Ph.D. graduate of Stanford University whose work has resulted in
  365. significant advances in theoretical computer science, including the well-known "Ogden's lemma" and
  366. a proof of the exponential complexity of the circularity problem for attribute grammars.  His most
  367. recent research has concentrated on modular program verification and on design and development
  368. of reusable software components based on abstractdata types.
  369.  
  370.  
  371.  
  372.                                                          Weide- 6
  373.