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

theorem :: extension of REAL_1:27
  not (x = +infty & y = +infty) & not (x = -infty & y = -infty) & not (y
= +infty & z = -infty) & not (y = -infty & z = +infty) & not (x = +infty & z =
  +infty) & not (x = -infty & z = -infty) implies x - y - z = x - (y + z)
proof
  assume that
A1: not(x=+infty & y=+infty) and
A2: not(x=-infty & y=-infty) and
A3: not (y = +infty & z = -infty) and
A4: not (y = -infty & z = +infty) and
A5: not (x = +infty & z = +infty) and
A6: not (x = -infty & z = -infty);
  per cases;
  suppose
A7: x = +infty;
    then x - y = +infty by A1,Th13;
    then
A8: x - y - z = +infty by A5,A7,Th13;
    y + z <> +infty by A1,A5,A7,Lm8;
    hence thesis by A7,A8,Th13;
  end;
  suppose
A9: x = -infty;
    then x - y = -infty by A2,Th14;
    then
A10: x - y - z = -infty by A6,A9,Th14;
    y + z <> -infty by A2,A6,A9,Lm9;
    hence thesis by A9,A10,Th14;
  end;
  suppose
A11: x <> +infty & x <> -infty;
    then x in REAL by XXREAL_0:14;
    then reconsider a = x as Real;
    per cases;
    suppose
A12:  y = +infty;
      then x - y = -infty & y + z = +infty by A3,A11,Def2,Th13;
      hence thesis by A3,A12,Th14;
    end;
    suppose
A13:  y = -infty;
      then x - y = +infty & y + z = -infty by A4,A11,Def2,Th14;
      hence thesis by A4,A13,Th13;
    end;
    suppose
      y <> +infty & y <> -infty;
      then y in REAL by XXREAL_0:14;
      then reconsider b = y as Real;
A14:  x - y = a - b;
      per cases;
      suppose
        z = +infty;
        then x - y - z = -infty & y + z = +infty by A14,Def2,Th13;
        hence thesis by A11,Th13;
      end;
      suppose
        z = -infty;
        then x - y - z = +infty & y + z = -infty by A14,Def2,Th14;
        hence thesis by A11,Th14;
      end;
      suppose
        z <> +infty & z <> -infty;
        then z in REAL by XXREAL_0:14;
        then reconsider c = z as Real;
        x - y - z = a - b - c & x - (y + z) = a - (b + c);
        hence thesis;
      end;
    end;
  end;
end;
