Verifying inverse functions by composition