add algorithm formalization