Abstract
Efficient pattern matching is fundamental for practical term rewrite engines. By preprocessing the given patterns into a finite deterministic automaton the matching patterns can be decided in a single traversal of the relevant parts of the input term. Most automaton-based techniques are restricted to linear patterns, where each variable occurs at most once, and require an additional post-processing step to check so-called variable consistency. However, we can show that interleaving the variable consistency and pattern matching phases can reduce the number of required steps to find all matches. Therefore, we take the existing adaptive pattern matching automata as introduced by Sekar et al and extend these with consistency checks. We prove that the resulting deterministic pattern matching automaton is correct, and show several examples where some reduction can be achieved.
Highlights
Efficient pattern matching is fundamental for practical term rewrite engines
Root pattern matching is often sufficient for term rewriting, because applying reduction steps can make matches found for subterms obsolete
We propose a combination of APMAs and CAs to obtain a matching automaton for non-linear patterns called adaptive non-linear pattern matching automata, abbreviated as adaptive non-linear pattern matching automaton (ANPMA)
Summary
Term rewriting is a universal model of computation that is used in various applications, for example to evaluate equalities or simplify expressions in model checking and theorem proving. Term rewriting is the process of repeatedly applying these reduction steps when applicable. Root pattern matching can be described as follows: given a term t and a set of patterns, determine the subset of patterns such that these are (syntactically) equal to t under a suitable substitution for their variables. The other variant, called complete pattern matching, determines the matching patterns for all subterms of t. Root pattern matching is often sufficient for term rewriting, because applying reduction steps can make matches found for subterms obsolete. A root pattern matching algorithm can be used to naively solve the complete pattern matching problem by applying it to every subterm. As the matching patterns need to be decided at each reduction step, various term indexing techniques [SRV01] have been proposed to determine matching patterns efficiently. Key words and phrases: Pattern matching, Term indexing, Tree automata
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.