Definition insert_main_ostate (d : preDTA) (o : option state) : DTA :=
  insert_main_ostate_0 d (new_preDTA_ad d) o.Definition union_opt_state (o0 o1 : option state) : 
  option state :=
  match o0, o1 with
  | None, None => None
  | None, Some s1 => Some s1
  | Some s0, None => Some s0
  | Some s0, Some s1 => Some (union_mpl s0 s1)
  end.Definition union_0 (d : preDTA) (a0 a1 : ad) : option state :=
  union_opt_state (MapGet state d (uad_conv_0 a0))
    (MapGet state d (uad_conv_1 a1)).Definition union_1 (d : preDTA) (a0 a1 : ad) : DTA :=
  insert_main_ostate d (union_0 d a0 a1).Definition union (dt0 dt1 : DTA) : DTA :=
  match dt0, dt1 with
  | dta d0 a0, dta d1 a1 => union_1 (u_merge d0 d1) a0 a1
  end.

(* Specifications: *)
Lemma union_semantics_0 : forall (d0 d1 : DTA) (t : term), DTA_main_state_correct d0 -> DTA_main_state_correct d1 -> DTA_ref_ok d0 -> DTA_ref_ok d1 -> DTA_compat d0 d1 -> (reconnait d0 t \/ reconnait d1 t <-> reconnait (union d0 d1) t).
Lemma union_semantics : forall (d0 d1 : DTA) (sigma : signature) (t : term), DTA_main_state_correct d0 -> DTA_main_state_correct d1 -> DTA_ref_ok d0 -> DTA_ref_ok d1 -> dta_correct_wrt_sign d0 sigma -> dta_correct_wrt_sign d1 sigma -> (reconnait d0 t \/ reconnait d1 t <-> reconnait (union d0 d1) t).