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.
(** The HoTT Book Exercises formalization. *)(** This file records formalized solutions to the HoTT Book exercises. *)(* See HoTTBook.v for an IMPORTANT NOTE FOR THE HoTT DEVELOPERS. PROCEDURE FOR UPDATING THE FILE: 1. Compile the latest version of the HoTT Book to update the LaTeX labels. Do not forget to pull in changes from HoTT/HoTT. 2. Run `etc/Book.py` using the `--exercises` flag (so your command should look like `cat ../book/*.aux | etc/Book.py --exercises contrib/HoTTBookExercises.v`) If it complains, fix things. 3. Add contents to new entries. 4. Run `etc/Book.py` again to make sure it is happy. 5. Compile this file with `make contrib` or `make contrib/HoTTBookExercises.vo`. 6. Do the git thing to submit your changes.*)
[Loading ML file number_string_notation_plugin.cmxs (using legacy method) ... done]
LocalOpen Scope nat_scope.LocalOpen Scope type_scope.LocalOpen Scope path_scope.(* END OF PREAMBLE *)(* ================================================== ex:composition *)(** Exercise 1.1 *)DefinitionBook_1_1 := (fun (ABC : Type) (f : A -> B) (g : B -> C) => g o f).
forall (ABCD : Type) (f : A -> B) (g : B -> C)
(h : C -> D), h o (g o f) = h o g o f
forall (ABCD : Type) (f : A -> B) (g : B -> C)
(h : C -> D), h o (g o f) = h o g o f
reflexivity.Defined.(* ================================================== ex:pr-to-rec *)(** Exercise 1.2 *)(** Recursor as equivalence. *)DefinitionBook_1_2_prod_lib := @HoTT.Types.Prod.equiv_uncurry.SectionBook_1_2_prod.VariableAB : Type.(** Recursor with projection functions instead of pattern-matching. *)Letprod_rec_projC (g : A -> B -> C) (p : A * B) : C
:= g (fst p) (snd p).DefinitionBook_1_2_prod := prod_rec_proj.
A, B: Type prod_rec_proj:= fun (C : Type) (g : A -> B -> C)
(p : A * B) => g (fst p) (snd p): forallC : Type,
(A -> B -> C) -> A * B -> C
fst = prod_rec_proj A (fun (a : A) (_ : B) => a)
A, B: Type prod_rec_proj:= fun (C : Type) (g : A -> B -> C)
(p : A * B) => g (fst p) (snd p): forallC : Type,
(A -> B -> C) -> A * B -> C
fst = prod_rec_proj A (fun (a : A) (_ : B) => a)
reflexivity.Defined.
A, B: Type prod_rec_proj:= fun (C : Type) (g : A -> B -> C)
(p : A * B) => g (fst p) (snd p): forallC : Type,
(A -> B -> C) -> A * B -> C
snd = prod_rec_proj B (fun_ : A => idmap)
A, B: Type prod_rec_proj:= fun (C : Type) (g : A -> B -> C)
(p : A * B) => g (fst p) (snd p): forallC : Type,
(A -> B -> C) -> A * B -> C
snd = prod_rec_proj B (fun_ : A => idmap)
reflexivity.Defined.EndBook_1_2_prod.(** Recursor as (dependent) equivalence. *)DefinitionBook_1_2_sig_lib := @HoTT.Types.Sigma.equiv_sig_ind.SectionBook_1_2_sig.VariableA : Type.VariableB : A -> Type.(** Non-dependent recursor with projection functions instead of pattern matching. *)Letsig_rec_projC (g : forall (x : A), B x -> C) (p : exists (x : A), B x) : C
:= g (pr1 p) (pr2 p).DefinitionBook_1_2_sig := @sig_rec_proj.
A: Type B: A -> Type sig_rec_proj:= fun (C : Type)
(g : forallx : A, B x -> C)
(p : {x : A & B x}) =>
g p.1 p.2: forallC : Type,
(forallx : A, B x -> C) ->
{x : A & B x} -> C
pr1 = sig_rec_proj A (fun (a : A) (_ : B a) => a)
A: Type B: A -> Type sig_rec_proj:= fun (C : Type)
(g : forallx : A, B x -> C)
(p : {x : A & B x}) =>
g p.1 p.2: forallC : Type,
(forallx : A, B x -> C) ->
{x : A & B x} -> C
pr1 = sig_rec_proj A (fun (a : A) (_ : B a) => a)
reflexivity.Defined.(** NB: You cannot implement pr2 with only the recursor, so it is not possible to check its definitional equality as the exercise suggests. *)EndBook_1_2_sig.(* ================================================== ex:pr-to-ind *)(** Exercise 1.3 *)(** The propositional uniqueness principles are named with an 'eta' postfix in the HoTT library. *)DefinitionBook_1_3_prod_lib := @HoTT.Types.Prod.prod_ind.SectionBook_1_3_prod.VariableAB : Type.Letprod_ind_eta (C : A * B -> Type) (g : forall (x : A) (y : B), C (x, y)) (x : A * B) : C x
:= transport C (HoTT.Types.Prod.eta_prod x) (g (fst x) (snd x)).DefinitionBook_1_3_prod := prod_ind_eta.
A, B: Type prod_ind_eta:= fun (C : A * B -> Type)
(g : forall (x : A) (y : B), C (x, y))
(x : A * B) =>
transport C (eta_prod x)
(g (fst x) (snd x)): forallC : A * B -> Type,
(forall (x : A) (y : B), C (x, y)) ->
forallx : A * B, C x
forall (C : A * B -> Type)
(g : forall (x : A) (y : B), C (x, y)) (a : A)
(b : B), prod_ind_eta C g (a, b) = g a b
A, B: Type prod_ind_eta:= fun (C : A * B -> Type)
(g : forall (x : A) (y : B), C (x, y))
(x : A * B) =>
transport C (eta_prod x)
(g (fst x) (snd x)): forallC : A * B -> Type,
(forall (x : A) (y : B), C (x, y)) ->
forallx : A * B, C x
forall (C : A * B -> Type)
(g : forall (x : A) (y : B), C (x, y)) (a : A)
(b : B), prod_ind_eta C g (a, b) = g a b
reflexivity.Defined.EndBook_1_3_prod.DefinitionBook_1_3_sig_lib := @HoTT.Basics.Overture.sig_ind.SectionBook_1_3_sig.VariableA : Type.VariableB : A -> Type.Letsig_ind_eta (C : (exists (a : A), B a) -> Type)
(g : forall (a : A) (b : B a), C (a; b))
(x : exists (a : A), B a) : C x
:= transport C (HoTT.Types.Sigma.eta_sigma x) (g (pr1 x) (pr2 x)).DefinitionBook_1_3_sig := sig_ind_eta.
A: Type B: A -> Type sig_ind_eta:= fun (C : {a : A & B a} -> Type)
(g : forall (a : A) (b : B a), C (a; b))
(x : {a : A & B a}) =>
transport C (eta_sigma x) (g x.1 x.2): forallC : {a : A & B a} -> Type,
(forall (a : A) (b : B a), C (a; b)) ->
forallx : {a : A & B a}, C x
forall (C : {a : A & B a} -> Type)
(g : forall (a : A) (b : B a), C (a; b)) (a : A)
(b : (funa0 : A => B a0) a),
sig_ind_eta C g (a; b) = g a b
A: Type B: A -> Type sig_ind_eta:= fun (C : {a : A & B a} -> Type)
(g : forall (a : A) (b : B a), C (a; b))
(x : {a : A & B a}) =>
transport C (eta_sigma x) (g x.1 x.2): forallC : {a : A & B a} -> Type,
(forall (a : A) (b : B a), C (a; b)) ->
forallx : {a : A & B a}, C x
forall (C : {a : A & B a} -> Type)
(g : forall (a : A) (b : B a), C (a; b)) (a : A)
(b : (funa0 : A => B a0) a),
sig_ind_eta C g (a; b) = g a b
reflexivity.Defined.EndBook_1_3_sig.(* ================================================== ex:iterator *)(** Exercise 1.4 *)SectionBook_1_4.FixpointBook_1_4_iter (C : Type) (c0 : C) (cs : C -> C) (n : nat) : C
:= match n with
| O => c0
| S m => cs (Book_1_4_iter C c0 cs m)
end.DefinitionBook_1_4_rec' (C : Type) (c0 : C) (cs : nat -> C -> C) : nat -> nat * C
:= Book_1_4_iter (nat * C) (O, c0) (funx => (S (fst x), cs (fst x) (snd x))).DefinitionBook_1_4_rec (C : Type) (c0 : C) (cs : nat -> C -> C) (n : nat) : C
:= snd (Book_1_4_rec' C c0 cs n).
forall (C : Type) (c0 : C) (cs : nat -> C -> C)
(n : nat), fst (Book_1_4_rec' C c0 cs n) = n
forall (C : Type) (c0 : C) (cs : nat -> C -> C)
(n : nat), fst (Book_1_4_rec' C c0 cs n) = n
C: Type c0: C cs: nat -> C -> C n: nat
fst (Book_1_4_rec' C c0 cs n) = n
C: Type c0: C cs: nat -> C -> C
fst (Book_1_4_rec' C c0 cs 0) = 0
C: Type c0: C cs: nat -> C -> C m: nat IH: fst (Book_1_4_rec' C c0 cs m) = m
fst (Book_1_4_rec' C c0 cs m.+1) = m.+1
C: Type c0: C cs: nat -> C -> C
fst (Book_1_4_rec' C c0 cs 0) = 0
C: Type c0: C cs: nat -> C -> C
0 = 0
reflexivity.
C: Type c0: C cs: nat -> C -> C m: nat IH: fst (Book_1_4_rec' C c0 cs m) = m
fst (Book_1_4_rec' C c0 cs m.+1) = m.+1
C: Type c0: C cs: nat -> C -> C m: nat IH: fst (Book_1_4_rec' C c0 cs m) = m
(fst (Book_1_4_rec' C c0 cs m)).+1 = m.+1
exact (ap S IH).Qed.
forall (C : Type) (c0 : C) (cs : nat -> C -> C)
(n : nat),
Book_1_4_rec C c0 cs n =
nat_rect (fun_ : nat => C) c0 cs n
forall (C : Type) (c0 : C) (cs : nat -> C -> C)
(n : nat),
Book_1_4_rec C c0 cs n =
nat_rect (fun_ : nat => C) c0 cs n
C: Type c0: C cs: nat -> C -> C n: nat
Book_1_4_rec C c0 cs n =
nat_rect (fun_ : nat => C) c0 cs n
C: Type c0: C cs: nat -> C -> C
Book_1_4_rec C c0 cs 0 =
nat_rect (fun_ : nat => C) c0 cs 0
C: Type c0: C cs: nat -> C -> C m: nat IH: Book_1_4_rec C c0 cs m =
nat_rect (fun_ : nat => C) c0 cs m
Book_1_4_rec C c0 cs m.+1 =
nat_rect (fun_ : nat => C) c0 cs m.+1
C: Type c0: C cs: nat -> C -> C
Book_1_4_rec C c0 cs 0 =
nat_rect (fun_ : nat => C) c0 cs 0
C: Type c0: C cs: nat -> C -> C
Book_1_4_rec C c0 cs 0 = c0
reflexivity.
C: Type c0: C cs: nat -> C -> C m: nat IH: Book_1_4_rec C c0 cs m =
nat_rect (fun_ : nat => C) c0 cs m
Book_1_4_rec C c0 cs m.+1 =
nat_rect (fun_ : nat => C) c0 cs m.+1
C: Type c0: C cs: nat -> C -> C m: nat IH: Book_1_4_rec C c0 cs m =
nat_rect (fun_ : nat => C) c0 cs m
cs (fst (Book_1_4_rec' C c0 cs m))
(Book_1_4_rec C c0 cs m) =
cs m (nat_rect (fun_ : nat => C) c0 cs m)
C: Type c0: C cs: nat -> C -> C m: nat IH: Book_1_4_rec C c0 cs m =
nat_rect (fun_ : nat => C) c0 cs m
cs m (Book_1_4_rec C c0 cs m) =
cs m (nat_rect (fun_ : nat => C) c0 cs m)
exact (ap (cs m) IH).Qed.EndBook_1_4.(* ================================================== ex:sum-via-bool *)(** Exercise 1.5 *)SectionBook_1_5.DefinitionBook_1_5_sum (AB : Type) := { x : Bool & if x then A else B }.Notation"'inl' a" := (true; a) (at level0).Notation"'inr' b" := (false; b) (at level0).DefinitionBook_1_5_ind (AB : Type) (C : Book_1_5_sum A B -> Type) (f : foralla, C (inl a))
(g : forallb, C (inr b)) : forallx : Book_1_5_sum A B, C x := funx => match x with
| inl a => f a
| inr b => g b
end.
A, B: Type C: Book_1_5_sum A B -> Type f: foralla : (funx : Bool => if x then A else B) true,
C inl (a) g: forallb : (funx : Bool => if x then A else B) false,
C inr (b) a: A
Book_1_5_ind A B C f g inl (a) = f a
A, B: Type C: Book_1_5_sum A B -> Type f: foralla : (funx : Bool => if x then A else B) true,
C inl (a) g: forallb : (funx : Bool => if x then A else B) false,
C inr (b) a: A
Book_1_5_ind A B C f g inl (a) = f a
reflexivity.Defined.
A, B: Type C: Book_1_5_sum A B -> Type f: foralla : (funx : Bool => if x then A else B) true,
C inl (a) g: forallb : (funx : Bool => if x then A else B) false,
C inr (b) b: B
Book_1_5_ind A B C f g inr (b) = g b
A, B: Type C: Book_1_5_sum A B -> Type f: foralla : (funx : Bool => if x then A else B) true,
C inl (a) g: forallb : (funx : Bool => if x then A else B) false,
C inr (b) b: B
Book_1_5_ind A B C f g inr (b) = g b
reflexivity.Defined.EndBook_1_5.(* ================================================== ex:prod-via-bool *)(** Exercise 1.6 *)SectionBook_1_6.Context `{Funext}.DefinitionBook_1_6_prod (AB : Type) := forallx : Bool, (if x then A else B).DefinitionBook_1_6_mk_pair {AB : Type} (a : A) (b : B) : Book_1_6_prod A B
:= funx => match x with
| true => a
| false => b
end.Notation"( a , b )" := (Book_1_6_mk_pair a b) (at level0).Notation"'pr1' p" := (p true) (at level0).Notation"'pr2' p" := (p false) (at level0).DefinitionBook_1_6_eq {AB : Type} (p : Book_1_6_prod A B) : (pr1 p, pr2 p) == p
:= funx => match x with
| true => 1
| false => 1end.
H: Funext A, B: Type a: A b: B
Book_1_6_eq (a, b) = (funx : Bool => 1)
H: Funext A, B: Type a: A b: B
Book_1_6_eq (a, b) = (funx : Bool => 1)
H: Funext A, B: Type a: A b: B
Book_1_6_eq (a, b) == (funx : Bool => 1)
H: Funext A, B: Type a: A b: B x: Bool
Book_1_6_eq (a, b) x = 1
destruct x; reflexivity.Qed.DefinitionBook_1_6_eta {AB : Type} (p : Book_1_6_prod A B) : (pr1 p, pr2 p) = p
:= path_forall (pr1 p, pr2 p) p (Book_1_6_eq p).DefinitionBook_1_6_ind {AB : Type} (C : Book_1_6_prod A B -> Type) (f : forallab, C (a, b))
(p : Book_1_6_prod A B) : C p
:= transport C (Book_1_6_eta p) (f (pr1 p) (pr2 p)).
H: Funext A, B: Type C: Book_1_6_prod A B -> Type f: forall (a : A) (b : B), C (a, b) a: A b: B
Book_1_6_ind C f (a, b) = f a b
H: Funext A, B: Type C: Book_1_6_prod A B -> Type f: forall (a : A) (b : B), C (a, b) a: A b: B
Book_1_6_ind C f (a, b) = f a b
H: Funext A, B: Type C: Book_1_6_prod A B -> Type f: forall (a : A) (b : B), C (a, b) a: A b: B
transport C
(path_forall ((a, b) true, (a, b) false) (a, b)
(Book_1_6_eq (a, b)))
(f ((a, b) true) ((a, b) false)) = f a b
H: Funext A, B: Type C: Book_1_6_prod A B -> Type f: forall (a : A) (b : B), C (a, b) a: A b: B
transport C
(path_forall (a, b) (a, b) (Book_1_6_eq (a, b)))
(f a b) = f a b
H: Funext A, B: Type C: Book_1_6_prod A B -> Type f: forall (a : A) (b : B), C (a, b) a: A b: B
transport C 1 (f a b) = f a b
reflexivity.Qed.EndBook_1_6.(* ================================================== ex:pm-to-ml *)(** Exercise 1.7 *)SectionBook_1_7.DefinitionBook_1_7_id {A : Type}
: forall {xy : A} (p : x = y), (x; 1) = (y; p) :> { a : A & x = a }
:= paths_ind' (fun (xy : A) (p : x = y) => (x; 1) = (y; p)) (funx => 1).DefinitionBook_1_7_transport {A : Type} (P : A -> Type)
: forall {xy : A} (p : x = y), P x -> P y
:= paths_ind' (fun (xy : A) (p : x = y) => P x -> P y) (funx => idmap).DefinitionBook_1_7_ind' {A : Type} (a : A) (C : forallx, (a = x) -> Type)
(c : C a 1) (x : A) (p : a = x)
: C x p
:= Book_1_7_transport (funr => C (pr1 r) (pr2 r)) (Book_1_7_id p) c.DefinitionBook_1_7_eq {A : Type} (a : A) (C : forallx, (a = x) -> Type) (c : C a 1)
: Book_1_7_ind' a C c a 1 = c
:= 1.EndBook_1_7.(* ================================================== ex:nat-semiring *)(** Exercise 1.8 *)SectionBook_1_8.FixpointBook_1_8_rec_nat (C : Type) c0cs (n : nat) : C
:= match n with
| O => c0
| S m => cs m (Book_1_8_rec_nat C c0 cs m)
end.DefinitionBook_1_8_add : nat -> nat -> nat
:= Book_1_8_rec_nat (nat -> nat) (funm => m) (funngm => (S (g m))).DefinitionBook_1_8_mult : nat -> nat -> nat
:= Book_1_8_rec_nat (nat -> nat) (funm => 0) (funngm => Book_1_8_add m (g m)).(* [Book_1_8_rec_nat] gives back a function with the wrong argument order, so we flip the order of the arguments [p] and [q]. *)DefinitionBook_1_8_exp : nat -> nat -> nat
:= funpq =>
(Book_1_8_rec_nat (nat -> nat) (funm => (S 0)) (funngm => Book_1_8_mult m (g m))) q p.Exampleadd_example: Book_1_8_add 3217 = 49 := 1.Examplemult_example: Book_1_8_mult 205 = 100 := 1.Exampleexp_example: Book_1_8_exp 210 = 1024 := 1.DefinitionBook_1_8_semiring := HoTT.Classes.implementations.peano_naturals.nat_semiring.EndBook_1_8.(* ================================================== ex:fin *)(** Exercise 1.9 *)SectionBook_1_9.FixpointBook_1_9_Fin (n : nat) : Type
:= match n with
| O => Empty
| S m => (Book_1_9_Fin m) + Unit
end.DefinitionBook_1_9_fmax (n : nat) : Book_1_9_Fin (S n) := inr tt.EndBook_1_9.(* ================================================== ex:ackermann *)(** Exercise 1.10 *)Fixpointack (nm : nat) : nat
:= match n with
| O => S m
| S p => let fixackn (m : nat)
:= match m with
| O => ack p 1
| S q => ack p (ackn q)
endin ackn m
end.DefinitionBook_1_10 := ack.(* ================================================== ex:neg-ldn *)(** Exercise 1.11 *)SectionBook_1_11.
exact (inl p).Qed.EndBook_1_13.(* ================================================== ex:without-K *)(** Exercise 1.14 *)(** There is no adequate type family C : Pi_{x, y, p} U such that C(x, x, p) is p = refl x definitionally. *)(* ================================================== ex:subtFromPathInd *)(** Exercise 1.15 *)DefinitionBook_1_15_paths_rec {A : Type} {C : A -> Type} {xy : A} (p : x = y) : C x -> C y
:= match p with1 => idmap end.(** This is exactly the definition of [transport] from Basics.Overture. *)(* ================================================== ex:add-nat-commutative *)(** Exercise 1.16 *)DefinitionBook_1_16 := HoTT.Spaces.Nat.Core.nat_add_comm.(* ================================================== ex:basics:concat *)(** Exercise 2.1 *)(* Book_2_1_concatenation1 is equivalent to the proof given in the text *)
forall (A : Type) (xyz : A), x = y -> y = z -> x = z
forall (A : Type) (xyz : A), x = y -> y = z -> x = z
A: Type x, y, z: A x_eq_y: x = y y_eq_z: y = z
x = z
A: Type x, z: A y_eq_z: x = z
x = z
A: Type x: A
x = x
reflexivity.Defined.
forall (A : Type) (xyz : A), x = y -> y = z -> x = z
forall (A : Type) (xyz : A), x = y -> y = z -> x = z
A: Type x, y, z: A x_eq_y: x = y y_eq_z: y = z
x = z
A: Type x, z: A y_eq_z: x = z
x = z
exact y_eq_z.Defined.
forall (A : Type) (xyz : A), x = y -> y = z -> x = z
forall (A : Type) (xyz : A), x = y -> y = z -> x = z
A: Type x, y, z: A x_eq_y: x = y y_eq_z: y = z
x = z
A: Type x, y: A x_eq_y: x = y
x = y
exact x_eq_y.Defined.LocalNotation"p *1 q" := (Book_2_1_concatenation1 p q) (at level10).LocalNotation"p *2 q" := (Book_2_1_concatenation2 p q) (at level10).LocalNotation"p *3 q" := (Book_2_1_concatenation3 p q) (at level10).SectionBook_2_1_Proofs_Are_Equal.Context {A : Type} {xyz : A}.Variable (p : x = y) (q : y = z).
forall (A : Type) (xyz : A) (p : x = y) (q : y = z),
(Book_2_1_concatenation1_eq_Book_2_1_concatenation2 p
q) *1
(Book_2_1_concatenation2_eq_Book_2_1_concatenation3 p
q) =
Book_2_1_concatenation1_eq_Book_2_1_concatenation3 p q
forall (A : Type) (xyz : A) (p : x = y) (q : y = z),
(Book_2_1_concatenation1_eq_Book_2_1_concatenation2 p
q) *1
(Book_2_1_concatenation2_eq_Book_2_1_concatenation3 p
q) =
Book_2_1_concatenation1_eq_Book_2_1_concatenation3 p q
reflexivity.Defined.(* ================================================== ex:fourth-concat *)(** Exercise 2.3 *)(* Since we have x_eq_y : x = y we can transport y_eq_z : y = z along x_eq_y⁻¹ : y = x in the type family λw.(w = z) to obtain a term of type x = z. *)DefinitionBook_2_1_concatenation4
{A : Type} {xyz : A} : x = y -> y = z -> x = z :=
funx_eq_yy_eq_z => transport (funw => w = z) (inverse x_eq_y) y_eq_z.LocalNotation"p *4 q" := (Book_2_1_concatenation4 p q) (at level10).
forall (A : Type) (xyz : A) (p : x = y) (q : y = z),
p *1 q = p *4 q
forall (A : Type) (xyz : A) (p : x = y) (q : y = z),
p *1 q = p *4 q
A: Type x: A
1 *11 = 1 *41
reflexivity.Defined.(* ================================================== ex:npaths *)(** Exercise 2.4 *)DefinitionBook_2_4_npath : nat -> Type -> Type
:= nat_ind (fun (n : nat) => Type -> Type)
(* 0-dimensional paths are elements *)
(funA => A)
(* (n+1)-dimensional paths are paths between n-dimimensional paths *)
(funnfA => (existsa1a2 : (f A), a1 = a2)).(* This is the intuition behind definition of nboundary: As we've defined them, every (n+1)-path is a path between two n-paths. *)
forall (n : nat) (A : Type),
Book_2_4_npath n.+1 A =
{p1 : Book_2_4_npath n A &
{p2 : Book_2_4_npath n A & p1 = p2}}
forall (n : nat) (A : Type),
Book_2_4_npath n.+1 A =
{p1 : Book_2_4_npath n A &
{p2 : Book_2_4_npath n A & p1 = p2}}
reflexivity.Defined.(* It can be helpful to take a look at what this definition does. Try uncommenting the following lines: *)(*Context {A : Type}.Eval compute in (Book_2_4_npath 0 A). (* = A : Type *)Eval compute in (Book_2_4_npath 1 A). (* = {a1 : A & {a2 : A & a1 = a2}} : Type *)Eval compute in (Book_2_4_npath 2 A). (* and so on... *)*)(* Given an (n+1)-path, we simply project to a pair of n-paths. *)DefinitionBook_2_4_nboundary
: forall {n : nat} {A : Type}, Book_2_4_npath (S n) A ->
(Book_2_4_npath n A * Book_2_4_npath n A)
:= fun {n} {A} p => (pr1 p, pr1 (pr2 p)).(* ================================================== ex:ap-to-apd-equiv-apd-to-ap *)(** Exercise 2.5 *)(* Note that "@" is notation for concatentation and ^ is for inversion *)DefinitionBook_eq_2_3_6 {AB : Type} {xy : A} (p : x = y) (f : A -> B)
: (f x = f y) -> (transport (fun_ => B) p (f x) = f y) :=
funfx_eq_fy =>
(HoTT.Basics.PathGroupoids.transport_const p (f x)) @ fx_eq_fy.DefinitionBook_eq_2_3_7 {AB : Type} {xy : A} (p : x = y) (f : A -> B)
: (transport (fun_ => B) p (f x) = f y) -> f x = f y :=
funfx_eq_fy =>
(HoTT.Basics.PathGroupoids.transport_const p (f x))^ @ fx_eq_fy.(* By induction on p, it suffices to assume that x ≡ y and p ≡ refl, so the above equations concatenate identity paths, which are units under concatenation. [isequiv_adjointify] is one way to prove two functions form an equivalence, specifically one proves that they are (category-theoretic) sections of one another, that is, each is a right inverse for the other. *)
A, B: Type x, y: A p: x = y f: A -> B
IsEquiv (Book_eq_2_3_6 p f)
A, B: Type x, y: A p: x = y f: A -> B
IsEquiv (Book_eq_2_3_6 p f)
apply (isequiv_adjointify (Book_eq_2_3_6 p f) (Book_eq_2_3_7 p f));
unfold Book_eq_2_3_6, Book_eq_2_3_7, transport_const;
induction p;
intros y;
do2 (rewrite concat_1p);
reflexivity.Defined.(* ================================================== ex:equiv-concat *)(** Exercise 2.6 *)(* This exercise is solved in the library as HoTT.Types.Paths.isequiv_concat_l *)Definitionconcat_left {A : Type} {xy : A} (z : A) (p : x = y)
: (y = z) -> (x = z) :=
funq => p @ q.Definitionconcat_right {A : Type} {xy : A} (z : A) (p : x = y)
: (x = z) -> (y = z) :=
funq => (inverse p) @ q.(* Again, by induction on p, it suffices to assume that x ≡ y and p ≡ refl, so the above equations concatenate identity paths, which are units under concatenation. *)
A: Type x, y, z: A p: x = y
IsEquiv (concat_left z p)
A: Type x, y, z: A p: x = y
IsEquiv (concat_left z p)
apply (isequiv_adjointify (concat_left z p) (concat_right z p));
induction p;
unfold concat_right, concat_left;
intros y;
do2 (rewrite concat_1p);
reflexivity.Defined.(* ================================================== ex:ap-sigma *)(** Exercise 2.7 *)(* Already solved as ap_functor_sigma; there is a copy here for completeness *)SectionBook_2_7.
A, B: Type P: A -> Type Q: B -> Type f: A -> B g: foralla : A, P a -> Q (f a) u, v: {x : _ & P x} p: u.1 = v.1 q: transport P p u.2 = v.2
ap (functor_sigma f g) (path_sigma P u v p q) =
path_sigma Q (functor_sigma f g u)
(functor_sigma f g v) (ap f p)
(((transport_compose Q f p (g u.1 u.2))^ @
(ap_transport p g u.2)^) @ ap (g v.1) q)
A, B: Type P: A -> Type Q: B -> Type f: A -> B g: foralla : A, P a -> Q (f a) u, v: {x : _ & P x} p: u.1 = v.1 q: transport P p u.2 = v.2
ap (functor_sigma f g) (path_sigma P u v p q) =
path_sigma Q (functor_sigma f g u)
(functor_sigma f g v) (ap f p)
(((transport_compose Q f p (g u.1 u.2))^ @
(ap_transport p g u.2)^) @ ap (g v.1) q)
A, B: Type P: A -> Type Q: B -> Type f: A -> B g: foralla : A, P a -> Q (f a) u1: A u2: P u1 v1: A v2: P v1 p: u1 = v1 q: transport P p u2 = v2
ap (functor_sigma f g)
(path_sigma P (u1; u2) (v1; v2) p q) =
path_sigma Q (functor_sigma f g (u1; u2))
(functor_sigma f g (v1; v2)) (ap f p)
(((transport_compose Q f p (g (u1; u2).1 (u1; u2).2))^ @
(ap_transport p g (u1; u2).2)^) @
ap (g (v1; v2).1) q)
A, B: Type P: A -> Type Q: B -> Type f: A -> B g: foralla : A, P a -> Q (f a) u1: A u2, v2: P u1 q: u2 = v2
ap (functor_sigma f g)
(path_sigma P (u1; u2) (u1; v2) 1 q) =
path_sigma Q (functor_sigma f g (u1; u2))
(functor_sigma f g (u1; v2)) (ap f 1)
(((transport_compose Q f 1 (g (u1; u2).1 (u1; u2).2))^ @
(ap_transport 1 g (u1; u2).2)^) @
ap (g (u1; v2).1) q)
A, B: Type P: A -> Type Q: B -> Type f: A -> B g: foralla : A, P a -> Q (f a) u1: A u2: P u1
ap (functor_sigma f g)
(path_sigma P (u1; u2) (u1; u2) 11) =
path_sigma Q (functor_sigma f g (u1; u2))
(functor_sigma f g (u1; u2)) (ap f 1)
(((transport_compose Q f 1 (g (u1; u2).1 (u1; u2).2))^ @
(ap_transport 1 g (u1; u2).2)^) @
ap (g (u1; u2).1) 1)
reflexivity.Defined.EndBook_2_7.(* ================================================== ex:ap-coprod *)(** Exercise 2.8 *)DefinitionBook_2_8 := @HoTT.Types.Sum.ap_functor_sum.(* ================================================== ex:coprod-ump *)(** Exercise 2.9 *)(* This exercise is solved in the library as HoTT.Types.Sum.equiv_sum_ind *)(* To extract a function on either summand, compose with the injections *)Definitioncoprod_ump1 {ABX} : (A + B -> X) -> (A -> X) * (B -> X) :=
funf => (f o inl, f o inr).(* To create a function on the direct sum from functions on the summands, work by cases *)Definitioncoprod_ump2 {ABX} : (A -> X) * (B -> X) -> (A + B -> X) :=
prod_ind (fun_ => A + B -> X) (funfg => sum_ind (fun_ => X) f g).
A, B, X: Type H: Funext
(A -> X) * (B -> X) <~> (A + B -> X)
A, B, X: Type H: Funext
(funx : A + B -> X => coprod_ump2 (coprod_ump1 x)) ==
idmap
reflexivity.Defined.(* ================================================== ex:sigma-assoc *)(** Exercise 2.10 *)(* This exercise is solved in the library as HoTT.Types.Sigma.equiv_sigma_assoc *)SectionTwoTen.Context `{A : Type} {B : A -> Type} {C : (existsa : A, B a) -> Type}.Local Definitionf210 : (existsa : A, (existsb : B a, (C (a; b)))) ->
(exists (p : existsa : A, B a), (C p)) :=
funpairpair =>
match pairpair with (a; pp) =>
match pp with (b; c) => ((a; b); c) endend.
A: Type B: A -> Type C: {a : A & B a} -> Type
{p : {a : A & B a} & C p} ->
{a : A & {b : B a & C (a; b)}}
A: Type B: A -> Type C: {a : A & B a} -> Type
{p : {a : A & B a} & C p} ->
{a : A & {b : B a & C (a; b)}}
A: Type B: A -> Type C: {a : A & B a} -> Type pairpair: {p : {a : A & B a} & C p}
{a : A & {b : B a & C (a; b)}}
A: Type B: A -> Type C: {a : A & B a} -> Type pair: {a : A & B a} c: C pair
{a : A & {b : B a & C (a; b)}}
A: Type B: A -> Type C: {a : A & B a} -> Type a: A b: B a c: C (a; b)
{a : A & {b : B a & C (a; b)}}
exact (a; (b; c)).Defined.
A: Type B: A -> Type C: {a : A & B a} -> Type
{a : A & {b : B a & C (a; b)}} <~>
{p : {a : A & B a} & C p}
A: Type B: A -> Type C: {a : A & B a} -> Type
{a : A & {b : B a & C (a; b)}} <~>
{p : {a : A & B a} & C p}
apply (equiv_adjointify f210 g210); compute; reflexivity.Defined.EndTwoTen.(* ================================================== ex:pullback *)(** Exercise 2.11 *)(** The definition of commutative squares in HoTT.Limits.Pullback is slightly different, using a homotopy between the composites instead of a path. *)DefinitionBook_2_11 `{H : Funext} {X A B C} (f : A -> C) (g : B -> C)
: (X -> HoTT.Limits.Pullback.Pullback f g)
<~> HoTT.Limits.Pullback.Pullback (funh : X -> A => f o h) (funk : X -> B => g o k)
:= HoTT.Limits.Pullback.equiv_ispullback_commsq f g
oE (HoTT.Limits.Pullback.equiv_pullback_corec f g)^-1.(* ================================================== ex:pullback-pasting *)(** Exercise 2.12 *)DefinitionBook_2_12_i := @HoTT.Limits.Pullback.ispullback_pasting_left.DefinitionBook_2_12_ii := @HoTT.Limits.Pullback.ispullback_pasting_outer.(* ================================================== ex:eqvboolbool *)(** Exercise 2.13 *)DefinitionBook_2_13 := @HoTT.Types.Bool.equiv_bool_aut_bool.(* ================================================== ex:equality-reflection *)(** Exercise 2.14 *)(** Assuming the equality reflection rule, given any [q : x = y], [x] and [y] are definitionally equal, so [q] and [refl_x] have the same type [x = x]. We can form the type [forall x y, forall q, q = refl_x]. A path induction produces an element [r], with [r x x p : p = refl_x], which is also definitional by the equality reflection rule. *)(* ================================================== ex:strengthen-transport-is-ap *)(** Exercise 2.15 *)DefinitionBook_2_15 {A} (B : A -> Type) {xy : A} (p : x = y)
: transport B p = HoTT.Types.Universe.equiv_path _ _ (ap B p)
:= match p with1 => 1end.(* ================================================== ex:strong-from-weak-funext *)(** Exercise 2.16 *)DefinitionBook_2_16 := @HoTT.Metatheory.FunextVarieties.NaiveFunext_implies_Funext.(* ================================================== ex:equiv-functor-types *)(** Exercise 2.17 *)SectionBook_2_17_prod.Context {AA'BB' : Type} (f : A <~> A') (g : B <~> B').DefinitionBook_2_17_i_prod : A * B <~> A' * B'
:= HoTT.Types.Prod.equiv_functor_prod' f g.
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
A * B <~> A' * B'
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
A * B <~> A' * B'
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
Book_2_17_ii_prod = Book_2_17_i_prod
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
Book_2_17_ii_prod = Book_2_17_i_prod
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap
(ap011 prod (path_universe_uncurried f)
(path_universe_uncurried g)) = functor_prod f g
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
functor_prod
(transport idmap (path_universe_uncurried f))
(transport idmap (path_universe_uncurried g)) =
functor_prod f g
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap (path_universe_uncurried f) = f
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap (path_universe_uncurried g) = g
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap (path_universe_uncurried f) = f
apply transport_idmap_path_universe_uncurried.
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap (path_universe_uncurried g) = g
apply transport_idmap_path_universe_uncurried.Qed.EndBook_2_17_prod.SectionBook_2_17_sigma.Context {AA' : Type} {B : A -> Type} {B' : A' -> Type}
(f : A <~> A') (g : foralla, B a <~> B' (f a)).DefinitionBook_2_17_i_sigma : {a : A & B a} <~> {a' : A' & B' a'}
:= HoTT.Types.Sigma.equiv_functor_sigma' f g.DefinitionBook_2_17_path_fibr_1 (p : A = A')
(q : B = B' o (transport idmap p))
: (transport (funA0 => A0 -> Type) p B) = B'
:= moveR_transport_p _ _ _ _
(transport (funp0 => B = B' o (_ p0)) (inv_V p)^ q
@ (transport_arrow_toconst' p^ B')^).
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
{a : A & B a} <~> {a' : A' & B' a'}
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
{a : A & B a} <~> {a' : A' & B' a'}
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
{a : A & B a} = {a' : A' & B' a'}
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
A = A'
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
transport (funA : Type => A -> Type) ?p
(funa : A => B a) = (funa' : A' => B' a')
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
A = A'
exact (path_universe_uncurried f).
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
transport (funA : Type => A -> Type)
(path_universe_uncurried f) (funa : A => B a) =
(funa' : A' => B' a')
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
B =
(funx : A =>
B' (transport idmap (path_universe_uncurried f) x))
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence a: A
B a =
B' (transport idmap (path_universe_uncurried f) a)
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence a: A
B a <~>
B' (transport idmap (path_universe_uncurried f) a)
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence a: A
B a <~> B' (f a)
apply g.Defined.
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) p: A = A' q: B = B' o transport idmap p
transport idmap
(ap011D (@sig) p (Book_2_17_path_fibr_1 p q)) =
functor_sigma (transport idmap p)
(funa : A => transport idmap (ap10 q a))
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) p: A = A' q: B = B' o transport idmap p
transport idmap
(ap011D (@sig) p (Book_2_17_path_fibr_1 p q)) =
functor_sigma (transport idmap p)
(funa : A => transport idmap (ap10 q a))
A: Type B, B': A -> Type f: A <~> A g: foralla : A, B a <~> B' (f a) q: B = (funx : A => B' (transport idmap 1 x))
transport idmap
(ap011D (@sig) 1
(moveR_transport_p (funx : Type => x -> Type) 1
B B'
(transport
(funp0 : A = A =>
B =
(funx : A => B' (transport idmap p0 x)))
(inv_V 1)^ q @
(transport_arrow_toconst' 1^ B')^))) =
functor_sigma (transport idmap 1)
(funa : A => transport idmap (ap10 q a))
A: Type B: A -> Type f: A <~> A g: foralla : A, B a <~> B (f a)
transport idmap
(ap011D (@sig) 1
(moveR_transport_p (funx : Type => x -> Type) 1
B B
(transport
(funp0 : A = A =>
B =
(funx : A => B (transport idmap p0 x)))
(inv_V 1)^ 1 @
(transport_arrow_toconst' 1^ B)^))) =
functor_sigma (transport idmap 1)
(funa : A => transport idmap (ap10 1 a))
reflexivity.Defined.
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
Book_2_17_ii_sigma = Book_2_17_i_sigma
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
Book_2_17_ii_sigma = Book_2_17_i_sigma
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
transport idmap
(ap011D (@sig) (path_universe_uncurried f)
(Book_2_17_path_fibr_1
(path_universe_uncurried f)
(path_arrow B
(funx : A =>
B'
(transport idmap
(path_universe_uncurried f) x))
(funa : A =>
path_universe_uncurried
(transport
(funf0 : A -> A' =>
B a <~> B' (f0 a))
(transport_idmap_path_universe_uncurried
f)^ (g a)))))) =
functor_sigma f (funa : A => g a)
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
functor_sigma
(transport idmap (path_universe_uncurried f))
(funa : A =>
transport idmap
(ap10
(path_arrow B
(funx : A =>
B'
(transport idmap
(path_universe_uncurried f) x))
(funa0 : A =>
path_universe_uncurried
(transport
(funf0 : A -> A' =>
B a0 <~> B' (f0 a0))
(transport_idmap_path_universe_uncurried
f)^ (g a0)))) a)) =
functor_sigma f (funa : A => g a)
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
transport idmap (path_universe_uncurried f) = f
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
transport
(funf : A -> A' =>
foralla : A, (funa0 : A => B a0) a -> B' (f a))
?p
(funa : A =>
transport idmap
(ap10
(path_arrow B
(funx : A =>
B'
(transport idmap
(path_universe_uncurried f) x))
(funa0 : A =>
path_universe_uncurried
(transport
(funf0 : A -> A' =>
B a0 <~> B' (f0 a0))
(transport_idmap_path_universe_uncurried
f)^ (g a0)))) a)) =
(funa : A => g a)
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
transport idmap (path_universe_uncurried f) = f
apply transport_idmap_path_universe_uncurried.
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' g: foralla : A, B a <~> B' (f a) H: Univalence
transport
(funf : A -> A' =>
foralla : A, (funa0 : A => B a0) a -> B' (f a))
(transport_idmap_path_universe_uncurried f)
(funa : A =>
transport idmap
(ap10
(path_arrow B
(funx : A =>
B'
(transport idmap
(path_universe_uncurried f) x))
(funa0 : A =>
path_universe_uncurried
(transport
(funf0 : A -> A' =>
B a0 <~> B' (f0 a0))
(transport_idmap_path_universe_uncurried
f)^ (g a0)))) a)) =
(funa : A => g a)
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' H: Univalence g: foralla : A,
B a <~>
B' (transport idmap (path_universe_uncurried f) a)
(funa : A =>
transport idmap
(ap10
(path_arrow B
(funx : A =>
B'
(transport idmap
(path_universe_uncurried f) x))
(funa0 : A => path_universe_uncurried (g a0)))
a)) = (funa : A => g a)
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' H: Univalence g: foralla : A,
B a <~>
B' (transport idmap (path_universe_uncurried f) a) a: A
transport idmap
(ap10
(path_arrow B
(funx : A =>
B'
(transport idmap
(path_universe_uncurried f) x))
(funa : A => path_universe_uncurried (g a)))
a) = g a
A, A': Type B: A -> Type B': A' -> Type f: A <~> A' H: Univalence g: foralla : A,
B a <~>
B' (transport idmap (path_universe_uncurried f) a) a: A
transport idmap (path_universe_uncurried (g a)) = g a
apply transport_idmap_path_universe_uncurried.Defined.EndBook_2_17_sigma.SectionBook_2_17_arrow.Context `{Funext} {A A' B B' : Type} (f : A' <~> A) (g : B <~> B').DefinitionBook_2_17_i_arrow : (A -> B) <~> (A' -> B')
:= HoTT.Types.Arrow.equiv_functor_arrow' f g.
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
(A -> B) <~> (A' -> B')
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
(A -> B) <~> (A' -> B')
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
Book_2_17_ii_arrow = Book_2_17_i_arrow
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
Book_2_17_ii_arrow = Book_2_17_i_arrow
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
transport idmap
(ap011 arrow (path_universe_uncurried f)^
(path_universe_uncurried g)) =
functor_forall f (fun_ : A' => g)
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
functor_arrow
(transport idmap (path_universe_uncurried f))
(transport idmap (path_universe_uncurried g)) =
functor_forall f (fun_ : A' => g)
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
transport idmap (path_universe_uncurried f) = f
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
(fun_ : A' =>
transport idmap (path_universe_uncurried g)) =
(fun_ : A' => g)
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
transport idmap (path_universe_uncurried f) = f
apply transport_idmap_path_universe_uncurried.
H: Funext A, A', B, B': Type f: A' <~> A g: B <~> B' H0: Univalence
(fun_ : A' =>
transport idmap (path_universe_uncurried g)) =
(fun_ : A' => g)
exact (ap (fung0_ => g0)
(transport_idmap_path_universe_uncurried g)).Qed.EndBook_2_17_arrow.SectionBook_2_17_forall.Context `{Funext} {A A' : Type} {B : A -> Type} {B' : A' -> Type}
(f : A' <~> A) (g : foralla', B (f a') <~> B' a').DefinitionBook_2_17_i_forall : (foralla, B a) <~> (foralla', B' a')
:= HoTT.Types.Forall.equiv_functor_forall' f g.DefinitionBook_2_17_path_fibr_2 (p : A' = A)
(q : B o (transport idmap p) = B')
: (transport (funA0 => A0 -> Type) p^ B) = B'
:= (transport_arrow_toconst' p^ B)
@ (transport (funp0 => B o (_ p0) = B') (inv_V p)^ q).
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
(foralla : A, B a) <~> (foralla' : A', B' a')
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
(foralla : A, B a) <~> (foralla' : A', B' a')
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
(foralla : A, B a) = (foralla' : A', B' a')
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
A = A'
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
transport (funA0 : Type => A0 -> Type) ?p B = B'
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
A = A'
exact (path_universe_uncurried f)^.
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
transport (funA0 : Type => A0 -> Type)
(path_universe_uncurried f)^ B = B'
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
(funx : A' =>
B (transport idmap (path_universe_uncurried f) x)) =
B'
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence a: A'
B (transport idmap (path_universe_uncurried f) a) =
B' a
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence a: A'
B (transport idmap (path_universe_uncurried f) a) <~>
B' a
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence a: A'
B (f a) <~> B' a
apply g.Defined.
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' p: A' = A q: B o transport idmap p = B'
transport idmap
(ap011D
(fun (A0 : Type)
(B0 : (funA1 : Type => A1 -> Type) A0) =>
foralla0 : A0, B0 a0) p^
(Book_2_17_path_fibr_2 p q)) =
functor_forall (transport idmap p)
(funa : A' => transport idmap (ap10 q a))
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' p: A' = A q: B o transport idmap p = B'
transport idmap
(ap011D
(fun (A0 : Type)
(B0 : (funA1 : Type => A1 -> Type) A0) =>
foralla0 : A0, B0 a0) p^
(Book_2_17_path_fibr_2 p q)) =
functor_forall (transport idmap p)
(funa : A' => transport idmap (ap10 q a))
H: Funext A': Type B, B': A' -> Type f: A' <~> A' g: foralla' : A', B (f a') <~> B' a' q: (funx : A' => B (transport idmap 1 x)) = B'
transport idmap
(ap011D
(fun (A0 : Type) (B0 : A0 -> Type) =>
foralla0 : A0, B0 a0) 1^
(transport_arrow_toconst' 1^ B @
transport
(funp0 : A' = A' =>
(funx : A' => B (transport idmap p0 x)) = B')
(inv_V 1)^ q)) =
functor_forall (transport idmap 1)
(funa : A' => transport idmap (ap10 q a))
H: Funext A': Type B: A' -> Type f: A' <~> A' g: foralla' : A', B (f a') <~> B a'
transport idmap
(ap011D
(fun (A0 : Type) (B0 : A0 -> Type) =>
foralla0 : A0, B0 a0) 1^
(transport_arrow_toconst' 1^ B @
transport
(funp0 : A' = A' =>
(funx : A' => B (transport idmap p0 x)) =
(funx : A' => B x)) (inv_V 1)^ 1)) =
functor_forall (transport idmap 1)
(funa : A' => transport idmap (ap10 1 a))
reflexivity.Defined.
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
Book_2_17_ii_forall = Book_2_17_i_forall
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
Book_2_17_ii_forall = Book_2_17_i_forall
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
transport idmap
(ap011D
(fun (A0 : Type) (B0 : A0 -> Type) =>
foralla0 : A0, B0 a0)
(path_universe_uncurried f)^
(Book_2_17_path_fibr_2
(path_universe_uncurried f)
(path_arrow
(funx : A' =>
B
(transport idmap
(path_universe_uncurried f) x)) B'
(funa : A' =>
path_universe_uncurried
(transport
(funf0 : A' -> A =>
B (f0 a) <~> B' a)
(transport_idmap_path_universe_uncurried
f)^ (g a)))))) =
functor_forall f (funb : A' => g b)
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
functor_forall
(transport idmap (path_universe_uncurried f))
(funa : A' =>
transport idmap
(ap10
(path_arrow
(funx : A' =>
B
(transport idmap
(path_universe_uncurried f) x)) B'
(funa0 : A' =>
path_universe_uncurried
(transport
(funf0 : A' -> A =>
B (f0 a0) <~> B' a0)
(transport_idmap_path_universe_uncurried
f)^ (g a0)))) a)) =
functor_forall f (funb : A' => g b)
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
transport idmap (path_universe_uncurried f) = f
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
transport
(funf0 : A' -> A =>
forallb : A', B (f0 b) -> (funa : A' => B' a) b)
?p
(funa : A' =>
transport idmap
(ap10
(path_arrow
(funx : A' =>
B
(transport idmap
(path_universe_uncurried f) x)) B'
(funa0 : A' =>
path_universe_uncurried
(transport
(funf0 : A' -> A =>
B (f0 a0) <~> B' a0)
(transport_idmap_path_universe_uncurried
f)^ (g a0)))) a)) =
(funb : A' => g b)
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
transport idmap (path_universe_uncurried f) = f
apply transport_idmap_path_universe_uncurried.
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A g: foralla' : A', B (f a') <~> B' a' H0: Univalence
transport
(funf0 : A' -> A =>
forallb : A', B (f0 b) -> (funa : A' => B' a) b)
(transport_idmap_path_universe_uncurried f)
(funa : A' =>
transport idmap
(ap10
(path_arrow
(funx : A' =>
B
(transport idmap
(path_universe_uncurried f) x)) B'
(funa0 : A' =>
path_universe_uncurried
(transport
(funf0 : A' -> A =>
B (f0 a0) <~> B' a0)
(transport_idmap_path_universe_uncurried
f)^ (g a0)))) a)) =
(funb : A' => g b)
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A H0: Univalence g: foralla' : A',
B (transport idmap (path_universe_uncurried f) a') <~>
B' a'
(funa : A' =>
transport idmap
(ap10
(path_arrow
(funx : A' =>
B
(transport idmap
(path_universe_uncurried f) x)) B'
(funa0 : A' =>
path_universe_uncurried (g a0))) a)) =
(funb : A' => g b)
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A H0: Univalence g: foralla' : A',
B (transport idmap (path_universe_uncurried f) a') <~>
B' a' a: A'
transport idmap
(ap10
(path_arrow
(funx : A' =>
B
(transport idmap
(path_universe_uncurried f) x)) B'
(funa : A' => path_universe_uncurried (g a)))
a) = g a
H: Funext A, A': Type B: A -> Type B': A' -> Type f: A' <~> A H0: Univalence g: foralla' : A',
B (transport idmap (path_universe_uncurried f) a') <~>
B' a' a: A'
transport idmap (path_universe_uncurried (g a)) = g a
apply transport_idmap_path_universe_uncurried.Defined.EndBook_2_17_forall.SectionBook_2_17_sum.Context {AA'BB' : Type} (f : A <~> A') (g : B <~> B').DefinitionBook_2_17_i_sum : A + B <~> A' + B'
:= HoTT.Types.Sum.equiv_functor_sum' f g.
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
A + B <~> A' + B'
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
A + B <~> A' + B'
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
A + B = A' + B'
exact (ap011 sum (path_universe_uncurried f) (path_universe_uncurried g)).Defined.
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Funext p: A = A' q: B = B'
transport idmap (ap011 sum p q) =
functor_sum (transport idmap p) (transport idmap q)
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Funext p: A = A' q: B = B'
transport idmap (ap011 sum p q) =
functor_sum (transport idmap p) (transport idmap q)
A, A', B, B': Type H: Funext p: A = A' q: B = B'
transport idmap (ap011 sum p q) =
functor_sum (transport idmap p) (transport idmap q)
A, B: Type H: Funext
transport idmap (ap011 sum 11) =
functor_sum (transport idmap 1) (transport idmap 1)
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
Book_2_17_ii_sum = Book_2_17_i_sum
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
Book_2_17_ii_sum = Book_2_17_i_sum
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap
(ap011 sum (path_universe_uncurried f)
(path_universe_uncurried g)) = functor_sum f g
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
functor_sum
(transport idmap (path_universe_uncurried f))
(transport idmap (path_universe_uncurried g)) =
functor_sum f g
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap (path_universe_uncurried f) = f
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap (path_universe_uncurried g) = g
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap (path_universe_uncurried f) = f
apply transport_idmap_path_universe_uncurried.
A, A', B, B': Type f: A <~> A' g: B <~> B' H: Univalence
transport idmap (path_universe_uncurried g) = g
apply transport_idmap_path_universe_uncurried.Qed.EndBook_2_17_sum.(* ================================================== ex:dep-htpy-natural *)(** Exercise 2.18 *)DefinitionBook_2_18 := @HoTT.Basics.PathGroupoids.apD_natural.(* ================================================== ex:equiv-functor-set *)(** Exercise 3.1 *)DefinitionBook_3_1_solution_1 {AB} (f : A <~> B) (H : IsHSet A)
:= @HoTT.Basics.Trunc.istrunc_equiv_istrunc A B f 0 H.(** Alternative solutions: [Book_3_1_solution_2] using UA, and [Book_3_1_solution_3] using two easy lemmas that may be of independent interest *)
H: Univalence A, B: Type
A <~> B -> IsHSet A -> IsHSet B
H: Univalence A, B: Type
A <~> B -> IsHSet A -> IsHSet B
H: Univalence A, B: Type e: A <~> B
IsHSet A -> IsHSet B
H: Univalence A, B: Type e: A <~> B
IsHSet B -> IsHSet B
exact idmap.Defined.
A, B: Type f: A -> B g: B -> A alpha: f o g == idmap x, y: B p: x = y
p = ((alpha x)^ @ ap f (ap g p)) @ alpha y
A, B: Type f: A -> B g: B -> A alpha: f o g == idmap x, y: B p: x = y
p = ((alpha x)^ @ ap f (ap g p)) @ alpha y
A, B: Type f: A -> B g: B -> A alpha: f o g == idmap x: B
1 = ((alpha x)^ @ ap f (ap g 1)) @ alpha x
A, B: Type f: A -> B g: B -> A alpha: f o g == idmap x: B
1 = ((alpha x)^ @ 1) @ alpha x
A, B: Type f: A -> B g: B -> A alpha: f o g == idmap x: B
1 = (alpha x)^ @ alpha x
A, B: Type f: A -> B g: B -> A alpha: f o g == idmap x: B
1 = 1
exact1.Defined.
A, B: Type f: A -> B g: B -> A
f o g == idmap -> IsHSet A -> IsHSet B
A, B: Type f: A -> B g: B -> A
f o g == idmap -> IsHSet A -> IsHSet B
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A
IsHSet B
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A
axiomK B
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A
forall (x : B) (p : x = x), p = 1
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x
p = 1
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x
ap g p = 1
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1
p = 1
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x
ap g p = 1
apply (axiomK_hset isHSet_A).
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1
p = 1
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1
1 = ((retr_f_g x)^ @ ap f (ap g p)) @ retr_f_g x
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1 rhs_is_1: 1 =
((retr_f_g x)^ @ ap f (ap g p)) @
retr_f_g x
p = 1
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1
1 = ((retr_f_g x)^ @ ap f (ap g p)) @ retr_f_g x
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1
1 = ((retr_f_g x)^ @ ap f 1) @ retr_f_g x
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1
1 = ((retr_f_g x)^ @ 1) @ retr_f_g x
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1
1 = (retr_f_g x)^ @ retr_f_g x
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1
1 = 1
exact1.
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1 rhs_is_1: 1 =
((retr_f_g x)^ @ ap f (ap g p)) @
retr_f_g x
p = 1
A, B: Type f: A -> B g: B -> A retr_f_g: f o g == idmap isHSet_A: IsHSet A x: B p: x = x g_p_is_1: ap g p = 1 rhs_is_1: 1 =
((retr_f_g x)^ @ ap f (ap g p)) @
retr_f_g x
p = ((retr_f_g x)^ @ ap f (ap g p)) @ retr_f_g x
apply (retr_f_g_path_in_B f g retr_f_g).Defined.
A, B: Type
A <~> B -> IsHSet A -> IsHSet B
A, B: Type
A <~> B -> IsHSet A -> IsHSet B
A, B: Type equivalent_A_B: A <~> B isHSet_A: IsHSet A
IsHSet B
A, B: Type equivalent_A_B: A <~> B isHSet_A: IsHSet A f: A -> B isequiv_f: IsEquiv f
IsHSet B
A, B: Type equivalent_A_B: A <~> B isHSet_A: IsHSet A f: A -> B isequiv_f: IsEquiv f g: B -> A retr_f_g: (funx : B => f (g x)) == idmap sect_f_g: (funx : A => g (f x)) == idmap coh: forallx : A, retr_f_g (f x) = ap f (sect_f_g x)
IsHSet B
apply (retr_f_g_isHSet_A_so_B f g); assumption.Defined.(* ================================================== ex:isset-coprod *)(** Exercise 3.2 *)DefinitionBook_3_2_solution_1 := @HoTT.Types.Sum.ishset_sum.(** Alternative solution for replaying *)
A, B: Type
IsHSet A -> IsHSet B -> IsHSet (A + B)
A, B: Type
IsHSet A -> IsHSet B -> IsHSet (A + B)
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B
IsHSet (A + B)
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B
axiomK (A + B)
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B
forall (x : A + B) (p : x = x), p = 1
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B x: A + B p: x = x
p = 1
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B a: A p: inl a = inl a
p = 1
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B b: B p: inr b = inr b
p = 1
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B a: A p: inl a = inl a
p = 1
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B a: A p: inl a = inl a
path_sum (path_sum_inv p) = 1
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B a: A p: inl a = inl a
path_sum 1 = 1
simpl; exact idpath.
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B b: B p: inr b = inr b
p = 1
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B b: B p: inr b = inr b
path_sum (path_sum_inv p) = 1
A, B: Type isHSet_A: IsHSet A isHSet_B: IsHSet B b: B p: inr b = inr b
path_sum 1 = 1
simpl; exact idpath.Defined.(* ================================================== ex:isset-sigma *)(** Exercise 3.3 *)DefinitionBook_3_3_solution_1 (A : Type) (B : A -> Type)
:= @HoTT.Types.Sigma.istrunc_sigma A B 0.(** This exercise is hard because 2-paths over Sigma types are not treated in the first three chapters of the book. Consult theories/Types/Sigma.v *)
A: Type B: A -> Type
IsHSet A ->
(forallx : A, IsHSet (B x)) -> IsHSet {x : A & B x}
A: Type B: A -> Type
IsHSet A ->
(forallx : A, IsHSet (B x)) -> IsHSet {x : A & B x}
A: Type B: A -> Type isHSet_A: IsHSet A allBx_HSet: forallx : A, IsHSet (B x)
IsHSet {x : A & B x}
A: Type B: A -> Type isHSet_A: IsHSet A allBx_HSet: forallx : A, IsHSet (B x)
axiomK {x : A & B x}
A: Type B: A -> Type isHSet_A: IsHSet A allBx_HSet: forallx : A, IsHSet (B x) x: {x : A & B x} xx: x = x
xx = 1
A: Type B: A -> Type isHSet_A: IsHSet A allBx_HSet: forallx : A, IsHSet (B x) x: {x : A & B x} xx: x = x useful:= path_path_sigma B x x xx 1: forallr : xx ..1 = 1 ..1,
transport
(funx0 : x.1 = x.1 =>
transport B x0 x.2 = x.2) r
xx ..2 = 1 ..2 -> xx = 1
IsHProp A -> IsHProp B -> ~ (A * B) -> IsHProp (A + B)
A, B: Type
IsHProp A -> IsHProp B -> ~ (A * B) -> IsHProp (A + B)
A, B: Type isHProp_A: IsHProp A isProp_B: IsHProp B nab: ~ (A * B)
IsHProp (A + B)
A, B: Type isHProp_A: IsHProp A isProp_B: IsHProp B nab: ~ (A * B)
forallxy : A + B, x = y
A, B: Type isHProp_A: IsHProp A isProp_B: IsHProp B nab: ~ (A * B) x, y: A + B
x = y
A, B: Type isHProp_A: IsHProp A isProp_B: IsHProp B nab: ~ (A * B) a1: A b2: B
code_sum (inl a1) (inr b2)
A, B: Type isHProp_A: IsHProp A isProp_B: IsHProp B nab: ~ (A * B) b1: B a2: A
code_sum (inr b1) (inl a2)
A, B: Type isHProp_A: IsHProp A isProp_B: IsHProp B nab: ~ (A * B) a1: A b2: B
code_sum (inl a1) (inr b2)
exact (nab (a1,b2)).
A, B: Type isHProp_A: IsHProp A isProp_B: IsHProp B nab: ~ (A * B) b1: B a2: A
code_sum (inr b1) (inl a2)
exact (nab (a2,b1)).Defined.(* ================================================== ex:brck-qinv *)(** Exercise 3.8 *)DefinitionBook_3_8_qinv {AB : Type} (f : A -> B) : Type
:= {g : B -> A & (f o g == idmap) * (g o f == idmap)}.SectionBook_3_8_ctx.Context {isequiv : forall {AB : Type}, (A -> B) -> Type}
{cond_i : forall {AB : Type} (f : A -> B), isequiv f -> Book_3_8_qinv f}
{cond_ii : forall {AB : Type} (f : A -> B), Book_3_8_qinv f -> isequiv f}
{cond_iii : forall {AB : Type} (f : A -> B), IsHProp (isequiv f)}.
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
Trunc (-1) (Book_3_8_qinv f) -> Book_3_8_qinv f
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
Trunc (-1) (Book_3_8_qinv f) -> Book_3_8_qinv f
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
Trunc (-1) (Book_3_8_qinv f) -> isequiv A B f
apply Trunc_rec, cond_ii.Defined.DefinitionBook_3_8_cond_ii {AB : Type} (f : A -> B)
: Book_3_8_qinv f -> Trunc (-1) (Book_3_8_qinv f)
:= tr.DefinitionBook_3_8_cond_iii {AB : Type} (f : A-> B)
: IsHProp (Trunc (-1) (Book_3_8_qinv f))
:= _.
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
Trunc (-1) (Book_3_8_qinv f) <~> isequiv A B f
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
Trunc (-1) (Book_3_8_qinv f) <~> isequiv A B f
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
IsHProp (Trunc (-1) (Book_3_8_qinv f))
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
IsHProp (isequiv A B f)
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
Trunc (-1) (Book_3_8_qinv f) -> isequiv A B f
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
isequiv A B f -> Trunc (-1) (Book_3_8_qinv f)
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
IsHProp (Trunc (-1) (Book_3_8_qinv f))
exact _.
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
IsHProp (isequiv A B f)
apply cond_iii.
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
Trunc (-1) (Book_3_8_qinv f) -> isequiv A B f
apply Trunc_rec, cond_ii.
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B
isequiv A B f -> Trunc (-1) (Book_3_8_qinv f)
isequiv: forallAB : Type, (A -> B) -> Type cond_i: forall (AB : Type) (f : A -> B),
isequiv A B f -> Book_3_8_qinv f cond_ii: forall (AB : Type) (f : A -> B),
Book_3_8_qinv f -> isequiv A B f cond_iii: forall (AB : Type) (f : A -> B),
IsHProp (isequiv A B f) A, B: Type f: A -> B x: isequiv A B f
Trunc (-1) (Book_3_8_qinv f)
apply tr, cond_i, x.Defined.EndBook_3_8_ctx.(* ================================================== ex:lem-impl-prop-equiv-bool *)(** Exercise 3.9 *)DefinitionLEM := forall (A : Type), IsHProp A -> A + ~A.DefinitionLEM_hProp_Bool (lem : LEM) (hprop : HProp) : Bool
:= match (lem hprop _) with inl _ => true | inr _ => false end.
exact ((if_not_hprop_then_equiv_Empty hprop np)^-1)%equiv.Defined.(* ================================================== ex:lem-impred *)(** Exercise 3.10 *)DefinitionBook_3_10_LEM@{j} := forallA : HProp@{j}, A + ~ A.DefinitionBook_3_10_Lift@{i j | i < j} (A : HProp@{i}) : HProp@{j}
:= Build_HProp A.
H: Univalence LEM: Book_3_10_LEM
IsEquiv Book_3_10_Lift
H: Univalence LEM: Book_3_10_LEM
IsEquiv Book_3_10_Lift
H: Univalence LEM: Book_3_10_LEM
HProp -> HProp
H: Univalence LEM: Book_3_10_LEM
Book_3_10_Lift o ?g == idmap
H: Univalence LEM: Book_3_10_LEM
?g o Book_3_10_Lift == idmap
H: Univalence LEM: Book_3_10_LEM
HProp -> HProp
H: Univalence LEM: Book_3_10_LEM A: HProp
HProp
H: Univalence LEM: Book_3_10_LEM A: HProp t: A
HProp
H: Univalence LEM: Book_3_10_LEM A: HProp n: ~ A
HProp
H: Univalence LEM: Book_3_10_LEM A: HProp t: A
HProp
exact (Build_HProp Unit).
H: Univalence LEM: Book_3_10_LEM A: HProp n: ~ A
HProp
exact (Build_HProp Empty).
H: Univalence LEM: Book_3_10_LEM
Book_3_10_Lift
o (funA : HProp =>
lets := LEM A inmatch s with
| inl t => (fun_ : A => Build_HProp Unit) t
| inr n => (fun_ : ~ A => Build_HProp Empty) n
end) == idmap
H: Univalence LEM: Book_3_10_LEM
(funA : HProp =>
lets := LEM A inmatch s with
| inl t => (fun_ : A => Build_HProp Unit) t
| inr n => (fun_ : ~ A => Build_HProp Empty) n
end) o Book_3_10_Lift == idmap
H: Univalence LEM: Book_3_10_LEM A: HProp a: A
A <~> Unit
H: Univalence LEM: Book_3_10_LEM A: HProp na: ~ A
A <~> Empty
H: Univalence LEM: Book_3_10_LEM A: HProp a: Book_3_10_Lift A
A <~> Unit
H: Univalence LEM: Book_3_10_LEM A: HProp na: ~ Book_3_10_Lift A
A <~> Empty
H: Univalence LEM: Book_3_10_LEM A: HProp na: ~ A
A <~> Empty
H: Univalence LEM: Book_3_10_LEM A: HProp na: ~ Book_3_10_Lift A
A <~> Empty
1,2: exact (if_not_hprop_then_equiv_Empty A na).Defined.(* ================================================== ex:not-brck-A-impl-A *)(** Exercise 3.11 *)(** This theorem extracts the main idea leading to the contradiction constructed in the proof of Theorem 3.2.2, that univalence implies that all functions are natural with respect to equivalences. The terms are complicated, but it pretty much follows the proof in the book, step by step. *)
H: Univalence
forallC : Type -> Type,
(forallA : Type, Contr (C A -> C A)) ->
forall (g : forallA : Type, C A -> A) (A : Type)
(e : A <~> A), e o g A = g A
H: Univalence
forallC : Type -> Type,
(forallA : Type, Contr (C A -> C A)) ->
forall (g : forallA : Type, C A -> A) (A : Type)
(e : A <~> A), e o g A = g A
H: Univalence C: Type -> Type all_contr: forallA : Type, Contr (C A -> C A) g: forallA : Type, C A -> A A: Type e: A <~> A
e o g A = g A
H: Univalence C: Type -> Type all_contr: forallA : Type, Contr (C A -> C A) g: forallA : Type, C A -> A A: Type e: A <~> A
(funx : C A => e (g A x)) == g A
H: Univalence C: Type -> Type all_contr: forallA : Type, Contr (C A -> C A) g: forallA : Type, C A -> A A: Type e: A <~> A x: C A
e (g A x) = g A x
H: Univalence C: Type -> Type all_contr: forallA : Type, Contr (C A -> C A) g: forallA : Type, C A -> A A: Type e: A <~> A x: C A p:= path_universe_uncurried e: A = A
e (g A x) = g A x
(* The propositional computation rule for univalence of section 2.10 *)
H: Univalence C: Type -> Type all_contr: forallA : Type, Contr (C A -> C A) g: forallA : Type, C A -> A A: Type e: A <~> A x: C A p:= path_universe_uncurried e: A = A
transport idmap (path_universe_uncurried e) (g A x) =
g A x
(** To obtain the situation of 2.9.4, we rewrite x using<< x = transport (fun A : Type => C A) p^ x>> This equality holds because [(C A) -> (C A)] is contractible, so<< transport (fun A : Type => C A) p^ = idmap>> In both Theorem 3.2.2 and the following result, the hypothesis [Contr ((C A) -> (C A))] will follow from the contractibility of [(C A)]. *)
H: Univalence C: Type -> Type all_contr: forallA : Type, Contr (C A -> C A) g: forallA : Type, C A -> A A: Type e: A <~> A x: C A p:= path_universe_uncurried e: A = A
transport idmap (path_universe_uncurried e)
(g A (transport C p^ x)) = g A x
(* Equation 2.9.4 is called transport_arrow in the library. *)
H: Univalence C: Type -> Type all_contr: forallA : Type, Contr (C A -> C A) g: forallA : Type, C A -> A A: Type e: A <~> A x: C A p:= path_universe_uncurried e: A = A
transport (funx : Type => C x -> x) p (g A) x = g A x
exact (happly (apD g p) x).Defined.(** For this proof, we closely follow the proof of Theorem 3.2.2 from the text, replacing ¬¬A → A by ∥A∥ → A. *)
H: Univalence
~ (forallA : Type, Trunc (-1) A -> A)
H: Univalence
~ (forallA : Type, Trunc (-1) A -> A)
(* The proof is by contradiction. We'll assume we have such a function, and obtain an element of 0. *)
H: Univalence g: forallA : Type, Trunc (-1) A -> A
Empty
H: Univalence g: forallA : Type, Trunc (-1) A -> A
forallA : Type, Contr (Trunc (-1) A -> Trunc (-1) A)
H: Univalence g: forallA : Type, Trunc (-1) A -> A end_contr: forallA : Type,
Contr (Trunc (-1) A -> Trunc (-1) A)
Empty
H: Univalence g: forallA : Type, Trunc (-1) A -> A
forallA : Type, Contr (Trunc (-1) A -> Trunc (-1) A)
H: Univalence g: forallA : Type, Trunc (-1) A -> A A: Type
Contr (Trunc (-1) A -> Trunc (-1) A)
H: Univalence g: forallA : Type, Trunc (-1) A -> A A: Type
IsHProp (Trunc (-1) A)
apply istrunc_truncation.
H: Univalence g: forallA : Type, Trunc (-1) A -> A end_contr: forallA : Type,
Contr (Trunc (-1) A -> Trunc (-1) A)
Empty
(** There are no fixpoints of the fix-point free autoequivalence of 2 (called negb). We will derive a contradiction by showing there must be such a fixpoint by naturality of g. We parametrize over b to emphasize that this proof depends only on the fact that Bool is inhabited, not on any specific value (we use "true" below). *)
H: Univalence g: forallA : Type, Trunc (-1) A -> A end_contr: forallA : Type,
Contr (Trunc (-1) A -> Trunc (-1) A) contr:= funb : Trunc (-1) Bool =>
not_fixed_negb (g Bool b)
(ap10
(univalence_func_natural_equiv
(Trunc (-1)) end_contr g equiv_negb) b): Trunc (-1) Bool -> Empty
LEM: forallA : Type, IsHProp A -> A + ~ A A: Type a: Trunc (-1) A
Trunc (-1) (Trunc (-1) A -> A)
LEM: forallA : Type, IsHProp A -> A + ~ A A: Type na: ~ Trunc (-1) A
Trunc (-1) (Trunc (-1) A -> A)
LEM: forallA : Type, IsHProp A -> A + ~ A A: Type a: Trunc (-1) A
Trunc (-1) (Trunc (-1) A -> A)
LEM: forallA : Type, IsHProp A -> A + ~ A A: Type a: A
Trunc (-1) (Trunc (-1) A -> A)
apply tr, (funa0 => a).
LEM: forallA : Type, IsHProp A -> A + ~ A A: Type na: ~ Trunc (-1) A
Trunc (-1) (Trunc (-1) A -> A)
LEM: forallA : Type, IsHProp A -> A + ~ A A: Type na: ~ Trunc (-1) A
Trunc (-1) A -> A
LEM: forallA : Type, IsHProp A -> A + ~ A A: Type na: ~ Trunc (-1) A a0: Trunc (-1) A
A
elim (na a0).Defined.(* ================================================== ex:naive-lem-impl-ac *)(** Exercise 3.13 *)SectionBook_3_13.Definitionnaive_LEM_impl_DN_elim (A : Type) (LEM : A + ~A)
: ~~A -> A
:= funnna => match LEM with
| inl a => a
| inr na => match nna na withendend.
(forallA : Type, A + ~ A) ->
forall (X : Type) (A : X -> Type)
(P : forallx : X, A x -> Type),
(forallx : X, ~~ {a : A x & P x a}) ->
{g : forallx : X, A x & forallx : X, P x (g x)}
(forallA : Type, A + ~ A) ->
forall (X : Type) (A : X -> Type)
(P : forallx : X, A x -> Type),
(forallx : X, ~~ {a : A x & P x a}) ->
{g : forallx : X, A x & forallx : X, P x (g x)}
LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type H: forallx : X, ~~ {a : A x & P x a}
{g : forallx : X, A x & forallx : X, P x (g x)}
LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type H: forallx : X, ~~ {a : A x & P x a} H':= funx : X =>
naive_LEM_impl_DN_elim {a : A x & P x a}
(LEM {a : A x & P x a}) (H x): forallx : X, {a : A x & P x a}
{g : forallx : X, A x & forallx : X, P x (g x)}
LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type H: forallx : X, ~~ {a : A x & P x a} H':= funx : X =>
naive_LEM_impl_DN_elim {a : A x & P x a}
(LEM {a : A x & P x a}) (H x): forallx : X, {a : A x & P x a}
forallx : X, P x (H' x).1
exact (funx => (H' x).2).Defined.
H: Funext
(forallA : Type, A + ~ A) ->
forall (X : Type) (A : X -> Type)
(P : forallx : X, A x -> Type),
IsHSet X ->
(forallx : X, IsHSet (A x)) ->
(forall (x : X) (a : A x), IsHProp (P x a)) ->
(forallx : X, merely {a : A x & P x a}) ->
merely
{g : forallx : X, A x & forallx : X, P x (g x)}
H: Funext
(forallA : Type, A + ~ A) ->
forall (X : Type) (A : X -> Type)
(P : forallx : X, A x -> Type),
IsHSet X ->
(forallx : X, IsHSet (A x)) ->
(forall (x : X) (a : A x), IsHProp (P x a)) ->
(forallx : X, merely {a : A x & P x a}) ->
merely
{g : forallx : X, A x & forallx : X, P x (g x)}
H: Funext LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type HX: IsHSet X HA: forallx : X, IsHSet (A x) HP: forall (x : X) (a : A x), IsHProp (P x a) H0: forallx : X, merely {a : A x & P x a}
merely
{g : forallx : X, A x & forallx : X, P x (g x)}
H: Funext LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type HX: IsHSet X HA: forallx : X, IsHSet (A x) HP: forall (x : X) (a : A x), IsHProp (P x a) H0: forallx : X, merely {a : A x & P x a}
{g : forallx : X, A x & forallx : X, P x (g x)}
H: Funext LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type HX: IsHSet X HA: forallx : X, IsHSet (A x) HP: forall (x : X) (a : A x), IsHProp (P x a) H0: forallx : X, merely {a : A x & P x a}
forallx : X, ~~ {a : A x & P x a}
H: Funext LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type HX: IsHSet X HA: forallx : X, IsHSet (A x) HP: forall (x : X) (a : A x), IsHProp (P x a) H0: forallx : X, merely {a : A x & P x a} x: X
~~ {a : A x & P x a}
H: Funext LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type HX: IsHSet X HA: forallx : X, IsHSet (A x) HP: forall (x : X) (a : A x), IsHProp (P x a) x: X H0: merely {a : A x & P x a}
~~ {a : A x & P x a}
H: Funext LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type HX: IsHSet X HA: forallx : X, IsHSet (A x) HP: forall (x : X) (a : A x), IsHProp (P x a) x: X
merely {a : A x & P x a} -> ~~ {a : A x & P x a}
H: Funext LEM: forallA : Type, A + ~ A X: Type A: X -> Type P: forallx : X, A x -> Type HX: IsHSet X HA: forallx : X, IsHSet (A x) HP: forall (x : X) (a : A x), IsHProp (P x a) x: X
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A
forall (A : Type) (P : ~~ A -> Type),
(foralla : A, P (funna : ~ A => na a)) ->
(forall (xy : ~~ A) (z : P x) (w : P y),
transport P (path_ishprop x y) z = w) ->
forallx : ~~ A, P x
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A
forall (A : Type) (P : ~~ A -> Type),
(foralla : A, P (funna : ~ A => na a)) ->
(forall (xy : ~~ A) (z : P x) (w : P y),
transport P (path_ishprop x y) z = w) ->
forallx : ~~ A, P x
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A
P nna
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A
forallx : ~~ A, IsHProp (P x)
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A X: forallx : ~~ A, IsHProp (P x)
P nna
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A
forallx : ~~ A, IsHProp (P x)
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna, x: ~~ A
IsHProp (P x)
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna, x: ~~ A
forallx0y : P x, x0 = y
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna, x: ~~ A x', y': P x
x' = y'
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna, x: ~~ A x', y': P x
transport P (path_ishprop x x) y' = y'
(* Without this it somehow proves [H'] using the wrong universe for hprop_Empty and fails when we do [Defined]. See Coq #4862. *)
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna, x: ~~ A x', y': P x path:= path_ishprop x x: x = x
transport P path y' = y'
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna, x: ~~ A x', y': P x path:= path_ishprop x x: x = x H': 1 = path
transport P path y' = y'
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna, x: ~~ A x', y': P x
transport P 1 y' = y'
reflexivity.
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A X: forallx : ~~ A, IsHProp (P x)
P nna
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A X: forallx : ~~ A, IsHProp (P x) npnna: ~ P nna
P nna
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A X: forallx : ~~ A, IsHProp (P x) npnna: ~ P nna
Empty
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A X: forallx : ~~ A, IsHProp (P x) npnna: ~ P nna
~ A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A X: forallx : ~~ A, IsHProp (P x) npnna: ~ P nna a: A
Empty
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type P: ~~ A -> Type base: foralla : A, P (funna : ~ A => na a) p: forall (xy : ~~ A) (z : P x)
(w : P y), transport P (path_ishprop x y) z = w nna: ~~ A X: forallx : ~~ A, IsHProp (P x) npnna: ~ P nna a: A
P nna
exact (transport P (path_ishprop _ _) (base a)).Defined.
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type
merely A <~> ~~ A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type
merely A <~> ~~ A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type
merely A -> ~~ A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type
~~ A -> merely A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type
merely A -> ~~ A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type
A -> ~~ A
exact (funana => na a).
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type
~~ A -> merely A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type nna: ~~ A
merely A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type nna: ~~ A
A -> merely A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type nna: ~~ A
forall (xy : ~~ A) (zw : merely A),
transport (fun_ : ~~ A => merely A)
(path_ishprop x y) z = w
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type nna: ~~ A
~~ A
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type nna: ~~ A
A -> merely A
exact tr.
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type nna: ~~ A
forall (xy : ~~ A) (zw : merely A),
transport (fun_ : ~~ A => merely A)
(path_ishprop x y) z = w
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type nna, x, y: ~~ A z, w: merely A
transport (fun_ : ~~ A => merely A)
(path_ishprop x y) z = w
apply path_ishprop.
H: Funext LEM: forallA : Type, IsHProp A -> A + ~ A A: Type nna: ~~ A
~~ A
exact nna.Defined.EndBook_3_14.(* ================================================== ex:impred-brck *)(** Exercise 3.15 *)DefinitionBook_3_15 := @HoTT.Metatheory.ImpredicativeTruncation.resized_Trm_rec_beta.(* ================================================== ex:lem-impl-dn-commutes *)(** Exercise 3.16 *)(** This result holds in general when [Y x] is stable for each [x : X] *)
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp
(forallx : X, ~~ Y x) <~> ~~ (forallx : X, Y x)
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp
(forallx : X, ~~ Y x) <~> ~~ (forallx : X, Y x)
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp
(forallx : X, ~~ Y x) -> ~~ (forallx : X, Y x)
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp
~~ (forallx : X, Y x) -> forallx : X, ~~ Y x
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp
(forallx : X, ~~ Y x) -> ~~ (forallx : X, Y x)
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: forallx : X, ~~ Y x g: ~ (forallx : X, Y x)
Empty
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: forallx : X, ~~ Y x g: ~ (forallx : X, Y x)
forallx : X, Y x
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: forallx : X, ~~ Y x g: ~ (forallx : X, Y x) x: X
Y x
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: forallx : X, ~~ Y x g: ~ (forallx : X, Y x) x: X y: Y x
Y x
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: forallx : X, ~~ Y x g: ~ (forallx : X, Y x) x: X ny: ~ Y x
Y x
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: forallx : X, ~~ Y x g: ~ (forallx : X, Y x) x: X y: Y x
Y x
exact y.
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: forallx : X, ~~ Y x g: ~ (forallx : X, Y x) x: X ny: ~ Y x
Y x
elim (f x ny).
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp
~~ (forallx : X, Y x) -> forallx : X, ~~ Y x
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: ~~ (forallx : X, Y x) x: X ny: ~ Y x
Empty
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: ~~ (forallx : X, Y x) x: X ny: ~ Y x
~ (forallx : X, Y x)
H: Funext LEM: forallA : HProp, A + ~ A X: HSet Y: X -> HProp f: ~~ (forallx : X, Y x) x: X ny: ~ Y x g: forallx : X, Y x
exact (istrunc_equiv_istrunc _ e^-1%equiv).Defined.(* ================================================== ex:finite-choice *)(** Exercise 3.22 *)(** Another form of this statement is proven in the library as [finite_choice] *)
n: nat A: Fin n -> HSet P: forallx : Fin n, A x -> HProp
(forallx : Fin n, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin n, A x &
forallx : Fin n, P x (g x)}
n: nat A: Fin n -> HSet P: forallx : Fin n, A x -> HProp
(forallx : Fin n, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin n, A x &
forallx : Fin n, P x (g x)}
n: nat A: Fin n -> HSet P: forallx : Fin n, A x -> HProp f: forallx : Fin n, Trunc (-1) {a : A x & P x a}
Trunc (-1)
{g : forallx : Fin n, A x &
forallx : Fin n, P x (g x)}
A: Fin 0 -> HSet P: forallx : Fin 0, A x -> HProp f: forallx : Fin 0, Trunc (-1) {a : A x & P x a}
Trunc (-1)
{g : forallx : Fin 0, A x &
forallx : Fin 0, P x (g x)}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)}
Trunc (-1)
{g : forallx : Fin m.+1, A x &
forallx : Fin m.+1, P x (g x)}
A: Fin 0 -> HSet P: forallx : Fin 0, A x -> HProp f: forallx : Fin 0, Trunc (-1) {a : A x & P x a}
Trunc (-1)
{g : forallx : Fin 0, A x &
forallx : Fin 0, P x (g x)}
A: Fin 0 -> HSet P: forallx : Fin 0, A x -> HProp f: forallx : Fin 0, Trunc (-1) {a : A x & P x a}
{g : forallx : Fin 0, A x &
forallx : Fin 0, P x (g x)}
A: Fin 0 -> HSet P: forallx : Fin 0, A x -> HProp f: forallx : Fin 0, Trunc (-1) {a : A x & P x a}
forallx : Fin 0, A x
A: Fin 0 -> HSet P: forallx : Fin 0, A x -> HProp f: forallx : Fin 0, Trunc (-1) {a : A x & P x a}
(fung : forallx : Fin 0, A x =>
forallx : Fin 0, P x (g x)) ?proj1
1-2: intro bot; elim bot.
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)}
Trunc (-1)
{g : forallx : Fin m.+1, A x &
forallx : Fin m.+1, P x (g x)}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)}
Trunc (-1)
{g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cl: Trunc (-1)
{g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
Trunc (-1)
{g : forallx : Fin m.+1, A x &
forallx : Fin m.+1, P x (g x)}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)}
Trunc (-1)
{g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)}
forallx : Fin m,
Trunc (-1) {a : A (inl x) & P (inl x) a}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} xl: Fin m
Trunc (-1) {a : A (inl xl) & P (inl xl) a}
apply f.
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cl: Trunc (-1)
{g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
Trunc (-1)
{g : forallx : Fin m.+1, A x &
forallx : Fin m.+1, P x (g x)}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cl: Trunc (-1)
{g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)} cr: Trunc (-1) {a : A (inr tt) & P (inr tt) a}
Trunc (-1)
{g : forallx : Fin m.+1, A x &
forallx : Fin m.+1, P x (g x)}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
Trunc (-1)
{g : forallx : Fin m.+1, A x &
forallx : Fin m.+1, P x (g x)}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
{g : forallx : Fin m.+1, A x &
forallx : Fin m.+1, P x (g x)}
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)} xl: Fin m
A (inl xl)
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
A (inr tt)
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)} xl: Fin m
P (inl xl) ?Goal
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
P (inr tt) ?Goal0
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)} xl: Fin m
A (inl xl)
apply cl.1.
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
A (inr tt)
exact cr.1.
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)} xl: Fin m
P (inl xl) (cl.1 xl)
apply cl.2.
m: nat A: Fin m.+1 -> HSet P: forallx : Fin m.+1, A x -> HProp f: forallx : Fin m.+1, Trunc (-1) {a : A x & P x a} IH: forall (A : Fin m -> HSet)
(P : forallx : Fin m, A x -> HProp),
(forallx : Fin m, Trunc (-1) {a : A x & P x a}) ->
Trunc (-1)
{g : forallx : Fin m, A x &
forallx : Fin m, P x (g x)} cr: {a : A (inr tt) & P (inr tt) a} cl: {g : forallxl : Fin m, A (inl xl) &
forallxl : Fin m, P (inl xl) (g xl)}
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
IsEquiv g
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
IsEquiv g
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
BiInv g
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
{g0 : C -> B & (funx : B => g0 (g x)) == idmap}
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
{h : C -> B & (funx : C => g (h x)) == idmap}
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
{g0 : C -> B & (funx : B => g0 (g x)) == idmap}
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
(funx : B => (h o g)^-1 (h (g x))) == idmap
exact (eissect (h o g)).
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
{h : C -> B & (funx : C => g (h x)) == idmap}
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
(funx : C => g (f ((g o f)^-1 x))) == idmap
exact (eisretr (g o f)).Defined.
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
IsEquiv f
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
IsEquiv f
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
(funx : A => g^-1 (g (f x))) == f
intro; apply (eissect g).Defined.
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
IsEquiv h
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
IsEquiv h
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
(funx : C => h (g (g^-1 x))) == h
intro; apply (ap h); apply (eisretr g).Defined.
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
IsEquiv (h o g o f)
A, B, C, D: Type f: A -> B g: B -> C h: C -> D H: IsEquiv (g o f) H0: IsEquiv (h o g)
IsEquiv (h o g o f)
typeclasses eauto.Defined.Endparts.(*Lemma Book_4_5 A B f `{IsEquiv A B f} (a a' : A) : IsEquiv (@ap _ _ f a a'). Proof. pose (@ap _ _ (f^-1) (f a) (f a')) as f'. pose (fun p : f^-1 (f a) = _ => p @ (@eissect _ _ f _ a')) as g'. pose (fun p : _ = a' => (@eissect _ _ f _ a)^ @ p) as h'. pose (g' o f'). pose (h' o g'). admit. Qed.*)EndBook_4_5.(* ================================================== ex:qinv-univalence *)(** Exercise 4.6 *)SectionBook_4_6_i.Definitionis_qinv {AB : Type} (f : A -> B)
:= { g : B -> A & (f o g == idmap) * (g o f == idmap) }.Definitionqinv (AB : Type)
:= { f : A -> B & is_qinv f }.Definitionqinv_idA : qinv A A
:= (funx => x; (funx => x ; (funx => 1, funx => 1))).Definitionqinv_pathAB : (A = B) -> qinv A B
:= funp => match p with1 => qinv_id _ end.DefinitionQInv_Univalence_type := forall (AB : Type@{i}),
is_qinv (qinv_path A B).
A, B: Type f: A -> B
is_qinv f -> IsEquiv f
A, B: Type f: A -> B
is_qinv f -> IsEquiv f
A, B: Type f: A -> B g: B -> A s: (funx : B => f (g x)) == idmap r: (funx : A => g (f x)) == idmap
IsEquiv f
exact (isequiv_adjointify f g s r).Defined.Definitionequiv_qinv_path (qua: QInv_Univalence_type) (AB : Type)
: (A = B) <~> qinv A B
:= Build_Equiv _ _ (qinv_path A B) (isequiv_qinv (qua A B)).Definitionqinv_isequiv {AB} (f : A -> B) `{IsEquiv _ _ f}
: qinv A B
:= (f ; (f^-1 ; (eisretr f , eissect f))).Context `{qua : QInv_Univalence_type}.
qua: QInv_Univalence_type A, B: Type w: A -> B H0: IsEquiv w C: Type
IsEquiv (fung : C -> A => w o g)
qua: QInv_Univalence_type A, B: Type w: A -> B H0: IsEquiv w C: Type
IsEquiv (fung : C -> A => w o g)
qua: forallAB : Type, is_qinv (qinv_path A B) A, B: Type w: A -> B H0: IsEquiv w C: Type
IsEquiv (fun (g : C -> A) (x : C) => w (g x))
qua: forallAB : Type, is_qinv (qinv_path A B) A, B: Type w: A -> B H0: IsEquiv w C: Type w':= qinv_isequiv w: qinv A B
IsEquiv (fun (g : C -> A) (x : C) => w (g x))
refine (isequiv_adjointify
(fun (g:C->A) => w o g)
(fun (g:C->B) => w^-1 o g)
_
_);
intros g;
first [ change ((funx => w'.1 ( w'.2.1 (g x))) = g)
| change ((funx => w'.2.1 ( w'.1 (g x))) = g) ];
clearbody w'; clear H0 w;
rewrite <- (@eisretr _ _ (@qinv_path A B) (isequiv_qinv (qua A B)) w');
generalize ((@equiv_inv _ _ (qinv_path A B) (isequiv_qinv (qua A B))) w');
intro p; clear w'; destruct p; reflexivity.Defined.(** Now the rest is basically copied from UnivalenceImpliesFunext, with name changes so as to use the current assumption of qinv-univalence rather than a global assumption of ordinary univalence. *)
qua: QInv_Univalence_type A, B: Type
IsEquiv
(fung : A -> {xy : B * B & fst xy = snd xy} =>
fst o pr1 o g)
qua: QInv_Univalence_type A, B: Type
IsEquiv
(fung : A -> {xy : B * B & fst xy = snd xy} =>
fst o pr1 o g)
qua: QInv_Univalence_type A, B: Type
IsEquiv
(funx : {xy : B * B & fst xy = snd xy} => fst x.1)
qua: QInv_Univalence_type A, B: Type f, g: A -> B p: f == g
f = g
qua: QInv_Univalence_type A, B: Type f, g: A -> B p: f == g d:= funx : A => ((f x, f x); 1): A -> {xy : B * B & fst xy = snd xy}
f = g
qua: QInv_Univalence_type A, B: Type f, g: A -> B p: f == g d:= funx : A => ((f x, f x); 1): A -> {xy : B * B & fst xy = snd xy} e:= funx : A => ((f x, g x); p x): A -> {xy : B * B & fst xy = snd xy}
f = g
qua: QInv_Univalence_type A, B: Type f, g: A -> B p: f == g d:= funx : A => ((f x, f x); 1): A -> {xy : B * B & fst xy = snd xy} e:= funx : A => ((f x, g x); p x): A -> {xy : B * B & fst xy = snd xy}
snd o pr1 o d = g
qua: QInv_Univalence_type A, B: Type f, g: A -> B p: f == g d:= funx : A => ((f x, f x); 1): A -> {xy : B * B & fst xy = snd xy} e:= funx : A => ((f x, g x); p x): A -> {xy : B * B & fst xy = snd xy}
snd o pr1 o d = snd o pr1 o e
qua: QInv_Univalence_type A, B: Type f, g: A -> B p: f == g d:= funx : A => ((f x, f x); 1): A -> {xy : B * B & fst xy = snd xy} e:= funx : A => ((f x, g x); p x): A -> {xy : B * B & fst xy = snd xy}
d = e
qua: QInv_Univalence_type A, B: Type f, g: A -> B p: f == g d:= funx : A => ((f x, f x); 1): A -> {xy : B * B & fst xy = snd xy} e:= funx : A => ((f x, g x); p x): A -> {xy : B * B & fst xy = snd xy} H':= fun (AB : Type)
(xy : A -> {xy : B * B & fst xy = snd xy}) =>
(ap
(fung : A -> {xy : B * B & fst xy = snd xy} =>
fst o pr1 o g))^-1: forall (AB : Type)
(xy : A -> {xy : B * B & fst xy = snd xy}),
(fung : A -> {xy : B * B & fst xy = snd xy} =>
fst o pr1 o g) x =
(fung : A -> {xy : B * B & fst xy = snd xy} =>
fst o pr1 o g) y -> x = y
d = e
qua: QInv_Univalence_type A, B: Type f, g: A -> B p: f == g d:= funx : A => ((f x, f x); 1): A -> {xy : B * B & fst xy = snd xy} e:= funx : A => ((f x, g x); p x): A -> {xy : B * B & fst xy = snd xy} H':= fun (AB : Type)
(xy : A -> {xy : B * B & fst xy = snd xy}) =>
(ap
(fung : A -> {xy : B * B & fst xy = snd xy} =>
fst o pr1 o g))^-1: forall (AB : Type)
(xy : A -> {xy : B * B & fst xy = snd xy}),
(fung : A -> {xy : B * B & fst xy = snd xy} =>
fst o pr1 o g) x =
(fung : A -> {xy : B * B & fst xy = snd xy} =>
fst o pr1 o g) y -> x = y
(funx : A => fst (d x).1) =
(funx : A => fst (e x).1)
reflexivity.Defined.DefinitionQInv_Univalence_implies_Funext_type : Funext_type
:= NaiveNondepFunext_implies_Funext QInv_Univalence_implies_FunextNondep.EndBook_4_6_i.SectionEquivFunctorFunextType.(* We need a version of [equiv_functor_forall_id] that takes a [Funext_type] rather than a global axiom [Funext]. *)Context (fa : Funext_type).Definitionft_path_forall {A : Type} {P : A -> Type} (fg : forallx : A, P x) :
f == g -> f = g
:=
@equiv_inv _ _ (@apD10 A P f g) (fa _ _ _ _).
fa: Funext_type A, B: Type P: A -> Type Q: B -> Type f: B -> A g: forallb : B, P (f b) -> Q b H: IsEquiv f H0: forallb : B, IsEquiv (g b)
IsEquiv (functor_forall f g)
fa: Funext_type A, B: Type P: A -> Type Q: B -> Type f: B -> A g: forallb : B, P (f b) -> Q b H: IsEquiv f H0: forallb : B, IsEquiv (g b)
IsEquiv (functor_forall f g)
fa: Funext_type A, B: Type P: A -> Type Q: B -> Type f: B -> A g: forallb : B, P (f b) -> Q b H: IsEquiv f H0: forallb : B, IsEquiv (g b) h: forallb : B, Q b
functor_forall f g
(functor_forall f^-1
(fun (x : A) (y : Q (f^-1 x)) =>
transport P (eisretr f x) ((g (f^-1 x))^-1 y)) h) =
h
fa: Funext_type A, B: Type P: A -> Type Q: B -> Type f: B -> A g: forallb : B, P (f b) -> Q b H: IsEquiv f H0: forallb : B, IsEquiv (g b) h: foralla : A, P a
functor_forall f^-1
(fun (x : A) (y : Q (f^-1 x)) =>
transport P (eisretr f x) ((g (f^-1 x))^-1 y))
(functor_forall f g h) = h
fa: Funext_type A, B: Type P: A -> Type Q: B -> Type f: B -> A g: forallb : B, P (f b) -> Q b H: IsEquiv f H0: forallb : B, IsEquiv (g b) h: forallb : B, Q b
functor_forall f g
(functor_forall f^-1
(fun (x : A) (y : Q (f^-1 x)) =>
transport P (eisretr f x) ((g (f^-1 x))^-1 y)) h) =
h
fa: Funext_type A, B: Type P: A -> Type Q: B -> Type f: B -> A g: forallb : B, P (f b) -> Q b H: IsEquiv f H0: forallb : B, IsEquiv (g b) h: foralla : A, P a
functor_forall f^-1
(fun (x : A) (y : Q (f^-1 x)) =>
transport P (eisretr f x) ((g (f^-1 x))^-1 y))
(functor_forall f g h) = h
abstract (
apply ft_path_forall; intros a; unfold functor_forall;
rewrite eissect;
apply apD
).Defined.Definitionft_equiv_functor_forall
{AB:Type} `{P : A -> Type} `{Q : B -> Type}
(f : B -> A) `{IsEquiv B A f}
(g : forallb:B, P (f b) -> Q b)
`{forallb, @IsEquiv (P (f b)) (Q b) (g b)}
: (foralla, P a) <~> (forallb, Q b)
:= Build_Equiv _ _ (functor_forall f g) _.Definitionft_equiv_functor_forall_id
{A:Type} `{P : A -> Type} `{Q : A -> Type}
(g : foralla, P a <~> Q a)
: (foralla, P a) <~> (foralla, Q a)
:= ft_equiv_functor_forall (equiv_idmap A) g.EndEquivFunctorFunextType.(** Using the Kraus-Sattler space of loops rather than the version in the book, since it is simpler and avoids use of propositional truncation. *)
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A)
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type
K <~> (forallA : {X : Type & X = X}, A = A)
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A)
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type
K <~> (forallA : {X : Type & X = X}, A = A)
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type
(forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}) <~>
(forallA : {X : Type & X = X}, A = A)
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type
(forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}) <~>
(forall (x : Type) (y : x = x), (x; y) = (x; y))
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type X: Type
(forallp : X = X, {q : X = X & p @ q = q @ p}) <~>
(forally : X = X, (X; y) = (X; y))
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type X: Type p: X = X
{q : X = X & p @ q = q @ p} <~> (X; p) = (X; p)
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type X: Type p: X = X
{q : X = X & p @ q = q @ p} <~>
{p0 : X = X &
transport (funX : Type => X = X) p0 p = p}
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type X: Type p, q: X = X
p @ q = q @ p <~>
transport (funX : Type => X = X) q p = p
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type X: Type p, q: X = X
p @ q = q @ p <~> (q^ @ p) @ q = p
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type X: Type p, q: X = X
p @ q = q @ p <~> q^ @ (p @ q) = p
apply equiv_moveR_Vp.
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A)
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K
forall (X : Type) (p : X = X), p @ 1 = 1 @ p
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K
forall (X : Type) (p : X = X), p @ 1 = 1 @ p
intros X p; rewrite concat_p1, concat_1p; reflexivity.
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p alpha:= (fun (X : Type) (p : X = X) => (1; u X p)) : K: K
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p alpha:= (fun (X : Type) (p : X = X) => (1; u X p)) : K: K beta:= (fun (X : Type) (p : X = X) => (p; 1)) : K: K
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p alpha:= (fun (X : Type) (p : X = X) => (1; u X p)) : K: K beta:= (fun (X : Type) (p : X = X) => (p; 1)) : K: K i:= isequiv_qinv (qua1 Bool Bool): IsEquiv (qinv_path Bool Bool)
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p alpha:= (fun (X : Type) (p : X = X) => (1; u X p)) : K: K beta:= (fun (X : Type) (p : X = X) => (p; 1)) : K: K i:= isequiv_qinv (qua1 Bool Bool): IsEquiv (qinv_path Bool Bool) r: (alpha Bool
((qinv_path Bool Bool)^-1
(qinv_isequiv equiv_negb))).1 =
(beta Bool
((qinv_path Bool Bool)^-1
(qinv_isequiv equiv_negb))).1
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p i:= isequiv_qinv (qua1 Bool Bool): IsEquiv (qinv_path Bool Bool) r: (1;
u Bool
((qinv_path Bool Bool)^-1
(qinv_isequiv equiv_negb))).1 =
((qinv_path Bool Bool)^-1
(qinv_isequiv equiv_negb); 1).1
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p i:= isequiv_qinv (qua1 Bool Bool): IsEquiv (qinv_path Bool Bool) r: qinv_path Bool Bool
(1;
u Bool
((qinv_path Bool Bool)^-1
(qinv_isequiv equiv_negb))).1 =
qinv_path Bool Bool
((qinv_path Bool Bool)^-1
(qinv_isequiv equiv_negb); 1).1
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p i:= isequiv_qinv (qua1 Bool Bool): IsEquiv (qinv_path Bool Bool) r: qinv_path Bool Bool
(1;
u Bool
((qinv_path Bool Bool)^-1
(qinv_isequiv equiv_negb))).1 =
qinv_isequiv equiv_negb
Empty
qua1, qua2: QInv_Univalence_type fa:= QInv_Univalence_implies_Funext_type: Funext_type H: IsHProp (forallA : {X : Type & X = X}, A = A) K:= forall (X : Type) (p : X = X),
{q : X = X & p @ q = q @ p}: Type e: K <~> (forallA : {X : Type & X = X}, A = A) HK: IsHProp (forallA : {X : Type & X = X}, A = A) ->
IsHProp K u: forall (X : Type) (p : X = X), p @ 1 = 1 @ p i:= isequiv_qinv (qua1 Bool Bool): IsEquiv (qinv_path Bool Bool) r: idmap = negb
Empty
exact (true_ne_false (ap10 r true)).Defined.(** Assuming qinv-univalence, every quasi-equivalence automatically satisfies one of the adjoint laws. *)
qua: QInv_Univalence_type A, B: Type f: qinv A B
(funx : B => ap (f.2).1 (fst (f.2).2 x)) =
(funx : B => snd (f.2).2 ((f.2).1 x))
qua: QInv_Univalence_type A, B: Type f: qinv A B
(funx : B => ap (f.2).1 (fst (f.2).2 x)) =
(funx : B => snd (f.2).2 ((f.2).1 x))
(* Every quasi-equivalence is the image of a path, and can therefore be assumed to be the identity equivalence, for which the claim holds immediately. *)
qua: QInv_Univalence_type A, B: Type
forallf : qinv A B,
(funx : B => ap (f.2).1 (fst (f.2).2 x)) =
(funx : B => snd (f.2).2 ((f.2).1 x))
qua: QInv_Univalence_type A, B: Type p: A = B
(funx : B =>
ap ((equiv_qinv_path qua A B p).2).1
(fst ((equiv_qinv_path qua A B p).2).2 x)) =
(funx : B =>
snd ((equiv_qinv_path qua A B p).2).2
(((equiv_qinv_path qua A B p).2).1 x))
destruct p; cbn; reflexivity.Defined.(** Qinv-univalence is inconsistent. *)
qua1, qua2: QInv_Univalence_type
Empty
qua1, qua2: QInv_Univalence_type
Empty
qua1, qua2: QInv_Univalence_type
IsHProp (forallA : {X : Type & X = X}, A = A)
qua1, qua2: QInv_Univalence_type
Contr (forallA : {X : Type & X = X}, A = A)
qua1, qua2: QInv_Univalence_type u: forallA : {X : Type & X = X}, A = A
(funA : {X : Type & X = X} => 1) = u
exact (allqinv_coherent qua2 _ _ (idmap; (idmap; (funA => 1, u)))).Defined.(* ================================================== ex:embedding-cancellable *)(** Exercise 4.7 *)(* ================================================== ex:cancellable-from-bool *)(** Exercise 4.8 *)(* ================================================== ex:funext-from-nondep *)(** Exercise 4.9 *)(* ================================================== ex:ind-lst *)(** Exercise 5.1 *)(* ================================================== ex:same-recurrence-not-defeq *)(** Exercise 5.2 *)SectionBook_5_2.(** Here is one example of functions which are propositionally equal but not judgmentally equal. They satisfy the same reucrrence propositionally. *)Letez : Bool := true.Letes : nat -> Bool -> Bool := fun_ => idmap.DefinitionBook_5_2_i : nat -> Bool := nat_ind (fun_ => Bool) ez es.DefinitionBook_5_2_ii : nat -> Bool := fun_ => true.
The command has indeed failed with message:
In environment
ez := true : Bool
es := fun_ : nat => idmap : nat -> Bool -> Bool
The term "1" has type "Book_5_2_i = Book_5_2_i"
while it is expected to have type
"Book_5_2_i = Book_5_2_ii" (cannot unify"Book_5_2_i"and"Book_5_2_ii").
induction n; simpl; trivial.Defined.EndBook_5_2.SectionBook_5_2'.LocalOpen Scope nat_scope.(** Here's another example where two functions are not (currently) definitionally equal, but satisfy the same reucrrence judgmentally. This example is a bit less robust; it fails in CoqMT. *)Letez : nat := 1.Letes : nat -> nat -> nat := fun_ => S.DefinitionBook_5_2'_i : nat -> nat := funn => n + 1.DefinitionBook_5_2'_ii : nat -> nat := funn => 1 + n.
The command has indeed failed with message:
In environment
ez := 1 : nat
es := fun_ : nat => S : nat -> nat -> nat
The term "1" has type "Book_5_2'_i = Book_5_2'_i"
while it is expected to have type
"Book_5_2'_i = Book_5_2'_ii"
(cannot unify"Book_5_2'_i"and"Book_5_2'_ii").
DefinitionBook_5_2'_i_eq_ez : Book_5_2'_i 0 = ez := idpath.DefinitionBook_5_2'_ii_eq_ez : Book_5_2'_ii 0 = ez := idpath.DefinitionBook_5_2'_i_eq_esn : Book_5_2'_i (S n) = es n (Book_5_2'_i n) := idpath.DefinitionBook_5_2'_ii_eq_esn : Book_5_2'_ii (S n) = es n (Book_5_2'_ii n) := idpath.EndBook_5_2'.(* ================================================== ex:one-function-two-recurrences *)(** Exercise 5.3 *)SectionBook_5_3.Letez : Bool := true.Letes : nat -> Bool -> Bool := fun_ => idmap.Letez' : Bool := true.Letes' : nat -> Bool -> Bool := fun__ => true.DefinitionBook_5_3 : nat -> Bool := fun_ => true.DefinitionBook_5_3_satisfies_ez : Book_5_3 0 = ez := idpath.DefinitionBook_5_3_satisfies_ez' : Book_5_3 0 = ez' := idpath.DefinitionBook_5_3_satisfies_esn : Book_5_3 (S n) = es n (Book_5_3 n) := idpath.DefinitionBook_5_3_satisfies_es'n : Book_5_3 (S n) = es' n (Book_5_3 n) := idpath.DefinitionBook_5_3_es_ne_es' : ~(es = es')
:= funH => false_ne_true (ap10 (ap10 H 0) false).EndBook_5_3.(* ================================================== ex:bool *)(** Exercise 5.4 *)DefinitionBook_5_4 := @HoTT.Types.Bool.equiv_bool_forall_prod.(* ================================================== ex:ind-nat-not-equiv *)(** Exercise 5.5 *)SectionBook_5_5.Letind_nat (P : nat -> Type) := funx => @nat_ind P (fst x) (snd x).
ind_nat:= fun (P : nat -> Type)
(x : P 0 * (foralln : nat, P n -> P n.+1))
=> nat_ind P (fst x) (snd x): forallP : nat -> Type,
P 0 * (foralln : nat, P n -> P n.+1) ->
foralln : nat, P n fs: Funext
~ (forallP : nat -> Type, IsEquiv (ind_nat P))
ind_nat:= fun (P : nat -> Type)
(x : P 0 * (foralln : nat, P n -> P n.+1))
=> nat_ind P (fst x) (snd x): forallP : nat -> Type,
P 0 * (foralln : nat, P n -> P n.+1) ->
foralln : nat, P n fs: Funext
~ (forallP : nat -> Type, IsEquiv (ind_nat P))
ind_nat:= fun (P : nat -> Type)
(x : P 0 * (foralln : nat, P n -> P n.+1))
=> nat_ind P (fst x) (snd x): forallP : nat -> Type,
P 0 * (foralln : nat, P n -> P n.+1) ->
foralln : nat, P n fs: Funext H: forallP : nat -> Type, IsEquiv (ind_nat P)
Empty
ind_nat:= fun (P : nat -> Type)
(x : P 0 * (foralln : nat, P n -> P n.+1))
=> nat_ind P (fst x) (snd x): forallP : nat -> Type,
P 0 * (foralln : nat, P n -> P n.+1) ->
foralln : nat, P n fs: Funext H: IsEquiv (ind_nat (fun_ : nat => Bool))
Empty
ind_nat:= fun (P : nat -> Type)
(x : P 0 * (foralln : nat, P n -> P n.+1))
=> nat_ind P (fst x) (snd x): forallP : nat -> Type,
P 0 * (foralln : nat, P n -> P n.+1) ->
foralln : nat, P n fs: Funext H: IsEquiv (ind_nat (fun_ : nat => Bool)) H1: ((ind_nat (fun_ : nat => Bool))^-1
o ind_nat (fun_ : nat => Bool))
(true, fun (_ : nat) (_ : Bool) => true) =
idmap (true, fun (_ : nat) (_ : Bool) => true)
Empty
ind_nat:= fun (P : nat -> Type)
(x : P 0 * (foralln : nat, P n -> P n.+1))
=> nat_ind P (fst x) (snd x): forallP : nat -> Type,
P 0 * (foralln : nat, P n -> P n.+1) ->
foralln : nat, P n fs: Funext H: IsEquiv (ind_nat (fun_ : nat => Bool)) H1: ((ind_nat (fun_ : nat => Bool))^-1
o ind_nat (fun_ : nat => Bool))
(true, fun (_ : nat) (_ : Bool) => true) =
idmap (true, fun (_ : nat) (_ : Bool) => true) H2: ((ind_nat (fun_ : nat => Bool))^-1
o ind_nat (fun_ : nat => Bool))
(true, fun_ : nat => idmap) =
idmap (true, fun_ : nat => idmap)
Empty
ind_nat:= fun (P : nat -> Type)
(x : P 0 * (foralln : nat, P n -> P n.+1))
=> nat_ind P (fst x) (snd x): forallP : nat -> Type,
P 0 * (foralln : nat, P n -> P n.+1) ->
foralln : nat, P n fs: Funext H: IsEquiv (ind_nat (fun_ : nat => Bool)) H1: ((ind_nat (fun_ : nat => Bool))^-1
o ind_nat (fun_ : nat => Bool))
(true, fun (_ : nat) (_ : Bool) => true) =
idmap (true, fun (_ : nat) (_ : Bool) => true) H2: ((ind_nat (fun_ : nat => Bool))^-1
o ind_nat (fun_ : nat => Bool))
(true, fun_ : nat => idmap) =
idmap (true, fun_ : nat => idmap)
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence
forallX : Type, X -> X
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence
forallX : Type, X -> X
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence X: Type
X -> X
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence X: Type contrXEquiv: Contr
{f : X <~> X &
~ (forallx : X, f x = x)} +
~
Contr
{f : X <~> X &
~ (forallx : X, f x = x)}
X -> X
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence X: Type C: Contr {f : X <~> X & ~ (forallx : X, f x = x)}
X -> X
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence X: Type notC: ~
Contr {f : X <~> X & ~ (forallx : X, f x = x)}
X -> X
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence X: Type C: Contr {f : X <~> X & ~ (forallx : X, f x = x)}
X -> X
exact ((@center _ C).1).
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence X: Type notC: ~
Contr {f : X <~> X & ~ (forallx : X, f x = x)}
X -> X
exact idmap.Defined.
LEM: forallA : Type, IsHProp A -> A + ~ A f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)}
forallb : Bool, f.1 b <> b
LEM: forallA : Type, IsHProp A -> A + ~ A f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)}
forallb : Bool, f.1 b <> b
LEM: forallA : Type, IsHProp A -> A + ~ A f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)} b: Bool
f.1 b <> b
LEM: forallA : Type, IsHProp A -> A + ~ A f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)} b: Bool H'': f.1 b = b
Empty
LEM: forallA : Type, IsHProp A -> A + ~ A f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)} b: Bool H'': f.1 b = b
forallx : Bool, f.1 x = x
LEM: forallA : Type, IsHProp A -> A + ~ A f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)} b: Bool H'': f.1 b = b b': Bool
f.1 b' = b'
LEM: forallA : Type, IsHProp A -> A + ~ A f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)} b: Bool H'': f.1 b = b b': Bool X: f.1 false = negb (f.1 true)
f.1 b' = b'
destruct b', b, (f.1 true), (f.1 false);
simplin *;
match goal with
| _ => assumption
| _ => reflexivity
| [ H : true = false |- _ ] => exact (match true_ne_false H withend)
| [ H : false = true |- _ ] => exact (match false_ne_true H withend)
end.Qed.
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext
Book_6_9 Bool = negb
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext
Book_6_9 Bool = negb
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool
Book_6_9 Bool b = negb b
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool
match
LEM
(Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)})
(ishprop_istrunc (-2)
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)})
with
| inl i =>
equiv_fun
(center
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)}).1
| inr _ => idmap
end b = negb b
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool C: Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)}
(center
{f : Bool <~> Bool & ~ (forallx : Bool, f x = x)}).1
b = negb b
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool H': ~
Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)}
b = negb b
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool C: Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)}
(center
{f : Bool <~> Bool & ~ (forallx : Bool, f x = x)}).1
b = negb b
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool C: Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)} f:= center
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)}: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)}
f.1 b = negb b
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool C: Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)} f:= center
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)}: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)} X: f.1 b <> b
f.1 b = negb b
destruct (f.1 b), b;
match goal with
| _ => assumption
| _ => reflexivity
| [ H : ~(_ = _) |- _ ] => exact (match H idpath withend)
| [ H : true = false |- _ ] => exact (match true_ne_false H withend)
| [ H : false = true |- _ ] => exact (match false_ne_true H withend)
end.
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool H': ~
Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)}
b = negb b
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool H': ~
Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)}
Contr
{f : Bool <~> Bool & ~ (forallx : Bool, f x = x)}
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool H': ~
Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)}
forally : {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)},
({|
equiv_fun := negb; equiv_isequiv := isequiv_negb
|};
funH : forallx : Bool, negb x = x =>
false_ne_true (H true)) = y
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool H': ~
Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)} f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)}
({|
equiv_fun := negb; equiv_isequiv := isequiv_negb
|};
funH : forallx : Bool, negb x = x =>
false_ne_true (H true)) = f
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool H': ~
Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)} f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)}
{p
: {|
equiv_fun := negb; equiv_isequiv := isequiv_negb
|} = f.1 &
transport
(funf : Bool <~> Bool =>
~ (forallx : Bool, f x = x)) p
(funH : forallx : Bool, negb x = x =>
false_ne_true (H true)) = f.2}
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool H': ~
Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)} f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)}
negb = f.1
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool H': ~
Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)} f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)} b': Bool
negb b' = f.1 b'
LEM: forallA : Type, IsHProp A -> A + ~ A ua: Univalence fs: Funext b: Bool H': ~
Contr
{f : Bool <~> Bool &
~ (forallx : Bool, f x = x)} f: {f : Bool <~> Bool & ~ (forallx : Bool, f x = x)} b': Bool X: f.1 b' <> b'
negb b' = f.1 b'
destruct (f.1 b'), b';
match goal with
| _ => assumption
| _ => reflexivity
| [ H : ~(_ = _) |- _ ] => exact (match H idpath withend)
| [ H : true = false |- _ ] => exact (match true_ne_false H withend)
| [ H : false = true |- _ ] => exact (match false_ne_true H withend)
end.Qed.(** Simpler solution not using univalence **)DefinitionAllExistsOther(X : Type) := forallx:X, { y:X | y <> x }.DefinitioncenterAllExOthBool : AllExistsOther Bool :=
fun (b:Bool) => (negb b ; not_fixed_negb b).
LEM: forallA : Type, IsHProp A -> A + ~ A H: Funext f: AllExistsOther Bool
centerAllExOthBool = f
LEM: forallA : Type, IsHProp A -> A + ~ A H: Funext f: AllExistsOther Bool
centerAllExOthBool = f
LEM: forallA : Type, IsHProp A -> A + ~ A H: Funext f: AllExistsOther Bool
centerAllExOthBool == f
LEM: forallA : Type, IsHProp A -> A + ~ A H: Funext f: AllExistsOther Bool b: Bool
centerAllExOthBool b = f b
LEM: forallA : Type, IsHProp A -> A + ~ A H: Funext f: AllExistsOther Bool b: Bool fst: negb b = (f b).1
centerAllExOthBool b = f b
LEM: forallA : Type, IsHProp A -> A + ~ A H: Funext f: AllExistsOther Bool b: Bool fst: negb b = (f b).1
(negb b; not_fixed_negb b) = f b
LEM: forallA : Type, IsHProp A -> A + ~ A H: Funext f: AllExistsOther Bool b: Bool fst: negb b = (f b).1
transport (funy : Bool => y <> b) fst
(not_fixed_negb b) = (f b).2
LEM: forallA : Type, IsHProp A -> A + ~ A H: Funext f: AllExistsOther Bool b: Bool fst: negb b = (f b).1