Ab-initio theory of polar semiconductor surfaces: I. Methodology and the (2 x 2)reconstructions of GaAs(111)