Skip to content

Commit ea71c02

Browse files
authored
Merge pull request #2334 from jdchristensen/diagram-chase-pr
move SetoidRewrite to main library and other changes in preparation for diagram chasing
2 parents 29a67bd + 8bebb6f commit ea71c02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+221
-160
lines changed

test/WildCat/SetoidRewrite.v

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#[warnings="-deprecated-from-Coq"]
2+
From Coq Require Init.Tactics. (* TODO: Can remove this line and previous once Rocq 9.0 is our minimum. *)
3+
From HoTT Require Import Basics.Overture Basics.Tactics.
4+
From HoTT.WildCat Require Import Core NatTrans Equiv SetoidRewrite.
5+
6+
(** * Examples and tests of setoid rewriting *)
7+
8+
(** ** Examples of setoid rewriting *)
9+
10+
(** See theories/WildCat/HomologicalAlgebra.v for many more examples of setoid rewriting. *)
11+
12+
(** Rewriting works in hypotheses. *)
13+
Proposition epic_sectionof {A} `{Is1Cat A}
14+
{a b : A} (f : a $-> b) :
15+
SectionOf f -> Epic f.
16+
Proof.
17+
intros [right_inverse is_section] c g h eq_gf_hf.
18+
apply cat_prewhisker with (h:=right_inverse) in eq_gf_hf.
19+
rewrite 2 cat_assoc, is_section, 2 cat_idr in eq_gf_hf.
20+
exact eq_gf_hf.
21+
Defined.
22+
23+
(** A different approach, working in the goal. *)
24+
Proposition monic_retractionof {A} `{Is1Cat A}
25+
{b c : A} (f : b $-> c) :
26+
RetractionOf f -> Monic f.
27+
Proof.
28+
intros [left_inverse is_retraction] a g h eq_fg_fh.
29+
rewrite <- (cat_idl g), <- (cat_idl h).
30+
rewrite <- is_retraction.
31+
rewrite 2 cat_assoc.
32+
exact (_ $@L eq_fg_fh).
33+
Defined.
34+
35+
Proposition faithful_nat_equiv_faithful {A B : Type}
36+
{F G : A -> B} `{Is1Functor _ _ F}
37+
`{!Is0Functor G, !Is1Functor G}
38+
`{!HasEquivs B} (tau : NatEquiv F G)
39+
: Faithful F -> Faithful G.
40+
Proof.
41+
intros faithful_F x y f g eq_Gf_Gg.
42+
apply faithful_F.
43+
apply (cate_monic_equiv (tau y)).
44+
rewrite 2 (isnat tau).
45+
by apply cat_prewhisker.
46+
Defined.
47+
48+
(** ** Tests of setoid rewriting *)
49+
50+
Section SetoidRewriteTests.
51+
52+
Goal forall (A : Type) `(H : Is0Gpd A) (a b c : A),
53+
a $== b -> b $== c -> a $== c.
54+
Proof.
55+
intros A ? ? ? a b c eq_ab eq_bc.
56+
by rewrite eq_ab, <- eq_bc.
57+
Defined.
58+
59+
Goal forall (A : Type) `(H : Is0Gpd A) (a b c : A),
60+
a $== b -> b $== c -> a $== c.
61+
Proof.
62+
intros A ? ? ? a b c eq_ab eq_bc.
63+
symmetry.
64+
rewrite eq_ab, <- eq_bc.
65+
rewrite eq_bc.
66+
by rewrite <- eq_bc.
67+
Defined.
68+
69+
Goal forall (A B : Type) (F : A -> B) `{Is1Functor _ _ F} (a b : A) (f g : a $-> b), f $== g -> fmap F f $== fmap F g.
70+
Proof.
71+
do 17 intro.
72+
intro eq_fg.
73+
by rewrite eq_fg.
74+
Defined.
75+
76+
Goal forall (A : Type) `{Is1Cat A} (a b c : A) (f1 f2 : a $-> b) (g : b $-> c), f1 $== f2 -> g $o f1 $== g $o f2.
77+
Proof.
78+
do 11 intro.
79+
intro eq.
80+
rewrite <- eq.
81+
by rewrite eq.
82+
Defined.
83+
84+
Goal forall (A : Type) `{Is1Cat A} (a b c : A) (f : a $-> b) (g1 g2 : b $-> c), g1 $== g2 -> g1 $o f $== g2 $o f.
85+
Proof.
86+
do 11 intro.
87+
intro eq.
88+
rewrite <- eq.
89+
rewrite eq.
90+
by rewrite <- eq.
91+
Defined.
92+
93+
Goal forall (A : Type) `{Is1Cat A} (a b c : A) (f1 f2 : a $-> b) (g1 g2 : b $-> c), g1 $== g2 -> f1 $== f2 -> g1 $o f1 $== g2 $o f2.
94+
Proof.
95+
do 12 intro.
96+
intros eq_g eq_f.
97+
rewrite eq_g.
98+
rewrite <- eq_f.
99+
rewrite eq_f.
100+
by rewrite <- eq_g.
101+
Defined.
102+
103+
End SetoidRewriteTests.

theories/Algebra/AbGroups/AbHom.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
From HoTT Require Import Basics Types.
2-
Require Import WildCat HSet Truncations.Core Modalities.ReflectiveSubuniverse.
2+
From HoTT.WildCat Require Import Core Opposite Bifunctor Square Equiv.
3+
Require Import HSet Truncations.Core Modalities.ReflectiveSubuniverse.
34
Require Import Groups.Group Groups.QuotientGroup AbelianGroup Biproduct.
45

56
(** * Homomorphisms from a group to an abelian group form an abelian group. *)

theories/Algebra/AbGroups/AbelianGroup.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
From HoTT Require Import Basics Types.
2+
From HoTT.WildCat Require Import Core Universe Equiv Induced PointedCat.
23
Require Import Spaces.Nat.Core Spaces.Int.
34
Require Export Classes.interfaces.canonical_names (Zero, zero, Plus, plus, Negate, negate, Involutive, involutive).
45
Require Export Classes.interfaces.abstract_algebra (IsAbGroup(..), abgroup_group, abgroup_commutative).
56
Require Export Algebra.Groups.Group.
67
Require Export Algebra.Groups.Subgroup.
78
Require Import Algebra.Groups.QuotientGroup.
8-
Require Import WildCat.
99

1010
Local Set Polymorphic Inductive Cumulativity.
1111

theories/Algebra/AbGroups/Abelianization.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
From HoTT Require Import Basics Types Truncations.Core.
2-
Require Import Cubical.DPath WildCat.
2+
From HoTT.WildCat Require Import Core Equiv EquivGpd.
3+
Require Import Cubical.DPath.
34
Require Import Colimits.Coeq.
45
Require Import Algebra.AbGroups.AbelianGroup.
56
Require Import Modalities.ReflectiveSubuniverse.

theories/Algebra/AbGroups/Biproduct.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
From HoTT Require Import Basics Types Truncations.Core.
2-
Require Import WildCat.
2+
From HoTT.WildCat Require Import Core Equiv Bifunctor.
33
Require Import HSet.
44
Require Import AbelianGroup.
55
Require Import Modalities.ReflectiveSubuniverse.

theories/Algebra/AbSES/BaerSum.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
From HoTT Require Import Basics Types.
2-
Require Import WildCat Pointed.Core.
2+
From HoTT.WildCat Require Import Core Universe Opposite Bifunctor.
3+
Require Import Pointed.Core.
34
Require Import AbGroups.AbelianGroup AbGroups.Biproduct AbGroups.AbHom.
45
Require Import AbSES.Core AbSES.Pullback AbSES.Pushout AbSES.DirectSum.
56
Require Import Homotopy.HSpace.Core.

theories/Algebra/AbSES/Core.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
From HoTT Require Import Basics Types Truncations.Core.
2-
Require Import HSet WildCat Pointed.
2+
From HoTT.WildCat Require Import Core Equiv Induced NatTrans.
3+
Require Import HSet Pointed.Core Pointed.Loops.
34
Require Import Groups.QuotientGroup Groups.ShortExactSequence.
45
Require Import AbelianGroup AbGroups.Biproduct AbHom.
56
Require Import Homotopy.ExactSequence.

theories/Algebra/AbSES/Ext.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
From HoTT Require Import Basics Types Truncations.Core.
2-
Require Import Pointed WildCat.
2+
From HoTT.WildCat Require Import Core Universe Opposite Bifunctor.
3+
Require Import Pointed.Core Pointed.pTrunc.
34
Require Import Truncations.SeparatedTrunc.
45
Require Import AbelianGroup AbHom AbProjective.
56
Require Import AbSES.Pullback AbSES.Pushout AbSES.BaerSum AbSES.Core.

theories/Algebra/AbSES/Pullback.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
From HoTT Require Import Basics Types.
2+
From HoTT.WildCat Require Import Core NatTrans Universe Opposite.
23
Require Import HSet Limits.Pullback.
3-
Require Import WildCat Pointed.Core Homotopy.ExactSequence.
4+
Require Import Pointed.Core Homotopy.ExactSequence.
45
Require Import Modalities.ReflectiveSubuniverse.
56
Require Import AbGroups.AbelianGroup AbGroups.AbPullback AbGroups.Biproduct.
67
Require Import AbSES.Core AbSES.DirectSum.
@@ -483,7 +484,6 @@ Proof.
483484
- symmetry; apply abses_pullback_compose.
484485
Defined.
485486

486-
487487
Instance is0functor_abses10 `{Univalence} {A : AbGroup}
488488
: Is0Functor (fun B : AbGroup^op => AbSES B A).
489489
Proof.

theories/Algebra/AbSES/PullbackFiberSequence.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
From HoTT Require Import Basics Types HSet HFiber Limits.Pullback.
2-
Require Import WildCat Pointed.Core Homotopy.ExactSequence.
2+
From HoTT.WildCat Require Import Core NatTrans.
3+
Require Import Pointed.Core Homotopy.ExactSequence.
34
Require Import Groups.QuotientGroup.
45
Require Import AbGroups.AbelianGroup AbGroups.AbPullback AbGroups.Biproduct.
56
Require Import AbSES.Core AbSES.Pullback.

0 commit comments

Comments
 (0)