-
-
Notifications
You must be signed in to change notification settings - Fork 0
258 lines (229 loc) · 8.27 KB
/
Copy pathverify-proofs.yml
File metadata and controls
258 lines (229 loc) · 8.27 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# SPDX-License-Identifier: MPL-2.0
# This workflow is managed by gh actions-lock.
# Consolidated workflow (behaviour-preserving merge).
# Merged from: verify-idris.yml, verify-lean.yml, verify-tlaplus.yml
name: Verify Proofs (Idris / Lean / TLA+)
on:
push:
paths:
- .github/workflows/verify-proofs.yml
- Justfile
- pack.toml
- verification/proofs/idris2/**
- verification/proofs/lean4/**
- verification/proofs/tlaplus/**
- src/abi/**
- src/Hypatia/ABI/**
- verify/**
branches:
- main
pull_request:
paths:
- .github/workflows/verify-proofs.yml
- Justfile
- pack.toml
- verification/proofs/idris2/**
- verification/proofs/lean4/**
- verification/proofs/tlaplus/**
- src/abi/**
- src/Hypatia/ABI/**
- verify/**
branches:
- main
schedule:
# Weekly Monday 04:00 UTC — single trigger. The three crons (04:00,
# 04:30, 05:00) were inherited from the pre-consolidation
# verify-{idris,lean,tlaplus}.yml workflows and fired the now-merged
# workflow three times every Monday. Collapsed to one.
- cron: '0 4 * * 1'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
type-check:
name: idris2 --check
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
env:
IDRIS2_VERSION: v0.7.0
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Install Chez Scheme
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y chezscheme
- name: Cache Idris 2 install
id: cache-idris
uses: actions/cache@v6.1.0
with:
path: |
/usr/local/bin/idris2
/usr/local/bin/idris2_app
/usr/local/lib/idris2
~/.idris2
# `idris2` is only a launcher script; it execs its sibling
# idris2_app/idris2.so. The previous cache omitted idris2_app/, so
# every cache *hit* restored a launcher with no image and died with
# `idris2_app/idris2.so: not found` (exit 127) before any proof ran.
# Key bumped to -2 to discard those poisoned caches.
key: idris2-${{ env.IDRIS2_VERSION }}-${{ runner.os }}-2
- name: Build Idris 2 from source
if: steps.cache-idris.outputs.cache-hit != 'true'
run: |
set -euo pipefail
git clone --depth 1 --branch "${IDRIS2_VERSION}" \
https://github.com/idris-lang/Idris2 /tmp/idris2
cd /tmp/idris2
make bootstrap SCHEME=chezscheme
sudo make install PREFIX=/usr/local
idris2 --version
- name: Verify Idris is on PATH
run: idris2 --version
- name: Type-check every .idr proof file
working-directory: verification/proofs/idris2
run: |
set -euo pipefail
failed=0
for f in *.idr; do
echo "── $f ─────────────────────────────────────────────"
if idris2 --check "$f"; then
echo "✓ $f"
else
echo "✗ $f"
failed=$((failed + 1))
fi
done
if [ "$failed" -gt 0 ]; then
echo "::error::$failed Idris proof file(s) failed to type-check"
exit 1
fi
# The standalone files above are only half the Idris proof surface. The
# richest proofs (RuleEngine's safety-triangle / dispatch / Bayesian
# monotonicity, the FFI ApiResponse proof, the pipeline state machine)
# live in the ABI and verify *packages*, which the per-file --check loop
# never builds. Gate them here so they can't silently rot again.
- name: Build the ABI proof package (Types, GraphQL, gRPC, REST, FFI, RuleEngine)
run: idris2 --build src/abi/hypatia-abi.ipkg
- name: Build the verify package (PipelineState, Verify.Fuel)
run: idris2 --build verify/hypatia-verify.ipkg
- name: Summary
if: always()
run: |
{
echo "## Idris 2 proof verification"
echo ""
echo "- Toolchain: Idris 2 \`${IDRIS2_VERSION}\` (from source, Chez Scheme backend)"
echo "- Proof files checked:"
for f in verification/proofs/idris2/*.idr; do
echo " - \`$(basename "$f")\`"
done
} >> "$GITHUB_STEP_SUMMARY"
lake-build:
name: lake build
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
env:
ELAN_VERSION: v4.0.0
# Pinned (not :stable) so the proofs are checked against the exact Lean
# they were verified with. Matches verification/proofs/lean4/lean-toolchain;
# bump both together. A moving :stable can break version-sensitive lemmas.
LEAN_TOOLCHAIN: leanprover/lean4:v4.30.0
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Cache Lean toolchain and build
id: cache-lean
uses: actions/cache@v6.1.0
with:
path: |
~/.elan
verification/proofs/lean4/.lake
key: lean-${{ env.ELAN_VERSION }}-${{ env.LEAN_TOOLCHAIN }}-${{ hashFiles('verification/proofs/lean4/lakefile.lean', 'verification/proofs/lean4/*.lean') }}
restore-keys: |
lean-${{ env.ELAN_VERSION }}-${{ env.LEAN_TOOLCHAIN }}-
- name: Install elan + Lean 4
if: steps.cache-lean.outputs.cache-hit != 'true'
run: |
set -euo pipefail
curl -fL -o /tmp/elan-init.sh "https://raw.githubusercontent.com/leanprover/elan/${ELAN_VERSION}/elan-init.sh"
sh /tmp/elan-init.sh -y --default-toolchain "${LEAN_TOOLCHAIN}" --no-modify-path
- name: Put elan on PATH
run: echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
- name: lake build
working-directory: verification/proofs/lean4
run: |
set -euo pipefail
lean --version
lake --version
lake build
- name: Summary
if: always()
run: |
{
echo "## Lean proof verification"
echo ""
echo "- Toolchain: \`${LEAN_TOOLCHAIN}\` via elan \`${ELAN_VERSION}\`"
echo "- Proof files:"
for f in verification/proofs/lean4/*.lean; do
[ "$(basename "$f")" = "lakefile.lean" ] && continue
echo " - \`$(basename "$f")\`"
done
} >> "$GITHUB_STEP_SUMMARY"
tlc:
name: TLC model-check
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Set up Eclipse Temurin 21 JRE
uses: actions/setup-java@v6.0.0
with:
distribution: temurin
java-version: '21'
- name: Cache tla2tools.jar
id: cache-tla
uses: actions/cache@v6.1.0
with:
path: ~/.local/share/tla2tools.jar
key: tla2tools-v1.8.0
- name: Fetch tla2tools.jar
if: steps.cache-tla.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.local/share
curl -sSL -o ~/.local/share/tla2tools.jar \
https://github.com/tlaplus/tlaplus/releases/latest/download/tla2tools.jar
ls -la ~/.local/share/tla2tools.jar
- name: Model-check KinGate (H8)
working-directory: verification/proofs/tlaplus
run: |
java -XX:+UseParallelGC \
-cp "$HOME/.local/share/tla2tools.jar" tlc2.TLC \
-workers auto -config KinGate.cfg KinGate.tla \
| tee tlc.log
# Fail if TLC printed an error or didn't declare completion.
if grep -q "Error:" tlc.log; then
echo "::error::TLC found an invariant / property violation"
exit 1
fi
if ! grep -q "Model checking completed. No error has been found." tlc.log; then
echo "::error::TLC did not report clean completion"
exit 1
fi
- name: Upload TLC log on failure
if: failure()
uses: actions/upload-artifact@v7.0.1
with:
name: tlc-log
path: verification/proofs/tlaplus/tlc.log
retention-days: 14