Grace/Cumulus/Algebra/Polynomial/ShiftMonomial.g17
Imports
Grace.Cumulus.Algebra.Polynomial.MonomialShift · Grace.Cumulus.Algebra.Polynomial.MonomialGeneration
Declarations
- shiftMonomial def
- shiftMonomial.function theorem derivation
- shiftMonomial.same theorem derivation
- shiftMonomial.other theorem derivation
- shiftMonomial.product theorem derivation
- shiftMonomial.member theorem derivation
- shiftMonomial.injective theorem derivation
- shiftMonomial.exponent_nonzero theorem derivation
- shiftMonomial.ne_one theorem derivation
- shiftMonomial.ne_variable theorem derivation
- monomials.unshift theorem derivation
Source
1-- The shifted monomial: the monomial m with its exponent at i raised by2-- one, which is the product of m by the monomial of Xᵢ, so a monomial,3-- injective in m, and never the unit monomial or a variable other than Xᵢ;4-- and every monomial with a nonzero exponent at i is a shift.5-- Part of Cumulus, the Grace17 mathematics library.6-- Copyright (c) 2026 Grant Passmore.7-- Released under the Apache License 2.0. See LICENSE in the repository root.8-- Authors: Grant Passmore910module Grace.Cumulus.Algebra.Polynomial.ShiftMonomial11import Grace.Cumulus.Algebra.Polynomial.MonomialShift12import Grace.Cumulus.Algebra.Polynomial.MonomialGeneration1314-- The monomial m with its exponent at i raised by one.15def shiftMonomial (I m i : Set) : Set :=16 { e ∈ I × ℕ | (fst(e) = i ∧ snd(e) = succ(m(i))) ∨17 (fst(e) ≠ i ∧ snd(e) = m(fst(e))) }1819-- The shifted monomial: a graph on I with the raised exponent at i and20-- the old exponents elsewhere, which is the product of m by the monomial21-- of Xᵢ, so a monomial, injective in m, and never the unit monomial or a22-- variable other than Xᵢ.23section Shift24variable (I i : Set)25hypothesis index : i ∈ I2627theorem shiftMonomial.function (m : Set)28 requires member : m ∈ monomials(I)29 shows shiftMonomial(I, m, i) : I → ℕ30proof31 have function := monomials.function with member32 constructor33 . intros e he34 exact he.left35 constructor36 . intros x y relatedY z relatedZ37 obtain ⟨_, shapeY⟩ := relatedY38 obtain ⟨_, shapeZ⟩ := relatedZ39 simp [fst.pair, snd.pair] at shapeY, shapeZ40 rcases shapeY with ⟨sameY, valueY⟩ | ⟨otherY, valueY⟩41 . rcases shapeZ with ⟨sameZ, valueZ⟩ | ⟨otherZ, valueZ⟩42 . cc43 . exfalso44 exact otherZ with sameY45 . rcases shapeZ with ⟨sameZ, valueZ⟩ | ⟨otherZ, valueZ⟩46 . exfalso47 exact otherY with sameZ48 . cc49 . intros x hx50 have alternatives : x = i ∨ x ≠ i by tauto51 cases alternatives with same | other52 . have exponent := monomials.exponent with member, index53 have successor := Naturals.constructor.succ with exponent54 have successorIn := nat.omega.forward with successor55 refine ⟨succ(m(i)), successorIn, _⟩56 apply shiftMonomial.membership.backward57 refine ⟨(product.pair with hx, successorIn), _⟩58 rw same59 simp [fst.pair, snd.pair]60 . have valueIn := FunctionBetween.apply_closed with function, hx61 refine ⟨m(x), valueIn, _⟩62 apply shiftMonomial.membership.backward63 refine ⟨(product.pair with hx, valueIn), _⟩64 simp [fst.pair, snd.pair, other]6566theorem shiftMonomial.same (m : Set)67 requires member : m ∈ monomials(I)68 shows shiftMonomial(I, m, i)(i) = succ(m(i))69proof70 have function := shiftMonomial.function at I, i, m with *71 have exponent := monomials.exponent with member, index72 have successor := Naturals.constructor.succ with exponent73 have successorIn := nat.omega.forward with successor74 have related : relates(shiftMonomial(I, m, i), i, succ(m(i)))75 apply shiftMonomial.membership.backward76 refine ⟨(product.pair with index, successorIn), _⟩77 simp [fst.pair, snd.pair]78 exact FunctionBetween.apply_value with function, index, related7980theorem shiftMonomial.other (m j : Set)81 requires member : m ∈ monomials(I)82 requires other : j ∈ I83 requires apart : j ≠ i84 shows shiftMonomial(I, m, i)(j) = m(j)85proof86 have function := shiftMonomial.function at I, i, m with *87 have valueIn :=88 FunctionBetween.apply_closed with (monomials.function with member), other89 have related : relates(shiftMonomial(I, m, i), j, m(j))90 apply shiftMonomial.membership.backward91 refine ⟨(product.pair with other, valueIn), _⟩92 simp [fst.pair, snd.pair, apart]93 exact FunctionBetween.apply_value with function, other, related9495theorem shiftMonomial.product (m : Set)96 requires member : m ∈ monomials(I)97 shows shiftMonomial(I, m, i) = monomialProduct(I, monomialVariable(I, i), m)98proof99 have variable := monomialVariable.member at I, i100 have product := monomialProduct.member with variable, member101 have left := shiftMonomial.function at I, i, m with *102 have right := monomials.function with product103 apply FunctionBetween.ext with left, right104 intros j hj105 have exponent := monomials.exponent with member, hj106 have value :=107 monomialProduct.value at I, monomialVariable(I, i), m, j with *108 rw value109 have alternatives : j = i ∨ j ≠ i by tauto110 cases alternatives with same | apart111 . rw same112 have shifted := shiftMonomial.same at I, i, m with *113 have unit := monomialVariable.same at I, i with index114 have exponentI := monomials.exponent with member, index115 have successor := add.right_one at m(i) with *116 rw [shifted, unit, ← successor]117 exact add.commutative with *118 . have shifted := shiftMonomial.other at I, i, m, j with *119 have unit := monomialVariable.other at I, i, j with hj, apart120 rw [shifted, unit]121 symm122 exact add.left_unit with *123124theorem shiftMonomial.member (m : Set)125 requires member : m ∈ monomials(I)126 shows shiftMonomial(I, m, i) ∈ monomials(I)127proof128 have variable := monomialVariable.member at I, i129 rw shiftMonomial.product at I, i, m with *130 exact monomialProduct.member with variable, member131132theorem shiftMonomial.injective (m n : Set)133 requires left : m ∈ monomials(I)134 requires right : n ∈ monomials(I)135 requires equal : shiftMonomial(I, m, i) = shiftMonomial(I, n, i)136 shows m = n137proof138 have variable := monomialVariable.member at I, i139 have productM := shiftMonomial.product at I, i, m with *140 have productN := shiftMonomial.product at I, i, n with *141 rw [productM, productN] at equal142 exact monomialProduct.cancel with variable, left, right, equal143144theorem shiftMonomial.exponent_nonzero (m : Set)145 requires member : m ∈ monomials(I)146 shows shiftMonomial(I, m, i)(i) ≠ 0147proof148 have shifted := shiftMonomial.same at I, i, m with *149 rw shifted150 intro equal151 symm at equal152 exact Naturals.disjoint.zero.succ at m(i) with equal153154theorem shiftMonomial.ne_one (m : Set)155 requires member : m ∈ monomials(I)156 shows shiftMonomial(I, m, i) ≠ monomialOne(I)157proof158 have nonzero := shiftMonomial.exponent_nonzero at I, i, m with *159 have unit := monomialOne.value at I, i with index160 intro equal161 apply nonzero162 rw equal163 exact unit164165theorem shiftMonomial.ne_variable (m j : Set)166 requires member : m ∈ monomials(I)167 requires other : j ∈ I168 requires apart : j ≠ i169 shows shiftMonomial(I, m, i) ≠ monomialVariable(I, j)170proof171 have nonzero := shiftMonomial.exponent_nonzero at I, i, m with *172 have reverse : i ≠ j by cc173 have vanishes := monomialVariable.other at I, j, i with index, reverse174 intro equal175 apply nonzero176 rw equal177 exact vanishes178179-- A monomial with a positive exponent at i is a shifted monomial.180theorem monomials.unshift (m : Set)181 requires member : m ∈ monomials(I)182 requires nonzero : m(i) ≠ 0183 shows ∃ n ∈ monomials(I), m = shiftMonomial(I, n, i)184proof185 have exponent := monomials.exponent with member, index186 have shape := natural.zero_or_successor at m(i) with *187 cases shape with vanishes | successor188 . exfalso189 exact nonzero with vanishes190 . obtain ⟨k, kNat, equal⟩ := successor191 have variable := monomialVariable.member at I, i192 have restore := monomialErase.restore with member, index193 have single := monomialSingle.member at I, i, k with *194 have erased := monomialErase.member at I, m, i with *195 have split := monomialSingle.succ at I, i, k with index196 have plusOne := add.right_one at k with *197 rw plusOne at split198 rw [equal, split] at restore199 have rest := monomialProduct.member with single, erased200 have reassociate :=201 monomialProduct.associative with variable, single, erased202 have shifted := shiftMonomial.product at I, i,203 monomialProduct(I, coefficientSingle(I, ℕ, 0, k, i),204 coefficientErase(I, ℕ, 0, m, i)) with *205 refine ⟨monomialProduct(I, coefficientSingle(I, ℕ, 0, k, i),206 coefficientErase(I, ℕ, 0, m, i)), rest, _⟩207 cc208209end Shift210