reserve k, k1, n, n1, m for Nat;
reserve X, y for set;
reserve p for Real;
reserve r for Real;
reserve a, a1, a2, b, b1, b2, x, x0, z, z0 for Complex;
reserve s1, s3, seq, seq1 for Complex_Sequence;
reserve Y for Subset of COMPLEX;
reserve f, f1, f2 for PartFunc of COMPLEX,COMPLEX;
reserve Nseq for increasing sequence of NAT;
reserve h for 0-convergent non-zero Complex_Sequence;
reserve c for constant Complex_Sequence;
reserve R, R1, R2 for C_RestFunc;
reserve L, L1, L2 for C_LinearFunc;
reserve Z for open Subset of COMPLEX;

theorem
  Z c= dom f & f|Z is constant implies f is_differentiable_on Z & for x
  st x in Z holds (f`|Z)/.x = 0c
proof
  reconsider cf = COMPLEX --> 0c as Function of COMPLEX,COMPLEX;
  set R = cf;
  now
    let h;
    now
      let n be Nat;
A2:   n in NAT & rng h c= dom R by ORDINAL1:def 12;
      thus ((h")(#)(R/*h)).n = (h".n)*((R/*h).n) by VALUED_1:5
        .= (h".n)*(R/.(h.n)) by A2,FUNCT_2:109
        .= (h".n)*0c
        .= 0c;
    end;
    then (h")(#)(R/*h) is constant & ((h")(#)(R/*h)).0 = 0c by VALUED_0:def 18;
    hence (h")(#)(R/*h) is convergent & lim ((h")(#)(R/*h)) = 0c by CFCONT_1:26
,27;
  end;
  then reconsider R as C_RestFunc by Def3;
  set L = cf;
  for x holds L/.x = 0c*x
   by XCMPLX_0:def 2,FUNCOP_1:7;
  then reconsider L as C_LinearFunc by Def4;
  assume that
A3: Z c= dom f and
A4: f|Z is constant;
  consider a1 being Element of COMPLEX  such that
A5: for x being Element of COMPLEX st x in Z/\dom f holds f/.x = a1
      by A4,PARTFUN2:35;
A6: now
    let x0;
    assume
A7: x0 in Z;
    then consider N being Neighbourhood of x0 such that
A8: N c= Z by Th9;
A9: N c= dom f by A3,A8;
A10: x0 in Z/\dom f by A3,A7,XBOOLE_0:def 4;
    for x st x in N holds f/.x-f/.x0 = L/.(x-x0)+R/.(x-x0)
    proof
      let x;
A11: x - x0 in COMPLEX by XCMPLX_0:def 2;
      assume x in N;
      then x in Z/\dom f by A8,A9,XBOOLE_0:def 4;
      hence f/.x-f/.x0 = a1-f/.x0 by A5
        .= a1-a1 by A5,A10
        .= L/.(x-x0)+0c by FUNCOP_1:7,A11
        .= L/.(x-x0)+R/.(x-x0) by FUNCOP_1:7,A11;
    end;
    hence f is_differentiable_in x0 by A9;
  end;
  hence
A12: f is_differentiable_on Z by A3,Th15;
  let x0;
  assume
A13: x0 in Z;
  then consider N being Neighbourhood of x0 such that
A14: N c= Z by Th9;
A15: N c= dom f by A3,A14;
A16: x0 in Z/\dom f by A3,A13,XBOOLE_0:def 4;
A17: for x st x in N holds f/.x-f/.x0 = L/.(x-x0)+R/.(x-x0)
  proof
    let x;
A18: x - x0 in COMPLEX by XCMPLX_0:def 2;
    assume x in N;
    then x in Z/\dom f by A14,A15,XBOOLE_0:def 4;
    hence f/.x-f/.x0 = a1-f/.x0 by A5
      .= a1-a1 by A5,A16
      .= L/.(x-x0)+0c by FUNCOP_1:7,A18
      .= L/.(x-x0)+R/.(x-x0) by FUNCOP_1:7,A18;
  end;
A19: f is_differentiable_in x0 by A6,A13;
  thus (f`|Z)/.x0 = diff(f,x0) by A12,A13,Def12
    .= L/.1r by A19,A15,A17,Def7
    .= 0c;
end;
