-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
255 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# This Dockerfile mostly exists to verify that the Makefile works; | ||
# it's unlikely that we'll actually use it "in production"! | ||
# You may also need to allow the Docker engine a lot of memory (32gb?) | ||
FROM ubuntu | ||
|
||
USER root | ||
|
||
# Set timezone to UTC to avoid prompts from tzdata. | ||
RUN TZ=UTC ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
# Install prerequisites. | ||
RUN apt-get update && \ | ||
apt-get install -y git libgmp-dev cmake ccache gcc-10 g++-10 && \ | ||
apt-get install -y build-essential && \ | ||
apt-get install -y curl python3-yaml python3 python-is-python3 && \ | ||
apt-get clean | ||
|
||
# create a non-root user | ||
RUN useradd -m lean | ||
|
||
USER lean | ||
WORKDIR /home/lean | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
# set the entrypoint to be a login shell, so everything is on the PATH | ||
ENTRYPOINT ["/bin/bash", "-l"] | ||
|
||
# make sure binaries are available even in non-login shells | ||
ENV PATH="/home/lean/.elan/bin:/home/lean/.local/bin:$PATH" | ||
|
||
## TODO: Once `lake` is distributed as part of Lean4, hopefully we can just install `elan`: | ||
# install elan | ||
# RUN curl https://raw.githubusercontent.com/Kha/elan/master/elan-init.sh -sSf | sh -s -- -y && \ | ||
# . ~/.profile && \ | ||
# elan toolchain uninstall stable | ||
|
||
## For now, we need to grab an old version of `elan-init` and build `lake` ourselves: | ||
|
||
RUN curl -L https://github.com/leanprover/elan/releases/download/v1.0.8/elan-x86_64-unknown-linux-gnu.tar.gz -o elan.tar.gz && \ | ||
tar zxf elan.tar.gz && \ | ||
rm elan.tar.gz && \ | ||
./elan-init -y && \ | ||
. ~/.profile && \ | ||
elan toolchain uninstall stable | ||
|
||
# We need to set CC and CCX while building lake. | ||
ENV CC="gcc-10" | ||
ENV CXX="g++-10" | ||
|
||
RUN mkdir -p /home/lean/.local/bin | ||
RUN git clone https://github.com/leanprover/lake && \ | ||
cd lake && \ | ||
./build.sh && \ | ||
ln -s /home/lean/lake/build/bin/lake /home/lean/.local/bin/lake | ||
|
||
# TODO: switch back to the main mathport repository once the Makefile PR merges. | ||
RUN git clone https://github.com/semorrison/mathport --branch Makefile | ||
WORKDIR /home/lean/mathport | ||
|
||
# We need to set CC and CCX while building lean3 / lean4. | ||
ENV CC="gcc-10" | ||
ENV CXX="g++-10" | ||
|
||
RUN make mathbin-source | ||
RUN make lean3-source | ||
RUN make lean4-source | ||
RUN make lean3-predata | ||
RUN make mathbin-predata | ||
RUN make build | ||
RUN make port-lean | ||
RUN make port-mathbin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ build/ | |
Logs/ | ||
PreData/ | ||
Lib4/*/ | ||
lean_packages/ | ||
sources/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Mathlib | ||
import Mathbin | ||
|
||
#check Semiring | ||
#lookup3 semiring | ||
#check Semiringₓ | ||
|
||
#lookup3 nat.exists_infinite_primes | ||
|
||
example (n : Nat) : n + n = 2 * n := by ring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
leanprover/lean4:nightly-2021-10-02 | ||
leanprover/lean4:nightly-2021-10-16 |
Submodule mathlib
added at
c33b82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
# Usage: mk_all.sh [subdirectory] | ||
# | ||
|
||
cd $1 | ||
find . -name \*.lean -not -name all.lean \ | ||
| sed 's,^\./,,;s,\.lean$,,;s,/,.,g;s,^,import ,' \ | ||
| sort > ./all.lean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From 9228d3949bda8c1411e707b3e20650fa1fdb9b4d Mon Sep 17 00:00:00 2001 | ||
From: Daniel Selsam <[email protected]> | ||
Date: Sat, 23 Jan 2021 15:00:09 -0800 | ||
Subject: [PATCH] temp: whnf the type of inductives | ||
|
||
--- | ||
src/kernel/inductive.cpp | 8 +++++++- | ||
1 file changed, 7 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/kernel/inductive.cpp b/src/kernel/inductive.cpp | ||
index 3d1a47659b..9c48383c36 100644 | ||
--- a/src/kernel/inductive.cpp | ||
+++ b/src/kernel/inductive.cpp | ||
@@ -168,6 +168,7 @@ public: | ||
tc().check(type, m_lparams); | ||
m_nindices.push_back(0); | ||
unsigned i = 0; | ||
+ type = whnf(type); | ||
while (is_pi(type)) { | ||
if (i < m_nparams) { | ||
if (first) { | ||
@@ -181,9 +182,11 @@ public: | ||
} | ||
i++; | ||
} else { | ||
- type = binding_body(type); | ||
+ expr index = mk_local_decl_for(type); | ||
+ type = instantiate(binding_body(type), index); | ||
m_nindices.back()++; | ||
} | ||
+ type = whnf(type); | ||
} | ||
if (i != m_nparams) | ||
throw kernel_exception(m_env, "number of parameters mismatch in inductive datatype declaration"); | ||
@@ -527,6 +530,8 @@ public: | ||
rec_info info; | ||
expr t = ind_type.get_type(); | ||
unsigned i = 0; | ||
+ | ||
+ t = whnf(t); | ||
while (is_pi(t)) { | ||
if (i < m_nparams) { | ||
t = instantiate(binding_body(t), m_params[i]); | ||
@@ -536,6 +541,7 @@ public: | ||
t = instantiate(binding_body(t), idx); | ||
} | ||
i++; | ||
+ t = whnf(t); | ||
} | ||
info.m_major = mk_local_decl("t", mk_app(mk_app(m_ind_cnsts[d_idx], m_params), info.m_indices)); | ||
expr C_ty = mk_sort(m_elim_level); | ||
-- | ||
2.30.1 (Apple Git-130) | ||
|