reserve x,y,Y,Z for set,
  L for LATTICE,
  l for Element of L;

theorem Th37:
  for L being continuous complete LATTICE st for l being Element
  of L ex X being Subset of L st l = sup X & for x being Element of L st x in X
  holds x is co-prime for l being Element of L holds l = "\/"((waybelow l) /\
  PRIME(L opp), L)
proof
  let L be continuous complete LATTICE;
  defpred P[object,object] means
    ex A being set st A = $2 & A c= PRIME L~ & $1 = "\/"(A,L);
  assume
A1: for l being Element of L ex X being Subset of L st l = sup X & for x
  being Element of L st x in X holds x is co-prime;
A2: for e be object st e in the carrier of L ex u be object st P[e,u]
  proof
    let e be object;
    assume e in the carrier of L;
    then reconsider l = e as Element of L;
    consider X being Subset of L such that
A3: l = sup X and
A4: for x being Element of L st x in X holds x is co-prime by A1;
    now
      let p1 be object;
      assume
A5:   p1 in X;
      then reconsider p = p1 as Element of L;
      p is co-prime by A4,A5;
      then p~ is prime;
      hence p1 in PRIME L~ by Def7;
    end;
    then X c= PRIME L~;
    hence thesis by A3;
  end;
  consider f being Function such that
A6: dom f = the carrier of L and
A7: for e be object st e in the carrier of L holds P[e, f.e] from CLASSES1
  :sch 1(A2);
  let l be Element of L;
A8: ex_sup_of ((waybelow l) /\ PRIME(L~)),L by YELLOW_0:17;
A9: waybelow l c= {sup X where X is Subset of L : X in rng f & sup X in
  waybelow l}
  proof
    let e be object;
    assume
A10: e in waybelow l;
    then
A11:  P[e,f.e] by A7;
    then f.e c= PRIME L~;
    then
A12: f.e c= the carrier of L~ by XBOOLE_1:1;
    e = "\/"((f.e),L) & f.e in rng f by A6,FUNCT_1:def 3,A11;
    hence thesis by A10,A12;
  end;
  defpred P[Subset of L] means $1 in rng f & sup $1 in waybelow l;
A13: l = sup waybelow l by WAYBEL_3:def 5;
  set Z = union {X where X is Subset of L : X in rng f & sup X in waybelow l};
A14: Z c= (waybelow l) /\ PRIME(L~)
  proof
    let e be object;
    assume e in Z;
    then consider Y be set such that
A15: e in Y and
A16: Y in {X where X is Subset of L : X in rng f & sup X in waybelow l
    } by TARSKI:def 4;
    consider X be Subset of L such that
A17: Y = X and
A18: X in rng f and
A19: sup X in waybelow l by A16;
    reconsider e1 = e as Element of L by A15,A17;
    e1 <= sup X by A15,A17,YELLOW_2:22;
    then
A20: e in waybelow l by A19,WAYBEL_0:def 19;
    consider r be object such that
A21:   r in dom f & X = f.r by A18,FUNCT_1:def 3;
    P[r,f.r] by A6,A7,A21;
    then X c= PRIME(L~) by A21;
    hence thesis by A15,A17,A20,XBOOLE_0:def 4;
  end;
A22: ex_sup_of Z,L by YELLOW_0:17;
  ex_sup_of (waybelow l),L by YELLOW_0:17;
  then
A23: "\/"((waybelow l) /\ PRIME(L~),L) <= "\/"(waybelow l,L) by A8,XBOOLE_1:17
,YELLOW_0:34;
  {sup X where X is Subset of L : P[X] } c= waybelow l
  proof
    let e be object;
    assume
    e in {sup X where X is Subset of L : X in rng f & sup X in waybelow l};
    then
    ex X be Subset of L st e = sup X & X in rng f & sup X in waybelow l;
    hence thesis;
  end;
  then l = "\/"({sup X where X is Subset of L : P[X]}, L) by A13,A9,
XBOOLE_0:def 10
    .= "\/"(union {X where X is Subset of L : P[X]}, L) from YELLOW_3:sch 5;
  then l <= "\/"((waybelow l) /\ PRIME(L~),L) by A22,A8,A14,YELLOW_0:34;
  hence thesis by A13,A23,ORDERS_2:2;
end;
