Set Bullet Behavior "Strict Subproofs".
Set Implicit Arguments.
Definition first :=
fun (A B C D  E: Prop) (p : A /\ B /\ C /\ D /\ E) =>
match p with
| conj H _ => H
end.
Definition second :=
fun (A B C D E : Prop) (p : A /\ B /\ C /\ D /\ E) =>
match p with
| conj _ (conj H _) => H
end.
Definition third :=
fun (A B C D E : Prop) (p : A /\ B /\ C /\ D /\ E) =>
match p with
| conj _ (conj _ (conj H _)) => H
end.
Definition fourth :=
fun (A B C D E : Prop) (p : A /\ B /\ C /\ D /\ E) =>
match p with
| conj _ (conj _ (conj _ (conj H _))) => H
end.
Definition fifth :=
fun (A B C D E : Prop) (p : A /\ B /\ C /\ D /\ E) =>
match p with
| conj _ (conj _ (conj _ (conj _ H))) => H
end.
(* ------------------------------------- *)
(* -------------------------------------- *)
intros. induction G. simpl in H. inversion H.
destruct a0 as [x0 s0].
simpl in H.
apply binds_cons_iff in H. destruct H. destruct H. subst.
exists s0. auto.
apply IHG in H. destruct H as [s' [ EQ B]].
exists s'. auto.
Qed.
(* -------------------------------------- *)

Lemma binds_cases: forall G F x A y B,
uniq (F ++ [(y, B)] ++ G) ->
@binds sort x A (F ++ [(y, B)] ++ G) ->
(binds x A F /\ x <> y /\ x `notin` dom G) \/ (x = y /\ A = B) \/ (binds x A G /\ x <> y /\ x `notin` dom F).