Foundations of neural networks