2014-08-07 01:21:54 +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
|
2014-08-12 20:00:09 +00:00
|
|
|
|
--
|
|
|
|
|
-- TODO: things to test:
|
|
|
|
|
-- o To what extent can we use opaque definitions outside the file?
|
|
|
|
|
-- o Try doing these proofs with tactics.
|
2014-08-22 22:46:10 +00:00
|
|
|
|
-- o Try using the simplifier on some of these proofs.
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-28 23:08:39 +00:00
|
|
|
|
import general_notation algebra.function tools.tactic
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-09-03 23:00:38 +00:00
|
|
|
|
open function
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Path
|
|
|
|
|
-- ----
|
|
|
|
|
|
|
|
|
|
inductive path {A : Type} (a : A) : A → Type :=
|
2014-08-22 22:46:10 +00:00
|
|
|
|
idpath : path a a
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-09-09 20:20:04 +00:00
|
|
|
|
namespace path
|
2014-10-21 21:08:07 +00:00
|
|
|
|
notation a ≈ b := path a b
|
|
|
|
|
notation x ≈ y `:>`:50 A:49 := @path A x y
|
2014-09-17 21:39:05 +00:00
|
|
|
|
definition idp {A : Type} {a : A} := idpath a
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Concatenation and inverse
|
|
|
|
|
-- -------------------------
|
|
|
|
|
|
|
|
|
|
definition concat {A : Type} {x y z : A} (p : x ≈ y) (q : y ≈ z) : x ≈ z :=
|
2014-09-04 22:03:59 +00:00
|
|
|
|
path.rec (λu, u) q p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition inverse {A : Type} {x y : A} (p : x ≈ y) : y ≈ x :=
|
2014-09-04 22:03:59 +00:00
|
|
|
|
path.rec (idpath x) p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
notation p₁ ⬝ p₂ := concat p₁ p₂
|
|
|
|
|
notation p ⁻¹ := inverse p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- In Coq, these are not needed, because concat and inv are kept transparent
|
2014-10-21 23:11:55 +00:00
|
|
|
|
-- definition inv_1 {A : Type} (x : A) : (idpath x)⁻¹ ≈ idpath x := idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
-- definition concat_11 {A : Type} (x : A) : idpath x ⬝ idpath x ≈ idpath x := idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- The 1-dimensional groupoid structure
|
|
|
|
|
-- ------------------------------------
|
|
|
|
|
|
|
|
|
|
-- The identity path is a right unit.
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition concat_p1 {A : Type} {x y : A} (p : x ≈ y) : p ⬝ idp ≈ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
-- The identity path is a right unit.
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition concat_1p {A : Type} {x y : A} (p : x ≈ y) : idp ⬝ p ≈ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Concatenation is associative.
|
|
|
|
|
definition concat_p_pp {A : Type} {x y z t : A} (p : x ≈ y) (q : y ≈ z) (r : z ≈ t) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ⬝ (q ⬝ r) ≈ (p ⬝ q) ⬝ r :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (rec_on q idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition concat_pp_p {A : Type} {x y z t : A} (p : x ≈ y) (q : y ≈ z) (r : z ≈ t) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(p ⬝ q) ⬝ r ≈ p ⬝ (q ⬝ r) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (rec_on q idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- The left inverse law.
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition concat_pV {A : Type} {x y : A} (p : x ≈ y) : p ⬝ p⁻¹ ≈ idp :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- The right inverse law.
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition concat_Vp {A : Type} {x y : A} (p : x ≈ y) : p⁻¹ ⬝ p ≈ idp :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Several auxiliary theorems about canceling inverses across associativity. These are somewhat
|
|
|
|
|
-- redundant, following from earlier theorems.
|
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition concat_V_pp {A : Type} {x y z : A} (p : x ≈ y) (q : y ≈ z) : p⁻¹ ⬝ (p ⬝ q) ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition concat_p_Vp {A : Type} {x y z : A} (p : x ≈ y) (q : x ≈ z) : p ⬝ (p⁻¹ ⬝ q) ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition concat_pp_V {A : Type} {x y z : A} (p : x ≈ y) (q : y ≈ z) : (p ⬝ q) ⬝ q⁻¹ ≈ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition concat_pV_p {A : Type} {x y z : A} (p : x ≈ z) (q : y ≈ z) : (p ⬝ q⁻¹) ⬝ q ≈ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (take p, rec_on p idp) p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Inverse distributes over concatenation
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition inv_pp {A : Type} {x y z : A} (p : x ≈ y) (q : y ≈ z) : (p ⬝ q)⁻¹ ≈ q⁻¹ ⬝ p⁻¹ :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition inv_Vp {A : Type} {x y z : A} (p : y ≈ x) (q : y ≈ z) : (p⁻¹ ⬝ q)⁻¹ ≈ q⁻¹ ⬝ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- universe metavariables
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition inv_pV {A : Type} {x y z : A} (p : x ≈ y) (q : z ≈ y) : (p ⬝ q⁻¹)⁻¹ ≈ q ⬝ p⁻¹ :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take q, rec_on q idp) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition inv_VV {A : Type} {x y z : A} (p : y ≈ x) (q : z ≈ y) : (p⁻¹ ⬝ q⁻¹)⁻¹ ≈ q ⬝ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (rec_on q idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Inverse is an involution.
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition inv_V {A : Type} {x y : A} (p : x ≈ y) : p⁻¹⁻¹ ≈ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Theorems for moving things around in equations
|
|
|
|
|
-- ----------------------------------------------
|
|
|
|
|
|
|
|
|
|
definition moveR_Mp {A : Type} {x y z : A} (p : x ≈ z) (q : y ≈ z) (r : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ≈ (r⁻¹ ⬝ q) → (r ⬝ p) ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (take p h, concat_1p _ ⬝ h ⬝ concat_1p _) p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveR_pM {A : Type} {x y z : A} (p : x ≈ z) (q : y ≈ z) (r : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
r ≈ q ⬝ p⁻¹ → r ⬝ p ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take q h, (concat_p1 _ ⬝ h ⬝ concat_p1 _)) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveR_Vp {A : Type} {x y z : A} (p : x ≈ z) (q : y ≈ z) (r : x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ≈ r ⬝ q → r⁻¹ ⬝ p ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (take q h, concat_1p _ ⬝ h ⬝ concat_1p _) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveR_pV {A : Type} {x y z : A} (p : z ≈ x) (q : y ≈ z) (r : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
r ≈ q ⬝ p → r ⬝ p⁻¹ ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take r h, concat_p1 _ ⬝ h ⬝ concat_p1 _) r
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_Mp {A : Type} {x y z : A} (p : x ≈ z) (q : y ≈ z) (r : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
r⁻¹ ⬝ q ≈ p → q ≈ r ⬝ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (take p h, (concat_1p _)⁻¹ ⬝ h ⬝ (concat_1p _)⁻¹) p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_pM {A : Type} {x y z : A} (p : x ≈ z) (q : y ≈ z) (r : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
q ⬝ p⁻¹ ≈ r → q ≈ r ⬝ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take q h, (concat_p1 _)⁻¹ ⬝ h ⬝ (concat_p1 _)⁻¹) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_Vp {A : Type} {x y z : A} (p : x ≈ z) (q : y ≈ z) (r : x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
r ⬝ q ≈ p → q ≈ r⁻¹ ⬝ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (take q h, (concat_1p _)⁻¹ ⬝ h ⬝ (concat_1p _)⁻¹) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_pV {A : Type} {x y z : A} (p : z ≈ x) (q : y ≈ z) (r : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
q ⬝ p ≈ r → q ≈ r ⬝ p⁻¹ :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take r h, (concat_p1 _)⁻¹ ⬝ h ⬝ (concat_p1 _)⁻¹) r
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_1M {A : Type} {x y : A} (p q : x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ⬝ q⁻¹ ≈ idp → p ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (take p h, (concat_p1 _)⁻¹ ⬝ h) p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_M1 {A : Type} {x y : A} (p q : x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
q⁻¹ ⬝ p ≈ idp → p ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (take p h, (concat_1p _)⁻¹ ⬝ h) p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_1V {A : Type} {x y : A} (p : x ≈ y) (q : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ⬝ q ≈ idp → p ≈ q⁻¹ :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (take p h, (concat_p1 _)⁻¹ ⬝ h) p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_V1 {A : Type} {x y : A} (p : x ≈ y) (q : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
q ⬝ p ≈ idp → p ≈ q⁻¹ :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (take p h, (concat_1p _)⁻¹ ⬝ h) p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveR_M1 {A : Type} {x y : A} (p q : x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
idp ≈ p⁻¹ ⬝ q → p ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take q h, h ⬝ (concat_1p _)) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveR_1M {A : Type} {x y : A} (p q : x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
idp ≈ q ⬝ p⁻¹ → p ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take q h, h ⬝ (concat_p1 _)) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveR_1V {A : Type} {x y : A} (p : x ≈ y) (q : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
idp ≈ q ⬝ p → p⁻¹ ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take q h, h ⬝ (concat_p1 _)) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveR_V1 {A : Type} {x y : A} (p : x ≈ y) (q : y ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
idp ≈ p ⬝ q → p⁻¹ ≈ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take q h, h ⬝ (concat_1p _)) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Transport
|
|
|
|
|
-- ---------
|
|
|
|
|
|
2014-09-17 21:39:05 +00:00
|
|
|
|
definition transport {A : Type} (P : A → Type) {x y : A} (p : x ≈ y) (u : P x) : P y :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
path.rec_on p u
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- This idiom makes the operation right associative.
|
2014-10-21 23:11:55 +00:00
|
|
|
|
notation p `▹`:65 x:64 := transport _ p x
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition ap ⦃A B : Type⦄ (f : A → B) {x y:A} (p : x ≈ y) : f x ≈ f y :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
path.rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-09-17 21:39:05 +00:00
|
|
|
|
definition ap01 := ap
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-09-17 21:39:05 +00:00
|
|
|
|
definition pointwise_paths {A : Type} {P : A → Type} (f g : Πx, P x) : Type :=
|
2014-08-07 01:21:54 +00:00
|
|
|
|
Πx : A, f x ≈ g x
|
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
notation f ∼ g := pointwise_paths f g
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition apD10 {A} {B : A → Type} {f g : Πx, B x} (H : f ≈ g) : f ∼ g :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
λx, path.rec_on H idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition ap10 {A B} {f g : A → B} (H : f ≈ g) : f ∼ g := apD10 H
|
|
|
|
|
|
|
|
|
|
definition ap11 {A B} {f g : A → B} (H : f ≈ g) {x y : A} (p : x ≈ y) : f x ≈ g y :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on H (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition apD {A:Type} {B : A → Type} (f : Πa:A, B a) {x y : A} (p : x ≈ y) : p ▹ (f x) ≈ f y :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
2014-08-12 20:00:09 +00:00
|
|
|
|
-- calc enviroment
|
|
|
|
|
-- ---------------
|
|
|
|
|
|
|
|
|
|
calc_subst transport
|
|
|
|
|
calc_trans concat
|
|
|
|
|
calc_refl idpath
|
2014-10-31 06:24:09 +00:00
|
|
|
|
calc_symm inverse
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
2014-08-07 01:21:54 +00:00
|
|
|
|
-- More theorems for moving things around in equations
|
|
|
|
|
-- ---------------------------------------------------
|
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition moveR_transport_p {A : Type} (P : A → Type) {x y : A} (p : x ≈ y) (u : P x) (v : P y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
u ≈ p⁻¹ ▹ v → p ▹ u ≈ v :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take v, id) v
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveR_transport_V {A : Type} (P : A → Type) {x y : A} (p : y ≈ x) (u : P x) (v : P y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
u ≈ p ▹ v → p⁻¹ ▹ u ≈ v :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take u, id) u
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_transport_V {A : Type} (P : A → Type) {x y : A} (p : x ≈ y) (u : P x) (v : P y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ▹ u ≈ v → u ≈ p⁻¹ ▹ v :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take v, id) v
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition moveL_transport_p {A : Type} (P : A → Type) {x y : A} (p : y ≈ x) (u : P x) (v : P y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p⁻¹ ▹ u ≈ v → u ≈ p ▹ v :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take u, id) u
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Functoriality of functions
|
|
|
|
|
-- --------------------------
|
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
-- Here we prove that functions behave like functors between groupoids, and that [ap] itself is
|
2014-08-07 01:21:54 +00:00
|
|
|
|
-- functorial.
|
|
|
|
|
|
|
|
|
|
-- Functions take identity paths to identity paths
|
|
|
|
|
definition ap_1 {A B : Type} (x : A) (f : A → B) : (ap f idp) ≈ idp :> (f x ≈ f x) := idp
|
|
|
|
|
|
2014-08-12 20:00:09 +00:00
|
|
|
|
definition apD_1 {A B} (x : A) (f : Π x : A, B x) : apD f idp ≈ idp :> (f x ≈ f x) := idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Functions commute with concatenation.
|
|
|
|
|
definition ap_pp {A B : Type} (f : A → B) {x y z : A} (p : x ≈ y) (q : y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
ap f (p ⬝ q) ≈ (ap f p) ⬝ (ap f q) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition ap_p_pp {A B : Type} (f : A → B) {w x y z : A} (r : f w ≈ f x) (p : x ≈ y) (q : y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
r ⬝ (ap f (p ⬝ q)) ≈ (r ⬝ ap f p) ⬝ (ap f q) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (take p, rec_on p (concat_p_pp r idp idp)) p
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition ap_pp_p {A B : Type} (f : A → B) {w x y z : A} (p : x ≈ y) (q : y ≈ z) (r : f z ≈ f w) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(ap f (p ⬝ q)) ⬝ r ≈ (ap f p) ⬝ (ap f q ⬝ r) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (rec_on p (take r, concat_pp_p _ _ _)) r
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Functions commute with path inverses.
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition inverse_ap {A B : Type} (f : A → B) {x y : A} (p : x ≈ y) : (ap f p)⁻¹ ≈ ap f (p⁻¹) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition ap_V {A B : Type} (f : A → B) {x y : A} (p : x ≈ y) : ap f (p⁻¹) ≈ (ap f p)⁻¹ :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- [ap] itself is functorial in the first argument.
|
|
|
|
|
|
|
|
|
|
definition ap_idmap {A : Type} {x y : A} (p : x ≈ y) : ap id p ≈ p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition ap_compose {A B C : Type} (f : A → B) (g : B → C) {x y : A} (p : x ≈ y) :
|
|
|
|
|
ap (g ∘ f) p ≈ ap g (ap f p) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Sometimes we don't have the actual function [compose].
|
|
|
|
|
definition ap_compose' {A B C : Type} (f : A → B) (g : B → C) {x y : A} (p : x ≈ y) :
|
2014-08-22 22:46:10 +00:00
|
|
|
|
ap (λa, g (f a)) p ≈ ap g (ap f p) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- The action of constant maps.
|
|
|
|
|
definition ap_const {A B : Type} {x y : A} (p : x ≈ y) (z : B) :
|
|
|
|
|
ap (λu, z) p ≈ idp :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Naturality of [ap].
|
2014-08-12 20:00:09 +00:00
|
|
|
|
definition concat_Ap {A B : Type} {f g : A → B} (p : Π x, f x ≈ g x) {x y : A} (q : x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(ap f q) ⬝ (p y) ≈ (p x) ⬝ (ap g q) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (concat_1p _ ⬝ (concat_p1 _)⁻¹)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Naturality of [ap] at identity.
|
2014-08-12 20:00:09 +00:00
|
|
|
|
definition concat_A1p {A : Type} {f : A → A} (p : Πx, f x ≈ x) {x y : A} (q : x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(ap f q) ⬝ (p y) ≈ (p x) ⬝ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (concat_1p _ ⬝ (concat_p1 _)⁻¹)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-12 20:00:09 +00:00
|
|
|
|
definition concat_pA1 {A : Type} {f : A → A} (p : Πx, x ≈ f x) {x y : A} (q : x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(p x) ⬝ (ap f q) ≈ q ⬝ (p y) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (concat_p1 _ ⬝ (concat_1p _)⁻¹)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Naturality with other paths hanging around.
|
|
|
|
|
|
2014-08-12 20:00:09 +00:00
|
|
|
|
definition concat_pA_pp {A B : Type} {f g : A → B} (p : Πx, f x ≈ g x) {x y : A} (q : x ≈ y)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
{w z : B} (r : w ≈ f x) (s : g y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(r ⬝ ap f q) ⬝ (p y ⬝ s) ≈ (r ⬝ p x) ⬝ (ap g q ⬝ s) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on s (rec_on q idp)
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition concat_pA_p {A B : Type} {f g : A → B} (p : Πx, f x ≈ g x) {x y : A} (q : x ≈ y)
|
2014-08-12 20:00:09 +00:00
|
|
|
|
{w : B} (r : w ≈ f x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(r ⬝ ap f q) ⬝ p y ≈ (r ⬝ p x) ⬝ ap g q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q idp
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
|
|
|
|
-- TODO: try this using the simplifier, and compare proofs
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition concat_A_pp {A B : Type} {f g : A → B} (p : Πx, f x ≈ g x) {x y : A} (q : x ≈ y)
|
2014-08-12 20:00:09 +00:00
|
|
|
|
{z : B} (s : g y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(ap f q) ⬝ (p y ⬝ s) ≈ (p x) ⬝ (ap g q ⬝ s) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on s (rec_on q
|
2014-08-12 20:00:09 +00:00
|
|
|
|
(calc
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(ap f idp) ⬝ (p x ⬝ idp) ≈ idp ⬝ p x : idp
|
2014-08-12 20:00:09 +00:00
|
|
|
|
... ≈ p x : concat_1p _
|
2014-10-21 23:11:55 +00:00
|
|
|
|
... ≈ (p x) ⬝ (ap g idp ⬝ idp) : idp))
|
2014-08-12 20:00:09 +00:00
|
|
|
|
-- This also works:
|
2014-10-25 20:36:38 +00:00
|
|
|
|
-- rec_on s (rec_on q (concat_1p _ ▹ idp))
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
|
|
|
|
definition concat_pA1_pp {A : Type} {f : A → A} (p : Πx, f x ≈ x) {x y : A} (q : x ≈ y)
|
|
|
|
|
{w z : A} (r : w ≈ f x) (s : y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(r ⬝ ap f q) ⬝ (p y ⬝ s) ≈ (r ⬝ p x) ⬝ (q ⬝ s) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on s (rec_on q idp)
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
|
|
|
|
definition concat_pp_A1p {A : Type} {g : A → A} (p : Πx, x ≈ g x) {x y : A} (q : x ≈ y)
|
|
|
|
|
{w z : A} (r : w ≈ x) (s : g y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(r ⬝ p x) ⬝ (ap g q ⬝ s) ≈ (r ⬝ q) ⬝ (p y ⬝ s) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on s (rec_on q idp)
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
|
|
|
|
definition concat_pA1_p {A : Type} {f : A → A} (p : Πx, f x ≈ x) {x y : A} (q : x ≈ y)
|
|
|
|
|
{w : A} (r : w ≈ f x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(r ⬝ ap f q) ⬝ p y ≈ (r ⬝ p x) ⬝ q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q idp
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
|
|
|
|
definition concat_A1_pp {A : Type} {f : A → A} (p : Πx, f x ≈ x) {x y : A} (q : x ≈ y)
|
|
|
|
|
{z : A} (s : y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(ap f q) ⬝ (p y ⬝ s) ≈ (p x) ⬝ (q ⬝ s) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on s (rec_on q (concat_1p _ ▹ idp))
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
|
|
|
|
definition concat_pp_A1 {A : Type} {g : A → A} (p : Πx, x ≈ g x) {x y : A} (q : x ≈ y)
|
|
|
|
|
{w : A} (r : w ≈ x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(r ⬝ p x) ⬝ ap g q ≈ (r ⬝ q) ⬝ p y :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q idp
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
|
|
|
|
definition concat_p_A1p {A : Type} {g : A → A} (p : Πx, x ≈ g x) {x y : A} (q : x ≈ y)
|
|
|
|
|
{z : A} (s : g y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p x ⬝ (ap g q ⬝ s) ≈ q ⬝ (p y ⬝ s) :=
|
2014-10-28 23:08:39 +00:00
|
|
|
|
begin
|
|
|
|
|
apply (rec_on s),
|
|
|
|
|
apply (rec_on q),
|
|
|
|
|
apply (concat_1p _ ▹ idp)
|
|
|
|
|
end
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Action of [apD10] and [ap10] on paths
|
|
|
|
|
-- -------------------------------------
|
|
|
|
|
|
|
|
|
|
-- Application of paths between functions preserves the groupoid structure
|
|
|
|
|
|
|
|
|
|
definition apD10_1 {A} {B : A → Type} (f : Πx, B x) (x : A) : apD10 (idpath f) x ≈ idp := idp
|
|
|
|
|
|
|
|
|
|
definition apD10_pp {A} {B : A → Type} {f f' f'' : Πx, B x} (h : f ≈ f') (h' : f' ≈ f'') (x : A) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
apD10 (h ⬝ h') x ≈ apD10 h x ⬝ apD10 h' x :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on h (take h', rec_on h' idp) h'
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition apD10_V {A : Type} {B : A → Type} {f g : Πx : A, B x} (h : f ≈ g) (x : A) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
apD10 (h⁻¹) x ≈ (apD10 h x)⁻¹ :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on h idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition ap10_1 {A B} {f : A → B} (x : A) : ap10 (idpath f) x ≈ idp := idp
|
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition ap10_pp {A B} {f f' f'' : A → B} (h : f ≈ f') (h' : f' ≈ f'') (x : A) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
ap10 (h ⬝ h') x ≈ ap10 h x ⬝ ap10 h' x := apD10_pp h h' x
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition ap10_V {A B} {f g : A→B} (h : f ≈ g) (x:A) : ap10 (h⁻¹) x ≈ (ap10 h x)⁻¹ := apD10_V h x
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- [ap10] also behaves nicely on paths produced by [ap]
|
|
|
|
|
definition ap_ap10 {A B C} (f g : A → B) (h : B → C) (p : f ≈ g) (a : A) :
|
|
|
|
|
ap h (ap10 p a) ≈ ap10 (ap (λ f', h ∘ f') p) a:=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Transport and the groupoid structure of paths
|
|
|
|
|
-- ---------------------------------------------
|
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport_1 {A : Type} (P : A → Type) {x : A} (u : P x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
idp ▹ u ≈ u := idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition transport_pp {A : Type} (P : A → Type) {x y z : A} (p : x ≈ y) (q : y ≈ z) (u : P x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ⬝ q ▹ u ≈ q ▹ p ▹ u :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport_pV {A : Type} (P : A → Type) {x y : A} (p : x ≈ y) (z : P y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ▹ p⁻¹ ▹ z ≈ z :=
|
|
|
|
|
(transport_pp P (p⁻¹) p z)⁻¹ ⬝ ap (λr, transport P r z) (concat_Vp p)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport_Vp {A : Type} (P : A → Type) {x y : A} (p : x ≈ y) (z : P x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p⁻¹ ▹ p ▹ z ≈ z :=
|
|
|
|
|
(transport_pp P p (p⁻¹) z)⁻¹ ⬝ ap (λr, transport P r z) (concat_pV p)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport_p_pp {A : Type} (P : A → Type)
|
|
|
|
|
{x y z w : A} (p : x ≈ y) (q : y ≈ z) (r : z ≈ w) (u : P x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
ap (λe, e ▹ u) (concat_p_pp p q r) ⬝ (transport_pp P (p ⬝ q) r u) ⬝
|
2014-08-07 01:21:54 +00:00
|
|
|
|
ap (transport P r) (transport_pp P p q u)
|
2014-10-21 23:11:55 +00:00
|
|
|
|
≈ (transport_pp P p (q ⬝ r) u) ⬝ (transport_pp P q r (p ▹ u))
|
|
|
|
|
:> ((p ⬝ (q ⬝ r)) ▹ u ≈ r ▹ q ▹ p ▹ u) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (rec_on q (rec_on p idp))
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Here is another coherence lemma for transport.
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport_pVp {A} (P : A → Type) {x y : A} (p : x ≈ y) (z : P x) :
|
|
|
|
|
transport_pV P p (transport P p z) ≈ ap (transport P p) (transport_Vp P p z) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Dependent transport in a doubly dependent type.
|
|
|
|
|
definition transportD {A : Type} (B : A → Type) (C : Π a : A, B a → Type)
|
2014-08-22 22:46:10 +00:00
|
|
|
|
{x1 x2 : A} (p : x1 ≈ x2) (y : B x1) (z : C x1 y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
C x2 (p ▹ y) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p z
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Transporting along higher-dimensional paths
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport2 {A : Type} (P : A → Type) {x y : A} {p q : x ≈ y} (r : p ≈ q) (z : P x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ▹ z ≈ q ▹ z :=
|
|
|
|
|
ap (λp', p' ▹ z) r
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- An alternative definition.
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport2_is_ap10 {A : Type} (Q : A → Type) {x y : A} {p q : x ≈ y} (r : p ≈ q)
|
|
|
|
|
(z : Q x) :
|
2014-08-07 01:21:54 +00:00
|
|
|
|
transport2 Q r z ≈ ap10 (ap (transport Q) r) z :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition transport2_p2p {A : Type} (P : A → Type) {x y : A} {p1 p2 p3 : x ≈ y}
|
2014-08-22 22:46:10 +00:00
|
|
|
|
(r1 : p1 ≈ p2) (r2 : p2 ≈ p3) (z : P x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
transport2 P (r1 ⬝ r2) z ≈ transport2 P r1 z ⬝ transport2 P r2 z :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r1 (rec_on r2 idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport2_V {A : Type} (Q : A → Type) {x y : A} {p q : x ≈ y} (r : p ≈ q) (z : Q x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
transport2 Q (r⁻¹) z ≈ ((transport2 Q r z)⁻¹) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition concat_AT {A : Type} (P : A → Type) {x y : A} {p q : x ≈ y} {z w : P x} (r : p ≈ q)
|
|
|
|
|
(s : z ≈ w) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
ap (transport P p) s ⬝ transport2 P r w ≈ transport2 P r z ⬝ ap (transport P q) s :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (concat_p1 _ ⬝ (concat_1p _)⁻¹)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- TODO (from Coq library): What should this be called?
|
|
|
|
|
definition ap_transport {A} {P Q : A → Type} {x y : A} (p : x ≈ y) (f : Πx, P x → Q x) (z : P x) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
f y (p ▹ z) ≈ (p ▹ (f x z)) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Transporting in particular fibrations
|
|
|
|
|
-- -------------------------------------
|
|
|
|
|
|
2014-08-23 00:55:08 +00:00
|
|
|
|
/-
|
|
|
|
|
From the Coq HoTT library:
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
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/
|
2014-08-07 01:21:54 +00:00
|
|
|
|
subdirectory. Here we consider only the most basic cases.
|
2014-08-23 00:55:08 +00:00
|
|
|
|
-/
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Transporting in a constant fibration.
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport_const {A B : Type} {x1 x2 : A} (p : x1 ≈ x2) (y : B) :
|
2014-08-07 01:21:54 +00:00
|
|
|
|
transport (λx, B) p y ≈ y :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition transport2_const {A B : Type} {x1 x2 : A} {p q : x1 ≈ x2} (r : p ≈ q) (y : B) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
transport_const p y ≈ transport2 (λu, B) r y ⬝ transport_const q y :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (concat_1p _)⁻¹
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Transporting in a pulled back fibration.
|
|
|
|
|
definition transport_compose {A B} {x y : A} (P : B → Type) (f : A → B) (p : x ≈ y) (z : P (f x)) :
|
|
|
|
|
transport (λx, P (f x)) p z ≈ transport P (ap f p) z :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport_precompose {A B C} (f : A → B) (g g' : B → C) (p : g ≈ g') :
|
2014-08-07 01:21:54 +00:00
|
|
|
|
transport (λh : B → C, g ∘ f ≈ h ∘ f) p idp ≈ ap (λh, h ∘ f) p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition apD10_ap_precompose {A B C} (f : A → B) (g g' : B → C) (p : g ≈ g') (a : A) :
|
|
|
|
|
apD10 (ap (λh : B → C, h ∘ f) p) a ≈ apD10 p (f a) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition apD10_ap_postcompose {A B C} (f : B → C) (g g' : A → B) (p : g ≈ g') (a : A) :
|
2014-08-07 01:21:54 +00:00
|
|
|
|
apD10 (ap (λh : A → B, f ∘ h) p) a ≈ ap f (apD10 p a) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- A special case of [transport_compose] which seems to come up a lot.
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition transport_idmap_ap A (P : A → Type) x y (p : x ≈ y) (u : P x) :
|
2014-08-07 01:21:54 +00:00
|
|
|
|
transport P p u ≈ transport (λz, z) (ap P p) u :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- The behavior of [ap] and [apD]
|
|
|
|
|
-- ------------------------------
|
|
|
|
|
|
|
|
|
|
-- In a constant fibration, [apD] reduces to [ap], modulo [transport_const].
|
|
|
|
|
definition apD_const {A B} {x y : A} (f : A → B) (p: x ≈ y) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
apD f p ≈ transport_const p (f x) ⬝ ap f p :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- The 2-dimensional groupoid structure
|
|
|
|
|
-- ------------------------------------
|
|
|
|
|
|
|
|
|
|
-- Horizontal composition of 2-dimensional paths.
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition concat2 {A} {x y z : A} {p p' : x ≈ y} {q q' : y ≈ z} (h : p ≈ p') (h' : q ≈ q') :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
p ⬝ q ≈ p' ⬝ q' :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on h (rec_on h' idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
infixl `◾`:75 := concat2
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- 2-dimensional path inversion
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition inverse2 {A : Type} {x y : A} {p q : x ≈ y} (h : p ≈ q) : p⁻¹ ≈ q⁻¹ :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on h idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Whiskering
|
|
|
|
|
-- ----------
|
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition whiskerL {A : Type} {x y z : A} (p : x ≈ y) {q r : y ≈ z} (h : q ≈ r) : p ⬝ q ≈ p ⬝ r :=
|
|
|
|
|
idp ◾ h
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition whiskerR {A : Type} {x y z : A} {p q : x ≈ y} (h : p ≈ q) (r : y ≈ z) : p ⬝ r ≈ q ⬝ r :=
|
|
|
|
|
h ◾ idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Unwhiskering, a.k.a. cancelling
|
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition cancelL {A} {x y z : A} (p : x ≈ y) (q r : y ≈ z) : (p ⬝ q ≈ p ⬝ r) → (q ≈ r) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on p (take r, rec_on r (take q a, (concat_1p q)⁻¹ ⬝ a)) r q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition cancelR {A} {x y z : A} (p q : x ≈ y) (r : y ≈ z) : (p ⬝ r ≈ q ⬝ r) → (p ≈ q) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (rec_on p (take q a, a ⬝ concat_p1 q)) q
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Whiskering and identity paths.
|
|
|
|
|
|
|
|
|
|
definition whiskerR_p1 {A : Type} {x y : A} {p q : x ≈ y} (h : p ≈ q) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(concat_p1 p)⁻¹ ⬝ whiskerR h idp ⬝ concat_p1 q ≈ h :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on h (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition whiskerR_1p {A : Type} {x y z : A} (p : x ≈ y) (q : y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
whiskerR idp q ≈ idp :> (p ⬝ q ≈ p ⬝ q) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition whiskerL_p1 {A : Type} {x y z : A} (p : x ≈ y) (q : y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
whiskerL p idp ≈ idp :> (p ⬝ q ≈ p ⬝ q) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition whiskerL_1p {A : Type} {x y : A} {p q : x ≈ y} (h : p ≈ q) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(concat_1p p) ⁻¹ ⬝ whiskerL idp h ⬝ concat_1p q ≈ h :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on h (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition concat2_p1 {A : Type} {x y : A} {p q : x ≈ y} (h : p ≈ q) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
h ◾ idp ≈ whiskerR h idp :> (p ⬝ idp ≈ q ⬝ idp) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on h idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition concat2_1p {A : Type} {x y : A} {p q : x ≈ y} (h : p ≈ q) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
idp ◾ h ≈ whiskerL idp h :> (idp ⬝ p ≈ idp ⬝ q) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on h idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- TODO: note, 4 inductions
|
|
|
|
|
-- The interchange law for concatenation.
|
|
|
|
|
definition concat_concat2 {A : Type} {x y z : A} {p p' p'' : x ≈ y} {q q' q'' : y ≈ z}
|
|
|
|
|
(a : p ≈ p') (b : p' ≈ p'') (c : q ≈ q') (d : q' ≈ q'') :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(a ◾ c) ⬝ (b ◾ d) ≈ (a ⬝ b) ◾ (c ⬝ d) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on d (rec_on c (rec_on b (rec_on a idp)))
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition concat_whisker {A} {x y z : A} (p p' : x ≈ y) (q q' : y ≈ z) (a : p ≈ p') (b : q ≈ q') :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
(whiskerR a q) ⬝ (whiskerL p' b) ≈ (whiskerL p b) ⬝ (whiskerR a q') :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on b (rec_on a (concat_1p _)⁻¹)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- Structure corresponding to the coherence equations of a bicategory.
|
|
|
|
|
|
|
|
|
|
-- The "pentagonator": the 3-cell witnessing the associativity pentagon.
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition pentagon {A : Type} {v w x y z : A} (p : v ≈ w) (q : w ≈ x) (r : x ≈ y) (s : y ≈ z) :
|
2014-08-07 01:21:54 +00:00
|
|
|
|
whiskerL p (concat_p_pp q r s)
|
2014-10-21 23:11:55 +00:00
|
|
|
|
⬝ concat_p_pp p (q ⬝ r) s
|
|
|
|
|
⬝ whiskerR (concat_p_pp p q r) s
|
|
|
|
|
≈ concat_p_pp p q (r ⬝ s) ⬝ concat_p_pp (p ⬝ q) r s :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on s (rec_on r (rec_on q (rec_on p idp)))
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- The 3-cell witnessing the left unit triangle.
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition triangulator {A : Type} {x y z : A} (p : x ≈ y) (q : y ≈ z) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
concat_p_pp p idp q ⬝ whiskerR (concat_p1 p) q ≈ whiskerL p (concat_1p q) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on q (rec_on p idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-10-21 23:11:55 +00:00
|
|
|
|
definition eckmann_hilton {A : Type} {x:A} (p q : idp ≈ idp :> (x ≈ x)) : p ⬝ q ≈ q ⬝ p :=
|
|
|
|
|
(!whiskerR_p1 ◾ !whiskerL_1p)⁻¹
|
|
|
|
|
⬝ (!concat_p1 ◾ !concat_p1)
|
|
|
|
|
⬝ (!concat_1p ◾ !concat_1p)
|
|
|
|
|
⬝ !concat_whisker
|
|
|
|
|
⬝ (!concat_1p ◾ !concat_1p)⁻¹
|
|
|
|
|
⬝ (!concat_p1 ◾ !concat_p1)⁻¹
|
|
|
|
|
⬝ (!whiskerL_1p ◾ !whiskerR_p1)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- The action of functions on 2-dimensional paths
|
|
|
|
|
definition ap02 {A B : Type} (f:A → B) {x y : A} {p q : x ≈ y} (r : p ≈ q) : ap f p ≈ ap f q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r idp
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
definition ap02_pp {A B} (f : A → B) {x y : A} {p p' p'' : x ≈ y} (r : p ≈ p') (r' : p' ≈ p'') :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
ap02 f (r ⬝ r') ≈ ap02 f r ⬝ ap02 f r' :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (rec_on r' idp)
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition ap02_p2p {A B} (f : A → B) {x y z : A} {p p' : x ≈ y} {q q' :y ≈ z} (r : p ≈ p')
|
|
|
|
|
(s : q ≈ q') :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
ap02 f (r ◾ s) ≈ ap_pp f p q
|
|
|
|
|
⬝ (ap02 f r ◾ ap02 f s)
|
|
|
|
|
⬝ (ap_pp f p' q')⁻¹ :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (rec_on s (rec_on q (rec_on p idp)))
|
2014-08-12 20:00:09 +00:00
|
|
|
|
|
2014-10-25 20:36:38 +00:00
|
|
|
|
-- rec_on r (rec_on s (rec_on p (rec_on q idp)))
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
definition apD02 {A : Type} {B : A → Type} {x y : A} {p q : x ≈ y} (f : Π x, B x) (r : p ≈ q) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
apD f p ≈ transport2 B r (f x) ⬝ apD f q :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r (concat_1p _)⁻¹
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- And now for a lemma whose statement is much longer than its proof.
|
|
|
|
|
definition apD02_pp {A} (B : A → Type) (f : Π x:A, B x) {x y : A}
|
2014-08-22 22:46:10 +00:00
|
|
|
|
{p1 p2 p3 : x ≈ y} (r1 : p1 ≈ p2) (r2 : p2 ≈ p3) :
|
2014-10-21 23:11:55 +00:00
|
|
|
|
apD02 f (r1 ⬝ r2) ≈ apD02 f r1
|
|
|
|
|
⬝ whiskerL (transport2 B r1 (f x)) (apD02 f r2)
|
|
|
|
|
⬝ concat_p_pp _ _ _
|
|
|
|
|
⬝ (whiskerR ((transport2_p2p B r1 r2 (f x))⁻¹) (apD f p3)) :=
|
2014-10-25 20:36:38 +00:00
|
|
|
|
rec_on r2 (rec_on r1 (rec_on p1 idp))
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
2014-08-23 00:55:08 +00:00
|
|
|
|
/- From the Coq version:
|
2014-08-07 01:21:54 +00:00
|
|
|
|
|
|
|
|
|
-- ** Tactics, hints, and aliases
|
|
|
|
|
|
2014-08-22 22:46:10 +00:00
|
|
|
|
-- [concat], with arguments flipped. Useful mainly in the idiom [apply (concatR (expression))].
|
|
|
|
|
-- Given as a notation not a definition so that the resultant terms are literally instances of
|
2014-08-12 20:00:09 +00:00
|
|
|
|
-- [concat], with no unfolding required.
|
2014-08-07 01:21:54 +00:00
|
|
|
|
Notation concatR := (λp q, concat q p).
|
|
|
|
|
|
|
|
|
|
Hint Resolve
|
|
|
|
|
concat_1p concat_p1 concat_p_pp
|
|
|
|
|
inv_pp inv_V
|
|
|
|
|
: path_hints.
|
|
|
|
|
|
|
|
|
|
(* First try at a paths db
|
|
|
|
|
We want the RHS of the equation to become strictly simpler
|
|
|
|
|
Hint Rewrite
|
2014-10-21 23:11:55 +00:00
|
|
|
|
⬝concat_p1
|
|
|
|
|
⬝concat_1p
|
|
|
|
|
⬝concat_p_pp (* there is a choice here !*)
|
|
|
|
|
⬝concat_pV
|
|
|
|
|
⬝concat_Vp
|
|
|
|
|
⬝concat_V_pp
|
|
|
|
|
⬝concat_p_Vp
|
|
|
|
|
⬝concat_pp_V
|
|
|
|
|
⬝concat_pV_p
|
|
|
|
|
(*⬝inv_pp*) (* I am not sure about this one
|
|
|
|
|
⬝inv_V
|
|
|
|
|
⬝moveR_Mp
|
|
|
|
|
⬝moveR_pM
|
|
|
|
|
⬝moveL_Mp
|
|
|
|
|
⬝moveL_pM
|
|
|
|
|
⬝moveL_1M
|
|
|
|
|
⬝moveL_M1
|
|
|
|
|
⬝moveR_M1
|
|
|
|
|
⬝moveR_1M
|
|
|
|
|
⬝ap_1
|
|
|
|
|
(* ⬝ap_pp
|
|
|
|
|
⬝ap_p_pp ?*)
|
|
|
|
|
⬝inverse_ap
|
|
|
|
|
⬝ap_idmap
|
|
|
|
|
(* ⬝ap_compose
|
|
|
|
|
⬝ap_compose'*)
|
|
|
|
|
⬝ap_const
|
2014-08-07 01:21:54 +00:00
|
|
|
|
(* Unsure about naturality of [ap], was absent in the old implementation*)
|
2014-10-21 23:11:55 +00:00
|
|
|
|
⬝apD10_1
|
2014-08-07 01:21:54 +00:00
|
|
|
|
:paths.
|
|
|
|
|
|
|
|
|
|
Ltac hott_simpl :=
|
|
|
|
|
autorewrite with paths in * |- * ; auto with path_hints.
|
|
|
|
|
|
2014-08-28 20:13:04 +00:00
|
|
|
|
-/
|
2014-09-09 20:20:04 +00:00
|
|
|
|
end path
|