# The universal property of booleans
```agda
module foundation.universal-property-booleans where
```
<details><summary>Imports</summary>
```agda
open import foundation.booleans
open import foundation.dependent-pair-types
open import foundation.equality-cartesian-product-types
open import foundation.function-extensionality
open import foundation.universe-levels
open import foundation-core.cartesian-product-types
open import foundation-core.equivalences
open import foundation-core.function-types
open import foundation-core.homotopies
open import foundation-core.identity-types
```
</details>
```agda
ev-true-false :
{l : Level} (A : UU l) → (f : bool → A) → A × A
ev-true-false A f = pair (f true) (f false)
map-universal-property-bool :
{l : Level} {A : UU l} →
A × A → (bool → A)
map-universal-property-bool (pair x y) true = x
map-universal-property-bool (pair x y) false = y
abstract
is-section-map-universal-property-bool :
{l : Level} {A : UU l} →
((ev-true-false A) ∘ map-universal-property-bool) ~ id
is-section-map-universal-property-bool (pair x y) =
eq-pair refl refl
abstract
is-retraction-map-universal-property-bool' :
{l : Level} {A : UU l} (f : bool → A) →
(map-universal-property-bool (ev-true-false A f)) ~ f
is-retraction-map-universal-property-bool' f true = refl
is-retraction-map-universal-property-bool' f false = refl
abstract
is-retraction-map-universal-property-bool :
{l : Level} {A : UU l} →
(map-universal-property-bool ∘ (ev-true-false A)) ~ id
is-retraction-map-universal-property-bool f =
eq-htpy (is-retraction-map-universal-property-bool' f)
abstract
universal-property-bool :
{l : Level} (A : UU l) →
is-equiv (λ (f : bool → A) → pair (f true) (f false))
universal-property-bool A =
is-equiv-is-invertible
map-universal-property-bool
is-section-map-universal-property-bool
is-retraction-map-universal-property-bool
ev-true :
{l : Level} {A : UU l} → (bool → A) → A
ev-true f = f true
triangle-ev-true :
{l : Level} (A : UU l) →
ev-true ~ pr1 ∘ ev-true-false A
triangle-ev-true A = refl-htpy
```