Section subseq.
Variable A B : Type.
Hypothesis A_eq_dec : forall x y : A, {x = y} + {x <> y}.
Proof using.
induction l; simpl; tauto.
Qed.
Proof using.
induction zs; intros; simpl in *;
repeat break_match; subst; simpl in *; intuition; subst; eauto;
right; (eapply IHzs; [|eauto]); simpl; eauto.
Qed.
Proof using.
induction ys; intros.
- destruct xs; simpl in *; intuition.
- simpl in *.
break_match; simpl in *; intuition auto; subst; intuition eauto;
right; (eapply IHys; [eauto| intuition auto with datatypes]).
Qed.
Proof using.
induction ys; intros.
- destruct xs; simpl in *; intuition.
- simpl in *. invc_NoDup.
break_match.
+ constructor.
+ intuition.
subst. constructor; eauto using subseq_In.
Qed.
Proof using.
induction xs; intros; simpl.
- auto.
- repeat break_match; auto.
+ intuition congruence.
+ find_inversion. auto.
Qed.
Proof using.
induction ys; intros; simpl in *.
- repeat break_match; try discriminate; auto.
- repeat break_match; try discriminate; auto.
intuition.
+ subst. simpl in *. find_inversion. auto.
+ right. repeat find_reverse_rewrite. auto.
Qed.
Proof using.
induction ys; intros; simpl in *; intuition; break_match; eauto.
Qed.
Proof using.
induction ys; intros; simpl in *; break_match;
intuition auto with datatypes arith.
subst. simpl in *. specialize (IHys l).
concludes. auto with arith.
Qed.
Proof using.
induction xs; intros; destruct ys; simpl in *;
intuition eauto using f_equal2, subseq_cons_drop.
exfalso.
repeat find_apply_lem_hyp subseq_length.
simpl in *. lia.
Qed.
Proof using.
induction xs; intros; simpl.
- auto.
- repeat break_match; intuition congruence.
Qed.
Proof using.
destruct xs; simpl; auto.
Qed.
Proof using.
induction ys; intros; simpl in *; repeat break_match; intuition.
Qed.
Proof using.
induction ys; intros; simpl in *; repeat break_match; auto; try discriminate; intuition; subst.
- simpl. find_rewrite. auto.
- auto using subseq_skip.
- auto using subseq_nil.
- simpl. find_rewrite. auto.
Qed.
Proof using.
induction xs; intros; simpl.
+ auto using subseq_refl.
+ break_match.
* auto.
* right. auto using subseq_nil.
Qed.
Proof using.
induction ys; intros; simpl in *.
- break_match; intuition auto using subseq_refl.
- repeat break_match.
+ auto.
+ discriminate.
+ simpl in *. subst. right. auto using subseq_app_r.
+ simpl in *. find_inversion. intuition.
rewrite app_comm_cons. auto.
Qed.
Proof using.
induction xs; intros; simpl; intuition.
Qed.
Proof using.
auto using subseq_refl, subseq_skip, subseq_app_head.
Qed.

Lemma subseq_middle :
forall xs y zs,
subseq (A:=A) (xs ++ zs) (xs ++ y :: zs).