reserve X for set;
reserve a,b,c,k,m,n for Nat;
reserve i,j for Integer;
reserve r,s for Real;
reserve p,p1,p2,p3 for Prime;

theorem Th31:
  for n being non zero Nat holds
  EmptyBag SetPrimes +* Euler_factorization n =
  (EmptyBag SetPrimes +* Euler_factorization_1 n) (#)
  (EmptyBag SetPrimes +* Euler_factorization_2 n)
  proof
    let n be non zero Nat;
    set N = Euler_factorization n;
    set S = Euler_factorization_1 n;
    set T = Euler_factorization_2 n;
A1: dom N = support ppf n by Def1;
A2: dom S = support ppf n by Def2;
A3: dom T = support ppf n by Def3;
    for x being object st x in SetPrimes holds (B+*N).x = (B+*S).x*(B+*T).x
    proof
      let x be object;
      assume x in SetPrimes;
      then reconsider p = x as Prime by NEWTON:def 6;
      per cases;
      suppose
A4:     x in dom N;
        then
A5:     (B+*N).x = N.x & (B+*S).x = S.x & (B+*T).x = T.x
        by A1,A2,A3,FUNCT_4:13;
        consider c being non zero Nat such that
A6:     c = p |-count n & S.p = p|^(c-1) by A1,A2,A4,Def2;
        ex c being non zero Nat st
        c = p |-count n & N.p = p|^(c-1) * (p-1) by A4,Th18;
        hence thesis by A1,A3,A4,A5,A6,Def3;
      end;
      suppose not x in dom N;
        then (B+*N).x = B.x & (B+*S).x = B.x & (B+*T).x = B.x
        by A1,A2,A3,FUNCT_4:11;
        hence thesis;
      end;
    end;
    hence thesis by Th4;
  end;
