feat: add permutation theorem support to `Sym.simp` (#13046) This PR prevents `Sym.simp` from looping on permutation theorems like `∀ x y, x + y = y + x`. - Add `perm : Bool` field to `Theorem` - Add `isPerm` that checks if LHS and RHS have the same structure with pattern variables (de Bruijn indices) rearranged via a consistent bijection. Uses `ReaderT` (offset for binder entry), `StateT` (forward/backward maps), `ExceptT` (failure). - Compute `perm` in `mkTheoremFromDecl` / `mkTheoremFromExpr` - In `Theorem.rewrite`, when `perm` is true, only apply the rewrite if the result is strictly less than the input (using `acLt`) - Tests include the classic AC normalization stress test with `add_comm`, `add_assoc`, `add_left_comm` --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This is the repository for Lean 4.
See Install Lean.
Please read our Contribution Guidelines first.
See Building Lean.