1-- Natural-number exponentiation2-- Part of Cumulus, the Grace17 mathematics library.3-- Copyright (c) 2026 Grant Passmore.4-- Released under the Apache License 2.0. See LICENSE in the repository root.5-- Authors: Grant Passmore67module Grace.Cumulus.Nat.Pow8import Core910def pow (base exponent : Nat) →Nat11| base, zero =>112| base, succ(n) => mul(base, pow(base, n))1314notationinfixr80"^"=> pow forNat1516theorem pow.zero (a : Nat)17shows a ^ 0=118proof19simp [pow]2021theorem pow.succ (a n : Nat)22shows a ^ succ(n) = mul(a, a ^ n)23proof24simp [pow]2526theorem pow.closed (a : Nat, n : Nat)27showsNat(a ^ n)28proof29induction n30| zero =>settlewith pow, Naturals.constructor.zero, Naturals.constructor.succ31| succ(k) using ih =>settlewith pow, mul.closed, ih3233theorem pow.add (a n : Nat, m : Nat)34shows a ^ add(m, n) = mul(a ^ m, a ^ n)35proof36induction m37| zero =>settlewith pow, add, mul, add.right_unit38| succ(k) using ih =>settlewith pow, add, mul.associative, pow.closed, ih3940lemma pow.sample41shows12 ^ 8=42998169642proof43compute4445eval12 ^ 2046