 reserve n,i for Nat;
 reserve p for Prime;

theorem
  for n being non zero Nat holds
    TSqFactors n = (SqFactors n) |^ 2
  proof
    let n be non zero Nat;
A0: dom ((SqFactors n) |^ 2) = SetPrimes by PARTFUN1:def 2;
AA: dom TSqFactors n = SetPrimes &
    dom (SqFactors n) = SetPrimes by PARTFUN1:def 2;
    for x being object st x in dom TSqFactors n holds
      (TSqFactors n).x = ((SqFactors n) |^ 2).x
    proof
      let x be object;
      assume x in dom TSqFactors n; then
      reconsider p = x as Prime by AA,NEWTON:def 6;
      per cases;
      suppose
J1:     x in support pfexp n;
        hence (TSqFactors n).x = p |^ (2 * ((p |-count n) div 2)) by TSqDef
          .= (p |^ (((p |-count n) div 2))) |^ 2 by NEWTON:9
          .= ((SqFactors n).x) |^ 2 by SqDef,J1
          .= ((SqFactors n) |^ 2).x by NAT_3:def 6;
      end;
      suppose
J0:     not x in support pfexp n; then
        not x in support TSqFactors n by TSqDef; then
J3:     (TSqFactors n).x = 0 by PRE_POLY:def 7;
        not x in support SqFactors n by J0,SqDef; then
        (SqFactors n).x = 0 by PRE_POLY:def 7; then
        ((SqFactors n).x) |^ 2 = 0 by NEWTON:11;
        hence thesis by J3,NAT_3:def 6;
      end;
    end;
    hence thesis by FUNCT_1:2,A0,PARTFUN1:def 2;
  end;
