reserve n,m,k,k1,k2,i,j for Nat;
reserve x,y,z for object,X,Y,Z for set;
reserve A for Subset of X;
reserve B,A1,A2,A3 for SetSequence of X;
reserve Si for SigmaField of X;
reserve S,S1,S2,S3 for SetSequence of Si;

theorem Th16:
  for X being set, B being SetSequence of X for f being Function
  st dom f = NAT & for n holds f.n = union {B.k: n <= k} holds
  f is sequence of bool X
proof
  let X be set, B be SetSequence of X;
  let f be Function such that
A1: dom f = NAT and
A2: for n holds f.n = union {B.k: n <= k};
  rng f c= bool X
  proof
    let z be object;
    assume z in rng f;
    then consider x being object such that
A3: x in dom f and
A4: z = f.x by FUNCT_1:def 3;
    reconsider n = x as Nat by A1,A3;
    set Y = {B.k: n <= k};
    set y = union Y;
    now
      let z be object;
      assume z in y;
      then ex Z st z in Z & Z in Y by TARSKI:def 4;
      then consider Z1 be set such that
A5:   Z1 in Y and
A6:   z in Z1;
      consider k1 such that
A7:     Z1 = B.k1 & n <= k1 by A5;
       reconsider k1 as Element of NAT by ORDINAL1:def 12;
       Z1 = B.k1 by A7;
      hence z in X by A6;
    end;
    then
A8: y is Subset of X by TARSKI:def 3;
    z = y by A2,A4;
    hence thesis by A8;
  end;
  hence thesis by A1,FUNCT_2:2;
end;
