Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ufmg-smite/lean-smt
Tactics for discharging Lean goals into SMT solvers.
https://github.com/ufmg-smite/lean-smt
lean4 smt
Last synced: about 2 months ago
JSON representation
Tactics for discharging Lean goals into SMT solvers.
- Host: GitHub
- URL: https://github.com/ufmg-smite/lean-smt
- Owner: ufmg-smite
- License: apache-2.0
- Created: 2021-11-23T20:54:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-23T03:18:18.000Z (8 months ago)
- Last Synced: 2024-05-23T03:39:23.714Z (8 months ago)
- Topics: lean4, smt
- Language: Lean
- Homepage:
- Size: 535 KB
- Stars: 72
- Watchers: 6
- Forks: 16
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
- best-of-lean4 - GitHub - 47% open · ⏱️ 17.12.2024): (Packages)
README
# SMT Lean
This project aims to provide Lean tactics that discharge goals into SMT solvers.
It is under active development and is currently in a beta phase. While it is
ready for use, it is important to note that there are still some rough edges and
ongoing improvements being made.## Supported Theories
`lean-smt` currently supports the theories of Uninterpreted Functions and Linear
Integer/Real Arithmetic with quantifiers. Mathlib is currently required for
Arithmetic. Support for the theory of Bitvectors is at an experimental stage. We
are working on adding support for other theories as well.## Requirements
`lean-smt` depends on [`lean-cvc5`](https://github.com/abdoo8080/lean-cvc5) FFI,
which currently only supports Linux (x86_64) and macOS (AArch64 and x86_64).## Usage
To use `lean-smt` in your project, add the following line to your list of
dependencies in `lakefile.lean`:
```lean
require smt from git "https://github.com/ufmg-smite/lean-smt.git" @ "main"def libcpp : String :=
if System.Platform.isWindows then "libstdc++-6.dll"
else if System.Platform.isOSX then "libc++.dylib"
else "libstdc++.so.6"package foo where
moreLeanArgs := #[s!"--load-dynlib={libcpp}"]
moreGlobalServerArgs := #[s!"--load-dynlib={libcpp}"]
```
`lean-smt` comes with one main tactic, `smt`, that translates the current goal
into an SMT query, sends the query to cvc5, and (if the solver returns `unsat`)
replays cvc5's proof in Lean. cvc5's proofs sometimes contain holes, which are
sent back to the user as Lean goals. The user can then fill in these holes
manually or by using other tactics.### Example
To use the `smt` tactic, you just need to import the `Smt` library:
```lean
import Smtexample {U : Type} [Nonempty U] {f : U → U → U} {a b c d : U}
(h0 : a = b) (h1 : c = d) (h2 : p1 ∧ True) (h3 : (¬ p1) ∨ (p2 ∧ p3))
(h4 : (¬ p3) ∨ (¬ (f a c = f b d))) : False := by
smt [h0, h1, h2, h3, h4]
```