
theorem Th48:
  for L being complete LATTICE holds L is completely-distributive iff
  for J being non empty set, K being non-empty ManySortedSet of J
  for F being DoubleIndexedSet of K,L holds Sup Infs F = Inf Sups Frege F
proof
  let L be complete LATTICE;
  thus L is completely-distributive implies for J being non empty set,
       K being non-empty ManySortedSet of J
  for F being DoubleIndexedSet of K,L holds Sup Infs
  F = Inf Sups Frege F
  proof
    assume that
    L is complete and
A1: for J being non empty set, K being non-empty ManySortedSet of J
    for F being DoubleIndexedSet of K, L holds Inf Sups F = Sup Infs Frege F;
    let J be non empty set, K be non-empty ManySortedSet of J;
    let F be DoubleIndexedSet of K,L;
A2: Inf Sups Frege F = Sup Infs Frege Frege F by A1;
A3: dom K = J by PARTFUN1:def 2;
A4: doms Frege F = (product doms F) --> J by Th45;
A6: doms F = K by Th45;
    rng Infs Frege Frege F is_<=_than Sup Infs F
    proof
      reconsider J9 = product doms Frege F as non empty set;
      let a be Element of L;
      reconsider K9 = J9 --> product doms F as ManySortedSet of J9;
      reconsider G = Frege Frege F as DoubleIndexedSet of K9, L;
      assume a in rng Infs Frege Frege F;
      then consider g being Element of J9 such that
A8:   a = Inf (G.g) by WAYBEL_5:14;
      reconsider g9 = g as Function;
      deffunc XX(object) =
       {f.(g9.f) where f is Element of product doms F: g9.f = $1};
A9:   dom ((product doms F) --> J) = product doms F;
      now
        defpred P[object,object] means $2 in (K.$1) \ XX($1);
        assume
A10:    for j being Element of J holds (K.j) \ XX(j) <> {};
A11:    now
          let j be object;
          assume j in J;
          then reconsider i = j as Element of J;
          set k = the Element of (K.i)\XX(j);
          (K.i)\XX(i) <> {} by A10;
          then k in (K.i)\XX(i);
          hence ex k being object st P[j,k];
        end;
        consider h being Function such that
A12:    dom h = J & for j being object st j in J holds P[j,h.j] from
        CLASSES1:sch 1(A11);
        now
          let j be object;
          assume j in J;
          then h.j in (K.j) \ XX(j) by A12;
          hence h.j in (doms F).j by A6;
        end;
        then reconsider h as Element of product doms F by A6,A3,A12,CARD_3:9;
        g9.h in (doms Frege F).h by A4,A9,CARD_3:9;
        then reconsider j = g9.h as Element of J by A4;
        h.(g9.h) in XX(j) & h.j in (K.j) \ XX(j) by A12;
        hence contradiction by XBOOLE_0:def 5;
      end;
      then consider j being Element of J such that
A13:  (K.j) \ XX(j) = {};
A14:  rng (F.j) c= rng (G.g)
      proof
        let z be object;
        assume z in rng (F.j);
        then consider u being object such that
A15:    u in dom (F.j) and
A16:    z = (F.j).u by FUNCT_1:def 3;
        reconsider u as Element of K.j by A15;
        u in XX(j) by A13,XBOOLE_0:def 5;
        then consider f being Element of product doms F such that
A17:    u = f.(g9.f) and
A18:    g9.f = j;
A:      G.g = (Frege F)..g9 & (Frege F).f = F..f by PRALG_2:def 2;
        consider gg being Function such that
BB:     f = gg & dom gg = dom doms F &
        for y being object st y in dom doms F holds gg.y in (doms F).y
          by CARD_3:def 5;
A25:    dom F = J by PARTFUN1:def 2;
BC:     dom f = dom F by FUNCT_6:def 2,BB;
        j in dom F /\ dom f by A25,BC; then
        j in dom (F..f) by PRALG_1:def 19; then
WW:     (F..f).j = (F.j).(f.j) by PRALG_1:def 19;
A27:    dom Frege F = product doms F by PARTFUN1:def 2;
        consider gg1 being Function such that
BB:     g = gg1 & dom gg1 = dom doms Frege F &
        for y being object st y in dom doms Frege F holds
          gg1.y in (doms Frege F).y by CARD_3:def 5;
        f in dom Frege F by A27; then
        f in dom doms Frege F by FUNCT_6:def 2; then
        f in dom Frege F /\ dom g9 by A27,BB,XBOOLE_0:def 4; then
        f in dom ((Frege F)..g9) by PRALG_1:def 19;
        then (G.g).f = (F..f).j by A18,PRALG_1:def 19,A; then
A19:    (G.g).f = z by A16,A17,A18,WW;
        dom (G.g) = K9.g & K9.g = product doms F by FUNCT_2:def 1;
        hence thesis by A19,FUNCT_1:def 3;
      end;
      ex_inf_of rng (G.g), L & ex_inf_of rng (F.j),L by YELLOW_0:17;
      then inf rng (G.g) <= inf rng (F.j) by A14,YELLOW_0:35;
      then a <= inf rng (F.j) by A8,YELLOW_2:def 6;
      then
A20:  a <= Inf (F.j) by YELLOW_2:def 6;
      Inf (F.j) in rng Infs F by WAYBEL_5:14;
      then Inf (F.j) <= sup rng Infs F by YELLOW_2:22;
      then a <= sup rng Infs F by A20,ORDERS_2:3;
      hence thesis by YELLOW_2:def 5;
    end;
    then sup rng Infs Frege Frege F <= Sup Infs F by YELLOW_0:32;
    then
