Grace/Cumulus/Algebra/Ring/Pow.g17

Open in Workbench Download source

Imports

Basic · Group.Power

Declarations

Source

1-- Natural powers in a bundled ring, written x ^ n: the recursion laws,2-- additivity and multiplicativity of exponents, powers of one, and closure3-- of the carrier under powers4-- Part of Cumulus, the Grace17 mathematics library.5-- Copyright (c) 2026 Grant Passmore.6-- Released under the Apache License 2.0. See LICENSE in the repository root.7-- Authors: Grant Passmore89module Grace.Cumulus.Algebra.Ring.Pow10import Basic11import Group.Power1213-- The n-th power of x in R, the monoid power under the multiplication and14-- one of R; written x ^ n wherever a hypothesis supplies the ring. The15-- ring tactics read a power with a literal exponent as the product it16-- abbreviates, so (x + y) ^ 2 = x ^ 2 + R[2] * x * y + y ^ 2 is closed by17-- ring without unfolding.18def Ring.pow (R x : Set, n : Nat) : Set :=19  monoidPow(Ring.mul(R), Ring.one(R), x, n)2021notation infixr 80 "^" => Ring.pow(R, _, _) via hypothesis Ring(R) for R.carrier22notation infixr 80 "^" => Ring.pow(R, _, _) via hypothesis CommRing(R) for R.carrier23notation infixr 80 "^" => Ring.pow(R, _, _) via hypothesis Field(R) for R.carrier24notation infixr 80 "^" => Ring.pow(R, _, _) via hypothesis OrderedField(R, lt) for R.carrier2526theorem Ring.pow.value (R x : Set, n : Nat)27  shows Ring.pow(R, x, n) = monoidPow(R.mul, R.one, x, n)28proof29  simp [Ring.pow]3031section PowerLaws32variable (R : Set)33hypothesis ring : Ring(R)3435theorem Ring.pow_zero (x : R)36  shows x ^ 0 = R[1]37proof38  simp [Ring.pow, monoidPow.zero]3940theorem Ring.pow_succ_left (x : R) (n : Nat)41  shows x ^ (n + 1) = x * x ^ n42proof43  have monoid := IsRing.multiplicative with (Ring.parts with ring)44  have step := monoidPow.succ_left at R.carrier, R.mul, R.one, x, n45    with monoid, *46  simp [Ring.pow, step]4748theorem Ring.pow_succ (x : R) (n : Nat)49  shows x ^ (n + 1) = x ^ n * x50proof51  have monoid := IsRing.multiplicative with (Ring.parts with ring)52  have step := monoidPow.succ_right at R.carrier, R.mul, R.one, x, n53    with monoid, *54  simp [Ring.pow, step]5556theorem Ring.pow_one (x : R)57  shows x ^ 1 = x58proof59  have monoid := IsRing.multiplicative with (Ring.parts with ring)60  have one := monoidPow.one with monoid, *61  simp [Ring.pow, one]6263instance Ring.pow_mem (x : R) (n : Nat)64  shows x ^ n ∈ R65proof66  have monoid := IsRing.multiplicative with (Ring.parts with ring)67  have closed := monoidPow.closed at R.carrier, R.mul, R.one, x, n68    with monoid, *69  simp [Ring.pow, closed]7071theorem Ring.pow_add (x : R) (m n : Nat)72  shows x ^ (m + n) = x ^ m * x ^ n73proof74  have monoid := IsRing.multiplicative with (Ring.parts with ring)75  have split := monoidPow.add at R.carrier, R.mul, R.one, x, m, n with monoid, *76  simp [Ring.pow, split]7778theorem Ring.pow_mul (x : R) (m n : Nat)79  shows x ^ (m * n) = (x ^ m) ^ n80proof81  have monoid := IsRing.multiplicative with (Ring.parts with ring)82  have split := monoidPow.mul at R.carrier, R.mul, R.one, x, m, n with monoid, *83  simp [Ring.pow, split]8485theorem Ring.one_pow (n : Nat)86  shows R[1] ^ n = R[1]87proof88  have monoid := IsRing.multiplicative with (Ring.parts with ring)89  have power := monoidPow.unit at R.carrier, R.mul, R.one, n with monoid90  simp [Ring.pow, power]9192end PowerLaws93