This commit is contained in:
Michael Zhang 2021-10-06 13:37:19 -05:00
parent 8b1fbba12a
commit 87fafc7a15
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
2 changed files with 18 additions and 18 deletions

View file

@ -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)

View file

@ -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