This is a template which you can use to quickly play with the translation of snippets of lean 3 code. The procedure is:
- Clone
https://github.com/leanprover-community/mathport/git clone https://github.com/leanprover-community/mathport/ - get in the folder:
cd mathport - install dependencies
cmake,gmp,gmp-devel,jqif needed. On debian/ubuntu:sudo apt install cmake gmp gmp-devel jq(orlibgmp3-devinstead ofgmpandgmp-devel). On mac:brew install cmake jq. On windows this script might not work. - Run
lake exe cache get - Run
make build(go get some coffee!) - Run
make lean3-source - Get a mathport release with
./download-release.sh. You can also use./download-release.sh $my_choiceto specify an explicit version, e.g. $my_choice =nightly-2022-12-13-04. - Put Lean 3 code in
Oneshot/lean3-in/main.lean. - Put extra
#aligninOneshot/lean4-in/Extra.lean - Run
make oneshot
After the first run, you only have to repeat steps 8-10, unless you want to update mathlib (step 7) or mathport itself (git pull and then steps 4-10).
If things work, at the end you should see
# output is in Outputs/src/oneshot/Oneshot/Main.lean.
You may need to add import Mathlib.Mathport.Rename to this file
before the #align commands work.
Also, all you mathlib imports will say import Mathbin.XYZ,
and need to be changed to import Mathlib.XYZ.