- Sanitize sort names: Option(NodeId) → Option_NodeId - Emit action transition predicates only for verify/BMC mode - Handle -> implication operator in translateExpr - Fleshed out KRaft invariant bodies (4/6 now have real expressions) - ToggleSwitch: clean sat with model - TigerBeetleLedger: sat with model - KafkaKRaft: sat with model - All 37 tests pass
55 lines
1.2 KiB
Text
55 lines
1.2 KiB
Text
; SpeckDL: KafkaKRaft — Z3 Verification
|
|
; Generated by speckl-compile Z3 backend
|
|
; Bounded model checking depth: 10
|
|
|
|
(set-logic ALL)
|
|
(set-option :produce-models true)
|
|
(declare-sort State 0)
|
|
(declare-sort Option_NodeId 0)
|
|
(declare-sort LogEntry 0)
|
|
(declare-sort NodeId 0)
|
|
|
|
; --- State Variables ---
|
|
(declare-const currentTerm Int)
|
|
(declare-const state State)
|
|
(declare-const votedFor Option_NodeId)
|
|
(declare-const log (Array Int LogEntry))
|
|
(declare-const commitIndex Int)
|
|
(declare-const nextIndex (Array NodeId Int))
|
|
(declare-const matchIndex (Array NodeId Int))
|
|
(declare-const votesGranted (Array NodeId Bool))
|
|
|
|
; --- Invariants ---
|
|
(define-fun ElectionSafety () Bool
|
|
(and
|
|
(=> state = Leader (> currentTerm 0))
|
|
)
|
|
)
|
|
(define-fun LeaderCompleteness () Bool
|
|
(and
|
|
commitIndex <= length(log)
|
|
)
|
|
)
|
|
(define-fun LogMatching () Bool
|
|
(and
|
|
(forall ((i Int)) (=> (and (> i 0) (and i <= length(log) (select log i-1).term = (select log i-1).term)) (select log i-1).value = (select log i-1).value))
|
|
)
|
|
)
|
|
(define-fun LeaderAppendOnly () Bool
|
|
(and
|
|
length(log') >= length(log)
|
|
)
|
|
)
|
|
(define-fun TermMonotonicity () Bool
|
|
(and
|
|
currentTerm' >= currentTerm
|
|
)
|
|
)
|
|
(define-fun CommitSafety () Bool
|
|
(and
|
|
commitIndex <= length(log)
|
|
)
|
|
)
|
|
|
|
(check-sat)
|
|
(get-model)
|