Skip to content

Instantly share code, notes, and snippets.

@gallais
Created April 17, 2016 08:29
Show Gist options
  • Save gallais/75100e26fc4be48eb3d31ae5ed6d1198 to your computer and use it in GitHub Desktop.
Save gallais/75100e26fc4be48eb3d31ae5ed6d1198 to your computer and use it in GitHub Desktop.
Postulating the LEM in Agda
module LEM where
open import Data.Empty
open import Data.Product
open import Function
open import Relation.Nullary
∄⇒∀ : {A : Set} {B : A → Set} →
¬ (∃ λ a → B a) →
∀ a → ¬ (B a)
∄⇒∀ ¬∃ a b = ¬∃ (a , b)
postulate LEM : (A : Set) → Dec A
¬¬A⇒A : {A : Set} → ¬ (¬ A) → A
¬¬A⇒A {A} ¬¬p =
case LEM A of λ
{ (yes p) → p
; (no ¬p) → ⊥-elim $ ¬¬p ¬p
}
∀̸⇒∃ : {A : Set} {B : A → Set} →
¬ (∀ a → B a) →
∃ λ a → ¬ (B a)
∀̸⇒∃ {A} {B} ¬∀ =
case LEM (∃ λ a → ¬ B a) of λ
{ (yes p) → p
; (no ¬p) → ⊥-elim $ ¬∀ (¬¬A⇒A ∘ ∄⇒∀ ¬p)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment