Mathematical foundations for error estimation in numerical solutions of integral equations in electromagnetics