2015-02-26 18:19:54 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Jakob von Raumer. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
2015-11-21 20:12:45 +00:00
|
|
|
Authors: Jakob von Raumer, Floris van Doorn
|
2015-02-26 18:19:54 +00:00
|
|
|
|
|
|
|
Ported from Coq HoTT
|
|
|
|
-/
|
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
prelude
|
2015-04-24 23:58:50 +00:00
|
|
|
import .equiv
|
2016-03-03 15:48:27 +00:00
|
|
|
open eq equiv is_equiv
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
axiom univalence (A B : Type) : is_equiv (@equiv_of_eq A B)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
attribute univalence [instance]
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2014-12-17 16:58:47 +00:00
|
|
|
-- This is the version of univalence axiom we will probably use most often
|
2015-04-27 21:39:23 +00:00
|
|
|
definition ua [reducible] {A B : Type} : A ≃ B → A = B :=
|
|
|
|
equiv_of_eq⁻¹
|
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition eq_equiv_equiv (A B : Type) : (A = B) ≃ (A ≃ B) :=
|
|
|
|
equiv.mk equiv_of_eq _
|
|
|
|
|
2015-04-27 21:39:23 +00:00
|
|
|
definition equiv_of_eq_ua [reducible] {A B : Type} (f : A ≃ B) : equiv_of_eq (ua f) = f :=
|
|
|
|
right_inv equiv_of_eq f
|
|
|
|
|
|
|
|
definition cast_ua_fn {A B : Type} (f : A ≃ B) : cast (ua f) = f :=
|
|
|
|
ap to_fun (equiv_of_eq_ua f)
|
|
|
|
|
|
|
|
definition cast_ua {A B : Type} (f : A ≃ B) (a : A) : cast (ua f) a = f a :=
|
|
|
|
ap10 (cast_ua_fn f) a
|
|
|
|
|
2016-03-06 00:35:12 +00:00
|
|
|
definition cast_ua_inv_fn {A B : Type} (f : A ≃ B) : cast (ua f)⁻¹ = to_inv f :=
|
|
|
|
ap to_inv (equiv_of_eq_ua f)
|
|
|
|
|
|
|
|
definition cast_ua_inv {A B : Type} (f : A ≃ B) (b : B) : cast (ua f)⁻¹ b = to_inv f b :=
|
|
|
|
ap10 (cast_ua_inv_fn f) b
|
|
|
|
|
2015-04-27 21:39:23 +00:00
|
|
|
definition ua_equiv_of_eq [reducible] {A B : Type} (p : A = B) : ua (equiv_of_eq p) = p :=
|
|
|
|
left_inv equiv_of_eq p
|
|
|
|
|
2015-06-24 21:59:17 +00:00
|
|
|
definition eq_of_equiv_lift {A B : Type} (f : A ≃ B) : A = lift B :=
|
|
|
|
ua (f ⬝e !equiv_lift)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-14 02:01:48 +00:00
|
|
|
namespace equiv
|
2015-08-07 14:44:57 +00:00
|
|
|
|
2015-05-14 02:01:48 +00:00
|
|
|
-- One consequence of UA is that we can transport along equivalencies of types
|
|
|
|
-- We can use this for calculation evironments
|
|
|
|
protected definition transport_of_equiv [subst] (P : Type → Type) {A B : Type} (H : A ≃ B)
|
2014-12-17 16:58:47 +00:00
|
|
|
: P A → P B :=
|
|
|
|
eq.transport P (ua H)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-14 02:01:48 +00:00
|
|
|
-- we can "recurse" on equivalences, by replacing them by (equiv_of_eq _)
|
2015-05-18 22:08:19 +00:00
|
|
|
definition rec_on_ua [recursor] {A B : Type} {P : A ≃ B → Type}
|
2015-05-14 02:01:48 +00:00
|
|
|
(f : A ≃ B) (H : Π(q : A = B), P (equiv_of_eq q)) : P f :=
|
|
|
|
right_inv equiv_of_eq f ▸ H (ua f)
|
|
|
|
|
2015-05-21 07:24:00 +00:00
|
|
|
-- a variant where we immediately recurse on the equality in the new goal
|
|
|
|
definition rec_on_ua_idp [recursor] {A : Type} {P : Π{B}, A ≃ B → Type} {B : Type}
|
2016-04-11 17:11:59 +00:00
|
|
|
(f : A ≃ B) (H : P equiv.rfl) : P f :=
|
2015-05-21 07:24:00 +00:00
|
|
|
rec_on_ua f (λq, eq.rec_on q H)
|
|
|
|
|
2015-05-14 02:01:48 +00:00
|
|
|
-- a variant where (equiv_of_eq (ua f)) will be replaced by f in the new goal
|
2015-05-21 07:24:00 +00:00
|
|
|
definition rec_on_ua' {A B : Type} {P : A ≃ B → A = B → Type}
|
2015-05-14 02:01:48 +00:00
|
|
|
(f : A ≃ B) (H : Π(q : A = B), P (equiv_of_eq q) q) : P f (ua f) :=
|
|
|
|
right_inv equiv_of_eq f ▸ H (ua f)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-21 07:24:00 +00:00
|
|
|
-- a variant where we do both
|
|
|
|
definition rec_on_ua_idp' {A : Type} {P : Π{B}, A ≃ B → A = B → Type} {B : Type}
|
2016-04-11 17:11:59 +00:00
|
|
|
(f : A ≃ B) (H : P equiv.rfl idp) : P f (ua f) :=
|
2015-05-21 07:24:00 +00:00
|
|
|
rec_on_ua' f (λq, eq.rec_on q H)
|
2015-03-13 14:32:48 +00:00
|
|
|
|
2016-03-19 15:10:33 +00:00
|
|
|
definition ua_refl (A : Type) : ua erfl = idpath A :=
|
|
|
|
eq_of_fn_eq_fn !eq_equiv_equiv (right_inv !eq_equiv_equiv erfl)
|
|
|
|
|
|
|
|
definition ua_symm {A B : Type} (f : A ≃ B) : ua f⁻¹ᵉ = (ua f)⁻¹ :=
|
|
|
|
begin
|
|
|
|
apply rec_on_ua_idp f,
|
|
|
|
refine !ua_refl ⬝ inverse2 !ua_refl⁻¹
|
|
|
|
end
|
|
|
|
|
|
|
|
definition ua_trans {A B C : Type} (f : A ≃ B) (g : B ≃ C) : ua (f ⬝e g) = ua f ⬝ ua g :=
|
|
|
|
begin
|
|
|
|
apply rec_on_ua_idp g, apply rec_on_ua_idp f,
|
|
|
|
refine !ua_refl ⬝ concat2 !ua_refl⁻¹ !ua_refl⁻¹
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
end equiv
|