reserve x,x1,x2,y,z,z1 for set;
reserve s1,r,r1,r2 for Real;
reserve s,w1,w2 for Real;
reserve n,i for Element of NAT;
reserve X for non empty TopSpace;
reserve p,p1,p2,p3 for Point of TOP-REAL n;
reserve P for Subset of TOP-REAL n;

theorem
  for f being Function of TOP-REAL 1,R^1 st (for p being Element of
  TOP-REAL 1 holds f.p=p/.1) holds f is being_homeomorphism
proof
  let f be Function of TOP-REAL 1,R^1;
  assume
A1: for p being Element of TOP-REAL 1 holds f.p=p/.1;
A2: dom f=the carrier of TOP-REAL 1 by FUNCT_2:def 1;
  REAL c= rng f
  proof
    let x be object;
    assume x in REAL;
    then reconsider r=x as Element of REAL;
A3: 1<=len <*r*> by FINSEQ_1:40;
    f.(|[r]|)=|[r]|/.1 by A1
      .=<*r*>.1 by A3,FINSEQ_4:15
      .=x;
    hence thesis by A2,FUNCT_1:def 3;
  end;
  then
A4: [#](TOP-REAL 1) = the carrier of TOP-REAL 1 & rng f=[#](R^1) by TOPMETR:17
,XBOOLE_0:def 10;
A5: the TopStruct of TOP-REAL 1 =TopSpaceMetr Euclid 1 by EUCLID:def 8;
  then reconsider ff = f/" as Function of R^1,TopSpaceMetr Euclid 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
A6: x1 in dom f & x2 in dom f and
A7: f.x1 = f.x2;
    reconsider p1=x1, p2=x2 as Element of TOP-REAL 1 by A6;
    consider r1 be Real such that
A8: p1=<*r1*> by Th20;
A9: 1<=len <*r1*> by FINSEQ_1:40;
    reconsider r1 as Element of REAL by XREAL_0:def 1;
    consider r2 being Real such that
A10: p2=<*r2*> by Th20;
A11: 1<=len <*r2*> by FINSEQ_1:40;
    reconsider r2 as Element of REAL by XREAL_0:def 1;
A12: f.p2=p2/.1 by A1
      .=<*r2*>.1 by A10,A11,FINSEQ_4:15
      .=r2;
    f.(p1)=p1/.1 by A1
      .=<*r1*>.1 by A8,A9,FINSEQ_4:15
      .=r1;
    hence thesis by A7,A8,A10,A12;
  end;
  then
A13: f is one-to-one by FUNCT_1:def 4;
A14: f/" is continuous
  proof
    the TopStruct of TOP-REAL 1 =TopSpaceMetr(Euclid 1) by EUCLID:def 8;
    then reconsider g=f/" as Function of R^1,TopSpaceMetr(Euclid 1);
    reconsider g1=g as Function of the carrier of R^1, the carrier of TOP-REAL
    1;
    the carrier of R^1 c= rng f
    proof
      let z1 be object;
      assume z1 in the carrier of R^1;
      then reconsider r1=z1 as Element of REAL by TOPMETR:17;
      <*r1*> in REAL 1 by FINSEQ_2:98;
      then reconsider q=<*r1*> as Element of TOP-REAL 1 by EUCLID:22;
      f.q=q/.1 by A1
        .=z1 by FINSEQ_4:16;
      hence thesis by A2,FUNCT_1:def 3;
    end;
    then
A15: rng f= the carrier of R^1 by XBOOLE_0:def 10;
    for r being Real,u being Element of Euclid 1,P
    being Subset of the carrier of TopSpaceMetr(Euclid 1) st r>0 & P=Ball(u,r)
    holds g"P is open
    proof
      reconsider f1=f as Function of the carrier of TOP-REAL 1,the carrier of
      R^1;
      let r be Real,u be Element of Euclid 1,P be Subset
      of the carrier of TopSpaceMetr(Euclid 1);
      assume that
      r>0 and
A16:  P=Ball(u,r);
      u is Tuple of 1,REAL by FINSEQ_2:131;
      then consider s1 be Element of REAL such that
A17:  u=<*s1*> by FINSEQ_2:97;
      dom f1=the carrier of TOP-REAL 1 by FUNCT_2:def 1;
      then
A18:  dom f1=REAL 1 by EUCLID:22;
A19:  Ball(u,r)={<*s*>:s1-r<s & s<s1+r} by A17,Th27;
A20:  f1.:(Ball(u,r))={w1:s1-r<w1 & w1<s1+r}
      proof
A21:    f1.:(Ball(u,r))c={w1:s1-r<w1 & w1<s1+r}
        proof
          let z be object;
          assume z in f1.:(Ball(u,r));
          then consider x1 being object such that
          x1 in dom f1 and
A22:      x1 in Ball(u,r) and
A23:      z=f1.x1 by FUNCT_1:def 6;
          consider s such that
A24:      <*s*>=x1 and
A25:      s1-r<s & s<s1+r by A19,A22;
          reconsider ss=s as Element of REAL by XREAL_0:def 1;
          <*ss*> in REAL 1 by FINSEQ_2:98;
          then reconsider q=<*s*> as Element of TOP-REAL 1 by EUCLID:22;
A26:      len <*s*>=1 by FINSEQ_1:40;
          z=q/.1 by A1,A23,A24
            .=<*ss*>.1 by A26,FINSEQ_4:15
            .=s;
          hence thesis by A25;
        end;
        {w1:s1-r<w1 & w1<s1+r} c= f1.:(Ball(u,r))
        proof
          let z be object;
          assume z in {w1:s1-r<w1 & w1<s1+r};
          then consider r1 be Real such that
A27:      z=r1 and
A28:      s1-r<r1 & r1<s1+r;
          reconsider rr=r1 as Element of REAL by XREAL_0:def 1;
          <*rr*> in REAL 1 by FINSEQ_2:98;
          then reconsider q=<*rr*> as Element of TOP-REAL 1 by EUCLID:22;
          Ball(u,r)={<*s*>:s1-r<s & s<s1+r} by A17,Th27;
          then
A29:      <*r1*> in Ball(u,r) by A28;
          z = q/.1 by A27,FINSEQ_4:16
            .=f1.<*r1*> by A1;
          hence thesis by A18,A29,FUNCT_1:def 6;
        end;
        hence thesis by A21,XBOOLE_0:def 10;
      end;
      f1 is onto by A15,FUNCT_2:def 3;
      then g1=(f1 qua Function)" by A13,TOPS_2:def 4;
      then g1"(Ball(u,r))={w1:s1-r<w1 & w1<s1+r} by A13,A20,FUNCT_1:84;
      hence thesis by A16,Th26;
    end;
    then ff is continuous by Th16;
    hence f/" is continuous by A5,PRE_TOPC:33;
  end;
  1 in Seg 1 by FINSEQ_1:1;
  then f is continuous by A1,Th18;
  hence thesis by A2,A4,A13,A14,TOPS_2:def 5;
end;
