
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
A Lean 4 Jupyter kernel via repl.
🔥 See it in action: Tutorial notebook.
The kernel can:
% proof
immediately after a sorry
ed theorem% env 1
or % prove 3
%cd
or %load
(loading a file)Mathlib
( demo ).Output:
jupyter notebook
and alike: echos the input annotated in alectryon style, at the corresponding line (not columns yet), with messages, proof states etc.jupyter console
and alike: echos the input annotated in codespan style, at the corresponding line:column
, with messages, proof states etc.repl
input/output in JSON format can be inspected by click-to-expand in the WebUI.The kernel code is linted by flake8, and tested with nbval in CI.
repl
input/output inspection as a magic, disable it by default%cd
and %load
work more robustlytactics
after %load
repl
test cases to the CI and set up coverage%lake
, e.g. %lake build
import
If you are interested in one of these TODOs, or you have some other nice features in mind, you may raise the discussion by opening an issue or discuss it in the Zulip topic.
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | bash -s -- -y --default-toolchain none
The following script will install a repl
of a compatible Lean 4 toolchain, the kernel, and prepare the demo Lean 4 project.
git clone https://github.com/utensil/lean4_jupyter.git && cd lean4_jupyter && ./scripts/prep.sh
Note: the script could remove an existing repl
, and it assumes /usr/local/bin
is in your PATH
, it will also set the default Lean 4 toolchain to the same as the one used by the repl
to ensure repl
works outside projects.
If you prefer manual installation, please read Manual installation below.
To use it, run one of:
# Web UI
jupyter notebook
jupyter lab
# Console UI
# hint: use Ctrl-D and confirm with y to exit
jupyter console --kernel lean4
# hint: you need to run `pip install PyQt5 qtconsole` to install it
jupyter qtconsole --kernel lean4
then open notebooks in the examples
folder to familiarize yourself with the basic usage.
First, verify that lean
and lake
is in your PATH
:
lean --version
lake --help|head -n 1
they should output Lean/Lake versions, respectively. If not, you can install them via elan.
Then, you need to have a working repl
in your PATH
.
You can build it from source (please read and adjust them before executing) using the example script scripts/install_repl.sh
.
Verify that repl
is working:
echo '{"cmd": "#eval Lean.versionString"}'|repl
In case repl
hangs, you could kill it with
ps aux|grep repl|grep -v grep|awk '{print $2}'|xargs kill -9
Then, ensure that you have python
, pip
installed, and install Jupyter:
pip install notebook
# or
# pip install jupyterlab
Then, install the kernel:
# Option 1: Install from PyPI
# see "Support matrix" for the tested versions
pip install lean4_jupyter
# Option 2 (recommended): install the latest version from the repo
pip install git+https://github.com/utensil/lean4_jupyter.git
# or in development mode, check out the repo then run
# pip install -e .
python -m lean4_jupyter.install
To use it, run one of:
# Web UI
jupyter notebook
jupyter lab
# Console UI
# hint: use Ctrl-D and confirm with y to exit
jupyter console --kernel lean4
# hint: you need to run `pip install PyQt5 qtconsole` to install it
jupyter qtconsole --kernel lean4
I've always wanted to do literate programming with Lean 4 in Jupyter, but Lean LSP and Infoview in VS Code has provided an immersive experience with immediate feedback, so I could never imagine a better way to interact with Lean 4, until interacting with repl makes me believe that limitless backtrack is another feature that best accompanies the reproducible interactivity of alectryon style annotations.
The idea came to me in an afternoon, and I thought it's technically trivial to implement overnight thanks to repl. It took me a bit longer to work out the logistics of UX and polish the code, but it's fun to see the potential.
This also serves as a human-friendly way to understand how Lean 4 repl works, for integrating repl with ML systems.
lean4_jupyter | Tested Lean 4 toolchain | Tested Python version |
---|---|---|
0.0.1 | v4.8.0-rc1 | 3.11.0 |
0.0.2 | v4.11.0 | 3.11.0 |
git main | v4.11.0 | 3.11.0 |
FAQs
lean4_jupyter: A Lean 4 Jupyter kernel via REPL
We found that lean4-jupyter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.