The Logic And Mathematics Behind Neural Networks