
theorem
  for L being complete LATTICE holds
  (for x being Element of L holds x is compact) iff
  for X being non empty Subset of L ex x being Element of L st x in X &
  for y being Element of L st y in X holds not x < y
proof
  let L be complete LATTICE;
  hereby
    assume
A1: for x being Element of L holds x is compact;
    given Y being non empty Subset of L such that
A2: for x being Element of L st x in Y
    ex y being Element of L st y in Y & x < y;
    defpred P[object,object] means
    [$1,$2] in the InternalRel of L & $1 <> $2;
A3: now
      let x be object;
      assume
A4:   x in Y;
      then reconsider y = x as Element of L;
      consider z being Element of L such that
A5:   z in Y and
A6:   y < z by A2,A4;
      reconsider u = z as object;
      take u;
      y <= z by A6;
      hence u in Y & P[x,u] by A5,A6;
    end;
    consider f being Function such that
A7: dom f = Y & rng f c= Y &
    for x being object st x in Y holds P[x,f.x] from FUNCT_1:sch 6(A3);
    set x = the Element of Y;
    set x1 = x;
    set Z = the set of all iter(f,n).x where n is Element of NAT;
    f.x in rng f by A7,FUNCT_1:def 3;
    then f.x in Y by A7;
    then reconsider x, x9 = f.x1 as Element of L;
A8: [x,f.x] in the InternalRel of L by A7;
A9: x <> f.x by A7;
A10: x9 = iter(f,1).x by FUNCT_7:70;
A11: x <= x9 by A8;
A12: x9 in Z by A10;
A13: x < x9 by A9,A11;
A14: Z c= Y
    proof
      let a be object;
      assume a in Z;
      then consider n being Element of NAT such that
A15:  a = iter(f,n).x;
      dom iter(f,n) = Y by A7,FUNCT_7:74;
      then
A16:  a in rng iter(f,n) by A15,FUNCT_1:def 3;
      rng iter(f,n) c= Y by A7,FUNCT_7:74;
      hence thesis by A16;
    end;
    then reconsider Z as Subset of L by XBOOLE_1:1;
A17: now
      let i be Element of NAT;
      defpred P[Nat] means ex z,y being Element of L st
      z = iter(f,i).x & y = iter(f,i+$1).x & z <= y;
      iter(f,i).x in Z;
      then
A18:  P[ 0 ];
A19:  for k being Nat st P[k] holds P[k+1]
      proof
        let k be Nat;
        given z,y being Element of L such that
A20:    z = iter(f,i).x and
A21:    y = iter(f,i+k).x and
A22:    z <= y;
        take z;
A23:    rng iter(f,i+k) c= Y by A7,FUNCT_7:74;
A24:    dom iter(f,i+k) = Y by A7,FUNCT_7:74;
        then
A25:    y in rng iter(f,i+k) by A21,FUNCT_1:def 3;
        then f.y in rng f by A7,A23,FUNCT_1:def 3;
        then f.y in Y by A7;
        then reconsider yy = f.y as Element of L;
        take yy;
        thus z = iter(f,i).x by A20;
        iter(f,k+i+1) = f*iter(f,k+i) by FUNCT_7:71;
        hence yy = iter(f,i+(k+1)).x by A21,A24,FUNCT_1:13;
        [y,yy] in the InternalRel of L by A7,A23,A25;
        then y <= yy;
        hence thesis by A22,ORDERS_2:3;
      end;
A26:  for k being Nat holds P[k] from NAT_1:sch 2(A18,A19);
      let k be Element of NAT;
      assume i <= k;
      then consider n being Nat such that
A27:  k = i+n by NAT_1:10;
      reconsider n as Element of NAT by ORDINAL1:def 12;
A28:  ex z,y being Element of L st
      z = iter(f,i).x & y = iter(f,i+n).x & z <= y by A26;
      let z,y be Element of L;
      assume that
A29:  z = iter(f,i).x and
A30:  y = iter(f,k).x;
      thus z <= y by A27,A28,A29,A30;
    end;
A31: now
      let z,y be Element of L;
      assume z in Z;
      then consider k1 being Element of NAT such that
A32:  z = iter(f,k1).x;
      assume y in Z;
      then consider k2 being Element of NAT such that
