CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

Try doing some basic maths questions in the Lean Theorem Prover. Functions, real numbers, equivalence relations and groups. Click on README.md and then on "Open in CoCalc with one click".

Project: Xena
Views: 18536
License: APACHE
1
#!/bin/bash
2
# Makes a file all.lean in all subfolders of src/ importing all files in that folder,
3
# including subfolders.
4
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
5
# Set DIR to the (absolute) directory of this script
6
for d in $(find $DIR/../src/ -type d)
7
# For every subfolder of src/ (including src/ itself)
8
do
9
cd "$d" # cd to that directory
10
echo "/- automatically generated file importing all files in this directory and subdirectories. -/" > all.lean
11
find . -maxdepth 1 -mindepth 1 -name 'all.lean' -prune -o -name 'lint_mathlib.lean' -prune -o -name '.*' -prune -o -name '*.lean' -print -o -type d -print |
12
# find all non-hidden files with the .lean extension (except all.lean) and all subdirectories
13
sed 's/$/\.all/; s/\.lean\.all//; s/^\.\// \./; 1s/^ /import/' >> all.lean
14
# Now modify this output so that Lean can parse it. Changes `./foo.lean` to `.foo` and `foodir` to `.foodir.all`. Also adds indentation, a comment and `import`. Write this to `all.lean`
15
done
16
17
nolint=0
18
while getopts 't' opt; do
19
case $opt in
20
t) nolint=1 ;;
21
*) echo 'Error in command line parsing' >&2
22
exit 1
23
esac
24
done
25
26
cd $DIR/../src/
27
if [ "$nolint" -eq 1 ]; then
28
cp ../scripts/nolints.txt ./nolints.lean
29
cat <<EOT > lint_mathlib.lean
30
import .nolints
31
EOT
32
else
33
cat <<EOT > lint_mathlib.lean
34
import all
35
EOT
36
fi
37
38
cat <<EOT >> lint_mathlib.lean
39
40
open nat -- need to do something before running a command
41
42
#lint_mathlib- only unused_arguments dup_namespace doc_blame ge_or_gt def_lemma instance_priority
43
impossible_instance incorrect_type_class_argument dangerous_instance
44
EOT
45
46