reserve i,j,k,n,m for Nat,
        b,b1,b2 for bag of n;

theorem Th18:
  for L being right_zeroed add-associative right_complementable
      well-unital distributive non trivial doubleLoopStr,
  p being Polynomial of n,L,
  x being Function of n, L,
  y being Function of (n+1), L st y|n=x
    holds eval(p,x) = eval(p extended_by_0,y)
proof
  let L be right_zeroed add-associative right_complementable
  well-unital distributive non trivial doubleLoopStr,
  p be Polynomial of n,L,
  x be Function of n, L,
  y be Function of (n+1), L;
  set n1=n+1;
  assume
A1:y|n=x;
  set S=SgmX(BagOrder n, Support p);
  set P=p extended_by_0;
  set S1=SgmX(BagOrder n1, Support P);
  consider T be FinSequence of L such that
A2: len T = len S & eval(p,x) = Sum T and
A3: for i be Element of NAT st 1 <= i & i <= len T
  holds T/.i = (p * S)/.i * eval(S/.i,x) by POLYNOM2:def 4;
  consider T1 be FinSequence of L such that
A4: len T1 = len S1 & eval(P,y) = Sum T1 and
A5: for i be Element of NAT st 1 <= i & i <= len T1
   holds T1/.i = (P * S1)/.i * eval(S1/.i,y) by POLYNOM2:def 4;
A6:len S = len S1 &
  for i be Nat st 1<=i<= len S holds S1/.i = S/.i bag_extend 0 by Th17;
  BagOrder n linearly_orders Support p & BagOrder n1 linearly_orders Support P
    by POLYNOM2:18;
  then
A7:rng S = Support p & rng S1 = Support P by PRE_POLY:def 2;
  dom p = Bags n & dom P = Bags n1 by FUNCT_2:def 1;
  then
A8:dom (p*S) = dom S & dom (P*S1)=dom S1 by A7,RELAT_1:27;
  for i be Nat st 1<=i<=len S holds T.i = T1.i
  proof
    let i such that
A9:   1<= i<= len S;
A10:  i in NAT by ORDINAL1:def 12;
A11:i in dom T & i in dom T1 by A9,A6,A2,A4,FINSEQ_3:25;
A12:i in dom S & i in dom S1 by A9,A6,FINSEQ_3:25;
    then
A13:S/.i = S.i & S1/.i = S1.i by PARTFUN1:def 6;
A14: S1/.i = S/.i bag_extend 0 by Th17,A9;
A15: (P * S1)/.i = (P * S1).i by A9,A6,FINSEQ_3:25,A8,PARTFUN1:def 6
    .= P.(S1/.i) by A12,A13,FUNCT_1:13
    .= P.(S/.i bag_extend 0) by Th17,A9
    .= p.(S/.i) by Th6
    .= p.(S.i) by A12,PARTFUN1:def 6
    .= (p*S).i by A12,FUNCT_1:13
    .= (p*S)/.i by A9,FINSEQ_3:25,A8,PARTFUN1:def 6;
    thus T1.i = T1/.i by A11,PARTFUN1:def 6
    .= (P * S1)/.i * eval(S1/.i,y) by A10,A5,A9,A4,A6
    .= (p*S)/.i * eval(S/.i,x) by A14,Th13,A1,A15
    .= T/.i by A10,A3,A9,A2
    .=T.i by A11,PARTFUN1:def 6;
  end;
  hence thesis by FINSEQ_1:14,A2,A4,Th17;
end;
