§ 5.1 · C · assert + CBMC
C
assert is the law inside one state; the checker supplies time.
In C the property you can write down is the assert: a boolean that must hold every time control passes it. That is exactly one slice of G !bad — safety, locally, with no mention of time.
Time comes from the checker. CBMC replaces every nondet function with all its possible values and unrolls loops to a bound — the same move as bounding the lasso search: an exhaustive answer within a depth, labelled incomplete beyond it.
assert(next(s) is well-formed) — a state invariant, checked at every step
G (coin -> F dispense)/* vend.c — assert is the safety oracle; liveness lives in the model. */
#include <assert.h>
#include <limits.h>
enum { IDLE, PAID, VEND };
extern int coin(void); /* nondet: CBMC explores every resolution */
int vend_step(int s) {
if (s == IDLE && coin()) return PAID;
if (s == PAID) return VEND; /* dispense */
return IDLE;
}
int main(void) {
int s = IDLE;
for (int i = 0; i < 8; i++) {
s = vend_step(s);
assert(s >= IDLE && s <= VEND); /* cbmc vend.c --unwind 8 */
}
}model_checkview the JSON-RPC body · POST to /api/mcp
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "model_check",
"arguments": {
"formula": "G (coin -> F dispense)",
"model": {
"atoms": [
"ready",
"coin",
"dispense"
],
"initial": [
"idle"
],
"states": [
{
"id": "idle",
"atoms": [
"ready"
],
"next": [
"paid"
]
},
{
"id": "paid",
"atoms": [
"coin"
],
"next": [
"vend"
]
},
{
"id": "vend",
"atoms": [
"dispense"
],
"next": [
"idle"
]
}
]
}
}
}
}read_skills_guideAn agent fixing C starts here: the guide's Step 3 explains that a bounded CBMC run may only be quoted as incomplete, never as pass — the honesty rules are the same ones CBMC's --unwind obeys.
check_ltlCBMC's counterexample is a trace of states; hand it to check_ltl and the truth table shows exactly which step breaks the LTL reading of the property — a ready-made regression assertion.
model_checkassert cannot even state the liveness half (F dispense). Agents translate the state machine into the artifact JSON and let model_check answer what unrolling loops cannot say.
assert covers safety only — G !bad. F response, precedence (U), fairness: take the artifact to the model checker.
--unwind 8 is a depth bound — CBMC's verdict is honest the same way ours is: violation found is real, nothing-found is unknown, not proof.
Static analyzers (frama-c, infer) do the abstraction for you; the model checker is the exact end of that spectrum.
field guide · Bounded model checking · Model checking