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
(************************************************************************)
8
(* $Id: Combinators.v 11709 2008-12-20 11:42:15Z msozeau $ *)
10
(** Proofs about standard combinators, exports functional extensionality.
12
Author: Matthieu Sozeau
13
Institution: LRI, CNRS UMR 8623 - UniversitÃcopyright Paris Sud
14
91405 Orsay, France *)
16
Require Import Coq.Program.Basics.
17
Require Export FunctionalExtensionality.
19
Open Scope program_scope.
21
(** Composition has [id] for neutral element and is associative. *)
23
Lemma compose_id_left : forall A B (f : A -> B), id ∘ f = f.
27
symmetry. apply eta_expansion.
30
Lemma compose_id_right : forall A B (f : A -> B), f ∘ id = f.
34
symmetry ; apply eta_expansion.
37
Lemma compose_assoc : forall A B C D (f : A -> B) (g : B -> C) (h : C -> D),
38
h ∘ g ∘ f = h ∘ (g ∘ f).
44
Hint Rewrite @compose_id_left @compose_id_right : core.
45
Hint Rewrite <- @compose_assoc : core.
47
(** [flip] is involutive. *)
49
Lemma flip_flip : forall A B C, @flip A B C ∘ flip = id.
53
extensionality x ; extensionality y ; extensionality z.
57
(** [prod_curry] and [prod_uncurry] are each others inverses. *)
59
Lemma prod_uncurry_curry : forall A B C, @prod_uncurry A B C ∘ prod_curry = id.
62
unfold prod_uncurry, prod_curry, compose.
63
extensionality x ; extensionality y ; extensionality z.
67
Lemma prod_curry_uncurry : forall A B C, @prod_curry A B C ∘ prod_uncurry = id.
70
unfold prod_uncurry, prod_curry, compose.
71
extensionality x ; extensionality p.
72
destruct p ; simpl ; reflexivity.