reserve n for Nat;

theorem multip:
for R being domRing,
    p being non zero Polynomial of R
for a being Element of R
holds multiplicity(p,a) = n
      iff (rpoly(1,a)`^n divides p & not rpoly(1,a)`^(n+1) divides p)
proof
let R be domRing, p be non zero Polynomial of R;
let a be Element of R;
A: now assume multiplicity(p,a) = n;
   then consider F being finite non empty Subset of NAT such that
   B: F = {k where k is Element of NAT : ex q being Polynomial of R
           st p = (<%-a, 1.R%>`^k) *' q} & n = max F by UPROOTS:def 8;
   n in F by B,XXREAL_2:def 6; then
   consider k being Element of NAT such that
   C: k = n & ex q being Polynomial of R st p = (<%-a, 1.R%>`^k) *' q by B;
   consider q being Polynomial of R such that
   D: p = (<%-a, 1.R%>`^n) *' q by C;
   p = (rpoly(1,a)`^n) *' q by D,repr;
   hence rpoly(1,a)`^n divides p by RING_4:1;
   F: n is UpperBound of F by B,XXREAL_2:def 3;
   now assume rpoly(1,a)`^(n+1) divides p;
     then consider q being Polynomial of R such that
     E: p = (rpoly(1,a)`^(n+1)) *' q by RING_4:1;
     p = (<%-a, 1.R%>`^(n+1)) *' q by E,repr;
     then n+1 in F by B;
     hence contradiction by F,XXREAL_2:def 1,NAT_1:16;
     end;
   hence not rpoly(1,a)`^(n+1) divides p;
   end;
now assume X: rpoly(1,a)`^n divides p & not rpoly(1,a)`^(n+1) divides p;
  set n0 = multiplicity(p,a);
  consider F being finite non empty Subset of NAT such that
  B: F = {k where k is Element of NAT : ex q being Polynomial of R
          st p = (<%-a, 1.R%>`^k) *' q} & n0 = max F by UPROOTS:def 8;
  consider q being Polynomial of R such that
  E: p = (rpoly(1,a)`^n) *' q by X,RING_4:1;
K: n in NAT by ORDINAL1:def 12;
  p = (<%-a, 1.R%>`^n) *' q by E,repr;
  then C: n in F by B,K;
  now let k be ExtReal;
    assume k in F;
    then consider k0 being Element of NAT such that
    C: k0 = k & ex q being Polynomial of R st p = (<%-a, 1.R%>`^k0) *' q by B;
    consider q being Polynomial of R such that
    D: p = (<%-a, 1.R%>`^k0) *' q by C;
    now assume k0 >= n + 1;
      then consider j being Nat such that
      E: k0 = (n + 1) + j by NAT_1:10;
      reconsider j as Element of NAT by ORDINAL1:def 12;
      p = (rpoly(1,a)`^k0) *' q by D,repr
       .= ((rpoly(1,a)`^(n+1)) *' (rpoly(1,a)`^j)) *' q by E,UPROOTS:30
       .= (rpoly(1,a)`^(n+1)) *' ((rpoly(1,a)`^j) *' q) by POLYNOM3:33;
      hence contradiction by X,RING_4:1;
      end;
    hence k <= n by C,NAT_1:13;
    end;
  hence multiplicity(p,a) = n by B,C,XXREAL_2:def 8;
  end;
hence thesis by A;
end;
