I have problem with proving existential variable in list. How can I prove something like this:
Lemma exists_in_list_helper: forall (X : Type) (a : X) (P : X -> Prop),
(exists b : X, In b [a] -> P b) ->
P a.
Proof.
Admitted.
I have another question. How can I do case analysis over the values in a list (if it exists in this part of the list or not)? This is the main lemma I'm proving. Any help appreciated:
Lemma in_list: forall (X : Type) (a : X) l (P : X -> Prop),
(a :: l <> [] /\ exists b : X, In b (a :: l) -> P b) ->
(P a /\ l = []) \/
(P a /\ l <> [] /\ exists b : X, In b l -> P b) \/
(P a /\ l <> [] /\ forall b : X, In b l -> ~ P b) \/
(~ P a /\ l <> [] /\ exists b : X, In b l -> P b).
Proof.
Thanks,