-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabsolute-zero.oil
More file actions
executable file
·214 lines (186 loc) · 4.52 KB
/
absolute-zero.oil
File metadata and controls
executable file
·214 lines (186 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/usr/bin/env oil
# Absolute Zero: Oil Shell Wrapper
# Modern shell interface for CNO formal verification
#
# Author: Jonathan D. A. Jewell
# Project: Absolute Zero
# License: AGPL-3.0 / Palimpsest 0.5
# Use Oil's block syntax for better structure
proc show_help {
echo "Absolute Zero - Certified Null Operations"
echo ""
echo "Usage: oil absolute-zero.oil <command>"
echo ""
echo "Commands:"
echo " build - Build all proof systems"
echo " build-coq - Build Coq proofs only"
echo " build-lean - Build Lean 4 proofs only"
echo " build-z3 - Verify Z3 SMT specifications"
echo " verify - Run all verification checks"
echo " test - Run all tests"
echo " clean - Clean build artifacts"
echo " stats - Show proof statistics"
echo " status - Show proof completion status"
echo " help - Show this help message"
echo ""
echo "For more commands, see: just --list"
}
proc check_command {
var cmd = $1
if ! which $cmd &>/dev/null {
echo "⚠ $cmd not found"
return 1
}
return 0
}
proc build_all {
echo "=== Building All Proof Systems ==="
# Check for just
if check_command just {
just build-all
return
}
# Fallback: Manual build
echo "Using manual build (just not found)"
# Build Coq
if check_command coqc {
echo "Building Coq proofs..."
cd proofs/coq/common && coqc CNO.v || {
echo "✗ Coq build failed"
return 1
}
cd ../physics && {
coqc -R ../common CNO StatMech.v
coqc -R ../common CNO LandauerDerivation.v
}
cd ../quantum && coqc -R ../common CNO QuantumMechanicsExact.v
echo "✓ Coq proofs built"
}
# Build Z3
if check_command z3 {
echo "Verifying Z3 specifications..."
z3 proofs/z3/cno_properties.smt2 && echo "✓ Z3 verification complete"
}
# Build Lean 4
if check_command lake {
echo "Building Lean 4 proofs..."
cd proofs/lean4 && lake build && echo "✓ Lean 4 proofs built"
}
# Build TypeScript
if check_command npm {
echo "Building TypeScript..."
npm install && npm run build && echo "✓ TypeScript built"
}
}
proc verify_all {
echo "=== Running All Verification ==="
if check_command just {
just verify-all
return
}
# Manual verification
echo "Checking Coq proofs for Admitted..."
var admitted = $(grep -r "Admitted\." proofs/coq/ | wc -l)
echo "Found $admitted Admitted statements"
echo "Checking Lean 4 proofs for sorry..."
var sorry = $(grep -r "sorry" proofs/lean4/ | wc -l)
echo "Found $sorry sorry statements"
if check_command z3 {
echo "Running Z3 verification..."
z3 proofs/z3/cno_properties.smt2
}
}
proc show_stats {
echo "=== Proof Statistics ==="
if check_command just {
just proof-status
return
}
# Manual stats
echo "Coq files:"
find proofs/coq -name "*.v" -exec wc -l {} + | tail -1
echo "Lean 4 files:"
find proofs/lean4 -name "*.lean" -exec wc -l {} + 2>/dev/null | tail -1 || echo "0"
echo "Z3 specifications:"
wc -l proofs/z3/cno_properties.smt2
}
proc clean_all {
echo "=== Cleaning Build Artifacts ==="
if check_command just {
just clean
return
}
# Manual clean
find proofs/coq -name "*.vo" -delete
find proofs/coq -name "*.vok" -delete
find proofs/coq -name "*.vos" -delete
find proofs/coq -name "*.glob" -delete
cd proofs/lean4 && lake clean 2>/dev/null
rm -rf node_modules dist
echo "✓ Clean complete"
}
# Main command dispatch using Oil's case syntax
proc main {
var cmd = ${1:-help}
case $cmd in
(build)
build_all
;;
(build-coq)
if check_command just {
just build-coq
} else {
cd proofs/coq/common && coqc CNO.v
}
;;
(build-lean)
if check_command just {
just build-lean
} else {
cd proofs/lean4 && lake build
}
;;
(build-z3)
if check_command just {
just build-z3
} else {
z3 proofs/z3/cno_properties.smt2
}
;;
(verify)
verify_all
;;
(test)
if check_command just {
just test-all
} else {
echo "Running tests..."
verify_all
}
;;
(clean)
clean_all
;;
(stats)
show_stats
;;
(status)
if check_command just {
just proof-status
} else {
show_stats
}
;;
(help|--help|-h)
show_help
;;
(*)
echo "Unknown command: $cmd"
echo ""
show_help
return 1
;;
esac
}
# Entry point
main @ARGV