If we read a variable or constant, then we push it on the stack. If we read a function symbol for a function of arity k, then we pop k terms from the stack, form the new term using the function symbol, and push it on the stack again.
Since the whole procedure was deterministic, it is pretty obvious that the string of symbols uniquely determines the resulting terms. For if not, suppose that we perform the procedure two times, and would end up with a differnt stack as results. Initially, both procedures start with an empty stack, so both stacks are identically initially. The induction hypothe…