brendanzab / lean-holes

Interactive holes for Lean 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lean-holes

Warning

This is an experimental and incomplete proof-of-concept!

A syntax extension for Lean 4 that adds support for interactive holes1. The goal is to make it easier to interactively construct programs and direct-style proofs in a type directed way.

Holes can be introduced using following custom syntax:

syntax "?" : term
syntax "{!" (term)? "!}" : term

For examples, see Examples/Sample.lean.

A series of code actions are provided:

  • Fill with contents
  • Fill with elaborated contents
  • Automatically fill a hole (NOTE: rudimentary support2)
  • Refine hole
  • Split hole
  • Make definition

The same actions have been added to _, ?_, and sorry.

Resources

This was inspired by this conversation with David Christiansen on Mastodon.

Agda docs:

Idris:

Footnotes

  1. As seen in Agda and Idris. I’m not exactly sure when interactive holes where first introduced however... possibly in Epigram?

  2. Auto-filling currently just looks up the local context for a matching declaration.

About

Interactive holes for Lean 4


Languages

Language:Lean 100.0%