Metamath Proof Explorer


Theorem derangfmla

Description: The derangements formula, which expresses the number of derangements of a finite nonempty set in terms of the factorial. The expression |_( x + 1 / 2 ) is a way of saying "rounded to the nearest integer". This is part of Metamath 100 proof #88. (Contributed by Mario Carneiro, 23-Jan-2015)

Ref Expression
Hypothesis derangfmla.d D=xFinf|f:x1-1 ontoxyxfyy
Assertion derangfmla AFinADA=A!e+12

Proof

Step Hyp Ref Expression
1 derangfmla.d D=xFinf|f:x1-1 ontoxyxfyy
2 oveq2 n=m1n=1m
3 2 fveq2d n=mD1n=D1m
4 3 cbvmptv n0D1n=m0D1m
5 1 4 derangen2 AFinDA=n0D1nA
6 5 adantr AFinADA=n0D1nA
7 hashnncl AFinAA
8 7 biimpar AFinAA
9 1 4 subfacval3 An0D1nA=A!e+12
10 8 9 syl AFinAn0D1nA=A!e+12
11 6 10 eqtrd AFinADA=A!e+12