@@ -50,6 +50,13 @@ Proof.
5050 exact (!((toforallpaths _ _ _ (!(pr22 Tm _ _ _ g f))) A)).
5151Qed .
5252
53+ Lemma Ty_identity {Γ : C} (A : Ty Γ : hSet) : A = #Ty (identity Γ) A.
54+ Proof .
55+ assert (eqA : A = (identity (pr1 Ty Γ) A)) by auto.
56+ rewrite eqA.
57+ apply (!((toforallpaths _ _ _ (pr12 Ty _ )) A)).
58+ Qed .
59+
5360(** * Tm as a Display * *)
5461Section tm.
5562Definition tm {Γ : C} (A : Ty Γ : hSet) : UU
@@ -151,6 +158,34 @@ Proof.
151158 reflexivity.
152159Qed .
153160
161+ Definition tm_transportf_bind {Γ} {A A' A'': Ty Γ : hSet} {e : A' = A} {e' : A'' = A'}
162+ {t} {t'} {t''} (ee : t = tm_transportf e t') (ee' : t' = tm_transportf e' t'')
163+ : t = tm_transportf (e' @ e) t''.
164+ Proof .
165+ etrans. 2: { apply pathsinv0, tm_transportf_compose. }
166+ etrans. { eassumption. }
167+ apply maponpaths; assumption.
168+ Qed .
169+
170+ Lemma reind_compose_tm'
171+ {Γ Γ' Γ'' : C} (f : C⟦Γ',Γ⟧) (g : C⟦Γ'',Γ'⟧) {A : Ty Γ : hSet} (a : tm A)
172+ : tm_transportf (Ty_composition _ _ _)
173+ (reind_tm (g ;; f) a)
174+ = reind_tm g (reind_tm f a).
175+ Proof .
176+ rewrite reind_compose_tm. rewrite tm_transportbf.
177+ now rewrite <- tm_transportf_compose, pathsinv0l, tm_transportf_idpath.
178+ Qed .
179+
180+ Definition reind_id_tm {Γ : C}{A : Ty Γ : hSet} (a : tm A)
181+ : reind_tm (identity _) a
182+ = tm_transportb ((toforallpaths _ _ _ (pr12 Ty _ )) A) a.
183+ Proof .
184+ apply subtypePath.
185+ - intros x. apply (setproperty (Ty Γ : hSet)).
186+ - apply ((toforallpaths _ _ _ (pr12 Tm _ )) a).
187+ Qed .
188+
154189End tm.
155190
156191Section Yoneda.
@@ -190,6 +225,11 @@ Proof.
190225 - rewrite Map2; rewrite Map1; apply yoneda_map_1_2.
191226Qed .
192227
228+ Lemma invyoneda {A B : C} (f : _⟦Yo A,Yo B⟧) : #Yo (Yo^-1 f) = f.
229+ Proof .
230+ apply yonedacarac.
231+ Qed .
232+
193233Lemma yyidentity {Γ : C} {A : Ty Γ : hSet} (B : Ty (Γ.:A) : hSet)
194234: B = (@yy (pr1 C) (pr2 C) Ty (Γ.:A) B : nat_trans _ _) (Γ.:A) (identity (Γ.:A)).
195235Proof .
@@ -287,6 +327,13 @@ Proof.
287327 exact (pr221((CwF_Pullback _) (Yo (Γ.:A)) (identity _) (yy _) (Subproof_γ _))).
288328Qed .
289329
330+ Lemma pull_γ {Γ : C} {A : Ty Γ : hSet} (a : tm A) : γ a ;; #Yo (pi A) = identity _.
331+ Proof .
332+ apply pathsinv0, (pathscomp0(!(pr121 (CwF_Pullback _
333+ (Yo Γ) (identity (Yo Γ)) (yy a)
334+ (Subproof_γ a))))); auto.
335+ Qed .
336+
290337Lemma γNat {Γ Δ : C} {A : Ty Γ : hSet} (f : C^op ⟦Γ,Δ⟧) (a : tm A)
291338: (f : C⟦Δ,Γ⟧) ;; (γ a : nat_trans _ _) Γ (identity Γ) =
292339 (γ (reind_tm f a ) ;; #Yo (qq_term A f) : nat_trans _ _) Δ (identity Δ).
@@ -373,6 +420,57 @@ Proof.
373420 reflexivity.
374421Qed .
375422
423+ Definition γ_qq {Γ} {A : Ty Γ: hSet} {Γ'} (f : C⟦Γ',Γ⟧) (a : tm (#Ty f A)) : C⟦Γ',Γ.: A⟧.
424+ Proof .
425+ exact (Yo^-1 (γ a) ;; qq_term A f).
426+ Defined .
427+
428+ Lemma γ_pi {Γ} {A : Ty Γ: hSet} (a : tm A) : Yo^-1 (γ a) ;; pi A = identity _.
429+ Proof .
430+ assert (Yoeq : #Yo(Yo^-1 (γ a) ;; pi A) = #Yo(identity Γ)).
431+ - apply (pathscomp0 (pr22 Yo _ _ _ _ _ )).
432+ apply pathsinv0 , (pathscomp0 (pr12 Yo _)).
433+ assert (simplman : identity (pr1 (yoneda C (homset_property C)) Γ)
434+ = identity (Yo Γ)) by auto.
435+ apply (pathscomp0 simplman).
436+ rewrite (!(pull_γ a)).
437+ apply cancel_postcomposition.
438+ assert (simplman2 : # (pr1 (yoneda C (homset_property C))) (Yo^-1 (γ a))
439+ = #Yo (Yo^-1 (γ a))) by auto.
440+ apply pathsinv0, (pathscomp0 simplman2), invyoneda.
441+ - apply (maponpaths (Yo^-1) ) in Yoeq.
442+ rewrite yonedainv, yonedainv in Yoeq.
443+ exact Yoeq.
444+ Qed .
445+
446+ Lemma te_subtitution {Γ} {A : Ty Γ : hSet} (a : tm A) : #Tm (Yo^-1(γ a)) (te A) = a.
447+ Proof .
448+ assert (inter : @yy _ (pr2 C) _ _ (#Tm (Yo^-1(γ a)) (te A)) = yy a).
449+ - rewrite yy_natural, invyoneda.
450+ exact (pr221((CwF_Pullback _) (Yo _) (identity _) (yy _) (Subproof_γ _))).
451+ - apply (maponpaths (invmap yy) ) in inter.
452+ do 2 rewrite homotinvweqweq in inter.
453+ exact inter.
454+ Qed .
455+
456+ Definition reind_id_tm' {Γ : C} {A : Ty Γ : hSet} (a : tm A) (b : tm A)
457+ (e : # Ty (identity Γ) A = # Ty (Yo^-1 (γ b) ;; pi A) A)
458+ : tm_transportf e (reind_tm (identity _) a)
459+ = tm_transportf ((Ty_identity _) @ e) a.
460+ Proof .
461+ apply subtypePath.
462+ - intros x. apply (setproperty (Ty Γ : hSet)).
463+ - apply ((toforallpaths _ _ _ (pr12 Tm _ )) a).
464+ Qed .
465+
466+ Lemma Ty_γ_id {Γ : C} {A : Ty Γ : hSet} (a : tm A)
467+ : # Ty (Yo^-1 (γ a)) (# Ty (pi A) A) = A.
468+ Proof .
469+ simple refine (!(Ty_composition _ _ _) @ _).
470+ apply (pathscomp0 ((toforallpaths _ _ _ (maponpaths _ (γ_pi _)) )A)).
471+ apply ((toforallpaths _ _ _ (pr12 Ty _ )) A).
472+ Qed .
473+
376474Definition DepTypesType {Γ : C} {A : Ty Γ : hSet} (B : Ty(Γ.:A) : hSet)
377475(a : tm A)
378476: Ty Γ : hSet := ( γ a;;yy B : nat_trans _ _) Γ (identity Γ).
@@ -635,5 +733,33 @@ Proof.
635733 rewrite tm_transportbf ;apply qq_term_te].
636734Qed .
637735
736+ Definition CwF_Id_map {Id} (nid : CwF_IdTypeNat Id) {Γ} {A : Ty Γ : hSet} (a : tm A) (b : tm A) (eqab : tm (Id _ _ a b))
737+ : C⟦Γ,_.:CwF_IdBasedFam Id A a⟧.
738+ Proof .
739+ simple refine (γ_qq (Yo^-1 (γ b)) _). unfold CwF_IdBasedFam.
740+ simple refine (tm_transportb _ eqab).
741+ abstract(
742+ simple refine (nid _ _ _ _ _ _ @ _);
743+ use CwF_maponpathsIdForm;
744+ [ apply Ty_γ_id
745+ | rewrite tm_transportbf ;
746+ refine (_ @ tm_transportf_irrelevant _ _ _);
747+ simple refine (tm_transportf_bind (!reind_compose_tm' _ _ _) _);
748+ [ apply (pathscomp0 (!(Ty_γ_id b))) , (!(Ty_composition _ _ _)) |
749+ simple refine (maponpaths_2_reind_tm _ _ @ _);
750+ [exact (identity _) | apply γ_pi |
751+ rewrite tm_transportbf; apply (pathscomp0 (reind_id_tm' _ _ _));
752+ apply tm_transportf_irrelevant ]]
753+ | apply subtypePath;
754+ [ intros x; apply (setproperty (Ty Γ : hSet))
755+ | rewrite tm_transportbf; apply te_subtitution]]).
756+ Defined .
757+
758+ Definition CwF_IdBased_path_inducton {Id} (nid : CwF_IdTypeNat Id) (refl : CwF_IdRefl Id) := ∏ Γ (A : Ty Γ : hSet) (a : tm A)
759+ (P : Ty (_ .: CwF_IdBasedFam Id A a) : hSet)
760+ (d : tm (#Ty (CwF_Id_map nid a a (refl _ _ a)) P))
761+ (b : tm A) (eqab : tm (Id _ _ a b)),
762+ tm (#Ty (CwF_Id_map nid a b eqab) P).
763+
638764End Identity_Structure.
639765End Fix_Category.
0 commit comments