Skip to content

About

Simplest non-trivial Boolean algebra, the two-element Boolean algebra

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TwoElementBooleanAlgebra

Build Status Package version Package dependencies Coverage PkgEval Aqua

A software package for the Julia programming language implementing the simplest non-trivial Boolean algebra, the two-element Boolean algebra.

The only public binding is the type, Boole. It is different from Bool in that one(Boole) + one(Boole) equals one instead of two.

Usage example

julia> using TwoElementBooleanAlgebra

julia> Boole(0)
Boole(0)

julia> Boole(0) + Boole(0)
Boole(0)

julia> Boole(0) + Boole(1)
Boole(1)

julia> Boole(1) + Boole(1)
Boole(1)

julia> Boole(0) * Boole(1)
Boole(0)

julia> !Boole(0)
Boole(1)

An application: represent a relation with a logical array

A logical array represents a mathematical relation. Specifically, an X::AbstractMatrix{Boole} represents a binary relation. Then:

  • matrix addition (X + Y) corresponds to relation union

  • pointwise multiplication (X .* Y) of matrices corresponds to relation intersection

  • matrix multiplication (X * Y) corresponds to relation composition

  • matrix transpose (transpose(X)) or adjoint (adjoint(X) or X') results in the converse relation

  • pointwise negation ((!).(X)) results in the complementary relation

  • pointwise partial order (all(splat(≤), zip(X, Y))) corresponds to the subset/inclusion predicate

About

Simplest non-trivial Boolean algebra, the two-element Boolean algebra

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages