2014-11-28 13:11:23 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Module: algebra.binary
|
|
|
|
Authors: Leonardo de Moura, Jeremy Avigad
|
|
|
|
|
|
|
|
General properties of binary operations.
|
|
|
|
-/
|
|
|
|
|
2014-10-05 17:50:13 +00:00
|
|
|
import logic.eq
|
2014-10-02 00:51:17 +00:00
|
|
|
open eq.ops
|
2014-07-25 00:46:41 +00:00
|
|
|
|
|
|
|
namespace binary
|
2014-11-28 13:11:23 +00:00
|
|
|
section
|
2014-10-09 14:13:06 +00:00
|
|
|
variable {A : Type}
|
2014-11-28 13:11:23 +00:00
|
|
|
variables (op₁ : A → A → A) (inv : A → A) (one : A)
|
|
|
|
|
|
|
|
notation [local] a * b := op₁ a b
|
|
|
|
notation [local] a ⁻¹ := inv a
|
|
|
|
notation [local] 1 := one
|
|
|
|
|
2014-11-30 13:31:34 +00:00
|
|
|
definition commutative := ∀a b, a * b = b * a
|
|
|
|
definition associative := ∀a b c, (a * b) * c = a * (b * c)
|
2014-11-28 13:11:23 +00:00
|
|
|
definition left_identity := ∀a, 1 * a = a
|
|
|
|
definition right_identity := ∀a, a * 1 = a
|
|
|
|
definition left_inverse := ∀a, a⁻¹ * a = 1
|
|
|
|
definition right_inverse := ∀a, a * a⁻¹ = 1
|
|
|
|
definition left_cancelative := ∀a b c, a * b = a * c → b = c
|
|
|
|
definition right_cancelative := ∀a b c, a * b = c * b → a = c
|
|
|
|
|
|
|
|
definition inv_op_cancel_left := ∀a b, a⁻¹ * (a * b) = b
|
|
|
|
definition op_inv_cancel_left := ∀a b, a * (a⁻¹ * b) = b
|
|
|
|
definition inv_op_cancel_right := ∀a b, a * b⁻¹ * b = a
|
|
|
|
definition op_inv_cancel_right := ∀a b, a * b * b⁻¹ = a
|
|
|
|
|
|
|
|
variable (op₂ : A → A → A)
|
|
|
|
|
|
|
|
notation [local] a + b := op₂ a b
|
|
|
|
|
|
|
|
definition left_distributive := ∀a b c, a * (b + c) = a * b + a * c
|
|
|
|
definition right_distributive := ∀a b c, (a + b) * c = a * c + b * c
|
2014-09-06 18:05:07 +00:00
|
|
|
end
|
2014-07-25 00:46:41 +00:00
|
|
|
|
2014-09-06 18:05:07 +00:00
|
|
|
context
|
2014-10-09 14:13:06 +00:00
|
|
|
variable {A : Type}
|
|
|
|
variable {f : A → A → A}
|
|
|
|
variable H_comm : commutative f
|
|
|
|
variable H_assoc : associative f
|
2014-10-21 22:27:45 +00:00
|
|
|
infixl `*` := f
|
2014-09-06 18:05:07 +00:00
|
|
|
theorem left_comm : ∀a b c, a*(b*c) = b*(a*c) :=
|
|
|
|
take a b c, calc
|
2014-11-28 13:11:23 +00:00
|
|
|
a*(b*c) = (a*b)*c : H_assoc
|
|
|
|
... = (b*a)*c : H_comm
|
2014-09-06 18:05:07 +00:00
|
|
|
... = b*(a*c) : H_assoc
|
2014-07-25 00:46:41 +00:00
|
|
|
|
2014-09-06 18:05:07 +00:00
|
|
|
theorem right_comm : ∀a b c, (a*b)*c = (a*c)*b :=
|
|
|
|
take a b c, calc
|
|
|
|
(a*b)*c = a*(b*c) : H_assoc
|
2014-11-28 13:11:23 +00:00
|
|
|
... = a*(c*b) : H_comm
|
|
|
|
... = (a*c)*b : H_assoc
|
2014-09-06 18:05:07 +00:00
|
|
|
end
|
2014-10-09 01:45:44 +00:00
|
|
|
|
|
|
|
context
|
2014-10-09 14:13:06 +00:00
|
|
|
variable {A : Type}
|
|
|
|
variable {f : A → A → A}
|
|
|
|
variable H_assoc : associative f
|
2014-10-21 22:27:45 +00:00
|
|
|
infixl `*` := f
|
2014-10-09 01:45:44 +00:00
|
|
|
theorem assoc4helper (a b c d) : (a*b)*(c*d) = a*((b*c)*d) :=
|
|
|
|
calc
|
|
|
|
(a*b)*(c*d) = a*(b*(c*d)) : H_assoc
|
2014-11-28 13:11:23 +00:00
|
|
|
... = a*((b*c)*d) : H_assoc
|
2014-10-09 01:45:44 +00:00
|
|
|
end
|
|
|
|
|
2014-08-07 23:59:08 +00:00
|
|
|
end binary
|