Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Algebra/*): beginning of algebra heirarchy #4

Merged
merged 4 commits into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 48 additions & 0 deletions Mathlib/Algebra/Group/Basic.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import Mathlib.Algebra.Group.Defs
import Mathlib.Logic.Basic

section AddCommSemigroup_lemmas

variable {A : Type u} [AddCommSemigroup A]

lemma add_left_comm (a b c : A) : a + (b + c) = b + (a + c) :=
by rw [← add_assoc, add_comm a, add_assoc]

lemma add_right_comm (a b c : A) : a + b + c = a + c + b :=
by rw [add_assoc, add_comm b, add_assoc]

theorem add_add_add_comm (a b c d : A) : (a + b) +(c + d) = (a + c) + (b + d) :=
by simp [add_left_comm, add_assoc]

end AddCommSemigroup_lemmas

section CommSemigroup_lemmas

variable {M : Type u} [CommSemigroup M]

lemma mul_left_comm (a b c : M) : a * (b * c) = b * (a * c) :=
by rw [← mul_assoc, mul_comm a, mul_assoc]

-- Funky Lean 3 proof of the above:
--left_comm has_mul.mul mul_comm mul_assoc

lemma mul_right_comm (a b c : M) : a * b * c = a * c * b :=
by rw [mul_assoc, mul_comm b c, mul_assoc]

theorem mul_mul_mul_comm (a b c d : M) : (a * b) * (c * d) = (a * c) * (b * d) :=
by simp [mul_assoc, mul_left_comm]

end CommSemigroup_lemmas

section AddLeftCancelMonoid_lemmas
-- too lazy to do mul versions and right versions

variable {A : Type u} [AddMonoid A] [IsAddLeftCancel A] {a b : A}

lemma add_right_eq_self : a + b = a ↔ b = 0 :=
by rw [←add_left_cancel_iff (c := 0), add_zero]

lemma self_eq_add_right : a = a + b ↔ b = 0 :=
by rw [←add_left_cancel_iff (c := 0), add_zero, eq_comm]

end AddLeftCancelMonoid_lemmas