FM-Lect12-Spring2025-Model Checking
FM-Lect12-Spring2025-Model Checking
NuSMV
purify-primal-reverb-rise
Example
• Problem: Verify that a traffic light controller never allows two conflicting green lights (e.g., North
and East) at the same time.
• NuSMV’s Role:
• Model the traffic light system as a state machine.
• Write a CTL/LTL formula like: AG !(North_Green ∧ East_Green) ("It is always false that North
and East are green simultaneously").
• NuSMV checks if this holds; if not, it produces a counterexample showing when the error
occurs.
SMV Language
SMV Language
purify-primal-reverb-rise
SMV Programs
purify-primal-reverb-rise
Example of SMV Program
purify-primal-reverb-rise
Variable declarations
purify-primal-reverb-rise
Variable examples
purify-primal-reverb-rise
Example Using integers
purify-primal-reverb-rise
State Transitions
purify-primal-reverb-rise
possible fix
Collatz Conjecture
Collatz Conjecture in SMV
Reminder: LTL Equivalence
LTLSPEC
G F (p | q) -> (q & G p);
LTLSPEC
(q & G p) -> G F (p | q);
Model to LTL
LTL Specifications
MODULE main
VAR
state : {s0, s1, s2};
p : boolean;
q : boolean;
r : boolean;
ASSIGN
init(state) := s0;
init(p) := TRUE;
init(q) := TRUE;
init(r) := FALSE;
next(state) := case
state = s0 : s1;
state = s1 : {s0, s2};
state = s2 : s2;
TRUE : state;
esac;