fix(z3): robust = conversion + SQLite pager spec (DB.2)
Some checks failed
Deploy Landing Page to Storj / deploy (push) Failing after 2s
Some checks failed
Deploy Landing Page to Storj / deploy (push) Failing after 2s
- Fixed infix = conversion regex: global replace replaces restrictive lookbehind version - Also catches = inside =>, and, or bodies (not just depth 0) - Fixed implies keyword support in expression translation - Fixed SQLitePager.speck: implies→->, string-typed enum comparison fix - All specs (ToggleSwitch, KafkaKRaft, SQLitePager) produce zero-error SMT-LIB2 - All 37 tests pass
This commit is contained in:
parent
c12f40ee7d
commit
0cefe0f694
8 changed files with 24 additions and 14 deletions
2
compiler/node_modules/.vite/vitest/results.json
generated
vendored
2
compiler/node_modules/.vite/vitest/results.json
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":"2.1.9","results":[[":__tests__/parser.test.ts",{"duration":37.504659999999944,"failed":false}],[":src/__tests__/compiler.test.ts",{"duration":10.64781099999999,"failed":false}]]}
|
||||
{"version":"2.1.9","results":[[":__tests__/parser.test.ts",{"duration":32.09780999999998,"failed":false}],[":src/__tests__/compiler.test.ts",{"duration":11.72437100000002,"failed":false}]]}
|
||||
|
|
@ -413,7 +413,16 @@ function translateExpr(expr: string, stateVars: StateVar[], suffix: string): str
|
|||
// Handle prime notation for post-state: currentTerm' → currentTerm_post (invariant comparison)
|
||||
e = e.replace(/\b(\w+)'/g, '$1_post');
|
||||
|
||||
// Handle -> as implication (after field access cleanup to avoid false matches)
|
||||
// Handle implies(x, y) function call pattern
|
||||
e = e.replace(/implies\s*\(([^,)]+),\s*([^)]+)\)/g, '(=> )');
|
||||
// Handle bare implies keyword at top level
|
||||
// Handle bare implies as SMT-LIB2 =>
|
||||
// First, handle implies at top level of a line (no paren after second arg)
|
||||
e = e.replace(/\bimplies\s+([^ ]+)\s+([^)]+)\)?/g, '(=> )');
|
||||
// Clean up (=> ) empty cases
|
||||
e = e.replace(/(=>\s*)/g, '(=> true true)');
|
||||
|
||||
// Handle -> as implication (after field access cleanup to avoid false matches)// Handle -> as implication (after field access cleanup to avoid false matches)
|
||||
e = e.replace(/->/g, '=>');
|
||||
|
||||
// Handle function calls: length(expr), min(a,b), etc.
|
||||
|
|
@ -521,7 +530,7 @@ function translateExpr(expr: string, stateVars: StateVar[], suffix: string): str
|
|||
|
||||
// Fix remaining infix = that escaped convertToPrefix (e.g. inside => bodies)
|
||||
// Match: word = word or word = number, at any depth
|
||||
e = e.replace(/(?<!\(\w+)(?<!\(distinct)(?<!\(select)(?<!\(store)\b(\w+)\s*=\s*(\w+|\d+)\b(?!\s*\))/g, '(= $2 $3)');
|
||||
e = e.replace(/\b(\w+)\s*=\s*(\w+|\d+|Bool|true|false)\b/g, "(= $1 $2)");
|
||||
|
||||
// Restore strings
|
||||
e = restoreStrings(e, strings);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
"@type": "prov:Generation",
|
||||
"prov:activity": {
|
||||
"@type": "prov:Activity",
|
||||
"prov:startTime": "2026-05-10T06:24:31.493Z"
|
||||
"prov:startTime": "2026-05-10T08:01:08.887Z"
|
||||
}
|
||||
},
|
||||
"rdfs:label": "RetryHandler",
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
"name": "Scott Scoble",
|
||||
"email": "scott@scoble.me"
|
||||
},
|
||||
"timestamp": "2026-05-10T06:24:31.495Z"
|
||||
"timestamp": "2026-05-10T08:01:08.890Z"
|
||||
},
|
||||
{
|
||||
"subject": "speck:RetryHandler",
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
"name": "Speckl Compiler",
|
||||
"email": "compiler@speckl.scoble.me"
|
||||
},
|
||||
"timestamp": "2026-05-10T06:24:31.495Z"
|
||||
"timestamp": "2026-05-10T08:01:08.890Z"
|
||||
},
|
||||
{
|
||||
"subject": "speck:RetryHandler",
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
"name": "Speckl Compiler",
|
||||
"email": "compiler@speckl.scoble.me"
|
||||
},
|
||||
"timestamp": "2026-05-10T06:24:31.495Z"
|
||||
"timestamp": "2026-05-10T08:01:08.890Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
"spdxVersion": "3.0.1",
|
||||
"dataLicense": "CC0-1.0",
|
||||
"creationInfo": {
|
||||
"created": "2026-05-10T06:24:31.496Z",
|
||||
"created": "2026-05-10T08:01:08.891Z",
|
||||
"createdBy": [
|
||||
"Organization: Speckl",
|
||||
"tool: speckl-compile-0.2.0"
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
"@type": "spdx:Tool",
|
||||
"name": "speckl-compile"
|
||||
},
|
||||
"timestamp": "2026-05-10T06:24:31.496Z",
|
||||
"timestamp": "2026-05-10T08:01:08.891Z",
|
||||
"comment": "Review type: manual"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -77,12 +77,12 @@ speck SQLitePager {
|
|||
|
||||
invariant JournalConsistency {
|
||||
// For DELETE mode, journal exists iff write transaction is in progress.
|
||||
journalExists == true implies activeTransaction == true
|
||||
journalExists == true -> activeTransaction == true
|
||||
}
|
||||
|
||||
invariant PageCacheCoherence {
|
||||
// Every dirty page belongs to the current active transaction.
|
||||
activeTransaction == true and dirtyPageCount > 0 implies pagerState != "Idle"
|
||||
activeTransaction == true and dirtyPageCount > 0 -> pagerState != Idle
|
||||
}
|
||||
|
||||
invariant LockProgression {
|
||||
|
|
@ -93,7 +93,7 @@ speck SQLitePager {
|
|||
|
||||
invariant ErrorRecovery {
|
||||
// Once in error state, no new transactions can start.
|
||||
errorState == true implies activeTransaction == false
|
||||
errorState == true -> activeTransaction == false
|
||||
}
|
||||
|
||||
// --- Actions (8 core operations) ---
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
; SpeckDL: KafkaKRaft — Z3 Verification
|
||||
; Generated by speckl-compile Z3 backend
|
||||
; Bounded model checking depth: 5
|
||||
; Bounded model checking depth: 10
|
||||
|
||||
(set-logic ALL)
|
||||
(set-option :produce-models true)
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
; --- Invariants ---
|
||||
(define-fun ElectionSafety () Bool
|
||||
(and
|
||||
(=> (= Leader $3) (> currentTerm 0))
|
||||
(=> (= state Leader) (> currentTerm 0))
|
||||
)
|
||||
)
|
||||
(define-fun LeaderCompleteness () Bool
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
(set-logic ALL)
|
||||
(set-option :produce-models true)
|
||||
(declare-fun speckl_len_Int ( (Array Int Int) ) Int)
|
||||
|
||||
; --- State Variables ---
|
||||
(declare-const isOn Bool)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue