Bridging the gap between learning and reasoning