# Proper instances for propositional connectives.

Author: Matthieu Sozeau Institution: LRI, CNRS UMR 8623 - University Paris Sud

Require Import Coq.Classes.Morphisms.
Require Import Coq.Program.Basics.
Require Import Coq.Program.Tactics.

Standard instances for not, iff and impl.
Logical negation.

Program Instance not_impl_morphism :
Proper (impl --> impl) not | 1.

Program Instance not_iff_morphism :
Proper (iff ++> iff) not.

Logical conjunction.

Program Instance and_impl_morphism :
Proper (impl ==> impl ==> impl) and | 1.

Program Instance and_iff_morphism :
Proper (iff ==> iff ==> iff) and.

Logical disjunction.

Program Instance or_impl_morphism :
Proper (impl ==> impl ==> impl) or | 1.

Program Instance or_iff_morphism :
Proper (iff ==> iff ==> iff) or.

Logical implication impl is a morphism for logical equivalence.
Morphisms for quantifiers

Program Instance ex_iff_morphism {A : Type} : Proper (pointwise_relation A iff ==> iff) (@ex A).

Program Instance ex_impl_morphism {A : Type} :
Proper (pointwise_relation A impl ==> impl) (@ex A) | 1.

Program Instance ex_flip_impl_morphism {A : Type} :
Proper (pointwise_relation A (flip impl) ==> flip impl) (@ex A) | 1.

Program Instance all_iff_morphism {A : Type} :
Proper (pointwise_relation A iff ==> iff) (@all A).

Program Instance all_impl_morphism {A : Type} :
Proper (pointwise_relation A impl ==> impl) (@all A) | 1.

Program Instance all_flip_impl_morphism {A : Type} :
Proper (pointwise_relation A (flip impl) ==> flip impl) (@all A) | 1.

Equivalent points are simultaneously accessible or not

Instance Acc_pt_morphism {A:Type}(E R : A->A->Prop)
`(Equivalence _ E) `(Proper _ (E==>E==>iff) R) :
Proper (E==>iff) (Acc R).

Equivalent relations have the same accessible points
Equivalent relations are simultaneously well-founded or not