A33:  y = iter(f,k2).x;
      k1 <= k2 or k2 <= k1;
      hence z <= y or z >= y by A17,A32,A33;
    end;
    sup Z is compact by A1;
    then sup Z << sup Z;
    then consider A being finite Subset of L such that
A34: A c= Z and
A35: sup Z <= sup A by Th18;
A36: now
      assume A = {};
      then x is_>=_than A;
      then sup A <= x by YELLOW_0:32;
      then
A37:  sup A < x9 by A13,ORDERS_2:7;
A38:  Z is_<=_than sup Z by YELLOW_0:32;
A39:  sup Z < x9 by A35,A37,ORDERS_2:7;
      x9 <= sup Z by A12,A38;
      hence contradiction by A39,ORDERS_2:6;
    end;
A40: A is finite;
    defpred P[set] means $1 <> {} implies "\/"($1,L) in $1;
A41: P[{}];
A42: now
      let x, B be set;
      assume that
A43:  x in A and
A44:  B c= A;
      reconsider x9 = x as Element of L by A43;
      assume
A45:  P[B];
      thus P[B \/ {x}]
      proof
        assume B \/ {x} <> {};
A46:    ex_sup_of B,L by YELLOW_0:17;
A47:    ex_sup_of {x},L by YELLOW_0:17;
        ex_sup_of B \/ {x},L by YELLOW_0:17;
        then
A48:    "\/"(B \/ {x}, L) = "\/"(B,L) "\/" "\/"({x},L) by A46,A47,YELLOW_0:36;
A49:    sup {x9} = x by YELLOW_0:39;
        per cases;
        suppose B = {};
          hence thesis by A49,TARSKI:def 1;
        end;
        suppose B <> {};
          then "\/"(B,L) in A by A44,A45;
          then x9 <= "\/"(B,L) or x9 >= "\/"(B,L) by A31,A34,A43;
          then "\/"(B,L) "\/" x9 = "\/"(B,L) or
          "\/"(B,L) "\/" x9 = x9 "\/" "\/"(B,L) & x9 "\/" "\/"(B,L) = x9
          by YELLOW_0:24;
          then "\/"(B \/ {x}, L) in B or "\/"
          (B \/ {x}, L) in {x} by A45,A48,A49,TARSKI:def 1;
          hence thesis by XBOOLE_0:def 3;
        end;
      end;
    end;
    P[A] from FINSET_1:sch 2(A40,A41,A42);
    then
A50: sup A in Z by A34,A36;
    then consider n being Element of NAT such that
A51: sup A = iter(f,n).x;
A52: [sup A, f.sup A] in the InternalRel of L by A7,A14,A50;
A53: sup A <> f.sup A by A7,A14,A50;
    reconsider xSn = f.sup A as Element of L by A52,ZFMISC_1:87;
A54: iter(f,n+1) = f*iter(f,n) by FUNCT_7:71;
A55: dom iter(f,n) = Y by A7,FUNCT_7:74;
A56: sup A <= xSn by A52;
A57: f.sup A = iter(f,n+1).x by A51,A54,A55,FUNCT_1:13;
A58: sup A < xSn by A53,A56;
A59: xSn in Z by A57;
    Z is_<=_than sup Z by YELLOW_0:32;
    then
A60: xSn <= sup Z by A59;
    sup Z < xSn by A35,A58,ORDERS_2:7;
    hence contradiction by A60,ORDERS_2:6;
  end;
  assume
A61: for X being non empty Subset of L ex x being Element of L st x in X &
  for y being Element of L st y in X holds not x < y;
  let x be Element of L;
  let D be directed non empty Subset of L;
  consider y being Element of L such that
A62: y in D and
A63: for z being Element of L st z in D holds not y < z by A61;
  D is_<=_than y
  proof
    let a be Element of L;
    assume a in D;
    then consider b being Element of L such that
A64: b in D and
A65: a <= b and
A66: y <= b by A62,WAYBEL_0:def 1;
    not y < b by A63,A64;
    hence thesis by A65,A66;
  end;
  then
A67: sup D <= y by YELLOW_0:32;
  sup D is_>=_than D by YELLOW_0:32;
  then y <= sup D by A62;
  then sup D = y by A67,ORDERS_2:2;
  hence thesis by A62;
end;
