An Algebra of Logic Programs