N Queens

Formulation of the N-queens problem and an iterative algorithm to solve the problem in TLA+. Since there must be exactly one queen in every row we represent placements of queens as functions of the form queens \in [ 1..N -> 1..N ] where queens[i] gives the column of the queen in row i. Note that such a function is just a sequence of length N. We will also consider partial solutions, also represented as sequences of length \leq N.