Abstract
Regular path queries are a way of declaratively specifying program analyses as a kind of regular expressions that are matched against paths in graph representations of programs. These and similar queries are useful for other path analysis problems as well. This paper describes the precise specification, derivation, and analysis of a complete algorithm and data structures for solving regular path queries. We first show two ways of specifying the problem and deriving a high-level algorithmic solution, using predicate logic and language inclusion, respectively. Both lead to a set-based fixed-point specification. We then derive a complete implementation from this specification using Paige’s methods that consist of dominated convergence, finite differencing, and real-time simulation. This formal derivation allows us to analyse the time and space complexity of the implementation precisely in terms of size parameters of the graph and the deterministic finite automaton that corresponds to the regular expression. In particular, the time and space complexity is linear in the size of the graph. We also note that the problem is PSPACE-complete in terms of the size of the regular expression. In applications such as program analysis, the size of the graph may be very large, but the size of the regular expression is small and can be considered a constant.
This work was supported in part by ONR under grants N00014-01-1-0109 and N00014-99-1-0132.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
A. V. Aho, J. E. Hopcroft, and J. D. Ullman. Data Structures and Algorithms. Addison-Wesley, Reading, Mass., 1983.
J. Cai, P. Facon, F. Henglein, R. Paige, and E. Schonberg. Type analysis and data structure selection. In B. Möller, editor, Constructing Programs from Specifications, pages 126–164. North-Holland, Amsterdam, 1991.
J. Cai and R. Paige. Program derivation by fixed point computation. Sci. Comput. Program., 11:197–261, Sept. 1988/89.
C.-H. Chang and R. Paige. From regular expressions to DFA’s using compressed NFA’s. Theoret. Comput. Sci., 178(1–2):1–36, May 1997.
O. de Moor, D. Lacey, and E. V. Wyk. Universal regular path queires, Nov. 2001. Revised and being reviewed for Special Issue of Higher-Order and Symbolic Computation dedicated to Bob Paige.
D.-Z. Du and K.-I. Ko. Theory of Computational Complexity. John Wiley & Sons, 2000.
Y. A. Liu. Efficiency by incrementalization: An introduction. Higher-Order and Symbolic Computation, 13(4):289–313, Dec. 2000.
Z. Manna and R. Waldinger. The Deductive Foundations of Computer Programming. Addison-Wesley, Reading, Mass., 1993.
M. Müller-Olm, D. Schmidt, and B. Steffen. Model-checking: A tutorial introduction. In Proceedings of the 6th International Static Analysis Symposium, volume 1694 of Lecture Notes in Computer Science, pages 331–354. Springer-Verlag, Berlin, Sept. 1999.
R. Paige. Formal Differentiation: A Program Synthesis Technique, volume 6 of Computer Science and Artificial Intelligence. UMI Research Press, Ann Arbor, Michigan, 1981. Revision of Ph.D. dissertation, New York University, 1979.
R. Paige. Programming with invariants. IEEE Software, 3(1):56–69, Jan. 1986.
R. Paige. Real-time simulation of a set machine on a RAM. In Computing and Information, Vol. II, pages 69–73. Canadian Scholars Press, 1989. Proceedings of ICCI’ 89: The International Conference on Computing and Information, Toronto, Canada, May 23–27, 1989.
R. Paige. Viewing a program transformation system at work. In M. Hermenegildo and J. Penjam, editors, Proceedings of Joint 6th International Conference on Programming Languages: Implementations, Logics and Programs and 4th International Conference on Algebraic and Logic Programming, volume 844 of Lecture Notes in Computer Science, pages 5–24. Springer-Verlag, Berlin, Sept. 1994.
R. Paige and S. Koenig. Finite differencing of computable expressions. ACM Trans. Program. Lang. Syst., 4(3):402–454, July 1982.
J. T. Schwartz, R. B. K. Dewar, E. Dubinsky, and E. Schonberg. Programming with Sets: An Introduction to SETL. Springer-Verlag, Berlin, New York, 1986.
W. K. Snyder. The SETL2 Programming Language. Technical report 490, Courant nstitute of Mathematical Sciences, New York University, Sept. 1990.
R. E. Tarjan. Fast algorithms for solving path problems. J. ACM, 28(3):594–614, July 1981.
R. E. Tarjan. A unified approach to path problems. J. ACM, 28(3):577–593, July 1981.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Liu, Y.A., Yu, F. (2002). Solving Regular Path Queries. In: Boiten, E.A., Möller, B. (eds) Mathematics of Program Construction. MPC 2002. Lecture Notes in Computer Science, vol 2386. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45442-X_12
Download citation
DOI: https://doi.org/10.1007/3-540-45442-X_12
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43857-1
Online ISBN: 978-3-540-45442-7
eBook Packages: Springer Book Archive