Section sec_exteq_congruence.
Variable T: Type.
(* All useful predicates are extensional in the following sense *)
Definition extensional (P: infseq T -> Prop) :=
forall s1 s2, exteq s1 s2 -> P s1 -> P s2.
Proof using.
intros s1 s2 eq; auto.
Qed.
Proof using.
intros s1 s2 eq; auto.
Qed.
Proof using.
intros P Q eP eQ s1 s2 e. destruct e; simpl. unfold and_tl. intuition.
- apply eP with (Cons x s1); [constructor; assumption | assumption].
- apply eQ with (Cons x s1); [constructor; assumption | assumption].
Qed.
Proof using.
intros P Q eP eQ s1 s2 e. destruct e; simpl. unfold or_tl. intuition.
- left; apply eP with (Cons x s1); [constructor; assumption | assumption].
- right; apply eQ with (Cons x s1); [constructor; assumption | assumption].
Qed.

Lemma extensional_impl_tl :
forall (P Q: infseq T -> Prop),
extensional P -> extensional Q -> extensional (P ->_ Q).