reserve i, x, I for set,
  A, M for ManySortedSet of I,
  f for Function,
  F for ManySortedFunction of I;
reserve P, R for MSSetOp of M,
  E, T for Element of bool M;
reserve S for 1-sorted;
reserve MS for many-sorted over S;

theorem Th33:
  for D being properly-upper-bound MSSubsetFamily of M ex J being
  MSSetOp of M st for X being Element of bool M for SF being non-empty
MSSubsetFamily of M st (for Y being ManySortedSet of I holds Y in SF iff Y in D
  & X c= Y) holds J..X = meet SF
proof
  let D be properly-upper-bound MSSubsetFamily of M;
  set G = bool M;
  defpred P[object,object,object] means
   ex D2 being set st D2 = $2 &
   for sf being Subset-Family of M.$3 for Fi being
  non empty set st Fi = D.$3 & sf = { z where z is Element of Fi : D2 c= z }
  holds $1 = Intersect sf;
A1: now
    consider K being ManySortedSet of I such that
A2: K in G by PBOOLE:134;
    let i be object such that
A3: i in I;
    reconsider b = (bool M).i as non empty set by A3;
    let x be object such that
A4: x in G.i;
    dom (K +* (i .--> x)) = I by A3,PZFMISC1:1;
    then reconsider X = K +* (i .--> x) as ManySortedSet of I by PARTFUN1:def 2
,RELAT_1:def 18;
A5: dom (i .--> x) = {i};
    i in {i} by TARSKI:def 1;
    then
A6: X.i = (i .--> x).i by A5,FUNCT_4:13
      .= x by FUNCOP_1:72;
A7: X is Element of bool M
    proof
      let s be object such that
A8:   s in I;
      per cases;
      suppose
        s = i;
        hence thesis by A4,A6;
      end;
      suppose
        s <> i;
        then not s in dom (i .--> x) by TARSKI:def 1;
        then X.s = K.s by FUNCT_4:11;
        hence thesis by A2,A8;
      end;
    end;
    then consider SF being non-empty MSSubsetFamily of M such that
A9: for Y being ManySortedSet of I holds Y in SF iff Y in D & X c= Y by Th31;
    reconsider sf = SF.i as Subset-Family of M.i by A3,MSSUBFAM:32;
    reconsider q = Intersect sf as Element of b by A3,MBOOLEAN:def 1;
    reconsider s = b --> q as Function of b, b;
     reconsider y = s.x as object;
    take y;
    Intersect sf in bool (M.i);
    then Intersect sf in b by A3,MBOOLEAN:def 1;
    hence y in G.i by A4,FUNCOP_1:7;
    thus P[y,x,i]
    proof
      reconsider Di = D.i as non empty set by A3;
A10:  SF.i = { z where z is Element of Di : X.i c= z } by A3,A7,A9,Th32;
      reconsider xx=x as set by TARSKI:1;
      take xx;
      thus xx = x;
      let sf1 be Subset-Family of M.i, Fi be non empty set;
      assume Fi = D.i & sf1 = { z where z is Element of Fi : xx c= z };
      hence thesis by A4,A6,A10,FUNCOP_1:7;
    end;
  end;
  consider J being ManySortedFunction of G, G such that
A11: for i be object st i in I
 ex f be Function of G.i, G.i st f = J.i &
  for x be object st x in G.i holds P[f.x,x,i] from MSSUBFAM:sch 1(A1);
  reconsider J as MSSetOp of M;
  take J;
  let X be Element of bool M, SF be non-empty MSSubsetFamily of M such that
A12: for Y being ManySortedSet of I holds Y in SF iff Y in D & X c= Y;
  now
    let i be object;
    assume
A13: i in I;
    then consider Q being Subset-Family of (M.i) such that
A14: Q = SF.i and
A15: (meet SF).i = Intersect Q by MSSUBFAM:def 1;
    reconsider Fi = D.i as non empty set by A13;
A16: Q = { z where z is Element of Fi : X.i c= z } by A12,A13,A14,Th32;
    X in G by MSSUBFAM:12;
    then
A17: X.i in G.i by A13;
    consider f being Function of G.i, G.i such that
A18: f = J.i and
A19: for x being object st x in G.i holds P[f.x,x,i] by A11,A13;
A20:  P[f.(X.i),X.i,i] by A19,A17;
    thus (J..X).i = f.(X.i) by A13,A18,PRALG_1:def 20
      .= (meet SF).i by A15,A16,A20;
  end;
  hence thesis;
end;
