Skip to content

Instantly share code, notes, and snippets.

@googleson78
Last active July 1, 2018 09:31
Show Gist options
  • Save googleson78/8e617848fef5adee9ef2f30cd6f1bd1d to your computer and use it in GitHub Desktop.
Save googleson78/8e617848fef5adee9ef2f30cd6f1bd1d to your computer and use it in GitHub Desktop.
-- empty type
data ⊥ : Set where
-- can't prove this so we introduce it as an axiom
postulate
stab : ∀{A : Set} -> ((A -> ⊥) -> ⊥) -> A
-- if you give me an x of type X and an inhabitant of P x, then I have proof that there exists an inhabitant of P x
data ∃ {X : Set} (P : X -> Set) : Set where
intro-∃ : ∀(x : X) -> P x -> ∃ P
-- lambda syntax
deMorgan4<-' : ∀{U : Set} {P : U -> Set} -> ((∀(x : U) -> P x) -> ⊥) -> ∃ (λ x -> P x -> ⊥)
deMorgan4<-' = λ f -> stab (λ h -> f (λ z -> stab (λ g -> h (intro-∃ z g))))
-- easier to figure out
deMorgan4<- : ∀{U : Set} {P : U -> Set} -> ((∀(x : U) -> P x) -> ⊥) -> ∃ (λ x -> P x -> ⊥)
deMorgan4<- {U} {P} f = stab x
where x : (∃ (λ x → P x → ⊥) → ⊥) → ⊥
x h = f y
where y : ∀(x : U) -> P x
y z = stab u
where u : (P z -> ⊥) -> ⊥
u g = h (intro-∃ z g)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment