reserve
  a for natural Number,
  k,l,m,n,k1,b,c,i for Nat,
  x,y,z,y1,y2 for object,
  X,Y for set,
  f,g for Function;
reserve p,q,r,s,t for FinSequence;
reserve D for set;

theorem Th31:
  rng(p^q) = rng p \/ rng q
proof
  now
    let x be object;
    assume x in rng(p^q);
    then consider y being object such that
A1: y in dom(p^q) and
A2: x=(p^q).y by FUNCT_1:def 3;
A3: y in Seg(len p + len q) by A1,Def7;
    reconsider k=y as Element of NAT by A1;
A4: 1 <= k by A3,Th1;
A5: k <= len p + len q by A3,Th1;
A6: now
      assume
A7:   len p + 1 <= k;
      then
A8:   q.(k-len p) = x by A2,A5,Th23;
      consider m be Nat such that
A9:   (len p+1)+m = k by A7,NAT_1:10;
      len p +(1+m) = k by A9;
      then 1+0<=1+m & 1+m <= len q by A3,Th1,XREAL_1:6;
      then 1+m in Seg len q;
      then k-len p in dom q by A9,Def3;
      hence x in rng q by A8,FUNCT_1:def 3;
    end;
    now
      assume not len p + 1 <= k;
      then k <= len p by NAT_1:8;
      then k in Seg len p by A4;
      then
A10:  k in dom p by Def3;
      then p.k = x by A2,Def7;
      hence x in rng p by A10,FUNCT_1:def 3;
    end;
    hence x in rng p \/ rng q by A6,XBOOLE_0:def 3;
  end;
  then
A11: rng(p^q) c= rng p \/ rng q;
  rng p c= rng(p^q) & rng q c= rng(p^q) by Th29,Th30;
  hence thesis by A11,XBOOLE_1:8;
end;
