proposition: Lemma find_last_ok : forall l p, find_last l = Some p -> exists el, nth_error l p = Some el /\ P el.
proof: Proof. induction l. inversion 1. simpl. destruct (P_dec a). intros q q0. destruct q. exists a; split; trivial. destruct (IHl q) as [el [lq Pel]]. destruct (find_last l); inversion q0; trivial. exists el; split; trivial. intros q q0. destruct q. destruct (find_last l); discr. destruct (IHl q) as [el [lq Pel]]. destruct (find_last l); inversion q0; trivial. exists el; split; trivial. Qed.
imports: Coq(Permutation Setoid) CoLoR(NatUtil LogicUtil)