Section Completeness_Proof.
Hypothesis safe: Inter.ValidSafe.safe.
Hypothesis complete: complete.
(** A PTL is compatible with a stack if the top of the stack contains data representing to this PTL. *)
Fixpoint ptl_stack_compat {symbs word}
(stk0 : stack) (ptl : parse_tree_list symbs word) (stk : stack) : Prop :=
match ptl with
| Nil_ptl => stk0 = stk
| @Cons_ptl _ _ ptl sym _ pt =>
match stk with
| [] => False
| existT _ _ sem::stk =>
ptl_stack_compat stk0 ptl stk /\
exists e,
sem = eq_rect _ symbol_semantic_type (pt_sem pt) _ e
end
end.

(** .. and when a PTL is compatible with a stack, then calling the pop function return the semantic value of this PTL. *)
Lemma pop_stack_compat_pop_spec {A symbs word}
(ptl:parse_tree_list symbs word) (stk:stack) (stk0:stack) action :
ptl_stack_compat stk0 ptl stk ->
pop_spec symbs stk action stk0 (ptl_sem (A:=A) ptl action).