We present a scheme for translating logic programs, which may use aggregation\nand arithmetic, into algebraic expressions that denote bag relations over\nground terms of the Herbrand universe. To evaluate queries against these\nrelations, we develop an operational semantics based on term rewriting of the\nalgebraic expressions. This approach can exploit arithmetic identities and\nrecovers a range of useful strategies, including lazy strategies that defer\nwork until it becomes possible or necessary.\n