IdrisDoc: Data.Nat.Fact

# Data.Nat.Fact

Properties of factorial functions.

factAcc : Nat -> Nat -> Nat

  Tail-recursive accumulator for factItr.

factAccMult : (a : Nat) -> (b : Nat) -> (c : Nat) -> a * factAcc b c = factAcc b (a * c)

  Multiplication of the accumulator.

factAccPlus : (a : Nat) -> (b : Nat) -> (c : Nat) -> factAcc a b + factAcc a c = factAcc a (b + c)

  Addition of accumulators.

factItr : Nat -> Nat

  Iterative definition of factorial.

factRec : Nat -> Nat

  Recursive definition of factorial.

factRecItr : (n : Nat) -> factRec n = factItr n

  The recursive and iterative definitions are the equivalent.

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

  Multiplicand-shuffling lemma.