Mathematical principles in photonic crystals