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 Th12:
  for s1,P,i st P = { p: s1>p/.i } & i in Seg n holds P is open
proof
  let s1,P,i such that
A1: P= { p:s1>p/.i } & i in Seg n;
  reconsider s1 as Real;
A2: the TopStruct of TOP-REAL n = TopSpaceMetr Euclid n by EUCLID:def 8;
  then reconsider PP=P as Subset of TopSpaceMetr Euclid n;
  for pe being Point of Euclid n st pe in P ex r be Real st r>0 &
  Ball(pe,r) c= P
  proof
    let pe be Point of Euclid n;
    assume pe in P;
    then consider p such that
A3: p=pe and
A4: s1>p/.i by A1;
    set r=(s1-p/.i)/2;
A5: s1-p/.i>0 by A4,XREAL_1:50;
    Ball(pe,r) c= P
    proof
      let x be object;
      assume x in Ball(pe,r);
      then x in {q where q is Element of Euclid n:dist(pe,q)<r} by METRIC_1:17;
      then consider q being Element of Euclid n such that
A6:   q=x and
A7:   dist(pe,q)<r;
      reconsider ppe=pe, pq=q as Point of TOP-REAL n by TOPREAL3:8;
      reconsider pen=ppe, pqn=pq as Element of REAL n;
      (Pitag_dist n).(q,pe)=dist(q,pe) by METRIC_1:def 1;
      then
A8:   |.pqn-pen.|<r by A7,EUCLID:def 6;
      reconsider q = pq-ppe as Element of REAL n by EUCLID:22;
      (pq-ppe)/.i <= |.q.| by A1,Th11;
      then (pq-ppe)/.i <= |.pqn-pen.|;
      then (pq-ppe)/.i <r by A8,XXREAL_0:2;
      then pq/.i-ppe/.i < r by A1,Th6;
      then
A9:   p/.i+(s1-p/.i)/2 > pq/.i by A3,XREAL_1:19;
      p/.i+(s1-p/.i)/2 =s1-r;
      then s1> p/.i+(s1-p/.i)/2 by A5,XREAL_1:44,139;
      then s1>pq/.i by A9,XXREAL_0:2;
      hence thesis by A1,A6;
    end;
    hence thesis by A5,XREAL_1:139;
  end;
  then PP is open by TOPMETR:15;
  hence thesis by A2,PRE_TOPC:30;
end;
