The content of existence theorems in the calculus of variations has been explored and an effective treatment of semi-continuity has been achieved. An algorithm has been developed which captures the natural algorithmic content of the notion of a semi-continuous function and this is used to obtain an effective version of the “chattering lemma” of control theory and ordinary differential equations. This lemma reveals the main computational content of the theory of relaxed optimal control.