reserve m, n for non zero Element of NAT;
reserve i, j, k for Element of NAT;
reserve Z for Subset of REAL 2;
reserve c for Real;
reserve I for non empty FinSequence of NAT;
reserve d1, d2 for Element of REAL;

theorem LM412:
  for A, B, e be Real, f be Function of REAL,REAL
  st for x be Real holds f.x = A*cos.(e*x) + B*sin.(e*x)
  holds f is_differentiable_on [#]REAL &
  for x be Real holds (f`| [#]REAL).x = -e*(A*sin.(e*x) - B*cos.(e*x))
  proof
    let A, B, e be Real, f be Function of REAL,REAL;
    assume
    AS1: for x be Real holds f.x = A*cos.(e*x) + B*sin.(e*x);
    reconsider
    f1 = A(#)(cos*(e(#)(id [#]REAL))), f2 = B(#)(sin*(e(#)(id [#]REAL)))
    as PartFunc of REAL,REAL;
    reconsider Z = [#]REAL as open Subset of REAL;
    reconsider E = e(#)(id [#]REAL) as Function of REAL,REAL;
    P00: [#]REAL = dom E & rng E c= [#]REAL by FUNCT_2:def 1;
    E01: for x being Real st x in Z holds E.x = e*x
    proof
      let x be Real;
      assume
      AS2: x in Z;
      hence E.x = e*(id [#]REAL).x by VALUED_1:def 5, P00
      .=e*x by AS2, FUNCT_1:18;
    end;
    P4: dom(f1 + f2) = Z by FUNCT_2:def 1;
    P01: dom f1 = Z by FUNCT_2:def 1;
    dom f2 = Z by FUNCT_2:def 1;
    then
    P6: dom f = dom f1 /\ dom f2 by FUNCT_2:def 1, P01;
    for x be object st x in dom f holds f.x = (f1.x) + (f2.x)
    proof
      let x be object;
      assume P50: x in dom f;
      then reconsider r=x as Real;
      thus f.x = A*cos.(e*r) + B*sin.(e*r) by AS1
      .= A*cos.(E.r) + B*sin.(e*r) by E01, P50
      .= A*cos.(E.r) + B*sin.(E.r) by E01, P50
      .= A*(cos*E).r + B*sin.(E.r) by FUNCT_1:13, P50, P00
      .= A*(cos*E).r + B*(sin*E).r by FUNCT_1:13, P50, P00
      .= f1.r + B*(sin*E).r by VALUED_1:6
      .= f1.x + f2.x by VALUED_1:6;
    end; then
    P1: f = f1+f2 by P6,VALUED_1:def 1;
    P2: f1 is_differentiable_on [#]REAL &
    for x being Real st x in [#]REAL holds
    (f1 `| [#]REAL).x = - A*e *sin.(e*x) by LM410;
    P3: f2 is_differentiable_on [#]REAL &
    for x being Real st x in [#]REAL holds (f2 `| [#]REAL).x = B*e *cos.(e*x)
    by LM411;
    for x be Real holds (f`| [#]REAL).x = -e*(A*sin.(e*x) - B*cos.(e*x))
    proof
      let x be Real;
      P60: x in Z by XREAL_0:def 1;
      (f `| Z).x = (diff(f1,x)) + (diff(f2,x))
      by XREAL_0:def 1, FDIFF_1:18, P1, P2, P3, P4
      .= (f1 `| [#]REAL).x + (diff(f2,x)) by P2, P60, FDIFF_1:def 7
      .= (f1 `| [#]REAL).x + (f2 `| [#]REAL).x by P3, P60, FDIFF_1:def 7
      .= -e*A*sin.(e*x) + (f2 `| [#]REAL).x by LM410, XREAL_0:def 1
      .= -e*(A*sin.(e*x)) + B*e*cos.(e*x) by LM411, XREAL_0:def 1
      .= -e*(A*sin.(e*x) - B*cos.(e*x));
      hence thesis;
    end;
    hence thesis by FDIFF_1:18, P1, P2, P3, P4;
end;
