reserve p,q,r for FinSequence;
reserve u,v,x,y,y1,y2,z for object, A,D,X,Y for set;
reserve i,j,k,l,m,n for Nat;
reserve J for Nat;
reserve n for Nat;
reserve x,y,y1,y2,z,a,b for object, X,Y,Z,V1,V2 for set,
  f,g,h,h9,f1,f2 for Function,
  i for Nat,
  P for Permutation of X,
  D,D1,D2,D3 for non empty set,
  d1 for Element of D1,
  d2 for Element of D2,
  d3 for Element of D3;

theorem
  for f being FinSequence st rng f={x,y} & len f=2 holds
  f.1=x & f.2=y or f.1=y & f.2=x
proof
  let f be FinSequence;
  assume that
A1: rng f={x,y} and
A2: len f=2;
  2 in dom f by A2,Th25;
  then
A3: f.2 in rng f by FUNCT_1:def 3;
A4: now
    x in rng f by A1,TARSKI:def 2;
    then consider z being object such that
A5: z in dom f and
A6: x=f.z by FUNCT_1:def 3;
    reconsider nz=z as Element of NAT by A5;
A7: 1<=nz & nz<=len f by A5,Th25;
    assume that
A8: f.1=y and
A9: f.2=y;
    per cases by A2,A7,NAT_1:9;
    suppose
      nz=1;
      hence f.1=x & f.2=y by A9,A6;
    end;
    suppose
      nz=1+1;
      hence f.1=x & f.2=y by A8,A9,A6;
    end;
  end;
A10: now
    y in rng f by A1,TARSKI:def 2;
    then consider z being object such that
A11: z in dom f and
A12: y=f.z by FUNCT_1:def 3;
    reconsider nz=z as Element of NAT by A11;
A13: 1<=nz & nz<=len f by A11,Th25;
    assume that
A14: f.1=x and
A15: f.2=x;
    per cases by A2,A13,NAT_1:9;
    suppose
      nz=1;
      hence f.1=x & f.2=y by A14,A15,A12;
    end;
    suppose
      nz=1+1;
      hence f.1=x & f.2=y by A14,A12;
    end;
  end;
  1 in dom f by A2,Th25;
  then f.1 in rng f by FUNCT_1:def 3;
  hence thesis by A1,A3,A10,A4,TARSKI:def 2;
end;
