Properties
Properties are the Boolean formulas SAPLE checks against a system.
System properties#
Properties inside a system declaration are named formulas, each ending in ;. These are the properties saple analyze checks; a violated one is reported as a [PROPERTY] finding.
properties {
safety : x >= 0 ;
bounded : x <= 100 ;
}Standalone properties#
A property can also be declared at the top level with a kind. The formula sits in braces with no trailing ;:
property invariant SafetyProp {
forall (i : Int) in [0..n) . x[i] >= 0
}
property reachable GoalReached {
x == targetValue
}
property unreachable BothBlocked {
blockedA && blockedB
}
property reachable_if GoalIfEnabled {
enabled => x == targetValue
}
property trace Ordered {
sent >= received
}Property kinds#
| Kind | Intended meaning |
|---|---|
invariant | Holds in every reachable state |
reachable | Some reachable state satisfies the formula |
unreachable | No reachable state satisfies the formula |
reachable_if | Conditional reachability |
trace | A property of execution traces |
Known limitation
Standalone property declarations are parsed (and listed by saple parse), but saple analyze does not check them today. Put the properties you want checked in the properties { } block of the system.
Writing system properties#
- Safety ("nothing bad happens") — a formula that must hold, often with
foralland=>or!. - Mutual exclusion —
forallover pairs with!(A && B). - Deadlock freedom —
existsover an enabledness condition.
Security use: a pattern states a bad behavior directly as a signature and a constraint; see Vulnerability Patterns.