Skip to content

Commit 152aee0

Browse files
committed
add assignment 12
1 parent e69922d commit 152aee0

1 file changed

Lines changed: 111 additions & 0 deletions

File tree

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import Mathlib.Tactic
2+
import Mathlib.Data.List.Basic
3+
import Mathlib.Combinatorics.SimpleGraph.Hamiltonian
4+
import Mathlib.CategoryTheory.Limits.Yoneda
5+
6+
open CategoryTheory Functor
7+
noncomputable section
8+
9+
/-! # Exercises to practice -/
10+
11+
namespace SimpleGraph
12+
13+
variable {V : Type*} (G : SimpleGraph V)
14+
15+
/--
16+
**Exercise 1**: The category of walks.
17+
18+
Here is the notion of walk introduced in the lecture. -/
19+
inductive MyWalk : V → V → Type _
20+
| nil {u : V} : MyWalk u u
21+
| cons {u v w : V} (h : G.Adj u v) (p : MyWalk v w) : MyWalk u w
22+
23+
def MyWalk.support {u v : V} : G.MyWalk u v → List V
24+
| nil => [u]
25+
| cons _ p => u :: p.support
26+
27+
/-- A walk is a *path* if no vertex is visited twice. -/
28+
structure MyWalk.IsPath {u v : V} (p : G.MyWalk u v) : Prop where
29+
support_nodup : p.support.Nodup
30+
31+
32+
/-
33+
Define concatenation of walks, and show that this defines a category with object type `V` and
34+
`Hom u v` defined as `G.MyWalk u v`.
35+
-/
36+
37+
def concat {u v w : V} (p : G.MyWalk u v) (q : G.MyWalk v w) : G.MyWalk u w :=
38+
sorry
39+
40+
def walkCategory : Category V := sorry
41+
42+
43+
/-
44+
**Exercise 2**: define a reduction of a walk into a path by removing any loops it makes.
45+
-/
46+
47+
def MyWalk.reduce {u v : V} (p : G.MyWalk u v) : G.MyWalk u v :=
48+
sorry
49+
50+
lemma MyWalk.isPath_reduce {u v : V} (p : G.MyWalk u v) : p.reduce.IsPath := by
51+
sorry
52+
done
53+
54+
55+
end SimpleGraph
56+
57+
namespace Category
58+
59+
/-
60+
**Exercise 3**: we will prove some lemmas about isomorphisms.
61+
62+
**Note**: We use our own version of isomorphisms, so you cannot use the results from Mathlib.
63+
-/
64+
65+
variable {C : Type*} [Category C] {D : Type*} [Category D] {X Y Z : C}
66+
67+
structure MyIso (X Y : C) where
68+
hom : X ⟶ Y
69+
inv : Y ⟶ X
70+
hom_inv_id : hom ≫ inv = 𝟙 X := by cat_disch
71+
inv_hom_id : inv ≫ hom = 𝟙 Y := by cat_disch
72+
73+
local infixr:10 (priority := high) " ≅ " => MyIso
74+
75+
def MyIso.trans (f : X ≅ Y) (g : Y ≅ Z) : X ≅ Z := sorry
76+
77+
def MyIso.symm (f : X ≅ Y) : Y ≅ X := sorry
78+
79+
def MyIso.rfl : X ≅ X := sorry
80+
81+
/- hint: since we haven't marked `MyIso` with `@[ext]`, we cannot use the `ext` tactic here yet.
82+
Instead, do cases on both `f` and `f'`, and then `simp` will simplify the goal. -/
83+
@[ext]
84+
lemma MyIso.ext {f f' : X ≅ Y} (h : f.hom = f'.hom) : f = f' := by
85+
sorry
86+
done
87+
88+
89+
-- @[simps]
90+
def MyIso.map {X X' : C} (F : C ⥤ D) (f : X ≅ X') : F.obj X ≅ F.obj X' := sorry
91+
92+
-- @[simps]
93+
def MyIso.prod {X X' : C} {Y Y' : D} (f : X ≅ X') (g : Y ≅ Y') : (X, Y) ≅ (X', Y') := sorry
94+
95+
/- Now show that isomorphisms in the product category are pairs of isomorphisms.
96+
The two functors below are already defined in Mathlib, and might be useful.
97+
98+
It will be useful to mark the definitions above as `simps`. This means that `(f.prod g).hom` and
99+
`(f.prod g).inv` will both be simplified by unfolding the definition, but `f.prod g`
100+
itself won't be.
101+
-/
102+
103+
#check CategoryTheory.Prod.fst
104+
#check CategoryTheory.Prod.snd
105+
106+
def prodIsoEquiv {X X' : C} {Y Y' : D} : ((X, Y) ≅ (X', Y')) ≃ (X ≅ X') × (Y ≅ Y') := sorry
107+
108+
109+
end Category
110+
111+
/-! # No exercises to hand-in. -/

0 commit comments

Comments
 (0)