IdrisDoc: Data.Nat.Parity

# Data.Nat.Parity

Even : Nat -> Type

  A nat is Even when it is twice some other nat.

Odd : Nat -> Type

  A nat is Odd when it is one more than twice some other nat.

add2Even : Even n -> Even (fromInteger 2 + n)

  Two more than an Even is Even.

add2Odd : Odd n -> Odd (fromInteger 2 + n)

  Two more than an Odd is Odd.

even : Nat -> Bool
evenDec : (n : Nat) -> Dec (Even n)

  Evenness is decidable.

evenEven : Even n -> even n = True

  Evens are even.

evenEvenConverse : (even n = True) -> Even n

  If it's even, it's Even.

evenMultEven : Even j -> Even k -> Even (j * k)

  Even times Even is Even.

evenMultOdd : Even j -> Odd k -> Even (j * k)

  Even times Odd is Even.

evenOrOdd : (n : Nat) -> Either (Even n) (Odd n)

  Every nat is either Even or Odd.

evenPlusEven : Even j -> Even k -> Even (j + k)

  Even plus Even is Even.

evenPlusOdd : Even j -> Odd k -> Odd (j + k)

  Even plus Odd is Odd.

evenorodd : (n : Nat) -> Either (even n = True) (odd n = True)

  Every nat is either even or odd.

multShuffle : (a : Nat) -> (b : Nat) -> (c : Nat) -> a * c * (b * c) = a * b * c * c

  A helper fact.

notEvenAndOdd : Even n -> Odd n -> Void

  No nat is both Even and Odd.

notevenandodd : (even n = True) -> (odd n = True) -> Void

  No nat is both even and odd.

odd : Nat -> Bool
oddDec : (n : Nat) -> Dec (Odd n)

  Oddness is decidable.

oddMultEven : Odd j -> Even k -> Even (j * k)

  Odd times Even is Even.

oddMultOdd : Odd j -> Odd k -> Odd (j * k)

  Odd times Odd is Odd.

oddOdd : Odd n -> odd n = True

  Odds are odd.

oddOddConverse : (odd n = True) -> Odd n

  If it's odd, it's Odd

oddPlusEven : Odd j -> Even k -> Odd (j + k)

  Odd plus Even is Odd.

oddPlusOdd : Odd j -> Odd k -> Even (j + k)

  Odd plus Odd is Even.

oddSuccEven : Odd n -> (m : Nat ** (n = S m, Even m))

  An Odd is the successor of an Even.

predEvenOdd : Even (S n) -> Odd n

  One less than an Even is Odd.

predOddEven : Odd (S n) -> Even n

  One less than an Odd is Even.

succDoublePredPred : (S n = k * fromInteger 2) -> n = S (pred k * fromInteger 2)

  A helper fact.

succEvenOdd : Even n -> Odd (S n)

  One more than an Even is Odd.

succOddEven : Odd n -> Even (S n)

  One more than an Odd is Even.