Built with Alectryon, running Coq+SerAPI v8.19.0+0.19.3. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
(** * Theorems about disjoint unions *)
[Loading ML file number_string_notation_plugin.cmxs (using legacy method) ... done]
Require Import Types.Empty Types.Unit Types.Prod Types.Sigma.(** The following are only required for the equivalence between [sum] and a sigma type *)Require Import Types.Bool.LocalOpen Scope trunc_scope.LocalOpen Scope path_scope.Local Set Universe Minimization ToSet.Generalizable VariablesX A B f g n.Schemesum_ind := Induction for sum SortType.Arguments sum_ind {A B} P f g s : rename.Schemesum_rec := Minimality for sum SortType.Arguments sum_rec {A B} P f g s : rename.(** ** Co-Unpacking *)(** Sums are coproducts, so there should be a dual to [unpack_prod]. I'm not sure what it is, though. *)(** ** Eta conversion *)Definitioneta_sum `(z : A + B) : match z with
| inl z' => inl z'
| inr z' => inr z'
end = z
:= match z with inl _ => 1 | inr _ => 1end.(** ** Paths *)Definitioncode_sum {AB} (zz' : A + B) : Type
:= match z, z' with
| inl a, inl a' => a = a'
| inr b, inr b' => b = b'
| _, _ => Empty end.
A, B: Type z, z': A + B c: code_sum z z'
z = z'
A, B: Type z, z': A + B c: code_sum z z'
z = z'
A, B: Type a, a0: A c: code_sum (inl a) (inl a0)
inl a = inl a0
A, B: Type a: A b: B c: code_sum (inl a) (inr b)
inl a = inr b
A, B: Type b: B a: A c: code_sum (inr b) (inl a)
inr b = inl a
A, B: Type b, b0: B c: code_sum (inr b) (inr b0)
inr b = inr b0
A, B: Type a, a0: A c: code_sum (inl a) (inl a0)
inl a = inl a0
apply ap, c.
A, B: Type a: A b: B c: code_sum (inl a) (inr b)
inl a = inr b
elim c.
A, B: Type b: B a: A c: code_sum (inr b) (inl a)
inr b = inl a
elim c.
A, B: Type b, b0: B c: code_sum (inr b) (inr b0)
inr b = inr b0
apply ap, c.Defined.Definitionpath_sum_inv {AB : Type} {zz' : A + B}
(pq : z = z')
: match z, z' with
| inl z0, inl z'0 => z0 = z'0
| inr z0, inr z'0 => z0 = z'0
| _, _ => Empty
end
:= match pq with
| 1 => match z with
| inl _ => 1
| inr _ => 1endend.Definitioninl_ne_inr {AB : Type} (a : A) (b : B)
: inl a <> inr b
:= path_sum_inv.Definitioninr_ne_inl {AB : Type} (b : B) (a : A)
: inr b <> inl a
:= path_sum_inv.(** This version produces only paths between closed terms, as opposed to paths between arbitrary inhabitants of sum types. *)Definitionpath_sum_inl {A : Type} (B : Type) {xx' : A}
: inl x = inl x' -> x = x'
:= funp => @path_sum_inv A B _ _ p.Definitionpath_sum_inr (A : Type) {B : Type} {xx' : B}
: inr x = inr x' -> x = x'
:= funp => @path_sum_inv A B _ _ p.(** This lets us identify the path space of a sum type, up to equivalence. *)Definitioneisretr_path_sum {AB} {zz' : A + B}
: path_sum o (@path_sum_inv _ _ z z') == idmap
:= funp => match p as p in (_ = z') return
path_sum (path_sum_inv p) = p
with
| 1 => match z as z return
(@path_sum _ _ z z) (path_sum_inv 1) = 1with
| inl _ => 1
| inr _ => 1endend.
A, B: Type z, z': A + B
path_sum_inv o path_sum == idmap
A, B: Type z, z': A + B
path_sum_inv o path_sum == idmap
A, B: Type z, z': A + B p: code_sum z z'
path_sum_inv (path_sum p) = p
destruct z, z', p; exact idpath.Defined.
A, B: Type z, z': A + B
IsEquiv path_sum
A, B: Type z, z': A + B
IsEquiv path_sum
A, B: Type z, z': A + B
forallx : code_sum z z',
eisretr_path_sum (path_sum x) =
ap path_sum (eissect_path_sum x)
destruct z, z';
intros [];
exact idpath.Defined.Definitionequiv_path_sum {AB : Type} (zz' : A + B)
:= Build_Equiv _ _ _ (@isequiv_path_sum A B z z').(** ** Fibers of [inl] and [inr] *)(** It follows that the fibers of [inl] and [inr] are decidable hprops. *)
exact (decidable_equiv _
(funxp => inr_ne_inl (xp.1) a xp.2)^-1 _).
A, B: Type b: B
Decidable {x : B & inr x = inr b}
exact (decidable_equiv' _
(equiv_functor_sigma_id
(funx => equiv_path_sum (inr x) (inr b))) _).Defined.(** ** Decomposition *)(** Conversely, a decidable predicate decomposes a type as a sum. *)SectionDecidableSum.Context `{Funext} {A : Type} (P : A -> Type)
`{foralla, IsHProp (P a)} `{foralla, Decidable (P a)}.
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a)
A <~> {x : A & P x} + {x : A & ~ P x}
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a)
A <~> {x : A & P x} + {x : A & ~ P x}
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a)
A -> {x : A & P x} + {x : A & ~ P x}
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= ?Goal: A -> {x : A & P x} + {x : A & ~ P x}
A <~> {x : A & P x} + {x : A & ~ P x}
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a)
A -> {x : A & P x} + {x : A & ~ P x}
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) x: A
{x : A & P x} + {x : A & ~ P x}
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) x: A p: P x
{x : A & P x} + {x : A & ~ P x}
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) x: A np: ~ P x
{x : A & P x} + {x : A & ~ P x}
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) x: A p: P x
{x : A & P x} + {x : A & ~ P x}
exact (inl (x;p)).
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) x: A np: ~ P x
{x : A & P x} + {x : A & ~ P x}
exact (inr (x;np)).
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x}
A <~> {x : A & P x} + {x : A & ~ P x}
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x}
IsEquiv f
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x}
(funx : {x : A & P x} + {x : A & ~ P x} =>
f match x with
| inl y => y.1
| inr y => y.1end) == idmap
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x}
(funx : A =>
match f x with
| inl y => y.1
| inr y => y.1end) == idmap
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x}
(funx : {x : A & P x} + {x : A & ~ P x} =>
f match x with
| inl y => y.1
| inr y => y.1end) == idmap
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x} x: A p, p': P x
inl (x; p') = inl (x; p)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x} x: A p: P x np': ~ P x
inr (x; np') = inl (x; p)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x} x: A np: ~ P x p': P x
inl (x; p') = inr (x; np)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x} x: A np, np': ~ P x
inr (x; np') = inr (x; np)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x} x: A p, p': P x
inl (x; p') = inl (x; p)
apply ap, ap, path_ishprop.
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x} x: A p: P x np': ~ P x
inr (x; np') = inl (x; p)
elim (np' p).
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x} x: A np: ~ P x p': P x
inl (x; p') = inr (x; np)
elim (np p').
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x} x: A np, np': ~ P x
inr (x; np') = inr (x; np)
apply ap, ap, path_ishprop.
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x}
(funx : A =>
match f x with
| inl y => y.1
| inr y => y.1end) == idmap
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) f:= funx : A =>
lets := dec (P x) inmatch s with
| inl p => (funp0 : P x => inl (x; p0)) p
| inr n => (funnp : ~ P x => inr (x; np)) n
end: A -> {x : A & P x} + {x : A & ~ P x} x: A
matchmatch dec (P x) with
| inl p => inl (x; p)
| inr n => inr (x; n)
endwith
| inl y => y.1
| inr y => y.1end = x
destruct (dec (P x)); cbn; reflexivity.Defined.
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A p: P a
equiv_decidable_sum a = inl (a; p)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A p: P a
equiv_decidable_sum a = inl (a; p)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A p: P a
match dec (P a) with
| inl p => inl (a; p)
| inr n => inr (a; n)
end = inl (a; p)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A p, p': P a
inl (a; p') = inl (a; p)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A p: P a np': ~ P a
inr (a; np') = inl (a; p)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A p, p': P a
inl (a; p') = inl (a; p)
apply ap, path_sigma_hprop; reflexivity.
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A p: P a np': ~ P a
inr (a; np') = inl (a; p)
elim (np' p).Defined.
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A np: ~ P a
equiv_decidable_sum a = inr (a; np)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A np: ~ P a
equiv_decidable_sum a = inr (a; np)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A np: ~ P a
match dec (P a) with
| inl p => inl (a; p)
| inr n => inr (a; n)
end = inr (a; np)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A np: ~ P a p': P a
inl (a; p') = inr (a; np)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A np, np': ~ P a
inr (a; np') = inr (a; np)
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A np: ~ P a p': P a
inl (a; p') = inr (a; np)
elim (np p').
H: Funext A: Type P: A -> Type H0: foralla : A, IsHProp (P a) H1: foralla : A, Decidable (P a) a: A np, np': ~ P a
inr (a; np') = inr (a; np)
apply ap, path_sigma_hprop; reflexivity.Defined.EndDecidableSum.(** ** Transport *)Definitiontransport_sum {A : Type} {PQ : A -> Type} {aa' : A} (p : a = a')
(z : P a + Q a)
: transport (funa => P a + Q a) p z = match z with
| inl z' => inl (p # z')
| inr z' => inr (p # z')
end
:= match p with idpath => match z with inl _ => 1 | inr _ => 1endend.(** ** Detecting the summands *)Definitionis_inl_and {AB} (P : A -> Type@{p}) : A + B -> Type@{p}
:= funx => match x with inl a => P a | inr _ => Empty end.Definitionis_inr_and {AB} (P : B -> Type@{p}) : A + B -> Type@{p}
:= funx => match x with inl _ => Empty | inr b => P b end.Definitionis_inl {AB} : A + B -> Type0
:= is_inl_and (fun_ => Unit).Definitionis_inr {AB} : A + B -> Type0
:= is_inr_and (fun_ => Unit).
A, B: Type x: A + B
IsHProp (is_inl x)
A, B: Type x: A + B
IsHProp (is_inl x)
destruct x; exact _.Defined.
A, B: Type x: A + B
IsHProp (is_inr x)
A, B: Type x: A + B
IsHProp (is_inr x)
destruct x; exact _.Defined.
A, B: Type x: A + B
Decidable (is_inl x)
A, B: Type x: A + B
Decidable (is_inl x)
destruct x; exact _.Defined.
A, B: Type x: A + B
Decidable (is_inr x)
A, B: Type x: A + B
Decidable (is_inr x)
destruct x; exact _.Defined.
A, B: Type z: A + B
is_inl z -> A
A, B: Type z: A + B
is_inl z -> A
A, B: Type a: A
is_inl (inl a) -> A
A, B: Type b: B
is_inl (inr b) -> A
A, B: Type a: A
is_inl (inl a) -> A
intros; exact a.
A, B: Type b: B
is_inl (inr b) -> A
intros e; elim e.Defined.
A, B: Type z: A + B
is_inr z -> B
A, B: Type z: A + B
is_inr z -> B
A, B: Type a: A
is_inr (inl a) -> B
A, B: Type b: B
is_inr (inr b) -> B
A, B: Type a: A
is_inr (inl a) -> B
intros e; elim e.
A, B: Type b: B
is_inr (inr b) -> B
intros; exact b.Defined.Definitionis_inl_not_inr {AB} (x : A + B) (na : ~ A)
: is_inr x
:= match x with
| inl a => na a
| inr b => tt
end.Definitionis_inr_not_inl {AB} (x : A + B) (nb : ~ B)
: is_inl x
:= match x with
| inl a => tt
| inr b => nb b
end.Definitionun_inl_inl {AB : Type} (a : A) (w : is_inl (inl a))
: un_inl (@inl A B a) w = a
:= 1.Definitionun_inr_inr {AB : Type} (b : B) (w : is_inr (inr b))
: un_inr (@inr A B b) w = b
:= 1.
A, B: Type z: A + B w: is_inl z
inl (un_inl z w) = z
A, B: Type z: A + B w: is_inl z
inl (un_inl z w) = z
A, B: Type a: A w: is_inl (inl a)
inl a = inl a
A, B: Type b: B w: is_inl (inr b)
inl (Empty_rect (fun_ : Empty => A) w) = inr b
A, B: Type a: A w: is_inl (inl a)
inl a = inl a
reflexivity.
A, B: Type b: B w: is_inl (inr b)
inl (Empty_rect (fun_ : Empty => A) w) = inr b
elim w.Defined.
A, B: Type z: A + B w: is_inr z
inr (un_inr z w) = z
A, B: Type z: A + B w: is_inr z
inr (un_inr z w) = z
A, B: Type a: A w: is_inr (inl a)
inr (Empty_rect (fun_ : Empty => B) w) = inl a
A, B: Type b: B w: is_inr (inr b)
inr b = inr b
A, B: Type a: A w: is_inr (inl a)
inr (Empty_rect (fun_ : Empty => B) w) = inl a
elim w.
A, B: Type b: B w: is_inr (inr b)
inr b = inr b
reflexivity.Defined.
A, B: Type P: A -> Type Q: B -> Type x: A + B
is_inl_and P x -> is_inr_and Q x -> Empty
A, B: Type P: A -> Type Q: B -> Type x: A + B
is_inl_and P x -> is_inr_and Q x -> Empty
A, B: Type P: A -> Type Q: B -> Type a: A
P a -> Empty -> Empty
A, B: Type P: A -> Type Q: B -> Type b: B
Empty -> Q b -> Empty
A, B: Type P: A -> Type Q: B -> Type a: A
P a -> Empty -> Empty
exact (fun_e => e).
A, B: Type P: A -> Type Q: B -> Type b: B
Empty -> Q b -> Empty
exact (fune_ => e).Defined.Definitionnot_is_inl_and_inr' {AB} (x : A + B)
: is_inl x -> is_inr x -> Empty
:= not_is_inl_and_inr (fun_ => Unit) (fun_ => Unit) x.Definitionis_inl_or_is_inr {AB} (x : A + B)
: (is_inl x) + (is_inr x)
:= match x return (is_inl x) + (is_inr x) with
| inl _ => inl tt
| inr _ => inr tt
end.
A, B: Type P: A + B -> Type f: foralla : A, P (inl a)
forallx : A + B, is_inl x -> P x
A, B: Type P: A + B -> Type f: foralla : A, P (inl a)
forallx : A + B, is_inl x -> P x
intros [a|b] H; [ exact (f a) | elim H ].Defined.
A, B: Type P: A + B -> Type f: forallb : B, P (inr b)
forallx : A + B, is_inr x -> P x
A, B: Type P: A + B -> Type f: forallb : B, P (inr b)
forallx : A + B, is_inr x -> P x
intros [a|b] H; [ elim H | exact (f b) ].Defined.(** ** Functorial action *)SectionFunctorSum.Context {AA'BB' : Type} (f : A -> A') (g : B -> B').Definitionfunctor_sum : A + B -> A' + B'
:= funz => match z with inl z' => inl (f z') | inr z' => inr (g z') end.
A, A', B, B': Type f: A -> A' g: B -> B' z, z': A + B c: code_sum z z'
code_sum (functor_sum z) (functor_sum z')
A, A', B, B': Type f: A -> A' g: B -> B' z, z': A + B c: code_sum z z'
code_sum (functor_sum z) (functor_sum z')
A, A', B, B': Type f: A -> A' g: B -> B' a, a0: A c: code_sum (inl a) (inl a0)
A, A', B, B': Type f: A -> A' g: B -> B' z, z': A + B c: code_sum z z'
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
A, A', B, B': Type f: A -> A' g: B -> B' z, z': A + B c: code_sum z z'
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
A, A', B, B': Type f: A -> A' g: B -> B' a, a0: A c: code_sum (inl a) (inl a0)
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
A, A', B, B': Type f: A -> A' g: B -> B' a: A b: B c: code_sum (inl a) (inr b)
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
A, A', B, B': Type f: A -> A' g: B -> B' b: B a: A c: code_sum (inr b) (inl a)
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
A, A', B, B': Type f: A -> A' g: B -> B' b, b0: B c: code_sum (inr b) (inr b0)
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
A, A', B, B': Type f: A -> A' g: B -> B' a, a0: A c: code_sum (inl a) (inl a0)
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
A, A', B, B': Type f: A -> A' g: B -> B' a: A
ap functor_sum (path_sum 1) =
path_sum (functor_code_sum 1)
reflexivity.
A, A', B, B': Type f: A -> A' g: B -> B' a: A b: B c: code_sum (inl a) (inr b)
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
elim c.
A, A', B, B': Type f: A -> A' g: B -> B' b: B a: A c: code_sum (inr b) (inl a)
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
elim c.
A, A', B, B': Type f: A -> A' g: B -> B' b, b0: B c: code_sum (inr b) (inr b0)
ap functor_sum (path_sum c) =
path_sum (functor_code_sum c)
A, A', B, B': Type f: A -> A' g: B -> B' b: B
ap functor_sum (path_sum 1) =
path_sum (functor_code_sum 1)
reflexivity.Defined.(** The fibers of [functor_sum] are those of [f] and [g]. *)
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
hfiber functor_sum (inl a') <~> hfiber f a'
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
hfiber functor_sum (inl a') <~> hfiber f a'
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
hfiber functor_sum (inl a') -> hfiber f a'
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
hfiber f a' -> hfiber functor_sum (inl a')
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
?f o ?g == idmap
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
?g o ?f == idmap
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
hfiber functor_sum (inl a') -> hfiber f a'
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: functor_sum (inl a) = inl a'
hfiber f a'
A, A', B, B': Type f: A -> A' g: B -> B' a': A' b: B p: functor_sum (inr b) = inl a'
hfiber f a'
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: functor_sum (inl a) = inl a'
hfiber f a'
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: functor_sum (inl a) = inl a'
f a = a'
exact (path_sum_inl _ p).
A, A', B, B': Type f: A -> A' g: B -> B' a': A' b: B p: functor_sum (inr b) = inl a'
hfiber f a'
elim (inr_ne_inl _ _ p).
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
hfiber f a' -> hfiber functor_sum (inl a')
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: f a = a'
hfiber functor_sum (inl a')
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: f a = a'
functor_sum (inl a) = inl a'
exact (ap inl p).
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
(funX : hfiber functor_sum (inl a') =>
(funproj1 : A + B =>
match
proj1 as s
return (functor_sum s = inl a' -> hfiber f a')
with
| inl a =>
(fun (a0 : A)
(p : functor_sum (inl a0) = inl a') =>
(a0; path_sum_inl B' p)) a
| inr b =>
(fun (b0 : B)
(p : functor_sum (inr b0) = inl a') =>
Empty_rect (fun_ : Empty => hfiber f a')
(inr_ne_inl (g b0) a' p)) b
end) X.1 X.2)
o (funX : hfiber f a' =>
(fun (a : A) (p : f a = a') => (inl a; ap inl p))
X.1 X.2) == idmap
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: f a = a'
(a; path_sum_inl B' (ap inl p)) = (a; p)
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: f a = a'
path_sum_inl B' (ap inl p) = p
(** Why doesn't Coq find this? *)
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: f a = a' i:= isequiv_path_sum: IsEquiv path_sum
path_sum_inl B' (ap inl p) = p
exact (eissect (@path_sum A' B' (inl (f a)) (inl a')) p).
A, A', B, B': Type f: A -> A' g: B -> B' a': A'
(funX : hfiber f a' =>
(fun (a : A) (p : f a = a') => (inl a; ap inl p)) X.1
X.2)
o (funX : hfiber functor_sum (inl a') =>
(funproj1 : A + B =>
match
proj1 as s
return (functor_sum s = inl a' -> hfiber f a')
with
| inl a =>
(fun (a0 : A)
(p : functor_sum (inl a0) = inl a') =>
(a0; path_sum_inl B' p)) a
| inr b =>
(fun (b0 : B)
(p : functor_sum (inr b0) = inl a') =>
Empty_rect (fun_ : Empty => hfiber f a')
(inr_ne_inl (g b0) a' p)) b
end) X.1 X.2) == idmap
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: functor_sum (inl a) = inl a'
(inl a; ap inl (path_sum_inl B' p)) = (inl a; p)
A, A', B, B': Type f: A -> A' g: B -> B' a': A' b: B p: functor_sum (inr b) = inl a'
(inl
(Empty_rect (fun_ : Empty => hfiber f a')
(inr_ne_inl (g b) a' p)).1;
ap inl
(Empty_rect (fun_ : Empty => hfiber f a')
(inr_ne_inl (g b) a' p)).2) = (inr b; p)
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: functor_sum (inl a) = inl a'
(inl a; ap inl (path_sum_inl B' p)) = (inl a; p)
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: functor_sum (inl a) = inl a'
ap inl (path_sum_inl B' p) = p
A, A', B, B': Type f: A -> A' g: B -> B' a': A' a: A p: functor_sum (inl a) = inl a' i:= isequiv_path_sum: IsEquiv path_sum
ap inl (path_sum_inl B' p) = p
exact (eisretr (@path_sum A' B' (inl (f a)) (inl a')) p).
A, A', B, B': Type f: A -> A' g: B -> B' a': A' b: B p: functor_sum (inr b) = inl a'
(inl
(Empty_rect (fun_ : Empty => hfiber f a')
(inr_ne_inl (g b) a' p)).1;
ap inl
(Empty_rect (fun_ : Empty => hfiber f a')
(inr_ne_inl (g b) a' p)).2) = (inr b; p)
elim (inr_ne_inl _ _ p).Defined.
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
hfiber functor_sum (inr b') <~> hfiber g b'
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
hfiber functor_sum (inr b') <~> hfiber g b'
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
hfiber functor_sum (inr b') -> hfiber g b'
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
hfiber g b' -> hfiber functor_sum (inr b')
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
?f o ?g == idmap
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
?g o ?f == idmap
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
hfiber functor_sum (inr b') -> hfiber g b'
A, A', B, B': Type f: A -> A' g: B -> B' b': B' a: A p: functor_sum (inl a) = inr b'
hfiber g b'
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: functor_sum (inr b) = inr b'
hfiber g b'
A, A', B, B': Type f: A -> A' g: B -> B' b': B' a: A p: functor_sum (inl a) = inr b'
hfiber g b'
elim (inl_ne_inr _ _ p).
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: functor_sum (inr b) = inr b'
hfiber g b'
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: functor_sum (inr b) = inr b'
g b = b'
exact (path_sum_inr _ p).
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
hfiber g b' -> hfiber functor_sum (inr b')
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: g b = b'
hfiber functor_sum (inr b')
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: g b = b'
functor_sum (inr b) = inr b'
exact (ap inr p).
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
(funX : hfiber functor_sum (inr b') =>
(funproj1 : A + B =>
match
proj1 as s
return (functor_sum s = inr b' -> hfiber g b')
with
| inl a =>
(fun (a0 : A)
(p : functor_sum (inl a0) = inr b') =>
Empty_rect (fun_ : Empty => hfiber g b')
(inl_ne_inr (f a0) b' p)) a
| inr b =>
(fun (b0 : B)
(p : functor_sum (inr b0) = inr b') =>
(b0; path_sum_inr A' p)) b
end) X.1 X.2)
o (funX : hfiber g b' =>
(fun (b : B) (p : g b = b') => (inr b; ap inr p))
X.1 X.2) == idmap
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: g b = b'
(b; path_sum_inr A' (ap inr p)) = (b; p)
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: g b = b'
path_sum_inr A' (ap inr p) = p
(** Why doesn't Coq find this? *)
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: g b = b' i:= isequiv_path_sum: IsEquiv path_sum
path_sum_inr A' (ap inr p) = p
exact (eissect (@path_sum A' B' (inr (g b)) (inr b')) p).
A, A', B, B': Type f: A -> A' g: B -> B' b': B'
(funX : hfiber g b' =>
(fun (b : B) (p : g b = b') => (inr b; ap inr p)) X.1
X.2)
o (funX : hfiber functor_sum (inr b') =>
(funproj1 : A + B =>
match
proj1 as s
return (functor_sum s = inr b' -> hfiber g b')
with
| inl a =>
(fun (a0 : A)
(p : functor_sum (inl a0) = inr b') =>
Empty_rect (fun_ : Empty => hfiber g b')
(inl_ne_inr (f a0) b' p)) a
| inr b =>
(fun (b0 : B)
(p : functor_sum (inr b0) = inr b') =>
(b0; path_sum_inr A' p)) b
end) X.1 X.2) == idmap
A, A', B, B': Type f: A -> A' g: B -> B' b': B' a: A p: functor_sum (inl a) = inr b'
(inr
(Empty_rect (fun_ : Empty => hfiber g b')
(inl_ne_inr (f a) b' p)).1;
ap inr
(Empty_rect (fun_ : Empty => hfiber g b')
(inl_ne_inr (f a) b' p)).2) = (inl a; p)
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: functor_sum (inr b) = inr b'
(inr b; ap inr (path_sum_inr A' p)) = (inr b; p)
A, A', B, B': Type f: A -> A' g: B -> B' b': B' a: A p: functor_sum (inl a) = inr b'
(inr
(Empty_rect (fun_ : Empty => hfiber g b')
(inl_ne_inr (f a) b' p)).1;
ap inr
(Empty_rect (fun_ : Empty => hfiber g b')
(inl_ne_inr (f a) b' p)).2) = (inl a; p)
elim (inl_ne_inr _ _ p).
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: functor_sum (inr b) = inr b'
(inr b; ap inr (path_sum_inr A' p)) = (inr b; p)
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: functor_sum (inr b) = inr b'
ap inr (path_sum_inr A' p) = p
A, A', B, B': Type f: A -> A' g: B -> B' b': B' b: B p: functor_sum (inr b) = inr b' i:= isequiv_path_sum: IsEquiv path_sum
ap inr (path_sum_inr A' p) = p
exact (eisretr (@path_sum A' B' (inr (g b)) (inr b')) p).Defined.EndFunctorSum.
A, A', B, B': Type f, f': A -> A' g, g': B -> B' p: f == f' q: g == g'
functor_sum f g == functor_sum f' g'
A, A', B, B': Type f, f': A -> A' g, g': B -> B' p: f == f' q: g == g'
functor_sum f g == functor_sum f' g'
A, A', B, B': Type f, f': A -> A' g, g': B -> B' p: f == f' q: g == g' a: A
functor_sum f g (inl a) = functor_sum f' g' (inl a)
A, A', B, B': Type f, f': A -> A' g, g': B -> B' p: f == f' q: g == g' b: B
functor_sum f g (inr b) = functor_sum f' g' (inr b)
A, A', B, B': Type f, f': A -> A' g, g': B -> B' p: f == f' q: g == g' a: A
functor_sum f g (inl a) = functor_sum f' g' (inl a)
exact (ap inl (p a)).
A, A', B, B': Type f, f': A -> A' g, g': B -> B' p: f == f' q: g == g' b: B
functor_sum f g (inr b) = functor_sum f' g' (inr b)
exact (ap inr (q b)).Defined.
A, A', A'', B, B', B'': Type f: A -> A' f': A' -> A'' g: B -> B' g': B' -> B''
functor_sum (f' o f) (g' o g) ==
functor_sum f' g' o functor_sum f g
A, A', A'', B, B', B'': Type f: A -> A' f': A' -> A'' g: B -> B' g': B' -> B''
functor_sum (f' o f) (g' o g) ==
functor_sum f' g' o functor_sum f g
intros [a|b]; reflexivity.Defined.
A, B: Type
functor_sum idmap idmap == idmap
A, B: Type
functor_sum idmap idmap == idmap
intros [a|b]; reflexivity.Defined.(** ** "Unfunctorial action" *)(** Not every function [A + B -> A' + B'] is of the form [functor_sum f g]. However, this is the case if it preserves the summands, i.e. if it maps [A] into [A'] and [B] into [B']. More generally, if a function [A + B -> A' + B'] maps [A] into [A'] only, then we can extract from it a function [A -> A']. Since these operations are a sort of inverse to [functor_sum], we call them [unfunctor_sum_*]. *)Definitionunfunctor_sum_l {AA'BB' : Type} (h : A + B -> A' + B')
(Ha : foralla:A, is_inl (h (inl a)))
: A -> A'
:= funa => un_inl (h (inl a)) (Ha a).Definitionunfunctor_sum_r {AA'BB' : Type} (h : A + B -> A' + B')
(Hb : forallb:B, is_inr (h (inr b)))
: B -> B'
:= funb => un_inr (h (inr b)) (Hb b).
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
functor_sum (unfunctor_sum_l h Ha)
(unfunctor_sum_r h Hb) == h
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
functor_sum (unfunctor_sum_l h Ha)
(unfunctor_sum_r h Hb) == h
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a: A
inl (unfunctor_sum_l h Ha a) = h (inl a)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b: B
inr (unfunctor_sum_r h Hb b) = h (inr b)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a: A
inl (unfunctor_sum_l h Ha a) = h (inl a)
unfold unfunctor_sum_l; apply inl_un_inl.
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b: B
inr (unfunctor_sum_r h Hb b) = h (inr b)
unfold unfunctor_sum_r; apply inr_un_inr.Defined.
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a))
inl o unfunctor_sum_l h Ha == h o inl
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a))
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Ha: foralla : A, is_inl (h (inl a)) Ha': foralla' : A', is_inl (k (inl a'))
unfunctor_sum_l k Ha' o unfunctor_sum_l h Ha ==
unfunctor_sum_l (k o h)
(funa : A =>
is_inl_ind (funx' : A' + B' => is_inl (k x')) Ha'
(h (inl a)) (Ha a))
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Ha: foralla : A, is_inl (h (inl a)) Ha': foralla' : A', is_inl (k (inl a'))
unfunctor_sum_l k Ha' o unfunctor_sum_l h Ha ==
unfunctor_sum_l (k o h)
(funa : A =>
is_inl_ind (funx' : A' + B' => is_inl (k x')) Ha'
(h (inl a)) (Ha a))
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Ha: foralla : A, is_inl (h (inl a)) Ha': foralla' : A', is_inl (k (inl a')) a: A
unfunctor_sum_l k Ha' (unfunctor_sum_l h Ha a) =
unfunctor_sum_l (funx : A + B => k (h x))
(funa : A =>
is_inl_ind (funx' : A' + B' => is_inl (k x')) Ha'
(h (inl a)) (Ha a)) a
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Ha: foralla : A, is_inl (h (inl a)) Ha': foralla' : A', is_inl (k (inl a')) a: A
inl (unfunctor_sum_l k Ha' (unfunctor_sum_l h Ha a)) =
inl
(unfunctor_sum_l (funx : A + B => k (h x))
(funa : A =>
is_inl_ind (funx' : A' + B' => is_inl (k x'))
Ha' (h (inl a)) (Ha a)) a)
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Ha: foralla : A, is_inl (h (inl a)) Ha': foralla' : A', is_inl (k (inl a')) a: A
k (inl (unfunctor_sum_l h Ha a)) =
inl
(unfunctor_sum_l (funx : A + B => k (h x))
(funa : A =>
is_inl_ind (funx' : A' + B' => is_inl (k x'))
Ha' (h (inl a)) (Ha a)) a)
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Ha: foralla : A, is_inl (h (inl a)) Ha': foralla' : A', is_inl (k (inl a')) a: A
k (h (inl a)) =
inl
(unfunctor_sum_l (funx : A + B => k (h x))
(funa : A =>
is_inl_ind (funx' : A' + B' => is_inl (k x'))
Ha' (h (inl a)) (Ha a)) a)
exact ((unfunctor_sum_l_beta _ _ _)^).Defined.
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Hb: forallb : B, is_inr (h (inr b)) Hb': forallb' : B', is_inr (k (inr b'))
unfunctor_sum_r k Hb' o unfunctor_sum_r h Hb ==
unfunctor_sum_r (k o h)
(funb : B =>
is_inr_ind (funx' : A' + B' => is_inr (k x')) Hb'
(h (inr b)) (Hb b))
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Hb: forallb : B, is_inr (h (inr b)) Hb': forallb' : B', is_inr (k (inr b'))
unfunctor_sum_r k Hb' o unfunctor_sum_r h Hb ==
unfunctor_sum_r (k o h)
(funb : B =>
is_inr_ind (funx' : A' + B' => is_inr (k x')) Hb'
(h (inr b)) (Hb b))
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Hb: forallb : B, is_inr (h (inr b)) Hb': forallb' : B', is_inr (k (inr b')) b: B
unfunctor_sum_r k Hb' (unfunctor_sum_r h Hb b) =
unfunctor_sum_r (funx : A + B => k (h x))
(funb : B =>
is_inr_ind (funx' : A' + B' => is_inr (k x')) Hb'
(h (inr b)) (Hb b)) b
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Hb: forallb : B, is_inr (h (inr b)) Hb': forallb' : B', is_inr (k (inr b')) b: B
inr (unfunctor_sum_r k Hb' (unfunctor_sum_r h Hb b)) =
inr
(unfunctor_sum_r (funx : A + B => k (h x))
(funb : B =>
is_inr_ind (funx' : A' + B' => is_inr (k x'))
Hb' (h (inr b)) (Hb b)) b)
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Hb: forallb : B, is_inr (h (inr b)) Hb': forallb' : B', is_inr (k (inr b')) b: B
k (inr (unfunctor_sum_r h Hb b)) =
inr
(unfunctor_sum_r (funx : A + B => k (h x))
(funb : B =>
is_inr_ind (funx' : A' + B' => is_inr (k x'))
Hb' (h (inr b)) (Hb b)) b)
A, A', A'', B, B', B'': Type h: A + B -> A' + B' k: A' + B' -> A'' + B'' Hb: forallb : B, is_inr (h (inr b)) Hb': forallb' : B', is_inr (k (inr b')) b: B
k (h (inr b)) =
inr
(unfunctor_sum_r (funx : A + B => k (h x))
(funb : B =>
is_inr_ind (funx' : A' + B' => is_inr (k x'))
Hb' (h (inr b)) (Hb b)) b)
exact ((unfunctor_sum_r_beta _ _ _)^).Defined.(** [unfunctor_sum] also preserves fibers, if both summands are preserved. *)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
hfiber (unfunctor_sum_l h Ha) a' <~> hfiber h (inl a')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
hfiber (unfunctor_sum_l h Ha) a' <~> hfiber h (inl a')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
hfiber (unfunctor_sum_l h Ha) a' -> hfiber h (inl a')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
hfiber h (inl a') -> hfiber (unfunctor_sum_l h Ha) a'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
?f o ?g == idmap
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
?g o ?f == idmap
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
hfiber (unfunctor_sum_l h Ha) a' -> hfiber h (inl a')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: unfunctor_sum_l h Ha a = a'
hfiber h (inl a')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: unfunctor_sum_l h Ha a = a'
h (inl a) = inl a'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: unfunctor_sum_l h Ha a = a'
h (inl a) = inl (unfunctor_sum_l h Ha a)
symmetry; apply inl_un_inl.
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
hfiber h (inl a') -> hfiber (unfunctor_sum_l h Ha) a'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h (inl a) = inl a'
hfiber (unfunctor_sum_l h Ha) a'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' b: B p: h (inr b) = inl a'
hfiber (unfunctor_sum_l h Ha) a'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h (inl a) = inl a'
hfiber (unfunctor_sum_l h Ha) a'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h (inl a) = inl a'
unfunctor_sum_l h Ha a = a'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h (inl a) = inl a'
inl (unfunctor_sum_l h Ha a) = inl a'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h (inl a) = inl a'
inl (unfunctor_sum_l h Ha a) = h (inl a)
apply inl_un_inl.
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' b: B p: h (inr b) = inl a'
hfiber (unfunctor_sum_l h Ha) a'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) b: B Hb: is_inr (h (inr b)) a': A' p: h (inr b) = inl a'
hfiber (unfunctor_sum_l h Ha) a'
abstract (rewrite p in Hb; elim Hb).
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
(funX : hfiber (unfunctor_sum_l h Ha) a' =>
(fun (a : A) (p : unfunctor_sum_l h Ha a = a') =>
(inl a; (inl_un_inl (h (inl a)) (Ha a))^ @ ap inl p))
X.1 X.2)
o (funX : hfiber h (inl a') =>
(funproj1 : A + B =>
match
proj1 as s
return
(h s = inl a' ->
hfiber (unfunctor_sum_l h Ha) a')
with
| inl a =>
(fun (a0 : A) (p : h (inl a0) = inl a') =>
(a0;
path_sum_inl B'
(inl_un_inl (h (inl a0)) (Ha a0) @ p))) a
| inr b =>
(fun (b0 : B) (p : h (inr b0) = inl a') =>
letHb := Hb b0 in
hfiber_unfunctor_sum_l_subproof A A' B B' h
Ha b0 Hb a' p) b
end) X.1 X.2) == idmap
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h (inl a) = inl a'
(inl a;
(inl_un_inl (h (inl a)) (Ha a))^ @
ap inl
(path_sum_inl B' (inl_un_inl (h (inl a)) (Ha a) @ p))) =
(inl a; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' b: B p: h (inr b) = inl a'
(inl
(hfiber_unfunctor_sum_l_subproof A A' B B' h Ha b
(Hb b) a' p).1;
(inl_un_inl
(h
(inl
(hfiber_unfunctor_sum_l_subproof A A' B B' h
Ha b (Hb b) a' p).1))
(Ha
(hfiber_unfunctor_sum_l_subproof A A' B B' h Ha
b (Hb b) a' p).1))^ @
ap inl
(hfiber_unfunctor_sum_l_subproof A A' B B' h Ha b
(Hb b) a' p).2) = (inr b; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h (inl a) = inl a'
(inl a;
(inl_un_inl (h (inl a)) (Ha a))^ @
ap inl
(path_sum_inl B' (inl_un_inl (h (inl a)) (Ha a) @ p))) =
(inl a; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h (inl a) = inl a'
(inl_un_inl (h (inl a)) (Ha a))^ @
ap inl
(path_sum_inl B' (inl_un_inl (h (inl a)) (Ha a) @ p)) =
p
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h (inl a) = inl a'
ap inl
(path_sum_inl B' (inl_un_inl (h (inl a)) (Ha a) @ p)) =
inl_un_inl (h (inl a)) (Ha a) @ p
exact (eisretr (@path_sum A' B' _ _)
(inl_un_inl (h (inl a)) (Ha a) @ p)).
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' b: B p: h (inr b) = inl a'
(inl
(hfiber_unfunctor_sum_l_subproof A A' B B' h Ha b
(Hb b) a' p).1;
(inl_un_inl
(h
(inl
(hfiber_unfunctor_sum_l_subproof A A' B B' h
Ha b (Hb b) a' p).1))
(Ha
(hfiber_unfunctor_sum_l_subproof A A' B B' h Ha
b (Hb b) a' p).1))^ @
ap inl
(hfiber_unfunctor_sum_l_subproof A A' B B' h Ha b
(Hb b) a' p).2) = (inr b; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' b: B p: h (inr b) = inl a'
Empty
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) b: B Hb: is_inr (h (inr b)) a': A' p: h (inr b) = inl a'
Empty
abstract (rewrite p in Hb; elim Hb).
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
(funX : hfiber h (inl a') =>
(funproj1 : A + B =>
match
proj1 as s
return
(h s = inl a' ->
hfiber (unfunctor_sum_l h Ha) a')
with
| inl a =>
(fun (a0 : A) (p : h (inl a0) = inl a') =>
(a0;
path_sum_inl B'
(inl_un_inl (h (inl a0)) (Ha a0) @ p))) a
| inr b =>
(fun (b0 : B) (p : h (inr b0) = inl a') =>
letHb := Hb b0 in
hfiber_unfunctor_sum_l_subproof A A' B B' h Ha
b0 Hb a' p) b
end) X.1 X.2)
o (funX : hfiber (unfunctor_sum_l h Ha) a' =>
(fun (a : A) (p : unfunctor_sum_l h Ha a = a') =>
(inl a;
(inl_un_inl (h (inl a)) (Ha a))^ @ ap inl p)) X.1
X.2) == idmap
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: unfunctor_sum_l h Ha a = a'
(a;
path_sum_inl B'
(inl_un_inl (h (inl a)) (Ha a) @
((inl_un_inl (h (inl a)) (Ha a))^ @ ap inl p))) =
(a; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: unfunctor_sum_l h Ha a = a'
path_sum_inl B'
(inl_un_inl (h (inl a)) (Ha a) @
((inl_un_inl (h (inl a)) (Ha a))^ @ ap inl p)) = p
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: unfunctor_sum_l h Ha a = a'
path_sum_inl B' (ap inl p) = p
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: unfunctor_sum_l h Ha a = a' i:= isequiv_path_sum: IsEquiv path_sum
path_sum_inl B' (ap inl p) = p
exact (eissect (@path_sum A' B' (inl (unfunctor_sum_l h Ha a)) (inl a')) p).Defined.
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
hfiber (unfunctor_sum_r h Hb) b' <~> hfiber h (inr b')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
hfiber (unfunctor_sum_r h Hb) b' <~> hfiber h (inr b')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
hfiber (unfunctor_sum_r h Hb) b' -> hfiber h (inr b')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
hfiber h (inr b') -> hfiber (unfunctor_sum_r h Hb) b'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
?f o ?g == idmap
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
?g o ?f == idmap
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
hfiber (unfunctor_sum_r h Hb) b' -> hfiber h (inr b')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: unfunctor_sum_r h Hb b = b'
hfiber h (inr b')
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: unfunctor_sum_r h Hb b = b'
h (inr b) = inr b'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: unfunctor_sum_r h Hb b = b'
h (inr b) = inr (unfunctor_sum_r h Hb b)
symmetry; apply inr_un_inr.
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
hfiber h (inr b') -> hfiber (unfunctor_sum_r h Hb) b'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' a: A p: h (inl a) = inr b'
hfiber (unfunctor_sum_r h Hb) b'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h (inr b) = inr b'
hfiber (unfunctor_sum_r h Hb) b'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' a: A p: h (inl a) = inr b'
hfiber (unfunctor_sum_r h Hb) b'
A, A', B, B': Type h: A + B -> A' + B' a: A Ha: is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' p: h (inl a) = inr b'
hfiber (unfunctor_sum_r h Hb) b'
abstract (rewrite p in Ha; elim Ha).
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h (inr b) = inr b'
hfiber (unfunctor_sum_r h Hb) b'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h (inr b) = inr b'
unfunctor_sum_r h Hb b = b'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h (inr b) = inr b'
inr (unfunctor_sum_r h Hb b) = inr b'
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h (inr b) = inr b'
inr (unfunctor_sum_r h Hb b) = h (inr b)
apply inr_un_inr.
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
(funX : hfiber (unfunctor_sum_r h Hb) b' =>
(fun (b : B) (p : unfunctor_sum_r h Hb b = b') =>
(inr b; (inr_un_inr (h (inr b)) (Hb b))^ @ ap inr p))
X.1 X.2)
o (funX : hfiber h (inr b') =>
(funproj1 : A + B =>
match
proj1 as s
return
(h s = inr b' ->
hfiber (unfunctor_sum_r h Hb) b')
with
| inl a =>
(fun (a0 : A) (p : h (inl a0) = inr b') =>
letHa := Ha a0 in
hfiber_unfunctor_sum_r_subproof A A' B B' h
a0 Ha Hb b' p) a
| inr b =>
(fun (b0 : B) (p : h (inr b0) = inr b') =>
(b0;
path_sum_inr A'
(inr_un_inr (h (inr b0)) (Hb b0) @ p))) b
end) X.1 X.2) == idmap
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' a: A p: h (inl a) = inr b'
(inr
(hfiber_unfunctor_sum_r_subproof A A' B B' h a
(Ha a) Hb b' p).1;
(inr_un_inr
(h
(inr
(hfiber_unfunctor_sum_r_subproof A A' B B' h
a (Ha a) Hb b' p).1))
(Hb
(hfiber_unfunctor_sum_r_subproof A A' B B' h a
(Ha a) Hb b' p).1))^ @
ap inr
(hfiber_unfunctor_sum_r_subproof A A' B B' h a
(Ha a) Hb b' p).2) = (inl a; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h (inr b) = inr b'
(inr b;
(inr_un_inr (h (inr b)) (Hb b))^ @
ap inr
(path_sum_inr A' (inr_un_inr (h (inr b)) (Hb b) @ p))) =
(inr b; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' a: A p: h (inl a) = inr b'
(inr
(hfiber_unfunctor_sum_r_subproof A A' B B' h a
(Ha a) Hb b' p).1;
(inr_un_inr
(h
(inr
(hfiber_unfunctor_sum_r_subproof A A' B B' h
a (Ha a) Hb b' p).1))
(Hb
(hfiber_unfunctor_sum_r_subproof A A' B B' h a
(Ha a) Hb b' p).1))^ @
ap inr
(hfiber_unfunctor_sum_r_subproof A A' B B' h a
(Ha a) Hb b' p).2) = (inl a; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' a: A p: h (inl a) = inr b'
Empty
A, A', B, B': Type h: A + B -> A' + B' a: A Ha: is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' p: h (inl a) = inr b'
Empty
abstract (rewrite p in Ha; elim Ha).
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h (inr b) = inr b'
(inr b;
(inr_un_inr (h (inr b)) (Hb b))^ @
ap inr
(path_sum_inr A' (inr_un_inr (h (inr b)) (Hb b) @ p))) =
(inr b; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h (inr b) = inr b'
(inr_un_inr (h (inr b)) (Hb b))^ @
ap inr
(path_sum_inr A' (inr_un_inr (h (inr b)) (Hb b) @ p)) =
p
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h (inr b) = inr b'
ap inr
(path_sum_inr A' (inr_un_inr (h (inr b)) (Hb b) @ p)) =
inr_un_inr (h (inr b)) (Hb b) @ p
exact (eisretr (@path_sum A' B' _ _)
(inr_un_inr (h (inr b)) (Hb b) @ p)).
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
(funX : hfiber h (inr b') =>
(funproj1 : A + B =>
match
proj1 as s
return
(h s = inr b' ->
hfiber (unfunctor_sum_r h Hb) b')
with
| inl a =>
(fun (a0 : A) (p : h (inl a0) = inr b') =>
letHa := Ha a0 in
hfiber_unfunctor_sum_r_subproof A A' B B' h a0
Ha Hb b' p) a
| inr b =>
(fun (b0 : B) (p : h (inr b0) = inr b') =>
(b0;
path_sum_inr A'
(inr_un_inr (h (inr b0)) (Hb b0) @ p))) b
end) X.1 X.2)
o (funX : hfiber (unfunctor_sum_r h Hb) b' =>
(fun (b : B) (p : unfunctor_sum_r h Hb b = b') =>
(inr b;
(inr_un_inr (h (inr b)) (Hb b))^ @ ap inr p)) X.1
X.2) == idmap
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: unfunctor_sum_r h Hb b = b'
(b;
path_sum_inr A'
(inr_un_inr (h (inr b)) (Hb b) @
((inr_un_inr (h (inr b)) (Hb b))^ @ ap inr p))) =
(b; p)
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: unfunctor_sum_r h Hb b = b'
path_sum_inr A'
(inr_un_inr (h (inr b)) (Hb b) @
((inr_un_inr (h (inr b)) (Hb b))^ @ ap inr p)) = p
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: unfunctor_sum_r h Hb b = b'
path_sum_inr A' (ap inr p) = p
A, A', B, B': Type h: A + B -> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: unfunctor_sum_r h Hb b = b' i:= isequiv_path_sum: IsEquiv path_sum
path_sum_inr A' (ap inr p) = p
exact (eissect (@path_sum A' B' (inr (unfunctor_sum_r h Hb b)) (inr b')) p).Defined.(** ** Functoriality on equivalences *)
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
IsEquiv (functor_sum f g)
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
IsEquiv (functor_sum f g)
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
A' + B' -> A + B
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
functor_sum f g o ?equiv_inv == idmap
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
?equiv_inv o functor_sum f g == idmap
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
forallx : A + B,
?eisretr (functor_sum f g x) =
ap (functor_sum f g) (?eissect x)
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
A' + B' -> A + B
exact (functor_sum f^-1 g^-1).
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
functor_sum f g o functor_sum f^-1 g^-1 == idmap
intros [?|?]; simpl; apply ap; apply eisretr.
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
functor_sum f^-1 g^-1 o functor_sum f g == idmap
intros [?|?]; simpl; apply ap; apply eissect.
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g
forallx : A + B,
((funx0 : A' + B' =>
match
x0 as s
return
(functor_sum f g (functor_sum f^-1 g^-1 s) = s)
with
| inl a =>
(funa0 : A' =>
ap inl (eisretr f a0)
:
functor_sum f g
(functor_sum f^-1 g^-1 (inl a0)) = inl a0) a
| inr b =>
(funb0 : B' =>
ap inr (eisretr g b0)
:
functor_sum f g
(functor_sum f^-1 g^-1 (inr b0)) = inr b0) b
end)
:
functor_sum f g o functor_sum f^-1 g^-1 == idmap)
(functor_sum f g x) =
ap (functor_sum f g)
(((funx0 : A + B =>
match
x0 as s
return
(functor_sum f^-1 g^-1 (functor_sum f g s) =
s)
with
| inl a =>
(funa0 : A =>
ap inl (eissect f a0)
:
functor_sum f^-1 g^-1
(functor_sum f g (inl a0)) = inl a0) a
| inr b =>
(funb0 : B =>
ap inr (eissect g b0)
:
functor_sum f^-1 g^-1
(functor_sum f g (inr b0)) = inr b0) b
end)
:
functor_sum f^-1 g^-1 o functor_sum f g == idmap)
x)
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g a: A
ap (functor_sum f g) (ap inl (eissect f a)) =
ap inl (ap f (eissect f a))
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g b: B
ap (functor_sum f g) (ap inr (eissect g b)) =
ap inr (ap g (eissect g b))
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g a: A
ap (functor_sum f g) (ap inl (eissect f a)) =
ap inl (ap f (eissect f a))
exact ((ap_compose inl _ _)^ @ ap_compose f inl _).
A, A': Type f: A -> A' H: IsEquiv f B, B': Type g: B -> B' H0: IsEquiv g b: B
ap (functor_sum f g) (ap inr (eissect g b)) =
ap inr (ap g (eissect g b))
exact ((ap_compose inr _ _)^ @ ap_compose g inr _).Defined.Definitionequiv_functor_sum `{IsEquiv A A' f} `{IsEquiv B B' g}
: A + B <~> A' + B'
:= Build_Equiv _ _ (functor_sum f g) _.Definitionequiv_functor_sum' {AA'BB' : Type} (f : A <~> A') (g : B <~> B')
: A + B <~> A' + B'
:= equiv_functor_sum (f := f) (g := g).Notation"f +E g" := (equiv_functor_sum' f g) : equiv_scope.Definitionequiv_functor_sum_l {ABB' : Type} (g : B <~> B')
: A + B <~> A + B'
:= 1 +E g.Definitionequiv_functor_sum_r {AA'B : Type} (f : A <~> A')
: A + B <~> A' + B
:= f +E 1.Definitioniff_functor_sum {AA'BB' : Type} (f : A <-> A') (g : B <-> B')
: A + B <-> A' + B'
:= (functor_sum (fst f) (fst g), functor_sum (snd f) (snd g)).(** ** Unfunctoriality on equivalences *)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
IsEquiv (unfunctor_sum_l h Ha)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
IsEquiv (unfunctor_sum_l h Ha)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
A' -> A
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
unfunctor_sum_l h Ha o ?g == idmap
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
?g o unfunctor_sum_l h Ha == idmap
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
A' -> A
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
is_inl (h^-1 (inl a'))
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' x: A + B p: h^-1 (inl a') = x
is_inl x
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h^-1 (inl a') = inl a
is_inl (inl a)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' b: B p: h^-1 (inl a') = inr b
is_inl (inr b)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' a: A p: h^-1 (inl a') = inl a
is_inl (inl a)
exact tt.
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' b: B p: h^-1 (inl a') = inr b
is_inl (inr b)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A' b: B p: inl a' = h (inr b)
is_inl (inr b)
elim (p^ # (Hb b)).
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
unfunctor_sum_l h Ha
o unfunctor_sum_l h^-1
(funa' : A' =>
letx := h^-1 (inl a') inletp := 1 : h^-1 (inl a') = x inmatch
x as s return (h^-1 (inl a') = s -> is_inl s)
with
| inl a =>
(fun (a0 : A) (_ : h^-1 (inl a') = inl a0) =>
tt) a
| inr b =>
(fun (b0 : B) (p0 : h^-1 (inl a') = inr b0)
=>
letp1 := moveL_equiv_M (inr b0) (inl a') p0
in
Overture.Empty_rec (is_inl (inr b0))
(transport is_inr p1^ (Hb b0))) b
end p) == idmap
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
unfunctor_sum_l h Ha
(unfunctor_sum_l h^-1
(funa' : A' =>
letx := h^-1 (inl a') inletp := 1inmatch
x as s return (h^-1 (inl a') = s -> is_inl s)
with
| inl a => fun_ : h^-1 (inl a') = inl a => tt
| inr b =>
funp0 : h^-1 (inl a') = inr b =>
letp1 := moveL_equiv_M (inr b) (inl a') p0
in
Overture.Empty_rec (is_inl (inr b))
(transport is_inr p1^ (Hb b))
end p) a') = a'
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
unfunctor_sum_l (funx : A' + B' => h (h^-1 x))
(funa : A' =>
is_inl_ind (funx' : A + B => is_inl (h x')) Ha
(h^-1 (inl a))
(letx := h^-1 (inl a) inletp := 1inmatch
x as s return (h^-1 (inl a) = s -> is_inl s)
with
| inl a0 => fun_ : h^-1 (inl a) = inl a0 => tt
| inr b =>
funp0 : h^-1 (inl a) = inr b =>
letp1 := moveL_equiv_M (inr b) (inl a) p0
in
Overture.Empty_rec (is_inl (inr b))
(transport is_inr p1^ (Hb b))
end p)) a' = a'
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
inl
(unfunctor_sum_l (funx : A' + B' => h (h^-1 x))
(funa : A' =>
is_inl_ind (funx' : A + B => is_inl (h x')) Ha
(h^-1 (inl a))
(letx := h^-1 (inl a) inletp := 1inmatch
x as s
return (h^-1 (inl a) = s -> is_inl s)
with
| inl a0 =>
fun_ : h^-1 (inl a) = inl a0 => tt
| inr b =>
funp0 : h^-1 (inl a) = inr b =>
letp1 :=
moveL_equiv_M (inr b) (inl a) p0 in
Overture.Empty_rec (is_inl (inr b))
(transport is_inr p1^ (Hb b))
end p)) a') = inl a'
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a': A'
h (h^-1 (inl a')) = inl a'
apply eisretr.
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
unfunctor_sum_l h^-1
(funa' : A' =>
letx := h^-1 (inl a') inletp := 1 : h^-1 (inl a') = x inmatch
x as s return (h^-1 (inl a') = s -> is_inl s)
with
| inl a =>
(fun (a0 : A) (_ : h^-1 (inl a') = inl a0) =>
tt) a
| inr b =>
(fun (b0 : B) (p0 : h^-1 (inl a') = inr b0) =>
letp1 := moveL_equiv_M (inr b0) (inl a') p0
in
Overture.Empty_rec (is_inl (inr b0))
(transport is_inr p1^ (Hb b0))) b
end p) o unfunctor_sum_l h Ha == idmap
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a: A
unfunctor_sum_l h^-1
(funa' : A' =>
letx := h^-1 (inl a') inletp := 1inmatch
x as s return (h^-1 (inl a') = s -> is_inl s)
with
| inl a => fun_ : h^-1 (inl a') = inl a => tt
| inr b =>
funp0 : h^-1 (inl a') = inr b =>
letp1 := moveL_equiv_M (inr b) (inl a') p0 in
Overture.Empty_rec (is_inl (inr b))
(transport is_inr p1^ (Hb b))
end p) (unfunctor_sum_l h Ha a) = a
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a: A
unfunctor_sum_l (funx : A + B => h^-1 (h x))
(funa : A =>
is_inl_ind (funx' : A' + B' => is_inl (h^-1 x'))
(funa' : A' =>
letx := h^-1 (inl a') inletp := 1inmatch
x as s return (h^-1 (inl a') = s -> is_inl s)
with
| inl a0 => fun_ : h^-1 (inl a') = inl a0 => tt
| inr b =>
funp0 : h^-1 (inl a') = inr b =>
letp1 := moveL_equiv_M (inr b) (inl a') p0
in
Overture.Empty_rec (is_inl (inr b))
(transport is_inr p1^ (Hb b))
end p) (h (inl a)) (Ha a)) a = a
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a: A
inl
(unfunctor_sum_l (funx : A + B => h^-1 (h x))
(funa : A =>
is_inl_ind
(funx' : A' + B' => is_inl (h^-1 x'))
(funa' : A' =>
letx := h^-1 (inl a') inletp := 1inmatch
x as s
return (h^-1 (inl a') = s -> is_inl s)
with
| inl a0 =>
fun_ : h^-1 (inl a') = inl a0 => tt
| inr b =>
funp0 : h^-1 (inl a') = inr b =>
letp1 :=
moveL_equiv_M (inr b) (inl a') p0 in
Overture.Empty_rec (is_inl (inr b))
(transport is_inr p1^ (Hb b))
end p) (h (inl a)) (Ha a)) a) = inl a
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) a: A
h^-1 (h (inl a)) = inl a
apply eissect.Defined.Definitionequiv_unfunctor_sum_l {AA'BB' : Type}
(h : A + B <~> A' + B')
(Ha : foralla:A, is_inl (h (inl a)))
(Hb : forallb:B, is_inr (h (inr b)))
: A <~> A'
:= Build_Equiv _ _ (unfunctor_sum_l h Ha)
(isequiv_unfunctor_sum_l h Ha Hb).
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
IsEquiv (unfunctor_sum_r h Hb)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
IsEquiv (unfunctor_sum_r h Hb)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
B' -> B
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
unfunctor_sum_r h Hb o ?g == idmap
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
?g o unfunctor_sum_r h Hb == idmap
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
B' -> B
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
is_inr (h^-1 (inr b'))
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' x: A + B p: h^-1 (inr b') = x
is_inr x
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' a: A p: h^-1 (inr b') = inl a
is_inr (inl a)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h^-1 (inr b') = inr b
is_inr (inr b)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' a: A p: h^-1 (inr b') = inl a
is_inr (inl a)
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' a: A p: inr b' = h (inl a)
is_inr (inl a)
elim (p^ # (Ha a)).
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B' b: B p: h^-1 (inr b') = inr b
is_inr (inr b)
exact tt.
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
unfunctor_sum_r h Hb
o unfunctor_sum_r h^-1
(funb' : B' =>
letx := h^-1 (inr b') inletp := 1 : h^-1 (inr b') = x inmatch
x as s return (h^-1 (inr b') = s -> is_inr s)
with
| inl a =>
(fun (a0 : A) (p0 : h^-1 (inr b') = inl a0)
=>
letp1 := moveL_equiv_M (inl a0) (inr b') p0
in
Overture.Empty_rec (is_inr (inl a0))
(transport is_inl p1^ (Ha a0))) a
| inr b =>
(fun (b0 : B) (_ : h^-1 (inr b') = inr b0) =>
tt) b
end p) == idmap
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
unfunctor_sum_r h Hb
(unfunctor_sum_r h^-1
(funb' : B' =>
letx := h^-1 (inr b') inletp := 1inmatch
x as s return (h^-1 (inr b') = s -> is_inr s)
with
| inl a =>
funp0 : h^-1 (inr b') = inl a =>
letp1 := moveL_equiv_M (inl a) (inr b') p0
in
Overture.Empty_rec (is_inr (inl a))
(transport is_inl p1^ (Ha a))
| inr b => fun_ : h^-1 (inr b') = inr b => tt
end p) b') = b'
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
unfunctor_sum_r (funx : A' + B' => h (h^-1 x))
(funb : B' =>
is_inr_ind (funx' : A + B => is_inr (h x')) Hb
(h^-1 (inr b))
(letx := h^-1 (inr b) inletp := 1inmatch
x as s return (h^-1 (inr b) = s -> is_inr s)
with
| inl a =>
funp0 : h^-1 (inr b) = inl a =>
letp1 := moveL_equiv_M (inl a) (inr b) p0
in
Overture.Empty_rec (is_inr (inl a))
(transport is_inl p1^ (Ha a))
| inr b0 => fun_ : h^-1 (inr b) = inr b0 => tt
end p)) b' = b'
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
inr
(unfunctor_sum_r (funx : A' + B' => h (h^-1 x))
(funb : B' =>
is_inr_ind (funx' : A + B => is_inr (h x')) Hb
(h^-1 (inr b))
(letx := h^-1 (inr b) inletp := 1inmatch
x as s
return (h^-1 (inr b) = s -> is_inr s)
with
| inl a =>
funp0 : h^-1 (inr b) = inl a =>
letp1 :=
moveL_equiv_M (inl a) (inr b) p0 in
Overture.Empty_rec (is_inr (inl a))
(transport is_inl p1^ (Ha a))
| inr b0 =>
fun_ : h^-1 (inr b) = inr b0 => tt
end p)) b') = inr b'
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b': B'
h (h^-1 (inr b')) = inr b'
apply eisretr.
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b))
unfunctor_sum_r h^-1
(funb' : B' =>
letx := h^-1 (inr b') inletp := 1 : h^-1 (inr b') = x inmatch
x as s return (h^-1 (inr b') = s -> is_inr s)
with
| inl a =>
(fun (a0 : A) (p0 : h^-1 (inr b') = inl a0) =>
letp1 := moveL_equiv_M (inl a0) (inr b') p0
in
Overture.Empty_rec (is_inr (inl a0))
(transport is_inl p1^ (Ha a0))) a
| inr b =>
(fun (b0 : B) (_ : h^-1 (inr b') = inr b0) =>
tt) b
end p) o unfunctor_sum_r h Hb == idmap
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b: B
unfunctor_sum_r h^-1
(funb' : B' =>
letx := h^-1 (inr b') inletp := 1inmatch
x as s return (h^-1 (inr b') = s -> is_inr s)
with
| inl a =>
funp0 : h^-1 (inr b') = inl a =>
letp1 := moveL_equiv_M (inl a) (inr b') p0 in
Overture.Empty_rec (is_inr (inl a))
(transport is_inl p1^ (Ha a))
| inr b => fun_ : h^-1 (inr b') = inr b => tt
end p) (unfunctor_sum_r h Hb b) = b
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b: B
unfunctor_sum_r (funx : A + B => h^-1 (h x))
(funb : B =>
is_inr_ind (funx' : A' + B' => is_inr (h^-1 x'))
(funb' : B' =>
letx := h^-1 (inr b') inletp := 1inmatch
x as s return (h^-1 (inr b') = s -> is_inr s)
with
| inl a =>
funp0 : h^-1 (inr b') = inl a =>
letp1 := moveL_equiv_M (inl a) (inr b') p0
in
Overture.Empty_rec (is_inr (inl a))
(transport is_inl p1^ (Ha a))
| inr b0 => fun_ : h^-1 (inr b') = inr b0 => tt
end p) (h (inr b)) (Hb b)) b = b
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b: B
inr
(unfunctor_sum_r (funx : A + B => h^-1 (h x))
(funb : B =>
is_inr_ind
(funx' : A' + B' => is_inr (h^-1 x'))
(funb' : B' =>
letx := h^-1 (inr b') inletp := 1inmatch
x as s
return (h^-1 (inr b') = s -> is_inr s)
with
| inl a =>
funp0 : h^-1 (inr b') = inl a =>
letp1 :=
moveL_equiv_M (inl a) (inr b') p0 in
Overture.Empty_rec (is_inr (inl a))
(transport is_inl p1^ (Ha a))
| inr b0 =>
fun_ : h^-1 (inr b') = inr b0 => tt
end p) (h (inr b)) (Hb b)) b) = inr b
A, A', B, B': Type h: A + B <~> A' + B' Ha: foralla : A, is_inl (h (inl a)) Hb: forallb : B, is_inr (h (inr b)) b: B
h^-1 (h (inr b)) = inr b
apply eissect.Defined.Definitionequiv_unfunctor_sum_r {AA'BB' : Type}
(h : A + B <~> A' + B')
(Ha : foralla:A, is_inl (h (inl a)))
(Hb : forallb:B, is_inr (h (inr b)))
: B <~> B'
:= Build_Equiv _ _ (unfunctor_sum_r h Hb)
(isequiv_unfunctor_sum_r h Ha Hb).Definitionequiv_unfunctor_sum {AA'BB' : Type}
(h : A + B <~> A' + B')
(Ha : foralla:A, is_inl (h (inl a)))
(Hb : forallb:B, is_inr (h (inr b)))
: (A <~> A') * (B <~> B')
:= (equiv_unfunctor_sum_l h Ha Hb , equiv_unfunctor_sum_r h Ha Hb).(** ** Symmetry *)(* This is a special property of [sum], of course, not an instance of a general family of facts about types. *)
A, B: Type
A + B <~> B + A
A, B: Type
A + B <~> B + A
apply (equiv_adjointify
(funab => match ab with inl a => inr a | inr b => inl b end)
(funab => match ab with inl a => inr a | inr b => inl b end));
intros [?|?]; exact idpath.Defined.(** ** Associativity *)
(funX : A + B + C =>
match X with
| inl s =>
(funs0 : A + B =>
match s0 with
| inl a => (funa0 : A => inl a0) a
| inr b => (funb0 : B => inr (inl b0)) b
end) s
| inr c => (func0 : C => inr (inr c0)) c
end)
o (funX : A + (B + C) =>
match X with
| inl a => (funa0 : A => inl (inl a0)) a
| inr s =>
(funs0 : B + C =>
match s0 with
| inl b => (funb0 : B => inl (inr b0)) b
| inr c => (func0 : C => inr c0) c
end) s
end) == idmap
intros [a|[b|c]]; reflexivity.
A, B, C: Type
(funX : A + (B + C) =>
match X with
| inl a => (funa0 : A => inl (inl a0)) a
| inr s =>
(funs0 : B + C =>
match s0 with
| inl b => (funb0 : B => inl (inr b0)) b
| inr c => (func0 : C => inr c0) c
end) s
end)
o (funX : A + B + C =>
match X with
| inl s =>
(funs0 : A + B =>
match s0 with
| inl a => (funa0 : A => inl a0) a
| inr b => (funb0 : B => inr (inl b0)) b
end) s
| inr c => (func0 : C => inr (inr c0)) c
end) == idmap
intros [e|a]; [ exact (Empty_rec@{u} e) | exact a ].
A: Type
A -> Empty + A
intros a; exact (inr@{Set u} a).
A: Type
(funX : Empty + A =>
match X with
| inl e => (fune0 : Empty => Empty_rec e0) e
| inr a => idmap a
end) o (funa : A => inr a) == idmap
intro x; exact idpath@{u}.
A: Type
(funa : A => inr a)
o (funX : Empty + A =>
match X with
| inl e => (fune0 : Empty => Empty_rec e0) e
| inr a => idmap a
end) == idmap
intros [e|z]; [ elim e | exact idpath@{u}].Defined.Definitionsum_empty_r@{u} (A : Type@{u}) : Equiv@{u u} (A + Empty) A
:= equiv_compose'@{u u u} (sum_empty_l A) (equiv_sum_symm@{u Set u} _ _).(** ** Distributivity *)
A, B, C: Type
A * (B + C) <~> A * B + A * C
A, B, C: Type
A * (B + C) <~> A * B + A * C
A, B, C: Type
A * (B + C) -> A * B + A * C
A, B, C: Type
IsEquiv ?equiv_fun
A, B, C: Type
A * (B + C) -> A * B + A * C
A, B, C: Type
A * B + A * C -> A * (B + C)
A, B, C: Type
?equiv_fun o ?equiv_inv == idmap
A, B, C: Type
?equiv_inv o ?equiv_fun == idmap
A, B, C: Type
forallx : A * (B + C),
?eisretr (?equiv_fun x) = ap ?equiv_fun (?eissect x)
A, B, C: Type
A * (B + C) -> A * B + A * C
A, B, C: Type a: A b: B
A * B + A * C
A, B, C: Type a: A c: C
A * B + A * C
A, B, C: Type a: A b: B
A * B + A * C
exact (inl@{u u} (a, b)).
A, B, C: Type a: A c: C
A * B + A * C
exact (inr@{u u} (a, c)).
A, B, C: Type
A * B + A * C -> A * (B + C)
A, B, C: Type a: A b: B
A * (B + C)
A, B, C: Type a: A c: C
A * (B + C)
A, B, C: Type a: A b: B
A * (B + C)
exact (a, inl@{u u} b).
A, B, C: Type a: A c: C
A * (B + C)
exact (a, inr@{u u} c).
A, B, C: Type
(funX : A * (B + C) =>
(fun (a : A) (snd : B + C) =>
match snd with
| inl b => (funb0 : B => inl (a, b0)) b
| inr c => (func0 : C => inr (a, c0)) c
end) (fst X) (snd X))
o (funX : A * B + A * C =>
match X with
| inl p =>
(funp0 : A * B =>
(fun (a : A) (b : B) => (a, inl b)) (fst p0)
(snd p0)) p
| inr p =>
(funp0 : A * C =>
(fun (a : A) (c : C) => (a, inr c)) (fst p0)
(snd p0)) p
end) == idmap
intros [[a b]|[a c]]; reflexivity.
A, B, C: Type
(funX : A * B + A * C =>
match X with
| inl p =>
(funp0 : A * B =>
(fun (a : A) (b : B) => (a, inl b)) (fst p0)
(snd p0)) p
| inr p =>
(funp0 : A * C =>
(fun (a : A) (c : C) => (a, inr c)) (fst p0)
(snd p0)) p
end)
o (funX : A * (B + C) =>
(fun (a : A) (snd : B + C) =>
match snd with
| inl b => (funb0 : B => inl (a, b0)) b
| inr c => (func0 : C => inr (a, c0)) c
end) (fst X) (snd X)) == idmap
intros [a [b|c]]; reflexivity.
A, B, C: Type
forallx : A * (B + C),
((funx0 : A * B + A * C =>
match
x0 as s
return
(match
snd
match s with
| inl p => (fst p, inl (snd p))
| inr p => (fst p, inr (snd p))
endwith
| inl b =>
inl
(fst
match s with
| inl p => (fst p, inl (snd p))
| inr p => (fst p, inr (snd p))
end, b)
| inr c =>
inr
(fst
match s with
| inl p => (fst p, inl (snd p))
| inr p => (fst p, inr (snd p))
end, c)
end = s)
with
| inl p =>
(funp0 : A * B =>
(fun (a : A) (b : B) => 1) (fst p0) (snd p0)) p
| inr p =>
(funp0 : A * C =>
(fun (a : A) (c : C) => 1) (fst p0) (snd p0)) p
end)
:
(funX : A * (B + C) =>
(fun (a : A) (snd : B + C) =>
match snd with
| inl b => (funb0 : B => inl (a, b0)) b
| inr c => (func0 : C => inr (a, c0)) c
end) (fst X) (snd X))
o (funX : A * B + A * C =>
match X with
| inl p =>
(funp0 : A * B =>
(fun (a : A) (b : B) => (a, inl b)) (fst p0)
(snd p0)) p
| inr p =>
(funp0 : A * C =>
(fun (a : A) (c : C) => (a, inr c)) (fst p0)
(snd p0)) p
end) == idmap)
((funX : A * (B + C) =>
(fun (a : A) (snd : B + C) =>
match snd with
| inl b => (funb0 : B => inl (a, b0)) b
| inr c => (func0 : C => inr (a, c0)) c
end) (fst X) (snd X)) x) =
ap
(funX : A * (B + C) =>
(fun (a : A) (snd : B + C) =>
match snd with
| inl b => (funb0 : B => inl (a, b0)) b
| inr c => (func0 : C => inr (a, c0)) c
end) (fst X) (snd X))
(((funx0 : A * (B + C) =>
(fun (a : A) (snd : B + C) =>
match
snd as s
return
(matchmatch s with
| inl b => inl (a, b)
| inr c => inr (a, c)
endwith
| inl p => (fst p, inl (Overture.snd p))
| inr p => (fst p, inr (Overture.snd p))
end = (a, s))
with
| inl b => (funb0 : B => 1) b
| inr c => (func0 : C => 1) c
end) (fst x0) (snd x0))
:
(funX : A * B + A * C =>
match X with
| inl p =>
(funp0 : A * B =>
(fun (a : A) (b : B) => (a, inl b)) (fst p0)
(snd p0)) p
| inr p =>
(funp0 : A * C =>
(fun (a : A) (c : C) => (a, inr c)) (fst p0)
(snd p0)) p
end)
o (funX : A * (B + C) =>
(fun (a : A) (snd : B + C) =>
match snd with
| inl b => (funb0 : B => inl (a, b0)) b
| inr c => (func0 : C => inr (a, c0)) c
end) (fst X) (snd X)) == idmap) x)
intros [a [b|c]]; reflexivity.Defined.
A, B, C: Type
(B + C) * A <~> B * A + C * A
A, B, C: Type
(B + C) * A <~> B * A + C * A
A, B, C: Type
IsEquiv
(funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end)
A, B, C: Type
(funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end)
o (funax : B * A + C * A =>
match ax with
| inl p =>
letp0 := p inletb := fst p0 inleta := snd p0 in (inl b, a)
| inr p =>
letp0 := p inletc := fst p0 inleta := snd p0 in (inr c, a)
end) == idmap
A, B, C: Type
(funax : B * A + C * A =>
match ax with
| inl p =>
letp0 := p inletb := fst p0 inleta := snd p0 in (inl b, a)
| inr p =>
letp0 := p inletc := fst p0 inleta := snd p0 in (inr c, a)
end)
o (funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end) == idmap
A, B, C: Type
forallx : (B + C) * A,
?eisretr
((funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end) x) =
ap
(funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end) (?eissect x)
A, B, C: Type
(funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end)
o (funax : B * A + C * A =>
match ax with
| inl p =>
letp0 := p inletb := fst p0 inleta := snd p0 in (inl b, a)
| inr p =>
letp0 := p inletc := fst p0 inleta := snd p0 in (inr c, a)
end) == idmap
intros [[b a]|[c a]]; reflexivity.
A, B, C: Type
(funax : B * A + C * A =>
match ax with
| inl p =>
letp0 := p inletb := fst p0 inleta := snd p0 in (inl b, a)
| inr p =>
letp0 := p inletc := fst p0 inleta := snd p0 in (inr c, a)
end)
o (funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end) == idmap
intros [[b|c] a]; reflexivity.
A, B, C: Type
forallx : (B + C) * A,
((funx0 : B * A + C * A =>
match
x0 as s
return
((letbc :=
fst
match s with
| inl p =>
letp0 := p inletb := fst p0 inleta := snd p0 in (inl b, a)
| inr p =>
letp0 := p inletc := fst p0 inleta := snd p0 in (inr c, a)
endinleta :=
snd
match s with
| inl p =>
letp0 := p inletb := fst p0 inleta := snd p0 in (inl b, a)
| inr p =>
letp0 := p inletc := fst p0 inleta := snd p0 in (inr c, a)
endinmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end) = s)
with
| inl p =>
(funp0 : B * A =>
(fun (b : B) (a : A) => 1) (fst p0) (snd p0)) p
| inr p =>
(funp0 : C * A =>
(fun (c : C) (a : A) => 1) (fst p0) (snd p0)) p
end)
:
(funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end)
o (funax : B * A + C * A =>
match ax with
| inl p =>
letp0 := p inletb := fst p0 inleta := snd p0 in (inl b, a)
| inr p =>
letp0 := p inletc := fst p0 inleta := snd p0 in (inr c, a)
end) == idmap)
((funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end) x) =
ap
(funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end)
(((funx0 : (B + C) * A =>
(funfst : B + C =>
match
fst as s
return
(forallsnd : A,
match
(letbc := s inleta := snd in ...
...
...
end)
with
| inl p =>
letp0 := p inletb := Overture.fst p0 inleta := Overture.snd p0 in (inl b, a)
| inr p =>
letp0 := p inletc := Overture.fst p0 inleta := Overture.snd p0 in (inr c, a)
end = (s, snd))
with
| inl b => (fun (b0 : B) (a : A) => 1) b
| inr c => (fun (c0 : C) (a : A) => 1) c
end) (fst x0) (snd x0))
:
(funax : B * A + C * A =>
match ax with
| inl p =>
letp0 := p inletb := fst p0 inleta := snd p0 in (inl b, a)
| inr p =>
letp0 := p inletc := fst p0 inleta := snd p0 in (inr c, a)
end)
o (funabc : (B + C) * A =>
letbc := fst abc inleta := snd abc inmatch bc with
| inl b => inl (b, a)
| inr c => inr (c, a)
end) == idmap) x)
intros [[b|c] a]; reflexivity.Defined.(** ** Extensivity *)(** We can phrase extensivity in two ways, using either dependent types or functions. *)(** The first is a statement about types dependent on a sum type. *)
A, B: Type C: A + B -> Type
{x : A + B & C x} <~>
{a : A & C (inl a)} + {b : B & C (inr b)}
A, B: Type C: A + B -> Type
{x : A + B & C x} <~>
{a : A & C (inl a)} + {b : B & C (inr b)}
A, B: Type C: A + B -> Type
IsEquiv
(funxc : {x : A + B & C x} =>
letx := xc.1inletc := xc.2inmatch
x as x0
return
(C x0 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c)
A, B: Type C: A + B -> Type
(funxc : {x : A + B & C x} =>
letx := xc.1inletc := xc.2inmatch
x as x0
return
(C x0 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c)
o (funabc : {a : A & C (inl a)} + {b : B & C (inr b)}
=>
match abc with
| inl s =>
lets0 := s inleta := s0.1inletc := s0.2in (inl a; c)
| inr s =>
lets0 := s inletb := s0.1inletc := s0.2in (inr b; c)
end) == idmap
A, B: Type C: A + B -> Type
(funabc : {a : A & C (inl a)} + {b : B & C (inr b)}
=>
match abc with
| inl s =>
lets0 := s inleta := s0.1inletc := s0.2in (inl a; c)
| inr s =>
lets0 := s inletb := s0.1inletc := s0.2in (inr b; c)
end)
o (funxc : {x : A + B & C x} =>
letx := xc.1inletc := xc.2inmatch
x as x0
return
(C x0 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c) == idmap
A, B: Type C: A + B -> Type
forallx : {x : A + B & C x},
?eisretr
((funxc : {x0 : A + B & C x0} =>
letx0 := xc.1inletc := xc.2inmatch
x0 as x1
return
(C x1 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c) x) =
ap
(funxc : {x0 : A + B & C x0} =>
letx0 := xc.1inletc := xc.2inmatch
x0 as x1
return
(C x1 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c) (?eissect x)
A, B: Type C: A + B -> Type
(funxc : {x : A + B & C x} =>
letx := xc.1inletc := xc.2inmatch
x as x0
return
(C x0 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c)
o (funabc : {a : A & C (inl a)} + {b : B & C (inr b)}
=>
match abc with
| inl s =>
lets0 := s inleta := s0.1inletc := s0.2in (inl a; c)
| inr s =>
lets0 := s inletb := s0.1inletc := s0.2in (inr b; c)
end) == idmap
intros [[a c]|[b c]]; reflexivity.
A, B: Type C: A + B -> Type
(funabc : {a : A & C (inl a)} + {b : B & C (inr b)}
=>
match abc with
| inl s =>
lets0 := s inleta := s0.1inletc := s0.2in (inl a; c)
| inr s =>
lets0 := s inletb := s0.1inletc := s0.2in (inr b; c)
end)
o (funxc : {x : A + B & C x} =>
letx := xc.1inletc := xc.2inmatch
x as x0
return
(C x0 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c) == idmap
intros [[a|b] c]; reflexivity.
A, B: Type C: A + B -> Type
forallx : {x : A + B & C x},
((funx0 : {a : A & C (inl a)} + {b : B & C (inr b)}
=>
match
x0 as s
return
((letx1 :=
match s with
| inl s0 =>
lets1 := s0 inleta := s1.1inletc := s1.2in (inl a; c)
| inr s0 =>
lets1 := s0 inletb := s1.1inletc := s1.2in (inr b; c)
end.1inletc :=
match s with
| inl s0 =>
lets1 := s0 inleta := s1.1inletc := s1.2in (inl a; c)
| inr s0 =>
lets1 := s0 inletb := s1.1inletc := s1.2in (inr b; c)
end.2inmatch
x1 as x2
return
(C x2 ->
{a : A & C (...)} + {b : B & C (...)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c) = s)
with
| inl s =>
(funs0 : {a : A & C (inl a)} =>
(fun (a : A) (c : C (inl a)) => 1) s0.1 s0.2) s
| inr s =>
(funs0 : {b : B & C (inr b)} =>
(fun (b : B) (c : C (inr b)) => 1) s0.1 s0.2) s
end)
:
(funxc : {x0 : A + B & C x0} =>
letx0 := xc.1inletc := xc.2inmatch
x0 as x1
return
(C x1 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c)
o (funabc : {a : A & C (inl a)} + {b : B & C (inr b)}
=>
match abc with
| inl s =>
lets0 := s inleta := s0.1inletc := s0.2in (inl a; c)
| inr s =>
lets0 := s inletb := s0.1inletc := s0.2in (inr b; c)
end) == idmap)
((funxc : {x0 : A + B & C x0} =>
letx0 := xc.1inletc := xc.2inmatch
x0 as x1
return
(C x1 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c) x) =
ap
(funxc : {x0 : A + B & C x0} =>
letx0 := xc.1inletc := xc.2inmatch
x0 as x1
return
(C x1 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c)
(((funx0 : {x0 : A + B & C x0} =>
(funproj1 : A + B =>
match
proj1 as s
return
(forallproj2 : C s,
match
(letx1 := s inletc := proj2 in ... c)
with
| inl s0 =>
lets1 := s0 inleta := s1.1inletc := s1.2in (inl a; c)
| inr s0 =>
lets1 := s0 inletb := s1.1inletc := s1.2in (inr b; c)
end = (s; proj2))
with
| inl a =>
(fun (a0 : A) (c : C (inl a0)) => 1) a
| inr b =>
(fun (b0 : B) (c : C (inr b0)) => 1) b
end) x0.1 x0.2)
:
(funabc : {a : A & C (inl a)} + {b : B & C (inr b)}
=>
match abc with
| inl s =>
lets0 := s inleta := s0.1inletc := s0.2in (inl a; c)
| inr s =>
lets0 := s inletb := s0.1inletc := s0.2in (inr b; c)
end)
o (funxc : {x0 : A + B & C x0} =>
letx0 := xc.1inletc := xc.2inmatch
x0 as x1
return
(C x1 ->
{a : A & C (inl a)} + {b : B & C (inr b)})
with
| inl a => func0 : C (inl a) => inl (a; c0)
| inr b => func0 : C (inr b) => inr (b; c0)
end c) == idmap) x)
intros [[a|b] c]; reflexivity.Defined.(** The second is a statement about functions into a sum type. *)Definitiondecompose_l {ABC} (f : C -> A + B) : Type
:= { c:C & is_inl (f c) }.Definitiondecompose_r {ABC} (f : C -> A + B) : Type
:= { c:C & is_inr (f c) }.
A, B, C: Type f: C -> A + B
decompose_l f + decompose_r f <~> C
A, B, C: Type f: C -> A + B
decompose_l f + decompose_r f <~> C
A, B, C: Type f: C -> A + B
C -> {c : C & is_inl (f c)} + {c : C & is_inr (f c)}
A, B, C: Type f: C -> A + B
sum_ind
(fun_ : {c : C & is_inl (f c)} +
{c : C & is_inr (f c)} => C) pr1 pr1 o ?g ==
idmap
A, B, C: Type f: C -> A + B
?g
o sum_ind
(fun_ : {c : C & is_inl (f c)} +
{c : C & is_inr (f c)} => C) pr1 pr1 ==
idmap
A, B, C: Type f: C -> A + B
C -> {c : C & is_inl (f c)} + {c : C & is_inr (f c)}
intros c; destruct (is_inl_or_is_inr (f c));
[ left | right ]; existsc; assumption.
A, B, C: Type f: C -> A + B
sum_ind
(fun_ : {c : C & is_inl (f c)} +
{c : C & is_inr (f c)} => C) pr1 pr1
o (func : C =>
lets := is_inl_or_is_inr (f c) inmatch s with
| inl i => (funi0 : is_inl (f c) => inl (c; i0)) i
| inr i => (funi0 : is_inr (f c) => inr (c; i0)) i
end) == idmap
(func : C =>
lets := is_inl_or_is_inr (f c) inmatch s with
| inl i => (funi0 : is_inl (f c) => inl (c; i0)) i
| inr i => (funi0 : is_inr (f c) => inr (c; i0)) i
end)
o sum_ind
(fun_ : {c : C & is_inl (f c)} +
{c : C & is_inr (f c)} => C) pr1 pr1 ==
idmap
A, B, C: Type f: C -> A + B c: C l, i: is_inl (f c)
inl (c; i) = inl (c; l)
A, B, C: Type f: C -> A + B c: C l: is_inl (f c) i: is_inr (f c)
inr (c; i) = inl (c; l)
A, B, C: Type f: C -> A + B c: C r: is_inr (f c) i: is_inl (f c)
inl (c; i) = inr (c; r)
A, B, C: Type f: C -> A + B c: C r, i: is_inr (f c)
inr (c; i) = inr (c; r)
A, B, C: Type f: C -> A + B c: C l, i: is_inl (f c)
inl (c; i) = inl (c; l)
apply ap, ap, path_ishprop.
A, B, C: Type f: C -> A + B c: C l: is_inl (f c) i: is_inr (f c)
inr (c; i) = inl (c; l)
elim (not_is_inl_and_inr' _ l i).
A, B, C: Type f: C -> A + B c: C r: is_inr (f c) i: is_inl (f c)
inl (c; i) = inr (c; r)
elim (not_is_inl_and_inr' _ i r).
A, B, C: Type f: C -> A + B c: C r, i: is_inr (f c)
inr (c; i) = inr (c; r)
apply ap, ap, path_ishprop.Defined.Definitionis_inl_decompose_l {ABC} (f : C -> A + B)
(z : decompose_l f)
: is_inl (f (equiv_decompose f (inl z)))
:= z.2.Definitionis_inr_decompose_r {ABC} (f : C -> A + B)
(z : decompose_r f)
: is_inr (f (equiv_decompose f (inr z)))
:= z.2.(** ** Indecomposability *)(** A type is indecomposable if whenever it maps into a finite sum, it lands entirely in one of the summands. It suffices to assert this for binary and nullary sums; in the latter case it reduces to nonemptiness. *)ClassIndecomposable (X : Type) :=
{ indecompose : forallAB (f : X -> A + B),
(forallx, is_inl (f x)) + (forallx, is_inr (f x))
; indecompose0 : ~~X }.(** For instance, contractible types are indecomposable. *)
X: Type Contr0: Contr X
Indecomposable X
X: Type Contr0: Contr X
Indecomposable X
X: Type Contr0: Contr X
forall (AB : Type) (f : X -> A + B),
(forallx : X, is_inl (f x)) +
(forallx : X, is_inr (f x))
X: Type Contr0: Contr X
~~ X
X: Type Contr0: Contr X
forall (AB : Type) (f : X -> A + B),
(forallx : X, is_inl (f x)) +
(forallx : X, is_inr (f x))
X: Type Contr0: Contr X A, B: Type f: X -> A + B i: is_inl (f (center X)) x: X
is_inl (f x)
X: Type Contr0: Contr X A, B: Type f: X -> A + B i: is_inr (f (center X)) x: X
is_inr (f x)
all:refine (transport _ (ap f (contr x)) _); assumption.
X: Type Contr0: Contr X
~~ X
intros nx; exact (nx (center X)).Defined.(** In particular, if an indecomposable type is equivalent to a sum type, then one summand is empty and it is equivalent to the other. *)
X, A, B: Type H: Indecomposable X f: X <~> A + B
(X <~> A) * (Empty <~> B) + (X <~> B) * (Empty <~> A)
X, A, B: Type H: Indecomposable X f: X <~> A + B
(X <~> A) * (Empty <~> B) + (X <~> B) * (Empty <~> A)
X, A, B: Type H: Indecomposable X f: X <~> A + B i: forallx : X, is_inl (f x)
(X <~> A) * (Empty <~> B)
X, A, B: Type H: Indecomposable X f: X <~> A + B i: forallx : X, is_inr (f x)
(X <~> B) * (Empty <~> A)
X, A, B: Type H: Indecomposable X f: X <~> A + B i: forallx : X, is_inl (f x) g:= f oE sum_empty_r X: X + Empty <~> A + B
(X <~> A) * (Empty <~> B)
X, A, B: Type H: Indecomposable X f: X <~> A + B i: forallx : X, is_inr (f x)
(X <~> B) * (Empty <~> A)
X, A, B: Type H: Indecomposable X f: X <~> A + B i: forallx : X, is_inl (f x) g:= f oE sum_empty_r X: X + Empty <~> A + B
(X <~> A) * (Empty <~> B)
X, A, B: Type H: Indecomposable X f: X <~> A + B i: forallx : X, is_inr (f x) g:= f oE sum_empty_l X: Empty + X <~> A + B
(X <~> B) * (Empty <~> A)
X, A, B: Type H: Indecomposable X f: X <~> A + B i: forallx : X, is_inl (f x) g:= f oE sum_empty_r X: X + Empty <~> A + B
(X <~> A) * (Empty <~> B)
X, A, B: Type H: Indecomposable X f: X <~> A + B i: forallx : X, is_inr (f x) g:= f oE sum_empty_l X: Empty + X <~> A + B
(Empty <~> A) * (X <~> B)
all:refine (equiv_unfunctor_sum g _ _); tryassumption; tryintros [].Defined.(** Summing with an indecomposable type is injective on equivalence classes of types. *)
A, B, B': Type H: Indecomposable A h: A + B <~> A + B'
B <~> B'
A, B, B': Type H: Indecomposable A h: A + B <~> A + B'
B <~> B'
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A
B <~> B'
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B
B <~> B'
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B k:= h oE (f +E g): decompose_l (h o inl) + decompose_r (h o inl) +
(decompose_l (h o inr) + decompose_r (h o inr)) <~>
A + B'
B <~> B'
(** This looks messy, but it just amounts to swapping the middle two summands in [k]. *)
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B k:= h oE (f +E g): decompose_l (h o inl) + decompose_r (h o inl) +
(decompose_l (h o inr) + decompose_r (h o inr)) <~>
A + B' k':= k
oE equiv_sum_assoc
(decompose_l (h o inl) +
decompose_r (h o inl))
(decompose_l (h o inr))
(decompose_r (h o inr))
oE ((equiv_sum_assoc (decompose_l (h o inl))
(decompose_r (h o inl))
(decompose_l (h o inr)))^-1 +E 1)
oE (1 +E
equiv_sum_symm (decompose_l (h o inr))
(decompose_r (h o inl)) +E 1)
oE (equiv_sum_assoc (decompose_l (h o inl))
(decompose_l (h o inr))
(decompose_r (h o inl)) +E 1)
oE (equiv_sum_assoc
(decompose_l (h o inl) +
decompose_l (h o inr))
(decompose_r (h o inl))
(decompose_r (h o inr)))^-1: decompose_l (h o inl) + decompose_l (h o inr) +
(decompose_r (h o inl) + decompose_r (h o inr)) <~>
A + B'
B <~> B'
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B'
B <~> B'
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B'
decompose_l (funx : B => h (inr x)) <~>
decompose_r (funx : A => h (inl x))
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : A => h (inl x)) q: Empty <~> decompose_l (funx : B => h (inr x)) u: A <~> decompose_l (funx : A => h (inl x)) v: Empty <~> decompose_r (funx : A => h (inl x))
decompose_l (funx : B => h (inr x)) <~>
decompose_r (funx : A => h (inl x))
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : A => h (inl x)) q: Empty <~> decompose_l (funx : B => h (inr x)) u: A <~> decompose_r (funx : A => h (inl x)) v: Empty <~> decompose_l (funx : A => h (inl x))
decompose_l (funx : B => h (inr x)) <~>
decompose_r (funx : A => h (inl x))
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : B => h (inr x)) q: Empty <~> decompose_l (funx : A => h (inl x)) u: A <~> decompose_l (funx : A => h (inl x)) v: Empty <~> decompose_r (funx : A => h (inl x))
decompose_l (funx : B => h (inr x)) <~>
decompose_r (funx : A => h (inl x))
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : B => h (inr x)) q: Empty <~> decompose_l (funx : A => h (inl x)) u: A <~> decompose_r (funx : A => h (inl x)) v: Empty <~> decompose_l (funx : A => h (inl x))
decompose_l (funx : B => h (inr x)) <~>
decompose_r (funx : A => h (inl x))
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : A => h (inl x)) q: Empty <~> decompose_l (funx : B => h (inr x)) u: A <~> decompose_l (funx : A => h (inl x)) v: Empty <~> decompose_r (funx : A => h (inl x))
decompose_l (funx : B => h (inr x)) <~>
decompose_r (funx : A => h (inl x))
exact (v oE q^-1).
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : A => h (inl x)) q: Empty <~> decompose_l (funx : B => h (inr x)) u: A <~> decompose_r (funx : A => h (inl x)) v: Empty <~> decompose_l (funx : A => h (inl x))
decompose_l (funx : B => h (inr x)) <~>
decompose_r (funx : A => h (inl x))
elim (indecompose0 (v^-1 o p)).
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : B => h (inr x)) q: Empty <~> decompose_l (funx : A => h (inl x)) u: A <~> decompose_l (funx : A => h (inl x)) v: Empty <~> decompose_r (funx : A => h (inl x))
decompose_l (funx : B => h (inr x)) <~>
decompose_r (funx : A => h (inl x))
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : B => h (inr x)) q: Empty <~> decompose_l (funx : A => h (inl x)) u: A <~> decompose_l (funx : A => h (inl x)) v: Empty <~> decompose_r (funx : A => h (inl x)) a: A
Empty
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : B => h (inr x)) q: Empty <~> decompose_l (funx : A => h (inl x)) u: A <~> decompose_l (funx : A => h (inl x)) v: Empty <~> decompose_r (funx : A => h (inl x)) a: A l: is_inl (h (inl a))
Empty
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : B => h (inr x)) q: Empty <~> decompose_l (funx : A => h (inl x)) u: A <~> decompose_l (funx : A => h (inl x)) v: Empty <~> decompose_r (funx : A => h (inl x)) a: A r: is_inr (h (inl a))
Empty
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : B => h (inr x)) q: Empty <~> decompose_l (funx : A => h (inl x)) u: A <~> decompose_l (funx : A => h (inl x)) v: Empty <~> decompose_r (funx : A => h (inl x)) a: A l: is_inl (h (inl a))
Empty
exact (q^-1 (a;l)).
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : B => h (inr x)) q: Empty <~> decompose_l (funx : A => h (inl x)) u: A <~> decompose_l (funx : A => h (inl x)) v: Empty <~> decompose_r (funx : A => h (inl x)) a: A r: is_inr (h (inl a))
Empty
exact (v^-1 (a;r)).
A, B, B': Type H: Indecomposable A h: A + B <~> A + B' f:= equiv_decompose (h o inl): decompose_l (h o inl) + decompose_r (h o inl) <~>
A g:= equiv_decompose (h o inr): decompose_l (h o inr) + decompose_r (h o inr) <~>
B s: decompose_l (funx : A => h (inl x)) +
decompose_l (funx : B => h (inr x)) <~> A t: decompose_r (funx : A => h (inl x)) +
decompose_r (funx : B => h (inr x)) <~> B' p: A <~> decompose_l (funx : B => h (inr x)) q: Empty <~> decompose_l (funx : A => h (inl x)) u: A <~> decompose_r (funx : A => h (inl x)) v: Empty <~> decompose_l (funx : A => h (inl x))
decompose_l (funx : B => h (inr x)) <~>
decompose_r (funx : A => h (inl x))
exact (u oE p^-1).Defined.Definitionequiv_unfunctor_sum_contr_ll {AA'BB' : Type}
`{Contr A} `{Contr A'}
(h : A + B <~> A' + B')
: B <~> B'
:= equiv_unfunctor_sum_indecomposable_ll
((equiv_contr_contr +E 1) oE h).(** ** Universal mapping properties *)(** Ordinary universal mapping properties are expressed as equivalences of sets or spaces of functions. In type theory, we can go beyond this and express an equivalence of types of *dependent* functions. *)Definitionsum_ind_uncurried {AB} (P : A + B -> Type)
(fg : (foralla, P (inl a)) * (forallb, P (inr b)))
: foralls, P s
:= @sum_ind A B P (fst fg) (snd fg).(* First the positive universal property. Doing this sort of thing without adjointifying will require very careful use of funext. *)
H: Funext A, B: Type P: A + B -> Type
IsEquiv (sum_ind_uncurried P)
H: Funext A, B: Type P: A + B -> Type
IsEquiv (sum_ind_uncurried P)
apply (isequiv_adjointify
(sum_ind_uncurried P)
(funf => (funa => f (inl a), funb => f (inr b))));
repeat ((exact idpath)
|| intros []
|| intro
|| apply path_forall).Defined.Definitionequiv_sum_ind `{Funext} `(P : A + B -> Type)
:= Build_Equiv _ _ _ (isequiv_sum_ind P).(* The non-dependent version, which is a special case, is the sum-distributive equivalence. *)Definitionequiv_sum_distributive `{Funext} (A B C : Type)
: (A -> C) * (B -> C) <~> (A + B -> C)
:= equiv_sum_ind (fun_ => C).(** ** Sums preserve most truncation *)
n': trunc_index n:= n'.+2: trunc_index A: Type IsTrunc0: IsTrunc n A B: Type IsTrunc1: IsTrunc n B
IsTrunc n (A + B)
n': trunc_index n:= n'.+2: trunc_index A: Type IsTrunc0: IsTrunc n A B: Type IsTrunc1: IsTrunc n B
IsTrunc n (A + B)
n': trunc_index n:= n'.+2: trunc_index A: Type IsTrunc0: IsTrunc n A B: Type IsTrunc1: IsTrunc n B
forallxy : A + B, IsTrunc n'.+1 (x = y)
n': trunc_index n:= n'.+2: trunc_index A: Type IsTrunc0: IsTrunc n A B: Type IsTrunc1: IsTrunc n B a, b: A + B
IsTrunc n'.+1 (a = b)
n': trunc_index n:= n'.+2: trunc_index A: Type IsTrunc0: IsTrunc n A B: Type IsTrunc1: IsTrunc n B a, b: A + B
IsTrunc n'.+1 (code_sum a b)
destruct a, b; exact _.Defined.Instanceishset_sum `{HA : IsHSet A, HB : IsHSet B} : IsHSet (A + B) | 100
:= @istrunc_sum (-2) A HA B HB.(** Sums don't preserve hprops in general, but they do for disjoint sums. *)
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B
(A -> B -> Empty) -> IsHProp (A + B)
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B
(A -> B -> Empty) -> IsHProp (A + B)
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B H: A -> B -> Empty
IsHProp (A + B)
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B H: A -> B -> Empty a1, a2: A
inl a1 = inl a2
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B H: A -> B -> Empty a1: A b2: B
inl a1 = inr b2
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B H: A -> B -> Empty b1: B a2: A
inr b1 = inl a2
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B H: A -> B -> Empty b1, b2: B
inr b1 = inr b2
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B H: A -> B -> Empty a1, a2: A
inl a1 = inl a2
apply ap, path_ishprop.
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B H: A -> B -> Empty a1: A b2: B
inl a1 = inr b2
case (H a1 b2).
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B H: A -> B -> Empty b1: B a2: A
inr b1 = inl a2
case (H a2 b1).
A, B: Type IsHProp0: IsHProp A IsHProp1: IsHProp B H: A -> B -> Empty b1, b2: B
A, B: Type H: DecidablePaths A H0: DecidablePaths B
DecidablePaths (A + B)
A, B: Type H: DecidablePaths A H0: DecidablePaths B
DecidablePaths (A + B)
A, B: Type H: DecidablePaths A H0: DecidablePaths B a1, a2: A
Decidable (inl a1 = inl a2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B a1: A b2: B
Decidable (inl a1 = inr b2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B b1: B a2: A
Decidable (inr b1 = inl a2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B b1, b2: B
Decidable (inr b1 = inr b2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B a1, a2: A
Decidable (inl a1 = inl a2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B a1, a2: A p: a1 = a2
Decidable (inl a1 = inl a2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B a1, a2: A np: a1 <> a2
Decidable (inl a1 = inl a2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B a1, a2: A p: a1 = a2
Decidable (inl a1 = inl a2)
exact (inl (ap inl p)).
A, B: Type H: DecidablePaths A H0: DecidablePaths B a1, a2: A np: a1 <> a2
Decidable (inl a1 = inl a2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B a1, a2: A np: a1 <> a2 p: inl a1 = inl a2
Empty
exact (np (path_sum^-1 p)).
A, B: Type H: DecidablePaths A H0: DecidablePaths B a1: A b2: B
Decidable (inl a1 = inr b2)
exact (inr path_sum^-1).
A, B: Type H: DecidablePaths A H0: DecidablePaths B b1: B a2: A
Decidable (inr b1 = inl a2)
exact (inr path_sum^-1).
A, B: Type H: DecidablePaths A H0: DecidablePaths B b1, b2: B
Decidable (inr b1 = inr b2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B b1, b2: B p: b1 = b2
Decidable (inr b1 = inr b2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B b1, b2: B np: b1 <> b2
Decidable (inr b1 = inr b2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B b1, b2: B p: b1 = b2
Decidable (inr b1 = inr b2)
exact (inl (ap inr p)).
A, B: Type H: DecidablePaths A H0: DecidablePaths B b1, b2: B np: b1 <> b2
Decidable (inr b1 = inr b2)
A, B: Type H: DecidablePaths A H0: DecidablePaths B b1, b2: B np: b1 <> b2 p: inr b1 = inr b2
Empty
exact (np (path_sum^-1 p)).Defined.(** Because of [ishprop_sum], decidability of an hprop is again an hprop. *)
H: Funext A: Type IsHProp0: IsHProp A
IsHProp (Decidable A)
H: Funext A: Type IsHProp0: IsHProp A
IsHProp (Decidable A)
H: Funext A: Type IsHProp0: IsHProp A
A -> ~ A -> Empty
intros a na; exact (na a).Defined.(** ** Binary coproducts are equivalent to dependent sigmas where the first component is a [Bool]. *)Definitionsig_of_sumAB (x : A + B)
: { b : Bool & if b then A else B }
:= (_;
match
x as s
return
(ifmatch s with
| inl _ => true
| inr _ => false
endthen A else B)
with
| inl a => a
| inr b => b
end).Definitionsum_of_sigAB (x : { b : Bool & if b then A else B })
: A + B
:= match x with
| (true; a) => inl a
| (false; b) => inr b
end.
A, B: Type
IsEquiv (sig_of_sum A B)
A, B: Type
IsEquiv (sig_of_sum A B)
A, B: Type
(funx : {b : Bool & if b then A else B} =>
sig_of_sum A B (sum_of_sig A B x)) == idmap
A, B: Type
(funx : A + B => sum_of_sig A B (sig_of_sum A B x)) ==
idmap
A, B: Type
(funx : {b : Bool & if b then A else B} =>
sig_of_sum A B (sum_of_sig A B x)) == idmap
intros [[] ?]; exact idpath.
A, B: Type
(funx : A + B => sum_of_sig A B (sig_of_sum A B x)) ==
idmap
intros []; exact idpath.Defined.Instanceisequiv_sum_of_sigAB : IsEquiv (sum_of_sig A B)
:= isequiv_inverse (@sig_of_sum A B).(** An alternative way of proving the truncation property of [sum]. *)
n: trunc_index A, B: Type IsTrunc0: IsTrunc n Bool IsTrunc1: IsTrunc n A IsTrunc2: IsTrunc n B
IsTrunc n (A + B)
n: trunc_index A, B: Type IsTrunc0: IsTrunc n Bool IsTrunc1: IsTrunc n A IsTrunc2: IsTrunc n B
IsTrunc n (A + B)
n: trunc_index A, B: Type IsTrunc0: IsTrunc n Bool IsTrunc1: IsTrunc n A IsTrunc2: IsTrunc n B