
theorem Th12:
  for n being Ordinal, L being right_zeroed add-associative
  right_complementable well-unital distributive non trivial doubleLoopStr, m
being Monomial of n,L, x being Function of n,L holds eval(m,x) = coefficient(m)
  * eval(term(m),x)
proof
  let n be Ordinal, L be right_zeroed add-associative right_complementable
  well-unital distributive non trivial doubleLoopStr, m be Monomial of n,L, x
  be Function of n,L;
  consider y being FinSequence of the carrier of L such that
A1: len y = len SgmX(BagOrder n, Support m) and
A2: eval(m,x) = Sum y and
A3: for i being Element of NAT st 1 <= i & i <= len y holds y/.i = (m *
  SgmX(BagOrder n, Support m))/.i * eval(((SgmX(BagOrder n, Support m))/.i),x)
  by POLYNOM2:def 4;
  consider b being bag of n such that
A4: for b9 being bag of n st b9 <> b holds m.b9 = 0.L by Def3;
  now
    per cases;
    case
A5:   m.b <> 0.L;
A6:   for u being object holds u in Support m implies u in {b}
      proof
        let u be object;
        assume
A7:     u in Support m;
        assume
A8:     not u in {b};
        reconsider u as Element of Bags n by A7;
        u <> b by A8,TARSKI:def 1;
        then m.u = 0.L by A4;
        hence thesis by A7,POLYNOM1:def 4;
      end;
A9:   b in Bags n & dom m = Bags n by FUNCT_2:def 1,PRE_POLY:def 12;
      reconsider sm = Support m as finite Subset of Bags n;
      set sg = SgmX(BagOrder n, sm);
A10:  BagOrder n linearly_orders sm by POLYNOM2:18;
      for u being object holds u in {b} implies u in Support m
      proof
        let u be object;
        assume
A11:    u in {b};
        then u = b by TARSKI:def 1;
        then reconsider u as Element of Bags n by PRE_POLY:def 12;
        m.u <> 0.L by A5,A11,TARSKI:def 1;
        hence thesis by POLYNOM1:def 4;
      end;
      then Support m = {b} by A6,TARSKI:2;
      then
A12:  rng sg = {b} by A10,PRE_POLY:def 2;
      then
A13:  b in rng sg by TARSKI:def 1;
      then
A14:  1 in dom sg by FINSEQ_3:31;
      then
A15:  sg.1 in rng sg by FUNCT_1:3;
      then sg.1 = b by A12,TARSKI:def 1;
      then 1 in dom (m * sg) by A14,A9,FUNCT_1:11;
      then
A16:  (m * sg)/.1 = (m * sg).1 by PARTFUN1:def 6
        .= m.(sg.1) by A14,FUNCT_1:13
        .= m.b by A12,A15,TARSKI:def 1
        .= coefficient(m) by A5,Def5;
A17:  for u being object holds u in dom sg implies u in {1}
      proof
        let u be object;
        assume
A18:    u in dom sg;
        assume
A19:    not u in {1};
        reconsider u as Element of NAT by A18;
        sg/.u = sg.u by A18,PARTFUN1:def 6;
        then
A20:    sg/.u in rng sg by A18,FUNCT_1:3;
A21:    u <> 1 by A19,TARSKI:def 1;
A22:    1 < u
        proof
          consider k being Nat such that
A23:      dom sg = Seg k by FINSEQ_1:def 2;
          Seg k = {l where l is Nat : 1 <= l & l <= k} by FINSEQ_1:def 1;
          then
          ex m9 being Nat st m9 = u & 1 <= m9 & m9 <= k by A18,A23;
          hence thesis by A21,XXREAL_0:1;
        end;
        sg/.1 = sg.1 by A13,A18,FINSEQ_3:31,PARTFUN1:def 6;
        then sg/.1 in rng sg by A14,FUNCT_1:3;
        then sg/.1 = b by A12,TARSKI:def 1
          .= sg/.u by A12,A20,TARSKI:def 1;
        hence thesis by A10,A14,A18,A22,PRE_POLY:def 2;
      end;
      for u being object holds u in {1} implies u in dom sg
          by A14,TARSKI:def 1;
      then
A24:  dom sg = Seg 1 by A17,FINSEQ_1:2,TARSKI:2;
      then
A25:  1 in dom sg by FINSEQ_1:2,TARSKI:def 1;
      sg/.1 = sg.1 by A14,PARTFUN1:def 6;
      then sg/.1 in rng sg by A25,FUNCT_1:3;
      then
A26:  sg/.1 = b by A12,TARSKI:def 1;
A27:  len sg = 1 by A24,FINSEQ_1:def 3;
      dom y = Seg(len y) by FINSEQ_1:def 3
        .= dom sg by A1,FINSEQ_1:def 3;
      then y.1 = y/.1 by A25,PARTFUN1:def 6
        .= (m * sg)/.1 * eval(b,x) by A26,A1,A3,A27;
      then y = <* coefficient(m) * eval(b,x) *> by A1,A27,A16,FINSEQ_1:40;
      hence eval(m,x) = coefficient(m) * eval(b,x) by A2,RLVECT_1:44
        .= coefficient(m) * eval(term(m),x) by A5,Def5;
    end;
    case
A28:  m.b = 0.L;
A29:  Support m = {}
      proof
        assume Support m <> {};
        then reconsider sm = Support m as non empty Subset of Bags n;
        set c = the Element of sm;
        m.c <> 0.L by POLYNOM1:def 4;
        hence thesis by A4,A28;
      end;
      then term(m) = EmptyBag n & m.(EmptyBag n) = 0.L by Def5,POLYNOM1:def 4;
      then
A30:  coefficient(m) * eval(term(m),x) = 0.L;
      consider y being FinSequence of the carrier of L such that
A31:  len y = len SgmX(BagOrder n, Support m) and
A32:  eval(m,x) = Sum y and
      for i being Element of NAT st 1 <= i & i <= len y holds y/.i = (m *
SgmX(BagOrder n, Support m))/.i * eval(((SgmX(BagOrder n, Support m))/.i),x)
      by POLYNOM2:def 4;
      BagOrder n linearly_orders Support m by POLYNOM2:18;
      then rng SgmX(BagOrder n, Support m) = {} by A29,PRE_POLY:def 2;
      then SgmX(BagOrder n, Support m) = {} by RELAT_1:41;
      then y = <*>(the carrier of L) by A31;
      hence thesis by A30,A32,RLVECT_1:43;
    end;
  end;
  hence thesis;
end;
