tfp-1.0.1.1: Type-level integers, booleans, lists using type families

Safe HaskellSafe
LanguageHaskell2010

Type.Data.Num.Unary.Proof

Synopsis

Documentation

data Nat x #

Constructors

Natural x => Nat 

data Pos x #

Constructors

Positive x => Pos 

natFromPos :: Pos x -> Nat x #

addNat :: Nat x -> Nat y -> Nat (x :+: y) #

addPosL :: Pos x -> Nat y -> Pos (x :+: y) #

addPosR :: Nat x -> Pos y -> Pos (x :+: y) #

data AddZeroL x #

Constructors

(Zero :+: x) ~ x => AddZeroL 

data AddComm x y #

Constructors

(x :+: y) ~ (y :+: x) => AddComm 

addComm :: Nat x -> Nat y -> AddComm x y #

The proof is pretty expensive. For proving (x:+:y ~ y:+:x) we need about x*y reduction steps.

data AddAssoc x y z #

Constructors

(x :+: (y :+: z)) ~ ((x :+: y) :+: z) => AddAssoc 

addAssoc :: Nat x -> Nat y -> Nat z -> AddAssoc x y z #

mulNat :: Nat x -> Nat y -> Nat (x :*: y) #

mulPos :: Pos x -> Pos y -> Pos (x :*: y) #