(* Lemma join_te_denote : forall te1 te2 id b t1, (join_te te1 te2) ! id = Some (t1, b) -> (exists b1, te1 ! id = Some (t1, b || b1)) /\ match te2 ! id with Some (t2,b2) => b = b && b2 | None => True end.  Lemma typecheck_environ_join1: forall rho Delta1 Delta2, var_types Delta1 = var_types Delta2 -> glob_types Delta1 = glob_types Delta2 ->  typecheck_environ Delta1 rho -> typecheck_environ (join_tycon Delta1 Delta2) rho. *)
Definition tycontext_evolve (Delta Delta' : tycontext) :=
(forall id, match (temp_types Delta) ! id, (temp_types Delta') ! id with
| Some t, Some t' => t=t'
| None, None => True
| _, _ => False
end)
/\ (forall id, (var_types Delta) ! id = (var_types Delta') ! id)
/\ ret_type Delta = ret_type Delta'
/\ (forall id, (glob_types Delta) ! id = (glob_types Delta') ! id)
/\ (forall id, (glob_specs Delta) ! id = (glob_specs Delta') ! id)
/\ (forall id, (annotations Delta) ! id = (annotations Delta') ! id).

(* Lemma initialized_tycontext_evolve: forall i Delta, tycontext_evolve Delta (initialized i Delta). *)
Lemma tycontext_evolve_trans: forall Delta1 Delta2 Delta3,
tycontext_evolve Delta1 Delta2 ->
tycontext_evolve Delta2 Delta3 ->
tycontext_evolve Delta1 Delta3.