reserve k,n,i,j for Nat;

theorem Th2:
  for f being FinSequence st f=<*1,2*> or f=<*2,1*> holds f is
  Permutation of Seg 2
proof
  let f be FinSequence;
  assume
A1: f=<*1,2*> or f=<*2,1*>;
  len (<*1,2*>)=2 & len (<*2,1*>)=2 by FINSEQ_1:44;
  then
A2: dom f =Seg 2 by A1,FINSEQ_1:def 3;
  rng f c= Seg 2
  proof
    let y be object;
    assume y in rng f;
    then ex x being object st x in dom f & y=f.x by FUNCT_1:def 3;
    then y=f.1 or y=f.2 by A2,FINSEQ_1:2,TARSKI:def 2;
    then y=1 or y=2 or (y=2 or y=1) by A1;
    hence thesis;
  end;
  then reconsider g=f as Function of Seg 2,Seg 2 by A2,FUNCT_2:2;
  now
    per cases by A1;
    case
A3:   f=<*1,2*>;
      for x1,x2 being object st x1 in dom f & x2 in dom f & f.x1=f.x2
holds x1=x2
      proof
        let x1,x2 be object;
        assume that
A4:     x1 in dom f & x2 in dom f and
A5:     f.x1=f.x2;
        now
          per cases by A2,A4,FINSEQ_1:2,TARSKI:def 2;
          case
            x1=1 & x2=1;
            hence thesis;
          end;
          case
A6:         x1=1 & x2=2;
            thus contradiction by A3,A5,A6;
          end;
          case
A7:         x1=2 & x2=1;
            thus contradiction by A3,A5,A7;
          end;
          case
            x1=2 & x2=2;
            hence thesis;
          end;
        end;
        hence thesis;
      end;
      then
A8:   f is one-to-one by FUNCT_1:def 4;
      now
        let x be object;
        assume x in rng f;
        then consider z being object such that
A9:     z in dom f and
A10:    f.z=x by FUNCT_1:def 3;
        len f=2 by A3,FINSEQ_1:44;
        then dom f=Seg 2 by FINSEQ_1:def 3;
        then z=1 or z=2 by A9,FINSEQ_1:2,TARSKI:def 2;
        then x =1 or x=2 by A3,A10;
        hence x in Seg 2;
      end;
      then
A11:  rng f c= Seg 2;
      Seg 2 c= rng f
      proof
        let z be object;
        assume z in Seg 2;
        then z=1 or z=2 by FINSEQ_1:2,TARSKI:def 2;
        then
A12:    z=f.1 or z=f.2 by A3;
        1 in dom f & 2 in dom f by A2;
        hence thesis by A12,FUNCT_1:def 3;
      end;
      then rng f = Seg 2 by A11;
      then g is onto by FUNCT_2:def 3;
      hence thesis by A8;
    end;
    case
A13:  f=<*2,1*>;
      for x1,x2 being object st x1 in dom f & x2 in dom f & f.x1=f.x2
      holds x1=x2
      proof
        let x1,x2 be object;
        assume that
A14:    x1 in dom f & x2 in dom f and
A15:    f.x1=f.x2;
        now
          per cases by A2,A14,FINSEQ_1:2,TARSKI:def 2;
          case
            x1=1 & x2=1;
            hence thesis;
          end;
          case
A16:        x1=1 & x2=2;
            thus contradiction by A13,A15,A16;
          end;
          case
A17:        x1=2 & x2=1;
            thus contradiction by A13,A15,A17;
          end;
          case
            x1=2 & x2=2;
            hence thesis;
          end;
        end;
        hence thesis;
      end;
      then
A18:  f is one-to-one by FUNCT_1:def 4;
      now
        let x be object;
        assume x in rng f;
        then consider z being object such that
A19:    z in dom f and
A20:    f.z=x by FUNCT_1:def 3;
        len f=2 by A13,FINSEQ_1:44;
        then dom f=Seg 2 by FINSEQ_1:def 3;
        then z=1 or z=2 by A19,FINSEQ_1:2,TARSKI:def 2;
        then x =2 or x=1 by A13,A20;
        hence x in Seg 2;
      end;
      then
A21:  rng f c= Seg 2;
      Seg 2 c= rng f
      proof
        let z be object;
        assume z in Seg 2;
        then z=1 or z=2 by FINSEQ_1:2,TARSKI:def 2;
        then
A22:    z=f.2 or z=f.1 by A13;
        2 in dom f & 1 in dom f by A2;
        hence thesis by A22,FUNCT_1:def 3;
      end;
      then rng f = Seg 2 by A21;
      then g is onto by FUNCT_2:def 3;
      hence thesis by A18;
    end;
  end;
  hence thesis;
end;
