GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Kiiyya/Lean-HoSmt: Towards a Higher-Order Lean 4 Hammer

BranchesTags
Open more actions menu

Latest commit

 

History

11 Commits
11 Commits

Folders and files

NameName
Last commit message
Last commit date
HoSmt
HoSmt
 
 
doc
doc
 
 
.gitignore
.gitignore
 
 
HoSmt.lean
HoSmt.lean
 
 
README.md
README.md
 
 
lake-manifest.json
lake-manifest.json
 
 
lakefile.lean
lakefile.lean
 
 
lean-toolchain
lean-toolchain
 
 

Repository files navigation

A Higher-Order Lean 4 Hammer

Note: Still in early stages of development!

This repo adds a hammer tactic for Lean 4.

import HoSmt
set_option HoSmt.cvc5 "./bin/cvc5" -- You need to download CVC5 yourself.

theorem hello : ∀x : Nat, x * 0 = 0
  := by smt [Nat.mul_zero]

How it works

Hammers have three stages:

  1. Lemma Selection: Select roughly 1000 as-relevant-as-possible helper lemmas for the problem (i.e. Lean proof goal) we're trying to solve. Not yet implemented.
  2. Translation: Translate proof goal and helper lemmas from Lean to a language that the SMT solver will understand. Lean is built on Martin-Löf type theory and the calculus of inductive constructions, whereas SMT solvers usually want non-polymorphic first or higher order logic. Types are converted to simple types in roughly two steps:
    1. Type index erasure: For example replacing Vec α len with a subtype { v : VecE α // VecG α len v }, where VecE is the index-erased type, and VecG is a guarding predice which enforces the length of v.
    2. Monomorphization: For example occurences of List Nat are replaced with ListNat.
  3. Proof Reconstruction: Running the SMT solver (such as CVC5) produces a proof for the translated (HOL) problem, from which we need to create a proof for the original MLTT+CIC problem. Not yet implemented.

So far, this repo implements an (admittedly buggy) translation from MLTT+CIC to non-polymorphic HOL.

Setting up CVC5

You can obtain CVC5 from CVC5's GitHub Releases. Tested with CVC5 1.0.2 macOS arm64. For some reason the newest version (1.0.5) doesn't like TPTP.

set_option HoSmt.cvc5 "./bin/cvc5"

Documents

This project originates from a science internship (in German: Praxis der Forschung) at KIT.

  • There is a "paper" describing the techniques used, as well as providing tons of references.
  • There also is a presentation.

Acknowledgements

Huge thanks goes out to Jakob who helped me greatly with his deep knowledge of type theory, steering me in the right direction, and most importantly: For being a cool person who believed in me and helping me stay motivated :D.

Related Work

  • Lean-smt incorporates theories such as bitvectors as well, but translates to first order logic.

Misc

Other Options

The default timeout is 3 seconds. You can customize that with

set_option HoSmt.time 10

Folder Structure

Lean-HoSmt/          Repo root (open in VSCode, run `lake build` here, etc.).
    lakefile.lean    Project manifest used by `lake`.
    doc/             Documentation, Presentations, etc.
    HoSmt.lean       "Root source file" defining the `smt` tactic.
    HoSmt/           Source files.
    ...

About

Towards a Higher-Order Lean 4 Hammer

Resources

Readme
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.