mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 18:34:06 +00:00
joachim/string-neq-proc2
This PR optimizes the `String.reduceEq`, `String.reduceNe`, and `Sym.Simp` string equality simprocs to produce kernel-efficient proofs. Previously, these used `String.decEq` which forced the kernel to run UTF-8 encoding/decoding and byte array comparison, causing 86+ kernel unfoldings on short strings. The new approach uses `String.ofList_injective` combined with `congrArg (List.get?Internal · i)` at the first differing character position, reducing kernel work to O(first_diff_pos) list indexing plus a single character comparison. For equal strings, `eq_true rfl` avoids kernel evaluation entirely. The shared proof construction is in `Lean.Meta.mkStringLitNeProof`, used by both the standard simprocs and the `Sym.Simp` ground evaluator. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This is the repository for Lean 4.
About
- Quickstart
- Homepage
- Theorem Proving Tutorial
- Functional Programming in Lean
- Documentation Overview
- Language Reference
- Release notes starting at v4.0.0-m3
- Examples
- External Contribution Guidelines
Installation
See Install Lean.
Contributing
Please read our Contribution Guidelines first.
Building from Source
See Building Lean.
Languages
Lean
94.3%
C++
4.1%
Python
0.6%
Shell
0.4%
CMake
0.3%