Source: https://www.irif.fr/~emiquey/stuff/TIPE.pdf