-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprecomp_ess_surj.v
888 lines (766 loc) · 27.6 KB
/
precomp_ess_surj.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
(** **********************************************************
Benedikt Ahrens, Chris Kapulkin, Mike Shulman
january 2013
************************************************************)
(** **********************************************************
Contents : Precomposition with a fully faithful and
essentially surjective functor yields
an essentially surjective functor
************************************************************)
Require Import Foundations.Generalities.uu0.
Require Import Foundations.hlevel1.hProp.
Require Import Foundations.hlevel2.hSet.
Require Import RezkCompletion.pathnotations.
Import RezkCompletion.pathnotations.PathNotations.
Require Import RezkCompletion.auxiliary_lemmas_HoTT.
Require Import RezkCompletion.precategories.
Require Import RezkCompletion.functors_transformations.
Require Import RezkCompletion.whiskering.
Ltac pathvia b := (apply (@pathscomp0 _ _ b _ )).
Local Notation "a --> b" := (precategory_morphisms a b)(at level 50).
(*Local Notation "'hom' C" := (precategory_morphisms (C := C)) (at level 2).*)
Local Notation "f ;; g" := (compose f g)(at level 50).
Notation "[ C , D ]" := (functor_precategory C D).
Local Notation "# F" := (functor_on_morphisms F)(at level 3).
Local Notation "FF ^-1" := (fully_faithful_inv_hom FF _ _ ) (at level 20).
Local Notation "F '^-i'" := (iso_from_fully_faithful_reflection F _ _) (at level 20).
Local Notation "G 'O' F" := (functor_compose _ _ _ F G) (at level 25).
Ltac simp_rew lem := let H:=fresh in
assert (H:= lem); simpl in *; rewrite H; clear H.
Ltac simp_rerew lem := let H:=fresh in
assert (H:= lem); simpl in *; rewrite <- H; clear H.
Ltac inv_functor HF x y :=
let H:=fresh in
set (H:= homotweqinvweq (weq_from_fully_faithful HF x y));
simpl in H;
unfold fully_faithful_inv_hom; simpl;
rewrite H; clear H.
(** * Lengthy preparation for the main result of this file *)
Section precomp_w_ess_surj_ff_is_ess_surj.
(** ** Section variables *)
Variables A B C : precategory.
Hypothesis Ccat : is_category C.
Variable H : functor A B.
Hypothesis p : essentially_surjective H.
Hypothesis fH : fully_faithful H.
(** We prove that precomposition with a [H] yields an essentially surjective functor *)
Section essentially_surjective.
(** ** Specification of preimage [G] of a functor [F] *)
(** Given a functor [F] from [A] to [C], we construct [G] such that
[F == G O H] *)
Variable F : functor A C.
Section preimage.
(** The type [X b] will be contractible, and [G] is defined as
the first component of its center. *)
Let X (b : B) := total2 (
fun ck :
total2 (fun c : C =>
forall a : A,
iso (H a) b -> iso (F a) c) =>
forall t t' : total2 (fun a : A => iso (H a) b),
forall f : pr1 t --> pr1 t',
(#H f ;; pr2 t' == pr2 t ->
#F f ;; pr2 ck (pr1 t') (pr2 t') == pr2 ck (pr1 t) (pr2 t))).
Definition kX {b : B} (t : X b) := (pr2 (pr1 t)).
(** The following is the third component of the center of [X b] *)
Lemma X_aux_type_center_of_contr_proof (b : B) (anot : A) (hnot : iso (H anot) b) :
forall (t t' : total2 (fun a : A => iso (H a) b))
(f : pr1 t --> pr1 t'),
#H f;; pr2 t' == pr2 t ->
#F f;;
#F (fH^-1 (pr2 t';; inv_from_iso hnot)) ==
#F (fH^-1 (pr2 t;; inv_from_iso hnot)).
Proof.
intros t t' f.
destruct t as [a h].
destruct t' as [a' h'].
simpl in *.
intro star.
rewrite <- functor_comp.
apply maponpaths.
apply (equal_transport_along_weq _ _
(weq_from_fully_faithful fH a anot)).
simpl.
rewrite functor_comp.
inv_functor fH a' anot.
rewrite assoc.
inv_functor fH a anot.
rewrite <- star.
apply idpath.
Qed.
(** The center of [X b] *)
Definition X_aux_type_center_of_contr (b : B)
(anot : A)(hnot : iso (H anot) b) : X b.
Proof.
set (cnot := F anot).
set (g := fun (a : A)(h : iso (H a) b) =>
(fH^-i (iso_comp h (iso_inv_from_iso hnot)))).
set (knot := fun (a : A)(h : iso (H a) b) =>
functor_on_iso _ _ F _ _ (g a h)).
simpl in *.
exists (tpair _ (F anot) knot).
simpl.
apply X_aux_type_center_of_contr_proof.
Defined.
(** Any inhabitant of [X b] is equal to the center of [X b]. *)
Lemma X_aux_type_contr_eq (b : B) (anot : A) (hnot : iso (H anot) b) :
forall t : X b, t == X_aux_type_center_of_contr b anot hnot.
Proof.
intro t.
simpl in X.
assert (Hpr1 : pr1 (X_aux_type_center_of_contr b anot hnot) == pr1 t).
set (w := isotoid _ Ccat ((pr2 (pr1 t)) anot hnot) :
pr1 (pr1 (X_aux_type_center_of_contr b anot hnot)) == pr1 (pr1 t)).
apply (total2_paths w).
simpl.
destruct t as [[c1 k1] q1].
simpl in *.
apply funextsec; intro a.
apply funextsec; intro h.
set (gah := fH^-i (iso_comp h (iso_inv_from_iso hnot))).
set (qhelp := q1 (tpair _ a h)(tpair _ anot hnot) gah).
simpl in *.
assert (feedtoqhelp :
#H (fH^-1 (h;; inv_from_iso hnot));; hnot == h).
inv_functor fH a anot.
rewrite <- assoc.
rewrite iso_after_iso_inv.
apply id_right.
assert (quack := qhelp feedtoqhelp).
simpl in *.
pathvia (iso_comp (functor_on_iso A C F a anot
(fH^-i (iso_comp h (iso_inv_from_iso hnot)))) (idtoiso w) ).
generalize w; intro w0.
induction w0.
simpl. apply eq_iso. simpl.
rewrite id_right.
apply idpath.
apply eq_iso.
simpl.
unfold w.
rewrite idtoiso_isotoid.
apply quack.
apply pathsinv0.
apply (total2_paths Hpr1).
apply proofirrelevance.
repeat (apply impred; intro).
apply (pr2 (_ --> _)).
Qed.
(** Putting everything together: [X b] is contractible. *)
Definition iscontr_X : forall b : B, iscontr (X b).
Proof.
intro b.
assert (HH : isaprop (iscontr (X b))).
apply isapropiscontr.
apply (p b (tpair (fun x => isaprop x) (iscontr (X b)) HH)).
intro t.
exists (X_aux_type_center_of_contr b (pr1 t) (pr2 t)).
apply (X_aux_type_contr_eq b (pr1 t) (pr2 t)).
Qed.
(** The object part of [G], [Go b], is defined as the first component of
the center of [X b]. *)
(** *** [G] on objects *)
Definition Go : B -> C :=
fun b : B => pr1 (pr1 (pr1 (iscontr_X b))).
Let k (b : B) :
forall a : A, iso (H a) b -> iso (F a) (Go b) :=
pr2 (pr1 (pr1 (iscontr_X b))).
Let q (b : B) := pr2 (pr1 (iscontr_X b)).
(** Given any inhabitant of [X b], its first component is equal to [Go b]. *)
Definition Xphi (b : B) (t : X b) : pr1 (pr1 t) == Go b.
Proof.
set (p1 := pr2 (iscontr_X b) t).
exact (base_paths _ _ (base_paths _ _ p1)).
Defined.
(** Given any inhabitant [t : X b], its second component is equal to [k b],
modulo transport along [Xphi b t]. *)
Definition Xkphi_transp (b : B) (t : X b) :
forall a : A, forall h : iso (H a) b,
transportf _ (Xphi b t) (kX t) a h == k b a h.
Proof.
unfold k.
rewrite <- (fiber_path (base_paths _ _ (pr2 (iscontr_X b) t))).
intros ? ?.
apply maponpaths, idpath.
Qed.
(** Similarly to the lemma before, the second component of [t] is the same
as [k b], modulo postcomposition with an isomorphism. *)
Definition Xkphi_idtoiso (b : B) (t : X b) :
forall a : A, forall h : iso (H a) b,
k b a h ;; idtoiso (!Xphi b t) == kX t a h.
Proof.
intros a h.
rewrite <- (Xkphi_transp _ t).
generalize (Xphi b t).
intro i; destruct i.
apply id_right.
Qed.
(*
Lemma k_transport (b : ob B) (*t : X b*) (c : ob C)
(p : pr1 (pr1 t) == c) (a : ob A) (h : iso (pr1 H a) b):
transportf (fun c' : ob C => forall a : ob A, iso (pr1 H a) b ->
iso ((pr1 F) a) c')
p (k) a h == (k b) b a h ;; idtoiso p .
*)
(** *** Preparation for [G] on morphisms *)
(** [G f] will be defined as the first component of the center of
contraction of [Y f]. *)
Let Y {b b' : B} (f : b --> b') :=
total2 (fun g : Go b --> Go b' =>
forall a : A,
forall h : iso (H a) b,
forall a' : A,
forall h' : iso (H a') b',
forall l : a --> a',
#H l ;; h' == h ;; f -> #F l ;; k b' a' h' == k b a h ;; g).
Lemma Y_inhab_proof (b b' : B) (f : b --> b') (a0 : A) (h0 : iso (H a0) b)
(a0' : A) (h0' : iso (H a0') b') :
forall (a : A) (h : iso (H a) b) (a' : A) (h' : iso (H a') b')
(l : a --> a'),
#H l;; h' == h;; f ->
#F l;; k b' a' h' ==
k b a h;; ((inv_from_iso (k b a0 h0);;
#F (fH^-1 ((h0;; f);; inv_from_iso h0')));; k b' a0' h0').
Proof.
intros a h a' h' l alpha.
set (m := fH^-i (iso_comp h0 (iso_inv_from_iso h))).
set (m' := fH^-i (iso_comp h0' (iso_inv_from_iso h'))).
assert (sss : iso_comp (functor_on_iso _ _ F _ _ m) (k b a h) ==
k b a0 h0).
apply eq_iso.
apply (q b (tpair _ a0 h0) (tpair _ a h) m).
simpl.
inv_functor fH a0 a.
rewrite <- assoc.
rewrite iso_after_iso_inv.
apply id_right.
assert (ssss : iso_comp (functor_on_iso _ _ F _ _ m') (k b' a' h') ==
k b' a0' h0').
apply eq_iso.
apply (q b' (tpair _ a0' h0') (tpair _ a' h') m').
simpl;
inv_functor fH a0' a'.
rewrite <- assoc.
rewrite iso_after_iso_inv.
apply id_right.
set (hfh := h0 ;; f ;; inv_from_iso h0').
set (l0 := fH^-1 hfh).
set (g0 := inv_from_iso (k b a0 h0) ;; #F l0 ;; k b' a0' h0').
assert (sssss : #H (l0 ;; m') == #H (m ;; l)).
rewrite functor_comp .
unfold m'. simpl.
inv_functor fH a0' a'.
unfold l0.
inv_functor fH a0 a0'.
unfold hfh.
pathvia (h0 ;; f ;; (inv_from_iso h0' ;; h0') ;; inv_from_iso h').
repeat rewrite assoc; apply idpath.
rewrite iso_after_iso_inv, id_right, functor_comp.
inv_functor fH a0 a.
repeat rewrite <- assoc.
apply maponpaths, pathsinv0, iso_inv_on_right.
rewrite assoc.
apply iso_inv_on_left, pathsinv0, alpha.
assert (star5 : inv_from_iso m ;; l0 == l ;; inv_from_iso m').
apply iso_inv_on_right.
rewrite assoc.
apply iso_inv_on_left,
(equal_transport_along_weq _ _ (weq_from_fully_faithful fH a0 a' )),
pathsinv0,
sssss.
clear sssss.
unfold g0.
assert (sss'' : k b a h ;; inv_from_iso (k b a0 h0) ==
inv_from_iso (functor_on_iso _ _ F _ _ m)).
apply pathsinv0, iso_inv_on_left, pathsinv0.
apply iso_inv_on_right.
unfold m; simpl.
apply pathsinv0, (base_paths _ _ sss).
repeat rewrite assoc.
rewrite sss''. clear sss'' sss.
rewrite <- functor_on_inv_from_iso.
rewrite <- functor_comp.
rewrite star5; clear star5 .
rewrite functor_comp, functor_on_inv_from_iso.
assert (star4 :
inv_from_iso (functor_on_iso A C F a0' a' m');; k b' a0' h0'
== k b' a' h' ).
apply iso_inv_on_right.
apply pathsinv0, (base_paths _ _ ssss).
rewrite <- assoc.
rewrite star4.
apply idpath.
Qed.
(** The center of [Y b b' f]. *)
Definition Y_inhab (b b' : B) (f : b --> b')
(a0 : A) (h0 : iso (H a0) b) (a0' : A) (h0' : iso (H a0') b') : Y b b' f.
Proof.
set (hfh := h0 ;; f ;; inv_from_iso h0').
set (l0 := fH^-1 hfh).
set (g0 := inv_from_iso (k b a0 h0) ;; #F l0 ;; k b' a0' h0').
exists g0.
apply Y_inhab_proof.
Defined.
(** Any inhabitant of [Y b b' f] is equal to the center. *)
Lemma Y_contr_eq (b b' : B) (f : b --> b')
(a0 : A) (h0 : iso (H a0) b)
(a0' : A) (h0' : iso (H a0') b') :
forall t : Y b b' f, t == Y_inhab b b' f a0 h0 a0' h0'.
Proof.
intro t.
apply pathsinv0.
assert (Hpr : pr1 (Y_inhab b b' f a0 h0 a0' h0') == pr1 t).
destruct t as [g1 r1]; simpl in *.
rewrite <- assoc.
apply iso_inv_on_right.
set (hfh := h0 ;; f ;; inv_from_iso h0').
set (l0 := fH^-1 hfh).
apply (r1 a0 h0 a0' h0' l0).
unfold l0.
inv_functor fH a0 a0' .
unfold hfh.
repeat rewrite <- assoc.
rewrite iso_after_iso_inv, id_right.
apply idpath.
apply (total2_paths Hpr).
apply proofirrelevance.
repeat (apply impred; intro).
apply (pr2 (_ --> _)).
Qed.
(** The type [Y b b' f] is contractible. *)
Definition Y_iscontr (b b' : B) (f : b --> b') :
iscontr (Y b b' f).
Proof.
assert (HH : isaprop (iscontr (Y b b' f))).
apply isapropiscontr.
apply (p b (tpair (fun x => isaprop x) (iscontr (Y b b' f)) HH)).
intros [a0 h0].
apply (p b' (tpair (fun x => isaprop x) (iscontr (Y b b' f)) HH)).
intros [a0' h0'].
exists (Y_inhab b b' f a0 h0 a0' h0').
apply Y_contr_eq.
Qed.
(** *** [G] on morphisms *)
(** We now have the data necessary to define the functor [G]. *)
Definition preimage_functor_data : functor_data B C.
Proof.
exists Go.
intros b b' f.
exact (pr1 (pr1 (Y_iscontr b b' f))).
Defined.
Notation "'G' f" := (pr1 (pr1 (Y_iscontr _ _ f))) (at level 3).
(** The above data is indeed functorial. *)
Lemma is_functor_preimage_functor_data : is_functor preimage_functor_data.
Proof.
split; simpl.
intro b.
assert (PR2 : forall (a : A) (h : iso (H a) b) (a' : A)
(h' : iso (H a') b)
(l : a --> a'),
#H l;; h' == h;; identity b ->
#F l;; k b a' h' == k b a h;; identity (Go b)).
intros a h a' h' l LL.
rewrite id_right.
apply (q b (tpair _ a h) (tpair _ a' h') l).
rewrite id_right in LL.
apply LL.
set (Gbrtilde :=
tpair _ (identity (Go b)) PR2 : Y b b (identity b)).
set (H' := pr2 (Y_iscontr b b (identity b)) Gbrtilde).
set (H'' := base_paths _ _ H').
simpl in H'.
rewrite <- H'.
apply idpath.
(** composition *)
intros b b' b'' f f'.
assert (HHHH : isaprop (pr1 (pr1 (Y_iscontr b b'' (f;; f'))) ==
pr1 (pr1 (Y_iscontr b b' f));; pr1 (pr1 (Y_iscontr b' b'' f')))).
apply (pr2 (Go b --> Go b'')).
apply (p b (tpair (fun x => isaprop x) (pr1 (pr1 (Y_iscontr b b'' (f;; f'))) ==
pr1 (pr1 (Y_iscontr b b' f));; pr1 (pr1 (Y_iscontr b' b'' f'))) HHHH)).
intros [a0 h0]; simpl.
apply (p b' (tpair (fun x => isaprop x) (pr1 (pr1 (Y_iscontr b b'' (f;; f'))) ==
pr1 (pr1 (Y_iscontr b b' f));; pr1 (pr1 (Y_iscontr b' b'' f'))) HHHH)).
intros [a0' h0']; simpl.
apply (p b'' (tpair (fun x => isaprop x) (pr1 (pr1 (Y_iscontr b b'' (f;; f'))) ==
pr1 (pr1 (Y_iscontr b b' f));; pr1 (pr1 (Y_iscontr b' b'' f'))) HHHH)).
intros [a0'' h0''].
simpl; clear HHHH.
set (l0 := fH^-1 (h0 ;; f ;; inv_from_iso h0')).
set (l0' := fH^-1 (h0' ;; f' ;; inv_from_iso h0'')).
set (l0'' := fH^-1 (h0 ;; (f;; f') ;; inv_from_iso h0'')).
assert (L : l0 ;; l0' == l0'').
apply (equal_transport_along_weq _ _ (weq_from_fully_faithful fH a0 a0'')).
simpl; rewrite functor_comp.
unfold l0'.
inv_functor fH a0' a0''.
unfold l0.
inv_functor fH a0 a0'.
pathvia (h0 ;; f ;; (inv_from_iso h0' ;; h0') ;; f' ;; inv_from_iso h0'').
repeat rewrite assoc; apply idpath.
rewrite iso_after_iso_inv, id_right.
unfold l0''.
inv_functor fH a0 a0''.
repeat rewrite assoc; apply idpath.
assert (PR2 : forall (a : A) (h : iso (H a) b)(a' : A)
(h' : iso (H a') b') (l : a --> a'),
#H l;; h' == h;; f ->
#F l;; k b' a' h' ==
k b a h;; ((inv_from_iso (k b a0 h0);; #F l0);; k b' a0' h0') ).
intros a h a' h' l.
intro alpha.
set (m := fH^-i (iso_comp h0 (iso_inv_from_iso h))).
set (m' := fH^-i (iso_comp h0' (iso_inv_from_iso h'))).
assert (sss : iso_comp (functor_on_iso _ _ F _ _ m) (k b a h) ==
k b a0 h0).
apply eq_iso; simpl.
apply (q b (tpair _ a0 h0) (tpair _ a h) m).
simpl.
inv_functor fH a0 a.
rewrite <- assoc.
rewrite iso_after_iso_inv.
apply id_right.
assert (ssss : iso_comp (functor_on_iso _ _ F _ _ m') (k b' a' h') ==
k b' a0' h0').
apply eq_iso; simpl.
apply (q b' (tpair _ a0' h0') (tpair _ a' h') m'); simpl.
inv_functor fH a0' a'.
rewrite <- assoc.
rewrite iso_after_iso_inv.
apply id_right.
assert (sssss : #H (l0 ;; m') == #H (m ;; l)).
rewrite functor_comp.
unfold m'; simpl.
inv_functor fH a0' a'.
unfold l0.
inv_functor fH a0 a0'.
pathvia (h0 ;; f ;; (inv_from_iso h0' ;; h0') ;; inv_from_iso h').
repeat rewrite assoc; apply idpath.
rewrite iso_after_iso_inv, id_right, functor_comp.
inv_functor fH a0 a.
repeat rewrite <- assoc.
apply maponpaths.
apply pathsinv0.
apply iso_inv_on_right.
rewrite assoc.
apply iso_inv_on_left.
apply pathsinv0.
apply alpha.
assert (star5 : inv_from_iso m ;; l0 == l ;; inv_from_iso m').
apply iso_inv_on_right.
rewrite assoc.
apply iso_inv_on_left.
apply (equal_transport_along_weq _ _ (weq_from_fully_faithful fH a0 a' )).
apply pathsinv0.
apply sssss.
clear sssss.
set (sss':= base_paths _ _ sss); simpl in sss'.
assert (sss'' : k b a h ;; inv_from_iso (k b a0 h0) ==
inv_from_iso (functor_on_iso _ _ F _ _ m)).
apply pathsinv0.
apply iso_inv_on_left.
apply pathsinv0.
apply iso_inv_on_right.
unfold m; simpl.
apply pathsinv0.
apply sss'.
repeat rewrite assoc.
rewrite sss''. clear sss'' sss' sss.
rewrite <- functor_on_inv_from_iso.
rewrite <- functor_comp.
rewrite star5, functor_comp, functor_on_inv_from_iso.
clear star5.
assert (star4 :
inv_from_iso (functor_on_iso A C F a0' a' m');; k b' a0' h0'
== k b' a' h' ).
apply iso_inv_on_right.
set (ssss' := base_paths _ _ ssss).
apply pathsinv0.
simpl in ssss'. simpl.
apply ssss'; clear ssss'.
rewrite <- assoc.
rewrite star4.
apply idpath.
assert (HGf : G f == inv_from_iso (k b a0 h0) ;; #F l0 ;; k b' a0' h0').
set (Gbrtilde :=
tpair _ (inv_from_iso (k b a0 h0) ;; #F l0 ;; k b' a0' h0') PR2 : Y b b' f).
set (H' := pr2 (Y_iscontr b b' f) Gbrtilde).
set (H'' := base_paths _ _ H').
simpl in H'.
rewrite <- H'.
apply idpath.
clear PR2.
assert (PR2 : forall (a : A) (h : iso (H a) b') (a' : A)
(h' : iso (H a') b'') (l : a --> a'),
#H l;; h' == h;; f' ->
#F l;; k b'' a' h' ==
k b' a h;; ((inv_from_iso (k b' a0' h0');; #F l0');; k b'' a0'' h0'')).
intros a' h' a'' h'' l'.
intro alpha.
set (m := fH^-i (iso_comp h0' (iso_inv_from_iso h'))).
set (m' := fH^-i (iso_comp h0'' (iso_inv_from_iso h''))).
assert (sss : iso_comp (functor_on_iso _ _ F _ _ m) (k b' a' h') ==
k b' a0' h0').
apply eq_iso; simpl.
apply (q b' (tpair _ a0' h0') (tpair _ a' h') m); simpl.
inv_functor fH a0' a'.
rewrite <- assoc.
rewrite iso_after_iso_inv.
apply id_right.
assert (ssss : iso_comp (functor_on_iso _ _ F _ _ m') (k b'' a'' h'') ==
k b'' a0'' h0'').
apply eq_iso; simpl.
apply (q b'' (tpair _ a0'' h0'') (tpair _ a'' h'') m'); simpl.
inv_functor fH a0'' a''.
rewrite <- assoc.
rewrite iso_after_iso_inv.
apply id_right.
assert (sssss : #H (l0' ;; m') == #H (m ;; l')).
rewrite functor_comp.
unfold m'. simpl.
inv_functor fH a0'' a''.
unfold l0'.
inv_functor fH a0' a0''.
pathvia (h0' ;; f' ;; (inv_from_iso h0'' ;; h0'') ;; inv_from_iso h'').
repeat rewrite assoc; apply idpath.
rewrite iso_after_iso_inv, id_right, functor_comp.
inv_functor fH a0' a'.
repeat rewrite <- assoc.
apply maponpaths, pathsinv0, iso_inv_on_right.
rewrite assoc.
apply iso_inv_on_left, pathsinv0, alpha.
assert (star5 : inv_from_iso m ;; l0' == l' ;; inv_from_iso m').
apply iso_inv_on_right.
rewrite assoc.
apply iso_inv_on_left,
(equal_transport_along_weq _ _ (weq_from_fully_faithful fH a0' a'' )),
pathsinv0,
sssss.
set (sss':= base_paths _ _ sss); simpl in sss'.
assert (sss'' : k b' a' h' ;; inv_from_iso (k b' a0' h0') ==
inv_from_iso (functor_on_iso _ _ F _ _ m)).
apply pathsinv0, iso_inv_on_left, pathsinv0, iso_inv_on_right.
unfold m; simpl;
apply pathsinv0, sss'.
repeat rewrite assoc.
rewrite sss''. clear sss'' sss' sss.
rewrite <- functor_on_inv_from_iso.
rewrite <- functor_comp.
rewrite star5. clear star5 sssss.
rewrite functor_comp, functor_on_inv_from_iso.
assert (star4 :
inv_from_iso (functor_on_iso A C F a0'' a'' m');; k b'' a0'' h0''
== k b'' a'' h'' ).
apply iso_inv_on_right.
set (ssss' := base_paths _ _ ssss).
apply pathsinv0.
simpl in *; apply ssss'.
rewrite <- assoc.
rewrite star4.
apply idpath.
assert (HGf' : G f' == inv_from_iso (k b' a0' h0') ;; #F l0' ;; k b'' a0'' h0'').
set (Gbrtilde :=
tpair _ (inv_from_iso (k b' a0' h0') ;; #F l0' ;; k b'' a0'' h0'') PR2 :
Y b' b'' f').
set (H' := pr2 (Y_iscontr b' b'' f') Gbrtilde).
rewrite <-(base_paths _ _ H').
apply idpath.
clear PR2.
assert (PR2 : forall (a : A) (h : iso (H a) b) (a' : A)
(h' : iso (H a') b'') (l : a --> a'),
#H l;; h' == h;; (f;; f') ->
#F l;; k b'' a' h' ==
k b a h;; ((inv_from_iso (k b a0 h0);; #F l0'');; k b'' a0'' h0'')).
intros a h a'' h'' l.
intro alpha.
set (m := fH^-i (iso_comp h0 (iso_inv_from_iso h))).
set (m' := fH^-i (iso_comp h0'' (iso_inv_from_iso h''))).
assert (sss : iso_comp (functor_on_iso _ _ F _ _ m) (k b a h) == k b a0 h0).
apply eq_iso.
apply (q b (tpair _ a0 h0) (tpair _ a h) m); simpl.
inv_functor fH a0 a.
rewrite <- assoc.
rewrite iso_after_iso_inv.
apply id_right.
assert (ssss : iso_comp (functor_on_iso _ _ F _ _ m') (k b'' a'' h'') ==
k b'' a0'' h0'').
apply eq_iso. apply (q b'' (tpair _ a0'' h0'') (tpair _ a'' h'') m').
simpl; inv_functor fH a0'' a''.
rewrite <- assoc.
rewrite iso_after_iso_inv.
apply id_right.
assert (sssss : #H (l0'' ;; m') == #H (m ;; l)).
rewrite functor_comp.
unfold m'. simpl.
inv_functor fH a0'' a''.
unfold l0''.
inv_functor fH a0 a0''.
pathvia (h0 ;; (f ;; f') ;; (inv_from_iso h0'' ;; h0'') ;; inv_from_iso h'').
repeat rewrite assoc; apply idpath.
rewrite iso_after_iso_inv, id_right, functor_comp.
inv_functor fH a0 a.
repeat rewrite <- assoc.
apply maponpaths, pathsinv0, iso_inv_on_right.
repeat rewrite assoc.
apply iso_inv_on_left, pathsinv0.
repeat rewrite <- assoc.
apply alpha.
assert (star5 : inv_from_iso m ;; l0'' == l ;; inv_from_iso m').
apply iso_inv_on_right.
rewrite assoc.
apply iso_inv_on_left.
apply (equal_transport_along_weq _ _ (weq_from_fully_faithful fH a0 a'' )).
apply pathsinv0, sssss.
set (sss':= base_paths _ _ sss); simpl in sss'.
assert (sss'' : k b a h ;; inv_from_iso (k b a0 h0) ==
inv_from_iso (functor_on_iso _ _ F _ _ m)).
apply pathsinv0, iso_inv_on_left, pathsinv0, iso_inv_on_right.
unfold m; simpl.
apply pathsinv0, sss'.
repeat rewrite assoc.
rewrite sss''. clear sss'' sss' sss.
rewrite <- functor_on_inv_from_iso.
rewrite <- functor_comp.
rewrite star5. clear star5 sssss.
rewrite functor_comp, functor_on_inv_from_iso.
assert (star4 :
inv_from_iso (functor_on_iso A C F a0'' a'' m');; k b'' a0'' h0''
== k b'' a'' h'' ).
apply iso_inv_on_right, pathsinv0, (base_paths _ _ ssss).
rewrite <- assoc.
rewrite star4.
apply idpath.
assert (HGff' : G (f ;; f') ==
inv_from_iso (k b a0 h0) ;; #F l0'' ;; k b'' a0'' h0'').
set (Gbrtilde :=
tpair _ (inv_from_iso (k b a0 h0) ;; #F l0'' ;; k b'' a0'' h0'') PR2 :
Y b b'' (f ;; f')).
rewrite <- (pr2 (Y_iscontr b b'' (f ;; f')) Gbrtilde).
apply idpath.
clear PR2.
rewrite HGf, HGf'.
pathvia (inv_from_iso (k b a0 h0);; #F l0;; (k b' a0' h0';;
inv_from_iso (k b' a0' h0'));; #F l0';; k b'' a0'' h0'').
rewrite iso_inv_after_iso, id_right.
rewrite HGff'.
repeat rewrite <- assoc.
apply maponpaths.
rewrite <- L.
rewrite functor_comp.
repeat rewrite <- assoc.
apply idpath.
repeat rewrite <- assoc.
apply idpath.
Qed.
(** We call the functor [GG] ... *)
Definition GG : [B, C] := tpair _ preimage_functor_data
is_functor_preimage_functor_data.
(** ** [G] is the preimage of [F] under [ _ O H] *)
(** Given any [a : A], we produce an element in [X (H a)], whose
first component is [F a].
This allows to prove [G (H a) == F a]. *)
Lemma qF (a0 : A) :
forall (t t' : total2 (fun a : A => iso (H a) (H a0)))
(f : pr1 t --> pr1 t'),
#H f;; pr2 t' == pr2 t ->
#F f;; #F (fH^-1 (pr2 t')) ==
#F (fH^-1 (pr2 t)).
Proof.
simpl.
intros [a h] [a' h'] f L.
simpl in L; simpl.
rewrite <- functor_comp.
apply maponpaths.
apply (equal_transport_along_weq _ _ (weq_from_fully_faithful fH a a0)
(f;; fH^-1 h') (fH^-1 h) ).
inv_functor fH a a0.
rewrite functor_comp.
inv_functor fH a' a0.
apply L.
Qed.
Definition kFa (a0 : A) : forall a : A,
iso (H a) (H a0) -> iso (F a) (F a0) :=
fun (a : A) (h : iso (H a) (H a0)) =>
functor_on_iso A C F a a0
(iso_from_fully_faithful_reflection fH a a0 h).
Definition XtripleF (a0 : A) : X (H a0) :=
tpair _ (tpair _ (F a0) (kFa a0)) (qF a0).
Lemma phi (a0 : A) : pr1 (pr1 (GG O H)) a0 == pr1 (pr1 F) a0.
Proof.
exact (!Xphi _ (XtripleF a0)).
Defined.
Lemma extphi : pr1 (pr1 (GG O H)) == pr1 (pr1 F).
Proof.
apply funextsec.
apply phi.
Defined.
(** Now for the functor as a whole. It remains to prove
equality on morphisms, modulo transport. *)
Lemma is_preimage_for_pre_composition : GG O H == F.
Proof.
apply (functor_eq _ _ (GG O H) F).
apply (total2_paths extphi).
apply funextsec; intro a0;
apply funextsec; intro a0';
apply funextsec; intro f.
rewrite transport_of_functor_map_is_pointwise.
unfold extphi.
rewrite toforallpaths_funextsec.
rewrite <- idtoiso_postcompose.
rewrite <- idtoiso_precompose.
rewrite idtoiso_inv.
rewrite <- assoc.
assert (PSIf : forall (a : A) (h : iso (H a) (H a0)) (a' : A)
(h' : iso (H a') (H a0')) (l : a --> a'),
#H l;; h' == h;; #H f ->
#F l;; k (H a0') a' h' ==
k (H a0) a h;;
((idtoiso (phi a0);; #F f);; inv_from_iso (idtoiso (phi a0')))).
intros a h a' h' l alpha.
rewrite assoc.
apply iso_inv_on_left.
unfold phi.
repeat rewrite assoc.
rewrite (Xkphi_idtoiso (H a0) (XtripleF a0)).
repeat rewrite <- assoc.
rewrite (Xkphi_idtoiso (H a0') (XtripleF a0')).
simpl.
assert (HH4 : fH^-1 h ;; f == l ;; fH^-1 h').
apply (equal_transport_along_weq _ _ (weq_from_fully_faithful fH a a0')).
simpl; repeat rewrite functor_comp.
inv_functor fH a a0.
inv_functor fH a' a0'.
apply pathsinv0, alpha.
pathvia (#F (fH^-1 h;; f)).
rewrite functor_comp.
apply idpath.
rewrite HH4.
rewrite functor_comp.
apply idpath.
set (Ybla := tpair _ (idtoiso (phi a0) ;; #F f ;; inv_from_iso (idtoiso (phi a0')))
PSIf : Y _ _ (#H f)).
set (Ycontr := pr2 (Y_iscontr _ _ (#(pr1 H) f)) Ybla).
set (Ycontr2 := base_paths _ _ Ycontr); simpl in *.
change (G (#H f)) with (G (#(pr1 H) f)).
rewrite <- Ycontr2.
repeat rewrite assoc.
rewrite iso_after_iso_inv, id_left.
repeat rewrite <- assoc.
rewrite iso_after_iso_inv, id_right.
apply idpath.
Qed.
End preimage.
End essentially_surjective.
(** * Precomposition with an ess. surj. and f. f. functor is ess. surj. *)
(** Abstracting from [F] by closing the previous section,
we can prove essential surjectivity of [_ O H]. *)
Lemma pre_composition_essentially_surjective :
essentially_surjective (pre_composition_functor A B C H).
Proof.
intros F p' f.
apply f.
exists (GG F).
apply idtoiso.
apply is_preimage_for_pre_composition.
Qed.
End precomp_w_ess_surj_ff_is_ess_surj.