Program starts by rewriting ground terms