2014-08-12 00:35:25 +00:00
|
|
|
-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
-- Author: Jeremy Avigad
|
|
|
|
-- Ported from Coq HoTT
|
|
|
|
import .path
|
2014-09-09 20:20:04 +00:00
|
|
|
open path
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
-- Equivalences
|
|
|
|
-- ------------
|
|
|
|
|
2014-09-17 21:39:05 +00:00
|
|
|
definition Sect {A B : Type} (s : A → B) (r : B → A) := Πx : A, r (s x) ≈ x
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
-- -- TODO: need better means of declaring structures
|
|
|
|
-- -- TODO: note that Coq allows projections to be declared to be coercions on the fly
|
|
|
|
|
|
|
|
-- Structure IsEquiv
|
|
|
|
|
|
|
|
inductive IsEquiv {A B : Type} (f : A → B) :=
|
2014-08-22 22:46:10 +00:00
|
|
|
IsEquiv_mk : Π
|
2014-08-12 00:35:25 +00:00
|
|
|
(equiv_inv : B → A)
|
|
|
|
(eisretr : Sect equiv_inv f)
|
|
|
|
(eissect : Sect f equiv_inv)
|
|
|
|
(eisadj : Πx, eisretr (f x) ≈ ap f (eissect x)),
|
|
|
|
IsEquiv f
|
|
|
|
|
|
|
|
definition equiv_inv {A B : Type} {f : A → B} (H : IsEquiv f) : B → A :=
|
2014-09-04 22:03:59 +00:00
|
|
|
IsEquiv.rec (λequiv_inv eisretr eissect eisadj, equiv_inv) H
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
-- TODO: note: does not type check without giving the type
|
|
|
|
definition eisretr {A B : Type} {f : A → B} (H : IsEquiv f) : Sect (equiv_inv H) f :=
|
2014-09-04 22:03:59 +00:00
|
|
|
IsEquiv.rec (λequiv_inv eisretr eissect eisadj, eisretr) H
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
definition eissect {A B : Type} {f : A → B} (H : IsEquiv f) : Sect f (equiv_inv H) :=
|
2014-09-04 22:03:59 +00:00
|
|
|
IsEquiv.rec (λequiv_inv eisretr eissect eisadj, eissect) H
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
definition eisadj {A B : Type} {f : A → B} (H : IsEquiv f) :
|
|
|
|
Πx, eisretr H (f x) ≈ ap f (eissect H x) :=
|
2014-09-04 22:03:59 +00:00
|
|
|
IsEquiv.rec (λequiv_inv eisretr eissect eisadj, eisadj) H
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
-- Structure Equiv
|
|
|
|
|
|
|
|
inductive Equiv (A B : Type) : Type :=
|
2014-08-22 22:46:10 +00:00
|
|
|
Equiv_mk : Π
|
2014-08-12 00:35:25 +00:00
|
|
|
(equiv_fun : A → B)
|
|
|
|
(equiv_isequiv : IsEquiv equiv_fun),
|
|
|
|
Equiv A B
|
|
|
|
|
2014-09-09 21:35:48 +00:00
|
|
|
definition equiv_fun [coercion] {A B : Type} (e : Equiv A B) : A → B :=
|
2014-09-04 22:03:59 +00:00
|
|
|
Equiv.rec (λequiv_fun equiv_isequiv, equiv_fun) e
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
definition equiv_isequiv [coercion] {A B : Type} (e : Equiv A B) : IsEquiv (equiv_fun e) :=
|
2014-09-04 22:03:59 +00:00
|
|
|
Equiv.rec (λequiv_fun equiv_isequiv, equiv_isequiv) e
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
-- TODO: better symbol
|
|
|
|
infix `<~>`:25 := Equiv
|
2014-10-21 21:08:07 +00:00
|
|
|
notation H ⁻¹ := equiv_inv H
|