Theory and applications of sheaf theory