A verified lowering from a small Zig surface to the LLVM AST of
Lean-LLVM.
The design is in zig-theory-handoff.md; the work
plan is ROADMAP.md.
nix develop lake build
zig version inside the shell prints the pinned compiler 0.17.1; lean --version prints 4.35.0.
| Path | Contents |
|---|---|
Zigolean.lean |
root library module |
lakefile.toml |
root package, default target, Lean-LLVM git pin |
lake-manifest.json |
committed package manifest: Lean-LLVM, mathlib, and mathlib's requires |
lean-toolchain |
Lean 4.35.0 |
flake.nix, flake.lock |
pinned dev shell, input sources, and Lake path overrides |
tools/gen-lake-manifest.sh |
regenerates lake-manifest.json from the pinned LeanLLVM source |
tools/checks/ |
build and resolution checks |
- Lean-LLVM
dcfcb07491d200cde9179b59e044a0f49a3db722(dcfcb07). - mathlib
56a005855ea17e0b0958f73ec801ae140b0a1679, resolved but never nix-built. - Lean
4.35.0, Zig0.17.1, from the locked nixpkgs.
The flake exposes the pins as .#pins.leanVersion, .#pins.zigVersion,
.#pins.leanllvmRev, .#pins.leanllvmSrc, .#pins.mathlibRev,
.#pins.mathlibSrc, and .#pins.lakePackages.
lake update is never run. The committed lake-manifest.json makes Lake use
the flake's --packages path override instead of auto-updating, and the lake
wrapper in the dev shell refuses update and upgrade.
bash tools/checks/z1-devshell.sh bash tests/checks/z7-compare.sh
The first scenario copies the tree to a fresh directory, evaluates the pins with
nix eval --offline, and runs tools/checks/z1-probe.sh in nix develop --offline with a dead proxy, then asserts the pinned revisions and versions,
that the package override points LeanLLVM and mathlib at the pinned store paths,
that the materialized LeanLLVM copy matches the archived source with no .git,
and that lake build exits 0 without a fetch marker.
The second runs the admitted fixtures through the Lean interpreter and the pinned Zig compiler on the same empty, all-zero, all-nonzero, and mixed byte inputs, compares the two result tables, and checks the rejection fixtures against their error kinds.
Run from the repository root, against a host that can reach the store the archive is copied to:
nix flake archive --to ssh-ng://<host> . tar --exclude=.lake --exclude=.git --exclude='result*' -czf - . \ | ssh <host> 'rm -rf /tmp/zigolean && mkdir -p /tmp/zigolean && tar -xz -C /tmp/zigolean' ssh <host> 'cd /tmp/zigolean && nix develop -c lake build'
nix flake archive copies the flake and every input's source tree into the
host's store, so the host resolves no input and clones no dependency. The one
non-archive substitution is cache.nixos.org: the remote build has no GitHub
route, so only the Lean, Zig, and build-input store paths come from the binary
cache. The sanitized LeanLLVM tree and the packages JSON are built from the
archived source on the host; Lake then copies each pinned package into
.lake/packages (about 219 MB, no network).
bash tools/checks/z1-devshell.shcovers the local no-forge build: every input is evaluated offline, the packages override resolves from the store, and the build runs behind a dead proxy.- The fresh-host leg is a recorded run on
zigolean-01a23129, not an automated check. No script here drives a remote host or asserts anything about one. - The
nix flake archivestep needs the local network once, at archive time; the host build after it does not.
Apache License 2.0. See LICENSE.