Martin Escardo and Paulo Oliva 2011

\begin{code}

{-# OPTIONS --safe --without-K #-}

module InfinitePigeon.Choice where

open import InfinitePigeon.Equality
open import InfinitePigeon.Logic
open import InfinitePigeon.Naturals


AC : {X : Set}
     {Y : X  Set}
     {A : (x : X)  Y x  Ω}
    (∀(x : X)   \(y : Y x)  A x y)
     \(f : ((x : X)  Y x))
    ∀(x : X)  A x (f x)
AC g = ∃-intro  x  ∃-witness (g x))  x  ∃-elim (g x))

DC : {X : Set}
     {P :   X  X  Ω}
     (x₀ : X)
    (∀(n : )  ∀(x : X)   \(y : X)  P n x y)
     \(α :   X)  α O  x₀  (∀(n : )  P n (α n) (α(succ n)))
DC {X} x₀ g = ∃-intro α (∧-intro reflexivity  n  ∃-elim(g n (α n))))
 where
  α :   X
  α = induction x₀  k x  ∃-witness(g k x))

\end{code}

Dependently typed, dependent choice:

\begin{code}

DDC : {X :   Set}
      {P : (n : )  X n  X(succ n)  Ω}
      (x₀ : X O)
     (∀(n : )  ∀(x : X n)   \(y : X(succ n))  P n x y)
      \(α : (n : )  X n)  α O  x₀  (∀(n : )  P n (α n) (α(succ n)))
DDC {X} x₀ g = ∃-intro α (∧-intro reflexivity  n  ∃-elim(g n (α n))))
 where
  α : (n : )  X n
  α = induction x₀  k x  ∃-witness(g k x))

\end{code}