A Mathematical Framework and a Suite of Learning Techniques for Neural-Symbolic Systems