Homotopy initial algebras in type theory