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
- Host: GitHub
- URL: https://github.com/leanprover/lean4export
- Owner: leanprover
- License: apache-2.0
- Created: 2023-03-01T12:42:13.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-18T01:44:23.000Z (over 1 year ago)
- Last Synced: 2025-02-12T03:47:34.352Z (over 1 year ago)
- Language: Lean
- Size: 7.19 MB
- Stars: 13
- Watchers: 17
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```