The areas / V06. Rings, fields and ordered algebra
Mathlib.Algebra.Ring.BooleanRing
109 declarations. Mathlib docs · Source
Boolean rings
A Boolean ring is a ring where multiplication is idempotent. They are equivalent to Boolean algebras.
Main declarations
BooleanRing: a typeclass for rings where multiplication is idempotent.BooleanRing.toBooleanAlgebra: Turn a Boolean ring into a Boolean algebra.BooleanAlgebra.toBooleanRing: Turn a Boolean algebra into a Boolean ring.AsBoolAlg: Type-synonym for the Boolean algebra associated to a Boolean ring.AsBoolRing: Type-synonym for the Boolean ring associated to a Boolean algebra.
Implementation notes
We provide two ways of turning a Boolean algebra/ring into a Boolean ring/algebra:
- Instances on the same type accessible in locales
BooleanAlgebraOfBooleanRingandBooleanRingOfBooleanAlgebra. - Type-synonyms
AsBoolAlgandAsBoolRing.
At this point in time, it is not clear the first way is useful, but we keep it for educational
purposes and because it is easier than dealing with
ofBoolAlg/toBoolAlg/ofBoolRing/toBoolRing explicitly.
Tags
boolean ring, boolean algebra
Turning a Boolean ring into a Boolean algebra
Turning a Boolean algebra into a Boolean ring
Equivalence between Boolean rings and Boolean algebras
def BooleanRing.ctorIdx E1 #
{α : Type u_4} → BooleanRing α → ℕ
class BooleanRing E3 #
Type u_4 → Type u_4
A Boolean ring is a ring where multiplication is idempotent.
instance BooleanRing.toRing E0 #
{α : Type u_4} → [self : BooleanRing α] → Ring α
ctor BooleanRing.mk E0 #
{α : Type u_4} → [toRing : Ring α] → (∀ (a : α), IsIdempotentElem a) → BooleanRing α
theorem BooleanRing.isIdempotentElem E1 #
∀ {α : Type u_4} [self : BooleanRing α] (a : α), IsIdempotentElem a
Multiplication in a Boolean ring is idempotent.
theorem BooleanRing.mul_self E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a : α), a * a = a
instance BooleanRing.instIdempotentOpHMul E0 #
∀ {α : Type u_1} [inst : BooleanRing α], Std.IdempotentOp fun x1 x2 ↦ x1 * x2
theorem BooleanRing.add_self E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a : α), a + a = 0
theorem BooleanRing.neg_eq E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a : α), -a = a
theorem BooleanRing.add_eq_zero' E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), a + b = 0 ↔ a = b
theorem BooleanRing.mul_add_mul E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), a * b + b * a = 0
theorem BooleanRing.sub_eq_add E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), a - b = a + b
theorem BooleanRing.mul_one_add_self E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a : α), a * (1 + a) = 0
instance BooleanRing.toCommRing E0 #
{α : Type u_1} → [BooleanRing α] → CommRing α
instance instBooleanRingPUnit E0 #
BooleanRing PUnit.{u_4 + 1}
def AsBoolAlg E3 #
Type u_4 → Type u_4
Type synonym to view a Boolean ring as a Boolean algebra.
def toBoolAlg E1 #
{α : Type u_1} → α ≃ AsBoolAlg α
The "identity" equivalence between AsBoolAlg α and α.
def ofBoolAlg E1 #
{α : Type u_1} → AsBoolAlg α ≃ α
The "identity" equivalence between α and AsBoolAlg α.
theorem toBoolAlg_symm_eq E0 #
∀ {α : Type u_1}, toBoolAlg.symm = ofBoolAlg
theorem ofBoolAlg_symm_eq E0 #
∀ {α : Type u_1}, ofBoolAlg.symm = toBoolAlg
theorem toBoolAlg_ofBoolAlg E0 #
∀ {α : Type u_1} (a : AsBoolAlg α), toBoolAlg (ofBoolAlg a) = a
theorem ofBoolAlg_toBoolAlg E0 #
∀ {α : Type u_1} (a : α), ofBoolAlg (toBoolAlg a) = a
theorem toBoolAlg_inj E1 #
∀ {α : Type u_1} {a b : α}, toBoolAlg a = toBoolAlg b ↔ a = b
theorem ofBoolAlg_inj E1 #
∀ {α : Type u_1} {a b : AsBoolAlg α}, ofBoolAlg a = ofBoolAlg b ↔ a = b
def AsBoolAlg.rec E1 #
{α : Type u_1} → {motive : AsBoolAlg α → Sort u_4} → ((a : α) → motive (toBoolAlg a)) → (a : AsBoolAlg α) → motive a
A recursor for AsBoolAlg. Use as induction x.
instance instInhabitedAsBoolAlg E0 #
{α : Type u_1} → [Inhabited α] → Inhabited (AsBoolAlg α)
def BooleanRing.sup E1 #
{α : Type u_1} → [BooleanRing α] → Max α
The join operation in a Boolean ring is x + y + x * y.
def BooleanRing.inf E1 #
{α : Type u_1} → [BooleanRing α] → Min α
The meet operation in a Boolean ring is x * y.
theorem BooleanRing.sup_comm E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), a ⊔ b = b ⊔ a
theorem BooleanRing.inf_comm E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), a ⊓ b = b ⊓ a
theorem BooleanRing.sup_assoc E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b c : α), a ⊔ b ⊔ c = a ⊔ (b ⊔ c)
theorem BooleanRing.inf_assoc E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b c : α), a ⊓ b ⊓ c = a ⊓ (b ⊓ c)
theorem BooleanRing.sup_inf_self E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), a ⊔ a ⊓ b = a
theorem BooleanRing.inf_sup_self E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), a ⊓ (a ⊔ b) = a
theorem BooleanRing.le_sup_inf_aux E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b c : α), (a + b + a * b) * (a + c + a * c) = a + b * c + a * (b * c)
theorem BooleanRing.le_sup_inf E1 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b c : α), (a ⊔ b) ⊓ (a ⊔ c) ⊔ (a ⊔ b ⊓ c) = a ⊔ b ⊓ c
theorem BooleanRing.sup_def E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), a ⊔ b = a + b + a * b
theorem BooleanRing.inf_def E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), a ⊓ b = a * b
def BooleanRing.toBooleanAlgebra E3 #
{α : Type u_1} → [BooleanRing α] → BooleanAlgebra α
The Boolean algebra structure on a Boolean ring.
The data is defined so that:
a ⊔ bunfolds toa + b + a * ba ⊓ bunfolds toa * ba ≤ bunfolds toa + b + a * b = b⊥unfolds to0⊤unfolds to1aᶜunfolds to1 + aa \ bunfolds toa * (1 + b)
instance instBooleanAlgebraAsBoolAlg E0 #
{α : Type u_1} → [BooleanRing α] → BooleanAlgebra (AsBoolAlg α)
theorem ofBoolAlg_top E0 #
∀ {α : Type u_1} [inst : BooleanRing α], ofBoolAlg ⊤ = 1
theorem ofBoolAlg_bot E0 #
∀ {α : Type u_1} [inst : BooleanRing α], ofBoolAlg ⊥ = 0
theorem ofBoolAlg_sup E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : AsBoolAlg α),
ofBoolAlg (a ⊔ b) = ofBoolAlg a + ofBoolAlg b + ofBoolAlg a * ofBoolAlg b
theorem ofBoolAlg_inf E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : AsBoolAlg α), ofBoolAlg (a ⊓ b) = ofBoolAlg a * ofBoolAlg b
theorem ofBoolAlg_compl E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a : AsBoolAlg α), ofBoolAlg aᶜ = 1 + ofBoolAlg a
theorem ofBoolAlg_sdiff E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : AsBoolAlg α), ofBoolAlg (a \ b) = ofBoolAlg a * (1 + ofBoolAlg b)
theorem ofBoolAlg_symmDiff E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : AsBoolAlg α), ofBoolAlg (symmDiff a b) = ofBoolAlg a + ofBoolAlg b
theorem ofBoolAlg_mul_ofBoolAlg_eq_left_iff E0 #
∀ {α : Type u_1} [inst : BooleanRing α] {a b : AsBoolAlg α}, ofBoolAlg a * ofBoolAlg b = ofBoolAlg a ↔ a ≤ b
theorem toBoolAlg_zero E0 #
∀ {α : Type u_1} [inst : BooleanRing α], toBoolAlg 0 = ⊥
theorem toBoolAlg_one E0 #
∀ {α : Type u_1} [inst : BooleanRing α], toBoolAlg 1 = ⊤
theorem toBoolAlg_mul E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), toBoolAlg (a * b) = toBoolAlg a ⊓ toBoolAlg b
theorem toBoolAlg_add_add_mul E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), toBoolAlg (a + b + a * b) = toBoolAlg a ⊔ toBoolAlg b
theorem toBoolAlg_add E0 #
∀ {α : Type u_1} [inst : BooleanRing α] (a b : α), toBoolAlg (a + b) = symmDiff (toBoolAlg a) (toBoolAlg b)
def RingHom.asBoolAlg E1 #
{α : Type u_1} →
{β : Type u_2} →
[inst : BooleanRing α] → [inst_1 : BooleanRing β] → (α →+* β) → BoundedLatticeHom (AsBoolAlg α) (AsBoolAlg β)
Turn a ring homomorphism from Boolean rings α to β into a bounded lattice homomorphism
from α to β considered as Boolean algebras.
theorem RingHom.asBoolAlg_toFun E0 #
∀ {α : Type u_1} {β : Type u_2} [inst : BooleanRing α] [inst_1 : BooleanRing β] (f : α →+* β) (a : AsBoolAlg α),
f.asBoolAlg a = (⇑toBoolAlg ∘ ⇑f ∘ ⇑ofBoolAlg) a
theorem RingHom.asBoolAlg_id E0 #
∀ {α : Type u_1} [inst : BooleanRing α], (RingHom.id α).asBoolAlg = BoundedLatticeHom.id (AsBoolAlg α)
theorem RingHom.asBoolAlg_comp E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} [inst : BooleanRing α] [inst_1 : BooleanRing β] [inst_2 : BooleanRing γ]
(g : β →+* γ) (f : α →+* β), (g.comp f).asBoolAlg = g.asBoolAlg.comp f.asBoolAlg
def AsBoolRing E3 #
Type u_4 → Type u_4
Type synonym to view a Boolean ring as a Boolean algebra.
def toBoolRing E1 #
{α : Type u_1} → α ≃ AsBoolRing α
The "identity" equivalence between AsBoolRing α and α.
def ofBoolRing E1 #
{α : Type u_1} → AsBoolRing α ≃ α
The "identity" equivalence between α and AsBoolRing α.
theorem toBoolRing_symm_eq E0 #
∀ {α : Type u_1}, toBoolRing.symm = ofBoolRing
theorem ofBoolRing_symm_eq E0 #
∀ {α : Type u_1}, ofBoolRing.symm = toBoolRing
theorem toBoolRing_ofBoolRing E0 #
∀ {α : Type u_1} (a : AsBoolRing α), toBoolRing (ofBoolRing a) = a
theorem ofBoolRing_toBoolRing E0 #
∀ {α : Type u_1} (a : α), ofBoolRing (toBoolRing a) = a
theorem toBoolRing_inj E1 #
∀ {α : Type u_1} {a b : α}, toBoolRing a = toBoolRing b ↔ a = b
theorem ofBoolRing_inj E1 #
∀ {α : Type u_1} {a b : AsBoolRing α}, ofBoolRing a = ofBoolRing b ↔ a = b
def AsBoolRing.rec E1 #
{α : Type u_1} → {motive : AsBoolRing α → Sort u_4} → ((a : α) → motive (toBoolRing a)) → (a : AsBoolRing α) → motive a
A recursor for AsBoolRing. Use as induction x.
instance instInhabitedAsBoolRing E0 #
{α : Type u_1} → [Inhabited α] → Inhabited (AsBoolRing α)
abbrev GeneralizedBooleanAlgebra.toNonUnitalCommRing E1 #
{α : Type u_1} → [GeneralizedBooleanAlgebra α] → NonUnitalCommRing α
Every generalized Boolean algebra has the structure of a nonunital commutative ring with the following data:
a + bunfolds toa ∆ b(symmetric difference)a * bunfolds toa ⊓ b-aunfolds toa0unfolds to⊥
instance instNonUnitalCommRingAsBoolRingOfGeneralizedBooleanAlgebra E0 #
{α : Type u_1} → [GeneralizedBooleanAlgebra α] → NonUnitalCommRing (AsBoolRing α)
abbrev BooleanAlgebra.toBooleanRing E3 #
{α : Type u_1} → [BooleanAlgebra α] → BooleanRing α
Every Boolean algebra has the structure of a Boolean ring with the following data:
a + bunfolds toa ∆ b(symmetric difference)a * bunfolds toa ⊓ b-aunfolds toa0unfolds to⊥1unfolds to⊤
instance instBooleanRingAsBoolRing E0 #
{α : Type u_1} → [BooleanAlgebra α] → BooleanRing (AsBoolRing α)
theorem ofBoolRing_zero E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α], ofBoolRing 0 = ⊥
theorem ofBoolRing_one E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α], ofBoolRing 1 = ⊤
theorem ofBoolRing_neg E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] (a : AsBoolRing α), ofBoolRing (-a) = ofBoolRing a
theorem ofBoolRing_add E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] (a b : AsBoolRing α),
ofBoolRing (a + b) = symmDiff (ofBoolRing a) (ofBoolRing b)
theorem ofBoolRing_sub E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] (a b : AsBoolRing α),
ofBoolRing (a - b) = symmDiff (ofBoolRing a) (ofBoolRing b)
theorem ofBoolRing_mul E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] (a b : AsBoolRing α), ofBoolRing (a * b) = ofBoolRing a ⊓ ofBoolRing b
theorem ofBoolRing_le_ofBoolRing_iff E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] {a b : AsBoolRing α}, ofBoolRing a ≤ ofBoolRing b ↔ a * b = a
theorem toBoolRing_bot E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α], toBoolRing ⊥ = 0
theorem toBoolRing_top E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α], toBoolRing ⊤ = 1
theorem toBoolRing_inf E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] (a b : α), toBoolRing (a ⊓ b) = toBoolRing a * toBoolRing b
theorem toBoolRing_symmDiff E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] (a b : α), toBoolRing (symmDiff a b) = toBoolRing a + toBoolRing b
theorem toBoolRing_compl E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] (a : α), toBoolRing aᶜ = 1 + toBoolRing a
theorem toBoolRing_sup E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] (a b : α),
toBoolRing (a ⊔ b) = toBoolRing a + toBoolRing b + toBoolRing a * toBoolRing b
theorem toBoolRing_sdiff E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α] (a b : α), toBoolRing (a \ b) = toBoolRing a * (1 + toBoolRing b)
def BoundedLatticeHom.asBoolRing E1 #
{α : Type u_1} →
{β : Type u_2} →
[inst : BooleanAlgebra α] → [inst_1 : BooleanAlgebra β] → BoundedLatticeHom α β → AsBoolRing α →+* AsBoolRing β
Turn a bounded lattice homomorphism from Boolean algebras α to β into a ring homomorphism
from α to β considered as Boolean rings.
theorem BoundedLatticeHom.asBoolRing_apply E0 #
∀ {α : Type u_1} {β : Type u_2} [inst : BooleanAlgebra α] [inst_1 : BooleanAlgebra β] (f : BoundedLatticeHom α β)
(a : AsBoolRing α), f.asBoolRing a = (⇑toBoolRing ∘ ⇑f ∘ ⇑ofBoolRing) a
theorem BoundedLatticeHom.asBoolRing_id E0 #
∀ {α : Type u_1} [inst : BooleanAlgebra α], (BoundedLatticeHom.id α).asBoolRing = RingHom.id (AsBoolRing α)
theorem BoundedLatticeHom.asBoolRing_comp E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} [inst : BooleanAlgebra α] [inst_1 : BooleanAlgebra β]
[inst_2 : BooleanAlgebra γ] (g : BoundedLatticeHom β γ) (f : BoundedLatticeHom α β),
(g.comp f).asBoolRing = g.asBoolRing.comp f.asBoolRing
def OrderIso.asBoolAlgAsBoolRing E1 #
(α : Type u_4) → [inst : BooleanAlgebra α] → AsBoolAlg (AsBoolRing α) ≃o α
Order isomorphism between α considered as a Boolean ring considered as a Boolean algebra and
α.
theorem OrderIso.asBoolAlgAsBoolRing_apply E0 #
∀ (α : Type u_4) [inst : BooleanAlgebra α] (a : AsBoolAlg (AsBoolRing α)),
(OrderIso.asBoolAlgAsBoolRing α) a = ofBoolRing (ofBoolAlg a)
theorem OrderIso.asBoolAlgAsBoolRing_symm_apply E0 #
∀ (α : Type u_4) [inst : BooleanAlgebra α] (a : α),
(RelIso.symm (OrderIso.asBoolAlgAsBoolRing α)) a = toBoolAlg (toBoolRing a)
def RingEquiv.asBoolRingAsBoolAlg E1 #
(α : Type u_4) → [inst : BooleanRing α] → AsBoolRing (AsBoolAlg α) ≃+* α
Ring isomorphism between α considered as a Boolean algebra considered as a Boolean ring and
α.
theorem RingEquiv.asBoolRingAsBoolAlg_apply E0 #
∀ (α : Type u_4) [inst : BooleanRing α] (a : AsBoolRing (AsBoolAlg α)),
(RingEquiv.asBoolRingAsBoolAlg α) a = ofBoolAlg (ofBoolRing a)
theorem RingEquiv.asBoolRingAsBoolAlg_symm_apply E0 #
∀ (α : Type u_4) [inst : BooleanRing α] (a : α), (RingEquiv.asBoolRingAsBoolAlg α).symm a = toBoolRing (toBoolAlg a)
instance instZeroBool_mathlib E0 #
Zero Bool
instance instOneBool_mathlib E0 #
One Bool
instance instAddBool_mathlib E0 #
Add Bool
instance instNegBool_mathlib E0 #
Neg Bool
instance instSubBool_mathlib E0 #
Sub Bool
instance instMulBool_mathlib E0 #
Mul Bool
instance instBooleanRingBool E0 #
BooleanRing Bool
theorem Bool.zero_eq_false E1 #
0 = false
theorem Bool.one_eq_true E1 #
1 = true
theorem Bool.add_eq_xor E1 #
∀ (b c : Bool), b + c = (b ^^ c)
theorem Bool.neg_eq_id E1 #
∀ (b : Bool), -b = b
theorem Bool.sub_eq_xor E1 #
∀ (b c : Bool), b - c = (b ^^ c)
theorem Bool.mul_eq_and E1 #
∀ (b c : Bool), b * c = (b && c)