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 Th26:
  for n being non zero Nat holds
  Euler n = Product ((EmptyBag SetPrimes) +* Euler_factorization n)
  proof
    let n be non zero Nat;
    set N = Euler_factorization n;
    defpred P[Nat] means for n being non zero Nat st
    support (B +* Euler_factorization n) c= Seg $1 holds
    Product (B +* Euler_factorization n) = Euler n;
A1: P[0]
    proof
      let n be non zero Nat;
      set N = Euler_factorization n;
      set G = B+*N;
A2:   support G = support N by Th12;
      assume
A3:   support G c= Seg 0;
      then
A4:   n = 1 by A2,Th22,NAT_1:53;
      support G = {} by A3;
      then G = B by PRE_POLY:81;
      hence Product G = Euler n by A4,NAT_3:20,EULER_1:17;
    end;
A5: for k being Nat st P[k] holds P[k+1]
    proof
      let k be Nat such that
A6:   P[k];
      let n be non zero Nat;
      set N = Euler_factorization n;
      set p = k+1;
      set e = p |-count n;
      set s = p|^e;
      set G = B+*N;
      assume
A7:   support G c= Seg p;
      per cases;
      suppose support G c= Seg k;
        hence Product G = Euler n by A6;
      end;
      suppose
A8:     not support G c= Seg k;
A9:     support ppf n = support pfexp n by NAT_3:def 9;
A10:    dom N = support ppf n by Def1;
A11:    support G = support N by Th12;
A12:    support N = dom N by Th21;
A13:    now
          assume
A14:      not p in support G;
          support G c= Seg k
          proof
            let x be object;
            assume
A15:        x in support G;
            then reconsider m = x as Nat;
            m <= p by A7,A15,FINSEQ_1:1;
            then m < p by A14,A15,XXREAL_0:1;
            then
A16:        m <= k by NAT_1:13;
            x is Prime by A11,A12,A15,Th17;
            then 1 <= m by INT_2:def 4;
            hence thesis by A16;
          end;
          hence contradiction by A8;
        end;
        then
A17:    p is Prime by A11,A12,Th17;
        then
A18:    p > 1 by INT_2:def 4;
        then s divides n by NAT_3:def 7;
        then consider t being Nat such that
A19:    n = s * t;
        reconsider s, t as non zero Nat by A19;
        set S = Euler_factorization s;
        set T = Euler_factorization t;
A20:    dom(B+*S) = SetPrimes by PARTFUN1:def 2;
        (pfexp n).p = e by A17,NAT_3:def 8;
        then
A21:    e <> 0 by A9,A13,A10,A11,A12,PRE_POLY:def 7;
A22:    support ppf t = support pfexp t by NAT_3:def 9;
A23:    support (B+*T) = support T by Th12;
A24:    support T = dom T by Th21;
A25:    dom T = support ppf t by Def1;
A26:    support T c= Seg k
        proof
          set f = p |-count t;
          let x be object;
          assume
A27:      x in support T;
          then reconsider x as Nat by A24,A25;
A28:      x in support pfexp t by A24,A25,A27,NAT_3:def 9;
A29:      now
            assume
A30:        x = p;
            (pfexp t).p = f by A17,NAT_3:def 8;
            then f <> 0 by A28,A30,PRE_POLY:def 7;
            then f >= 0+1 by NAT_1:13;
            then consider g being Nat such that
A31:        f = 1+g by NAT_1:10;
            p|^f divides t by A18,NAT_3:def 7;
            then consider u being Nat such that
A32:        t = (p|^f)*u;
            n = s * (((p|^g)*p)*u) by A19,A31,A32,NEWTON:6
            .= s*p *((p|^g)*u)
            .= (p|^(e+1))*((p|^g)*u) by NEWTON:6;
            then p|^(e+1) divides n;
            hence contradiction by A18,NAT_3:def 7;
          end;
          support ppf t c= support ppf n by A9,A19,A22,NAT_3:45;
          then x in support N by A10,A12,A24,A25,A27;
          then x <= p by A11,A7,FINSEQ_1:1;
          then x < p by A29,XXREAL_0:1;
          then
