1-- Polynomial homomorphisms depend only on the variables actually used (ZF).2-- 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.Algebra.Polynomial.EvaluationSupport8import EvaluationOver9import Variables1011theorem polynomialMap.variables (I A z B o f p : Set)12requires function : f : A → B13requires zero : f(z) = o14requires polynomial : p ∈ polynomials(I, A, z)15shows polynomialVariablesUsed(I, B, o, polynomialMap(I, A, z, B, o, f)(p)) ⊆ polynomialVariablesUsed(I, A, z, p)16proof17intros i used18obtain⟨m, support, exponent⟩:= polynomialVariablesUsed.membership.forward with used19obtain⟨monomial, nonzero⟩:= functionSupport.membership.forward with support20have value := polynomialMap.coefficient with*21have coefficient : p(m) ≠ z22intro vanishes23apply nonzero24cc25have original : m ∈ functionSupport(p, monomials(I), z)26exact functionSupport.membership.backward with⟨monomial, coefficient⟩27exact polynomialVariablesUsed.membership.backward with⟨m, original, exponent⟩2829defgraph polynomialHomVariables (I A z one B h : Set) (i ∈ I) : B := h(polynomialVariable(I, A, z, one, i))30requires zeroIn : z ∈ A31requires oneIn : one ∈ A32requires function : h : polynomials(I, A, z) → B33proof34have variableIn := polynomialVariable.member at I, A, z, one, i with*35exact FunctionBetween.apply_closed with function, variableIn3637section Rings38variable (I A add z neg mul one B plus o minus times unit f : Set)39notationring R := (A, add, z, neg, mul, one)40notationring S := (B, plus, o, minus, times, unit)41notationring P := R[I]42hypothesis source : IsCommRing(R)43hypothesis target : IsCommRing(S)44hypothesis hom : IsRingHom(f, R, S)4546theorem polynomialAtOver.agree_on_variables (v w p : Set)47requires first : v : I → S48requires second : w : I → S49requires polynomial : p ∈ P50requires agreement : ∀ i ∈ polynomialVariablesUsed(I, R, p), v(i) = w(i)51shows polynomialAtOver(I, R, S, f, v)(p) = polynomialAtOver(I, R, S, f, w)(p)52proof53have function := IsRingHom.function with hom54have zero := IsRingHom.zero with hom55have mapped := polynomialMap.member with*56have variables := polynomialMap.variables with*57have same : ∀ i ∈ polynomialVariablesUsed(I, S, polynomialMap(I, R, S, f)(p)), v(i) = w(i)58intros i used59have original := variables with i, used60exact agreement with i, original61have equal := polynomialAt.agree_on_variables at I, B, plus, o, minus, times, unit, v, w, polynomialMap(I, R, S, f)(p) with*62haveleft:= polynomialAtOver.value at I, A, add, z, neg, mul, one, B, plus, o, minus, times, unit, f, v, p with*63haveright:= polynomialAtOver.value at I, A, add, z, neg, mul, one, B, plus, o, minus, times, unit, f, w, p with*64cc6566theorem IsRingHom.polynomial_local_ext (h g p : Set)67requires first : IsRingHom(h, P, S)68requires second : IsRingHom(g, P, S)69requires polynomial : p ∈ P70requires firstConstants : ∀ a ∈ R, h(polynomialConstant(I, R, a)) = f(a)71requires secondConstants : ∀ a ∈ R, g(polynomialConstant(I, R, a)) = f(a)72requires agreement : ∀ i ∈ polynomialVariablesUsed(I, R, p), h(polynomialVariable(I, R, i)) = g(polynomialVariable(I, R, i))73shows h(p) = g(p)74proof75have zeroIn : R[0] ∈ R bytypecheck76have oneIn : R[1] ∈ R bytypecheck77have functionH := IsRingHom.function with first78have functionG := IsRingHom.function with second79have assignmentH := polynomialHomVariables.function at I, A, z, one, B, h with*80have assignmentG := polynomialHomVariables.function at I, A, z, one, B, g with*81have variablesH : ∀ i ∈ I, h(polynomialVariable(I, R, i)) = polynomialHomVariables(I, A, z, one, B, h)(i)82intros i index83 symm84exact polynomialHomVariables.value with*85have variablesG : ∀ i ∈ I, g(polynomialVariable(I, R, i)) = polynomialHomVariables(I, A, z, one, B, g)(i)86intros i index87 symm88exact polynomialHomVariables.value with*89have representationH := polynomialAtOver.unique at I, A, add, z, neg, mul, one, B, plus, o, minus, times, unit, f, polynomialHomVariables(I, A, z, one, B, h), h with*90have representationG := polynomialAtOver.unique at I, A, add, z, neg, mul, one, B, plus, o, minus, times, unit, f, polynomialHomVariables(I, A, z, one, B, g), g with*91have same : ∀ i ∈ polynomialVariablesUsed(I, R, p), polynomialHomVariables(I, A, z, one, B, h)(i) = polynomialHomVariables(I, A, z, one, B, g)(i)92intros i used93have subset := polynomialVariablesUsed.subset at I, A, z, p94have index := subset with i, used95haveleft:= variablesH with i, index96haveright:= variablesG with i, index97have equal := agreement with i, used98cc99have equal := polynomialAtOver.agree_on_variables with*100 rwa [representationH, representationG]101102end Rings103