
theorem lemma105:
for X being set, S being with_empty_element semi-diff-closed cap-closed
  Subset-Family of X, A,B,R being set
  st R = DisUnion S & A in R & B in R & A <> {}
holds B \ A in R
proof
   let X be set, S be with_empty_element semi-diff-closed cap-closed
     Subset-Family of X, A,B,R be set;
   assume that
A1: R = DisUnion S and
A2: A in R & B in R & A <> {};
   consider A1 be Subset of X such that
A3: A = A1 &
    ex F be disjoint_valued FinSequence of S st A1 = Union F by A1,A2;
   consider f1 be disjoint_valued FinSequence of S such that
A4: A1 = Union f1 by A3;
   consider B1 be Subset of X such that
A5: B = B1 &
    ex F be disjoint_valued FinSequence of S st B1 = Union F by A1,A2;
   reconsider R1=R as non empty set by A2;
   defpred P[Nat,object] means $2 = B1 \ f1.$1;
A7:for k being Nat st k in Seg len f1
    ex x being Element of R1 st P[k,x]
   proof
    let k be Nat;
    assume k in Seg len f1; then
    k in dom f1 by FINSEQ_1:def 3; then
    f1.k in rng f1 & rng f1 c= S by FUNCT_1:3; then
    B1 \ f1.k in R1 by A1,A2,A5,lemma104;
    hence thesis;
   end;
   consider F be FinSequence of R1 such that
A8: dom F = Seg len f1 &
    for k being Nat st k in Seg len f1 holds P[k,F.k] from FINSEQ_1:sch 5(A7);
   now let x be object;
    assume C9: x in B \ A; then
    x in B & not x in A by XBOOLE_0:def 5; then
A10:for Y being set holds not x in Y or not Y in rng f1 by A3,A4,TARSKI:def 4;
B1: for k being Nat st k in Seg len f1 holds x in F.k
    proof
     let k be Nat;
     assume B2: k in Seg len f1; then
B3:  F.k = B1 \ f1.k by A8;
     k in dom f1 by B2,FINSEQ_1:def 3; then
     not x in f1.k by A10,FUNCT_1:3;
     hence thesis by A5,C9,B3,XBOOLE_0:def 5;
    end;
    dom f1 <> {} by A2,A3,A4,ZFMISC_1:2,RELAT_1:42; then
    consider k be object such that
B4:  k in dom f1 by XBOOLE_0:def 1;
    reconsider k as Nat by B4;
    k in Seg len f1 by B4,FINSEQ_1:def 3; then
B5: rng F <> {} by A8,FUNCT_1:3;
    now let Y be set;
     assume Y in rng F; then
     consider k be object such that
B6:   k in dom F & Y = F.k by FUNCT_1:def 3;
     reconsider k as Nat by B6;
     thus x in Y by A8,B6,B1;
    end;
    hence x in meet rng F by B5,SETFAM_1:def 1;
   end; then
B7:B \ A c= meet rng F;
   now let x be object;
    assume B8: x in meet rng F; then
    consider Y be object such that
B10: Y in rng F by SETFAM_1:1,XBOOLE_0:def 1;
    consider k be object such that
B11: k in dom F & Y = F.k by B10,FUNCT_1:def 3;
    reconsider k as Nat by B11;
    x in F.k by B8,B10,B11,SETFAM_1:def 1; then
    x in B1 \ f1.k by A8,B11; then
B12:x in B1 & not x in f1.k by XBOOLE_0:def 5;
    now assume x in union rng f1; then
     consider Y be set such that
B13:  x in Y & Y in rng f1 by TARSKI:def 4;
     consider k be object such that
B14:  k in dom f1 & Y = f1.k by B13,FUNCT_1:def 3;
     reconsider k as Nat by B14;
B15: k in dom F by B14,A8,FINSEQ_1:def 3; then
     F.k in rng F by FUNCT_1:3; then
     x in F.k by B8,SETFAM_1:def 1; then
     x in B1 \ f1.k by B15,A8;
     hence contradiction by B13,B14,XBOOLE_0:def 5;
    end;
    hence x in B \ A by A3,A4,A5,B12,XBOOLE_0:def 5;
   end; then
   meet rng F c= B \ A; then
B16:B \ A = meet rng F by B7;
   defpred P[Nat] means meet rng(F|$1) in R;
   meet rng(F|0) in S & S c= R by A1,lemma100,SETFAM_1:def 8,1; then
C1:P[0];
C2:for k being Nat st P[k] holds P[k+1]
   proof
    let k be Nat;
    assume C3: P[k];
    per cases;
    suppose C4: k+1 <= len F;
     F|k = (F|(k+1))|k by FINSEQ_1:82,NAT_1:11; then
     F|(k+1) = F|k ^ <*(F|(k+1)).(k+1)*> by C4,FINSEQ_1:59,FINSEQ_3:55; then
C6:  rng (F|(k+1)) = rng (F|k) \/ rng <*(F|(k+1)).(k+1)*> by FINSEQ_1:31
      .= rng (F|k) \/ { (F|(k+1)).(k+1) } by FINSEQ_1:38
      .= rng (F|k) \/ { F.(k+1) } by FINSEQ_3:112;
     k+1 in dom F by C4,FINSEQ_3:25,NAT_1:11; then
C9:  F.(k+1) in rng F & rng F c= R1 by FUNCT_1:3; then
C7:  F.(k+1) in R;
     per cases;
     suppose rng(F|k) <> {}; then
C8:   meet rng(F|(k+1)) = meet rng (F|k) /\ meet { F.(k+1) } by C6,SETFAM_1:9
       .= meet rng (F|k) /\ F.(k+1) by SETFAM_1:10;
      R is cap-closed by A1,lemma101;
      hence meet rng (F|(k+1)) in R by C3,C9,C8;
     end;
     suppose rng(F|k) = {};
      hence meet rng (F|(k+1)) in R by C6,C7,SETFAM_1:10;
     end;
    end;
    suppose k+1 > len F; then
     F|k = F & F|(k+1) = F by FINSEQ_1:58,NAT_1:13;
     hence meet rng (F|(k+1)) in R by C3;
    end;
   end;
   for k being Nat holds P[k] from NAT_1:sch 2(C1,C2); then
   P[len F];
   hence B \ A in R by B16,FINSEQ_1:58;
end;
