https://en.wikipedia.org/wiki/Patent_infringement_under_Unit...
Richard didn't apply for a patent himself, so first-to-invent is not applicable either. If he had learned of Doug's patent application, and then made an application of his own, there would have been a legitimate dispute as to priority. Since Richard shopped the library around in 2009, he might have been able to prove that he conceived the invention first. However, Doug might then have argued that Richard had abandoned, suppressed, or concealed it. See this blog post from 2005 discussing a similar hypothetical:
https://www.irmi.com/articles/expert-commentary/the-dangers-...
The technique employed by crunch was effectively a trade secret until its open source release. It's entirely possible that the patent is invalid for other reasons, but my layman's understanding of patent law is that because Richard didn't publish or patent in time, crunch can in fact infringe Doug's patent.