44# CONFIGURATION
55# ==============================================================================
66
7+ # Default value for precompileModules
8+ PRECOMP=false
9+
10+ # Time format
11+ TIMEFORMAT=" this took %R seconds"
12+
13+ # Parse command line arguments
14+ while [[ $# -gt 0 ]]; do
15+ case $1 in
16+ --precomp)
17+ PRECOMP=" $2 "
18+ shift 2
19+ ;;
20+ * )
21+ echo " Unknown option: $1 "
22+ echo " Usage: $0 [--precomp true|false]"
23+ exit 1
24+ ;;
25+ esac
26+ done
27+
28+ # Validate precomp value
29+ if [[ " $PRECOMP " != " true" && " $PRECOMP " != " false" ]]; then
30+ echo " Error: --precomp must be 'true' or 'false'"
31+ exit 1
32+ fi
33+
34+ # Modify lakefile.toml
35+ echo " --- Setting precompileModules = $PRECOMP in lakefile.toml ---"
36+ if [[ -f " lakefile.toml" ]]; then
37+ # Use sed to replace the precompileModules line
38+ # This handles various formats: precompileModules = true/false with/without quotes
39+ # Empty string after -i means no backup (works on both Linux and macOS)
40+ sed -i ' ' " s/^precompileModules = .*/precompileModules = $PRECOMP /" lakefile.toml
41+ echo " Updated lakefile.toml"
42+ else
43+ echo " Warning: lakefile.toml not found"
44+ fi
45+
746cmd_trans () {
847 lake build Benchmark.RunTrans
948}
@@ -41,15 +80,16 @@ parse_lean_output() {
4180 '
4281}
4382
44- TIMEFORMAT=" this took %R seconds"
83+ echo " --- Deleting .oleans ---"
84+ lake clean
4585
4686echo " --- Running Benchmark: Transitivity ---"
4787# Capture output and evaluate it
4888eval $( time cmd_trans | parse_lean_output " FIG1_" )
4989
5090
5191echo " --- Running Benchmark: Depth ---"
52- time eval $( cmd_depth | parse_lean_output " FIG2_" )
92+ eval $( time cmd_depth | parse_lean_output " FIG2_" )
5393
5494{
5595 echo " Transitivity Benchmark"
@@ -175,4 +215,4 @@ if command -v pdflatex &> /dev/null; then
175215 echo " Done! Generated benchmark_results.pdf"
176216else
177217 echo " Warning: pdflatex not found. The .tex file was created but not compiled."
178- fi
218+ fi
0 commit comments