# Kima: An Automated Error Correction System for Concurrent Logic Programs

- 66 Downloads
- 6 Citations

## Abstract

We have implemented Kima, an automated error correction system for concurrent logic programs. Kima corrects near-misses such as wrong variable occurrences in the absence of explicit declarations of program properties.

Strong moding/typing and constraint-based analysis are turning out to play fundamental roles in debugging concurrent logic programs as well as in establishing the consistency of communication protocols and data types. Mode/type analysis of Moded Flat GHC is a constraint satisfaction problem with many simple mode/type constraints, and can be solved efficiently. We proposed a simple and efficient technique which, given a non-well-moded/typed program, diagnoses the “reasons” of inconsistency by finding minimal inconsistent subsets of mode/type constraints. Since each constraint keeps track of the symbol occurrence in the program, a minimal subset also tells possible sources of program errors.

Kima realizes automated correction by replacing symbol occurrences around the possible sources and recalculating modes and types of the rewritten programs systematically. As long as bugs are near-misses, Kima proposes a rather small number of alternatives that include an intended program. Search space is kept small because the minimal subset confines possible sources of errors in advance. This paper presents the basic algorithm and various optimization techniques implemented in Kima, and then discusses its effectiveness based on quantitative experiments.

## Preview

Unable to display preview. Download preview PDF.

## References

- Aiken, A., Wimmers, E.L., and Lakshman, T.K. 1994. Soft typing with conditional types. In
*Proc. 21st ACM Symp. on Principles of Programming Languages*, New York: ACM, pp. 167–173.Google Scholar - Aït-Kaci, H. and Nasr, R. 1986. LOGIN: A logic programming language with built-in inheritance.
*J. Logic Programming*, 3(3):185–215.Google Scholar - Ajiro, Y. and Ueda, K. 2001. Kima—An automated error correction system for concurrent logic programs.
*Computer Software*, 18(0):122–137 (in Japanese).Google Scholar - Ajiro, Y., Ueda, K., and Cho, K. 1998. Error-correcting source code. In
*Proc. Fourth Int. Conf. on Principles and Practice of Constraint Programming (CP'98)*, LNCS 844, Berlin: Springer, pp. 40–54.Google Scholar - Beaven, M. and Stansifer, R. 1993. Explaining type errors in polymorphic languages.
*ACMLetters on Programming Languages and Systems*, 2(1–4):17–30.Google Scholar - Cartwright, R. and Fagan, M. 1991. Soft typing. In
*Proc. ACM SIGPLAN'91 Conf. on Programming Language Design and Implementation (PLDI'91)*, New York: ACM, pp. 268–277.Google Scholar - Chikayama, T., Fujise, T., and Sekita, D. 1994. A portable and efficient implementation of KL1. In
*Proc. Sixth Int. Symp. on Programming Language Implementation and Logic Programming (PLILP'94)*, LNCS 844, Berlin: Springer, pp. 25–39.Google Scholar - Cho, K. and Ueda, K. 1996. Diagnosing non-well-moded concurrent logic programs. In
*Proc. 1996 Joint Int. Conf. and Symp. on Logic Programming (JICSLP'96)*, Cambridge, MA: MIT Press, pp. 215–229.Google Scholar - Duggan, D. and Bent, F. 1996. Explaining type inference.
*Science of Computer Programming*, 27(1):37–83.Google Scholar - Flanagan, C. and Felleisen, M. 1998. A new way of debugging Lisp programs. In
*40th Anniversary of Lisp (Lisp in the Mainstream)*.Google Scholar - Fromherz, M.P. 1993. Towards declarative debugging of concurrent constraint programs. In
*Proc. First Int. Workshop on Automated and Algorithmic Debugging (AADEBUG'93)*, Berlin: Springer, pp. 88–100.Google Scholar - Heintze, N. and Jaffar, J. 1994. Set constraints and set-based analysis. In
*Proc. Principles and Practice of Constraint Programming, Second Int. Workshop (PPCP'94)*, LNCS 844, Berlin: Springer, pp. 281–298.Google Scholar - Jung, Y. and Michaelson, G. 2000. A visualisation of polymorphic type checking.
*J. Functional Programming*, 10(1):57–75.Google Scholar - McAdam, B.J. 1999. Generalising techniques for type debugging. In
*First Scottish Functional Programming Workshop*. Also in P. Trinder, G. Michaelson, and H.-W. Loidl, editors,*Trends in Functional Programming*, Bristol: Intellect, 2000, pp. 49–57.Google Scholar - Milner, R. 1978. A theory of type polymorphism in programming.
*J. of Computer and System Sciences*, 17(3):348–375.Google Scholar - Puebla, G., Bueno, F., and Hermenegildo, M. 1999. Combined static and dynamic assertion-based debugging of constraint logic programs. In
*Proc. Logic-based Program Synthesis and Transformation (LOPSTR'99)*, LNCS 1068, Berlin: Springer, pp. 273–292.Google Scholar - Reiter, R. 1987. A theory of diagnosis from first principles.
*Artificial Intelligence*, 32:57–95.Google Scholar - Shapiro, E.Y. 1982.
*Algorithmic Program Debugging*, ACM Distinguished Dissertation Series. Cambridge, MA: MIT Press.Google Scholar - Tenma, T., et al. 1990, A modification support system—Automated correction of side-effects caused by type modifications. In
*Proc. ACM 18th Annual Computer Science Conference (CSC'90)*, New York: ACM, pp. 154–160.Google Scholar - Ueda, K. 1996. Experiences with strong moding in concurrent logic/constraint programming. In
*Proc. Int. Workshop on Parallel Symbolic Languages and Systems*, Berlin: Springer, pp. 134–153.Google Scholar - Ueda, K. 1999. Concurrent logic/constraint programming: The next 10 years. In K.R. Apt, V.W. Marek, M. Truszczynski, and D.S. Warren, editors,
*The Logic Programming Paradigm: A 25-Year Perspective*. Berlin: Springer, pp. 53–71.Google Scholar - Ueda, K. and Chikayama, T. 1990. Design of the kernel language for the parallel inference machine.
*The Computer Journal*, 33(6):494–500.Google Scholar - Ueda, K. and Morita, M. 1990. A new implementation technique for Flat GHC. In
*Proc. Seventh Int. Conf. on Logic Programming (ICLP'90)*, Cambridge, MA: MIT Press, pp. 3–17.Google Scholar - Ueda, K. and Morita, M. 1994. Moded Flat GHC and its message-oriented implementation technique.
*New Generation Computing*, 13(1):3–43.Google Scholar - Wand, M. 1986. Finding the source of type errors. In
*Proc. 13th ACM Symp. on Principles of Programming Languages*, New York: ACM, pp. 38–43.Google Scholar