The formulation of gauge-Higgs unification with dynamical boundary conditions