Fixpoint state_ref_ok_check (s : state) : preDTA -> bool :=
fun d : preDTA =>
match s with
| M0 => true
| M1 a p => prec_list_ref_ok_check p d
| M2 x y => state_ref_ok_check x d && state_ref_ok_check y d
end.

Lemma state_ref_ok_check_correct :
forall (s : state) (d : preDTA),
state_ref_ok s d -> state_ref_ok_check s d = true.