Grounding Neural Inference with Satisfiability Modulo Theories