Skip to content

Commit 5fa0e44

Browse files
committed
experiment in removing internal_paths_*
1 parent 2b8a17d commit 5fa0e44

File tree

3 files changed

+10
-27
lines changed

3 files changed

+10
-27
lines changed

test/bugs/github1794.v

Lines changed: 0 additions & 6 deletions
This file was deleted.

theories/Basics/Overture.v

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ Register paths as core.identity.type.
283283
Register idpath as core.identity.refl.
284284
Register paths_rect as core.identity.ind.
285285
Register paths_rec as core.identity.rec.
286+
Register paths_rec as core.identity.rect.
287+
Register paths_ind as core.identity.rect_dep.
286288

287289
Notation "x = y :> A" := (@paths A x y) : type_scope.
288290
Notation "x = y" := (x = y :>_) : type_scope.
@@ -310,6 +312,13 @@ Proof.
310312
exact u.
311313
Defined.
312314

315+
Definition paths_rect_r {A : Type} (a : A)
316+
(P : A -> Type) (u : P a)
317+
: forall (y : A) (p : y = a), P y := paths_ind_r a (fun b _ => P b) u.
318+
319+
Register paths_ind_r as core.identity.rect_r_dep.
320+
Register paths_rect_r as core.identity.rect_r.
321+
313322
Definition related_reflexive_path {A : Type} (R : Relation A) `{Reflexive A R}
314323
{a b : A} (p : a = b)
315324
: R a b.
@@ -398,16 +407,13 @@ Notation "p # u" := (transport _ p u) (only parsing) : path_scope.
398407

399408
(** 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. *)
400409
(** 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. *)
410+
(** TODO DONE*)
401411
Local Lemma define_internal_paths_rew A x y P (u : P x) (H : x = y :> A) : P y.
402412
Proof. rewrite <- H. exact u. Defined.
403413

404414
Local Lemma define_internal_paths_rew_r A x y P (u : P y) (H : x = y :> A) : P x.
405415
Proof. rewrite -> H. exact u. Defined.
406416

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.
410-
411417
(** 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]. *)
412418

413419
(** Functions act on paths: if [f : A -> B] and [p : x = y] is a path in [A], then [ap f p : f x = f y]. We typically pronounce [ap] as a single syllable, short for "application"; but it may also be considered as an acronym, "action on paths". *)

theories/Tactics.v

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -405,20 +405,3 @@ Ltac context_to_lambda G :=
405405
let ret := context G[k] in
406406
exact ret)) in
407407
(eval cbv zeta in ret).
408-
409-
(** The [rewrite <-] tactic uses [internal_paths_rew], which is definitionally equal to [transport], except for the order of the arguments. The following replaces the former with the latter. *)
410-
Ltac internal_paths_rew_to_transport :=
411-
repeat match goal with |- context [ internal_paths_rew ?P ?u ?p ] =>
412-
change (internal_paths_rew P u p) with (transport P p u) end.
413-
414-
(** Unfortunately, the more common [rewrite ->] uses [internal_paths_rew_r], which is not definitionally equal to something involving [transport]. However, we do have a propositional equality. The arguments here match the arguments that [internal_paths_rew_r] takes. *)
415-
Definition internal_paths_rew_r_to_transport {A : Type} {x y : A} (P : A -> Type) (u : P y) (p : x = y)
416-
: internal_paths_rew_r P u p = transport P p^ u.
417-
Proof.
418-
destruct p; reflexivity.
419-
Defined.
420-
421-
(** This tactic replaces both [internal_paths_rew] and [internal_paths_rew_r] with [transport], using [rewrite] for the latter. *)
422-
Ltac rewrite_to_transport :=
423-
internal_paths_rew_to_transport;
424-
rewrite ! internal_paths_rew_r_to_transport.

0 commit comments

Comments
 (0)