Skip to content

Commit 794a39e

Browse files
committed
add pre-update
1 parent 22c9585 commit 794a39e

20 files changed

Lines changed: 361 additions & 21 deletions

Game/Levels/Group/L01_MulLeft.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Title "Left Multiplication"
88

99
namespace MyAlgebra
1010

11-
Introduction "Just to get us warmed up, let's create some lemmas to make it easy to multiply."
11+
Introduction "Just to get us warmed up, let's create some lemmas for multiplication."
1212

1313
/--
1414
`mul_left` is a proof that if `g1 = g2`, then `h * g1 = h * g2` - basically `h * _` is a function.

Game/Levels/Group/L02_MulRight.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace MyAlgebra
1010
Introduction "Here's a duel of that last level."
1111

1212
/--
13-
`mul_right` is a proof that if `g1 = g2`, then `g1 * h = g2 * h` - basically `_ * h` is a function.
13+
`mul_right` is a proof that if `g1 = g2`, then `g1 * h = g2 * h` - based on `_ * h` is a well defined function.
1414
-/
1515
TheoremDoc MyAlgebra.mul_right as "mul_left" in "Group"
1616
@[to_additive]
@@ -19,4 +19,4 @@ Statement mul_right (g : G) [Group G] : g1 = g2 → g1 * g = g2 * g := by
1919
rw [h]
2020

2121

22-
Conclusion "Don't worry it going to get a bit more challenging (and a lot more fun)!"
22+
Conclusion "Don't worry it's going to get a bit more challenging (and a lot more fun)!"

Game/Levels/Group/L08_CombinedInv2.lean

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ NewDefinition MyAlgebra.prod_list MyAlgebra.prod_list_inv
3939
/--
4040
`inv_n_prod` is a proof that the inverse of a product of `n` elements is the product of the inverses in reverse order.
4141
-/
42-
TheoremDoc MyAlgebra.inv_n_prod as "inv_n_prod" in "Group"
43-
Statement inv_n_prod (l : List G) [Group G] : is_inv (prod_list l) (prod_list_inv l) := by
42+
-- TheoremDoc MyAlgebra.inv_n_prod as "inv_n_prod" in "Group"
43+
-- Statement inv_n_prod (l : List G) [Group G] : is_inv (prod_list l) (prod_list_inv l) := by
44+
Statement (l : List G) [Group G] : is_inv (prod_list l) (prod_list_inv l) := by
4445
Hint "Since we're working with a generalized number of elements, it might be helpful to use induction. It also helps that the functions `prod_list` and `prod_list_inv` are defined recursively."
4546
induction' l with fst rst
4647

