An open API service indexing awesome lists of open source software.

https://github.com/leanprover/lean4export

Plain-text declaration export for Lean 4
https://github.com/leanprover/lean4export

Last synced: 7 months ago
JSON representation

Plain-text declaration export for Lean 4

Awesome Lists containing this project

README

          

A simple declaration exporter for Lean 4 using the [Lean 3 export format](https://github.com/leanprover/lean/blob/master/doc/export_format.md)

## How to Run

```sh
$ lake exe lean4export [-- ]
```
This exports the contents of the given Lean modules, looked up in the core library or `LEAN_PATH` (as e.g. initialized by an outer `lake env`) and their transitive dependencies.
A specific list of declarations to be exported from these modules can be given after a separating `--`.

## Format Extensions

The following commands have been added to represent new features of the Lean 4 type system.

```
#EJ
```
A primitive projection of the ``-nth field of a value `` of the record type ``.
Example: the primitive projection corresponding to `Prod.snd` of the innermost bound variable
```
1 #NS 0 Prod
0 #EV 0
1 #EJ 1 1 0
```

```
#ELN
#ELS *
```
Primitive literals of type `Nat` and `String` (encoded as a sequence of UTF-8 bytes in hexadecimal), respectively.
Examples:
```
0 #ELN 1000000000000000
1 #ELS 68 69 # "hi"
```

```
#EZ
```
A binding `let : := ; `.
Already supported by the Lean 3 export format, but not documented.
Example: the encoding of `let x : Nat := Nat.zero; x` is
```
1 #NS 0 x
2 #NS 0 Nat
0 #EC 2
3 #NS 2 zero
1 #EC 3
2 #EV 0
3 #EZ 1 0 1 2
```