
theorem bag5:
for F being Field
for B1,B2 being non zero bag of the carrier of F
for p being Ppoly of F,B1
for q being Ppoly of F,B2 st B1 = B2 holds p = q
proof
let R be Field, B1,B2 be non zero bag of the carrier of R;
let p be Ppoly of R,B1; let q be Ppoly of R,B2;
assume AS: B1 = B2;
defpred P[Nat] means
  for B1,B2 being non zero bag of the carrier of R
  for p being Ppoly of R,B1
  for q being Ppoly of R,B2 st deg p = $1 & B1 = B2 holds p = q;
IA: P[1]
    proof
    now let B1,B2 being non zero bag of the carrier of R;
      let p be Ppoly of R,B1; let q be Ppoly of R,B2;
      assume A0: deg p = 1 & B1 = B2;
      B1 = BRoots p by RING_5:55; then
      card B1 = 1 by A0,RING_5:56; then
      consider a being Element of R such that A1: B1 = Bag{a} by bag2;
      thus p = rpoly(1,a) by A1,simpAgcd2 .= q by A0,A1,simpAgcd2;
      end;
    hence thesis;
    end;
IS: now let k be Nat;
    assume k >= 1;
    assume IV: P[k];
    now let B1,B2 being non zero bag of the carrier of R;
      let p be Ppoly of R,B1; let q be Ppoly of R,B2;
      assume A0: deg p = k+1 & B1 = B2;
      set a = the Element of support B1;
      A1: support B1 <> {} by RING_5:24;
      support B1 c= dom B1 & dom B1 c= the carrier of R by PRE_POLY:37;
      then reconsider a as Element of R by A1;
      B1.a <> 0 by A1,PRE_POLY:def 7; then
      reconsider m = B1.a - 1 as Element of NAT by INT_1:5,NAT_1:14;
      consider u being Polynomial of R such that
      A2: p = (rpoly(1,a) `^ (B1.a)) *' u by RING_4:1,RING_5:54;
      set p1 = (rpoly(1,a) `^ m) *' u;
      B1.a = m + 1; then
      rpoly(1,a)`^(B1.a) = rpoly(1,a) *' (rpoly(1,a)`^m) by POLYNOM5:19;
      then A10: p = rpoly(1,a) *' p1 by A2,POLYNOM3:33;
      consider v being Polynomial of R such that
      A4: q = (rpoly(1,a) `^ (B1.a)) *' v by A0,RING_5:54,RING_4:1;
      set q1 = (rpoly(1,a) `^ m) *' v;
      B1.a = m + 1; then
      rpoly(1,a)`^(B1.a) = rpoly(1,a) *' (rpoly(1,a)`^m) by POLYNOM5:19;
      then A5: q = rpoly(1,a) *' q1 by A4,POLYNOM3:33;
      reconsider u,v as monic non zero Polynomial of R by A2,A4,ZZ3y;
      rpoly(1,a) <> 0_.(R) & p1 <> 0_.(R) by A10; then
      A8: deg p = deg rpoly(1,a) + deg p1 by A10,HURWITZ:23
               .= 1 + deg p1 by HURWITZ:27;
      per cases;
      suppose u is constant; then
        A6: u = 1_.(R) by lemconst;
        now assume A9: v is non constant;
          rpoly(1,a) `^ (B1.a) <> 0_.(R) & v <> 0_.(R); then
          A7: deg q = deg p + deg v by A2,A6,A4,HURWITZ:23;
          A8: B1 = BRoots p & B2 = BRoots q by RING_5:55; then
          deg p = card B2 by A0,RING_5:56 .= deg q by A8,RING_5:56;
          hence contradiction by A7,A9,RATFUNC1:def 2;
          end;
        hence p = q by A10,A5,A6,lemconst;
        end;
      suppose I: u is non constant;
        now assume v is constant; then
        I0: v = 1_.(R) by lemconst .= (1.R)|R by RING_4:14;
        1.R <> 0.R; then
        I5: deg((1.R)|R) = 0 by RING_4:21;
        rpoly(1,a) `^ (B1.a) <> 0_.(R) & v <> 0_.(R); then
        I1: deg q = deg(rpoly(1,a)`^(B1.a)) + 0 by I0,I5,A4,HURWITZ:23;
        rpoly(1,a) `^ (B1.a) <> 0_.(R) & u <> 0_.(R); then
        I3: deg p = deg(rpoly(1,a) `^ (B1.a)) + deg u by A2,HURWITZ:23;
        I4: B1 = BRoots p & B2 = BRoots q by RING_5:55; then
        deg p = card B2 by A0,RING_5:56 .= deg q by I4,RING_5:56;
        hence contradiction by I3,I1,I,RATFUNC1:def 2;
        end; then
      reconsider u,v as non constant monic Polynomial of R by I;
      reconsider u,v as Ppoly of R by A2,A4,FIELD_8:10;
      B1 = BRoots p by RING_5:55
        .= BRoots(rpoly(1,a)`^(B1.a)) + BRoots u by A2,UPROOTS:56; then
      BRoots(rpoly(1,a)`^(B1.a)) + BRoots u
         = BRoots q by A0,RING_5:55
        .= BRoots(rpoly(1,a)`^(B1.a)) + BRoots v by A4,UPROOTS:56; then
      A7: BRoots u = (BRoots(rpoly(1,a)`^(B1.a)) + BRoots v) -'
                          BRoots(rpoly(1,a)`^(B1.a)) by PRE_POLY:48
            .= BRoots v by PRE_POLY:48;
      per cases;
      suppose m is zero; then
        A9: rpoly(1,a) `^ m = 1_.(R) by POLYNOM5:15;
        u is Ppoly of R,(BRoots u) & v is Ppoly of R,(BRoots v) by RING_5:59;
        hence p = q by A7,A8,A0,A9,IV,A2,A4;
        end;
      suppose m is non zero; then
        reconsider m as non zero Element of NAT;
        rpoly(1,a)`^m is Ppoly of R by lemrpoly; then
        A9: rpoly(1,a)`^m is Ppoly of R,BRoots(rpoly(1,a)`^m) by RING_5:59;
        u is Ppoly of R,(BRoots u) by RING_5:59; then
        A6: p1 is Ppoly of R,BRoots(rpoly(1,a)`^m) + BRoots u by A9,RING_5:58;
        v is Ppoly of R,(BRoots v) by RING_5:59; then
        q1 is Ppoly of R,BRoots(rpoly(1,a)`^m) + BRoots v by A9,RING_5:58;
        hence p = q by A0,A6,A7,A8,IV,A10,A5;
        end;
      end;
      end;
    hence P[k+1];
    end;
I: for k being Nat st k >= 1 holds P[k] from NAT_1:sch 8(IA,IS);
reconsider n = deg p as Element of NAT;
n + 1 > 0 + 1 by RATFUNC1:def 2,XREAL_1:6;
then n >= 1 by NAT_1:13;
hence thesis by I,AS;
end;
