Definition next_ptd (ptd:pt_dot): option pt_dot :=
match ptd with
| Shift_ptd term sem ptl ptlz =>
Some (build_pt_dot ptl (Cons_ptl_ptlz (Terminal_pt term sem) ptlz))
| Reduce_ptd ptlz =>
let 'existT _ _ (existT _ _ (ptz, pt)) := pop_ptlz Nil_ptl ptlz in
match ptz in pt_zipper sym _ _ return parse_tree sym _ _ -> _ with
| Top_ptz => fun pt => None
| Cons_ptl_ptz ptl ptlz' =>
fun pt => Some (build_pt_dot ptl (Cons_ptl_ptlz pt ptlz'))
end pt
end.

Lemma reduce_step_next_ptd:
forall (ptlz:ptl_zipper [] [] ()) (stack:stack),
ptlz_stack_compat ptlz stack ->
match reduce_step init stack (ptlz_prod ptlz) (ptlz_buffer ptlz) with
| OK Fail_sr =>
False
| OK (Accept_sr sem buffer) =>
sem = full_sem /\ buffer = buffer_end /\ next_ptd (Reduce_ptd ptlz) = None
| OK (Progress_sr stack buffer) =>
match next_ptd (Reduce_ptd ptlz) with
| None => False
| Some ptd =>
ptd_stack_compat ptd stack /\ buffer = ptd_buffer ptd
end
| Err =>
True
end.