Foundations of Trustworthy AI