Memoize rule applications