Syntax Quick Reference
Top-level declarations#
This file parses as it stands:
type Color = { RED, GREEN, BLUE } ;
datatype Slot = Empty | Full(value: BV<64>) ;
regset scratch = { X1..X3, NZCV } ;
transition step(p : Int, w : BV<64>) {
guard: p >= 0 ;
modifies: x ;
effect: let t = x + p ;
x := t ;
if (t > 10) then { y := 1 ; } else { y := 0 ; } ;
for (j : Int) in [0..3) { arr[j] := 0 ; } ;
for 2 times { x += 1 ; } ;
atomic { x -= 1 ; } ;
havoc(scratch) ;
havoc(z) with { z >= 0 } ;
Memory<8>(w) := X1 ;
}
agent Worker(id : Int) {
attributes { busy : Bool = false ; }
process {
B0 = step(id, 0x0:BV<64>) . B1 + done ;
B1 = branch x == 0
taken: step(id, 0x1:BV<64>) . unexplored
observed fall: step(id, 0x2:BV<64>) . B0 ;
}
invariants { B0 : x >= 0 ; }
}
schema Env {
attributes {
x, y, z : Int = 0 ;
arr : Array(Int, 3) ;
X1..X3 : BV<64> ;
N, Z, C, V : BV<1> = 0x0:BV<1> ;
Memory : Array(BV<64>, BV<8>) ;
X1 = 0x10:BV<64> ;
}
invariants { x >= 0 ; }
}
system S {
schema: Env ;
agents { Worker(i) * 2 ; }
init { x == 0 ; }
properties { safety : x >= 0 ; }
}
property invariant NonNegative { x >= 0 }
pattern stepTwice {
signature { step(p1, w1) . step(p2, w2) . done }
constraints { p1 != p2 }
severity: MEDIUM ;
}
canonizer Norm for Int { apply(rules: Simplify, strategy: bottomUp) ; }include "file.spl" lines are expanded by saple analyze and saple compose only. rules declarations cannot be written today; see Rules & Canonizers.
Behavior operators#
| Syntax | Meaning |
|---|---|
a(args) . P | Prefix |
P1 + P2 | Choice |
P1 || P2 | Parallel |
(P) * | Iteration |
[cond] P | Guard |
atomic { a . b . P } | Atomic prefix chain |
branch c taken: … observed fall: … | Observed conditional branch |
done, 0, Bottom, Bottom(via=R), unexplored | Terminals |
Effect statements#
x := e ; x += e ; x -= e ;
arr[i] := e ; node.f := e ; Agent(i).f := e ; Memory<N>(a) := e ;
skip ;
let name = e ;
if (c) then { … } else { … } ;
for (j : Int) in [lo..hi) { … } ;
for n times { … } ;
atomic { … } ;
havoc(x) ; havoc(x) with { c } ; havoc(a, b, Memory) ; havoc(X1..X3) ; havoc(NZCV) ;Types#
Int, Real, Bool, String/Str, Void, BV<N>, QWord, DWord, Word, Byte, Bits(N), Set(T), Array(T, n), Array(K, V), Queue(T), enumeration and datatype names.