-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathAddGroup.lean
More file actions
62 lines (40 loc) · 2.07 KB
/
AddGroup.lean
File metadata and controls
62 lines (40 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module
import Mathlib.Tactic.AddGroup
public import Mathlib.Algebra.Group.Commutator
variable {G : Type} [AddGroup G]
attribute [instance] addCommutatorElement
example (a b c : G) : c + (a + b) + (-b + -a) + c = c + c := by add_group
example (a b c : G) : (b + -c) + c + (a + b) + (-b + -a) + c = b + c := by add_group
example (a b c : G) : -c + (b + -c) + c + (a + b) + (-b + -a + -b) + c = 0 := by add_group
-- The following is known as the Hall-Witt identity,
-- see e.g.
-- https://en.wikipedia.org/wiki/Three_subgroups_lemma#Proof_and_the_Hall%E2%80%93Witt_identity
example (g h k : G) :
g + ⁅⁅-g, h⁆, k⁆ + -g + k + ⁅⁅-k, g⁆, h⁆ + -k + h + ⁅⁅-h, k⁆, g⁆ + -h = 0 := by add_group
example (a : G) : 2 • a + a = 3 • a := by add_group
example (n m : ℕ) (a : G) : n • a + m • a = (n + m) • a := by add_group
example (a b c : G) : c + (a + 2 • b) + (-(b + b) + -a) + c = c + c := by add_group
example (n : ℕ) (a : G) : n • a + n • (-a) = 0 := by add_group
example (a : G) : 2 • a + -a + -a = 0 := by add_group
example (n m : ℕ) (a : G) : n • a + m • a = (m + n) • a := by add_group
example (n : ℕ) (a : G) : (n - n) • a = 0 := by add_group
example (n : ℤ) (a : G) : (n - n) • a = 0 := by add_group
example (n : ℤ) (a : G) (h : (n * (n + 1) - n - n ^ 2) • a = a) : a = 0 := by
add_group at h
exact h.symm
example (a b c d : G) (h : c = (a + 2 • b) + (-(b + b) + -a) + d) : a + c + -d = a := by
add_group at h
rw [h]
add_group
-- The next example can be expanded to require an arbitrarily high number of alternations
-- between simp and ring
example (n m : ℤ) (a b : G) : (m - n) • a + (m - n) • b + (n - m) • b + (n - m) • a = 0 := by
add_group
example (n : ℤ) (a b : G) :
n • a + n • b + n • a + n • a + (-n) • a + (-n) • a + (-n) • b + (-n) • a = 0 := by add_group
-- Test that add_group deals with `-(0)` properly
example (x y : G) : -((-x) + (x + y) + (-y)) = 0 := by add_group
set_option linter.unusedTactic false in
example (x : G) (h : x = 0) : x = 0 := by
add_group
exact h