Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a new rewrite engine based on rewriting theory #1717

Open
wants to merge 138 commits into
base: master
Choose a base branch
from

Conversation

mlaveaux
Copy link
Member

This pull request forms the basis for a new rewrite engine with the goal to resolve issue #912. It is (for now) a pure innermost rewrite based on non-linear adaptive pattern matching automata. This pull request is mostly to start with compilation on different platforms and testing.

Matching

Matching is based on the work "Adaptive Non-linear Pattern Matching Automata.", with several variations that can be toggled for experimental comparison. The current implementation positions are indexed into a sub term table for faster consistency checking (avoiding linear walk through term) and delivering the matching substitution.

Progress

  • Implement an iterative rewrite engine using a configuration stack that avoids the need of tracking normal forms and computing matching substitution. I think this can also avoid the construction of intermediate terms somewhat.
  • Add pseudo code from papers into the documentation.
  • Integrate strategy from the just-in-time rewrite engine.
  • Higher order matching.
  • It is not yet competitive with the existing rewriters.
  • Print rewrite steps performed, debug information and metrics.
  • Introduce the notion of positions to the toolset.
  • Added the mCRL2 benchmarks from the "Rewrite Engines Competition" benchmark set.
  • Implemented a naive matching algorithm that can optionally index on the head symbol.
  • Implemented the non-linear pattern matching automata for matching either performing consistency checks during matching or afterwards.
  • Implemented a straightforward innermost rewriter that can deal with enumeration, lambda terms.
  • Implemented rewrite cache of closed terms for experimentation, disabled by default.
  • Track normal forms of the right-hand side using a tag, or using an unordered set.

@mlaveaux mlaveaux added the feature New functionality label Jul 18, 2023
@mlaveaux mlaveaux self-assigned this Jul 18, 2023
@mlaveaux mlaveaux force-pushed the feature/rewriter branch 2 times, most recently from b19d9bc to 037a140 Compare March 12, 2024 16:49
 * Improved matching by ignoring impossible cases.
 * Clear the set of normal forms after the rewriting for more consistent
   benchmarking.
mlaveaux and others added 29 commits March 15, 2024 11:59
 * Although this still causes allocations it is far more efficient than
   map based substitutions, because the number of bound variables is low.
 * The assumption is that all assignments take place before the next
   sequence substitution is created, and that its destruction takes place
   in reverse order of creation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant