Foundation of electromagnetic theory