(* Exponentiation. *)

Definition expn_rec m n := iterop n muln m 1.Definition expn := nosimpl expn_rec.

(* Specifications: *)
Lemma expnE : expn = expn_rec.
Lemma expn0 m : m ^ 0 = 1.
Lemma expn1 m : m ^ 1 = m.
Lemma expnS m n : m ^ n.+1 = m * m ^ n.
Lemma expnSr m n : m ^ n.+1 = m ^ n * m.
Lemma iter_muln m n p : iter n (muln m) p = m ^ n * p.
Lemma iter_muln_1 m n : iter n (muln m) 1 = m ^ n.
Lemma exp0n n : 0 < n -> 0 ^ n = 0.
Lemma exp1n n : 1 ^ n = 1.
Lemma expnD m n1 n2 : m ^ (n1 + n2) = m ^ n1 * m ^ n2.
Lemma expnMn m1 m2 n : (m1 * m2) ^ n = m1 ^ n * m2 ^ n.
Lemma expnM m n1 n2 : m ^ (n1 * n2) = (m ^ n1) ^ n2.
Lemma expnAC m n1 n2 : (m ^ n1) ^ n2 = (m ^ n2) ^ n1.
Lemma ltn_expl m n : 1 < m -> n < m ^ n.
Lemma leq_exp2l m n1 n2 : 1 < m -> (m ^ n1 <= m ^ n2) = (n1 <= n2).
Lemma ltn_exp2l m n1 n2 : 1 < m -> (m ^ n1 < m ^ n2) = (n1 < n2).
Lemma expnI m : 1 < m -> injective (expn m).
Lemma leq_pexp2l m n1 n2 : 0 < m -> n1 <= n2 -> m ^ n1 <= m ^ n2.
Lemma ltn_pexp2l m n1 n2 : 0 < m -> m ^ n1 < m ^ n2 -> n1 < n2.
Lemma ltn_exp2r m n e : e > 0 -> (m ^ e < n ^ e) = (m < n).
Lemma leq_exp2r m n e : e > 0 -> (m ^ e <= n ^ e) = (m <= n).
Lemma expIn e : e > 0 -> injective (expn^~ e).