I am working on an exercise where I came up with a proposition to prove but I am stuck. Hope someone and enlighten my thought.
I am defining an inductive proposition that defines subsequence relation, where the elements in first list needs to appear in the second list in order, but not necessarily consecutively.
Here is my definition:
Inductive subseq : list nat -> list nat -> Prop :=
| emptyseq : forall l, subseq [] l
| matchh : forall h l1 l2, subseq l1 l2 -> subseq (h :: l1) (h :: l2)
| nmatchh : forall h l1 l2, subseq l1 l2 -> subseq l1 (h :: l2).
and the theorem that I want to prove:
Theorem subseq_shrink : forall h l1 l2,
subseq (h :: l1) l2 -> subseq l1 l2.
basically it says a list will still be subsequence if the head is chopped off. quite intuitive, no? However, I am stuck.
following is a part of my proof:
Proof.
intros h l1 l2 H. generalize dependent h. induction l1.
- intros. apply emptyseq.
- intros h H.
the proof doesn't look good already.
1 subgoals
x : nat
l1 : list nat
l2 : list nat
IHl1 : forall h : nat, subseq (h :: l1) l2 -> subseq l1 l2
h : nat
H : subseq (h :: x :: l1) l2
______________________________________(1/1)
subseq (x :: l1) l2
that looks so clueless to me. Am I making a mistake somewhere? Which part am i missing to get stuck in this easy theorem?