proposition: Lemma nth_error_almost_id : forall A n l l' (a1 a2 : A), nth_error (l ++ a1 :: l') n = nth_error (l ++ a2 :: l') n \/ (nth_error (l ++ a1 :: l') n = Some a1 /\ nth_error (l ++ a2 :: l') n = Some a2).
proof: Proof. fix nth_error_almost_id 2. intros A [ | n] l l' a1 a2; case l; clear l; simpl. right; split; reflexivity. intro a; left; reflexivity. left; reflexivity. intros _ l; apply (nth_error_almost_id A n). Qed.
imports: Coq(Bool List Arith Setoid Relations FunInd) CoLoR(closure)