The dining philosophers problem is summarized as five philosophers sitting at a table doing one of two things – eating or thinking. While eating, they are not thinking, and while thinking, they are not eating. The five philosophers sit at a circular table with a large bowl of spaghetti in the center. A fork is placed in between each philosopher, and as such, each philosopher has one fork to his or her left and one fork to his or her right. As spaghetti is difficult to serve and eat with a single fork, it is assumed that a philosopher must eat with two forks. The philosopher can only use the fork on his or her immediate left or right.
The CSP Definition of Dining Philosophers:
The property interested states that every philosopher will always eventually eat, i.e., no one shall starve.
The following defintion is the Dining Philosophers example with size 3.
- assert DiningPhilosophers() |= <>e0;
- assert DiningPhilosophers() deadlockfree;
- assert DiningPhilosophers() feasible;
- assert DiningPhilosophers() |= <>e0 && <>e1 && <>e2;