Documentation

Mathlib.Data.LawfulXor

The LawfulXor typeclass #

This file generalizes basic lemmas about the ^^^ operator across numeric types.

class LawfulXor (α : Type u_1) [XorOp α] [Zero α] :

A typeclass indicating that the xor operation, ^^^, is lawful.

  • xor_assoc (a b c : α) : a ^^^ b ^^^ c = a ^^^ (b ^^^ c)
  • xor_self (a : α) : a ^^^ a = 0
  • xor_zero (a : α) : a ^^^ 0 = a
  • xor_comm (a b : α) : a ^^^ b = b ^^^ a
Instances
    @[simp]
    theorem zero_xor {α : Type u_1} [XorOp α] [Zero α] [LawfulXor α] (a : α) :
    0 ^^^ a = a
    @[simp]
    theorem xor_cancel_right {α : Type u_1} [XorOp α] [Zero α] [LawfulXor α] (a b : α) :
    a ^^^ b ^^^ b = a
    @[simp]
    theorem xor_cancel_left {α : Type u_1} [XorOp α] [Zero α] [LawfulXor α] (a b : α) :
    a ^^^ (a ^^^ b) = b
    theorem xor_right_involutive {α : Type u_1} [XorOp α] [Zero α] [LawfulXor α] (a : α) :
    Function.Involutive fun (x : α) => a ^^^ x
    theorem xor_left_involutive {α : Type u_1} [XorOp α] [Zero α] [LawfulXor α] (a : α) :
    Function.Involutive fun (x : α) => x ^^^ a
    theorem xor_eq_iff_left_eq {α : Type u_1} [XorOp α] [Zero α] [LawfulXor α] (a b c : α) :
    a ^^^ b = c a = c ^^^ b
    theorem xor_eq_iff_right_eq {α : Type u_1} [XorOp α] [Zero α] [LawfulXor α] (a b c : α) :
    a ^^^ b = c b = a ^^^ c