(* calcul des automates modifiés *)

Fixpoint upl_conv_0 (p : prec_list) : prec_list :=
  match p with
  | prec_empty => prec_empty
  | prec_cons a p0 p1 =>
      prec_cons (uad_conv_0 a) (upl_conv_0 p0) (upl_conv_0 p1)
  end.Fixpoint upl_conv_1 (p : prec_list) : prec_list :=
  match p with
  | prec_empty => prec_empty
  | prec_cons a p0 p1 =>
      prec_cons (uad_conv_1 a) (upl_conv_1 p0) (upl_conv_1 p1)
  end.Fixpoint umpl_conv_0 (s : state) : state :=
  match s with
  | M0 => M0 prec_list
  | M1 a p => M1 prec_list a (upl_conv_0 p)
  | M2 p0 p1 => M2 prec_list (umpl_conv_0 p0) (umpl_conv_0 p1)
  end.Fixpoint umpl_conv_1 (s : state) : state :=
  match s with
  | M0 => M0 prec_list
  | M1 a p => M1 prec_list a (upl_conv_1 p)
  | M2 p0 p1 => M2 prec_list (umpl_conv_1 p0) (umpl_conv_1 p1)
  end.Fixpoint udta_conv_0_aux (d : preDTA) : preDTA :=
  match d with
  | M0 => M0 state
  | M1 a s => M1 state a (umpl_conv_0 s)
  | M2 s0 s1 => M2 state (udta_conv_0_aux s0) (udta_conv_0_aux s1)
  end.Fixpoint udta_conv_1_aux (d : preDTA) : preDTA :=
  match d with
  | M0 => M0 state
  | M1 a s => M1 state a (umpl_conv_1 s)
  | M2 s0 s1 => M2 state (udta_conv_1_aux s0) (udta_conv_1_aux s1)
  end.Definition udta_conv_0 (d : preDTA) : preDTA :=
  M2 state (udta_conv_0_aux d) (M0 state).Definition udta_conv_1 (d : preDTA) : preDTA :=
  M2 state (M0 state) (udta_conv_1_aux d).

Lemma u_conv_0_invar_1 : forall (s : state) (c : ad) (p : prec_list), MapGet prec_list s c = Some p -> MapGet prec_list (umpl_conv_0 s) c = Some (upl_conv_0 p).