Discrete gauge symmetries and the origin of baryon and lepton number conservation in supersymmetric versions of the standard model