(* insertion d'un état *)

Definition insert_state (d : preDTA) (a : ad) (s : state) : preDTA :=
  MapPut state d a s.Definition insert_main_state_0 (d : preDTA) (a : ad) 
  (s : state) : DTA := dta (insert_state d a s) a.Definition insert_main_state (d : preDTA) (s : state) : DTA :=
  insert_main_state_0 d (new_preDTA_ad d) s.Definition insert_ostate (d : preDTA) (a : ad) (o : option state) : preDTA :=
  match o with
  | None => d
  | Some s => MapPut state d a s
  end.Definition insert_main_ostate_0 (d : preDTA) (a : ad) 
  (o : option state) : DTA := dta (insert_ostate d a o) a.

Lemma insert_ostate_5 : forall (d0 d1 : preDTA) (a0 a1 a : ad) (s0 s1 s0' s1' : state) (t : term), mpl_compat s0' s1' -> MapGet state d0 a0 = Some s0 -> MapGet state d1 a1 = Some s1 -> MapGet state (u_merge d0 d1) (uad_conv_0 a0) = Some s0' -> MapGet state (u_merge d0 d1) (uad_conv_1 a1) = Some s1' -> preDTA_ref_ok (u_merge d0 d1) -> MapGet state (u_merge d0 d1) a = None -> a <> uad_conv_0 a0 -> a <> uad_conv_1 a1 -> (state_reconnait (insert_ostate (u_merge d0 d1) a (Some (union_mpl s0' s1'))) (union_mpl s0' s1') t <-> state_reconnait (insert_ostate (u_merge d0 d1) a (Some (union_mpl s0' s1'))) s0' t \/ state_reconnait (insert_ostate (u_merge d0 d1) a (Some (union_mpl s0' s1'))) s1' t).