Skip to content

Commit c8995de

Browse files
Improved ways to access hprop equality in sets
1 parent 164510a commit c8995de

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

TypeTheory/Auxiliary/Auxiliary.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ Notation "( x , y , .. , z )" := (make_dirprod .. (make_dirprod x y) .. z)
2626
: core_scope.
2727
(** Replaces builtin notation for [pair], since we use [dirprod, make_dirprod] instead of [prod, pair]. *)
2828

29+
Notation "x = y :> A" := (@eqset A x y) : logic.
30+
31+
(* Tweak UniMath’s [∀] to add a “logic” scope annotation on inner argument *)
32+
Notation "∀ x .. y , P"
33+
:= (forall_hProp (λ x, .. (forall_hProp (λ y, P%logic))..))
34+
(at level 200, x binder, y binder, right associativity) : type_scope.
2935

3036
(** * Some tactics *)
3137

@@ -586,7 +592,7 @@ Proof.
586592
Defined.
587593

588594

589-
(** ** Other general lemmas *)
595+
(** ** Other misc general lemmas *)
590596

591597
(* A slightly surprising but very useful lemma for characterising identity types.
592598

TypeTheory/Auxiliary/CategoryTheory.v

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,14 +647,17 @@ Section Sections.
647647
intro; apply homset_property.
648648
Qed.
649649

650-
Definition isaset_section {C : category} {X Y : C} {f : X --> Y}
650+
Definition isaset_section {C : category} {X Y : C} (f : X --> Y)
651651
: isaset (section f).
652652
Proof.
653653
apply isaset_total2.
654654
- apply homset_property.
655655
- intros; apply isasetaprop, homset_property.
656656
Qed.
657657

658+
Definition section_hSet {C : category} {X Y : C} (f : X --> Y)
659+
:= make_hSet (section f) (isaset_section f).
660+
658661
End Sections.
659662

660663
(** * Comprehension categories *)

TypeTheory/Initiality/Interpretation.v

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Require Import UniMath.CategoryTheory.All.
77

88
Require Import TypeTheory.Auxiliary.Auxiliary.
99
Require Import TypeTheory.Auxiliary.CategoryTheory.
10+
Require Import TypeTheory.Auxiliary.SetsAndPresheaves.
1011
Require Import TypeTheory.Auxiliary.Partial.
1112
Require Import TypeTheory.ALV1.TypeCat.
1213
Require Import TypeTheory.Initiality.SplitTypeCat_General.
@@ -19,20 +20,6 @@ Local Open Scope functions.
1920

2021
Section Auxiliary.
2122

22-
(** Functions giving path types in various hsets directly as hprops. *)
23-
(* TODO: work out better way to treat them? *)
24-
Definition mor_paths_hProp {C : category} {X Y : C} (f g : X --> Y)
25-
: hProp
26-
:= make_hProp (f = g) (homset_property C _ _ _ _).
27-
28-
Definition type_paths_hProp {C : split_typecat} {Γ : C} (A B : C Γ)
29-
: hProp
30-
:= make_hProp (A = B) (isaset_types_typecat _ _ _).
31-
32-
Definition tm_paths_hProp {C : split_typecat} {Γ : C} {A : C Γ} (s t : tm A)
33-
: hProp
34-
:= make_hProp (s = t) (isaset_tm _ _).
35-
3623
End Auxiliary.
3724

3825
Section Partial_Interpretation.
@@ -62,15 +49,15 @@ Section Partial_Interpretation.
6249
- (* term expressions *)
6350
destruct e as [ m i | m A B b | m A B f a ].
6451
+ (* [var_expr i] *)
65-
assume_partial (type_paths_hProp (type_of (E i)) T) e_Ei_T.
52+
assume_partial (type_of (E i) = T :> ty C $p _)%logic e_Ei_T.
6653
apply return_partial.
6754
exact (tm_transportf e_Ei_T (E i)).
6855
+ (* [lam_expr A B b] *)
6956
get_partial (partial_interpretation_ty _ U Π _ _ E A) interp_A.
7057
set (E_A := extend_environment E interp_A).
7158
get_partial (partial_interpretation_ty _ U Π _ _ E_A B) interp_B.
7259
get_partial (partial_interpretation_tm _ U Π _ _ E_A interp_B b) interp_b.
73-
assume_partial (type_paths_hProp (Π _ interp_A interp_B) T) e_ΠAB_T.
60+
assume_partial (Π _ interp_A interp_B = T :> ty C $p _)%logic e_ΠAB_T.
7461
apply return_partial.
7562
refine (tm_transportf e_ΠAB_T _).
7663
exact (pi_intro _ _ _ _ interp_b).
@@ -81,7 +68,7 @@ Section Partial_Interpretation.
8168
set (Π_A_B := Π _ interp_A interp_B).
8269
get_partial (partial_interpretation_tm _ U Π _ _ E interp_A a) interp_a.
8370
get_partial (partial_interpretation_tm _ U Π _ _ E Π_A_B f) interp_f.
84-
assume_partial (type_paths_hProp (interp_B ⦃interp_a⦄) T) e_Ba_T.
71+
assume_partial (interp_B ⦃interp_a⦄ = T :> ty C $p _)%logic e_Ba_T.
8572
apply return_partial.
8673
refine (tm_transportf e_Ba_T _).
8774
refine (pi_app _ _ _ _ interp_f interp_a).
@@ -874,7 +861,7 @@ Section Totality.
874861
=> ∀ (X:C) (E : typed_environment X Γ)
875862
(d_A : is_defined (partial_interpretation_ty U Π E A))
876863
(d_A' : is_defined (partial_interpretation_ty U Π E A')),
877-
type_paths_hProp (evaluate d_A) (evaluate d_A')
864+
(evaluate d_A = evaluate d_A' :> ty C $p _)
878865
| [! Γ |- a ::: A !]
879866
=> ∀ (X:C) (E : typed_environment X Γ)
880867
(d_A : is_defined (partial_interpretation_ty U Π E A)),
@@ -884,7 +871,7 @@ Section Totality.
884871
(d_A : is_defined (partial_interpretation_ty U Π E A))
885872
(d_a : is_defined (partial_interpretation_tm U Π E (evaluate d_A) a))
886873
(d_a' : is_defined (partial_interpretation_tm U Π E (evaluate d_A) a')),
887-
tm_paths_hProp (evaluate d_a) (evaluate d_a')
874+
(evaluate d_a = evaluate d_a' :> tm_hSet _)
888875
end.
889876
(* Note: we DON’T expect to need any inductive information for context judgements!
890877

TypeTheory/Initiality/InterpretationLemmas.v

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ Section Functoriality.
185185
(* final naturality part *)
186186
apply leq_partial_of_path.
187187
eapply pathscomp0. { apply fmap_return_partial. }
188-
apply maponpaths. rewrite tm_transportf_idpath.
188+
apply maponpaths.
189+
eapply pathscomp0. { apply maponpaths, tm_transportf_idpath. }
189190
eapply pathscomp0. { apply (fmap_pi_intro F_Π). }
190191
apply tm_transportf_irrelevant.
191192
+ (* [app_expr A B t a] *)
@@ -268,7 +269,8 @@ Section Functoriality.
268269
(* final naturality part *)
269270
apply leq_partial_of_path.
270271
eapply pathscomp0. { apply fmap_return_partial. }
271-
apply maponpaths. rewrite tm_transportf_idpath.
272+
apply maponpaths.
273+
eapply pathscomp0. { apply maponpaths, tm_transportf_idpath. }
272274
eapply pathscomp0. { apply (fmap_pi_app F_Π). }
273275
apply tm_transportf_irrelevant.
274276
Time Defined.

TypeTheory/Initiality/SplitTypeCat_General.v

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,15 @@ Section Terms.
127127
apply paths_section.
128128
Qed.
129129

130-
Lemma isaset_tm {C : split_typecat} {Γ : C} {A : C Γ}
130+
Lemma isaset_tm {C : split_typecat} {Γ : C} (A : C Γ)
131131
: isaset (tm A).
132132
Proof.
133133
apply isaset_section.
134134
Qed.
135135

136+
Definition tm_hSet {C : split_typecat} {Γ : C} (A : C Γ) : hSet
137+
:= make_hSet (tm A) (isaset_tm A).
138+
136139
Definition reind_tm {C : typecat} {Γ Γ'} (f : Γ' --> Γ) {A : C Γ}
137140
(x : tm A) : tm (A⦃f⦄) := pb_of_section _ (reind_pb_typecat A f) _ (pr2 x).
138141

0 commit comments

Comments
 (0)