reserve X,Y,Z for set,
  x,y,z for object,
  E for non empty set,
  A,B,C for Ordinal ,
  L,L1 for Sequence,
  f,f1,f2,h for Function,
  d,d1,d2,d9 for Element of E;
reserve f,g,h for (Function of VAR,E),
  u,v,w for (Element of E),
  x for Variable,
  a,b,c for object;

theorem
  E |= the_axiom_of_extensionality implies ex X st X is
  epsilon-transitive & E,X are_epsilon-isomorphic
proof
  consider f being Function such that
A1: dom f = E and
A2: for d holds f.d = f.:d by Th9;
  assume
A3: E |= the_axiom_of_extensionality;
A4: now
    defpred P[Ordinal] means ex d1,d2 st d1 in Collapse(E,$1) & d2 in Collapse
    (E,$1) & f.d1 = f.d2 & d1 <> d2;
    given a,b being object such that
A5: a in dom f & b in dom f and
A6: f.a = f.b & a <> b;
    reconsider d1 = a, d2 = b as Element of E by A1,A5;
    consider A1 being Ordinal such that
A7: d1 in Collapse (E,A1) by Th5;
    consider A2 being Ordinal such that
A8: d2 in Collapse (E,A2) by Th5;
    A1 c= A2 or A2 c= A1;
    then
    Collapse (E,A1) c= Collapse (E,A2) or Collapse (E,A2) c= Collapse (E,
    A1) by Th4;
    then
A9: ex A st P[A] by A6,A7,A8;
    consider A such that
A10: P[A] & for B st P[B] holds A c= B from ORDINAL1:sch 1 (A9);
    consider d1,d2 such that
A11: d1 in Collapse (E,A) and
A12: d2 in Collapse (E,A) and
A13: f.d1 = f.d2 and
A14: d1 <> d2 by A10;
    consider w such that
A15: not(w in d1 iff w in d2) by A3,A14,Th11;
A16: f.d1 = f.:d1 & f.d2 = f.:d2 by A2;
A17: now
      assume that
A18:  w in d2 and
A19:  not w in d1;
      consider A1 being Ordinal such that
A20:  A1 in A & w in Collapse(E,A1) by A12,A18,Th6;
      f.w in f.:d2 by A1,A18,FUNCT_1:def 6;
      then consider a being object such that
A21:  a in dom f and
A22:  a in d1 and
A23:  f.w = f.a by A13,A16,FUNCT_1:def 6;
      reconsider v = a as Element of E by A1,A21;
      consider A2 being Ordinal such that
A24:  A2 in A & v in Collapse(E,A2) by A11,A22,Th6;
      A1 c= A2 or A2 c= A1;
      then
      Collapse (E,A1) c= Collapse (E,A2) or Collapse (E,A2) c= Collapse (
      E,A1) by Th4;
      hence contradiction by A10,A19,A22,A23,A20,A24,ORDINAL1:5;
    end;
    now
      assume that
A25:  w in d1 and
A26:  not w in d2;
      consider A1 being Ordinal such that
A27:  A1 in A & w in Collapse(E,A1) by A11,A25,Th6;
      f.w in f.:d1 by A1,A25,FUNCT_1:def 6;
      then consider a being object such that
A28:  a in dom f and
A29:  a in d2 and
A30:  f.w = f.a by A13,A16,FUNCT_1:def 6;
      reconsider v = a as Element of E by A1,A28;
      consider A2 being Ordinal such that
A31:  A2 in A & v in Collapse(E,A2) by A12,A29,Th6;
      A1 c= A2 or A2 c= A1;
      then
      Collapse (E,A1) c= Collapse (E,A2) or Collapse (E,A2) c= Collapse (
      E,A1) by Th4;
      hence contradiction by A10,A26,A29,A30,A27,A31,ORDINAL1:5;
    end;
    hence contradiction by A15,A17;
  end;
  take X = rng f;
  thus X is epsilon-transitive by A1,A2,Th10;
  take f;
  thus dom f = E & rng f = X by A1;
  thus f is one-to-one by A4,FUNCT_1:def 4;
  let a,b;
  assume that
A32: a in E and
A33: b in E;
  reconsider d2 = b as Element of E by A33;
  thus (ex Z st Z = b & a in Z) implies ex Z st Z = f.b & f.a in Z
  proof
    given Z such that
A34: Z = b & a in Z;
A35: f.d2 = f.: d2 by A2;
    f.a in f.:d2 by A1,A32,A34,FUNCT_1:def 6;
    hence thesis by A35;
  end;
  given Z such that
A36: Z = f.b & f.a in Z;
  f.d2 = f.:d2 by A2;
  then consider c being object such that
A37: c in dom f and
A38: c in d2 and
A39: f.a = f.c by A36,FUNCT_1:def 6;
  a = c by A1,A4,A32,A37,A39;
  hence thesis by A38;
end;
