heyting-algebras: Heyting and Boolean algebras

[ bsd3, library, math ] [ Propose Tags ] [ Report a vulnerability ]

This package provides Heyting and Boolean operations together with various constructions of Heyting algebras.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.1.0, 0.0.1.1, 0.0.1.2, 0.0.2.0, 0.2.0.1 (info)
Change log ChangeLog.md
Dependencies base (>=4.9 && <4.16), containers (>=0.4.2 && <0.7), free-algebras (>=0.1.0.1 && <0.1.1.0), hashable (>=1.2.6.1 && <1.4), lattices (>=2.0 && <2.1), semiring-simple (>=1.0 && <1.2), tagged (>=0.8.5 && <0.9), universe-base (>=1.0 && <1.2), unordered-containers (>=0.2.6.0 && <0.3) [details]
Tested with ghc ==8.10.4
License BSD-3-Clause
Copyright (c) 2018-2021 Marcin Szamotulski
Author Marcin Szamotulski
Maintainer profunctor@pm.me
Category Math
Source repo head: git clone https://github.com/coot/heyting-algebras
Uploaded by coot at 2021-03-27T13:40:47Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1994 total (18 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-03-27 [all 1 reports]

Readme for heyting-algebras-0.2.0.1

[back to package description]

Heyting Algebras

Maintainer: coot POSIX

This package now extends lattices by providing more Heyting algebras. The package also defines a type class for Boolean algebras and comes with many useful instances.

A note about notation: this package is based on lattices, and both are using notation and names common in lattice theory and logic. Where && becomes and is called meet and || is denoted by and is usually called join. The lattice package provides \/ and /\ operators as well as type classes for various flavors of posets and lattices.

A very good introduction to Heyting algebras can be found at ncatlab. Heyting algebras are the crux of intuitionistic logic, which drops the axiom of excluded middle. From categorical point of view, Heyting algebras are posets (categories with at most one arrow between any objects), which are also Cartesian closed (and finitely (co-)complete). Note that this makes any Heyting algebra a simply typed lambda calculus; hence one more incentive to learn about them. For example currying holds in every Heyting algebra: a => (b ⇒ c) is equal to (a ∧ b) ⇒ c

The most important operation is implication (==>) :: HeytingAlgebra a => a -> a -> a (which we might also write as ⇒ in documentation). Every Boolean algebra is a Heyting algebra via a ==> b = not a \/ b (using the lattice notation for or). It is very handy in expression conditional logic.

Some examples of Heyting algebras:

  • Bool is a Boolean algebra
  • (Ord a, Bounded a) => a; the implication is defined as: if a ≤ b then a ⇒ b = maxBound, otherwise a ⇒ b = b; e.g. integers with both ±∞ (it can be represented by Levitated Int. Note that it is not a Boolean algebra.
  • The power set is a Boolean algebra, in Haskell it can be represented by Set a (one might need to require a to be finite though, otherwise not (not empty) might be undefined rather than empty). It is a well known fact that every Boolean algebra is isomorphic to a power set.
  •   type CounterExample a = Lifted (Op (Set a))
    
    is a Heyting algebra; it is useful for gathering counter examples in a similar way that Property from QuickCheck library does (put pure). This library provides some useful functions for this type, see the Algebra.Heyting.Properties and tests for example usage.
  • More generally every type (Ord k, Finite k, HeytingAlgebra v) => Map k a is a Heyting algebra (though in general not a Boolean one).