A21: Sup Infs Frege Frege F <= Sup Infs F by YELLOW_2:def 5;
    Sup Infs F <= Inf Sups Frege F by Th47;
    hence thesis by A2,A21,ORDERS_2:2;
  end;
  assume
A22: for J being non empty set, K being non-empty ManySortedSet of J for
  F being DoubleIndexedSet of K, L holds Sup Infs F = Inf Sups Frege F;
  thus L is complete;
  let J be non empty set, K be non-empty ManySortedSet of J;
  let F be DoubleIndexedSet of K,L;
A23: dom K = J by PARTFUN1:def 2;
A24: doms Frege F = (product doms F) --> J by Th45;
A25: dom F = J by PARTFUN1:def 2;
A26: doms F = K by Th45;
A27: dom Frege F = product doms F by PARTFUN1:def 2;
  rng Sups Frege Frege F is_>=_than Inf Sups F
  proof
    reconsider J9 = product doms Frege F as non empty set;
    let a be Element of L;
    reconsider K9 = J9 --> product doms F as ManySortedSet of J9;
    reconsider G = Frege Frege F as DoubleIndexedSet of K9, L;
    assume a in rng Sups Frege Frege F;
    then consider g being Element of J9 such that
A28: a = Sup (G.g) by WAYBEL_5:14;
    reconsider g9 = g as Function;
    deffunc XX(object) =
     {f.(g9.f) where f is Element of product doms F: g9.f = $1};
A29: dom ((product doms F) --> J) = product doms F;
    now
      defpred P[object,object] means $2 in (K.$1) \ XX($1);
      assume
A30:  for j being Element of J holds (K.j) \ XX(j) <> {};
A31:  now
        let j be object;
        assume j in J;
        then reconsider i = j as Element of J;
        set k = the Element of (K.i)\XX(j);
        (K.i)\XX(i) <> {} by A30;
        then k in (K.i)\XX(i);
        hence ex k being object st P[j,k];
      end;
      consider h being Function such that
A32:  dom h = J & for j being object st j in J holds P[j,h.j] from
      CLASSES1:sch 1(A31);
      now
        let j be object;
        assume j in J;
        then h.j in (K.j) \ XX(j) by A32;
        hence h.j in (doms F).j by A26;
      end;
      then reconsider h as Element of product doms F by A26,A23,A32,CARD_3:9;
      g9.h in (doms Frege F).h by A24,A29,CARD_3:9;
      then reconsider j = g9.h as Element of J by A24;
      h.(g9.h) in XX(j) & h.j in (K.j) \ XX(j) by A32;
      hence contradiction by XBOOLE_0:def 5;
    end;
    then consider j being Element of J such that
A33: (K.j) \ XX(j) = {};
A34: rng (F.j) c= rng (G.g)
    proof
      let z be object;
      assume z in rng (F.j);
      then consider u being object such that
A35:  u in dom (F.j) and
A36:  z = (F.j).u by FUNCT_1:def 3;
      reconsider u as Element of K.j by A35;
      u in XX(j) by A33,XBOOLE_0:def 5;
      then consider f being Element of product doms F such that
A37:  u = f.(g9.f) and
A38:  g9.f = j;
a37:  G.g = (Frege F)..g9 & (Frege F).f = F..f by PRALG_2:def 2;
      consider gg being Function such that
BB:   f = gg & dom gg = dom doms F &
      for y being object st y in dom doms F holds gg.y in (doms F).y
        by CARD_3:def 5;
      dom F = dom f by BB,FUNCT_6:def 2; then
      j in dom F /\ dom f by A25; then
Z1:   j in dom (F..f) by PRALG_1:def 19;
      consider gg1 being Function such that
BB:   g = gg1 & dom gg1 = dom doms Frege F &
      for y being object st y in dom doms Frege F holds
        gg1.y in (doms Frege F).y by CARD_3:def 5;
      f in dom Frege F by A27; then
      f in dom g9 by BB,FUNCT_6:def 2; then
      f in dom (Frege F) /\ dom g9 by A27,XBOOLE_0:def 4; then
a38:  f in dom ((Frege F)..g9) by PRALG_1:def 19;
      (G.g).f = ((Frege F).f).(g9.f) by a37,a38,PRALG_1:def 19; then
A39:  (G.g).f = z by Z1,A36,a37,A37,A38,PRALG_1:def 19;
      dom (G.g) = K9.g & K9.g = product doms F by FUNCT_2:def 1;
      hence thesis by A39,FUNCT_1:def 3;
    end;
    ex_sup_of rng (G.g), L & ex_sup_of rng (F.j),L by YELLOW_0:17;
    then sup rng (G.g) >= sup rng (F.j) by A34,YELLOW_0:34;
    then a >= sup rng (F.j) by A28,YELLOW_2:def 5;
    then
A40: a >= Sup (F.j) by YELLOW_2:def 5;
    Sup (F.j) in rng Sups F by WAYBEL_5:14;
    then Sup (F.j) >= inf rng Sups F by YELLOW_2:22;
    then a >= inf rng Sups F by A40,ORDERS_2:3;
    hence thesis by YELLOW_2:def 6;
  end;
  then inf rng Sups Frege Frege F >= Inf Sups F by YELLOW_0:33;
  then
A41: Inf Sups Frege Frege F >= Inf Sups F by YELLOW_2:def 6;
  Inf Sups F >= Sup Infs Frege F & Sup Infs Frege F = Inf Sups Frege
  Frege F by A22,WAYBEL_5:16;
  hence thesis by A41,ORDERS_2:2;
end;
