Brendan Ang

Search

Search IconIcon to open search

NuSMV

Last updated Apr 12, 2023 Edit Source

# NuSMV

# Vending Machine Example

What we want to model:

# Properties

# Iteration 1

Livelock where we make a choice and cancel:

# Iteration 2

Deadlock where we make a payment when no choice is made

# Iteration 3

We want to accept payment only when choice is made. Introduce new variable acc_payment which is TRUE only if expect payment and payment are true. Deadlock because acc_payment can be set to TRUE even when we cancel our choice:

# Pitfalls

Case statement must be exhaustive:

# Modules

# Operators

# next()

# Ferryman Problem Example

We can find the solution by negative the property we want to hold, reach the solution while property is false. Model checker can then find a counter example where we reach the solution while property is true:

# Bridge and Torch Problem

# Model

# Transitions

# Modelling Concurrent Programs

# Ensuring fairness

running is a property created by the process keyword internally which indicates which process is running.

Process 2 is always selected by this model “scheduler”. This is unfair trace which can be forbidden using the keyword FAIRNESS running;

# No bounded waiting

Process 1 and 2 alternate between each other but process 2 acquires the semaphore each time before process 1 is able to do so.