Luminescence of Pr, Nd and Yb ions implanted in GaAs and GaP