2015-02-21 00:30:32 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
2015-03-13 16:13:50 +00:00
|
|
|
Authors: Jeremy Avigad, Jakob von Raumer, Floris van Doorn
|
2015-02-21 00:30:32 +00:00
|
|
|
|
|
|
|
Ported from Coq HoTT
|
|
|
|
-/
|
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
prelude
|
2015-08-05 00:17:14 +00:00
|
|
|
import .function .tactic
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
open function eq
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- Path equality -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
namespace eq
|
2016-02-15 17:57:51 +00:00
|
|
|
variables {A B C : Type} {P : A → Type} {a a' x y z t : A} {b b' : B}
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
--notation a = b := eq a b
|
|
|
|
notation x = y `:>`:50 A:49 := @eq A x y
|
2015-05-07 18:56:42 +00:00
|
|
|
definition idp [reducible] [constructor] {a : A} := refl a
|
|
|
|
definition idpath [reducible] [constructor] (a : A) := refl a
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- unbased path induction
|
2017-05-19 17:36:43 +00:00
|
|
|
definition rec_unbased [reducible] [unfold 6] {P : Π (a b : A), (a = b) → Type}
|
2015-05-11 20:45:15 +00:00
|
|
|
(H : Π (a : A), P a a idp) {a b : A} (p : a = b) : P a b p :=
|
2014-12-12 18:17:50 +00:00
|
|
|
eq.rec (H a) p
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2017-05-19 17:36:43 +00:00
|
|
|
definition rec_on_unbased [reducible] [unfold 5] {P : Π (a b : A), (a = b) → Type}
|
2015-05-11 20:45:15 +00:00
|
|
|
{a b : A} (p : a = b) (H : Π (a : A), P a a idp) : P a b p :=
|
2014-12-12 18:17:50 +00:00
|
|
|
eq.rec (H a) p
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- Concatenation and inverse -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition concat [trans] [unfold 6] (p : x = y) (q : y = z) : x = z :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; exact p
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition inverse [symm] [unfold 4] (p : x = y) : y = x :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-13 19:30:59 +00:00
|
|
|
infix ⬝ := concat
|
|
|
|
postfix ⁻¹ := inverse
|
2015-02-24 00:54:16 +00:00
|
|
|
--a second notation for the inverse, which is not overloaded
|
2015-10-09 20:21:03 +00:00
|
|
|
postfix [parsing_only] `⁻¹ᵖ`:std.prec.max_plus := inverse
|
2015-02-24 00:54:16 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- The 1-dimensional groupoid structure -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- The identity path is a right unit.
|
2015-10-09 20:21:03 +00:00
|
|
|
definition con_idp [unfold_full] (p : x = y) : p ⬝ idp = p :=
|
2015-06-23 16:47:52 +00:00
|
|
|
idp
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-07-13 08:39:16 +00:00
|
|
|
-- The identity path is a left unit.
|
2015-07-07 23:37:06 +00:00
|
|
|
definition idp_con [unfold 4] (p : x = y) : idp ⬝ p = p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Concatenation is associative.
|
2017-01-17 19:32:55 +00:00
|
|
|
definition con.assoc' [unfold 8] (p : x = y) (q : y = z) (r : z = t) :
|
2014-12-12 18:17:50 +00:00
|
|
|
p ⬝ (q ⬝ r) = (p ⬝ q) ⬝ r :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by induction r; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2017-01-17 19:32:55 +00:00
|
|
|
definition con.assoc [unfold 8] (p : x = y) (q : y = z) (r : z = t) :
|
2014-12-12 18:17:50 +00:00
|
|
|
(p ⬝ q) ⬝ r = p ⬝ (q ⬝ r) :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by induction r; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-04-22 19:12:25 +00:00
|
|
|
definition con.assoc5 {a₁ a₂ a₃ a₄ a₅ a₆ : A}
|
|
|
|
(p₁ : a₁ = a₂) (p₂ : a₂ = a₃) (p₃ : a₃ = a₄) (p₄ : a₄ = a₅) (p₅ : a₅ = a₆) :
|
|
|
|
p₁ ⬝ (p₂ ⬝ p₃ ⬝ p₄) ⬝ p₅ = (p₁ ⬝ p₂) ⬝ p₃ ⬝ (p₄ ⬝ p₅) :=
|
|
|
|
by induction p₅; induction p₄; induction p₃; reflexivity
|
|
|
|
|
2017-06-02 16:13:20 +00:00
|
|
|
-- The right inverse law.
|
2015-07-07 23:37:06 +00:00
|
|
|
definition con.right_inv [unfold 4] (p : x = y) : p ⬝ p⁻¹ = idp :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2017-06-02 16:13:20 +00:00
|
|
|
-- The left inverse law.
|
2015-07-07 23:37:06 +00:00
|
|
|
definition con.left_inv [unfold 4] (p : x = y) : p⁻¹ ⬝ p = idp :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- Several auxiliary theorems about canceling inverses across associativity. These are somewhat
|
|
|
|
redundant, following from earlier theorems. -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition inv_con_cancel_left (p : x = y) (q : y = z) : p⁻¹ ⬝ (p ⬝ q) = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition con_inv_cancel_left (p : x = y) (q : x = z) : p ⬝ (p⁻¹ ⬝ q) = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition con_inv_cancel_right (p : x = y) (q : y = z) : (p ⬝ q) ⬝ q⁻¹ = p :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by induction q; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition inv_con_cancel_right (p : x = z) (q : y = z) : (p ⬝ q⁻¹) ⬝ q = p :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by induction q; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Inverse distributes over concatenation
|
2015-02-21 00:30:32 +00:00
|
|
|
definition con_inv (p : x = y) (q : y = z) : (p ⬝ q)⁻¹ = q⁻¹ ⬝ p⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition inv_con_inv_left (p : y = x) (q : y = z) : (p⁻¹ ⬝ q)⁻¹ = q⁻¹ ⬝ p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition inv_con_inv_right (p : x = y) (q : z = y) : (p ⬝ q⁻¹)⁻¹ = q ⬝ p⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition inv_con_inv_inv (p : y = x) (q : z = y) : (p⁻¹ ⬝ q⁻¹)⁻¹ = q ⬝ p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Inverse is an involution.
|
2016-06-23 20:49:54 +00:00
|
|
|
definition inv_inv [unfold 4] (p : x = y) : p⁻¹⁻¹ = p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-03-24 01:06:11 +00:00
|
|
|
-- auxiliary definition used by 'cases' tactic
|
2016-06-23 20:49:54 +00:00
|
|
|
definition elim_inv_inv [unfold 5] {A : Type} {a b : A} {C : a = b → Type}
|
|
|
|
(H₁ : a = b) (H₂ : C (H₁⁻¹⁻¹)) : C H₁ :=
|
2015-03-24 01:06:11 +00:00
|
|
|
eq.rec_on (inv_inv H₁) H₂
|
|
|
|
|
2017-06-02 16:13:20 +00:00
|
|
|
definition eq.rec_symm {A : Type} {a₀ : A} {P : Π⦃a₁⦄, a₁ = a₀ → Type}
|
|
|
|
(H : P idp) ⦃a₁ : A⦄ (p : a₁ = a₀) : P p :=
|
|
|
|
begin
|
|
|
|
cases p, exact H
|
|
|
|
end
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- Theorems for moving things around in equations -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
definition con_eq_of_eq_inv_con {p : x = z} {q : y = z} {r : y = x} :
|
2015-02-21 00:30:32 +00:00
|
|
|
p = r⁻¹ ⬝ q → r ⬝ p = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
begin
|
|
|
|
induction r, intro h, exact !idp_con ⬝ h ⬝ !idp_con
|
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition con_eq_of_eq_con_inv [unfold 5] {p : x = z} {q : y = z} {r : y = x} :
|
2014-12-12 18:17:50 +00:00
|
|
|
r = q ⬝ p⁻¹ → r ⬝ p = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
definition inv_con_eq_of_eq_con {p : x = z} {q : y = z} {r : x = y} :
|
2014-12-12 18:17:50 +00:00
|
|
|
p = r ⬝ q → r⁻¹ ⬝ p = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; intro h; exact !idp_con ⬝ h ⬝ !idp_con
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition con_inv_eq_of_eq_con [unfold 5] {p : z = x} {q : y = z} {r : y = x} :
|
2014-12-12 18:17:50 +00:00
|
|
|
r = q ⬝ p → r ⬝ p⁻¹ = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
definition eq_con_of_inv_con_eq {p : x = z} {q : y = z} {r : y = x} :
|
2014-12-12 18:17:50 +00:00
|
|
|
r⁻¹ ⬝ q = p → q = r ⬝ p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; intro h; exact !idp_con⁻¹ ⬝ h ⬝ !idp_con⁻¹
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition eq_con_of_con_inv_eq [unfold 5] {p : x = z} {q : y = z} {r : y = x} :
|
2014-12-12 18:17:50 +00:00
|
|
|
q ⬝ p⁻¹ = r → q = r ⬝ p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
definition eq_inv_con_of_con_eq {p : x = z} {q : y = z} {r : x = y} :
|
2014-12-12 18:17:50 +00:00
|
|
|
r ⬝ q = p → q = r⁻¹ ⬝ p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; intro h; exact !idp_con⁻¹ ⬝ h ⬝ !idp_con⁻¹
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition eq_con_inv_of_con_eq [unfold 5] {p : z = x} {q : y = z} {r : y = x} :
|
2014-12-12 18:17:50 +00:00
|
|
|
q ⬝ p = r → q = r ⬝ p⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition eq_of_con_inv_eq_idp [unfold 5] {p q : x = y} : p ⬝ q⁻¹ = idp → p = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
definition eq_of_inv_con_eq_idp {p q : x = y} : q⁻¹ ⬝ p = idp → p = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; intro h; exact !idp_con⁻¹ ⬝ h
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition eq_inv_of_con_eq_idp' [unfold 5] {p : x = y} {q : y = x} : p ⬝ q = idp → p = q⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
definition eq_inv_of_con_eq_idp {p : x = y} {q : y = x} : q ⬝ p = idp → p = q⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; intro h; exact !idp_con⁻¹ ⬝ h
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
definition eq_of_idp_eq_inv_con {p q : x = y} : idp = p⁻¹ ⬝ q → p = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; intro h; exact h ⬝ !idp_con
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition eq_of_idp_eq_con_inv [unfold 4] {p q : x = y} : idp = q ⬝ p⁻¹ → p = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition inv_eq_of_idp_eq_con [unfold 4] {p : x = y} {q : y = x} : idp = q ⬝ p → p⁻¹ = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
definition inv_eq_of_idp_eq_con' {p : x = y} {q : y = x} : idp = p ⬝ q → p⁻¹ = q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; intro h; exact h ⬝ !idp_con
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-08-04 17:00:12 +00:00
|
|
|
definition con_inv_eq_idp [unfold 6] {p q : x = y} (r : p = q) : p ⬝ q⁻¹ = idp :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by cases r; apply con.right_inv
|
2015-05-29 18:50:19 +00:00
|
|
|
|
2015-08-04 17:00:12 +00:00
|
|
|
definition inv_con_eq_idp [unfold 6] {p q : x = y} (r : p = q) : q⁻¹ ⬝ p = idp :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by cases r; apply con.left_inv
|
2015-05-29 18:50:19 +00:00
|
|
|
|
|
|
|
definition con_eq_idp {p : x = y} {q : y = x} (r : p = q⁻¹) : p ⬝ q = idp :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by cases q; exact r
|
2015-05-29 18:50:19 +00:00
|
|
|
|
|
|
|
definition idp_eq_inv_con {p q : x = y} (r : p = q) : idp = p⁻¹ ⬝ q :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by cases r; exact !con.left_inv⁻¹
|
2015-05-29 18:50:19 +00:00
|
|
|
|
|
|
|
definition idp_eq_con_inv {p q : x = y} (r : p = q) : idp = q ⬝ p⁻¹ :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by cases r; exact !con.right_inv⁻¹
|
2015-05-29 18:50:19 +00:00
|
|
|
|
|
|
|
definition idp_eq_con {p : x = y} {q : y = x} (r : p⁻¹ = q) : idp = q ⬝ p :=
|
2016-02-25 00:43:50 +00:00
|
|
|
by cases p; exact r
|
2015-05-29 18:50:19 +00:00
|
|
|
|
2016-03-06 00:35:12 +00:00
|
|
|
definition eq_idp_of_con_right {p : x = x} {q : x = y} (r : p ⬝ q = q) : p = idp :=
|
|
|
|
by cases q; exact r
|
|
|
|
|
|
|
|
definition eq_idp_of_con_left {p : x = x} {q : y = x} (r : q ⬝ p = q) : p = idp :=
|
|
|
|
by cases q; exact (idp_con p)⁻¹ ⬝ r
|
|
|
|
|
|
|
|
definition idp_eq_of_con_right {p : x = x} {q : x = y} (r : q = p ⬝ q) : idp = p :=
|
|
|
|
by cases q; exact r
|
|
|
|
|
|
|
|
definition idp_eq_of_con_left {p : x = x} {q : y = x} (r : q = q ⬝ p) : idp = p :=
|
|
|
|
by cases q; exact r ⬝ idp_con p
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- Transport -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition transport [subst] [reducible] [unfold 5] (P : A → Type) {x y : A} (p : x = y)
|
2015-05-11 20:45:15 +00:00
|
|
|
(u : P x) : P y :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact u
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- This idiom makes the operation right associative.
|
2015-10-22 22:41:55 +00:00
|
|
|
infixr ` ▸ ` := transport _
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition cast [reducible] [unfold 3] {A B : Type} (p : A = B) (a : A) : B :=
|
2015-05-01 03:23:12 +00:00
|
|
|
p ▸ a
|
2015-04-24 21:00:32 +00:00
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
definition cast_def [reducible] [unfold_full] {A B : Type} (p : A = B) (a : A)
|
2015-09-22 16:01:55 +00:00
|
|
|
: cast p a = p ▸ a :=
|
|
|
|
idp
|
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition tr_rev [reducible] [unfold 6] (P : A → Type) {x y : A} (p : x = y) (u : P y) : P x :=
|
2015-05-01 03:23:12 +00:00
|
|
|
p⁻¹ ▸ u
|
2015-02-21 00:30:32 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition ap [unfold 6] ⦃A B : Type⦄ (f : A → B) {x y:A} (p : x = y) : f x = f y :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
abbreviation ap01 [parsing_only] := ap
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
definition homotopy [reducible] (f g : Πx, P x) : Type :=
|
2014-12-12 18:17:50 +00:00
|
|
|
Πx : A, f x = g x
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
infix ~ := homotopy
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
protected definition homotopy.refl [refl] [reducible] [unfold_full] (f : Πx, P x) : f ~ f :=
|
2015-02-21 00:30:32 +00:00
|
|
|
λ x, idp
|
|
|
|
|
2017-06-02 16:13:20 +00:00
|
|
|
protected definition homotopy.rfl [reducible] [unfold_full] {f : Πx, P x} : f ~ f :=
|
|
|
|
homotopy.refl f
|
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
protected definition homotopy.symm [symm] [reducible] [unfold_full] {f g : Πx, P x} (H : f ~ g)
|
2015-09-01 22:00:11 +00:00
|
|
|
: g ~ f :=
|
2015-04-28 21:31:26 +00:00
|
|
|
λ x, (H x)⁻¹
|
2015-02-21 00:30:32 +00:00
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
protected definition homotopy.trans [trans] [reducible] [unfold_full] {f g h : Πx, P x}
|
2015-06-23 16:47:52 +00:00
|
|
|
(H1 : f ~ g) (H2 : g ~ h) : f ~ h :=
|
2015-04-28 21:31:26 +00:00
|
|
|
λ x, H1 x ⬝ H2 x
|
2015-02-21 00:30:32 +00:00
|
|
|
|
2017-06-02 16:13:20 +00:00
|
|
|
infix ` ⬝hty `:75 := homotopy.trans
|
|
|
|
postfix `⁻¹ʰᵗʸ`:(max+1) := homotopy.symm
|
|
|
|
|
2016-06-23 20:49:54 +00:00
|
|
|
definition hwhisker_left [unfold_full] (g : B → C) {f f' : A → B} (H : f ~ f') :
|
|
|
|
g ∘ f ~ g ∘ f' :=
|
|
|
|
λa, ap g (H a)
|
|
|
|
|
|
|
|
definition hwhisker_right [unfold_full] (f : A → B) {g g' : B → C} (H : g ~ g') :
|
|
|
|
g ∘ f ~ g' ∘ f :=
|
|
|
|
λa, H (f a)
|
|
|
|
|
2017-06-02 16:13:20 +00:00
|
|
|
definition compose_id (f : A → B) : f ∘ id ~ f :=
|
|
|
|
by reflexivity
|
|
|
|
|
|
|
|
definition id_compose (f : A → B) : id ∘ f ~ f :=
|
|
|
|
by reflexivity
|
|
|
|
|
|
|
|
definition compose2 {A B C : Type} {g g' : B → C} {f f' : A → B}
|
|
|
|
(p : g ~ g') (q : f ~ f') : g ∘ f ~ g' ∘ f' :=
|
|
|
|
hwhisker_right f p ⬝hty hwhisker_left g' q
|
|
|
|
|
|
|
|
definition hassoc {A B C D : Type} (h : C → D) (g : B → C) (f : A → B) : (h ∘ g) ∘ f ~ h ∘ (g ∘ f) :=
|
|
|
|
λa, idp
|
|
|
|
|
2018-08-19 11:51:12 +00:00
|
|
|
definition homotopy_of_eq [unfold 5] {f g : Πx, P x} (H : f = g) : f ~ g :=
|
|
|
|
λa, ap (λh, h a) H
|
2015-08-31 16:23:34 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition apd10 [unfold 5] {f g : Πx, P x} (H : f = g) : f ~ g :=
|
2018-08-19 11:51:12 +00:00
|
|
|
λa, ap (λh, h a) H
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
--the next theorem is useful if you want to write "apply (apd10' a)"
|
2015-07-07 23:37:06 +00:00
|
|
|
definition apd10' [unfold 6] {f g : Πx, P x} (a : A) (H : f = g) : f a = g a :=
|
2018-08-19 11:51:12 +00:00
|
|
|
apd10 H a
|
2015-02-24 00:54:16 +00:00
|
|
|
|
2018-08-19 11:51:12 +00:00
|
|
|
--apd10 is a special case of ap
|
2016-01-23 19:15:59 +00:00
|
|
|
definition apd10_eq_ap_eval {f g : Πx, P x} (H : f = g) (a : A)
|
|
|
|
: apd10 H a = ap (λs : Πx, P x, s a) H :=
|
2018-08-19 11:51:12 +00:00
|
|
|
by reflexivity
|
2016-01-23 19:15:59 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition ap10 [reducible] [unfold 5] {f g : A → B} (H : f = g) : f ~ g := apd10 H
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
definition ap11 {f g : A → B} (H : f = g) {x y : A} (p : x = y) : f x = g y :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction H; exact ap f p
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-03-19 16:09:44 +00:00
|
|
|
-- [apd] is defined in init.pathover using pathover instead of an equality with transport.
|
2016-03-19 14:38:05 +00:00
|
|
|
definition apdt [unfold 6] (f : Πa, P a) {x y : A} (p : x = y) : p ▸ f x = f y :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
definition ap011 [unfold 9] (f : A → B → C) (Ha : a = a') (Hb : b = b') : f a b = f a' b' :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by cases Ha; exact ap (f a) Hb
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- More theorems for moving things around in equations -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition tr_eq_of_eq_inv_tr {P : A → Type} {x y : A} {p : x = y} {u : P x} {v : P y} :
|
2015-05-01 03:23:12 +00:00
|
|
|
u = p⁻¹ ▸ v → p ▸ u = v :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition inv_tr_eq_of_eq_tr {P : A → Type} {x y : A} {p : y = x} {u : P x} {v : P y} :
|
2015-05-01 03:23:12 +00:00
|
|
|
u = p ▸ v → p⁻¹ ▸ u = v :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition eq_inv_tr_of_tr_eq {P : A → Type} {x y : A} {p : x = y} {u : P x} {v : P y} :
|
2015-05-01 03:23:12 +00:00
|
|
|
p ▸ u = v → u = p⁻¹ ▸ v :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition eq_tr_of_inv_tr_eq {P : A → Type} {x y : A} {p : y = x} {u : P x} {v : P y} :
|
2015-05-01 03:23:12 +00:00
|
|
|
p⁻¹ ▸ u = v → u = p ▸ v :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact id
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-06-29 23:26:56 +00:00
|
|
|
/- Transporting along the diagonal of a type family -/
|
|
|
|
definition tr_diag_eq_tr_tr {A : Type} (P : A → A → Type) {x y : A} (p : x = y) (a : P x x) :
|
|
|
|
transport (λ x, P x x) p a = transport (λ x, P _ x) p (transport (λ x, P x _) p a) :=
|
|
|
|
by induction p; reflexivity
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- Functoriality of functions -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Here we prove that functions behave like functors between groupoids, and that [ap] itself is
|
|
|
|
-- functorial.
|
|
|
|
|
|
|
|
-- Functions take identity paths to identity paths
|
2015-11-22 22:46:54 +00:00
|
|
|
definition ap_idp [unfold_full] (x : A) (f : A → B) : ap f idp = idp :> (f x = f x) := idp
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Functions commute with concatenation.
|
2015-11-22 22:46:54 +00:00
|
|
|
definition ap_con [unfold 8] (f : A → B) {x y z : A} (p : x = y) (q : y = z) :
|
2015-04-28 02:05:59 +00:00
|
|
|
ap f (p ⬝ q) = ap f p ⬝ ap f q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-23 16:47:52 +00:00
|
|
|
definition con_ap_con_eq_con_ap_con_ap (f : A → B) {w x y z : A} (r : f w = f x)
|
|
|
|
(p : x = y) (q : y = z) : r ⬝ ap f (p ⬝ q) = (r ⬝ ap f p) ⬝ ap f q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-23 16:47:52 +00:00
|
|
|
definition ap_con_con_eq_ap_con_ap_con (f : A → B) {w x y z : A} (p : x = y) (q : y = z)
|
|
|
|
(r : f z = f w) : ap f (p ⬝ q) ⬝ r = ap f p ⬝ (ap f q ⬝ r) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; induction p; apply con.assoc
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Functions commute with path inverses.
|
2015-11-22 22:46:54 +00:00
|
|
|
definition ap_inv' [unfold 6] (f : A → B) {x y : A} (p : x = y) : (ap f p)⁻¹ = ap f p⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-11-22 22:46:54 +00:00
|
|
|
definition ap_inv [unfold 6] (f : A → B) {x y : A} (p : x = y) : ap f p⁻¹ = (ap f p)⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- [ap] itself is functorial in the first argument.
|
|
|
|
|
2015-11-22 22:46:54 +00:00
|
|
|
definition ap_id [unfold 4] (p : x = y) : ap id p = p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-09-01 22:00:11 +00:00
|
|
|
definition ap_compose [unfold 8] (g : B → C) (f : A → B) {x y : A} (p : x = y) :
|
2014-12-12 18:17:50 +00:00
|
|
|
ap (g ∘ f) p = ap g (ap f p) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Sometimes we don't have the actual function [compose].
|
2015-09-01 22:00:11 +00:00
|
|
|
definition ap_compose' [unfold 8] (g : B → C) (f : A → B) {x y : A} (p : x = y) :
|
2014-12-12 18:17:50 +00:00
|
|
|
ap (λa, g (f a)) p = ap g (ap f p) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- The action of constant maps.
|
2015-07-07 23:37:06 +00:00
|
|
|
definition ap_constant [unfold 5] (p : x = y) (z : B) : ap (λu, z) p = idp :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Naturality of [ap].
|
2015-08-31 16:23:34 +00:00
|
|
|
-- see also natural_square in cubical.square
|
2015-06-17 19:58:58 +00:00
|
|
|
definition ap_con_eq_con_ap {f g : A → B} (p : f ~ g) {x y : A} (q : x = y) :
|
2015-04-24 21:00:32 +00:00
|
|
|
ap f q ⬝ p y = p x ⬝ ap g q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; apply idp_con
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Naturality of [ap] at identity.
|
2015-02-21 00:30:32 +00:00
|
|
|
definition ap_con_eq_con {f : A → A} (p : Πx, f x = x) {x y : A} (q : x = y) :
|
2015-04-24 21:00:32 +00:00
|
|
|
ap f q ⬝ p y = p x ⬝ q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; apply idp_con
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition con_ap_eq_con {f : A → A} (p : Πx, x = f x) {x y : A} (q : x = y) :
|
2015-04-24 21:00:32 +00:00
|
|
|
p x ⬝ ap f q = q ⬝ p y :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; exact !idp_con⁻¹
|
2015-06-17 19:58:58 +00:00
|
|
|
|
|
|
|
-- Naturality of [ap] with constant function
|
|
|
|
definition ap_con_eq {f : A → B} {b : B} (p : Πx, f x = b) {x y : A} (q : x = y) :
|
|
|
|
ap f q ⬝ p y = p x :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; apply idp_con
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Naturality with other paths hanging around.
|
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
definition con_ap_con_con_eq_con_con_ap_con {f g : A → B} (p : f ~ g) {x y : A} (q : x = y)
|
2014-12-12 18:17:50 +00:00
|
|
|
{w z : B} (r : w = f x) (s : g y = z) :
|
|
|
|
(r ⬝ ap f q) ⬝ (p y ⬝ s) = (r ⬝ p x) ⬝ (ap g q ⬝ s) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction s; induction q; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
definition con_ap_con_eq_con_con_ap {f g : A → B} (p : f ~ g) {x y : A} (q : x = y)
|
2014-12-12 18:17:50 +00:00
|
|
|
{w : B} (r : w = f x) :
|
|
|
|
(r ⬝ ap f q) ⬝ p y = (r ⬝ p x) ⬝ ap g q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- TODO: try this using the simplifier, and compare proofs
|
2015-06-17 19:58:58 +00:00
|
|
|
definition ap_con_con_eq_con_ap_con {f g : A → B} (p : f ~ g) {x y : A} (q : x = y)
|
2014-12-12 18:17:50 +00:00
|
|
|
{z : B} (s : g y = z) :
|
2015-04-24 21:00:32 +00:00
|
|
|
ap f q ⬝ (p y ⬝ s) = p x ⬝ (ap g q ⬝ s) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
begin
|
|
|
|
induction s,
|
|
|
|
induction q,
|
|
|
|
apply idp_con
|
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
definition con_ap_con_con_eq_con_con_con {f : A → A} (p : f ~ id) {x y : A} (q : x = y)
|
2014-12-12 18:17:50 +00:00
|
|
|
{w z : A} (r : w = f x) (s : y = z) :
|
|
|
|
(r ⬝ ap f q) ⬝ (p y ⬝ s) = (r ⬝ p x) ⬝ (q ⬝ s) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction s; induction q; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
definition con_con_ap_con_eq_con_con_con {g : A → A} (p : id ~ g) {x y : A} (q : x = y)
|
2014-12-12 18:17:50 +00:00
|
|
|
{w z : A} (r : w = x) (s : g y = z) :
|
|
|
|
(r ⬝ p x) ⬝ (ap g q ⬝ s) = (r ⬝ q) ⬝ (p y ⬝ s) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction s; induction q; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
definition con_ap_con_eq_con_con {f : A → A} (p : f ~ id) {x y : A} (q : x = y)
|
2014-12-12 18:17:50 +00:00
|
|
|
{w : A} (r : w = f x) :
|
|
|
|
(r ⬝ ap f q) ⬝ p y = (r ⬝ p x) ⬝ q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
definition ap_con_con_eq_con_con {f : A → A} (p : f ~ id) {x y : A} (q : x = y)
|
2014-12-12 18:17:50 +00:00
|
|
|
{z : A} (s : y = z) :
|
2015-04-24 21:00:32 +00:00
|
|
|
ap f q ⬝ (p y ⬝ s) = p x ⬝ (q ⬝ s) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction s; induction q; apply idp_con
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
definition con_con_ap_eq_con_con {g : A → A} (p : id ~ g) {x y : A} (q : x = y)
|
2014-12-12 18:17:50 +00:00
|
|
|
{w : A} (r : w = x) :
|
|
|
|
(r ⬝ p x) ⬝ ap g q = (r ⬝ q) ⬝ p y :=
|
2015-04-27 18:20:15 +00:00
|
|
|
begin cases q, exact idp end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
definition con_ap_con_eq_con_con' {g : A → A} (p : id ~ g) {x y : A} (q : x = y)
|
2014-12-12 18:17:50 +00:00
|
|
|
{z : A} (s : g y = z) :
|
|
|
|
p x ⬝ (ap g q ⬝ s) = q ⬝ (p y ⬝ s) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction s; induction q; exact !idp_con⁻¹
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
/- Action of [apd10] and [ap10] on paths -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Application of paths between functions preserves the groupoid structure
|
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
definition apd10_idp (f : Πx, P x) (x : A) : apd10 (refl f) x = idp := idp
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
definition apd10_con {f f' f'' : Πx, P x} (h : f = f') (h' : f' = f'') (x : A) :
|
|
|
|
apd10 (h ⬝ h') x = apd10 h x ⬝ apd10 h' x :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction h; induction h'; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
definition apd10_inv {f g : Πx : A, P x} (h : f = g) (x : A) :
|
|
|
|
apd10 h⁻¹ x = (apd10 h x)⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction h; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition ap10_idp {f : A → B} (x : A) : ap10 (refl f) x = idp := idp
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition ap10_con {f f' f'' : A → B} (h : f = f') (h' : f' = f'') (x : A) :
|
2015-04-24 21:00:32 +00:00
|
|
|
ap10 (h ⬝ h') x = ap10 h x ⬝ ap10 h' x := apd10_con h h' x
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-28 00:02:18 +00:00
|
|
|
definition ap10_inv {f g : A → B} (h : f = g) (x : A) : ap10 h⁻¹ x = (ap10 h x)⁻¹ :=
|
2015-04-24 21:00:32 +00:00
|
|
|
apd10_inv h x
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- [ap10] also behaves nicely on paths produced by [ap]
|
2014-12-12 18:17:50 +00:00
|
|
|
definition ap_ap10 (f g : A → B) (h : B → C) (p : f = g) (a : A) :
|
|
|
|
ap h (ap10 p a) = ap10 (ap (λ f', h ∘ f') p) a:=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2017-06-02 16:13:20 +00:00
|
|
|
/- some lemma's about ap011 -/
|
|
|
|
|
|
|
|
definition ap_eq_ap011_left (f : A → B → C) (Ha : a = a') (b : B) :
|
|
|
|
ap (λa, f a b) Ha = ap011 f Ha idp :=
|
|
|
|
by induction Ha; reflexivity
|
|
|
|
|
|
|
|
definition ap_eq_ap011_right (f : A → B → C) (a : A) (Hb : b = b') :
|
|
|
|
ap (f a) Hb = ap011 f idp Hb :=
|
|
|
|
by reflexivity
|
|
|
|
|
|
|
|
definition ap_ap011 {A B C D : Type} (g : C → D) (f : A → B → C) {a a' : A} {b b' : B}
|
|
|
|
(p : a = a') (q : b = b') : ap g (ap011 f p q) = ap011 (λa b, g (f a b)) p q :=
|
|
|
|
begin
|
|
|
|
induction p, exact (ap_compose g (f a) q)⁻¹
|
|
|
|
end
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- Transport and the groupoid structure of paths -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-01 03:23:12 +00:00
|
|
|
definition idp_tr {P : A → Type} {x : A} (u : P x) : idp ▸ u = u := idp
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-29 17:31:40 +00:00
|
|
|
definition con_tr [unfold 7] {P : A → Type} {x y z : A} (p : x = y) (q : y = z) (u : P x) :
|
2015-05-01 03:23:12 +00:00
|
|
|
p ⬝ q ▸ u = q ▸ p ▸ u :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition tr_inv_tr {P : A → Type} {x y : A} (p : x = y) (z : P y) :
|
2015-05-01 03:23:12 +00:00
|
|
|
p ▸ p⁻¹ ▸ z = z :=
|
2015-04-28 21:31:26 +00:00
|
|
|
(con_tr p⁻¹ p z)⁻¹ ⬝ ap (λr, transport P r z) (con.left_inv p)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition inv_tr_tr {P : A → Type} {x y : A} (p : x = y) (z : P x) :
|
2015-05-01 03:23:12 +00:00
|
|
|
p⁻¹ ▸ p ▸ z = z :=
|
2015-04-28 21:31:26 +00:00
|
|
|
(con_tr p p⁻¹ z)⁻¹ ⬝ ap (λr, transport P r z) (con.right_inv p)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-04-11 17:11:59 +00:00
|
|
|
definition cast_cast_inv {A : Type} {P : A → Type} {x y : A} (p : x = y) (z : P y) :
|
|
|
|
cast (ap P p) (cast (ap P p⁻¹) z) = z :=
|
|
|
|
by induction p; reflexivity
|
|
|
|
|
|
|
|
definition cast_inv_cast {A : Type} {P : A → Type} {x y : A} (p : x = y) (z : P x) :
|
|
|
|
cast (ap P p⁻¹) (cast (ap P p) z) = z :=
|
|
|
|
by induction p; reflexivity
|
|
|
|
|
2016-11-27 22:13:38 +00:00
|
|
|
definition fn_tr_eq_tr_fn {P Q : A → Type} {x y : A} (p : x = y) (f : Πx, P x → Q x) (z : P x) :
|
|
|
|
f y (p ▸ z) = p ▸ f x z :=
|
|
|
|
by induction p; reflexivity
|
|
|
|
|
|
|
|
definition fn_cast_eq_cast_fn {A : Type} {P Q : A → Type} {x y : A} (p : x = y)
|
|
|
|
(f : Πx, P x → Q x) (z : P x) : f y (cast (ap P p) z) = cast (ap Q p) (f x z) :=
|
|
|
|
by induction p; reflexivity
|
|
|
|
|
2016-03-19 16:09:44 +00:00
|
|
|
definition con_con_tr {P : A → Type}
|
2014-12-12 18:17:50 +00:00
|
|
|
{x y z w : A} (p : x = y) (q : y = z) (r : z = w) (u : P x) :
|
2015-05-01 03:23:12 +00:00
|
|
|
ap (λe, e ▸ u) (con.assoc' p q r) ⬝ (con_tr (p ⬝ q) r u) ⬝
|
2015-04-28 21:31:26 +00:00
|
|
|
ap (transport P r) (con_tr p q u)
|
2015-05-01 03:23:12 +00:00
|
|
|
= (con_tr p (q ⬝ r) u) ⬝ (con_tr q r (p ▸ u))
|
|
|
|
:> ((p ⬝ (q ⬝ r)) ▸ u = r ▸ q ▸ p ▸ u) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Here is another coherence lemma for transport.
|
2015-04-28 21:31:26 +00:00
|
|
|
definition tr_inv_tr_lemma {P : A → Type} {x y : A} (p : x = y) (z : P x) :
|
|
|
|
tr_inv_tr p (transport P p z) = ap (transport P p) (inv_tr_tr p z) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-03-19 14:38:05 +00:00
|
|
|
/- some properties for apdt -/
|
2015-04-28 02:05:59 +00:00
|
|
|
|
2016-03-19 14:38:05 +00:00
|
|
|
definition apdt_idp (x : A) (f : Πx, P x) : apdt f idp = idp :> (f x = f x) := idp
|
2016-02-15 17:57:51 +00:00
|
|
|
|
2016-03-19 14:38:05 +00:00
|
|
|
definition apdt_con (f : Πx, P x) {x y z : A} (p : x = y) (q : y = z)
|
|
|
|
: apdt f (p ⬝ q) = con_tr p q (f x) ⬝ ap (transport P q) (apdt f p) ⬝ apdt f q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by cases p; cases q; apply idp
|
|
|
|
|
2016-03-19 14:38:05 +00:00
|
|
|
definition apdt_inv (f : Πx, P x) {x y : A} (p : x = y)
|
|
|
|
: apdt f p⁻¹ = (eq_inv_tr_of_tr_eq (apdt f p))⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by cases p; apply idp
|
2015-04-28 02:05:59 +00:00
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
-- Dependent transport in a doubly dependent type.
|
2016-06-23 20:10:37 +00:00
|
|
|
-- This is a special case of transporto in init.pathover
|
2015-07-07 23:37:06 +00:00
|
|
|
definition transportD [unfold 6] {P : A → Type} (Q : Πa, P a → Type)
|
2015-05-01 03:23:12 +00:00
|
|
|
{a a' : A} (p : a = a') (b : P a) (z : Q a b) : Q a' (p ▸ b) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact z
|
2015-04-24 21:00:32 +00:00
|
|
|
|
2015-06-23 16:47:52 +00:00
|
|
|
-- In Coq the variables P, Q and b are explicit, but in Lean we can probably have them implicit
|
|
|
|
-- using the following notation
|
2015-09-30 23:52:34 +00:00
|
|
|
notation p ` ▸D `:65 x:64 := transportD _ p _ x
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-04-22 19:12:25 +00:00
|
|
|
-- transporting over 2 one-dimensional paths
|
2016-06-23 20:10:37 +00:00
|
|
|
-- This is a special case of transporto in init.pathover
|
2016-04-22 19:12:25 +00:00
|
|
|
definition transport11 {A B : Type} (P : A → B → Type) {a a' : A} {b b' : B}
|
|
|
|
(p : a = a') (q : b = b') (z : P a b) : P a' b' :=
|
|
|
|
transport (P a') q (p ▸ z)
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
-- Transporting along higher-dimensional paths
|
2015-07-07 23:37:06 +00:00
|
|
|
definition transport2 [unfold 7] (P : A → Type) {x y : A} {p q : x = y} (r : p = q) (z : P x) :
|
2015-05-01 03:23:12 +00:00
|
|
|
p ▸ z = q ▸ z :=
|
|
|
|
ap (λp', p' ▸ z) r
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-09-30 23:52:34 +00:00
|
|
|
notation p ` ▸2 `:65 x:64 := transport2 _ p _ x
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- An alternative definition.
|
2016-02-15 17:57:51 +00:00
|
|
|
definition tr2_eq_ap10 (Q : A → Type) {x y : A} {p q : x = y} (r : p = q) (z : Q x) :
|
2014-12-12 18:17:50 +00:00
|
|
|
transport2 Q r z = ap10 (ap (transport Q) r) z :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition tr2_con {P : A → Type} {x y : A} {p1 p2 p3 : x = y}
|
2014-12-12 18:17:50 +00:00
|
|
|
(r1 : p1 = p2) (r2 : p2 = p3) (z : P x) :
|
|
|
|
transport2 P (r1 ⬝ r2) z = transport2 P r1 z ⬝ transport2 P r2 z :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r1; induction r2; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition tr2_inv (Q : A → Type) {x y : A} {p q : x = y} (r : p = q) (z : Q x) :
|
2015-02-28 00:02:18 +00:00
|
|
|
transport2 Q r⁻¹ z = (transport2 Q r z)⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-02-15 17:57:51 +00:00
|
|
|
definition transportD2 [unfold 7] {B C : A → Type} (D : Π(a:A), B a → C a → Type)
|
2015-05-01 03:23:12 +00:00
|
|
|
{x1 x2 : A} (p : x1 = x2) (y : B x1) (z : C x1) (w : D x1 y z) : D x2 (p ▸ y) (p ▸ z) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; exact w
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-02-15 17:57:51 +00:00
|
|
|
notation p ` ▸D2 `:65 x:64 := transportD2 _ p _ _ x
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition ap_tr_con_tr2 (P : A → Type) {x y : A} {p q : x = y} {z w : P x} (r : p = q)
|
2014-12-12 18:17:50 +00:00
|
|
|
(s : z = w) :
|
|
|
|
ap (transport P p) s ⬝ transport2 P r w = transport2 P r z ⬝ ap (transport P q) s :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; exact !idp_con⁻¹
|
2015-02-21 00:30:32 +00:00
|
|
|
|
|
|
|
/- Transporting in particular fibrations -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
/-
|
|
|
|
From the Coq HoTT library:
|
|
|
|
|
|
|
|
One frequently needs lemmas showing that transport in a certain dependent type is equal to some
|
|
|
|
more explicitly defined operation, defined according to the structure of that dependent type.
|
|
|
|
For most dependent types, we prove these lemmas in the appropriate file in the types/
|
|
|
|
subdirectory. Here we consider only the most basic cases.
|
|
|
|
-/
|
|
|
|
|
|
|
|
-- Transporting in a constant fibration.
|
2015-02-21 00:30:32 +00:00
|
|
|
definition tr_constant (p : x = y) (z : B) : transport (λx, B) p z = z :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition tr2_constant {p q : x = y} (r : p = q) (z : B) :
|
|
|
|
tr_constant p z = transport2 (λu, B) r z ⬝ tr_constant q z :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; exact !idp_con⁻¹
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Transporting in a pulled back fibration.
|
2015-08-06 13:09:49 +00:00
|
|
|
definition tr_compose (P : B → Type) (f : A → B) (p : x = y) (z : P (f x)) :
|
2014-12-12 18:17:50 +00:00
|
|
|
transport (P ∘ f) p z = transport P (ap f p) z :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-11-23 22:59:13 +00:00
|
|
|
definition tr_ap (P : B → Type) (f : A → B) (p : x = y) (z : P (f x)) :
|
|
|
|
transport P (ap f p) z = transport (P ∘ f) p z :=
|
|
|
|
(tr_compose P f p z)⁻¹
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition ap_precompose (f : A → B) (g g' : B → C) (p : g = g') :
|
|
|
|
ap (λh, h ∘ f) p = transport (λh : B → C, g ∘ f = h ∘ f) p idp :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-01-23 19:15:59 +00:00
|
|
|
definition apd10_ap_precompose (f : A → B) (g g' : B → C) (p : g = g') :
|
|
|
|
apd10 (ap (λh : B → C, h ∘ f) p) = λa, apd10 p (f a) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2016-01-23 19:15:59 +00:00
|
|
|
|
|
|
|
definition apd10_ap_precompose_dependent {C : B → Type}
|
|
|
|
(f : A → B) {g g' : Πb : B, C b} (p : g = g')
|
|
|
|
: apd10 (ap (λ(h : (Πb : B, C b))(a : A), h (f a)) p) = λa, apd10 p (f a) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-01-23 19:15:59 +00:00
|
|
|
definition apd10_ap_postcompose (f : B → C) (g g' : A → B) (p : g = g') :
|
|
|
|
apd10 (ap (λh : A → B, f ∘ h) p) = λa, ap f (apd10 p a) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-08-06 13:09:49 +00:00
|
|
|
-- A special case of [tr_compose] which seems to come up a lot.
|
2015-05-01 03:23:12 +00:00
|
|
|
definition tr_eq_cast_ap {P : A → Type} {x y} (p : x = y) (u : P x) : p ▸ u = cast (ap P p) u :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition tr_eq_cast_ap_fn {P : A → Type} {x y} (p : x = y) : transport P p = cast (ap P p) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-03-19 14:38:05 +00:00
|
|
|
/- The behavior of [ap] and [apdt] -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-03-19 14:38:05 +00:00
|
|
|
-- In a constant fibration, [apdt] reduces to [ap], modulo [transport_const].
|
|
|
|
definition apdt_eq_tr_constant_con_ap (f : A → B) (p : x = y) :
|
|
|
|
apdt f p = tr_constant p (f x) ⬝ ap f p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- The 2-dimensional groupoid structure -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Horizontal composition of 2-dimensional paths.
|
2015-08-04 17:00:12 +00:00
|
|
|
definition concat2 [unfold 9 10] {p p' : x = y} {q q' : y = z} (h : p = p') (h' : q = q')
|
2015-05-11 20:45:15 +00:00
|
|
|
: p ⬝ q = p' ⬝ q' :=
|
2016-02-15 17:57:51 +00:00
|
|
|
ap011 concat h h'
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- 2-dimensional path inversion
|
2015-07-07 23:37:06 +00:00
|
|
|
definition inverse2 [unfold 6] {p q : x = y} (h : p = q) : p⁻¹ = q⁻¹ :=
|
2016-02-13 05:12:13 +00:00
|
|
|
ap inverse h
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-11-23 22:59:13 +00:00
|
|
|
infixl ` ◾ `:80 := concat2
|
2015-10-09 20:21:03 +00:00
|
|
|
postfix [parsing_only] `⁻²`:(max+10) := inverse2 --this notation is abusive, should we use it?
|
2015-06-23 16:47:52 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/- Whiskering -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-08-05 00:17:14 +00:00
|
|
|
definition whisker_left [unfold 8] (p : x = y) {q r : y = z} (h : q = r) : p ⬝ q = p ⬝ r :=
|
2014-12-12 04:14:53 +00:00
|
|
|
idp ◾ h
|
|
|
|
|
2017-01-17 19:32:55 +00:00
|
|
|
definition whisker_right [unfold 8] {p q : x = y} (r : y = z) (h : p = q) : p ⬝ r = q ⬝ r :=
|
2014-12-12 04:14:53 +00:00
|
|
|
h ◾ idp
|
|
|
|
|
|
|
|
-- Unwhiskering, a.k.a. cancelling
|
|
|
|
|
2016-02-15 17:57:51 +00:00
|
|
|
definition cancel_left {x y z : A} (p : x = y) {q r : y = z} : (p ⬝ q = p ⬝ r) → (q = r) :=
|
2015-03-04 05:10:48 +00:00
|
|
|
λs, !inv_con_cancel_left⁻¹ ⬝ whisker_left p⁻¹ s ⬝ !inv_con_cancel_left
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-02-15 17:57:51 +00:00
|
|
|
definition cancel_right {x y z : A} {p q : x = y} (r : y = z) : (p ⬝ r = q ⬝ r) → (p = q) :=
|
2016-11-24 05:13:05 +00:00
|
|
|
λs, !con_inv_cancel_right⁻¹ ⬝ whisker_right r⁻¹ s ⬝ !con_inv_cancel_right
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Whiskering and identity paths.
|
|
|
|
|
2015-08-04 19:02:33 +00:00
|
|
|
definition whisker_right_idp {p q : x = y} (h : p = q) :
|
2016-11-24 05:13:05 +00:00
|
|
|
whisker_right idp h = h :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction h; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
definition whisker_right_idp_left [unfold_full] (p : x = y) (q : y = z) :
|
2016-11-24 05:13:05 +00:00
|
|
|
whisker_right q idp = idp :> (p ⬝ q = p ⬝ q) :=
|
2015-08-04 19:02:33 +00:00
|
|
|
idp
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
definition whisker_left_idp_right [unfold_full] (p : x = y) (q : y = z) :
|
2015-02-21 00:30:32 +00:00
|
|
|
whisker_left p idp = idp :> (p ⬝ q = p ⬝ q) :=
|
2015-08-04 19:02:33 +00:00
|
|
|
idp
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-08-04 19:02:33 +00:00
|
|
|
definition whisker_left_idp {p q : x = y} (h : p = q) :
|
2016-02-15 17:57:51 +00:00
|
|
|
(idp_con p)⁻¹ ⬝ whisker_left idp h ⬝ idp_con q = h :=
|
|
|
|
by induction h; induction p; reflexivity
|
|
|
|
|
|
|
|
definition whisker_left_idp2 {A : Type} {a : A} (p : idp = idp :> a = a) :
|
|
|
|
whisker_left idp p = p :=
|
|
|
|
begin
|
|
|
|
refine _ ⬝ whisker_left_idp p,
|
|
|
|
exact !idp_con⁻¹
|
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
definition con2_idp [unfold_full] {p q : x = y} (h : p = q) :
|
2016-11-24 05:13:05 +00:00
|
|
|
h ◾ idp = whisker_right idp h :> (p ⬝ idp = q ⬝ idp) :=
|
2015-03-04 05:10:48 +00:00
|
|
|
idp
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
definition idp_con2 [unfold_full] {p q : x = y} (h : p = q) :
|
2015-02-21 00:30:32 +00:00
|
|
|
idp ◾ h = whisker_left idp h :> (idp ⬝ p = idp ⬝ q) :=
|
2015-03-04 05:10:48 +00:00
|
|
|
idp
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-03-19 16:09:44 +00:00
|
|
|
definition inv2_con2 {p p' : x = y} (h : p = p')
|
2016-02-15 17:57:51 +00:00
|
|
|
: h⁻² ◾ h = con.left_inv p ⬝ (con.left_inv p')⁻¹ :=
|
|
|
|
by induction h; induction p; reflexivity
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
-- The interchange law for concatenation.
|
2015-02-21 00:30:32 +00:00
|
|
|
definition con2_con_con2 {p p' p'' : x = y} {q q' q'' : y = z}
|
2014-12-12 18:17:50 +00:00
|
|
|
(a : p = p') (b : p' = p'') (c : q = q') (d : q' = q'') :
|
2016-11-23 22:59:13 +00:00
|
|
|
a ◾ c ⬝ b ◾ d = (a ⬝ b) ◾ (c ⬝ d) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction d; induction c; induction b;induction a; reflexivity
|
|
|
|
|
2016-03-19 16:09:44 +00:00
|
|
|
definition con2_eq_rl {A : Type} {x y z : A} {p p' : x = y} {q q' : y = z}
|
2016-11-24 05:13:05 +00:00
|
|
|
(a : p = p') (b : q = q') : a ◾ b = whisker_right q a ⬝ whisker_left p' b :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction b; induction a; reflexivity
|
|
|
|
|
2016-03-19 16:09:44 +00:00
|
|
|
definition con2_eq_lf {A : Type} {x y z : A} {p p' : x = y} {q q' : y = z}
|
2016-11-24 05:13:05 +00:00
|
|
|
(a : p = p') (b : q = q') : a ◾ b = whisker_left p b ⬝ whisker_right q' a :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction b; induction a; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 21:00:32 +00:00
|
|
|
definition whisker_right_con_whisker_left {x y z : A} {p p' : x = y} {q q' : y = z}
|
|
|
|
(a : p = p') (b : q = q') :
|
2016-11-24 05:13:05 +00:00
|
|
|
(whisker_right q a) ⬝ (whisker_left p' b) = (whisker_left p b) ⬝ (whisker_right q' a) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction b; induction a; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- Structure corresponding to the coherence equations of a bicategory.
|
|
|
|
|
|
|
|
-- The "pentagonator": the 3-cell witnessing the associativity pentagon.
|
2014-12-12 18:17:50 +00:00
|
|
|
definition pentagon {v w x y z : A} (p : v = w) (q : w = x) (r : x = y) (s : y = z) :
|
2015-02-21 00:30:32 +00:00
|
|
|
whisker_left p (con.assoc' q r s)
|
|
|
|
⬝ con.assoc' p (q ⬝ r) s
|
2016-11-24 05:13:05 +00:00
|
|
|
⬝ whisker_right s (con.assoc' p q r)
|
2015-02-21 00:30:32 +00:00
|
|
|
= con.assoc' p q (r ⬝ s) ⬝ con.assoc' (p ⬝ q) r s :=
|
2015-06-23 16:47:52 +00:00
|
|
|
by induction s;induction r;induction q;induction p;reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- The 3-cell witnessing the left unit triangle.
|
2014-12-12 18:17:50 +00:00
|
|
|
definition triangulator (p : x = y) (q : y = z) :
|
2016-11-24 05:13:05 +00:00
|
|
|
con.assoc' p idp q ⬝ whisker_right q (con_idp p) = whisker_left p (idp_con q) :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-03-19 16:09:44 +00:00
|
|
|
definition eckmann_hilton (p q : idp = idp :> a = a) : p ⬝ q = q ⬝ p :=
|
2016-02-15 17:57:51 +00:00
|
|
|
begin
|
|
|
|
refine (whisker_right_idp p ◾ whisker_left_idp2 q)⁻¹ ⬝ _,
|
|
|
|
refine !whisker_right_con_whisker_left ⬝ _,
|
|
|
|
refine !whisker_left_idp2 ◾ !whisker_right_idp
|
|
|
|
end
|
|
|
|
|
2016-03-19 16:09:44 +00:00
|
|
|
definition con_eq_con2 (p q : idp = idp :> a = a) : p ⬝ q = p ◾ q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
begin
|
|
|
|
refine (whisker_right_idp p ◾ whisker_left_idp2 q)⁻¹ ⬝ _,
|
2016-03-19 16:09:44 +00:00
|
|
|
exact !con2_eq_rl⁻¹
|
2016-02-15 17:57:51 +00:00
|
|
|
end
|
|
|
|
|
2016-03-19 16:09:44 +00:00
|
|
|
definition inv_eq_inv2 (p : idp = idp :> a = a) : p⁻¹ = p⁻² :=
|
2016-02-15 17:57:51 +00:00
|
|
|
begin
|
|
|
|
apply eq.cancel_right p,
|
|
|
|
refine !con.left_inv ⬝ _,
|
2016-03-19 16:09:44 +00:00
|
|
|
refine _ ⬝ !con_eq_con2⁻¹,
|
|
|
|
exact !inv2_con2⁻¹,
|
2016-02-15 17:57:51 +00:00
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- The action of functions on 2-dimensional paths
|
2015-07-07 23:37:06 +00:00
|
|
|
definition ap02 [unfold 8] [reducible] (f : A → B) {x y : A} {p q : x = y} (r : p = q)
|
2015-06-26 02:25:08 +00:00
|
|
|
: ap f p = ap f q :=
|
2015-06-23 16:47:52 +00:00
|
|
|
ap (ap f) r
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition ap02_con (f : A → B) {x y : A} {p p' p'' : x = y} (r : p = p') (r' : p' = p'') :
|
2014-12-12 18:17:50 +00:00
|
|
|
ap02 f (r ⬝ r') = ap02 f r ⬝ ap02 f r' :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; induction r'; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition ap02_con2 (f : A → B) {x y z : A} {p p' : x = y} {q q' :y = z} (r : p = p')
|
2014-12-12 18:17:50 +00:00
|
|
|
(s : q = q') :
|
2015-02-21 00:30:32 +00:00
|
|
|
ap02 f (r ◾ s) = ap_con f p q
|
2016-11-23 22:59:13 +00:00
|
|
|
⬝ (ap02 f r ◾ ap02 f s)
|
2015-02-21 00:30:32 +00:00
|
|
|
⬝ (ap_con f p' q')⁻¹ :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; induction s; induction q; induction p; reflexivity
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2016-03-19 14:38:05 +00:00
|
|
|
definition apdt02 [unfold 8] {p q : x = y} (f : Π x, P x) (r : p = q) :
|
|
|
|
apdt f p = transport2 P r (f x) ⬝ apdt f q :=
|
2016-02-15 17:57:51 +00:00
|
|
|
by induction r; exact !idp_con⁻¹
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
end eq
|
2016-04-22 19:12:25 +00:00
|
|
|
|
|
|
|
/-
|
|
|
|
an auxillary namespace for concatenation and inversion for homotopies. We put this is a separate
|
|
|
|
namespace because ⁻¹ʰ is also used as the inverse of a homomorphism
|
|
|
|
-/
|
|
|
|
|
|
|
|
open eq
|
|
|
|
namespace homotopy
|
|
|
|
infix ` ⬝h `:75 := homotopy.trans
|
|
|
|
postfix `⁻¹ʰ`:(max+1) := homotopy.symm
|
|
|
|
end homotopy
|