Source-Tracking Unification

  • Venkatesh Choppella
  • Christopher T. Haynes
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2741)


We propose a practical path-based framework for deriving and simplifying source-tracking information for term unification in the empty theory. Such a framework is useful for debugging unification-based systems, including the diagnosis of ill-typed programs and the generation of success and failure proofs in logic programming.

The objects of source-tracking are deductions in the logic of unification. The semantics of deductions are paths over a unification graph whose labels form the language of suffixes of a semi-Dyck set. Based on this framework, two algorithms for generating proofs are presented: the first uses context-free shortest-path algorithms to generate optimal (shortest) proofs in time O(n 3), where n is the number of vertices of the unification graph. The second algorithm integrates easily with standard unification algorithms, entailing an overhead of only a constant factor, but generates non-optimal proofs. These non-optimal proofs may be further simplified by group rewrite rules.


Normal Form Logic Program Logic Programming Type Inference Term Equation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Baader, F., Siekmann, J.: Unification theory. In: Gabbay, D.M., Hogger, C.J., Robinson, J.A. (eds.) Handbook of Logic in Artificial Intelligence and Logic Programmaning. Oxford University Press, Oxford (1993)Google Scholar
  2. 2.
    Barrett, C., Jakob, R., Marathe, M.: Formal language constraint path problems. SIAM Journal of Computing 30, 809–837 (2000)zbMATHCrossRefGoogle Scholar
  3. 3.
    Beaven, M., Stansifer, R.: Explaining type errors in polymorphic languages. ACM Letters on Programming Languages (1994)Google Scholar
  4. 4.
    Bertot, Y.: Origin Functions in λ-calculus and Term Rewriting Systems. In: Raoult, J.-C. (ed.) CAAP 1992. LNCS, vol. 581. Springer, Heidelberg (1992)Google Scholar
  5. 5.
    Chen, T.Y., Lassez, J.-L., Port, G.S.: Maximal unifiable subsets and minimal non-unifiable subsets. New Generation Computing, 133–152 (1986)Google Scholar
  6. 6.
    Choppella, V.: Implementation of unification source-tracking (July 2002),
  7. 7.
    Choppella, V.: Unification Source-tracking with Application to Diagnosis of Type Inference. PhD thesis, Indiana University, IUCS Tech Report TR566 (August 2002)Google Scholar
  8. 8.
    Corbin, J., Bidoit, M.: A rehabilitation of Robinson’s unification algorithm. In: Mason, R.E.A. (ed.) Information Processing, pp. 909–914. Elsevier Science Publishers (North Holland), Amsterdam (1983)Google Scholar
  9. 9.
    Cox, P.T.: Finding backtrack points for intelligent backtracking. In: Campbell, J. (ed.) Prolog Implementation, pp. 216–233 (1984)Google Scholar
  10. 10.
    Dinesh, T., Tip, F.: A case-study of slicing-based approach for locating type errors. In: Proc. 2nd International Conference on the Theory and Practice of Algebraic Specifications (ASF+SDF 1997) (September 1997)Google Scholar
  11. 11.
    Duggan, D., Bent, F.: Explaining type inference. Science of Computer Programming 27(1), 37–83 (1996)zbMATHCrossRefGoogle Scholar
  12. 12.
    Harrison, M.A.: Introduction to Formal Language Theory. Addison-Wesley, Reading (1978)zbMATHGoogle Scholar
  13. 13.
    Johnson, G.F., Walz, J.A.: A maximum-flow approach to anomaly isolation in unification-based incremental type inference. In: Proceedings of the 13th ACM Symposium on Programming Languages, pp. 44–57 (1986)Google Scholar
  14. 14.
    Lassez, J., Maher, M.J., Marriot, K.: Unification revisited. In: Minker, J. (ed.) Deductive Databases and Logic Programming, ch. 15, pp. 587–625. Morgan Kaufmann, San Francisco (1988)Google Scholar
  15. 15.
    Le Chenadec, P.: On the logic of unification. Journal of Symbolic computation 8(1), 141–199 (1989)zbMATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    Lee, O., Yi, K.: Proofs about a folklore let-polymorphic type inference algorithm. ACM Transactions on Programming Languages 20(4), 707–723 (1998)CrossRefGoogle Scholar
  17. 17.
    Marathe, M.: Personal communication (May 2002)Google Scholar
  18. 18.
    Martelli, A., Montanari, U.: An efficient unification algorithm. ACM Trans. Program. Lang. Syst. 4(2), 258–282 (1982)zbMATHCrossRefGoogle Scholar
  19. 19.
    Melski, D., Reps, T.: Interconvertibility of a class of set constraints and context-free-language reachability. Theoretical Computer Science 248(1-2), 29–98 (2000)zbMATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)zbMATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    Paterson, M., Wegman, M.: Linear unification. J. Comput. Syst. Sci. 16(2), 158–167 (1978)zbMATHCrossRefMathSciNetGoogle Scholar
  22. 22.
    Peterson, G.E., Stickel, M.E.: Complete sets of reductions for some equational theories. Journal for the ACM 28(2), 233–264 (1981)zbMATHCrossRefMathSciNetGoogle Scholar
  23. 23.
    Port, G.S.: A simple approach to finding the cause of non-unifiability. In: Kowalski, R.A., Bowen, K.A. (eds.) Logic Programming: Proceedings of the Fifth International Conference and Symposium, pp. 651–665. MIT Press, Cambridge (1988)Google Scholar
  24. 24.
    Reps, T.: Program analysis via graph reachability. In: Maluszynski, J. (ed.) International Symposium on Logic Programming, pp. 5–19. MIT Press, Cambridge (1997)Google Scholar
  25. 25.
    Tip, F.: Generation of Program Analysis Tools. PhD thesis, Institute for Logic, Language and Computation, CWI, Amsterdam (1995)Google Scholar
  26. 26.
    van Deursen, A., Klint, P., Tip, F.: Origin Tracking. Journal of Symbolic Computation 15, 523–545 (1993); Special issue on automatic programmingGoogle Scholar
  27. 27.
    Walz, J.A.: Extending Attribute Grammars and Type Inference Algorithms. PhD thesis, Cornell University (February 1989), TR 89-968 Google Scholar
  28. 28.
    Wand, M.: Finding the source of type errors. In: 13th Annual ACM Symp. on Principles of Prog. Languages, January 1986, pp. 38–43 (1986)Google Scholar
  29. 29.
    Yang, J., Trinder, P., Michaelson, G., Wells, J.: Improved type error reporting. In: Proceeding of Implementation of Functional Languages, 12th International Workshop, September 2000, pp. 71–86 (2000)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Venkatesh Choppella
    • 1
  • Christopher T. Haynes
    • 1
  1. 1.Computer Science DepartmentIndiana UniversityBloomingtonUSA

Personalised recommendations