reserve n,n1,m,k for Nat;
reserve x,y for set;
reserve s,g,g1,g2,r,p,p2,q,t for Real;
reserve s1,s2,s3 for Real_Sequence;
reserve Nseq for increasing sequence of NAT;
reserve X for Subset of REAL;

theorem
  r in ].p,g.[ iff |.p+g-2*r.|<g-p
proof
  thus r in ].p,g.[ implies |.p+g-2*r.|<g-p
  proof
    assume r in ].p,g.[;
    then
A1: ex s st s=r & p<s & s<g;
    then 2*r<2*g by XREAL_1:68;
    then -2*r>-2*g by XREAL_1:24;
    then (p+g)+-2*r>(p+g)+-2*g by XREAL_1:6;
    then
A2: p+g-2*r>-(g-p);
    2*p<2*r by A1,XREAL_1:68;
    then -2*p>-2*r by XREAL_1:24;
    then (p+g)+-2*p>(p+g)+-2*r by XREAL_1:6;
    hence thesis by A2,SEQ_2:1;
  end;
  assume
A3: |.p+g-2*r.|<g-p;
  then p+g-2*r>-(g-p) by SEQ_2:1;
  then p+g>p-g+2*r by XREAL_1:20;
  then p+g-(p-g)>2*r by XREAL_1:20;
  then
A4: 1/2*(2*g)>1/2*(2*r) by XREAL_1:68;
  g-p>p+g-2*r by A3,SEQ_2:1;
  then 2*r+(g-p)>p+g by XREAL_1:19;
  then 2*r>p+g-(g-p) by XREAL_1:19;
  then 1 /2*(2*r)>1/2*(2*p) by XREAL_1:68;
  hence thesis by A4;
end;
