(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(** Some facts and definitions about extensionality  We investigate the relations between the following extensionality principles  - Functional extensionality - Equality of projections from diagonal - Unicity of inverse bijections - Bijectivity of bijective composition  Table of contents  1. Definitions  2. Functional extensionality <-> Equality of projections from diagonal  3. Functional extensionality <-> Unicity of inverse bijections  4. Functional extensionality <-> Bijectivity of bijective composition  *)
Set Implicit Arguments.
(**********************************************************************)
(** * Definitions *)
(** Being an inverse *)
Definition is_inverse A B f g := (forall a:A, g (f a) = a) /\ (forall b:B, f (g b) = b).
(** The diagonal over A and the one-one correspondence with A *)
#[universes(template)]
Record Delta A := { pi1:A; pi2:A; eq:pi1=pi2 }.
Definition delta {A} (a:A) := {|pi1 := a; pi2 := a; eq := eq_refl a |}.
Arguments pi1 {A} _.
Arguments pi2 {A} _.
(** Functional extensionality *)
Local Notation FunctionalExtensionality :=
(forall A B (f g : A -> B), (forall x, f x = g x) -> f = g).
(** Equality of projections from diagonal *)
Local Notation EqDeltaProjs := (forall A, pi1 = pi2 :> (Delta A -> A)).
(** Unicity of bijection inverse *)
Local Notation UniqueInverse := (forall A B (f:A->B) g1 g2, is_inverse f g1 -> is_inverse f g2 -> g1 = g2).
(** Bijectivity of bijective composition *)
Definition action A B C (f:A->B) := (fun h:B->C => fun x => h (f x)).
Local Notation BijectivityBijectiveComp := (forall A B C (f:A->B) g,
is_inverse f g -> is_inverse (A:=B->C) (action f) (action g)).
(**********************************************************************)
(** * Functional extensionality <-> Equality of projections from diagonal *)
(**********************************************************************)
(** * Functional extensionality <-> Unicity of bijection inverse *)

Theorem FunctExt_iff_UniqInverse : FunctionalExtensionality <-> UniqueInverse.