maude: Phase 5 system modules + rewrite rules (21 tests, 159 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s

lib/maude/rewrite.sx: rl/crl transitions interleaved with eq normalisation.
mau/rewrite = default strategy (top-down, leftmost-outermost, first rule);
mau/rew bounded; mau/search = BFS reachability over all successors.

lib/maude/fire.sx: short-circuiting matcher (mau/fire-eq) — finds the first
productive match instead of enumerating the whole solution set. Fixes the
exponential blowup of AC rewriting on many identical elements (8 coins:
60s+ to <1s). Eager match-multiset kept only for match-all / search.

Verified on AC coin-change, traffic light, branching search, crl clock.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 15:23:06 +00:00
parent 1747bbd944
commit 858d35a68c
8 changed files with 692 additions and 12 deletions

View File

@@ -10,8 +10,10 @@
;; — termination rests on the guard reducing on structurally smaller arguments
;; (and the global fuel guard).
;;
;; This engine subsumes mau/ac-reduce: an unconditional equation has cond nil,
;; which always holds. Phases 5+ build on the c-* entry points.
;; Single-step firing uses the short-circuiting matcher in fire.sx
;; (mau/fire-eq) so reduction is not quadratic/exponential in AC argument size.
;; The eager candidate enumeration (mau/eq-candidates) is retained for `search`
;; (rewrite.sx), which genuinely needs every successor.
(define
mau/ac-candidates
@@ -92,7 +94,7 @@
(empty? eqs)
nil
(let
((r (mau/try-candidates theory all-eqs (get (first eqs) :cond) term (mau/eq-candidates theory (first eqs) term))))
((r (mau/fire-eq theory all-eqs (first eqs) term)))
(if (= r nil) (mau/crewrite-loop theory all-eqs (rest eqs) term) r)))))
(define