https://github.com/chasenorman/canonicallean
A Lean tactic for Canonical, a search procedure for terms in dependent type theory.
https://github.com/chasenorman/canonicallean
automated-reasoning dependent-type-theory dependent-types formal-methods lean4 program-synthesis theorem-prover theorem-proving
Last synced: 4 months ago
JSON representation
A Lean tactic for Canonical, a search procedure for terms in dependent type theory.
- Host: GitHub
- URL: https://github.com/chasenorman/canonicallean
- Owner: chasenorman
- License: mit
- Created: 2025-04-10T05:24:53.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-10-31T17:37:31.000Z (4 months ago)
- Last Synced: 2025-10-31T19:21:59.264Z (4 months ago)
- Topics: automated-reasoning, dependent-type-theory, dependent-types, formal-methods, lean4, program-synthesis, theorem-prover, theorem-proving
- Language: Lean
- Homepage: https://chasenorman.com
- Size: 8.16 MB
- Stars: 89
- Watchers: 3
- Forks: 8
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Canonical
[Canonical](https://github.com/chasenorman/Canonical) exhaustively searches for terms in dependent type theory. The `canonical` tactic proves theorems, synthesizes programs, and constructs objects in Lean.
https://github.com/user-attachments/assets/ec13ad85-7d09-4a32-9c73-3b5b501722a4
## Installation
Add the following dependency to your `lakefile.toml`:
```
[[require]]
name = "Canonical"
scope = "chasenorman"
```
Or, if you are using a `lakefile.lean`:
```
require "chasenorman" / "Canonical"
```
You should then be prompted to run `lake update Canonical`.
## Usage
Basic examples:
```lean
import Canonical
-- prove properties by induction
def add_assoc (a b c : Nat) : (a + b) + c = a + (b + c) :=
by canonical
-- enumerate over elements of a type
example : List Nat := by canonical (count := 10)
-- supply premises
def Set (X : Type) := X → Prop
axiom P_ne_not_P : P ≠ ¬ P
theorem Cantor (f : X → Set X) : ¬ ∀ y, ∃ x, f x = y :=
by canonical [P_ne_not_P, congrFun]
```
More examples can be found [in the Canonical repository](https://github.com/chasenorman/Canonical/tree/main/lean/Results).