reserve i,j,k,n,m for Nat,
        X for set,
        b,s for bag of X,
        x for object;
reserve O for Ordinal,
        R for right_zeroed add-associative right_complementable
          right_unital distributive non trivial doubleLoopStr,
        p for Polynomial of O, R;
reserve O for Ordinal,
        R for right_zeroed add-associative right_complementable
             right_unital distributive non trivial doubleLoopStr,
        p for Polynomial of O, R;

theorem Th47:
  for X be Ordinal, S be right_zeroed add-associative right_complementable
      right_unital distributive well-unital non trivial doubleLoopStr
  for p,s be Polynomial of X, S holds
    vars Subst(p,x,s) c= (vars p)\{x} \/ vars s
proof
  let X be Ordinal, S be right_zeroed add-associative right_complementable
      right_unital distributive well-unital non trivial doubleLoopStr;
  let p,s be Polynomial of X, S;
  set PR=Polynom-Ring (X, S);
  set SX = SgmX(BagOrder X, Support p);
  consider F be FinSequence of PR such that
A1:  Subst(p,x,s) = Sum F & len SX = len F and
A2: for i st i in dom F holds
  F.i = p.(SX/.i) * Subst(SX/.i,x, s) by Def4;
  defpred P[Nat] means for i be Nat st i=$1 & i <= len F
  for q be Polynomial of X,S st q = Sum (F|i) holds
  vars q c= (vars p)\{x} \/ vars s;
A3: P[0]
  proof
    let i be Nat such that
A4: i=0 & i <= len F;
    let q be Polynomial of X,S such that A5: q = Sum (F|i);
    F | i = <*>(the carrier of PR) by A4;
    then q = 0.PR by A5,RLVECT_1:43
    .= 0_(X,S) by POLYNOM1:def 11;
    hence thesis by Th38;
  end;
A6: P[n] implies P[n+1]
  proof
    assume
A7: P[n];
    let n1 be Nat such that
A8: n1=n+1 & n1 <= len F;
    let q be Polynomial of X,S such that
A9: q = Sum (F | n1);
    reconsider q1 = Sum(F|n), Fn1 = F/.n1 as Polynomial of X,S
    by POLYNOM1:def 11;
A10:n1 in dom F & n1 in dom SX by A1,A8,FINSEQ_3:25,NAT_1:11;
    then
A11:F|n1 = (F|n)^<*F.n1*> & F.n1 =F/.n1 & SX.n1 =SX/.n1
    by A8,FINSEQ_5:10,PARTFUN1:def 6;
    then q = Sum(F|n) + Sum(<*F/.n1*>) by A9,RLVECT_1:41
    .= Sum(F|n) + F/.n1 by RLVECT_1:44
    .= q1+ Fn1 by POLYNOM1:def 11;
    then
A12: vars q c= vars q1 \/ vars Fn1 by Th41;
    n < len F by NAT_1:13,A8;
    then
A13: vars q1 c= (vars p)\{x} \/ vars s by A7;
    Fn1 = p.(SgmX(BagOrder X, Support p)/.n1) *
    Subst(SgmX(BagOrder X, Support p)/.n1,x, s) by A11,A2,A10;
    then
A14: vars Fn1 c= vars Subst(SX/.n1,x, s) by Th44;
A15: vars Subst(SX/.n1,x, s) c=
    (support SX/.n1)\{x} \/ vars s by Th46;
    BagOrder X linearly_orders  Support p by POLYNOM2:18;
    then SX/.n1 in rng SX = Support p by A10,A11,PRE_POLY:def 2,FUNCT_1:def 3;
    then (support SX/.n1)\{x} c= vars p\{x} by Th40,XBOOLE_1:33;
    then (support SX/.n1)\{x} \/ vars s c= (vars p)\{x} \/ vars s
    by XBOOLE_1:9;
    then vars Fn1 c= (vars p)\{x} \/ vars s by A14,A15;
    then vars q1 \/ vars Fn1 c= (vars p)\{x} \/ vars s by A13,XBOOLE_1:8;
    hence thesis by A12;
  end;
A16: P[n] from NAT_1:sch 2(A3,A6);
  F|len F=F;
  hence thesis by A1,A16;
end;
