reserve Y,Z for non empty set;
reserve PA,PB for a_partition of Y;
reserve A,B for Subset of Y;
reserve i,j,k for Nat;
reserve x,y,z,x1,x2,y1,z0,X,V,a,b,d,t,SFX,SFY for set;

theorem Th22:
  for R1,R2 being Equivalence_Relation of Y,f being FinSequence of Y,
  x,y being set st x in Y &
  f.1=x & f.len f=y & 1 <= len f &
  (for i st 1<=i & i<len f
  ex u being set st u in Y & [f.i,u] in (R1 \/ R2) & [u,f.(i+1)] in (R1 \/
  R2)) holds [x,y] in (R1 "\/" R2)
proof
  let R1,R2 be Equivalence_Relation of Y,f be FinSequence of Y, x,y be set;
  assume that
A1: x in Y and
A2: f.1=x and
A3: f.len f=y & 1 <= len f and
A4: for i st 1<=i & i<len f ex u being set st u in Y & [f.i,u] in R1 \/
  R2 & [u,f.(i+1)] in R1 \/ R2;
 for i st 1 <= i & i <= len f holds [f.1,f.i] in (R1 "\/" R2)
  proof
    defpred P[Nat] means
    1<=$1 & $1<=len f implies [f.1,f.$1] in R1 "\/" R2;
A5: P[0];
A6: for i st P[i] holds P[i+1]
    proof
      let i;
      assume
A7:   P[i];
      assume that
A8:   1 <= i + 1 and
A9:  i + 1 <= len f;
A10:  i < len f by A9,NAT_1:13;
A11:  1 <= i or 1 = i + 1 by A8,NAT_1:8;
A12:  R1 \/ R2 c= R1 "\/" R2 by EQREL_1:def 2;
  now per cases by A11;
        suppose
A13:      1 <= i;
          then consider u being set such that
A14:      u in Y and
A15:      [f.i,u] in R1 \/ R2 & [u,f.(i+1)] in R1 \/ R2 by A4,A10;
          reconsider u as Element of Y by A14;
A16:      dom f = Seg len f by FINSEQ_1:def 3;
then       i in dom f by A10,A13,FINSEQ_1:1;
          then reconsider f1=f.i as Element of Y by FINSEQ_2:11;
      (i+1) in dom f by A8,A9,A16,FINSEQ_1:1;
          then reconsider f2=f.(i+1) as Element of Y by FINSEQ_2:11;
          reconsider p = <*f1,u,f2*> as FinSequence of Y;
A17:      len p = 3 by FINSEQ_1:45;
A18:      p.1 = f.i & p.3 = f.(i+1) by FINSEQ_1:45;
      for j st 1 <= j & j < len p holds [p.j,p.(j+1)] in (R1 \/ R2)
          proof
            let j;
            assume that
A19:        1 <= j and
A20:        j < len p;
        j < 2+1 by A20,FINSEQ_1:45;
then         j <= 2 by NAT_1:13;
then         j = 0 or ... or j = 2 by NAT_1:60;
            hence thesis by A15,A18,A19,FINSEQ_1:45;
          end;
then       [f.i,f.(i+1)] in R1 "\/" R2 by A17,A18,EQREL_1:28;
          hence thesis by A7,A9,A13,EQREL_1:7,NAT_1:13;
        end;
        suppose
A21:      0 = i;
          [f.1,f.1] in R1 by A1,A2,EQREL_1:5;
then      [f.1,f.1] in R1 \/ R2 by XBOOLE_0:def 3;
          hence thesis by A12,A21;
        end;
      end;
      hence thesis;
    end;
    thus P[i] from NAT_1:sch 2(A5,A6);
  end;
  hence thesis by A2,A3;
end;
