Skip to main content
Log in

Program Synthesis from Formal Requirements Specifications Using APTS

  • Published:
Higher-Order and Symbolic Computation

Abstract

Formal specifications of software systems are extremely useful because they can be rigorously analyzed, verified, and validated, giving high confidence that the specification captures the desired behavior. To transfer this confidence to the actual source code implementation, a formal link is needed between the specification and the implementation. Generating the implementation directly from the specification provides one such link. A program transformation system such as Paige's APTS can be useful in developing a source code generator. This paper describes a case study in which APTS was used to produce code generators that construct C source code from a requirements specification in the SCR (Software Cost Reduction) tabular notation. In the study, two different code generation strategies were explored. The first strategy uses rewrite rules to transform the parse tree of an SCR specification into a parse tree for the corresponding C code. The second strategy associates a relation with each node of the specification parse tree. Each member of this relation acts as an attribute, holding the C code corresponding to the tree at the associated node; the root of the tree has the entire C program as its member of the relation. This paper describes the two code generators supported by APTS, how each was used to synthesize code for two example SCR requirements specifications, and what was learned about APTS from these implementations.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Aho, A.V., Ganapathi, M., and Tjiang, S.W.K. Code generation using tree matching and dynamic programming. ACM Transactions on Programming Languages and Systems, 11(4) (1989) 491–516.

    Google Scholar 

  2. Archer, M. TAME: Using PVS strategies for special-purpose theorem proving. Annals of Mathematics and Artificial Intelligence, 29(1–4) (2001) 139–181.

    Google Scholar 

  3. Bharadwaj, R. and Heitmeyer, C. Model checking complete requirements specifications using abstraction. Automated Software Engineering, 6(1) (1999) 37–68.

    Google Scholar 

  4. Bharadwaj, R. and Sims, S. Salsa: Combining constraint solvers with BDDs for automatic invariant checking. In Proc. Tools and Algorithms for the Construction and Analysis of Systems (TACAS’ 2000), S. Grat and M. Schwartzbach (Eds.). LNCS 1785, Berlin, 2000, pp. 378–399.

  5. Blackburn, M., Knickerbocker, R., and Kasuda, R. Applying the test automation framework to the Mars Lander Touchdown Monitor. In Lockheed Martin Joint Symposium, 2001.

  6. Cai, J. and Paige, R. Program derivation by fixed point computation. Science of Computer Programming, 11 (1988/89) 197–261.

    Google Scholar 

  7. Cai, J. and Paige, R. Towards increased productivity of algorithm implementation. ProceedingsACMSIGSOFT 1993, Software Engineering Notes, 18(5) (1993) 71–78.

    Google Scholar 

  8. Courtois, P.-J. and Parnas, D.L. Documentation for safety critical software. In Proc. 15th Int'l Conf. on Softw. Eng. (ICSE’ 93). Baltimore, MD, 1993, pp. 315–323.

  9. Easterbrook, S., Lutz, R., Covington, R., Ampo, Y., and Hamilton, D. Experiences using lightweight formal methods for requirements modeling. IEEE Transactions on Software Engineering, 24(1) (1998) 4–14.

    Google Scholar 

  10. Faulk, S.R., Finneran, L., Kirby, Jr., J., Shah, S., and Sutton, J. Experience applying the CoRE method to the Lockheed C-130J. In Proc. 9th Annual Conf. on Computer Assurance (COMPASS’ 94). IEEE Press, Gaithersburg, MD, 1994, pp. 3–8.

    Google Scholar 

  11. Fraser, C.W., Hanson, D.R., and Proebsting, T.A. Engineering a simple, efficient code generator generator. ACM Letters on Programming Languages and Systems, 1(3) (1992) 213–226.

    Google Scholar 

  12. Halbwachs, N., Raymond, P., and Ratel, C. Generating efficient code from data-flowprograms. In Third Intern. Symposium on Programming Language Implementation and Logic Programming. Passau (Germany), 1991, pp. 207–218.

  13. Harel, D. et al. Statemate: A working environment for the development of complex reactive systems. IEEE Trans. Softw. Eng., SE-16(4) (1990) 404–414.

    Google Scholar 

  14. Heimdahl, M.P.E. and Keenan, D.J. Generating code from hierarchical state-based requirements. In Proc. of the IEEE International Symposium on Requirements Engineering, 1997, pp. 450–467.

  15. Heitmeyer C. Software cost reduction. In Encyclopedia of Software Engineering, J.J. Marciniak (Ed.). (Second edition), John Wiley & Sons, Inc., New York, NY, 2002, pp. 1374–1380.

    Google Scholar 

  16. Heitmeyer, C., Kirby, J., Labaw, B., Archer, M., and Bharadwaj, R. Using abstraction and model checking to detect safety violations in requirements specifications. IEEE Trans. on Softw. Eng., 24(11) (1998), 927–948.

    Google Scholar 

  17. Heitmeyer, C., Kirby, Jr., J., Labaw, B., and Bharadwaj, R. SCR*: A toolset for specifying and analyzing software requirements. In Proc. Computer-Aided Verification, 10th Annual Conf. (CAV'98). A.J. Hua and M.Y. Vardi (Eds.). LNCS 1427, Vancouver, Canada, 1998, pp. 526–531.

  18. Heitmeyer, C.L., Jeffords, R.D., and Labaw, B.G. Automated consistency checking of requirements specifications. ACM Transactions on Software Engineering and Methodology, 5(3) (1996) 231–261.

    Google Scholar 

  19. Heninger, K., Parnas, D.L., Shore, J.E., and Kallander, J.W. Software requirements for the A-7E aircraft. Technical Report 3876, NRL, Washington, DC, 1978.

    Google Scholar 

  20. Hester, S.D., Parnas, D.L., and Utter, D.F. Using documentation as a software design medium. Bell System Tech. J., 60(8) (1981) 1941–1977.

    Google Scholar 

  21. Jeffords, R. and Heitmeyer, C. Automatic generation of state invariants from requirements specifications. In Proc. Sixth ACM SIGSOFT Symp. on Foundations of Software Engineering, Nov. 3–5, Lake Buena Vista, FL, 1998, pp. 56–69.

  22. Jeffords, R.D. Personal communication, 2001.

  23. Jeffords, R.D. Personal communication, 2002.

  24. Jeffords, R.D. and Heitmeyer, C.L. An algorithm for strengthening state invariants generated from requirements specifications. In Proc. Fifth IEEE International Symposium on Requirements Engineering, 2001, pp. 182–191.

  25. Kirby, Jr., J., Archer, M., and Heitmeyer, C. SCR: A practical approach to building a high assurance COMSEC system. In Proc. 15th Annual Computer Security Applications Conference (ACSAC’ 99), 1999, pp. 109–118.

  26. Knuth, D.E. Semantics of context-free languages. Mathematical Systems Theory, 2(2) (1968) 127–145.

    Google Scholar 

  27. LaLonde, W. Regular right part grammars and their parsers. Communications of the ACM, 20(10) (1977) 731–741.

    Google Scholar 

  28. Lowry, M.R. and Baalen, J.V.V. META-AMPHION: Synthesis of efficient domain-specific program synthesis systems. Automated Software Engineering, 4 (1997) 199–241.

    Google Scholar 

  29. Meyers, S. and White, S. Software requirements methodology and tool study for A6-E technology transfer. Technical report, Grumman Aerospace Corp., Bethpage, NY, 1983.

    Google Scholar 

  30. Miller, S. Specifying the mode logic of a flight guidance system in CoRE and SCR. In Proc. 2nd ACM Workshop on Formal Methods in Software Practice (FMSP'98), 1998, pp. 44–53.

  31. Paige, R. Programming with invariants. IEEE Software, 3(1) (1986) 56–69.

    Google Scholar 

  32. Paige, R. Symbolic finite differencing—Part 1. In Proc. ESOP 90, N. Jones (Ed.), LNCS 432, 1990, pp. 36–56.

  33. Paige, R. APTS external specification manual (rough draft). Unpublished manuscript, 1993. Available at http://www.cs.nyu.edu/ jessie/.

  34. Paige, R. Viewing a program transformation system at work. In Proc. Joint 6th Int'l Conf. on Programming Language Implementation and Logic Programming (PLILP) and 4th Int'l Conf. on Algebraic and Logic Programming (ALP). LNCS 844, 1994, pp. 5–24.

  35. Parnas, D.L., Asmis, G., and Madey, J. Assessment of safety-critical software in nuclear power plants. Nuclear Safety, 32(2) (1991) 189–198.

    Google Scholar 

  36. Pnueli, A., Siegel, M., and Singerman, E. Translation validation. In International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS 1998). LNCS 1384, 1998, pp. 151–166.

  37. Reasoning Systems. Refine User's Guide Version 3.0, 1990.

  38. Reps T.W. and Teitelbaum, T. The Synthesizer Generator:A System for Constructing Language-Based Editors. Springer-Verlag, New York, NY, 1989.

    Google Scholar 

  39. Smith, D.R. KIDS: A semiautomatic program development system. IEEE Transactions on Software Engineering, 16 (1990) 1024–1043.

    Google Scholar 

  40. Snyder K. The SETL2 programming language. Technical Report 490, Courant Institute/ New York University, 1990.

  41. Wan, Z., Taha, W., and Hudak, P. Event-driven FRP. In Proc. Fourth International Symposium on Practical Aspects of Declarative Languages (PADL02), LNCS 2257, 2002, pp. 155–172.

  42. Winter, V.L., Kapur, D., and Berg, R.S. Refinement-based derivation of train controllers. In High Integrity Software, V.L. Winter and S. Bhattacharya (Eds.). Kluwer Academic Publishers, Norwell, MA, 2001, Ch. 9, pp. 197–240.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Leonard, E.I., Heitmeyer, C.L. Program Synthesis from Formal Requirements Specifications Using APTS. Higher-Order and Symbolic Computation 16, 63–92 (2003). https://doi.org/10.1023/A:1023072104553

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1023/A:1023072104553

Navigation