Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc cleanups to PathGroupoids, Equiv, HProp and BoundedSearch #2198

Merged
merged 4 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions theories/Basics/PathGroupoids.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Local Open Scope path_scope.

Theorems about concatenation of paths are called [concat_XXX] where [XXX] tells us what is on the left-hand side of the equation. You have to guess the right-hand side. We use the following symbols in [XXX]:

- [1] means the identity path
- [1] means the identity path, or sometimes the identity function
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does it mean the identity function? Typically we write id or idmap in those cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`concat_A1p' and some others. Should we rename them?

- [p] means 'the path'
- [V] means 'the inverse path'
- [A] means '[ap]'
Expand All @@ -27,12 +27,12 @@ Local Open Scope path_scope.

Associativity is indicated with an underscore. Here are some examples of how the name gives hints about the left-hand side of the equation.

- [concat_1p] means [1 * p]
- [concat_Vp] means [p^ * p]
- [concat_p_pp] means [p * (q * r)]
- [concat_pp_p] means [(p * q) * r]
- [concat_V_pp] means [p^ * (p * q)]
- [concat_pV_p] means [(q * p^) * p] or [(p * p^) * q], but probably the former because for the latter you could just use [concat_pV].
- [concat_1p] means [1 @ p]
- [concat_Vp] means [p^ @ p]
- [concat_p_pp] means [p @ (q @ r)]
- [concat_pp_p] means [(p @ q) @ r]
- [concat_V_pp] means [p^ @ (p @ q)]
- [concat_pV_p] means [(q @ p^) @ p] or [(p @ p^) @ q], but probably the former because for the latter you could just use [concat_pV].

Laws about inverse of something are of the form [inv_XXX], and those about [ap] are of the form [ap_XXX], and so on. For example:

Expand All @@ -55,11 +55,9 @@ Local Open Scope path_scope.
because we move to the right-hand side, and we are moving the left
argument of concat.

- [moveR_1M] means that we transform [p = q] (rather than [p = 1 @ q]) to [p * q^ = 1].
- [moveR_1M] means that we transform [p = q] (rather than [p = 1 @ q]) to [p @ q^ = 1].

There are also cancellation laws called [cancelR] and [cancelL], which are inverse to the 2-dimensional 'whiskering' operations [whiskerR] and [whiskerL].

We may now proceed with the groupoid structure proper.
*)

(** ** The 1-dimensional groupoid structure. *)
Expand Down
11 changes: 6 additions & 5 deletions theories/BoundedSearch.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ Require Import HoTT.Spaces.Nat.Core.
Section bounded_search.

Context (P : nat -> Type)
(P_dec : forall n, Decidable (P n))
(P_inhab : hexists (fun n => P n)).
(P_dec : forall n, Decidable (P n)).

(** We open type_scope again after nat_scope in order to use the product type notation. *)
Local Open Scope nat_scope.
Expand Down Expand Up @@ -80,15 +79,17 @@ Section bounded_search.
- destruct (none n (leq_refl n) Pn).
Defined.

Local Definition prop_n_to_min_n : min_n_Type.
Local Definition prop_n_to_min_n (P_inhab : hexists (fun n => P n))
: min_n_Type.
Proof.
refine (Trunc_rec _ P_inhab).
intros [n Pn]. exact (n_to_min_n n Pn).
Defined.

Definition minimal_n : { n : nat & P n }.
Definition minimal_n (P_inhab : hexists (fun n => P n))
: { n : nat & P n }.
Proof.
destruct prop_n_to_min_n as [n pl]. destruct pl as [p _].
destruct (prop_n_to_min_n P_inhab) as [n pl]. destruct pl as [p _].
exact (n; fst merely_inhabited_iff_inhabited_stable p).
Defined.

Expand Down
1 change: 0 additions & 1 deletion theories/Types/Equiv.v
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ Section AssumeFunext.
Global Instance istrunc_equiv {n : trunc_index} {A B : Type} `{IsTrunc n.+1 B}
: IsTrunc n.+1 (A <~> B).
Proof.
simpl.
apply istrunc_S.
intros e1 e2.
apply (istrunc_equiv_istrunc _ (equiv_path_equiv e1 e2)).
Expand Down
4 changes: 2 additions & 2 deletions theories/Universes/HProp.v
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ Defined.
(** When [A] is an hprop, so is [Stable A] (by [ishprop_stable_hprop]), so [Stable A * IsHProp A] is an hprop for any [A]. *)
Global Instance ishprop_stable_ishprop `{Funext} (A : Type) : IsHProp (Stable A * IsHProp A).
Proof.
apply hprop_allpath; intros [st1 hp1] [st2 hp2].
apply path_ishprop.
apply istrunc_inhabited_istrunc; intros [stable ishprop].
exact _.
Defined.

(** Under function extensionality, if [A] is a stable type, then [~~A] is the propositional truncation of [A]. Here, for dependency reasons, we don't give the equivalence to [Tr (-1) A], but just show that the recursion principle holds. See Metatheory/ImpredicativeTruncation.v for a generalization to all types, and Modalities/Notnot.v for a description of the universal property of [~~A] when [A] is not assumed to be stable. *)
Expand Down
Loading