Factorize function calls on sorts in builds of premises