Source: https://www.iro.umontreal.ca/~mignotte/IFT2425/Introduction_IFT2425.pdf