|
3 | 3 | (** This file defines some of the most basic types and type formers, such as sums, products, Sigma types and path types. It defines the action of functions on paths [ap], transport, equivalences, and function extensionality. It also defines truncatedness, and a number of other fundamental definitions used throughout the library. *) |
4 | 4 |
|
5 | 5 | (** Import the file of reserved notations so we maintain consistent level notations throughout the library. *) |
6 | | -Require Export Equality. |
7 | 6 | Require Export Basics.Settings Basics.Notations. |
| 7 | + |
8 | 8 | Local Set Polymorphic Inductive Cumulativity. |
9 | 9 |
|
10 | 10 | (** This command prevents Coq from automatically defining the eliminator functions for inductive types. We will define them ourselves to match the naming scheme of the HoTT Book. In principle we ought to make this [Global], but unfortunately the tactics [induction] and [elim] assume that the eliminators are named in Coq's way, e.g. [thing_rect], so making it global could cause unpleasant surprises for people defining new inductive types. However, when you do define your own inductive types you are encouraged to also do [Local Unset Elimination Schemes] and then use [Scheme] to define [thing_ind], [thing_rec], and (for compatibility with [induction] and [elim]) [thing_rect], as we have done below for [paths], [Empty], [Unit], etc. We are hoping that this will be fixed eventually; see https://github.com/coq/coq/issues/3745. *) |
@@ -282,6 +282,7 @@ Definition paths_rect := paths_ind. |
282 | 282 | Register paths as core.identity.type. |
283 | 283 | Register idpath as core.identity.refl. |
284 | 284 | Register paths_rect as core.identity.ind. |
| 285 | +Register paths_rec as core.identity.rec. |
285 | 286 |
|
286 | 287 | Notation "x = y :> A" := (@paths A x y) : type_scope. |
287 | 288 | Notation "x = y" := (x = y :>_) : type_scope. |
@@ -395,28 +396,17 @@ Arguments transport {A}%_type_scope P%_function_scope {x y} p%_path_scope u : si |
395 | 396 | (** Transport is very common so it is worth introducing a parsing notation for it. However, we do not use the notation for output because it hides the fibration, and so makes it very hard to read involved transport expression. *) |
396 | 397 | Notation "p # u" := (transport _ p u) (only parsing) : path_scope. |
397 | 398 |
|
398 | | -Instance path_Has_refl@{l} : Has_refl@{Type Type;l l} (@paths@{l}) |
399 | | - := @idpath. |
400 | | - |
401 | | -Definition path_Has_J_elim@{l l'} : Has_J@{Type Type Type; l l l'} (@paths) _ |
402 | | - := paths_rect. |
403 | | - |
404 | | -Hint Resolve path_Has_J_elim : rewrite_instances. |
405 | | - |
406 | | -Definition path_Has_Leibniz_elim@{l l'} : Has_Leibniz@{Type Type Type;l l l'} (@paths) |
407 | | - := @paths_rec. |
| 399 | +(** The first time [rewrite] is used in each direction, it creates transport lemmas called [internal_paths_rew] and [internal_paths_rew_r]. See ../Tactics.v for how these compare to [transport]. We use [rewrite] here to trigger the creation of these lemmas. This ensures that they are defined outside of sections, so they are not unnecessarily polymorphic. The lemmas below are not used in the library. *) |
| 400 | +(** TODO: Since Coq 8.20 has PR#18299, once that is our minimum version we can instead register wrappers for [transport] to be used for rewriting. See the comment by Dan Christensen in that PR for how to do this. Then the tactics [internal_paths_rew_to_transport] and [rewrite_to_transport] can be removed from ../Tactics.v. Rocq 9.2 will contain PR#21098 which adds further registration options. It should be possible to do things in a way that works across these versions. See #2332 for a discussion of this. *) |
| 401 | +Local Lemma define_internal_paths_rew A x y P (u : P x) (H : x = y :> A) : P y. |
| 402 | +Proof. rewrite <- H. exact u. Defined. |
408 | 403 |
|
409 | | -Hint Resolve path_Has_Leibniz_elim : rewrite_instances. |
| 404 | +Local Lemma define_internal_paths_rew_r A x y P (u : P y) (H : x = y :> A) : P x. |
| 405 | +Proof. rewrite -> H. exact u. Defined. |
410 | 406 |
|
411 | | -Definition path_Has_J_r_elim@{l l'} : Has_J_r@{Type Type Type; l l l'} (@paths) _ |
412 | | - := @paths_ind_r. |
413 | | - |
414 | | -Hint Resolve path_Has_J_r_elim : rewrite_instances. |
415 | | - |
416 | | -Definition path_Has_Leibniz_r_elim@{l l'} : Has_Leibniz_r@{Type Type s;l l l'} (@paths) := |
417 | | - fun A x P t y e => @paths_ind_r A x (fun a _ => P a) t y e. |
418 | | - |
419 | | -Hint Resolve path_Has_Leibniz_r_elim : rewrite_instances. |
| 407 | +(* TODO: ": rename" is needed because the default names changed in Rocq 9.2.0. When the minimum supported version is >= 9.2.0, the ": rename" can be removed. *) |
| 408 | +Arguments internal_paths_rew {A%_type_scope} {a} P%_function_scope f {a0} p : rename. |
| 409 | +Arguments internal_paths_rew_r {A%_type_scope} {a y} P%_function_scope HC X. |
420 | 410 |
|
421 | 411 | (** Having defined transport, we can use it to talk about what a homotopy theorist might see as "paths in a fibration over paths in the base"; and what a type theorist might see as "heterogeneous equality in a dependent type". We will first see this appearing in the type of [apD]. *) |
422 | 412 |
|
|
0 commit comments