{-# OPTIONS --allow-unsolved-metas #-}
open import Data.Nat
open import Data.Sum
data _×_ (A B : Set) : Set where
_,_ : A → B → A × B
data Σ (A : Set) (B : A → Set) : Set where
_,_ : (x : A) → (y : B x) → Σ A B
fst : {A : Set} {B : A → Set} → Σ A B → A
fst (x , y) = x
Dickson : (ℕ → ℕ) → Set
Dickson α = Σ ℕ (λ i → α i ≤ α (suc i))
ex : ℕ → ℕ
ex 0 = 10
ex 1 = 5
ex 2 = 30
ex _ = 4
module Classical where
data ⊥ : Set where
⊥-elim : {X : Set} → ⊥ → X
⊥-elim ()
¬_ : Set → Set
¬ X = X → ⊥
postulate
oracle : (A : Set) → A ⊎ (¬ A)
double-negation-elimination : {A : Set} → ¬ ¬ A → A
double-negation-elimination p = {!!}
de-morgan : {A B : Set} → ¬ ((¬ A) × (¬ B)) → A ⊎ B
de-morgan f = {!!}
de-morgan∞ : {A : Set} {B : A → Set} → ¬ ((x : A) → ¬ (B x)) → Σ A B
de-morgan∞ = {!!}
module _ (α : ℕ → ℕ) where
{-# TERMINATING #-}
go : ℕ → Σ ℕ (λ i → ((j : ℕ) → α i ≤ α j))
go i with oracle (Σ ℕ (λ j → α j < α i))
... | inj₁ (j , αj<αi) = go j
... | inj₂ p = (i , h)
where
h : (j : ℕ) → α i ≤ α j
h j with ≤-<-connex (α i) (α j)
... | inj₁ αi≤αj = αi≤αj
... | inj₂ αj<αi = ⊥-elim (p (j , αj<αi))
minimum : Σ ℕ (λ i → ((j : ℕ) → α i ≤ α j))
minimum = go 0
minimum₀ : (α : ℕ → ℕ) → ℕ
minimum₀ α = fst (minimum α)
thm : (α : ℕ → ℕ) → Dickson α
thm α with minimum α
... | i , h = i , h (suc i)
module Sarcastic (⊥ : Set) where
¬_ : Set → Set
¬ X = X → ⊥
escape : ¬ ¬ ⊥ → ⊥
escape = λ z → z (λ z₁ → z₁)
oracle : (A : Set) → ¬ ¬ (A ⊎ (¬ A))
oracle = λ A z → z (inj₂ (λ x → z (inj₁ x)))
de-morgan : {A B : Set} → ¬ ((¬ A) × (¬ B)) → ¬ ¬ (A ⊎ B)
de-morgan = λ z z₁ → z ((λ x → z₁ (inj₁ x)) , (λ x → z₁ (inj₂ x)))
de-morgan∞ : {A : Set} {B : A → Set} → ¬ ((x : A) → ¬ (B x)) → ¬ ¬ (Σ A B)
de-morgan∞ = λ z z₁ → z (λ x z₂ → z₁ (x , z₂))
modus-ponens : {A B : Set} → A → (A → B) → B
modus-ponens = λ z z₁ → z₁ z
_>>=_ : {A B : Set} → ¬ ¬ A → (A → ¬ ¬ B) → ¬ ¬ B
_>>=_ = λ z z₁ z₂ → z (λ z₃ → z₁ z₃ z₂)
return : {A : Set} → A → ¬ ¬ A
return = λ z z₁ → z₁ z
⊥-elim : {A : Set} → ⊥ → ¬ ¬ A
⊥-elim = λ z _ → z
module _ (α : ℕ → ℕ) where
{-# TERMINATING #-}
go : ℕ → ¬ ¬ Σ ℕ (λ i → ((j : ℕ) → ¬ ¬ (α i ≤ α j)))
go i = oracle (Σ ℕ (λ j → α j < α i)) >>= g
where
g : (Σ ℕ (λ j → α j < α i)) ⊎ ¬ (Σ ℕ (λ j → α j < α i)) → _
g (inj₁ (j , αj<αi)) = go j
g (inj₂ p) = return (i , h)
where
h : (j : ℕ) → ¬ ¬ (α i ≤ α j)
h j with ≤-<-connex (α i) (α j)
... | inj₁ αi≤αj = return αi≤αj
... | inj₂ αj<αi = ⊥-elim (p (j , αj<αi))
minimum : ¬ ¬ Σ ℕ (λ i → ((j : ℕ) → ¬ ¬ (α i ≤ α j)))
minimum = go 0
thm : (α : ℕ → ℕ) → ¬ ¬ (Dickson α)
thm α = do
(i , h) ← minimum α
αi≤α1+i ← h (suc i)
return (i , αi≤α1+i)
foo : ¬ ¬ ℕ
foo f = ?
module Constructive where
module _ (α : ℕ → ℕ) where
open Sarcastic (Dickson α)
theorem : Dickson α
theorem = escape (thm α)