reserve a,b,c,k,l,m,n for Nat,
  i,j,x,y for Integer;

theorem
  n is prime implies Euler n = n - 1
proof
  set X={kk where kk is Element of NAT : n,kk are_coprime & kk >= 1 &
  kk <= n};
  X c= Seg n
  proof
    let x be object;
    assume x in X;
    then ex k be Element of NAT st k = x & n,k are_coprime & k >= 1 & k
    <= n;
    hence thesis by FINSEQ_1:1;
  end;
  then reconsider X as finite set;
  assume
A1: n is prime;
  n <> 0
  proof
    assume n = 0;
    then n in SetPrimenumber 2 by A1,NEWTON:def 7;
    hence contradiction;
  end;
  then 0 in {l where l is Nat: l < n};
  then
A2: 0 in n by AXIOMS:4;
  Segm n \ {0} c= X
  proof
    let x be object;
    assume
A3: x in Segm n \ {0};
    then
A4:x in Segm n by XBOOLE_0:def 5;
    not x in {0} by A3,XBOOLE_0:def 5;
    hence thesis by A1,Th3,A4;
  end;
  then
A5: card (n \ {0}) <= card X by NAT_1:43;
A6: Euler n <= n - 1 by A1,Th19,INT_2:def 4;
  card n = n & card {0} = 1 by CARD_1:30;
  then n - 1 <= Euler n by A5,A2,Th4;
  hence thesis by A6,XXREAL_0:1;
end;
