https://github.com/leanprover/adt
https://github.com/leanprover/adt
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/leanprover/adt
- Owner: leanprover
- License: apache-2.0
- Created: 2025-09-10T03:52:40.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-09-12T00:07:23.000Z (11 months ago)
- Last Synced: 2026-01-21T13:12:49.572Z (7 months ago)
- Language: Lean
- Size: 124 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ADT
Abstract Datatypes for Lean 4
This library defines uniform APIs for data structures that have common operations:
* Dependently typed maps: `DHashMap`, `DTreeMap`, `ExtDHashMap`, `ExtDTreeMap`
* Maps: `HashMap`, `TreeMap`, `ExtHashMap`, `ExtTreeMap`
* Sets: `HashSet`, `TreeSet`, `ExtHashSet`, `ExtTreeSet`
To increase modularity, this library also have low-level typeclasses for basic operations on data structures
* The `Size` class: `Size.size`
* The `Foldl`, `FoldlM`, `Foldr`, and `FoldrM` classes: `Foldl.foldl`, `FoldlM.foldlM`, `Foldr.foldr`, `FoldrM.foldrM`
* The `ToList` class: `ToList.toList`
* The `DGetElem` and `DGetElem?` classes: `dGetElem, dGetElem?` and `dGetElem!`. We also defined notations for these operations
* `dGetElem`: `x[m]ᵈ`
* `dGetElem?`: `x[m]ᵈ?`
* `dGetElem!`: `x[m]ᵈ!`
The `IndexMap` file is an example use case of the `MapLike` class. We also included a utility that automatically generates equational theorems for functions that return structure instances. This utility is used by `IndexMap`.