1-- Natural powers of real numbers2-- 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.Real.Power8import Ring9import Algebra.Group.Power1011-- Real powers are the specialization of monoid powers to multiplication.12-- The heterogeneous notation records its type: Real × Nat → Real.13def realPow (A : Real, n : Nat) : Real:=14 monoidPow(realMul, realOne, A, n)1516notationinfixr80"^"=> realPow forReal, Nat1718theorem realPow.real (A : Real, n : Nat)19showsReal(A ^ n)20proof21have typedA : Real(A) bytypecheck22unfold realPow23have closed := monoidPow.closed at24 ℝ, realMul, realOne, A, n with realMul.monoid, typedA25exact closed2627theorem realPow.zero (A : Real)28shows A ^ 0=129proof30unfold realPow31exact monoidPow.zero3233theorem realPow.succ (A : Real, n : Nat)34shows A ^ succ(n) = A * A ^ n35proof36unfold realPow37exact monoidPow.succ withassumption3839theorem realPow.add (A : Real, m n : Nat)40shows A ^ (m + n) = A ^ m * A ^ n41proof42have typedA : Real(A) bytypecheck43unfoldRealat typedA44unfold realPow45exact monoidPow.add with realMul.monoid, typedA4647theorem realPow.one (n : Nat)48shows (1:R) ^ n = (1:R)49proof50induction n51| zero =>52rw realPow.zero53rfl54| succ(k) using ih =>55rw [realPow.succ, ih]56ring5758theorem realPow.zero_succ (n : Nat)59shows (0:R) ^ succ(n) = (0:R)60proof61rw realPow.succ62ring6364theorem realPow.mul (A B : Real, n : Nat)65shows (A * B) ^ n = A ^ n * B ^ n66proof67induction n68| zero =>69rw [realPow.zero, realPow.zero, realPow.zero]70ring71| succ(k) using ih =>72rw [realPow.succ, realPow.succ, realPow.succ, ih]73ring7475theorem realPow.two (A : Real)76shows A ^ succ(succ(0)) = A * A77proof78rw [realPow.succ, realPow.succ, realPow.zero]79ring80