reserve x,y,z,w for ExtReal,
  r for Real;
reserve f,g for ExtReal;

theorem
  not ( x = +infty & y = -infty or x = -infty & y = +infty or y = +infty
& z = +infty or y = -infty & z = -infty ) & x + y <= z implies y <> +infty & x
  <= z - y
proof
  assume that
A1: not ( x=+infty & y=-infty or x=-infty & y=+infty or y = +infty & z =
  +infty or y = -infty & z = -infty ) and
A2: x + y <= z;
  thus y <> +infty
  proof
    assume
A3: y = +infty;
    then x + y = +infty by A1,Def2;
    hence contradiction by A1,A2,A3,XXREAL_0:4;
  end;
  per cases;
  suppose
    z = +infty;
    then z - y = +infty by A1,Th13;
    hence thesis by XXREAL_0:4;
  end;
  suppose
A4: z <> +infty;
    then
A5: x + y < +infty by A2,XXREAL_0:2,4;
    then
A6: x <> +infty by A1,Def2;
A7: y <> +infty by A1,A5,Def2;
    per cases;
    suppose
      x = -infty;
      hence thesis by XXREAL_0:5;
    end;
    suppose
      x <> -infty;
      then x in REAL by A6,XXREAL_0:14;
      then reconsider a = x as Real;
      per cases;
      suppose
        y = -infty;
        then z - y = +infty by A1,Th14;
        hence thesis by XXREAL_0:4;
      end;
      suppose
        y <> -infty;
        then y in REAL by A7,XXREAL_0:14;
        then reconsider b = y as Real;
        a+b in REAL by XREAL_0:def 1;
        then z <> -infty by A2,XXREAL_0:12;
        then z in REAL by A4,XXREAL_0:14;
        then reconsider c = z as Real;
        x + y = a + b;
        then a <= c - b by A2,XREAL_1:19;
        hence thesis;
      end;
    end;
  end;
end;
