induction ls; intuition; simpl in *.
inversion H; clear H; subst.
simpl.
trivial.
inversion H; clear H; subst.
simpl.
unfold arrayLookupList.
simpl.
inversion H0; clear H0; subst.
case_eq (eqb a0 a1); intuition.
case_eq (arrayLookup (pair_EqDec eqda eqdb) a (a0, b)); intuition.
eapply arrayLookup_app_Some.
trivial.
rewrite eqb_leibniz in H.
subst.
rewrite arrayLookup_app_None; intuition.
eapply arrayLookup_pair_flatten_none.
eauto.
intuition.
case_eq ( arrayLookup _ a (a0, b) ); intuition.
rewrite  arrayLookup_pair_None in H0.
discriminate.
intuition.
subst.
eapply eqb_false_iff in H.
intuition.
rewrite arrayLookup_app_None.
eapply IHls; intuition.
trivial.
Qed.

Theorem arrayLookup_pair_snd :
forall (A B C : Set)(eqda : EqDec A)(eqdb : EqDec B)(ls1 : list (A * B * C))(ls2 : list (B * C)) a b,
list_pred (fun x y => fst (fst x) = a /\ snd (fst x) = fst y /\ snd x = snd y) ls1 ls2 ->
arrayLookup _ ls1 (a, b) =
arrayLookup _ ls2 b.