reserve i,j,n,n1,n2,m,k,l,u for Nat,
        i1,i2,i3,i4,i5,i6 for Element of n,
        p,q for n-element XFinSequence of NAT,
        a,b,c,d,e,f for Integer;

theorem Th4:
  for n being Ordinal, b being bag of n holds
   degree b = Sum (b * SgmX(RelIncl n, support b))
proof
  let n be Ordinal, b be bag of n;
  set SG=SgmX(RelIncl n, support b);
A1: RelIncl n linearly_orders support b by PRE_POLY:82;
A2: rng SG = support b by A1,PRE_POLY:def 2;
  then
A3: rng SG c= dom b = n by PRE_POLY:37,PARTFUN1:def 2;
  consider f be  FinSequence of NAT such that
A4: degree b = Sum f & f = b*canFS(support b) by UPROOTS:def 4;
  rng canFS(support b) = support b by FUNCT_2:def 3;
  then reconsider C= canFS(support b) as FinSequence of n by FINSEQ_1:def 4;
  rng b c= NAT by VALUED_0:def 6;
  then reconsider B=b as Function of n,REAL by A3,FUNCT_2:2;
A5: SG is one-to-one by PRE_POLY:10,82;
A6: rng SG =rng C by FUNCT_2:def 3,A2;
  then for x being Element of n st x in rng SG \ rng C holds B.x = 0
    by XBOOLE_0:def 1;
  hence thesis by A4,ORDERS_5:8,A5,A6;
end;
