Grace/Cumulus/Real/PowerOrder.g17
Imports
Power · Squares · AbsoluteValue · Negation · Natural · RationalEmbedding
Declarations
- realPow.nonnegative theorem derivation
- realPow.base_monotone theorem derivation
- realPow.le_one theorem derivation
- realPow.one_le theorem derivation
- realPow.abs theorem derivation
- realPow.bernoulli theorem derivation
- realPow.decay_bound theorem derivation
Source
1-- Order properties of 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 Passmore, András Salamon67module Grace.Cumulus.Real.PowerOrder8import Power9import Squares10import AbsoluteValue11import Negation12import Natural13import RationalEmbedding1415-- Section: Sign and size16theorem realPow.nonnegative (A : Real, n : Nat)17 requires nonnegative : 0 ≤ A18 shows 0 ≤ A ^ n19proof20 induction n21 | zero =>22 rw realPow.zero23 exact realLess.implies_le with realZero.lt_one24 | succ(k) using ih =>25 have power := realPow.real at A, k26 rw realPow.succ27 exact realMulValue.nonnegative with nonnegative, ih2829-- Powers are monotone in a nonnegative base.30theorem realPow.base_monotone (A B : Real, n : Nat)31 requires nonnegative : 0 ≤ A32 requires le : A ≤ B33 shows A ^ n ≤ B ^ n34proof35 induction n36 | zero =>37 rw [realPow.zero, realPow.zero]38 exact realLe.reflexive with realOne.real39 | succ(k) using ih =>40 have powerA := realPow.real at A, k41 have powerB := realPow.real at B, k42 have nonnegativeB : 0 ≤ B by linarith43 have powerNonnegative := realPow.nonnegative with nonnegative44 have first := realLe.mul_right_of_nonnegative with le, powerNonnegative45 have second := realLe.mul_left_of_nonnegative with ih, nonnegativeB46 rw [realPow.succ, realPow.succ]47 linarith4849theorem realPow.le_one (A : Real, n : Nat)50 requires nonnegative : 0 ≤ A51 requires bounded : A ≤ 152 shows A ^ n ≤ 153proof54 have lowered := realPow.base_monotone at A, (1:R), n with nonnegative, bounded55 rwa realPow.one at lowered5657theorem realPow.one_le (A : Real, n : Nat)58 requires above : 1 ≤ A59 shows 1 ≤ A ^ n60proof61 have oneNonnegative := realLess.implies_le with realZero.lt_one62 have lifted := realPow.base_monotone at (1:R), A, n with oneNonnegative, above63 rwa realPow.one at lifted6465theorem realPow.abs (A : Real, n : Nat)66 shows abs(A ^ n) = abs(A) ^ n67proof68 induction n69 | zero =>70 rw [realPow.zero, realPow.zero]71 have oneNonnegative := realLess.implies_le with realZero.lt_one72 exact abs.of_nonnegative with oneNonnegative73 | succ(k) using ih =>74 have power := realPow.real at A, k75 have product := abs.mul at A, A ^ k with assumption, power76 rw [realPow.succ, realPow.succ, product, ih]77 rfl7879-- Section: Bernoulli80-- Bernoulli's inequality.81theorem realPow.bernoulli (H : Real, n : Nat)82 requires nonnegative : 0 ≤ H83 shows (1:R) + (realNat(n):R) * H ≤ ((1:R) + H) ^ n84proof85 induction n86 | zero =>87 rw [realPow.zero, realNat.zero]88 have zeroProduct : (1:R) + (0:R) * H = (1:R) by ring89 rw zeroProduct90 exact realLe.reflexive with realOne.real91 | succ(k) using ih =>92 have countReal := realNat.real at k93 have baseReal : (1:R) + H ∈ ℝ by typecheck94 have one := realZero.lt_one95 have baseNonnegative : 0 ≤ (1:R) + H by linarith96 have power := realPow.real at (1:R) + H, k97 have scaled := realLe.mul_left_of_nonnegative with ih, baseNonnegative98 have countNonnegative := realNat.zero_le at k99 have square := realMulValue.square_nonnegative at H100 have cross := realMulValue.nonnegative with countNonnegative, square101 have expand : ((1:R) + H) * ((1:R) + (realNat(k):R) * H) =102 (1:R) + ((realNat(k):R) + 1) * H + (realNat(k):R) * (H * H) by ring103 rw [realPow.succ, realNat.successor]104 rw expand at scaled105 linarith106107-- For 0 ≤ A < 1 the powers decay at least like 1/(1 + n(1 - A)).108theorem realPow.decay_bound (A : Real, n : Nat)109 requires nonnegative : 0 ≤ A110 requires below : A < 1111 shows A ^ n * ((1:R) + (realNat(n):R) * ((1:R) - A)) ≤ 1112proof113 have gapReal := realSubValue.real at (1:R), A with realOne.real, assumption114 have gapPositive := realLess.iff_pos_sub.forward with below115 have gapNonnegative := realLess.implies_le with gapPositive116 have countReal := realNat.real at n117 have power := realPow.real at A, n118 have powerNonnegative := realPow.nonnegative at A, n with nonnegative119 have bernoulli := realPow.bernoulli at (1:R) - A, n with gapNonnegative120 have baseReal : (1:R) + ((1:R) - A) ∈ ℝ by typecheck121 have basePower := realPow.real at (1:R) + ((1:R) - A), n122 have factorReal : (1:R) + (realNat(n):R) * ((1:R) - A) ∈ ℝ by typecheck123 have scaled := realLe.mul_left_of_nonnegative with bernoulli, powerNonnegative124 have combined := realPow.mul at A, (1:R) + ((1:R) - A), n125 have productReal : A * ((1:R) + ((1:R) - A)) ∈ ℝ by typecheck126 have one := realZero.lt_one127 have baseNonnegative : 0 ≤ (1:R) + ((1:R) - A) by linarith128 have productNonnegative := realMulValue.nonnegative with129 nonnegative, baseNonnegative130 have productBounded : A * ((1:R) + ((1:R) - A)) ≤ 1131 have square := realMulValue.square_nonnegative at (1:R) - A132 have expand : A * ((1:R) + ((1:R) - A)) =133 (1:R) - ((1:R) - A) * ((1:R) - A) by ring134 rw expand135 linarith136 have small := realPow.le_one at A * ((1:R) + ((1:R) - A)), n with137 productNonnegative, productBounded138 rw combined at small139 exact realLe.transitive with scaled, small140