The arithmetic agrees on 4 tons, but there's an awkward discrepancy between the 40 mm depth you want and the 20 mm gravel size you're getting. After the first layer on the ground, a complete second layer will settle into its gaps, so it will only be about 33 mm, but would still need a bit more than 3 tons. Then with 5 tons you would have enough for a third layer in the gaps of the second, but that would increase the depth to about 50 mm. Maybe you should think about the next smaller size of gravel so that your 4 tons will spread evenly and give you the depth you want.