A derangement is a permutation of elements of a set where no element is mapped to itself (i.e. the permutation has no fixed points).
The number of derangements of a set of size
The files in this repository formalize the proof of the above formula in Coq. Verify them in this order:
coqc drmcorrect.v
coqc drmnodup.v
coqc drmcomplete.v
coqc drmformula.v
The proof is based on a function drm_construct
, which constructs all derangements of size drmformula.v
.