-
Notifications
You must be signed in to change notification settings - Fork 2
/
sheaf_def_and_thm.v
1190 lines (1069 loc) · 52.9 KB
/
sheaf_def_and_thm.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
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* -*- coq-prog-args: ("-emacs" "-indices-matter" "-type-in-type") -*- *)
Require Import HoTT HoTT.hit.Truncations Connectedness.
Require Export Utf8_core.
Require Import Forall_.
Require Import epi_mono reflective_subuniverse modalities.
Require Import sheaf_base_case.
Set Universe Polymorphism.
Global Set Primitive Projections.
Local Open Scope path_scope.
(* Local Open Scope equiv_scope. *)
Local Open Scope type_scope.
(* Readability *)
Arguments trunc_arrow {H} {A} {B} {n} H0: simpl never.
Arguments trunc_sigma {A} {P} {n} H H0: simpl never.
Arguments istrunc_paths {A} {n} H x y: simpl never.
Section Definitions.
Context `{ua: Univalence}.
Context `{fs: Funext}.
Parameter n0 : trunc_index.
Definition n := trunc_S n0.
Parameter mod_nj : Modality n.
Definition nj := underlying_subu n mod_nj.
(* The following two parameters are the hypothesis 26 *)
Parameter j_is_nj : forall P, trunctype_type (j P) = trunctype_type (@st _ _ (O nj (@BuildTruncType _ P (@trunc_leq -1 n tt _ _)))).
Parameter j_is_nj_unit : forall P x ,
transport idmap (j_is_nj P) (Oj_unit P x) = O_unit nj (@BuildTruncType _ P (@trunc_leq -1 n tt _ _)) x.
Parameter islex_mod_nj : IsLex mod_nj.
Definition islex_nj := islex_to_hfibers_preservation mod_nj islex_mod_nj.
Definition lex_compat := islex_to_hfibers_preservation_compat mod_nj islex_mod_nj.
Definition J :=
(* pr1 (nchar_to_sub (pr1 o Oj)). *)
{P : hProp & j P}.
Definition Oj_J_Contr (χ:J) : Contr (j χ.1).
apply BuildContr with (center := χ.2).
intro. apply path_ishprop.
Defined.
Definition nJ := {T : TruncType n & (O nj T)}.
(* Definition 18, for subobjects seen as a characteristic function [χ : E -> TruncType n], or as n-fibered functions *)
Definition closed {E} (χ : E -> TruncType n) := forall e, IsEquiv (nj.(O_unit) (χ e)).
(* Definition closed' E A (m : {f : A -> E & forall b:E, IsTrunc n (hfiber f b)}) := closed (nsub_to_char n (A;m)). *)
Definition cloture {E} (χ : E -> TruncType n) : E -> TruncType n := nj.(O) o χ.
(* Definition cloture' E A (m : {f : A -> E & forall b:E, IsTrunc n (hfiber f b)}) := *)
(* nchar_to_sub (cloture (nsub_to_char n (A;m))). *)
(* Proofs that the the closure of a subobject is closed *)
Definition cloture_is_closed {E :Type} (χ : E -> TruncType n) : closed (cloture χ).
intro. apply O_modal_equiv. exact fs.
Defined.
(* Lemma cloture_is_closed' (A:Type) (E:Type) (m : {f : A -> E & forall e:E, IsTrunc n (hfiber f e)}) : closed' (pr2 (cloture' m)). *)
(* unfold closed', cloture'. *)
(* rewrite (eta_sigma (nchar_to_sub (cloture (nsub_to_char n (A; m))))). *)
(* pose (f := cloture_is_closed (nsub_to_char n (A; m))). *)
(* rewrite <- (@nsub_eq_char_retr ua fs n _ (cloture (nsub_to_char n (A; m)))) in f. *)
(* exact f. *)
(* Defined. *)
Definition incl_Aeq_Eeq {E:Type} (χ:E -> TruncType n) (x:{e:E & χ e})
: {e':{e:E & χ e} & x.1 = e'.1} -> {e':E & x.1 = e'}
:= λ X, (X.1.1;X.2).
Definition eq_dense_1 {E:Type} (χ:E -> TruncType n) (x:{e:E & χ e})
: {e':{e:E & χ e} & x.1 = e'.1} <~> (χ x.1).
exists (λ X:(∃ e' : ∃ e : E, χ e, x.1 = e'.1), (transport (λ u, χ u) (X.2)^ X.1.2)).
apply isequiv_adjointify with (g := (λ X, ((x.1;X);1)) : ((χ x.1) -> {e':{e:E & χ e} & x.1 = e'.1})).
- intro u. reflexivity.
- intro u. destruct u as [[e' e] p]. simpl in *. destruct p. simpl. reflexivity.
Defined.
Definition is_dense_eq {E:Type} (char : E -> TruncType n) := forall e:E, ({e':E & e=e'}) = O nj (char e).
Definition is_dense_diag {E:Type} (char : E -> TruncType n) (dense_eq : is_dense_eq char)
:= forall x:{e:E & char e}, forall u:{e':{e:E & char e} & x.1 = e'.1}, (equiv_path _ _ (dense_eq x.1)) o (incl_Aeq_Eeq char x) = (O_unit nj _) o ((eq_dense_1 char x)).
(* For A a subobject of E, and x:A, this diagram commute : *)
(* *)
(* {e':A & x.1 = e'.1} === (χ x.1).1 *)
(* | | *)
(* ι | | η *)
(* | | *)
(* v v *)
(* {e':E & x.1 = e'} === (O nj (χ x.1)).1.1 *)
(* Definition 19 *)
Record EnJ (E:Type) :=
{
char :> E -> TruncType n ;
dense_eq : forall e:E, ({e':E & e=e'}) = (O nj (char e))
}.
Arguments char {E} χ e: rename.
Arguments dense_eq {E} χ e: rename.
Definition dense_diag {E:Type} (char : EnJ E)
: forall x:{e:E & char e}, forall u:{e':{e:E & char e} & x.1 = e'.1}, (equiv_path _ _ (dense_eq char x.1)) o (incl_Aeq_Eeq char x) = (O_unit nj _) o ((eq_dense_1 char x)).
intros x u.
apply path_forall; intro z.
assert (Contr (O nj (char x.1))).
{ rewrite <- dense_eq. exists (x.1;1). intros [y q]. destruct q. reflexivity. }
apply (path_contr).
Qed.
Definition witness_is_eta {E:Type} (χ:EnJ E) (x:{e:E & χ e})
: transport idmap (dense_eq χ x .1) (x .1; 1) = O_unit nj (χ x .1) x.2
:= ap10 (dense_diag χ x (x;1)) (x;1).
Definition EnJ_is_nJ {E:Type} (χ : EnJ E)
: forall e:E, (O nj (χ e))
:= λ e, transport (λ T, T) (dense_eq χ e) (e;idpath).
Definition dense_eta_equal {E:Type} (χ : EnJ E) (x:E) : forall (v w:χ x), O_unit nj (χ x) v = O_unit nj (χ x) w.
intros v w.
assert (forall (a b:(∃ e' : E, x = e')), a=b).
intros a b.
destruct a as [a p], b as [b q]. simpl.
apply @path_sigma' with (p := p^@q).
destruct p. destruct q. simpl. reflexivity.
rewrite (dense_eq χ) in X; apply X.
Defined.
(* Definition 20, for (-1)-subobjects *)
Definition E_to_χmono_map (T:TruncType (trunc_S n)) {E} (χ : E -> J) (f : E -> T) :
{x:E & (χ x).1} -> T := f o pr1.
Arguments E_to_χmono_map T {E} χ f _.
(* Definition 20, for n-subobjects *)
Definition E_to_χ_map (T:TruncType (trunc_S n)) {E} (χ : EnJ E) (f : E -> T) :
{x:E & χ x} -> T := f o pr1.
(* Definition 21 *)
Definition separated T := ∀ E (χ : EnJ E), IsMono (E_to_χ_map T (E:=E) χ).
(* Definition 22 *)
Definition Snsheaf_struct T := (separated T) /\ (∀ E (χ : E -> J), IsEquiv (E_to_χmono_map T (E:=E) (χ))).
Definition SnType_j_Type := {T : TruncType (trunc_S n) & Snsheaf_struct T}.
Definition separated_is_HProp T : IsHProp (separated T).
repeat (apply trunc_forall).
Defined.
Definition Snsheaf_struct_is_HProp T : IsHProp (Snsheaf_struct T).
apply trunc_prod.
Defined.
(* If T is a n-Type, then if T is a n-sheaf, then T is also a (S n)-sheaf *)
Lemma nsheaf_to_Snsheaf (T:TruncType (trunc_S n)) (Trn : IsTrunc n T) (nsheaf : IsSubu _ nj (@BuildTruncType n T Trn))
: Snsheaf_struct T.
split.
{ intros E χ u v.
simple refine (isequiv_adjointify _ _ _ _).
- unfold E_to_χ_map; simpl; intro p.
apply path_forall; intro x.
destruct χ as [χ χeq χdiag]. simpl in *.
pose proof (transport idmap (χeq x) (x;1)). simpl in X.
revert X.
transparent assert (modal_family : (subuniverse_Type nj)).
{ simple refine (Build_subuniverse_Type _ nj (BuildTruncType _ (u x = v x)) _).
apply istrunc_paths. apply trunc_succ. exact Trn.
exact (subuniverse_paths _ nj (Build_subuniverse_Type _ nj (@BuildTruncType _ T Trn) nsheaf) (u x) (v x)). }
apply (O_rec _ nj (χ x) modal_family); unfold modal_family; clear modal_family.
intro xx; simpl.
exact (ap10 p (x;xx)).
- intro p. simpl. unfold E_to_χ_map in *; simpl in *.
apply (@equiv_inj _ _ _ (isequiv_apD10 _ _ _ _)).
apply path_forall; intro x.
pose (rew := @ap10_ap_precompose); unfold ap10 in rew; rewrite rew; clear rew.
unfold ap10 at 1, path_forall at 1; rewrite eisretr. simpl.
assert (χdiag := dense_diag χ).
destruct χ as [χ χeq]. simpl in *.
specialize (χdiag x (x;1)).
unfold incl_Aeq_Eeq in χdiag.
apply ap10 in χdiag.
specialize (χdiag (x;1)). simpl in χdiag.
rewrite χdiag.
match goal with
|[|- O_rec _ _ _ ?X _ _ = _] => set (sheaf := X) end.
exact (ap10 (O_rec_retr _ _ (χ x.1) sheaf (λ xx : (χ x.1), ap10 p (x.1; xx))) x.2).
- intro p. destruct p. simpl.
match goal with
|[|- path_forall u u ?X = _] => assert (X=(λ _, 1)) end.
{ apply path_forall; intro x. rewrite O_rec_const. reflexivity. }
rewrite X. apply path_forall_1. }
{ intros E χ.
simple refine (isequiv_adjointify _ _ _ _).
- intros f x.
unfold J in χ; simpl in *.
assert (p := transport idmap (j_is_nj (χ x).1) (χ x).2).
revert p. simpl. apply (O_rec _ nj _ (Build_subuniverse_Type _ nj (@BuildTruncType _ T Trn) nsheaf)).
intros xx. simpl in *.
exact (f (x;xx)).
- intro f. apply path_forall; intro x; simpl in *.
unfold E_to_χmono_map; simpl.
assert ((χ x.1).2 = (Oj_unit (χ x.1).1 x.2)) by apply path_ishprop.
rewrite X.
transparent assert (TrH: (IsTrunc n ((λ x : E, (χ x).1) x.1))).
intros x0 y. apply (@trunc_leq -1 n). exact tt. exact (istrunc_trunctype_type _).
path_via (O_rec n nj
{|
trunctype_type := (χ x.1).1;
istrunc_trunctype_type := _ |}
{|
st := {| trunctype_type := T; istrunc_trunctype_type := Trn |};
subu_struct := nsheaf |}
(λ xx : (χ x.1).1, f (x.1;xx))
(O_unit nj {|
trunctype_type := (χ x.1).1;
istrunc_trunctype_type := _ |}
x.2)).
apply ap. exact (j_is_nj_unit (χ x.1).1 x.2).
exact (ap10 (O_rec_retr _ _ {| trunctype_type := (χ x.1).1; istrunc_trunctype_type := TrH |}
{|
st := {| trunctype_type := T; istrunc_trunctype_type := Trn |};
subu_struct := nsheaf |}
(λ xx : ((χ x.1).1), f (x.1; xx)))
x.2).
- intro f.
apply path_forall; intro x.
assert (p := transport idmap (j_is_nj (χ x).1) (χ x).2).
revert p. simpl.
transparent assert (sheaf : (subuniverse_Type nj)).
{ simple refine (Build_subuniverse_Type n nj
(BuildTruncType _ (O_rec n nj
{|
trunctype_type := (χ x).1;
istrunc_trunctype_type := _ |}
{|
st := {| trunctype_type := T; istrunc_trunctype_type := Trn |};
subu_struct := nsheaf |}
(λ xx : (χ x).1, E_to_χmono_map T χ f (x; xx))
(transport (λ x0 : Type, x0) (j_is_nj (χ x).1) (χ x).2) =
f x)) _). }
apply (O_rec _ _ _ sheaf).
unfold sheaf; clear sheaf. simpl. intro xx.
pose (j_is_nj_unit (χ x).1 xx).
assert ((χ x).2 = (Oj_unit (χ x).1 xx)) by apply path_ishprop.
rewrite X.
transparent assert (TrH: (IsTrunc n ((λ x : E, (χ x).1) x))).
intros x0 y. apply (@trunc_leq -1 n). exact tt. exact (istrunc_trunctype_type _).
path_via (O_rec n nj
{|
trunctype_type := (χ x).1;
istrunc_trunctype_type := _|}
{|
st := {| trunctype_type := T; istrunc_trunctype_type := Trn |};
subu_struct := nsheaf |}
(λ xx0 : (χ x).1, E_to_χmono_map T χ f (x; xx0))
(O_unit nj
{|
trunctype_type := (χ x).1;
istrunc_trunctype_type := _|} xx)).
apply ap; exact p.
exact (ap10 (O_rec_retr _ nj {| trunctype_type := (χ x).1; istrunc_trunctype_type := TrH |} {|
st := {| trunctype_type := T; istrunc_trunctype_type := Trn |};
subu_struct := nsheaf |} (λ xx0 : (χ x).1, E_to_χmono_map T χ f (x; xx0))) xx). }
Defined.
Definition nj_inter_f (A : TruncType n) (φ : A -> TruncType n) :
(O nj (BuildTruncType _ {a:A & φ a})) ->
(O nj (BuildTruncType _ {a:A & (O nj (φ a))}))
:= function_lift _
nj
(BuildTruncType _ {a:A & φ a})
(BuildTruncType _ {a:A & (O nj (φ a))})
(λ X, (X.1;nj.(O_unit) _ X.2)).
Definition nj_inter_g (A : TruncType n) (φ : A -> TruncType n) :
(O nj (BuildTruncType _ {a:A & (O nj (φ a))})) ->
(O nj (BuildTruncType _ {a:A & φ a})).
Proof.
apply O_rec. intro X.
generalize X.2. apply O_rec; intro φa.
apply nj.(O_unit). exact (X.1;φa).
Defined.
Instance nj_inter_equiv (A : TruncType n) (φ : A -> TruncType n) : IsEquiv (nj_inter_f A φ).
apply (isequiv_adjointify _ (nj_inter_g A φ)).
- intro x. unfold nj_inter_f, nj_inter_g. simpl in *.
transitivity (function_lift n nj
(BuildTruncType _ {a:A & φ a})
(BuildTruncType _ {a:A & (O nj (φ a))})
(λ X : ∃ a : A, φ a,
(X.1;
O_unit nj
(default_TruncType n (φ X.1) (istrunc_trunctype_type (φ X.1))) X.2))
(O_rec n nj
(BuildTruncType _ {a:A & (O nj (φ a))})
(O nj
(BuildTruncType _ {a:A & φ a}))
(λ X : (BuildTruncType _ {a:A & (O nj (φ a))}),
(function_lift n nj (φ X.1) (BuildTruncType _ {a:A & φ a}) (λ b, (X.1;b)))
X .2) x)
); auto with path_hints.
pose (foo := ap10 (reflect_factoriality_pre n nj
(BuildTruncType _ {a:A & (O nj (φ a))})
(((O nj
(BuildTruncType _ {a:A & φ a}))))
(((O nj
(BuildTruncType _ {a:A & (O nj (φ a))}))))
(function_lift n nj
(BuildTruncType _ {a:A & φ a})
(BuildTruncType _ {a:A & (O nj (φ a))})
(λ X : (BuildTruncType _ {a:A & φ a}), (X .1; O_unit nj (φ X .1) X .2)))
((λ X : (BuildTruncType _ {a:A & (O nj (φ a))}),
function_lift n nj (φ X .1)
(BuildTruncType _ {a:A & φ a}) (λ b : φ X.1, (X.1; b))
X .2))) x
).
etransitivity; try exact foo. clear foo.
transitivity (
O_rec n nj
(BuildTruncType _ {a:A & (O nj (φ a))})
(O nj
(BuildTruncType _ {a:A & (O nj (φ a))}))
(λ x0 :(BuildTruncType _ {a:A & (O nj (φ a))}),
function_lift n nj (φ x0 .1)
(BuildTruncType _ {a:A & (O nj (φ a))})
(λ x : (φ x0 .1), (x0 .1; O_unit nj (φ x0 .1) x))
x0 .2) x
).
apply (ap (λ u, O_rec n nj
(BuildTruncType _ {a:A & (O nj (φ a))})
(O nj
(BuildTruncType _ {a:A & (O nj (φ a))})) u x)).
apply path_forall; intro x0.
exact (ap10 (reflect_functoriality
n nj
(φ x0 .1)
(BuildTruncType _ {a:A & (φ a)})
(BuildTruncType _ {a:A & (O nj (φ a))})
(λ X, (X .1; O_unit nj (φ X .1) X .2))
(λ b : (φ x0 .1), (x0 .1; b))) x0.2
).
exact (ap10 (O_rec_O_rec_dep_sect n nj
(BuildTruncType _ {a:A & (O nj (φ a))})
(λ a, (φ a.1))
(λ u, λ v, (u.1;v))
(λ u, u.2)
(λ a, eta_sigma a)) x); simpl in foo.
- intro x. unfold nj_inter_f, nj_inter_g. simpl.
pose (foo := ap10 (reflect_factoriality_post n nj
(BuildTruncType _ {a:A & (φ a)})
(BuildTruncType _ {a:A & (O nj (φ a))})
(O nj
(BuildTruncType _ {a:A & (φ a)}))
(λ X : (BuildTruncType _ {a:A & (O nj (φ a))}),
O_rec n nj (φ X .1)
(O nj
(BuildTruncType _ {a:A & (φ a)}))
(λ φa : (φ X .1),
O_unit nj
(BuildTruncType _ {a:A & (φ a)})
(X .1; φa)) X .2)
(λ X,
(X .1; O_unit nj (φ X .1) X .2)))
x
).
etransitivity; try exact foo. clear foo.
apply (ap10 (O_rec_O_rec_dep_retr n nj
(BuildTruncType _ {a:A & (φ a)})
(λ a, (φ a .1))
(λ a b, (a.1;b))
(λ a, a.2)
(λ a, eta_sigma a))
x).
Defined.
Definition nj_inter (A : TruncType n) (φ : A -> TruncType n) :
O nj (BuildTruncType n {a:A & (φ a)}) =
O nj (BuildTruncType n {a:A & (O nj (φ a))}).
Proof.
apply unique_subuniverse.
apply path_trunctype.
exact (BuildEquiv _ _ _ (nj_inter_equiv _ _)).
Defined.
(** Put that elsewhere *)
Lemma istruncmap_compose n {A B C:Type} (f:A -> B) (g: B -> C)
: IsTruncMap n f -> IsTruncMap n g -> IsTruncMap n (g o f).
Proof.
intros Hf Hg.
intro x.
simple refine (trunc_equiv' _ (hfiber_compose f g x)^-1).
Defined.
Instance istruncmap_charn n {B:Type} (P: B -> TruncType n)
: IsTruncMap n (pr1: sig P -> B).
Proof.
intro b. unfold hfiber.
simple refine (@trunc_equiv (P b) _ (λ x:P b, ((b;x);1)) _ _ _).
simple refine (isequiv_adjointify _ _ _ _).
exact (fun X => transport (λ b, P b) (X.2) (X.1.2)).
intros [[b' P'] eqb']; cbn in *. destruct eqb'.
reflexivity.
intro x; reflexivity.
Defined.
Lemma hfiber_compose_mono {A B C:Type} (f : A -> B) (g : B -> C) (Mg: IsMono g) b
: hfiber f b <~> hfiber (g o f) (g b).
Proof.
simple refine (equiv_adjointify _ _ _ _).
- intros [x p]. exact (x; ap g p).
- intros [x p]. exact (x; (equiv_inv (IsEquiv := Mg (f x) b)) p).
- intros [x p]. simple refine (path_sigma' _ 1 _); cbn.
apply eisretr.
- intros [x p]. simple refine (path_sigma' _ 1 _); simpl.
apply eissect.
Defined.
(*********)
(* Lemma 24 *)
Definition nj_fibers_compose A B C (f : A -> B) (g : B -> C) (c : C)
(HB : IsTruncMap n f) (HC : IsTruncMap n g)
:
O nj (@BuildTruncType _ (hfiber (g o f) c) (istruncmap_compose n f g HB HC c)) =
O nj (BuildTruncType _ { w : hfiber g c & O nj (BuildTruncType _ (hfiber f w.1))}).
Proof.
etransitivity; [exact (ap (O nj) (@path_trunctype ua n (@BuildTruncType _ (hfiber (λ x : A, g (f x)) c) (istruncmap_compose n f g HB HC c)) _ (hfiber_compose f g c)))| cbn].
apply unique_subuniverse. unfold default_TruncType.
exact (ap (@st n nj) (nj_inter (@BuildTruncType _ (hfiber g c) (HC c)) (fun w => (@BuildTruncType _ (hfiber f w .1) (HB w.1))))).
Defined.
Definition type_j_f {E} (χ: E -> J)
: (E -> subuniverse_Type nj) -> {e:E & (χ e).1} -> subuniverse_Type nj
:= λ α e, α (pr1 e).
Definition type_j_inv {E} (χ: E -> J) : ({e:E & (χ e).1} -> subuniverse_Type nj) -> E -> subuniverse_Type nj.
Proof.
intros α e.
apply (O nj).
pose (m := pr1 : {e:E & (χ e).1} -> E).
pose (f := pr1 : {e: (∃ e : E, (χ e).1) & (α e)} -> (∃ e : E, (χ e).1)).
assert (IsTruncMap n (m o f)).
apply istruncmap_compose. apply istruncmap_charn.
intro x. exact (@trunc_leq -1 n tt _ (istruncmap_charn -1 (pr1 o χ) x)).
exact (BuildTruncType _ (hfiber (λ x : ∃ e : ∃ e : E, (χ e).1, α e, m (f x)) e)).
Defined.
Definition inter_symm E (χ φ : E -> Type) x :
hfiber (λ t : {b : {b : E & χ b} & φ (pr1 b)}, pr1 (pr1 t)) x <~>
hfiber (λ t : {b : {b : E & φ b} & χ (pr1 b)}, pr1 (pr1 t)) x.
unfold hfiber. cbn.
simple refine (equiv_functor_sigma' _ _).
simple refine (equiv_adjointify _ _ _ _).
- intros [[a b] c]. exact ((a;c);b).
- intros [[a b] c]. exact ((a;c);b).
- intros a. reflexivity.
- intros a. reflexivity.
- intros [[a b] c]; apply equiv_idmap.
Defined.
(* Proposition 23, sheaf part *)
Instance nTjTiSnTjT_eq E (χ : E -> J) : IsEquiv (λ (f : E -> subuniverse_Type nj) (t : {b : E & pr1 ((χ b))}), f (pr1 t)).
apply (isequiv_adjointify _ (type_j_inv (E:=E) χ)).
- intro φ.
unfold type_j_inv. simpl.
apply path_forall; intro x.
rewrite (O_modal n nj (φ x)).
apply ap.
apply path_trunctype. cbn.
etransitivity; [| exact (equiv_inverse (hfiber_fibration x (trunctype_type o (@st n nj) o φ)))].
symmetry. apply (hfiber_compose_mono pr1 pr1).
intros X Y.
apply isequiv_pr1_path_hprop.
- intro φ.
unfold type_j_inv. simpl.
apply path_forall; intro x.
rewrite (O_modal n nj (φ x)).
assert (Tr1: IsTruncMap n (λ x0 : ∃ e : ∃ e : E, φ e, (χ e.1).1, (x0.1).1)).
simple refine (istruncmap_compose n pr1 pr1 _ _).
intro e; exact (@trunc_leq -1 n tt _ (istruncmap_charn -1 (λ t, (χ t.1).1) e)).
match goal with
|[|- O nj ?XX = _] =>
path_via (O nj (@BuildTruncType _ (hfiber (λ x0 : ∃ e : ∃ e : E, (φ e), (χ e.1).1, x0.1.1) x) (istruncmap_fiber x)))
end.
apply ap.
apply path_trunctype. cbn.
exact (inter_symm _ (fun b => (χ b).1) (fun b => φ b) x).
pose (X := nj_fibers_compose (∃ e : ∃ e : E, φ e, (χ e.1).1) {e:E & φ e} E pr1 pr1 x).
assert (HB : IsTruncMap n (λ s : ∃ e : ∃ e : E, φ e, (χ e.1).1, s.1)).
intro e. simple refine (@trunc_leq -1 n tt _ _).
assert (HC : IsTruncMap n
(λ s : ∃ e : E, φ e, let (proj1_sig, _) := s in proj1_sig)).
intro e. simple refine (istruncmap_charn _ _ _).
cbn in *.
specialize (X HB HC).
match goal with
|[|- O nj (@BuildTruncType _ _ ?foo) = _] => assert (rTr: istruncmap_compose n pr1 pr1 HB HC x = foo) by apply path_ishprop
end.
destruct rTr.
etransitivity; [exact X| clear X; cbn].
apply ap. apply path_trunctype. cbn.
eapply transitive_equiv.
apply equiv_sigma_contr.
intro a.
match goal with
|[|- Contr (trunctype_type (@st n nj (O nj (BuildTruncType _ ?foo))))]
=> pose (f:= j_is_nj (BuildTruncType -1 foo))
end.
match goal with
|[ f : _ = trunctype_type (@st n nj (O nj (@BuildTruncType _ _ ?foo))) |- Contr (trunctype_type (@st n nj (O nj (@BuildTruncType _ _ ?bar)))) ]
=> assert (foo = bar) by apply path_ishprop
end.
destruct X.
apply (transport (fun X => Contr X) f); cbn.
apply (transport (fun X => Contr (not (not X))) (path_universe_uncurried (hfiber_fibration a.1 (λ x, (χ x.1).1)))).
apply Oj_J_Contr.
apply equiv_path.
exact (path_universe_uncurried (hfiber_fibration x φ))^.
Defined.
Definition nTjTiseparated_eq_fun_univ {E:Type} {χ:EnJ E} {φ1 φ2}
(p: E_to_χ_map (@BuildTruncType _ (subuniverse_Type nj) (subuniverse_Type_is_TruncTypeSn n nj)) χ φ1 =
E_to_χ_map (@BuildTruncType _ (subuniverse_Type nj) _) χ φ2)
(x:E)
: (φ1 x) -> (φ2 x).
unfold E_to_χ_map in p.
generalize dependent (EnJ_is_nJ χ x).
simple refine (O_rec n nj (χ x) (Build_subuniverse_Type n nj (BuildTruncType _ (φ1 x -> φ2 x)) _) _).
intro v.
exact (transport (λ U, U) (ap (trunctype_type) (ap (@st n nj) (ap10 p (x;v))))).
Defined.
Lemma nTjTiseparated_eq_fun_univ_invol {E:Type} {χ:EnJ E} {φ1 φ2}
(p: E_to_χ_map (@BuildTruncType _ (subuniverse_Type nj) (subuniverse_Type_is_TruncTypeSn n nj)) χ φ1 =
E_to_χ_map (@BuildTruncType _ (subuniverse_Type nj) _) χ φ2)
(x:E)
: forall (y:φ2 x), nTjTiseparated_eq_fun_univ p x (nTjTiseparated_eq_fun_univ p^ x y) = y.
Proof.
intro y. unfold nTjTiseparated_eq_fun_univ; simpl.
unfold E_to_χ_map in p; simpl in *.
pose (foo := ap10 (ap10 (reflect_factoriality_arrow_space n nj
(χ x)
(φ1 x)
(φ2 x)
(λ v : (χ x),
transport idmap
(ap (trunctype_type) (ap (@st n nj) (ap10 p (x;v)))))
(λ v : (χ x),
transport idmap
(ap (trunctype_type) (ap (@st n nj) (ap10 p^ (x;v))))))
(EnJ_is_nJ χ x)) y
).
apply (transport (λ u, u = y) foo^). clear foo.
transitivity (O_rec n nj (χ x)
{|
st := {|
trunctype_type := φ2 x → φ2 x;
istrunc_trunctype_type := trunc_arrow
(istrunc_trunctype_type (φ2 x)) |};
subu_struct := subuniverse_arrow n nj (φ2 x) (φ2 x) |}
(λ (v : χ x) (x0 : φ2 x),
transport (λ x1 : Type, x1)
(ap trunctype_type (ap (@st n nj) (ap10 p (x; v))))
(transport (λ x1 : Type, x1)
(ap trunctype_type (ap (@st n nj) (ap10 p (x; v))))^ x0)) (EnJ_is_nJ χ x) y); auto with path_hints.
apply (ap (λ u, O_rec n nj (χ x)
{|
st := {|
trunctype_type := φ2 x → φ2 x;
istrunc_trunctype_type := trunc_arrow
(istrunc_trunctype_type (φ2 x)) |};
subu_struct := subuniverse_arrow n nj (φ2 x) (φ2 x) |}
u (EnJ_is_nJ χ x) y)).
funext v x0.
apply ap. apply (ap (λ U, transport idmap U x0)).
repeat rewrite <- ap_V. rewrite ap10_V. reflexivity.
pose (fooo := @transport_arrow_space_dep_path n nj fs (φ1 x) (φ2 x) (χ x) (λ v, (ap (trunctype_type) (ap (@st n nj) (ap10 p (x;v)))))).
simpl in fooo.
apply (transport (λ U, O_rec n nj (χ x)
{|
st := {|
trunctype_type := φ2 x → φ2 x;
istrunc_trunctype_type := trunc_arrow
(istrunc_trunctype_type (φ2 x)) |};
subu_struct := subuniverse_arrow n nj (φ2 x) (φ2 x) |}
U
(EnJ_is_nJ χ x) y = y) fooo^).
clear fooo; simpl.
rewrite O_rec_const; reflexivity.
Defined.
Definition nTjTiseparated_eq_inv (E:Type) (χ:EnJ E) φ1 φ2 :
(E_to_χ_map (@BuildTruncType _ (subuniverse_Type nj) (subuniverse_Type_is_TruncTypeSn n nj)) χ φ1 =
E_to_χ_map (@BuildTruncType _ (subuniverse_Type nj) _) χ φ2)
-> φ1 = φ2.
intro p.
simpl in *.
unfold E_to_χ_map in p; simpl in p.
apply path_forall; intro x.
apply unique_subuniverse; apply path_trunctype.
exists (nTjTiseparated_eq_fun_univ p x).
apply isequiv_adjointify with (g := nTjTiseparated_eq_fun_univ (inverse p) x).
- exact (nTjTiseparated_eq_fun_univ_invol p x).
- exact (transport (λ u, ∀ y : φ1 x, nTjTiseparated_eq_fun_univ (inverse p) x (nTjTiseparated_eq_fun_univ u x y) = y) (inv_V p) (nTjTiseparated_eq_fun_univ_invol (inverse p) x)).
Defined.
(* Proposition 23, separation part *)
Lemma nTjTiseparated_eq : separated (@BuildTruncType _ (subuniverse_Type nj) (@subuniverse_Type_is_TruncTypeSn _ nj ua)).
intros E χ φ1 φ2.
apply isequiv_adjointify with (g := @nTjTiseparated_eq_inv E χ φ1 φ2).
- intro p.
unfold E_to_χ_map in *; simpl in *.
apply (@equiv_inj _ _ _ (isequiv_apD10 _ _ (φ1 o (@pr1 _ (fun e => (χ e)))) (φ2 o pr1))).
apply path_forall; intro x.
unfold nTjTiseparated_eq_inv.
pose (r:= @ap10_ap_precompose); unfold ap10 in r; rewrite r; clear r.
unfold path_forall; rewrite eisretr.
apply (@equiv_inj _ _ (equiv_inv (IsEquiv := isequiv_unique_subuniverse _ _ _ _))). apply isequiv_inverse.
apply (@equiv_inj _ _ (equiv_inv (IsEquiv := isequiv_path_trunctype))). apply isequiv_inverse.
repeat rewrite eissect.
apply path_equiv; cbn.
unfold nTjTiseparated_eq_fun_univ, EnJ_is_nJ.
apply (transport (λ U, O_rec n nj _ {|
st := {|
trunctype_type := φ1 (let (proj1_sig, _) := x in proj1_sig)
→ φ2 (let (proj1_sig, _) := x in proj1_sig);
istrunc_trunctype_type := trunc_arrow
(istrunc_trunctype_type
(φ2
(let
(proj1_sig, _) := x in
proj1_sig))) |};
subu_struct := subuniverse_arrow n nj
(φ1 (let (proj1_sig, _) := x in proj1_sig))
(φ2 (let (proj1_sig, _) := x in proj1_sig)) |} _ U = _) ((witness_is_eta χ x)^)).
etransitivity;
[ exact (ap10 (O_rec_retr n nj (χ x.1) {|
st := {|
trunctype_type := φ1 (let (proj1_sig, _) := x in proj1_sig)
→ φ2 (let (proj1_sig, _) := x in proj1_sig);
istrunc_trunctype_type := trunc_arrow
(istrunc_trunctype_type
(φ2
(let
(proj1_sig, _) := x in
proj1_sig))) |};
subu_struct := subuniverse_arrow n nj
(φ1 (let (proj1_sig, _) := x in proj1_sig))
(φ2 (let (proj1_sig, _) := x in proj1_sig)) |}
(λ v : χ (let (proj1_sig, _) := x in proj1_sig),
transport (λ U : Type, U)
(ap trunctype_type
(ap (@st n nj) (ap10 p (let (proj1_sig, _) := x in proj1_sig; v)))))) x.2) |].
repeat apply ap. destruct x as [x1 x2]. reflexivity.
- intro p; destruct p.
unfold E_to_χ_map, nTjTiseparated_eq_inv in *; simpl in *.
eapply concat; [idtac | apply (path_forall_1 φ1)]; apply ap.
apply path_forall; intro x; simpl.
apply (@equiv_inj _ _ (equiv_inv (IsEquiv := isequiv_unique_subuniverse _ _ _ _))). apply isequiv_inverse.
apply (@equiv_inj _ _ (equiv_inv (IsEquiv := isequiv_path_trunctype))). apply isequiv_inverse.
repeat rewrite eissect.
apply path_equiv; cbn.
unfold transport, nTjTiseparated_eq_fun_univ; simpl.
exact (ap10 (O_rec_const n nj (χ x) {|
st := {|
trunctype_type := φ1 x → φ1 x;
istrunc_trunctype_type := trunc_arrow
(istrunc_trunctype_type (φ1 x)) |};
subu_struct := subuniverse_arrow n nj (φ1 x) (φ1 x) |} idmap) (EnJ_is_nJ χ x)).
Defined.
(* Proposition 23 *)
Lemma nType_j_Type_is_SnType_j_Type : Snsheaf_struct (@BuildTruncType _ (subuniverse_Type nj) (@subuniverse_Type_is_TruncTypeSn _ nj ua)).
Proof.
split.
apply nTjTiseparated_eq.
intros E χ. unfold E_to_χ_map; simpl.
exact (nTjTiSnTjT_eq _ _).
Defined.
Definition nType_j_Type_sheaf : SnType_j_Type :=
((@BuildTruncType _ (subuniverse_Type nj) (@subuniverse_Type_is_TruncTypeSn _ nj ua));nType_j_Type_is_SnType_j_Type).
(* Proposition 25, sheaf part *)
Instance dep_prod_SnType_j_Type_eq
(A : Type)
(B : A -> SnType_j_Type)
: forall (E:Type) (χ : E -> J) (H := λ a, (snd (pr2 (B a))) E χ),
IsEquiv (λ (f : E -> ∀ a : A, (B a).1) (t : {b : E & (χ b).1}), f (pr1 t)).
intros E χ H.
apply (isequiv_adjointify _ (λ g e a, (@equiv_inv _ _ _ (H a) (λ x, g x a) e))).
- intro φ.
apply path_forall; intro x.
apply path_forall; intro a.
destruct (H a) as [inv retr sect adj]; simpl in *.
clear adj; clear sect.
unfold Sect, E_to_χmono_map in retr.
specialize (retr (λ x, φ x a)).
exact (ap10 retr x).
- intro φ.
funext x a.
destruct (H a) as [inv retr sect adj]; simpl in *.
clear adj; clear retr.
unfold Sect, E_to_χ_map in sect.
specialize (sect (λ x, φ x a)).
exact (ap10 sect x).
Defined.
Definition dep_prod_SnType_j_Type_sep_inv
(A : Type)
(B : A -> SnType_j_Type)
(E : Type)
(χ : EnJ E)
(x y : E -> ∀ a : A, (B a).1)
: (λ (f : E -> ∀ a : A, (B a).1) (t : {b : E & (χ b)}),
f t .1) x =
(λ (f : E -> ∀ a : A, (B a).1) (t : {b : E & (χ b)}),
f t .1) y
-> x = y.
Proof.
intro H; simpl in H.
funext u a .
simple refine (@ap10 _ _ (λ u, x u a) (λ u, y u a) _ u).
pose ((fst (B a).2) E χ (λ v, x v a) (λ v, y v a)).
exact (equiv_inv (IsEquiv := i) (path_forall _ _ (λ t, apD10 ((apD10 H) t) a))).
Defined.
(* Proposition 25, separated part *)
Lemma dep_prod_SnType_j_Type_sep
(A : Type)
(B : A -> SnType_j_Type)
: forall (E:Type) (χ : EnJ E), IsMono
(λ (f : E -> ∀ a : A, (B a).1) (t : {b : E & χ b}), f (t.1)).
intros E χ.
unfold IsMono.
intros f g.
apply @isequiv_adjointify with (g := @dep_prod_SnType_j_Type_sep_inv A B E χ f g).
- unfold Sect.
intro p.
unfold dep_prod_SnType_j_Type_sep_inv.
unfold E_to_χ_map. simpl.
unfold equiv_inv.
pose (foo := path_forall_precompose (∃ b : E, χ b)
E
(∀ a : A, (B a).1)
pr1
f
g
(λ u : E,
path_forall (f u) (g u)
(λ a : A,
ap10
((let (equiv_inv, eisretr, eissect, _) :=
fst (B a) .2 E χ (λ v : E, f v a) (λ v : E, g v a) in
equiv_inv)
(path_forall (λ t : ∃ b : E, (χ b), f t .1 a)
(λ t : ∃ b : E, (χ b), g t .1 a)
(λ t : ∃ b : E, (χ b), apD10 (apD10 p t) a))) u))).
apply (transport (λ U, U=p) foo^); clear foo.
apply (@equiv_inj _ _ _ (isequiv_apD10 _ _ _ _)).
unfold ap10 at 1, path_forall at 1; rewrite eisretr.
apply path_forall; intro x.
apply (@equiv_inj _ _ _ (isequiv_apD10 _ _ _ _)); unfold path_forall at 1; rewrite eisretr.
apply path_forall; intro a.
pose (r := @ap10_ap_precompose (∃ b : E, χ b)
E
((B a).1)
pr1
(λ v, f v a)
(λ v, g v a)
((let (equiv_inv, eisretr, eissect, _) :=
fst (B a) .2 E χ (λ v : E, f v a) (λ v : E, g v a) in
equiv_inv)
(path_forall (λ t : ∃ b : E, (χ b), f t .1 a)
(λ t : ∃ b : E, (χ b), g t .1 a)
(λ t : ∃ b : E, (χ b), apD10 (apD10 p t) a)))
x);
unfold ap10 in r; rewrite <- r; clear r.
rewrite (@eisretr _ _ _ (fst (B a) .2 E χ (λ v : E, f v a) (λ v : E, g v a))).
unfold path_forall; rewrite eisretr.
reflexivity.
- intro v. unfold dep_prod_SnType_j_Type_sep_inv.
unfold E_to_χ_map. simpl.
destruct v. simpl.
etransitivity; [idtac | apply path_forall_1]; apply ap; apply path_forall; intro x.
etransitivity; [idtac | apply path_forall_1]; apply ap; apply path_forall; intro y.
assert ((apD10
((let (equiv_inv, eisretr, eissect, _) :=
fst (B y) .2 E χ (λ v : E, f v y) (λ v : E, f v y) in
equiv_inv)
(path_forall (λ t : ∃ b : E, χ b, f t .1 y)
(λ t : ∃ b : E, χ b, f t .1 y) (λ t : ∃ b : E, χ b, 1)))) = λ _, 1).
apply (@equiv_inj _ _ _ (isequiv_path_forall _ _)).
unfold path_forall. rewrite eissect.
apply (@equiv_inj _ _ _ (fst (B y) .2 E χ (λ v : E, f v y) (λ v : E, f v y))).
pose (foo := @eisretr _ _ _ (fst (B y) .2 E χ (λ v : E, f v y) (λ v : E, f v y))).
unfold Sect, equiv_inv in foo; simpl in foo.
rewrite foo.
unfold E_to_χ_map. simpl.
apply (@equiv_inj _ _ _ (isequiv_apD10 _ _ _ _)).
rewrite eisretr.
apply path_forall; intro t.
match goal with
|[|- _ = apD10 (ap _ ?X) _] => pose (ap10_ap_precompose (pr1 : ({e:E & χ e} -> E)) X) end. unfold ap10 in p; rewrite p.
unfold ap10; rewrite eisretr. reflexivity.
exact (apD10 X x).
Defined.
(* Proposition 25 *)
Definition dep_prod_SnType_j_Type
: forall A (B : A -> SnType_j_Type),
Snsheaf_struct (BuildTruncType _ (forall a, pr1 (B a))).
Proof.
intros. split.
exact (dep_prod_SnType_j_Type_sep _ _).
exact (dep_prod_SnType_j_Type_eq _ _).
Defined.
(* Definition of diagonals *)
Definition δ (T:TruncType (trunc_S n)) : T * T-> TruncType n.
intros x. exists (fst x = snd x). simple refine (istrunc_paths _ _ _).
Defined.
Definition Δ (T:TruncType (trunc_S n)) := {x:T*T & δ T x}.
Definition clδ (T:TruncType (trunc_S n)) := nj.(O) o (δ T).
Definition clΔ (T:TruncType (trunc_S n)) := {x:T*T & clδ T x}.
Lemma equal_hfibers (A B:Type) (r:A=B) (f g:A -> B) e (p : f = equiv_path _ _ r) (q : g = equiv_path _ _ r)
: {a:A & a = e} <~> {a:A & f a = g e}.
exists (λ x:(∃ a : A, a = e), (x.1 ; (ap f x.2) @ (ap10 (p@q^) e))).
destruct r.
assert (f=idmap).
apply path_forall; intro x. exact (ap10 p x).
destruct p. destruct q.
rewrite X. simpl.
apply @isequiv_adjointify with (g:= ( λ x, (x.1; x.2))).
- intro x. simpl. hott_simpl.
- intro x. simpl. hott_simpl.
Defined.
Lemma dicde_l {E:Type} (φ:E -> TruncType n) (A:={e:E & φ e}) (clA := {e:E & (O nj (φ e))}) (e:clA)
: (∃ rx : (O nj (φ e .1)),
rx =
e.2) =(∃ rx : (O nj (φ e .1)),
O_rec n nj (φ e .1) (O nj (O nj (φ e .1)))
(λ x : (φ e .1),
O_unit nj (O nj (φ e .1)) (O_unit nj (φ e .1) x)) rx =
O_unit nj (O nj (φ e .1)) e .2).
Proof.
apply path_universe_uncurried.
apply (@equal_hfibers
((O nj (φ e .1)))
((O nj (O nj (φ e .1))))
(ap (trunctype_type) (ap (@st n nj) ((O_invol_ n nj (φ e .1)))))
(O_rec n nj (φ e .1) (O nj (O nj (φ e .1)))
(λ x : (φ e .1), O_unit nj (O nj (φ e .1)) (O_unit nj (φ e .1) x)))
(O_unit nj (O nj (φ e .1)))
e.2).
- cbn.
etransitivity; [exact (O_rec_sect n nj (φ e .1) (O nj (O nj (φ e .1))) (O_unit nj _)) | apply OO_unit_idmap].
- apply OO_unit_idmap.
Defined.
Lemma dicde_ll
(E : Type)
(φ : E → TruncType n)
(A := ∃ e : E, (φ e) : Type)
(clA := ∃ e : E, O nj (φ e) : Type)
(a : ∃ e : E, O nj (φ e))
(x : ∃ π : (φ a .1), O_unit nj (φ a .1) π = a .2)
(π : ∃ π : (φ a .1), O_unit nj (φ a .1) π = a .2)
(π' : ∃ π : (φ a .1), O_unit nj (φ a .1) π = a .2)
: equiv_path _ _ (dicde_l φ a) (a .2; 1) =
(O_unit nj (φ a .1) π' .1;
islex_compat_func mod_nj (φ a .1) (O nj (φ a .1)) (O_unit nj (φ a .1)) _ π').
unfold dicde_l.
unfold path_universe_uncurried.
rewrite eisretr. simpl. hott_simpl.
apply @path_sigma' with (p := π'.2^). simpl. destruct π' as [b p]. simpl. destruct p. simpl.
unfold islex_compat_func. simpl.
apply ap10_O_retr_sect.
Defined.
Lemma dense_into_cloture_dense_eq {E:Type} (φ:E -> TruncType n) (A:={e:E & φ e}) (clA := {e:E & O nj (φ e)})
: is_dense_eq (λ e:clA, (BuildTruncType _ {π : φ e.1 & O_unit nj _ π = e.2})).
intro e.
assert (rew := ((islex_nj (φ e .1) (O nj (φ e .1)) (O_unit nj _) e.2) @ (dicde_l φ e)^)).
apply path_universe_uncurried.
apply (transport (λ U, (∃ e' : clA, e = e') <~> U) (islex_nj (φ e .1) (O nj (φ e .1)) (O_unit nj _) e.2)^).
apply (transport (λ U, (∃ e' : clA, e = e') <~> U) (dicde_l φ e)).
exists ((λ x:(∃ e' : clA, e = e'), existT (λ u, u = e.2) e.2 1)).
apply @isequiv_adjointify with (g:= (λ x:(∃ rx : ((O nj (φ e .1))), rx = e .2), ((e.1;x.1); path_sigma _ e (e.1;x.1) 1 x.2^))).
- intros [x p]. destruct p. reflexivity.
- intros [x p]. destruct p. simpl.
apply @path_sigma' with (p := eta_sigma _).
reflexivity.
Defined.
(** Put that elswhere *)
Lemma transport_equiv (A: Type) (f g:A -> Type) (x y: A) (p: x=y) (q: f x <~> g x)
: transport (λ a:A, f a <~> g a) p q
= (equiv_compose' (equiv_path _ _ (ap g p)) (equiv_compose' q (equiv_inverse (equiv_path _ _ (ap f p))))).
path_induction.
destruct q. apply path_equiv. reflexivity.
Defined.
(*****)
Lemma dense_into_cloture_dense_diag (E:Type) (φ:E -> TruncType n) (A:={e:E & φ e}) (clA := {e:E & (O nj (φ e))})
: is_dense_diag _ (dense_into_cloture_dense_eq φ).
intros x p.
unfold dense_into_cloture_dense_eq.
apply path_forall; intro y.
unfold path_universe_uncurried. rewrite eisretr.
simpl.
destruct x as [a x]. simpl in x. simpl in p. destruct p as [a' q]. destruct a' as [a' π]. simpl in q.
destruct q. simpl.
destruct y as [[a' π'] q]. simpl in *. destruct q. simpl in *.
unfold incl_Aeq_Eeq. simpl.
rewrite <- transport_pp.
rewrite transport_equiv. simpl.
simpl.
rewrite ap_idmap.
rewrite transport_pp.
pose (foo := lex_compat (φ a .1) (O nj (φ a .1)) (O_unit nj (φ a .1))). unfold equiv_path in foo; simpl in foo.
specialize (foo a.2 π'). simpl in foo.
unfold hfiber in foo. simpl in foo.
apply (moveR_transport_V idmap (islex_nj (φ a .1) (O nj (φ a .1)) (O_unit nj (φ a .1)) a .2) (transport idmap (dicde_l φ a) (a .2; 1))).
apply (transport (λ U, transport idmap (dicde_l φ a) (a .2; 1) = U) foo^).
clear foo.
apply dicde_ll. exact π. exact π'.
Qed.
(* Any object seen as a subobject of its closure is closed *)
Definition dense_into_cloture (E:Type) (φ:E -> TruncType n) (A:={e:E & φ e}) (clA := {e:E & (O nj (φ e))})
: EnJ clA.
simple refine (Build_EnJ _ _ (dense_into_cloture_dense_eq φ)).
Defined.
(*** CHECK IF THAT IS NEEDED *)
(* Definition transport_density (E:Type) (φ:E -> TruncType n) (A:={e:E & (φ e).1}) (clA := {e:E & (O nj (φ e)).1.1}) *)
(* : forall X, clA = X -> EnJ X. *)
(* pose (e := dense_into_cloture φ); simpl in e. *)
(* assert (χdiag := dense_diag e). *)
(* destruct e as [χ χeq]. *)
(* intros X p. *)
(* simple refine (Build_EnJ _ _). *)
(* - intro x. apply χ. *)
(* apply (equiv_path _ _ p). *)
(* exact x. *)
(* - destruct p. intro x. simpl. *)
(* apply χeq. *)
(* (* - destruct p. intros x e'. simpl. *) *)
(* (* apply χdiag. exact e'. *) *)