"An artice in [Quanta magazine](https://www.quantamagazine.org/150-year-old-math-design-problem-solved-20150609) mentions the following puzzle by Dudeney and popularized by Martin Gardner:\n",
"\n",
"*\"So in the spirit of Kirkman, we will leave the gentle reader with another brainteaser, a slight variation on the schoolgirl puzzle devised in 1917 by the British puzzle aficionado Henry Ernest Dudeney and later popularized by Martin Gardner: Nine prisoners are taken outdoors for exercise in rows of three, with each adjacent pair of prisoners linked by handcuffs, on each of the six weekdays (back in Dudeney’s less enlightened times, Saturday was still a weekday). Can the prisoners be arranged over the course of the six days so that each pair of prisoners shares handcuffs exactly once?\"*\n",
"\n",
"An encoding of this puzzle in B is relatively straightforward, thanks to the use of sets, sequences and permutations and universal quantification. To improve the performance, symmetry reductions were added by hand in the model below. The constant `arrange` contains the solution to our puzzle: the arrangement of the prisoners for every working day from `1` to `Days`.\n",
"\n",
"In this notebook we will create two visualizations. The first one will be a quite simple table and is defined in the `ANIMATION_FUNCTION` in the machine below. \n",
"To investigate the machine, we have to set up its constants and initialize it, with the two commands below the machine."
"Machine initialised using operation 0: $initialise_machine()"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":init"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "ProB 2",
"language": "prob",
"name": "prob2"
},
"language_info": {
"codemirror_mode": "prob2_jupyter_repl",
"file_extension": ".prob",
"mimetype": "text/x-prob2-jupyter-repl",
"name": "prob"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:markdown id: tags:
# Nine Prisoners
An artice in [Quanta magazine](https://www.quantamagazine.org/150-year-old-math-design-problem-solved-20150609) mentions the following puzzle by Dudeney and popularized by Martin Gardner:
*"So in the spirit of Kirkman, we will leave the gentle reader with another brainteaser, a slight variation on the schoolgirl puzzle devised in 1917 by the British puzzle aficionado Henry Ernest Dudeney and later popularized by Martin Gardner: Nine prisoners are taken outdoors for exercise in rows of three, with each adjacent pair of prisoners linked by handcuffs, on each of the six weekdays (back in Dudeney’s less enlightened times, Saturday was still a weekday). Can the prisoners be arranged over the course of the six days so that each pair of prisoners shares handcuffs exactly once?"*
An encoding of this puzzle in B is relatively straightforward, thanks to the use of sets, sequences and permutations and universal quantification. To improve the performance, symmetry reductions were added by hand in the model below. The constant `arrange` contains the solution to our puzzle: the arrangement of the prisoners for every working day from `1` to `Days`.
In this notebook we will create two visualizations. The first one will be a quite simple table and is defined in the `ANIMATION_FUNCTION` in the machine below.
To investigate the machine, we have to set up its constants and initialize it, with the two commands below the machine.