A large-deviation theorem for tree-indexed Markov chains