Module

Data.BooleanAlgebra

Package
purescript-prelude
Repository
purescript/purescript-prelude

#BooleanAlgebra Source

class (HeytingAlgebra a) <= BooleanAlgebra a 

The BooleanAlgebra type class represents types that behave like boolean values.

Instances should satisfy the following laws in addition to the HeytingAlgebra law:

  • Excluded middle:
    • a || not a = tt

Instances

#BooleanAlgebraRecord Source

class BooleanAlgebraRecord :: RowList Type -> Row Type -> Row Type -> Constraintclass (HeytingAlgebraRecord rowlist row subrow) <= BooleanAlgebraRecord rowlist row subrow | rowlist -> subrow

A class for records where all fields have BooleanAlgebra instances, used to implement the BooleanAlgebra instance for records.

Instances

Re-exports from Data.HeytingAlgebra

#HeytingAlgebra Source

class HeytingAlgebra a  where

The HeytingAlgebra type class represents types that are bounded lattices with an implication operator such that the following laws hold:

  • Associativity:
    • a || (b || c) = (a || b) || c
    • a && (b && c) = (a && b) && c
  • Commutativity:
    • a || b = b || a
    • a && b = b && a
  • Absorption:
    • a || (a && b) = a
    • a && (a || b) = a
  • Idempotent:
    • a || a = a
    • a && a = a
  • Identity:
    • a || ff = a
    • a && tt = a
  • Implication:
    • a `implies` a = tt
    • a && (a `implies` b) = a && b
    • b && (a `implies` b) = b
    • a `implies` (b && c) = (a `implies` b) && (a `implies` c)
  • Complemented:
    • not a = a `implies` ff

Members

Instances

#HeytingAlgebraRecord Source

class HeytingAlgebraRecord :: RowList Type -> Row Type -> Row Type -> Constraintclass HeytingAlgebraRecord rowlist row subrow | rowlist -> subrow

A class for records where all fields have HeytingAlgebra instances, used to implement the HeytingAlgebra instance for records.

Instances

#(||) Source

Operator alias for Data.HeytingAlgebra.disj (right-associative / precedence 2)

#(&&) Source

Operator alias for Data.HeytingAlgebra.conj (right-associative / precedence 3)