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.
Proof using.
intros P Q eP eQ s1 s2 e. destruct e; simpl. unfold impl_tl.
intros PQ1 P2.
apply eQ with (Cons x s1); [constructor; assumption | idtac].
apply PQ1. apply eP with (Cons x s2).
- constructor. apply exteq_sym. assumption.
- assumption.
Qed.

Lemma extensional_not_tl :
forall (P: infseq T -> Prop),
extensional P -> extensional (~_ P).