reserve x,y,z for set;
reserve f,f1,f2,f3 for FinSequence,
  p,p1,p2,p3 for set,
  i,k for Nat;
reserve D for non empty set,
  p,p1,p2,p3 for Element of D,
  f,f1,f2 for FinSequence of D;
reserve D for non empty set;
reserve p, q for FinSequence,
  X, Y, x, y for set,
  D for non empty set,
  i, j, k, l, m, n, r for Nat;

theorem
  p<>{} & q<>{} & p.len p = q.1 implies rng (p^'q) = rng p \/ rng q
proof
  set r = p^'q;
  set qc = (2,len q)-cut q;
  assume that
A1: p<>{} and
A2: q<>{} and
A3: p.len p = q.1;
  0+1<=len q by A2,NAT_1:13;
  then
A4: 1+1<=len q +1 by XREAL_1:7;
  then len qc +(1+1) = len q + 1 by Lm2;
  then
A5: len qc +1+1 = len q + 1;
  now
    let x be object;
    hereby
      assume x in rng r;
      then x in rng p \/ rng qc by FINSEQ_1:31;
      then
A6:   x in rng p or x in rng qc by XBOOLE_0:def 3;
      rng qc c= rng q by Th11;
      hence x in rng p \/ rng q by A6,XBOOLE_0:def 3;
    end;
    assume x in rng p \/ rng q;
    then
A7: x in rng p or x in rng q by XBOOLE_0:def 3;
    assume not x in rng r;
    then
A8: not x in rng p \/ rng qc by FINSEQ_1:31;
    then consider y being object such that
A9: y in dom q and
A10: x=q.y by A7,FUNCT_1:def 3,XBOOLE_0:def 3;
A11: not x in rng p by A8,XBOOLE_0:def 3;
    reconsider y as Element of NAT by A9;
A12: 1<=y by A9,FINSEQ_3:25;
A13: y<=len q by A9,FINSEQ_3:25;
A14: not x in rng qc by A8,XBOOLE_0:def 3;
    per cases by A12,XXREAL_0:1;
    suppose
A15:  y=1;
      0+1<=len p by A1,NAT_1:13;
      then len p in dom p by FINSEQ_3:25;
      hence contradiction by A3,A11,A10,A15,FUNCT_1:def 3;
    end;
    suppose
      1<y;
      then 1+1<=y by NAT_1:13;
      then consider i such that
A16:  1<=i and
A17:  i<len q and
A18:  y=i+1 by A13,Th1;
A19:  i<=len qc by A5,A17,NAT_1:13;
      then
A20:  i in dom qc by A16,FINSEQ_3:25;
      0+1<=i by A16;
      then consider j such that
      0<=j and
A21:  j<len qc and
A22:  i=j+1 by A19,Th1;
      qc.(j+1) = q.(1+1+j) by A4,A21,Lm2
        .= q.y by A18,A22;
      hence contradiction by A14,A10,A22,A20,FUNCT_1:def 3;
    end;
  end;
  hence thesis by TARSKI:2;
end;
