Worth noting that pattern matching and term rewriting are a sufficiently general combination that it forms the basis for Mathematica.
LLM style pattern matching and rewriting does not preserve semantics, except accidentally due to an overwhelming amount of examples.