reserve a,b for R_eal;
reserve A,B for Interval;

theorem
  for I being interval Subset of REAL holds
  I is open_interval or I is closed_interval or
  I is right_open_interval or I is left_open_interval
    proof let I be interval Subset of REAL;
      per cases;
      suppose
A1:     I is left_end right_end;
        reconsider a = inf I,b = sup I as R_eal;
A2:     a in I & I = [.a,b.] by A1,XXREAL_2:75,def 5;
        thus thesis by A1,A2;
      end;
      suppose
A3:     I is non left_end right_end;
        set a = inf I, b = sup I;
A4:     I = ].a,b.] by A3,XXREAL_2:76;
A5:     b in I by A3,XXREAL_2:def 6;
        thus thesis by A5,A4;
      end;
      suppose
A6:     I is left_end non right_end;
        set a = inf I, b = sup I;
A7:     I = [.a,b.[ by A6,XXREAL_2:77;
A8:     a in I by A6,XXREAL_2:def 5;
        thus thesis by A8,A7;
      end;
      suppose
        I is non left_end non right_end;
        then consider a,b being ExtReal such that
A9:    a <= b and
A10:    I = ].a,b.[ by XXREAL_2:79;
        reconsider a,b as R_eal by XXREAL_0:def 1;
        a <= b by A9;
        hence thesis by A10;
      end;
    end;
