A Theoretical Perspective for Speculative Decoding Algorithm