feat(library/algebra/group_power): add times (additive variant of power)

This commit is contained in:
François G. Dorais 2015-08-03 12:25:33 -04:00 committed by Leonardo de Moura
parent e004ed8cba
commit 131b344519
2 changed files with 72 additions and 1 deletions

View file

@ -351,6 +351,11 @@ structure comm_group [class] (A : Type) extends group A, comm_monoid A
structure add_group [class] (A : Type) extends add_monoid A, has_neg A :=
(add_left_inv : ∀a, add (neg a) a = zero)
definition add_group.to_group {A : Type} [s : add_group A] : group A :=
⦃ group, add_monoid.to_monoid,
mul_left_inv := add_group.add_left_inv ⦄
section add_group
variables [s : add_group A]
@ -579,7 +584,6 @@ section add_comm_group
theorem sub_eq_sub_add_sub (a b c : A) : a - b = c - b + (a - c) :=
by rewrite [add_sub, sub_add_cancel] ⬝ !add.comm
end add_comm_group
definition group_of_add_group (A : Type) [G : add_group A] : group A :=

View file

@ -167,4 +167,71 @@ theorem pow_two_add (n : ) : pow 2 n + pow 2 n = pow 2 (succ n) :=
end ordered_ring
/- additive monoid -/
section add_monoid
variable [s : add_monoid A]
include s
local attribute add_monoid.to_monoid [trans-instance]
open nat
definition times : → A → A := λ n a, pow a n
infix [priority algebra.prio] `*` := times
theorem zero_times (a : A) : (0:) * a = 0 := pow_zero a
theorem succ_times (n : ) (a : A) : succ n * a = times n a + a := pow_succ a n
theorem succ_times' (n : ) (a : A) : times (succ n) a = a + (times n a) := pow_succ' a n
theorem times_zero (n : ) : n * 0 = (0:A) := one_pow n
theorem one_times (a : A) : 1 * a = a := pow_one a
theorem add_times (m n : ) (a : A) : (m + n) * a = (m * a) + (n * a) := pow_add a m n
theorem mul_times (m n : ) (a : A) : (m * n) * a = m * (n * a) := eq.subst (nat.mul.comm n m) (pow_mul a n m)
theorem times_comm (m n : ) (a : A) : (m * a) + (n * a) = (n * a) + (m * a) := pow_comm a m n
end add_monoid
/- additive commutative monoid -/
section add_comm_monoid
open nat
variable [s : add_comm_monoid A]
include s
local attribute add_comm_monoid.to_comm_monoid [trans-instance]
theorem times_add (n : ) (a b : A) : n * (a + b) = (n * a) + (n * b) := mul_pow a b n
end add_comm_monoid
section add_group
variable [s : add_group A]
include s
local attribute add_group.to_group [trans-instance]
section nat
open nat
theorem times_neg (n : ) (a : A) : n * (-a) = -(n * a) := inv_pow a n
theorem sub_times {m n : } (a : A) (H : m ≥ n) : (m - n) * a = (m * a) + -(n * a) := pow_sub a H
theorem times_neg_comm (m n : ) (a : A) : (m * (-a)) + (n * a) = (n * a) + (m * (-a)) := pow_inv_comm a m n
end nat
open int
definition itimes : → A → A := λ i a, ipow a i
theorem add_itimes (i j : ) (a : A) : itimes (i + j) a = itimes i a + itimes j a :=
ipow_add a i j
theorem itimes_comm (i j : ) (a : A) : itimes i a + itimes j a = itimes j a + itimes i a := ipow_comm a i j
end add_group
end algebra