@@ -73,7 +74,7 @@ Statement inv_n_prod (l : List G) [Group G] : is_inv (prod_list l) (prod_list_in
7374
Conclusion "Congrats!"
7475

7576
/--
76-
`induction l with fst rst` is a tactic that performs induction on the list `l`, with the first element of the list being called `fst` and the rest of the list being called `rst`.
77+
`induction' l with fst rst` is a tactic that performs induction on the list `l`, with the first element of the list being called `fst` and the rest of the list being called `rst`.
7778
-/
7879
TacticDoc induction'
7980

Game/Levels/Group/L09_InvInv.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Title "Inverse of an Inverse"
88
namespace MyAlgebra
99

1010
Introduction "
11-
You would expect the inverse of an inverse to be the original element. Ex. `-(-2) = 2` or the composition of two flips is the identity. But let's formally prove it.
11+
You should expect the inverse of an inverse to be the original element. Ex. `-(-2) = 2` or the composition of two flips is the identity. But let's formally prove it.
1212
"
1313

1414
/--

Game/Levels/GroupExamples.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Game.Levels.GroupExamples.L01_Z_mod_mZ_Id
2+
import Game.Levels.GroupExamples.L02_Z_mod_mZ_Inv
3+
import Game.Levels.GroupExamples.L03_Dihedral_Id
4+
import Game.Levels.GroupExamples.L04_Dihedral_Inv
5+
6+
World "Group Examples"
7+
Title "Group Examples World"
8+
9+
Introduction "
10+
In this world, we will explore some examples of groups. We will see how the axioms of groups apply to these examples and how they can be used to prove properties about the groups.
11+
"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import Game.MyAlgebra.Z_mod_mZ
2+
import Game.Levels.Group.L05_OneUnique
3+
4+
World "Group Examples"
5+
Level 1
6+
7+
Title "Z mod mZ Identity"
8+
9+
namespace MyAlgebra
10+
11+
Introduction "
12+
The set of integers Z = {... , −2, −1, 0, 1, 2, . . .} is a group if we use addition as the group law. It is an example of group with infinitely many elements.
13+
14+
What goes wrong if we try to use multiplication as the group law?
15+
16+
The set of integers modulo m (denoted Z/mZ) forms a group with addition as the group law.
17+
18+
Ex. Z/12Z = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} is the group of integers modulo 12, which we use on clocks. If it's 11am and you add 1 hour, the clock wraps back to the start and it becomes 0pm (or 12pm).
19+
20+
In this level, we will prove that the identity element of the group Z_mod_mZ is 0.
21+
"
22+
23+
/--
24+
`Z_mod_mZ_id` is a proof that the identity element of the group `Z_mod_mZ` is `0`.
25+
-/
26+
TheoremDoc MyAlgebra.Z_mod_mZ_id as "Z_mod_mZ_id" in "Group Examples"
27+
Statement Z_mod_mZ_id (m : ℕ) (a : ZMod m) : 0 + a = a ∧ a + 0 = a := by
28+
Hint "We can use `add_zero` and `zero_add` from the Natural numbers."
29+
rw [add_zero, zero_add]
30+
exact ⟨rfl, rfl⟩
31+
32+
Conclusion "Congrats!"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Game.Levels.GroupExamples.L01_Z_mod_mZ_Id
2+
3+
World "Group Examples"
4+
Level 2
5+
6+
Title "Z mod mZ Inverses"
7+
8+
namespace MyAlgebra
9+
10+
Introduction "
11+
In this level, we will prove that every element in the group `Z_mod_mZ` has an inverse.
12+
13+
It might be helpful to use the `sub_eq_add_neg` and `sub_eq_neg_add` lemmas from the Natural numbers, which relate subtraction to addition with negation. Also, `sub_self` can be used to show that subtracting an element from itself gives zero.
14+
"
15+
16+
/--
17+
`Z_mod_mZ_inv` is a proof that the group `Z_mod_mZ` has an inverse for every element `a`.
18+
-/
19+
TheoremDoc MyAlgebra.Z_mod_mZ_inv as "Z_mod_mZ_inv" in "Group Examples"
20+
Statement Z_mod_mZ_inv (m : ℕ) (a : ZMod m) : ∃ b : ZMod m, a + b = 0 ∧ b + a = 0 := by
21+
Hint "What is the inverse of an element in `Z_mod_mZ`?"
22+
use (-a : ZMod m)
23+
rw [← sub_eq_add_neg]
24+
rw [← sub_eq_neg_add]
25+
rw [sub_self]
26+
exact ⟨rfl, rfl⟩
27+
28+
Conclusion "Congrats!"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import Game.MyAlgebra.Dihedral
2+
import Game.Levels.GroupExamples.L02_Z_mod_mZ_Inv
3+
4+
open MyAlgebra
5+
6+
7+
World "Group Examples"
8+
Level 3
9+
10+
Title "Dihedral Group Identity"
11+
12+
namespace MyAlgebra
13+
14+
Introduction "
15+
We can consider n-gons and their symmetries, which form a group called the dihedral group. The dihedral group of order 2n, denoted D_n, consists of n rotations and n reflections.
16+
17+
Here is a square with its vertices labeled (1,2,3,4) and its symmetries (rotations and reflections):
18+
19+
1-----2
20+
| |
21+
4-----3
22+
23+
Rotations:
24+
0° (identity) 90° 180° 270°
25+
1-----2 4-----1 3-----4 2-----3
26+
| | | | | | | |
27+
4-----3 3-----2 2-----1 1-----4
28+
29+
Reflections:
30+
Vertical Horizontal Diagonal (\\) Diagonal (/)
31+
2-----1 4-----3 1-----4 3-----2
32+
| | | | | | | |
33+
3-----4 1-----2 2-----3 4-----1
34+
35+
Each symmetry is an element of the dihedral group D₄.
36+
37+
38+
We define the dihedral group D_n as follows:
39+
```
40+
inductive Dihedral (n : ℕ) : Type
41+
| r : ZMod n → Dihedral n
42+
| sr : ZMod n → Dihedral n
43+
```
44+
The elements of D_n are either rotations (`r i`) or reflections (`sr i`), where i is an integer modulo n. `r` stands for rotation and `s` stands for reflection.
45+
46+
In this level, we will prove that the identity element of the dihedral group D_n is the identity rotation, which does not change the polygon.
47+
"
48+
49+
namespace Dihedral
50+
51+
variable {n : ℕ}
52+
53+
/--
54+
`Dihedral_id` is a proof that the identity element of the dihedral group `D_n` is `r 0`.
55+
-/
56+
TheoremDoc MyAlgebra.Dihedral_id as "Dihedral_id" in "Group Examples"
57+
Statement Dihedral_id (n : ℕ) (a : Dihedral n) : ∃ b : Dihedral n, mul a (r 0) = a ∧ mul (r 0) a = a := by
58+
use r 0
59+
Hint "Use the definition of multiplication in the dihedral group."
60+
induction a with
61+
| r i => simp [mul]
62+
| sr i => simp [mul]
63+
64+
Conclusion "Congrats!"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import Game.Levels.GroupExamples.L03_Dihedral_Id
2+
3+
World "Group Examples"
4+
Level 4
5+
6+
Title "Z mod mZ Inverses"
7+
8+
namespace MyAlgebra
9+
10+
Introduction "
11+
In this level, we will prove that every element in the dihedral group has an inverse.
12+
"
13+
14+
namespace Dihedral
15+
16+
17+
/--
18+
`Dihedral_inv` is a proof that the group `Z_mod_mZ` has an inverse for every element `a`.
19+
-/
20+
TheoremDoc MyAlgebra.Dihedral_inv as "Dihedral_inv" in "Group Examples"
21+
Statement Dihedral_inv (n : ℕ) (a : Dihedral n) : ∃ b : Dihedral n, mul a b = (r 0) ∧ mul b a = (r 0) := by
22+
Hint "What is the inverse of an element in `Dihedral`? Dihedral elements are either rotations or reflections."
23+
induction a with
24+
| r i =>
25+
use (r (- i))
26+
simp [mul]
27+
| sr i =>
28+
use (sr i)
29+
simp [mul]
30+
31+
Conclusion "Congrats!"

Game/Levels/GroupHom.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ World "GroupHom"
88
Title "Group Homomorphisms"
99

1010
Introduction "
11-
After creating groups, it's probably a good idea to define a function between groups. There can be a lot of different functions between groups, but we only care about the ones that preserve the group structure. These functions are called homomorphisms.
11+
After creating groups, it's a good idea to define a function between them. There can be a lot of different functions between groups, but we only care about the ones that preserve the group structure (becasue they are the only interesting ones). These functions are called homomorphisms.
1212
1313
So what makes up the group structure? Well, we have a set `α`, a binary operation `*`, an identity element `1`, and inverses. Therefore, we need to define a function that preserves these aspects.
1414

0 commit comments

Comments
 (0)