Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This PR introduces the `@[specs]` attribute. It can be applied to (certain) type class instances and define “specification theorems” for the class’ operations, by taking the equational theorems of the implementation function mentioned in the type class instance and rephrasing them in terms of the overloaded operations. Fixes #5295. Example: ``` inductive L α where | nil : L α | cons : α → L α → L α def L.beqImpl [BEq α] : L α → L α → Bool | nil, nil => true | cons x xs, cons y ys => x == y && L.beqImpl xs ys | _, _ => false @[method_specs] instance [BEq α] : BEq (L α) := ⟨L.beqImpl⟩ /-- info: theorem instBEqL.beq_spec_2.{u_1} : ∀ {α : Type u_1} [inst : BEq α] (x_2 : α) (xs : L α) (y : α) (ys : L α), (L.cons x_2 xs == L.cons y ys) = (x_2 == y && xs == ys) -/ #guard_msgs(pass trace, all) in #print sig instBEqL.beq_spec_2 ``` It also introduces the `method_specs_norm` simpset to allow registering further normalization of the theorems. The intended use of this is to rewrite, say, `Append.append` to the `HAppend.hAppend` (i.e. `++`) that the user wants to see. Library annotations to follow in a separate PR. |
||
|---|---|---|
| .github | ||
| doc | ||
| images | ||
| releases_drafts | ||
| script | ||
| src | ||
| stage0 | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| .gitpod.Dockerfile | ||
| .gitpod.yml | ||
| .ignore | ||
| CMakeLists.txt | ||
| CMakePresets.json | ||
| CODEOWNERS | ||
| CONTRIBUTING.md | ||
| flake.lock | ||
| flake.nix | ||
| lean-toolchain | ||
| lean.code-workspace | ||
| LICENSE | ||
| LICENSES | ||
| README.md | ||
| RELEASES.md | ||
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 Setting Up Lean.
Contributing
Please read our Contribution Guidelines first.
Building from Source
See Building Lean.