Boolean rings #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
A Boolean ring is a ring where multiplication is idempotent. They are equivalent to Boolean algebras.
Main declarations #
boolean_ring
: a typeclass for rings where multiplication is idempotent.boolean_ring.to_boolean_algebra
: Turn a Boolean ring into a Boolean algebra.boolean_algebra.to_boolean_ring
: Turn a Boolean algebra into a Boolean ring.as_boolalg
: Type-synonym for the Boolean algebra associated to a Boolean ring.as_boolring
: 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
boolean_algebra_of_boolean_ring
andboolean_ring_of_boolean_algebra
. - Type-synonyms
as_boolalg
andas_boolring
.
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
of_boolalg
/to_boolalg
/of_boolring
/to_boolring
explicitly.
Tags #
boolean ring, boolean algebra
A Boolean ring is a ring where multiplication is idempotent.
Instances of this typeclass
Instances of other typeclasses for boolean_ring
- boolean_ring.has_sizeof_inst
Equations
- boolean_ring.to_comm_ring = {add := ring.add boolean_ring.to_ring, add_assoc := _, zero := ring.zero boolean_ring.to_ring, zero_add := _, add_zero := _, nsmul := ring.nsmul boolean_ring.to_ring, nsmul_zero' := _, nsmul_succ' := _, neg := ring.neg boolean_ring.to_ring, sub := ring.sub boolean_ring.to_ring, sub_eq_add_neg := _, zsmul := ring.zsmul boolean_ring.to_ring, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _, int_cast := ring.int_cast boolean_ring.to_ring, nat_cast := ring.nat_cast boolean_ring.to_ring, one := ring.one boolean_ring.to_ring, nat_cast_zero := _, nat_cast_succ := _, int_cast_of_nat := _, int_cast_neg_succ_of_nat := _, mul := ring.mul boolean_ring.to_ring, mul_assoc := _, one_mul := _, mul_one := _, npow := ring.npow boolean_ring.to_ring, npow_zero' := _, npow_succ' := _, left_distrib := _, right_distrib := _, mul_comm := _}
Instances for boolean_ring.to_comm_ring
Equations
- punit.boolean_ring = {to_ring := comm_ring.to_ring punit punit.comm_ring, mul_self := punit.boolean_ring._proof_1}
Turning a Boolean ring into a Boolean algebra #
Type synonym to view a Boolean ring as a Boolean algebra.
Equations
- as_boolalg α = α
Instances for as_boolalg
The "identity" equivalence between as_boolalg α
and α
.
Equations
The "identity" equivalence between α
and as_boolalg α
.
Equations
Equations
- as_boolalg.inhabited = _inst_1
The join operation in a Boolean ring is x + y + x * y
.
The meet operation in a Boolean ring is x * y
.
Equations
The Boolean algebra structure on a Boolean ring.
The data is defined so that:
a ⊔ b
unfolds toa + b + a * b
a ⊓ b
unfolds toa * b
a ≤ b
unfolds toa + b + a * b = b
⊥
unfolds to0
⊤
unfolds to1
aᶜ
unfolds to1 + a
a \ b
unfolds toa * (1 + b)
Equations
- boolean_ring.to_boolean_algebra = {sup := lattice.sup (lattice.mk' boolean_ring.sup_comm boolean_ring.sup_assoc boolean_ring.inf_comm boolean_ring.inf_assoc boolean_ring.sup_inf_self boolean_ring.inf_sup_self), le := lattice.le (lattice.mk' boolean_ring.sup_comm boolean_ring.sup_assoc boolean_ring.inf_comm boolean_ring.inf_assoc boolean_ring.sup_inf_self boolean_ring.inf_sup_self), lt := lattice.lt (lattice.mk' boolean_ring.sup_comm boolean_ring.sup_assoc boolean_ring.inf_comm boolean_ring.inf_assoc boolean_ring.sup_inf_self boolean_ring.inf_sup_self), le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_sup_left := _, le_sup_right := _, sup_le := _, inf := lattice.inf (lattice.mk' boolean_ring.sup_comm boolean_ring.sup_assoc boolean_ring.inf_comm boolean_ring.inf_assoc boolean_ring.sup_inf_self boolean_ring.inf_sup_self), inf_le_left := _, inf_le_right := _, le_inf := _, le_sup_inf := _, compl := λ (a : α), 1 + a, sdiff := λ (x y : α), distrib_lattice.inf x (1 + y), himp := λ (x y : α), distrib_lattice.sup y (1 + x), top := 1, bot := 0, inf_compl_le_bot := _, top_le_sup_compl := _, le_top := _, bot_le := _, sdiff_eq := _, himp_eq := _}
Turn a ring homomorphism from Boolean rings α
to β
into a bounded lattice homomorphism
from α
to β
considered as Boolean algebras.
Equations
- f.as_boolalg = {to_lattice_hom := {to_sup_hom := {to_fun := ⇑to_boolalg ∘ ⇑f ∘ ⇑of_boolalg, map_sup' := _}, map_inf' := _}, map_top' := _, map_bot' := _}
Turning a Boolean algebra into a Boolean ring #
Type synonym to view a Boolean ring as a Boolean algebra.
Equations
- as_boolring α = α
Instances for as_boolring
The "identity" equivalence between as_boolring α
and α
.
Equations
The "identity" equivalence between α
and as_boolring α
.
Equations
Equations
- as_boolring.inhabited = _inst_1
Every generalized Boolean algebra has the structure of a non unital commutative ring with the following data:
a + b
unfolds toa ∆ b
(symmetric difference)a * b
unfolds toa ⊓ b
-a
unfolds toa
0
unfolds to⊥
Equations
- generalized_boolean_algebra.to_non_unital_comm_ring = {add := symm_diff (generalized_boolean_algebra.to_has_sdiff α), add_assoc := _, zero := ⊥, zero_add := _, add_zero := _, nsmul := non_unital_ring.nsmul._default ⊥ symm_diff generalized_boolean_algebra.to_non_unital_comm_ring._proof_3 generalized_boolean_algebra.to_non_unital_comm_ring._proof_4, nsmul_zero' := _, nsmul_succ' := _, neg := id α, sub := non_unital_ring.sub._default symm_diff symm_diff_assoc ⊥ generalized_boolean_algebra.to_non_unital_comm_ring._proof_7 generalized_boolean_algebra.to_non_unital_comm_ring._proof_8 (non_unital_ring.nsmul._default ⊥ symm_diff generalized_boolean_algebra.to_non_unital_comm_ring._proof_3 generalized_boolean_algebra.to_non_unital_comm_ring._proof_4) generalized_boolean_algebra.to_non_unital_comm_ring._proof_9 generalized_boolean_algebra.to_non_unital_comm_ring._proof_10 id, sub_eq_add_neg := _, zsmul := non_unital_ring.zsmul._default symm_diff symm_diff_assoc ⊥ generalized_boolean_algebra.to_non_unital_comm_ring._proof_12 generalized_boolean_algebra.to_non_unital_comm_ring._proof_13 (non_unital_ring.nsmul._default ⊥ symm_diff generalized_boolean_algebra.to_non_unital_comm_ring._proof_3 generalized_boolean_algebra.to_non_unital_comm_ring._proof_4) generalized_boolean_algebra.to_non_unital_comm_ring._proof_14 generalized_boolean_algebra.to_non_unital_comm_ring._proof_15 id, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _, mul := has_inf.inf (semilattice_inf.to_has_inf α), left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, mul_assoc := _, mul_comm := _}
Every Boolean algebra has the structure of a Boolean ring with the following data:
a + b
unfolds toa ∆ b
(symmetric difference)a * b
unfolds toa ⊓ b
-a
unfolds toa
0
unfolds to⊥
1
unfolds to⊤
Equations
- boolean_algebra.to_boolean_ring = {to_ring := {add := non_unital_comm_ring.add generalized_boolean_algebra.to_non_unital_comm_ring, add_assoc := _, zero := non_unital_comm_ring.zero generalized_boolean_algebra.to_non_unital_comm_ring, zero_add := _, add_zero := _, nsmul := non_unital_comm_ring.nsmul generalized_boolean_algebra.to_non_unital_comm_ring, nsmul_zero' := _, nsmul_succ' := _, neg := non_unital_comm_ring.neg generalized_boolean_algebra.to_non_unital_comm_ring, sub := non_unital_comm_ring.sub generalized_boolean_algebra.to_non_unital_comm_ring, sub_eq_add_neg := _, zsmul := non_unital_comm_ring.zsmul generalized_boolean_algebra.to_non_unital_comm_ring, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _, int_cast := add_comm_group_with_one.int_cast._default (add_comm_group_with_one.nat_cast._default ⊤ non_unital_comm_ring.add boolean_algebra.to_boolean_ring._proof_12 non_unital_comm_ring.zero boolean_algebra.to_boolean_ring._proof_13 boolean_algebra.to_boolean_ring._proof_14 non_unital_comm_ring.nsmul boolean_algebra.to_boolean_ring._proof_15 boolean_algebra.to_boolean_ring._proof_16) non_unital_comm_ring.add boolean_algebra.to_boolean_ring._proof_17 non_unital_comm_ring.zero boolean_algebra.to_boolean_ring._proof_18 boolean_algebra.to_boolean_ring._proof_19 non_unital_comm_ring.nsmul boolean_algebra.to_boolean_ring._proof_20 boolean_algebra.to_boolean_ring._proof_21 ⊤ boolean_algebra.to_boolean_ring._proof_22 boolean_algebra.to_boolean_ring._proof_23 non_unital_comm_ring.neg non_unital_comm_ring.sub boolean_algebra.to_boolean_ring._proof_24 non_unital_comm_ring.zsmul boolean_algebra.to_boolean_ring._proof_25 boolean_algebra.to_boolean_ring._proof_26 boolean_algebra.to_boolean_ring._proof_27 boolean_algebra.to_boolean_ring._proof_28, nat_cast := add_comm_group_with_one.nat_cast._default ⊤ non_unital_comm_ring.add boolean_algebra.to_boolean_ring._proof_12 non_unital_comm_ring.zero boolean_algebra.to_boolean_ring._proof_13 boolean_algebra.to_boolean_ring._proof_14 non_unital_comm_ring.nsmul boolean_algebra.to_boolean_ring._proof_15 boolean_algebra.to_boolean_ring._proof_16, one := ⊤, nat_cast_zero := _, nat_cast_succ := _, int_cast_of_nat := _, int_cast_neg_succ_of_nat := _, mul := non_unital_comm_ring.mul generalized_boolean_algebra.to_non_unital_comm_ring, mul_assoc := _, one_mul := _, mul_one := _, npow := monoid.npow._default ⊤ non_unital_comm_ring.mul boolean_algebra.to_boolean_ring._proof_36 boolean_algebra.to_boolean_ring._proof_37, npow_zero' := _, npow_succ' := _, left_distrib := _, right_distrib := _}, mul_self := _}
Turn a bounded lattice homomorphism from Boolean algebras α
to β
into a ring homomorphism
from α
to β
considered as Boolean rings.
Equations
- f.as_boolring = {to_fun := ⇑to_boolring ∘ ⇑f ∘ ⇑of_boolring, map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}
Equivalence between Boolean rings and Boolean algebras #
Order isomorphism between α
considered as a Boolean ring considered as a Boolean algebra and
α
.
Equations
Ring isomorphism between α
considered as a Boolean algebra considered as a Boolean ring and
α
.
Equations
- ring_equiv.as_boolring_as_boolalg α = {to_fun := (of_boolring.trans of_boolalg).to_fun, inv_fun := (of_boolring.trans of_boolalg).inv_fun, left_inv := _, right_inv := _, map_mul' := _, map_add' := _}
Equations
- bool.boolean_ring = {to_ring := {add := bxor, add_assoc := bool.bxor_assoc, zero := bool.ff, zero_add := ff_bxor, add_zero := bxor_ff, nsmul := add_comm_group_with_one.nsmul._default bool.ff bxor ff_bxor bxor_ff, nsmul_zero' := bool.boolean_ring._proof_1, nsmul_succ' := bool.boolean_ring._proof_2, neg := id bool, sub := bxor, sub_eq_add_neg := bool.boolean_ring._proof_3, zsmul := add_comm_group_with_one.zsmul._default bxor bool.bxor_assoc bool.ff ff_bxor bxor_ff (add_comm_group_with_one.nsmul._default bool.ff bxor ff_bxor bxor_ff) bool.boolean_ring._proof_4 bool.boolean_ring._proof_5 id, zsmul_zero' := bool.boolean_ring._proof_6, zsmul_succ' := bool.boolean_ring._proof_7, zsmul_neg' := bool.boolean_ring._proof_8, add_left_neg := bxor_self, add_comm := bool.bxor_comm, int_cast := add_comm_group_with_one.int_cast._default (add_comm_group_with_one.nat_cast._default bool.tt bxor bool.bxor_assoc bool.ff ff_bxor bxor_ff (add_comm_group_with_one.nsmul._default bool.ff bxor ff_bxor bxor_ff) bool.boolean_ring._proof_9 bool.boolean_ring._proof_10) bxor bool.bxor_assoc bool.ff ff_bxor bxor_ff (add_comm_group_with_one.nsmul._default bool.ff bxor ff_bxor bxor_ff) bool.boolean_ring._proof_11 bool.boolean_ring._proof_12 bool.tt bool.boolean_ring._proof_13 bool.boolean_ring._proof_14 id bxor bool.boolean_ring._proof_15 (add_comm_group_with_one.zsmul._default bxor bool.bxor_assoc bool.ff ff_bxor bxor_ff (add_comm_group_with_one.nsmul._default bool.ff bxor ff_bxor bxor_ff) bool.boolean_ring._proof_4 bool.boolean_ring._proof_5 id) bool.boolean_ring._proof_16 bool.boolean_ring._proof_17 bool.boolean_ring._proof_18 bxor_self, nat_cast := add_comm_group_with_one.nat_cast._default bool.tt bxor bool.bxor_assoc bool.ff ff_bxor bxor_ff (add_comm_group_with_one.nsmul._default bool.ff bxor ff_bxor bxor_ff) bool.boolean_ring._proof_9 bool.boolean_ring._proof_10, one := bool.tt, nat_cast_zero := bool.boolean_ring._proof_19, nat_cast_succ := bool.boolean_ring._proof_20, int_cast_of_nat := bool.boolean_ring._proof_21, int_cast_neg_succ_of_nat := bool.boolean_ring._proof_22, mul := band, mul_assoc := bool.band_assoc, one_mul := tt_band, mul_one := band_tt, npow := monoid.npow._default bool.tt band tt_band band_tt, npow_zero' := bool.boolean_ring._proof_23, npow_succ' := bool.boolean_ring._proof_24, left_distrib := bool.band_bxor_distrib_left, right_distrib := bool.band_bxor_distrib_right}, mul_self := band_self}