The question is how do we define bijection in agda? definition:
We know that
2 + 2 = 2 × 2 = 2^2 = 4
for numbers. Similarly, we have that
Bool + Bool ∼= Bool × Bool ∼= Bool → Bool
where A ∼= B means that there is a bijection between A and B, that is, that there are
f : A → B
andg : B → A
which are inverses of each other, that is,g (f x) = x
for allx : A
andf (g y) = y
for ally : B
.Implement these bijections in Agda!
So i started by defining Bool
and some functions for it:
data Bool : Set where
true : Bool
false : Bool
not : Bool → Bool
not true = false
not false = true
T : Bool → Set
T true = ⊤
T false = ⊥
_∧_ : Bool → Bool → Bool
true ∧ b = b
false ∧ b = false
_∨_ : Bool → Bool → Bool
true ∨ b = true
false ∨ b = b
_xor_ : Bool → Bool → Bool
true xor b = not b
false xor b = b
But im stuck on the bijections, not sure at all how to solve it.