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 Th31:
  for D being properly-upper-bound MSSubsetFamily of M
  for X being Element of bool M
  ex 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
proof
  let D be properly-upper-bound MSSubsetFamily of M, X be Element of bool M;
  defpred P[object,object] means
     ex D2 being set st D2 = $2 & X.$1 c= D2;
  consider SF being ManySortedSet of I such that
A1: for i being object st i in I
    for e being object holds e in SF.i iff e in D.i & P[i,e]
     from PBOOLE:sch 2;
A2: D c= bool M by PBOOLE:def 18;
  SF is ManySortedSubset of bool M
  proof
    let i be object;
    assume
A3: i in I;
    then D.i c= (bool M).i by A2; then
A4: D.i c= bool (M.i) by A3,MBOOLEAN:def 1;
    SF.i c= bool (M.i)
    proof
      let x be object;
      assume x in SF.i;
      then x in D.i by A1,A3;
      hence thesis by A4;
    end;
    hence SF.i c= (bool M).i by A3,MBOOLEAN:def 1;
  end;
  then reconsider SF as ManySortedSubset of bool M;
  reconsider SF as MSSubsetFamily of M;
  SF is non-empty
  proof
    let i be object such that
A5: i in I;
    M in D by MSSUBFAM:def 6;
    then
A6: M.i in D.i by A5;
    X in bool M by MSSUBFAM:12;
    then X c= M by MBOOLEAN:18;
    then X.i c= M.i by A5;
    hence thesis by A1,A5,A6;
  end;
  then reconsider SF as non-empty MSSubsetFamily of M;
  take SF;
  let Y be ManySortedSet of I;
  thus Y in SF implies Y in D & X c= Y
  proof
    assume
A7: Y in SF;
    thus Y in D
    proof
      let i be object;
      assume
A8:   i in I;
      then Y.i in SF.i by A7;
      hence thesis by A1,A8;
    end;
    thus X c= Y
    proof
      let i be object;
      assume
A9:   i in I;
      then Y.i in SF.i by A7;
      then Y.i in D.i & P[i,Y.i] by A1,A9;
      hence thesis;
    end;
  end;
  assume
A10: Y in D & X c= Y;
  let i be object;
  assume
A11: i in I;
  then Y.i in D.i & X.i c= Y.i by A10;
  hence thesis by A1,A11;
end;
