Booleans, the original true-false dichotomy

Booleans can have two values, in any given universe. First, we define the Boolean context :

In this context, the type of booleans is simply the .Bool type in context, and the ‘true’ and ‘false’ values are respectively the ‘.true’ and ‘.false’ hypotheses.

We can test that \(true\) and \(false\) have the correct type :

  • type of :
  • type of :
  • type of :

Functions on Booleans

Then, we can start defining first-level combinators, such as ‘not’, ‘and’ and ‘or’ :

As always, we should verify the type of our combinators, and test whether they truly conform to their specification :

  • \(not : Boolean \rightarrow Boolean\)
  • \(or : Boolean \rightarrow Boolean \rightarrow Boolean\)
  • \(and : Boolean \rightarrow Boolean \rightarrow Boolean\)
  • \(implies : Boolean \rightarrow Boolean \rightarrow Boolean\)