The Bool set

Definition of Bool with two elements true and false:


data Bool : Set where
  true  : Bool
  false : Bool

Interpretation:

It is because of the last two points that the syntax of the definition doesn't look like this:

Bool  : Set
true  : Bool
false : Bool

Exercises

  1. Define a set named Answer with three elements, yes, no and maybe.

  2. Define a set named Quarter with four elements, east, west, north and south.

Questions

Suppose we have Bool' defined:


data Bool' : Set where
  true'  : Bool'
  false' : Bool'

  1. Are Bool and Bool' the same sets?
  2. If not, which one is the "real" set of Booleans?

Isomorphisms

Bool and Bool' are definitionally different but they are isomorphic.

Representation and interpretation

Interpretation (or meaning) is the opposite relation to representation.

Special finite sets

We can define finite sets with n = 0, 1, 2, ... elements.

The special case with n = 0 is the empty set:


data  : Set where   -- There is no constructor.

The special case with n = 1 is the singleton set (set with one element):


data  : Set where
  tt : 

and have interesting interpretations as we will see.

Types vs. sets

Basic differences between types and sets:

data defines types, not sets!

Syntactic abbreviation

If we have multiple elements of the same type we can define them in one line:


data name : Set where
  elem₁ elem₂ : name