reserve n,m,i,j,k for Nat,
  x,y,e,X,V,U for set,
  W,f,g for Function;
reserve p,q for FinSequence;

theorem Th4:
  (for n,m st 1<=n & n<m & m<=len p holds p.n <> p.m) iff p is one-to-one
proof
  hereby
    assume
A1: for n,m st 1<=n & n<m & m<=len p holds p.n <> p.m;
    thus p is one-to-one
    proof
      let x1,x2 be object;
      assume that
A2:   x1 in dom p & x2 in dom p and
A3:   p.x1 = p.x2;
      reconsider n=x1, m=x2 as Element of NAT by A2;
A4:   n <= len p & 1 <= m by A2,FINSEQ_3:25;
A5:   1 <= n & m <= len p by A2,FINSEQ_3:25;
      assume
A6:   x1 <> x2;
      per cases;
      suppose
        m <= n;
        then m < n by A6,XXREAL_0:1;
        hence contradiction by A1,A3,A4;
      end;
      suppose
        m > n;
        hence contradiction by A1,A3,A5;
      end;
    end;
  end;
  assume
A7: p is one-to-one;
  let n,m;
  assume that
A8: 1<=n and
A9: n<m and
A10: m<=len p;
  n <= len p by A9,A10,XXREAL_0:2;
  then
A11: n in dom p by A8,FINSEQ_3:25;
  1 <= m by A8,A9,XXREAL_0:2;
  then
A12: m in dom p by A10,FINSEQ_3:25;
  assume p.n = p.m;
  hence contradiction by A7,A9,A11,A12;
end;
