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;
reserve z for Complex;

theorem
  {2|^n-1 where n is Nat: 2|^n-1 <= 10|^6 & 2|^n-1 is a_product_of_two_primes}
  = { 2|^4-1, 2|^9-1, 2|^11-1 }
  proof
    set A =
    {2|^n-1: 2|^n-1 <= 10|^6 & 2|^n-1 is a_product_of_two_primes};
    set B = {2|^4-1,2|^9-1,2|^11-1};
A1: 10|^6 = 10*10*10*10*10*10 by NUMBER02:2;
    thus A c= B
    proof
      let x be object;
      assume x in A;
      then consider n such that
A2:   x = 2|^n-1 and
A3:   2|^n-1 <= 10|^6 and
A4:   2|^n-1 is a_product_of_two_primes;
A5:   now
        assume n < 2+1 & 2 = 3-1;
        then n = 0 or ... or n = 2 by NUMBER02:7;
        hence contradiction by A4,Th19,Lm1,Lm2;
      end;
A6:   now
        assume n is even;
        then consider k such that
A7:     n = 2*k;
A8:     2|^k+1 <> 0+1;
        now
          assume 2|^k = 2|^1;
          then k = 1 by PEPIN:30;
          hence contradiction by A7,A4,Th19,Lm2;
        end;
        then
A9:     2|^k-1 <> 2-1;
        2|^(2*k) = 2|^k|^2 by NEWTON:9
        .= (2|^k)^2 by WSIERP_1:1;
        then 2|^n-1 = (2|^k+1)*(2|^k-1) by A7;
        then 2|^k+1 is prime & 2|^k-1 is prime by A4,A8,A9,NUMBER07:59;
        then k = 2 by Th22;
        hence n > 4 implies contradiction by A7;
      end;
      n = 0 or ... or n = 19 by A1,A3,Lm25;
      then per cases by A5;
      suppose n = 3;
        hence thesis by A4,Lm3,XPRIMES1:7;
      end;
      suppose n = 4;
        hence thesis by A2,ENUMSET1:def 1;
      end;
      suppose n = 5;
        hence thesis by A4,Lm5,XPRIMES1:31;
      end;
      suppose n = 2*3;
        hence thesis by A6;
      end;
      suppose n = 7;
        hence thesis by A4,Lm7,XPRIMES1:127;
      end;
      suppose n = 2*4;
        hence thesis by A6;
      end;
      suppose n = 9;
        hence thesis by A2,ENUMSET1:def 1;
      end;
      suppose n = 2*5;
        hence thesis by A6;
      end;
      suppose n = 11;
        hence thesis by A2,ENUMSET1:def 1;
      end;
      suppose n = 2*6;
        hence thesis by A6;
      end;
      suppose n = 13;
        hence thesis by A4,Lm11,XPRIMES2:8191;
      end;
      suppose n = 2*7;
        hence thesis by A6;
      end;
      suppose
A10:    n = 15;
        2|^15-1 = 7*31*151 by Lm12;
        hence thesis by A4,A10,XPRIMES1:7,31,151;
      end;
      suppose n = 2*8;
        hence thesis by A6;
      end;
      suppose n = 17;
        hence thesis by A4,Th24;
      end;
      suppose n = 2*9;
        hence thesis by A6;
      end;
      suppose n = 19;
        hence thesis by A4,Th25;
      end;
    end;
    thus B c= A
    proof
      let x be object;
      assume x in B;
      then per cases by ENUMSET1:def 1;
      suppose
A11:    x = 2|^4-1;
        2|^4-1 = 3*5 by Lm4;
        hence thesis by A1,A11,XPRIMES1:3,5;
      end;
      suppose
A12:    x = 2|^9-1;
        2|^9-1 = 7*73 by Lm9;
        hence thesis by A1,A12,XPRIMES1:7,73;
      end;
      suppose
A13:    x = 2|^11-1;
        2|^11-1 = 23*89 by Lm10;
        hence thesis by A1,A13,XPRIMES1:23,89;
      end;
    end;
  end;
