reserve k,m,n for Nat,
  i1,i2,i3 for Integer,
  e for set;
reserve i,k,m,n,p,x,y for Nat;
reserve a for Tuple of n,(k-SD);

theorem
  for n st n >= 1
  for m st m is_represented_by n,k holds m = SDDec(DecSD(m,n,k))
proof
  let n;
  defpred P[Nat] means for m st m is_represented_by $1,k holds m = SDDec(DecSD
  (m,$1,k));
A1: for u be Nat st u >= 1 & P[u] holds P[u+1]
  proof
    let u be Nat;
    assume that
    u >= 1 and
A2: P[u];
    p is_represented_by (u+1),k implies p = SDDec(DecSD(p,(u+1),k))
    proof
      set I = u + 1;
      set R = Radix(k) |^ u;
      set M = p mod R;
      set N = R*(p div R);
A3:   I -' 1 = u by NAT_D:34;
A4:   u+1 <= len (DigitSD(DecSD(p,(u+1),k))) by CARD_1:def 7;
A5:   1 <= u+1 by NAT_1:12;
      then
A6:   u+1 in Seg (u+1) by FINSEQ_1:1;
      assume p is_represented_by (u+1),k;
      then p < Radix(k) |^ (u+1);
      then p div R = DigitDC(p,(u+1),k) by A3,NAT_D:24;
      then
A7:   N = SubDigit(DecSD(p,(u+1),k),(u+1),k) by A3,A6,Def9
        .= (DigitSD(DecSD(p,(u+1),k)))/.(u+1) by A6,Def6
        .= DigitSD(DecSD(p,(u+1),k)).(u+1) by A4,FINSEQ_4:15,NAT_1:12;
A8:   DigitSD(DecSD(M,u,k))^<*N*> = DigitSD(DecSD(p,(u+1),k))
      proof
        N is Element of INT by INT_1:def 2;
        then reconsider z1 = <*N*> as FinSequence of INT by FINSEQ_1:74;
        reconsider DD = DigitSD(DecSD(p,(u+1),k)) as FinSequence of INT;
        set z0 = DigitSD(DecSD(M,u,k));
        reconsider z = z0^z1 as FinSequence of INT;
A9:     len z = len (DigitSD(DecSD(M,u,k))) + len <*N*> by FINSEQ_1:22
          .= u + len <*N*> by CARD_1:def 7
          .= u + 1 by FINSEQ_1:39;
A10:    for i be Nat st 1 <= i & i <= len z holds z/.i = DD/.i
        proof
          let i be Nat;
          assume 1 <= i & i <= len z;
          then
A11:      i in Seg (u+1) by A9,FINSEQ_1:1;
          per cases by A11,FINSEQ_2:7;
          suppose
A12:        i in Seg u;
A13:        M mod (Radix(k) |^ i) = p mod (Radix(k) |^ i)
            proof
              i <= u by A12,FINSEQ_1:1;
              then Radix(k) |^ i divides Radix(k) |^ u by NEWTON:89;
              then consider t being Nat such that
A14:          Radix(k) |^ u = (Radix(k) |^ i)*t by NAT_D:def 3;
              Radix(k) <> 0 by POWER:34;
              then t <> 0 by A14,PREPOWER:5;
              hence thesis by A14,Th3;
            end;
A15:        i in dom (z0^z1) by A9,A11,FINSEQ_1:def 3;
            len DD = u+1 by CARD_1:def 7;
            then
A16:        i in dom DD by A11,FINSEQ_1:def 3;
            then
A17:        DD.i = DD/.i by PARTFUN1:def 6;
A18:        DD.i = (DigitSD(DecSD(p,(u+1),k)))/.i by A16,PARTFUN1:def 6
              .= SubDigit(DecSD(p,(u+1),k),i,k) by A11,Def6
              .= (Radix(k) |^ (i -'1))*DigitDC(p,i,k) by A11,Def9
              .= (Radix(k) |^ (i -'1))*((p mod (Radix(k) |^ i)) div (Radix(k
            ) |^ (i -'1)));
            len z0 = u by CARD_1:def 7;
            then
A19:        i in dom z0 by A12,FINSEQ_1:def 3;
            then (z0^z1).i = DigitSD(DecSD(M,u,k)).i by FINSEQ_1:def 7
              .= (DigitSD(DecSD(M,u,k)))/.i by A19,PARTFUN1:def 6
              .= SubDigit(DecSD(M,u,k),i,k) by A12,Def6
              .= (Radix(k) |^ (i -'1))*DigitDC(M,i,k) by A12,Def9
              .= (Radix(k) |^ (i -'1))*((p mod (Radix(k) |^ i)) div (Radix(k
            ) |^ (i -'1))) by A13;
            hence thesis by A18,A17,A15,PARTFUN1:def 6;
          end;
          suppose
A20:        i = u+1;
            hence z/.i = z.(u+1) by A5,A9,FINSEQ_4:15
              .= (z0^z1).(len z0 + 1) by CARD_1:def 7
              .= DigitSD(DecSD(p,(u+1),k)).(u+1) by A7,FINSEQ_1:42
              .= DD/.i by A4,A20,FINSEQ_4:15,NAT_1:12;
          end;
        end;
        len DD = u+1 by CARD_1:def 7;
        hence thesis by A9,A10,FINSEQ_5:13;
      end;
      Radix(k) <> 0 by POWER:34;
      then
A21:  R <> 0 by PREPOWER:5;
      then M < R by NAT_D:1;
      then
A22:  M is_represented_by u,k;
      p = R*(p div R) + (p mod R) by A21,NAT_D:2;
      then p = SDDec(DecSD(M,u,k)) + N by A2,A22;
      hence thesis by A8,RVSUM_1:74;
    end;
    hence thesis;
  end;
A23: P[1]
  proof
    let m;
    assume
A24: m is_represented_by 1,k;
    reconsider i = m as Element of REAL by XREAL_0:def 1;
    reconsider M = <*i*> as FinSequence of REAL;
A25: 1 in Seg 1 by FINSEQ_1:1;
    SubDigit(DecSD(m,1,k),1,k) = (Radix(k) |^ 0)*DigB(DecSD(m,1,k),1) by
XREAL_1:232
      .= 1*DigB(DecSD(m,1,k),1) by NEWTON:4
      .= m by A24,Th20;
    then (DigitSD(DecSD(m,1,k)))/.1 = m by A25,Def6;
    hence SDDec(DecSD(m,1,k)) = Sum M by Th16
    .= m by FINSOP_1:11;
  end;
  for u be Nat st u >= 1 holds P[u] from NAT_1:sch 8(A23,A1);
  hence thesis;
end;
