Library TLC.LibOperation
Section Definitions.
Variables (A : Type).
Implicit Types f g : A -> A -> A.
Implicit Types i : A -> A.
Associativity
Combined associativity commutativity
comm distributivity of unary operator
Left distributivity
Right distributivity
Right Neutral
Left Absorbant
Right Absorbant
Idempotence
Idempotence
Idempotence for binary operators
Self Neutral
Right Inverse
Left Inverse function -- todo arguments in order f i e ?
Right Inverse function
Self Inverse
Definition morphism (A B : Type) (h : A->B) (f : A->A->A) (g : B->B->B) :=
forall x y, h (f x y) = g (h x) (h y).
Auto-morphism
Section OpProperties.
Variables (A : Type).
Implicit Types h : A -> A.
Implicit Types f g : A -> A -> A.
Lemma idempotent_inv : forall h x y,
idempotent h ->
y = h x ->
h y = y.
Proof using. intros. subst*. Qed.
For comm operators, right-properties can be derived from
corresponding left-properties
Lemma neutral_r_of_comm_neutral_l : forall f e,
comm f ->
neutral_l f e ->
neutral_r f e.
Proof using. introv C N. intros_all. rewrite* C. Qed.
Lemma inverse_r_of_comm_inverse_l : forall f e i,
comm f ->
inverse_l f e i ->
inverse_r f e i.
Proof using. introv C I. intros_all. rewrite* C. Qed.
Lemma distrib_r_of_comm_distrib_l : forall f g,
comm f ->
distrib_l f g ->
distrib_r f g.
Proof using.
introv C N. intros_all. unfolds distrib_l.
do 3 rewrite <- (C x). auto.
Qed.
Lemma comm_assoc_of_comm_and_assoc : forall f,
comm f ->
assoc f ->
comm_assoc f.
Proof using.
introv C S. intros_all. rewrite C.
rewrite <- S. rewrite~ (C x).
Qed.
End OpProperties.