1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(*i $Id: Permut.v 10616 2008-03-04 17:33:35Z letouzey $ i*)
13
(** We consider a Set [U], given with a commutative-associative operator [op],
14
and a congruence [cong]; we show permutation lemmas *)
16
Section Axiomatisation.
19
Variable op : U -> U -> U.
20
Variable cong : U -> U -> Prop.
22
Hypothesis op_comm : forall x y:U, cong (op x y) (op y x).
23
Hypothesis op_ass : forall x y z:U, cong (op (op x y) z) (op x (op y z)).
25
Hypothesis cong_left : forall x y z:U, cong x y -> cong (op x z) (op y z).
26
Hypothesis cong_right : forall x y z:U, cong x y -> cong (op z x) (op z y).
27
Hypothesis cong_trans : forall x y z:U, cong x y -> cong y z -> cong x z.
28
Hypothesis cong_sym : forall x y:U, cong x y -> cong y x.
30
(** Remark. we do not need: [Hypothesis cong_refl : (x:U)(cong x x)]. *)
33
forall x y z t:U, cong x y -> cong z t -> cong (op x z) (op y t).
35
intros; apply cong_trans with (op y z).
36
apply cong_left; trivial.
37
apply cong_right; trivial.
40
Lemma comm_right : forall x y z:U, cong (op x (op y z)) (op x (op z y)).
42
intros; apply cong_right; apply op_comm.
45
Lemma comm_left : forall x y z:U, cong (op (op x y) z) (op (op y x) z).
47
intros; apply cong_left; apply op_comm.
50
Lemma perm_right : forall x y z:U, cong (op (op x y) z) (op (op x z) y).
53
apply cong_trans with (op x (op y z)).
55
apply cong_trans with (op x (op z y)).
56
apply cong_right; apply op_comm.
57
apply cong_sym; apply op_ass.
60
Lemma perm_left : forall x y z:U, cong (op x (op y z)) (op y (op x z)).
63
apply cong_trans with (op (op x y) z).
64
apply cong_sym; apply op_ass.
65
apply cong_trans with (op (op y x) z).
66
apply cong_left; apply op_comm.
70
Lemma op_rotate : forall x y z t:U, cong (op x (op y z)) (op z (op x y)).
72
intros; apply cong_trans with (op (op x y) z).
73
apply cong_sym; apply op_ass.
77
(** Needed for treesort ... *)
79
forall x y z t:U, cong (op x (op (op y z) t)) (op (op y (op x t)) z).
82
apply cong_trans with (op x (op (op y t) z)).
83
apply cong_right; apply perm_right.
84
apply cong_trans with (op (op x (op y t)) z).
85
apply cong_sym; apply op_ass.
86
apply cong_left; apply perm_left.
b'\\ No newline at end of file'