Formal Structure of Electromagnetics