0art0 / LeanInk

LeanInk is a command line helper tool for Alectryon which aims to ease the integration of Lean 4.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LeanInkLogo

CI LƎⱯN - 4

This branch of LeanInk is a bare-bones version meant for extracting tactic data from mathlib4. It was derived from the original LeanInk source by iteratively simplifying and customising the code for tactic data extraction.

To extract the tactic data from the latest version of Mathlib, run the extract_tactic_data script as bash extract_tactic_data.sh . 4. The first argument indicates the directory relative to the main Mathlib folder, and the second indicates the number of threads to use while running the tactic extraction in parallel.

LeanInk is a command line helper tool for Alectryon which aims to ease the integration and support of Lean 4. Alectryon uses the information provided by LeanInk to create a static code visualization for Lean 4 code. For more information about Alectryon make sure to take a look at their repository.

The official version of Alectryon does not yet support LeanInk, as LeanInk is still in active development. Please use our Alectryon Fork to test LeanInk.

Installation

Building from source is the recommended way of trying out this fork of LeanInk.

Building from source

Before you can build LeanInk from source make sure to install the latest version of Lean 4 using elan. This will also automatically install the Lake package manager.

git clone https://github.com/0art0/LeanInk --branch tactic-extraction
cd LeanInk
lake exe cache get
lake build

To install this built version it is recommended you simply add the LeanInk/build/bin folder to your PATH environment.

Usage

Analyzing a simple lean program Input.lean is very straightforward. To do so you simply provide LeanInk the input file.

./build/bin/leanInk Input.lean

This creates a file Input.lean.json in the TacticExtractionData folder with the data of the tactic states. If the TacticExtractionData folder does not already exist, it can be created by running

mkdir TacticExtractionData

However, in practice the code is designed to generate tactic-step data in bulk from mathlib4 files. The Python script tactic_extraction.py runs the leanInk script concurrently on the entire mathlib4 directory (using the version specified in the lakefile or manifest.json file), handling the creation of the TacticExtractionData folder in the process. The variable num_workers in the tactic_extraction.py file can be modified to set the maximum number of processes that are allowed to run in parallel.

The entire tactic extraction process is bundled up into the extract_tactic_data.sh script in the top-level directory. Instructions for use are mentioned in the second paragraph of this README file.

Contributing

LeanInk enforces the same Contribution Guidelines as Lean 4. Before contributing, make sure to read it.

We also highly encourage you to sign your commits.

About

LeanInk is a command line helper tool for Alectryon which aims to ease the integration of Lean 4.

License:Apache License 2.0


Languages

Language:Lean 78.3%Language:Python 16.2%Language:Shell 5.5%