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;

theorem Th101:
  rng(f/^1) c= rng Rotate(f,p)
proof
  per cases;
  suppose
A1: p in rng f;
    then Rotate(f,p) = (f:-p)^((f-:p)/^1) by Def2;
    then
A2: rng Rotate(f,p) = rng(f:-p) \/ rng((f-:p)/^1) by FINSEQ_1:31;
    thus thesis
    proof
      let x be object;
      assume
A3:   x in rng(f/^1);
A4:   rng(f/^1) c= rng f by FINSEQ_5:33;
      then
A5:   x in rng f by A3;
      per cases;
      suppose that
A6:     x..f < p..f and
A7:     x..(f/^1) >= p..(f/^1);
A8:     p..f >= 1 by A1,FINSEQ_4:21;
        p..f <> 1 by A3,A4,A6,FINSEQ_4:21;
        then p..f > 1 by A8,XXREAL_0:1;
        then p..f = p..(f/^1) + 1 by A1,Th56;
        then
A9:     x..(f/^1)+1 >= p..f by A7,XREAL_1:6;
        rng f c= D by FINSEQ_1:def 4;
        then reconsider q = x as Element of D by A5;
A10:    x..(f/^1) in dom(f/^1) by A3,FINSEQ_4:20;
        f <> {} by A1;
        then len f >= 1 by NAT_1:14;
        then len f - 1 = len(f/^1) by RFINSEQ:def 1;
        then
A11:    len f = len(f/^1) + 1;
        x..(f/^1) <= len(f/^1) by A3,FINSEQ_4:21;
        then
A12:    x..(f/^1)+1 <= len f by A11,XREAL_1:6;
        q = (f/^1)/.(q..(f/^1)) by A3,FINSEQ_5:38
          .= f/.(q..(f/^1)+1) by A10,FINSEQ_5:27;
        then x in rng(f:-p) by A1,A12,A9,Th63;
        hence thesis by A2,XBOOLE_0:def 3;
      end;
      suppose that
A13:    x..f < p..f and
A14:    x..(f/^1) <= p..(f/^1);
A15:    p..f <> 1 by A3,A4,A13,FINSEQ_4:21;
        p..f >= 1 by A1,FINSEQ_4:21;
        then p..f > 1 by A15,XXREAL_0:1;
        then p in rng(f/^1) by A1,Th57;
        then x in rng((f/^1)-:p) by A3,A14,FINSEQ_5:46;
        then x in rng((f-:p)/^1) by A1,A15,Th60;
        hence thesis by A2,XBOOLE_0:def 3;
      end;
      suppose
        x..f >= p..f;
        then x in rng(f:-p) by A1,A3,A4,Th62;
        hence thesis by A2,XBOOLE_0:def 3;
      end;
    end;
  end;
  suppose
    not p in rng f;
    then Rotate(f,p) = f by Def2;
    hence thesis by FINSEQ_5:33;
  end;
end;
