lean-proof-checker / setup_lean.sh
Angshul's picture
Upload 8 files
13e1f35 verified
Raw History Blame Contribute Delete
864 Bytes
#!/usr/bin/env bash
# Installs elan + Lean 4 + a Mathlib project with prebuilt cache into $HOME/leancheck.
# Idempotent: re-running skips what is already there. Runs at every Space start
# (the Space disk is not persistent), takes ~5-10 minutes on a cold start.
set -euo pipefail
export PATH="$HOME/.elan/bin:$PATH"
if [ ! -x "$HOME/.elan/bin/lake" ]; then
echo "== installing elan"
curl -sSfL https://elan.lean-lang.org/elan-init.sh -o /tmp/elan-init.sh
sh /tmp/elan-init.sh -y --default-toolchain none --no-modify-path
fi
cd "$HOME"
if [ ! -f leancheck/lakefile.toml ] && [ ! -f leancheck/lakefile.lean ]; then
echo "== creating Mathlib project"
rm -rf leancheck
lake +leanprover-community/mathlib4:lean-toolchain new leancheck math
fi
cd leancheck
echo "== downloading prebuilt Mathlib"
lake exe cache get
mkdir -p scratch
echo "LEAN-SETUP-DONE"