Definition ptlz_state_compat {hole_symbs hole_word hole_sems}
(ptlz:ptl_zipper hole_symbs hole_word hole_sems)
(state:state): Prop :=
state_has_future state (ptlz_prod ptlz) hole_symbs
(projT1 (Streams.hd (ptlz_buffer ptlz))).
Fixpoint ptlz_stack_compat {hole_symbs hole_word hole_sems}
(ptlz:ptl_zipper hole_symbs hole_word hole_sems)
(stack:stack): Prop :=
ptlz_state_compat ptlz (state_of_stack init stack) /\
match ptlz with
| Non_terminal_pt_ptlz ptz =>
ptz_stack_compat ptz stack
| @Cons_ptl_ptlz _ _ sem _ _ _ _ ptlz' =>
match stack with
| [] => False
| existT _ _ sem'::stackq =>
ptlz_stack_compat ptlz' stackq /\
sem ~= sem'
end
end
with ptz_stack_compat {hole_symb hole_word hole_sem}
(ptz:pt_zipper hole_symb hole_word hole_sem)
(stack:stack): Prop :=
match ptz with
| Top_ptz => stack = []
| Cons_ptl_ptz _ ptlz' =>
ptlz_stack_compat ptlz' stack
end.

(* Specifications: *)
Lemma ptlz_stack_compat_ptlz_state_compat:
forall hole_symbs hole_word hole_sems
(ptlz:ptl_zipper hole_symbs hole_word hole_sems)
(stack:stack),
ptlz_stack_compat ptlz stack -> ptlz_state_compat ptlz (state_of_stack init stack).