Unicode algorithms for Lean 4 that are too large or too specialized to live in UnicodeBasic.
This library is one of a small family of Lean 4 Unicode libraries. Each one has a narrow job, so you only depend on what you need.
| Library | What it is for |
|---|---|
| UnicodeBasic | The foundation. Fast lookups of commonly used character properties such as general category, case mappings, numeric values, scripts and names, from compact precompiled tables. Start here. |
| UnicodeData | Direct access to the Unicode Character Database files themselves, such as UnicodeData.txt, PropList.txt, CaseFolding.txt and SpecialCasing.txt. Heavier than UnicodeBasic, but complete, and handy for properties UnicodeBasic does not cover or for checking it against the source. |
| UnicodeFormat | Encoding and decoding: UTF-8, UTF-16 and UTF-32, the byte-level encoding schemes with byte order marks, strict and lossy decoding, and streaming iterators. |
| UnicodeLemmas | Proofs about UnicodeBasic properties, such as the fact that every cased character is alphabetic. |
| UnicodeExtra (this library) | Unicode algorithms built on top of UnicodeBasic. |
UnicodeBasic answers questions about single characters: what is the general category of this character, what is its lowercase form, which script does it belong to? Many real tasks need more than that. They work on whole strings and follow the multi-step algorithms specified in the Unicode Standard and its annexes, often with extra data tables and many special cases.
That kind of code would make UnicodeBasic slower to build and harder to keep lightweight, so it lives here instead. Typical candidates are algorithms such as full case mapping and case-insensitive comparison, normalization, text segmentation into grapheme clusters, words and sentences, and line breaking. UnicodeExtra depends on UnicodeBasic and reuses its character properties rather than duplicating them.
The library is new and still taking shape. If there is a Unicode algorithm you would like to see here, please open an issue!
Add the following dependency to your project's lakefile.toml:
[[require]]
name = "UnicodeExtra"
git = "https://github.com/fgdorais/lean4-unicode-extra.git"
rev = "main" # or any specific revisionOr this dependency to your project's lakefile.lean:
require UnicodeExtra from git
"https://github.com/fgdorais/lean4-unicode-extra.git" @ "main"You can generate documentation locally using lake build UnicodeExtra:docs in the docs directory.
- The
Lean 4 / Unicode Extralibrary is copyright © 2026 François G. Dorais. The library is released under the Apache 2.0 license. See the file LICENSE for additional details.