Some checks failed
Deploy Landing Page to Storj / deploy (push) Failing after 3s
- Declare speckl_len_Int helper for list/sequence lengths - Fix infix = inside => bodies (final pass regex) - Handle prime notation: currentTerm' → currentTerm_post - Handle length() calls: length(log) → (speckl_len_Int log) - Handle min(): (ite (<= a b) a b) instead of unsupported 'min' - Handle subtraction: i-1 → (- i 1) - Declare _post state vars when invariants compare pre/post - Added 3 BMC verify blocks to KRaft spec (TermMonotonicity, CommitSafety, LeaderCompleteness) - Z3 returns clean sat with zero errors for all specs - All 37 tests pass
64 lines
1.7 KiB
Text
64 lines
1.7 KiB
Text
; SpeckDL: KafkaKRaft — Z3 Verification
|
|
; Generated by speckl-compile Z3 backend
|
|
; Bounded model checking depth: 5
|
|
|
|
(set-logic ALL)
|
|
(set-option :produce-models true)
|
|
(declare-fun speckl_len_Int ( (Array Int Int) ) Int)
|
|
(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))
|
|
(declare-const currentTerm_post Int)
|
|
(declare-const state_post State)
|
|
(declare-const votedFor_post Option_NodeId)
|
|
(declare-const log_post (Array Int LogEntry))
|
|
(declare-const commitIndex_post Int)
|
|
(declare-const nextIndex_post (Array NodeId Int))
|
|
(declare-const matchIndex_post (Array NodeId Int))
|
|
(declare-const votesGranted_post (Array NodeId Bool))
|
|
|
|
; --- Invariants ---
|
|
(define-fun ElectionSafety () Bool
|
|
(and
|
|
(=> (= Leader $3) (> currentTerm 0))
|
|
)
|
|
)
|
|
(define-fun LeaderCompleteness () Bool
|
|
(and
|
|
commitIndex <= (speckl_len_Int log)
|
|
)
|
|
)
|
|
(define-fun LogMatching () Bool
|
|
(and
|
|
(forall ((i Int)) (=> (and (> i 0) (and i <= (speckl_len_Int 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
|
|
(speckl_len_Int log_post) >= (speckl_len_Int log)
|
|
)
|
|
)
|
|
(define-fun TermMonotonicity () Bool
|
|
(and
|
|
currentTerm_post >= currentTerm
|
|
)
|
|
)
|
|
(define-fun CommitSafety () Bool
|
|
(and
|
|
commitIndex <= (speckl_len_Int log)
|
|
)
|
|
)
|
|
|
|
(check-sat)
|
|
(get-model)
|