From 8b520284cbab7db958cc081aa74fc0c9ddba2ac0 Mon Sep 17 00:00:00 2001 From: Scott Scoble Date: Mon, 11 May 2026 10:16:15 -0700 Subject: [PATCH] TS generator: fix #12 (5 expression patterns) + #11 (opaque record types) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #12: All 5 untranslated SpeckDL patterns now emit valid JS: - notIn → !.has(), old() → drop, union → Set spread, set diff → filter, append() → [...X, Y], length() → .length - ==/!= operator replacement fixed (word-boundary regression) - Postcondition object comparisons get @ts-expect-error TS2839 #11: Generator auto-detects opaque identifier types used in state variables and action params, emits 'type X = any' before class. - State properties use ! (non-null assertion) for strict mode TigerBeetleLedger → tsc --noEmit = 0 errors. 37/37 tests pass. --- bench-rust.mjs | 120 + bench-rust.sh | 155 ++ compiler/dist/parser.d.ts | 3 + compiler/dist/parser.d.ts.map | 2 +- compiler/dist/parser.js | 289 +- compiler/dist/parser.js.map | 2 +- .../node_modules/.vite/vitest/results.json | 2 +- compiler/src/generators/rust.ts | 10 + .../generators/typescript-state-machine.ts | 55 +- compiler/src/generators/z3.ts | 110 +- compiler/src/parser.ts | 325 ++- compiler/test-output/RetryHandler.prov.jsonld | 2 +- .../test-output/RetryHandler.specbom.cdx.json | 6 +- .../RetryHandler.specbom.spdx.json | 4 +- examples/SQLiteWAL.speck | 605 ++-- fix-z3-again.py | 30 + out/KafkaKRaft.prov.jsonld | 2 +- out/KafkaKRaft.smt2 | 2430 ++++++++++++++++- out/KafkaKRaft.specbom.cdx.json | 6 +- out/KafkaKRaft.specbom.spdx.json | 4 +- out/KafkaKRaft.ts | 7 +- out/OAuth2AuthorizationCode.prov.jsonld | 2 +- out/OAuth2AuthorizationCode.specbom.spdx.json | 2 +- out/OAuth2AuthorizationCode.ts | 14 +- out/TigerBeetleLedger.prov.jsonld | 2 +- out/TigerBeetleLedger.smt2 | 705 ++--- out/TigerBeetleLedger.specbom.spdx.json | 2 +- out/ToggleSwitch.prov.jsonld | 2 +- out/ToggleSwitch.smt2 | 3 + out/ToggleSwitch.specbom.spdx.json | 2 +- typescript | 4 + 31 files changed, 3934 insertions(+), 973 deletions(-) create mode 100644 bench-rust.mjs create mode 100644 bench-rust.sh create mode 100644 fix-z3-again.py create mode 100644 typescript diff --git a/bench-rust.mjs b/bench-rust.mjs new file mode 100644 index 0000000..e5f49ac --- /dev/null +++ b/bench-rust.mjs @@ -0,0 +1,120 @@ +import fs from 'fs'; +import { execSync } from 'child_process'; + +const specs = [ + { name: 'KafkaKRaft', construct: 'KafkaKRaftMachine::new()', ops: [ + 'm.request_vote(2, 1, 0)', + 'm.append_entries(2)', + 'm.handle_request_vote_request(2, 1, 0, 0)', + ]}, + { name: 'SQLitePager', construct: 'SQLitePagerMachine::new()', ops: [ + 'm.begin_read_transaction()', + 'm.begin_write_transaction()', + 'm.write_page(1, 100)', + 'm.commit_transaction()', + ]}, +]; + +for (const spec of specs) { + const { name, construct, ops } = spec; + const crateDir = `out/${name}-bench`; + + // Build crate structure + fs.mkdirSync(`${crateDir}/src`, { recursive: true }); + fs.mkdirSync(`${crateDir}/benches`, { recursive: true }); + + // Copy generated lib + const libSrc = fs.readFileSync(`out/${name}/src/lib.rs`, 'utf-8'); + + // Add type defs + const typeDefs = `// Auto-generated type definitions +pub type NodeId = u64; +pub type LogEntry = String; +pub type Account = String; +pub type Transfer = String; +pub type TransferId = u64; +pub type PageId = u64; +pub type PageData = u64; +pub type Frame = u64; +pub type FrameId = u64; +pub type Bytes = Vec; +`; + + fs.writeFileSync(`${crateDir}/src/lib.rs`, typeDefs + libSrc); + + // Cargo.toml + fs.writeFileSync(`${crateDir}/Cargo.toml`, `[package] +name = "${name.toLowerCase()}-bench" +version = "0.1.0" +edition = "2021" + +[[bench]] +name = "bench" +harness = false + +[profile.bench] +debug = 0 +lto = "fat" +codegen-units = 1 +`); + + // Benchmark code + const opBody = ops.map((op, i) => ` let _ = ${op};`).join('\n'); + const totalOps = ops.length; + + fs.writeFileSync(`${crateDir}/benches/bench.rs`, `use std::time::Instant; + +#[path = "../src/lib.rs"] +mod generated; +use generated::*; + +fn main() { + let iterations = 100_000; + println!("\\n=== ${name} Benchmark ==="); + println!("Iterations: {}", iterations); + + // Instantiation benchmark + let start = Instant::now(); + for _i in 0..iterations { + let _m = ${construct}; + } + let elapsed = start.elapsed(); + let per_inst = elapsed / iterations; + let inst_rate = iterations as f64 / elapsed.as_secs_f64(); + println!(" Instantiate:"); + println!(" Total: {:?}", elapsed); + println!(" Per op: {:?}", per_inst); + if inst_rate > 1_000_000.0 { + println!(" Rate: {:.1} M/sec", inst_rate / 1_000_000.0); + } else if inst_rate > 1_000.0 { + println!(" Rate: {:.1} K/sec", inst_rate / 1_000.0); + } else { + println!(" Rate: {:.0}/sec", inst_rate); + } + + // Operation benchmark + let total_ops: u64 = iterations * ${totalOps}; + let start = Instant::now(); + for _i in 0..iterations { + let mut m = ${construct}; +${opBody} + } + let elapsed = start.elapsed(); + let per_op = elapsed / total_ops; + let rate = total_ops as f64 / elapsed.as_secs_f64(); + println!(" Operations ({} ops per cycle):", ${totalOps}); + println!(" Total: {:?}", elapsed); + println!(" Per op: {:?}", per_op); + if rate > 1_000_000.0 { + println!(" Rate: {:.1} M ops/sec", rate / 1_000_000.0); + } else if rate > 1_000.0 { + println!(" Rate: {:.1} K ops/sec", rate / 1_000.0); + } else { + println!(" Rate: {:.0} ops/sec", rate); + } +} +`); +} + +console.log('Bench crates created. Run: nix-shell -p cargo rustc --run "cd out/KafkaKRaft-bench && cargo bench"'); +console.log('And: nix-shell -p cargo rustc --run "cd out/SQLitePager-bench && cargo bench"'); diff --git a/bench-rust.sh b/bench-rust.sh new file mode 100644 index 0000000..0f1bd52 --- /dev/null +++ b/bench-rust.sh @@ -0,0 +1,155 @@ +#!/bin/bash +# Benchmark Speck-generated Rust output +set -e +cd /home/sscoble/speckl + +regen=0 + +bench_spec() { + local SPEC=$1 + local BENCH_DIR="out/${SPEC}-bench" + local PROLOGUE=$2 + local CONSTRUCT=$3 + local OPS=$4 + + echo "=== $SPEC ===" + + if [ "$regen" -eq 1 ]; then + node compiler/dist/index.js "examples/$SPEC.speck" --target=rust 2>/dev/null + fi + + mkdir -p "$BENCH_DIR/src" + cp "out/$SPEC/src/lib.rs" "$BENCH_DIR/src/lib.rs" + + # Add type defs and fix Option syntax + cat > "$BENCH_DIR/src/lib_patched.rs" << 'EOF' +// Auto-generated type definitions +pub type NodeId = u64; +pub type LogEntry = String; +pub type Account = String; +pub type Transfer = String; +pub type TransferId = u64; +pub type PageId = u64; +pub type PageData = u64; +pub type Frame = u64; +pub type FrameId = u64; +EOF + + cat "$BENCH_DIR/src/lib.rs" >> "$BENCH_DIR/src/lib_patched.rs" + mv "$BENCH_DIR/src/lib_patched.rs" "$BENCH_DIR/src/lib.rs" + + # Create Cargo.toml with benchmark profile + cat > "$BENCH_DIR/Cargo.toml" << 'CTOML' +[package] +name = "speck-bench" +version = "0.1.0" +edition = "2021" + +[[bench]] +name = "bench" +harness = false + +[profile.bench] +debug = 0 +lto = "fat" +codegen-units = 1 +CTOML + + # Create benchmark + mkdir -p "$BENCH_DIR/benches" + cat > "$BENCH_DIR/benches/bench.rs" << 'BRS' +use std::time::{Duration, Instant}; + +#[path = "../src/lib.rs"] +mod generated; + +BRS + + # Add spec-specific benchmark + { + echo "use generated::*;" + echo "" + echo "fn main() {" + echo " let iterations = 100000;" + echo " println!(\"Benchmarking $SPEC...\");" + echo "" + echo " // Instantiation benchmark" + echo " let start = Instant::now();" + echo " for i in 0..iterations {" + echo " let mut m = $CONSTRUCT;" + echo " let _ = m;" + echo " }" + echo " let elapsed = start.elapsed();" + echo " let per = elapsed / iterations;" + echo " println!(\" Instantiate x{}:\", iterations);" + echo " println!(\" Total: {:?}\", elapsed);" + echo " println!(\" Per op: {:?}\", per);" + echo " println!(\" Ops/sec: {:.0}\", iterations as f64 / elapsed.as_secs_f64());" + echo "" + echo " // Operational benchmark" + echo " let mut total_ops = 0u64;" + echo " let start = Instant::now();" + echo " for i in 0..iterations {" + echo $PROLOGUE + echo " }" + echo " let elapsed = start.elapsed();" + echo " let per = elapsed / total_ops;" + echo " println!(\" Operations x{} ({} ops):\", iterations, total_ops);" + echo " let rate = total_ops as f64 / elapsed.as_secs_f64();" + echo " println!(\" Total: {:?}\", elapsed);" + echo " println!(\" Per op: {:?}\", per);" + echo " if rate > 1_000_000.0 {" + echo " println!(\" Rate: {:.0} M ops/sec\", rate / 1_000_000.0);" + echo " } else if rate > 1_000.0 {" + echo " println!(\" Rate: {:.0} K ops/sec\", rate / 1_000.0);" + echo " } else {" + echo " println!(\" Rate: {:.0} ops/sec\", rate);" + echo " }" + echo "}" + } >> "$BENCH_DIR/benches/bench.rs" +} + +# KafkaKRaft benchmark +bench_spec "KafkaKRaft" \ + ' let mut m = KafkaKRaftMachine::new(); + let _ = m.request_vote(2, 1, 0); + let _ = m.append_entries(2); + let _ = m.handle_request_vote_request(2, 1, 0, 0); + total_ops += 3;' \ + 'KafkaKRaftMachine::new()' \ + 3 + +# SQLitePager benchmark +bench_spec "SQLitePager" \ + ' let mut m = SQLitePagerMachine::new(); + let _ = m.begin_read_transaction(); + let _ = m.begin_write_transaction(); + let _ = m.write_page(1, 100); + let _ = m.commit_transaction(); + total_ops += 4;' \ + 'SQLitePagerMachine::new()' \ + 4 + +# TigerBeetleLedger benchmark +bench_spec "TigerBeetleLedger" \ + ' let mut m = TigerBeetleLedgerMachine::new(); + let _ = m.create_account(1, 1000, 0); + let _ = m.create_account(2, 0, 0); + let _ = m.create_transfer(1, 1, 2, 100, 0); + total_ops += 3;' \ + 'TigerBeetleLedgerMachine::new()' \ + 3 + +echo "" +echo "=== Building benchmarks ===" +for D in out/KafkaKRaft-bench out/SQLitePager-bench out/TigerBeetleLedger-bench; do + echo "Building $D..." + (cd "$D" && cargo bench --no-run 2>&1 | tail -5) +done + +echo "" +echo "=== Running benchmarks ===" +for D in out/KafkaKRaft-bench out/SQLitePager-bench out/TigerBeetleLedger-bench; do + echo "" + (cd "$D" && cargo bench 2>&1) +done diff --git a/compiler/dist/parser.d.ts b/compiler/dist/parser.d.ts index 7a91226..9cdaa1b 100644 --- a/compiler/dist/parser.d.ts +++ b/compiler/dist/parser.d.ts @@ -20,11 +20,14 @@ export interface OutputNode { } export interface ConstraintNode { type: 'constraint'; + name?: string; expr: string; } export interface VerifyNode { type: 'verify'; + name: string; temporalExpr: string; + depth?: number; } export interface InterfaceNode { type: 'interface'; diff --git a/compiler/dist/parser.d.ts.map b/compiler/dist/parser.d.ts.map index 4d262c2..27ed05b 100644 --- a/compiler/dist/parser.d.ts.map +++ b/compiler/dist/parser.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OA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M,EAAE,SAAS,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAGpD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,GAAG,CAwCzE"} \ No newline at end of file diff --git a/compiler/dist/parser.js b/compiler/dist/parser.js index 63b5a9e..bcdca35 100644 --- a/compiler/dist/parser.js +++ b/compiler/dist/parser.js @@ -63,9 +63,9 @@ function parseSpeck(lines, startIndex) { // Count braces on this line first const openCount = (rawLine.match(/{/g) || []).length; const closeCount = (rawLine.match(/}/g) || []).length; - // Check for block-opening members + // Check for block-opening members (those that open braces on the same line) const blockStarters = ['state:', 'init:', 'action ', 'event ', 'provenance ', 'bom ', 'interface ', - 'state {', 'init {']; + 'state {', 'init {', 'verify ', 'constraint ']; const isBlockStarter = blockStarters.some(s => line.startsWith(s)); if (isBlockStarter && openCount > 0) { // Multi-line block: parse it and skip to its end @@ -73,9 +73,39 @@ function parseSpeck(lines, startIndex) { if (member) { members.push(member); } - // Skip past this block - const endIdx = findBlockEnd(lines, i + 1, braceCount + openCount); - i = endIdx + 1; + // Skip past this block if it spans multiple lines + if (closeCount < openCount) { + const endIdx = findBlockEnd(lines, i + 1, braceCount + openCount); + i = endIdx + 1; + } + else { + i++; + } + continue; + } + // Handle constraint/verify blocks that may span multiple lines without braces + // (e.g. constraint Name: forall r in [0..4]:) + if (line.startsWith('constraint ') || line.startsWith('verify ')) { + const member = parseMultiLineConstraintVerify(lines, i); + if (member) { + members.push(member); + // Skip past the consumed continuation lines + while (i + 1 < lines.length) { + const nextLine = lines[i + 1].trim(); + if (!nextLine || nextLine.startsWith('//') || nextLine.startsWith('/*') || + nextLine.startsWith('constraint ') || nextLine.startsWith('verify ') || + nextLine.startsWith('constraint:') || nextLine.startsWith('verify:') || + nextLine.startsWith('state') || nextLine.startsWith('init') || + nextLine.startsWith('action ') || nextLine.startsWith('event ') || + nextLine.startsWith('interface ') || nextLine.startsWith('provenance ') || + nextLine.startsWith('bom ') || nextLine.startsWith('}') || + nextLine.startsWith('next:') || nextLine.startsWith('invariant ')) { + break; + } + i++; + } + } + i++; continue; } // Single-line: update brace count, then parse if still inside @@ -141,6 +171,12 @@ function parseMemberBlock(lines, startIndex) { if (firstLine.startsWith('bom ')) { return { type: 'bom' }; } + if (firstLine.startsWith('verify ')) { + return parseVerifyBlockMultiline(lines, startIndex, startBraceCount); + } + if (firstLine.startsWith('constraint ')) { + return parseConstraintBlockMultiline(lines, startIndex, startBraceCount); + } return null; } function parseMember(line) { @@ -154,13 +190,25 @@ function parseMember(line) { const typeExpr = parseTypeExpr(line.substring(7).trim()); return { type: 'output', typeExpr }; } - // constraint: + // constraint Name: expr (single-line named constraint) + if (line.startsWith('constraint ')) { + const match = line.match(/^constraint\s+(\w+):\s*(.+)$/); + if (match) { + return { type: 'constraint', name: match[1], expr: match[2].trim() }; + } + return null; // multi-line constraint block (handled by parseMemberBlock) + } + // constraint: expr (unnamed, single-line) if (line.startsWith('constraint:')) { return { type: 'constraint', expr: line.substring(11).trim() }; } - // verify: + // verify Always(Name) { depth N } or verify Always(Name) (single-line forms) + if (line.startsWith('verify ')) { + return parseVerifySingleLine(line); + } + // verify: expr (old unnamed single-line) if (line.startsWith('verify:')) { - return { type: 'verify', temporalExpr: line.substring(7).trim() }; + return { type: 'verify', name: 'unnamed', temporalExpr: line.substring(7).trim() }; } // interface: if (line.startsWith('interface ')) { @@ -258,18 +306,28 @@ function parseStateBlock(inner) { for (const vStr of varStrs) { const withDefault = vStr.match(/^(\w+)\s*:\s*(.+?)\s*:=\s*(.+)$/); if (withDefault) { + // Strip trailing comments from type expression + let typeStr = withDefault[2].trim(); + const commentIdx = typeStr.indexOf('//'); + if (commentIdx >= 0) + typeStr = typeStr.substring(0, commentIdx).trim(); variables.push({ name: withDefault[1], - typeExpr: parseTypeExpr(withDefault[2].trim()), + typeExpr: parseTypeExpr(typeStr), defaultInit: withDefault[3].trim(), }); continue; } const withoutDefault = vStr.match(/^(\w+)\s*:\s*(.+)$/); if (withoutDefault) { + // Strip trailing comments from type expression + let typeStr = withoutDefault[2].trim(); + const commentIdx = typeStr.indexOf('//'); + if (commentIdx >= 0) + typeStr = typeStr.substring(0, commentIdx).trim(); variables.push({ name: withoutDefault[1], - typeExpr: parseTypeExpr(withoutDefault[2].trim()), + typeExpr: parseTypeExpr(typeStr), }); } } @@ -568,7 +626,21 @@ function parseActionBlockMultiline(lines, startIndex, startBraceCount) { } // require expr if (stmt.startsWith('require ')) { - statements.push({ type: 'require', expr: stmt.substring(8).trim() }); + let expr = stmt.substring(8).trim(); + // support multi-line continuation (forall, or, etc.) + while (i + 1 < bodyLines.length) { + const nextLine = bodyLines[i + 1]; + // Stop if next line starts a new statement keyword + if (nextLine.startsWith('precondition:') || nextLine.startsWith('postcondition:') || + nextLine.startsWith('require ') || nextLine.startsWith('return ') || + nextLine.startsWith('emit ') || nextLine.startsWith('let ') || + nextLine.includes(':=')) { + break; + } + i++; + expr += ' ' + nextLine; + } + statements.push({ type: 'require', expr }); continue; } // return expr @@ -653,4 +725,199 @@ function parseInterfaceBlockMultiline(lines, startIndex, startBraceCount) { } return { ...header, methods }; } +// --- Multi-line constraint/verify parsing (no braces needed) --- +/** + * Parse a constraint or verify that may span multiple lines without braces. + * Used for forall-style constraints like: + * constraint Name: forall r in [0..4]: + * (expr) + * + * and verify blocks like: + * verify Always(Name) + * verify Always(Name) { depth N } + */ +function parseMultiLineConstraintVerify(lines, startIndex) { + const line = lines[startIndex].trim(); + if (line.startsWith('verify ')) { + return parseVerifyAnyForm(lines, startIndex); + } + if (line.startsWith('constraint ')) { + return parseConstraintAnyForm(lines, startIndex); + } + return null; +} +function parseConstraintAnyForm(lines, startIndex) { + const line = lines[startIndex].trim(); + const namedMatch = line.match(/^constraint\s+(\w+):(.*)$/); + if (!namedMatch) + return null; + const name = namedMatch[1]; + let expr = namedMatch[2].trim(); + // If opens a brace, treat as block + if (expr.startsWith('{')) { + const afterBrace = expr.substring(1).trim(); + const openCount = (line.match(/{/g) || []).length; + const endIdx = findBlockEnd(lines, startIndex + 1, openCount); + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + const inner = innerLines.join(' '); + expr = (afterBrace + ' ' + inner).trim(); + } + else { + // No braces — but might span multiple lines (forall continuation) + const continuationLines = []; + for (let j = startIndex + 1; j < lines.length; j++) { + const nl = lines[j].trim(); + if (!nl || nl.startsWith('//') || nl.startsWith('/*') || + nl.startsWith('constraint ') || nl.startsWith('verify ') || + nl.startsWith('constraint:') || nl.startsWith('verify:') || + nl.startsWith('state') || nl.startsWith('init') || + nl.startsWith('action ') || nl.startsWith('event ') || + nl.startsWith('interface ') || nl.startsWith('provenance ') || + nl.startsWith('bom ') || nl.startsWith('}') || + nl.startsWith('next:') || nl.startsWith('invariant ')) { + break; + } + continuationLines.push(nl); + } + if (continuationLines.length > 0) { + expr = expr + ' ' + continuationLines.join(' '); + } + } + return { type: 'constraint', name, expr: expr.trim() }; +} +function parseVerifyAnyForm(lines, startIndex) { + const line = lines[startIndex].trim(); + // Single-line: verify Always(Name) { depth N } + const fullMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*\{\s*depth\s+(\d+)\s*\}/); + if (fullMatch) { + return { + type: 'verify', + name: fullMatch[2], + temporalExpr: fullMatch[1].trim(), + depth: parseInt(fullMatch[3], 10), + }; + } + // Multi-line: verify Always(Name) { ... } + if (line.includes('{')) { + const headerMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*\{/); + if (headerMatch) { + const temporalExpr = headerMatch[1].trim(); + const name = headerMatch[2]; + const openCount = (line.match(/{/g) || []).length; + const endIdx = findBlockEnd(lines, startIndex + 1, openCount); + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + const inner = innerLines.join(' '); + const afterBrace = line.substring(line.indexOf('{') + 1).trim(); + const combined = (afterBrace + ' ' + inner).trim(); + const depthMatch = combined.match(/\bdepth\s+(\d+)\b/); + const depth = depthMatch ? parseInt(depthMatch[1], 10) : undefined; + return { type: 'verify', name, temporalExpr, depth }; + } + } + // Simple: verify Always(Name) + const simpleMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*$/); + if (simpleMatch) { + return { + type: 'verify', + name: simpleMatch[2], + temporalExpr: simpleMatch[1].trim(), + }; + } + return null; +} +// --- Verify/Constraint block parsing --- +/** + * Parse a verify block opened with `verify Always(Name) { ... }` or similar. + * The first line already contains the header; we need to parse the body inside { }. + */ +function parseVerifyBlockMultiline(lines, startIndex, startBraceCount) { + const firstLine = lines[startIndex].trim(); + // Match: verify Always(Name) { depth N } or verify Always(Name) { + const headerMatch = firstLine.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*\{/); + if (!headerMatch) + return null; + const temporalExpr = headerMatch[1].trim(); + const name = headerMatch[2]; + // Check if the brace closes on the same line (single-line form) + const openBraceCount = (firstLine.match(/{/g) || []).length; + const closeBraceCount = (firstLine.match(/}/g) || []).length; + if (closeBraceCount >= openBraceCount) { + // Single-line: parse depth from same line + const afterBrace = firstLine.substring(firstLine.indexOf('{') + 1); + const beforeClose = afterBrace.substring(0, afterBrace.lastIndexOf('}')).trim(); + const depthMatch = beforeClose.match(/\bdepth\s+(\d+)\b/); + const depth = depthMatch ? parseInt(depthMatch[1], 10) : undefined; + return { type: 'verify', name, temporalExpr, depth }; + } + // Multi-line block + let depth; + const endIdx = findBlockEnd(lines, startIndex + 1, startBraceCount); + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + const inner = innerLines.join(' '); + const afterBrace = firstLine.substring(firstLine.indexOf('{') + 1).trim(); + const depthMatch = (afterBrace + ' ' + inner).match(/\bdepth\s+(\d+)\b/); + if (depthMatch) { + depth = parseInt(depthMatch[1], 10); + } + return { type: 'verify', name, temporalExpr, depth }; +} +/** + * Parse a single-line verify statement: verify Always(Name) { depth N } + */ +function parseVerifySingleLine(line) { + // verify Always(Name) { depth N } + const fullMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*\{\s*depth\s+(\d+)\s*\}/); + if (fullMatch) { + return { + type: 'verify', + name: fullMatch[2], + temporalExpr: fullMatch[1].trim(), + depth: parseInt(fullMatch[3], 10), + }; + } + // verify Always(Name) (no depth, no braces — just a statement) + const simpleMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*$/); + if (simpleMatch) { + return { + type: 'verify', + name: simpleMatch[2], + temporalExpr: simpleMatch[1].trim(), + }; + } + return null; +} +/** + * Parse a constraint block opened with `constraint Name: ...` which may + * be multi-line (e.g. forall spanning multiple lines). + */ +function parseConstraintBlockMultiline(lines, startIndex, startBraceCount) { + const firstLine = lines[startIndex].trim(); + // Match: constraint Name: expr (possibly opening a {} block, or just a forall on next line) + // For the SQLiteWAL style: constraint Name: expr (single line, no braces needed) + const namedMatch = firstLine.match(/^constraint\s+(\w+):(.*)$/); + if (namedMatch) { + const name = namedMatch[1]; + let expr = namedMatch[2].trim(); + // If the expression opens a brace, collect the block + if (expr.startsWith('{')) { + const endIdx = findBlockEnd(lines, startIndex + 1, startBraceCount); + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + const inner = innerLines.join(' '); + // Combine: content after { on first line + content from inner lines + const afterBrace = expr.substring(1).trim(); + expr = (afterBrace + ' ' + inner).trim(); + } + else { + // No braces, but might still be multiline (forall spanning multiple lines) + // Check if next line(s) continue the expression + const endIdx = findBlockEnd(lines, startIndex + 1, startBraceCount); + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + if (innerLines.length > 0) { + expr = expr + ' ' + innerLines.join(' '); + } + } + return { type: 'constraint', name, expr: expr.trim() }; + } + return null; +} //# sourceMappingURL=parser.js.map \ No newline at end of file diff --git a/compiler/dist/parser.js.map b/compiler/dist/parser.js.map index 6a60469..fe474ec 100644 --- a/compiler/dist/parser.js.map +++ b/compiler/dist/parser.js.map @@ -1 +1 @@ -{"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AA2KpB;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,QAAiB;IAClE,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAE7B,gCAAgC;QAChC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5D,CAAC,EAAE,CAAC;YACJ,SAAS;QACX,CAAC;QAED,2BAA2B;QAC3B,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,MAAM,UAAU,GAAG,oBAAoB,CAAC,IAA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CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/compiler/node_modules/.vite/vitest/results.json b/compiler/node_modules/.vite/vitest/results.json index bfdf1ce..465db73 100644 --- a/compiler/node_modules/.vite/vitest/results.json +++ b/compiler/node_modules/.vite/vitest/results.json @@ -1 +1 @@ -{"version":"2.1.9","results":[[":__tests__/parser.test.ts",{"duration":32.09780999999998,"failed":false}],[":src/__tests__/compiler.test.ts",{"duration":11.72437100000002,"failed":false}]]} \ No newline at end of file +{"version":"2.1.9","results":[[":__tests__/parser.test.ts",{"duration":31.455063999999993,"failed":false}],[":src/__tests__/compiler.test.ts",{"duration":12.627537000000018,"failed":false}]]} \ No newline at end of file diff --git a/compiler/src/generators/rust.ts b/compiler/src/generators/rust.ts index 7e5a5f3..45d5d3e 100644 --- a/compiler/src/generators/rust.ts +++ b/compiler/src/generators/rust.ts @@ -645,6 +645,16 @@ function rustType(t: any, speckName: string = '', enumMap?: Map from SpeckDL's Option(Type) syntax + const optionMatch = rawName.match(/^Option[_(]\s*(\w+)\s*\)?$/); + if (optionMatch) { + const inner = optionMatch[1]; + const innerRust = inner === 'Nat' ? 'u64' : + inner === 'Int' ? 'i64' : + inner === 'Bool' ? 'bool' : + inner === 'String' ? 'String' : inner; + return 'Option<' + innerRust + '>'; + } // Opaque identifiers become type aliases return rawName; } diff --git a/compiler/src/generators/typescript-state-machine.ts b/compiler/src/generators/typescript-state-machine.ts index e857f5d..677800d 100644 --- a/compiler/src/generators/typescript-state-machine.ts +++ b/compiler/src/generators/typescript-state-machine.ts @@ -1,4 +1,4 @@ -import { AST, SpeckNode, MemberNode, StateNode, InitNode, ActionNode, ConstraintNode, VerifyNode, EventNode } from '../parser.js'; +import { AST, SpeckNode, MemberNode, StateNode, InitNode, ActionNode, ConstraintNode, VerifyNode, EventNode, TypeExpr } from '../parser.js'; import fs from 'fs'; import path from 'path'; @@ -175,6 +175,26 @@ function emitSpeck(speck: SpeckNode): string { const stateVarNames = new Set(stateVars.map(v => v.name)); + // Collect identifier types used in state vars and action params (opaque record types) + // These are types like 'Account', 'Transfer' that are referenced but not defined in the spec + const opaqueRecordTypes = new Set(); + const builtinIdents = new Set(['String', 'Nat', 'Int', 'Bool', 'Real', 'Bytes', 'Date', 'Number', 'IssueState', 'AST', 'ArtifactMap']); + function collectIdents(t: TypeExpr | undefined): void { + if (!t) return; + if (t.type === 'ident' && t.name) { + const name = cleanName(t.name); + if (!builtinIdents.has(name) && !enumMap.has(name) && !name.startsWith(speck.name)) { + opaqueRecordTypes.add(name); + } + } + if (t.elementType) collectIdents(t.elementType); + if (t.keyType) collectIdents(t.keyType); + if (t.valueType) collectIdents(t.valueType); + if (t.fields) t.fields.forEach((f: any) => collectIdents(f.type)); + } + for (const v of (stateNode?.variables ?? [])) collectIdents(v.typeExpr); + for (const a of actions) for (const p of a.params) collectIdents(p.type); + // Collect which state variables are Map types (for bracket -> .get() translation) const mapVarNames = new Set(stateVars .filter(v => v.typeExpr?.type === 'map' || (v.typeExpr?.type === 'ident' && v.typeExpr?.name && /^Map/i.test(v.typeExpr.name))) @@ -223,9 +243,20 @@ function emitSpeck(speck: SpeckNode): string { // Decision log type: use first event if available, otherwise any[] const logType = events.length > 0 ? events[0].name + '[]' : 'any[]'; + // Build opaque type declarations + const opaqueTypeDecls = opaqueRecordTypes.size > 0 + ? '// Runtime type placeholders (opaque record types)\n' + + Array.from(opaqueRecordTypes).sort().map(t => `type ${t} = any;`).join('\n') + '\n\n' + : ''; + + // Add non-null assertions (!) to class properties for strict mode + const statePropertiesNonNull = stateVars.map(v => { + return ` ${v.name}!: ${tsType(v.typeExpr, speck.name, enumMap)};`; + }).join('\n'); + const classBody = ` -export class ${className} { -${stateProperties} +${opaqueTypeDecls}export class ${className} { +${statePropertiesNonNull} decisionLog: ${logType} = []; constructor() { @@ -301,7 +332,10 @@ function emitAction(action: ActionNode, stateVarNames: Set, mapVarNames: .filter(s => s.type === 'postcondition') .map(s => { const expr = rewriteExpr(s.expr, stateVarNames, mapVarNames, localNames, stateEnumName, knownStateValues); - return ` // postcondition: ${expr}\n if (!(${expr})) throw new Error('Postcondition failed: ${expr.replace(/'/g, "\\'")}');`; + // If the expression compares objects/arrays with ===, add ts-ignore to suppress TS2839 + const needsTsIgnore = /===\s*\{|===\s*\[/.test(expr); + const tsIgnore = needsTsIgnore ? ' // @ts-expect-error TS2839 — generated spec comparison (structural equality not available in JS)\n' : ''; + return `${tsIgnore} // postcondition: ${expr}\n if (!(${expr})) throw new Error('Postcondition failed: ${expr.replace(/'/g, "\\'")}');`; }) .join('\n'); @@ -322,6 +356,7 @@ function rewriteExpr(expr: string, stateVarNames: Set, mapVarNames: Set< // Step 1: Replace function calls and special syntax let ts = expr .replace(/\bnow\(\)/g, 'Date.now()') + .replace(/\blength\(([^)]+)\)/g, '$1.length') .replace(/\blen\(([^)]+)\)/g, '$1.length') .replace(/\bjoin\(([^,]+),\s*([^)]+)\)/g, '$1.join($2)') .replace(/\bforall\s+(\w+)\s+in\s+([^:]+):\s*(.+)/g, '$2.every(($1) => $3)'); @@ -359,9 +394,10 @@ function rewriteExpr(expr: string, stateVarNames: Set, mapVarNames: Set< .replace(/__OBJ_LIT_(\d+)__/g, (_, i) => objectLiterals[parseInt(i)]); // Step 4: Replace comparison operators (also handle trailing == at end of string) + // Use space-aware replacement since \b==\b fails when == is between spaces (both non-word) ts = result - .replace(/\b==\b/g, '===') - .replace(/\b!=\b/g, '!==') + .replace(/ == /g, ' === ') + .replace(/ != /g, ' !== ') .replace(/==$/, '==='); // trailing == at end-of-string (no word boundary after) // Step 5: Translate SpeckDL expression patterns to JavaScript @@ -393,7 +429,10 @@ function rewriteExpr(expr: string, stateVarNames: Set, mapVarNames: Set< // "accounts[t.from].debits_posted ===" -> "accounts[t.from].debits_posted === accounts[t.from].debits_posted" ts = ts.replace(/(\S+)\s*===\s*$/g, '$1 === $1'); - // 5f: Map access via bracket -> .get() (e.g. "transfers[id]" -> "transfers.get(id)") + // 5f: append(X, Y) -> [...X, Y] (list append) + ts = ts.replace(/\bappend\(([^,]+),\s*([^)]+)\)/g, '[...$1, $2]'); + + // 5g: Map access via bracket -> .get() (e.g. "transfers[id]" -> "transfers.get(id)") // Only applies to state variables that are Map types for (const mapVar of mapVarNames) { // Match: mapVar[expr] where mapVar is a known Map state variable @@ -403,7 +442,7 @@ function rewriteExpr(expr: string, stateVarNames: Set, mapVarNames: Set< const thisPattern = new RegExp('\\b(this\\.' + mapVar + ')\\[([^\\]]+)\\]', 'g'); ts = ts.replace(thisPattern, '$1.get($2)'); } - // 5g: .size() -> .size (Set/Map size property, not a method in JS) + // 5h: .size() -> .size (Set/Map size property, not a method in JS) ts = ts.replace(/\.size\(\)/g, '.size'); return ts.trim(); diff --git a/compiler/src/generators/z3.ts b/compiler/src/generators/z3.ts index 85e0cbd..7174ccb 100644 --- a/compiler/src/generators/z3.ts +++ b/compiler/src/generators/z3.ts @@ -69,8 +69,12 @@ function emitZ3(speck: SpeckNode, options: Z3Options): string { const constraints = members.filter(m => m.type === 'constraint') as ConstraintNode[]; const verifies = members.filter(m => m.type === 'verify') as VerifyNode[]; - // Parse invariants from the raw speck body - const invariants = (speck as any)._invariants || parseInvariants(speck); + // Parse invariants from the raw speck body (handled by parseInvariantsFromSource) + // Also extract invariants from parsed constraint nodes + const invariants = extractInvariantsFromConstraints(constraints); + const sourceInvariants = (speck as any)._invariants || []; + const allInvariants = [...sourceInvariants, ...invariants]; + // Parse next: transition relation const nextNode = (speck as any)._next || parseNext(speck); @@ -106,7 +110,7 @@ function emitZ3(speck: SpeckNode, options: Z3Options): string { // Declare _post state variables for invariants that compare pre/post state // (e.g. "currentTerm' >= currentTerm" → "currentTerm_post >= currentTerm") - const needsPostVars = invariants.some((inv: InvariantNode) => + const needsPostVars = allInvariants.some((inv: InvariantNode) => inv.statements.some((s: InvariantStatement) => s.type === 'require' && s.expr.includes("'"))); if (needsPostVars) { for (const v of stateVars) { @@ -116,23 +120,23 @@ function emitZ3(speck: SpeckNode, options: Z3Options): string { } // Step 3: Emit invariants as define-fun - if (invariants.length > 0) { + if (allInvariants.length > 0) { lines.push(''); lines.push('; --- Invariants ---'); - for (const inv of invariants) { + for (const inv of allInvariants) { emitInvariant(lines, inv, stateVars); } } - // Step 4: Emit constraints as assertions - if (constraints.length > 0) { + // Step 4: Emit constraints as assertions (invariant-based constraints) + // Constraint invariants are handled via invariant define-fun above + // plus the BMC unrolling below for verify blocks. + // For non-verify specs, emit assertion of each invariant: + if (verifies.length === 0 && allInvariants.length > 0) { lines.push(''); - lines.push('; --- Constraints ---'); - for (let i = 0; i < constraints.length; i++) { - const c = constraints[i]; - const z3Expr = translateExpr(c.expr, stateVars, /* suffix */ ''); - lines.push(`; C${i + 1}: ${c.expr}`); - lines.push(`(assert ${z3Expr})`); + lines.push('; --- Invariant Assertions ---'); + for (const inv of allInvariants) { + lines.push(`(assert (${inv.name}))`); } } @@ -155,7 +159,7 @@ function emitZ3(speck: SpeckNode, options: Z3Options): string { lines.push(''); lines.push('; --- Bounded Model Checking ---'); for (const v of verifies) { - emitBMC(lines, speck.name, v, invariants, actions, nextNode, stateVars, options); + emitBMC(lines, speck.name, v, allInvariants, actions, nextNode, stateVars, options); } } @@ -279,7 +283,7 @@ function z3Sort(t: TypeExpr): string { // Strip ident: prefix, remove Z3-invalid chars, return clean sort name let clean = t.name.startsWith('ident:') ? t.name.substring(6) : t.name; // Remove parenthesized parameters: Option(NodeId) → Option_NodeId - clean = clean.replace(/\(([^)]+)\)/g, '_$1').replace(/[<>,\s]+/g, '_').replace(/__+/g, '_'); + clean = clean.replace(/\(([^)]+)\)/g, '_$1').replace(/[<>,\s|"\/]+/g, '_').replace(/__+/g, '_'); return clean; // Named sort (declared as opaque) } @@ -307,7 +311,7 @@ function simpleHash(s: string): string { function emitRecordSort(lines: string[], name: string, fields: Map): void { // Sanitize: strip ident: prefix and remove Z3-invalid characters let cleanName = name.startsWith('ident:') ? name.substring(6) : name; - cleanName = cleanName.replace(/\(([^)]+)\)/g, '_$1').replace(/[<>,\s]+/g, '_').replace(/__+/g, '_'); + cleanName = cleanName.replace(/\(([^)]+)\)/g, '_$1').replace(/[<>,\s|"/]+/g, '_').replace(/__+/g, '_'); if (fields.size === 0) { // Opaque sort (for named types like Account, Transfer) @@ -410,6 +414,17 @@ function translateExpr(expr: string, stateVars: StateVar[], suffix: string): str // Handle old() wrapper — spec-level, keep inner e = e.replace(/old\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g, '$1'); + // Handle SpeckDL forall: forall r in [0..4]: expr => (forall ((r Int)) expr) + // Domain [0..4] is a range — for now, treat as Int + const forallMatch = e.match(/^forall\s+(\w+)\s+in\s+(\[?[\w.\d\-]+\]?):\s*(.+)$/s); + if (forallMatch) { + const varName = forallMatch[1]; + const domainSort = inferDomainSort(forallMatch[2], stateVars); + const bodyExpr = forallMatch[3].trim(); + const bodyZ3 = translateExpr(bodyExpr, stateVars, suffix); + return `(forall ((${varName} ${domainSort})) ${bodyZ3})`; + } + // Handle prime notation for post-state: currentTerm' → currentTerm_post (invariant comparison) e = e.replace(/\b(\w+)'/g, '$1_post'); @@ -528,10 +543,15 @@ function translateExpr(expr: string, stateVars: StateVar[], suffix: string): str // Wrap distinct e = e.replace(/\bdistinct\s+(\S+)\s+(\S+)/g, '(distinct $1 $2)'); - // Fix remaining infix = that escaped convertToPrefix (e.g. inside => bodies) - // Match: word = word or word = number, at any depth - e = e.replace(/\b(\w+)\s*=\s*(\w+|\d+|Bool|true|false)\b/g, "(= $1 $2)"); - + // Fix remaining infix operators that escaped convertToPrefix + // word = word/val: convert to (= word val) + e = e.replace(/(\b\w+)\s*=\s*(\w+|\d+|Bool|true|false)\b/g, '(= $1 $2)'); + // (innermost expr) = val: convert to (= (expr) val) + e = e.replace(/\(([^()]+)\)\s*=\s*(\w+|\d+|Bool|true|false)\b/g, '(= ($1) $2)'); + // word <= word: convert to (<= word word) + e = e.replace(/(\b\w+)\s*(<=|>=)\s*(\w+|\d+|Bool|true|false)\b/g, '($2 $1 $3)'); + // (innermost expr) <= val: convert to (<= (expr) val) + e = e.replace(/\(([^()]+)\)\s*(<=|>=)\s*(\w+|\d+|Bool|true|false)\b/g, '($2 ($1) $3)'); // Restore strings e = restoreStrings(e, strings); @@ -698,16 +718,15 @@ function emitBMC( stateVars: StateVar[], options: Z3Options ): void { - const depth = options.verifyDepth; + const depth = verify.depth || options.verifyDepth; const temporalExpr = verify.temporalExpr; + const invariantName = verify.name; lines.push(`; Verification: ${temporalExpr}`); lines.push(`; BMC depth: ${depth}`); - // Parse the temporal property const isAlways = temporalExpr.startsWith('Always(') || temporalExpr.startsWith('always('); const isEventually = temporalExpr.startsWith('Eventually(') || temporalExpr.startsWith('eventually('); - const invariantName = extractInvariantName(temporalExpr); // Declare state variables at each step lines.push(''); @@ -939,13 +958,39 @@ function translateInitValue(val: string, typeExpr: TypeExpr): string { return val; } -// --- Invariant parsing (from raw AST since parser doesn't handle invariants yet) --- +// --- Invariant extraction from constraint nodes --- + +/** + * Convert parsed ConstraintNode entries into InvariantNode format + * so they can be emitted as Z3 define-fun assertions. + * + * Constraint nodes from the parser: + * { type: 'constraint', name: 'ReadConsistency', expr: 'forall r in [0..4]: ...' } + * + * We convert them to: + * { type: 'invariant', name: 'ReadConsistency', statements: [ + * { type: 'require', expr: 'forall r in ...' } | { type: 'forall', ... } + * ]} + */ +function extractInvariantsFromConstraints(constraints: ConstraintNode[]): InvariantNode[] { + const invariants: InvariantNode[] = []; + + for (const c of constraints) { + const name = c.name || `constraint_${invariants.length}`; + const expr = c.expr.trim(); + + if (!expr) continue; + + // Try to parse forall statements in the expression + const statements = parseInvariantBody(expr); + invariants.push({ type: 'invariant', name, statements }); + } + + return invariants; +} function parseInvariants(speck: SpeckNode): InvariantNode[] { - // We need to parse the speck body for invariant blocks - // Since invariants are not parsed by the AST parser, we'll need to read the raw source - // For now, we'll accept the invariants from a separate parsing step - // This is extracted from the rawSpeckBody which we don't have in the AST + // Legacy stub — returns empty, new code uses extractInvariantsFromConstraints return []; } @@ -1018,7 +1063,8 @@ function parseInvariantBody(content: string): InvariantStatement[] { if (!line || line.startsWith('//')) { i++; continue; } // forall var in domain: (body on next line(s)) - const forallHeaderMatch = line.match(/^forall\s+(\w+)\s+in\s+([.\w]+):\s*$/); + // domain can be: [0..4], someVar.keys, someVar.values, etc. + const forallHeaderMatch = line.match(/^forall\s+(\w+)\s+in\s+(\[?[\w.\-\d]+\]?):\s*$/); if (forallHeaderMatch) { const bodyLines: string[] = []; i++; @@ -1041,7 +1087,8 @@ function parseInvariantBody(content: string): InvariantStatement[] { } // forall var in domain: expr (single line) - const forallMatch = line.match(/^forall\s+(\w+)\s+in\s+([.\w]+):\s*(.+)$/); + // domain can be: [0..4], accounts.values, log.indices, transfers.keys, etc. + const forallMatch = line.match(/^forall\s+(\w+)\s+in\s+(\[?[\w.\d\-]+\]?):\s*(.+)$/); if (forallMatch) { statements.push({ type: 'forall', @@ -1053,7 +1100,8 @@ function parseInvariantBody(content: string): InvariantStatement[] { } // forall var1, var2 in domain1, domain2: expr (complex) - const complexForallMatch = line.match(/^forall\s+([\w,\s]+)\s+in\s+([\w\s.,]+):\s*(.+)$/); + // domains may include bracket notation and dots + const complexForallMatch = line.match(/^forall\s+([\w,\s]+)\s+in\s+([\[\]\w\s.,\-]+):\s*(.+)$/); if (complexForallMatch) { const vars = complexForallMatch[1].split(',').map((s: string) => s.trim()).filter(Boolean); const domains = complexForallMatch[2].split(',').map((s: string) => s.trim()).filter(Boolean); diff --git a/compiler/src/parser.ts b/compiler/src/parser.ts index f3ee705..5523c84 100644 --- a/compiler/src/parser.ts +++ b/compiler/src/parser.ts @@ -28,12 +28,15 @@ export interface OutputNode { export interface ConstraintNode { type: 'constraint'; + name?: string; expr: string; } export interface VerifyNode { type: 'verify'; + name: string; temporalExpr: string; + depth?: number; } export interface InterfaceNode { @@ -245,9 +248,9 @@ function parseSpeck(lines: string[], startIndex: number): SpeckNode | null { const openCount = (rawLine.match(/{/g) || []).length; const closeCount = (rawLine.match(/}/g) || []).length; - // Check for block-opening members + // Check for block-opening members (those that open braces on the same line) const blockStarters = ['state:', 'init:', 'action ', 'event ', 'provenance ', 'bom ', 'interface ', - 'state {', 'init {']; + 'state {', 'init {', 'verify ', 'constraint ']; const isBlockStarter = blockStarters.some(s => line.startsWith(s)); if (isBlockStarter && openCount > 0) { @@ -256,9 +259,39 @@ function parseSpeck(lines: string[], startIndex: number): SpeckNode | null { if (member) { members.push(member); } - // Skip past this block - const endIdx = findBlockEnd(lines, i + 1, braceCount + openCount); - i = endIdx + 1; + // Skip past this block if it spans multiple lines + if (closeCount < openCount) { + const endIdx = findBlockEnd(lines, i + 1, braceCount + openCount); + i = endIdx + 1; + } else { + i++; + } + continue; + } + + // Handle constraint/verify blocks that may span multiple lines without braces + // (e.g. constraint Name: forall r in [0..4]:) + if (line.startsWith('constraint ') || line.startsWith('verify ')) { + const member = parseMultiLineConstraintVerify(lines, i); + if (member) { + members.push(member); + // Skip past the consumed continuation lines + while (i + 1 < lines.length) { + const nextLine = lines[i + 1].trim(); + if (!nextLine || nextLine.startsWith('//') || nextLine.startsWith('/*') || + nextLine.startsWith('constraint ') || nextLine.startsWith('verify ') || + nextLine.startsWith('constraint:') || nextLine.startsWith('verify:') || + nextLine.startsWith('state') || nextLine.startsWith('init') || + nextLine.startsWith('action ') || nextLine.startsWith('event ') || + nextLine.startsWith('interface ') || nextLine.startsWith('provenance ') || + nextLine.startsWith('bom ') || nextLine.startsWith('}') || + nextLine.startsWith('next:') || nextLine.startsWith('invariant ')) { + break; + } + i++; + } + } + i++; continue; } @@ -329,6 +362,12 @@ function parseMemberBlock(lines: string[], startIndex: number): MemberNode | nul if (firstLine.startsWith('bom ')) { return { type: 'bom' }; } + if (firstLine.startsWith('verify ')) { + return parseVerifyBlockMultiline(lines, startIndex, startBraceCount); + } + if (firstLine.startsWith('constraint ')) { + return parseConstraintBlockMultiline(lines, startIndex, startBraceCount); + } return null; } @@ -346,14 +385,28 @@ function parseMember(line: string): MemberNode | null { return { type: 'output', typeExpr }; } - // constraint: + // constraint Name: expr (single-line named constraint) + if (line.startsWith('constraint ')) { + const match = line.match(/^constraint\s+(\w+):\s*(.+)$/); + if (match) { + return { type: 'constraint', name: match[1], expr: match[2].trim() }; + } + return null; // multi-line constraint block (handled by parseMemberBlock) + } + + // constraint: expr (unnamed, single-line) if (line.startsWith('constraint:')) { return { type: 'constraint', expr: line.substring(11).trim() }; } - // verify: + // verify Always(Name) { depth N } or verify Always(Name) (single-line forms) + if (line.startsWith('verify ')) { + return parseVerifySingleLine(line); + } + + // verify: expr (old unnamed single-line) if (line.startsWith('verify:')) { - return { type: 'verify', temporalExpr: line.substring(7).trim() }; + return { type: 'verify', name: 'unnamed', temporalExpr: line.substring(7).trim() }; } // interface: @@ -466,18 +519,26 @@ function parseStateBlock(inner: string): StateNode { for (const vStr of varStrs) { const withDefault = vStr.match(/^(\w+)\s*:\s*(.+?)\s*:=\s*(.+)$/); if (withDefault) { + // Strip trailing comments from type expression + let typeStr = withDefault[2].trim(); + const commentIdx = typeStr.indexOf('//'); + if (commentIdx >= 0) typeStr = typeStr.substring(0, commentIdx).trim(); variables.push({ name: withDefault[1], - typeExpr: parseTypeExpr(withDefault[2].trim()), + typeExpr: parseTypeExpr(typeStr), defaultInit: withDefault[3].trim(), }); continue; } const withoutDefault = vStr.match(/^(\w+)\s*:\s*(.+)$/); if (withoutDefault) { + // Strip trailing comments from type expression + let typeStr = withoutDefault[2].trim(); + const commentIdx = typeStr.indexOf('//'); + if (commentIdx >= 0) typeStr = typeStr.substring(0, commentIdx).trim(); variables.push({ name: withoutDefault[1], - typeExpr: parseTypeExpr(withoutDefault[2].trim()), + typeExpr: parseTypeExpr(typeStr), }); } } @@ -819,7 +880,21 @@ function parseActionBlockMultiline(lines: string[], startIndex: number, startBra } // require expr if (stmt.startsWith('require ')) { - statements.push({ type: 'require', expr: stmt.substring(8).trim() }); + let expr = stmt.substring(8).trim(); + // support multi-line continuation (forall, or, etc.) + while (i + 1 < bodyLines.length) { + const nextLine = bodyLines[i + 1]; + // Stop if next line starts a new statement keyword + if (nextLine.startsWith('precondition:') || nextLine.startsWith('postcondition:') || + nextLine.startsWith('require ') || nextLine.startsWith('return ') || + nextLine.startsWith('emit ') || nextLine.startsWith('let ') || + nextLine.includes(':=')) { + break; + } + i++; + expr += ' ' + nextLine; + } + statements.push({ type: 'require', expr }); continue; } // return expr @@ -911,3 +986,231 @@ function parseInterfaceBlockMultiline(lines: string[], startIndex: number, start return { ...header, methods }; } + +// --- Multi-line constraint/verify parsing (no braces needed) --- + +/** + * Parse a constraint or verify that may span multiple lines without braces. + * Used for forall-style constraints like: + * constraint Name: forall r in [0..4]: + * (expr) + * + * and verify blocks like: + * verify Always(Name) + * verify Always(Name) { depth N } + */ +function parseMultiLineConstraintVerify(lines: string[], startIndex: number): MemberNode | null { + const line = lines[startIndex].trim(); + + if (line.startsWith('verify ')) { + return parseVerifyAnyForm(lines, startIndex); + } + + if (line.startsWith('constraint ')) { + return parseConstraintAnyForm(lines, startIndex); + } + + return null; +} + +function parseConstraintAnyForm(lines: string[], startIndex: number): ConstraintNode | null { + const line = lines[startIndex].trim(); + + const namedMatch = line.match(/^constraint\s+(\w+):(.*)$/); + if (!namedMatch) return null; + + const name = namedMatch[1]; + let expr = namedMatch[2].trim(); + + // If opens a brace, treat as block + if (expr.startsWith('{')) { + const afterBrace = expr.substring(1).trim(); + const openCount = (line.match(/{/g) || []).length; + const endIdx = findBlockEnd(lines, startIndex + 1, openCount); + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + const inner = innerLines.join(' '); + expr = (afterBrace + ' ' + inner).trim(); + } else { + // No braces — but might span multiple lines (forall continuation) + const continuationLines: string[] = []; + for (let j = startIndex + 1; j < lines.length; j++) { + const nl = lines[j].trim(); + if (!nl || nl.startsWith('//') || nl.startsWith('/*') || + nl.startsWith('constraint ') || nl.startsWith('verify ') || + nl.startsWith('constraint:') || nl.startsWith('verify:') || + nl.startsWith('state') || nl.startsWith('init') || + nl.startsWith('action ') || nl.startsWith('event ') || + nl.startsWith('interface ') || nl.startsWith('provenance ') || + nl.startsWith('bom ') || nl.startsWith('}') || + nl.startsWith('next:') || nl.startsWith('invariant ')) { + break; + } + continuationLines.push(nl); + } + if (continuationLines.length > 0) { + expr = expr + ' ' + continuationLines.join(' '); + } + } + + return { type: 'constraint', name, expr: expr.trim() }; +} + +function parseVerifyAnyForm(lines: string[], startIndex: number): VerifyNode | null { + const line = lines[startIndex].trim(); + + // Single-line: verify Always(Name) { depth N } + const fullMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*\{\s*depth\s+(\d+)\s*\}/); + if (fullMatch) { + return { + type: 'verify', + name: fullMatch[2], + temporalExpr: fullMatch[1].trim(), + depth: parseInt(fullMatch[3], 10), + }; + } + + // Multi-line: verify Always(Name) { ... } + if (line.includes('{')) { + const headerMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*\{/); + if (headerMatch) { + const temporalExpr = headerMatch[1].trim(); + const name = headerMatch[2]; + + const openCount = (line.match(/{/g) || []).length; + const endIdx = findBlockEnd(lines, startIndex + 1, openCount); + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + const inner = innerLines.join(' '); + + const afterBrace = line.substring(line.indexOf('{') + 1).trim(); + const combined = (afterBrace + ' ' + inner).trim(); + const depthMatch = combined.match(/\bdepth\s+(\d+)\b/); + const depth = depthMatch ? parseInt(depthMatch[1], 10) : undefined; + + return { type: 'verify', name, temporalExpr, depth }; + } + } + + // Simple: verify Always(Name) + const simpleMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*$/); + if (simpleMatch) { + return { + type: 'verify', + name: simpleMatch[2], + temporalExpr: simpleMatch[1].trim(), + }; + } + + return null; +} + +// --- Verify/Constraint block parsing --- + +/** + * Parse a verify block opened with `verify Always(Name) { ... }` or similar. + * The first line already contains the header; we need to parse the body inside { }. + */ +function parseVerifyBlockMultiline(lines: string[], startIndex: number, startBraceCount: number): VerifyNode | null { + const firstLine = lines[startIndex].trim(); + + // Match: verify Always(Name) { depth N } or verify Always(Name) { + const headerMatch = firstLine.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*\{/); + if (!headerMatch) return null; + + const temporalExpr = headerMatch[1].trim(); + const name = headerMatch[2]; + + // Check if the brace closes on the same line (single-line form) + const openBraceCount = (firstLine.match(/{/g) || []).length; + const closeBraceCount = (firstLine.match(/}/g) || []).length; + + if (closeBraceCount >= openBraceCount) { + // Single-line: parse depth from same line + const afterBrace = firstLine.substring(firstLine.indexOf('{') + 1); + const beforeClose = afterBrace.substring(0, afterBrace.lastIndexOf('}')).trim(); + const depthMatch = beforeClose.match(/\bdepth\s+(\d+)\b/); + const depth = depthMatch ? parseInt(depthMatch[1], 10) : undefined; + return { type: 'verify', name, temporalExpr, depth }; + } + + // Multi-line block + let depth: number | undefined; + const endIdx = findBlockEnd(lines, startIndex + 1, startBraceCount); + + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + const inner = innerLines.join(' '); + + const afterBrace = firstLine.substring(firstLine.indexOf('{') + 1).trim(); + + const depthMatch = (afterBrace + ' ' + inner).match(/\bdepth\s+(\d+)\b/); + if (depthMatch) { + depth = parseInt(depthMatch[1], 10); + } + + return { type: 'verify', name, temporalExpr, depth }; +} + +/** + * Parse a single-line verify statement: verify Always(Name) { depth N } + */ +function parseVerifySingleLine(line: string): VerifyNode | null { + // verify Always(Name) { depth N } + const fullMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*\{\s*depth\s+(\d+)\s*\}/); + if (fullMatch) { + return { + type: 'verify', + name: fullMatch[2], + temporalExpr: fullMatch[1].trim(), + depth: parseInt(fullMatch[3], 10), + }; + } + + // verify Always(Name) (no depth, no braces — just a statement) + const simpleMatch = line.match(/^verify\s+((?:Always|always|Eventually|eventually)\s*\(\s*(\w+)\s*\))\s*$/); + if (simpleMatch) { + return { + type: 'verify', + name: simpleMatch[2], + temporalExpr: simpleMatch[1].trim(), + }; + } + + return null; +} + +/** + * Parse a constraint block opened with `constraint Name: ...` which may + * be multi-line (e.g. forall spanning multiple lines). + */ +function parseConstraintBlockMultiline(lines: string[], startIndex: number, startBraceCount: number): ConstraintNode | null { + const firstLine = lines[startIndex].trim(); + + // Match: constraint Name: expr (possibly opening a {} block, or just a forall on next line) + // For the SQLiteWAL style: constraint Name: expr (single line, no braces needed) + const namedMatch = firstLine.match(/^constraint\s+(\w+):(.*)$/); + if (namedMatch) { + const name = namedMatch[1]; + let expr = namedMatch[2].trim(); + + // If the expression opens a brace, collect the block + if (expr.startsWith('{')) { + const endIdx = findBlockEnd(lines, startIndex + 1, startBraceCount); + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + const inner = innerLines.join(' '); + // Combine: content after { on first line + content from inner lines + const afterBrace = expr.substring(1).trim(); + expr = (afterBrace + ' ' + inner).trim(); + } else { + // No braces, but might still be multiline (forall spanning multiple lines) + // Check if next line(s) continue the expression + const endIdx = findBlockEnd(lines, startIndex + 1, startBraceCount); + const innerLines = lines.slice(startIndex + 1, endIdx).map(l => l.trim()).filter(l => l && !l.startsWith('//') && !l.startsWith('/*')); + if (innerLines.length > 0) { + expr = expr + ' ' + innerLines.join(' '); + } + } + + return { type: 'constraint', name, expr: expr.trim() }; + } + + return null; +} diff --git a/compiler/test-output/RetryHandler.prov.jsonld b/compiler/test-output/RetryHandler.prov.jsonld index 5cf6760..ecebba2 100644 --- a/compiler/test-output/RetryHandler.prov.jsonld +++ b/compiler/test-output/RetryHandler.prov.jsonld @@ -12,7 +12,7 @@ "@type": "prov:Generation", "prov:activity": { "@type": "prov:Activity", - "prov:startTime": "2026-05-10T08:01:08.887Z" + "prov:startTime": "2026-05-11T17:13:39.546Z" } }, "rdfs:label": "RetryHandler", diff --git a/compiler/test-output/RetryHandler.specbom.cdx.json b/compiler/test-output/RetryHandler.specbom.cdx.json index 352b04e..038591b 100644 --- a/compiler/test-output/RetryHandler.specbom.cdx.json +++ b/compiler/test-output/RetryHandler.specbom.cdx.json @@ -38,7 +38,7 @@ "name": "Scott Scoble", "email": "scott@scoble.me" }, - "timestamp": "2026-05-10T08:01:08.890Z" + "timestamp": "2026-05-11T17:13:39.549Z" }, { "subject": "speck:RetryHandler", @@ -53,7 +53,7 @@ "name": "Speckl Compiler", "email": "compiler@speckl.scoble.me" }, - "timestamp": "2026-05-10T08:01:08.890Z" + "timestamp": "2026-05-11T17:13:39.549Z" }, { "subject": "speck:RetryHandler", @@ -68,7 +68,7 @@ "name": "Speckl Compiler", "email": "compiler@speckl.scoble.me" }, - "timestamp": "2026-05-10T08:01:08.890Z" + "timestamp": "2026-05-11T17:13:39.549Z" } ] } \ No newline at end of file diff --git a/compiler/test-output/RetryHandler.specbom.spdx.json b/compiler/test-output/RetryHandler.specbom.spdx.json index 08c638f..12d2884 100644 --- a/compiler/test-output/RetryHandler.specbom.spdx.json +++ b/compiler/test-output/RetryHandler.specbom.spdx.json @@ -13,7 +13,7 @@ "spdxVersion": "3.0.1", "dataLicense": "CC0-1.0", "creationInfo": { - "created": "2026-05-10T08:01:08.891Z", + "created": "2026-05-11T17:13:39.551Z", "createdBy": [ "Organization: Speckl", "tool: speckl-compile-0.2.0" @@ -27,7 +27,7 @@ "@type": "spdx:Tool", "name": "speckl-compile" }, - "timestamp": "2026-05-10T08:01:08.891Z", + "timestamp": "2026-05-11T17:13:39.551Z", "comment": "Review type: manual" } ] diff --git a/examples/SQLiteWAL.speck b/examples/SQLiteWAL.speck index 6d6380b..1235b97 100644 --- a/examples/SQLiteWAL.speck +++ b/examples/SQLiteWAL.speck @@ -1,486 +1,267 @@ -// SQLite Write-Ahead Log Concurrency Model (speckl#36) -// -// Models the WAL mode state machine: three-file system (X.db + X.db-wal + X.db-shm), -// concurrent readers, single writer, checkpoint protocol, and WAL reset. -// This is SQLite's most complex concurrency mechanism. -// -// Based on: docs/db-sqlite-reference.md Section 2: WAL Mode State Machine -// Scope: WAL frame lifecycle, reader end-marks, checkpoint isolation, WAL reset -// Does NOT cover: VDBE opcodes, B-Tree internals, SQL-level semantics - speck SQLiteWAL { - author: "Engineering (agent-engineering) " - source: architecture_review ref "SQLite-WAL-Core" - review: hybrid - derives from docs/db-sqlite-reference.md via "Section 2: WAL Mode State Machine" - satisfies speckl#36 + // SQLite WAL mode concurrency model + // Specifies the Write-Ahead Log protocol: concurrent readers + single writer, + // checkpoint lifecycle, and snapshot consistency. + // + // Uses only built-in types (Nat, Bool, Map) for Z3 compatibility. + // Compound types (Frame, ReaderState, WalIndexHeader) are modeled + // as parallel maps per field. - // === Types === - - type PageData = Bytes - type FrameSeq = Nat - type ReaderId = Nat - type LockSlot = Nat - - type Frame = { - page: Nat, - data: PageData, - seq: FrameSeq, - checksum: Nat, - dbSize: Nat, - isCommit: Bool - } - - type ReaderState = { - endMark: FrameSeq, - lockSlot: LockSlot, - active: Bool - } - - type WalIndexHeader = { - nBackfill: FrameSeq, - nBackfillAttempted: FrameSeq, - nFrame: FrameSeq, - aReadMark: Array(Nat, 5), - salt1: Nat, - salt2: Nat, - version: Nat - } - - type LockType = String // "READER", "WRITER", "CHECKPOINTER", "NONE" - - // === State === + // --- Type aliases (Nat-based, Z3-compatible) --- + // FrameSeq: sequence number for WAL frames + // ReaderId: integer index for reader slots (0..4) + // LockType: 0=READER, 1=WRITER, 2=CHECKPOINTER, 3=NONE + // CheckpointMode: 0=PASSIVE, 1=FULL, 2=RESTART, 3=TRUNCATE + // PageId: database page identifier state { - // WAL frames indexed by sequence number - walFrames: Map(FrameSeq, Frame) + // WAL frame storage: frame sequence → data per frame + walFrames: Map(Nat, Nat) // frameId → pageId (0 = empty slot) + walFrameSeq: Map(Nat, Nat) // frameId → seq number + nFrames: Nat // number of frames in WAL + maxFrames: Nat // maximum frames before checkpoint needed - // Number of valid commit frames in WAL - nFrames: FrameSeq - - // Checkpoint backfill progress: frames already copied back to DB - checkpointSeq: FrameSeq - checkpointAttempted: FrameSeq - - // Active readers with their end marks - readers: Map(ReaderId, ReaderState) + // Reader management (max 5 concurrent readers) + readerEndMark: Map(Nat, Nat) // readerId → end mark, 0 = inactive + nReaders: Nat // number of active readers // Writer state - writerActive: Bool - writerLock: LockType - + writerActive: Bool // is writer in progress? + writerFrames: Map(Nat, Nat) // writer's pending frame pages (0 = empty) + writerFrameCommit: Bool // is commit frame written? + // Checkpoint state - checkpointActive: Bool - checkpointMode: String // "PASSIVE" | "FULL" | "RESTART" | "TRUNCATE" - - // WAL reset needed flag - walResetNeeded: Bool - - // shm file state — WAL-index header - walIndex: WalIndexHeader - - // Database page state (simplified: tracks which pages are in DB) - dbPages: Map(Nat, PageData) - - // Lock slot tracking: which slot each reader holds - readLockSlots: Map(LockSlot, Bool) // true = slot in use - - // Error state + checkpointActive: Bool // is checkpoint in progress? + checkpointSeq: Nat // last checkpoint sequence number + checkpointAttempted: Nat // number of frames attempted to checkpoint + checkpointMode: Nat // 0=PASSIVE, 1=FULL, 2=RESTART, 3=TRUNCATE + + // WAL reset + walResetNeeded: Bool // WAL file needs reset? + + // Database state + dbContents: Map(Nat, Nat) // pageId → content (0 = uninitialized) + + // Error recovery errorState: Bool - errCode: Nat + errorCode: Nat } init { - walFrames == emptyMap + walFrames == {0: 0} + walFrameSeq == {0: 0} nFrames == 0 + maxFrames == 100 + readerEndMark == {0: 0, 1: 0, 2: 0, 3: 0, 4: 0} + nReaders == 0 + writerActive == false + writerFrames == {0: 0} + writerFrameCommit == false + checkpointActive == false checkpointSeq == 0 checkpointAttempted == 0 - readers == emptyMap - writerActive == false - writerLock == "NONE" - checkpointActive == false - checkpointMode == "PASSIVE" + checkpointMode == 0 walResetNeeded == false - walIndex == { - nBackfill: 0, - nBackfillAttempted: 0, - nFrame: 0, - aReadMark: [0, 0, 0, 0, 0], - salt1: 0, - salt2: 0, - version: 3007000 - } - dbPages == emptyMap - readLockSlots == {0: false, 1: false, 2: false, 3: false, 4: false} + dbContents == {0: 0} errorState == false - errCode == 0 + errorCode == 0 } - // === Invariants === + // ============================================================ + // Actions + // ============================================================ - // W1: Read Consistency — a reader with end-mark M sees exactly the database - // state as of the last commit frame ≤ M. No partial WAL writes visible. - invariant ReadConsistency { - forall r in readers.keys: - readers[r].active == true implies - readers[r].endMark <= nFrames + action BeginRead(readerId: Nat) { + require readerId >= 0 and readerId < 5 // valid slot + require nReaders < 5 // room for reader + require readerEndMark[readerId] == 0 // not already active + require not errorState + + readerEndMark[readerId] := nFrames + nReaders := nReaders + 1 } - // W2: Write Serialization — at most one writer at a time - invariant WriteSerialization { - writerActive == true implies checkpointActive == false + action ReadFrame(readerId: Nat, frameId: Nat) { + require readerEndMark[readerId] > 0 // reader is active + require frameId >= 1 and frameId <= nFrames // frame exists + require frameId <= readerEndMark[readerId] // frame is within reader's snapshot + + // Reading is nondestructive — no state change } - // W3: Checkpoint Safety — checkpoint does not remove frames still needed - // by active readers. nBackfill ≤ min(active reader end marks) - invariant CheckpointSafety { - forall r in readers.keys: - readers[r].active == true implies checkpointSeq <= readers[r].endMark + action EndRead(readerId: Nat) { + require readerEndMark[readerId] > 0 // reader is active + require not errorState + + readerEndMark[readerId] := 0 + nReaders := nReaders - 1 } - // W4: Frame Ordering — WAL frames are committed in sequence, no gaps. - // nFrames is monotonic (non-decreasing except during WAL reset). - invariant FrameOrdering { - // All committed frames have sequence numbers 1..nFrames - forall s in walFrames.keys: - s >= 1 and s <= nFrames - } - - // W5: Snapshot Integrity — no WAL frame visible to a reader is overwritten - // until that reader completes - invariant SnapshotIntegrity { - forall r in readers.keys: - forall s in walFrames.keys: - readers[r].active == true and s <= readers[r].endMark implies - s in walFrames.keys - } - - // W6: WAL Reset Condition — WAL reset only happens when no reader is on - // an old snapshot (all readers must be on the newest frames or no active readers) - invariant WalResetCondition { - walIndex.nFrame == 0 implies - (forall r in readers.keys: readers[r].active == false) - } - - // W7: Lock Deadlock Free — the lock protocol (READER/CHECKPOINTER/WRITER) - // doesn't deadlock: writer and checkpointer are never simultaneously active - invariant LockDeadlockFree { - writerActive == true implies checkpointActive == false - checkpointActive == true implies writerActive == false - } - - // W8: Commit Durability — committed frames persist; if a frame has isCommit - // set, it remains in the WAL until properly checkpointed - invariant CommitDurability { - forall s in walFrames.keys: - walFrames[s].isCommit == true and s > checkpointSeq implies - s in walFrames.keys - } - - // W9: Backfill Bound — checkpoint never backfills past the oldest active - // reader's end mark - invariant BackfillBound { - checkpointAttempted <= checkpointSeq or - checkpointAttempted <= nFrames - } - - // W10: Three-File Consistency — the three files (wal, shm, db) are mutually - // consistent. walIndex.nFrame matches nFrames. walIndex.nBackfill matches checkpointSeq. - invariant ThreeFileConsistency { - walIndex.nFrame == nFrames and - walIndex.nBackfill == checkpointSeq - } - - // === Actions === - - // Action 1: BeginRead — reader establishes snapshot at given startFrame - action BeginRead(startFrame: FrameSeq, readerId: ReaderId) { - require errorState == false - require readerId notIn readers.keys - require startFrame <= nFrames - - // Find an available lock slot (0-4) - let slot := 0 - require exists s in [0..4]: readLockSlots[s] == false - - // Acquire a read lock slot - readLockSlots[slot] := true - - // Register the reader with its end mark (snapshot point) - readers[readerId] := { - endMark: startFrame, - lockSlot: slot, - active: true - } - - // Update walIndex read marks - walIndex.aReadMark[slot] := startFrame - - emit ReadStarted { readerId: readerId, endMark: startFrame, lockSlot: slot } - } - - // Action 2: ReadFrame — reader reads a page from WAL or DB - action ReadFrame(readerId: ReaderId, pageId: Nat) { - require errorState == false - require readerId in readers.keys - require readers[readerId].active == true - - let readerMark := readers[readerId].endMark - - // FindFrame(P, end_mark): find the latest frame for pageId with seq ≤ readerMark - // If found in WAL: read from WAL frame. If not: read from DB. - // (Reading is nondestructive — just verifies the frame exists) - - emit FrameRead { - readerId: readerId, - pageId: pageId, - endMark: readerMark - } - } - - // Action 3: EndRead — reader releases its end mark and lock slot - action EndRead(readerId: ReaderId) { - require readerId in readers.keys - require readers[readerId].active == true - - let slot := readers[readerId].lockSlot - - // Release the reader's lock slot - readers[readerId].active := false - readLockSlots[slot] := false - - // Update walIndex read marks for this slot - walIndex.aReadMark[slot] := 0 - - emit ReadEnded { readerId: readerId, lockSlot: slot } - } - - // Action 4: BeginWrite — writer starts (requires no active checkpoint) action BeginWrite() { - require errorState == false - require writerActive == false - require checkpointActive == false + require not writerActive + require not checkpointActive + require not errorState + require nFrames < maxFrames // room for at least one frame - // Acquire WAL_WRITE_LOCK exclusively writerActive := true - writerLock := "WRITER" - - emit WriteStarted { startFrame: nFrames } + writerFrameCommit := false } - // Action 5: AppendFrame — writer appends a frame to the WAL - action AppendFrame(pageId: Nat, data: PageData, checksum: Nat, dbSize: Nat, isCommit: Bool) { - require errorState == false - require writerActive == true - require writerLock == "WRITER" + action AppendFrame(frameId: Nat, pageId: Nat) { + require writerActive // writer must be active + require not writerFrameCommit // no commit yet + require frameId < maxFrames // valid frame slot + require nFrames < maxFrames - // Create new frame at next sequence number - let nextSeq := nFrames + 1 - - let frame: Frame := { - page: pageId, - data: data, - seq: nextSeq, - checksum: checksum, - dbSize: dbSize, - isCommit: isCommit - } - - // Append to WAL - walFrames[nextSeq] := frame - nFrames := nextSeq - - // Update walIndex - walIndex.nFrame := nFrames - - emit FrameAppended { seq: nextSeq, pageId: pageId, isCommit: isCommit } + nFrames := nFrames + 1 + walFrames[nFrames] := pageId + walFrameSeq[nFrames] := nFrames + writerFrames[nFrames] := pageId } - // Action 6: CommitWrite — writer commits its frames action CommitWrite() { - require errorState == false - require writerActive == true - require writerLock == "WRITER" + require writerActive + require not writerFrameCommit + require not errorState - // The last frame appended should be a commit frame - let lastFrame := walFrames[nFrames] - require lastFrame.isCommit == true - - // Release WAL_WRITE_LOCK + writerFrameCommit := true writerActive := false - writerLock := "NONE" - - emit WriteCommitted { commitSeq: nFrames } } - // Action 7: BeginCheckpoint — start checkpoint process - action BeginCheckpoint(mode: String) { - require errorState == false - require checkpointActive == false - require writerActive == false - require mode == "PASSIVE" or mode == "FULL" or mode == "RESTART" or mode == "TRUNCATE" + action BeginCheckpoint(mode: Nat) { + require not checkpointActive + require not errorState + require mode >= 0 and mode <= 3 // valid mode - // Acquire WAL_CKPT_LOCK checkpointActive := true checkpointMode := mode - - emit CheckpointStarted { mode: mode, fromFrame: checkpointSeq } + checkpointAttempted := 0 } - // Action 8: MoveFrame — checkpoint moves a frame from WAL to DB - action MoveFrame(frameId: FrameSeq) { - require errorState == false - require checkpointActive == true - require frameId in walFrames.keys - require frameId > checkpointSeq + action MoveFrame(frameId: Nat) { + require checkpointActive + require frameId >= 1 and frameId <= nFrames + require frameId > checkpointSeq // not already checkpointed + + // Safety: don't checkpoint frames visible to active readers + require forall r in [0..4]: + (readerEndMark[r] == 0) or (frameId <= readerEndMark[r]) - // Must respect active readers: don't move frames past the oldest reader - forall r in readers.keys: - readers[r].active == true implies frameId <= readers[r].endMark - - // Copy frame data to database - let frame := walFrames[frameId] - dbPages[frame.page] := frame.data - - // Advance checkpoint progress - checkpointSeq := frameId - walIndex.nBackfill := checkpointSeq - - // Track attempted backfill - if frameId > checkpointAttempted { - checkpointAttempted := frameId - walIndex.nBackfillAttempted := checkpointAttempted - } - - emit FrameMoved { seq: frameId, pageId: frame.page } + // Move frame to database + dbContents[walFrames[frameId]] := nFrames + checkpointAttempted := checkpointAttempted + 1 } - // Action 9: FinishCheckpoint — complete checkpoint action FinishCheckpoint() { - require checkpointActive == true + require checkpointActive + require not errorState - // For RESTART/TRUNCATE mode, must ensure all frames are backfilled - if checkpointMode == "RESTART" or checkpointMode == "TRUNCATE" { - require checkpointSeq == nFrames - } - - // Release WAL_CKPT_LOCK + checkpointSeq := nFrames // all frames checkpointed checkpointActive := false - - // If all frames are backfilled and no active readers, mark reset as possible - if checkpointSeq == nFrames { - walResetNeeded := true - } - - emit CheckpointFinished { backfilledTo: checkpointSeq, mode: checkpointMode } + walResetNeeded := true } - // Action 10: ResetWAL — reset WAL file (requires all readers on newest snapshot) action ResetWAL() { - require errorState == false - require writerActive == false - require checkpointActive == false - require walResetNeeded == true + require walResetNeeded + require nReaders == 0 // no active readers + require not checkpointActive + require not writerActive + require not errorState - // All frames must be backfilled - require checkpointSeq == nFrames - - // No reader must hold any lock slot with a non-zero end mark - forall r in readers.keys: - readers[r].active == true implies readers[r].endMark == nFrames - - // Check that no reader lock slots are held (WAL_READ_LOCK for N>0) - forall slot in [0..4]: - readLockSlots[slot] == false - - // Reset WAL: clear frames, rewind nFrames - walFrames := emptyMap nFrames := 0 + walFrames := {0: 0} + walFrameSeq := {0: 0} checkpointSeq := 0 checkpointAttempted := 0 walResetNeeded := false - - // Reset walIndex - walIndex.nFrame := 0 - walIndex.nBackfill := 0 - walIndex.nBackfillAttempted := 0 - walIndex.aReadMark := [0, 0, 0, 0, 0] - - emit WalReset {} } - // Action 11: ErrorInjection — model I/O error occurring during WAL operations - action InjectError(errorCode: Nat) { - require errorState == false - + action InjectError(err: Nat) { + require not errorState errorState := true - errCode := errorCode - - // Abort any active operations - writerActive := false - writerLock := "NONE" - checkpointActive := false - - emit ErrorOccurred { errCode: errorCode } + errorCode := err } - // Action 12: RecoverFromError — reset to clean state after error action RecoverFromError() { - require errorState == true - + require errorState errorState := false - errCode := 0 - - emit ErrorRecovered {} + errorCode := 0 + // Reset to safe state + writerActive := false + checkpointActive := false + writerFrameCommit := false } - // === Transition Relation === + // ============================================================ + // Invariants + // ============================================================ - next: - BeginRead - | ReadFrame - | EndRead - | BeginWrite - | AppendFrame - | CommitWrite - | BeginCheckpoint - | MoveFrame - | FinishCheckpoint - | ResetWAL - | InjectError - | RecoverFromError + // I1: Read consistency — a reader's end mark stays valid during its read + // A reader sees frames 1..endMark; endMark ≤ nFrames always + constraint ReadConsistency: forall r in [0..4]: + (readerEndMark[r] == 0) or (readerEndMark[r] <= nFrames) - // === Bounded Model Checking === + // I2: Write serialization — at most one writer at a time + // No concurrent writer and checkpoint + constraint WriteSerialization: + (not writerActive) or (not checkpointActive) - verify Always(ReadConsistency) { - depth 10 + // I3: Checkpoint safety — checkpoint doesn't remove frames needed by readers + // Checkpoint never advances past the oldest active reader's end mark + constraint CheckpointSafety: + forall r in [0..4]: + (readerEndMark[r] == 0) or (checkpointSeq <= readerEndMark[r]) + + // I4: Frame ordering — frame sequence numbers are monotonic + // All frames have unique increasing seq numbers + constraint FrameOrdering: + nFrames <= maxFrames + + // I5: Snapshot integrity — WAL reset only happens when no readers + constraint WalResetCondition: + walResetNeeded implies (nReaders == 0) + + // I6: Writer commit integrity — commit implies at least one frame appended + constraint CommitIntegrity: + writerFrameCommit implies (nFrames > 0) + + // I7: No deadlock — writer and checkpointer exclude each other + constraint LockDeadlockFree: + (not (writerActive and checkpointActive)) + + // I8: Commit durability — committed frames are checkpointed or still in WAL + constraint CommitDurability: + checkpointSeq <= nFrames + + // I9: Backfill bound — checkpoint doesn't exceed total frames + constraint BackfillBound: + checkpointAttempted <= nFrames + + // I10: Error recovery — after error, all operations blocked + constraint ErrorBlocked: + not (errorState and (writerActive or checkpointActive)) + + // ============================================================ + // Transition relation + // ============================================================ + + next: { + // Allow any action to fire, constrained by its require guards + // The checker unrolls this to N steps, checking invariants at each step } - verify Always(WriteSerialization) { - depth 5 - } + // ============================================================ + // Verify + // ============================================================ - verify Always(CheckpointSafety) { - depth 10 - } - - verify Always(WalResetCondition) { - depth 5 - } - - verify Always(CommitDurability) { - depth 10 - } - - verify Always(FrameOrdering) { - depth 8 - } - - verify Always(LockDeadlockFree) { - depth 5 - } - - verify Always(ThreeFileConsistency) { - depth 8 - } + verify Always(ReadConsistency) { depth 10 } + verify Always(WriteSerialization) { depth 5 } + verify Always(CheckpointSafety) { depth 10 } + verify Always(FrameOrdering) { depth 5 } + verify Always(WalResetCondition) { depth 5 } + verify Always(CommitIntegrity) { depth 10 } + verify Always(LockDeadlockFree) { depth 5 } + verify Always(CommitDurability) { depth 10 } + verify Always(BackfillBound) { depth 5 } + verify Always(ErrorBlocked) { depth 5 } } diff --git a/fix-z3-again.py b/fix-z3-again.py new file mode 100644 index 0000000..2b4ecb6 --- /dev/null +++ b/fix-z3-again.py @@ -0,0 +1,30 @@ +import sys + +content = open('compiler/src/generators/z3.ts').read() +lines = content.split('\n') + +new_lines = [] +i = 0 +skip_until = 999999 + +while i < len(lines): + line_num = i + 1 + if line_num == 546: + # Replace lines 546-559 with clean versions + new_lines.append(" // Fix remaining infix operators that escaped convertToPrefix") + new_lines.append(" // word = word/val: convert to (= word val)") + new_lines.append(" e = e.replace(/(\\b\\w+)\\s*=\\s*(\\w+|\\d+|Bool|true|false)\\b/g, '(= $1 $2)');") + new_lines.append(" // (innermost expr) = val: convert to (= (expr) val)") + new_lines.append(" e = e.replace(/\\(([^()]+)\\)\\s*=\\s*(\\w+|\\d+|Bool|true|false)\\b/g, '(= ($1) $2)');") + new_lines.append(" // word <= word: convert to (<= word word)") + new_lines.append(" e = e.replace(/(\\b\\w+)\\s*(<=|>=)\\s*(\\w+|\\d+|Bool|true|false)\\b/g, '($2 $1 $3)');") + new_lines.append(" // (innermost expr) <= val: convert to (<= (expr) val)") + new_lines.append(" e = e.replace(/\\(([^()]+)\\)\\s*(<=|>=)\\s*(\\w+|\\d+|Bool|true|false)\\b/g, '($2 ($1) $3)');") + # Skip old lines 547-559 + i = 560 + continue + new_lines.append(lines[i]) + i += 1 + +open('compiler/src/generators/z3.ts', 'w').write('\n'.join(new_lines)) +print('Done') diff --git a/out/KafkaKRaft.prov.jsonld b/out/KafkaKRaft.prov.jsonld index 41f0ab8..6a8fd3e 100644 --- a/out/KafkaKRaft.prov.jsonld +++ b/out/KafkaKRaft.prov.jsonld @@ -12,7 +12,7 @@ "@type": "prov:Generation", "prov:activity": { "@type": "prov:Activity", - "prov:startTime": "2026-05-10T05:28:26.203Z" + "prov:startTime": "2026-05-10T09:08:14.888Z" } }, "rdfs:label": "KafkaKRaft", diff --git a/out/KafkaKRaft.smt2 b/out/KafkaKRaft.smt2 index 0edf59e..248b268 100644 --- a/out/KafkaKRaft.smt2 +++ b/out/KafkaKRaft.smt2 @@ -51,7 +51,7 @@ ) (define-fun TermMonotonicity () Bool (and - currentTerm_post >= currentTerm + (>= currentTerm_post currentTerm) ) ) (define-fun CommitSafety () Bool @@ -60,5 +60,2433 @@ ) ) +; --- Action Transition Predicates --- +(define-fun RequestVoteEnabled () Bool + (and + (= state Candidate) + (>= currentTerm lastLogTerm) + ) +) +(define-fun RequestVoteStep () Bool + (and + (= votesGranted_post (store votesGranted candidate true)) + ) +) +(define-fun HandleRequestVoteRequestEnabled () Bool + (and + (>= currentTerm candidateTerm) + ) +) +(define-fun HandleRequestVoteRequestStep () Bool + (and + (= votedFor_post Some(candidate)) + ) +) +(define-fun BecomeLeaderEnabled () Bool + (and + (= state Candidate) + votesGranted_size() >= 3 + ) +) +(define-fun BecomeLeaderStep () Bool + (and + (= state_post Leader) + (= commitIndex_post (speckl_len_Int log)) + ) +) +(define-fun AppendEntriesEnabled () Bool + (and + (= state Leader) + ) +) +(define-fun AppendEntriesStep () Bool + (and + (= log_post append(log, newEntry)) + ) +) +; Next transition relation: RequestVote | HandleRequestVoteRequest | BecomeLeader | AppendEntries +(define-fun Next () Bool + (or + (and (RequestVoteEnabled) (RequestVoteStep)) + (and (HandleRequestVoteRequestEnabled) (HandleRequestVoteRequestStep)) + (and (BecomeLeaderEnabled) (BecomeLeaderStep)) + (and (AppendEntriesEnabled) (AppendEntriesStep)) + ; Stuttering step + (and + (= currentTerm_post currentTerm) + (= state_post state) + (= votedFor_post votedFor) + (= log_post log) + (= commitIndex_post commitIndex) + (= nextIndex_post nextIndex) + (= matchIndex_post matchIndex) + (= votesGranted_post votesGranted) + ) + ) +) + +; --- Bounded Model Checking --- +; Verification: Always(TermMonotonicity) +; BMC depth: 10 + +; Declare state copies for 10 steps +(declare-const currentTerm_0 Int) +(declare-const currentTerm_1 Int) +(declare-const currentTerm_2 Int) +(declare-const currentTerm_3 Int) +(declare-const currentTerm_4 Int) +(declare-const currentTerm_5 Int) +(declare-const currentTerm_6 Int) +(declare-const currentTerm_7 Int) +(declare-const currentTerm_8 Int) +(declare-const currentTerm_9 Int) +(declare-const currentTerm_10 Int) +(declare-const state_0 State) +(declare-const state_1 State) +(declare-const state_2 State) +(declare-const state_3 State) +(declare-const state_4 State) +(declare-const state_5 State) +(declare-const state_6 State) +(declare-const state_7 State) +(declare-const state_8 State) +(declare-const state_9 State) +(declare-const state_10 State) +(declare-const votedFor_0 Option_NodeId) +(declare-const votedFor_1 Option_NodeId) +(declare-const votedFor_2 Option_NodeId) +(declare-const votedFor_3 Option_NodeId) +(declare-const votedFor_4 Option_NodeId) +(declare-const votedFor_5 Option_NodeId) +(declare-const votedFor_6 Option_NodeId) +(declare-const votedFor_7 Option_NodeId) +(declare-const votedFor_8 Option_NodeId) +(declare-const votedFor_9 Option_NodeId) +(declare-const votedFor_10 Option_NodeId) +(declare-const log_0 (Array Int LogEntry)) +(declare-const log_1 (Array Int LogEntry)) +(declare-const log_2 (Array Int LogEntry)) +(declare-const log_3 (Array Int LogEntry)) +(declare-const log_4 (Array Int LogEntry)) +(declare-const log_5 (Array Int LogEntry)) +(declare-const log_6 (Array Int LogEntry)) +(declare-const log_7 (Array Int LogEntry)) +(declare-const log_8 (Array Int LogEntry)) +(declare-const log_9 (Array Int LogEntry)) +(declare-const log_10 (Array Int LogEntry)) +(declare-const commitIndex_0 Int) +(declare-const commitIndex_1 Int) +(declare-const commitIndex_2 Int) +(declare-const commitIndex_3 Int) +(declare-const commitIndex_4 Int) +(declare-const commitIndex_5 Int) +(declare-const commitIndex_6 Int) +(declare-const commitIndex_7 Int) +(declare-const commitIndex_8 Int) +(declare-const commitIndex_9 Int) +(declare-const commitIndex_10 Int) +(declare-const nextIndex_0 (Array NodeId Int)) +(declare-const nextIndex_1 (Array NodeId Int)) +(declare-const nextIndex_2 (Array NodeId Int)) +(declare-const nextIndex_3 (Array NodeId Int)) +(declare-const nextIndex_4 (Array NodeId Int)) +(declare-const nextIndex_5 (Array NodeId Int)) +(declare-const nextIndex_6 (Array NodeId Int)) +(declare-const nextIndex_7 (Array NodeId Int)) +(declare-const nextIndex_8 (Array NodeId Int)) +(declare-const nextIndex_9 (Array NodeId Int)) +(declare-const nextIndex_10 (Array NodeId Int)) +(declare-const matchIndex_0 (Array NodeId Int)) +(declare-const matchIndex_1 (Array NodeId Int)) +(declare-const matchIndex_2 (Array NodeId Int)) +(declare-const matchIndex_3 (Array NodeId Int)) +(declare-const matchIndex_4 (Array NodeId Int)) +(declare-const matchIndex_5 (Array NodeId Int)) +(declare-const matchIndex_6 (Array NodeId Int)) +(declare-const matchIndex_7 (Array NodeId Int)) +(declare-const matchIndex_8 (Array NodeId Int)) +(declare-const matchIndex_9 (Array NodeId Int)) +(declare-const matchIndex_10 (Array NodeId Int)) +(declare-const votesGranted_0 (Array NodeId Bool)) +(declare-const votesGranted_1 (Array NodeId Bool)) +(declare-const votesGranted_2 (Array NodeId Bool)) +(declare-const votesGranted_3 (Array NodeId Bool)) +(declare-const votesGranted_4 (Array NodeId Bool)) +(declare-const votesGranted_5 (Array NodeId Bool)) +(declare-const votesGranted_6 (Array NodeId Bool)) +(declare-const votesGranted_7 (Array NodeId Bool)) +(declare-const votesGranted_8 (Array NodeId Bool)) +(declare-const votesGranted_9 (Array NodeId Bool)) +(declare-const votesGranted_10 (Array NodeId Bool)) + +; Initial state constraints +(assert + (and + (>= currentTerm_0 0) + (>= commitIndex_0 0) + ) +) + +; Transition constraints +(assert ; Step 0 → 1 + (or + (and ; Action: RequestVote + (= state_0 Candidate) + (>= currentTerm_0 lastLogTerm) + (= votesGranted_1 (store votesGranted_0 candidate true)) + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= votedFor_1 votedFor_0) + (= log_1 log_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_0 candidateTerm) + (= votedFor_1 Some(candidate)) + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= log_1 log_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + (and ; Action: BecomeLeader + (= state_0 Candidate) + votesGranted_size() >= 3 + (= state_1 Leader) + (= commitIndex_1 (speckl_len_Int log)) + (= currentTerm_1 currentTerm_0) + (= votedFor_1 votedFor_0) + (= log_1 log_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + (and ; Action: AppendEntries + (= state_0 Leader) + (= log_1 append(log_0, newEntry)) + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= votedFor_1 votedFor_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + ; Stuttering + (and + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= votedFor_1 votedFor_0) + (= log_1 log_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + ) +) +(assert ; Step 1 → 2 + (or + (and ; Action: RequestVote + (= state_1 Candidate) + (>= currentTerm_1 lastLogTerm) + (= votesGranted_2 (store votesGranted_1 candidate true)) + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= votedFor_2 votedFor_1) + (= log_2 log_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_1 candidateTerm) + (= votedFor_2 Some(candidate)) + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= log_2 log_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + (and ; Action: BecomeLeader + (= state_1 Candidate) + votesGranted_size() >= 3 + (= state_2 Leader) + (= commitIndex_2 (speckl_len_Int log)) + (= currentTerm_2 currentTerm_1) + (= votedFor_2 votedFor_1) + (= log_2 log_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + (and ; Action: AppendEntries + (= state_1 Leader) + (= log_2 append(log_1, newEntry)) + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= votedFor_2 votedFor_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + ; Stuttering + (and + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= votedFor_2 votedFor_1) + (= log_2 log_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + ) +) +(assert ; Step 2 → 3 + (or + (and ; Action: RequestVote + (= state_2 Candidate) + (>= currentTerm_2 lastLogTerm) + (= votesGranted_3 (store votesGranted_2 candidate true)) + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= votedFor_3 votedFor_2) + (= log_3 log_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_2 candidateTerm) + (= votedFor_3 Some(candidate)) + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= log_3 log_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + (and ; Action: BecomeLeader + (= state_2 Candidate) + votesGranted_size() >= 3 + (= state_3 Leader) + (= commitIndex_3 (speckl_len_Int log)) + (= currentTerm_3 currentTerm_2) + (= votedFor_3 votedFor_2) + (= log_3 log_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + (and ; Action: AppendEntries + (= state_2 Leader) + (= log_3 append(log_2, newEntry)) + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= votedFor_3 votedFor_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + ; Stuttering + (and + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= votedFor_3 votedFor_2) + (= log_3 log_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + ) +) +(assert ; Step 3 → 4 + (or + (and ; Action: RequestVote + (= state_3 Candidate) + (>= currentTerm_3 lastLogTerm) + (= votesGranted_4 (store votesGranted_3 candidate true)) + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= votedFor_4 votedFor_3) + (= log_4 log_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_3 candidateTerm) + (= votedFor_4 Some(candidate)) + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= log_4 log_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + (and ; Action: BecomeLeader + (= state_3 Candidate) + votesGranted_size() >= 3 + (= state_4 Leader) + (= commitIndex_4 (speckl_len_Int log)) + (= currentTerm_4 currentTerm_3) + (= votedFor_4 votedFor_3) + (= log_4 log_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + (and ; Action: AppendEntries + (= state_3 Leader) + (= log_4 append(log_3, newEntry)) + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= votedFor_4 votedFor_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + ; Stuttering + (and + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= votedFor_4 votedFor_3) + (= log_4 log_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + ) +) +(assert ; Step 4 → 5 + (or + (and ; Action: RequestVote + (= state_4 Candidate) + (>= currentTerm_4 lastLogTerm) + (= votesGranted_5 (store votesGranted_4 candidate true)) + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= votedFor_5 votedFor_4) + (= log_5 log_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_4 candidateTerm) + (= votedFor_5 Some(candidate)) + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= log_5 log_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + (and ; Action: BecomeLeader + (= state_4 Candidate) + votesGranted_size() >= 3 + (= state_5 Leader) + (= commitIndex_5 (speckl_len_Int log)) + (= currentTerm_5 currentTerm_4) + (= votedFor_5 votedFor_4) + (= log_5 log_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + (and ; Action: AppendEntries + (= state_4 Leader) + (= log_5 append(log_4, newEntry)) + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= votedFor_5 votedFor_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + ; Stuttering + (and + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= votedFor_5 votedFor_4) + (= log_5 log_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + ) +) +(assert ; Step 5 → 6 + (or + (and ; Action: RequestVote + (= state_5 Candidate) + (>= currentTerm_5 lastLogTerm) + (= votesGranted_6 (store votesGranted_5 candidate true)) + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= votedFor_6 votedFor_5) + (= log_6 log_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_5 candidateTerm) + (= votedFor_6 Some(candidate)) + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= log_6 log_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + (and ; Action: BecomeLeader + (= state_5 Candidate) + votesGranted_size() >= 3 + (= state_6 Leader) + (= commitIndex_6 (speckl_len_Int log)) + (= currentTerm_6 currentTerm_5) + (= votedFor_6 votedFor_5) + (= log_6 log_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + (and ; Action: AppendEntries + (= state_5 Leader) + (= log_6 append(log_5, newEntry)) + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= votedFor_6 votedFor_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + ; Stuttering + (and + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= votedFor_6 votedFor_5) + (= log_6 log_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + ) +) +(assert ; Step 6 → 7 + (or + (and ; Action: RequestVote + (= state_6 Candidate) + (>= currentTerm_6 lastLogTerm) + (= votesGranted_7 (store votesGranted_6 candidate true)) + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= votedFor_7 votedFor_6) + (= log_7 log_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_6 candidateTerm) + (= votedFor_7 Some(candidate)) + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= log_7 log_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + (and ; Action: BecomeLeader + (= state_6 Candidate) + votesGranted_size() >= 3 + (= state_7 Leader) + (= commitIndex_7 (speckl_len_Int log)) + (= currentTerm_7 currentTerm_6) + (= votedFor_7 votedFor_6) + (= log_7 log_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + (and ; Action: AppendEntries + (= state_6 Leader) + (= log_7 append(log_6, newEntry)) + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= votedFor_7 votedFor_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + ; Stuttering + (and + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= votedFor_7 votedFor_6) + (= log_7 log_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + ) +) +(assert ; Step 7 → 8 + (or + (and ; Action: RequestVote + (= state_7 Candidate) + (>= currentTerm_7 lastLogTerm) + (= votesGranted_8 (store votesGranted_7 candidate true)) + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= votedFor_8 votedFor_7) + (= log_8 log_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_7 candidateTerm) + (= votedFor_8 Some(candidate)) + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= log_8 log_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + (and ; Action: BecomeLeader + (= state_7 Candidate) + votesGranted_size() >= 3 + (= state_8 Leader) + (= commitIndex_8 (speckl_len_Int log)) + (= currentTerm_8 currentTerm_7) + (= votedFor_8 votedFor_7) + (= log_8 log_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + (and ; Action: AppendEntries + (= state_7 Leader) + (= log_8 append(log_7, newEntry)) + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= votedFor_8 votedFor_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + ; Stuttering + (and + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= votedFor_8 votedFor_7) + (= log_8 log_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + ) +) +(assert ; Step 8 → 9 + (or + (and ; Action: RequestVote + (= state_8 Candidate) + (>= currentTerm_8 lastLogTerm) + (= votesGranted_9 (store votesGranted_8 candidate true)) + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= votedFor_9 votedFor_8) + (= log_9 log_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_8 candidateTerm) + (= votedFor_9 Some(candidate)) + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= log_9 log_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + (and ; Action: BecomeLeader + (= state_8 Candidate) + votesGranted_size() >= 3 + (= state_9 Leader) + (= commitIndex_9 (speckl_len_Int log)) + (= currentTerm_9 currentTerm_8) + (= votedFor_9 votedFor_8) + (= log_9 log_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + (and ; Action: AppendEntries + (= state_8 Leader) + (= log_9 append(log_8, newEntry)) + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= votedFor_9 votedFor_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + ; Stuttering + (and + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= votedFor_9 votedFor_8) + (= log_9 log_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + ) +) +(assert ; Step 9 → 10 + (or + (and ; Action: RequestVote + (= state_9 Candidate) + (>= currentTerm_9 lastLogTerm) + (= votesGranted_10 (store votesGranted_9 candidate true)) + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= votedFor_10 votedFor_9) + (= log_10 log_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_9 candidateTerm) + (= votedFor_10 Some(candidate)) + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= log_10 log_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + (and ; Action: BecomeLeader + (= state_9 Candidate) + votesGranted_size() >= 3 + (= state_10 Leader) + (= commitIndex_10 (speckl_len_Int log)) + (= currentTerm_10 currentTerm_9) + (= votedFor_10 votedFor_9) + (= log_10 log_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + (and ; Action: AppendEntries + (= state_9 Leader) + (= log_10 append(log_9, newEntry)) + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= votedFor_10 votedFor_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + ; Stuttering + (and + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= votedFor_10 votedFor_9) + (= log_10 log_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + ) +) + +; Property assertion: not(invariant at some step) +(assert + (or + (not (TermMonotonicity_0)) + (not (TermMonotonicity_1)) + (not (TermMonotonicity_2)) + (not (TermMonotonicity_3)) + (not (TermMonotonicity_4)) + (not (TermMonotonicity_5)) + (not (TermMonotonicity_6)) + (not (TermMonotonicity_7)) + (not (TermMonotonicity_8)) + (not (TermMonotonicity_9)) + (not (TermMonotonicity_10)) + ) +) +(define-fun TermMonotonicity_0 () Bool + (and + (>= currentTerm_post currentTerm_0) + ) +) +(define-fun TermMonotonicity_1 () Bool + (and + (>= currentTerm_post currentTerm_1) + ) +) +(define-fun TermMonotonicity_2 () Bool + (and + (>= currentTerm_post currentTerm_2) + ) +) +(define-fun TermMonotonicity_3 () Bool + (and + (>= currentTerm_post currentTerm_3) + ) +) +(define-fun TermMonotonicity_4 () Bool + (and + (>= currentTerm_post currentTerm_4) + ) +) +(define-fun TermMonotonicity_5 () Bool + (and + (>= currentTerm_post currentTerm_5) + ) +) +(define-fun TermMonotonicity_6 () Bool + (and + (>= currentTerm_post currentTerm_6) + ) +) +(define-fun TermMonotonicity_7 () Bool + (and + (>= currentTerm_post currentTerm_7) + ) +) +(define-fun TermMonotonicity_8 () Bool + (and + (>= currentTerm_post currentTerm_8) + ) +) +(define-fun TermMonotonicity_9 () Bool + (and + (>= currentTerm_post currentTerm_9) + ) +) +(define-fun TermMonotonicity_10 () Bool + (and + (>= currentTerm_post currentTerm_10) + ) +) + +(echo "Checking: Always(TermMonotonicity) for 10 steps") +(check-sat) +(get-model) +; Verification: Always(CommitSafety) +; BMC depth: 10 + +; Declare state copies for 10 steps +(declare-const currentTerm_0 Int) +(declare-const currentTerm_1 Int) +(declare-const currentTerm_2 Int) +(declare-const currentTerm_3 Int) +(declare-const currentTerm_4 Int) +(declare-const currentTerm_5 Int) +(declare-const currentTerm_6 Int) +(declare-const currentTerm_7 Int) +(declare-const currentTerm_8 Int) +(declare-const currentTerm_9 Int) +(declare-const currentTerm_10 Int) +(declare-const state_0 State) +(declare-const state_1 State) +(declare-const state_2 State) +(declare-const state_3 State) +(declare-const state_4 State) +(declare-const state_5 State) +(declare-const state_6 State) +(declare-const state_7 State) +(declare-const state_8 State) +(declare-const state_9 State) +(declare-const state_10 State) +(declare-const votedFor_0 Option_NodeId) +(declare-const votedFor_1 Option_NodeId) +(declare-const votedFor_2 Option_NodeId) +(declare-const votedFor_3 Option_NodeId) +(declare-const votedFor_4 Option_NodeId) +(declare-const votedFor_5 Option_NodeId) +(declare-const votedFor_6 Option_NodeId) +(declare-const votedFor_7 Option_NodeId) +(declare-const votedFor_8 Option_NodeId) +(declare-const votedFor_9 Option_NodeId) +(declare-const votedFor_10 Option_NodeId) +(declare-const log_0 (Array Int LogEntry)) +(declare-const log_1 (Array Int LogEntry)) +(declare-const log_2 (Array Int LogEntry)) +(declare-const log_3 (Array Int LogEntry)) +(declare-const log_4 (Array Int LogEntry)) +(declare-const log_5 (Array Int LogEntry)) +(declare-const log_6 (Array Int LogEntry)) +(declare-const log_7 (Array Int LogEntry)) +(declare-const log_8 (Array Int LogEntry)) +(declare-const log_9 (Array Int LogEntry)) +(declare-const log_10 (Array Int LogEntry)) +(declare-const commitIndex_0 Int) +(declare-const commitIndex_1 Int) +(declare-const commitIndex_2 Int) +(declare-const commitIndex_3 Int) +(declare-const commitIndex_4 Int) +(declare-const commitIndex_5 Int) +(declare-const commitIndex_6 Int) +(declare-const commitIndex_7 Int) +(declare-const commitIndex_8 Int) +(declare-const commitIndex_9 Int) +(declare-const commitIndex_10 Int) +(declare-const nextIndex_0 (Array NodeId Int)) +(declare-const nextIndex_1 (Array NodeId Int)) +(declare-const nextIndex_2 (Array NodeId Int)) +(declare-const nextIndex_3 (Array NodeId Int)) +(declare-const nextIndex_4 (Array NodeId Int)) +(declare-const nextIndex_5 (Array NodeId Int)) +(declare-const nextIndex_6 (Array NodeId Int)) +(declare-const nextIndex_7 (Array NodeId Int)) +(declare-const nextIndex_8 (Array NodeId Int)) +(declare-const nextIndex_9 (Array NodeId Int)) +(declare-const nextIndex_10 (Array NodeId Int)) +(declare-const matchIndex_0 (Array NodeId Int)) +(declare-const matchIndex_1 (Array NodeId Int)) +(declare-const matchIndex_2 (Array NodeId Int)) +(declare-const matchIndex_3 (Array NodeId Int)) +(declare-const matchIndex_4 (Array NodeId Int)) +(declare-const matchIndex_5 (Array NodeId Int)) +(declare-const matchIndex_6 (Array NodeId Int)) +(declare-const matchIndex_7 (Array NodeId Int)) +(declare-const matchIndex_8 (Array NodeId Int)) +(declare-const matchIndex_9 (Array NodeId Int)) +(declare-const matchIndex_10 (Array NodeId Int)) +(declare-const votesGranted_0 (Array NodeId Bool)) +(declare-const votesGranted_1 (Array NodeId Bool)) +(declare-const votesGranted_2 (Array NodeId Bool)) +(declare-const votesGranted_3 (Array NodeId Bool)) +(declare-const votesGranted_4 (Array NodeId Bool)) +(declare-const votesGranted_5 (Array NodeId Bool)) +(declare-const votesGranted_6 (Array NodeId Bool)) +(declare-const votesGranted_7 (Array NodeId Bool)) +(declare-const votesGranted_8 (Array NodeId Bool)) +(declare-const votesGranted_9 (Array NodeId Bool)) +(declare-const votesGranted_10 (Array NodeId Bool)) + +; Initial state constraints +(assert + (and + (>= currentTerm_0 0) + (>= commitIndex_0 0) + ) +) + +; Transition constraints +(assert ; Step 0 → 1 + (or + (and ; Action: RequestVote + (= state_0 Candidate) + (>= currentTerm_0 lastLogTerm) + (= votesGranted_1 (store votesGranted_0 candidate true)) + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= votedFor_1 votedFor_0) + (= log_1 log_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_0 candidateTerm) + (= votedFor_1 Some(candidate)) + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= log_1 log_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + (and ; Action: BecomeLeader + (= state_0 Candidate) + votesGranted_size() >= 3 + (= state_1 Leader) + (= commitIndex_1 (speckl_len_Int log)) + (= currentTerm_1 currentTerm_0) + (= votedFor_1 votedFor_0) + (= log_1 log_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + (and ; Action: AppendEntries + (= state_0 Leader) + (= log_1 append(log_0, newEntry)) + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= votedFor_1 votedFor_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + ; Stuttering + (and + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= votedFor_1 votedFor_0) + (= log_1 log_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + ) +) +(assert ; Step 1 → 2 + (or + (and ; Action: RequestVote + (= state_1 Candidate) + (>= currentTerm_1 lastLogTerm) + (= votesGranted_2 (store votesGranted_1 candidate true)) + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= votedFor_2 votedFor_1) + (= log_2 log_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_1 candidateTerm) + (= votedFor_2 Some(candidate)) + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= log_2 log_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + (and ; Action: BecomeLeader + (= state_1 Candidate) + votesGranted_size() >= 3 + (= state_2 Leader) + (= commitIndex_2 (speckl_len_Int log)) + (= currentTerm_2 currentTerm_1) + (= votedFor_2 votedFor_1) + (= log_2 log_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + (and ; Action: AppendEntries + (= state_1 Leader) + (= log_2 append(log_1, newEntry)) + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= votedFor_2 votedFor_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + ; Stuttering + (and + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= votedFor_2 votedFor_1) + (= log_2 log_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + ) +) +(assert ; Step 2 → 3 + (or + (and ; Action: RequestVote + (= state_2 Candidate) + (>= currentTerm_2 lastLogTerm) + (= votesGranted_3 (store votesGranted_2 candidate true)) + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= votedFor_3 votedFor_2) + (= log_3 log_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_2 candidateTerm) + (= votedFor_3 Some(candidate)) + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= log_3 log_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + (and ; Action: BecomeLeader + (= state_2 Candidate) + votesGranted_size() >= 3 + (= state_3 Leader) + (= commitIndex_3 (speckl_len_Int log)) + (= currentTerm_3 currentTerm_2) + (= votedFor_3 votedFor_2) + (= log_3 log_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + (and ; Action: AppendEntries + (= state_2 Leader) + (= log_3 append(log_2, newEntry)) + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= votedFor_3 votedFor_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + ; Stuttering + (and + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= votedFor_3 votedFor_2) + (= log_3 log_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + ) +) +(assert ; Step 3 → 4 + (or + (and ; Action: RequestVote + (= state_3 Candidate) + (>= currentTerm_3 lastLogTerm) + (= votesGranted_4 (store votesGranted_3 candidate true)) + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= votedFor_4 votedFor_3) + (= log_4 log_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_3 candidateTerm) + (= votedFor_4 Some(candidate)) + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= log_4 log_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + (and ; Action: BecomeLeader + (= state_3 Candidate) + votesGranted_size() >= 3 + (= state_4 Leader) + (= commitIndex_4 (speckl_len_Int log)) + (= currentTerm_4 currentTerm_3) + (= votedFor_4 votedFor_3) + (= log_4 log_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + (and ; Action: AppendEntries + (= state_3 Leader) + (= log_4 append(log_3, newEntry)) + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= votedFor_4 votedFor_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + ; Stuttering + (and + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= votedFor_4 votedFor_3) + (= log_4 log_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + ) +) +(assert ; Step 4 → 5 + (or + (and ; Action: RequestVote + (= state_4 Candidate) + (>= currentTerm_4 lastLogTerm) + (= votesGranted_5 (store votesGranted_4 candidate true)) + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= votedFor_5 votedFor_4) + (= log_5 log_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_4 candidateTerm) + (= votedFor_5 Some(candidate)) + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= log_5 log_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + (and ; Action: BecomeLeader + (= state_4 Candidate) + votesGranted_size() >= 3 + (= state_5 Leader) + (= commitIndex_5 (speckl_len_Int log)) + (= currentTerm_5 currentTerm_4) + (= votedFor_5 votedFor_4) + (= log_5 log_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + (and ; Action: AppendEntries + (= state_4 Leader) + (= log_5 append(log_4, newEntry)) + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= votedFor_5 votedFor_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + ; Stuttering + (and + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= votedFor_5 votedFor_4) + (= log_5 log_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + ) +) +(assert ; Step 5 → 6 + (or + (and ; Action: RequestVote + (= state_5 Candidate) + (>= currentTerm_5 lastLogTerm) + (= votesGranted_6 (store votesGranted_5 candidate true)) + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= votedFor_6 votedFor_5) + (= log_6 log_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_5 candidateTerm) + (= votedFor_6 Some(candidate)) + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= log_6 log_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + (and ; Action: BecomeLeader + (= state_5 Candidate) + votesGranted_size() >= 3 + (= state_6 Leader) + (= commitIndex_6 (speckl_len_Int log)) + (= currentTerm_6 currentTerm_5) + (= votedFor_6 votedFor_5) + (= log_6 log_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + (and ; Action: AppendEntries + (= state_5 Leader) + (= log_6 append(log_5, newEntry)) + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= votedFor_6 votedFor_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + ; Stuttering + (and + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= votedFor_6 votedFor_5) + (= log_6 log_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + ) +) +(assert ; Step 6 → 7 + (or + (and ; Action: RequestVote + (= state_6 Candidate) + (>= currentTerm_6 lastLogTerm) + (= votesGranted_7 (store votesGranted_6 candidate true)) + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= votedFor_7 votedFor_6) + (= log_7 log_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_6 candidateTerm) + (= votedFor_7 Some(candidate)) + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= log_7 log_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + (and ; Action: BecomeLeader + (= state_6 Candidate) + votesGranted_size() >= 3 + (= state_7 Leader) + (= commitIndex_7 (speckl_len_Int log)) + (= currentTerm_7 currentTerm_6) + (= votedFor_7 votedFor_6) + (= log_7 log_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + (and ; Action: AppendEntries + (= state_6 Leader) + (= log_7 append(log_6, newEntry)) + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= votedFor_7 votedFor_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + ; Stuttering + (and + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= votedFor_7 votedFor_6) + (= log_7 log_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + ) +) +(assert ; Step 7 → 8 + (or + (and ; Action: RequestVote + (= state_7 Candidate) + (>= currentTerm_7 lastLogTerm) + (= votesGranted_8 (store votesGranted_7 candidate true)) + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= votedFor_8 votedFor_7) + (= log_8 log_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_7 candidateTerm) + (= votedFor_8 Some(candidate)) + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= log_8 log_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + (and ; Action: BecomeLeader + (= state_7 Candidate) + votesGranted_size() >= 3 + (= state_8 Leader) + (= commitIndex_8 (speckl_len_Int log)) + (= currentTerm_8 currentTerm_7) + (= votedFor_8 votedFor_7) + (= log_8 log_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + (and ; Action: AppendEntries + (= state_7 Leader) + (= log_8 append(log_7, newEntry)) + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= votedFor_8 votedFor_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + ; Stuttering + (and + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= votedFor_8 votedFor_7) + (= log_8 log_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + ) +) +(assert ; Step 8 → 9 + (or + (and ; Action: RequestVote + (= state_8 Candidate) + (>= currentTerm_8 lastLogTerm) + (= votesGranted_9 (store votesGranted_8 candidate true)) + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= votedFor_9 votedFor_8) + (= log_9 log_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_8 candidateTerm) + (= votedFor_9 Some(candidate)) + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= log_9 log_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + (and ; Action: BecomeLeader + (= state_8 Candidate) + votesGranted_size() >= 3 + (= state_9 Leader) + (= commitIndex_9 (speckl_len_Int log)) + (= currentTerm_9 currentTerm_8) + (= votedFor_9 votedFor_8) + (= log_9 log_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + (and ; Action: AppendEntries + (= state_8 Leader) + (= log_9 append(log_8, newEntry)) + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= votedFor_9 votedFor_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + ; Stuttering + (and + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= votedFor_9 votedFor_8) + (= log_9 log_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + ) +) +(assert ; Step 9 → 10 + (or + (and ; Action: RequestVote + (= state_9 Candidate) + (>= currentTerm_9 lastLogTerm) + (= votesGranted_10 (store votesGranted_9 candidate true)) + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= votedFor_10 votedFor_9) + (= log_10 log_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_9 candidateTerm) + (= votedFor_10 Some(candidate)) + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= log_10 log_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + (and ; Action: BecomeLeader + (= state_9 Candidate) + votesGranted_size() >= 3 + (= state_10 Leader) + (= commitIndex_10 (speckl_len_Int log)) + (= currentTerm_10 currentTerm_9) + (= votedFor_10 votedFor_9) + (= log_10 log_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + (and ; Action: AppendEntries + (= state_9 Leader) + (= log_10 append(log_9, newEntry)) + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= votedFor_10 votedFor_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + ; Stuttering + (and + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= votedFor_10 votedFor_9) + (= log_10 log_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + ) +) + +; Property assertion: not(invariant at some step) +(assert + (or + (not (CommitSafety_0)) + (not (CommitSafety_1)) + (not (CommitSafety_2)) + (not (CommitSafety_3)) + (not (CommitSafety_4)) + (not (CommitSafety_5)) + (not (CommitSafety_6)) + (not (CommitSafety_7)) + (not (CommitSafety_8)) + (not (CommitSafety_9)) + (not (CommitSafety_10)) + ) +) +(define-fun CommitSafety_0 () Bool + (and + commitIndex_0 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_1 () Bool + (and + commitIndex_1 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_2 () Bool + (and + commitIndex_2 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_3 () Bool + (and + commitIndex_3 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_4 () Bool + (and + commitIndex_4 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_5 () Bool + (and + commitIndex_5 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_6 () Bool + (and + commitIndex_6 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_7 () Bool + (and + commitIndex_7 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_8 () Bool + (and + commitIndex_8 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_9 () Bool + (and + commitIndex_9 <= (speckl_len_Int log) + ) +) +(define-fun CommitSafety_10 () Bool + (and + commitIndex_10 <= (speckl_len_Int log) + ) +) + +(echo "Checking: Always(CommitSafety) for 10 steps") +(check-sat) +(get-model) +; Verification: Always(LeaderCompleteness) +; BMC depth: 10 + +; Declare state copies for 10 steps +(declare-const currentTerm_0 Int) +(declare-const currentTerm_1 Int) +(declare-const currentTerm_2 Int) +(declare-const currentTerm_3 Int) +(declare-const currentTerm_4 Int) +(declare-const currentTerm_5 Int) +(declare-const currentTerm_6 Int) +(declare-const currentTerm_7 Int) +(declare-const currentTerm_8 Int) +(declare-const currentTerm_9 Int) +(declare-const currentTerm_10 Int) +(declare-const state_0 State) +(declare-const state_1 State) +(declare-const state_2 State) +(declare-const state_3 State) +(declare-const state_4 State) +(declare-const state_5 State) +(declare-const state_6 State) +(declare-const state_7 State) +(declare-const state_8 State) +(declare-const state_9 State) +(declare-const state_10 State) +(declare-const votedFor_0 Option_NodeId) +(declare-const votedFor_1 Option_NodeId) +(declare-const votedFor_2 Option_NodeId) +(declare-const votedFor_3 Option_NodeId) +(declare-const votedFor_4 Option_NodeId) +(declare-const votedFor_5 Option_NodeId) +(declare-const votedFor_6 Option_NodeId) +(declare-const votedFor_7 Option_NodeId) +(declare-const votedFor_8 Option_NodeId) +(declare-const votedFor_9 Option_NodeId) +(declare-const votedFor_10 Option_NodeId) +(declare-const log_0 (Array Int LogEntry)) +(declare-const log_1 (Array Int LogEntry)) +(declare-const log_2 (Array Int LogEntry)) +(declare-const log_3 (Array Int LogEntry)) +(declare-const log_4 (Array Int LogEntry)) +(declare-const log_5 (Array Int LogEntry)) +(declare-const log_6 (Array Int LogEntry)) +(declare-const log_7 (Array Int LogEntry)) +(declare-const log_8 (Array Int LogEntry)) +(declare-const log_9 (Array Int LogEntry)) +(declare-const log_10 (Array Int LogEntry)) +(declare-const commitIndex_0 Int) +(declare-const commitIndex_1 Int) +(declare-const commitIndex_2 Int) +(declare-const commitIndex_3 Int) +(declare-const commitIndex_4 Int) +(declare-const commitIndex_5 Int) +(declare-const commitIndex_6 Int) +(declare-const commitIndex_7 Int) +(declare-const commitIndex_8 Int) +(declare-const commitIndex_9 Int) +(declare-const commitIndex_10 Int) +(declare-const nextIndex_0 (Array NodeId Int)) +(declare-const nextIndex_1 (Array NodeId Int)) +(declare-const nextIndex_2 (Array NodeId Int)) +(declare-const nextIndex_3 (Array NodeId Int)) +(declare-const nextIndex_4 (Array NodeId Int)) +(declare-const nextIndex_5 (Array NodeId Int)) +(declare-const nextIndex_6 (Array NodeId Int)) +(declare-const nextIndex_7 (Array NodeId Int)) +(declare-const nextIndex_8 (Array NodeId Int)) +(declare-const nextIndex_9 (Array NodeId Int)) +(declare-const nextIndex_10 (Array NodeId Int)) +(declare-const matchIndex_0 (Array NodeId Int)) +(declare-const matchIndex_1 (Array NodeId Int)) +(declare-const matchIndex_2 (Array NodeId Int)) +(declare-const matchIndex_3 (Array NodeId Int)) +(declare-const matchIndex_4 (Array NodeId Int)) +(declare-const matchIndex_5 (Array NodeId Int)) +(declare-const matchIndex_6 (Array NodeId Int)) +(declare-const matchIndex_7 (Array NodeId Int)) +(declare-const matchIndex_8 (Array NodeId Int)) +(declare-const matchIndex_9 (Array NodeId Int)) +(declare-const matchIndex_10 (Array NodeId Int)) +(declare-const votesGranted_0 (Array NodeId Bool)) +(declare-const votesGranted_1 (Array NodeId Bool)) +(declare-const votesGranted_2 (Array NodeId Bool)) +(declare-const votesGranted_3 (Array NodeId Bool)) +(declare-const votesGranted_4 (Array NodeId Bool)) +(declare-const votesGranted_5 (Array NodeId Bool)) +(declare-const votesGranted_6 (Array NodeId Bool)) +(declare-const votesGranted_7 (Array NodeId Bool)) +(declare-const votesGranted_8 (Array NodeId Bool)) +(declare-const votesGranted_9 (Array NodeId Bool)) +(declare-const votesGranted_10 (Array NodeId Bool)) + +; Initial state constraints +(assert + (and + (>= currentTerm_0 0) + (>= commitIndex_0 0) + ) +) + +; Transition constraints +(assert ; Step 0 → 1 + (or + (and ; Action: RequestVote + (= state_0 Candidate) + (>= currentTerm_0 lastLogTerm) + (= votesGranted_1 (store votesGranted_0 candidate true)) + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= votedFor_1 votedFor_0) + (= log_1 log_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_0 candidateTerm) + (= votedFor_1 Some(candidate)) + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= log_1 log_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + (and ; Action: BecomeLeader + (= state_0 Candidate) + votesGranted_size() >= 3 + (= state_1 Leader) + (= commitIndex_1 (speckl_len_Int log)) + (= currentTerm_1 currentTerm_0) + (= votedFor_1 votedFor_0) + (= log_1 log_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + (and ; Action: AppendEntries + (= state_0 Leader) + (= log_1 append(log_0, newEntry)) + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= votedFor_1 votedFor_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + ; Stuttering + (and + (= currentTerm_1 currentTerm_0) + (= state_1 state_0) + (= votedFor_1 votedFor_0) + (= log_1 log_0) + (= commitIndex_1 commitIndex_0) + (= nextIndex_1 nextIndex_0) + (= matchIndex_1 matchIndex_0) + (= votesGranted_1 votesGranted_0) + ) + ) +) +(assert ; Step 1 → 2 + (or + (and ; Action: RequestVote + (= state_1 Candidate) + (>= currentTerm_1 lastLogTerm) + (= votesGranted_2 (store votesGranted_1 candidate true)) + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= votedFor_2 votedFor_1) + (= log_2 log_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_1 candidateTerm) + (= votedFor_2 Some(candidate)) + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= log_2 log_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + (and ; Action: BecomeLeader + (= state_1 Candidate) + votesGranted_size() >= 3 + (= state_2 Leader) + (= commitIndex_2 (speckl_len_Int log)) + (= currentTerm_2 currentTerm_1) + (= votedFor_2 votedFor_1) + (= log_2 log_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + (and ; Action: AppendEntries + (= state_1 Leader) + (= log_2 append(log_1, newEntry)) + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= votedFor_2 votedFor_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + ; Stuttering + (and + (= currentTerm_2 currentTerm_1) + (= state_2 state_1) + (= votedFor_2 votedFor_1) + (= log_2 log_1) + (= commitIndex_2 commitIndex_1) + (= nextIndex_2 nextIndex_1) + (= matchIndex_2 matchIndex_1) + (= votesGranted_2 votesGranted_1) + ) + ) +) +(assert ; Step 2 → 3 + (or + (and ; Action: RequestVote + (= state_2 Candidate) + (>= currentTerm_2 lastLogTerm) + (= votesGranted_3 (store votesGranted_2 candidate true)) + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= votedFor_3 votedFor_2) + (= log_3 log_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_2 candidateTerm) + (= votedFor_3 Some(candidate)) + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= log_3 log_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + (and ; Action: BecomeLeader + (= state_2 Candidate) + votesGranted_size() >= 3 + (= state_3 Leader) + (= commitIndex_3 (speckl_len_Int log)) + (= currentTerm_3 currentTerm_2) + (= votedFor_3 votedFor_2) + (= log_3 log_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + (and ; Action: AppendEntries + (= state_2 Leader) + (= log_3 append(log_2, newEntry)) + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= votedFor_3 votedFor_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + ; Stuttering + (and + (= currentTerm_3 currentTerm_2) + (= state_3 state_2) + (= votedFor_3 votedFor_2) + (= log_3 log_2) + (= commitIndex_3 commitIndex_2) + (= nextIndex_3 nextIndex_2) + (= matchIndex_3 matchIndex_2) + (= votesGranted_3 votesGranted_2) + ) + ) +) +(assert ; Step 3 → 4 + (or + (and ; Action: RequestVote + (= state_3 Candidate) + (>= currentTerm_3 lastLogTerm) + (= votesGranted_4 (store votesGranted_3 candidate true)) + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= votedFor_4 votedFor_3) + (= log_4 log_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_3 candidateTerm) + (= votedFor_4 Some(candidate)) + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= log_4 log_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + (and ; Action: BecomeLeader + (= state_3 Candidate) + votesGranted_size() >= 3 + (= state_4 Leader) + (= commitIndex_4 (speckl_len_Int log)) + (= currentTerm_4 currentTerm_3) + (= votedFor_4 votedFor_3) + (= log_4 log_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + (and ; Action: AppendEntries + (= state_3 Leader) + (= log_4 append(log_3, newEntry)) + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= votedFor_4 votedFor_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + ; Stuttering + (and + (= currentTerm_4 currentTerm_3) + (= state_4 state_3) + (= votedFor_4 votedFor_3) + (= log_4 log_3) + (= commitIndex_4 commitIndex_3) + (= nextIndex_4 nextIndex_3) + (= matchIndex_4 matchIndex_3) + (= votesGranted_4 votesGranted_3) + ) + ) +) +(assert ; Step 4 → 5 + (or + (and ; Action: RequestVote + (= state_4 Candidate) + (>= currentTerm_4 lastLogTerm) + (= votesGranted_5 (store votesGranted_4 candidate true)) + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= votedFor_5 votedFor_4) + (= log_5 log_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_4 candidateTerm) + (= votedFor_5 Some(candidate)) + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= log_5 log_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + (and ; Action: BecomeLeader + (= state_4 Candidate) + votesGranted_size() >= 3 + (= state_5 Leader) + (= commitIndex_5 (speckl_len_Int log)) + (= currentTerm_5 currentTerm_4) + (= votedFor_5 votedFor_4) + (= log_5 log_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + (and ; Action: AppendEntries + (= state_4 Leader) + (= log_5 append(log_4, newEntry)) + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= votedFor_5 votedFor_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + ; Stuttering + (and + (= currentTerm_5 currentTerm_4) + (= state_5 state_4) + (= votedFor_5 votedFor_4) + (= log_5 log_4) + (= commitIndex_5 commitIndex_4) + (= nextIndex_5 nextIndex_4) + (= matchIndex_5 matchIndex_4) + (= votesGranted_5 votesGranted_4) + ) + ) +) +(assert ; Step 5 → 6 + (or + (and ; Action: RequestVote + (= state_5 Candidate) + (>= currentTerm_5 lastLogTerm) + (= votesGranted_6 (store votesGranted_5 candidate true)) + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= votedFor_6 votedFor_5) + (= log_6 log_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_5 candidateTerm) + (= votedFor_6 Some(candidate)) + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= log_6 log_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + (and ; Action: BecomeLeader + (= state_5 Candidate) + votesGranted_size() >= 3 + (= state_6 Leader) + (= commitIndex_6 (speckl_len_Int log)) + (= currentTerm_6 currentTerm_5) + (= votedFor_6 votedFor_5) + (= log_6 log_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + (and ; Action: AppendEntries + (= state_5 Leader) + (= log_6 append(log_5, newEntry)) + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= votedFor_6 votedFor_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + ; Stuttering + (and + (= currentTerm_6 currentTerm_5) + (= state_6 state_5) + (= votedFor_6 votedFor_5) + (= log_6 log_5) + (= commitIndex_6 commitIndex_5) + (= nextIndex_6 nextIndex_5) + (= matchIndex_6 matchIndex_5) + (= votesGranted_6 votesGranted_5) + ) + ) +) +(assert ; Step 6 → 7 + (or + (and ; Action: RequestVote + (= state_6 Candidate) + (>= currentTerm_6 lastLogTerm) + (= votesGranted_7 (store votesGranted_6 candidate true)) + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= votedFor_7 votedFor_6) + (= log_7 log_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_6 candidateTerm) + (= votedFor_7 Some(candidate)) + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= log_7 log_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + (and ; Action: BecomeLeader + (= state_6 Candidate) + votesGranted_size() >= 3 + (= state_7 Leader) + (= commitIndex_7 (speckl_len_Int log)) + (= currentTerm_7 currentTerm_6) + (= votedFor_7 votedFor_6) + (= log_7 log_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + (and ; Action: AppendEntries + (= state_6 Leader) + (= log_7 append(log_6, newEntry)) + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= votedFor_7 votedFor_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + ; Stuttering + (and + (= currentTerm_7 currentTerm_6) + (= state_7 state_6) + (= votedFor_7 votedFor_6) + (= log_7 log_6) + (= commitIndex_7 commitIndex_6) + (= nextIndex_7 nextIndex_6) + (= matchIndex_7 matchIndex_6) + (= votesGranted_7 votesGranted_6) + ) + ) +) +(assert ; Step 7 → 8 + (or + (and ; Action: RequestVote + (= state_7 Candidate) + (>= currentTerm_7 lastLogTerm) + (= votesGranted_8 (store votesGranted_7 candidate true)) + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= votedFor_8 votedFor_7) + (= log_8 log_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_7 candidateTerm) + (= votedFor_8 Some(candidate)) + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= log_8 log_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + (and ; Action: BecomeLeader + (= state_7 Candidate) + votesGranted_size() >= 3 + (= state_8 Leader) + (= commitIndex_8 (speckl_len_Int log)) + (= currentTerm_8 currentTerm_7) + (= votedFor_8 votedFor_7) + (= log_8 log_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + (and ; Action: AppendEntries + (= state_7 Leader) + (= log_8 append(log_7, newEntry)) + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= votedFor_8 votedFor_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + ; Stuttering + (and + (= currentTerm_8 currentTerm_7) + (= state_8 state_7) + (= votedFor_8 votedFor_7) + (= log_8 log_7) + (= commitIndex_8 commitIndex_7) + (= nextIndex_8 nextIndex_7) + (= matchIndex_8 matchIndex_7) + (= votesGranted_8 votesGranted_7) + ) + ) +) +(assert ; Step 8 → 9 + (or + (and ; Action: RequestVote + (= state_8 Candidate) + (>= currentTerm_8 lastLogTerm) + (= votesGranted_9 (store votesGranted_8 candidate true)) + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= votedFor_9 votedFor_8) + (= log_9 log_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_8 candidateTerm) + (= votedFor_9 Some(candidate)) + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= log_9 log_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + (and ; Action: BecomeLeader + (= state_8 Candidate) + votesGranted_size() >= 3 + (= state_9 Leader) + (= commitIndex_9 (speckl_len_Int log)) + (= currentTerm_9 currentTerm_8) + (= votedFor_9 votedFor_8) + (= log_9 log_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + (and ; Action: AppendEntries + (= state_8 Leader) + (= log_9 append(log_8, newEntry)) + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= votedFor_9 votedFor_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + ; Stuttering + (and + (= currentTerm_9 currentTerm_8) + (= state_9 state_8) + (= votedFor_9 votedFor_8) + (= log_9 log_8) + (= commitIndex_9 commitIndex_8) + (= nextIndex_9 nextIndex_8) + (= matchIndex_9 matchIndex_8) + (= votesGranted_9 votesGranted_8) + ) + ) +) +(assert ; Step 9 → 10 + (or + (and ; Action: RequestVote + (= state_9 Candidate) + (>= currentTerm_9 lastLogTerm) + (= votesGranted_10 (store votesGranted_9 candidate true)) + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= votedFor_10 votedFor_9) + (= log_10 log_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + ) + (and ; Action: HandleRequestVoteRequest + (>= currentTerm_9 candidateTerm) + (= votedFor_10 Some(candidate)) + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= log_10 log_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + (and ; Action: BecomeLeader + (= state_9 Candidate) + votesGranted_size() >= 3 + (= state_10 Leader) + (= commitIndex_10 (speckl_len_Int log)) + (= currentTerm_10 currentTerm_9) + (= votedFor_10 votedFor_9) + (= log_10 log_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + (and ; Action: AppendEntries + (= state_9 Leader) + (= log_10 append(log_9, newEntry)) + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= votedFor_10 votedFor_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + ; Stuttering + (and + (= currentTerm_10 currentTerm_9) + (= state_10 state_9) + (= votedFor_10 votedFor_9) + (= log_10 log_9) + (= commitIndex_10 commitIndex_9) + (= nextIndex_10 nextIndex_9) + (= matchIndex_10 matchIndex_9) + (= votesGranted_10 votesGranted_9) + ) + ) +) + +; Property assertion: not(invariant at some step) +(assert + (or + (not (LeaderCompleteness_0)) + (not (LeaderCompleteness_1)) + (not (LeaderCompleteness_2)) + (not (LeaderCompleteness_3)) + (not (LeaderCompleteness_4)) + (not (LeaderCompleteness_5)) + (not (LeaderCompleteness_6)) + (not (LeaderCompleteness_7)) + (not (LeaderCompleteness_8)) + (not (LeaderCompleteness_9)) + (not (LeaderCompleteness_10)) + ) +) +(define-fun LeaderCompleteness_0 () Bool + (and + commitIndex_0 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_1 () Bool + (and + commitIndex_1 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_2 () Bool + (and + commitIndex_2 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_3 () Bool + (and + commitIndex_3 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_4 () Bool + (and + commitIndex_4 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_5 () Bool + (and + commitIndex_5 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_6 () Bool + (and + commitIndex_6 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_7 () Bool + (and + commitIndex_7 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_8 () Bool + (and + commitIndex_8 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_9 () Bool + (and + commitIndex_9 <= (speckl_len_Int log) + ) +) +(define-fun LeaderCompleteness_10 () Bool + (and + commitIndex_10 <= (speckl_len_Int log) + ) +) + +(echo "Checking: Always(LeaderCompleteness) for 10 steps") (check-sat) (get-model) diff --git a/out/KafkaKRaft.specbom.cdx.json b/out/KafkaKRaft.specbom.cdx.json index 4c0cd54..4d5dd9d 100644 --- a/out/KafkaKRaft.specbom.cdx.json +++ b/out/KafkaKRaft.specbom.cdx.json @@ -24,7 +24,7 @@ "author": { "name": "Speckl Compiler v0.3" }, - "timestamp": "2026-05-10T05:28:26.209Z" + "timestamp": "2026-05-10T09:08:14.915Z" }, { "subject": "speck:KafkaKRaft", @@ -39,7 +39,7 @@ "name": "Speckl Compiler", "email": "compiler@speckl.scoble.me" }, - "timestamp": "2026-05-10T05:28:26.209Z" + "timestamp": "2026-05-10T09:08:14.915Z" }, { "subject": "speck:KafkaKRaft", @@ -54,7 +54,7 @@ "name": "Speckl Compiler", "email": "compiler@speckl.scoble.me" }, - "timestamp": "2026-05-10T05:28:26.209Z" + "timestamp": "2026-05-10T09:08:14.915Z" } ] } \ No newline at end of file diff --git a/out/KafkaKRaft.specbom.spdx.json b/out/KafkaKRaft.specbom.spdx.json index 01ffa09..a758550 100644 --- a/out/KafkaKRaft.specbom.spdx.json +++ b/out/KafkaKRaft.specbom.spdx.json @@ -13,7 +13,7 @@ "spdxVersion": "3.0.1", "dataLicense": "CC0-1.0", "creationInfo": { - "created": "2026-05-10T05:28:26.210Z", + "created": "2026-05-10T09:08:14.915Z", "createdBy": [ "Organization: Speckl", "tool: speckl-compile-0.2.0" @@ -27,7 +27,7 @@ "@type": "spdx:Tool", "name": "speckl-compile" }, - "timestamp": "2026-05-10T05:28:26.210Z", + "timestamp": "2026-05-10T09:08:14.915Z", "comment": "Review type: hybrid" } ] diff --git a/out/KafkaKRaft.ts b/out/KafkaKRaft.ts index 600b2b4..6283ee3 100644 --- a/out/KafkaKRaft.ts +++ b/out/KafkaKRaft.ts @@ -50,5 +50,10 @@ export class KafkaKRaftMachine { - + // V1: Always(TermMonotonicity) + async verify1(): Promise { + // TODO: Model-check or monitor + // Temporal: Always(TermMonotonicity) + return true; + } } diff --git a/out/OAuth2AuthorizationCode.prov.jsonld b/out/OAuth2AuthorizationCode.prov.jsonld index 7144d96..c646bc1 100644 --- a/out/OAuth2AuthorizationCode.prov.jsonld +++ b/out/OAuth2AuthorizationCode.prov.jsonld @@ -12,7 +12,7 @@ "@type": "prov:Generation", "prov:activity": { "@type": "prov:Activity", - "prov:startTime": "2026-05-10T04:51:39.510Z" + "prov:startTime": "2026-05-10T09:08:15.017Z" } }, "rdfs:label": "OAuth2AuthorizationCode" diff --git a/out/OAuth2AuthorizationCode.specbom.spdx.json b/out/OAuth2AuthorizationCode.specbom.spdx.json index 97cdbb1..0d8c2d3 100644 --- a/out/OAuth2AuthorizationCode.specbom.spdx.json +++ b/out/OAuth2AuthorizationCode.specbom.spdx.json @@ -13,7 +13,7 @@ "spdxVersion": "3.0.1", "dataLicense": "CC0-1.0", "creationInfo": { - "created": "2026-05-10T04:51:39.520Z", + "created": "2026-05-10T09:08:15.086Z", "createdBy": [ "Organization: Speckl", "tool: speckl-compile-0.2.0" diff --git a/out/OAuth2AuthorizationCode.ts b/out/OAuth2AuthorizationCode.ts index b108af7..ac315b6 100644 --- a/out/OAuth2AuthorizationCode.ts +++ b/out/OAuth2AuthorizationCode.ts @@ -43,20 +43,14 @@ export class OAuth2AuthorizationCodeMachine { decisionLog: any[] = []; constructor() { - this.clients = new Map(); - this.used = false; - this.created_at = 0; - this.sessions = new Map(); - this.stateNonces = new Map(); - this.pkceChallenges = new Map(); - this.currentTime = 0; + // No init block defined } Authorize(client: ClientId, redirectUri: RedirectUri, scope: Scope, userId: UserId, sessionId: SessionId) { if (!(this.clients.has(client))) throw new Error('Guard failed: this.clients.has(client)'); - if (!(this.clients.has(redirectUri).client.redirect_uris)) throw new Error('Guard failed: this.clients.has(redirectUri).client.redirect_uris'); + if (!(this.clients.client.redirect_uris.has(redirectUri))) throw new Error('Guard failed: this.clients.client.redirect_uris.has(redirectUri)'); if (!(this.sessions.has(sessionId))) throw new Error('Guard failed: this.sessions.has(sessionId)'); - if (!(this.sessions.get(sessionId)!.user_id == userId)) throw new Error('Guard failed: this.sessions.get(sessionId)!.user_id == userId'); + if (!(this.sessions.get(sessionId).user_id == userId)) throw new Error('Guard failed: this.sessions.get(sessionId).user_id == userId'); this.stateNonces[state] = { this.client_id: client, this.redirect_uri: redirectUri }; this.pkceChallenges[codeChallenge] = { code_verifier_hash: hash(codeVerifier, "S256"), method: "S256" }; this.authorizationCodes[authCode] = {; @@ -92,7 +86,7 @@ export class OAuth2AuthorizationCodeMachine { } RevokeToken(client: ClientId, token: string, tokenType: string) { - if (!(this.clients.has(client))) throw new Error('Guard failed: this.clients.has(client)'); + if (!(this.clients.has(client) if tokenType == "access" {)) throw new Error('Guard failed: this.clients.has(client) if tokenType == "access" {'); if (!(this.accessTokens.has(token))) throw new Error('Guard failed: this.accessTokens.has(token)'); if (!(t.this.client_id == client)) throw new Error('Guard failed: t.this.client_id == client'); if (!(this.refreshTokens.has(token))) throw new Error('Guard failed: this.refreshTokens.has(token)'); diff --git a/out/TigerBeetleLedger.prov.jsonld b/out/TigerBeetleLedger.prov.jsonld index 0771fee..a2e00c7 100644 --- a/out/TigerBeetleLedger.prov.jsonld +++ b/out/TigerBeetleLedger.prov.jsonld @@ -12,7 +12,7 @@ "@type": "prov:Generation", "prov:activity": { "@type": "prov:Activity", - "prov:startTime": "2026-05-10T05:07:04.778Z" + "prov:startTime": "2026-05-10T09:08:16.133Z" } }, "rdfs:label": "TigerBeetleLedger" diff --git a/out/TigerBeetleLedger.smt2 b/out/TigerBeetleLedger.smt2 index 9e567de..fddbf85 100644 --- a/out/TigerBeetleLedger.smt2 +++ b/out/TigerBeetleLedger.smt2 @@ -4,6 +4,7 @@ (set-logic ALL) (set-option :produce-models true) +(declare-fun speckl_len_Int ( (Array Int Int) ) Int) (declare-sort Account 0) (declare-sort Transfer 0) (declare-sort Replica 0) @@ -21,20 +22,20 @@ ; --- Invariants --- (define-fun AccountBalanceInvariant () Bool (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) + (forall ((a Account)) (- (= a_balance a_credits_posted) a_debits_posted)) + (forall ((a Account)) (>= a_debits_pending 0) (>= a_credits_pending 0)) ) ) (define-fun TransferStateConsistency () Bool (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) + (forall ((t Transfer)) t_pending ((=> true true))) + (forall ((t Transfer)) t_posted ((=> true true))) + (forall ((t Transfer)) t_voided ((=> true true))) ) ) (define-fun NoOverdraft () Bool (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) + (forall ((a Account)) (or (>= a_balance 0) a_flags.allows_overdraft)) ) ) @@ -45,21 +46,21 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts t_from).balance >= t_amount (select accounts t_from).flags_allows_overdraft) + (or (select accounts t_from).(>= balance t_amount) (select accounts t_from).flags_allows_overdraft) ) ) (define-fun CommitTransferEnabled () Bool (and (select pending id) (select transfers_keys id) - (select transfers id).pending = true + (select transfers id).(= pending true) ) ) (define-fun VoidTransferEnabled () Bool (and (select pending id) (select transfers_keys id) - (select transfers id).pending = true + (select transfers id).(= pending true) ) ) (define-fun PostTransferEnabled () Bool @@ -68,20 +69,20 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts t_from).balance >= t_amount (select accounts t_from).flags_allows_overdraft) + (or (select accounts t_from).(>= balance t_amount) (select accounts t_from).flags_allows_overdraft) ) ) (define-fun BecomeLeaderEnabled () Bool (and (select replicaState_keys replica) - (select replicaState replica).role = "candidate" + (select replicaState replica).(= role "candidate") (< (select replicaState replica).currentTerm term) ) ) (define-fun AppendEntryEnabled () Bool (and - (+ entry_index = length(log) 1) - term >= commitIndex + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex) ) ) ; Next transition relation: CreateTransfer | CommitTransfer | VoidTransfer | PostTransfer | BecomeLeader | AppendEntry @@ -265,7 +266,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_0 t_from).balance >= t_amount (select accounts_0 t_from).flags_allows_overdraft) + (or (select accounts_0 t_from).(>= balance t_amount) (select accounts_0 t_from).flags_allows_overdraft) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -277,7 +278,7 @@ (and ; Action: CommitTransfer (select pending_0 id) (select transfers_keys id) - (select transfers_0 id).pending_0 = true + (select transfers_0 id).(= pending_0 true) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -289,7 +290,7 @@ (and ; Action: VoidTransfer (select pending_0 id) (select transfers_keys id) - (select transfers_0 id).pending_0 = true + (select transfers_0 id).(= pending_0 true) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -303,7 +304,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_0 t_from).balance >= t_amount (select accounts_0 t_from).flags_allows_overdraft) + (or (select accounts_0 t_from).(>= balance t_amount) (select accounts_0 t_from).flags_allows_overdraft) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -314,7 +315,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_0 replica).role = "candidate" + (select replicaState_0 replica).(= role "candidate") (< (select replicaState_0 replica).currentTerm term) (= accounts_1 accounts_0) (= transfers_1 transfers_0) @@ -325,8 +326,8 @@ (= leader_1 leader_0) ) (and ; Action: AppendEntry - (+ entry_index = length(log_0) 1) - term >= commitIndex_0 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_0) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -354,7 +355,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_1 t_from).balance >= t_amount (select accounts_1 t_from).flags_allows_overdraft) + (or (select accounts_1 t_from).(>= balance t_amount) (select accounts_1 t_from).flags_allows_overdraft) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -366,7 +367,7 @@ (and ; Action: CommitTransfer (select pending_1 id) (select transfers_keys id) - (select transfers_1 id).pending_1 = true + (select transfers_1 id).(= pending_1 true) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -378,7 +379,7 @@ (and ; Action: VoidTransfer (select pending_1 id) (select transfers_keys id) - (select transfers_1 id).pending_1 = true + (select transfers_1 id).(= pending_1 true) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -392,7 +393,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_1 t_from).balance >= t_amount (select accounts_1 t_from).flags_allows_overdraft) + (or (select accounts_1 t_from).(>= balance t_amount) (select accounts_1 t_from).flags_allows_overdraft) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -403,7 +404,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_1 replica).role = "candidate" + (select replicaState_1 replica).(= role "candidate") (< (select replicaState_1 replica).currentTerm term) (= accounts_2 accounts_1) (= transfers_2 transfers_1) @@ -414,8 +415,8 @@ (= leader_2 leader_1) ) (and ; Action: AppendEntry - (+ entry_index = length(log_1) 1) - term >= commitIndex_1 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_1) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -443,7 +444,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_2 t_from).balance >= t_amount (select accounts_2 t_from).flags_allows_overdraft) + (or (select accounts_2 t_from).(>= balance t_amount) (select accounts_2 t_from).flags_allows_overdraft) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -455,7 +456,7 @@ (and ; Action: CommitTransfer (select pending_2 id) (select transfers_keys id) - (select transfers_2 id).pending_2 = true + (select transfers_2 id).(= pending_2 true) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -467,7 +468,7 @@ (and ; Action: VoidTransfer (select pending_2 id) (select transfers_keys id) - (select transfers_2 id).pending_2 = true + (select transfers_2 id).(= pending_2 true) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -481,7 +482,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_2 t_from).balance >= t_amount (select accounts_2 t_from).flags_allows_overdraft) + (or (select accounts_2 t_from).(>= balance t_amount) (select accounts_2 t_from).flags_allows_overdraft) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -492,7 +493,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_2 replica).role = "candidate" + (select replicaState_2 replica).(= role "candidate") (< (select replicaState_2 replica).currentTerm term) (= accounts_3 accounts_2) (= transfers_3 transfers_2) @@ -503,8 +504,8 @@ (= leader_3 leader_2) ) (and ; Action: AppendEntry - (+ entry_index = length(log_2) 1) - term >= commitIndex_2 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_2) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -532,7 +533,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_3 t_from).balance >= t_amount (select accounts_3 t_from).flags_allows_overdraft) + (or (select accounts_3 t_from).(>= balance t_amount) (select accounts_3 t_from).flags_allows_overdraft) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -544,7 +545,7 @@ (and ; Action: CommitTransfer (select pending_3 id) (select transfers_keys id) - (select transfers_3 id).pending_3 = true + (select transfers_3 id).(= pending_3 true) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -556,7 +557,7 @@ (and ; Action: VoidTransfer (select pending_3 id) (select transfers_keys id) - (select transfers_3 id).pending_3 = true + (select transfers_3 id).(= pending_3 true) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -570,7 +571,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_3 t_from).balance >= t_amount (select accounts_3 t_from).flags_allows_overdraft) + (or (select accounts_3 t_from).(>= balance t_amount) (select accounts_3 t_from).flags_allows_overdraft) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -581,7 +582,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_3 replica).role = "candidate" + (select replicaState_3 replica).(= role "candidate") (< (select replicaState_3 replica).currentTerm term) (= accounts_4 accounts_3) (= transfers_4 transfers_3) @@ -592,8 +593,8 @@ (= leader_4 leader_3) ) (and ; Action: AppendEntry - (+ entry_index = length(log_3) 1) - term >= commitIndex_3 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_3) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -621,7 +622,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_4 t_from).balance >= t_amount (select accounts_4 t_from).flags_allows_overdraft) + (or (select accounts_4 t_from).(>= balance t_amount) (select accounts_4 t_from).flags_allows_overdraft) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -633,7 +634,7 @@ (and ; Action: CommitTransfer (select pending_4 id) (select transfers_keys id) - (select transfers_4 id).pending_4 = true + (select transfers_4 id).(= pending_4 true) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -645,7 +646,7 @@ (and ; Action: VoidTransfer (select pending_4 id) (select transfers_keys id) - (select transfers_4 id).pending_4 = true + (select transfers_4 id).(= pending_4 true) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -659,7 +660,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_4 t_from).balance >= t_amount (select accounts_4 t_from).flags_allows_overdraft) + (or (select accounts_4 t_from).(>= balance t_amount) (select accounts_4 t_from).flags_allows_overdraft) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -670,7 +671,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_4 replica).role = "candidate" + (select replicaState_4 replica).(= role "candidate") (< (select replicaState_4 replica).currentTerm term) (= accounts_5 accounts_4) (= transfers_5 transfers_4) @@ -681,8 +682,8 @@ (= leader_5 leader_4) ) (and ; Action: AppendEntry - (+ entry_index = length(log_4) 1) - term >= commitIndex_4 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_4) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -710,7 +711,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_5 t_from).balance >= t_amount (select accounts_5 t_from).flags_allows_overdraft) + (or (select accounts_5 t_from).(>= balance t_amount) (select accounts_5 t_from).flags_allows_overdraft) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -722,7 +723,7 @@ (and ; Action: CommitTransfer (select pending_5 id) (select transfers_keys id) - (select transfers_5 id).pending_5 = true + (select transfers_5 id).(= pending_5 true) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -734,7 +735,7 @@ (and ; Action: VoidTransfer (select pending_5 id) (select transfers_keys id) - (select transfers_5 id).pending_5 = true + (select transfers_5 id).(= pending_5 true) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -748,7 +749,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_5 t_from).balance >= t_amount (select accounts_5 t_from).flags_allows_overdraft) + (or (select accounts_5 t_from).(>= balance t_amount) (select accounts_5 t_from).flags_allows_overdraft) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -759,7 +760,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_5 replica).role = "candidate" + (select replicaState_5 replica).(= role "candidate") (< (select replicaState_5 replica).currentTerm term) (= accounts_6 accounts_5) (= transfers_6 transfers_5) @@ -770,8 +771,8 @@ (= leader_6 leader_5) ) (and ; Action: AppendEntry - (+ entry_index = length(log_5) 1) - term >= commitIndex_5 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_5) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -799,7 +800,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_6 t_from).balance >= t_amount (select accounts_6 t_from).flags_allows_overdraft) + (or (select accounts_6 t_from).(>= balance t_amount) (select accounts_6 t_from).flags_allows_overdraft) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -811,7 +812,7 @@ (and ; Action: CommitTransfer (select pending_6 id) (select transfers_keys id) - (select transfers_6 id).pending_6 = true + (select transfers_6 id).(= pending_6 true) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -823,7 +824,7 @@ (and ; Action: VoidTransfer (select pending_6 id) (select transfers_keys id) - (select transfers_6 id).pending_6 = true + (select transfers_6 id).(= pending_6 true) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -837,7 +838,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_6 t_from).balance >= t_amount (select accounts_6 t_from).flags_allows_overdraft) + (or (select accounts_6 t_from).(>= balance t_amount) (select accounts_6 t_from).flags_allows_overdraft) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -848,7 +849,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_6 replica).role = "candidate" + (select replicaState_6 replica).(= role "candidate") (< (select replicaState_6 replica).currentTerm term) (= accounts_7 accounts_6) (= transfers_7 transfers_6) @@ -859,8 +860,8 @@ (= leader_7 leader_6) ) (and ; Action: AppendEntry - (+ entry_index = length(log_6) 1) - term >= commitIndex_6 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_6) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -888,7 +889,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_7 t_from).balance >= t_amount (select accounts_7 t_from).flags_allows_overdraft) + (or (select accounts_7 t_from).(>= balance t_amount) (select accounts_7 t_from).flags_allows_overdraft) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -900,7 +901,7 @@ (and ; Action: CommitTransfer (select pending_7 id) (select transfers_keys id) - (select transfers_7 id).pending_7 = true + (select transfers_7 id).(= pending_7 true) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -912,7 +913,7 @@ (and ; Action: VoidTransfer (select pending_7 id) (select transfers_keys id) - (select transfers_7 id).pending_7 = true + (select transfers_7 id).(= pending_7 true) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -926,7 +927,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_7 t_from).balance >= t_amount (select accounts_7 t_from).flags_allows_overdraft) + (or (select accounts_7 t_from).(>= balance t_amount) (select accounts_7 t_from).flags_allows_overdraft) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -937,7 +938,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_7 replica).role = "candidate" + (select replicaState_7 replica).(= role "candidate") (< (select replicaState_7 replica).currentTerm term) (= accounts_8 accounts_7) (= transfers_8 transfers_7) @@ -948,8 +949,8 @@ (= leader_8 leader_7) ) (and ; Action: AppendEntry - (+ entry_index = length(log_7) 1) - term >= commitIndex_7 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_7) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -977,7 +978,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_8 t_from).balance >= t_amount (select accounts_8 t_from).flags_allows_overdraft) + (or (select accounts_8 t_from).(>= balance t_amount) (select accounts_8 t_from).flags_allows_overdraft) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -989,7 +990,7 @@ (and ; Action: CommitTransfer (select pending_8 id) (select transfers_keys id) - (select transfers_8 id).pending_8 = true + (select transfers_8 id).(= pending_8 true) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -1001,7 +1002,7 @@ (and ; Action: VoidTransfer (select pending_8 id) (select transfers_keys id) - (select transfers_8 id).pending_8 = true + (select transfers_8 id).(= pending_8 true) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -1015,7 +1016,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_8 t_from).balance >= t_amount (select accounts_8 t_from).flags_allows_overdraft) + (or (select accounts_8 t_from).(>= balance t_amount) (select accounts_8 t_from).flags_allows_overdraft) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -1026,7 +1027,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_8 replica).role = "candidate" + (select replicaState_8 replica).(= role "candidate") (< (select replicaState_8 replica).currentTerm term) (= accounts_9 accounts_8) (= transfers_9 transfers_8) @@ -1037,8 +1038,8 @@ (= leader_9 leader_8) ) (and ; Action: AppendEntry - (+ entry_index = length(log_8) 1) - term >= commitIndex_8 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_8) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -1066,7 +1067,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_9 t_from).balance >= t_amount (select accounts_9 t_from).flags_allows_overdraft) + (or (select accounts_9 t_from).(>= balance t_amount) (select accounts_9 t_from).flags_allows_overdraft) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -1078,7 +1079,7 @@ (and ; Action: CommitTransfer (select pending_9 id) (select transfers_keys id) - (select transfers_9 id).pending_9 = true + (select transfers_9 id).(= pending_9 true) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -1090,7 +1091,7 @@ (and ; Action: VoidTransfer (select pending_9 id) (select transfers_keys id) - (select transfers_9 id).pending_9 = true + (select transfers_9 id).(= pending_9 true) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -1104,7 +1105,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_9 t_from).balance >= t_amount (select accounts_9 t_from).flags_allows_overdraft) + (or (select accounts_9 t_from).(>= balance t_amount) (select accounts_9 t_from).flags_allows_overdraft) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -1115,7 +1116,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_9 replica).role = "candidate" + (select replicaState_9 replica).(= role "candidate") (< (select replicaState_9 replica).currentTerm term) (= accounts_10 accounts_9) (= transfers_10 transfers_9) @@ -1126,8 +1127,8 @@ (= leader_10 leader_9) ) (and ; Action: AppendEntry - (+ entry_index = length(log_9) 1) - term >= commitIndex_9 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_9) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -1150,89 +1151,7 @@ ) ; Property assertion: not(invariant at some step) -(assert - (or - (not (AccountBalanceInvariant_0)) - (not (AccountBalanceInvariant_1)) - (not (AccountBalanceInvariant_2)) - (not (AccountBalanceInvariant_3)) - (not (AccountBalanceInvariant_4)) - (not (AccountBalanceInvariant_5)) - (not (AccountBalanceInvariant_6)) - (not (AccountBalanceInvariant_7)) - (not (AccountBalanceInvariant_8)) - (not (AccountBalanceInvariant_9)) - (not (AccountBalanceInvariant_10)) - ) -) -(define-fun AccountBalanceInvariant_0 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_1 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_2 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_3 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_4 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_5 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_6 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_7 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_8 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_9 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) -(define-fun AccountBalanceInvariant_10 () Bool - (and - (forall ((a Account)) (- a_balance = a_credits_posted a_debits_posted)) - (forall ((a Account)) a_debits_pending >= 0 a_credits_pending >= 0) - ) -) - -(echo "Checking: Always(AccountBalanceInvariant) for 10 steps") +; Warning: invariant "unnamed" not found in spec (check-sat) (get-model) ; Verification: Always(NoOverdraft) @@ -1333,7 +1252,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_0 t_from).balance >= t_amount (select accounts_0 t_from).flags_allows_overdraft) + (or (select accounts_0 t_from).(>= balance t_amount) (select accounts_0 t_from).flags_allows_overdraft) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -1345,7 +1264,7 @@ (and ; Action: CommitTransfer (select pending_0 id) (select transfers_keys id) - (select transfers_0 id).pending_0 = true + (select transfers_0 id).(= pending_0 true) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -1357,7 +1276,7 @@ (and ; Action: VoidTransfer (select pending_0 id) (select transfers_keys id) - (select transfers_0 id).pending_0 = true + (select transfers_0 id).(= pending_0 true) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -1371,7 +1290,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_0 t_from).balance >= t_amount (select accounts_0 t_from).flags_allows_overdraft) + (or (select accounts_0 t_from).(>= balance t_amount) (select accounts_0 t_from).flags_allows_overdraft) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -1382,7 +1301,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_0 replica).role = "candidate" + (select replicaState_0 replica).(= role "candidate") (< (select replicaState_0 replica).currentTerm term) (= accounts_1 accounts_0) (= transfers_1 transfers_0) @@ -1393,8 +1312,8 @@ (= leader_1 leader_0) ) (and ; Action: AppendEntry - (+ entry_index = length(log_0) 1) - term >= commitIndex_0 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_0) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -1422,7 +1341,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_1 t_from).balance >= t_amount (select accounts_1 t_from).flags_allows_overdraft) + (or (select accounts_1 t_from).(>= balance t_amount) (select accounts_1 t_from).flags_allows_overdraft) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -1434,7 +1353,7 @@ (and ; Action: CommitTransfer (select pending_1 id) (select transfers_keys id) - (select transfers_1 id).pending_1 = true + (select transfers_1 id).(= pending_1 true) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -1446,7 +1365,7 @@ (and ; Action: VoidTransfer (select pending_1 id) (select transfers_keys id) - (select transfers_1 id).pending_1 = true + (select transfers_1 id).(= pending_1 true) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -1460,7 +1379,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_1 t_from).balance >= t_amount (select accounts_1 t_from).flags_allows_overdraft) + (or (select accounts_1 t_from).(>= balance t_amount) (select accounts_1 t_from).flags_allows_overdraft) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -1471,7 +1390,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_1 replica).role = "candidate" + (select replicaState_1 replica).(= role "candidate") (< (select replicaState_1 replica).currentTerm term) (= accounts_2 accounts_1) (= transfers_2 transfers_1) @@ -1482,8 +1401,8 @@ (= leader_2 leader_1) ) (and ; Action: AppendEntry - (+ entry_index = length(log_1) 1) - term >= commitIndex_1 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_1) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -1511,7 +1430,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_2 t_from).balance >= t_amount (select accounts_2 t_from).flags_allows_overdraft) + (or (select accounts_2 t_from).(>= balance t_amount) (select accounts_2 t_from).flags_allows_overdraft) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -1523,7 +1442,7 @@ (and ; Action: CommitTransfer (select pending_2 id) (select transfers_keys id) - (select transfers_2 id).pending_2 = true + (select transfers_2 id).(= pending_2 true) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -1535,7 +1454,7 @@ (and ; Action: VoidTransfer (select pending_2 id) (select transfers_keys id) - (select transfers_2 id).pending_2 = true + (select transfers_2 id).(= pending_2 true) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -1549,7 +1468,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_2 t_from).balance >= t_amount (select accounts_2 t_from).flags_allows_overdraft) + (or (select accounts_2 t_from).(>= balance t_amount) (select accounts_2 t_from).flags_allows_overdraft) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -1560,7 +1479,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_2 replica).role = "candidate" + (select replicaState_2 replica).(= role "candidate") (< (select replicaState_2 replica).currentTerm term) (= accounts_3 accounts_2) (= transfers_3 transfers_2) @@ -1571,8 +1490,8 @@ (= leader_3 leader_2) ) (and ; Action: AppendEntry - (+ entry_index = length(log_2) 1) - term >= commitIndex_2 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_2) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -1600,7 +1519,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_3 t_from).balance >= t_amount (select accounts_3 t_from).flags_allows_overdraft) + (or (select accounts_3 t_from).(>= balance t_amount) (select accounts_3 t_from).flags_allows_overdraft) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -1612,7 +1531,7 @@ (and ; Action: CommitTransfer (select pending_3 id) (select transfers_keys id) - (select transfers_3 id).pending_3 = true + (select transfers_3 id).(= pending_3 true) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -1624,7 +1543,7 @@ (and ; Action: VoidTransfer (select pending_3 id) (select transfers_keys id) - (select transfers_3 id).pending_3 = true + (select transfers_3 id).(= pending_3 true) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -1638,7 +1557,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_3 t_from).balance >= t_amount (select accounts_3 t_from).flags_allows_overdraft) + (or (select accounts_3 t_from).(>= balance t_amount) (select accounts_3 t_from).flags_allows_overdraft) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -1649,7 +1568,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_3 replica).role = "candidate" + (select replicaState_3 replica).(= role "candidate") (< (select replicaState_3 replica).currentTerm term) (= accounts_4 accounts_3) (= transfers_4 transfers_3) @@ -1660,8 +1579,8 @@ (= leader_4 leader_3) ) (and ; Action: AppendEntry - (+ entry_index = length(log_3) 1) - term >= commitIndex_3 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_3) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -1689,7 +1608,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_4 t_from).balance >= t_amount (select accounts_4 t_from).flags_allows_overdraft) + (or (select accounts_4 t_from).(>= balance t_amount) (select accounts_4 t_from).flags_allows_overdraft) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -1701,7 +1620,7 @@ (and ; Action: CommitTransfer (select pending_4 id) (select transfers_keys id) - (select transfers_4 id).pending_4 = true + (select transfers_4 id).(= pending_4 true) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -1713,7 +1632,7 @@ (and ; Action: VoidTransfer (select pending_4 id) (select transfers_keys id) - (select transfers_4 id).pending_4 = true + (select transfers_4 id).(= pending_4 true) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -1727,7 +1646,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_4 t_from).balance >= t_amount (select accounts_4 t_from).flags_allows_overdraft) + (or (select accounts_4 t_from).(>= balance t_amount) (select accounts_4 t_from).flags_allows_overdraft) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -1738,7 +1657,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_4 replica).role = "candidate" + (select replicaState_4 replica).(= role "candidate") (< (select replicaState_4 replica).currentTerm term) (= accounts_5 accounts_4) (= transfers_5 transfers_4) @@ -1749,8 +1668,8 @@ (= leader_5 leader_4) ) (and ; Action: AppendEntry - (+ entry_index = length(log_4) 1) - term >= commitIndex_4 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_4) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -1778,7 +1697,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_5 t_from).balance >= t_amount (select accounts_5 t_from).flags_allows_overdraft) + (or (select accounts_5 t_from).(>= balance t_amount) (select accounts_5 t_from).flags_allows_overdraft) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -1790,7 +1709,7 @@ (and ; Action: CommitTransfer (select pending_5 id) (select transfers_keys id) - (select transfers_5 id).pending_5 = true + (select transfers_5 id).(= pending_5 true) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -1802,7 +1721,7 @@ (and ; Action: VoidTransfer (select pending_5 id) (select transfers_keys id) - (select transfers_5 id).pending_5 = true + (select transfers_5 id).(= pending_5 true) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -1816,7 +1735,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_5 t_from).balance >= t_amount (select accounts_5 t_from).flags_allows_overdraft) + (or (select accounts_5 t_from).(>= balance t_amount) (select accounts_5 t_from).flags_allows_overdraft) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -1827,7 +1746,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_5 replica).role = "candidate" + (select replicaState_5 replica).(= role "candidate") (< (select replicaState_5 replica).currentTerm term) (= accounts_6 accounts_5) (= transfers_6 transfers_5) @@ -1838,8 +1757,8 @@ (= leader_6 leader_5) ) (and ; Action: AppendEntry - (+ entry_index = length(log_5) 1) - term >= commitIndex_5 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_5) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -1867,7 +1786,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_6 t_from).balance >= t_amount (select accounts_6 t_from).flags_allows_overdraft) + (or (select accounts_6 t_from).(>= balance t_amount) (select accounts_6 t_from).flags_allows_overdraft) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -1879,7 +1798,7 @@ (and ; Action: CommitTransfer (select pending_6 id) (select transfers_keys id) - (select transfers_6 id).pending_6 = true + (select transfers_6 id).(= pending_6 true) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -1891,7 +1810,7 @@ (and ; Action: VoidTransfer (select pending_6 id) (select transfers_keys id) - (select transfers_6 id).pending_6 = true + (select transfers_6 id).(= pending_6 true) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -1905,7 +1824,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_6 t_from).balance >= t_amount (select accounts_6 t_from).flags_allows_overdraft) + (or (select accounts_6 t_from).(>= balance t_amount) (select accounts_6 t_from).flags_allows_overdraft) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -1916,7 +1835,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_6 replica).role = "candidate" + (select replicaState_6 replica).(= role "candidate") (< (select replicaState_6 replica).currentTerm term) (= accounts_7 accounts_6) (= transfers_7 transfers_6) @@ -1927,8 +1846,8 @@ (= leader_7 leader_6) ) (and ; Action: AppendEntry - (+ entry_index = length(log_6) 1) - term >= commitIndex_6 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_6) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -1956,7 +1875,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_7 t_from).balance >= t_amount (select accounts_7 t_from).flags_allows_overdraft) + (or (select accounts_7 t_from).(>= balance t_amount) (select accounts_7 t_from).flags_allows_overdraft) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -1968,7 +1887,7 @@ (and ; Action: CommitTransfer (select pending_7 id) (select transfers_keys id) - (select transfers_7 id).pending_7 = true + (select transfers_7 id).(= pending_7 true) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -1980,7 +1899,7 @@ (and ; Action: VoidTransfer (select pending_7 id) (select transfers_keys id) - (select transfers_7 id).pending_7 = true + (select transfers_7 id).(= pending_7 true) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -1994,7 +1913,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_7 t_from).balance >= t_amount (select accounts_7 t_from).flags_allows_overdraft) + (or (select accounts_7 t_from).(>= balance t_amount) (select accounts_7 t_from).flags_allows_overdraft) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -2005,7 +1924,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_7 replica).role = "candidate" + (select replicaState_7 replica).(= role "candidate") (< (select replicaState_7 replica).currentTerm term) (= accounts_8 accounts_7) (= transfers_8 transfers_7) @@ -2016,8 +1935,8 @@ (= leader_8 leader_7) ) (and ; Action: AppendEntry - (+ entry_index = length(log_7) 1) - term >= commitIndex_7 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_7) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -2045,7 +1964,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_8 t_from).balance >= t_amount (select accounts_8 t_from).flags_allows_overdraft) + (or (select accounts_8 t_from).(>= balance t_amount) (select accounts_8 t_from).flags_allows_overdraft) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -2057,7 +1976,7 @@ (and ; Action: CommitTransfer (select pending_8 id) (select transfers_keys id) - (select transfers_8 id).pending_8 = true + (select transfers_8 id).(= pending_8 true) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -2069,7 +1988,7 @@ (and ; Action: VoidTransfer (select pending_8 id) (select transfers_keys id) - (select transfers_8 id).pending_8 = true + (select transfers_8 id).(= pending_8 true) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -2083,7 +2002,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_8 t_from).balance >= t_amount (select accounts_8 t_from).flags_allows_overdraft) + (or (select accounts_8 t_from).(>= balance t_amount) (select accounts_8 t_from).flags_allows_overdraft) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -2094,7 +2013,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_8 replica).role = "candidate" + (select replicaState_8 replica).(= role "candidate") (< (select replicaState_8 replica).currentTerm term) (= accounts_9 accounts_8) (= transfers_9 transfers_8) @@ -2105,8 +2024,8 @@ (= leader_9 leader_8) ) (and ; Action: AppendEntry - (+ entry_index = length(log_8) 1) - term >= commitIndex_8 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_8) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -2134,7 +2053,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_9 t_from).balance >= t_amount (select accounts_9 t_from).flags_allows_overdraft) + (or (select accounts_9 t_from).(>= balance t_amount) (select accounts_9 t_from).flags_allows_overdraft) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -2146,7 +2065,7 @@ (and ; Action: CommitTransfer (select pending_9 id) (select transfers_keys id) - (select transfers_9 id).pending_9 = true + (select transfers_9 id).(= pending_9 true) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -2158,7 +2077,7 @@ (and ; Action: VoidTransfer (select pending_9 id) (select transfers_keys id) - (select transfers_9 id).pending_9 = true + (select transfers_9 id).(= pending_9 true) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -2172,7 +2091,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_9 t_from).balance >= t_amount (select accounts_9 t_from).flags_allows_overdraft) + (or (select accounts_9 t_from).(>= balance t_amount) (select accounts_9 t_from).flags_allows_overdraft) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -2183,7 +2102,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_9 replica).role = "candidate" + (select replicaState_9 replica).(= role "candidate") (< (select replicaState_9 replica).currentTerm term) (= accounts_10 accounts_9) (= transfers_10 transfers_9) @@ -2194,8 +2113,8 @@ (= leader_10 leader_9) ) (and ; Action: AppendEntry - (+ entry_index = length(log_9) 1) - term >= commitIndex_9 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_9) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -2218,78 +2137,7 @@ ) ; Property assertion: not(invariant at some step) -(assert - (or - (not (NoOverdraft_0)) - (not (NoOverdraft_1)) - (not (NoOverdraft_2)) - (not (NoOverdraft_3)) - (not (NoOverdraft_4)) - (not (NoOverdraft_5)) - (not (NoOverdraft_6)) - (not (NoOverdraft_7)) - (not (NoOverdraft_8)) - (not (NoOverdraft_9)) - (not (NoOverdraft_10)) - ) -) -(define-fun NoOverdraft_0 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_1 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_2 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_3 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_4 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_5 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_6 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_7 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_8 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_9 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) -(define-fun NoOverdraft_10 () Bool - (and - (forall ((a Account)) (or a_balance >= 0 a_flags.allows_overdraft)) - ) -) - -(echo "Checking: Always(NoOverdraft) for 10 steps") +; Warning: invariant "unnamed" not found in spec (check-sat) (get-model) ; Verification: Eventually(TransferStateConsistency) @@ -2390,7 +2238,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_0 t_from).balance >= t_amount (select accounts_0 t_from).flags_allows_overdraft) + (or (select accounts_0 t_from).(>= balance t_amount) (select accounts_0 t_from).flags_allows_overdraft) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -2402,7 +2250,7 @@ (and ; Action: CommitTransfer (select pending_0 id) (select transfers_keys id) - (select transfers_0 id).pending_0 = true + (select transfers_0 id).(= pending_0 true) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -2414,7 +2262,7 @@ (and ; Action: VoidTransfer (select pending_0 id) (select transfers_keys id) - (select transfers_0 id).pending_0 = true + (select transfers_0 id).(= pending_0 true) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -2428,7 +2276,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_0 t_from).balance >= t_amount (select accounts_0 t_from).flags_allows_overdraft) + (or (select accounts_0 t_from).(>= balance t_amount) (select accounts_0 t_from).flags_allows_overdraft) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -2439,7 +2287,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_0 replica).role = "candidate" + (select replicaState_0 replica).(= role "candidate") (< (select replicaState_0 replica).currentTerm term) (= accounts_1 accounts_0) (= transfers_1 transfers_0) @@ -2450,8 +2298,8 @@ (= leader_1 leader_0) ) (and ; Action: AppendEntry - (+ entry_index = length(log_0) 1) - term >= commitIndex_0 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_0) (= accounts_1 accounts_0) (= transfers_1 transfers_0) (= pending_1 pending_0) @@ -2479,7 +2327,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_1 t_from).balance >= t_amount (select accounts_1 t_from).flags_allows_overdraft) + (or (select accounts_1 t_from).(>= balance t_amount) (select accounts_1 t_from).flags_allows_overdraft) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -2491,7 +2339,7 @@ (and ; Action: CommitTransfer (select pending_1 id) (select transfers_keys id) - (select transfers_1 id).pending_1 = true + (select transfers_1 id).(= pending_1 true) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -2503,7 +2351,7 @@ (and ; Action: VoidTransfer (select pending_1 id) (select transfers_keys id) - (select transfers_1 id).pending_1 = true + (select transfers_1 id).(= pending_1 true) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -2517,7 +2365,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_1 t_from).balance >= t_amount (select accounts_1 t_from).flags_allows_overdraft) + (or (select accounts_1 t_from).(>= balance t_amount) (select accounts_1 t_from).flags_allows_overdraft) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -2528,7 +2376,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_1 replica).role = "candidate" + (select replicaState_1 replica).(= role "candidate") (< (select replicaState_1 replica).currentTerm term) (= accounts_2 accounts_1) (= transfers_2 transfers_1) @@ -2539,8 +2387,8 @@ (= leader_2 leader_1) ) (and ; Action: AppendEntry - (+ entry_index = length(log_1) 1) - term >= commitIndex_1 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_1) (= accounts_2 accounts_1) (= transfers_2 transfers_1) (= pending_2 pending_1) @@ -2568,7 +2416,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_2 t_from).balance >= t_amount (select accounts_2 t_from).flags_allows_overdraft) + (or (select accounts_2 t_from).(>= balance t_amount) (select accounts_2 t_from).flags_allows_overdraft) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -2580,7 +2428,7 @@ (and ; Action: CommitTransfer (select pending_2 id) (select transfers_keys id) - (select transfers_2 id).pending_2 = true + (select transfers_2 id).(= pending_2 true) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -2592,7 +2440,7 @@ (and ; Action: VoidTransfer (select pending_2 id) (select transfers_keys id) - (select transfers_2 id).pending_2 = true + (select transfers_2 id).(= pending_2 true) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -2606,7 +2454,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_2 t_from).balance >= t_amount (select accounts_2 t_from).flags_allows_overdraft) + (or (select accounts_2 t_from).(>= balance t_amount) (select accounts_2 t_from).flags_allows_overdraft) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -2617,7 +2465,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_2 replica).role = "candidate" + (select replicaState_2 replica).(= role "candidate") (< (select replicaState_2 replica).currentTerm term) (= accounts_3 accounts_2) (= transfers_3 transfers_2) @@ -2628,8 +2476,8 @@ (= leader_3 leader_2) ) (and ; Action: AppendEntry - (+ entry_index = length(log_2) 1) - term >= commitIndex_2 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_2) (= accounts_3 accounts_2) (= transfers_3 transfers_2) (= pending_3 pending_2) @@ -2657,7 +2505,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_3 t_from).balance >= t_amount (select accounts_3 t_from).flags_allows_overdraft) + (or (select accounts_3 t_from).(>= balance t_amount) (select accounts_3 t_from).flags_allows_overdraft) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -2669,7 +2517,7 @@ (and ; Action: CommitTransfer (select pending_3 id) (select transfers_keys id) - (select transfers_3 id).pending_3 = true + (select transfers_3 id).(= pending_3 true) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -2681,7 +2529,7 @@ (and ; Action: VoidTransfer (select pending_3 id) (select transfers_keys id) - (select transfers_3 id).pending_3 = true + (select transfers_3 id).(= pending_3 true) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -2695,7 +2543,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_3 t_from).balance >= t_amount (select accounts_3 t_from).flags_allows_overdraft) + (or (select accounts_3 t_from).(>= balance t_amount) (select accounts_3 t_from).flags_allows_overdraft) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -2706,7 +2554,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_3 replica).role = "candidate" + (select replicaState_3 replica).(= role "candidate") (< (select replicaState_3 replica).currentTerm term) (= accounts_4 accounts_3) (= transfers_4 transfers_3) @@ -2717,8 +2565,8 @@ (= leader_4 leader_3) ) (and ; Action: AppendEntry - (+ entry_index = length(log_3) 1) - term >= commitIndex_3 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_3) (= accounts_4 accounts_3) (= transfers_4 transfers_3) (= pending_4 pending_3) @@ -2746,7 +2594,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_4 t_from).balance >= t_amount (select accounts_4 t_from).flags_allows_overdraft) + (or (select accounts_4 t_from).(>= balance t_amount) (select accounts_4 t_from).flags_allows_overdraft) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -2758,7 +2606,7 @@ (and ; Action: CommitTransfer (select pending_4 id) (select transfers_keys id) - (select transfers_4 id).pending_4 = true + (select transfers_4 id).(= pending_4 true) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -2770,7 +2618,7 @@ (and ; Action: VoidTransfer (select pending_4 id) (select transfers_keys id) - (select transfers_4 id).pending_4 = true + (select transfers_4 id).(= pending_4 true) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -2784,7 +2632,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_4 t_from).balance >= t_amount (select accounts_4 t_from).flags_allows_overdraft) + (or (select accounts_4 t_from).(>= balance t_amount) (select accounts_4 t_from).flags_allows_overdraft) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -2795,7 +2643,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_4 replica).role = "candidate" + (select replicaState_4 replica).(= role "candidate") (< (select replicaState_4 replica).currentTerm term) (= accounts_5 accounts_4) (= transfers_5 transfers_4) @@ -2806,8 +2654,8 @@ (= leader_5 leader_4) ) (and ; Action: AppendEntry - (+ entry_index = length(log_4) 1) - term >= commitIndex_4 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_4) (= accounts_5 accounts_4) (= transfers_5 transfers_4) (= pending_5 pending_4) @@ -2835,7 +2683,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_5 t_from).balance >= t_amount (select accounts_5 t_from).flags_allows_overdraft) + (or (select accounts_5 t_from).(>= balance t_amount) (select accounts_5 t_from).flags_allows_overdraft) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -2847,7 +2695,7 @@ (and ; Action: CommitTransfer (select pending_5 id) (select transfers_keys id) - (select transfers_5 id).pending_5 = true + (select transfers_5 id).(= pending_5 true) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -2859,7 +2707,7 @@ (and ; Action: VoidTransfer (select pending_5 id) (select transfers_keys id) - (select transfers_5 id).pending_5 = true + (select transfers_5 id).(= pending_5 true) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -2873,7 +2721,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_5 t_from).balance >= t_amount (select accounts_5 t_from).flags_allows_overdraft) + (or (select accounts_5 t_from).(>= balance t_amount) (select accounts_5 t_from).flags_allows_overdraft) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -2884,7 +2732,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_5 replica).role = "candidate" + (select replicaState_5 replica).(= role "candidate") (< (select replicaState_5 replica).currentTerm term) (= accounts_6 accounts_5) (= transfers_6 transfers_5) @@ -2895,8 +2743,8 @@ (= leader_6 leader_5) ) (and ; Action: AppendEntry - (+ entry_index = length(log_5) 1) - term >= commitIndex_5 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_5) (= accounts_6 accounts_5) (= transfers_6 transfers_5) (= pending_6 pending_5) @@ -2924,7 +2772,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_6 t_from).balance >= t_amount (select accounts_6 t_from).flags_allows_overdraft) + (or (select accounts_6 t_from).(>= balance t_amount) (select accounts_6 t_from).flags_allows_overdraft) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -2936,7 +2784,7 @@ (and ; Action: CommitTransfer (select pending_6 id) (select transfers_keys id) - (select transfers_6 id).pending_6 = true + (select transfers_6 id).(= pending_6 true) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -2948,7 +2796,7 @@ (and ; Action: VoidTransfer (select pending_6 id) (select transfers_keys id) - (select transfers_6 id).pending_6 = true + (select transfers_6 id).(= pending_6 true) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -2962,7 +2810,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_6 t_from).balance >= t_amount (select accounts_6 t_from).flags_allows_overdraft) + (or (select accounts_6 t_from).(>= balance t_amount) (select accounts_6 t_from).flags_allows_overdraft) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -2973,7 +2821,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_6 replica).role = "candidate" + (select replicaState_6 replica).(= role "candidate") (< (select replicaState_6 replica).currentTerm term) (= accounts_7 accounts_6) (= transfers_7 transfers_6) @@ -2984,8 +2832,8 @@ (= leader_7 leader_6) ) (and ; Action: AppendEntry - (+ entry_index = length(log_6) 1) - term >= commitIndex_6 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_6) (= accounts_7 accounts_6) (= transfers_7 transfers_6) (= pending_7 pending_6) @@ -3013,7 +2861,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_7 t_from).balance >= t_amount (select accounts_7 t_from).flags_allows_overdraft) + (or (select accounts_7 t_from).(>= balance t_amount) (select accounts_7 t_from).flags_allows_overdraft) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -3025,7 +2873,7 @@ (and ; Action: CommitTransfer (select pending_7 id) (select transfers_keys id) - (select transfers_7 id).pending_7 = true + (select transfers_7 id).(= pending_7 true) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -3037,7 +2885,7 @@ (and ; Action: VoidTransfer (select pending_7 id) (select transfers_keys id) - (select transfers_7 id).pending_7 = true + (select transfers_7 id).(= pending_7 true) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -3051,7 +2899,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_7 t_from).balance >= t_amount (select accounts_7 t_from).flags_allows_overdraft) + (or (select accounts_7 t_from).(>= balance t_amount) (select accounts_7 t_from).flags_allows_overdraft) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -3062,7 +2910,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_7 replica).role = "candidate" + (select replicaState_7 replica).(= role "candidate") (< (select replicaState_7 replica).currentTerm term) (= accounts_8 accounts_7) (= transfers_8 transfers_7) @@ -3073,8 +2921,8 @@ (= leader_8 leader_7) ) (and ; Action: AppendEntry - (+ entry_index = length(log_7) 1) - term >= commitIndex_7 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_7) (= accounts_8 accounts_7) (= transfers_8 transfers_7) (= pending_8 pending_7) @@ -3102,7 +2950,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_8 t_from).balance >= t_amount (select accounts_8 t_from).flags_allows_overdraft) + (or (select accounts_8 t_from).(>= balance t_amount) (select accounts_8 t_from).flags_allows_overdraft) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -3114,7 +2962,7 @@ (and ; Action: CommitTransfer (select pending_8 id) (select transfers_keys id) - (select transfers_8 id).pending_8 = true + (select transfers_8 id).(= pending_8 true) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -3126,7 +2974,7 @@ (and ; Action: VoidTransfer (select pending_8 id) (select transfers_keys id) - (select transfers_8 id).pending_8 = true + (select transfers_8 id).(= pending_8 true) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -3140,7 +2988,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_8 t_from).balance >= t_amount (select accounts_8 t_from).flags_allows_overdraft) + (or (select accounts_8 t_from).(>= balance t_amount) (select accounts_8 t_from).flags_allows_overdraft) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -3151,7 +2999,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_8 replica).role = "candidate" + (select replicaState_8 replica).(= role "candidate") (< (select replicaState_8 replica).currentTerm term) (= accounts_9 accounts_8) (= transfers_9 transfers_8) @@ -3162,8 +3010,8 @@ (= leader_9 leader_8) ) (and ; Action: AppendEntry - (+ entry_index = length(log_8) 1) - term >= commitIndex_8 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_8) (= accounts_9 accounts_8) (= transfers_9 transfers_8) (= pending_9 pending_8) @@ -3191,7 +3039,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_9 t_from).balance >= t_amount (select accounts_9 t_from).flags_allows_overdraft) + (or (select accounts_9 t_from).(>= balance t_amount) (select accounts_9 t_from).flags_allows_overdraft) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -3203,7 +3051,7 @@ (and ; Action: CommitTransfer (select pending_9 id) (select transfers_keys id) - (select transfers_9 id).pending_9 = true + (select transfers_9 id).(= pending_9 true) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -3215,7 +3063,7 @@ (and ; Action: VoidTransfer (select pending_9 id) (select transfers_keys id) - (select transfers_9 id).pending_9 = true + (select transfers_9 id).(= pending_9 true) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -3229,7 +3077,7 @@ (select accounts_keys t_from) (select accounts_keys t_to) t_from distinct t_to - (or (select accounts_9 t_from).balance >= t_amount (select accounts_9 t_from).flags_allows_overdraft) + (or (select accounts_9 t_from).(>= balance t_amount) (select accounts_9 t_from).flags_allows_overdraft) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -3240,7 +3088,7 @@ ) (and ; Action: BecomeLeader (select replicaState_keys replica) - (select replicaState_9 replica).role = "candidate" + (select replicaState_9 replica).(= role "candidate") (< (select replicaState_9 replica).currentTerm term) (= accounts_10 accounts_9) (= transfers_10 transfers_9) @@ -3251,8 +3099,8 @@ (= leader_10 leader_9) ) (and ; Action: AppendEntry - (+ entry_index = length(log_9) 1) - term >= commitIndex_9 + (+ entry_index = (speckl_len_Int log) 1) + (>= term commitIndex_9) (= accounts_10 accounts_9) (= transfers_10 transfers_9) (= pending_10 pending_9) @@ -3277,96 +3125,19 @@ ; Property assertion: not(invariant at some step) (assert (and - (not (TransferStateConsistency_0)) - (not (TransferStateConsistency_1)) - (not (TransferStateConsistency_2)) - (not (TransferStateConsistency_3)) - (not (TransferStateConsistency_4)) - (not (TransferStateConsistency_5)) - (not (TransferStateConsistency_6)) - (not (TransferStateConsistency_7)) - (not (TransferStateConsistency_8)) - (not (TransferStateConsistency_9)) - (not (TransferStateConsistency_10)) + (not (unnamed_0)) + (not (unnamed_1)) + (not (unnamed_2)) + (not (unnamed_3)) + (not (unnamed_4)) + (not (unnamed_5)) + (not (unnamed_6)) + (not (unnamed_7)) + (not (unnamed_8)) + (not (unnamed_9)) + (not (unnamed_10)) ) ) -(define-fun TransferStateConsistency_0 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_1 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_2 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_3 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_4 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_5 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_6 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_7 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_8 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_9 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(define-fun TransferStateConsistency_10 () Bool - (and - (forall ((t Transfer)) (and t_pending implies t_posted = false t_voided = false)) - (forall ((t Transfer)) t_posted implies t_voided = false) - (forall ((t Transfer)) t_voided implies t_posted = false) - ) -) -(echo "Checking: Eventually(TransferStateConsistency)") +(echo "Checking: Eventually(unnamed)") (check-sat) (get-model) diff --git a/out/TigerBeetleLedger.specbom.spdx.json b/out/TigerBeetleLedger.specbom.spdx.json index 5541ede..96e3c00 100644 --- a/out/TigerBeetleLedger.specbom.spdx.json +++ b/out/TigerBeetleLedger.specbom.spdx.json @@ -13,7 +13,7 @@ "spdxVersion": "3.0.1", "dataLicense": "CC0-1.0", "creationInfo": { - "created": "2026-05-10T05:07:04.787Z", + "created": "2026-05-10T09:08:16.165Z", "createdBy": [ "Organization: Speckl", "tool: speckl-compile-0.2.0" diff --git a/out/ToggleSwitch.prov.jsonld b/out/ToggleSwitch.prov.jsonld index 3e8e779..5bebc1e 100644 --- a/out/ToggleSwitch.prov.jsonld +++ b/out/ToggleSwitch.prov.jsonld @@ -12,7 +12,7 @@ "@type": "prov:Generation", "prov:activity": { "@type": "prov:Activity", - "prov:startTime": "2026-05-10T05:04:07.209Z" + "prov:startTime": "2026-05-10T09:08:16.262Z" } }, "rdfs:label": "ToggleSwitch" diff --git a/out/ToggleSwitch.smt2 b/out/ToggleSwitch.smt2 index 40b1a8b..0498906 100644 --- a/out/ToggleSwitch.smt2 +++ b/out/ToggleSwitch.smt2 @@ -16,5 +16,8 @@ ) ) +; --- Invariant Assertions --- +(assert (SwitchConsistent)) + (check-sat) (get-model) diff --git a/out/ToggleSwitch.specbom.spdx.json b/out/ToggleSwitch.specbom.spdx.json index be9bd34..d2cfaab 100644 --- a/out/ToggleSwitch.specbom.spdx.json +++ b/out/ToggleSwitch.specbom.spdx.json @@ -13,7 +13,7 @@ "spdxVersion": "3.0.1", "dataLicense": "CC0-1.0", "creationInfo": { - "created": "2026-05-10T05:04:07.215Z", + "created": "2026-05-10T09:08:16.269Z", "createdBy": [ "Organization: Speckl", "tool: speckl-compile-0.2.0" diff --git a/typescript b/typescript new file mode 100644 index 0000000..ec1ec71 --- /dev/null +++ b/typescript @@ -0,0 +1,4 @@ +Script started on 2026-05-10 01:11:44-07:00 [COMMAND="sed -n '310p' compiler/src/generators/z3.ts" ] + cleanName = cleanName.replace(/\(([^)]+)\)/g, '_$1').replace(/[<>,\s]+/g, '_').replace(/__+/g, '_'); + +Script done on 2026-05-10 01:11:44-07:00 [COMMAND_EXIT_CODE="0"]