I am trying to prove the following theorem
Theorem subseq_subset : forall l1 l2, subseq l1 l2 -> sublist l1 l2.
with the inductive type subseq :
Inductive subseq {A:Type} : list A -> list A -> Prop :=
| SubNil : forall (l:list A), subseq nil l
| Sub_both : forall (s l:list A) (x:A), subseq s l -> subseq s (x::l)
| Sub_right : forall (s l: list A) (x:A), subseq s l -> subseq (x::s) (x::l).
and the definition of sublist:
Definition sublist (l1 l2 : list A) : Prop := forall x : A, In x l1 -> In x l2.
this is the proof i started to do
Theorem subseq_subset : forall l1 l2, subseq l1 l2 -> sublist l1 l2.
Proof.
intros.
unfold sublist. intros.
induction l2.
+ inversion H in H0. simpl. simpl in H0. assumption.
+ apply in_cons. apply IHl2.
Qed.
i have this context now
1 subgoals
l1 : list A
a : A
l2 : list A
H : subseq l1 (a :: l2)
x : A
H0 : In x l1
IHl2 : subseq l1 l2 -> In x l2
______________________________________(1/1)
subseq l1 l2
i thought to apply sub_right on H so i can end the proof with assumption but apply sub_right in H
is not working. Is this possible? and how can i end this proof?
Thanks.