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;

theorem
  Seg k = {x,y} & x <> y implies k = 2 & {x,y} = {1,2}
proof
  assume that
A1: Seg k = {x,y} and
A2: x <> y;
  now
    per cases;
    suppose
      k = 0;
      hence thesis by A1;
    end;
    suppose
A3:   k <> 0;
      now
        per cases;
        suppose
          k = 1;
          hence thesis by A1,A2,FINSEQ_1:2,ZFMISC_1:5;
        end;
        suppose
A4:       k <> 1;
          1 <= k by A3,NAT_1:14;
          then 1 < k by A4,XXREAL_0:1;
          then
A5:       1 + 1 <= k by NAT_1:13;
          then Seg 2 c= Seg k by FINSEQ_1:5;
          then
A6:       1 = x & 2 = x or 1 = x & 2 = y or 2 = x & 1 = y or 1 = y & 2 =
          y by A1,FINSEQ_1:2,ZFMISC_1:22;
          now
            k in Seg k by A1,Th7;
            then
A7:         k = 1 or k = 2 by A1,A6,TARSKI:def 2;
            assume not k <= 2;
            hence contradiction by A7;
          end;
          hence thesis by A1,A5,FINSEQ_1:2,XXREAL_0:1;
        end;
      end;
      hence thesis;
    end;
  end;
  hence thesis;
end;
