Recent developments in decoding Tanner codes with maximum-likelihood certificates are based on a sufficient condition called local optimality. We define hierarchies of locally optimal codewords with respect to two parameters. One parameter is related to the minimum distance of the local codes in Tanner codes. The second parameter is related to the finite number of iterations used in iterative decoding. We show that these hierarchies satisfy inclusion properties as these parameters are increased. In particular, this implies that a codeword that is decoded with a certificate using an iterative decoder after h iterations is decoded with a certificate after k·h iterations, for every integer k.