Lemma reduce_step_invariant (stack:stack) (prod:production): forall word buffer, word_has_stack_semantics word stack -> match reduce_step init stack prod buffer with | OK (Accept_sr sem buffer_new) => buffer = buffer_new /\ inhabited (parse_tree (NT (start_nt init)) word sem) | OK (Progress_sr stack_new buffer_new) => buffer = buffer_new /\ word_has_stack_semantics word stack_new | Err | OK Fail_sr => True end.