hmm
This commit is contained in:
parent
8b1fbba12a
commit
87fafc7a15
2 changed files with 18 additions and 18 deletions
|
@ -94,16 +94,16 @@ postulate
|
|||
open import Debug.Trace
|
||||
|
||||
postulate
|
||||
makeProofEven : ∀ (n m : ℕ) → m * 2 ≡ n → suc m ≤′ n
|
||||
makeProofOdd : ∀ (n m : ℕ) → suc (m * 2) ≡ n → suc m ≤′ n
|
||||
makeProofEven : ∀ (n m : ℕ) → m * 2 ≡ n → suc m ≤′ suc n
|
||||
makeProofOdd : ∀ (n m : ℕ) → suc (m * 2) ≡ n → suc m ≤′ suc n
|
||||
|
||||
to' : (n : ℕ) → Terminating n → Bin
|
||||
to' zero _ = O
|
||||
to' n (box mWit) with parity? n
|
||||
to' (suc n) (box mWit) with parity? n
|
||||
-- this means n is odd
|
||||
... | ⟨ m , isOdd p ⟩ = (to' m (mWit (makeProofOdd n m p))) I
|
||||
... | ⟨ m , isOdd p ⟩ = (to' m (mWit (makeProofOdd n m p))) II
|
||||
-- this means n is even
|
||||
... | ⟨ m , isEven p ⟩ = (to' m (mWit (makeProofEven n m p))) II
|
||||
... | ⟨ m , isEven p ⟩ = (to' m (mWit (makeProofEven n m p))) I
|
||||
|
||||
to : (n : ℕ) → Bin
|
||||
to n = to' n (term n)
|
||||
|
|
|
@ -12,19 +12,19 @@ data Bin : Set where
|
|||
_I : Bin → Bin
|
||||
_II : Bin → Bin
|
||||
|
||||
data Bool : Set where
|
||||
true : Bool
|
||||
false : Bool
|
||||
data even : ℕ → Set
|
||||
data odd : ℕ → Set
|
||||
|
||||
T : Bool → Set
|
||||
T true = ⊤
|
||||
T false = ⊥
|
||||
data even where
|
||||
zero : even zero
|
||||
suc : ∀ {n : ℕ} → odd n → even (suc n)
|
||||
|
||||
T→≡ : ∀ (b : Bool) → T b → b ≡ true
|
||||
T→≡ true tt = refl
|
||||
T→≡ false ()
|
||||
data odd where
|
||||
suc : ∀ {n : ℕ} → even n → odd (suc n)
|
||||
|
||||
data parity : ℕ → Set → Set where
|
||||
zero : parity zero
|
||||
oddSuc : ∀ {n : ℕ} → parity n → parity (evenSuc n)
|
||||
evenSuc : ∀ {n : ℕ} → parity n → parity (oddSuc n)
|
||||
to : ℕ → Bin
|
||||
to zero = O
|
||||
to n with odd n
|
||||
... | x = O I
|
||||
to n with even n
|
||||
... | x = O II
|
Loading…
Reference in a new issue