reserve x, y for object, I for set,
  A, B, X, Y for ManySortedSet of I;

theorem :: RLVECT_3:34
  for A be finite-yielding non-empty ManySortedSet of I st (for X, Y be
ManySortedSet of I st X in A & Y in A holds X c= Y or Y c= X) holds union A in
  A
proof
  let A be finite-yielding non-empty ManySortedSet of I such that
A1: for X, Y be ManySortedSet of I st X in A & Y in A holds X c= Y or Y c= X;
  let i be object;
  assume
A2: i in I;
  then i in dom A by PARTFUN1:def 2;
  then A.i in rng A by FUNCT_1:3;
  then
A3: A.i is finite by FINSET_1:def 2;
A4: for X9, Y9 be set st X9 in A.i & Y9 in A.i holds X9 c= Y9 or Y9 c= X9
  proof
    let X9, Y9 be set such that
A5: X9 in A.i and
A6: Y9 in A.i;
    consider M be ManySortedSet of I such that
A7: M in A by PBOOLE:134;
    dom (M +* (i .--> Y9)) = I & dom (M +* (i .--> X9)) = I by A2,Lm1;
    then reconsider
    K1 = M +* (i.-->X9), K2 = M +* (i.-->Y9) as ManySortedSet of I
    by PARTFUN1:def 2,RELAT_1:def 18;
    assume
A8: not X9 c= Y9;
A9: i in {i} by TARSKI:def 1;
 dom (i .--> Y9) = {i};
    then
A11: K2.i = (i .--> Y9).i by A9,FUNCT_4:13
      .= Y9 by FUNCOP_1:72;
A12: K2 in A
    proof
      let j be object such that
A13:  j in I;
        per cases;
        suppose
          j = i;
          hence thesis by A6,A11;
        end;
        suppose
          j <> i;
          then not j in dom (i .--> Y9) by TARSKI:def 1;
          then K2.j = M.j by FUNCT_4:11;
          hence thesis by A7,A13;
        end;
    end;
 dom (i .--> X9) = {i};
    then
A15: K1.i = (i .--> X9).i by A9,FUNCT_4:13
      .= X9 by FUNCOP_1:72;
    K1 in A
    proof
      let j be object such that
A16:  j in I;
        per cases;
        suppose
          j = i;
          hence thesis by A5,A15;
        end;
        suppose
          j <> i;
          then not j in dom (i .--> X9) by TARSKI:def 1;
          then K1.j = M.j by FUNCT_4:11;
          hence thesis by A7,A16;
        end;
    end;
    then K1 c= K2 or K2 c= K1 by A1,A12;
    hence thesis by A2,A8,A15,A11;
  end;
  A.i <> {} by A2,PBOOLE:def 13;
  then union (A.i) in A.i by A3,A4,CARD_2:62;
  hence thesis by A2,Def2;
end;
