1
0
forked from GitHub/gf-core

Moved transfer libraries to transfer/lib

This commit is contained in:
bringert
2005-11-30 16:00:06 +00:00
parent 86df2a69b1
commit cba2fcb9b1
7 changed files with 40 additions and 9 deletions

18
transfer/lib/nat.tr Normal file
View File

@@ -0,0 +1,18 @@
data Nat : Type where
Zero : Nat
Succ : (n:Nat) -> Nat
plus : Nat -> Nat -> Nat
plus Zero y = y
plus (Succ x) y = Succ (plus x y)
pred : Nat -> Nat
pred Zero = Zero
pred (Succ n) = n
natToInt : Nat -> Int
natToInt Zero = 0
natToInt (Succ n) = 1 + natToInt n
intToNat : Int -> Nat
intToNat n = if n == 0 then Zero else Succ (intToNat (n-1))