
theorem Th4:
  for p be Safe Prime st p <> 7 holds p mod 3 = 2
proof
  let p be Safe Prime;
  set k = p mod 3;
  consider q be Prime such that
A1: 2*q+1 = p by Def1;
  assume
A2: p <> 7;
A3: now
    assume
A4: k = 0 or k = 1;
    now
      per cases by A4;
      suppose
        k = 0;
        then 3 divides p by INT_1:62;
        then 3 = p by INT_2:def 4;
        hence contradiction by Th2;
      end;
      suppose
A5:     k = 1;
        2,3 are_coprime by INT_2:28,30,PEPIN:41;
        then
A6:     2 gcd 3 = 1 by INT_2:def 3;
        3 divides (2*q+1-1) by A1,A5,PEPIN:8;
        then 3 divides q by A6,WSIERP_1:29;
        then 3 = q by INT_2:def 4;
        hence contradiction by A2,A1;
      end;
    end;
    hence contradiction;
  end;
  k < 2+1 by NAT_D:62;
  then k <=0+2 by NAT_1:13;
  then k = 0 or ... or k = 2;
  hence thesis by A3;
end;