A33:      x <= k by NAT_1:13;
          x is Prime by A28,NAT_3:34;
          then 1 <= x by INT_2:def 4;
          hence thesis by A33;
        end;
A34:    s,t are_coprime
        proof
          set u = s gcd t;
A35:      u divides t by NAT_D:def 5;
A36:      0+1 <= u by NAT_1:13;
          assume s gcd t <> 1;
          then u > 1 by A36,XXREAL_0:1;
          then u >= 1+1 by NAT_1:13;
          then consider r being Element of NAT such that
A37:      r is prime and
A38:      r divides u by INT_2:31;
          u divides s by NAT_D:def 5;
          then r divides s by A38,NAT_D:4;
          then r = 1 or r = p by A17,A37,NAT_3:5,INT_2:def 4;
          then p in support pfexp t by A37,A38,A35,NAT_D:4,NAT_3:37;
          then k+1 <= k by A26,A24,A25,A22,FINSEQ_1:1;
          hence contradiction by NAT_1:13;
        end;
        consider f being FinSequence of COMPLEX such that
A39:    Product(B+*S) = Product f and
A40:    f = (B+*S)*canFS(support(B+*S)) by NAT_3:def 5;
A41:    dom S = support ppf s by Def1
        .= support pfexp s by NAT_3:def 9;
A42:    support pfexp s = {p} by A17,A21,NAT_3:42;
        then
A43:    p in dom S by A41,TARSKI:def 1;
A44:    support S c= dom S by PRE_POLY:37;
        consider c being non zero Nat such that
A45:    c = p |-count s & S.p = p|^c - p|^(c-1) by A43,Def1;
A46:    c-'1 = c-1 by XREAL_0:def 2;
        {p} c= support S
        proof
          let x be object;
          assume x in {p};
          then
A47:      x = p by TARSKI:def 1;
          c-1 < c-0 by XREAL_1:15;
          then S.p <> 0 by A45,A18,PEPIN:66;
          hence thesis by A47,PRE_POLY:def 7;
        end;
        then support S = {p} by A41,A42,A44,XBOOLE_0:def 10;
        then
A48:    support(B+*S) = {p} by Th12;
        then f = (B+*S)*<*p*> by A40,FINSEQ_1:94
        .= <* (B+*S).p *> by A13,A20,FINSEQ_2:34;
        then
A49:    Product(B+*S) = S.p by A39,A43,FUNCT_4:13
        .= Euler s by A17,A45,A46,NAT_1:14,INT_8:8;
        Product((B+*S)+(B+*T)) = (Product(B+*S)) * (Product(B+*T))
        by A23,A24,A34,A48,A41,A42,Th24,NAT_3:19;
        then
A50:    Product((B+*S)+(B+*T)) = Euler s * Euler t by A6,A49,A23,A26;
        Euler n = Euler s * Euler t by A19,A34,EULER_1:21;
        hence Product G = Euler n by A50,A19,A34,Th25;
      end;
    end;
A51: for k being Nat holds P[k] from NAT_1:sch 2(A1,A5);
     set G = B+*N;
A52: support G = support N by Th12;
     per cases;
     suppose
A53:   support G is empty;
       then
A54:   n = 1 by A52,Th22,NAT_1:53;
       G = B by A53,PRE_POLY:81;
       hence Product G = Euler n by A54,NAT_3:20,EULER_1:17;
     end;
     suppose support G is non empty;
       then reconsider M = support G as finite non empty Subset of NAT
       by XBOOLE_1:1;
A55:   max M is Nat by TARSKI:1;
       support G c= Seg max M
       proof
         let x be object;
         assume
A56:     x in support G;
         then reconsider m = x as Nat;
A57:     support G = support N by Th12;
         support N c= dom N by PRE_POLY:37;
         then x is Prime by A56,A57,Th17;
         then
A58:     1 <= m by INT_2:def 4;
         m <= max M by A56,XXREAL_2:def 8;
         hence thesis by A58;
       end;
       hence thesis by A51,A55;
     end;
   end;
