Documentation

Cslib.Foundations.RelationAlgebra.Basic

Relation algebras #

A relation algebra in the sense of Tarski (not to be confused with a relational algebra) is an extension of Boolean algebras that are designed to form an algebraic analysis of relations, α → α → Prop in Lean. They have applications in computer science such as the theory of constraint satisfaction as well as mathematical connections such as combinatorics.

References #

class Cslib.RelationAlgebra (α : Type u_1) extends BooleanAlgebra α, Monoid α, StarMul α :
Type u_1

The class of relation algebras. Note the notational differences from the literature. In addition to inheriting Mathlib's notations for Boolean algebras, star is used for converse, and the monoid reduct for composition uses multiplicative notation.

Instances

    The relation algebra of a complete Boolean algebra.

    Instances

      The relation algebra of a complete and atomic Boolean algebra.

      Instances
        @[instance_reducible]
        def Cslib.RelationAlgebra.ofTarski {α : Type u_1} [Max α] [Compl α] [Mul α] [One α] [Star α] (sup_comm : ∀ (a b : α), a ⊔ b = b ⊔ a) (sup_assoc : ∀ (a b c : α), a ⊔ b ⊔ c = a ⊔ (b ⊔ c)) (huntington : ∀ (a b : α), (aᶜ ⊔ b)ᶜ ⊔ (aᶜ ⊔ bᶜ)ᶜ = a) (mul_assoc : ∀ (a b c : α), a * b * c = a * (b * c)) (mul_one : ∀ (a : α), a * 1 = a) (star_involutive : ∀ (a : α), star (star a) = a) (star_mul : ∀ (a b : α), star (a * b) = star b * star a) (sup_mul : ∀ (a b c : α), (a ⊔ b) * c = a * c ⊔ b * c) (star_sup : ∀ (a b : α), star (a ⊔ b) = star a ⊔ star b) (tarski : ∀ (a b : α), star a * (a * b)ᶜ ⊔ bᶜ = bᶜ) :

        A RelationAlgebra can be constructed using Tarski's original ten axioms.

        Converse as an automorphism of a relation algebra.

        @[simp]
        theorem Cslib.RelationAlgebra.starOrderIso_apply {α : Type u_1} [RelationAlgebra α] (a✝ : α) :
        starOrderIso a✝ = star a✝
        @[simp]
        theorem Cslib.RelationAlgebra.star_le_star_iff {α : Type u_1} [RelationAlgebra α] {a b : α} :
        star a ≤ star b ↔ a ≤ b
        @[simp]
        theorem Cslib.RelationAlgebra.star_lt_star_iff {α : Type u_1} [RelationAlgebra α] {a b : α} :
        star a < star b ↔ a < b
        theorem Cslib.RelationAlgebra.le_star_iff {α : Type u_1} [RelationAlgebra α] {a b : α} :
        a ≤ star b ↔ star a ≤ b
        theorem Cslib.RelationAlgebra.star_le_iff {α : Type u_1} [RelationAlgebra α] {a b : α} :
        star b ≤ a ↔ b ≤ star a
        @[simp]
        theorem Cslib.RelationAlgebra.star_inf {α : Type u_1} [RelationAlgebra α] (a b : α) :
        star (a ⊓ b) = star a ⊓ star b
        @[simp]
        theorem Cslib.RelationAlgebra.star_compl {α : Type u_1} [RelationAlgebra α] (a : α) :
        @[simp]
        theorem Cslib.RelationAlgebra.star_sdiff {α : Type u_1} [RelationAlgebra α] (a b : α) :
        star (a \ b) = star a \ star b
        @[simp]
        theorem Cslib.RelationAlgebra.star_sSup {α : Type u_2} [CompleteRelationAlgebra α] (s : Set α) :
        star (sSup s) = ⨆ a ∈ s, star a
        @[simp]
        theorem Cslib.RelationAlgebra.star_sInf {α : Type u_2} [CompleteRelationAlgebra α] (s : Set α) :
        star (sInf s) = ⨅ a ∈ s, star a
        theorem Cslib.RelationAlgebra.mul_sup {α : Type u_1} [RelationAlgebra α] (a b c : α) :
        a * (b ⊔ c) = a * b ⊔ a * c
        @[simp]
        theorem Cslib.RelationAlgebra.mul_bot {α : Type u_1} [RelationAlgebra α] (a : α) :
        theorem Cslib.RelationAlgebra.inf_mul_le {α : Type u_1} [RelationAlgebra α] (a b c : α) :
        (a ⊓ b) * c ≤ a * c ⊓ b * c
        theorem Cslib.RelationAlgebra.mul_inf_le {α : Type u_1} [RelationAlgebra α] (a b c : α) :
        a * (b ⊓ c) ≤ a * b ⊓ a * c
        theorem Cslib.RelationAlgebra.left_modular {α : Type u_1} [RelationAlgebra α] (a b c : α) :
        a * b ⊓ c ≤ a * (b ⊓ star a * c)
        theorem Cslib.RelationAlgebra.right_modular {α : Type u_1} [RelationAlgebra α] (a b c : α) :
        a * b ⊓ c ≤ (a ⊓ c * star b) * b
        theorem Cslib.RelationAlgebra.mul_le_compl_right {α : Type u_1} [RelationAlgebra α] (a b c : α) :
        a * b ≤ cᶜ ↔ star a * c ≤ bᶜ
        theorem Cslib.RelationAlgebra.mul_le_compl_left {α : Type u_1} [RelationAlgebra α] (a b c : α) :
        a * b ≤ cᶜ ↔ c * star b ≤ aᶜ
        theorem Cslib.RelationAlgebra.mul_le_compl_star_tfae {α : Type u_1} [RelationAlgebra α] {a b c : α} :
        [a * b ≤ (star c)ᶜ, b * c ≤ (star a)ᶜ, c * a ≤ (star b)ᶜ].TFAE
        def Cslib.RelationAlgebra.leftResidual {α : Type u_1} [RelationAlgebra α] (a b : α) :
        α

        The right residual, defined so that a ≤ leftResidual b c ↔ a * b ≤ c.

        def Cslib.RelationAlgebra.rightResidual {α : Type u_1} [RelationAlgebra α] (a b : α) :
        α

        The left residual, defined so that a ≤ rightResidual b c ↔ b * a ≤ c.

        theorem Cslib.RelationAlgebra.mul_sSup {α : Type u_2} [CompleteRelationAlgebra α] {a : α} {s : Set α} :
        a * sSup s = ⨆ b ∈ s, a * b
        theorem Cslib.RelationAlgebra.sSup_mul {α : Type u_2} [CompleteRelationAlgebra α] {s : Set α} {b : α} :
        sSup s * b = ⨆ a ∈ s, a * b
        theorem Cslib.RelationAlgebra.inf_star_mul_ne_bot {α : Type u_1} [RelationAlgebra α] {r s p : α} (hp : p ≠ ⊥) (h : p ≤ r * s) :
        s ⊓ star r * p ≠ ⊥

        If a nonzero element lies below a product, the right factor meets its converse image.

        theorem Cslib.RelationAlgebra.atom_cycle_left {α : Type u_1} [RelationAlgebra α] {r s p : α} (hs : IsAtom s) (hp : p ≠ ⊥) (h : p ≤ r * s) :
        s ≤ star r * p
        theorem Cslib.RelationAlgebra.atom_cycle_left_iff {α : Type u_1} [RelationAlgebra α] {r s p : α} (hs : IsAtom s) (hp : IsAtom p) :
        p ≤ r * s ↔ s ≤ star r * p

        For atoms, the cycle law is an equivalence.

        theorem Cslib.RelationAlgebra.exists_atom_le_mul_right {α : Type u_1} [RelationAlgebra α] [IsAtomic α] {a b p : α} (hp : IsAtom p) (h : p ≤ a * b) :
        ∃ (s : α), IsAtom s ∧ s ≤ b ∧ p ≤ a * s

        If an atom lies below a product, its right factor can be replaced by an atom below it.

        theorem Cslib.RelationAlgebra.exists_atom_le_mul_left {α : Type u_1} [RelationAlgebra α] [IsAtomic α] {a b p : α} (hp : IsAtom p) (h : p ≤ a * b) :
        ∃ (r : α), IsAtom r ∧ r ≤ a ∧ p ≤ r * b

        If an atom lies below a product, its left factor can be replaced by an atom below it.

        A relation algebra is integral when its identity is an atom.

        The set of identity atoms.

        The set of symmetric diversity atoms, those below the complement of identity.

        The set of nonsymmetric diversity atoms. The diversity condition follows from le_compl_one_of_mem_nonsymmetricDiversityAtoms.

        Every nonsymmetric atom lies below the complement of identity.

        @[instance_reducible]

        The relation algebra of all binary relations on a type α. This is scoped so that other instances, such as those under Pointwise, can be used elsewhere.

        theorem SetRel.mul_eq_comp {α : Type u} {R S : SetRel α α} :
        R * S = R.comp S
        theorem SetRel.star_eq_inv {α : Type u} {R : SetRel α α} :
        star R = R.inv
        @[simp]
        theorem SetRel.mem_mul {α : Type u} {R S : SetRel α α} {a c : α} :
        (a, c) ∈ R * S ↔ ∃ (b : α), (a, b) ∈ R ∧ (b, c) ∈ S
        @[simp]
        theorem SetRel.mem_one {α : Type u} {a b : α} :
        (a, b) ∈ 1 ↔ a = b
        @[simp]
        theorem SetRel.mem_star {α : Type u} {R : SetRel α α} {a b : α} :
        (a, b) ∈ star R ↔ (b, a) ∈ R
        theorem SetRel.mem_leftResidual {α : Type u} {R S : SetRel α α} {a b : α} :
        (a, b) ∈ Cslib.RelationAlgebra.leftResidual R S ↔ ∀ (c : α), (b, c) ∈ R → (a, c) ∈ S
        theorem SetRel.mem_rightResidual {α : Type u} {R S : SetRel α α} {a b : α} :
        (a, b) ∈ Cslib.RelationAlgebra.rightResidual R S ↔ ∀ (c : α), (c, a) ∈ R → (c, b) ∈ S