reserve y for set,
  x,a,b for Real,
  n for Element of NAT,
  Z for open Subset of REAL,
  f,f1,f2,g for PartFunc of REAL,REAL;

theorem
  Z c= dom (f1/f2) & (for x st x in Z holds f1.x=a+x & f2.x=a-x & f2.x<>
0) implies (f1/f2) is_differentiable_on Z & for x st x in Z holds ((f1/f2)`|Z).
  x = (2*a)/(a-x)^2
proof
  assume that
A1: Z c= dom (f1/f2) and
A2: for x st x in Z holds f1.x=a+x & f2.x=a-x & f2.x<>0;
A3: Z c= dom f1 /\ (dom f2 \ f2"{0}) by A1,RFUNCT_1:def 1;
  then
A4: Z c= dom f1 by XBOOLE_1:18;
A5: for x st x in Z holds f1.x=1*x+a by A2;
  then
A6: f1 is_differentiable_on Z by A4,FDIFF_1:23;
A7: for x st x in Z holds f2.x =(-1)*x+a
  proof
    let x;
    assume x in Z;
    then f2.x =a-x by A2;
    hence thesis;
  end;
A8: Z c= dom f2 by A3,XBOOLE_1:1;
  then
A9: f2 is_differentiable_on Z by A7,FDIFF_1:23;
A10: for x st x in Z holds f2.x <> 0 by A2;
  then
A11: f1/f2 is_differentiable_on Z by A6,A9,FDIFF_2:21;
  for x st x in Z holds ((f1/f2)`|Z).x = (2*a)/(a-x)^2
  proof
    let x;
    assume
A12: x in Z;
    then
A13: f2.x <>0 by A2;
A14: f1.x=a+x & f2.x=a-x by A2,A12;
    f1 is_differentiable_in x & f2 is_differentiable_in x by A6,A9,A12,
FDIFF_1:9;
    then diff(f1/f2,x) =(diff(f1,x) * f2.x - diff(f2,x) * f1.x)/(f2.x)^2 by A13
,FDIFF_2:14
      .=((f1`|Z).x * f2.x-diff(f2,x) * f1.x)/(f2.x)^2 by A6,A12,FDIFF_1:def 7
      .= ((f1`|Z).x * f2.x-(f2`|Z).x * f1.x)/(f2.x)^2 by A9,A12,FDIFF_1:def 7
      .=(1* f2.x-(f2`|Z).x * f1.x)/(f2.x)^2 by A4,A5,A12,FDIFF_1:23
      .=(1* f2.x-(-1)* f1.x)/(f2.x)^2 by A8,A7,A12,FDIFF_1:23
      .=(2*a)/(a-x)^2 by A14;
    hence thesis by A11,A12,FDIFF_1:def 7;
  end;
  hence thesis by A6,A9,A10,FDIFF_2:21;
end;
