order.symm_diff

# Symmetric difference #

The symmetric difference or disjunctive union of sets A and B is the set of elements that are in either A or B but not both. Translated into propositions, the symmetric difference is xor.

The symmetric difference operator (symm_diff) is defined in this file for any type with and \ via the formula (A \ B) ⊔ (B \ A), however the theorems proved about it only hold for generalized_boolean_algebras and boolean_algebras.

The symmetric difference is the addition operator in the Boolean ring structure on Boolean algebras.

## Main declarations #

• symm_diff: the symmetric difference operator, defined as (A \ B) ⊔ (B \ A)

In generalized Boolean algebras, the symmetric difference operator is:

## References #

The proof of associativity follows the note "Associativity of the Symmetric Difference of Sets: A Proof from the Book" by John McCuan:

## Tags #

boolean ring, generalized boolean algebra, boolean algebra, symmetric differences

def symm_diff {α : Type u_1} [has_sup α] [has_sdiff α] (A B : α) :
α

The symmetric difference operator on a type with and \ is (A \ B) ⊔ (B \ A).

Equations
Instances for symm_diff
theorem symm_diff_def {α : Type u_1} [has_sup α] [has_sdiff α] (A B : α) :
A B = A \ B B \ A
theorem symm_diff_eq_xor (p q : Prop) :
p q = xor p q
@[simp]
theorem bool.symm_diff_eq_bxor (p q : bool) :
p q = bxor p q
theorem symm_diff_comm {α : Type u_1} (a b : α) :
a b = b a
@[protected, instance]
def symm_diff_is_comm {α : Type u_1}  :
@[simp]
theorem symm_diff_self {α : Type u_1} (a : α) :
a a =
@[simp]
theorem symm_diff_bot {α : Type u_1} (a : α) :
a = a
@[simp]
theorem bot_symm_diff {α : Type u_1} (a : α) :
a = a
theorem symm_diff_eq_sup_sdiff_inf {α : Type u_1} (a b : α) :
a b = (a b) \ (a b)
@[simp]
theorem sup_sdiff_symm_diff {α : Type u_1} (a b : α) :
(a b) \ a b = a b
theorem disjoint_symm_diff_inf {α : Type u_1} (a b : α) :
disjoint (a b) (a b)
theorem symm_diff_le_sup {α : Type u_1} (a b : α) :
a b a b
theorem inf_symm_diff_distrib_left {α : Type u_1} (a b c : α) :
a b c = (a b) (a c)
theorem inf_symm_diff_distrib_right {α : Type u_1} (a b c : α) :
a b c = (a c) (b c)
theorem sdiff_symm_diff {α : Type u_1} (a b c : α) :
c \ a b = c a b c \ a c \ b
theorem sdiff_symm_diff' {α : Type u_1} (a b c : α) :
c \ a b = c a b c \ (a b)
theorem symm_diff_sdiff {α : Type u_1} (a b c : α) :
a b \ c = a \ (b c) b \ (a c)
@[simp]
theorem symm_diff_sdiff_left {α : Type u_1} (a b : α) :
a b \ a = b \ a
@[simp]
theorem symm_diff_sdiff_right {α : Type u_1} (a b : α) :
a b \ b = a \ b
@[simp]
theorem sdiff_symm_diff_self {α : Type u_1} (a b : α) :
a \ a b = a b
theorem symm_diff_eq_iff_sdiff_eq {α : Type u_1} {a b c : α} (ha : a c) :
a b = c c \ a = b
theorem disjoint.symm_diff_eq_sup {α : Type u_1} {a b : α} (h : b) :
a b = a b
theorem symm_diff_eq_sup {α : Type u_1} (a b : α) :
a b = a b b
@[simp]
theorem le_symm_diff_iff_left {α : Type u_1} (a b : α) :
a a b b
@[simp]
theorem le_symm_diff_iff_right {α : Type u_1} (a b : α) :
b a b b
theorem symm_diff_symm_diff_left {α : Type u_1} (a b c : α) :
a b c = a \ (b c) b \ (a c) c \ (a b) a b c
theorem symm_diff_symm_diff_right {α : Type u_1} (a b c : α) :
a (b c) = a \ (b c) b \ (a c) c \ (a b) a b c
@[simp]
theorem symm_diff_symm_diff_inf {α : Type u_1} (a b : α) :
a b (a b) = a b
@[simp]
theorem inf_symm_diff_symm_diff {α : Type u_1} (a b : α) :
(a b) (a b) = a b
theorem symm_diff_triangle {α : Type u_1} (a b c : α) :
a c a b b c
theorem symm_diff_assoc {α : Type u_1} (a b c : α) :
a b c = a (b c)
@[protected, instance]
def symm_diff_is_assoc {α : Type u_1}  :
theorem symm_diff_left_comm {α : Type u_1} (a b c : α) :
a (b c) = b (a c)
theorem symm_diff_right_comm {α : Type u_1} (a b c : α) :
a b c = a c b
theorem symm_diff_symm_diff_symm_diff_comm {α : Type u_1} (a b c d : α) :
a b (c d) = a c (b d)
@[simp]
theorem symm_diff_symm_diff_cancel_left {α : Type u_1} (a b : α) :
a (a b) = b
@[simp]
theorem symm_diff_symm_diff_cancel_right {α : Type u_1} (a b : α) :
b a a = b
@[simp]
theorem symm_diff_symm_diff_self' {α : Type u_1} (a b : α) :
a b a = b
theorem symm_diff_left_involutive {α : Type u_1} (a : α) :
function.involutive (λ (_x : α), _x a)
theorem symm_diff_right_involutive {α : Type u_1} (a : α) :
theorem symm_diff_left_injective {α : Type u_1} (a : α) :
function.injective (λ (_x : α), _x a)
theorem symm_diff_right_injective {α : Type u_1} (a : α) :
theorem symm_diff_left_surjective {α : Type u_1} (a : α) :
function.surjective (λ (_x : α), _x a)
theorem symm_diff_right_surjective {α : Type u_1} (a : α) :
@[simp]
theorem symm_diff_left_inj {α : Type u_1} {a b c : α} :
a b = c b a = c
@[simp]
theorem symm_diff_right_inj {α : Type u_1} {a b c : α} :
a b = a c b = c
@[simp]
theorem symm_diff_eq_left {α : Type u_1} {a b : α} :
a b = a b =
@[simp]
theorem symm_diff_eq_right {α : Type u_1} {a b : α} :
a b = b a =
@[simp]
theorem symm_diff_eq_bot {α : Type u_1} {a b : α} :
a b = a = b
@[protected]
theorem disjoint.symm_diff_left {α : Type u_1} {a b c : α} (ha : c) (hb : c) :
disjoint (a b) c
@[protected]
theorem disjoint.symm_diff_right {α : Type u_1} {a b c : α} (ha : b) (hb : c) :
(b c)
theorem symm_diff_eq {α : Type u_1} (a b : α) :
a b = a b b a
@[simp]
theorem symm_diff_top {α : Type u_1} (a : α) :
@[simp]
theorem top_symm_diff {α : Type u_1} (a : α) :
theorem compl_symm_diff {α : Type u_1} (a b : α) :
(a b) = a b a b
theorem symm_diff_eq_top_iff {α : Type u_1} (a b : α) :
a b = b
theorem is_compl.symm_diff_eq_top {α : Type u_1} (a b : α) (h : b) :
a b =
@[simp]
theorem compl_symm_diff_self {α : Type u_1} (a : α) :
@[simp]
theorem symm_diff_compl_self {α : Type u_1} (a : α) :
theorem symm_diff_symm_diff_right' {α : Type u_1} (a b c : α) :
a (b c) = a b c a b c a b c a b c