Learning from logical constraints with lower- and upper-bound arithmetic circuits