Simplify method for inferring proxy lemmas in strings (#5789)