Skip to content

Instantly share code, notes, and snippets.

@louisswarren
Last active December 24, 2018 09:59
Show Gist options
  • Save louisswarren/0121ef0268ef5d3b4fe245ef468ef23c to your computer and use it in GitHub Desktop.
Save louisswarren/0121ef0268ef5d3b4fe245ef468ef23c to your computer and use it in GitHub Desktop.
Cantor's diagonal argument (sort of)
open import Agda.Builtin.Equality
open import Agda.Builtin.Nat renaming (Nat to ℕ)
open import Agda.Builtin.Sigma
data ⊥ : Set where
¬_ : Set → Set
¬ P = P → ⊥
Surjective : {A B : Set} → (A → B) → Set
Surjective f = ∀ y → Σ _ λ x → f x ≡ y
Countable : Set → Set
Countable A = Σ (ℕ → A) Surjective
baire-uncountable : ¬(Countable (ℕ → ℕ))
baire-uncountable (f , sur) with sur λ n → suc (f n n)
baire-uncountable (f , sur) | x , fx≡ω = n≢sn (eqext fx≡ω x)
where
n≢sn : ∀{n} → ¬(n ≡ (suc n))
n≢sn ()
eqext : {A B : Set} {f g : A → B} → f ≡ g → ∀ x → f x ≡ g x
eqext refl x = refl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment