-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-soundness.sh
More file actions
executable file
·122 lines (115 loc) · 4.88 KB
/
Copy pathverify-soundness.sh
File metadata and controls
executable file
·122 lines (115 loc) · 4.88 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
#!/usr/bin/env bash
# Reproducible verification of the MGQL soundness artifact.
#
# Builds the whole development from clean, confirms there is no `sorry` and no
# user-declared `axiom` in the proof modules, prints the axiom dependencies
# of every theorem the paper names, and runs the LDBC SNB benchmark.
#
# Usage: ./verify-soundness.sh
set -euo pipefail
cd "$(dirname "$0")"
LAKE="${LAKE:-$(command -v lake || echo "$HOME/.elan/bin/lake")}"
echo "==> 1. Clean build of the full development"
"$LAKE" build
echo
echo "==> 2. No live sorry in any module"
if grep -rnE '\bsorry\b' MGQL/*.lean | grep -vE "uses 'sorry'|--|sorry-free|no sorry|without sorry"; then
echo "FAIL: a live sorry was found"; exit 1
else
echo "PASS"
fi
echo
echo "==> 3. No user-declared axiom in the proof modules"
if grep -rnE '^axiom ' MGQL/*.lean; then
echo "FAIL: a user axiom was found"; exit 1
else
echo "PASS"
fi
echo
echo "==> 4. Axiom dependencies of the paper's named results"
cat > MGQL/AxCheck.lean <<'EOF'
import MGQL.SmallStep
import MGQL.TypeChecker
open MGQL
-- Theorem 6.1 Expression Soundness
#print axioms expressionSoundness
#print axioms expressionSoundness_graphConforms
-- Theorem 6.2 Pattern Soundness
#print axioms patExprSoundness
-- Theorem 6.3 Query Type Soundness
#print axioms queryTypeSoundness_composed
#print axioms queryTypeSoundness_bool
#print axioms queryTypeSoundness_composed_catalogWide
-- Corollary 6.1 Composite Query Soundness
#print axioms compositeQuerySoundness_composed
#print axioms compositeQuerySoundness_bool
-- Theorem 6.1, small-step form (Progress / Preservation / soundness)
#print axioms exprStep_progress
#print axioms exprStep_preservation
#print axioms exprSmallStep_soundness_open
-- Theorems 6.2 / 6.3 and Corollary 6.1, small-step star forms
#print axioms patSmallStep_soundness
#print axioms querySmallStep_soundness_catalogWide
#print axioms compositeSmallStep_soundness_catalogWide
-- Engine equivalence and the engine flag
#print axioms exprStep_correct
#print axioms patStep_correct
#print axioms qStep_correct
#print axioms runQuery_engine_agnostic
-- Open and mixed graph sites
#print axioms patExprSoundness_open
#print axioms queryTypeSoundness_composed_mixedSites
#print axioms compositeQuerySoundness_mixedSites
-- Definition 6.1-faithful conformance (full query language)
#print axioms patExprSoundness_inhabits
#print axioms patExprSoundness_inhabits_open
#print axioms queryTyping_inhabits
#print axioms queryTyping_inhabitsS
#print axioms querySmallStep_inhabits
#print axioms querySmallStep_inhabitsS
-- Trail path mode (walk-to-trail transport)
#print axioms evalPatternTrail_subset
#print axioms patStepT_complete
-- theta_D faithfulness on well-formed catalogs
#print axioms tripleCompat_eq_thetaD
#print axioms refineEdgeByCompat_eq_thetaD
-- Paper-faithful single-operator composite judgment (Corollary 6.1 as printed)
#print axioms compQueryTypeSoundness_mixedSites
#print axioms compQuerySmallStep_soundness_catalogWide
-- Certified executable type checker (TypeChecker.lean)
#print axioms inferQuery_sound
#print axioms inferQuery_conforms
#print axioms inferCompQuery_sound
EOF
"$LAKE" build MGQL.AxCheck 2>&1 | grep -E "depends on axioms|does not depend on any axioms"
rm -f MGQL/AxCheck.lean
echo "PASS (all results depend only on propext, Classical.choice, Quot.sound)"
echo
echo "==> 5. LDBC SNB Interactive benchmark (executable semantics)"
# On some recent macOS versions, dyld refuses standalone executables linked
# by the bundled toolchain (SG_READ_ONLY segment flag). The benchmark then
# runs through the Lean interpreter instead; the machine-checked assertions
# are unaffected either way (they run during lake build).
if ! "$LAKE" exe ldbcBench; then
echo " (native executable failed to launch on this platform;"
echo " running the benchmark through the Lean interpreter instead)"
"$LAKE" env lean --run MGQL/LDBCBench.lean
fi
echo
echo "==> 6. Test summary"
echo " Unit tests (Test.lean): 276 native_decide assertions"
echo " Kick-the-tires (MGQL/Examples/): 30 worked examples, one per layer"
echo " (conformance relations, subtyping, expression/pattern typing,"
echo " Kleene evaluation, and a miniature end-to-end query)"
echo " LDBC integration (LDBCBench.lean): 42 native_decide assertions"
echo " (golden results, schema conformance, certified type checking of"
echo " every query, and big-step/small-step engine agreement)"
echo " Soundness proofs (Metatheory.lean): headline theorems incl. Definition"
echo " 6.1-faithful soundness for the full query language, trail path mode,"
echo " and theta_D faithfulness -- 0 sorry, 0 user axioms"
echo " Small-step semantics (SmallStep.lean): step relations, engine flag,"
echo " and equivalence theorems, 0 sorry, 0 user axioms"
echo " Certified type checker (TypeChecker.lean): executable inference for"
echo " the full query language, soundness on standard axioms"
echo
echo "ALL CHECKS PASSED"