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

theorem Th1: :: Tarski:6
  X = bool Y iff for A holds A in X iff A c= Y
proof
  thus X = bool Y implies for A holds A in X iff A c= Y
  proof
    assume
A1: X = bool Y;
    let A;
    thus A in X implies A c= Y
    proof
      assume
A2:   A in X;
      let i be object;
      assume
A3:   i in I;
      then
A4:   A.i in X.i by A2;
      X.i = bool (Y.i) by A1,A3,Def1;
      hence thesis by A4;
    end;
    assume
A5: A c= Y;
    let i be object;
    assume
A6: i in I;
    then
A7: A.i c= Y.i by A5;
    X.i = bool (Y.i) by A1,A6,Def1;
    hence thesis by A7;
  end;
  assume
A8: for A holds A in X iff A c= Y;
  now
    let i be object such that
A9: i in I;
    EmptyMS I c= Y by PBOOLE:43;
    then
A10: EmptyMS I in X by A8;
    for A9 be set holds A9 in X.i iff A9 c= Y.i
    proof
      let A9 be set;
A11:  dom (i .--> A9) = {i};
      dom (EmptyMS I +* (i .--> A9)) = I by A9,Lm1;
      then reconsider K = EmptyMS I +* (i .--> A9) as ManySortedSet of I by
PARTFUN1:def 2,RELAT_1:def 18;
      i in {i} by TARSKI:def 1;
      then
A12:  K.i = (i .--> A9).i by A11,FUNCT_4:13
        .= A9 by FUNCOP_1:72;
      thus A9 in X.i implies A9 c= Y.i
      proof
        assume
A13:    A9 in X.i;
        K in X
        proof
          let j be object such that
A14:      j in I;
          now
            per cases;
            case
              j = i;
              hence thesis by A12,A13;
            end;
            case
              j <> i;
              then not j in dom (i .--> A9) by TARSKI:def 1;
              then K.j = EmptyMS I.j by FUNCT_4:11;
              hence thesis by A10,A14;
            end;
          end;
          hence thesis;
        end;
        then K c= Y by A8;
        hence thesis by A9,A12;
      end;
      assume
A15:  A9 c= Y.i;
      K c= Y
      proof
        let j be object such that
A16:    j in I;
        now
          per cases;
          case
            j = i;
            hence thesis by A12,A15;
          end;
          case
            j <> i;
            then not j in dom (i .--> A9) by TARSKI:def 1;
            then
A17:        K.j = EmptyMS I.j by FUNCT_4:11;
            EmptyMS I c= Y by PBOOLE:43;
            hence thesis by A16,A17;
          end;
        end;
        hence thesis;
      end;
      then K in X by A8;
      hence thesis by A9,A12;
    end;
    then X.i = bool (Y.i) by ZFMISC_1:def 1;
    hence X.i = (bool Y).i by A9,Def1;
  end;
  hence thesis;
end;
