Homological perturbation theory and the algebraic structure of the antifield-antibracket formalism for gauge theories