MACHINE tictac

ABSTRACT_VARIABLES  square, turn

INVARIANT  

	turn:(0..1)
&
	square:( (1..3) * (1..3) ) +-> (0..1) 

DEFINITIONS
 GOAL ==
       /* use model checking to find a trace leading to : */
	not(	(1|->1)|->0 : square &
		(2|->2)|->0 : square &
		(3|->3)|->0 : square   )



INITIALISATION turn,square := 0,{}

OPERATIONS

  place0(xx,yy) =
	PRE 
		turn = 0 &
		xx:(1..3) & yy:(1..3) &
		xx|->yy /: dom(square)
	THEN 
		square(xx|->yy) := 0 ||
		turn := 1
	END ;

  place1(xx,yy) =
	PRE
		turn = 1 &
		xx:(1..3) & yy:(1..3) &
		xx|->yy /: dom(square)
	THEN 
		square(xx|->yy) := 1  ||
		turn:=0
	END

END


