reserve a,b,i,j,k,l,m,n for Nat;

theorem INT436:
  for f be INT-valued FinSequence, a be Integer st
    (for n be Nat st n in dom f holds a divides f.n) holds
  a divides Sum f
  proof
    let f be INT-valued FinSequence, a be Integer such that
    A1: for n be Nat st n in dom f holds a divides f.n;
    reconsider f1 = f as FinSequence of REAL by NEWTON02:103;
    f1.(min_p f1) in INT by INT_1:def 2; then
    reconsider k = min f1 as Integer by RFINSEQ2:def 4;
    reconsider f2 = f as FinSequence of COMPLEX by NEWTON02:103;
    reconsider g = f2 - k as FinSequence of INT by NEWTON02:103;
    reconsider g as FinSequence of NAT by NEWTON02:103;
    |.a.| in INT & |.a.|>=0 by INT_1:def 2; then
    reconsider l = |.a.| as Nat;
    A1a: a divides k
    proof
      per cases;
      suppose
        B1: (min_p f1) in dom f1;
        reconsider x = min_p f1 as Nat;
        a divides f.x by B1,A1;
        hence thesis by RFINSEQ2:def 4;
      end;
      suppose not min_p f1 in dom f1; then
        0 = f1.(min_p f1)  by FUNCT_1:def 2
        .= k by RFINSEQ2:def 4;
        hence thesis by INT_2:12;
      end;
    end;
    m in dom g implies l divides g.m
    proof
      assume
      B1: m in dom g;
      B2: m in dom (f2+-k) by B1,VALUED_1:def 3; then
      m in dom f by VALUED_1:def 2; then
      a divides f.m & a divides -k by A1,A1a,INT_2:10; then
      a divides f.m + -k by WSIERP_1:4; then
      a divides (f+-k).m by B2,VALUED_1:def 2; then
      a divides (f-k).m by VALUED_1:def 3;
      hence thesis by WSIERP_1:13;
    end; then
    A2: a divides Sum g by INT_4:36,WSIERP_1:13;
    A3: a divides k*(len g) by A1a,INT_2:2;
    reconsider g as FinSequence of COMPLEX by NEWTON02:103;
    Sum (g+k) = Sum g + k*(len g) by SFX;
    hence thesis by A2,A3,WSIERP_1:4;
  end;
