Infer recursive SMT sort information at compile-time