
theorem lemma104:
for X being set, S being with_empty_element semi-diff-closed cap-closed
  Subset-Family of X, A,B being set
  st A in S & B in DisUnion S
holds B \ A in DisUnion S
proof
   let X be set, S be with_empty_element semi-diff-closed cap-closed
      Subset-Family of X, A,B be set;
   assume that
A2: A in S & B in DisUnion S;
   reconsider A1=A as Subset of X by A2;
   consider B1 be Subset of X such that
A5: B = B1 &
    ex F be disjoint_valued FinSequence of S st B1 = Union F by A2;
   consider g1 be disjoint_valued FinSequence of S such that
A6: B1 = Union g1 by A5;
   reconsider R1=DisUnion S as non empty set;
   defpred P[Nat,object] means $2 = g1.$1 \ A1;
A7:for k being Nat st k in Seg len g1
    ex x being Element of R1 st P[k,x]
   proof
    let k be Nat;
    assume k in Seg len g1; then
    k in dom g1 by FINSEQ_1:def 3; then
    g1.k in rng g1 & rng g1 c= S by FUNCT_1:3; then
    g1.k \ A1 in DisUnion S by A2,lemma103;
    hence ex x being Element of R1 st P[k,x];
   end;
   consider g2 be FinSequence of R1 such that
A8: dom g2 = Seg len g1 &
    for k being Nat st k in Seg len g1 holds P[k,g2.k] from FINSEQ_1:sch 5(A7);
A11:for n,m being Nat st
     n in dom g2 & m in dom g2 & n <> m holds g2.n misses g2.m
   proof
    let n,m be Nat;
    assume A9: n in dom g2 & m in dom g2 & n <> m; then
A10:g2.n = g1.n \ A1 & g2.m = g1.m \ A1 by A8;
    g1.n misses g2.m by A10,A9,PROB_2:def 2,XBOOLE_1:80;
    hence g2.n misses g2.m by A10,XBOOLE_1:80;
   end;
   set R = DisUnion S;
   defpred P2[Nat] means union rng (g2|$1) in R;
   union rng(g2|0) in S & S c= R by lemma100,SETFAM_1:def 8,ZFMISC_1:2; then
A12: P2[0];
A13:for k being Nat st P2[k] holds P2[k+1]
   proof
    let k be Nat;
    assume A14: P2[k];
    per cases;
    suppose A15: k+1 <= len g2; then
A20: k <= len g2 & k <= k+1 by NAT_1:13; then
     len(g2|(k+1)) = k+1 & g2|k = (g2|(k+1))|k by A15,FINSEQ_1:59,82; then
     g2|(k+1) = g2|k ^ <*(g2|(k+1)).(k+1) *> by FINSEQ_3:55; then
     rng(g2|(k+1)) = rng(g2|k) \/ rng <*(g2|(k+1)).(k+1)*> by FINSEQ_1:31
      .= rng(g2|k) \/ { (g2|(k+1)).(k+1) } by FINSEQ_1:38
      .= rng(g2|k) \/ { g2.(k+1) } by FINSEQ_3:112; then
A16: union rng(g2|(k+1)) = union rng(g2|k) \/ union { g2.(k+1) } by ZFMISC_1:78
      .= union rng(g2|k) \/ g2.(k+1);
A24: k+1 in dom g2 by A15,FINSEQ_3:25,NAT_1:11;
A25: now assume union rng(g2|k) meets g2.(k+1); then
      consider x be object such that
A17:   x in union rng(g2|k) & x in g2.(k+1) by XBOOLE_0:3;
      consider Z be set such that
A18:   x in Z & Z in rng(g2|k) by A17,TARSKI:def 4;
      consider i be object such that
A19:   i in dom(g2|k) & Z = (g2|k).i by A18,FUNCT_1:def 3;
      reconsider i as Nat by A19;
      i <= len (g2|k) by A19,FINSEQ_3:25; then
A21:  i <= k by A20,FINSEQ_1:59; then
A22:  Z = g2.i by A19,FINSEQ_3:112;
A23:  dom(g2|k) c= dom g2 by RELAT_1:60;
      i <> k+1 by A21,NAT_1:13; then
      Z misses g2.(k+1) by A11,A22,A23,A19,A24;
      hence contradiction by A17,A18,XBOOLE_0:def 4;
     end;
     g2.(k+1) in rng g2 & rng g2 c= R by A24,FUNCT_1:3;
     hence union rng(g2|(k+1)) in R by A14,A16,A25,lemma102;
    end;
    suppose k+1 > len g2; then
     g2|(k+1) = g2 & g2|k = g2 by FINSEQ_1:58,NAT_1:13;
     hence union rng(g2|(k+1)) in R by A14;
    end;
   end;
   for k being Nat holds P2[k] from NAT_1:sch 2(A12,A13); then
C1:P2[len g2];
   now let x be object;
    assume x in union rng g2; then
    consider y be set such that
B1:  x in y & y in rng g2 by TARSKI:def 4;
    consider k be object such that
B2:  k in dom g2 & y = g2.k by B1,FUNCT_1:def 3;
    reconsider k as Nat by B2;
C3: g2.k = g1.k \ A1 by B2,A8; then
B3: x in g1.k & not x in A1 by B1,B2,XBOOLE_0:def 5;
    k in dom g1 by B2,A8,FINSEQ_1:def 3; then
    g1.k in rng g1 by FUNCT_1:3; then
    x in union rng g1 by C3,B1,B2,TARSKI:def 4;
    hence x in union rng g1 \ A1 by B3,XBOOLE_0:def 5;
   end; then
B4:union rng g2 c= union rng g1 \ A1;
   now let x be object;
    assume C5: x in union rng g1 \ A1; then
B5: x in union rng g1 & not x in A1 by XBOOLE_0:def 5;
    consider y be set such that
B6:  x in y & y in rng g1 by C5,TARSKI:def 4;
    consider k be object such that
B7:  k in dom g1 & y = g1.k by B6,FUNCT_1:def 3;
    reconsider k as Nat by B7;
B8: k in dom g2 by B7,A8,FINSEQ_1:def 3; then
    g2.k = g1.k \ A1 by A8; then
    x in g2.k & g2.k in rng g2 by B5,B6,B7,B8,XBOOLE_0:def 5,FUNCT_1:3;
    hence x in union rng g2 by TARSKI:def 4;
   end; then
   union rng g1 \ A1 c= union rng g2; then
   union rng g1 \ A1 = union rng g2 by B4;
   hence B \ A in R by A5,A6,C1,FINSEQ_1:58;
end;
